timer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Fundacion Inria Chile
3  * 2017 Inria
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
10 #pragma once
11 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "ztimer.h"
29 #include "msg.h"
30 
31 #include "semtech_loramac.h"
32 
36 typedef struct TimerEvent_s {
37  uint32_t timeout;
38  uint8_t running;
41  void (*cb)(void);
43 
47 #ifndef TimerTime_t
48 typedef uint32_t TimerTime_t;
49 #endif
50 
60 void TimerInit(TimerEvent_t *obj, void (*callback)(void));
61 
65 void TimerIrqHandler(void);
66 
73 
80 
87 
94 void TimerSetValue(TimerEvent_t *obj, uint32_t value);
95 
102 
110 
118 
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
TimerTime_t TimerGetCurrentTime(void)
Read the current time.
void TimerLowPowerHandler(void)
Manages the entry into low power mode.
uint32_t TimerTime_t
Timer time variable definition.
Definition: timer.h:48
void TimerIrqHandler(void)
Timer IRQ event handler.
void TimerInit(TimerEvent_t *obj, void(*callback)(void))
Initializes the timer object.
void TimerReset(TimerEvent_t *obj)
Resets the timer object.
struct TimerEvent_s TimerEvent_t
Timer object description.
void TimerStop(TimerEvent_t *obj)
Stops and removes the timer object from the list of timer events.
void TimerStart(TimerEvent_t *obj)
Starts and adds the timer object to the list of timer events.
void TimerSetValue(TimerEvent_t *obj, uint32_t value)
Set timer new timeout value.
TimerTime_t TimerGetElapsedTime(TimerTime_t time)
Return the time elapsed since a fix moment in Time.
TimerTime_t TimerGetFutureTime(TimerTime_t time)
Return the time elapsed since a fix moment in time.
Public API and definitions of the Semtech LoRaMAC.
Timer object description.
Definition: timer.h:36
msg_t msg
message attacher to this LoRaMAC timer
Definition: timer.h:40
void(* cb)(void)
callback to call when timer timeout
Definition: timer.h:41
uint32_t timeout
Timer timeout in us.
Definition: timer.h:37
ztimer_t dev
ztimer instance attached to this LoRaMAC timer
Definition: timer.h:39
uint8_t running
Check if timer is running.
Definition: timer.h:38
Describes a message object which can be sent between threads.
Definition: msg.h:195
ztimer structure
Definition: ztimer.h:319
ztimer API