From 8f53359cb817b32bc67990f2f09dc2136f4dad1e Mon Sep 17 00:00:00 2001 From: anschrammh Date: Thu, 19 Oct 2023 07:57:48 +0200 Subject: [PATCH] Added the folder for a new module which work is still in progress : the power management block --- .../app/app_drivers/Makefile | 3 +- .../watch_power_management/Makefile | 15 +++++ .../watch_power_management.c | 10 ++++ .../watch_power_management.h | 55 +++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/Makefile create mode 100644 src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/watch_power_management.c create mode 100644 src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/watch_power_management.h diff --git a/src/W800_SDK_v1.00.10/app/app_drivers/Makefile b/src/W800_SDK_v1.00.10/app/app_drivers/Makefile index a26d3ad..425e18f 100644 --- a/src/W800_SDK_v1.00.10/app/app_drivers/Makefile +++ b/src/W800_SDK_v1.00.10/app/app_drivers/Makefile @@ -6,7 +6,8 @@ GEN_LIBS = libappdrivers$(LIB_EXT) COMPONENTS_libappdrivers = lcd/libappdriverslcd$(LIB_EXT) \ mmc_sdio/libappdriversmmc_sdio$(LIB_EXT) \ i2c/libappdriversi2c$(LIB_EXT) \ - watch_peripherals/libappdriverswatch_peripherals$(LIB_EXT) + watch_peripherals/libappdriverswatch_peripherals$(LIB_EXT) \ + watch_power_management/libappdriverswatch_power_management$(LIB_EXT) endif #DEFINES += diff --git a/src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/Makefile b/src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/Makefile new file mode 100644 index 0000000..af00f1a --- /dev/null +++ b/src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/Makefile @@ -0,0 +1,15 @@ +TOP_DIR = ../../.. +sinclude $(TOP_DIR)/tools/w800/conf.mk + +ifndef PDIR +GEN_LIBS = libappdriverswatch_power_management$(LIB_EXT) +endif + +#DEFINES += + +sinclude $(TOP_DIR)/tools/w800/rules.mk + +INCLUDES := $(INCLUDES) -I $(PDIR)include + +PDIR := ../$(PDIR) +sinclude $(PDIR)Makefile \ No newline at end of file diff --git a/src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/watch_power_management.c b/src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/watch_power_management.c new file mode 100644 index 0000000..dd961db --- /dev/null +++ b/src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/watch_power_management.c @@ -0,0 +1,10 @@ +/** + * @file watch_power_management.h + * @author Anatole SCHRAMM-HENRY + * @brief Watch power management functions API header file + * @version 0.1 + * @date 2023-10-12 + * + * @copyright MIT + * + */ \ No newline at end of file diff --git a/src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/watch_power_management.h b/src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/watch_power_management.h new file mode 100644 index 0000000..16653e9 --- /dev/null +++ b/src/W800_SDK_v1.00.10/app/app_drivers/watch_power_management/watch_power_management.h @@ -0,0 +1,55 @@ +/** + * @file watch_power_management.h + * @author Anatole SCHRAMM-HENRY + * @brief Watch power management functions API header file + * @version 0.1 + * @date 2023-10-12 + * + * @copyright MIT + * + */ + +#ifndef WATCH_POWER_MANAGEMENT_H +#define WATCH_POWER_MANAGEMENT_H + +typedef enum watch_power_state +{ + /** + * @brief WATCH_POWER_STATE_IDLE : the watch has the display on and the screen is showing something, + * to save power, the MCU is running at a low clock speed (40 MHz), animations, transitions and other graphical effects might not be smooth. + */ + WATCH_POWER_STATE_IDLE, + /** + * @brief WATCH_POWER_STATE_FULL_SPEED : the watch has the display on and the screen is showing something, + * to have the best graphical user experience, the MCU is running at a higher clock speed giving better animations, + * transitions and other graphical effects at the expense of a higher power consumption. + */ + WATCH_POWER_STATE_FULL_SPEED, + /** + * @brief WATCH_POWER_STATE_SLEEP : the watch is put in sleep state this means that the MCU stops, data in RAM is kept, + * the display is completely switched off and the wake up is fast. + * The watch will wakeup after user interaction is detected : tilt of the wrist, screen touched. + * The watch will continue executing the firmware where it last was. + * This mode allows for a low power consumption of around 4 mA. + */ + WATCH_POWER_STATE_SLEEP, + /** + * @brief WATCH_POWER_STATE_BLE_SLEEP : the watch will enter this mode instead of the WATCH_POWER_STATE_SLEEP state + * if the BLE modem is running. This is because the MCU can not be put to sleep to keep the Bluetooth Low Energy stack running. + * The min clock speed should be set to 40MHz and NOT lower. + */ + WATCH_POWER_STATE_BLE_SLEEP, + /** + * @brief WACTH_POWER_STATE_STANDBY : in this state, the watch should achieve it's the lowest power consumption, + * data in RAM is lost and on user events (tilt of the wrist, screen touched), the watch reboots. + * This mode allows for a low power consumption of around 2 mA. + */ + WACTH_POWER_STATE_STANDBY, +} watch_power_state_e; + +typedef struct watch_power_management +{ + watch_power_state_e current_power_state; +} watch_power_management_t; + +#endif //WATCH_POWER_MANAGEMENT_H \ No newline at end of file