-
Notifications
You must be signed in to change notification settings - Fork 0
/
cdh_monolithic.c
41 lines (35 loc) · 1022 Bytes
/
cdh_monolithic.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
// cdh_monolithic.c
// TAB C Example CDH Monolithic
//
// Written by Bradley Denby
// Other contributors: Alok Anand
//
// See the top-level LICENSE file for the license.
// Standard library headers
#include <stddef.h> // size_t
#include <stdint.h> // uint8_t, uint32_t
// Board-specific header
#include <cdh.h> // CDH header
// TAB header
#include <tab.h> // TAB header
// Main
int main(void) {
// MCU initialization
//added HSE clock initialisation and disabling internal PLL clock
//init_clock();
init_clock_hse();
init_uart();
// TAB initialization
rx_cmd_buff_t rx_cmd_buff = {.size=CMD_MAX_LEN};
clear_rx_cmd_buff(&rx_cmd_buff);
tx_cmd_buff_t tx_cmd_buff = {.size=CMD_MAX_LEN};
clear_tx_cmd_buff(&tx_cmd_buff);
// TAB loop
while(1) {
rx_usart1(&rx_cmd_buff); // Collect command bytes
reply(&rx_cmd_buff, &tx_cmd_buff); // Command reply logic
tx_usart1(&tx_cmd_buff); // Send a response if any
}
// Should never reach this point
return 0;
}