28 #define UART1_RX_BUFFER_SIZE 256
29 #define UART1_TX_BUFFER_SIZE 256
30 #define UART2_RX_BUFFER_SIZE 256
31 #define UART2_TX_BUFFER_SIZE 256
32 #define UART3_RX_BUFFER_SIZE 256
33 #define UART3_TX_BUFFER_SIZE 256
34 #define UART4_RX_BUFFER_SIZE 256
35 #define UART4_TX_BUFFER_SIZE 256
36 #define UART5_RX_BUFFER_SIZE 256
37 #define UART5_TX_BUFFER_SIZE 256
42 #define UART1_TX_PIN Pin_9 // PA9
43 #define UART1_RX_PIN Pin_10 // PA10
44 #define UART1_GPIO GPIOA
45 #define UART1_APB2_PERIPHERALS RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA
46 #define UART1_AHB_PERIPHERALS RCC_AHBPeriph_DMA1
50 #define UART2_TX_PIN Pin_2 // PA2
51 #define UART2_RX_PIN Pin_3 // PA3
52 #define UART2_GPIO GPIOA
53 #define UART2_APB1_PERIPHERALS RCC_APB1Periph_USART2
54 #define UART2_APB2_PERIPHERALS RCC_APB2Periph_GPIOA
55 #define UART2_AHB_PERIPHERALS RCC_AHBPeriph_DMA1
59 #define UART3_TX_PIN Pin_10 // PB10
60 #define UART3_RX_PIN Pin_11 // PB11
61 #define UART3_GPIO GPIOB
62 #define UART3_APB1_PERIPHERALS RCC_APB1Periph_USART3
63 #define UART3_APB2_PERIPHERALS RCC_APB2Periph_GPIOB
67 #define UART4_TX_PIN Pin_10 // PC10
68 #define UART4_RX_PIN Pin_11 // PC11
69 #define UART4_GPIO GPIOC
70 #define UART4_APB1_PERIPHERALS RCC_APB1Periph_UART4
71 #define UART4_APB2_PERIPHERALS RCC_APB2Periph_GPIOC
74 #define UART5_TX_PIN Pin_12 // PC12
75 #define UART5_RX_PIN Pin_2 // PD2
76 #define UART5_GPIO_TX GPIOC
77 #define UART5_GPIO_RX GPIOD
78 #define UART5_APB1_PERIPHERALS RCC_APB1Periph_UART5
79 #define UART5_APB2_PERIPHERALS_TX RCC_APB2Periph_GPIOC
80 #define UART5_APB2_PERIPHERALS_RX RCC_APB2Periph_GPIOD
82 #elif defined(STM32F303)
85 #define UART1_TX_PIN GPIO_Pin_9 // PA9
86 #define UART1_RX_PIN GPIO_Pin_10 // PA10
87 #define UART1_GPIO GPIOA
88 #define UART1_GPIO_AF GPIO_AF_7
89 #define UART1_TX_PINSOURCE GPIO_PinSource9
90 #define UART1_RX_PINSOURCE GPIO_PinSource10
94 #define UART2_TX_PIN GPIO_Pin_5 // PD5
95 #define UART2_RX_PIN GPIO_Pin_6 // PD6
96 #define UART2_GPIO GPIOD
97 #define UART2_GPIO_AF GPIO_AF_7
98 #define UART2_TX_PINSOURCE GPIO_PinSource5
99 #define UART2_RX_PINSOURCE GPIO_PinSource6
103 #define UART3_TX_PIN GPIO_Pin_10 // PB10 (AF7)
104 #define UART3_RX_PIN GPIO_Pin_11 // PB11 (AF7)
105 #define UART3_GPIO_AF GPIO_AF_7
106 #define UART3_GPIO GPIOB
107 #define UART3_TX_PINSOURCE GPIO_PinSource10
108 #define UART3_RX_PINSOURCE GPIO_PinSource11
112 #define UART4_TX_PIN GPIO_Pin_10 // PC10
113 #define UART4_RX_PIN GPIO_Pin_11 // PC11
114 #define UART4_GPIO_AF GPIO_AF_5
115 #define UART4_GPIO GPIOC
116 #define UART4_APB1_PERIPHERALS RCC_APB1Periph_UART4
117 #define UART4_AHB_PERIPHERALS RCC_AHBPeriph_GPIOC
118 #define UART4_TX_PINSOURCE GPIO_PinSource10
119 #define UART4_RX_PINSOURCE GPIO_PinSource11
123 #define UART5_TX_PIN Pin_12 // PC12
124 #define UART5_RX_PIN Pin_2 // PD2
125 #define UART5_GPIO_AF GPIO_AF_5
126 #define UART5_GPIO_TX GPIOC
127 #define UART5_GPIO_RX GPIOD
128 #define UART5_APB1_PERIPHERALS RCC_APB1Periph_UART5
129 #define UART5_AHB_PERIPHERALS_TX RCC_AHBPeriph_GPIOC
130 #define UART5_AHB_PERIPHERALS_RX RCC_AHBPeriph_GPIOD
131 #define UART5_TX_PINSOURCE GPIO_PinSource12
132 #define UART5_RX_PINSOURCE GPIO_PinSource2
serialPort_t * uartOpen(uint8_t id, serialReceiveCallbackPtr callback, uint32_t baudRate, portMode_t mode, portOptions_t options)
Definition: serial_uart.c:249
uint8_t mode
Definition: gimbal.h:49
void usartInitAllIOSignals(void)
Definition: serial_uart_stm32f10x.c:66
portMode_t
Definition: serial.h:24
portOptions_t
Definition: serial.h:30
void(* serialReceiveCallbackPtr)(uint16_t data)
Definition: serial.h:41