SwTimer#

Modules#

SSwTimer

SSwTimerPrivate_t

Enumerations#

enum
ESWTIMER_STATUS_SUCCESS = 0
ESWTIMER_STATUS_FAILED = 1
}

Defines return values from SwTimer methods.

Typedefs#

typedef enum ESwTimerStatus

Defines return values from SwTimer methods.

typedef struct SSwTimerLiaison *

Typedef needed to include pointer for struct SSwTimerLiaison in struct SSwTimer, without requiring include of definition SSwTimerLiaison.

typedef struct SSwTimer
typedef struct SSwTimerPrivate_t

Timer Liaison object.

Functions#

void
TimerSetCallback(SSwTimer *pTimer, void(*pCallback)(SSwTimer *pTimer))

Configures the callback method called on timer timeout.

TimerStart(SSwTimer *pTimer, uint32_t iTimeout)

Configures Timer timeout and starts the timer.

TimerStartFromISR(SSwTimer *pTimer, uint32_t iTimeout)

Configures Timer timeout and starts the timer from an Interrupt Service Routine.

TimerRestart(SSwTimer *pTimer)

Restarts the timer.

TimerRestartFromISR(SSwTimer *pTimer)

Restarts the timer.

TimerStop(SSwTimer *pTimer)

Stops an active timer.

TimerStopFromISR(SSwTimer *pTimer)

Stops an active timer from an Interrupt Service Routine.

bool
TimerIsActive(SSwTimer *pTimer)

Returns if the timer is active.

bool
TimerHasPendingCallback(SSwTimer *pTimer)

Returns if timer has a timeout callback pending.

bool

Returns if timer has a timeout callback pending from an Interrupt Service Routine.

TimerGetMsUntilTimeout(SSwTimer *pTimer, uint32_t refTaskTickCount, uint32_t *pMsUntilTimeout)

Queries a timer for number of milliseconds remaining before time out Method may be called on inactive timers, but in that case ESWTIMER_STATUS_FAILED will be returned and pMsUntilTimeout will not be modified.

uint32_t
TimerGetPeriod(SSwTimer *pTimer)

Returns the period of a freeRTOS timer.

Macros#

#define
PRIVATE_TIMER_SIZE 11

Space for holding FreeRTOS StaticEventGroup_t and EventGroupHandle_t.

Enumeration Documentation#

ESwTimerStatus#

ESwTimerStatus

Defines return values from SwTimer methods.

Enumerator
ESWTIMER_STATUS_SUCCESS

ESWTIMER_STATUS_SUCCESS.

ESWTIMER_STATUS_FAILED

ESWTIMER_STATUS_FAILED.


Typedef Documentation#

ESwTimerStatus#

typedef enum ESwTimerStatus ESwTimerStatus

Defines return values from SwTimer methods.


SSwTimerLiaisonPtr#

typedef struct SSwTimerLiaison* SSwTimerLiaisonPtr

Typedef needed to include pointer for struct SSwTimerLiaison in struct SSwTimer, without requiring include of definition SSwTimerLiaison.


SSwTimer#

typedef struct SSwTimer SSwTimer

SSwTimerPrivate_t#

typedef struct SSwTimerPrivate_t SSwTimerPrivate_t

Timer Liaison object.

All content is private.


Function Documentation#

TimerSetCallback#

void TimerSetCallback (SSwTimer * pTimer, void(*)(SSwTimer *pTimer) pCallback)

Configures the callback method called on timer timeout.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object

void(*)(SSwTimer *pTimer)[in]pCallback

Callback method of type void Callback(SSwTimer* pTimer). Argument may be NULL, in which case no callback is performed.

If called on a timer that has a pending callback, the callback will be executed on the new callback method.


TimerStart#

ESwTimerStatus TimerStart (SSwTimer * pTimer, uint32_t iTimeout)

Configures Timer timeout and starts the timer.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object

uint32_t[in]iTimeout

Timeout value in ms. Zero is illegal.

If method is called on a timer that is already started, the timer will restart from zero and count towards the new timeout.


TimerStartFromISR#

ESwTimerStatus TimerStartFromISR (SSwTimer * pTimer, uint32_t iTimeout)

Configures Timer timeout and starts the timer from an Interrupt Service Routine.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object

uint32_t[in]iTimeout

Timeout value in ms. Zero is illegal.

If method is called on a timer that is already started, the timer will restart from zero and count towards the new timeout.


TimerRestart#

ESwTimerStatus TimerRestart (SSwTimer * pTimer)

Restarts the timer.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object

Starts an inactive timer. If called on a timer that is already started, the timer will restart from zero.


TimerRestartFromISR#

ESwTimerStatus TimerRestartFromISR (SSwTimer * pTimer)

Restarts the timer.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object

Starts an inactive timer. If called on a timer that is already started, the timer will restart from zero.


TimerStop#

ESwTimerStatus TimerStop (SSwTimer * pTimer)

Stops an active timer.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object

Method may be called on inactive timers. Any pending callbacks that has not been performed yet will be cleared.


TimerStopFromISR#

ESwTimerStatus TimerStopFromISR (SSwTimer * pTimer)

Stops an active timer from an Interrupt Service Routine.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object

Method may be called on inactive timers. Any pending callbacks that has not been performed yet will be cleared.


TimerIsActive#

bool TimerIsActive (SSwTimer * pTimer)

Returns if the timer is active.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object

Active is defined as the timer counting, or having a pending callback.


TimerHasPendingCallback#

bool TimerHasPendingCallback (SSwTimer * pTimer)

Returns if timer has a timeout callback pending.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object


TimerHasPendingCallbackFromISR#

bool TimerHasPendingCallbackFromISR (SSwTimer * pTimer)

Returns if timer has a timeout callback pending from an Interrupt Service Routine.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object


TimerGetMsUntilTimeout#

ESwTimerStatus TimerGetMsUntilTimeout (SSwTimer * pTimer, uint32_t refTaskTickCount, uint32_t * pMsUntilTimeout)

Queries a timer for number of milliseconds remaining before time out Method may be called on inactive timers, but in that case ESWTIMER_STATUS_FAILED will be returned and pMsUntilTimeout will not be modified.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object

uint32_t[in]refTaskTickCount

The xTaskGetTickCount() value to use as a reference for the timeout.

uint32_t *[out]pMsUntilTimeout

Pointer to variable to receive remaining time until timeout


TimerGetPeriod#

uint32_t TimerGetPeriod (SSwTimer * pTimer)

Returns the period of a freeRTOS timer.

Parameters
TypeDirectionArgument NameDescription
SSwTimer *[in]pTimer

Pointer to the timer object