 |
思澈科技軟件開發(fā)工具包
2.20
|
|
HAL PMU提供抽象的軟件接口操作硬件PMU(Power Management Unit)模塊,提供的功能有:
- 設(shè)置芯片的供電參數(shù)
- 設(shè)置低功耗時鐘參數(shù),
- 配置芯片進入關(guān)機模式并設(shè)置喚醒源, 在關(guān)機模式下芯片可被PIN和RTC喚醒, 喚醒PIN與GPIO管腳的映射關(guān)系與LPSYS睡眠模式的喚醒PIN相同,參見AON
- SF32LB52X支持充電,相關(guān)接口為 HAL_PMU_ChgInit 等
詳細(xì)的API說明參考 PMU.
- Note
-
使用HAL PMU
使能RTC和PIN喚醒后關(guān)機
void shutdown(void)
{
}
void init(void)
{
uint32_t wakeup_src;
}
配置充電
{
{
}
{
}
{
}
}
void config_charger(void)
{
uint32_t current;
uint32_t volt;
current = 300;
volt = 4300;
}
int8_t HAL_PMU_ChgReadStatus(PMU_ChgHandleTypeDef *handle, PMU_ChgIrqStatusTypeDef irq)
Read raw charger event status.
HAL_StatusTypeDef HAL_PMU_ChgInit(PMU_ChgHandleTypeDef *handle, PMU_ChgCalParamTypeDef *cal_param)
Init charger.
HAL_StatusTypeDef HAL_PMU_EnablePinWakeup(uint8_t pin, uint8_t mode)
Enable pin wakeup for hibernate.
HAL_StatusTypeDef HAL_PMU_ChgConfigIRQ(PMU_ChgHandleTypeDef *handle, PMU_ChgIrqStatusTypeDef irq, PMU_ChgIrqTrigModeTypeDef trig_mode)
Enable/disable IRQ in specified trig mode.
Definition: bf0_hal_pmu.h:130
@ HAL_OK
Definition: bf0_hal_def.h:75
void HAL_PMU_ChgRegisterCallback(PMU_ChgHandleTypeDef *handle, PMU_ChgCallbackTypeDef callback)
Register charger IRQ callback which is called when IRQ is triggered.
PMU_BootModeTypeDef
Definition: bf0_hal_pmu.h:72
@ PMU_CHG_IRQ_TRIG_MODE_POS_EDGE
Definition: bf0_hal_pmu.h:141
@ PMU_CHG_IRQ_VBAT_HIGH
Definition: bf0_hal_pmu.h:151
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
Set the priority of an interrupt.
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
Enable a device specific interrupt in the NVIC interrupt controller.
HAL_StatusTypeDef HAL_PMU_EnableRtcWakeup(void)
Enable RTC wakeup for hibernate.
@ PMU_CHG_IRQ_VBUS_RDY
Definition: bf0_hal_pmu.h:150
void HAL_PMU_EnterHibernate(void)
Make system enter hibernate mode.
uint32_t HAL_PMU_ChgConfigCcCurrent(PMU_ChgHandleTypeDef *handle, uint32_t current)
Configure charger CC current.
Definition: bf0_hal_pmu.h:91
HAL_StatusTypeDef HAL_PMU_CheckBootMode(PMU_BootModeTypeDef *boot_mode, uint32_t *wakeup_src)
Check PMU boot mode.
@ PMU_CHG_IRQ_TRIG_MODE_DOUBLE_EDGE
Definition: bf0_hal_pmu.h:143
uint32_t HAL_PMU_ChgConfigTargetVolt(PMU_ChgHandleTypeDef *handle, uint32_t volt_mv)
Configure charging full target voltage.
@ PMU_CHG_IRQ_EOC
Definition: bf0_hal_pmu.h:156