APP_PM

Defines

SLEEP_HCPU

All applicaiton/sensor/lcd all sleep.

SLEEP_RETURN_TO_CLOCK_THRESHOLD

After the sleep time exceeds a certain time threshold, it will return to CLOCK. unit, ms.

Typedefs

typedef void (*resume_thread_prior_t)(bool)

The prototype of resume thread. used for accelerating power_on.

Enums

enum power_on_anim_type_t

The type of Power on and Power off animation.

Values:

enumerator LOW_VOLT_CHARGING_ANIM

charging animation icon of low voltage

enumerator LOW_VOLT_NOTIFY_ANIM

notification(event) animation icon when low voltage satified

enumerator POWER_ON_ANIM

power on animation when power on

enumerator POWER_OFF_ANIM

power off animation when power off

enum sleep_event_t

The sleep event, used for sleep procedure. Sleep sequence: PRE_SLEEP_EVT -> ENTER_SLEEP_EVT -> EXIT SLEEP.

Values:

enumerator APP_SLEEP_EVT_NONE

none

enumerator APP_PRE_ENTER_SLEEP_EVT

prepare to close display and sleep

enumerator APP_ENTER_SLEEP_EVT

close display and sleep

enumerator APP_PRE_EXIT_SLEEP_EVT

prepare to exit sleep

enumerator APP_EXIT_SLEEP_EVT

exit sleep and open display

enum sleep_type_t

The sleep type, which is a bit mask.

Values:

enumerator SLEEP_WHOLE_APP

All applicaiton will sleep

enumerator SLEEP_LV_TASK

lv task sleep. stop lv task schedule

enumerator SLEEP_WITHOUT_SENSOR_NOTI

Stop sensor realtime notification, such as step...

enumerator SLEEP_CLOSE_DISPLAY_ONLY

Close lcd

enum [anonymous]

Power on anim phase.

Values:

enumerator POWER_ON_ANIM_BEGIN

Begin power on anim

enumerator POWER_ON_ANIM_END

End power on anim

enum power_on_reason_t

The reason of power on.

Values:

enumerator POWER_ON_REASON_NULL

None

enumerator POWER_ON_BY_RESET

Reset

enumerator POWER_ON_BY_NORMAL

Normal

enum power_off_t

The reason of power off.

Values:

enumerator POWER_OFF

Normal

enumerator POWER_OFF_BY_DFU

Nor OTA upgrade

enumerator POWER_OFF_WITH_REBOOT

Reboot, cold boot

enumerator POWER_OFF_RETURN_FACTORY

Reboot, cold boot

enumerator POWER_OFF_BY_NAND_OTA

Nand OTA upgrade

enumerator POWER_OFF_BY_NAND_OVERWRITE

Nand overwrite OTA upgrade

Functions

bool app_is_lv_enable(void)

LVGL task schedule is enable. When power on or power off, need disable lv_msg receive.

void app_lv_enable_set(bool enable)

Enable LVGL task schedule or not. When shutting down, it will disable lv task schedule.

参数:
  • enable -- 0 : disable; 1 : enable.

void app_blocking_thread_delete(void)

resume some threads priority, those threads temporary changes to accelerate power on.

void app_power_on_action(void)

Application initialize when power on. also, it including: Power on anim procedure. Read nvm from flash. Open ble/bt and rf calibration. Open sensor.

void app_power_off_action(power_off_t type)

Application de_initialize when power off. also, it including: Power off anim procedure. Write nvm to flash Close ble/bt. Close sensor.

参数:
  • type -- The type of power off, power_off_t

void app_gui_sleep_set(bool sleep)

Set gui sleep or wakeup. Here only set flag. gui_entry will check this flag to decide if it will enter sleep.

参数:
  • sleep -- 0 : wakeup; 1 : sleep

bool app_gui_is_sleep(void)

Check if gui wll enter sleep. If you want the GUI to go to sleep, call this function to set it.

参数:
  • sleep -- 0 : wakeup; 1 : sleep.

bool app_gui_aod_wakeup(void)

When wakeup from button pressing, check if gui is running in aod? If it is, exit aod and clean sleep flag. If you want the GUI to go to sleep, call this function to set it.

返回值:

bool -- 0 : in AOD; 1 : not in AOD.

bool app_gui_sleep(uint16_t action)

If entering into sleep satisfied, need call this funciton enter into sleep. This function also will handle AOD case. @action action PM action gui_pm_action_t.

返回值:

bool -- 0 : entering AOD; 1 : entering sleep.