for India band 30dBm LoRa Module, DSPLoRa based on code from Semtech and as modified by Sachin Pukale/ TCL/
Dependencies: mbed Chainable_RGB_LED DigitDisplay LoRaWAN-lib SX1276Lib
Fork of DSP_LoRaWAN by
Revision 1:c365eaf833bb, committed 2016-04-12
- Comitter:
- spcores
- Date:
- Tue Apr 12 05:21:37 2016 +0000
- Parent:
- 0:cb80564f40e1
- Child:
- 2:66f94cef0765
- Commit message:
- Version 1.0
Changed in this revision
--- a/app/Comissioning.h Thu Mar 17 09:32:46 2016 +0000 +++ b/app/Comissioning.h Tue Apr 12 05:21:37 2016 +0000 @@ -31,17 +31,17 @@ /*! * Mote device IEEE EUI (big endian) */ -#define LORAWAN_DEVICE_EUI { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 } +#define LORAWAN_DEVICE_EUI { 0x82, 0x89, 0x9D, 0x68, 0xC9, 0xF4, 0xEC, 0xA6 } //{ 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 } /*! * Application IEEE EUI (big endian) */ -#define LORAWAN_APPLICATION_EUI { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } +#define LORAWAN_APPLICATION_EUI { 0xAC, 0x55, 0xC3, 0x96, 0xEB, 0x4A, 0x9A, 0x65 } //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } /*! * AES encryption/decryption cipher application key */ -#define LORAWAN_APPLICATION_KEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C } +#define LORAWAN_APPLICATION_KEY { 0xFF, 0x64, 0xE3, 0xBC, 0x6A, 0x50, 0x11, 0x69, 0x4F, 0x84, 0x41, 0x5D, 0x11, 0x45, 0x4E, 0x60 } //{ 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C } #else
--- a/app/main.cpp Thu Mar 17 09:32:46 2016 +0000 +++ b/app/main.cpp Tue Apr 12 05:21:37 2016 +0000 @@ -52,9 +52,9 @@ * * \remark Please note that when ADR is enabled the end-device should be static */ -#define LORAWAN_ADR_ON 1 +#define LORAWAN_ADR_ON 0 -#if defined( USE_BAND_868 ) +#if defined( USE_BAND_868 ) || defined( USE_BAND_865 ) #include "LoRaMacTest.h" @@ -70,16 +70,16 @@ /*! * LoRaWAN application port */ -#define LORAWAN_APP_PORT 10 +#define LORAWAN_APP_PORT 5 /*! * User application data buffer size */ #if ( LORAWAN_CONFIRMED_MSG_ON == 1 ) -#define LORAWAN_APP_DATA_SIZE 6 +#define LORAWAN_APP_DATA_SIZE 7 //6 #else -#define LORAWAN_APP_DATA_SIZE 5 +#define LORAWAN_APP_DATA_SIZE 6 //5 #endif @@ -162,7 +162,7 @@ /*! * Hold the value returned from the Light Sensor */ -static float LightValue = 0.0; +//static float LightValue = 0.0; /*! * Control the 3-color LED @@ -191,13 +191,42 @@ /*! * Constructor for Light Sensor */ -AnalogIn LightSens( A1 ); +AnalogIn LightSensor( A1 ); /*! * Constructor for 4 Digit 7 semgent display */ DigitDisplay display(D8, D9); +/* LED For Customer */ +DigitalOut myLed ( D8 ); + +/** +Interrupt Event by SP +**/ +InterruptIn buttonPressed(D7); +uint8_t buttonCount = 0; +bool buttonStatus = false; //OFF = false & ON = true +bool ledStatus = false; //OFF = false & ON = true + +// Interrupt Handler for User Button +void incButtonCount() +{ + buttonCount++; + buttonStatus=!buttonStatus; + if (buttonStatus == 1) + { + ledStatus=1; + myLed=1; + } + else + { + ledStatus = 0; + myLed = 0; + } + +} + /*! * Device states */ @@ -288,7 +317,7 @@ SerialDisplayUpdateNetworkIsJoined( mibReq.Param.IsNetworkJoined ); SerialDisplayUpdateAdr( LORAWAN_ADR_ON ); -#if defined( USE_BAND_868 ) +#if defined( USE_BAND_868 ) || defined ( USE_BAND_865 ) SerialDisplayUpdateDutyCycle( LORAWAN_DUTYCYCLE_ON ); #else SerialDisplayUpdateDutyCycle( false ); @@ -324,14 +353,36 @@ switch( port ) { + case 5: + tempValue = LightSensor.read_u16(); + AppData[0] = (( tempValue & 0xFF00 ) >> 8 ) & 0xFF; + AppData[1] = ( tempValue & 0x00FF ); + AppData[2] = 44; // Sending ',' + AppData[3] = ledStatus + 48; //Send LED status ON/OFF + + //printf("Light Sensor = %d , %x", tempValue, tempValue); + break; + case 10: { + AppData[0] = 72; + AppData[1] = 69; + AppData[2] = 76; + AppData[3] = 76; + AppData[4] = 79; + + tempValue = buttonStatus + 48; + AppData[5] = tempValue; + + buttonCount = 0; + /* tempValue = ( uint32_t )( LightValue * 1000000.0 ); AppData[0] = LightMode; AppData[1] = ( ( tempValue & 0xFF000000 ) >> 24 ) & 0xFF; AppData[2] = ( ( tempValue & 0x00FF0000 ) >> 16 ) & 0xFF; AppData[3] = ( ( tempValue & 0x0000FF00 ) >> 8 ) & 0xFF; AppData[4] = ( tempValue & 0x000000FF ); + */ } break; case 15: @@ -660,7 +711,7 @@ mibReq.Param.AdrEnable = true; LoRaMacMibSetRequestConfirm( &mibReq ); -#if defined( USE_BAND_868 ) +#if defined( USE_BAND_868 ) || defined( USE_BAND_865 ) LoRaMacTestSetDutyCycleOn( false ); #endif } @@ -681,7 +732,7 @@ mibReq.Type = MIB_ADR; mibReq.Param.AdrEnable = LORAWAN_ADR_ON; LoRaMacMibSetRequestConfirm( &mibReq ); -#if defined( USE_BAND_868 ) +#if defined( USE_BAND_868 ) || defined( USE_BAND_865 ) LoRaMacTestSetDutyCycleOn( LORAWAN_DUTYCYCLE_ON ); #endif break; @@ -772,10 +823,11 @@ */ int main( void ) { - float tempLightValue = 0.0; + //float tempLightValue = 0.0; LightMode = 0; // 0: manual, 1: automatic buzzer = 0; // 0: OFF, 1: ON + myLed = 0; LoRaMacPrimitives_t LoRaMacPrimitives; LoRaMacCallback_t LoRaMacCallbacks; @@ -783,7 +835,8 @@ BoardInit( ); SerialDisplayInit( ); - + buttonPressed.rise(&incButtonCount); + DeviceState = DEVICE_STATE_INIT; while( 1 ) @@ -849,7 +902,7 @@ mibReq.Param.EnablePublicNetwork = LORAWAN_PUBLIC_NETWORK; LoRaMacMibSetRequestConfirm( &mibReq ); -#if defined( USE_BAND_868 ) +#if defined( USE_BAND_868 ) || defined( USE_BAND_865 ) LoRaMacTestSetDutyCycleOn( LORAWAN_DUTYCYCLE_ON ); SerialDisplayUpdateDutyCycle( LORAWAN_DUTYCYCLE_ON ); #endif @@ -967,6 +1020,7 @@ } + /* // Read light sensor tempLightValue = LightSens.read( ) * 1.65; @@ -977,5 +1031,6 @@ { color_led.setColorRGB( 0, ( uint8_t )( 255 * LightValue ), ( uint8_t )( 255 * LightValue ), ( uint8_t )( 255 * LightValue ) ); } + */ } }
--- a/board/board.h Thu Mar 17 09:32:46 2016 +0000 +++ b/board/board.h Tue Apr 12 05:21:37 2016 +0000 @@ -21,7 +21,7 @@ #include "system/utilities.h" #include "sx1276-hal.h" -#define USE_BAND_868 +#define USE_BAND_865 //USE_BAND_868 extern SX1276MB1xAS Radio;
--- a/mac/LoRaWAN-lib.lib Thu Mar 17 09:32:46 2016 +0000 +++ b/mac/LoRaWAN-lib.lib Tue Apr 12 05:21:37 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/Semtech/code/LoRaWAN-lib/#b9d87593a8ae +https://developer.mbed.org/users/spcores/code/LoRaWAN-lib/#8d84e1ef9e34