Code: Select all
esp_deep_sleep_enable_ext0_wakeup (GPIO_NUM_33, 0);
I understand this can be done with a stub, but I'm not sure if it's really possible.
Is it possible, can anyone give an example?
Code: Select all
esp_deep_sleep_enable_ext0_wakeup (GPIO_NUM_33, 0);
Code: Select all
// Set level which will trigger wakeup
SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, level, RTC_CNTL_EXT_WAKEUP0_LV_S);
Code: Select all
static void RTC_IRAM_ATTR wake_stub()
{
ets_printf(alive_prnt);
SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, 1, RTC_CNTL_EXT_WAKEUP0_LV_S);
}
This is repeated while I've the external source in LOWrst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
wake_stub alive
ets Jun 8 2016 00:22:57
rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0008,len:8
load:0x3fff0010,len:160
load:0x40078000,len:10632
load:0x40080000,len:252
entry 0x40080034
Boot number: 1
Wakeup was not caused by deep sleep
Going to sleep now
ets Jun 8 2016 00:22:57
Code: Select all
int current_level = REG_GET_FIELD(RTC_CNTL_EXT_WAKEUP_CONF_REG, RTC_CNTL_EXT_WAKEUP0_LV);
REG_SET_FIELD(RTC_CNTL_EXT_WAKEUP_CONF_REG, RTC_CNTL_EXT_WAKEUP0_LV, !current_level);
Code: Select all
#define PULSE_CNT_IS_HIGH() \
((REG_GET_FIELD(RTC_GPIO_IN_REG, RTC_GPIO_IN_NEXT) \
& BIT(GPIO_NUM_33)) == 1)
Code: Select all
int current_level = REG_GET_FIELD(RTC_CNTL_EXT_WAKEUP_CONF_REG, RTC_CNTL_EXT_WAKEUP0_LV);
Code: Select all
REG_SET_FIELD(RTC_CNTL_EXT_WAKEUP_CONF_REG, RTC_CNTL_EXT_WAKEUP0_LV, !current_level);
Code: Select all
do {
while (PULSE_CNT_IS_HIGH()) {
int current_level = REG_GET_FIELD(RTC_CNTL_EXT_WAKEUP_CONF_REG, RTC_CNTL_EXT_WAKEUP0_LV);
REG_SET_FIELD(RTC_CNTL_EXT_WAKEUP_CONF_REG, RTC_CNTL_EXT_WAKEUP0_LV, !current_level);
}
// debounce, 10ms
ets_delay_us(10000);
} while (PULSE_CNT_IS_HIGH());
You're forgivenguillermop wrote:sorry if what I'm doing is nonsense
Hahaha ThanksWiFive wrote:You're forgivenguillermop wrote:sorry if what I'm doing is nonsense
Code: Select all
RTC_DATA_ATTR int wakeup_level = -1;
Code: Select all
if(wakeup_level == -1){
wakeup_level = 0;
}else{
wakeup_level = !REG_GET_FIELD(RTC_CNTL_EXT_WAKEUP_CONF_REG, RTC_CNTL_EXT_WAKEUP0_LV);
}
Code: Select all
esp_deep_sleep_enable_ext0_wakeup(GPIO_NUM_33, wakeup_level);
Users browsing this forum: No registered users and 74 guests