| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /**
- * @file usart.h
- * @author chenjun (chenjun@radareye.com.cn)
- * @brief
- * @version 0.1
- * @date 2024-04-22
- *
- * @copyright Copyright (c) 2024
- *
- */
- #ifndef __USART_H__
- #define __USART_H__
- #define UART2_PORT (GPIOA)
- #define UART2_TX_PIN (GPIO_PIN_2)
- #define UART2_RX_PIN (GPIO_PIN_3)
- #define UART1_PORT (GPIOB)
- #define UART1_TX_PIN (GPIO_PIN_6)
- #define UART1_RX_PIN (GPIO_PIN_7)
- #define MAX_RECV_SIZE (8192)
- enum
- {
- E_IDLE_EVENT,
- E_HALF_EVENT,
- E_FULL_EVENT,
- };
- typedef struct uart_data
- {
- rt_sem_t sem;
- int index;
- int type;
- uint32_t recv_len;
- bool frame_complete ; // 帧接收完成标志
- uint8_t buff[MAX_RECV_SIZE];
- } ts_UartData;
- extern ts_UartData uart2_rdata;
- void usart_init(void);
- #endif /*__USART_H__*/
|