Low Power API 参考
类型定义:
-
enum wm_pm_mode_t
Values:
-
enumerator WM_PM_MODE_NO_SLEEP
nonsleeping
-
enumerator WM_PM_MODE_LIGHT_SLEEP
light sleep
-
enumerator WM_PM_MODE_DEEP_SLEEP
deep sleep. Some peripherals do not remain operational
-
enumerator WM_PM_MODE_STANDBY
standby mode. Upon awakening, the system will perform from scratch
-
enumerator WM_PM_MODE_NO_SLEEP
-
enum wm_pm_sleep_dev_t
Values:
-
enumerator WM_PM_SLEEP_DEV_TYPE_I2C
peripheral type : I2C
-
enumerator WM_PM_SLEEP_DEV_TYPE_UART0
peripheral type : UART0
-
enumerator WM_PM_SLEEP_DEV_TYPE_UART1
peripheral type : UART1
-
enumerator WM_PM_SLEEP_DEV_TYPE_UART2
peripheral type : UART2
-
enumerator WM_PM_SLEEP_DEV_TYPE_UART3
peripheral type : UART3
-
enumerator WM_PM_SLEEP_DEV_TYPE_UART4
peripheral type : UART4
-
enumerator WM_PM_SLEEP_DEV_TYPE_UART5
peripheral type : UART4
-
enumerator WM_PM_SLEEP_DEV_TYPE_LSPI
peripheral type : LSPI
-
enumerator WM_PM_SLEEP_DEV_TYPE_DMA
peripheral type : DMA
-
enumerator WM_PM_SLEEP_DEV_TYPE_TIMER
peripheral type : TIMER
-
enumerator WM_PM_SLEEP_DEV_TYPE_GPIO
peripheral type : GPIO
-
enumerator WM_PM_SLEEP_DEV_TYPE_SDADC
peripheral type : SDADC
-
enumerator WM_PM_SLEEP_DEV_TYPE_PWM
peripheral type : PWM
-
enumerator WM_PM_SLEEP_DEV_TYPE_LCD
peripheral type : LCD
-
enumerator WM_PM_SLEEP_DEV_TYPE_I2S
peripheral type : I2S
-
enumerator WM_PM_SLEEP_DEV_TYPE_RSA
peripheral type : RSA
-
enumerator WM_PM_SLEEP_DEV_TYPE_GPSEC
peripheral type : GPSEC
-
enumerator WM_PM_SLEEP_DEV_TYPE_SDIO_MASTER
peripheral type : SDIO
-
enumerator WM_PM_SLEEP_DEV_TYPE_PSRAM
peripheral type : PSRAM
-
enumerator WM_PM_SLEEP_DEV_TYPE_BT
peripheral type : BT
-
enumerator WM_PM_SLEEP_DEV_TYPE_TOUCH_SENSOR
peripheral type : TOUCH
-
enumerator WM_PM_SLEEP_DEV_TYPE_I2C
-
enum wm_pm_wakeup_dev_t
Values:
-
enumerator WM_PM_WAKEUP_DEV_TYPE_SDIO
-
enumerator WM_PM_WAKEUP_DEV_TYPE_MAC
-
enumerator WM_PM_WAKEUP_DEV_TYPE_RF_CFG
-
enumerator WM_PM_WAKEUP_DEV_TYPE_SEC
-
enumerator WM_PM_WAKEUP_DEV_TYPE_DMA_Channel0
-
enumerator WM_PM_WAKEUP_DEV_TYPE_DMA_Channel1
-
enumerator WM_PM_WAKEUP_DEV_TYPE_DMA_Channel2
-
enumerator WM_PM_WAKEUP_DEV_TYPE_DMA_Channel3
-
enumerator WM_PM_WAKEUP_DEV_TYPE_DMA_Channel4_7
-
enumerator WM_PM_WAKEUP_DEV_TYPE_DMA_BRUST
-
enumerator WM_PM_WAKEUP_DEV_TYPE_I2C
-
enumerator WM_PM_WAKEUP_DEV_TYPE_ADC
-
enumerator WM_PM_WAKEUP_DEV_TYPE_SPI_LS
-
enumerator WM_PM_WAKEUP_DEV_TYPE_SPI_HS
-
enumerator WM_PM_WAKEUP_DEV_TYPE_GPIOA
-
enumerator WM_PM_WAKEUP_DEV_TYPE_GPIOB
-
enumerator WM_PM_WAKEUP_DEV_TYPE_UART0
-
enumerator WM_PM_WAKEUP_DEV_TYPE_UART1
-
enumerator WM_PM_WAKEUP_DEV_TYPE_TOUCH
-
enumerator WM_PM_WAKEUP_DEV_TYPE_UART2_5
-
enumerator WM_PM_WAKEUP_DEV_TYPE_BLE
-
enumerator WM_PM_WAKEUP_DEV_TYPE_BT
-
enumerator WM_PM_WAKEUP_DEV_TYPE_PWM
-
enumerator WM_PM_WAKEUP_DEV_TYPE_I2S
-
enumerator WM_PM_WAKEUP_DEV_TYPE_SIDO_HOST
-
enumerator WM_PM_WAKEUP_DEV_TYPE_SYS_TICK
-
enumerator WM_PM_WAKEUP_DEV_TYPE_RSA
-
enumerator WM_PM_WAKEUP_DEV_TYPE_CRYPTION
-
enumerator WM_PM_WAKEUP_DEV_TYPE_FLASH
-
enumerator WM_PM_WAKEUP_DEV_TYPE_PMU
-
enumerator WM_PM_WAKEUP_DEV_TYPE_TIMER
-
enumerator WM_PM_WAKEUP_DEV_TYPE_WDG
-
enumerator WM_PM_WAKEUP_DEV_TYPE_SDIO
-
typedef uint32_t (*wm_pm_get_slept_callback)(void)
Get the amount of time (in milliseconds) that has been asleep. Only valid for deep sleep mode when using wake io.
- Return:
Get the time already asleep (in milliseconds)
-
struct wm_pm_config_t
Public Members
-
wm_pm_mode_t mode
sleep mode
-
wm_pm_sleep_dev_t sleep_dev_bitmap
used to indicate which peripheral can sleep, valid only for light sleep mode.
-
wm_pm_wakeup_dev_t wakeup_dev_bitmap
used to indicate which device interrupts can be woken up, valid only for light sleep mode.
-
wm_pm_get_slept_callback get_slept
gets the amount of time (in milliseconds) that has been asleep, valid only for deep sleep mode when using wake io.
-
wm_pm_mode_t mode
接口定义:
-
int wm_pm_get_config(wm_pm_config_t *config)
Get PM Configuration.
- 参数:
config – [out] store configuration
- 返回:
WM_ERR_SUCCESS: succeed
WM_ERR_INVALID_PARAM: invalid argument
others: failed
-
int wm_pm_set_config(wm_pm_config_t *config)
Set PM Configuration.
- 参数:
config – configuration
- 返回:
WM_ERR_SUCCESS: succeed
WM_ERR_INVALID_PARAM: invalid argument
others: failed
-
int wm_pm_lock_acquire(void)
Obtaining a Power Management Lock. After acquiring the lock, the system will not enter sleep mode until the lock is released.
警告
After a power lock has been acquired, it cannot be acquired repeatedly, or the program will generate a deadlock.
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_pm_lock_release(void)
Releasing the Power Management Lock.
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_pm_enter_sleep(uint32_t ticks)
go to sleep
- 参数:
ticks – sleep duration
- 返回:
WM_ERR_SUCCESS: succeed
WM_ERR_INVALID_PARAM: invalid argument
others: failed