📄 pwrlib.h
字号:
//--- Zigbee stack status ---//
extern PWRLib_StackPS_t PWRLib_StackPS;
//--- For LVD function ---//
#if (cPWR_LVD_Enable > 0)
#if (cPWR_LVD_Enable == 2)
extern uint16_t PWRLib_LVD_CollectCounter;
#endif // #if (cPWR_LVD_Enable == 2)
extern uint16_t PWRLib_LVD_L2Counter;
extern PWRLib_LVD_VoltageLevel_t PWRLib_LVD_SavedLevel;
#endif // #if (cPWR_LVD_Enable > 0)
//---------------------------------------------------------------------------//
//--- Only include the rest if needed / enabled ---//
#if (cPWR_UsePowerDownMode==1)
/************************************************************************************
*************************************************************************************
* Public function prototypes
*************************************************************************************
************************************************************************************/
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
// MCU interface functions
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
/******************************************************************************
* Description : Executes a illegal instruction to force a MCU reset.
* Assumptions : None
* Inputs : None
* Output : None
* Errors : Not handled
* History : 20050504 pbbusk1 Code adopted from kimsim1 code snip
******************************************************************************/
void PWRLib_Reset(void);
/******************************************************************************
* Description : Save state of all debug pins
* Assumptions : Assumes that direction of ports are correct
* Inputs : None
* Output : None
* Errors : Not handled
* History : 20050429 pbbusk1 Created
******************************************************************************/
void PWRLib_SaveDebugIOState(void);
/******************************************************************************
* Description : Restore state off all debug pins
* Assumptions : Assumes that direction of ports are correct
* Inputs : None
* Output : None
* Errors : Not handled
* History : 20050429 pbbusk1 Created
******************************************************************************/
void PWRLib_RestoreDebugIOState(void);
/******************************************************************************
* Description : Set all MCU IO pins for low power mode. Most as outputs with a
* zero value.
* Assumptions : Assumes interrupt has been turned off, to ensure that no other
* process changes IO.
* Inputs : None
* Output : None
* Errors : Not handled
* History : 20050322 pbbusk1 Created
******************************************************************************/
void PWRLib_SetMCUIOForPowerSavingMode(void);
/******************************************************************************
* Description : Restore all MCU IO pins after a low power mode. Using previous-
* ly saved values or reset values.
* Assumptions : Assumes interrupt has been turned off, to ensure that no other
* process changes IO.
* Inputs : None
* Output : None
* Errors : Not handled
* History : 20050322 pbbusk1 Created
******************************************************************************/
void PWRLib_ResetMCUIOAfterPowerSavingMode(void);
/******************************************************************************
* Description : MCU will enter the WAIT mode and stay there until an interrupt
* restarts the execution.
* CPU standby, CPU registers OK, RAM OK, RTI OK, KBI OK, Regulator
* on, I/O latched, BUS clk on.
* Assumptions : Intended for use anywhere in code where execution may pause.
* Input : None
* Output : None
* Errors : Not handled
* History : 20050322 pbbusk1 Created
******************************************************************************/
void PWRLib_MCUWait(void);
/******************************************************************************
* Description : MCU will enter the STOP3 mode and stay there until an interrupt
* restarts the execution.
* CPU standby, CPU registers OK, RAM OK, RTI OK, KBI OK, Regulator
* on, I/O latched, BUS clk off
* Assumptions : None
* Input : None
* Output : None
* Errors : Not handled
* History : 20050322 pbbusk1 Created
******************************************************************************/
void PWRLib_MCUStop3(void);
/******************************************************************************
* Description : MCU will enter the STOP2 mode and stay there until an interrupt
* restarts the execution.
* CPU standby, CPU registers Lost, RAM OK, RTI OK, KBI OK, Regulator
* off, I/O latched, BUS clk off
* Note : Remember to set PPDACK to enable ports after STOP2
* Input : None
* Output : None
* Errors : Not handled
* History : 20050322 pbbusk1 Created
******************************************************************************/
void PWRLib_MCUStop2(void);
/******************************************************************************
* Description : MCU will enter the STOP1 mode and stay there until an RESET
* occurs.
* CPU off, CPU registers Lost, RAM OFF, No RTI, No KBI, Regulator
* off, I/O tristated, BUS clk off
* Assumptions : None
* Input : None
* Output : None
* Errors : Not handled
* History : 20050322 pbbusk1 Created
******************************************************************************/
void PWRLib_MCUStop1(void);
/******************************************************************************
* Description : For setting up the ICG mode.
* Assumptions : None
* Input : ICG_mode - the ICG mode to enter
* Clock - the ICG clock type (low or high)
* Output : None
* Errors : Not handled
* History : 20050329 pbbusk1 Created from mvchr1 source
******************************************************************************/
void PWRLib_ICG_Mode(PWRLib_ICGMode_t ICG_mode, PWRLib_ICGClockType_t Clock);
/******************************************************************************
* Description : Returns TRUE if it is necessary to wait for the clock to lock (DCO).
* Assumptions : None
* Input : None
* Output : TRUE - ICG clock must lock in current mode - wait for lock
* FALSE - ICG clock cannot lock in current mode (Not nesesary)
* Errors : Not handled
* History : 20050329 pbbusk1 Created from mvchr1 source
******************************************************************************/
bool_t PWRLib_ICG_Wait_Clock_Lock(void);
/******************************************************************************
* Description : For setup of ICG multiplier and divider (N/R).
* Assumptions : None
* Inputs : N - multiplier factor - not used in all ICG clock modes.
* R - divider factor - used in all ICG clock modes.
* Output : None
* Errors : Not handled
* History : 20050329 pbbusk1 Created from mvchr1 source
******************************************************************************/
void PWRLib_ICG_Divider_Setup(PWRLib_ICGMultiplier_t N, PWRLib_ICGDivider_t R);
/******************************************************************************
* Description : Setup the MCU ICG clock mode and RADIO ClkO.
* Assumptions : None
* Inputs : ClkMode: The chosen clock mode
* Output : None
* Errors : Not handled
* History : 20050331 pbbusk1 Created
******************************************************************************/
void PWRLib_ClockSetup(PWRLib_ICGClkMode_t ClkMode);
/******************************************************************************
* Description : Setup the MCU RTI timer for generating interrupts and set the
* counter to selected value. This will be decremented auto-
* matically by the interrupt. Remember that the resulting
* interrupt are only with an accuracy of +-30%
* Assumptions : None
* Inputs : ClkMode : The chosen clock mode
* Ticks : Number of ticks (Time depends on ClkMode)
* Output : None
* Errors : Not handled
* History : 20050404 pbbusk1 Created
******************************************************************************/
void PWRLib_RTIClockStart(uint8_t ClkMode, uint32_t Ticks);
/******************************************************************************
* Description : Returns remaining time to timeout.
* Assumptions : None
* Inputs : None
* Output : Remaining number of ticks
* Errors : Not handled
* History : 20050405 pbbusk1 Created
******************************************************************************/
uint32_t PWRLib_RTIClockCheck(void);
/******************************************************************************
* Description : Stops the MCU RTI timer from generating interrupts in STOP2/3
* Assumptions : None
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -