#ifndef __DEBUG_USART_H #define __DEBUG_USART_H #include "stm32f2xx.h" #include #include "main.h" #include "myFile.h" #include "main.h" extern UART_HandleTypeDef USART_InitStruct_485; extern UART_HandleTypeDef USART_InitStruct_232; extern UART_HandleTypeDef USART_InitStruct_DEBUG; extern DMA_HandleTypeDef DMA_DEBUG_RX; extern uint8_t recv_232_done; //通讯网口引脚定义 /*******************************************************/ #define DEBUG_USART USART6 #define DEBUG_USART_BAUDRATE 115200 //串口波特率 #define DEBUG_USART_RX_GPIO_PORT GPIOC #define DEBUG_USART_RX_PIN GPIO_PIN_7 #define DEBUG_USART_TX_GPIO_PORT GPIOC #define DEBUG_USART_TX_PIN GPIO_PIN_6 #define DEBUG_USART_IRQHandler USART6_IRQHandler #define DEBUG_USART_IRQ USART6_IRQn //通讯网口DMA #define DEBUG_USART_DR_BASE (USART6_BASE+0x04) //DR寄存器 #define DEBUG_USART_DMA_CLK RCC_AHB1Periph_DMA2 #define DEBUG_USART_DMA_CHANNEL DMA_CHANNEL_5 #define DEBUG_USART_DMA_STREAM DMA2_Stream1 #define BUFF_SIZE 5000//35 * 1024 //dma空间大小 64k /************************************************************/ //232引脚定义 #define USART_232 USART1 #define USART_232_BAUDRATE 115200 //串口波特率 #define USART_232_RX_GPIO_PORT GPIOA #define USART_232_RX_PIN GPIO_PIN_10 #define USART_232_TX_GPIO_PORT GPIOA #define USART_232_TX_PIN GPIO_PIN_9 #define USART_232_IRQHandler USART1_IRQHandler #define USART_232_IRQ USART1_IRQn #define RX_BUFFER_SIZE 20 * 1024 //485引脚定义 #define USART_485 USART3 #define USART_485_BAUDRATE 115200 //串口波特率 #define USART_485_RX_GPIO_PORT GPIOC #define USART_485_RX_PIN GPIO_PIN_11 #define USART_485_TX_GPIO_PORT GPIOC #define USART_485_TX_PIN GPIO_PIN_10 #define USART_485_IRQHandler USART3_IRQHandler #define USART_485_IRQ USART3_IRQn //485控制引脚 #define USART_485_DE_GPIO_PORT GPIOC #define USART_485_DE_PIN GPIO_PIN_12 void DEBUG_USART_Config(void); void USART_DMA_Config(void); void USART_232_config(void); void USART_232_Send(uint8_t *message,uint16_t size); //void USART_232_task_creat(void); void USART_485_config(void); void USART_485_DE_TX(void); void USART_485_DE_RX(void); void Config_485_Port(uint32_t baudrate, uint8_t databits, uint8_t stopbits, uint8_t parity, uint8_t flowcontrol); void USART_485_Send(uint8_t *message,uint16_t size); extern uint8_t UART6_RX_BUF[BUFF_SIZE]; extern uint8_t UART6_RX_STAT; extern uint32_t UART6_RX_NUM; extern uint8_t rx_232_Buffer[RX_BUFFER_SIZE]; #endif /* __USART_H */