Skip to content

Commit

Permalink
feat(core): Updated at core version to d4ece292
Browse files Browse the repository at this point in the history
- feat: Updated at lib version to v3.5.0.0-dev
- feat(ESPAT-2013): Added instance, proto, txt parameters to AT+MDNS command
- feat(ESPAT-2022): Added pre_wakeup_callback and process light-sleep hook event
- chore(ESPAT-2023): Added some return value checks for driver commands
  • Loading branch information
ustccw committed Jun 26, 2024
1 parent 230aae8 commit 9992e66
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 7 deletions.
3 changes: 2 additions & 1 deletion components/at/include/esp_at_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
10 changes: 5 additions & 5 deletions components/at/lib/VERSION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ESP32: c31b833
ESP32C3: be2bd9b
ESP32C2: be2bd9b
ESP32C6: be2bd9b
ESP32S2: c31b833
ESP32: d4ece29
ESP32C3: d4ece29
ESP32C2: d4ece29
ESP32C6: d4ece29
ESP32S2: d4ece29
Binary file modified components/at/lib/libesp32_at_core.a
Binary file not shown.
Binary file modified components/at/lib/libesp32_at_core_silence.a
Binary file not shown.
Binary file modified components/at/lib/libesp32c2_at_core.a
Binary file not shown.
Binary file modified components/at/lib/libesp32c2_at_core_silence.a
Binary file not shown.
Binary file modified components/at/lib/libesp32c3_at_core.a
Binary file not shown.
Binary file modified components/at/lib/libesp32c3_at_core_silence.a
Binary file not shown.
Binary file modified components/at/lib/libesp32c6_at_core.a
Binary file not shown.
Binary file modified components/at/lib/libesp32c6_at_core_silence.a
Binary file not shown.
Binary file modified components/at/lib/libesp32s2_at_core.a
Binary file not shown.
Binary file modified components/at/lib/libesp32s2_at_core_silence.a
Binary file not shown.
10 changes: 10 additions & 0 deletions main/interface/at_interface_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions main/interface/socket/at_socket_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 19 additions & 1 deletion main/interface/spi/at_spi_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions main/interface/uart/at_uart_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9992e66

Please sign in to comment.