The board I am using is the TTGO T-Display ESP32. It's schematic shows a pullup resistor on the push button input on GPIO_35.
I use the following and it works fine in the wake stub for GPIO_0/RTC_GPIO_11 but not for GPIO_35/RTC_GPIO_5.
Any ideas why? I think with might be in the REG_GET_FIELD but I am not finding much documentation on that (I assume it is out there, I just have not found it).
THANKS!
Code: Select all
#define PULSE_CNT_GPIO_NUM 0
#define PULSE_CNT_RTC_GPIO_NUM 11
static void RTC_IRAM_ATTR wake_stub(void)
{
#define PULSE_CNT_IS_LOW() \
((REG_GET_FIELD(RTC_GPIO_IN_REG, RTC_GPIO_IN_NEXT) & BIT(PULSE_CNT_RTC_GPIO_NUM)) == 0)
if (PULSE_CNT_IS_LOW())
{
ESP_RTC_LOGI("wake stub: Pulse Pin is LOW");
}
else
{ // GPIO_0 must be HIGH
ESP_RTC_LOGI("wake stub: Pulse Pin is HIGH");
}
// Set wakeup time in stub, if need to check GPIOs or read some sensor periodically in the stub.
esp_wake_stub_set_wakeup_time(1 * 1000000); // wake every second
// Print status.
ESP_RTC_LOGI("wake stub: going to deep sleep");
// Set stub entry, then going to deep sleep again.
esp_wake_stub_sleep(&wake_stub);
}