Data Gator
Hardware and software documentation for the Data Gator project.
Loading...
Searching...
No Matches
KKM_K6P.hpp File Reference

Contains the definition of the KKM K6P BLE sensor, which is based on the BLESensor.hpp interface. More...

#include <Arduino.h>
#include <sstream>
#include <string.h>
#include <../../include/BLESensor.hpp>
#include <NimBLEAdvertisedDevice.h>
#include <MQTTMailer.hpp>
Include dependency graph for KKM_K6P.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ufloat88
 Defines structure for floating point numbers in dual 8 bit upper/lower format. More...
 
class  KKMK6P
 Singleton used to identify and parse BLE transmissions from KKMK6P BLE Temperature and Humidity sensors. More...
 

Macros

#define ENDIAN_CHANGE_U16(x)   ((((x)&0xFF00)>>8) + (((x)&0xFF)<<8))
 < Converts endianess for 16 bit integers
 
#define ENDIAN_CHANGE_U32(x)   ((((x)&0xFF000000)>>24) + (((x)&0x00FF0000)>>8)) + ((((x)&0xFF00)<<8) + (((x)&0xFF)<<24))
 

Functions

struct ufloat88 __attribute__ ((packed)) ufloat88
 Defines structure for floating point numbers in dual 8 bit upper/lower format.
 
std::string toString ()
 Convert struct members upper and lower to a string double value.
 

Variables

const bool USB_DEBUG
 USB serial debugging enabled.
 
int8_t upper = 0x00
 the value to the left of the decimal point
 
uint8_t lower = 0x00
 the value to the right of the decimal point
 
uint8_t id = 0x00
 
uint16_t unknown = 0x0000
 
uint16_t temp = 0x0000
 
uint16_t humidity = 0x0000
 
uint8_t address [6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
 
char name [2] = {0x00, 0x00}
 
uint8_t frameType = 0x00
 
uint8_t version = 0x00
 
uint8_t sensor_mask = 0x00
 
uint16_t volt = 0x0000
 
ufloat88 accX
 
ufloat88 accY
 
ufloat88 accZ
 
uint8_t manufacturerID [6]
 
KKMK6P __attribute__
 

Detailed Description

Contains the definition of the KKM K6P BLE sensor, which is based on the BLESensor.hpp interface.

Author
Garrett Wells
Date
2022

Macro Definition Documentation

◆ ENDIAN_CHANGE_U16

#define ENDIAN_CHANGE_U16 (   x)    ((((x)&0xFF00)>>8) + (((x)&0xFF)<<8))

< Converts endianess for 16 bit integers

Converts endianess for 32 bit integers

Function Documentation

◆ __attribute__()

struct ufloat88 __attribute__ ( (packed )

Defines structure for floating point numbers in dual 8 bit upper/lower format.

Uses the toString member to convert the upper and lower 8 bit values to a string of format <upper>.<lower> to represent a double.

For example:

// note this is pseudo code!
str a = ufloat88.toString() // value of a = "2.5"
int reset_count
number of resets retrieved for NVS
Definition scheduler.hpp:31
Defines structure for floating point numbers in dual 8 bit upper/lower format.
Definition KKM_K6P.hpp:44
int8_t upper
the value to the left of the decimal point
Definition KKM_K6P.hpp:45
std::string toString()
Convert struct members upper and lower to a string double value.
Definition KKM_K6P.hpp:53
uint8_t lower
the value to the right of the decimal point
Definition KKM_K6P.hpp:46

◆ toString()

std::string toString ( )

Convert struct members upper and lower to a string double value.

Returns
A string value of form <upper_int>.<lower_int>.

Variable Documentation

◆ USB_DEBUG

const bool USB_DEBUG
extern

USB serial debugging enabled.

Serial debug enable flag, set in config.h