generated from hulk/gd32e23x_template_cmake_vscode
emmm
This commit is contained in:
parent
4a488429bf
commit
1c3c688cc2
@ -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
|
||||||
|
@ -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 的接收缓冲区有数据时,触发该中断
|
||||||
|
** 该中断为只读中断,不需要手动清除
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
|
*/
|
||||||
}
|
}
|
@ -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
|
||||||
|
29
Src/uart.c
29
Src/uart.c
@ -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;
|
|
||||||
// }
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user