119 *
sca = *(*eeprom_buffer)++;
145 "sizeof (uint32_t) differ from sizeof (mtostk_time_t)");
146 _Static_assert(
sizeof(
uint32_t) ==
sizeof(
float),
147 "sizeof (uint32_t) differ from sizeof (float)");
188 const size_t numOfElems = *(*eeprom_buffer)++;
194 *
str++ = *(*eeprom_buffer_byte)++;
214 const size_t numOfElems = *(*eeprom_buffer)++;
260 y += coeffs[i] *
powf(value, (
float) i);
287 for (i = 0; i <= params->
num_temp - 2; i++) {
288 const float t1 = params->
temps[i];
289 const float t2 = params->
temps[i + 1];
290 if (temp >
t1 && temp <= t2) {
294 const float alpha = (t2 - temp) / (t2 -
t1);
static bool mtostk_populate_uuid_from_buffer(char *str, uint32_t **eeprom_buffer)
static bool mtostk_seek_scalar_buffer(size_t dataSize, uint32_t **eeprom_buffer)
static float mtostk_apply_polynomial(float *coeffs, uint16_t num_coef, float value)
static bool mtostk_populate_uint_from_buffer(uint32_t *sca, uint32_t **eeprom_buffer)
static bool mtostk_seek_array_buffer(size_t dataSize, uint32_t **eeprom_buffer)
static float mtostk_apply_polynomial_temp(Sensors_params *params, float temp, float value)
bool mtostk_populate_cal_from_buffer(Calibration_params *cp, uint8_t *_eeprom_buffer)
Initializes a Calibration_params structure from memory buffer.
static bool mtostk_populate_float_array_from_buffer(float *ar, uint16_t *num_of_array, uint16_t *num_of_elem, uint32_t **eeprom_buffer)
static uint32_t fletcher32(uint32_t const *_data, size_t words)
static bool mtostk_populate_sensor_from_buffer(Sensors_params *sp, uint32_t **eeprom_buffer)
float mtostk_get_calibrated_value(Calibration_params *cp, Mtostk_sensors type, float uncal, float temp)
get calibrated value for a sensor according to current temperature
Parser for calibration data coming from 25AA256 EEPROM of the Meteo Stick.
#define MTOSTK_MAX_POLY_ARRAY_SIZE
float coeffs[MTOSTK_MAX_TEMP_ARRAY_SIZE][MTOSTK_MAX_POLY_ARRAY_SIZE]
#define MTOSTK_MAX_TEMP_ARRAY_SIZE
uint32_t mtostk_time_t
time in seconds since 01/01/1970
#define MTOSTK_MAX_SEEK_ARRAY_SIZE
float temps[MTOSTK_MAX_TEMP_ARRAY_SIZE]
Calibration_params structure initialized with calibvration data read from meteostick eeprom.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.