SX126x-Arduino  2.0.1
Data Structures | Macros | Typedefs | Functions
timer.h File Reference
#include "stdint.h"
#include "stdbool.h"
#include "sx126x-debug.h"

Go to the source code of this file.

Data Structures

struct  TimerEvent_s
 Timer object description. More...
 

Macros

#define ROUNDED_DIV(A, B)   (((A) + ((B) / 2)) / (B))
 

Typedefs

typedef void(* callbackType) (void)
 
typedef struct TimerEvent_s TimerEvent_t
 Timer object description. More...
 
typedef uint32_t TimerTime_t
 Timer time variable definition. More...
 

Functions

void TimerConfig (void)
 Initializes the RTC2 timer. More...
 
void TimerInit (TimerEvent_t *obj, void(*callback)(void))
 Initializes the timer object. More...
 
void TimerStart (TimerEvent_t *obj)
 Starts and adds the timer object to the list of timer events. More...
 
void TimerStop (TimerEvent_t *obj)
 Stops and removes the timer object from the list of timer events. More...
 
void TimerReset (TimerEvent_t *obj)
 Resets the timer object. More...
 
void TimerSetValue (TimerEvent_t *obj, uint32_t value)
 Set timer new timeout value. More...
 
TimerTime_t TimerGetElapsedTime (TimerTime_t savedTime)
 Return the Time elapsed since a fix moment in Time. More...
 
TimerTime_t TimerGetCurrentTime (void)
 Read the current time ellapsed since the start (or restart) of RTC2. More...
 

Macro Definition Documentation

◆ ROUNDED_DIV

#define ROUNDED_DIV (   A,
 
)    (((A) + ((B) / 2)) / (B))

Typedef Documentation

◆ callbackType

typedef void(* callbackType) (void)

◆ TimerEvent_t

typedef struct TimerEvent_s TimerEvent_t

Timer object description.

◆ TimerTime_t

typedef uint32_t TimerTime_t

Timer time variable definition.

Function Documentation

◆ TimerConfig()

void TimerConfig ( void  )

Initializes the RTC2 timer.

Set prescaler to 31 in order to have Fs=1kHz Enable CC interrupt Start RTC2

◆ TimerInit()

void TimerInit ( TimerEvent_t obj,
void(*)(void)  callback 
)

Initializes the timer object.

Remarks
TimerSetValue function must be called before starting the timer. this function initializes timestamp and reload value at 0.
Parameters
objStructure containing the timer object parameters
callbackFunction callback called at the end of the timeout
Examples
LoRaWanPio\src\main.cpp.

◆ TimerStart()

void TimerStart ( TimerEvent_t obj)

Starts and adds the timer object to the list of timer events.

Parameters
objStructure containing the timer object parameters
Examples
LoRaWanPio\src\main.cpp.

◆ TimerStop()

void TimerStop ( TimerEvent_t obj)

Stops and removes the timer object from the list of timer events.

Parameters
objStructure containing the timer object parameters

◆ TimerReset()

void TimerReset ( TimerEvent_t obj)

Resets the timer object.

Parameters
objStructure containing the timer object parameters

◆ TimerSetValue()

void TimerSetValue ( TimerEvent_t obj,
uint32_t  value 
)

Set timer new timeout value.

Parameters
objStructure containing the timer object parameters
valueNew timer timeout value in ms
Examples
LoRaWanPio\src\main.cpp.

◆ TimerGetElapsedTime()

TimerTime_t TimerGetElapsedTime ( TimerTime_t  savedTime)

Return the Time elapsed since a fix moment in Time.

Parameters
savedTimefix moment in Time
Return values
timereturns elapsed time in ms

◆ TimerGetCurrentTime()

TimerTime_t TimerGetCurrentTime ( void  )

Read the current time ellapsed since the start (or restart) of RTC2.

Return values
currenttime in ms