diff --git a/components/at/include/esp_at_core.h b/components/at/include/esp_at_core.h index 43c72288d..25a878b26 100644 --- a/components/at/include/esp_at_core.h +++ b/components/at/include/esp_at_core.h @@ -90,7 +90,8 @@ typedef enum { */ typedef struct { void (*status_callback)(esp_at_status_type status); /*!< callback when AT status changes */ - void (*pre_sleep_callback)(at_sleep_mode_t mode); /*!< callback before enter modem sleep and light sleep */ + void (*pre_sleep_callback)(at_sleep_mode_t mode); /*!< callback before entering light sleep */ + void (*pre_wakeup_callback)(void); /*!< callback before waking up from light sleep */ void (*pre_deepsleep_callback)(void); /*!< callback before enter deep sleep */ void (*pre_restart_callback)(void); /*!< callback before restart */ void (*pre_active_write_data_callback)(at_write_data_fn_t); /*!< callback before write data */ diff --git a/components/at/lib/VERSION b/components/at/lib/VERSION index 34682bbbe..dd3e4ffdd 100644 --- a/components/at/lib/VERSION +++ b/components/at/lib/VERSION @@ -1,5 +1,5 @@ -ESP32: c31b833 -ESP32C3: be2bd9b -ESP32C2: be2bd9b -ESP32C6: be2bd9b -ESP32S2: c31b833 +ESP32: d4ece29 +ESP32C3: d4ece29 +ESP32C2: d4ece29 +ESP32C6: d4ece29 +ESP32S2: d4ece29 diff --git a/components/at/lib/libesp32_at_core.a b/components/at/lib/libesp32_at_core.a index b5daba01e..fef58b63b 100644 Binary files a/components/at/lib/libesp32_at_core.a and b/components/at/lib/libesp32_at_core.a differ diff --git a/components/at/lib/libesp32_at_core_silence.a b/components/at/lib/libesp32_at_core_silence.a index 51df85b3c..26a81a873 100644 Binary files a/components/at/lib/libesp32_at_core_silence.a and b/components/at/lib/libesp32_at_core_silence.a differ diff --git a/components/at/lib/libesp32c2_at_core.a b/components/at/lib/libesp32c2_at_core.a index 3a2c9d788..7d5c6e06b 100644 Binary files a/components/at/lib/libesp32c2_at_core.a and b/components/at/lib/libesp32c2_at_core.a differ diff --git a/components/at/lib/libesp32c2_at_core_silence.a b/components/at/lib/libesp32c2_at_core_silence.a index e1bd942df..3c675346f 100644 Binary files a/components/at/lib/libesp32c2_at_core_silence.a and b/components/at/lib/libesp32c2_at_core_silence.a differ diff --git a/components/at/lib/libesp32c3_at_core.a b/components/at/lib/libesp32c3_at_core.a index 8148595f4..2dfc3e945 100644 Binary files a/components/at/lib/libesp32c3_at_core.a and b/components/at/lib/libesp32c3_at_core.a differ diff --git a/components/at/lib/libesp32c3_at_core_silence.a b/components/at/lib/libesp32c3_at_core_silence.a index 1c99544f9..377689802 100644 Binary files a/components/at/lib/libesp32c3_at_core_silence.a and b/components/at/lib/libesp32c3_at_core_silence.a differ diff --git a/components/at/lib/libesp32c6_at_core.a b/components/at/lib/libesp32c6_at_core.a index af5bc7d53..fa860e825 100644 Binary files a/components/at/lib/libesp32c6_at_core.a and b/components/at/lib/libesp32c6_at_core.a differ diff --git a/components/at/lib/libesp32c6_at_core_silence.a b/components/at/lib/libesp32c6_at_core_silence.a index fecaa0e06..ab764a086 100644 Binary files a/components/at/lib/libesp32c6_at_core_silence.a and b/components/at/lib/libesp32c6_at_core_silence.a differ diff --git a/components/at/lib/libesp32s2_at_core.a b/components/at/lib/libesp32s2_at_core.a index 0be95f88c..d94724a23 100644 Binary files a/components/at/lib/libesp32s2_at_core.a and b/components/at/lib/libesp32s2_at_core.a differ diff --git a/components/at/lib/libesp32s2_at_core_silence.a b/components/at/lib/libesp32s2_at_core_silence.a index bab2d00ea..12247ca83 100644 Binary files a/components/at/lib/libesp32s2_at_core_silence.a and b/components/at/lib/libesp32s2_at_core_silence.a differ diff --git a/main/interface/at_interface_api.c b/main/interface/at_interface_api.c index b06cecc45..768644950 100644 --- a/main/interface/at_interface_api.c +++ b/main/interface/at_interface_api.c @@ -132,6 +132,14 @@ static void at_normal_sleep_before_cb(at_sleep_mode_t mode) } } +static void at_normal_wakeup_before_cb(void) +{ + // do some special things from the interface hook before wakeup + if (s_interface_hooks.pre_wakeup_callback) { + s_interface_hooks.pre_wakeup_callback(); + } +} + static void at_deep_sleep_before_cb(void) { // do some special things from the interface hook before deep sleep @@ -164,6 +172,7 @@ void at_interface_hooks(esp_at_custom_ops_struct *if_hooks) if (if_hooks) { s_interface_hooks.status_callback = if_hooks->status_callback; s_interface_hooks.pre_sleep_callback = if_hooks->pre_sleep_callback; + s_interface_hooks.pre_wakeup_callback = if_hooks->pre_wakeup_callback; s_interface_hooks.pre_deepsleep_callback = if_hooks->pre_deepsleep_callback; s_interface_hooks.pre_restart_callback = if_hooks->pre_restart_callback; s_interface_hooks.pre_active_write_data_callback = if_hooks->pre_active_write_data_callback; @@ -172,6 +181,7 @@ void at_interface_hooks(esp_at_custom_ops_struct *if_hooks) esp_at_custom_ops_struct at_hooks = { .status_callback = at_transmit_mode_switch_cb, .pre_sleep_callback = at_normal_sleep_before_cb, + .pre_wakeup_callback = at_normal_wakeup_before_cb, .pre_deepsleep_callback = at_deep_sleep_before_cb, .pre_restart_callback = at_restart_before_cb, .pre_active_write_data_callback = at_port_tx_data_before_cb, diff --git a/main/interface/socket/at_socket_task.c b/main/interface/socket/at_socket_task.c index 35718f71a..cccd84852 100644 --- a/main/interface/socket/at_socket_task.c +++ b/main/interface/socket/at_socket_task.c @@ -231,6 +231,7 @@ void at_interface_init(void) esp_at_custom_ops_struct socket_hooks = { .status_callback = at_socket_transmit_mode_switch_cb, .pre_sleep_callback = NULL, + .pre_wakeup_callback = NULL, .pre_deepsleep_callback = NULL, .pre_restart_callback = NULL, .pre_active_write_data_callback = NULL, diff --git a/main/interface/spi/at_spi_task.c b/main/interface/spi/at_spi_task.c index f461883ec..f8d133f8a 100644 --- a/main/interface/spi/at_spi_task.c +++ b/main/interface/spi/at_spi_task.c @@ -332,6 +332,16 @@ static void at_spi_init(void) xTaskCreate(at_spi_task, "at_spi_task", 4096, NULL, 10, NULL); } +static void at_spi_sleep_before_cb(at_sleep_mode_t mode) +{ + // do something before entering light-sleep +} + +static void at_spi_wakeup_before_cb(void) +{ + // do something before waking up from light-sleep +} + void at_interface_init(void) { // init interface driver @@ -347,7 +357,15 @@ void at_interface_init(void) at_interface_ops_init(&spi_ops); // init interface hooks - at_interface_hooks(NULL); + esp_at_custom_ops_struct spi_hooks = { + .pre_sleep_callback = at_spi_sleep_before_cb, + .pre_wakeup_callback = at_spi_wakeup_before_cb, + .status_callback = NULL, + .pre_deepsleep_callback = NULL, + .pre_restart_callback = NULL, + .pre_active_write_data_callback = NULL, + }; + at_interface_hooks(&spi_hooks); } #endif diff --git a/main/interface/uart/at_uart_task.c b/main/interface/uart/at_uart_task.c index a3f397f0b..667b16c60 100644 --- a/main/interface/uart/at_uart_task.c +++ b/main/interface/uart/at_uart_task.c @@ -276,6 +276,7 @@ void at_interface_init(void) esp_at_custom_ops_struct uart_hooks = { .status_callback = at_uart_transmit_mode_switch_cb, .pre_sleep_callback = NULL, + .pre_wakeup_callback = NULL, .pre_deepsleep_callback = at_uart_deepsleep_before_cb, .pre_restart_callback = at_uart_restart_before_cb, .pre_active_write_data_callback = NULL,