refactoring: extracting method
This commit is contained in:
parent
c6ed93b6fb
commit
1f07d65fb1
|
@ -383,7 +383,7 @@ void initHardware(Logging *l) {
|
||||||
if (boardConfiguration->boardTestModeJumperPin != GPIO_UNASSIGNED) {
|
if (boardConfiguration->boardTestModeJumperPin != GPIO_UNASSIGNED) {
|
||||||
mySetPadMode2("board test", boardConfiguration->boardTestModeJumperPin,
|
mySetPadMode2("board test", boardConfiguration->boardTestModeJumperPin,
|
||||||
PAL_MODE_INPUT_PULLUP);
|
PAL_MODE_INPUT_PULLUP);
|
||||||
isBoardTestMode_b = (!palReadPad(getHwPort(boardConfiguration->boardTestModeJumperPin), getHwPin(boardConfiguration->boardTestModeJumperPin)));
|
isBoardTestMode_b = (!efiReadPin(boardConfiguration->boardTestModeJumperPin));
|
||||||
|
|
||||||
// we can now relese this pin, it is actually used as output sometimes
|
// we can now relese this pin, it is actually used as output sometimes
|
||||||
unmarkPin(boardConfiguration->boardTestModeJumperPin);
|
unmarkPin(boardConfiguration->boardTestModeJumperPin);
|
||||||
|
|
|
@ -53,6 +53,10 @@ ioportmask_t getHwPin(brain_pin_e brainPin) {
|
||||||
return brainPin % PORT_SIZE;
|
return brainPin % PORT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool efiReadPin(brain_pin_e pin) {
|
||||||
|
return palReadPad(getHwPort(pin), getHwPin(pin));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method would set an error condition if pin is already used
|
* This method would set an error condition if pin is already used
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__)
|
||||||
void mySetPadMode2(const char *msg, brain_pin_e pin, iomode_t mode);
|
void mySetPadMode2(const char *msg, brain_pin_e pin, iomode_t mode);
|
||||||
|
|
||||||
|
bool efiReadPin(brain_pin_e pin);
|
||||||
|
|
||||||
iomode_t getInputMode(pin_input_mode_e mode);
|
iomode_t getInputMode(pin_input_mode_e mode);
|
||||||
void efiIcuStart(ICUDriver *icup, const ICUConfig *config);
|
void efiIcuStart(ICUDriver *icup, const ICUConfig *config);
|
||||||
#endif /* EFI_GPIO_HARDWARE */
|
#endif /* EFI_GPIO_HARDWARE */
|
||||||
|
|
Loading…
Reference in New Issue