versionepudee2018

Dependencies:   mbed LoRaWAN-lib SX1272Lib

Fork of LoRaWAN-demo-72 by Semtech

Committer:
mluis
Date:
Thu Jan 07 15:11:08 2016 +0000
Revision:
0:45496a70a8a5
Child:
3:3152aa75c58d
Initial commit

Who changed what in which revision?

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