This commit is contained in:
yelvlab 2025-08-11 20:59:22 +08:00
parent 4a488429bf
commit 1c3c688cc2
4 changed files with 8 additions and 39 deletions

View File

@ -12,6 +12,5 @@ typedef enum {
} uart_printf_port_t; } uart_printf_port_t;
void rs485_init(void); void rs485_init(void);
// void uart_set_printf_port(uart_printf_port_t port);
#endif // UART_H #endif // UART_H

View File

@ -103,4 +103,12 @@ void USART0_IRQHandler(void) {
uint8_t data = usart_data_receive(USART0); uint8_t data = usart_data_receive(USART0);
uart_rx_put(data); uart_rx_put(data);
} }
/* 处理 USART0 中断
** USART_INT_FLAG_RBNE
** USART0
**
**
**
**
*/
} }

View File

@ -37,15 +37,6 @@ OF SUCH DAMAGE.
#include "uart.h" #include "uart.h"
#include "led.h" #include "led.h"
#include <stdio.h> #include <stdio.h>
#include "board_config.h"
#include "uart_ring_buffer.h"
#include "command.h"
void uart_puts(const char *s) {
while (*s) {
usart_data_transmit(RS485_PHY, (uint8_t)*s++);
}
}
/*! /*!
\brief main function \brief main function

View File

@ -70,32 +70,3 @@ void rs485_init(void) {
#endif // RS485_MAX13487 #endif // RS485_MAX13487
} }
// static uart_printf_port_t g_printf_port = UART_PRINTF_USART0;
// void uart_set_printf_port(uart_printf_port_t port) {
// g_printf_port = port;
// }
// // printf 重定向,支持多串口
// int __io_putchar(int ch) {
// switch (g_printf_port) {
// case UART_PRINTF_USART0:
// while (usart_flag_get(USART0, USART_FLAG_TBE) == RESET) {}
// usart_data_transmit(USART0, (uint8_t)ch);
// break;
// case UART_PRINTF_USART1:
// while (usart_flag_get(USART1, USART_FLAG_TBE) == RESET) {}
// usart_data_transmit(USART1, (uint8_t)ch);
// break;
// case UART_PRINTF_BOTH:
// while (usart_flag_get(USART0, USART_FLAG_TBE) == RESET) {}
// usart_data_transmit(USART0, (uint8_t)ch);
// while (usart_flag_get(USART1, USART_FLAG_TBE) == RESET) {}
// usart_data_transmit(USART1, (uint8_t)ch);
// break;
// default:
// break;
// }
// return ch;
// }