refactoring - reducing GPIO complexity
This commit is contained in:
parent
ddcdb996dc
commit
9535094fd9
|
@ -54,10 +54,12 @@ ioportmask_t getHwPin(brain_pin_e brainPin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated: todo finish migration to 'mySetPadMode2' with 'brain_pin_e' parameter
|
|
||||||
* This method would set an error condition if pin is already used
|
* This method would set an error condition if pin is already used
|
||||||
*/
|
*/
|
||||||
void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t mode) {
|
void mySetPadMode2(const char *msg, brain_pin_e brainPin, iomode_t mode) {
|
||||||
|
ioportid_t port = getHwPort(brainPin);
|
||||||
|
ioportmask_t pin = getHwPin(brainPin);
|
||||||
|
|
||||||
if (port == GPIO_NULL) {
|
if (port == GPIO_NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -72,10 +74,6 @@ void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t m
|
||||||
palSetPadMode(port, pin, mode);
|
palSetPadMode(port, pin, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mySetPadMode2(const char *msg, brain_pin_e pin, iomode_t mode) {
|
|
||||||
mySetPadMode(msg, getHwPort(pin), getHwPin(pin), mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
iomode_t getInputMode(pin_input_mode_e mode) {
|
iomode_t getInputMode(pin_input_mode_e mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case PI_PULLUP:
|
case PI_PULLUP:
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
// LED_HUGE_20,
|
// LED_HUGE_20,
|
||||||
|
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||||
void mySetPadMode(const char *msg, ioportid_t port, ioportmask_t pin, iomode_t mode);
|
|
||||||
void mySetPadMode2(const char *msg, brain_pin_e pin, iomode_t mode);
|
void mySetPadMode2(const char *msg, brain_pin_e pin, iomode_t mode);
|
||||||
|
|
||||||
iomode_t getInputMode(pin_input_mode_e mode);
|
iomode_t getInputMode(pin_input_mode_e mode);
|
||||||
|
|
Loading…
Reference in New Issue