-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
55 lines (45 loc) · 1.11 KB
/
test.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
//Basic Test
#include "keep_alive_checker.h"
#include "keep_alive_platform.h"
#include "stdio.h"
#include "stdlib.h"
static void uart_tx_platform_specific(const uint8_t* data, uint8_t size)
{
for (int i = 0; i < 12; ++i)
{
printf("\r\n data[%d] = %d", i, data[i]);
}
}
void fault_handle(void* self)
{
printf("fault cb");
}
int main()
{
struct keep_alive_platform_t* kap = new_platform();
platform_ctr(kap, 5000, uart_tx_platform_specific, fault_handle);
static uint8_t buf[11] = {
0x01, //start of frame
0x02, //opcde
0x00, 0x00, 0x00, 0x00, //rx_cnt
0x00, 0x00, 0x00, 0x00, //tx_cnt
0x21, //end of frame
};
add_buf_and_parse(kap, buf);
add_buf_and_parse(kap, buf);
/*
platform_systick(kap);
platform_systick(kap);
platform_systick(kap);
platform_systick(kap);
platform_systick(kap);
platform_systick(kap);
platform_systick(kap);
platform_systick(kap);
platform_systick(kap);
*/
uint32_t ct = get_tx(kap);
printf("\r\n ct = %d", ct);
platform_dtr(kap);
free(kap);
}