Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Fundacion Inria Chile
3 * SPDX-FileCopyrightText: 2017 Inria
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include "ztimer.h"
26#include "msg.h"
27
28#include "semtech_loramac.h"
29
33typedef struct TimerEvent_s {
34 uint32_t timeout;
35 uint8_t running;
38 void (*cb)(void);
40
44#ifndef TimerTime_t
45typedef uint32_t TimerTime_t;
46#endif
47
57void TimerInit(TimerEvent_t *obj, void (*callback)(void));
58
62void TimerIrqHandler(void);
63
70
77
84
91void TimerSetValue(TimerEvent_t *obj, uint32_t value);
92
99
107
115
120
121#ifdef __cplusplus
122}
123#endif
124
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:45
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:33
msg_t msg
message attacher to this LoRaMAC timer
Definition timer.h:37
void(* cb)(void)
callback to call when timer timeout
Definition timer.h:38
uint32_t timeout
Timer timeout in us.
Definition timer.h:34
ztimer_t dev
ztimer instance attached to this LoRaMAC timer
Definition timer.h:36
uint8_t running
Check if timer is running.
Definition timer.h:35
Describes a message object which can be sent between threads.
Definition msg.h:193
ztimer structure
Definition ztimer.h:316
ztimer API