File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,25 @@ void* pinmap_peripheral(PinName pin, const PinMap* map) {
36
36
return peripheral ;
37
37
}
38
38
39
+ PinName pinmap_find_pin (void * peripheral , const PinMap * map ) {
40
+ while (map -> peripheral != NP ) {
41
+ if (map -> peripheral == peripheral )
42
+ return map -> pin ;
43
+ map ++ ;
44
+ }
45
+ return NC ;
46
+ }
47
+
48
+ PinName pinmap_pin (void * peripheral , const PinMap * map ) {
49
+ PinName pin = NC ;
50
+
51
+ if (peripheral != NP ) {
52
+ pin = pinmap_find_pin (peripheral , map );
53
+ }
54
+ // else error("pinmap not found for pin");
55
+ return pin ;
56
+ }
57
+
39
58
uint32_t pinmap_find_function (PinName pin , const PinMap * map ) {
40
59
while (map -> pin != NC ) {
41
60
if (map -> pin == pin )
Original file line number Diff line number Diff line change @@ -41,10 +41,12 @@ void pin_function(PinName pin, int function);
41
41
42
42
PinName pin_pinName (const PinMap * map );
43
43
44
- void * pinmap_peripheral (PinName pin , const PinMap * map );
45
- uint32_t pinmap_function (PinName pin , const PinMap * map );
46
44
void * pinmap_find_peripheral (PinName pin , const PinMap * map );
45
+ void * pinmap_peripheral (PinName pin , const PinMap * map );
46
+ PinName pinmap_find_pin (void * peripheral , const PinMap * map );
47
+ PinName pinmap_pin (void * peripheral , const PinMap * map );
47
48
uint32_t pinmap_find_function (PinName pin , const PinMap * map );
49
+ uint32_t pinmap_function (PinName pin , const PinMap * map );
48
50
void * pinmap_merge_peripheral (void * a , void * b );
49
51
50
52
#ifdef __cplusplus
You can’t perform that action at this time.
0 commit comments