This commit is contained in:
2025-08-19 22:46:27 +08:00
parent 9e6333dca8
commit 552984ef2a
20 changed files with 1995 additions and 182 deletions

View File

@@ -36,7 +36,12 @@ 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"
#include "tmp112.h"
/*!
\brief main function
@@ -46,17 +51,35 @@ 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
while(1){
led_toggle();
delay_ms(200);
command_process();
delay_ms(10);
}
}