⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwrlib.h

📁 freescale的基于802.15.4的无线通讯例程
💻 H
📖 第 1 页 / 共 3 页
字号:
* Inputs      : None
* Output      : None
* Errors      : Not handled
* History     : 20050405  pbbusk1  Created
******************************************************************************/
void PWRLib_RTIClockStop(void);


/******************************************************************************
* Description : Interrupt occurring every time the RTI timer times out.
* Assumptions : None
* WARNINGS    : Internal RTI oscillator is only running when not in RUN or WAIT
*               mode (AN2493). RTI is ok in Simulation mode except it runs 16
*               times too fast. Internal RTI oscillator don't run when debugger
*               is connected. DISCONNECT DEBUGGER or stop debugger and reset.
* Inputs      : None
* Output      : Remaining number of ticks. Uses PWRLib_MCU_WakeupReason.Bits.FromRTI
*               = 1 to set reason for wakeup.
* Errors      : Not handled
* History     : 20050405  pbbusk1  Created
******************************************************************************/
__interrupt void PWRLib_RTIClock_ISR(void);


/******************************************************************************
* Description : Interrupt occurring every time the Keyboard Interrupt pins are
*               activated.
* Assumptions : None
* Inputs      : None
* Output      : Uses PWRLib_MCU_WakeupReason.Bits.FromKBI = 1 to set reason
* Errors      : Not handled
* History     : 20050502  pbbusk1  Created
******************************************************************************/
__interrupt void PWRLib_KBI_ISR(void);


/******************************************************************************
* Description : Detection of low voltage.
*               Will use the MCU internal LVI module to get a battery voltage level.
*               This can be polled directly from application code or use the RTI
*               interrupt for collecting and storing the level. This last method
*               is less power demanding.
*
*               Possible returned levels are:
*               PWR_NODEPOWER_LEVEL_100  >  2.4V  - "Very Good" - bus frequency up to max. 20 MHz
*
*               PWR_NODEPOWER_LEVEL_66  <= 2.4V  - "Good" - bus frequency up to max. 20 MHz still supported
*
*               PWR_NODEPOWER_LEVEL_50  >  2.1V & < 2.4V - "Low" a user selectable level (see below)
*
*               PWR_NODEPOWER_LEVEL_33  <= 2.1V  - "Critical" for bus frequencies > 8 MHz
*
*               PWR_NODEPOWER_LEVEL_CRITICAL  <  1.8V  - "Hazardous"  - System must be shut down to avoid resets etc.
*
*               PWR_NODEPOWER_LEVEL_50 in more detail (user selectable):
*               The user can define this level as a timed values according to the application's
*               current consumption, i.e. the selected voltage level on the decreasing voltage
*               slope for the used battery type.
*
*               The user must select a voltage level on the batteries decreasing voltage slope
*               and measure the time for the battery voltage to drop from 2.4V down to the
*               selected voltage level above 2.1V.
*
*               Note! The battery voltage drop depends strongly on the application's current
*               draw and temperature.
*
*               The counter value "cPWR_LVD_LEVEL_50_Ticks" must be set according to how often
*               the LVD module is polled. Ex. If it takes 10 hours to discharge from 2.4V to
*               2.2V and the LVD module is called ones every 1 hour cPWR_LVD_LEVEL_50_Ticks = 10.
*
* Assumptions : None
* NOTE        : Voltage threshold levels differs slightly from device to device
*               Typical values are used above
*               This function are normally not called from external modules
*
* Inputs      : None
* Output      : PWR_NODEPOWER_LEVEL_CRITICAL..PWR_NODEPOWER_LEVEL_100 : As specified above
* Errors      : Not handled
* History     : 20050524  pbbusk1  Created from mvchr1 example code
******************************************************************************/
PWRLib_LVD_VoltageLevel_t PWRLib_LVD_CollectLevel(void);


//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
// RADIO interface functions
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------

/******************************************************************************
* Description : Request MAC to Wake up the RADIO
* Assumptions : None
* Inputs      : None
* Output      : TRUE if successful
* Errors      : Not handled but reported
* History     : 20050322  pbbusk1  Created from code by mwest2 and jshol1
******************************************************************************/
uint8_t PWRLib_RadioWakeReq(void);


/******************************************************************************
* Description : Request MAC to set radio in doze mode for requested number of
*               symbols (16usec).
* Assumptions : None
* Inputs      : DozeDuration is the time to doze
*               ClkOutEnabled is TRUE if ClkO should be active.
*                 FALSE will disable ClkO and consequently save power
* Output      : TRUE if DozeDuration req. granted
* Errors      : Not handled but reported
* History     : 20050322  pbbusk1  Created from code by mwest2 and jshol1
*               20050419  pbbusk1  Changed to use ClkOutEnable
******************************************************************************/
uint8_t PWRLib_RadioDozeReq(zbClock24_t DozeDuration, bool_t ClkOutEnabled);


/******************************************************************************
* Description : Request MAC to set radio in AcomaDoze.
* Assumptions : None
* Inputs      : ClkOutEnabled is TRUE if ClkO should be active.
*                 FALSE will disable ClkO and consequently save power
* Output      : TRUE if req. granted
* Errors      : Not handled but reported
* History     : 20050322  pbbusk1  Created from code by mwest2 and jshol1
*               20050419  pbbusk1  Changed to use ClkOutEnable and time removed
******************************************************************************/
uint8_t PWRLib_RadioAcomaDozeReq(bool_t ClkOutEnabled);


/******************************************************************************
* Description : Request MAC to set RADIO in Hibernate mode
* Assumptions : None
* Inputs      : None
* Output      : TRUE if Hibernate req. granted
* Errors      : Not handled but reported
* History     : 20050322  pbbusk1  Created from code by mwest2 and jshol1
******************************************************************************/
uint8_t PWRLib_RadioHibernateReq(void);


/******************************************************************************
* Description : Resets the RADIO. Will use the least amount of current.
* Assumptions : None
* Inputs      : None
* Output      : None
* Errors      : Not handled
* History     : 20050330  pbbusk1  Created
******************************************************************************/
void PWRLib_RadioOffReq(void);


/******************************************************************************
* Description : Remove the Reset signal to the RADIO. It will return to Idle
*               mode within 25msec.
* Assumptions : None
* Inputs      : None
* Output      : None
* Errors      : Not handled
* History     : 20050330  pbbusk1  Created
******************************************************************************/
void PWRLib_RadioOnReq(void);


/******************************************************************************
* Description : Get status from MAC. Functions just as Asp_GetMacStateReq().
* Assumptions : None
* Inputs      : None
* Output      : gAspMacStateIdle_c     : MAC ready for Sleep or DeepSleep
*               gAspMacStateBusy_c     : Don't sleep
*               gAspMacStateNotEmpty_c : MAC allows Wait
* Errors      : Not handled
* History     : 20050420 pbbusk1  Created
******************************************************************************/
uint8_t PWRLib_GetMacStateReq(void);


//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
// Zigbee stack interface functions
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------

/******************************************************************************
* Description : Macros to get the current status of the STACK
* Assumptions : None
* Inputs      : None
* Output      : Status from PWRLib_StackPS
* Errors      : Not handled
* History     : 20050330 pbbusk1  Created
******************************************************************************/
#define PWRLib_GetCurrentZigbeeStackPowerState      PWRLib_StackPS


/******************************************************************************
* Description : Macro to set the status of the STACK
* Inputs      : NewStackPS  : New state
*                 StackPS_Running   : Busy
*                 StackPS_Sleep     : Sleep allowed. Duration is appl. specific
*                 StackPS_DeepSleep : DeepSleep allowed
* Output      : None
* Errors      : Not handled
* History     : 20050330 pbbusk1  Created
******************************************************************************/
#define PWRLib_SetCurrentZigbeeStackPowerState( NewStackPS)  PWRLib_StackPS = NewStackPS;


/******************************************************************************
* Description : Initialize the Power Lib functions for correct functioning.
* Assumptions : Assumes normal running with MCU and RADIO with correct IO etc.
* Inputs      : None
* Output      : None
* Errors      : Not handled
* History     : 20050322  pbbusk1  Created
*               20050408  pbbusk1  Added assumption
******************************************************************************/
void PWRLib_Init(void);

#endif  // #if (cPWR_UsePowerDownMode==1)

#endif _PWRLIB_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -