rtcdriver.h File Reference

RTCDRV timer API definition.

Version
5.5.0

License

(C) Copyright 2014 Silicon Labs, www.silabs.com

This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file rtcdriver.h .

#include <stdint.h>
#include <stdbool.h>
#include " ecode.h "
#include "rtcdrv_config.h"

Macros

#define ECODE_EMDRV_RTCDRV_ALL_TIMERS_USED ( ECODE_EMDRV_RTCDRV_BASE | 0x00000001)
No timers available.
#define ECODE_EMDRV_RTCDRV_ILLEGAL_TIMER_ID ( ECODE_EMDRV_RTCDRV_BASE | 0x00000002)
An illegal timer ID.
#define ECODE_EMDRV_RTCDRV_OK ( ECODE_OK )
A successful return value.
#define ECODE_EMDRV_RTCDRV_PARAM_ERROR ( ECODE_EMDRV_RTCDRV_BASE | 0x00000004)
An illegal input parameter.
#define ECODE_EMDRV_RTCDRV_TIMER_NOT_ALLOCATED ( ECODE_EMDRV_RTCDRV_BASE | 0x00000003)
A timer is not allocated.
#define ECODE_EMDRV_RTCDRV_TIMER_NOT_RUNNING ( ECODE_EMDRV_RTCDRV_BASE | 0x00000005)
A timer is not running.

Typedefs

typedef void(* RTCDRV_Callback_t ) ( RTCDRV_TimerID_t id, void *user)
Typedef for the user supplied callback function which is called when a timer elapses.
typedef uint32_t RTCDRV_TimerID_t
Timer ID.

Enumerations

enum RTCDRV_TimerType_t {
rtcdrvTimerTypeOneshot = 0,
rtcdrvTimerTypePeriodic = 1
}
Timer type enumerator.

Functions

Ecode_t RTCDRV_AllocateTimer ( RTCDRV_TimerID_t *id)
Allocate timer.
Ecode_t RTCDRV_DeInit (void)
Deinitialize the RTCDRV driver.
Ecode_t RTCDRV_Delay (uint32_t ms)
Millisecond delay function.
Ecode_t RTCDRV_FreeTimer ( RTCDRV_TimerID_t id)
Free timer.
uint32_t RTCDRV_GetWallClock (void)
Get wallclock time.
uint32_t RTCDRV_GetWallClockTicks32 (void)
Get wallclock tick count as a 32bit value. At 4 ticks per millisecond, overflow occurs after approximately 12.5 days.
uint64_t RTCDRV_GetWallClockTicks64 (void)
Get a wallclock tick count as a 64 bit value. This will never overflow.
Ecode_t RTCDRV_Init (void)
Initialize the RTCDRV driver.
Ecode_t RTCDRV_IsRunning ( RTCDRV_TimerID_t id, bool *isRunning)
Check if a given timer is running.
uint64_t RTCDRV_MsecsToTicks (uint32_t ms)
Convert from milliseconds to RTC/RTCC ticks.
uint64_t RTCDRV_SecsToTicks (uint32_t secs)
Convert from seconds to RTC/RTCC ticks.
Ecode_t RTCDRV_SetWallClock (uint32_t secs)
Set wallclock time.
Ecode_t RTCDRV_StartTimer ( RTCDRV_TimerID_t id, RTCDRV_TimerType_t type, uint32_t timeout, RTCDRV_Callback_t callback, void *user)
Start a timer.
Ecode_t RTCDRV_StopTimer ( RTCDRV_TimerID_t id)
Stop a given timer.
uint32_t RTCDRV_TicksToMsec (uint64_t ticks)
Convert from RTC/RTCC ticks to milliseconds.
uint32_t RTCDRV_TicksToSec (uint64_t ticks)
Convert from RTC/RTCC ticks to seconds.
Ecode_t RTCDRV_TimeRemaining ( RTCDRV_TimerID_t id, uint32_t *timeRemaining)
Get time left before a given timer expires.