37 #if defined(TIMER_COUNT) && (TIMER_COUNT > 0)
63 #define TIMER_REF_VALID(ref) TIMER_Valid(ref)
66 #if defined(_SILICON_LABS_32B_SERIES_0)
67 #define TIMER_CH_VALID(ch) ((ch) < 3)
68 #elif defined(_SILICON_LABS_32B_SERIES_1)
69 #define TIMER_CH_VALID(ch) ((ch) < 4)
71 #error "Unknown device. Undefined number of channels."
212 #if defined(_TIMER_CC_CTRL_PRSSEL_PRSCH4)
213 timerPRSSELCh4 = _TIMER_CC_CTRL_PRSSEL_PRSCH4,
215 #if defined(_TIMER_CC_CTRL_PRSSEL_PRSCH5)
216 timerPRSSELCh5 = _TIMER_CC_CTRL_PRSSEL_PRSCH5,
218 #if defined(_TIMER_CC_CTRL_PRSSEL_PRSCH6)
219 timerPRSSELCh6 = _TIMER_CC_CTRL_PRSSEL_PRSCH6,
221 #if defined(_TIMER_CC_CTRL_PRSSEL_PRSCH7)
222 timerPRSSELCh7 = _TIMER_CC_CTRL_PRSSEL_PRSCH7,
224 #if defined(_TIMER_CC_CTRL_PRSSEL_PRSCH8)
225 timerPRSSELCh8 = _TIMER_CC_CTRL_PRSSEL_PRSCH8,
227 #if defined(_TIMER_CC_CTRL_PRSSEL_PRSCH9)
228 timerPRSSELCh9 = _TIMER_CC_CTRL_PRSSEL_PRSCH9,
230 #if defined(_TIMER_CC_CTRL_PRSSEL_PRSCH10)
231 timerPRSSELCh10 = _TIMER_CC_CTRL_PRSSEL_PRSCH10,
233 #if defined(_TIMER_CC_CTRL_PRSSEL_PRSCH11)
234 timerPRSSELCh11 = _TIMER_CC_CTRL_PRSSEL_PRSCH11,
238 #if defined(_TIMER_DTFC_DTFA_NONE)
242 timerDtiFaultActionNone = _TIMER_DTFC_DTFA_NONE,
243 timerDtiFaultActionInactive = _TIMER_DTFC_DTFA_INACTIVE,
244 timerDtiFaultActionClear = _TIMER_DTFC_DTFA_CLEAR,
245 timerDtiFaultActionTristate = _TIMER_DTFC_DTFA_TRISTATE
246 } TIMER_DtiFaultAction_TypeDef;
268 #if defined(TIMER_CTRL_X2CNT) && defined(TIMER_CTRL_ATI)
300 #if defined(TIMER_CTRL_X2CNT) && defined(TIMER_CTRL_ATI)
301 #define TIMER_INIT_DEFAULT \
306 timerClkSelHFPerClk, \
309 timerInputActionNone, \
310 timerInputActionNone, \
318 #define TIMER_INIT_DEFAULT \
323 timerClkSelHFPerClk, \
324 timerInputActionNone, \
325 timerInputActionNone, \
381 #define TIMER_INITCC_DEFAULT \
383 timerEventEveryEdge, \
386 timerOutputActionNone, \
387 timerOutputActionNone, \
388 timerOutputActionNone, \
396 #if defined(_TIMER_DTCTRL_MASK)
407 bool invertComplementaryOut;
413 bool enablePrsSource;
423 unsigned int riseTime;
426 unsigned int fallTime;
432 uint32_t outputsEnableMask;
435 bool enableFaultSourceCoreLockup;
438 bool enableFaultSourceDebugger;
441 bool enableFaultSourcePrsSel0;
447 bool enableFaultSourcePrsSel1;
453 TIMER_DtiFaultAction_TypeDef faultAction;
455 } TIMER_InitDTI_TypeDef;
459 #define TIMER_INITDTI_DEFAULT \
470 TIMER_DTOGEN_DTOGCC0EN|TIMER_DTOGEN_DTOGCDTI0EN, \
477 timerDtiFaultActionInactive, \
531 #if defined(WTIMER_PRESENT)
562 return timer->
CC[ch].
CCV;
613 timer->
CC[ch].
CCV = val;
662 EFM_ASSERT(TIMER_REF_VALID(timer));
680 #if defined(_TIMER_DTCTRL_MASK)
681 void TIMER_InitDTI(
TIMER_TypeDef *timer,
const TIMER_InitDTI_TypeDef *init);
693 __STATIC_INLINE
void TIMER_EnableDTI(
TIMER_TypeDef *timer,
bool enable)
695 EFM_ASSERT(
TIMER0 == timer);
699 timer->DTCTRL |= TIMER_DTCTRL_DTEN;
703 timer->DTCTRL &= ~TIMER_DTCTRL_DTEN;
722 __STATIC_INLINE uint32_t TIMER_GetDTIFault(
TIMER_TypeDef *timer)
724 EFM_ASSERT(
TIMER0 == timer);
725 return timer->DTFAULT;
740 __STATIC_INLINE
void TIMER_ClearDTIFault(
TIMER_TypeDef *timer, uint32_t flags)
743 EFM_ASSERT(
TIMER0 == timer);
744 timer->DTFAULTC = flags;
779 timer->
IEN &= ~flags;
853 return timer->
IF & ien;
873 #if defined(_TIMER_DTLOCK_LOCKKEY_LOCK)
892 EFM_ASSERT(
TIMER0 == timer);
894 timer->DTLOCK = TIMER_DTLOCK_LOCKKEY_LOCK;
955 #if defined(TIMER_DTLOCK_LOCKKEY_UNLOCK)
965 EFM_ASSERT(
TIMER0 == timer);
967 timer->DTLOCK = TIMER_DTLOCK_LOCKKEY_UNLOCK;
__STATIC_INLINE void TIMER_IntDisable(TIMER_TypeDef *timer, uint32_t flags)
Disable one or more TIMER interrupts.
#define _TIMER_CC_CTRL_MODE_INPUTCAPTURE
__STATIC_INLINE void TIMER_TopSet(TIMER_TypeDef *timer, uint32_t val)
Set top value for timer.
#define _TIMER_CC_CTRL_ICEDGE_FALLING
TIMER_ClkSel_TypeDef clkSel
#define _TIMER_CTRL_PRESC_DIV1
#define _TIMER_CC_CTRL_ICEDGE_NONE
TIMER_OutputAction_TypeDef cufoa
Emlib peripheral API "assert" implementation.
void TIMER_Reset(TIMER_TypeDef *timer)
Reset TIMER to same state as after a HW reset.
TIMER_InputAction_TypeDef fallAction
__STATIC_INLINE void TIMER_Enable(TIMER_TypeDef *timer, bool enable)
Start/stop TIMER.
__STATIC_INLINE void TIMER_CounterSet(TIMER_TypeDef *timer, uint32_t val)
Set TIMER counter value.
#define _TIMER_CC_CTRL_MODE_PWM
#define _TIMER_CC_CTRL_ICEVCTRL_RISING
__STATIC_INLINE void TIMER_IntClear(TIMER_TypeDef *timer, uint32_t flags)
Clear one or more pending TIMER interrupts.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
#define _TIMER_CTRL_MODE_DOWN
TIMER_CCMode_TypeDef mode
#define _TIMER_CC_CTRL_MODE_OUTPUTCOMPARE
#define _TIMER_CC_CTRL_ICEVCTRL_EVERYSECONDEDGE
__STATIC_INLINE void TIMER_IntEnable(TIMER_TypeDef *timer, uint32_t flags)
Enable one or more TIMER interrupts.
#define _TIMER_CTRL_CLKSEL_PRESCHFPERCLK
#define _TIMER_CTRL_PRESC_DIV1024
#define _TIMER_CC_CTRL_ICEVCTRL_EVERYEDGE
#define _TIMER_CC_CTRL_PRSSEL_PRSCH3
__STATIC_INLINE void TIMER_IntSet(TIMER_TypeDef *timer, uint32_t flags)
Set one or more pending TIMER interrupts from SW.
#define _TIMER_CTRL_MODE_UPDOWN
#define _TIMER_CTRL_PRESC_DIV128
TIMER_PRSSEL_TypeDef prsSel
__STATIC_INLINE void TIMER_TopBufSet(TIMER_TypeDef *timer, uint32_t val)
Set top value buffer for timer.
#define _TIMER_CTRL_CLKSEL_TIMEROUF
__STATIC_INLINE uint32_t TIMER_IntGet(TIMER_TypeDef *timer)
Get pending TIMER interrupt flags.
#define _TIMER_CTRL_PRESC_DIV16
#define _TIMER_CTRL_FALLA_STOP
#define _TIMER_CTRL_MODE_UP
TIMER_OutputAction_TypeDef
#define _TIMER_CTRL_PRESC_DIV512
#define _TIMER_CC_CTRL_MODE_OFF
TIMER_Event_TypeDef eventCtrl
#define _TIMER_CTRL_PRESC_DIV4
#define _TIMER_CTRL_PRESC_DIV256
__STATIC_INLINE void TIMER_CompareSet(TIMER_TypeDef *timer, unsigned int ch, uint32_t val)
Set compare value for compare/capture channel when operating in compare or PWM mode.
__STATIC_INLINE uint32_t TIMER_CounterGet(TIMER_TypeDef *timer)
Get TIMER counter value.
#define _TIMER_CC_CTRL_ICEVCTRL_FALLING
#define _TIMER_CC_CTRL_ICEDGE_RISING
#define _TIMER_CTRL_PRESC_DIV32
__STATIC_INLINE uint32_t TIMER_CaptureGet(TIMER_TypeDef *timer, unsigned int ch)
Get capture value for compare/capture channel when operating in capture mode.
TIMER_Prescale_TypeDef prescale
__STATIC_INLINE bool TIMER_Valid(const TIMER_TypeDef *ref)
Validate the TIMER register block pointer.
__STATIC_INLINE uint32_t TIMER_MaxCount(const TIMER_TypeDef *ref)
Get the Max count of the timer.
TIMER_OutputAction_TypeDef cofoa
#define _TIMER_CC_CTRL_PRSSEL_PRSCH1
#define _TIMER_CTRL_FALLA_RELOADSTART
#define _TIMER_CC_CTRL_CUFOA_SET
#define _TIMER_CC_CTRL_PRSSEL_PRSCH0
void TIMER_Init(TIMER_TypeDef *timer, const TIMER_Init_TypeDef *init)
Initialize TIMER.
__STATIC_INLINE uint32_t TIMER_TopGet(TIMER_TypeDef *timer)
Get top value setting for timer.
TIMER_InputAction_TypeDef riseAction
__STATIC_INLINE void TIMER_CompareBufSet(TIMER_TypeDef *timer, unsigned int ch, uint32_t val)
Set compare value buffer for compare/capture channel when operating in compare or PWM mode...
#define _TIMER_CC_CTRL_ICEDGE_BOTH
__STATIC_INLINE uint32_t TIMER_IntGetEnabled(TIMER_TypeDef *timer)
Get enabled and pending TIMER interrupt flags. Useful for handling more interrupt sources in the same...
#define _TIMER_CTRL_FALLA_NONE
#define _TIMER_CTRL_PRESC_DIV64
#define _TIMER_CTRL_FALLA_START
#define _TIMER_CTRL_CLKSEL_CC1
#define _TIMER_CC_CTRL_CUFOA_NONE
void TIMER_InitCC(TIMER_TypeDef *timer, unsigned int ch, const TIMER_InitCC_TypeDef *init)
Initialize TIMER compare/capture channel.
TIMER_OutputAction_TypeDef cmoa
#define _TIMER_CC_CTRL_CUFOA_TOGGLE
#define _TIMER_CC_CTRL_PRSSEL_PRSCH2
#define _TIMER_CTRL_MODE_QDEC
#define _TIMER_CTRL_PRESC_DIV8
TIMER_InputAction_TypeDef
#define _TIMER_CTRL_PRESC_DIV2
#define _TIMER_CC_CTRL_CUFOA_CLEAR