EZR32 Wonder Gecko Software Documentation  ezr32wg-doc-5.1.2
em_timer.h File Reference

Detailed Description

Timer/counter (TIMER) peripheral API.

Version
5.1.2

License

Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no obligation to support this Software. Silicon Labs is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.

Silicon Labs will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.

Definition in file em_timer.h.

#include "em_device.h"
#include <stdbool.h>
#include "em_assert.h"

Go to the source code of this file.

Data Structures

struct  TIMER_Init_TypeDef
 
struct  TIMER_InitCC_TypeDef
 
struct  TIMER_InitDTI_TypeDef
 

Macros

#define TIMER_INIT_DEFAULT
 
#define TIMER_INITCC_DEFAULT
 
#define TIMER_INITDTI_DEFAULT
 

Enumerations

enum  TIMER_CCMode_TypeDef {
  timerCCModeOff = _TIMER_CC_CTRL_MODE_OFF,
  timerCCModeCapture = _TIMER_CC_CTRL_MODE_INPUTCAPTURE,
  timerCCModeCompare = _TIMER_CC_CTRL_MODE_OUTPUTCOMPARE,
  timerCCModePWM = _TIMER_CC_CTRL_MODE_PWM
}
 
enum  TIMER_ClkSel_TypeDef {
  timerClkSelHFPerClk = _TIMER_CTRL_CLKSEL_PRESCHFPERCLK,
  timerClkSelCC1 = _TIMER_CTRL_CLKSEL_CC1,
  timerClkSelCascade = _TIMER_CTRL_CLKSEL_TIMEROUF
}
 
enum  TIMER_DtiFaultAction_TypeDef {
  timerDtiFaultActionNone = _TIMER_DTFC_DTFA_NONE,
  timerDtiFaultActionInactive = _TIMER_DTFC_DTFA_INACTIVE,
  timerDtiFaultActionClear = _TIMER_DTFC_DTFA_CLEAR,
  timerDtiFaultActionTristate = _TIMER_DTFC_DTFA_TRISTATE
}
 
enum  TIMER_Edge_TypeDef {
  timerEdgeRising = _TIMER_CC_CTRL_ICEDGE_RISING,
  timerEdgeFalling = _TIMER_CC_CTRL_ICEDGE_FALLING,
  timerEdgeBoth = _TIMER_CC_CTRL_ICEDGE_BOTH,
  timerEdgeNone = _TIMER_CC_CTRL_ICEDGE_NONE
}
 
enum  TIMER_Event_TypeDef {
  timerEventEveryEdge = _TIMER_CC_CTRL_ICEVCTRL_EVERYEDGE,
  timerEventEvery2ndEdge = _TIMER_CC_CTRL_ICEVCTRL_EVERYSECONDEDGE,
  timerEventRising = _TIMER_CC_CTRL_ICEVCTRL_RISING,
  timerEventFalling = _TIMER_CC_CTRL_ICEVCTRL_FALLING
}
 
enum  TIMER_InputAction_TypeDef {
  timerInputActionNone = _TIMER_CTRL_FALLA_NONE,
  timerInputActionStart = _TIMER_CTRL_FALLA_START,
  timerInputActionStop = _TIMER_CTRL_FALLA_STOP,
  timerInputActionReloadStart = _TIMER_CTRL_FALLA_RELOADSTART
}
 
enum  TIMER_Mode_TypeDef {
  timerModeUp = _TIMER_CTRL_MODE_UP,
  timerModeDown = _TIMER_CTRL_MODE_DOWN,
  timerModeUpDown = _TIMER_CTRL_MODE_UPDOWN,
  timerModeQDec = _TIMER_CTRL_MODE_QDEC
}
 
enum  TIMER_OutputAction_TypeDef {
  timerOutputActionNone = _TIMER_CC_CTRL_CUFOA_NONE,
  timerOutputActionToggle = _TIMER_CC_CTRL_CUFOA_TOGGLE,
  timerOutputActionClear = _TIMER_CC_CTRL_CUFOA_CLEAR,
  timerOutputActionSet = _TIMER_CC_CTRL_CUFOA_SET
}
 
enum  TIMER_Prescale_TypeDef {
  timerPrescale1 = _TIMER_CTRL_PRESC_DIV1,
  timerPrescale2 = _TIMER_CTRL_PRESC_DIV2,
  timerPrescale4 = _TIMER_CTRL_PRESC_DIV4,
  timerPrescale8 = _TIMER_CTRL_PRESC_DIV8,
  timerPrescale16 = _TIMER_CTRL_PRESC_DIV16,
  timerPrescale32 = _TIMER_CTRL_PRESC_DIV32,
  timerPrescale64 = _TIMER_CTRL_PRESC_DIV64,
  timerPrescale128 = _TIMER_CTRL_PRESC_DIV128,
  timerPrescale256 = _TIMER_CTRL_PRESC_DIV256,
  timerPrescale512 = _TIMER_CTRL_PRESC_DIV512,
  timerPrescale1024 = _TIMER_CTRL_PRESC_DIV1024
}
 
enum  TIMER_PRSSEL_TypeDef {
  timerPRSSELCh0 = _TIMER_CC_CTRL_PRSSEL_PRSCH0,
  timerPRSSELCh1 = _TIMER_CC_CTRL_PRSSEL_PRSCH1,
  timerPRSSELCh2 = _TIMER_CC_CTRL_PRSSEL_PRSCH2,
  timerPRSSELCh3 = _TIMER_CC_CTRL_PRSSEL_PRSCH3,
  timerPRSSELCh4 = _TIMER_CC_CTRL_PRSSEL_PRSCH4,
  timerPRSSELCh5 = _TIMER_CC_CTRL_PRSSEL_PRSCH5,
  timerPRSSELCh6 = _TIMER_CC_CTRL_PRSSEL_PRSCH6,
  timerPRSSELCh7 = _TIMER_CC_CTRL_PRSSEL_PRSCH7,
  timerPRSSELCh8 = _TIMER_CC_CTRL_PRSSEL_PRSCH8,
  timerPRSSELCh9 = _TIMER_CC_CTRL_PRSSEL_PRSCH9,
  timerPRSSELCh10 = _TIMER_CC_CTRL_PRSSEL_PRSCH10,
  timerPRSSELCh11 = _TIMER_CC_CTRL_PRSSEL_PRSCH11
}
 

Functions

__STATIC_INLINE uint32_t TIMER_CaptureGet (TIMER_TypeDef *timer, unsigned int ch)
 Get capture value for compare/capture channel when operating in capture mode. More...
 
__STATIC_INLINE void TIMER_ClearDTIFault (TIMER_TypeDef *timer, uint32_t flags)
 Clear DTI fault source flags. More...
 
__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. More...
 
__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. More...
 
__STATIC_INLINE uint32_t TIMER_CounterGet (TIMER_TypeDef *timer)
 Get TIMER counter value. More...
 
__STATIC_INLINE void TIMER_CounterSet (TIMER_TypeDef *timer, uint32_t val)
 Set TIMER counter value. More...
 
__STATIC_INLINE void TIMER_Enable (TIMER_TypeDef *timer, bool enable)
 Start/stop TIMER. More...
 
__STATIC_INLINE void TIMER_EnableDTI (TIMER_TypeDef *timer, bool enable)
 Enable or disable DTI unit. More...
 
__STATIC_INLINE uint32_t TIMER_GetDTIFault (TIMER_TypeDef *timer)
 Get DTI fault source flags status. More...
 
void TIMER_Init (TIMER_TypeDef *timer, const TIMER_Init_TypeDef *init)
 Initialize TIMER. More...
 
void TIMER_InitCC (TIMER_TypeDef *timer, unsigned int ch, const TIMER_InitCC_TypeDef *init)
 Initialize TIMER compare/capture channel. More...
 
void TIMER_InitDTI (TIMER_TypeDef *timer, const TIMER_InitDTI_TypeDef *init)
 Initialize the TIMER DTI unit. More...
 
__STATIC_INLINE void TIMER_IntClear (TIMER_TypeDef *timer, uint32_t flags)
 Clear one or more pending TIMER interrupts. More...
 
__STATIC_INLINE void TIMER_IntDisable (TIMER_TypeDef *timer, uint32_t flags)
 Disable one or more TIMER interrupts. More...
 
__STATIC_INLINE void TIMER_IntEnable (TIMER_TypeDef *timer, uint32_t flags)
 Enable one or more TIMER interrupts. More...
 
__STATIC_INLINE uint32_t TIMER_IntGet (TIMER_TypeDef *timer)
 Get pending TIMER interrupt flags. More...
 
__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 interrupt handler. More...
 
__STATIC_INLINE void TIMER_IntSet (TIMER_TypeDef *timer, uint32_t flags)
 Set one or more pending TIMER interrupts from SW. More...
 
__STATIC_INLINE void TIMER_Lock (TIMER_TypeDef *timer)
 Lock some of the TIMER registers in order to protect them from being modified. More...
 
__STATIC_INLINE uint32_t TIMER_MaxCount (const TIMER_TypeDef *ref)
 Get the Max count of the timer. More...
 
void TIMER_Reset (TIMER_TypeDef *timer)
 Reset TIMER to same state as after a HW reset. More...
 
__STATIC_INLINE void TIMER_TopBufSet (TIMER_TypeDef *timer, uint32_t val)
 Set top value buffer for timer. More...
 
__STATIC_INLINE uint32_t TIMER_TopGet (TIMER_TypeDef *timer)
 Get top value setting for timer. More...
 
__STATIC_INLINE void TIMER_TopSet (TIMER_TypeDef *timer, uint32_t val)
 Set top value for timer. More...
 
__STATIC_INLINE void TIMER_Unlock (TIMER_TypeDef *timer)
 Unlock the TIMER so that writing to locked registers again is possible. More...
 
__STATIC_INLINE bool TIMER_Valid (const TIMER_TypeDef *ref)
 Validate the TIMER register block pointer. More...