Skip to content

Commit c804dc8

Browse files
committed
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.
1 parent 6017125 commit c804dc8

File tree

48 files changed

+97
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+97
-5
lines changed

libraries/mbed/common/pinmap_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void pinmap_pinout(PinName pin, const PinMap *map) {
2121
return;
2222

2323
while (map->pin != NC) {
24-
if (map->pin == pin) {
24+
if ((map->pin == DONT_CARE) || (map->pin == pin)) {
2525
pin_function(pin, map->function);
2626

2727
pin_mode(pin, PullNone);
@@ -50,7 +50,7 @@ uint32_t pinmap_merge(uint32_t a, uint32_t b) {
5050

5151
uint32_t pinmap_find_peripheral(PinName pin, const PinMap* map) {
5252
while (map->pin != NC) {
53-
if (map->pin == pin)
53+
if ((map->pin == DONT_CARE) || (map->pin == pin))
5454
return map->peripheral;
5555
map++;
5656
}

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ typedef enum {
237237
TSI_ELEC0 = PTB16,
238238
TSI_ELEC1 = PTB17,
239239

240+
// Do not care
241+
DONT_CARE = (int)0xFFFFFFFE,
240242
// Not connected
241243
NC = (int)0xFFFFFFFF
242244
} PinName;

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KLXX/TARGET_KL05Z/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ typedef enum {
118118
TSI_ELEC0 = PTA13,
119119
TSI_ELEC1 = PTB12,
120120

121+
// Do not care
122+
DONT_CARE = (int)0xFFFFFFFE,
121123
// Not connected
122124
NC = (int)0xFFFFFFFF
123125
} PinName;

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KLXX/TARGET_KL25Z/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ typedef enum {
236236
TSI_ELEC0 = PTB16,
237237
TSI_ELEC1 = PTB17,
238238

239+
// Do not care
240+
DONT_CARE = (int)0xFFFFFFFE,
239241
// Not connected
240242
NC = (int)0xFFFFFFFF
241243
} PinName;

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ typedef enum {
239239
TSI_ELEC0 = PTB16,
240240
TSI_ELEC1 = PTB17,
241241

242+
// Do not care
243+
DONT_CARE = (int)0xFFFFFFFE,
242244
// Not connected
243245
NC = (int)0xFFFFFFFF
244246
} PinName;

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/TARGET_FRDM/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ typedef enum {
239239

240240
DAC0_OUT = 0xFEFE, /* DAC does not have Pin Name in RM */
241241

242+
// Do not care
243+
DONT_CARE = (int)0xFFFFFFFE,
242244
// Not connected
243245
NC = (int)0xFFFFFFFF
244246
} PinName;

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/TARGET_MTS_GAMBIT/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ typedef enum {
208208

209209
DAC0_OUT = 0xFEFE, /* DAC does not have Pin Name in RM */
210210

211+
// Do not care
212+
DONT_CARE = (int)0xFFFFFFFE,
211213
// Not connected
212214
NC = (int)0xFFFFFFFF
213215
} PinName;

libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_ARCH_BLE/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ typedef enum {
159159
A4 = p5,
160160
A5 = p6,
161161

162+
// Do not care
163+
DONT_CARE = (int)0xFFFFFFFE,
162164
// Not connected
163165
NC = (int)0xFFFFFFFF
164166
} PinName;

libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_HRM1017/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ typedef enum {
135135

136136
I2C_SDA1 = p13,
137137
I2C_SCL1 = p15,
138+
// Do not care
139+
DONT_CARE = (int)0xFFFFFFFE,
138140
// Not connected
139141
NC = (int)0xFFFFFFFF
140142
} PinName;

libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_NRF51822_MKIT/PinNames.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ typedef enum {
135135

136136
I2C_SDA1 = p13,
137137
I2C_SCL1 = p15,
138+
139+
// Do not care
140+
DONT_CARE = (int)0xFFFFFFFE,
138141
// Not connected
139142
NC = (int)0xFFFFFFFF
140143
} PinName;

libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_RBLAB_NRF51822/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ typedef enum {
162162
A4 = p5,
163163
A5 = p6,
164164

165+
// Do not care
166+
DONT_CARE = (int)0xFFFFFFFE,
165167
// Not connected
166168
NC = (int)0xFFFFFFFF
167169
} PinName;

libraries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/serial_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
#define UART_NUM 1
2929

3030
static const PinMap PinMap_UART_TX[] = {
31-
{TX_PIN_NUMBER, UART_0, 1},
31+
{DONT_CARE, UART_0, 1},
3232
{ NC , NC , 0}
3333
};
3434

3535
static const PinMap PinMap_UART_RX[] = {
36-
{RX_PIN_NUMBER, UART_0, 1},
36+
{DONT_CARE, UART_0, 1},
3737
{NC , NC , 0}
3838
};
3939

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11U6X/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ typedef enum {
157157
SDA= P0_5, // same port as A4
158158
SCL= P0_4, // same port as A5
159159

160+
// Do not care
161+
DONT_CARE = (int)0xFFFFFFFE,
160162
// Not connected
161163
NC = (int)0xFFFFFFFF,
162164
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_ARCH_GPRS/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ typedef enum {
164164
I2C_SCL = D15,
165165
I2C_SDA = D14,
166166

167+
// Do not care
168+
DONT_CARE = (int)0xFFFFFFFE,
167169
// Not connected
168170
NC = (int)0xFFFFFFFF,
169171
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_GHI_MBUINO/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ typedef enum {
7474
I2C_SCL = P0_4,
7575
I2C_SDA = P0_5,
7676

77+
// Do not care
78+
DONT_CARE = (int)0xFFFFFFFE,
7779
// Not connected
7880
NC = (int)0xFFFFFFFF,
7981
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_LPC11U24_301/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ typedef enum {
135135
USBTX = P0_19,
136136
USBRX = P0_18,
137137

138+
// Do not care
139+
DONT_CARE = (int)0xFFFFFFFE,
138140
// Not connected
139141
NC = (int)0xFFFFFFFF,
140142
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_LPC11U24_401/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ typedef enum {
164164
I2C_SCL = D15,
165165
I2C_SDA = D14,
166166

167+
// Do not care
168+
DONT_CARE = (int)0xFFFFFFFE,
167169
// Not connected
168170
NC = (int)0xFFFFFFFF,
169171
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_LPC11U35_401/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ typedef enum {
130130
UART_TX = P0_19,
131131
UART_RX = P0_18,
132132

133+
// Do not care
134+
DONT_CARE = (int)0xFFFFFFFE,
133135
// Not connected
134136
NC = (int)0xFFFFFFFF,
135137
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_LPCCAPPUCCINO/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ typedef enum {
103103
UART_TX = P0_19,
104104
UART_RX = P0_18,
105105

106+
// Do not care
107+
DONT_CARE = (int)0xFFFFFFFE,
106108
// Not connected
107109
NC = (int)0xFFFFFFFF,
108110
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/TARGET_LPC11U35_501/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ typedef enum {
145145
UART_TX = P0_19,
146146
UART_RX = P0_18,
147147

148+
// Do not care
149+
DONT_CARE = (int)0xFFFFFFFE,
148150
// Not connected
149151
NC = (int)0xFFFFFFFF,
150152
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/TARGET_XADOW_M0/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ typedef enum {
148148
I2C_SCL = P0_4,
149149
I2C_SDA = P0_5,
150150

151+
// Do not care
152+
DONT_CARE = (int)0xFFFFFFFE,
151153
// Not connected
152154
NC = (int)0xFFFFFFFF,
153155
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ typedef enum {
188188
dp27 = P0_4,
189189
dp28 = P0_7,
190190

191+
// Do not care
192+
DONT_CARE = (int)0xFFFFFFFE,
191193
// Not connected
192194
NC = (int)0xFFFFFFFF,
193195
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11XX/PinNames.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ typedef enum {
202202
dip28 = P0_7,
203203

204204

205-
205+
// Do not care
206+
DONT_CARE = (int)0xFFFFFFFE,
206207
// Not connected
207208
NC = (int)0xFFFFFFFF,
208209
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC13XX/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ typedef enum {
115115
UART_TX = P0_19,
116116
UART_RX = P0_18,
117117

118+
// Do not care
119+
DONT_CARE = (int)0xFFFFFFFE,
118120
// Not connected
119121
NC = (int)0xFFFFFFFF,
120122

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC15XX/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ typedef enum {
7575
SDA= P0_23, // same port as A4
7676
SCL= P0_22, // same port as A5
7777

78+
// Do not care
79+
DONT_CARE = (int)0xFFFFFFFE,
7880
// Not connected
7981
NC = (int)0xFFFFFFFF,
8082
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/TARGET_ARCH_PRO/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ typedef enum {
109109
I2C_SCL = D15,
110110
I2C_SDA = D14,
111111

112+
// Do not care
113+
DONT_CARE = (int)0xFFFFFFFE,
112114
// Not connected
113115
NC = (int)0xFFFFFFFF
114116
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/TARGET_MBED_LPC1768/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ typedef enum {
109109
I2C_SCL = D15,
110110
I2C_SDA = D14,
111111

112+
// Do not care
113+
DONT_CARE = (int)0xFFFFFFFE,
112114
// Not connected
113115
NC = (int)0xFFFFFFFF
114116
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ typedef enum {
158158
USBTXD = USBTX, // identical USBTX
159159
USBRXD = USBRX, // identical USBRX
160160

161+
// Do not care
162+
DONT_CARE = (int)0xFFFFFFFE,
161163
// Not connected
162164
NC = (int)0xFFFFFFFF
163165
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ typedef enum {
7676
USBTX = P0_2,
7777
USBRX = P0_3,
7878

79+
// Do not care
80+
DONT_CARE = (int)0xFFFFFFFE,
7981
// Not connected
8082
NC = (int)0xFFFFFFFF
8183
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ typedef enum {
109109
A5 = p20,
110110

111111

112+
// Do not care
113+
DONT_CARE = (int)0xFFFFFFFE,
112114
// Not connected
113115
NC = (int)0xFFFFFFFF
114116
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ typedef enum {
451451
// Dedicated pin (no GPIO)
452452
P_DED = MBED_PIN(0, 0, NO_GPIO, 0),
453453

454+
// Do not care
455+
DONT_CARE = (int)0xFFFFFFFE,
454456
// Not connected
455457
NC = (int)0xFFFFFFFF,
456458

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC810/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ typedef enum {
5353
USBTX = P0_4,
5454
USBRX = P0_0,
5555

56+
// Do not care
57+
DONT_CARE = (int)0xFFFFFFFE,
5658
// Not connected
5759
NC = (int)0xFFFFFFFF,
5860
} PinName;

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC812/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ typedef enum {
8181
USBTX = P0_6,
8282
USBRX = P0_1,
8383

84+
// Do not care
85+
DONT_CARE = (int)0xFFFFFFFE,
8486
// Not connected
8587
NC = (int)0xFFFFFFFF,
8688
} PinName;

libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ typedef enum {
211211
SPI_CS = PB_6,
212212
PWM_OUT = PB_3,
213213

214+
// Do not care
215+
DONT_CARE = (int)0xFFFFFFFE,
214216
// Not connected
215217
NC = (int)0xFFFFFFFF
216218
} PinName;

libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F100RB/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ typedef enum {
171171
SPI_CS = PB_12,
172172
PWM_OUT = PB_8,
173173

174+
// Do not care
175+
DONT_CARE = (int)0xFFFFFFFE,
174176
// Not connected
175177
NC = (int)0xFFFFFFFF
176178
} PinName;

libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F303VC/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ typedef enum {
207207
SPI_CS = PA_15,
208208
PWM_OUT = PB_1,
209209

210+
// Do not care
211+
DONT_CARE = (int)0xFFFFFFFE,
210212
// Not connected
211213
NC = (int)0xFFFFFFFF
212214
} PinName;

libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F407VG/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ typedef enum {
264264
SPI_CS = PB_6,
265265
PWM_OUT = PB_3,
266266

267+
// Do not care
268+
DONT_CARE = (int)0xFFFFFFFE,
267269
// Not connected
268270
NC = (int)0xFFFFFFFF
269271
} PinName;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ typedef enum {
160160
SPI_CS = PB_6,
161161
PWM_OUT = PC_7,
162162

163+
// Do not care
164+
DONT_CARE = (int)0xFFFFFFFE,
163165
// Not connected
164166
NC = (int)0xFFFFFFFF
165167
} PinName;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F072RB/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ typedef enum {
164164
SPI_CS = PB_6,
165165
PWM_OUT = PB_3,
166166

167+
// Do not care
168+
DONT_CARE = (int)0xFFFFFFFE,
167169
// Not connected
168170
NC = (int)0xFFFFFFFF
169171
} PinName;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ typedef enum {
148148
SPI_CS = PB_6,
149149
PWM_OUT = PB_3,
150150

151+
// Do not care
152+
DONT_CARE = (int)0xFFFFFFFE,
151153
// Not connected
152154
NC = (int)0xFFFFFFFF
153155
} PinName;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ typedef enum {
155155
SPI_CS = PB_6,
156156
PWM_OUT = PB_4,
157157

158+
// Do not care
159+
DONT_CARE = (int)0xFFFFFFFE,
158160
// Not connected
159161
NC = (int)0xFFFFFFFF
160162
} PinName;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F334R8/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ typedef enum {
163163
SPI_CS = PB_6,
164164
PWM_OUT = PB_4,
165165

166+
// Do not care
167+
DONT_CARE = (int)0xFFFFFFFE,
166168
// Not connected
167169
NC = (int)0xFFFFFFFF
168170
} PinName;

0 commit comments

Comments
 (0)