MAX32665 Peripheral Driver API
Peripheral Driver API for the MAX32665
Timer (TMR)

Modules

 TMR_Registers
 

Data Structures

struct  mxc_tmr_cfg_t
 

Enumerations

enum  mxc_tmr_pres_t
 
enum  mxc_tmr_mode_t
 
enum  mxc_tmr_unit_t
 

Functions

void MXC_TMR_Init (mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg)
 
void MXC_TMR_Shutdown (mxc_tmr_regs_t *tmr)
 
void MXC_TMR_Start (mxc_tmr_regs_t *tmr)
 
void MXC_TMR_Stop (mxc_tmr_regs_t *tmr)
 
int MXC_TMR_SetPWM (mxc_tmr_regs_t *tmr, uint32_t pwm)
 
uint32_t MXC_TMR_GetCompare (mxc_tmr_regs_t *tmr)
 
uint32_t MXC_TMR_GetCapture (mxc_tmr_regs_t *tmr)
 
uint32_t MXC_TMR_GetCount (mxc_tmr_regs_t *tmr)
 
void MXC_TMR_ClearFlags (mxc_tmr_regs_t *tmr)
 
uint32_t MXC_TMR_GetFlags (mxc_tmr_regs_t *tmr)
 
void MXC_TMR_EnableInt (mxc_tmr_regs_t *tmr)
 
void MXC_TMR_DisableInt (mxc_tmr_regs_t *tmr)
 
void MXC_TMR_SetCompare (mxc_tmr_regs_t *tmr, uint32_t cmp_cnt)
 
void MXC_TMR_SetCount (mxc_tmr_regs_t *tmr, uint32_t cnt)
 
void MXC_TMR_Delay (mxc_tmr_regs_t *tmr, unsigned long us)
 
void MXC_TMR_TO_Start (mxc_tmr_regs_t *tmr, unsigned long us)
 
int MXC_TMR_TO_Check (mxc_tmr_regs_t *tmr)
 
void MXC_TMR_TO_Stop (mxc_tmr_regs_t *tmr)
 
void MXC_TMR_TO_Clear (mxc_tmr_regs_t *tmr)
 
unsigned int MXC_TMR_TO_Elapsed (mxc_tmr_regs_t *tmr)
 
unsigned int MXC_TMR_TO_Remaining (mxc_tmr_regs_t *tmr)
 
void MXC_TMR_SW_Start (mxc_tmr_regs_t *tmr)
 
unsigned int MXC_TMR_SW_Stop (mxc_tmr_regs_t *tmr)
 
int MXC_TMR_GetTime (mxc_tmr_regs_t *tmr, uint32_t ticks, uint32_t *time, mxc_tmr_unit_t *units)
 

Detailed Description


Data Structure Documentation

◆ mxc_tmr_cfg_t

struct mxc_tmr_cfg_t

Timer Configuration.

Data Fields

mxc_tmr_pres_t pres
 
mxc_tmr_mode_t mode
 
uint32_t cmp_cnt
 
unsigned pol
 

Enumeration Type Documentation

◆ mxc_tmr_mode_t

Timer modes.

Enumerator
TMR_MODE_ONESHOT 

Timer Mode ONESHOT.

TMR_MODE_CONTINUOUS 

Timer Mode CONTINUOUS.

TMR_MODE_COUNTER 

Timer Mode COUNTER.

TMR_MODE_PWM 

Timer Mode PWM.

TMR_MODE_CAPTURE 

Timer Mode CAPTURE.

TMR_MODE_COMPARE 

Timer Mode COMPARE.

TMR_MODE_GATED 

Timer Mode GATED.

TMR_MODE_CAPTURE_COMPARE 

Timer Mode CAPTURECOMPARE.

◆ mxc_tmr_pres_t

Timer prescaler values.

Enumerator
TMR_PRES_1 

Divide input clock by 1.

TMR_PRES_2 

Divide input clock by 2.

TMR_PRES_4 

Divide input clock by 4.

TMR_PRES_8 

Divide input clock by 8.

TMR_PRES_16 

Divide input clock by 16.

TMR_PRES_32 

Divide input clock by 32.

TMR_PRES_64 

Divide input clock by 64.

TMR_PRES_128 

Divide input clock by 128.

TMR_PRES_256 

Divide input clock by 256.

TMR_PRES_512 

Divide input clock by 512.

TMR_PRES_1024 

Divide input clock by 1024.

TMR_PRES_2048 

Divide input clock by 2048.

TMR_PRES_4096 

Divide input clock by 4096.

◆ mxc_tmr_unit_t

Timer units of time enumeration.

Enumerator
TMR_UNIT_NANOSEC 

Nanosecond Unit Indicator.

TMR_UNIT_MICROSEC 

Microsecond Unit Indicator.

TMR_UNIT_MILLISEC 

Millisecond Unit Indicator.

TMR_UNIT_SEC 

Second Unit Indicator.

Function Documentation

◆ MXC_TMR_ClearFlags()

void MXC_TMR_ClearFlags ( mxc_tmr_regs_t *  tmr)

Clear the timer interrupt.

Parameters
tmrPointer to timer module to initialize.

◆ MXC_TMR_Delay()

void MXC_TMR_Delay ( mxc_tmr_regs_t *  tmr,
unsigned long  us 
)

Dealay for a set periord of time measured in microseconds.

Parameters
tmrThe timer
[in]usmicroseconds to delay for

◆ MXC_TMR_DisableInt()

void MXC_TMR_DisableInt ( mxc_tmr_regs_t *  tmr)

disable interupt

Parameters
tmrThe timer

◆ MXC_TMR_EnableInt()

void MXC_TMR_EnableInt ( mxc_tmr_regs_t *  tmr)

enable interupt

Parameters
tmrThe timer

◆ MXC_TMR_GetCapture()

uint32_t MXC_TMR_GetCapture ( mxc_tmr_regs_t *  tmr)

Get the timer capture count.

Parameters
tmrPointer to timer module to initialize.
Returns
Returns the most recent capture count.

◆ MXC_TMR_GetCompare()

uint32_t MXC_TMR_GetCompare ( mxc_tmr_regs_t *  tmr)

Get the timer compare count.

Parameters
tmrPointer to timer module to initialize.
Returns
Returns the current compare count.

◆ MXC_TMR_GetCount()

uint32_t MXC_TMR_GetCount ( mxc_tmr_regs_t *  tmr)

Get the timer count.

Parameters
tmrPointer to timer module to initialize.
Returns
Returns the current count.

◆ MXC_TMR_GetFlags()

uint32_t MXC_TMR_GetFlags ( mxc_tmr_regs_t *  tmr)

Get the timer interrupt status.

Parameters
tmrPointer to timer module to initialize.
Returns
Returns the interrupt status. 1 if interrupt has occured.

◆ MXC_TMR_GetTime()

int MXC_TMR_GetTime ( mxc_tmr_regs_t *  tmr,
uint32_t  ticks,
uint32_t *  time,
mxc_tmr_unit_t *  units 
)

Get time from timer.

Parameters
tmrThe timer
[in]ticksThe ticks
timeThe time
unitsThe units
Returns
E_NO_ERROR or error check mxc_errors.

◆ MXC_TMR_Init()

void MXC_TMR_Init ( mxc_tmr_regs_t *  tmr,
mxc_tmr_cfg_t *  cfg 
)

Initialize timer module clock.

Parameters
tmrPointer to timer module to initialize.
cfgconfiguration object

◆ MXC_TMR_SetCompare()

void MXC_TMR_SetCompare ( mxc_tmr_regs_t *  tmr,
uint32_t  cmp_cnt 
)

Set the timer compare count.

Parameters
tmrPointer to timer module to initialize.
cmp_cntNew compare count.
Note
In PWM Mode use this to set the value of the second transition.

◆ MXC_TMR_SetCount()

void MXC_TMR_SetCount ( mxc_tmr_regs_t *  tmr,
uint32_t  cnt 
)

Set the timer count.

Parameters
tmrPointer to timer module to initialize.
cntNew count.

◆ MXC_TMR_SetPWM()

int MXC_TMR_SetPWM ( mxc_tmr_regs_t *  tmr,
uint32_t  pwm 
)

Set the value of the first transition in PWM mode.

Parameters
tmrPointer to timer module to initialize.
pwmNew pwm count.
Note
Will block until safe to change the period count.
Returns
E_BAD_PARAM if pwm > cnt.

◆ MXC_TMR_Shutdown()

void MXC_TMR_Shutdown ( mxc_tmr_regs_t *  tmr)

Shutdown timer module clock.

Parameters
tmrPointer to timer module to initialize.

◆ MXC_TMR_Start()

void MXC_TMR_Start ( mxc_tmr_regs_t *  tmr)

Start the timer counting.

Parameters
tmrPointer to timer module to initialize.

◆ MXC_TMR_Stop()

void MXC_TMR_Stop ( mxc_tmr_regs_t *  tmr)

Stop the timer.

Parameters
tmrPointer to timer module to initialize.

◆ MXC_TMR_SW_Start()

void MXC_TMR_SW_Start ( mxc_tmr_regs_t *  tmr)

Start stopwatch.

Parameters
tmrThe timer

◆ MXC_TMR_SW_Stop()

unsigned int MXC_TMR_SW_Stop ( mxc_tmr_regs_t *  tmr)

Stopwatch stop.

Parameters
tmrThe timer
Returns
the time when the stopwatch is stopped.

◆ MXC_TMR_TO_Check()

int MXC_TMR_TO_Check ( mxc_tmr_regs_t *  tmr)

Check on time out timer.

Parameters
tmrThe timer
Returns
Returns E_TIMEOUT if timer timed out or E_NO_ERROR if it has not timed out

◆ MXC_TMR_TO_Clear()

void MXC_TMR_TO_Clear ( mxc_tmr_regs_t *  tmr)

Clear timeout timer back to zero.

Parameters
tmrThe timer

◆ MXC_TMR_TO_Elapsed()

unsigned int MXC_TMR_TO_Elapsed ( mxc_tmr_regs_t *  tmr)

Get elapsed time of timeout timer.

Parameters
tmrThe timer
Returns
Time that has elapsed in timeout timer

◆ MXC_TMR_TO_Remaining()

unsigned int MXC_TMR_TO_Remaining ( mxc_tmr_regs_t *  tmr)

Amount of time remaining until timeour.

Parameters
tmrThe timer
Returns
Time that is left until timeout

◆ MXC_TMR_TO_Start()

void MXC_TMR_TO_Start ( mxc_tmr_regs_t *  tmr,
unsigned long  us 
)

Start a timer that will time out after a certain number of microseconds.

Parameters
tmrThe timer
[in]usmicroseconds to time out after

◆ MXC_TMR_TO_Stop()

void MXC_TMR_TO_Stop ( mxc_tmr_regs_t *  tmr)

Stop the Timeout timer.

Parameters
tmrThe timer