User board-specific terms in error messages #3886

progress
This commit is contained in:
rusefillc 2022-02-03 12:45:26 -05:00
parent 48bfb67a22
commit 014b8293a5
3 changed files with 11 additions and 1 deletions

View File

@ -252,6 +252,5 @@ const char *portname(ioportid_t GPIOx);
void printSpiConfig(const char *msg, spi_device_e device);
brain_pin_e parseBrainPin(const char *str);
const char *hwPortname(brain_pin_e brainPin);
extern EnginePins enginePins;

View File

@ -189,6 +189,10 @@ void printSpiConfig(const char *msg, spi_device_e device) {
#endif // HAL_USE_SPI
}
__attribute__((weak)) const char * getBoardSpecificPinName(brain_pin_e brainPin) {
return nullptr;
}
const char *hwPortname(brain_pin_e brainPin) {
if (brainPin == GPIO_INVALID) {
return "INVALID";
@ -196,6 +200,11 @@ const char *hwPortname(brain_pin_e brainPin) {
if (brainPin == GPIO_UNASSIGNED) {
return "NONE";
}
const char * boardSpecificPinName = getBoardSpecificPinName(brainPin);
if (boardSpecificPinName != nullptr) {
return boardSpecificPinName;
}
portNameStream.eos = 0; // reset
if (brain_pin_is_onchip(brainPin)) {

View File

@ -58,6 +58,8 @@ int getBrainPinIndex(brain_pin_e brainPin);
int brainPin_to_index(brain_pin_e brainPin);
unsigned int getBrainPinOnchipNum(void);
unsigned int getBrainPinTotalNum(void);
const char *hwPortname(brain_pin_e brainPin);
const char * getBoardSpecificPinName(brain_pin_e brainPin);
#ifdef __cplusplus
const char* & getBrainUsedPin(unsigned int idx);