A very easy to understand LoRaWAN-node code.

Dependencies:   LoRaWAN-lib SX1272Lib X_NUCLEO_IKS01A1 mbed

Important parameters:

• In comissioning.h: DevEUI, AppEUI, AppKEY, DevADR, NwksKEY, AppsKEY, OTAA and public network. Frequency and channel block to use, confirmed or unconfirmed messages, app port, app data size and OTAA and Tx duty cycles.

• In LoRaMac.h: Maximum payload and MAC commands length, receive delays, max FCNT, adr ack limit, timeout and delay, max ack retries, rssi threshold and sync words.

• In LoRaMac.cpp: Maximum payload, MAC commands and FRMpayload length.

• In LoRaMac-board.h: Tx power, data rates and band settings.

NOTE: Please refer to LoRaWAN regional parameters (page 12 for US band) to know which parameters you can modify.

Committer:
dgabino
Date:
Tue Apr 03 17:09:34 2018 +0000
Revision:
0:60ff878b27b8
A simpler way to customize your LoRaWAN payload

Who changed what in which revision?

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