-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_wspr.c
58 lines (48 loc) · 1.54 KB
/
test_wspr.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef MSP430
#include <stdio.h>
#include <inttypes.h>
#include "wspr.h"
int main(void) {
struct wspr_message msg;
int i;
int errors = 0;
uint8_t validation[162] = {
3, 3, 0, 0, 2, 0, 0, 0, 1, 0, 2, 0, 1, 3, 1, 2, 2, 2, 1, 0, 0, 3, 2, 3, 1, 3, 3, 2, 2, 0,
2, 0, 0, 0, 3, 2, 0, 1, 2, 3, 2, 2, 0, 0, 2, 2, 3, 2, 1, 1, 0, 2, 3, 3, 2, 1, 0, 2, 2, 1,
3, 2, 1, 2, 2, 2, 0, 3, 3, 0, 3, 0, 3, 0, 1, 2, 1, 0, 2, 1, 2, 0, 3, 2, 1, 3, 2, 0, 0, 3,
3, 2, 3, 0, 3, 2, 2, 0, 3, 0, 2, 0, 2, 0, 1, 0, 2, 3, 0, 2, 1, 1, 1, 2, 3, 3, 0, 2, 3, 1,
2, 1, 2, 2, 2, 1, 3, 3, 2, 0, 0, 0, 0, 1, 0, 3, 2, 0, 1, 3, 2, 2, 2, 2, 2, 0, 2, 3, 3, 2,
3, 2, 3, 3, 2, 0, 0, 3, 1, 2, 2, 2
};
msg.callsign[0] = ' ';
msg.callsign[1] = 'K';
msg.callsign[2] = '1';
msg.callsign[3] = 'A';
msg.callsign[4] = 'B';
msg.callsign[5] = 'C';
msg.locator[0] = 'F';
msg.locator[1] = 'N';
msg.locator[2] = '4';
msg.locator[3] = '2';
msg.power = 37;
wspr_encode(&msg);
for (i = 0; i < WSPR_NUM_SYMBOLS; i++) {
if (i % 30 == 0)
printf("\n");
printf("%d ", msg.tx_symbol_buffer[i]);
}
printf("\n\n");
for (i = 0; i < WSPR_NUM_SYMBOLS; i++) {
if (msg.tx_symbol_buffer[i] != validation[i]) {
printf("Symbol error at index %d\n", i);
errors++;
}
}
if (errors == 0) {
printf("Tests successful!\n");
} else {
printf("Tests finished with %d errors.\n", errors);
}
printf("\n");
}
#endif