Mbed OS Reference
Loading...
Searching...
No Matches
LoRaWANTimer.h
1/**
2 / _____) _ | |
3( (____ _____ ____ _| |_ _____ ____| |__
4 \____ \| ___ | (_ _) ___ |/ ___) _ \
5 _____) ) ____| | | || |_| ____( (___| | | |
6(______/|_____)_|_|_| \__)_____)\____)_| |_|
7 (C)2013 Semtech
8
9Description: Timer objects and scheduling management
10
11License: Revised BSD License, see LICENSE.TXT file include in the project
12
13Maintainer: Miguel Luis and Gregory Cristian
14
15
16Copyright (c) 2017, Arm Limited and affiliates.
17
18SPDX-License-Identifier: BSD-3-Clause
19*/
20
21#ifndef MBED_LORAWAN_SYS_TIMER_H__
22#define MBED_LORAWAN_SYS_TIMER_H__
23
24#include <stdint.h>
25#include "events/EventQueue.h"
26
28
30public:
33
34 /** Activates the timer subsystem.
35 *
36 * Embeds EventQueue object to timer subsystem which is subsequently
37 * used to extract timer information.
38 *
39 * @param [in] queue Handle to EventQueue object
40 */
42
43 /** Read the current time.
44 *
45 * @return time The current time.
46 */
48
49 /** Return the time elapsed since a fixed moment in time.
50 *
51 * @param [in] saved_time The fixed moment in time.
52 * @return time The elapsed time.
53 */
55
56 /** Initializes the timer object.
57 *
58 * @remark The TimerSetValue function must be called before starting the timer.
59 * This function initializes the time-stamp and reloads the value at 0.
60 *
61 * @param [in] obj The structure containing the timer object parameters.
62 * @param [in] callback The function callback called at the end of the timeout.
63 */
64 void init(timer_event_t &obj, mbed::Callback<void()> callback);
65
66 /** Starts and adds the timer object to the list of timer events.
67 *
68 * @param [in] obj The structure containing the timer object parameters.
69 * @param [in] timeout The new timeout value.
70 */
71 void start(timer_event_t &obj, const uint32_t timeout);
72
73 /** Stops and removes the timer object from the list of timer events.
74 *
75 * @param [in] obj The structure containing the timer object parameters.
76 */
77 void stop(timer_event_t &obj);
78
79 /** Clear timer state so it is not inadvertently canceled. This function
80 * must be called by the callback registered in init.
81 *
82 * @param [in] obj The structure containing the timer object parameters.
83 */
84 void clear(timer_event_t &obj);
85
86private:
87 events::EventQueue *_queue;
88};
89
90#endif // MBED_LORAWAN_SYS_TIMER_H__
/ _____) _ | | ( (____ _____ ____ _| |_ _____ ____| |__ ____ | ___ | (_ _) ___ |/ ___) _ \ _____) ) _...
Definition: LoRaWANTimer.h:29
lorawan_time_t get_elapsed_time(lorawan_time_t saved_time)
Return the time elapsed since a fixed moment in time.
void activate_timer_subsystem(events::EventQueue *queue)
Activates the timer subsystem.
void clear(timer_event_t &obj)
Clear timer state so it is not inadvertently canceled.
void stop(timer_event_t &obj)
Stops and removes the timer object from the list of timer events.
void start(timer_event_t &obj, const uint32_t timeout)
Starts and adds the timer object to the list of timer events.
void init(timer_event_t &obj, mbed::Callback< void()> callback)
Initializes the timer object.
lorawan_time_t get_current_time(void)
Read the current time.
EventQueue.
Definition: EventQueue.h:62
Callback class based on template specialization.
Definition: Callback.h:53
Contains common data structures used by Mbed-OS LoRaWAN mplementation.
uint32_t lorawan_time_t
Timer time variable definition.
Timer object description.