Files
ArduinoCore-mbed/cores/arduino/pinToIndex.cpp
Martino Facchin 1d33915d4f Change digitalPinToPinName() into a first class function
This fixes some issues with the new arduino-cli, since compling a lot of libraries
forces linking them as archives, breaking the inline.

Must be tested in the CI to make sure it dones't break anyhing
2022-02-17 10:38:05 +01:00

21 lines
397 B
C++

#include "Arduino.h"
#include "pinDefinitions.h"
int PinNameToIndex(PinName P) {
for (pin_size_t i=0; i < PINS_COUNT; i++) {
if (g_APinDescription[i].name == P) {
return i;
}
}
return NOT_A_PIN;
}
#ifdef __cplusplus__
extern "C" {
#endif
PinName digitalPinToPinName(pin_size_t P) {
return (P >= PINS_COUNT ? NC : g_APinDescription[P].name);
};
#ifdef __cplusplus__
}
#endif