Application Timer#

Modules#

SAppTimer

Typedefs#

typedef struct SAppTimer

AppTimer object.

Functions#

void
AppTimerInit(uint8_t iTaskNotificationBitNumber, void *ReceiverTask)

Initialize AppTimer.

void
AppTimerSetReceiverTask(void *ReceiverTask)

Configures the Receiver task of callbacks.

bool
AppTimerRegister(SSwTimer *pTimer, bool bAutoReload, void(*pCallback)(SSwTimer *pTimer))

Register a SwTimer to a TimerLiaison.

bool
AppTimerDeepSleepPersistentRegister(SSwTimer *pTimer, bool bAutoReload, void(*pCallback)(SSwTimer *pTimer))

Wrapper for AppTimerRegister to register timers that should be re-loaded after deep sleep hibernate.

AppTimerDeepSleepPersistentStart(SSwTimer *pTimer, uint32_t iTimeout)

Wrapper for TimerStart() that ensures the timer value is saved so it can be re-loaded after deep sleep hibernate.

Wrapper for TimerRestart() that ensures the timer status is saved so it can be re-loaded after deep sleep hibernate.

Wrapper for TimerStop() that ensures the timer status is saved so it does not get re-started after deep sleep hibernate.

void

Must be called from application task when the task notification bit assigned to AppTimer is set.

void

Clear storage used for persisting application timers during deep sleep hibernate.

void

Save SSwTimers that should survive deep sleep Hibernate.

void
AppTimerDeepSleepPersistentLoadAll(zpal_reset_reason_t resetReason)

Load SSwTimers after deep sleep hibernate wakeup.

uint32_t

Get index of first retention register used for saving Deep Sleep persistent app timers.

uint32_t

Get index of last retention register used for saving Deep Sleep persistent app timers.

void

Stops all the running applications timers.

Macros#

#define

Max number of application timers.

#define
APP_TIMER_RETENTION_REGISTER_RESERVED_COUNT (MAX_NUM_PERSISTENT_APP_TIMERS + 2)

Typedef Documentation#

SAppTimer#

typedef struct SAppTimer SAppTimer

AppTimer object.


Definition at line 51 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

Function Documentation#

AppTimerInit#

void AppTimerInit (uint8_t iTaskNotificationBitNumber, void * ReceiverTask)

Initialize AppTimer.

Parameters
[in]iTaskNotificationBitNumber

Number defines which bit to use when notifying receiver task of pending timer event (range 0 - 31)

[in]ReceiverTask

Handle to the Application task


Definition at line 60 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerSetReceiverTask#

void AppTimerSetReceiverTask (void * ReceiverTask)

Configures the Receiver task of callbacks.

Parameters
[in]ReceiverTask

Handle to the Application task

Provided as the AppTimer may be needed for registering SwTimers before the receiver task is created, meaning AppTimerInit is called prior to the Receiver task handle being available. Though not the intention, the receiver task can be changed at run time.


Definition at line 73 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerRegister#

bool AppTimerRegister (SSwTimer * pTimer, bool bAutoReload, void(*)(SSwTimer *pTimer) pCallback)

Register a SwTimer to a TimerLiaison.

Parameters
[in]pTimer

Pointer to the SwTimer object to register

[in]bAutoReload

Enable timer auto reload on timeout. Configuration of AutoReload cannot be changed after registration.

[in]pCallback

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

Initial SwTimer configuration is also performed.

Method creates a static FreeRTOS timer from the SwTimer object passed as argument, and registers it as requiring callbacks in the Receiver task. If calling method AppTimerRegister on the same SwTimer object multiple times, all but the first call will be ignored.


Definition at line 93 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerDeepSleepPersistentRegister#

bool AppTimerDeepSleepPersistentRegister (SSwTimer * pTimer, bool bAutoReload, void(*)(SSwTimer *pTimer) pCallback)

Wrapper for AppTimerRegister to register timers that should be re-loaded after deep sleep hibernate.

Parameters
N/ApTimer
N/AbAutoReload
N/ApCallback

In addition to having AppTimerRegister() register the timer with a TimerLiaison this function also marks the timer to survive deep sleep hibernate.

For parameter descriptions See Also


Definition at line 109 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerDeepSleepPersistentStart#

ESwTimerStatus AppTimerDeepSleepPersistentStart (SSwTimer * pTimer, uint32_t iTimeout)

Wrapper for TimerStart() that ensures the timer value is saved so it can be re-loaded after deep sleep hibernate.

Parameters
N/ApTimer
N/AiTimeout

For parameter descriptions See Also


Definition at line 120 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerDeepSleepPersistentRestart#

ESwTimerStatus AppTimerDeepSleepPersistentRestart (SSwTimer * pTimer)

Wrapper for TimerRestart() that ensures the timer status is saved so it can be re-loaded after deep sleep hibernate.

Parameters
N/ApTimer

For parameter descriptions See Also


Definition at line 129 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerDeepSleepPersistentStop#

ESwTimerStatus AppTimerDeepSleepPersistentStop (SSwTimer * pTimer)

Wrapper for TimerStop() that ensures the timer status is saved so it does not get re-started after deep sleep hibernate.

Parameters
N/ApTimer

For parameter descriptions See Also


Definition at line 138 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerNotificationHandler#

void AppTimerNotificationHandler (void )

Must be called from application task when the task notification bit assigned to AppTimer is set.

Parameters
N/A

Method will perform pending callbacks. There is no side effects from calling method when assigned task notification bit was not set.


Definition at line 148 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerDeepSleepPersistentResetStorage#

void AppTimerDeepSleepPersistentResetStorage (void )

Clear storage used for persisting application timers during deep sleep hibernate.

Parameters
N/A

Definition at line 154 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerDeepSleepPersistentSaveAll#

void AppTimerDeepSleepPersistentSaveAll (void )

Save SSwTimers that should survive deep sleep Hibernate.

Parameters
N/A

The number of remaining milliseconds until timeout are saved to the RTCC retention registers for all application timers registered to be persisted during Deep Sleep.


Definition at line 164 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerDeepSleepPersistentLoadAll#

void AppTimerDeepSleepPersistentLoadAll (zpal_reset_reason_t resetReason)

Load SSwTimers after deep sleep hibernate wakeup.

Parameters
N/AresetReason

Reason why the device woke up

Activates callback registered for the timer causing the wakeup

Must be called AFTER AppTimerInit() and AppTimerDeepSleepPersistentRegister()


Definition at line 176 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerDeepSleepGetFirstRetentionRegister#

uint32_t AppTimerDeepSleepGetFirstRetentionRegister (void )

Get index of first retention register used for saving Deep Sleep persistent app timers.

Parameters
N/A

The retention registers are manipulated with the zpal_retention_register_xx() API.


Definition at line 184 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerDeepSleepGetLastRetentionRegister#

uint32_t AppTimerDeepSleepGetLastRetentionRegister (void )

Get index of last retention register used for saving Deep Sleep persistent app timers.

Parameters
N/A

NB: The number of retention registers used depends on how many times AppTimerDeepSleepPersistentRegister() have been called since system startup. It is not safe to use the returned value to locate "free" retention registers unless it is guarantees that all calls to AppTimerDeepSleepPersistentRegister() has been performed.

The retention registers are manipulated with the zpal_retention_register_xx() API.


Definition at line 198 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

AppTimerStopAll#

void AppTimerStopAll (void )

Stops all the running applications timers.

Parameters
N/A

Definition at line 204 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

Macro Definition Documentation#

MAX_NUM_APP_TIMERS#

#define MAX_NUM_APP_TIMERS
Value:
12

Max number of application timers.


Definition at line 38 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

MAX_NUM_PERSISTENT_APP_TIMERS#

#define MAX_NUM_PERSISTENT_APP_TIMERS
Value:
6

Definition at line 39 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h

APP_TIMER_RETENTION_REGISTER_RESERVED_COUNT#

#define APP_TIMER_RETENTION_REGISTER_RESERVED_COUNT
Value:
(MAX_NUM_PERSISTENT_APP_TIMERS + 2)

Definition at line 40 of file /mnt/raid/workspaces/ws.Mh9rMZz8x/overlay/gsdk/protocol/z-wave/ZAF/ApplicationUtilities/AppTimer.h