1

Dependencies:   X_NUCLEO_IKS01A1 LoRaWAN-lib SX1276Lib mbed

Revision:
3:4bca7f8f731a
Parent:
2:78df92a365c2
--- a/app/LoRaApp.cpp	Sat Aug 27 04:03:02 2016 +0000
+++ b/app/LoRaApp.cpp	Thu Apr 06 16:35:17 2017 +0000
@@ -21,6 +21,16 @@
 int32_t Accl_Value[3] = {0};
 #endif
 
+#ifdef USE_CAYENNE_LPP
+/*
+.... Pressure
+.... Temperature
+.... Humidity
+.... Accelerometer
+*/
+uint8_t maxLPPsize[4] = {4, 4, 3, 8};
+#endif
+
 bool VerticalStatus = false;
 
 
@@ -55,13 +65,18 @@
         {    
 #ifdef USE_IKS01A1_SENSOR 
                         
-            temp_sensor1->GetTemperature(&iks01a1_data);
+            temp_sensor2->GetTemperature(&iks01a1_data);
                                     
             printf("Temp = %f, %d\r\n", iks01a1_data, (int8_t) iks01a1_data);
                                
             if( ( BuffPtr + 1 ) <= LORAWAN_APP_DATA_SIZE )
             {
-                BuffAddr[BuffPtr++] = (int8_t) iks01a1_data;                         
+#ifdef USE_CAYENNE_LPP
+                BuffAddr[BuffPtr++] = 0;
+                BuffAddr[BuffPtr++] = (int8_t) ( iks01a1_data * 10 );
+#else                
+                BuffAddr[BuffPtr++] = (int8_t) iks01a1_data;
+#endif                
             }
             
 #endif            
@@ -79,8 +94,16 @@
                                
             if( ( BuffPtr + 2 ) <= LORAWAN_APP_DATA_SIZE )
             {
+#ifdef USE_CAYENNE_LPP
+                int16_t tmp;
+                
+                tmp =  (int16_t) ( iks01a1_data * 10 );
+                BuffAddr[BuffPtr++] = ( tmp >> 8 ) & 0xFF;
+                BuffAddr[BuffPtr++] = ( tmp ) & 0xFF;
+#else                
                 BuffAddr[BuffPtr++] = ( (int16_t) iks01a1_data >> 8 ) & 0xFF;
-                BuffAddr[BuffPtr++] = ( (int16_t) iks01a1_data ) & 0xFF;                         
+                BuffAddr[BuffPtr++] = ( (int16_t) iks01a1_data ) & 0xFF;
+#endif                
             }
             
 #endif            
@@ -98,7 +121,11 @@
                                
             if( ( BuffPtr + 1 ) <= LORAWAN_APP_DATA_SIZE )
             {
+#ifdef USE_CAYENNE_LPP
+                BuffAddr[BuffPtr++] = (uint8_t) ( iks01a1_data * 2 );
+#else                
                 BuffAddr[BuffPtr++] = (int8_t) iks01a1_data;
+#endif                
             }
             
 #endif