Добавить общие графики, декодер KONOR и порт STM32 bxCAN

This commit is contained in:
2026-09-04 12:22:17 +03:00
parent af82687e42
commit e163d9ba55
51 changed files with 5040 additions and 15 deletions

View File

@@ -0,0 +1,22 @@
#include "set_spectrum.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
int main(void)
{
double times[32], values[32], output[18], meta[3];
for (size_t i = 0; i < 32; ++i) { times[i] = (double)i / 32; values[i] = sin(2 * 3.14159265358979323846 * 4 * times[i]); }
output[17] = 12345;
assert(set_spectrum_analyze(times, values, 32, 32, SET_WINDOW_HANN, 0, 0, 0, 1, output, 17, meta) == SET_SPECTRUM_OK);
assert(meta[0] == 32 && meta[1] == 32);
assert(fabs(output[4] - 1.0) < 1e-12 && output[17] == 12345);
assert(set_spectrum_analyze(times, values, 32, 32, 0, 0, 0, 0, 1, output, 16, meta) == SET_SPECTRUM_INVALID);
assert(set_spectrum_analyze(times, values, 15, 32, 0, 0, 0, 0, 1, output, 17, meta) == SET_SPECTRUM_SHORT);
assert(set_spectrum_analyze(times, values, 32, 32, 0, 99, 0, 0, 1, output, 17, meta) == SET_SPECTRUM_INVALID);
assert(set_spectrum_analyze(times, values, 32, 32, 0, SET_FILTER_LOW_PASS, 0, 16, 1, output, 17, meta) == SET_SPECTRUM_CUTOFF);
times[12] = times[11];
assert(set_spectrum_analyze(times, values, 32, 32, 0, 0, 0, 0, 1, output, 17, meta) == SET_SPECTRUM_TIMING);
puts("shared spectrum: OK");
return 0;
}