68 #include "em_leuart.h" 104 #if DEBUG_DBPRINT == 1 105 else dbinfo(
"LoRaWAN initialized.");
123 #if DEBUG_DBPRINT == 1 124 dbinfo(
"LoRaWAN disabled.");
183 #if DEBUG_DBPRINT == 1 184 dbinfo(
"Started sending LPP buffer...");
194 #if DEBUG_DBPRINT == 1 195 dbinfo(
"LPP buffer send.");
333 int16_t batteryLPP = (int16_t)(round((
float)data.
voltage[0]/10));
340 int16_t intTempLPP = (int16_t)(round((
float)data.
intTemp[0]/100));
347 int16_t extTempLPP = (int16_t)(round((
float)data.
extTemp[0]/100));
void disableLoRaWAN(void)
Disable LoRaWAN functionality.
void sendStormDetected(bool stormDetected)
Send a packet to the cloud using LoRaWAN to indicate that a storm has been detected.
void sendCableBroken(bool cableBroken)
Send a packet to the cloud using LoRaWAN to indicate that the cable is broken.
#define RN2483_RESET_PORT
LoRaSettings_t loraSettings
bool LPP_InitBuffer(LPP_Buffer_t *b, uint8_t size)
bool LPP_AddStormDetected(LPP_Buffer_t *b, uint8_t stormDetected)
Add a value to indicate that a storm has been detected to the LPP packet following the custom message...
enum lora_statuses LoRaStatus_t
Basic Low Power Payload (LPP) functionality.
Definitions of the custom data-types used.
void sendStatus(uint8_t status)
Send a packet to indicate a status.
void dbinfo(char *message)
Print an info string (char array) to USARTx and go to the next line.
void LoRa_Sleep(uint32_t durationMs, volatile bool *wakeUp)
bool LPP_deprecated_AddCableBroken(LPP_Buffer_t *b, uint8_t cableBroken)
Add a cable break value to the LPP packet, disguised as a Digital Input packet (1 byte)...
bool LPP_deprecated_AddStatus(LPP_Buffer_t *b, uint8_t status)
Add a status value to the LPP packet, disguised as a Digital Input packet (1 byte). The channel is defined by LPP_STATUS_CHANNEL and is 0x15.
void initLoRaWAN(void)
Initialize LoRaWAN functionality.
void sleepLoRaWAN(uint32_t sSleep)
Let the LoRaWAN module sleep for a specified amount of time.
void error(uint8_t number)
Error method.
void PM_Disable(PM_SubSystem_t pmss)
The pin definitions for the regular and custom Happy Gecko board.
void wakeLoRaWAN(void)
Wake up the LoRaWAN module early after putting it to sleep using sleepLoRaWAN.
LoRaStatus_t LoRa_Init(LoRaSettings_t init)
bool LPP_AddCableBroken(LPP_Buffer_t *b, uint8_t cableBroken)
Add a value to indicate that the cable has been broken to the LPP packet following the custom message...
void LPP_FreeBuffer(LPP_Buffer_t *b)
Enable or disable printing to UART with dbprint.
void sendMeasurements(MeasurementData_t data)
Send measured battery voltages and internal and external temperatures to the cloud using LoRaWAN...
bool LPP_deprecated_AddVBAT(LPP_Buffer_t *b, int16_t vbat)
Add a battery voltage measurement to the LPP packet, disguised as an Analog Input packet (2 bytes)...
LoRaStatus_t LoRa_WakeUp(void)
bool LPP_AddMeasurements(LPP_Buffer_t *b, MeasurementData_t data)
Add measurement data to the LPP packet following the custom message convention to save bytes to send...
bool LPP_deprecated_AddIntTemp(LPP_Buffer_t *b, int16_t intTemp)
Add an internal temperature measurement (2 bytes) to the LPP packet. The channel is defined by LPP_TE...
LoRaStatus_t LoRa_SendLppBuffer(LPP_Buffer_t b, bool ackNoAck)
bool LPP_AddStatus(LPP_Buffer_t *b, uint8_t status)
Add a value to indicate a program status to the LPP packet following the custom message convention...
#define LORA_INIT_MY_DEVICE
bool LPP_deprecated_AddStormDetected(LPP_Buffer_t *b, uint8_t stormDetected)
Add a storm value to the LPP packet, disguised as a Digital Input packet (1 byte). The channel is defined by LPP_STORM_CHANNEL and is 0x13.
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.
bool LPP_deprecated_AddExtTemp(LPP_Buffer_t *b, int16_t extTemp)
Add an external temperature measurement (2 bytes) to the LPP packet. The channel is defined by LPP_TE...