LoRaWAN MAC layer implementation

Dependents:   LoRaWAN-demo-72_tjm LoRaWAN-demo-72_jlc LoRaWAN-demo-elmo frdm_LoRa_Connect_Woodstream_Demo_tjm ... more

LoRAWAN-lib is a port of the GitHub LoRaMac-node LoRaWAN MAC layer implementation.

This library depends on the SX1276Lib or SX1272Lib radio drivers depending on the used mbed component shield.

This library depends also on some cryptographic helper functions as well as helper functions for the timers management. These can be found on the example projects under the system directory.

The example projects are:

  1. LoRaWAN-demo-72
  2. LoRaWAN-demo-76
  3. LoRaWAN-demo-NAMote72

The LoRaWAN specification specifies different ISM bands operating parameters. These are all implemented under the LoRaMac-board.h file.

In order to select which band to use, please change line 24 of board.h file provided on the examples projects as follows:


EU868

board.h

#define USE_BAND_868


US915

board.h

#define USE_BAND_915


US915 - Hybrid

board.h

#define USE_BAND_915_HYBRID


CN780

board.h

#define USE_BAND_780


EU433

board.h

#define USE_BAND_433
Revision:
1:91e4e6c60d1e
Parent:
0:91d1a7783bb9
Child:
2:14a5d6ad92d5
--- a/LoRaMac.h	Tue Oct 20 13:21:26 2015 +0000
+++ b/LoRaMac.h	Mon Nov 23 10:09:43 2015 +0000
@@ -298,7 +298,7 @@
  * LoRaMAC events structure
  * Used to notify upper layers of MAC events
  */
-typedef struct sLoRaMacEvent
+typedef struct sLoRaMacCallbacks
 {
     /*!
      * MAC layer event callback prototype.
@@ -307,17 +307,21 @@
      * \param [IN] info  Details about MAC events occurred
      */
     void ( *MacEvent )( LoRaMacEventFlags_t *flags, LoRaMacEventInfo_t *info );
-}LoRaMacEvent_t;
+    /*!
+     * Function callback to get the current battery level
+     *
+     * \retval batteryLevel Current battery level
+     */
+    uint8_t ( *GetBatteryLevel )( void );
+}LoRaMacCallbacks_t;
 
 /*!
  * LoRaMAC layer initialization
  *
- * \param [IN] events          Pointer to a structure defining the LoRaMAC
+ * \param [IN] callabcks       Pointer to a structure defining the LoRaMAC
  *                             callback functions.
- * \param [IN] getBatteryLevel Function callback to get the current
- *                             battery level
  */
-void LoRaMacInit( LoRaMacEvent_t *events, uint8_t ( *getBatteryLevel )( ) );
+void LoRaMacInit( LoRaMacCallbacks_t *callabcks );
 
 /*!
  * Enables/Disables the ADR (Adaptive Data Rate)