29 lines
662 B
C++
29 lines
662 B
C++
#include <cstdio>
|
|
#include <mutex>
|
|
#include "utils.h"
|
|
static std::mutex Mutex;
|
|
|
|
void print_morse_table (const TABLE<unsigned char, 64> & tab) {
|
|
Mutex.lock();
|
|
int n = 0;
|
|
printf("static const unsigned char compressed_table [] = {");
|
|
for (auto & e: tab) {
|
|
if ((n % 16) == 0) printf("\n ");
|
|
printf("0x%02x,", e);
|
|
n++;
|
|
}
|
|
printf("\n};\n");
|
|
Mutex.unlock();
|
|
}
|
|
void print_sinus_table (const TABLE<unsigned short, 256> & tab) {
|
|
Mutex.lock();
|
|
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");
|
|
Mutex.unlock();
|
|
}
|