TIMEREMLIB
Detailed Description
Timer/Counter (TIMER) Peripheral API.
The timer module consists of three main parts:
- General timer config and enable control.
- Compare/capture control.
- Dead time insertion control (may not be available for all timers).
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 } |
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.
|
|
__STATIC_INLINE void | TIMER_ClearDTIFault ( TIMER_TypeDef *timer, uint32_t flags) |
Clear DTI fault source flags.
|
|
__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.
|
|
__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.
|
|
__STATIC_INLINE void | TIMER_CounterSet ( TIMER_TypeDef *timer, uint32_t val) |
Set TIMER counter value.
|
|
__STATIC_INLINE void | TIMER_Enable ( TIMER_TypeDef *timer, bool enable) |
Start/stop TIMER.
|
|
__STATIC_INLINE void | TIMER_EnableDTI ( TIMER_TypeDef *timer, bool enable) |
Enable or disable DTI unit.
|
|
__STATIC_INLINE uint32_t | TIMER_GetDTIFault ( TIMER_TypeDef *timer) |
Get DTI fault source flags status.
|
|
void | TIMER_Init ( TIMER_TypeDef *timer, const TIMER_Init_TypeDef *init) |
Initialize TIMER.
|
|
void | TIMER_InitCC ( TIMER_TypeDef *timer, unsigned int ch, const TIMER_InitCC_TypeDef *init) |
Initialize TIMER compare/capture channel.
|
|
void | TIMER_InitDTI ( TIMER_TypeDef *timer, const TIMER_InitDTI_TypeDef *init) |
Initialize the TIMER DTI unit.
|
|
__STATIC_INLINE void | TIMER_IntClear ( TIMER_TypeDef *timer, uint32_t flags) |
Clear one or more pending TIMER interrupts.
|
|
__STATIC_INLINE void | TIMER_IntDisable ( TIMER_TypeDef *timer, uint32_t flags) |
Disable one or more TIMER interrupts.
|
|
__STATIC_INLINE void | TIMER_IntEnable ( TIMER_TypeDef *timer, uint32_t flags) |
Enable one or more TIMER interrupts.
|
|
__STATIC_INLINE uint32_t | TIMER_IntGet ( TIMER_TypeDef *timer) |
Get pending TIMER interrupt flags.
|
|
__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.
|
|
__STATIC_INLINE void | TIMER_IntSet ( TIMER_TypeDef *timer, uint32_t flags) |
Set one or more pending TIMER interrupts from SW.
|
|
__STATIC_INLINE void | TIMER_Lock ( TIMER_TypeDef *timer) |
Lock some of the TIMER registers in order to protect them from being modified.
|
|
__STATIC_INLINE uint32_t | TIMER_MaxCount (const TIMER_TypeDef *ref) |
Get the Max count of the timer.
|
|
void | TIMER_Reset ( TIMER_TypeDef *timer) |
Reset TIMER to same state as after a HW reset.
|
|
__STATIC_INLINE void | TIMER_TopBufSet ( TIMER_TypeDef *timer, uint32_t val) |
Set top value buffer for timer.
|
|
__STATIC_INLINE uint32_t | TIMER_TopGet ( TIMER_TypeDef *timer) |
Get top value setting for timer.
|
|
__STATIC_INLINE void | TIMER_TopSet ( TIMER_TypeDef *timer, uint32_t val) |
Set top value for timer.
|
|
__STATIC_INLINE void | TIMER_Unlock ( TIMER_TypeDef *timer) |
Unlock the TIMER so that writing to locked registers again is possible.
|
|
__STATIC_INLINE bool | TIMER_Valid (const TIMER_TypeDef *ref) |
Validate the TIMER register block pointer.
|
|
Macro Definition Documentation
#define TIMER_INIT_DEFAULT |
Default config for TIMER init structure.
Definition at line
282
of file
em_timer.h
.
Referenced by BOARD_init() , and USTIMER_Init() .
#define TIMER_INITCC_DEFAULT |
Default config for TIMER compare/capture init structure.
Definition at line
361
of file
em_timer.h
.
Referenced by BOARD_init() , and USTIMER_Init() .
#define TIMER_INITDTI_DEFAULT |
Default config for TIMER DTI init structure.
Definition at line
436
of file
em_timer.h
.
Enumeration Type Documentation
enum TIMER_CCMode_TypeDef |
enum TIMER_ClkSel_TypeDef |
enum TIMER_Edge_TypeDef |
enum TIMER_Event_TypeDef |
Input capture event control.
Definition at line
119
of file
em_timer.h
.
enum TIMER_Mode_TypeDef |
Prescaler.
Definition at line
175
of file
em_timer.h
.
enum TIMER_PRSSEL_TypeDef |
Peripheral Reflex System signal.
Definition at line
190
of file
em_timer.h
.
Function Documentation
__STATIC_INLINE uint32_t TIMER_CaptureGet | ( | TIMER_TypeDef * |
timer,
|
unsigned int |
ch
|
||
) |
Get capture value for compare/capture channel when operating in capture mode.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] ch
Compare/capture channel to access.
- Returns
- Current capture value.
Definition at line
555
of file
em_timer.h
.
References TIMER_TypeDef::CC , and TIMER_CC_TypeDef::CCV .
__STATIC_INLINE void TIMER_ClearDTIFault | ( | TIMER_TypeDef * |
timer,
|
uint32_t |
flags
|
||
) |
Clear DTI fault source flags.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] flags
DTI fault source(s) to clear. Use one or more valid DTI fault source flags (TIMER_DTFAULT_nnn) OR'ed together.
Definition at line
721
of file
em_timer.h
.
References TIMER_TypeDef::DTFAULTC , and TIMER0 .
Referenced by TIMER_InitDTI() .
__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.
The compare value buffer holds the value which will be written to TIMERn_CCx_CCV on an update event if the buffer has been updated since the last event.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] ch
Compare/capture channel to access. [in] val
Value to set in compare value buffer register.
Definition at line
579
of file
em_timer.h
.
References TIMER_TypeDef::CC , TIMER_CC_TypeDef::CCVB , and TIMER_MaxCount() .
Referenced by BOARD_rgbledSetRawColor() .
__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.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] ch
Compare/capture channel to access. [in] val
Value to set in compare value register.
Definition at line
601
of file
em_timer.h
.
References TIMER_TypeDef::CC , TIMER_CC_TypeDef::CCV , and TIMER_MaxCount() .
__STATIC_INLINE uint32_t TIMER_CounterGet | ( | TIMER_TypeDef * |
timer
|
) |
Get TIMER counter value.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block.
- Returns
- Current TIMER counter value.
Definition at line
619
of file
em_timer.h
.
References TIMER_TypeDef::CNT .
__STATIC_INLINE void TIMER_CounterSet | ( | TIMER_TypeDef * |
timer,
|
uint32_t |
val
|
||
) |
Set TIMER counter value.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] val
Value to set counter to.
Definition at line
634
of file
em_timer.h
.
References TIMER_TypeDef::CNT , and TIMER_MaxCount() .
__STATIC_INLINE void TIMER_Enable | ( | TIMER_TypeDef * |
timer,
|
bool |
enable
|
||
) |
Start/stop TIMER.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] enable
true to enable counting, false to disable.
Definition at line
650
of file
em_timer.h
.
References TIMER_TypeDef::CMD , TIMER_CMD_START , and TIMER_CMD_STOP .
Referenced by BOARD_rgbledSetRawColor() , and USTIMER_DeInit() .
__STATIC_INLINE void TIMER_EnableDTI | ( | TIMER_TypeDef * |
timer,
|
bool |
enable
|
||
) |
Enable or disable DTI unit.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] enable
true to enable DTI unit, false to disable.
Definition at line
679
of file
em_timer.h
.
References TIMER_TypeDef::DTCTRL , TIMER0 , and TIMER_DTCTRL_DTEN .
Referenced by TIMER_InitDTI() .
__STATIC_INLINE uint32_t TIMER_GetDTIFault | ( | TIMER_TypeDef * |
timer
|
) |
Get DTI fault source flags status.
- Note
- The event bits are not cleared by the use of this function.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block.
- Returns
- Status of the DTI fault source flags. Returns one or more valid DTI fault source flags (TIMER_DTFAULT_nnn) OR'ed together.
Definition at line
704
of file
em_timer.h
.
References TIMER_TypeDef::DTFAULT , and TIMER0 .
Referenced by TIMER_InitDTI() .
void TIMER_Init | ( | TIMER_TypeDef * |
timer,
|
const TIMER_Init_TypeDef * |
init
|
||
) |
Initialize TIMER.
Notice that counter top must be configured separately with for instance TIMER_TopSet() . In addition, compare/capture and dead-time insertion init must be initialized separately if used. That should probably be done prior to the use of this function if configuring the TIMER to start when initialization is completed.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] init
Pointer to TIMER initialization structure.
Definition at line
75
of file
em_timer.c
.
References _TIMER_CNT_RESETVALUE , _TIMER_CTRL_CLKSEL_SHIFT , _TIMER_CTRL_FALLA_SHIFT , _TIMER_CTRL_MODE_SHIFT , _TIMER_CTRL_PRESC_SHIFT , _TIMER_CTRL_RISEA_SHIFT , TIMER_Init_TypeDef::ati , TIMER_Init_TypeDef::clkSel , TIMER_TypeDef::CMD , TIMER_TypeDef::CNT , TIMER_Init_TypeDef::count2x , TIMER_TypeDef::CTRL , TIMER_Init_TypeDef::debugRun , TIMER_Init_TypeDef::dmaClrAct , TIMER_Init_TypeDef::enable , TIMER_Init_TypeDef::fallAction , TIMER_Init_TypeDef::mode , TIMER_Init_TypeDef::oneShot , TIMER_Init_TypeDef::prescale , TIMER_Init_TypeDef::quadModeX4 , TIMER_Init_TypeDef::riseAction , TIMER_Init_TypeDef::sync , TIMER_CMD_START , TIMER_CMD_STOP , TIMER_CTRL_ATI , TIMER_CTRL_DEBUGRUN , TIMER_CTRL_DMACLRACT , TIMER_CTRL_OSMEN , TIMER_CTRL_QDM_X4 , TIMER_CTRL_SYNC , and TIMER_CTRL_X2CNT .
Referenced by BOARD_init() , and USTIMER_Init() .
void TIMER_InitCC | ( | TIMER_TypeDef * |
timer,
|
unsigned int |
ch,
|
||
const TIMER_InitCC_TypeDef * |
init
|
||
) |
Initialize TIMER compare/capture channel.
Notice that if operating channel in compare mode, the CCV and CCVB register must be set separately as required.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] ch
Compare/capture channel to init for. [in] init
Pointer to TIMER initialization structure.
Definition at line
126
of file
em_timer.c
.
References _TIMER_CC_CTRL_CMOA_SHIFT , _TIMER_CC_CTRL_COFOA_SHIFT , _TIMER_CC_CTRL_CUFOA_SHIFT , _TIMER_CC_CTRL_ICEDGE_SHIFT , _TIMER_CC_CTRL_ICEVCTRL_SHIFT , _TIMER_CC_CTRL_MODE_SHIFT , _TIMER_CC_CTRL_PRSSEL_SHIFT , TIMER_TypeDef::CC , TIMER_InitCC_TypeDef::cmoa , TIMER_InitCC_TypeDef::cofoa , TIMER_InitCC_TypeDef::coist , TIMER_CC_TypeDef::CTRL , TIMER_InitCC_TypeDef::cufoa , TIMER_InitCC_TypeDef::edge , TIMER_InitCC_TypeDef::eventCtrl , TIMER_InitCC_TypeDef::filter , TIMER_InitCC_TypeDef::mode , TIMER_InitCC_TypeDef::outInvert , TIMER_InitCC_TypeDef::prsInput , TIMER_InitCC_TypeDef::prsSel , TIMER_CC_CTRL_COIST , TIMER_CC_CTRL_FILT_ENABLE , TIMER_CC_CTRL_INSEL_PRS , and TIMER_CC_CTRL_OUTINV .
Referenced by BOARD_init() , and USTIMER_Init() .
void TIMER_InitDTI | ( | TIMER_TypeDef * |
timer,
|
const TIMER_InitDTI_TypeDef * |
init
|
||
) |
Initialize the TIMER DTI unit.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] init
Pointer to TIMER DTI initialization structure.
Definition at line
158
of file
em_timer.c
.
References _TIMER_DTCTRL_DTPRSSEL_SHIFT , _TIMER_DTFC_DTFA_SHIFT , _TIMER_DTFC_DTPRS0FSEL_SHIFT , _TIMER_DTFC_DTPRS1FSEL_SHIFT , _TIMER_DTTIME_DTFALLT_SHIFT , _TIMER_DTTIME_DTPRESC_SHIFT , _TIMER_DTTIME_DTRISET_SHIFT , TIMER_InitDTI_TypeDef::activeLowOut , TIMER_InitDTI_TypeDef::autoRestart , TIMER_TypeDef::DTCTRL , TIMER_TypeDef::DTFC , TIMER_TypeDef::DTOGEN , TIMER_TypeDef::DTTIME , TIMER_InitDTI_TypeDef::enable , TIMER_InitDTI_TypeDef::enableFaultSourceCoreLockup , TIMER_InitDTI_TypeDef::enableFaultSourceDebugger , TIMER_InitDTI_TypeDef::enableFaultSourcePrsSel0 , TIMER_InitDTI_TypeDef::enableFaultSourcePrsSel1 , TIMER_InitDTI_TypeDef::enablePrsSource , TIMER_InitDTI_TypeDef::fallTime , TIMER_InitDTI_TypeDef::faultAction , TIMER_InitDTI_TypeDef::faultSourcePrsSel0 , TIMER_InitDTI_TypeDef::faultSourcePrsSel1 , TIMER_InitDTI_TypeDef::invertComplementaryOut , TIMER_InitDTI_TypeDef::outputsEnableMask , TIMER_InitDTI_TypeDef::prescale , TIMER_InitDTI_TypeDef::prsSel , TIMER_InitDTI_TypeDef::riseTime , TIMER0 , TIMER_ClearDTIFault() , TIMER_DTCTRL_DTCINV , TIMER_DTCTRL_DTDAS , TIMER_DTCTRL_DTIPOL , TIMER_DTCTRL_DTPRSEN , TIMER_DTFC_DTDBGFEN , TIMER_DTFC_DTLOCKUPFEN , TIMER_DTFC_DTPRS0FEN , TIMER_DTFC_DTPRS1FEN , TIMER_EnableDTI() , and TIMER_GetDTIFault() .
__STATIC_INLINE void TIMER_IntClear | ( | TIMER_TypeDef * |
timer,
|
uint32_t |
flags
|
||
) |
Clear one or more pending TIMER interrupts.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] flags
Pending TIMER interrupt source(s) to clear. Use one or more valid interrupt flags for the TIMER module (TIMER_IF_nnn) OR'ed together.
Definition at line
740
of file
em_timer.h
.
References TIMER_TypeDef::IFC .
Referenced by USTIMER_DeInit() .
__STATIC_INLINE void TIMER_IntDisable | ( | TIMER_TypeDef * |
timer,
|
uint32_t |
flags
|
||
) |
Disable one or more TIMER interrupts.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] flags
TIMER interrupt source(s) to disable. Use one or more valid interrupt flags for the TIMER module (TIMER_IF_nnn) OR'ed together.
Definition at line
756
of file
em_timer.h
.
References TIMER_TypeDef::IEN .
Referenced by USTIMER_DeInit() , and USTIMER_Init() .
__STATIC_INLINE void TIMER_IntEnable | ( | TIMER_TypeDef * |
timer,
|
uint32_t |
flags
|
||
) |
Enable one or more TIMER interrupts.
- Note
- Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. Consider using TIMER_IntClear() prior to enabling if such a pending interrupt should be ignored.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] flags
TIMER interrupt source(s) to enable. Use one or more valid interrupt flags for the TIMER module (TIMER_IF_nnn) OR'ed together.
Definition at line
777
of file
em_timer.h
.
References TIMER_TypeDef::IEN .
__STATIC_INLINE uint32_t TIMER_IntGet | ( | TIMER_TypeDef * |
timer
|
) |
Get pending TIMER interrupt flags.
- Note
- The event bits are not cleared by the use of this function.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block.
- Returns
- TIMER interrupt source(s) pending. Returns one or more valid interrupt flags for the TIMER module (TIMER_IF_nnn) OR'ed together.
Definition at line
796
of file
em_timer.h
.
References TIMER_TypeDef::IF .
__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.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block.
- Note
- Interrupt flags are not cleared by the use of this function.
- Returns
-
Pending and enabled TIMER interrupt sources. The return value is the bitwise AND combination of
- the OR combination of enabled interrupt sources in TIMERx_IEN_nnn register (TIMERx_IEN_nnn) and
- the OR combination of valid interrupt flags of the TIMER module (TIMERx_IF_nnn).
Definition at line
820
of file
em_timer.h
.
References TIMER_TypeDef::IEN , and TIMER_TypeDef::IF .
__STATIC_INLINE void TIMER_IntSet | ( | TIMER_TypeDef * |
timer,
|
uint32_t |
flags
|
||
) |
Set one or more pending TIMER interrupts from SW.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] flags
TIMER interrupt source(s) to set to pending. Use one or more valid interrupt flags for the TIMER module (TIMER_IF_nnn) OR'ed together.
Definition at line
843
of file
em_timer.h
.
References TIMER_TypeDef::IFS .
__STATIC_INLINE void TIMER_Lock | ( | TIMER_TypeDef * |
timer
|
) |
Lock some of the TIMER registers in order to protect them from being modified.
Please refer to the reference manual for TIMER registers that will be locked.
- Note
- If locking the TIMER registers, they must be unlocked prior to using any TIMER API functions modifying TIMER registers protected by the lock.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block.
Definition at line
865
of file
em_timer.h
.
References TIMER_TypeDef::DTLOCK , TIMER0 , and TIMER_DTLOCK_LOCKKEY_LOCK .
__STATIC_INLINE uint32_t TIMER_MaxCount | ( | const TIMER_TypeDef * |
ref
|
) |
Get the Max count of the timer.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block.
- Returns
- The max count value of the timer. This is 0xFFFF for 16 bit timers and 0xFFFFFFFF for 32 bit timers.
Definition at line
519
of file
em_timer.h
.
References WTIMER0 , and WTIMER1 .
Referenced by TIMER_CompareBufSet() , TIMER_CompareSet() , TIMER_CounterSet() , TIMER_TopBufSet() , and TIMER_TopSet() .
void TIMER_Reset | ( | TIMER_TypeDef * |
timer
|
) |
Reset TIMER to same state as after a HW reset.
- Note
- The ROUTE register is NOT reset by this function, in order to allow for centralized setup of this feature.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block.
Definition at line
212
of file
em_timer.c
.
References _TIMER_CC_CCV_RESETVALUE , _TIMER_CC_CCVB_RESETVALUE , _TIMER_CC_CTRL_RESETVALUE , _TIMER_CNT_RESETVALUE , _TIMER_CTRL_RESETVALUE , _TIMER_DTCTRL_RESETVALUE , _TIMER_DTFAULTC_MASK , _TIMER_DTFC_RESETVALUE , _TIMER_DTOGEN_RESETVALUE , _TIMER_DTTIME_RESETVALUE , _TIMER_IEN_RESETVALUE , _TIMER_IFC_MASK , _TIMER_TOP_RESETVALUE , _TIMER_TOPB_RESETVALUE , TIMER_TypeDef::CC , TIMER_CC_TypeDef::CCV , TIMER_CC_TypeDef::CCVB , TIMER_TypeDef::CMD , TIMER_TypeDef::CNT , TIMER_CC_TypeDef::CTRL , TIMER_TypeDef::CTRL , TIMER_TypeDef::DTCTRL , TIMER_TypeDef::DTFAULTC , TIMER_TypeDef::DTFC , TIMER_TypeDef::DTLOCK , TIMER_TypeDef::DTOGEN , TIMER_TypeDef::DTTIME , TIMER_TypeDef::IEN , TIMER_TypeDef::IFC , TIMER_CMD_STOP , TIMER_DTLOCK_LOCKKEY_UNLOCK , TIMER_TypeDef::TOP , and TIMER_TypeDef::TOPB .
__STATIC_INLINE void TIMER_TopBufSet | ( | TIMER_TypeDef * |
timer,
|
uint32_t |
val
|
||
) |
Set top value buffer for timer.
When the top value buffer register is updated, the value is loaded into the top value register at the next wrap around. This feature is useful in order to update the top value safely when the timer is running.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] val
Value to set in top value buffer register.
Definition at line
890
of file
em_timer.h
.
References TIMER_MaxCount() , and TIMER_TypeDef::TOPB .
__STATIC_INLINE uint32_t TIMER_TopGet | ( | TIMER_TypeDef * |
timer
|
) |
Get top value setting for timer.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block.
- Returns
- Current top value.
Definition at line
906
of file
em_timer.h
.
References TIMER_TypeDef::TOP .
__STATIC_INLINE void TIMER_TopSet | ( | TIMER_TypeDef * |
timer,
|
uint32_t |
val
|
||
) |
Set top value for timer.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block. [in] val
Value to set in top value register.
Definition at line
921
of file
em_timer.h
.
References TIMER_MaxCount() , and TIMER_TypeDef::TOP .
Referenced by BOARD_init() , and USTIMER_Init() .
__STATIC_INLINE void TIMER_Unlock | ( | TIMER_TypeDef * |
timer
|
) |
Unlock the TIMER so that writing to locked registers again is possible.
- Parameters
-
[in] timer
Pointer to TIMER peripheral register block.
Definition at line
935
of file
em_timer.h
.
References TIMER_TypeDef::DTLOCK , TIMER0 , and TIMER_DTLOCK_LOCKKEY_UNLOCK .
__STATIC_INLINE bool TIMER_Valid | ( | const TIMER_TypeDef * |
ref
|
) |