M487: Support configurability of USB/STDIO UART pins

-   STDIO_UART and STDIO_UART_TX/STDIO_UART_RX
-   USB_UART and USBTX/USBRX
pull/12576/head
Chun-Chieh Li 2020-03-04 17:16:10 +08:00
parent 9d26390595
commit 2cf82821dd
3 changed files with 65 additions and 7 deletions

View File

@ -18,6 +18,7 @@
#define MBED_PERIPHERALNAMES_H
#include "cmsis.h"
#include "PinNames.h"
#ifdef __cplusplus
extern "C" {
@ -80,7 +81,16 @@ typedef enum {
UART_4 = (int) NU_MODNAME(UART4_BASE, 4, 0),
UART_5 = (int) NU_MODNAME(UART5_BASE, 5, 0),
// NOTE: board-specific
STDIO_UART = UART_0
#if defined(MBED_CONF_TARGET_USB_UART)
USB_UART = MBED_CONF_TARGET_USB_UART,
#else
USB_UART = NC,
#endif
#if defined(MBED_CONF_TARGET_STDIO_UART)
STDIO_UART = MBED_CONF_TARGET_STDIO_UART
#else
STDIO_UART = USB_UART
#endif
} UARTName;
typedef enum {

View File

@ -73,7 +73,7 @@ typedef enum {
typedef enum {
// Not connected
NC = (int)0xFFFFFFFF,
// Generic naming
PA_0 = NU_PORT_N_PIN_TO_PINNAME(0, 0), PA_1, PA_2, PA_3, PA_4, PA_5, PA_6, PA_7, PA_8, PA_9, PA_10, PA_11, PA_12, PA_13, PA_14, PA_15,
PB_0 = NU_PORT_N_PIN_TO_PINNAME(1, 0), PB_1, PB_2, PB_3, PB_4, PB_5, PB_6, PB_7, PB_8, PB_9, PB_10, PB_11, PB_12, PB_13, PB_14, PB_15,
@ -83,7 +83,7 @@ typedef enum {
PF_0 = NU_PORT_N_PIN_TO_PINNAME(5, 0), PF_1, PF_2, PF_3, PF_4, PF_5, PF_6, PF_7, PF_8, PF_9, PF_10, PF_11,
PG_0 = NU_PORT_N_PIN_TO_PINNAME(6, 0), PG_1, PG_2, PG_3, PG_4, PG_5, PG_6, PG_7, PG_8, PG_9, PG_10, PG_11, PG_12, PG_13, PG_14, PG_15,
PH_0 = NU_PORT_N_PIN_TO_PINNAME(7, 0), PH_1, PH_2, PH_3, PH_4, PH_5, PH_6, PH_7, PH_8, PH_9, PH_10, PH_11,
// Arduino UNO naming
A0 = PB_6,
A1 = PB_7,
@ -111,15 +111,32 @@ typedef enum {
I2C_SCL = D15,
I2C_SDA = D14,
// Note: board-specific
// UART naming
USBTX = PB_13,
USBRX = PB_12,
#if defined(MBED_CONF_TARGET_USB_UART_TX)
USBTX = MBED_CONF_TARGET_USB_UART_TX,
#else
USBTX = NC,
#endif
#if defined(MBED_CONF_TARGET_USB_UART_RX)
USBRX = MBED_CONF_TARGET_USB_UART_RX,
#else
USBRX = NC,
#endif
#if defined(MBED_CONF_TARGET_STDIO_UART_TX)
STDIO_UART_TX = MBED_CONF_TARGET_STDIO_UART_TX,
#else
STDIO_UART_TX = USBTX,
#endif
#if defined(MBED_CONF_TARGET_STDIO_UART_RX)
STDIO_UART_RX = MBED_CONF_TARGET_STDIO_UART_RX,
#else
STDIO_UART_RX = USBRX,
#endif
SERIAL_TX = D10,
SERIAL_RX = D13,
SERIAL_RX = D13,
// LED naming
LED_RED = PH_0,
LED_YELLOW = PH_1,
@ -128,6 +145,7 @@ typedef enum {
LED2 = LED_YELLOW,
LED3 = LED_GREEN,
LED4 = LED1, // No real LED. Just for passing ATS.
// Button naming
#if TARGET_NUMAKER_PFM_M487
SW2 = PG_15,

View File

@ -12766,6 +12766,30 @@
"help": "Enable SPIM CCM mode to spare 32KiB SRAM for normal use",
"value": 0
},
"usb-uart": {
"help": "Configure USB_UART. USB_UART and USB_UART_TX/USB_UART_RX must be consistent.",
"value": null
},
"usb-uart-tx": {
"help": "Configure USBTX. USB_UART and USBTX/USBRX must be consistent.",
"value": null
},
"usb-uart-rx": {
"help": "Configure USBRX. USB_UART and USBTX/USBRX must be consistent.",
"value": null
},
"stdio-uart": {
"help": "Configure STDIO_UART. STDIO_UART and STDIO_UART_TX/STDIO_UART_RX must be consistent. STDIO_UART defaults to USB_UART.",
"value": null
},
"stdio-uart-tx": {
"help": "Configure STDIO_UART_TX. STDIO_UART and STDIO_UART_TX/STDIO_UART_RX must be consistent. STDIO_UART_TX defaults to USBTX.",
"value": null
},
"stdio-uart-rx": {
"help": "Configure STDIO_UART_RX. STDIO_UART and STDIO_UART_TX/STDIO_UART_RX must be consistent. STDIO_UART_RX defaults to USBRX.",
"value": null
},
"gpio-irq-debounce-enable": {
"help": "Enable GPIO IRQ debounce",
"value": 0
@ -12847,6 +12871,9 @@
"1304"
],
"overrides": {
"usb-uart": "UART_0",
"usb-uart-tx": "PB_13",
"usb-uart-rx": "PB_12",
"spim-ccm-enable": 1,
"network-default-interface-type": "ETHERNET"
}
@ -12863,6 +12890,9 @@
"1308"
],
"overrides": {
"usb-uart": "UART_0",
"usb-uart-tx": "PB_13",
"usb-uart-rx": "PB_12",
"spim-ccm-enable": 1,
"network-default-interface-type": "WIFI"
}