rtcounter.h File Reference

Includes

  1. 1.stdint.h

Functions

void
rtcount_initialize (void)

This function sets the RTCounter ISR handler as the the interrupt handler for the timer. Must be called while GIE = 0

Parameters:

none

Returns:

None

void
rtcount_create (rtcountStruct_t *timer, int32_t timeout)

This function adds a new timer to the list of serviced timers. The user supplies the memory for the timer and initializes it. This method simply updates absoluteTime and adds the timer to the list of serviced timers.

Parameters:

*timer

Type: rtcountStruct_t *

- timer instance to be created and added to the list

timeout

Type: int32_t

- number of timer ticks before this timer expires.

Returns:

None

void
rtcount_delete (rtcountStruct_t *volatile timer)

This function cancels and removes a running timer

Parameters:

*timer

Type: rtcountStruct_t *volatile

- timer instance to be removed

Returns:

None

void
rtcount_callNextCallback (void)

This function checks the list of expired timers and calls the first one in the list if the list is not empty. It also reschedules the timer if the callback returned a value greater than 0.It is recommended that this is called from the main superloop (while(1)) in your code but by design this can also be called from the timer ISR. If you wish callbacks to happen from the ISR context you can call this as the last action in timeout_isr instead.

Parameters:

none

Returns:

None

uint32_t
rtcount_getTickCount (void)

This function returns the 32-bit total tick count of the timer. This means concatenating the hardware timer value to the overflow counter

Parameters:

none

Returns:

None

void
rtcount_flushAll (void)

This function cancels and removes all timers in the queue

Parameters:

none

Returns:

None

void
rtcount_startTimer (rtcountStruct_t *timer)

This function is specifically used in Stopwatch mode for calculating the elapsed time in stopwatch mode. It will start a timer with maximum timeout length.

Parameters:

*timer

Type: rtcountStruct_t *

- timer instance.

Returns:

None

uint32_t
rtcount_stopTimer (rtcountStruct_t *timer)

This function will stop the running timer and return the number of ticks it counted.

Parameters:

*timer

Type: rtcountStruct_t *

- timer instance.

Returns: