Fahad Mirza
/
Nucleo_HXC900
A demo application for HXC900 LoRaWAN module using Nucleo-L053R8.
Diff: lora_conf.h
- Revision:
- 22:5b77cf59d630
- Parent:
- 21:f1d561ed31a1
- Child:
- 24:f3b987589609
--- a/lora_conf.h Tue Oct 09 22:15:01 2018 +0000 +++ b/lora_conf.h Fri Oct 19 04:27:55 2018 +0000 @@ -8,11 +8,11 @@ (C)2017 HaxIoT */ /******************************************************************************* - * File : lora_conf.h - * Author : Fahad Mirza (Haxiot) - * Version : V1.0.0 - * Modified: 18-July-2018 - * Brief : LoRaWAN Configuration + * @File : lora_conf.h + * @Author : Fahad Mirza (Haxiot) + * @Version : V1.0.0 + * @Modified: 18 October, 2018 + * @Brief : LoRaWAN Configuration ****************************************************************************** * @attention * @@ -52,17 +52,33 @@ #include <ctype.h> #include <string.h> +#include "lora_driver.h" /* Macros --------------------------------------------------------------------*/ #define SENSORS_MEASURE_CYCLE (15000U) // Send packet every 15s -// Uplink packet acknowledgment configuration -#define UNCONFIRMED 0 -#define CONFIRMED 1 +/* Private function declaration ----------------------------------------------*/ +static void GetSensorData(uint8_t *buffer, uint8_t *dataSize, uint8_t *ack, uint8_t *port); +static void LedControl(uint8_t *buffer, uint8_t dataSize, uint8_t ack, uint8_t port); +static void tolower_array(char *array, uint8_t arraySize); +/* Private variables ---------------------------------------------------------*/ +static sLoraConfig_t LoraConfigParam = +{ + .joinMode = OTAA, + .adrStatus = ADR_OFF, + .class_ = 'A', + .devEui = "AD25000000000000", + .appEui = "AD10500000000CA7", + .appKey = "AD105CA70000FA00CE00FF123C0FFEE0" +}; -/* Function declarations -----------------------------------------------------*/ -static void tolower_array(char *array, uint8_t arraySize); +static sLoraDriverParam_t LoraDriverParam = +{ + .SensorMeasureTime = SENSORS_MEASURE_CYCLE, + .SendDataHandler = GetSensorData, + .ReceiveDataHandler = LedControl +}; /* Private function definitions ----------------------------------------------*/ /****************************************************************************** @@ -86,10 +102,11 @@ buffer[size++] = slideSwitch; *dataSize = size; - *ack = UNCONFIRMED; + *ack = (uint8_t)UNCONFIRMED; *port = 2; } + /****************************************************************************** * @Brief : Downlink packet handler for lora_driver * Valid downlink messages are: 'red', 'green', 'blue' and 'off'