RISC-V/V203/hello/linux/print.cpp

25 lines
569 B
C++
Raw Normal View History

2024-08-17 14:27:07 +02:00
#include <cstdio>
2024-08-17 20:59:36 +02:00
#include <mutex>
2024-08-17 14:27:07 +02:00
#include "utils.h"
2024-08-17 20:59:36 +02:00
2024-08-17 14:27:07 +02:00
void print_morse_table (const TABLE<unsigned char, 64> & tab) {
int n = 0;
printf("static const unsigned char compressed_table [] = {");
for (auto & e: tab) {
2024-08-17 20:59:36 +02:00
if ((n % 16) == 0) printf("\n ");
2024-08-17 14:27:07 +02:00
printf("0x%02x,", e);
n++;
}
printf("\n};\n");
}
void print_sinus_table (const TABLE<unsigned short, 256> & tab) {
int n = 0;
printf("static const uint16_t sin_tab [] = {");
for (auto & e: tab) {
if ((n % 16) == 0) printf("\n");
printf("%5du,", e);
n++;
}
printf("\n};\n");
}