A demo application for HXC900 LoRaWAN module using Nucleo-L053R8.

Dependencies:   mbed

Revision:
31:174c745f921c
Parent:
30:c58316bab0fb
Child:
32:2d0678039a09
--- a/LoRa/lora_driver.c	Mon Dec 10 19:38:11 2018 +0000
+++ b/LoRa/lora_driver.c	Mon Dec 10 19:54:23 2018 +0000
@@ -63,7 +63,6 @@
 static sLoraConfig_t *LoraConfigParam;
 static sLoraDriverParam_t *LoraDriverParam;
 static volatile eDeviceState_t DeviceState = CLIENT_INIT;
-static uint8_t FwVersion;
 
 static TimerEvent_t JoinRequestTimer;
 static TimerEvent_t RejoinTimer;
@@ -244,7 +243,7 @@
   * @Param  : None
   * @Retval : Integer firmware version
 ******************************************************************************/
-static uint8_t Lora_getFwVersion(void)
+uint8_t Lora_getFwVersion(void)
 {
 	char fwVersion_str[5];
 	float fwVer_float;
@@ -269,7 +268,7 @@
   * @Param  : None
   * @Retval : Battery level
 ******************************************************************************/
-static uint8_t Lora_getBatteryLevel(void)
+uint8_t Lora_getBatteryLevel(void)
 {
 	char batteryLevel_str[5];
 	uint8_t batteryLevel = 0;
@@ -318,7 +317,7 @@
   * @Param  : Any of eDeviceState_t type
   * @Return : None
 ******************************************************************************/
-void Lora_ChangeDeviceState(eDeviceState_t newDeviceState)
+static void Lora_ChangeDeviceState(eDeviceState_t newDeviceState)
 {
 	//ToDo: Check for valid eDeviceState_t states
 	DeviceState = newDeviceState;
@@ -363,8 +362,6 @@
 				// If users use AUTO as Device EUI, print the DevEUI
 			    // so that they can add that on X-ON
 			    Lora_printDevEui();
-			    // Get the FW Version
-			    FwVersion = Lora_getFwVersion();
 				
 				setJoinRequestTimer();
 				DeviceState = CLIENT_SLEEP;
@@ -461,15 +458,12 @@
         }
 		case CLIENT_SEND:
 		{
-			SendDataBinary.DataSize = 0;
-			// Add Firmware version
-			SendDataBinary.Buffer[SendDataBinary.DataSize++] = FwVersion;
-			SendDataBinary.Buffer[SendDataBinary.DataSize++] = Lora_getBatteryLevel();
 			// Read sensor data and populate payload
-			SendDataBinary.DataSize = SendDataBinary.DataSize + LoraDriverParam->SendDataHandler(\
-			                          &SendDataBinary.Buffer[SendDataBinary.DataSize],\
-			                          (MAX_PAYLOAD_SIZE - SendDataBinary.DataSize),   \
-			                          &SendDataBinary.Ack, &SendDataBinary.Port);
+			SendDataBinary.DataSize = LoraDriverParam->SendDataHandler(\
+			                          SendDataBinary.Buffer           ,\
+			                          MAX_PAYLOAD_SIZE                ,\
+			                          &SendDataBinary.Ack             ,\
+			                          &SendDataBinary.Port            );
 			
 			// Initiate uplink transmission
 			eAtStatus_t status = Lora_SendDataBinary(&SendDataBinary);