 |
思澈科技软件开发工具包
2.20
|
|
HAL PMU提供抽象的软件接口操作硬件PMU(Power Management Unit)模块,提供的功能有:
- 设置芯片的供电参数
- 设置低功耗时钟参数,
- 配置芯片进入关机模式并设置唤醒源, 在关机模式下芯片可被PIN和RTC唤醒, 唤醒PIN与GPIO管脚的映射关系与LPSYS睡眠模式的唤醒PIN相同,参见AON
- SF32LB52X支持充电,相关接口为 HAL_PMU_ChgInit 等
详细的API说明参考 PMU.
- Note
-
使用HAL PMU
使能RTC和PIN唤醒后关机
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