![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
first draft
Dependencies: mbed LoRaWAN-lib SX1272Liby
Fork of LoRaWAN-demo-72 by
Revision 4:35c4373393c3, committed 2016-03-09
- Comitter:
- tmulrooney
- Date:
- Wed Mar 09 20:31:37 2016 +0000
- Parent:
- 3:b93a0cb03083
- Commit message:
- first draft
Changed in this revision
app/main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b93a0cb03083 -r 35c4373393c3 app/main.cpp --- a/app/main.cpp Wed Mar 09 16:16:05 2016 +0000 +++ b/app/main.cpp Wed Mar 09 20:31:37 2016 +0000 @@ -75,7 +75,8 @@ * User application data buffer size */ #if ( LORAWAN_CONFIRMED_MSG_ON == 1 ) -#define LORAWAN_APP_DATA_SIZE 6 +//#define LORAWAN_APP_DATA_SIZE 6 +#define LORAWAN_APP_DATA_SIZE 12 #else #define LORAWAN_APP_DATA_SIZE 1 @@ -139,6 +140,8 @@ #define LED_YEL PTA2 DigitalOut led1(LED_RED); DigitalOut led2(LED_YEL); +//DigitalIn powerOn(PTC1); /* SW2 */ +//DigitalIn killStatus(PTB17); /* SW3 */ /*! * Specifies the state of the application LED @@ -283,12 +286,33 @@ /*! * \brief Prepares the payload of the frame */ +int randVoltage; static void PrepareTxFrame( uint8_t port ) { + char str[30]; + switch( port ) { case 15: { + switch(randVoltage%3) + { + case 0: + sprintf(str,"Voltage %2.2f",2.30 + (randVoltage%10 * .1)); + break; + + case 1: + sprintf(str,"KillStatus %d",(randVoltage & 0x04)?1:0); + break; + + case 2: + sprintf(str,"PowerOn %d",(randVoltage & 0x08)?1:0); + break; + } + randVoltage++; + memcpy(AppData,str,strlen(str)); + AppDataSize = strlen(str); + #if 0 AppData[0] = AppLedStateOn; if( IsTxConfirmed == true ) { @@ -298,6 +322,7 @@ AppData[4] = LoRaMacDownlinkStatus.Rssi; AppData[5] = LoRaMacDownlinkStatus.Snr; } + #endif } break; case 224: @@ -708,7 +733,7 @@ while( 1 ) { - SerialRxProcess( ); + SerialRxProcess( ); if( IsNetworkJoinedStatusUpdate == true ) { IsNetworkJoinedStatusUpdate = false; @@ -720,7 +745,7 @@ { Led1StateChanged = false; SerialDisplayUpdateLedState( 1, Led1State ); - led1 = !Led1State; + led1 = !Led1State; } if( Led2StateChanged == true ) {