10#ifndef INC_MYSENSORS_BASE_H_
11#define INC_MYSENSORS_BASE_H_
52 #define SIZE_SHT45 sizeof(tmphm_sht45_t)
54 #define SIZE_SHT45_NFC (4+3)
55 #define SIZE_SHT45_NFC_NEG 0
58 #define SIZE_SHT45_NFC 0
59 #define SIZE_SHT45_NFC_NEG (4+3)
62#ifdef SENSOR_AMB_TSL2591
64 #define SIZE_TSL2591 sizeof(amb_tsl2591_t)
66 #define SIZE_TSL2591_NFC 4
68 #define SIZE_TSL2591 0
69 #define SIZE_TSL2591_NFC 0
72#ifdef SENSOR_BAR_ILS22QS
74 #define SIZE_ILS22QS sizeof(bar_ils22qs_t)
76 #define SIZE_ILS22QS_NFC (4+0)
78 #define SIZE_ILS22QS 0
79 #define SIZE_ILS22QS_NFC 0
82#ifdef SENSOR_BAR_BMP585
84 #define SIZE_BMP585 sizeof(bar_bmp585_t)
86 #define SIZE_BMP585_NFC (4+0)
89 #define SIZE_BMP585_NFC 0
94 #define SIZE_SCD41 sizeof(scd41_t)
96 #define SIZE_SCD41_NFC (4+SIZE_SHT45_NFC_NEG)
99 #define SIZE_SCD41_NFC 0
104 #define SIZE_SPS30 sizeof(sps30_t)
106 #define SIZE_SPS30_NFC (4+4)
109 #define SIZE_SPS30_NFC 0
129#define SENSORS_DATASIZE (\
141#define SYSTEMPARAMS_SIGN "MTTV"
147#define SZ_SYSTEMPARAMS 92
154#define SYSTEMPARAMS_STRUCTVER 1
157#define SYSTEMPARAMS_APPVER00 0x01
160#define SYSTEMPARAMS_APPVER01 0x01
163#define SYSTEMPARAMS_DEFAULTALTITUDE 300
166#define SYSTEMPARAMS_MINSENSORTIME 30000
169#define SYSTEMPARAMS_DEFAULTSENSORTIME 60*1000*10
172#define SYSTEMPARAMS_MAXSENSORTIME 60*1000*60*18
179#define SYSTEMPARAMS_MINTIME2OFF 10000
182#define SYSTEM_APP_EUI 00,00,00,00,00,00,00,00
185#define SYSTEM_APP_KEY AB,CD,EF,01,02,03,10,11,12,05,06,07,EF,EF,EF,EF
188#define SYSTEM_APP_DevEUI0 0x45
190#define SYSTEM_APP_DevEUI1 0x87
192#define SYSTEM_APP_DevEUI2 0xF2
215#define SYSTEMPARAMS_BATTIMESEND (12*3600)
218#define SYSTEMPARAMS_BATTMINWORK 2600
356#define SZ_MEASURENFC 16
363#define MEASUREDATANFC_ADDR 128
371#define MEASUEREDATANFC_SIZE (\
384#define MEASUEREDATANFC_EEPROMSIZE 2048
511#define systemParams_Log(...)
void sensorsBase_StartTimerToOff()
start timer to off the function is called from PWR_EnterStopMode - timer is started
systemParams_t _systemParams
uint8_t * systemParams_getAppKey()
Return a pointer to the AppKey stored in _systemParams. Used by the LoRaWAN stack to derive session k...
void sensorsBase_SetCRCMeasureNFC()
Recalculate and store the CRC in _measureNFC.Crc. Call this after modifying any field of _measureNFC ...
uint8_t systemParams_CorrectSystemTime()
setting/correction of the system time from _systemParams.MqttTime, if contains valid UNIX time(low ui...
void systemParams_SetCRCSystemParams()
Recalculate and store the CRC in _systemParams.Crc. Call this after modifying any field of _systemPar...
systemParams_Sensors_t
Bitmask of sensor modules that are enabled / available for data collection. Used in systemParams_t....
uint8_t * systemParams_getAppEUI()
Return a pointer to the AppEUI (JoinEUI) stored in _systemParams. Used by the LoRaWAN stack during th...
void sensorsBase_MeasureNFCInit()
the default initialization of _measureNFC struct
uint8_t * systemParams_getAppDevEUI()
Return a pointer to the DevEUI stored in _systemParams. The DevEUI is auto-generated from the chip UI...
void sensorsBase_StopTimerToOff()
stop timer to off the function is called from PWR_ExitStopMode - the timer value is checked and the P...
void systemParams_SetFromPart(const uint8_t *buffer, uint8_t bufSize)
The setting of systemParams_t from server dowlink. The buffer contains the combination for setting of...
uint8_t sensorsBase_CheckCRCMeasureNFC()
Verify the CRC field of a _measureNFC structure.
systemParams_t _systemParamsBck
uint8_t systemParams_CheckCRC(const systemParams_t *par)
Verify the CRC field of a systemParams_t structure.
void systemParams_Log(const char *info)
Log the current _systemParams fields to the UART debug output.
void systemParams_Correction()
Clamp all RW fields of _systemParams to their valid ranges, called after loading parameters from NFC ...
#define MEASUEREDATANFC_SIZE
one data NFC block of measure data in payload CaynnelLPP format 32 - maximum for all sensors,...
void sensorsBase_Init()
Initialization of base sensor data structure.
uint8_t systemParams_IsSensorAvaiable(systemParams_Sensors_t sensorType)
Check whether a particular sensor is enabled in _systemParams.AvailableSensors.
loraWanPort_t
the list of LORAWAN port.
@ LORAWANPORT_CONFIG_GET_LAST
@ LORAWANPORT_DATA_DEFAULT
@ LORAWANPORT_CONFIG_SET_PART
block of one measure data in CayennelLPP payload format The Data field contains the same payload as i...
uint8_t Data[(4+(4+3)+0+0+(4+0)+0+0)]
uint8_t DummyOn4[4 -((sizeof(uint32_t)+(4+(4+3)+0+0+(4+0)+0+0)) % 4)]
the control block of NFC on address MEASUREDATANFC_ADDR where are stored the last measure data The EE...
System configuration parameters – persisted in NFC EEPROM at address 0. The structure contains all mo...
uint8_t HWBatteryLevelStatus
uint8_t MemsStoreSensorData
uint16_t MemsCurrentCountSensorData
uint8_t SensSendInOnePacket
uint32_t IntBatTimeSendUNIX
uint32_t SensTimeoutMeasure
uint8_t LoRaAdaptiveDataRate
uint16_t MemsMaxSensorData
uint8_t LoRaRepeatTryConnect
The references to systemParams_t for change values from server via downlink. The server sends via dow...