Skip to content

Commit 99058c1

Browse files
author
fpr
committed
Adds a pin function to get PinName from PinMap
Signed-off-by: fpr <[email protected]>
1 parent 402a26c commit 99058c1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,11 @@ void* pinmap_merge_peripheral(void* a, void* b) {
8282
// error("pinmap mis-match");
8383
return NP;
8484
}
85+
86+
PinName pin_pinName(const PinMap* map) {
87+
if(map->pin != (PinName)NC) {
88+
return map->pin;
89+
} else {
90+
return (PinName)NC;
91+
}
92+
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ typedef struct {
3939
bool pin_in_pinmap(PinName pin, const PinMap* map);
4040
void pin_function(PinName pin, int function);
4141

42+
PinName pin_pinName(const PinMap* map);
43+
4244
void* pinmap_peripheral(PinName pin, const PinMap* map);
4345
uint32_t pinmap_function(PinName pin, const PinMap* map);
4446
void* pinmap_find_peripheral(PinName pin, const PinMap* map);

0 commit comments

Comments
 (0)