12#include "stm32wlxx_hal.h"
20#define SZ_MAINBLOCK 64
28#define SZ_DATABLOCK (5+SENSORS_DATASIZE)
void mems_RemoveLastData(uint8_t fromEndTo)
remove last data
HAL_StatusTypeDef mems_GetLastData(mems_DataBlock_t **memBlock, uint8_t inxFromEnd)
Get the last sensor data if exists. The data and mem block is stored in work buffer,...
uint8_t mems_WriteToSystemParams()
write data from memory to systemParams
mems_MainBlock_t _memsMainBlock
Global instance of the main flash control block; loaded by mems_ReadMainBlock().
void mems_Init()
Initialise NFC and external flash; load the main block and system parameters. Verifies the flash sign...
HAL_StatusTypeDef mems_AddData(const void *data, mems_DataType_t type, uint8_t size)
write new data of sensor at the end of queue, if is no space, the most older data start to rewrites
mems_DataBlock_t * mems_InicBuffer(mems_DataType_t type)
Initialize the work buffer - _memsDataBlock.
HAL_StatusTypeDef mems_Reset()
memory reset - remove sign from chip
void setBackUpRegister(uint32_t backupRegister, uint32_t value)
Write a value to an RTC backup register.
mems_DataType_t
Type tag stored in each mems_DataBlock_t to identify the payload format. Used when reading back block...
HAL_StatusTypeDef mems_WriteMainBlock()
writing the main block on flash. The main block is stored on address 0
uint32_t getBackUpRegister(uint32_t backupRegister)
Read a value from an RTC backup register.
HAL_StatusTypeDef mems_Check(int8_t correct)
Check the memory consist.
HAL_StatusTypeDef mems_ReadMainBlock()
reading of main block from flash. If there is not valid MEMS_SIGN, the structure is initialize to 0 T...
#define SENSORS_DATASIZE
Total size in bytes of one packed sensor data record. Computed as the sum of all enabled sensor struc...
Sensor data record stored as one element in the flash circular queue.
uint8_t Data[(sizeof(uint16_t)+sizeof(tmphm_sht45_t)+sizeof(amb_tsl2591_t)+sizeof(bar_ils22qs_t)+sizeof(bar_bmp585_t)+sizeof(scd41_t)+sizeof(sps30_t))]
Master control block stored at flash address 0.
uint16_t Data_CountCurrent
uint32_t Sens_AmbientStart
uint32_t Sens_TempHumStart
uint32_t Sens_BarometerStart