feat(soc): Add soc_caps macros for sleep support

- modify console example to use the new SOC_LIGHT_SLEEP_SUPPORTED
and SOC_DEEP_SLEEP_SUPPORTED macros when registering sleep commands

- remove exclusion of esp32p4 in basic and advanced example in
.build-test-rules.yml

- replace exclusion of esp32p4 for deep and light sleep tests with newly introduced macro

- remove the temporary disable check for esp32p4 and uses the
SOC_LIGHT_SLEEP_SUPPORTED maccro instead.
This commit is contained in:
Guillaume Souchere
2024-02-01 11:28:28 +01:00
parent 5f85aefe0d
commit 0b9f01ac20
26 changed files with 119 additions and 43 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Console Example
@@ -14,5 +14,12 @@
void register_system(void)
{
register_system_common();
register_system_sleep();
#if SOC_LIGHT_SLEEP_SUPPORTED
register_system_light_sleep();
#endif
#if SOC_DEEP_SLEEP_SUPPORTED
register_system_deep_sleep();
#endif
}
@@ -19,7 +19,8 @@ void register_system(void);
void register_system_common(void);
// Register deep and light sleep functions
void register_system_sleep(void);
void register_system_deep_sleep(void);
void register_system_light_sleep(void);
#ifdef __cplusplus
}
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -29,16 +29,6 @@
static const char *TAG = "cmd_system_sleep";
static void register_deep_sleep(void);
static void register_light_sleep(void);
void register_system_sleep(void)
{
register_deep_sleep();
register_light_sleep();
}
/** 'deep_sleep' command puts the chip into deep sleep mode */
static struct {
@@ -95,7 +85,7 @@ static int deep_sleep(int argc, char **argv)
return 1;
}
static void register_deep_sleep(void)
void register_system_deep_sleep(void)
{
int num_args = 1;
deep_sleep_args.wakeup_time =
@@ -196,7 +186,7 @@ static int light_sleep(int argc, char **argv)
return 0;
}
static void register_light_sleep(void)
void register_system_light_sleep(void)
{
light_sleep_args.wakeup_time =
arg_int0("t", "time", "<t>", "Wake up time, ms");
@@ -168,7 +168,12 @@ void app_main(void)
/* Register commands */
esp_console_register_help_command();
register_system_common();
register_system_sleep();
#if SOC_LIGHT_SLEEP_SUPPORTED
register_system_light_sleep();
#endif
#if SOC_DEEP_SLEEP_SUPPORTED
register_system_deep_sleep();
#endif
#if SOC_WIFI_SUPPORTED
register_wifi();
#endif
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -95,9 +95,16 @@ void app_main(void)
/* Register commands */
esp_console_register_help_command();
register_system_common();
register_system_sleep();
register_nvs();
#if SOC_LIGHT_SLEEP_SUPPORTED
register_system_light_sleep();
#endif
#if SOC_DEEP_SLEEP_SUPPORTED
register_system_deep_sleep();
#endif
#if SOC_WIFI_SUPPORTED
register_wifi();
#endif
register_nvs();
/* Prompt to be printed before each line.
* This can be customized, made dynamic, etc.
+2 -2
View File
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
# Basic Console Example (`esp_console_repl`)
@@ -91,7 +91,12 @@ void app_main(void)
/* Register commands */
esp_console_register_help_command();
register_system_common();
register_system_sleep();
#if SOC_LIGHT_SLEEP_SUPPORTED
register_system_light_sleep();
#endif
#if SOC_DEEP_SLEEP_SUPPORTED
register_system_deep_sleep();
#endif
#if SOC_WIFI_SUPPORTED
register_wifi();
#endif