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.
Diff: Code/Common.h
- Revision:
- 0:60ff878b27b8
diff -r 000000000000 -r 60ff878b27b8 Code/Common.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Code/Common.h Tue Apr 03 17:09:34 2018 +0000 @@ -0,0 +1,74 @@ +/* + / _____) _ | | +( (____ _____ ____ _| |_ _____ ____| |__ + \____ \| ___ | (_ _) ___ |/ ___) _ \ + _____) ) ____| | | || |_| ____( (___| | | | +(______/|_____)_|_|_| \__)_____)\____)_| |_| + (C)2015 Semtech + +Description: Extern declaration of parameters defined in main.cpp + +License: Revised BSD License, see LICENSE.TXT file include in the project + +Maintainer: Uttam Bhat +*/ +#ifndef __COMMON_H__ +#define __COMMON_H__ + +#include "Comissioning.h" +#include "board.h" + + +/*! + * User application data buffer size + */ +#define LORAWAN_APP_DATA_MAX_SIZE 64 + +/*! + * Current network ID + */ +#define LORAWAN_NETWORK_ID ( uint32_t )0 + + +#if( OVER_THE_AIR_ACTIVATION != 0 ) +/*! + * Over the Air Activation + */ + +extern uint8_t DevEui[]; +extern uint8_t AppEui[]; +extern uint8_t AppKey[]; + +#else +/*! + * Activation by Personalization + */ + +extern uint8_t NwkSKey[]; +extern uint8_t AppSKey[]; +extern uint32_t DevAddr; + +#endif + + +extern uint8_t AppData[LORAWAN_APP_DATA_MAX_SIZE]; // User application data size + +extern uint8_t AppPort; // Application port + +extern uint8_t AppDataSize; // Application size + +extern uint8_t IsTxConfirmed; // Indicates if the node is sending confirmed or unconfirmed messages + +extern bool IsTxIntUpdate; // Indicates if a new transmit interrupt can be set + +extern bool NextTx; // Indicates if a new packet can be sent + +extern bool IsNetworkJoinedStatusUpdate; // Indicates if the MAC layer network join status has changed. + +extern bool IsTxUpdate; // Indicates if the message sent + +extern bool IsRxUpdate; // Indicates if the message received in the RX window. + +extern TimerEvent_t TxNextPacketTimer; // Timer to handle the application data transmission duty cycle + +#endif // __COMMON_H__ \ No newline at end of file