mirror of https://github.com/ARMmbed/mbed-os.git
Adds a standard DONT_CARE pin name that allows specifying that any pin will
work in a pin map. This is currently used in the NRF51822 serial API to allow specifying any pins as a UART.pull/447/head
parent
601712595f
commit
c804dc8013
|
@ -21,7 +21,7 @@ void pinmap_pinout(PinName pin, const PinMap *map) {
|
|||
return;
|
||||
|
||||
while (map->pin != NC) {
|
||||
if (map->pin == pin) {
|
||||
if ((map->pin == DONT_CARE) || (map->pin == pin)) {
|
||||
pin_function(pin, map->function);
|
||||
|
||||
pin_mode(pin, PullNone);
|
||||
|
@ -50,7 +50,7 @@ uint32_t pinmap_merge(uint32_t a, uint32_t b) {
|
|||
|
||||
uint32_t pinmap_find_peripheral(PinName pin, const PinMap* map) {
|
||||
while (map->pin != NC) {
|
||||
if (map->pin == pin)
|
||||
if ((map->pin == DONT_CARE) || (map->pin == pin))
|
||||
return map->peripheral;
|
||||
map++;
|
||||
}
|
||||
|
|
|
@ -237,6 +237,8 @@ typedef enum {
|
|||
TSI_ELEC0 = PTB16,
|
||||
TSI_ELEC1 = PTB17,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -118,6 +118,8 @@ typedef enum {
|
|||
TSI_ELEC0 = PTA13,
|
||||
TSI_ELEC1 = PTB12,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -236,6 +236,8 @@ typedef enum {
|
|||
TSI_ELEC0 = PTB16,
|
||||
TSI_ELEC1 = PTB17,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -239,6 +239,8 @@ typedef enum {
|
|||
TSI_ELEC0 = PTB16,
|
||||
TSI_ELEC1 = PTB17,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -239,6 +239,8 @@ typedef enum {
|
|||
|
||||
DAC0_OUT = 0xFEFE, /* DAC does not have Pin Name in RM */
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -208,6 +208,8 @@ typedef enum {
|
|||
|
||||
DAC0_OUT = 0xFEFE, /* DAC does not have Pin Name in RM */
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -159,6 +159,8 @@ typedef enum {
|
|||
A4 = p5,
|
||||
A5 = p6,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -135,6 +135,8 @@ typedef enum {
|
|||
|
||||
I2C_SDA1 = p13,
|
||||
I2C_SCL1 = p15,
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -135,6 +135,9 @@ typedef enum {
|
|||
|
||||
I2C_SDA1 = p13,
|
||||
I2C_SCL1 = p15,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -162,6 +162,8 @@ typedef enum {
|
|||
A4 = p5,
|
||||
A5 = p6,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#define UART_NUM 1
|
||||
|
||||
static const PinMap PinMap_UART_TX[] = {
|
||||
{TX_PIN_NUMBER, UART_0, 1},
|
||||
{DONT_CARE, UART_0, 1},
|
||||
{ NC , NC , 0}
|
||||
};
|
||||
|
||||
static const PinMap PinMap_UART_RX[] = {
|
||||
{RX_PIN_NUMBER, UART_0, 1},
|
||||
{DONT_CARE, UART_0, 1},
|
||||
{NC , NC , 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -157,6 +157,8 @@ typedef enum {
|
|||
SDA= P0_5, // same port as A4
|
||||
SCL= P0_4, // same port as A5
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -164,6 +164,8 @@ typedef enum {
|
|||
I2C_SCL = D15,
|
||||
I2C_SDA = D14,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -74,6 +74,8 @@ typedef enum {
|
|||
I2C_SCL = P0_4,
|
||||
I2C_SDA = P0_5,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -135,6 +135,8 @@ typedef enum {
|
|||
USBTX = P0_19,
|
||||
USBRX = P0_18,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -164,6 +164,8 @@ typedef enum {
|
|||
I2C_SCL = D15,
|
||||
I2C_SDA = D14,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -130,6 +130,8 @@ typedef enum {
|
|||
UART_TX = P0_19,
|
||||
UART_RX = P0_18,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -103,6 +103,8 @@ typedef enum {
|
|||
UART_TX = P0_19,
|
||||
UART_RX = P0_18,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -145,6 +145,8 @@ typedef enum {
|
|||
UART_TX = P0_19,
|
||||
UART_RX = P0_18,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -148,6 +148,8 @@ typedef enum {
|
|||
I2C_SCL = P0_4,
|
||||
I2C_SDA = P0_5,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -188,6 +188,8 @@ typedef enum {
|
|||
dp27 = P0_4,
|
||||
dp28 = P0_7,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -202,7 +202,8 @@ typedef enum {
|
|||
dip28 = P0_7,
|
||||
|
||||
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -115,6 +115,8 @@ typedef enum {
|
|||
UART_TX = P0_19,
|
||||
UART_RX = P0_18,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
|
||||
|
|
|
@ -75,6 +75,8 @@ typedef enum {
|
|||
SDA= P0_23, // same port as A4
|
||||
SCL= P0_22, // same port as A5
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -109,6 +109,8 @@ typedef enum {
|
|||
I2C_SCL = D15,
|
||||
I2C_SDA = D14,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -109,6 +109,8 @@ typedef enum {
|
|||
I2C_SCL = D15,
|
||||
I2C_SDA = D14,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -158,6 +158,8 @@ typedef enum {
|
|||
USBTXD = USBTX, // identical USBTX
|
||||
USBRXD = USBRX, // identical USBRX
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -76,6 +76,8 @@ typedef enum {
|
|||
USBTX = P0_2,
|
||||
USBRX = P0_3,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -109,6 +109,8 @@ typedef enum {
|
|||
A5 = p20,
|
||||
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -451,6 +451,8 @@ typedef enum {
|
|||
// Dedicated pin (no GPIO)
|
||||
P_DED = MBED_PIN(0, 0, NO_GPIO, 0),
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ typedef enum {
|
|||
USBTX = P0_4,
|
||||
USBRX = P0_0,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -81,6 +81,8 @@ typedef enum {
|
|||
USBTX = P0_6,
|
||||
USBRX = P0_1,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF,
|
||||
} PinName;
|
||||
|
|
|
@ -211,6 +211,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_3,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -171,6 +171,8 @@ typedef enum {
|
|||
SPI_CS = PB_12,
|
||||
PWM_OUT = PB_8,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -207,6 +207,8 @@ typedef enum {
|
|||
SPI_CS = PA_15,
|
||||
PWM_OUT = PB_1,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -264,6 +264,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_3,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -160,6 +160,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PC_7,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -164,6 +164,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_3,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -148,6 +148,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_3,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -155,6 +155,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_4,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -163,6 +163,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_4,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -162,6 +162,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_3,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -162,6 +162,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_3,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -163,6 +163,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_3,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -155,6 +155,8 @@ typedef enum {
|
|||
SPI_CS = PB_6,
|
||||
PWM_OUT = PB_3,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -161,6 +161,8 @@ typedef enum {
|
|||
|
||||
LED1 = PE_9,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
|
@ -50,6 +50,8 @@ typedef enum {
|
|||
LED5 = PD_14,
|
||||
LED6 = PD_15,
|
||||
|
||||
// Do not care
|
||||
DONT_CARE = (int)0xFFFFFFFE,
|
||||
// Not connected
|
||||
NC = (int)0xFFFFFFFF
|
||||
} PinName;
|
||||
|
|
Loading…
Reference in New Issue