reducing GPIO code duplication
This commit is contained in:
parent
fa57f32a37
commit
b2547c629d
|
@ -784,14 +784,14 @@ const char *portname(ioportid_t GPIOx) {
|
||||||
if (GPIOx == GPIOI)
|
if (GPIOx == GPIOI)
|
||||||
return "PI";
|
return "PI";
|
||||||
#endif /* GPIOI */
|
#endif /* GPIOI */
|
||||||
#if defined(GPIOJ)
|
#if defined(GPIOJ_BASE)
|
||||||
if (GPIOx == GPIOJ)
|
if (GPIOx == GPIOJ)
|
||||||
return "PJ";
|
return "PJ";
|
||||||
#endif /* GPIOJ */
|
#endif /* GPIOJ_BASE */
|
||||||
#if defined(GPIOK)
|
#if defined(GPIOK_BASE)
|
||||||
if (GPIOx == GPIOK)
|
if (GPIOx == GPIOK)
|
||||||
return "PK";
|
return "PK";
|
||||||
#endif /* GPIOK */
|
#endif /* GPIOK_BASE */
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,14 +825,14 @@ static int getPortIndex(ioportid_t port) {
|
||||||
if (port == GPIOI)
|
if (port == GPIOI)
|
||||||
return 8;
|
return 8;
|
||||||
#endif /* STM32_HAS_GPIOI */
|
#endif /* STM32_HAS_GPIOI */
|
||||||
#if defined(GPIOJ)
|
#if defined(GPIOJ_BASE)
|
||||||
if (port == GPIOJ)
|
if (port == GPIOJ)
|
||||||
return 9;
|
return 9;
|
||||||
#endif /* GPIOJ */
|
#endif /* GPIOJ_BASE */
|
||||||
#if defined(GPIOK)
|
#if defined(GPIOK_BASE)
|
||||||
if (port == GPIOK)
|
if (port == GPIOK)
|
||||||
return 10;
|
return 10;
|
||||||
#endif /* GPIOK */
|
#endif /* GPIOK_BASE */
|
||||||
firmwareError(ObdCode::CUSTOM_ERR_UNKNOWN_PORT, "unknown port");
|
firmwareError(ObdCode::CUSTOM_ERR_UNKNOWN_PORT, "unknown port");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue