Skip to content

Commit

Permalink
Merge branch 'feature/box_air_control_lowPower' into 'master'
Browse files Browse the repository at this point in the history
add ESP32-S3-BOX-3 support

See merge request ae_group/esp-box!75
  • Loading branch information
espressif2022 committed Aug 25, 2023
2 parents 59e7c92 + c0e5935 commit 9444158
Show file tree
Hide file tree
Showing 613 changed files with 58,745 additions and 427 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a href="https://github.com/espressif/esp-box/blob/master/LICENSE" alt="Build examples">
<img alt="GitHub" src="https://img.shields.io/github/license/espressif/esp-box"></a>
<a href="https://github.com/espressif/esp-box/actions/workflows/build_IDF5.1.yml" alt="Build examples">
<img src="https://github.com/espressif/esp-box/actions/workflows/build.yml/badge.svg" /></a>
<img src="https://github.com/espressif/esp-box/actions/workflows/build_IDF5.1.yml/badge.svg" /></a>
<a href="https://github.com/espressif/esp-box/graphs/contributors" alt="Contributors">
<img src="https://img.shields.io/github/contributors/espressif/esp-box" /></a>
<a href="https://github.com/espressif/esp-box/releases" alt="GitHub all releases">
Expand Down
2 changes: 1 addition & 1 deletion README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<a href="https://github.com/espressif/esp-box/blob/master/LICENSE" alt="Build examples">
<img alt="GitHub" src="https://img.shields.io/github/license/espressif/esp-box"></a>
<a href="https://github.com/espressif/esp-box/actions/workflows/build_IDF5.1.yml" alt="Build examples">
<img src="https://github.com/espressif/esp-box/actions/workflows/build.yml/badge.svg" /></a>
<img src="https://github.com/espressif/esp-box/actions/workflows/build_IDF5.1.yml/badge.svg" /></a>
<a href="https://github.com/espressif/esp-box/graphs/contributors" alt="Contributors">
<img src="https://img.shields.io/github/contributors/espressif/esp-box" /></a>
<a href="https://github.com/espressif/esp-box/releases" alt="GitHub all releases">
Expand Down
16 changes: 14 additions & 2 deletions components/bsp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
set(bsp_src "src/storage/bsp_sdcard.c")

message(STATUS "PROJECT_DIR: " ${PROJECT_DIR})
set(bsp_src "src/storage/bsp_sdcard.c")

if(EXISTS ${PROJECT_DIR}/sdkconfig)
file(READ ${PROJECT_DIR}/sdkconfig SDKCONFIG_RULE)
Expand All @@ -24,7 +23,13 @@ else()
message(FATAL_ERROR "PLATFORM unknown.")
endif()

string(REGEX MATCH "factory_demo" PROJECT_IS_FACTORY_DEMO "${PROJECT_DIR}")
if (PROJECT_IS_FACTORY_DEMO)
set(priv_requires "esp-box${box_lite}" "aht20" "at581x")
else()
set(priv_requires "esp-box${box_lite}")
endif()

set(requires "driver" "fatfs")

idf_component_register(
Expand All @@ -34,3 +39,10 @@ idf_component_register(
"include"
PRIV_REQUIRES ${priv_requires}
REQUIRES ${requires})

if (PROJECT_IS_FACTORY_DEMO)
set_source_files_properties(
SRCS ${bsp_src}
PROPERTIES COMPILE_OPTIONS
-DCONFIG_NEED_SENSOR)
endif()
102 changes: 100 additions & 2 deletions components/bsp/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
menu "HMI Board Config"

choice BSP_LCD_BOARD
prompt "Select BSP board"
default BSP_BOARD_ESP32_S3_BOX
Expand All @@ -15,4 +14,103 @@ menu "HMI Board Config"
default y
help
Whether to enable the touch button.
endmenu
endmenu

menu "Power Save Configuration"
config EXAMPLE_WIFI_LISTEN_INTERVAL
int "WiFi listen interval"
default 3
help
Interval for station to listen to beacon from AP. The unit of listen interval is one beacon interval.
For example, if beacon interval is 100 ms and listen interval is 3, the interval for station to listen
to beacon is 300 ms.

config EXAMPLE_WIFI_BEACON_TIMEOUT
int "WiFi beacon timeout"
default 6
range 6 30
help
For Station, If the station does not receive a beacon frame from the connected SoftAP during the
inactive time, disconnect from SoftAP. Default 6s.

choice EXAMPLE_POWER_SAVE_MODE
prompt "power save mode"
default EXAMPLE_POWER_SAVE_MIN_MODEM
help
Power save mode for the esp32 to use. Modem sleep mode includes minimum and maximum power save modes.
In minimum power save mode, station wakes up every DTIM to receive beacon. Broadcast data will not be
lost because it is transmitted after DTIM. However, it can not save much more power if DTIM is short
for DTIM is determined by AP.
In maximum power save mode, station wakes up every listen interval to receive beacon. Broadcast data
may be lost because station may be in sleep state at DTIM time. If listen interval is longer, more power
is saved but broadcast data is more easy to lose.

config EXAMPLE_POWER_SAVE_NONE
bool "none"
config EXAMPLE_POWER_SAVE_MIN_MODEM
bool "minimum modem"
config EXAMPLE_POWER_SAVE_MAX_MODEM
bool "maximum modem"
endchoice

choice EXAMPLE_MAX_CPU_FREQ
prompt "Maximum CPU frequency"
default EXAMPLE_MAX_CPU_FREQ_80
depends on PM_ENABLE
help
Maximum CPU frequency to use for dynamic frequency scaling.

config EXAMPLE_MAX_CPU_FREQ_80
bool "80 MHz"
config EXAMPLE_MAX_CPU_FREQ_120
bool "120 MHz"
depends on IDF_TARGET_ESP32C2
config EXAMPLE_MAX_CPU_FREQ_160
bool "160 MHz"
depends on !IDF_TARGET_ESP32C2
config EXAMPLE_MAX_CPU_FREQ_240
bool "240 MHz"
depends on IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
endchoice

config EXAMPLE_MAX_CPU_FREQ_MHZ
int
default 80 if EXAMPLE_MAX_CPU_FREQ_80
default 120 if EXAMPLE_MAX_CPU_FREQ_120
default 160 if EXAMPLE_MAX_CPU_FREQ_160
default 240 if EXAMPLE_MAX_CPU_FREQ_240

choice EXAMPLE_MIN_CPU_FREQ
prompt "Minimum CPU frequency"
default EXAMPLE_MIN_CPU_FREQ_10M
depends on PM_ENABLE
help
Minimum CPU frequency to use for dynamic frequency scaling.
Should be set to XTAL frequency or XTAL frequency divided by integer.

config EXAMPLE_MIN_CPU_FREQ_40M
bool "40 MHz (use with 40MHz XTAL)"
depends on XTAL_FREQ_40 || XTAL_FREQ_AUTO
config EXAMPLE_MIN_CPU_FREQ_20M
bool "20 MHz (use with 40MHz XTAL)"
depends on XTAL_FREQ_40 || XTAL_FREQ_AUTO
config EXAMPLE_MIN_CPU_FREQ_10M
bool "10 MHz (use with 40MHz XTAL)"
depends on XTAL_FREQ_40 || XTAL_FREQ_AUTO
config EXAMPLE_MIN_CPU_FREQ_26M
bool "26 MHz (use with 26MHz XTAL)"
depends on XTAL_FREQ_26 || XTAL_FREQ_AUTO
config EXAMPLE_MIN_CPU_FREQ_13M
bool "13 MHz (use with 26MHz XTAL)"
depends on XTAL_FREQ_26 || XTAL_FREQ_AUTO
endchoice

config EXAMPLE_MIN_CPU_FREQ_MHZ
int
default 40 if EXAMPLE_MIN_CPU_FREQ_40M
default 20 if EXAMPLE_MIN_CPU_FREQ_20M
default 10 if EXAMPLE_MIN_CPU_FREQ_10M
default 26 if EXAMPLE_MIN_CPU_FREQ_26M
default 13 if EXAMPLE_MIN_CPU_FREQ_13M

endmenu
107 changes: 106 additions & 1 deletion components/bsp/include/bsp_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,32 @@
#include "esp_err.h"
#include "driver/gpio.h"
#include "driver/spi_master.h"
// #include "bsp/esp-bsp.h"
#include "driver/i2s_std.h"
#include "iot_button.h"

#ifdef __cplusplus
extern "C" {
#endif

#define BSP_I2C_EXPAND_SCL (GPIO_NUM_40)
#define BSP_I2C_EXPAND_SDA (GPIO_NUM_41)

#define BSP_RADAR_OUT_IO (GPIO_NUM_21)
#define BSP_IR_CTRL_GPIO (GPIO_NUM_44)
#define BSP_IR_TX_GPIO (GPIO_NUM_39)
#define BSP_IR_RX_GPIO (GPIO_NUM_38)

typedef enum {
BOARD_S3_BOX,
BOARD_S3_BOX_LITE,
} boards_id_t;

typedef enum{
BOTTOM_ID_SENSOR,
BOTTOM_ID_UNKNOW,
BOTTOM_ID_LOST,
}bottom_id_t;

typedef enum {
#if CONFIG_BSP_BOARD_ESP32_S3_BOX
BOARD_BTN_ID_BOOT = 0,
Expand Down Expand Up @@ -187,6 +200,98 @@ esp_err_t bsp_btn_register_callback(bsp_button_id_t btn, button_event_t event, b
esp_err_t bsp_btn_rm_all_callback(bsp_button_id_t btn);

esp_err_t bsp_btn_rm_event_callback(bsp_button_id_t btn, size_t event);
/**
* @brief stop codec to enter sleep mode
*
* @return
* - ESP_OK: Success
* - Others: Fail
*/
esp_err_t bsp_codec_dev_stop(void);

/**
* @brief resume codec to enter normal mode
*
* @return
* - ESP_OK: Success
* - Others: Fail
*/
esp_err_t bsp_codec_dev_resume(void);

/**
* @brief esp_pm_lock_acquire
*
* @return
* - ESP_OK: Success
* - Others: Fail
*/
esp_err_t bsp_pm_exit_sleep();

/**
* @brief esp_pm_lock_release
*
* @return
* - ESP_OK: Success
* - Others: Fail
*/
esp_err_t bsp_pm_enter_sleep();

/**
* @brief init pm module
*
* @return
* - ESP_OK: Success
* - Others: Fail
*/
esp_err_t bsp_pm_init();

/**
* @brief get sleep mode
*
* @return
* - true: sleep mode
* - false: nornal mode
*/
bool bsp_get_system_sleep_mode();

/**
* @brief get bottom status
*
* @return
* - BOTTOM_ID_SENSOR: sensor bottom connected
* - BOTTOM_ID_LOST: sensor bottom lost
* - BOTTOM_ID_UNKNOW: unknow
*/
bottom_id_t bsp_get_bottom_id();

/**
* @brief get radar status
*
* @return
* - true: active
* - false: passive
*/
bool bsp_get_system_radar_status();

/**
* @brief set radar status
*
* @param enable
*
* @return
* - ESP_OK on success
* - ESP_ERR_INVALID_ARG Arguments is invalid.
*/
void bsp_set_system_radar_status(bool enable);

/**
* @brief get sleep mode
*
* @return
* - ESP_OK: read successfully
* - ESP_FAIL: read failed
*/
esp_err_t bsp_read_temp_humidity(float *temperature_s, uint8_t *humidity_s);

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit 9444158

Please sign in to comment.