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