Analog values current readings
Dependencies: mbed LoRaWAN-lib SX1276Lib
system/timer.h@13:3285ecb328a3, 2020-05-21 (annotated)
- Committer:
- amirchaudhary
- Date:
- Thu May 21 16:36:11 2020 +0000
- Revision:
- 13:3285ecb328a3
- Parent:
- 9:ee9dcbb9708d
Analog values current readings
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mluis | 1:352f608c3337 | 1 | /* |
mluis | 1:352f608c3337 | 2 | / _____) _ | | |
mluis | 1:352f608c3337 | 3 | ( (____ _____ ____ _| |_ _____ ____| |__ |
mluis | 1:352f608c3337 | 4 | \____ \| ___ | (_ _) ___ |/ ___) _ \ |
mluis | 1:352f608c3337 | 5 | _____) ) ____| | | || |_| ____( (___| | | | |
mluis | 1:352f608c3337 | 6 | (______/|_____)_|_|_| \__)_____)\____)_| |_| |
mluis | 1:352f608c3337 | 7 | (C)2013 Semtech |
mluis | 1:352f608c3337 | 8 | |
mluis | 1:352f608c3337 | 9 | Description: Timer objects and scheduling management |
mluis | 1:352f608c3337 | 10 | |
mluis | 1:352f608c3337 | 11 | License: Revised BSD License, see LICENSE.TXT file include in the project |
mluis | 1:352f608c3337 | 12 | |
mluis | 1:352f608c3337 | 13 | Maintainer: Miguel Luis and Gregory Cristian |
mluis | 1:352f608c3337 | 14 | */ |
mluis | 1:352f608c3337 | 15 | #ifndef __TIMER_H__ |
mluis | 1:352f608c3337 | 16 | #define __TIMER_H__ |
mluis | 1:352f608c3337 | 17 | |
mluis | 1:352f608c3337 | 18 | #include "mbed.h" |
mluis | 1:352f608c3337 | 19 | |
mluis | 1:352f608c3337 | 20 | /*! |
mluis | 1:352f608c3337 | 21 | * \brief Timer object description |
mluis | 1:352f608c3337 | 22 | */ |
mluis | 1:352f608c3337 | 23 | typedef struct TimerEvent_s |
mluis | 1:352f608c3337 | 24 | { |
mluis | 9:ee9dcbb9708d | 25 | uint32_t value; |
mluis | 1:352f608c3337 | 26 | void ( *Callback )( void ); |
mluis | 1:352f608c3337 | 27 | Ticker Timer; |
mluis | 1:352f608c3337 | 28 | }TimerEvent_t; |
mluis | 1:352f608c3337 | 29 | |
mluis | 1:352f608c3337 | 30 | /*! |
mluis | 1:352f608c3337 | 31 | * \brief Timer time variable definition |
mluis | 1:352f608c3337 | 32 | */ |
mluis | 1:352f608c3337 | 33 | #ifndef TimerTime_t |
mluis | 9:ee9dcbb9708d | 34 | typedef uint32_t TimerTime_t; |
mluis | 1:352f608c3337 | 35 | #endif |
mluis | 1:352f608c3337 | 36 | |
mluis | 1:352f608c3337 | 37 | /*! |
mluis | 1:352f608c3337 | 38 | * \brief Inializes the timer used to get current time. |
mluis | 1:352f608c3337 | 39 | * |
mluis | 1:352f608c3337 | 40 | * \remark Current time corresponds to the time since system startup |
mluis | 1:352f608c3337 | 41 | */ |
mluis | 1:352f608c3337 | 42 | void TimerTimeCounterInit( void ); |
mluis | 1:352f608c3337 | 43 | |
mluis | 1:352f608c3337 | 44 | /*! |
mluis | 1:352f608c3337 | 45 | * \brief Initializes the timer object |
mluis | 1:352f608c3337 | 46 | * |
mluis | 1:352f608c3337 | 47 | * \remark TimerSetValue function must be called before starting the timer. |
mluis | 1:352f608c3337 | 48 | * this function initializes timestamp and reload value at 0. |
mluis | 1:352f608c3337 | 49 | * |
mluis | 1:352f608c3337 | 50 | * \param [IN] obj Structure containing the timer object parameters |
mluis | 1:352f608c3337 | 51 | * \param [IN] callback Function callback called at the end of the timeout |
mluis | 1:352f608c3337 | 52 | */ |
mluis | 1:352f608c3337 | 53 | void TimerInit( TimerEvent_t *obj, void ( *callback )( void ) ); |
mluis | 1:352f608c3337 | 54 | |
mluis | 1:352f608c3337 | 55 | /*! |
mluis | 1:352f608c3337 | 56 | * \brief Starts and adds the timer object to the list of timer events |
mluis | 1:352f608c3337 | 57 | * |
mluis | 1:352f608c3337 | 58 | * \param [IN] obj Structure containing the timer object parameters |
mluis | 1:352f608c3337 | 59 | */ |
mluis | 1:352f608c3337 | 60 | void TimerStart( TimerEvent_t *obj ); |
mluis | 1:352f608c3337 | 61 | |
mluis | 1:352f608c3337 | 62 | /*! |
mluis | 1:352f608c3337 | 63 | * \brief Stops and removes the timer object from the list of timer events |
mluis | 1:352f608c3337 | 64 | * |
mluis | 1:352f608c3337 | 65 | * \param [IN] obj Structure containing the timer object parameters |
mluis | 1:352f608c3337 | 66 | */ |
mluis | 1:352f608c3337 | 67 | void TimerStop( TimerEvent_t *obj ); |
mluis | 1:352f608c3337 | 68 | |
mluis | 1:352f608c3337 | 69 | /*! |
mluis | 1:352f608c3337 | 70 | * \brief Resets the timer object |
mluis | 1:352f608c3337 | 71 | * |
mluis | 1:352f608c3337 | 72 | * \param [IN] obj Structure containing the timer object parameters |
mluis | 1:352f608c3337 | 73 | */ |
mluis | 1:352f608c3337 | 74 | void TimerReset( TimerEvent_t *obj ); |
mluis | 1:352f608c3337 | 75 | |
mluis | 1:352f608c3337 | 76 | /*! |
mluis | 1:352f608c3337 | 77 | * \brief Set timer new timeout value |
mluis | 1:352f608c3337 | 78 | * |
mluis | 1:352f608c3337 | 79 | * \param [IN] obj Structure containing the timer object parameters |
mluis | 1:352f608c3337 | 80 | * \param [IN] value New timer timeout value |
mluis | 1:352f608c3337 | 81 | */ |
mluis | 1:352f608c3337 | 82 | void TimerSetValue( TimerEvent_t *obj, uint32_t value ); |
mluis | 1:352f608c3337 | 83 | |
mluis | 1:352f608c3337 | 84 | /*! |
mluis | 1:352f608c3337 | 85 | * \brief Read the current time |
mluis | 1:352f608c3337 | 86 | * |
mluis | 1:352f608c3337 | 87 | * \retval time returns current time |
mluis | 1:352f608c3337 | 88 | */ |
mluis | 1:352f608c3337 | 89 | TimerTime_t TimerGetCurrentTime( void ); |
mluis | 1:352f608c3337 | 90 | |
mluis | 5:1e9f6a365854 | 91 | /*! |
mluis | 5:1e9f6a365854 | 92 | * \brief Return the Time elapsed since a fix moment in Time |
mluis | 5:1e9f6a365854 | 93 | * |
mluis | 5:1e9f6a365854 | 94 | * \param [IN] savedTime fix moment in Time |
mluis | 5:1e9f6a365854 | 95 | * \retval time returns elapsed time |
mluis | 5:1e9f6a365854 | 96 | */ |
mluis | 5:1e9f6a365854 | 97 | TimerTime_t TimerGetElapsedTime( TimerTime_t savedTime ); |
mluis | 5:1e9f6a365854 | 98 | |
mluis | 5:1e9f6a365854 | 99 | /*! |
mluis | 5:1e9f6a365854 | 100 | * \brief Return the Time elapsed since a fix moment in Time |
mluis | 5:1e9f6a365854 | 101 | * |
mluis | 5:1e9f6a365854 | 102 | * \param [IN] eventInFuture fix moment in the future |
mluis | 5:1e9f6a365854 | 103 | * \retval time returns difference between now and future event |
mluis | 5:1e9f6a365854 | 104 | */ |
mluis | 5:1e9f6a365854 | 105 | TimerTime_t TimerGetFutureTime( TimerTime_t eventInFuture ); |
mluis | 1:352f608c3337 | 106 | |
mluis | 1:352f608c3337 | 107 | #endif // __TIMER_H__ |