52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
/** @file pwr.h
|
|
* Module handling the power management's control
|
|
*
|
|
* The module provides functions to enter the different sleep states, control
|
|
* and filter wakeup events (WKUP and RTC) and configure power voltage
|
|
* detection
|
|
*/
|
|
|
|
#ifndef _PWR_H_
|
|
#define _PWR_H_
|
|
|
|
//--includes--------------------------------------------------------------------
|
|
|
|
//--type definitions------------------------------------------------------------
|
|
|
|
enum PwrWakeupSpeed {
|
|
PWR_WAKEUP_SPEED_FAST, //faster wakeup, higher consumption in stop mode
|
|
PWR_WAKEUP_SPEED_SLOW, //slower wakeup, lower consumption in stop mode
|
|
};
|
|
|
|
enum PwrPvdThreshold {
|
|
PWR_PVD_THRESHOLD_2_2V,
|
|
PWR_PVD_THRESHOLD_2_3V,
|
|
PWR_PVD_THRESHOLD_2_4V,
|
|
PWR_PVD_THRESHOLD_2_5V,
|
|
PWR_PVD_THRESHOLD_2_6V,
|
|
PWR_PVD_THRESHOLD_2_7V,
|
|
PWR_PVD_THRESHOLD_2_8V,
|
|
PWR_PVD_THRESHOLD_2_9V,
|
|
|
|
};
|
|
|
|
typedef void (*PwrPvdCallback)(void);
|
|
|
|
|
|
//--functions-------------------------------------------------------------------
|
|
|
|
void pwr_sleep(void);
|
|
void pwr_stop(enum PwrWakeupSpeed speed);
|
|
void pwr_standby(void);
|
|
|
|
bool pwr_wakeup_event(void);
|
|
bool pwr_standby_exit(void);
|
|
|
|
void pwr_configure_bkp_write(bool enable);
|
|
void pwr_configure_wakeup_pin(bool enable);
|
|
void pwr_configure_pvd(enum PwrPvdThreshold treshold);
|
|
|
|
|
|
#endif //_PWR_H_
|
|
|