Christopher De Bank / LoRaWAN-lib

Fork of LoRaWAN-lib by Semtech

Committer:
mluis
Date:
Tue Oct 20 13:21:26 2015 +0000
Revision:
0:91d1a7783bb9
Library creation synchronized with GitHub LoRaMac-node v3.4 (https://github.com/Lora-net/LoRaMac-node)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mluis 0:91d1a7783bb9 1 /*
mluis 0:91d1a7783bb9 2 / _____) _ | |
mluis 0:91d1a7783bb9 3 ( (____ _____ ____ _| |_ _____ ____| |__
mluis 0:91d1a7783bb9 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
mluis 0:91d1a7783bb9 5 _____) ) ____| | | || |_| ____( (___| | | |
mluis 0:91d1a7783bb9 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
mluis 0:91d1a7783bb9 7 (C)2013 Semtech
mluis 0:91d1a7783bb9 8
mluis 0:91d1a7783bb9 9 Description: Timer objects and scheduling management
mluis 0:91d1a7783bb9 10
mluis 0:91d1a7783bb9 11 License: Revised BSD License, see LICENSE.TXT file include in the project
mluis 0:91d1a7783bb9 12
mluis 0:91d1a7783bb9 13 Maintainer: Miguel Luis and Gregory Cristian
mluis 0:91d1a7783bb9 14 */
mluis 0:91d1a7783bb9 15 #ifndef __TIMER_H__
mluis 0:91d1a7783bb9 16 #define __TIMER_H__
mluis 0:91d1a7783bb9 17
mluis 0:91d1a7783bb9 18 #include "mbed.h"
mluis 0:91d1a7783bb9 19
mluis 0:91d1a7783bb9 20 /*!
mluis 0:91d1a7783bb9 21 * \brief Timer object description
mluis 0:91d1a7783bb9 22 */
mluis 0:91d1a7783bb9 23 typedef struct TimerEvent_s
mluis 0:91d1a7783bb9 24 {
mluis 0:91d1a7783bb9 25 uint32_t value;
mluis 0:91d1a7783bb9 26 void ( *Callback )( void );
mluis 0:91d1a7783bb9 27 Ticker Timer;
mluis 0:91d1a7783bb9 28 }TimerEvent_t;
mluis 0:91d1a7783bb9 29
mluis 0:91d1a7783bb9 30 /*!
mluis 0:91d1a7783bb9 31 * \brief Timer time variable definition
mluis 0:91d1a7783bb9 32 */
mluis 0:91d1a7783bb9 33 #ifndef TimerTime_t
mluis 0:91d1a7783bb9 34 typedef uint32_t TimerTime_t;
mluis 0:91d1a7783bb9 35 #endif
mluis 0:91d1a7783bb9 36
mluis 0:91d1a7783bb9 37 /*!
mluis 0:91d1a7783bb9 38 * \brief Inializes the timer used to get current time.
mluis 0:91d1a7783bb9 39 *
mluis 0:91d1a7783bb9 40 * \remark Current time corresponds to the time since system startup
mluis 0:91d1a7783bb9 41 */
mluis 0:91d1a7783bb9 42 void TimerTimeCounterInit( void );
mluis 0:91d1a7783bb9 43
mluis 0:91d1a7783bb9 44 /*!
mluis 0:91d1a7783bb9 45 * \brief Initializes the timer object
mluis 0:91d1a7783bb9 46 *
mluis 0:91d1a7783bb9 47 * \remark TimerSetValue function must be called before starting the timer.
mluis 0:91d1a7783bb9 48 * this function initializes timestamp and reload value at 0.
mluis 0:91d1a7783bb9 49 *
mluis 0:91d1a7783bb9 50 * \param [IN] obj Structure containing the timer object parameters
mluis 0:91d1a7783bb9 51 * \param [IN] callback Function callback called at the end of the timeout
mluis 0:91d1a7783bb9 52 */
mluis 0:91d1a7783bb9 53 void TimerInit( TimerEvent_t *obj, void ( *callback )( void ) );
mluis 0:91d1a7783bb9 54
mluis 0:91d1a7783bb9 55 /*!
mluis 0:91d1a7783bb9 56 * \brief Starts and adds the timer object to the list of timer events
mluis 0:91d1a7783bb9 57 *
mluis 0:91d1a7783bb9 58 * \param [IN] obj Structure containing the timer object parameters
mluis 0:91d1a7783bb9 59 */
mluis 0:91d1a7783bb9 60 void TimerStart( TimerEvent_t *obj );
mluis 0:91d1a7783bb9 61
mluis 0:91d1a7783bb9 62 /*!
mluis 0:91d1a7783bb9 63 * \brief Stops and removes the timer object from the list of timer events
mluis 0:91d1a7783bb9 64 *
mluis 0:91d1a7783bb9 65 * \param [IN] obj Structure containing the timer object parameters
mluis 0:91d1a7783bb9 66 */
mluis 0:91d1a7783bb9 67 void TimerStop( TimerEvent_t *obj );
mluis 0:91d1a7783bb9 68
mluis 0:91d1a7783bb9 69 /*!
mluis 0:91d1a7783bb9 70 * \brief Resets the timer object
mluis 0:91d1a7783bb9 71 *
mluis 0:91d1a7783bb9 72 * \param [IN] obj Structure containing the timer object parameters
mluis 0:91d1a7783bb9 73 */
mluis 0:91d1a7783bb9 74 void TimerReset( TimerEvent_t *obj );
mluis 0:91d1a7783bb9 75
mluis 0:91d1a7783bb9 76 /*!
mluis 0:91d1a7783bb9 77 * \brief Set timer new timeout value
mluis 0:91d1a7783bb9 78 *
mluis 0:91d1a7783bb9 79 * \param [IN] obj Structure containing the timer object parameters
mluis 0:91d1a7783bb9 80 * \param [IN] value New timer timeout value
mluis 0:91d1a7783bb9 81 */
mluis 0:91d1a7783bb9 82 void TimerSetValue( TimerEvent_t *obj, uint32_t value );
mluis 0:91d1a7783bb9 83
mluis 0:91d1a7783bb9 84 /*!
mluis 0:91d1a7783bb9 85 * \brief Read the current time
mluis 0:91d1a7783bb9 86 *
mluis 0:91d1a7783bb9 87 * \retval time returns current time
mluis 0:91d1a7783bb9 88 */
mluis 0:91d1a7783bb9 89 TimerTime_t TimerGetCurrentTime( void );
mluis 0:91d1a7783bb9 90
mluis 0:91d1a7783bb9 91
mluis 0:91d1a7783bb9 92 #endif // __TIMER_H__