#ifndef __DEBUG_USART_H #define __DEBUG_USART_H #include "stm32f2xx.h" #include #include "sys_data.h" //#define USART_BAUDRATE 9600 //串口波特率 //#define USART3_RX_GPIO_PORT GPIOD //#define USART3_RX_GPIO_CLK RCC_AHB1Periph_GPIOD //#define USART3_RX_PIN GPIO_Pin_8 //#define USART3_RX_AF GPIO_AF_USART3 //#define USART3_RX_SOURCE GPIO_PinSource8 //#define USART3_TX_GPIO_PORT GPIOD //#define USART3_TX_GPIO_CLK RCC_AHB1Periph_GPIOD //#define USART3_TX_PIN GPIO_Pin_9 //#define USART3_TX_AF GPIO_AF_USART3 //#define USART3_TX_SOURCE GPIO_PinSource9 //232引脚定义 #define USART_232 USART1 #define USART_232_CLK RCC_APB2Periph_USART1 #define USART_232_BAUDRATE 115200 //串口波特率 #define USART_232_RX_GPIO_PORT GPIOA #define USART_232_RX_GPIO_CLK RCC_AHB1Periph_GPIOA #define USART_232_RX_PIN GPIO_Pin_10 #define USART_232_RX_AF GPIO_AF_USART1 #define USART_232_RX_SOURCE GPIO_PinSource10 #define USART_232_TX_GPIO_PORT GPIOA #define USART_232_TX_GPIO_CLK RCC_AHB1Periph_GPIOA #define USART_232_TX_PIN GPIO_Pin_9 #define USART_232_TX_AF GPIO_AF_USART1 #define USART_232_TX_SOURCE GPIO_PinSource9 #define USART_232_IRQHandler USART1_IRQHandler #define USART_232_IRQ USART1_IRQn void USART3_config(void); // 测试示例 void USART_485_config(void); void USART_485_DE_TX(void); void USART_485_DE_RX(void); //485引脚定义 #define USART_485 USART3 #define USART_485_CLK RCC_APB1Periph_USART3 #define USART_485_BAUDRATE 9600 //串口波特率 #define USART_485_RX_GPIO_PORT GPIOC #define USART_485_RX_GPIO_CLK RCC_AHB1Periph_GPIOC #define USART_485_RX_PIN GPIO_Pin_11 #define USART_485_RX_AF GPIO_AF_USART3 #define USART_485_RX_SOURCE GPIO_PinSource11 #define USART_485_TX_GPIO_PORT GPIOC #define USART_485_TX_GPIO_CLK RCC_AHB1Periph_GPIOC #define USART_485_TX_PIN GPIO_Pin_10 #define USART_485_TX_AF GPIO_AF_USART3 #define USART_485_TX_SOURCE GPIO_PinSource10 #define USART_485_IRQHandler USART3_IRQHandler #define USART_485_IRQ USART3_IRQn //485控制引脚 #define USART_485_DE_GPIO_PORT GPIOC #define USART_485_DE_GPIO_CLK RCC_AHB1Periph_GPIOC #define USART_485_DE_PIN GPIO_Pin_12 #endif /* __USART1_H */