Node code for sx1272 LoRa transciever

Dependencies:   mbed BMP085 BufferedSerial DHT Sds021 Chainable_RGB_LED DigitDisplay LoRaWAN-lib SX1272Lib

Fork of LoRaWAN-demo-72-bootcamp by Semtech

Committer:
abouillot
Date:
Mon Jan 30 21:49:58 2017 +0000
Revision:
9:16106008960b
Parent:
7:ceb4063e6863
Added support for BMP085, DHT22 and SDS021 sensors; Added support of update upon User Button push

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 7:ceb4063e6863 25 uint64_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 7:ceb4063e6863 34 typedef uint64_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 5:fa113b25f612 91 /*!
mluis 5:fa113b25f612 92 * \brief Return the Time elapsed since a fix moment in Time
mluis 5:fa113b25f612 93 *
mluis 5:fa113b25f612 94 * \param [IN] savedTime fix moment in Time
mluis 5:fa113b25f612 95 * \retval time returns elapsed time
mluis 5:fa113b25f612 96 */
mluis 5:fa113b25f612 97 TimerTime_t TimerGetElapsedTime( TimerTime_t savedTime );
mluis 5:fa113b25f612 98
mluis 5:fa113b25f612 99 /*!
mluis 5:fa113b25f612 100 * \brief Return the Time elapsed since a fix moment in Time
mluis 5:fa113b25f612 101 *
mluis 5:fa113b25f612 102 * \param [IN] eventInFuture fix moment in the future
mluis 5:fa113b25f612 103 * \retval time returns difference between now and future event
mluis 5:fa113b25f612 104 */
mluis 5:fa113b25f612 105 TimerTime_t TimerGetFutureTime( TimerTime_t eventInFuture );
mluis 0:45496a70a8a5 106
mluis 0:45496a70a8a5 107 #endif // __TIMER_H__