Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LoRaWANTimer.cpp
00001 /** 00002 / _____) _ | | 00003 ( (____ _____ ____ _| |_ _____ ____| |__ 00004 \____ \| ___ | (_ _) ___ |/ ___) _ \ 00005 _____) ) ____| | | || |_| ____( (___| | | | 00006 (______/|_____)_|_|_| \__)_____)\____)_| |_| 00007 (C)2013 Semtech 00008 00009 Description: Timer objects and scheduling management 00010 00011 License: Revised BSD License, see LICENSE.TXT file include in the project 00012 00013 Maintainer: Miguel Luis and Gregory Cristian 00014 00015 00016 Copyright (c) 2017, Arm Limited and affiliates. 00017 00018 SPDX-License-Identifier: BSD-3-Clause 00019 */ 00020 00021 #include "lorawan/system/LoRaWANTimer.h" 00022 00023 LoRaWANTimeHandler::LoRaWANTimeHandler() 00024 : _queue(NULL) 00025 { 00026 } 00027 00028 LoRaWANTimeHandler::~LoRaWANTimeHandler() 00029 { 00030 } 00031 00032 void LoRaWANTimeHandler::activate_timer_subsystem(events::EventQueue *queue) 00033 { 00034 _queue = queue; 00035 } 00036 00037 lorawan_time_t LoRaWANTimeHandler::get_current_time( void ) 00038 { 00039 const uint32_t current_time = _queue->tick(); 00040 return (lorawan_time_t)current_time; 00041 } 00042 00043 lorawan_time_t LoRaWANTimeHandler::get_elapsed_time(lorawan_time_t saved_time) 00044 { 00045 return get_current_time() - saved_time; 00046 } 00047 00048 void LoRaWANTimeHandler::init(timer_event_t &obj, mbed::Callback<void()> callback) 00049 { 00050 obj.callback = callback; 00051 obj.timer_id = 0; 00052 } 00053 00054 void LoRaWANTimeHandler::start(timer_event_t &obj, const uint32_t timeout) 00055 { 00056 obj.timer_id = _queue->call_in(timeout, obj.callback); 00057 MBED_ASSERT(obj.timer_id != 0); 00058 } 00059 00060 void LoRaWANTimeHandler::stop(timer_event_t &obj) 00061 { 00062 _queue->cancel(obj.timer_id); 00063 obj.timer_id = 0; 00064 }
Generated on Tue Jul 12 2022 12:21:59 by
