/*** * @Author: mbw * @Date: 2024-08-20 15:51:16 * @LastEditors: mbw && 1600520629@qq.com * @LastEditTime: 2024-08-22 16:17:12 * @FilePath: \USART1_Interrupt - RT-Thread\drivers\inc\drv_uart.h * @Description: * @ * @Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. */ /************************************************************************************************/ /** * @file usart_bsp.h * @author MCU Ecosystem Development Team * @brief USART BSP头文件。 * * ************************************************************************************************** * @attention * Copyright (c) CEC Huada Electronic Design Co.,Ltd. All rights reserved. * ************************************************************************************************** */ /* 避免头文件重复引用 */ #ifndef USART_BSP_H #define USART_BSP_H #ifdef __cplusplus extern "C" { #endif /*------------------------------------------includes--------------------------------------------*/ #include #include #include "lwrb.h" typedef enum { kCheck0Stop1 = 0U, kCheck0Stop2, kCheckOdd, kCheckEven } TeUsartParityMode; /*------------------------------------------defines---------------------------------------------*/ /***********************UART1**************************** */ #define UART1_DMA_RX_THREAD_STACK_SIZE (1024) #define UART1_DMA_RX_THREAD_PRIORITY (20) #define UART1_DMA_RX_THREAD_TIMESLICE (5) #define UART1_TX_GPIO_PIN GPIO_PIN_11 #define UART1_TX_GPIO_PORT GPIOA #define UART1_RX_GPIO_PIN GPIO_PIN_12 #define UART1_RX_GPIO_PORT GPIOA #define UART1_RX_BUFFER_LENGTH (128U) #define UART1_RX_RB_LENGTH (128U) #define UART1_TX_RB_LENGTH (128U) #define UART1_DMA_RX_CHANNEL DMA_CHANNEL_0 #define UART1_DMA_TX_CHANNEL DMA_CHANNEL_1 #define UART1_DMA_RX_IRQ_CHANNEL DMA_Channel0_IRQn #define UART1_DMA_TX_IRQ_CHANNEL DMA_Channel1_IRQn rt_uint32_t UART1_Write(const void* data, size_t len); rt_uint32_t UART1_SendString(const char* str); /*-------------------------------------------functions------------------------------------------*/ int rt_hw_usart_init(void); #ifdef __cplusplus } #endif #endif /* USART_BSP_H */