27#include "generated/airframe.h"
28#include "pprzlink/messages.h"
34#ifndef MS_PRESSURE_OFFSET
35#define MS_PRESSURE_OFFSET 0.0f
37#ifndef MS_PRESSURE_SCALE
38#define MS_PRESSURE_SCALE 1.0f
40#ifndef MS_TEMPERATURE_OFFSET
41#define MS_TEMPERATURE_OFFSET 0.0f
43#ifndef MS_TEMPERATURE_SCALE
44#define MS_TEMPERATURE_SCALE 1.0f
46#ifndef MS_HUMIDTY_OFFSET
47#define MS_HUMIDTY_OFFSET 0.0f
49#ifndef MS_HUMIDTY_SCALE
50#define MS_HUMIDTY_SCALE 1.0f
52#ifndef MS_DIFF_PRESSURE_OFFSET
53#define MS_DIFF_PRESSURE_OFFSET 0.0f
55#ifndef MS_DIFF_PRESSURE_SCALE
56#define MS_DIFF_PRESSURE_SCALE 1.0f
60#ifdef MS_PRESSURE_SLAVE_IDX
61#ifndef USE_MS_PRESSURE
62#define USE_MS_PRESSURE TRUE
67#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
68#ifndef USE_MS_DIFF_PRESSURE
69#define USE_MS_DIFF_PRESSURE TRUE
74#ifdef MS_TEMPERATURE_SLAVE_IDX
75#ifndef USE_MS_TEMPERATURE
76#define USE_MS_TEMPERATURE TRUE
82#ifndef MS_EEPROM_SLAVE_IDX
93static const float maxAdc = 8388608.0f;
108 const float coeff_A = 3.9083e-3f;
109 const float coeff_B = -5.775e-7f;
110 const float R0 = 1000.0f;
113 const float Rref = 6.8e3f;
128#define MS_PITOT_COUNTER 20
130#define MS_PITOT_FILTER 0.6
153 const float Ra = 390e3f;
154 const float Rb = 680e3f;
155 const float S1 = 0.3e-12f;
158 const float k = 2.f *
logf(2.f) * (
Ra +
Rb +
Rb);
188#define SEND_MS_SYNC FALSE
225 for (k = 0; k <
meteo_stick.calib.params[i].num_coeff; k++) {
233 "P(adc) T(adc) H(ticks) P_diff(adc) P(hPa) T(C) H(%%) CAS(m/s) FIX TOW(ms) WEEK Lat(1e7rad) Lon(1e7rad) HMSL(mm) GS(cm/s) course(1e7rad) VZ(cm/s)\n");
238 "P(adc) T(adc) H(ticks) P_diff(adc) P(hPa) T(C) H(%%) CAS(m/s) FIX TOW(ms) WEEK Lat(1e7rad) Lon(1e7rad) HMSL(mm) GS(cm/s) course(1e7rad) VZ(cm/s)\n");
260#ifndef LOG_MS_FLIGHTRECORDER
261#define LOG_MS_FLIGHTRECORDER FALSE
266#define MS_LOG_FILE flightrecorder_sdlog
269#if LOG_MS_FLIGHTRECORDER
302#ifdef MS_PRESSURE_SLAVE_IDX
316#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
330#ifdef MS_TEMPERATURE_SLAVE_IDX
370#if LOG_MS_FLIGHTRECORDER
380#ifdef MS_PRESSURE_SLAVE_IDX
383#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
386#ifdef MS_TEMPERATURE_SLAVE_IDX
390#ifdef MS_HUMIDITY_PWM_INPUT
416#if LOG_MS_FLIGHTRECORDER
436#ifdef MS_PRESSURE_SLAVE_IDX
439#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
442#ifdef MS_TEMPERATURE_SLAVE_IDX
446#ifdef MS_PRESSURE_SLAVE_IDX
458#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
471#if USE_MS_DIFF_PRESSURE
481#ifdef MS_TEMPERATURE_SLAVE_IDX
485#if USE_MS_TEMPERATURE
Main include for ABI (AirBorneInterface).
#define METEO_STICK_SENDER_ID
void ads1220_event(struct Ads1220 *ads)
void ads1220_init(struct Ads1220 *ads, struct spi_periph *spi_p, uint8_t slave_idx)
Driver for the ADS1220 24-bits ADC from TI SPI communication.
enum Ads1220VRef vref
voltage ref
@ ADS1220_CONTINIOUS_CONVERSION
@ ADS1220_VREF_EXTERNAL_REF
static void ads1220_periodic(struct Ads1220 *ads)
convenience function: read or start configuration if not already initialized
enum Ads1220Imux i1mux
IDAC routing 1.
enum Ads1220Idac idac
IDAC config.
enum Ads1220Imux i2mux
IDAC routing 2.
volatile bool data_available
data ready flag
enum Ads1220Gain gain
gain
static const float Ads1220GainTable[]
enum Ads1220SampleRate rate
data output rate
struct Ads1220Config config
configuration
uint32_t data
raw ADC value
enum Ads1220ConvMode conv
conversion mode
bool pga_bypass
bypass PGA (PGA enabled = 0)
enum Ads1220Mux mux
input multiplexer
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Common code for AP and FBW telemetry.
void eeprom25AA256_event(struct Eeprom25AA256 *eeprom)
Event function.
void eeprom25AA256_init(struct Eeprom25AA256 *eeprom, struct spi_periph *spi_p, uint8_t slave_idx)
Init function.
void eeprom25AA256_read(struct Eeprom25AA256 *eeprom, uint16_t addr, uint16_t length)
Read function.
struct GpsState gps
global GPS state
Device independent GPS code (interface)
uint32_t tow
GPS time of week in ms.
int32_t hmsl
height above mean sea level (MSL) in mm
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
struct NedCoor_i ned_vel
speed NED in cm/s
uint16_t gspeed
norm of 2d ground speed in cm/s
int32_t lat
in degrees*1e7
int32_t lon
in degrees*1e7
static struct LlaCoor_i * stateGetPositionLla_i(void)
Get position in LLA coordinates (int).
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
#define MS_HUMIDTY_OFFSET
#define MS_PRESSURE_OFFSET
Default scale and offset Only used if calibration from EEPROM is not used/available.
void meteo_stick_init(void)
Init function.
#define MS_TEMPERATURE_SCALE
struct MeteoStick meteo_stick
General structure.
static float pitot_offset
static float get_temp(uint32_t raw)
void meteo_stick_periodic(void)
Periodic function.
#define MS_DIFF_PRESSURE_OFFSET
static float get_humidity(uint32_t raw)
static float get_diff(uint32_t raw)
#define MS_DIFF_PRESSURE_SCALE
#define MS_TEMPERATURE_OFFSET
static float get_pitot(uint32_t raw)
static const float maxAdc
Prescaling of data according to datasheets.
static float get_pressure(uint32_t raw)
void meteo_stick_report(void)
void meteo_stick_event(void)
Event function.
static void meteo_stick_send_data(struct transport_tx *trans, struct link_device *device)
Funnction to send over different transport and device.
#define MS_PRESSURE_SCALE
Data acquisition module for ENAC PTU board.
float current_pressure
calibrated pressure
uint32_t humidity_period
humidity (in ticks)
struct Ads1220 temperature
temperature
struct Ads1220 pressure
absolute pressure
float current_temperature
calibrated temperature
struct Ads1220 diff_pressure
differential pressure
bool reset_dp_offset
reset differential pressure offset
float current_airspeed
calibrated airspeed
float current_humidity
calibrated humidity
bool mtostk_populate_cal_from_buffer(Calibration_params *cp, uint8_t *_eeprom_buffer)
Initializes a Calibration_params structure from memory 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
position in UTM coordinates Units: meters
struct pprzlog_transport pprzlog_tp
PPRZLOG transport structure.
Initialize pprzlog transport.
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.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.