TIMER - Timer/Counter

Description

Timer/Counter (TIMER) Peripheral API.

The timer module consists of three main parts:

  • General timer configuration and enable control.
  • Compare/capture control.
  • Dead time insertion control (may not be available for all timers).

Data Structures

struct TIMER_Init_TypeDef
TIMER initialization structure.
struct TIMER_InitCC_TypeDef
TIMER compare/capture initialization structure.
struct TIMER_InitDTI_TypeDef
TIMER Dead Time Insertion (DTI) initialization structure.

Functions

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 the TIMER compare/capture channel.
void TIMER_InitDTI (TIMER_TypeDef *timer, const TIMER_InitDTI_TypeDef *init)
Initialize the TIMER DTI unit.
void TIMER_Reset (TIMER_TypeDef *timer)
Reset the TIMER to the same state that it was in after a hardware reset.
bool TIMER_Valid (const TIMER_TypeDef *ref)
Validate TIMER register block pointer.
bool TIMER_SupportsDTI (const TIMER_TypeDef *ref)
Check if TIMER is valid and supports Dead Timer Insertion (DTI).
uint32_t TIMER_MaxCount (const TIMER_TypeDef *ref)
Get the Max count of the timer.
uint32_t TIMER_CaptureGet (TIMER_TypeDef *timer, unsigned int ch)
Get compare/capture value for compare/capture channel.
uint32_t TIMER_CaptureBufGet (TIMER_TypeDef *timer, unsigned int ch)
Get buffered compare/capture value for compare/capture channel.
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.
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.
uint32_t TIMER_CounterGet (TIMER_TypeDef *timer)
Get TIMER counter value.
void TIMER_CounterSet (TIMER_TypeDef *timer, uint32_t val)
Set TIMER counter value.
void TIMER_Enable (TIMER_TypeDef *timer, bool enable)
Start/stop TIMER.
void TIMER_EnableDTI (TIMER_TypeDef *timer, bool enable)
Enable or disable DTI unit.
uint32_t TIMER_GetDTIFault (TIMER_TypeDef *timer)
Get DTI fault source flags status.
void TIMER_ClearDTIFault (TIMER_TypeDef *timer, uint32_t flags)
Clear DTI fault source flags.
void TIMER_IntClear (TIMER_TypeDef *timer, uint32_t flags)
Clear one or more pending TIMER interrupts.
void TIMER_IntDisable (TIMER_TypeDef *timer, uint32_t flags)
Disable one or more TIMER interrupts.
void TIMER_IntEnable (TIMER_TypeDef *timer, uint32_t flags)
Enable one or mor