1 /*! 2 * \file CayenneLpp.h 3 * 4 * \brief Implements the Cayenne Low Power Protocol 5 * 6 * \copyright Revised BSD License, see section \ref LICENSE. 7 * 8 * \code 9 * ______ _ 10 * / _____) _ | | 11 * ( (____ _____ ____ _| |_ _____ ____| |__ 12 * \____ \| ___ | (_ _) ___ |/ ___) _ \ 13 * _____) ) ____| | | || |_| ____( (___| | | | 14 * (______/|_____)_|_|_| \__)_____)\____)_| |_| 15 * (C)2013-2018 Semtech 16 * 17 * \endcode 18 * 19 * \author Miguel Luis ( Semtech ) 20 */ 21 #ifndef __CAYENNE_LPP_H__ 22 #define __CAYENNE_LPP_H__ 23 24 #include <stdint.h> 25 26 #define LPP_DIGITAL_INPUT 0 // 1 byte 27 #define LPP_DIGITAL_OUTPUT 1 // 1 byte 28 #define LPP_ANALOG_INPUT 2 // 2 bytes, 0.01 signed 29 #define LPP_ANALOG_OUTPUT 3 // 2 bytes, 0.01 signed 30 #define LPP_LUMINOSITY 101 // 2 bytes, 1 lux unsigned 31 #define LPP_PRESENCE 102 // 1 byte, 1 32 #define LPP_TEMPERATURE 103 // 2 bytes, 0.1°C signed 33 #define LPP_RELATIVE_HUMIDITY 104 // 1 byte, 0.5% unsigned 34 #define LPP_ACCELEROMETER 113 // 2 bytes per axis, 0.001G 35 #define LPP_BAROMETRIC_PRESSURE 115 // 2 bytes 0.1 hPa Unsigned 36 #define LPP_GYROMETER 134 // 2 bytes per axis, 0.01 °/s 37 #define LPP_GPS 136 // 3 byte lon/lat 0.0001 °, 3 bytes alt 0.01m 38 39 40 // Data ID + Data Type + Data Size 41 #define LPP_DIGITAL_INPUT_SIZE 3 42 #define LPP_DIGITAL_OUTPUT_SIZE 3 43 #define LPP_ANALOG_INPUT_SIZE 4 44 #define LPP_ANALOG_OUTPUT_SIZE 4 45 #define LPP_LUMINOSITY_SIZE 4 46 #define LPP_PRESENCE_SIZE 3 47 #define LPP_TEMPERATURE_SIZE 4 48 #define LPP_RELATIVE_HUMIDITY_SIZE 3 49 #define LPP_ACCELEROMETER_SIZE 8 50 #define LPP_BAROMETRIC_PRESSURE_SIZE 4 51 #define LPP_GYROMETER_SIZE 8 52 #define LPP_GPS_SIZE 11 53 54 void CayenneLppInit( void ); 55 56 void CayenneLppReset( void ); 57 uint8_t CayenneLppGetSize( void ); 58 uint8_t* CayenneLppGetBuffer( void ); 59 uint8_t CayenneLppCopy( uint8_t* buffer ); 60 61 uint8_t CayenneLppAddDigitalInput( uint8_t channel, uint8_t value ); 62 uint8_t CayenneLppAddDigitalOutput( uint8_t channel, uint8_t value ); 63 64 uint8_t CayenneLppAddAnalogInput( uint8_t channel, float value ); 65 uint8_t CayenneLppAddAnalogOutput( uint8_t channel, float value ); 66 67 uint8_t CayenneLppAddLuminosity( uint8_t channel, uint16_t lux ); 68 uint8_t CayenneLppAddPresence( uint8_t channel, uint8_t value ); 69 uint8_t CayenneLppAddTemperature( uint8_t channel, float celsius ); 70 uint8_t CayenneLppAddRelativeHumidity( uint8_t channel, float rh ); 71 uint8_t CayenneLppAddAccelerometer( uint8_t channel, float x, float y, float z ); 72 uint8_t CayenneLppAddBarometricPressure( uint8_t channel, float hpa ); 73 uint8_t CayenneLppAddGyrometer( uint8_t channel, float x, float y, float z ); 74 uint8_t CayenneLppAddGps( uint8_t channel, float latitude, float longitude, float meters ); 75 76 #endif // __CAYENNE_LPP_H__ 77