Skip to content

Commit 1016e2f

Browse files
fpistmxC0000005
authored andcommitted
[pinmap] Add pinmap_pinout() API
Allow to configure a pin as describe in a pinmap Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 297a40b commit 1016e2f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Diff for: cores/arduino/stm32/pinmap.c

+16
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,22 @@ void pin_function(PinName pin, int function)
130130
pin_DisconnectDebug(pin);
131131
}
132132

133+
void pinmap_pinout(PinName pin, const PinMap *map)
134+
{
135+
if (pin == NC) {
136+
return;
137+
}
138+
139+
while (map->pin != NC) {
140+
if (map->pin == pin) {
141+
pin_function(pin, map->function);
142+
return;
143+
}
144+
map++;
145+
}
146+
Error_Handler();
147+
}
148+
133149
void *pinmap_find_peripheral(PinName pin, const PinMap *map)
134150
{
135151
while (map->pin != NC) {

Diff for: cores/arduino/stm32/pinmap.h

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static inline PinName pin_pinName(const PinMap *map)
4848
return map->pin;
4949
}
5050

51+
void pinmap_pinout(PinName pin, const PinMap *map);
5152
void *pinmap_find_peripheral(PinName pin, const PinMap *map);
5253
void *pinmap_peripheral(PinName pin, const PinMap *map);
5354
PinName pinmap_find_pin(void *peripheral, const PinMap *map);

0 commit comments

Comments
 (0)