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 
22 #ifndef SEMTECH_LORAMAC_TIMER_H
23 #define SEMTECH_LORAMAC_TIMER_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include "ztimer.h"
30 #include "msg.h"
31 
32 #include "semtech_loramac.h"
33 
37 typedef struct TimerEvent_s {
38  uint32_t timeout;
39  uint8_t running;
42  void (*cb)(void);
43 } TimerEvent_t;
44 
48 #ifndef TimerTime_t
49 typedef uint32_t TimerTime_t;
50 #endif
51 
61 void TimerInit(TimerEvent_t *obj, void (*callback)(void));
62 
66 void TimerIrqHandler(void);
67 
73 void TimerStart(TimerEvent_t *obj);
74 
80 void TimerStop(TimerEvent_t *obj);
81 
87 void TimerReset(TimerEvent_t *obj);
88 
95 void TimerSetValue(TimerEvent_t *obj, uint32_t value);
96 
103 
111 
119 
123 void TimerLowPowerHandler(void);
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif /* SEMTECH_LORAMAC_TIMER_H */
130 
TimerGetCurrentTime
TimerTime_t TimerGetCurrentTime(void)
Read the current time.
TimerEvent_s::cb
void(* cb)(void)
callback to call when timer timeout
Definition: timer.h:42
TimerEvent_t
struct TimerEvent_s TimerEvent_t
Timer object description.
semtech_loramac.h
Public API and definitions of the Semtech LoRaMAC.
ztimer.h
ztimer API
TimerTime_t
uint32_t TimerTime_t
Timer time variable definition.
Definition: timer.h:49
ztimer_t
ztimer structure
Definition: ztimer.h:279
TimerStop
void TimerStop(TimerEvent_t *obj)
Stops and removes the timer object from the list of timer events.
msg.h
Messaging API for inter process communication.
TimerSetValue
void TimerSetValue(TimerEvent_t *obj, uint32_t value)
Set timer new timeout value.
TimerEvent_s::timeout
uint32_t timeout
Timer timeout in us.
Definition: timer.h:38
TimerGetFutureTime
TimerTime_t TimerGetFutureTime(TimerTime_t time)
Return the time elapsed since a fix moment in time.
TimerGetElapsedTime
TimerTime_t TimerGetElapsedTime(TimerTime_t time)
Return the time elapsed since a fix moment in Time.
TimerEvent_s::running
uint8_t running
Check if timer is running.
Definition: timer.h:39
TimerStart
void TimerStart(TimerEvent_t *obj)
Starts and adds the timer object to the list of timer events.
TimerEvent_s::dev
ztimer_t dev
ztimer instance attached to this LoRaMAC timer
Definition: timer.h:40
TimerEvent_s
Timer object description.
Definition: timer.h:37
TimerEvent_s::msg
msg_t msg
message attacher to this LoRaMAC timer
Definition: timer.h:41
msg_t
Describes a message object which can be sent between threads.
Definition: msg.h:185
TimerReset
void TimerReset(TimerEvent_t *obj)
Resets the timer object.
TimerIrqHandler
void TimerIrqHandler(void)
Timer IRQ event handler.
TimerInit
void TimerInit(TimerEvent_t *obj, void(*callback)(void))
Initializes the timer object.
TimerLowPowerHandler
void TimerLowPowerHandler(void)
Manages the entry into low power mode.