From f6468f0af3c271e138c57f9b79e435279c9eaf78 Mon Sep 17 00:00:00 2001
From: Bob Kuhn <bob.kuhn@att.net>
Date: Sun, 19 Jan 2020 22:27:20 -0600
Subject: [PATCH] STEVAL_3DP001V1: Easier Serial2 (for WIFI interface) (#16599)

---
 .../PlatformIO/variants/STEVAL_F401VE/variant.h  | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h
index e656b8c243..bac86151bb 100644
--- a/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h
+++ b/buildroot/share/PlatformIO/variants/STEVAL_F401VE/variant.h
@@ -51,7 +51,7 @@ extern "C" {
 #define PA9  0 //TX
 #define PA10 1 //RX
 
-// WIFI
+// WIFI (USART2)
 #define PD3   2 // CTS
 #define PD4   3 // RTS
 #define PD5   4 // TX
@@ -183,12 +183,20 @@ extern "C" {
 #define USER_BTN                PE7
 
 // UART Definitions
-#define SERIAL_UART_INSTANCE    1 //Connected to ST-Link
+#define SERIAL_UART_INSTANCE    1 // Connected to ST-Link
+//#define SERIAL_UART_INSTANCE    2 // Connected to WIFI
 
 // Default pin used for 'Serial' instance (ex: ST-Link)
 // Mandatory for Firmata
-#define PIN_SERIAL_RX           PA10
-#define PIN_SERIAL_TX           PA9
+#if SERIAL_UART_INSTANCE == 1             // ST-Link & J23
+  #define PIN_SERIAL_RX         PA10
+  #define PIN_SERIAL_TX         PA9
+#elif SERIAL_UART_INSTANCE == 2         // WIFI interface
+  #define PIN_SERIAL2_RX        PD6
+  #define PIN_SERIAL2_TX        PD5
+#else
+  #error'Invaqlid setting for SERIAL_UART_INSTANCE'
+#endif
 
 // Timer Definitions
 #define TIMER_SERVO             TIM4  // TIMER_SERVO must be defined in this file