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) {
3636 return peripheral ;
3737}
3838
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+
3958uint32_t pinmap_find_function (PinName pin , const PinMap * map ) {
4059 while (map -> pin != NC ) {
4160 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);
4141
4242PinName pin_pinName (const PinMap * map );
4343
44- void * pinmap_peripheral (PinName pin , const PinMap * map );
45- uint32_t pinmap_function (PinName pin , const PinMap * map );
4644void * 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 );
4748uint32_t pinmap_find_function (PinName pin , const PinMap * map );
49+ uint32_t pinmap_function (PinName pin , const PinMap * map );
4850void * pinmap_merge_peripheral (void * a , void * b );
4951
5052#ifdef __cplusplus
You can’t perform that action at this time.
0 commit comments