Embedded System Design 2 - Project
lpp.h
Go to the documentation of this file.
1 /***************************************************************************//**
2  * @file lpp.h
3  * @brief Basic Low Power Payload (LPP) functionality.
4  * @version 2.3
5  * @author
6  * Geoffrey Ottoy@n
7  * Modified by Brecht Van Eeckhoudt
8  ******************************************************************************/
9 
10 /* ____ ____ _ __ __ ____ ___
11  * | _ \| _ \ / \ | \/ |/ ___/ _ \
12  * | | | | |_) | / _ \ | |\/| | | | | | |
13  * | |_| | _ < / ___ \| | | | |__| |_| |
14  * |____/|_| \_\/_/ \_\_| |_|\____\___/
15  * research group
16  * dramco.be/
17  *
18  * KU Leuven - Technology Campus Gent,
19  * Gebroeders De Smetstraat 1,
20  * B-9000 Gent, Belgium
21  *
22  * File: lpp.h
23  * Created: 2018-03-23
24  * Author: Geoffrey Ottoy
25  *
26  * Description: Header file for lpp.c
27  */
28 
29 
30 #ifndef _LPP_H_
31 #define _LPP_H_
32 
33 #include <stdint.h> /* (u)intXX_t */
34 #include <stdbool.h> /* "bool", "true", "false" */
35 
36 #include "datatypes.h" /* Definitions of the custom data-types */
37 
38 typedef struct lpp_buffer
39 {
40  uint8_t * buffer;
41  uint8_t fill;
42  uint8_t length;
43 } LPP_Buffer_t;
44 
45 bool LPP_InitBuffer(LPP_Buffer_t * b, uint8_t size);
48 
50 bool LPP_AddStormDetected (LPP_Buffer_t *b, uint8_t stormDetected);
51 bool LPP_AddCableBroken (LPP_Buffer_t *b, uint8_t cableBroken);
52 bool LPP_AddStatus (LPP_Buffer_t *b, uint8_t status);
53 
54 bool LPP_deprecated_AddVBAT (LPP_Buffer_t *b, int16_t vbat);
55 bool LPP_deprecated_AddIntTemp (LPP_Buffer_t *b, int16_t intTemp);
56 bool LPP_deprecated_AddExtTemp (LPP_Buffer_t *b, int16_t extTemp);
57 bool LPP_deprecated_AddStormDetected (LPP_Buffer_t *b, uint8_t stormDetected);
58 bool LPP_deprecated_AddCableBroken (LPP_Buffer_t *b, uint8_t cableValue);
59 bool LPP_deprecated_AddStatus (LPP_Buffer_t *b, uint8_t status);
60 
61 bool LPP_AddDigital(LPP_Buffer_t *b, uint8_t data);
62 bool LPP_AddAnalog(LPP_Buffer_t *b, int16_t data);
63 bool LPP_AddTemperature(LPP_Buffer_t *b, int16_t data);
64 bool LPP_AddHumidity(LPP_Buffer_t *b, uint8_t data);
65 bool LPP_AddAccelerometer(LPP_Buffer_t *b, int16_t x, int16_t y, int16_t z);
66 bool LPP_AddPressure(LPP_Buffer_t *b, uint16_t data);
67 
68 #endif /* _LPP_H_ */
struct lpp_buffer LPP_Buffer_t
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...
Definition: lpp.c:466
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...
Definition: lpp.c:317
uint8_t fill
Definition: lpp.h:41
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)...
Definition: lpp.c:400
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...
Definition: lpp.c:360
void LPP_FreeBuffer(LPP_Buffer_t *b)
Definition: lpp.c:129
bool LPP_AddTemperature(LPP_Buffer_t *b, int16_t data)
Definition: lpp.c:601
Definitions of the custom data-types used.
MeasurementData_t data
Definition: main.c:189
bool LPP_AddPressure(LPP_Buffer_t *b, uint16_t data)
Definition: lpp.c:649
bool LPP_AddAccelerometer(LPP_Buffer_t *b, int16_t x, int16_t y, int16_t z)
Definition: lpp.c:630
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...
Definition: lpp.c:274
bool LPP_InitBuffer(LPP_Buffer_t *b, uint8_t size)
Definition: lpp.c:84
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...
Definition: lpp.c:182
void LPP_ClearBuffer(LPP_Buffer_t *b)
Definition: lpp.c:118
Definition: lpp.h:38
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.
Definition: lpp.c:560
bool LPP_AddAnalog(LPP_Buffer_t *b, int16_t data)
Definition: lpp.c:586
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.
Definition: lpp.c:498
uint8_t * buffer
Definition: lpp.h:40
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...
Definition: lpp.c:433
bool LPP_AddHumidity(LPP_Buffer_t *b, uint8_t data)
Definition: lpp.c:616
bool LPP_AddDigital(LPP_Buffer_t *b, uint8_t data)
Definition: lpp.c:572
uint8_t length
Definition: lpp.h:42
bool LPP_deprecated_AddCableBroken(LPP_Buffer_t *b, uint8_t cableValue)
Add a cable break value to the LPP packet, disguised as a Digital Input packet (1 byte)...
Definition: lpp.c:529