| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #ifndef DMA_UART_H
- #define DMA_UART_H
- #include <stdint.h>
- #include "FreeRTOS.h"
- #include "task.h"
- #define ARRAYNUM(arr_nanme) (uint32_t)(sizeof(arr_nanme) / sizeof(*(arr_nanme)))
- #define USART0_TDATA_ADDRESS ((uint32_t)0x40013828)
- #define USART0_RDATA_ADDRESS ((uint32_t)0x40013824)
- #define USART1_TDATA_ADDRESS (uint32_t)(&USART_TDATA(USART1))
- #define USART1_RDATA_ADDRESS (uint32_t)(&USART_RDATA(USART1))
- typedef void (*COM_DATA_CB)(uint8_t*, uint32_t);
- #define UART_RECV_SUB_DELAY (5)
- #define COM0_TX_PIN GPIO_PIN_9
- #define COM0_RX_PIN GPIO_PIN_10
- #define COM0_GPIO_PORT GPIOA
- #define COM0_GPIO_CLK RCU_GPIOA
- #define COM0_AF GPIO_AF_1
- //#define COM0_BAUDRATE 9600U
- #define COM0_BAUDRATE 115200U
- #define COM0_WORD_LEN USART_WL_8BIT
- #define COM0_STOP_BIT USART_STB_1BIT
- #define COM0_PM USART_PM_NONE
- #define COM0_CTRL USART_HCM_NONE
- #define COM0_DMA_SEND_LEN (64)
- #define COM0_DMA_REC_LEN (64)
- #define COM0_USE_RTS (1)
- #define COM0_RTS_SEND_HIGH (1)
- #define COM0_RTS_DELAY (2)
- #define COM1_TX_PIN GPIO_PIN_2
- #define COM1_RX_PIN GPIO_PIN_3
- #define COM1_GPIO_PORT GPIOA
- #define COM1_GPIO_CLK RCU_GPIOA
- #define COM1_AF GPIO_AF_1
- #define COM1_BAUDRATE 9600U
- #define COM1_WORD_LEN USART_WL_9BIT //如果pm 不是none 这里要设置成9
- #define COM1_STOP_BIT USART_STB_1BIT
- #define COM1_PM USART_PM_EVEN
- #define COM1_CTRL USART_HCM_NONE
- #define COM1_DMA_SEND_LEN (32)
- #define COM1_DMA_REC_LEN (32)
- #define COM1_USE_RTS (0)
- #define COM1_RTS_SEND_HIGH (1)
- #define COM1_RTS_DELAY (2)
- uint8_t* com0_receive(uint32_t t,uint16_t* len);
- uint8_t* com1_receive(uint32_t t,uint16_t* len);
- void com0_gpio_init(void);
- void com0_usart_init(void);
- void com0_dma_init(void);
- void com0_dma_send_data(uint8_t *buffter, uint8_t length);
- void com0_dma_printf(const char *format,...);
- void com0_data_transmit(uint8_t arr[], uint32_t length);
- void com0_set_cb(COM_DATA_CB cb);
- void com0_rts_init();
- void com0_rts_set();
- void com0_rts_reset();
- void com1_gpio_init(void);
- void com1_usart_init(void);
- void com1_dma_init(void);
- void com1_dma_send_data(uint8_t *buffter, uint8_t length);
- void com1_dma_printf(const char *format,...);
- void com1_data_transmit(uint8_t arr[], uint32_t length);
- void com1_set_cb(COM_DATA_CB cb);
- #endif
|