SX1276 Shield based Applications

Dependencies:   X_NUCLEO_IKS01A1 LoRaWAN-lib SX1276Lib mbed

LoRaWAN-SX1276-Application Demo uses SX1276MB1LAS mbed component shield on a nucleo board platform to demonstrate a Class-A LoRaWAN device in the 915MHz ISM band for North American region. It uses the LoRaWAN-lib and SX1276Lib libraries.

Comissioning.h (LoRaWAN Network Configuration)

The end-device can be activated in one of the two ways:

Over the Air (OTA) activation can be enabled as shown in the figure below. /media/uploads/ubhat/ota_enable.png

The end-device must be configured with the following parameters:

  • LORAWAN_DEVICE_EUI (8 Bytes) : Fist 3 Bytes is the Organizationally Unique Identifier (OUI) followed by 5 bytes of unique ID. If not defined by user, then the firmware automatically assigns one to the end-device
  • LORAWAN_APPLICATION_EUI (8 Bytes)
  • LORAWAN_APPLICATION_KEY (or DEVKEY) (16 Bytes)

/media/uploads/ubhat/ota_eui.png

Activation by Personalization (ABP) can be enabled as shown in the figure below. /media/uploads/ubhat/abp_enable.png

The end-device must be configured with the following parameters:

  • LORAWAN_DEVICE_ADDRESS (4 Bytes) : If not defined by user, then the firmware automatically assigns one to the end-device
  • LORAWAN_NWKSKEY (16 Bytes)
  • LORAWAN_APPSKEY (16 Bytes)

/media/uploads/ubhat/abp_key.png

Config.h (LoRaWAN Communication Parameters)

  • Mode of Operation : Hybrid If the end-device needs to be configured to operate over 8-channels, then Hybrid Mode needs to be enabled /media/uploads/ubhat/hybridenable.png
  • Mode of Operation : Frequency Hop If the end-device needs to be configured to operate over 64-channels, then Hybrid Mode needs to be disabled
  • Delay between successive JOIN REQUESTs : The delay between successive Join Requests (until the end-device joins the network) can be configured using the parameter OVER_THE_AIR_ACTIVATION_DUTYCYCLE
  • Inter-Frame Delay : One can change the delay between each frame transmission using APP_TX_DUTYCYCLE It is advisable that APP_TX_DUTYCYCLE is greater than or equal to 3sec.
  • Data Rate : The data rate can be configured as per LoRaWAN specification using the paramter LORAWAN_DEFAULT_DATARATE. The range of values are DR_0, DR_1, DR_2, DR_3 and DR_4
  • Confirmed/Unconfirmed Messages : The uplink message or payload can be chosen to be confirmed or unconfirmed using the parameter LORAWAN_CONFIRMED_MSG_ON. When set to 1, the transmitted messages need to be confirmed with an ACK by the network server in the subsequent RX window. When set to 0, no ACK is requested.
  • ADR ON/OFF : The ADR can be enabled or disabled using the parameter LORAWAN_ADR_ON. When set to 1, ADR is enabled and disabled when set to 0.
  • Application Port : The application port can be set using parameter LORAWAN_APP_PORT. A few examples are associated to specific Application Port, and are defined in Config.h
  • Payload Length : The lenght of the payload (in bytes) to be transmitted can be configured using LORAWAN_APP_DATA_SIZE
  • Transmit Power : The transmit power can be configured using LORAWAN_TX_POWER (LoRaMAC verifies if the set power is compliant with the LoRaWAN spec and FCC guidelines)

/media/uploads/ubhat/loraconfig.png

The baud-rate for serial terminal display is 115200

Committer:
ubhat
Date:
Thu Sep 28 04:53:55 2017 +0000
Revision:
4:aad57e03bf82
Parent:
3:4bca7f8f731a
Minor edits

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ubhat 0:42863a11464a 1 /*
ubhat 0:42863a11464a 2 / _____) _ | |
ubhat 0:42863a11464a 3 ( (____ _____ ____ _| |_ _____ ____| |__
ubhat 0:42863a11464a 4 \____ \| ___ | (_ _) ___ |/ ___) _ \
ubhat 0:42863a11464a 5 _____) ) ____| | | || |_| ____( (___| | | |
ubhat 0:42863a11464a 6 (______/|_____)_|_|_| \__)_____)\____)_| |_|
ubhat 0:42863a11464a 7 (C)2015 Semtech
ubhat 0:42863a11464a 8
ubhat 0:42863a11464a 9 Description: Define events during Join, Tx & Rx
ubhat 0:42863a11464a 10 Prepare TX packet by appending with appropriate application data
ubhat 0:42863a11464a 11
ubhat 0:42863a11464a 12 License: Revised BSD License, see LICENSE.TXT file include in the project
ubhat 0:42863a11464a 13
ubhat 0:42863a11464a 14 Maintainer: Uttam Bhat
ubhat 0:42863a11464a 15 */
ubhat 0:42863a11464a 16
ubhat 0:42863a11464a 17 #include "LoRaEventProc.h"
ubhat 0:42863a11464a 18
ubhat 0:42863a11464a 19 /*!
ubhat 0:42863a11464a 20 * Defines the application data transmission duty cycle
ubhat 0:42863a11464a 21 */
ubhat 0:42863a11464a 22 uint32_t TxDutyCycleTime = APP_TX_DUTYCYCLE;
ubhat 0:42863a11464a 23
ubhat 0:42863a11464a 24 bool AppLed = 0;
ubhat 0:42863a11464a 25
ubhat 3:4bca7f8f731a 26 uint8_t AppCase = 0;
ubhat 3:4bca7f8f731a 27
ubhat 0:42863a11464a 28 /*!
ubhat 0:42863a11464a 29 * \brief Prepares the payload of the frame based on application port
ubhat 0:42863a11464a 30 */
ubhat 0:42863a11464a 31 void PrepareLoRaFrame( uint8_t port )
ubhat 0:42863a11464a 32 {
ubhat 0:42863a11464a 33
ubhat 0:42863a11464a 34 switch( port )
ubhat 0:42863a11464a 35 {
ubhat 0:42863a11464a 36 case 5:
ubhat 0:42863a11464a 37 {
ubhat 0:42863a11464a 38 uint8_t ptrIndex = 0;
ubhat 0:42863a11464a 39
ubhat 0:42863a11464a 40 // Point the pointer to position index of Tx Buffer
ubhat 0:42863a11464a 41 LoRaApp.ApplicationPtrPos( ptrIndex );
ubhat 0:42863a11464a 42
ubhat 0:42863a11464a 43 /*!
ubhat 2:78df92a365c2 44 * Generate Ramp data bytes
ubhat 2:78df92a365c2 45 * Appends incremental values of 1 Byte each to TX buffer until Full
ubhat 2:78df92a365c2 46 */
ubhat 2:78df92a365c2 47 LoRaApp.ApplicationCall( AppRamp );
ubhat 2:78df92a365c2 48
ubhat 2:78df92a365c2 49 break;
ubhat 2:78df92a365c2 50 }
ubhat 2:78df92a365c2 51
ubhat 2:78df92a365c2 52 case 8:
ubhat 2:78df92a365c2 53 {
ubhat 2:78df92a365c2 54 uint8_t ptrIndex = 0;
ubhat 2:78df92a365c2 55
ubhat 2:78df92a365c2 56 //Point the pointer to position index of Tx Buffer
ubhat 2:78df92a365c2 57 LoRaApp.ApplicationPtrPos( ptrIndex );
ubhat 2:78df92a365c2 58
ubhat 2:78df92a365c2 59 /*!
ubhat 2:78df92a365c2 60 * Read Pressure
ubhat 2:78df92a365c2 61 * Appends 2 Bytes to TX buffer
ubhat 2:78df92a365c2 62 */
ubhat 2:78df92a365c2 63 LoRaApp.ApplicationCall( AppPressr );
ubhat 2:78df92a365c2 64
ubhat 2:78df92a365c2 65 /*!
ubhat 0:42863a11464a 66 * Read Temperature
ubhat 0:42863a11464a 67 * Appends 1 Byte to TX buffer
ubhat 0:42863a11464a 68 */
ubhat 0:42863a11464a 69 LoRaApp.ApplicationCall( AppTemp );
ubhat 2:78df92a365c2 70
ubhat 0:42863a11464a 71 /*!
ubhat 2:78df92a365c2 72 * Read Humidity
ubhat 0:42863a11464a 73 * Appends 1 Byte to TX buffer
ubhat 0:42863a11464a 74 */
ubhat 2:78df92a365c2 75 LoRaApp.ApplicationCall( AppHumid );
ubhat 0:42863a11464a 76
ubhat 0:42863a11464a 77 /*!
ubhat 0:42863a11464a 78 * Read Accelerometer
ubhat 0:42863a11464a 79 * Appends 2 Bytes to TX buffer
ubhat 0:42863a11464a 80 * Value Orientation
ubhat 0:42863a11464a 81 * 0x99 0x00 horizontal + faceup
ubhat 0:42863a11464a 82 * 0x66 0x00 horizontal + facedown
ubhat 0:42863a11464a 83 * 0x00 0x11 vertical
ubhat 0:42863a11464a 84 */
ubhat 0:42863a11464a 85 LoRaApp.ApplicationCall( AppAccl ); // Generate Accelerometer data bytes
ubhat 0:42863a11464a 86
ubhat 0:42863a11464a 87
ubhat 0:42863a11464a 88 break;
ubhat 0:42863a11464a 89 }
ubhat 3:4bca7f8f731a 90
ubhat 3:4bca7f8f731a 91 // IKAS sensor using Cayenne Payload Format
ubhat 3:4bca7f8f731a 92 case 9:
ubhat 3:4bca7f8f731a 93 {
ubhat 3:4bca7f8f731a 94 #ifdef USE_CAYENNE_LPP
ubhat 3:4bca7f8f731a 95 uint8_t ptrIndex = 0;
ubhat 3:4bca7f8f731a 96
ubhat 3:4bca7f8f731a 97 uint16_t AppSize = 0;
ubhat 3:4bca7f8f731a 98
ubhat 3:4bca7f8f731a 99 uint8_t tmp[2] = {0};
ubhat 3:4bca7f8f731a 100
ubhat 3:4bca7f8f731a 101 //Point the pointer to position index of Tx Buffer
ubhat 3:4bca7f8f731a 102 LoRaApp.ApplicationPtrPos( ptrIndex );
ubhat 3:4bca7f8f731a 103
ubhat 3:4bca7f8f731a 104 AppCase = AppCase > 3 ? 0 : AppCase;
ubhat 3:4bca7f8f731a 105
ubhat 3:4bca7f8f731a 106 while( 1 )
ubhat 3:4bca7f8f731a 107 {
ubhat 3:4bca7f8f731a 108 switch( AppCase )
ubhat 3:4bca7f8f731a 109 {
ubhat 3:4bca7f8f731a 110 case 0:
ubhat 3:4bca7f8f731a 111 {
ubhat 3:4bca7f8f731a 112 tmp[0] = 0;
ubhat 3:4bca7f8f731a 113 tmp[1] = 115; // Data Type PRESSURE: 115
ubhat 3:4bca7f8f731a 114 LoRaApp.ApplicationAppendData( tmp, 2 );
ubhat 3:4bca7f8f731a 115
ubhat 3:4bca7f8f731a 116 /*!
ubhat 3:4bca7f8f731a 117 * Read Pressure
ubhat 3:4bca7f8f731a 118 * Appends 2 Bytes to TX buffer
ubhat 3:4bca7f8f731a 119 */
ubhat 3:4bca7f8f731a 120 LoRaApp.ApplicationCall( AppPressr );
ubhat 3:4bca7f8f731a 121
ubhat 3:4bca7f8f731a 122 AppSize += maxLPPsize[AppCase];
ubhat 3:4bca7f8f731a 123
ubhat 3:4bca7f8f731a 124 break;
ubhat 3:4bca7f8f731a 125 }
ubhat 3:4bca7f8f731a 126
ubhat 3:4bca7f8f731a 127 case 1:
ubhat 3:4bca7f8f731a 128 {
ubhat 3:4bca7f8f731a 129 tmp[0] = 1;
ubhat 3:4bca7f8f731a 130 tmp[1] = 103; // Data Type TEMP: 103
ubhat 3:4bca7f8f731a 131 LoRaApp.ApplicationAppendData( tmp, 2 );
ubhat 3:4bca7f8f731a 132
ubhat 3:4bca7f8f731a 133 /*!
ubhat 3:4bca7f8f731a 134 * Read Temperature
ubhat 3:4bca7f8f731a 135 * Appends 1 Byte to TX buffer
ubhat 3:4bca7f8f731a 136 */
ubhat 3:4bca7f8f731a 137 LoRaApp.ApplicationCall( AppTemp );
ubhat 3:4bca7f8f731a 138
ubhat 3:4bca7f8f731a 139 AppSize += maxLPPsize[AppCase];
ubhat 3:4bca7f8f731a 140
ubhat 3:4bca7f8f731a 141 break;
ubhat 3:4bca7f8f731a 142 }
ubhat 3:4bca7f8f731a 143
ubhat 3:4bca7f8f731a 144 case 2:
ubhat 3:4bca7f8f731a 145 {
ubhat 3:4bca7f8f731a 146 tmp[0] = 2;
ubhat 3:4bca7f8f731a 147 tmp[1] = 104; // Data Type HUMIDITY: 103
ubhat 3:4bca7f8f731a 148 LoRaApp.ApplicationAppendData( tmp, 2 );
ubhat 3:4bca7f8f731a 149
ubhat 3:4bca7f8f731a 150 /*!
ubhat 3:4bca7f8f731a 151 * Read Humidity
ubhat 3:4bca7f8f731a 152 * Appends 1 Byte to TX buffer
ubhat 3:4bca7f8f731a 153 */
ubhat 3:4bca7f8f731a 154 LoRaApp.ApplicationCall( AppHumid );
ubhat 3:4bca7f8f731a 155
ubhat 3:4bca7f8f731a 156 AppSize += maxLPPsize[AppCase];
ubhat 3:4bca7f8f731a 157
ubhat 3:4bca7f8f731a 158 break;
ubhat 3:4bca7f8f731a 159 }
ubhat 3:4bca7f8f731a 160
ubhat 3:4bca7f8f731a 161 case 3:
ubhat 3:4bca7f8f731a 162 {
ubhat 3:4bca7f8f731a 163 tmp[0] = 3;
ubhat 3:4bca7f8f731a 164 tmp[1] = 113; // Data Type Accl: 113
ubhat 3:4bca7f8f731a 165 LoRaApp.ApplicationAppendData( tmp, 2 );
ubhat 3:4bca7f8f731a 166 /*!
ubhat 3:4bca7f8f731a 167 * Read Accelerometer
ubhat 3:4bca7f8f731a 168 */
ubhat 3:4bca7f8f731a 169 LoRaApp.ApplicationCall( AppAccl ); // Generate Accelerometer data bytes
ubhat 3:4bca7f8f731a 170
ubhat 3:4bca7f8f731a 171 AppSize += maxLPPsize[AppCase];
ubhat 3:4bca7f8f731a 172
ubhat 3:4bca7f8f731a 173 break;
ubhat 3:4bca7f8f731a 174 }
ubhat 3:4bca7f8f731a 175 }
ubhat 3:4bca7f8f731a 176
ubhat 3:4bca7f8f731a 177 AppCase++;
ubhat 3:4bca7f8f731a 178
ubhat 3:4bca7f8f731a 179 if( AppSize + maxLPPsize[AppCase] > LORAWAN_APP_DATA_SIZE )
ubhat 3:4bca7f8f731a 180 {
ubhat 3:4bca7f8f731a 181 break;
ubhat 3:4bca7f8f731a 182 }
ubhat 3:4bca7f8f731a 183 }
ubhat 3:4bca7f8f731a 184
ubhat 3:4bca7f8f731a 185 AppDataSize = AppSize;
ubhat 3:4bca7f8f731a 186 #endif
ubhat 3:4bca7f8f731a 187 break;
ubhat 3:4bca7f8f731a 188 }
ubhat 0:42863a11464a 189
ubhat 0:42863a11464a 190 // Push-Button Demo
ubhat 0:42863a11464a 191 case 11:
ubhat 0:42863a11464a 192 {
ubhat 0:42863a11464a 193 uint8_t ptrIndex = 0;
ubhat 0:42863a11464a 194
ubhat 0:42863a11464a 195 //Point the pointer to position index of Tx Buffer
ubhat 0:42863a11464a 196 LoRaApp.ApplicationPtrPos( ptrIndex );
ubhat 0:42863a11464a 197
ubhat 0:42863a11464a 198 LoRaApp.ApplicationCall( AppPushButton ); // Transmit uplink counter
ubhat 0:42863a11464a 199
ubhat 0:42863a11464a 200 break;
ubhat 0:42863a11464a 201 }
ubhat 2:78df92a365c2 202
ubhat 0:42863a11464a 203 default:
ubhat 0:42863a11464a 204 break;
ubhat 0:42863a11464a 205 }
ubhat 0:42863a11464a 206 }
ubhat 0:42863a11464a 207
ubhat 0:42863a11464a 208
ubhat 0:42863a11464a 209 /*!
ubhat 0:42863a11464a 210 * \brief Sets Interrupt for next payload transmission
ubhat 0:42863a11464a 211 */
ubhat 0:42863a11464a 212 void InitNextTxInterrupt( uint8_t port )
ubhat 0:42863a11464a 213 {
ubhat 0:42863a11464a 214 switch( port )
ubhat 0:42863a11464a 215 {
ubhat 0:42863a11464a 216 /* GPS Application Demo
ubhat 0:42863a11464a 217 Set Timer interrupt for next uplink
ubhat 0:42863a11464a 218 */
ubhat 0:42863a11464a 219 case 5:
ubhat 0:42863a11464a 220 {
ubhat 0:42863a11464a 221 }
ubhat 0:42863a11464a 222
ubhat 0:42863a11464a 223 /* Senet + M2X demo
ubhat 0:42863a11464a 224 Set Timer interrupt for next uplink
ubhat 0:42863a11464a 225 */
ubhat 0:42863a11464a 226 case 6:
ubhat 0:42863a11464a 227 {
ubhat 0:42863a11464a 228
ubhat 0:42863a11464a 229 }
ubhat 0:42863a11464a 230
ubhat 0:42863a11464a 231 /* Senet GPS Demo
ubhat 0:42863a11464a 232 Set Timer interrupt for next uplink
ubhat 0:42863a11464a 233 */
ubhat 0:42863a11464a 234 case 7:
ubhat 0:42863a11464a 235 {
ubhat 0:42863a11464a 236 // Schedule next packet transmission
ubhat 0:42863a11464a 237 TxDutyCycleTime = APP_TX_DUTYCYCLE + randr( -APP_TX_DUTYCYCLE_RND, APP_TX_DUTYCYCLE_RND );
ubhat 0:42863a11464a 238 TimerSetValue( &TxNextPacketTimer, TxDutyCycleTime );
ubhat 0:42863a11464a 239 TimerStart( &TxNextPacketTimer );
ubhat 0:42863a11464a 240 break;
ubhat 0:42863a11464a 241 }
ubhat 0:42863a11464a 242
ubhat 0:42863a11464a 243 /* Push Button Demo
ubhat 0:42863a11464a 244 Send Packet Immedietly if PC0 = GND
ubhat 0:42863a11464a 245 */
ubhat 0:42863a11464a 246 case 11:
ubhat 1:80c1daf19aa4 247 {
ubhat 0:42863a11464a 248 volatile bool PushButtonStatus;
ubhat 0:42863a11464a 249
ubhat 1:80c1daf19aa4 250 PushButtonStatus = UsrButton;
ubhat 0:42863a11464a 251
ubhat 0:42863a11464a 252 if(PushButtonStatus == 0)
ubhat 0:42863a11464a 253 {
ubhat 0:42863a11464a 254 // Send Pkt immedietly if PC = GND
ubhat 0:42863a11464a 255 DeviceState = DEVICE_STATE_SEND;
ubhat 0:42863a11464a 256 NextTx = true;
ubhat 0:42863a11464a 257 }
ubhat 0:42863a11464a 258 else
ubhat 0:42863a11464a 259 {
ubhat 0:42863a11464a 260 // Keep polling
ubhat 0:42863a11464a 261 IsTxIntUpdate = true;
ubhat 0:42863a11464a 262 }
ubhat 1:80c1daf19aa4 263
ubhat 0:42863a11464a 264 break;
ubhat 0:42863a11464a 265 }
ubhat 0:42863a11464a 266
ubhat 0:42863a11464a 267 /* Orientation Demo
ubhat 0:42863a11464a 268 Send Packet Immedietly if Mote is Vertical
ubhat 0:42863a11464a 269 */
ubhat 0:42863a11464a 270 case 12:
ubhat 0:42863a11464a 271 {
ubhat 0:42863a11464a 272 CheckOrientation( );
ubhat 0:42863a11464a 273
ubhat 0:42863a11464a 274 if(VerticalStatus == true)
ubhat 0:42863a11464a 275 {
ubhat 0:42863a11464a 276 // Send Pkt immedietly if PC = GND
ubhat 0:42863a11464a 277 DeviceState = DEVICE_STATE_SEND;
ubhat 0:42863a11464a 278 NextTx = true;
ubhat 0:42863a11464a 279 }
ubhat 0:42863a11464a 280 else
ubhat 0:42863a11464a 281 {
ubhat 0:42863a11464a 282 // Keep polling
ubhat 0:42863a11464a 283 IsTxIntUpdate = true;
ubhat 0:42863a11464a 284 }
ubhat 0:42863a11464a 285 break;
ubhat 0:42863a11464a 286 }
ubhat 0:42863a11464a 287
ubhat 0:42863a11464a 288 /* Compliance Test
ubhat 0:42863a11464a 289 Set Timer interrupt for next uplink
ubhat 0:42863a11464a 290 */
ubhat 0:42863a11464a 291 case 224:
ubhat 0:42863a11464a 292 {
ubhat 0:42863a11464a 293 // Schedule next packet transmission
ubhat 0:42863a11464a 294 TimerSetValue( &TxNextPacketTimer, COMPLIANCE_TX_DUTYCYCLE );
ubhat 0:42863a11464a 295 TimerStart( &TxNextPacketTimer );
ubhat 0:42863a11464a 296 break;
ubhat 0:42863a11464a 297 }
ubhat 0:42863a11464a 298
ubhat 0:42863a11464a 299 default:
ubhat 0:42863a11464a 300 {
ubhat 0:42863a11464a 301 // Schedule next packet transmission
ubhat 0:42863a11464a 302 TimerSetValue( &TxNextPacketTimer, TxDutyCycleTime );
ubhat 0:42863a11464a 303 TimerStart( &TxNextPacketTimer );
ubhat 0:42863a11464a 304 break;
ubhat 0:42863a11464a 305 }
ubhat 0:42863a11464a 306 }
ubhat 0:42863a11464a 307
ubhat 0:42863a11464a 308 }
ubhat 0:42863a11464a 309
ubhat 0:42863a11464a 310 /*!
ubhat 0:42863a11464a 311 * \brief What to do during JOIN process ? blink/toggle LED etc.
ubhat 0:42863a11464a 312 */
ubhat 0:42863a11464a 313 void JoinEvent( void )
ubhat 0:42863a11464a 314 {
ubhat 0:42863a11464a 315 // CtrlLED is defined in LoRaBoardAppIf.h
ubhat 0:42863a11464a 316 // param 1: LED color (Red, Yellow or Green)
ubhat 0:42863a11464a 317 // param 2: LED_ON or LED_OFF
ubhat 0:42863a11464a 318 //CtrlLED( Red, LED_ON );
ubhat 0:42863a11464a 319 }
ubhat 0:42863a11464a 320
ubhat 0:42863a11464a 321
ubhat 0:42863a11464a 322 /*!
ubhat 0:42863a11464a 323 * \brief What to do during TX ? blink/toggle LED etc.
ubhat 0:42863a11464a 324 */
ubhat 0:42863a11464a 325 void TxEvent( void )
ubhat 0:42863a11464a 326 {
ubhat 4:aad57e03bf82 327 /*
ubhat 0:42863a11464a 328 int blinkTime = 25000;
ubhat 0:42863a11464a 329
ubhat 4:aad57e03bf82 330 Blink Red LED for 25msec
ubhat 4:aad57e03bf82 331 BlinkLED( Red, blinkTime );
ubhat 4:aad57e03bf82 332 */
ubhat 0:42863a11464a 333 }
ubhat 0:42863a11464a 334
ubhat 0:42863a11464a 335 void RxEvent()
ubhat 0:42863a11464a 336 {
ubhat 4:aad57e03bf82 337 /*
ubhat 0:42863a11464a 338 // Toggle yellow LED
ubhat 0:42863a11464a 339 //ToggleLED( Yellow );
ubhat 0:42863a11464a 340
ubhat 0:42863a11464a 341 // If Rx Data is 0x01 turn on Green LED else if 0x0 Turn Green LED off
ubhat 0:42863a11464a 342 if( LoRaMacDownlinkStatus.BufferSize == 1 )
ubhat 0:42863a11464a 343 {
ubhat 0:42863a11464a 344 if( LoRaMacDownlinkStatus.Buffer[0] == 0x01 )
ubhat 0:42863a11464a 345 {
ubhat 0:42863a11464a 346 AppLed = 1;
ubhat 0:42863a11464a 347 }
ubhat 0:42863a11464a 348 else
ubhat 0:42863a11464a 349 {
ubhat 0:42863a11464a 350 if( LoRaMacDownlinkStatus.Buffer[0] == 0x00 )
ubhat 0:42863a11464a 351 {
ubhat 0:42863a11464a 352 AppLed = 0;
ubhat 0:42863a11464a 353 }
ubhat 0:42863a11464a 354 }
ubhat 0:42863a11464a 355 }
ubhat 0:42863a11464a 356
ubhat 0:42863a11464a 357 if( AppLed != 0 )
ubhat 0:42863a11464a 358 {
ubhat 0:42863a11464a 359 // Turn USR_LED ON
ubhat 2:78df92a365c2 360 //UsrLED = 3.3;
ubhat 0:42863a11464a 361 }
ubhat 0:42863a11464a 362 else
ubhat 0:42863a11464a 363 {
ubhat 0:42863a11464a 364 // Turn USR_LED OFF
ubhat 2:78df92a365c2 365 //UsrLED = 0;
ubhat 0:42863a11464a 366 }
ubhat 4:aad57e03bf82 367 */
ubhat 0:42863a11464a 368 }
ubhat 0:42863a11464a 369