Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed LoRaWAN-lib
Revision 10:4e528716aa7a, committed 2018-12-27
- Comitter:
- uss1994
- Date:
- Thu Dec 27 18:37:04 2018 +0000
- Parent:
- 9:ee9dcbb9708d
- Child:
- 11:876331d64e0e
- Commit message:
- latest changes;
Changed in this revision
--- a/app/Commissioning.h Mon Apr 24 13:38:31 2017 +0000
+++ b/app/Commissioning.h Thu Dec 27 18:37:04 2018 +0000
@@ -30,22 +30,22 @@
* IEEE Organizationally Unique Identifier ( OUI ) (big endian)
* \remark This is unique to a company or organization
*/
-#define IEEE_OUI 0x11, 0x22, 0x33
+#define IEEE_OUI 0x00, 0x52, 0xF7
/*!
* Mote device IEEE EUI (big endian)
*/
-#define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x44, 0x55, 0x66, 0x77, 0x88 }
+#define LORAWAN_DEVICE_EUI { 0x00, 0x52, 0xF7, 0x41, 0x06, 0x67, 0xB2, 0xEE }
/*!
* Application IEEE EUI (big endian)
*/
-#define LORAWAN_APPLICATION_EUI { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
+#define LORAWAN_APPLICATION_EUI { 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x01, 0x4D, 0xD1 }
/*!
* 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 { 0xC3, 0x65, 0xF6, 0xEF, 0xA0, 0x90, 0x71, 0x16, 0x83, 0x9A, 0x16, 0xC4, 0xF5, 0xF3, 0x20, 0xC7 }
/*!
* Current network ID
--- a/app/main.cpp Mon Apr 24 13:38:31 2017 +0000
+++ b/app/main.cpp Thu Dec 27 18:37:04 2018 +0000
@@ -143,24 +143,6 @@
static TimerEvent_t TxNextPacketTimer;
/*!
- * Specifies the state of the application LED
- */
-static bool AppLedStateOn = false;
-volatile bool Led3StateChanged = false;
-/*!
- * Timer to handle the state of LED1
- */
-static TimerEvent_t Led1Timer;
-volatile bool Led1State = false;
-volatile bool Led1StateChanged = false;
-/*!
- * Timer to handle the state of LED2
- */
-static TimerEvent_t Led2Timer;
-volatile bool Led2State = false;
-volatile bool Led2StateChanged = false;
-
-/*!
* Indicates if a new packet can be sent
*/
static bool NextTx = true;
@@ -232,6 +214,12 @@
}LoRaMacDownlinkStatus;
volatile bool DownlinkStatusUpdated = false;
+
+// Application Globals
+DigitalOut myled(D6);
+
+
+
void SerialDisplayRefresh( void )
{
MibRequestConfirm_t mibReq;
@@ -260,8 +248,6 @@
SerialDisplayUpdateDutyCycle( false );
#endif
SerialDisplayUpdatePublicNetwork( LORAWAN_PUBLIC_NETWORK );
-
- SerialDisplayUpdateLedState( 3, AppLedStateOn );
}
void SerialRxProcess( void )
@@ -290,7 +276,7 @@
{
case 15:
{
- AppData[0] = AppLedStateOn;
+ AppData[0] = 0;
if( IsTxConfirmed == true )
{
AppData[1] = LoRaMacDownlinkStatus.DownlinkCounter >> 8;
@@ -416,27 +402,6 @@
}
}
-/*!
- * \brief Function executed on Led 1 Timeout event
- */
-static void OnLed1TimerEvent( void )
-{
- TimerStop( &Led1Timer );
- // Switch LED 1 OFF
- Led1State = false;
- Led1StateChanged = true;
-}
-
-/*!
- * \brief Function executed on Led 2 Timeout event
- */
-static void OnLed2TimerEvent( void )
-{
- TimerStop( &Led2Timer );
- // Switch LED 2 OFF
- Led2State = false;
- Led2StateChanged = true;
-}
/*!
* \brief MCPS-Confirm event function
@@ -475,11 +440,6 @@
LoRaMacUplinkStatus.Datarate = mcpsConfirm->Datarate;
LoRaMacUplinkStatus.UplinkCounter = mcpsConfirm->UpLinkCounter;
- // Switch LED 1 ON
- Led1State = true;
- Led1StateChanged = true;
- TimerStart( &Led1Timer );
-
UplinkStatusUpdated = true;
}
NextTx = true;
@@ -558,11 +518,6 @@
{
case 1: // The application LED can be controlled on port 1 or 2
case 2:
- if( mcpsIndication->BufferSize == 1 )
- {
- AppLedStateOn = mcpsIndication->Buffer[0] & 0x01;
- Led3StateChanged = true;
- }
break;
case 224:
if( ComplianceTest.Running == false )
@@ -702,10 +657,6 @@
}
}
- // Switch LED 2 ON for each received downlink
- Led2State = true;
- Led2StateChanged = true;
- TimerStart( &Led2Timer );
DownlinkStatusUpdated = true;
}
@@ -756,11 +707,23 @@
UplinkStatusUpdated = true;
}
+void flash_builtin() {
+ myled = 1; // turn the LED on (HIGH is the voltage level)
+ wait(2); // wait for a second
+ myled = 0; // turn the LED off by making the voltage LOW
+ wait(1);
+}
+
/**
* Main application entry point.
*/
int main( void )
{
+ flash_builtin();
+ flash_builtin();
+ flash_builtin();
+ flash_builtin();
+
LoRaMacPrimitives_t LoRaMacPrimitives;
LoRaMacCallback_t LoRaMacCallbacks;
MibRequestConfirm_t mibReq;
@@ -784,6 +747,7 @@
while( 1 )
{
SerialRxProcess( );
+ flash_builtin();
if( IsNetworkJoinedStatusUpdate == true )
{
IsNetworkJoinedStatusUpdate = false;
@@ -791,21 +755,6 @@
LoRaMacMibGetRequestConfirm( &mibReq );
SerialDisplayUpdateNetworkIsJoined( mibReq.Param.IsNetworkJoined );
}
- if( Led1StateChanged == true )
- {
- Led1StateChanged = false;
- SerialDisplayUpdateLedState( 1, Led1State );
- }
- if( Led2StateChanged == true )
- {
- Led2StateChanged = false;
- SerialDisplayUpdateLedState( 2, Led2State );
- }
- if( Led3StateChanged == true )
- {
- Led3StateChanged = false;
- SerialDisplayUpdateLedState( 3, AppLedStateOn );
- }
if( UplinkStatusUpdated == true )
{
UplinkStatusUpdated = false;
@@ -814,7 +763,6 @@
if( DownlinkStatusUpdated == true )
{
DownlinkStatusUpdated = false;
- SerialDisplayUpdateLedState( 2, Led2State );
SerialDisplayUpdateDownlink( LoRaMacDownlinkStatus.RxData, LoRaMacDownlinkStatus.Rssi, LoRaMacDownlinkStatus.Snr, LoRaMacDownlinkStatus.DownlinkCounter, LoRaMacDownlinkStatus.Port, LoRaMacDownlinkStatus.Buffer, LoRaMacDownlinkStatus.BufferSize );
}
@@ -830,12 +778,6 @@
TimerInit( &TxNextPacketTimer, OnTxNextPacketTimerEvent );
- TimerInit( &Led1Timer, OnLed1TimerEvent );
- TimerSetValue( &Led1Timer, 25 );
-
- TimerInit( &Led2Timer, OnLed2TimerEvent );
- TimerSetValue( &Led2Timer, 25 );
-
mibReq.Type = MIB_ADR;
mibReq.Param.AdrEnable = LORAWAN_ADR_ON;
LoRaMacMibSetRequestConfirm( &mibReq );
--- a/board/board.h Mon Apr 24 13:38:31 2017 +0000 +++ b/board/board.h Thu Dec 27 18:37:04 2018 +0000 @@ -21,7 +21,7 @@ #include "system/utilities.h" #include "sx1276-hal.h" -#define USE_BAND_868 +#define USE_BAND_915 extern SX1276MB1xAS Radio;