HAN-IOT-LAB-2324 / CayenneLPP_MemOptimized

Cayenne Low Power Payload (LLP)
https://han-iot-lab-2324.github.io/CayenneLPP_MemOptimized/
GNU General Public License v3.0
0 stars 1 forks source link

-add arduino compatibility #6

Closed Hoog-V closed 3 months ago

Hoog-V commented 4 months ago

This pr adds arduino compatibilty (import as .zip functionality).

Besides this a basic usage example was added.

Code to reproduce:


#include <CayenneLPP.h>

/* The buffer size to initialize the CayenneLPP instance with */
#define BUFFER_SIZE 100

/* The measurement channel from which the measurements were measured
 * Both the data and measurement channel will be bundled and sent over LoraWAN
 * See the README of CayenneLPP
 */
#define GPS_MEASUREMENT_CHANNEL 1

void setup() {
  /* Nothing here :) */
}

void loop() {
  CayenneLPP CayenneEncoder(100);
  CayenneEncoder.addGPS(GPS_MEASUREMENT_CHANNEL, 10.0, 50.0, 20.0);
  CayenneEncoder.addGPS(GPS_MEASUREMENT_CHANNEL, 10.0, 5.0, 20.0);
}
#include <CayenneLPP.hpp>

/* The buffer size to initialize the CayenneLPP instance with */
#define BUFFER_SIZE 100

/* The measurement channel from which the measurements were measured
 * Both the data and measurement channel will be bundled and sent over LoraWAN
 * See the README of CayenneLPP
 */
#define MEASUREMENT_CHANNEL 1

void setup() {
/* Nothing here :) */
}

void loop() {
/* Statically Initialize the CayenneLPP encoder with 100 bytes buffer */
CayenneLPP::CayenneLPP<BUFFER_SIZE> CayenneEncoder;
CayenneLPP::Measurement_t GPSMeasurement = CayenneLPP::SetGPS(10.0, 50.0, 20.0);
CayenneEncoder.setMeasurement(MEASUREMENT_CHANNEL, GPSMeasurement);
GPSMeasurement = CayenneLPP::SetGPS(5.0, 50.0, 20.0);
CayenneEncoder.setMeasurement(MEASUREMENT_CHANNEL, GPSMeasurement);
}

The benefits in flash and ram are:

Type Flash Ram
orig 4914 Bytes 159 Bytes
Our version 3888 Bytes 149 Bytes