takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Revision:
0:8fdf9a60065b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os/features/lorawan/system/LoRaWANTimer.h	Wed Oct 10 00:33:53 2018 +0000
@@ -0,0 +1,84 @@
+/**
+ / _____)             _              | |
+( (____  _____ ____ _| |_ _____  ____| |__
+ \____ \| ___ |    (_   _) ___ |/ ___)  _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+    (C)2013 Semtech
+
+Description: Timer objects and scheduling management
+
+License: Revised BSD License, see LICENSE.TXT file include in the project
+
+Maintainer: Miguel Luis and Gregory Cristian
+
+
+Copyright (c) 2017, Arm Limited and affiliates.
+
+SPDX-License-Identifier: BSD-3-Clause
+*/
+
+#ifndef MBED_LORAWAN_SYS_TIMER_H__
+#define MBED_LORAWAN_SYS_TIMER_H__
+
+#include <stdint.h>
+#include "events/EventQueue.h"
+
+#include "lorawan_data_structures.h"
+
+class LoRaWANTimeHandler
+{
+public:
+    LoRaWANTimeHandler();
+    ~LoRaWANTimeHandler();
+
+    /** Activates the timer subsystem.
+     *
+     * Embeds EventQueue object to timer subsystem which is subsequently
+     * used to extract timer information.
+     *
+     * @param [in] queue  Handle to EventQueue object
+     */
+    void activate_timer_subsystem(events::EventQueue *queue);
+
+    /** Read the current time.
+     *
+     * @return time The current time.
+     */
+    lorawan_time_t get_current_time(void);
+
+    /** Return the time elapsed since a fixed moment in time.
+     *
+     * @param [in] saved_time    The fixed moment in time.
+     * @return     time          The elapsed time.
+     */
+    lorawan_time_t get_elapsed_time(lorawan_time_t saved_time);
+
+    /** Initializes the timer object.
+     *
+     * @remark The TimerSetValue function must be called before starting the timer.
+     *         This function initializes the time-stamp and reloads the value at 0.
+     *
+     * @param [in] obj          The structure containing the timer object parameters.
+     * @param [in] callback     The function callback called at the end of the timeout.
+     */
+     void init(timer_event_t &obj, mbed::Callback<void()> callback);
+
+    /** Starts and adds the timer object to the list of timer events.
+     *
+     * @param [in] obj     The structure containing the timer object parameters.
+     * @param [in] timeout The new timeout value.
+     */
+    void start(timer_event_t &obj, const uint32_t timeout);
+
+    /** Stops and removes the timer object from the list of timer events.
+     *
+     * @param [in] obj The structure containing the timer object parameters.
+     */
+    void stop(timer_event_t &obj);
+
+private:
+    events::EventQueue *_queue;
+};
+
+#endif // MBED_LORAWAN_SYS_TIMER_H__