generated from hulk/gd32e23x_template_cmake_vscode
release dev branch
This commit is contained in:
46
Src/main.c
46
Src/main.c
@@ -36,7 +36,11 @@ OF SUCH DAMAGE.
|
||||
#include "systick.h"
|
||||
#include "uart.h"
|
||||
#include "led.h"
|
||||
#include "command.h"
|
||||
#include <stdio.h>
|
||||
#include "i2c.h"
|
||||
#include "board_config.h"
|
||||
#include "ldc1612.h"
|
||||
|
||||
/*!
|
||||
\brief main function
|
||||
@@ -46,17 +50,43 @@ OF SUCH DAMAGE.
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
systick_config();
|
||||
uart0_init(115200);
|
||||
// uart1_init(115200); // 如需使用USART1请初始化
|
||||
|
||||
// printf("Hello USART0!\r\n");
|
||||
// uart_set_printf_port(UART_PRINTF_USART1); // 切换printf到USART1
|
||||
// uart_set_printf_port(UART_PRINTF_BOTH); // 同时输出到USART0和USART1
|
||||
setbuf(stdout, NULL);
|
||||
systick_config();
|
||||
rs485_init();
|
||||
|
||||
led_init();
|
||||
|
||||
#ifdef DEBUG_VERBOSE
|
||||
char hello_world[] = {"Hello World!\r\n"};
|
||||
|
||||
for (uint8_t i = 0; i < sizeof(hello_world); i++)
|
||||
{
|
||||
while (usart_flag_get(RS485_PHY, USART_FLAG_TBE) == RESET) {}
|
||||
usart_data_transmit(RS485_PHY, hello_world[i]);
|
||||
}
|
||||
|
||||
while (usart_flag_get(RS485_PHY, USART_FLAG_TC) == RESET) {}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
i2c_config();
|
||||
|
||||
#ifdef DEBUG_VERBOSE
|
||||
i2c_scan();
|
||||
|
||||
i2c_bus_reset();
|
||||
#endif
|
||||
|
||||
ldc1612_init();
|
||||
ldc1612_config_single_channel(CHANNEL_0);
|
||||
|
||||
while(1){
|
||||
led_toggle();
|
||||
delay_ms(200);
|
||||
command_process();
|
||||
delay_ms(10);
|
||||
if (g_sensor_report_enabled) {
|
||||
eddy_current_report();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user