M252: Support configurability of USB/STDIO UART pins

-   STDIO_UART and STDIO_UART_TX/STDIO_UART_RX
-   USB_UART and USBTX/USBRX
pull/13382/head
Chun-Chieh Li 2020-03-12 10:52:44 +08:00
parent f7e4a75041
commit a76f5dcbdf
3 changed files with 64 additions and 9 deletions

View File

@ -20,6 +20,7 @@
#define MBED_PERIPHERALNAMES_H
#include "cmsis.h"
#include "PinNames.h"
#ifdef __cplusplus
extern "C" {
@ -77,7 +78,16 @@ typedef enum {
UART_2 = (int) NU_MODNAME(UART2_BASE, 2, 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

@ -107,10 +107,26 @@ typedef enum {
/* Other board-specific naming */
/* 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,

View File

@ -5656,6 +5656,30 @@
"IAR"
],
"config": {
"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
@ -5733,7 +5757,12 @@
"2",
"5"
],
"device_name": "M252KG6AE"
"device_name": "M252KG6AE",
"overrides": {
"usb-uart": "UART_0",
"usb-uart-tx": "PB_13",
"usb-uart-rx": "PB_12"
}
},
"TMPM4G9": {
"inherits": [