mirror of https://github.com/ARMmbed/mbed-os.git
Rename USBTX/RX to CONSOLE_TX/RX
parent
3af96247a6
commit
d239ef98cd
|
@ -17,8 +17,17 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_ARDUINO_UNO_H
|
||||
#define MBED_ARDUINO_UNO_H
|
||||
#ifndef MBED_PIN_NAME_ALIASES_H
|
||||
#define MBED_PIN_NAME_ALIASES_H
|
||||
|
||||
/* Aliases for legacy reasons. To be removed in the next Mbed OS version */
|
||||
#if defined (CONSOLE_TX) && (CONSOLE_RX)
|
||||
#define USBTX CONSOLE_TX
|
||||
#define USBRX CONSOLE_RX
|
||||
#else
|
||||
#define CONSOLE_TX USBTX
|
||||
#define CONSOLE_RX USBRX
|
||||
#endif
|
||||
|
||||
#if defined (TARGET_FF_ARDUINO) || (TARGET_FF_ARDUINO_UNO)
|
||||
|
||||
|
@ -94,6 +103,6 @@
|
|||
|
||||
#endif // (TARGET_FF_ARDUINO) || (TARGET_FF_ARDUINO_UNO)
|
||||
|
||||
#endif // MBED_ARDUINO_UNO_H
|
||||
#endif // MBED_PIN_NAME_ALIASES_H
|
||||
|
||||
/** @}*/
|
|
@ -17,6 +17,7 @@
|
|||
#ifndef STATIC_PINMAP_H
|
||||
#define STATIC_PINMAP_H
|
||||
|
||||
#include "hal/PinNameAliases.h"
|
||||
#include "PinNames.h"
|
||||
#include "spi_api.h"
|
||||
#include "pwmout_api.h"
|
||||
|
@ -128,7 +129,7 @@ MSTD_CONSTEXPR_FN_14 serial_pinmap_t get_uart_pinmap(const PinName tx, const Pin
|
|||
return {(int) NC, NC, (int) NC, NC, (int) NC, false};
|
||||
}
|
||||
|
||||
if (tx_map->pin == USBTX && rx_map->pin == USBRX) {
|
||||
if (tx_map->pin == CONSOLE_TX && rx_map->pin == CONSOLE_RX) {
|
||||
return {tx_map->peripheral, tx_map->pin, tx_map->function, rx_map->pin, rx_map->function, true};
|
||||
} else {
|
||||
return {tx_map->peripheral, tx_map->pin, tx_map->function, rx_map->pin, rx_map->function, false};
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
#include "hal/gpio_api.h"
|
||||
#include "platform/mbed_toolchain.h"
|
||||
#include "hal/ArduinoUnoAliases.h"
|
||||
#include "hal/PinNameAliases.h"
|
||||
|
||||
static inline void _gpio_init_in(gpio_t *gpio, PinName pin, PinMode mode)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "platform/mbed_assert.h"
|
||||
#include "device.h"
|
||||
#include "hal/serial_api.h"
|
||||
#include "hal/ArduinoUnoAliases.h"
|
||||
#include "hal/PinNameAliases.h"
|
||||
|
||||
//*** Common form factors ***
|
||||
#if defined (TARGET_FF_ARDUINO) || (TARGET_FF_ARDUINO_UNO)
|
||||
|
@ -70,7 +70,7 @@ const char *pinmap_ff_arduino_uno_pin_to_string(PinName pin)
|
|||
MBED_WEAK const PinList *pinmap_restricted_pins()
|
||||
{
|
||||
static const PinName pins[] = {
|
||||
USBTX, USBRX
|
||||
CONSOLE_TX, CONSOLE_RX
|
||||
};
|
||||
static const PinList pin_list = {
|
||||
sizeof(pins) / sizeof(pins[0]),
|
||||
|
@ -94,7 +94,7 @@ MBED_WEAK const PinList *pinmap_gpio_restricted_pins()
|
|||
#if DEVICE_SERIAL
|
||||
MBED_WEAK const PeripheralList *pinmap_uart_restricted_peripherals()
|
||||
{
|
||||
static const int stdio_uart = pinmap_peripheral(USBTX, serial_tx_pinmap());
|
||||
static const int stdio_uart = pinmap_peripheral(CONSOLE_TX, serial_tx_pinmap());
|
||||
|
||||
static const int peripherals[] = {
|
||||
stdio_uart
|
||||
|
|
|
@ -35,8 +35,8 @@ void GPIO_test()
|
|||
{
|
||||
utest_printf("GPIO Pin 0x%x\n", TestedPin);
|
||||
|
||||
TEST_SKIP_UNLESS_MESSAGE(TestedPin != USBTX, "ARDUINO_UNO pin shared with USBTX");
|
||||
TEST_SKIP_UNLESS_MESSAGE(TestedPin != USBRX, "ARDUINO_UNO pin shared with USBRX");
|
||||
TEST_SKIP_UNLESS_MESSAGE(TestedPin != CONSOLE_TX, "ARDUINO_UNO pin shared with CONSOLE_TX");
|
||||
TEST_SKIP_UNLESS_MESSAGE(TestedPin != CONSOLE_RX, "ARDUINO_UNO pin shared with CONSOLE_RX");
|
||||
|
||||
const PinMap *maps = gpio_pinmap(); // hal/source/mbed_gpio.c
|
||||
while (maps->pin != (PinName)NC) { // check each pin from PinMap table till NC pin
|
||||
|
@ -124,8 +124,8 @@ void UART_test()
|
|||
{
|
||||
utest_printf("UART TX Pin 0x%x RX Pin 0x%x\n", TX_pin, RX_pin);
|
||||
|
||||
TEST_SKIP_UNLESS_MESSAGE(TX_pin != USBTX, "ARDUINO_UNO_UART pin shared with USBTX");
|
||||
TEST_SKIP_UNLESS_MESSAGE(RX_pin != USBRX, "ARDUINO_UNO_UART pin shared with USBRX");
|
||||
TEST_SKIP_UNLESS_MESSAGE(TX_pin != CONSOLE_TX, "ARDUINO_UNO_UART pin shared with CONSOLE_TX");
|
||||
TEST_SKIP_UNLESS_MESSAGE(RX_pin != CONSOLE_RX, "ARDUINO_UNO_UART pin shared with CONSOLE_RX");
|
||||
|
||||
{
|
||||
const PinMap *maps = serial_tx_pinmap();
|
||||
|
|
|
@ -314,7 +314,7 @@ def identity_assignment_check(pin_name_dict):
|
|||
def nc_assignment_check(pin_name_dict):
|
||||
invalid_items = []
|
||||
for key, val in pin_name_dict.items():
|
||||
if re.match(r"^((LED|BUTTON)\d*|USBTX|USBRX)$", key):
|
||||
if re.match(r"^((LED|BUTTON)\d*|CONSOLE_TX|CONSOLE_RX|USBTX|USBRX)$", key):
|
||||
if val == "NC":
|
||||
message = "cannot be NC"
|
||||
invalid_items.append(
|
||||
|
@ -329,7 +329,7 @@ def duplicate_assignment_check(pin_name_dict):
|
|||
invalid_items = []
|
||||
|
||||
for key, val in pin_name_dict.items():
|
||||
if re.match(r"^((LED|BUTTON)\d*|USBTX|USBRX)$", key):
|
||||
if re.match(r"^((LED|BUTTON)\d*|CONSOLE_TX|CONSOLE_RX|USBTX|USBRX)$", key):
|
||||
if val == "NC":
|
||||
continue
|
||||
# resolve to literal
|
||||
|
@ -438,6 +438,13 @@ def legacy_assignment_check(pin_name_content):
|
|||
invalid_items.append({"key": key, "val": val, "message": message})
|
||||
return invalid_items
|
||||
|
||||
def legacy_uart_check(pin_name_dict):
|
||||
invalid_items = []
|
||||
if "CONSOLE_TX" not in pin_name_dict or "CONSOLE_RX" not in pin_name_dict:
|
||||
message = "CONSOLE_TX or CONSOLE_RX are not defined; USBTX and USBRX are deprecated"
|
||||
invalid_items.append({"key": "", "val": "", "message": message})
|
||||
return invalid_items
|
||||
|
||||
|
||||
def print_summary(report):
|
||||
targets = set([case["platform_name"] for case in report])
|
||||
|
@ -653,6 +660,12 @@ test_cases = [
|
|||
"case_function": legacy_assignment_check,
|
||||
"case_input": "content",
|
||||
},
|
||||
{
|
||||
"suite_name": "generic",
|
||||
"case_name": "uart",
|
||||
"case_function": legacy_uart_check,
|
||||
"case_input": "content",
|
||||
},
|
||||
{
|
||||
"suite_name": "arduino_uno",
|
||||
"case_name": "duplicate",
|
||||
|
|
|
@ -139,8 +139,8 @@ def test_pin_name_to_dict(pin_name_dict):
|
|||
"ARDUINO_UNO_D13": "PA_5",
|
||||
"ARDUINO_UNO_D14": "PB_9",
|
||||
"ARDUINO_UNO_D15": "PB_8",
|
||||
"USBTX": "PB_6",
|
||||
"USBRX": "PB_7",
|
||||
"CONSOLE_TX": "PB_6",
|
||||
"CONSOLE_RX": "PB_7",
|
||||
"LED1": "PA_5",
|
||||
"BUTTON1": "PC_2",
|
||||
"LED2": "PB_14",
|
||||
|
|
|
@ -82,8 +82,8 @@ typedef enum {
|
|||
LED3 = P1_21,
|
||||
LED4 = P1_23,
|
||||
#endif
|
||||
USBTX = P0_2,
|
||||
USBRX = P0_3,
|
||||
CONSOLE_TX = P0_2,
|
||||
CONSOLE_RX = P0_3,
|
||||
|
||||
// Arch Pro Pin Names
|
||||
D0 = P4_29,
|
||||
|
|
|
@ -119,8 +119,8 @@ typedef enum {
|
|||
ARDUINO_UNO_D15 = PB_8, // I2C SCL / GPIO
|
||||
|
||||
// valid STDIO definitions for console print
|
||||
USBTX = PB_6,
|
||||
USBRX = PB_7,
|
||||
CONSOLE_TX = PB_6,
|
||||
CONSOLE_RX = PB_7,
|
||||
|
||||
// invalid legacy LED/BUTTON definitions
|
||||
// these should be a #define, not in an enum
|
||||
|
|
|
@ -82,8 +82,8 @@ typedef enum {
|
|||
LED3 = P1_21,
|
||||
LED4 = P1_23,
|
||||
#endif
|
||||
USBTX = P0_2,
|
||||
USBRX = P0_3,
|
||||
CONSOLE_TX = P0_2,
|
||||
CONSOLE_RX = P0_3,
|
||||
|
||||
// Arch Pro Pin Names
|
||||
D0 = P4_29,
|
||||
|
|
|
@ -82,8 +82,8 @@ typedef enum {
|
|||
LED3 = P1_21,
|
||||
LED4 = P1_23,
|
||||
#endif
|
||||
USBTX = P0_2,
|
||||
USBRX = P0_3,
|
||||
CONSOLE_TX = P0_2,
|
||||
CONSOLE_RX = P0_3,
|
||||
|
||||
// Arch Pro Pin Names
|
||||
D0 = P4_29,
|
||||
|
|
|
@ -82,8 +82,8 @@ typedef enum {
|
|||
LED3 = P1_21,
|
||||
LED4 = P1_23,
|
||||
#endif
|
||||
USBTX = P0_2,
|
||||
USBRX = P0_3,
|
||||
CONSOLE_TX = P0_2,
|
||||
CONSOLE_RX = P0_3,
|
||||
|
||||
// Arch Pro Pin Names
|
||||
D0 = P4_29,
|
||||
|
|
|
@ -80,8 +80,8 @@ typedef enum {
|
|||
LED3 = P1_21,
|
||||
LED4 = P1_23,
|
||||
#endif
|
||||
USBTX = P0_2,
|
||||
USBRX = P0_3,
|
||||
CONSOLE_TX = P0_2,
|
||||
CONSOLE_RX = P0_3,
|
||||
|
||||
// Arch Pro Pin Names
|
||||
D0 = P4_29,
|
||||
|
|
|
@ -82,8 +82,8 @@ typedef enum {
|
|||
LED3 = P1_21,
|
||||
LED4 = P1_23,
|
||||
#endif
|
||||
USBTX = P0_2,
|
||||
USBRX = P0_3,
|
||||
CONSOLE_TX = P0_2,
|
||||
CONSOLE_RX = P0_3,
|
||||
|
||||
// Arch Pro Pin Names
|
||||
D0 = P4_29,
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "device.h"
|
||||
#include "PinNames.h"
|
||||
#include "PeripheralNames.h"
|
||||
#include "hal/ArduinoUnoAliases.h"
|
||||
#include "hal/PinNameAliases.h"
|
||||
|
||||
/** \defgroup platform-public-api Platform
|
||||
* \ingroup mbed-os-public
|
||||
|
|
|
@ -181,7 +181,7 @@ DirectSerial::DirectSerial(PinName tx, PinName rx, int baud)
|
|||
return;
|
||||
}
|
||||
|
||||
static const serial_pinmap_t console_pinmap = get_uart_pinmap(USBTX, USBRX);
|
||||
static const serial_pinmap_t console_pinmap = get_uart_pinmap(CONSOLE_TX, CONSOLE_RX);
|
||||
serial_init_direct(&stdio_uart, &console_pinmap);
|
||||
serial_baud(&stdio_uart, baud);
|
||||
|
||||
|
@ -256,7 +256,7 @@ static void do_serial_init()
|
|||
return;
|
||||
}
|
||||
|
||||
static const serial_pinmap_t console_pinmap = get_uart_pinmap(USBTX, USBRX);
|
||||
static const serial_pinmap_t console_pinmap = get_uart_pinmap(CONSOLE_TX, CONSOLE_RX);
|
||||
serial_init_direct(&stdio_uart, &console_pinmap);
|
||||
serial_baud(&stdio_uart, MBED_CONF_PLATFORM_STDIO_BAUD_RATE);
|
||||
#if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS
|
||||
|
@ -335,7 +335,7 @@ static FileHandle *default_console()
|
|||
#if MBED_CONF_TARGET_CONSOLE_UART && DEVICE_SERIAL
|
||||
|
||||
# if MBED_CONF_PLATFORM_STDIO_BUFFERED_SERIAL
|
||||
static const serial_pinmap_t console_pinmap = get_uart_pinmap(USBTX, USBRX);
|
||||
static const serial_pinmap_t console_pinmap = get_uart_pinmap(CONSOLE_TX, CONSOLE_RX);
|
||||
static BufferedSerial console(console_pinmap, MBED_CONF_PLATFORM_STDIO_BAUD_RATE);
|
||||
# if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS
|
||||
static const serial_fc_pinmap_t fc_pinmap = get_uart_fc_pinmap(STDIO_UART_RTS, NC);
|
||||
|
@ -348,7 +348,7 @@ static FileHandle *default_console()
|
|||
console.serial_set_flow_control(SerialBase::RTSCTS, fc_pinmap);
|
||||
# endif
|
||||
# else
|
||||
static const serial_pinmap_t console_pinmap = get_uart_pinmap(USBTX, USBRX);
|
||||
static const serial_pinmap_t console_pinmap = get_uart_pinmap(CONSOLE_TX, CONSOLE_RX);
|
||||
static DirectSerial console(console_pinmap, MBED_CONF_PLATFORM_STDIO_BAUD_RATE);
|
||||
# endif
|
||||
#else // MBED_CONF_TARGET_CONSOLE_UART && DEVICE_SERIAL
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
],
|
||||
"config": {
|
||||
"console-uart": {
|
||||
"help": "Target has UART console on pins USBTX, USBRX. Value is only significant if target has SERIAL device.",
|
||||
"help": "Target has UART console on pins CONSOLE_TX, CONSOLE_RX. Value is only significant if target has SERIAL device.",
|
||||
"value": true
|
||||
},
|
||||
"console-uart-flow-control": {
|
||||
|
@ -6370,11 +6370,11 @@
|
|||
"value": null
|
||||
},
|
||||
"usb-uart-tx": {
|
||||
"help": "Configure USBTX. USB_UART and USBTX/USBRX must be consistent.",
|
||||
"help": "Configure CONSOLE_TX. USB_UART and CONSOLE_TX/CONSOLE_RX must be consistent.",
|
||||
"value": null
|
||||
},
|
||||
"usb-uart-rx": {
|
||||
"help": "Configure USBRX. USB_UART and USBTX/USBRX must be consistent.",
|
||||
"help": "Configure CONSOLE_RX. USB_UART and CONSOLE_TX/CONSOLE_RX must be consistent.",
|
||||
"value": null
|
||||
},
|
||||
"stdio-uart": {
|
||||
|
@ -6382,11 +6382,11 @@
|
|||
"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.",
|
||||
"help": "Configure STDIO_UART_TX. STDIO_UART and STDIO_UART_TX/STDIO_UART_RX must be consistent. STDIO_UART_TX defaults to CONSOLE_TX.",
|
||||
"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.",
|
||||
"help": "Configure STDIO_UART_RX. STDIO_UART and STDIO_UART_TX/STDIO_UART_RX must be consistent. STDIO_UART_RX defaults to CONSOLE_RX.",
|
||||
"value": null
|
||||
},
|
||||
"gpio-irq-debounce-enable": {
|
||||
|
@ -6719,11 +6719,11 @@
|
|||
"value": null
|
||||
},
|
||||
"usb-uart-tx": {
|
||||
"help": "Configure USBTX. USB_UART and USBTX/USBRX must be consistent.",
|
||||
"help": "Configure CONSOLE_TX. USB_UART and CONSOLE_TX/CONSOLE_RX must be consistent.",
|
||||
"value": null
|
||||
},
|
||||
"usb-uart-rx": {
|
||||
"help": "Configure USBRX. USB_UART and USBTX/USBRX must be consistent.",
|
||||
"help": "Configure CONSOLE_RX. USB_UART and CONSOLE_TX/CONSOLE_RX must be consistent.",
|
||||
"value": null
|
||||
},
|
||||
"stdio-uart": {
|
||||
|
@ -6731,11 +6731,11 @@
|
|||
"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.",
|
||||
"help": "Configure STDIO_UART_TX. STDIO_UART and STDIO_UART_TX/STDIO_UART_RX must be consistent. STDIO_UART_TX defaults to CONSOLE_TX.",
|
||||
"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.",
|
||||
"help": "Configure STDIO_UART_RX. STDIO_UART and STDIO_UART_TX/STDIO_UART_RX must be consistent. STDIO_UART_RX defaults to CONSOLE_RX.",
|
||||
"value": null
|
||||
},
|
||||
"gpio-irq-debounce-enable": {
|
||||
|
@ -7642,11 +7642,11 @@
|
|||
"value": null
|
||||
},
|
||||
"usb-uart-tx": {
|
||||
"help": "Configure USBTX. USB_UART and USBTX/USBRX must be consistent.",
|
||||
"help": "Configure CONSOLE_TX. USB_UART and CONSOLE_TX/CONSOLE_RX must be consistent.",
|
||||
"value": null
|
||||
},
|
||||
"usb-uart-rx": {
|
||||
"help": "Configure USBRX. USB_UART and USBTX/USBRX must be consistent.",
|
||||
"help": "Configure CONSOLE_RX. USB_UART and CONSOLE_TX/CONSOLE_RX must be consistent.",
|
||||
"value": null
|
||||
},
|
||||
"stdio-uart": {
|
||||
|
@ -7654,7 +7654,7 @@
|
|||
"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.",
|
||||
"help": "Configure STDIO_UART_TX. STDIO_UART and STDIO_UART_TX/STDIO_UART_RX must be consistent. STDIO_UART_TX defaults to CONSOLE_TX.",
|
||||
"value": null
|
||||
},
|
||||
"stdio-uart-rx": {
|
||||
|
|
Loading…
Reference in New Issue