123456789101112131415161718192021222324252627282930313233343536 |
- #ifndef USART_H
- #define USART_H
- #include "gd32f30x.h"
- typedef struct usart_data_buf_s
- {
- uint8_t data[256];
- uint16_t data_cnt;
- } usart_data_buf_t;
- #define DE485_PIN GPIO_PIN_8
- #define DE485_GPIO_PORT GPIOA
- #define DE485_GPIO_CLK RCU_GPIOA
- #define COM_485 USART0
- #define COM_485_CLK RCU_USART0
- #define COM_485_TX_PIN GPIO_PIN_9
- #define COM_485_RX_PIN GPIO_PIN_10
- #define COM_485_GPIO_PORT GPIOA
- #define COM_485_GPIO_CLK RCU_GPIOA
- #define COM_485_IT_HANDLER USART0_IRQn
- void config_485_port(uint32_t com,uint32_t baudrate, uint8_t databits, uint8_t stopbits, uint8_t parity);
- void gd_com_485_send(uint8_t *message,uint16_t size);
- void gd_485_DE_pin_init(void);
- void gd_485_DE_tx(void);
- void gd_485_DE_rx(void);
- #endif
|