Loading...
Searching...
No Matches
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
26extern "C" {
27#endif
28
29#include "ztimer.h"
30#include "msg.h"
31
32#include "semtech_loramac.h"
33
37typedef struct TimerEvent_s {
38 uint32_t timeout;
39 uint8_t running;
42 void (*cb)(void);
44
48#ifndef TimerTime_t
49typedef uint32_t TimerTime_t;
50#endif
51
61void TimerInit(TimerEvent_t *obj, void (*callback)(void));
62
66void TimerIrqHandler(void);
67
74
81
88
95void TimerSetValue(TimerEvent_t *obj, uint32_t value);
96
103
111
119
124
125#ifdef __cplusplus
126}
127#endif
128
129#endif /* SEMTECH_LORAMAC_TIMER_H */
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:49
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:37
msg_t msg
message attacher to this LoRaMAC timer
Definition timer.h:41
void(* cb)(void)
callback to call when timer timeout
Definition timer.h:42
uint32_t timeout
Timer timeout in us.
Definition timer.h:38
ztimer_t dev
ztimer instance attached to this LoRaMAC timer
Definition timer.h:40
uint8_t running
Check if timer is running.
Definition timer.h:39
Describes a message object which can be sent between threads.
Definition msg.h:196
ztimer structure
Definition ztimer.h:332
ztimer API