LoRa on Multitech with Semtech mote
Dependencies: LoRaWAN-lib SX1272Lib lib_gps lib_mma8451q lib_mpl3115a2 mbed
Fork of LoRaWAN-NAMote72-Application-Demo_Multitech by
Diff: app/LoRaApp.cpp
- Revision:
- 7:92f4f419f91f
- Parent:
- 6:f8194e691dd4
- Child:
- 13:6b6f4be13633
diff -r f8194e691dd4 -r 92f4f419f91f app/LoRaApp.cpp --- a/app/LoRaApp.cpp Wed Jun 08 22:06:26 2016 +0000 +++ b/app/LoRaApp.cpp Wed Jun 08 22:39:27 2016 +0000 @@ -16,6 +16,8 @@ #include "LoRaApp.h" +bool VerticalStatus = false; + /*! * Red LED timer event */ @@ -84,7 +86,7 @@ Mpl3115a2.ReadTemperature( ); if( ( BuffPtr + 1 ) <= LORAWAN_APP_DATA_SIZE ) { - BuffAddr[BuffPtr++] = ( int32_t )Mpl3115a2.Temperature; // Signed degrees Celcius in half degree units. So, +/-63 °C + BuffAddr[BuffPtr++] = ( int32_t )Mpl3115a2.Temperature; // Signed degrees Celcius in half degree units. So, +/-63 °C } break; } @@ -385,3 +387,23 @@ } } } + +void CheckOrientation( void ) +{ + uint8_t statusReg; + + // Read the PS_STATUS register + statusReg = Mma8451q.read_single( MMA8451_PL_STATUS ); + + // If Orientation of the Mote changed then populate Upper Nibble of 0th Byte of Tx Buffer + if( ( statusReg & 0x40 ) != 0 ) + { + CtrlLED( Green, LED_OFF ); + VerticalStatus = false; // horizontal + } + else + { + CtrlLED( Green, LED_ON ); + VerticalStatus = true; // vertical + } +} \ No newline at end of file