Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
meteo_stick_calib.c File Reference

Parser for calibration data coming from 25AA256 EEPROM of the Meteo Stick. More...

#include "modules/meteo/meteo_stick_calib.h"
#include <math.h>
+ Include dependency graph for meteo_stick_calib.c:

Go to the source code of this file.

Data Structures

struct  CalibrationPoint
 

Functions

static bool mtostk_populate_sensor_from_buffer (Sensors_params *sp, uint32_t **eeprom_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 bool mtostk_populate_uuid_from_buffer (char *str, uint32_t **eeprom_buffer)
 
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 bool mtostk_seek_scalar_buffer (size_t dataSize, uint32_t **eeprom_buffer)
 
static uint32_t fletcher32 (uint32_t const *_data, size_t words)
 
static float mtostk_apply_polynomial (float *coeffs, uint16_t num_coef, float value)
 
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. More...
 
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 More...
 

Detailed Description

Parser for calibration data coming from 25AA256 EEPROM of the Meteo Stick.

Definition in file meteo_stick_calib.c.


Data Structure Documentation

struct CalibrationPoint

Definition at line 33 of file meteo_stick_calib.c.

Data Fields
float rawValue
float ref
float value

Function Documentation

static uint32_t fletcher32 ( uint32_t const *  _data,
size_t  words 
)
static

Definition at line 233 of file meteo_stick_calib.c.

References words.

Referenced by mtostk_populate_sensor_from_buffer().

+ Here is the caller graph for this function:

float mtostk_apply_polynomial ( float *  coeffs,
uint16_t  num_coef,
float  value 
)
static

Definition at line 255 of file meteo_stick_calib.c.

Referenced by mtostk_apply_polynomial_temp(), and mtostk_get_calibrated_value().

+ Here is the caller graph for this function:

float mtostk_apply_polynomial_temp ( Sensors_params params,
float  temp,
float  value 
)
static

Definition at line 265 of file meteo_stick_calib.c.

References alpha, Sensors_params::coeffs, mtostk_apply_polynomial(), Sensors_params::num_coeff, Sensors_params::num_temp, Sensors_params::temps, and Sensors_params::timestamp.

Referenced by mtostk_get_calibrated_value().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Parameters
[in]cppointer to calibration structure
[in]typesensor type
[in]uncaluncalibrated value
[in]tempcurrent temperature (not relevant for calibration of temperature sensor)
Returns
calibrated value

Definition at line 71 of file meteo_stick_calib.c.

References Sensors_params::coeffs, mtostk_apply_polynomial(), mtostk_apply_polynomial_temp(), MTOSTK_NUM_SENSORS, MTOSTK_TEMP, Sensors_params::num_coeff, Sensors_params::num_temp, Calibration_params::params, and Sensors_params::timestamp.

Referenced by get_diff(), get_humidity(), get_pressure(), and get_temp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool mtostk_populate_cal_from_buffer ( Calibration_params cp,
uint8_t eeprom_buffer 
)

Initializes a Calibration_params structure from memory buffer.

Precondition
the memory buffer must be initialized with data read from the spi eeprom embeded on the meteostick
Parameters
[out]cppointer to the Calibration_params structure to be initialized
[in]eeprom_bufferpointer to word aligned buffer of bytes

Definition at line 53 of file meteo_stick_calib.c.

References MTOSTK_NUM_SENSORS, mtostk_populate_sensor_from_buffer(), mtostk_populate_uuid_from_buffer(), MTOSTK_TEMP, Calibration_params::params, and Calibration_params::uuid.

Referenced by meteo_stick_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 123 of file meteo_stick_calib.c.

References idx, MTOSTK_MAX_POLY_ARRAY_SIZE, and MTOSTK_MAX_TEMP_ARRAY_SIZE.

Referenced by mtostk_populate_sensor_from_buffer().

+ Here is the caller graph for this function:

static bool mtostk_populate_sensor_from_buffer ( Sensors_params sp,
uint32_t **  eeprom_buffer 
)
static
static bool mtostk_populate_uint_from_buffer ( uint32_t sca,
uint32_t **  eeprom_buffer 
)
static

Definition at line 113 of file meteo_stick_calib.c.

Referenced by mtostk_populate_sensor_from_buffer().

+ Here is the caller graph for this function:

static bool mtostk_populate_uuid_from_buffer ( char *  str,
uint32_t **  eeprom_buffer 
)
static

Definition at line 176 of file meteo_stick_calib.c.

References idx, and UUID_LEN.

Referenced by mtostk_populate_cal_from_buffer().

+ Here is the caller graph for this function:

static bool mtostk_seek_array_buffer ( size_t  dataSize,
uint32_t **  eeprom_buffer 
)
static

Definition at line 200 of file meteo_stick_calib.c.

References MTOSTK_MAX_SEEK_ARRAY_SIZE, and MTOSTK_MAX_TEMP_ARRAY_SIZE.

Referenced by mtostk_populate_sensor_from_buffer().

+ Here is the caller graph for this function:

static bool mtostk_seek_scalar_buffer ( size_t  dataSize,
uint32_t **  eeprom_buffer 
)
static

Definition at line 225 of file meteo_stick_calib.c.

Referenced by mtostk_populate_sensor_from_buffer().

+ Here is the caller graph for this function: