File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
boards/arm/stm32/nucleo-f302r8 Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ config NUCLEOF302R8_HIGHPRI
9
9
bool "High priority interrupt test"
10
10
default n
11
11
12
+ config NUCLEOF302R8_RS485_WAVESHARE
13
+ bool "Map USART1 pins to match RS485 CAN Waveshare shield"
14
+ default n
15
+
12
16
if SENSORS_QENCODER
13
17
14
18
config NUCLEO_F302R8_QETIMER
Original file line number Diff line number Diff line change 206
206
#define GPIO_USART2_RX GPIO_USART2_RX_2 /* PA3 */
207
207
#define GPIO_USART2_TX GPIO_USART2_TX_2 /* PA2 */
208
208
209
- /* USART1 */
209
+ /* USART1
210
+ *
211
+ * At default use:
212
+ * USART1_RX - PB7
213
+ * USART1_TX - PB6
214
+ *
215
+ * If CONFIG_NUCLEOF302R8_RS485_WAVESHARE=y use configuration to match RS485
216
+ * shield from Waveshare:
217
+ *
218
+ * USART1_RX - PA10
219
+ * USART1_TX - PA9
220
+ * RS485_DIR - PA8 (arduino D7)
221
+ *
222
+ */
210
223
211
- #define GPIO_USART1_RX GPIO_USART1_RX_2 /* PB7 */
212
- #define GPIO_USART1_TX GPIO_USART1_TX_2 /* PB6 */
224
+ #ifdef CONFIG_NUCLEOF302R8_RS485_WAVESHARE
225
+ # define GPIO_USART1_RX GPIO_USART1_RX_1 /* PA10 */
226
+ # define GPIO_USART1_TX GPIO_USART1_TX_1 /* PA9 */
227
+ # define GPIO_USART1_RS485_DIR (GPIO_OUTPUT | GPIO_PUSHPULL | \
228
+ GPIO_SPEED_50MHz | GPIO_OUTPUT_CLEAR | \
229
+ GPIO_PORTA | GPIO_PIN8)
230
+ #else
231
+ # define GPIO_USART1_RX GPIO_USART1_RX_2 /* PB7 */
232
+ # define GPIO_USART1_TX GPIO_USART1_TX_2 /* PB6 */
233
+ #endif
213
234
214
235
/* CAN */
215
236
You can’t perform that action at this time.
0 commit comments