📄 pwr_configuration.h
字号:
#define cKBI1PE 0b00010000 // Only PTA4 = S103 interrupt
#endif /*gMacStandAlone_d*/
#else
#define cKBI1PE 0b00000000 // No inputs enabled
#endif // #if (cPWR_KBIWakeupEnable)
#if (defined (TARGET_AXIOM_GB60) || defined (TARGET_TOROWEAP) || defined (TARGET_DIG528_2) || defined(TARGET_RD01) || defined(TARGET_DIG536_2) || defined(TARGET_FSL556_1) || defined(TARGET_USER_DEFINED) )
//-----------------------------------------------------------------------------
// Macroes for IO setup for returning to normal RUNNING mode.
// Will set IO direction, pull-ups and port value for each port, if
// enabled by cPWR_SetupIOWhenInPD
// PTxD : Output value for Port-x - 1: high, 0: low
// PTxPE: Input pullup for Port-x - 1: pullup active, 0: inactive
// PTxDD: Direction for Port-x - 1: output, 0: input
// Uses a copy of existing definitions defined in Target.h and App_Target.h
// and some are created directly.
// NOTE, must be changed to match your hardware!!!
//--- From mAPP_SETUP_PORT_A in App_Target.h
#define mPWRLib_RESTORE_PORT_A PTAPE = mSWITCH_MASK;\
PTADD = 0x42; // Set as input except 2 * CTS
//--- From mSETUP_PORT_B in Target.h
#define mPWRLib_RESTORE_PORT_B PTBPE = 0x00;\
PTBDD = (gMC1319xAntSwMask_c);\
PTBDD &=(~gMC1319xGPIO1Mask_c \
&~gMC1319xGPIO2Mask_c); // Set as input
//--- From mSETUP_PORT_C in Target.h
#define mPWRLib_RESTORE_PORT_C PTCPE = 0x00;\
PTCDD = 0xfd | (gMC1319xResetMask_c \
|gMC1319xAttnMask_c \
| gMC1319xRxTxMask_c );
//--- From mAPP_SETUP_PORT_D in App_Target.h
#define mPWRLib_RESTORE_PORT_D PTDPE = 0x00;\
PTDDD = 0xff; // LED_MASK;
#define mPWRLib_RESTORE_PORT_E PTEPE = 0x00;\
PTEDD = 0xf5;
#define mPWRLib_RESTORE_PORT_F PTFPE = 0x00;\
PTFDD = 0xff;
#define mPWRLib_RESTORE_PORT_G PTGPE = 0x00;\
PTGDD = 0xfb;
//---------------------------------------------------------------------------//
//--- Macros for IO setup for WAIT, STOP3 and STOP2 modes and reset. ---//
//--- Will set IO direction, pull-ups and port value for each port, if ---//
//--- enabled by the cPWR_SetupIOWhenInPD define. ---//
//--- PTxD : Output value for Port-x - 1: high, 0: low ---//
//--- PTxPE: Input pullup for Port-x - 1: pullup active, 0: inactive ---//
//--- PTxDD: Direction for Port-x - 1: output, 0: input ---//
#define mPWRLib_SETUP_PORT_A
/*
PTAD = 0x00;\
PTAPE = 0x10;\
PTADD = 0x6E & ~cKBI1PE;
*/
#define mPWRLib_SETUP_PORT_B PTBD = 0x00;\
PTBPE = 0x00;\
PTBDD = 0xcf;
#define mPWRLib_SETUP_PORT_C PTCD = 0x1c;\
PTCPE = 0x00;\
PTCDD = 0xfd;
#define mPWRLib_SETUP_PORT_D PTDD = 0x1b;\
PTDPE = 0x00;\
PTDDD = 0xff;
#define mPWRLib_SETUP_PORT_E PTED = 0x04;\
PTEPE = 0x00;\
PTEDD = 0xf5;
#define mPWRLib_SETUP_PORT_F PTFD = 0x00;\
PTFPE = 0x00;\
PTFDD = 0xff;
#define mPWRLib_SETUP_PORT_G PTGD = 0x01;\
PTGPE = 0x00;\
PTGDD = 0xfb;
//---------------------------------------------------------------------------//
//--- Extra settings for SPI pin setup when going in/out of PD ---//
#if (cPWR_UseSPIDisable)
#define mPWRLib_SPIPowerSaveMode SPI1C1 &= ~0x40;
#define mPWRLib_SPINormalMode SPI1C1 |= 0x40;
#else
#define mPWRLib_SPIPowerSaveMode ;
#define mPWRLib_SPINormalMode ;
#endif // #if (cPWR_UseSPIDisable)
//---------------------------------------------------------------------------//
//--- Extra settings when entering the RADIO Reset mode ---//
//--- Setup GPIO1 & 2 as high outputs ---//
//--- Setup MISOo as high output ---//
//--- Setup CLKO as high output ---//
#if (cPWR_SetupIOWhenInPD > 0)
#define mPWRLib_SETUPFOR_RADIORESET PTBD &= ~0x30; \
PTBDD|= 0x30; \
PTED &= ~0x08; \
PTEDD|= 0x08; \
PTGD &= ~0x04; \
PTGDD|= 0x04;
#else
#define mPWRLib_SETUPFOR_RADIORESET ;
#endif
//---------------------------------------------------------------------------//
//--- Extra settings when exiting the RADIO Reset mode ---//
//--- Setup GPIO1 & 2 as inputs ---//
//--- Setup MISOo as input ---//
//--- Setup CLKO as input ---//
#if (cPWR_SetupIOWhenInPD > 0)
#define mPWRLib_SETUPAFTER_RADIORESET PTBDD&= ~0x30; \
PTEDD&= ~0x08; \
PTGDD&= ~0x04;
#else
#define mPWRLib_SETUPAFTER_RADIORESET ;
#endif
//---------------------------------------------------------------------------//
//--- Bitmask for DEBUG info pins ---//
#define mPWRLib_DEBUG_MASK_PTBD 0x8e
#define mPWRLib_DEBUG_MASK_PTCD 0xe0
#define mPWRLib_DEBUG_MASK_PTDD 0x04
//---------------------------------------------------------------------------//
//--- Definitions of DEBUG info pins ---//
#if (cPWR_UseDebugOutputs)
#define mSETPIN_STOP3_MODE PTDD |= 0x04; // Set PTD2 J107.10
#define mRESETPIN_STOP3_MODE PTDD &= ~0x04; // Reset PTD2
#define mSETPIN_STOP2_MODE PTBD |= 0x02; // Set PTB1 J107.9
#define mRESETPIN_STOP2_MODE PTBD &= ~0x02; // Reset PTB1
#define mSETPIN_WAIT_MODE PTBD |= 0x04; // Set PTB2 J107.8
#define mRESETPIN_WAIT_MODE PTBD &= ~0x04; // Reset PTB2
#define mSETPIN_CHKPWRSTATE_MODE PTCD |= 0x40; // Set PTC6 J107.2
#define mRESETPIN_CHKPWRSTATE_MODE PTCD &= ~0x40; // Reset PTC6
#define mSETPIN_RTISTARTED_MODE PTCD |= 0x20; // Set PTC5 J107.1
#define mRESETPIN_RTISTARTED_MODE PTCD &= ~0x20; // Reset PTC5
#else
#define mSETPIN_STOP3_MODE ;
#define mRESETPIN_STOP3_MODE ;
#define mSETPIN_STOP2_MODE ;
#define mRESETPIN_STOP2_MODE ;
#define mSETPIN_WAIT_MODE ;
#define mRESETPIN_WAIT_MODE ;
#define mSETPIN_CHKPWRSTATE_MODE ;
#define mRESETPIN_CHKPWRSTATE_MODE ;
#define mSETPIN_RTISTARTED_MODE ;
#define mRESETPIN_RTISTARTED_MODE ;
#endif
//---------------------------------------------------------------------------//
//--- Sanity checks ---//
#else
#error "*** ERROR: target not supported !"
#endif // #if defined (TARGET_RD01) #else
#if (cPWR_UsePowerDownMode > 1)
#error "*** ERROR: Illegal value in cPWR_UsePowerDownMode"
#endif
#if ((cPWR_MACVersionUsed != 1.05) && (cPWR_MACVersionUsed != 1.06))
#error "*** ERROR: Illegal value in cPWR_MACVersionUsed"
#endif
#if (cPWR_CallWakeupStackProcAfterDeepSleep > 1)
#error "*** ERROR: Illegal value in cPWR_CallWakeupStackProcAfterDeepSleep"
#endif
#if (cPWR_KBIInitAndVectorEnable > 1)
#error "*** ERROR: Illegal value in cPWR_KBIInitAndVectorEnable"
#endif
#if (cPWR_KBIWakeupEnable > 1)
#error "*** ERROR: Illegal value in cPWR_KBIWakeupEnable"
#endif
#if (cPWR_SetupIOWhenInPD > 2)
#error "*** ERROR: Illegal value in cPWR_SetupIOWhenInPD"
#endif
#if (cPWR_UseSPIDisable > 1)
#error "*** ERROR: Illegal value in cPWR_UseSPIDisable"
#endif
#if ((cPWR_UseSPIDisable > 0) && (cPWR_SetupIOWhenInPD == 0))
#error "*** ERROR: If no IO port setup is done - then changing SPI gives no meaning"
#endif
#if (cPWR_UseDebugOutputs > 1)
#error "*** ERROR: Illegal value in cPWR_UseDebugOutputs"
#endif
#if (cPWR_UseRADIOStatus > 1)
#error "*** ERROR: Illegal value in cPWR_UseRADIOStatus"
#endif
#if (cPWR_UseMCUStatus > 1)
#error "*** ERROR: Illegal value in cPWR_UseMCUStatus"
#endif
#if (cPWR_RTIFromExternalClock > 1)
#error "*** ERROR: Illegal value in cPWR_RTIFromExternalClock"
#endif
#if (cPWR_LVD_Enable > 2)
#error "*** ERROR: Illegal value in cPWR_LVD_Enable"
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -