Embedded System Design 2 - Project
|
LoRa wrapper methods. More...
#include <stdlib.h>
#include <stdbool.h>
#include "em_gpio.h"
#include "em_leuart.h"
#include "lora.h"
#include "lpp.h"
#include "pm.h"
#include "lora_settings.h"
#include "lora_wrappers.h"
#include "pin_mapping.h"
#include "debug_dbprint.h"
#include "datatypes.h"
#include "util.h"
Go to the source code of this file.
Functions | |
void | initLoRaWAN (void) |
Initialize LoRaWAN functionality. More... | |
void | disableLoRaWAN (void) |
Disable LoRaWAN functionality. More... | |
void | sleepLoRaWAN (uint32_t sSleep) |
Let the LoRaWAN module sleep for a specified amount of time. More... | |
void | wakeLoRaWAN (void) |
Wake up the LoRaWAN module early after putting it to sleep using sleepLoRaWAN . More... | |
void | sendMeasurements (MeasurementData_t data) |
Send measured battery voltages and internal and external temperatures to the cloud using LoRaWAN. More... | |
void | sendStormDetected (bool stormDetected) |
Send a packet to the cloud using LoRaWAN to indicate that a storm has been detected. More... | |
void | sendCableBroken (bool cableBroken) |
Send a packet to the cloud using LoRaWAN to indicate that the cable is broken. More... | |
void | sendStatus (uint8_t status) |
Send a packet to indicate a status. More... | |
void | sendTest (MeasurementData_t data) |
Send ONE measured battery voltage, internal and external temperature, stormDetected , cableBroken and status value to the cloud using LoRaWAN. This method uses the deprecated methods to test if the data gets send correctly. More... | |
Variables | |
LoRaSettings_t | loraSettings = LORA_INIT_MY_DEVICE |
LoRaStatus_t | loraStatus |
LPP_Buffer_t | appData |
LoRa wrapper methods.
data.index
reset to LoRaWAN sending functionality. data.index
reset back to main.c
because it doesn't affect the correct variable here. error
call and updated version number. static
before the local variables (not necessary).disableLoRaWAN
?saveMAC
?) See reference manual!initLoRaWAN
and other methods are called.sleepLoRaWAN
and wakeLoRaWAN
methods.ULFRCO
definition in delay.c
Copyright (C) 2019 - Brecht Van Eeckhoudt
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A copy of the GNU General Public License can be found in the LICENSE
file along with this source code.
Some methods use code obtained from examples from Silicon Labs' GitHub. These sections are licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.
Definition in file lora_wrappers.c.
void disableLoRaWAN | ( | void | ) |
Disable LoRaWAN functionality.
Definition at line 115 of file lora_wrappers.c.
void initLoRaWAN | ( | void | ) |
Initialize LoRaWAN functionality.
Definition at line 92 of file lora_wrappers.c.
void sendCableBroken | ( | bool | cableBroken | ) |
Send a packet to the cloud using LoRaWAN to indicate that the cable is broken.
The value gets added to the LPP packet following the custom message convention.
[in] | cableBroken |
|
Definition at line 251 of file lora_wrappers.c.
void sendMeasurements | ( | MeasurementData_t | data | ) |
Send measured battery voltages and internal and external temperatures to the cloud using LoRaWAN.
The measurements get added to the LPP packet following the custom message convention to save bytes to send.
[in] | data | The struct which contains the measurements to send using LoRaWAN. |
Definition at line 166 of file lora_wrappers.c.
void sendStatus | ( | uint8_t | status | ) |
Send a packet to indicate a status.
[in] | status | The status value to send. |
Definition at line 286 of file lora_wrappers.c.
void sendStormDetected | ( | bool | stormDetected | ) |
Send a packet to the cloud using LoRaWAN to indicate that a storm has been detected.
The value gets added to the LPP packet following the custom message convention.
[in] | stormDetected |
|
Definition at line 213 of file lora_wrappers.c.
void sendTest | ( | MeasurementData_t | data | ) |
Send ONE measured battery voltage, internal and external temperature, stormDetected
, cableBroken
and status
value to the cloud using LoRaWAN. This method uses the deprecated methods to test if the data gets send correctly.
[in] | data | The struct which contains the measurements to send using LoRaWAN. |
Definition at line 323 of file lora_wrappers.c.
void sleepLoRaWAN | ( | uint32_t | sSleep | ) |
Let the LoRaWAN module sleep for a specified amount of time.
[in] | sSleep | The amount of seconds for the module to go to sleep. |
Definition at line 137 of file lora_wrappers.c.
void wakeLoRaWAN | ( | void | ) |
Wake up the LoRaWAN module early after putting it to sleep using sleepLoRaWAN
.
Definition at line 148 of file lora_wrappers.c.
LPP_Buffer_t appData |
Definition at line 85 of file lora_wrappers.c.
LoRaSettings_t loraSettings = LORA_INIT_MY_DEVICE |
Definition at line 83 of file lora_wrappers.c.
LoRaStatus_t loraStatus |
Definition at line 84 of file lora_wrappers.c.