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