Fix ESP32 GPIO16 init

This commit is contained in:
Theo Arends 2020-10-09 10:28:17 +02:00
parent 9497a9d505
commit 05bfb71aa6
2 changed files with 8 additions and 0 deletions

View File

@ -87,7 +87,11 @@ void ButtonInit(void)
for (uint32_t i = 0; i < MAX_KEYS; i++) {
if (PinUsed(GPIO_KEY1, i)) {
Button.present++;
#ifdef ESP8266
pinMode(Pin(GPIO_KEY1, i), bitRead(Button.no_pullup_mask, i) ? INPUT : ((16 == Pin(GPIO_KEY1, i)) ? INPUT_PULLDOWN_16 : INPUT_PULLUP));
#else // ESP32
pinMode(Pin(GPIO_KEY1, i), bitRead(Button.no_pullup_mask, i) ? INPUT : INPUT_PULLUP);
#endif
}
#ifdef USE_ADC
else if (PinUsed(GPIO_ADC_BUTTON, i) || PinUsed(GPIO_ADC_BUTTON_INV, i)) {

View File

@ -202,7 +202,11 @@ void SwitchInit(void)
Switch.last_state[i] = 1; // Init global to virtual switch state;
if (PinUsed(GPIO_SWT1, i)) {
Switch.present++;
#ifdef ESP8266
pinMode(Pin(GPIO_SWT1, i), bitRead(Switch.no_pullup_mask, i) ? INPUT : ((16 == Pin(GPIO_SWT1, i)) ? INPUT_PULLDOWN_16 : INPUT_PULLUP));
#else // ESP32
pinMode(Pin(GPIO_SWT1, i), bitRead(Switch.no_pullup_mask, i) ? INPUT : INPUT_PULLUP);
#endif
if (ac_detect) {
Switch.state[i] = 0x80 + 2 * AC_PERIOD;
Switch.last_state[i] = 0; // Will set later in the debouncing code