I have a keymatrix as below
When the column pins are low and a button is pressed the row pins which are INPUT_PULLUP are pulled down.
Below sketch seems to suggest that even though I pull the row pins down, the device won’t wake up.
void sleepSetup() {
// rows
pinMode(GPIO_NUM_3, INPUT_PULLUP);
pinMode(GPIO_NUM_4, INPUT_PULLUP);
pinMode(GPIO_NUM_8, INPUT_PULLUP);
pinMode(GPIO_NUM_9, INPUT_PULLUP);
pinMode(GPIO_NUM_20, INPUT_PULLUP);
gpio_wakeup_enable(GPIO_NUM_3, GPIO_INTR_LOW_LEVEL);
gpio_wakeup_enable(GPIO_NUM_4, GPIO_INTR_LOW_LEVEL);
gpio_wakeup_enable(GPIO_NUM_8, GPIO_INTR_LOW_LEVEL);
gpio_wakeup_enable(GPIO_NUM_9, GPIO_INTR_LOW_LEVEL);
gpio_wakeup_enable(GPIO_NUM_20, GPIO_INTR_LOW_LEVEL);
gpio_hold_en(GPIO_NUM_3);
gpio_hold_en(GPIO_NUM_4);
gpio_hold_en(GPIO_NUM_8);
gpio_hold_en(GPIO_NUM_9);
gpio_hold_en(GPIO_NUM_20);
// columns
pinMode(GPIO_NUM_10, OUTPUT);
pinMode(GPIO_NUM_21, OUTPUT);
digitalWrite(GPIO_NUM_10, LOW);
digitalWrite(GPIO_NUM_21, LOW);
gpio_hold_en(GPIO_NUM_10);
gpio_hold_en(GPIO_NUM_21);
}
void setup() {
sleepSetup();
Serial.begin(115200);
}
void loop() {
delay(2000);
Serial.println("will sleep");
delay(10000);
Serial.println("byeee");
esp_light_sleep_start();
Serial.println("woken up");
}