Skip to content

Commit f01162e

Browse files
committed
[pinmap] Move pin_pinName() as static
Function always return map->pin Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 595c139 commit f01162e

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

cores/arduino/stm32/pinmap.c

+13-22
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ const uint32_t pin_map_ll[16] = {
3838
LL_GPIO_PIN_15
3939
};
4040

41+
bool pin_in_pinmap(PinName pin, const PinMap *map)
42+
{
43+
if (pin != (PinName)NC) {
44+
while (map->pin != NC) {
45+
if (map->pin == pin) {
46+
return true;
47+
}
48+
map++;
49+
}
50+
}
51+
return false;
52+
}
53+
4154
void *pinmap_find_peripheral(PinName pin, const PinMap *map)
4255
{
4356
while (map->pin != NC) {
@@ -101,19 +114,6 @@ uint32_t pinmap_function(PinName pin, const PinMap *map)
101114
return function;
102115
}
103116

104-
bool pin_in_pinmap(PinName pin, const PinMap *map)
105-
{
106-
if (pin != (PinName)NC) {
107-
while (map->pin != NC) {
108-
if (map->pin == pin) {
109-
return true;
110-
}
111-
map++;
112-
}
113-
}
114-
return false;
115-
}
116-
117117
// Merge peripherals
118118
void *pinmap_merge_peripheral(void *a, void *b)
119119
{
@@ -133,12 +133,3 @@ void *pinmap_merge_peripheral(void *a, void *b)
133133
// mis-match error case
134134
return NP;
135135
}
136-
137-
PinName pin_pinName(const PinMap *map)
138-
{
139-
if (map->pin != (PinName)NC) {
140-
return map->pin;
141-
} else {
142-
return (PinName)NC;
143-
}
144-
}

cores/arduino/stm32/pinmap.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ typedef struct {
4343
bool pin_in_pinmap(PinName pin, const PinMap *map);
4444
void pin_function(PinName pin, int function);
4545

46-
PinName pin_pinName(const PinMap *map);
46+
static inline PinName pin_pinName(const PinMap *map)
47+
{
48+
return map->pin;
49+
}
4750

4851
void *pinmap_find_peripheral(PinName pin, const PinMap *map);
4952
void *pinmap_peripheral(PinName pin, const PinMap *map);

0 commit comments

Comments
 (0)