Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
meteo_stick.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2014 Gautier Hattenberger
3 *
4 * This file is part of paparazzi
5
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
23
24#include "modules/core/abi.h"
25#include "mcu_periph/sys_time.h"
26#include "peripherals/ads1220.h"
28#include "generated/airframe.h"
29#include "pprzlink/messages.h"
31
35#ifndef MS_PRESSURE_OFFSET
36#define MS_PRESSURE_OFFSET 0.0f
37#endif
38#ifndef MS_PRESSURE_SCALE
39#define MS_PRESSURE_SCALE 1.0f
40#endif
41#ifndef MS_TEMPERATURE_OFFSET
42#define MS_TEMPERATURE_OFFSET 0.0f
43#endif
44#ifndef MS_TEMPERATURE_SCALE
45#define MS_TEMPERATURE_SCALE 1.0f
46#endif
47#ifndef MS_HUMIDTY_OFFSET
48#define MS_HUMIDTY_OFFSET 0.0f
49#endif
50#ifndef MS_HUMIDTY_SCALE
51#define MS_HUMIDTY_SCALE 1.0f
52#endif
53#ifndef MS_DIFF_PRESSURE_OFFSET
54#define MS_DIFF_PRESSURE_OFFSET 0.0f
55#endif
56#ifndef MS_DIFF_PRESSURE_SCALE
57#define MS_DIFF_PRESSURE_SCALE 1.0f
58#endif
59
60// Test if pressure sensor is configured and/or should send ABI message
61#ifdef MS_PRESSURE_SLAVE_IDX
62#ifndef USE_MS_PRESSURE
63#define USE_MS_PRESSURE TRUE
64#endif
65#endif
66
67// Test if diff pressure sensor is configured and/or should send ABI message
68#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
69#ifndef USE_MS_DIFF_PRESSURE
70#define USE_MS_DIFF_PRESSURE TRUE
71#endif
72#endif
73
74// Test if temperature sensor is configured and/or should send ABI message
75#ifdef MS_TEMPERATURE_SLAVE_IDX
76#ifndef USE_MS_TEMPERATURE
77#define USE_MS_TEMPERATURE TRUE
78#endif
79#endif
80
81// Test if EEPROM slave index is configured
82// if not, don't use EEPROM
83#ifndef MS_EEPROM_SLAVE_IDX
84#undef USE_MS_EEPROM
85#endif
86
89
90
93
94static const float maxAdc = 8388608.0f; // 2 ** 23
95
96static inline float get_pressure(uint32_t raw)
97{
98 const float uncal_abs = ((raw / maxAdc) + 0.095f) / 0.0009f;
99
100#if USE_MS_EEPROM
101 return mtostk_get_calibrated_value(&meteo_stick.calib, MTOSTK_ABS_PRESS, uncal_abs, meteo_stick.current_temperature);
102#else
103 return (MS_PRESSURE_SCALE * uncal_abs) + MS_PRESSURE_OFFSET;
104#endif
105}
106
107static inline float get_temp(uint32_t raw)
108{
109 const float coeff_A = 3.9083e-3f;
110 const float coeff_B = -5.775e-7f;
111 const float R0 = 1000.0f;
112 const float gain_factor = Ads1220GainTable[ADS1220_GAIN_4];
113 const float pga_factor = 1.0f;
114 const float Rref = 6.8e3f;
115 const float Rt = (raw * Rref) / (gain_factor * pga_factor * maxAdc);
116 const float uncal_temp = ((-R0 * coeff_A) + (sqrtf(powf((R0 * coeff_A), 2.0f) +
117 (4.0f * R0 * coeff_B * (Rt - R0))))) / (2.0f * R0 * coeff_B);
118
119#if USE_MS_EEPROM
120 return mtostk_get_calibrated_value(&meteo_stick.calib, MTOSTK_TEMP, uncal_temp, 0.);
121#else
122 return (MS_TEMPERATURE_SCALE * uncal_temp) + MS_TEMPERATURE_OFFSET;
123#endif
124}
125
126static float pitot_offset;
127static int pitot_counter;
128// number of measures for averaging initial offset
129#define MS_PITOT_COUNTER 20
130// filtering coefficient (0 no filter, 1 constant value)
131#define MS_PITOT_FILTER 0.6
132
133static inline float get_diff(uint32_t raw)
134{
135 const float gain_factor = Ads1220GainTable[ADS1220_GAIN_2];
136 const uint32_t raw_diff = raw > pitot_offset ? raw - pitot_offset : 0;
137 const float uncal_diff = ((raw_diff / maxAdc) * 5000.f / gain_factor);
138
139#if USE_MS_EEPROM
140 return mtostk_get_calibrated_value(&meteo_stick.calib, MTOSTK_DIF_PRESS, uncal_diff, meteo_stick.current_temperature);
141#else
142 return (MS_DIFF_PRESSURE_SCALE * uncal_diff) + MS_DIFF_PRESSURE_OFFSET;
143#endif
144}
145
146static inline float get_pitot(uint32_t raw)
147{
148 return sqrtf((2.0f * get_diff(raw)) / 1.293f);
149}
150
151static inline float get_humidity(uint32_t raw)
152{
153 const float icu_freq = 42e6f; // Freq
154 const float Ra = 390e3f;
155 const float Rb = 680e3f;
156 const float S1 = 0.3e-12f; // pico farad by % of relative humidity
157 const float calib_raw_period = 17800.f;
158 const float calib_humidity = 45.f;
159 const float k = 2.f * logf(2.f) * (Ra + Rb + Rb);
160 const float uncal_hum = calib_humidity + ((raw - calib_raw_period) / (k * icu_freq * S1));
161
162#if USE_MS_EEPROM
163 return mtostk_get_calibrated_value(&meteo_stick.calib, MTOSTK_HUMIDITY, uncal_hum, meteo_stick.current_temperature);
164#else
165 return (MS_HUMIDTY_SCALE * uncal_hum) + MS_HUMIDTY_OFFSET;
166#endif
167}
168
171static void meteo_stick_send_data(struct transport_tx *trans, struct link_device *device)
172{
173 pprz_msg_send_METEO_STICK(trans, device, AC_ID,
174 &stateGetPositionLla_i()->lat,
175 &stateGetPositionLla_i()->lon,
176 &gps.hmsl,
177 &gps.tow,
178 &meteo_stick.current_pressure,
179 &meteo_stick.current_temperature,
180 &meteo_stick.current_humidity,
181 &meteo_stick.current_airspeed);
182}
183
188#ifndef SEND_MS_SYNC
189#define SEND_MS_SYNC FALSE
190#endif
191
192
197#ifndef LOG_MS
198#define LOG_MS TRUE
199#endif
200
201#if LOG_MS
203#include "modules/gps/gps.h"
204static bool log_ptu_started;
205
206static inline void meteo_stick_log_data_ascii(void)
207{
208 if (pprzLogFile != -1) {
209 if (!log_ptu_started) {
210#if USE_MS_EEPROM
211 if (meteo_stick.eeprom.data_available) {
212 // Print calibration data in the log header
213 sdLogWriteLog(pprzLogFile, "# Calibration data (UUID: %s)\n#\n", meteo_stick.calib.uuid);
214 int i, j, k;
215 for (i = 0; i < MTOSTK_NUM_SENSORS; i++) {
216 sdLogWriteLog(pprzLogFile, "# Sensor: %d, time: %ld, num_temp: %d, num_coeff: %d\n", i,
217 meteo_stick.calib.params[i].timestamp,
218 meteo_stick.calib.params[i].num_temp,
219 meteo_stick.calib.params[i].num_coeff);
220 if (meteo_stick.calib.params[i].timestamp == 0) {
221 continue; // No calibration
222 }
223 for (j = 0; j < meteo_stick.calib.params[i].num_temp; j++) {
224 sdLogWriteLog(pprzLogFile, "# Reference temp: %.2f\n", meteo_stick.calib.params[i].temps[j]);
225 sdLogWriteLog(pprzLogFile, "# Coeffs:");
226 for (k = 0; k < meteo_stick.calib.params[i].num_coeff; k++) {
227 sdLogWriteLog(pprzLogFile, " %.5f", meteo_stick.calib.params[i].coeffs[j][k]);
228 }
230 }
231 }
234 "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");
235 log_ptu_started = true;
236 }
237#else
239 "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");
240 log_ptu_started = true;
241#endif
242 } else {
243 sdLogWriteLog(pprzLogFile, "%lu %lu %lu %lu %.2f %.2f %.2f %.2f %d %lu %d %lu %lu %lu %d %lu %lu\n",
244 meteo_stick.pressure.data, meteo_stick.temperature.data,
245 meteo_stick.humidity_period, meteo_stick.diff_pressure.data,
246 meteo_stick.current_pressure, meteo_stick.current_temperature,
247 meteo_stick.current_humidity, meteo_stick.current_airspeed,
248 gps.fix, gps.tow, gps.week,
249 gps.lla_pos.lat, gps.lla_pos.lon, gps.hmsl,
250 gps.gspeed, gps.course, -gps.ned_vel.z);
251 }
252 }
253}
254
255#endif
256
261#ifndef LOG_MS_FLIGHTRECORDER
262#define LOG_MS_FLIGHTRECORDER FALSE
263#endif
264
265// log to flight recorder by default
266#ifndef MS_LOG_FILE
267#define MS_LOG_FILE flightrecorder_sdlog
268#endif
269
270#if LOG_MS_FLIGHTRECORDER
273static bool log_tagged;
274
275static inline void meteo_stick_log_data_fr(void)
276{
277 if (MS_LOG_FILE.file != NULL && *(MS_LOG_FILE.file) != -1) {
278 if (log_tagged == false && GpsFixValid()) {
279 // write at least once ALIVE and GPS messages
280 // to log for correct extraction of binary data
281 DOWNLINK_SEND_ALIVE(pprzlog_tp, MS_LOG_FILE, 16, MD5SUM);
282 // Log GPS for time reference
283 uint8_t foo_u8 = 0;
284 int16_t foo_16 = 0;
285 uint16_t foo_u16 = 0;
286 struct UtmCoor_f utm = *stateGetPositionUtm_f();
287 int32_t east = utm.east * 100;
288 int32_t north = utm.north * 100;
289 DOWNLINK_SEND_GPS(pprzlog_tp, MS_LOG_FILE, &gps.fix,
290 &east, &north, &foo_16, &gps.hmsl, &foo_u16, &foo_16,
291 &gps.week, &gps.tow, &utm.zone, &foo_u8);
292 log_tagged = true;
293 }
294 meteo_stick_send_data(&pprzlog_tp.trans_tx, &(MS_LOG_FILE).device);
295 }
296}
297#endif
298
302{
303#ifdef MS_PRESSURE_SLAVE_IDX
304 // Init absolute pressure
305 meteo_stick.pressure.config.mux = ADS1220_MUX_AIN0_AVSS;
306 meteo_stick.pressure.config.gain = ADS1220_GAIN_1;
307 meteo_stick.pressure.config.pga_bypass = true;
308 meteo_stick.pressure.config.rate = ADS1220_RATE_45_HZ;
309 meteo_stick.pressure.config.conv = ADS1220_CONTINIOUS_CONVERSION;
310 meteo_stick.pressure.config.vref = ADS1220_VREF_VDD;
311 meteo_stick.pressure.config.idac = ADS1220_IDAC_OFF;
312 meteo_stick.pressure.config.i1mux = ADS1220_IMUX_OFF;
313 meteo_stick.pressure.config.i2mux = ADS1220_IMUX_OFF;
314 ads1220_init(&meteo_stick.pressure, &(MS_SPI_DEV), MS_PRESSURE_SLAVE_IDX);
315#endif
316
317#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
318 // Init differential pressure
319 meteo_stick.diff_pressure.config.mux = ADS1220_MUX_AIN0_AVSS;
320 meteo_stick.diff_pressure.config.gain = ADS1220_GAIN_2;
321 meteo_stick.diff_pressure.config.pga_bypass = true;
322 meteo_stick.diff_pressure.config.rate = ADS1220_RATE_45_HZ;
323 meteo_stick.diff_pressure.config.conv = ADS1220_CONTINIOUS_CONVERSION;
324 meteo_stick.diff_pressure.config.vref = ADS1220_VREF_VDD;
325 meteo_stick.diff_pressure.config.idac = ADS1220_IDAC_OFF;
326 meteo_stick.diff_pressure.config.i1mux = ADS1220_IMUX_OFF;
327 meteo_stick.diff_pressure.config.i2mux = ADS1220_IMUX_OFF;
328 ads1220_init(&meteo_stick.diff_pressure, &(MS_SPI_DEV), MS_DIFF_PRESSURE_SLAVE_IDX);
329#endif
330
331#ifdef MS_TEMPERATURE_SLAVE_IDX
332 // Init temperature
333 meteo_stick.temperature.config.mux = ADS1220_MUX_AIN0_AIN1;
334 meteo_stick.temperature.config.gain = ADS1220_GAIN_4;
335 meteo_stick.temperature.config.pga_bypass = true;
336 meteo_stick.temperature.config.rate = ADS1220_RATE_45_HZ;
337 meteo_stick.temperature.config.conv = ADS1220_CONTINIOUS_CONVERSION;
338 meteo_stick.temperature.config.vref = ADS1220_VREF_EXTERNAL_REF;
339 meteo_stick.temperature.config.idac = ADS1220_IDAC_250_uA;
340 meteo_stick.temperature.config.i1mux = ADS1220_IMUX_OFF;
341 meteo_stick.temperature.config.i2mux = ADS1220_IMUX_A0_RP1;
342 ads1220_init(&meteo_stick.temperature, &(MS_SPI_DEV), MS_TEMPERATURE_SLAVE_IDX);
343#endif
344
345 // Init humidity
346 meteo_stick.humidity_period = 0;
347
348 // Initial conditions
349 meteo_stick.current_pressure = 0.0f;
350 meteo_stick.current_temperature = 0.0f;
351 meteo_stick.current_humidity = 0.0f;
352 meteo_stick.current_airspeed = 0.0f;
353
354#if USE_MS_EEPROM
355 // Set number of calibration to 0 for all sensors
356 int i;
357 for (i = 0; i < MTOSTK_NUM_SENSORS; i++) {
358 meteo_stick.calib.params[i].num_temp = 0;
359 }
360 // Init eeprom
361 eeprom25AA256_init(&meteo_stick.eeprom, &(MS_SPI_DEV), MS_EEPROM_SLAVE_IDX);
362#endif
363
364 // Number of measurements before setting pitot offset
366 meteo_stick.reset_dp_offset = false;
367
368#if LOG_MS
369 log_ptu_started = false;
370#endif
371#if LOG_MS_FLIGHTRECORDER
372 log_tagged = false;
373#endif
374}
375
379{
380 // Read ADC
381#ifdef MS_PRESSURE_SLAVE_IDX
382 ads1220_periodic(&meteo_stick.pressure);
383#endif
384#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
385 ads1220_periodic(&meteo_stick.diff_pressure);
386#endif
387#ifdef MS_TEMPERATURE_SLAVE_IDX
388 ads1220_periodic(&meteo_stick.temperature);
389#endif
390 // Read PWM
391#ifdef MS_HUMIDITY_PWM_INPUT
392 meteo_stick.humidity_period = pwm_input_period_tics[MS_HUMIDITY_PWM_INPUT];
393 meteo_stick.current_humidity = get_humidity(meteo_stick.humidity_period);
394#endif
395
396#if USE_MS_EEPROM
397 if (meteo_stick.eeprom.data_available) {
398 // Extract calibration data
399 if (!mtostk_populate_cal_from_buffer(&meteo_stick.calib, (uint8_t *)(meteo_stick.eeprom.rx_buf + 3))) {
400 // Extraction failed
401 // Force number of calibration to 0 for all sensors
402 int i;
403 for (i = 0; i < MTOSTK_NUM_SENSORS; i++) {
404 meteo_stick.calib.params[i].num_temp = 0;
405 }
406 }
407 } else if (meteo_stick.eeprom.spi_trans.status == SPITransDone) {
408 // Load reading request (reading 1Kb from address 0x0)
409 eeprom25AA256_read(&meteo_stick.eeprom, 0x0, 1024);
410 }
411#endif
412
413 // Log data
414#if LOG_MS
415 meteo_stick_log_data_ascii();
416#endif
417#if LOG_MS_FLIGHTRECORDER
418 meteo_stick_log_data_fr();
419#endif
420
421 // Send data synch to reading
422#if SEND_MS_SYNC
423 meteo_stick_send_data(&(DefaultChannel).trans_tx, &(DefaultDevice).device);
424#endif
425
426 // Check if DP offset reset is required
427 if (meteo_stick.reset_dp_offset) {
429 meteo_stick.reset_dp_offset = false;
430 }
431}
432
436{
437#ifdef MS_PRESSURE_SLAVE_IDX
438 ads1220_event(&meteo_stick.pressure);
439#endif
440#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
441 ads1220_event(&meteo_stick.diff_pressure);
442#endif
443#ifdef MS_TEMPERATURE_SLAVE_IDX
444 ads1220_event(&meteo_stick.temperature);
445#endif
446
447#ifdef MS_PRESSURE_SLAVE_IDX
448 // send absolute pressure data over ABI as soon as available
449 if (meteo_stick.pressure.data_available) {
450 uint32_t now_ts = get_sys_time_usec();
451 meteo_stick.current_pressure = get_pressure(meteo_stick.pressure.data);
452#if USE_MS_PRESSURE
453 AbiSendMsgBARO_ABS_RAW(METEO_STICK_SENDER_ID, now_ts, meteo_stick.current_pressure);
454#endif
455 meteo_stick.pressure.data_available = false;
456 }
457#endif
458
459#ifdef MS_DIFF_PRESSURE_SLAVE_IDX
460 // send differential pressure data over ABI as soon as available
461 if (meteo_stick.diff_pressure.data_available) {
462 if (pitot_counter > 0) {
464 // set initial value
465 pitot_offset = meteo_stick.diff_pressure.data;
466 } else {
467 pitot_offset = pitot_offset * MS_PITOT_FILTER + (1.0f - MS_PITOT_FILTER) * meteo_stick.diff_pressure.data;
468 }
470 }
471 else {
472#if USE_MS_DIFF_PRESSURE
473 float diff = get_diff(meteo_stick.diff_pressure.data);
474 AbiSendMsgBARO_DIFF_RAW(METEO_STICK_SENDER_ID, get_sys_time_usec(), diff);
475#endif
476 meteo_stick.current_airspeed = get_pitot(meteo_stick.diff_pressure.data);
477 meteo_stick.diff_pressure.data_available = false;
478 }
479 }
480#endif
481
482#ifdef MS_TEMPERATURE_SLAVE_IDX
483 // send temperature data over ABI as soon as available
484 if (meteo_stick.temperature.data_available) {
485 meteo_stick.current_temperature = get_temp(meteo_stick.temperature.data);
486#if USE_MS_TEMPERATURE
487 AbiSendMsgTEMPERATURE_RAW(METEO_STICK_SENDER_ID, now_ts, meteo_stick.current_temperature, TEMPERATURE_TYPE_AIR);
488#endif
489 meteo_stick.temperature.data_available = false;
490 }
491#endif
492
493#if USE_MS_EEPROM
495#endif
496}
497
499{
500 // send meteo_stick data at a different frequency
501 meteo_stick_send_data(&(DefaultChannel).trans_tx, &(DefaultDevice).device);
502}
503
Main include for ABI (AirBorneInterface).
#define TEMPERATURE_TYPE_AIR
Types of the TEMPERATURE_RAW message, what the temperature measures.
Definition abi_common.h:89
#define METEO_STICK_SENDER_ID
void ads1220_event(struct Ads1220 *ads)
Definition ads1220.c:130
void ads1220_init(struct Ads1220 *ads, struct spi_periph *spi_p, uint8_t slave_idx)
Definition ads1220.c:49
Driver for the ADS1220 24-bits ADC from TI SPI communication.
@ ADS1220_IDAC_250_uA
Definition ads1220.h:110
@ ADS1220_IDAC_OFF
Definition ads1220.h:106
@ ADS1220_CONTINIOUS_CONVERSION
Definition ads1220.h:93
@ ADS1220_VREF_VDD
Definition ads1220.h:101
@ ADS1220_VREF_EXTERNAL_REF
Definition ads1220.h:99
static void ads1220_periodic(struct Ads1220 *ads)
convenience function: read or start configuration if not already initialized
Definition ads1220.h:171
static const float Ads1220GainTable[]
Definition ads1220.h:78
@ ADS1220_RATE_45_HZ
Definition ads1220.h:85
@ ADS1220_MUX_AIN0_AVSS
Definition ads1220.h:56
@ ADS1220_MUX_AIN0_AIN1
Definition ads1220.h:48
@ ADS1220_GAIN_1
Definition ads1220.h:67
@ ADS1220_GAIN_2
Definition ads1220.h:68
@ ADS1220_GAIN_4
Definition ads1220.h:69
@ ADS1220_IMUX_OFF
Definition ads1220.h:118
@ ADS1220_IMUX_A0_RP1
Definition ads1220.h:119
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
static bool log_tagged
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
Definition gps.c:74
Device independent GPS code (interface).
#define GpsFixValid()
Definition gps.h:171
@ SPITransDone
Definition spi.h:97
static struct LlaCoor_i * stateGetPositionLla_i(void)
Get position in LLA coordinates (int).
Definition state.h:823
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
Definition state.h:832
#define S1
Definition board.h:70
static FILE * pprzLogFile
#define MS_HUMIDTY_OFFSET
Definition meteo_stick.c:48
#define MS_PRESSURE_OFFSET
Default scale and offset Only used if calibration from EEPROM is not used/available.
Definition meteo_stick.c:36
void meteo_stick_init(void)
Init function.
#define MS_TEMPERATURE_SCALE
Definition meteo_stick.c:45
struct MeteoStick meteo_stick
General structure.
Definition meteo_stick.c:88
static float pitot_offset
static float get_temp(uint32_t raw)
static int pitot_counter
void meteo_stick_periodic(void)
Periodic function.
#define MS_DIFF_PRESSURE_OFFSET
Definition meteo_stick.c:54
#define MS_PITOT_COUNTER
static float get_humidity(uint32_t raw)
static float get_diff(uint32_t raw)
#define MS_PITOT_FILTER
#define MS_DIFF_PRESSURE_SCALE
Definition meteo_stick.c:57
#define MS_TEMPERATURE_OFFSET
Definition meteo_stick.c:42
static float get_pitot(uint32_t raw)
#define MS_LOG_FILE
static const float maxAdc
Prescaling of data according to datasheets.
Definition meteo_stick.c:94
static float get_pressure(uint32_t raw)
Definition meteo_stick.c:96
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
Definition meteo_stick.c:39
#define MS_HUMIDTY_SCALE
Definition meteo_stick.c:51
Data acquisition module for ENAC PTU board.
Raw sensors structure.
Definition meteo_stick.h:59
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
@ MTOSTK_DIF_PRESS
@ MTOSTK_TEMP
@ MTOSTK_HUMIDITY
@ MTOSTK_ABS_PRESS
@ MTOSTK_NUM_SENSORS
uint8_t zone
UTM zone number.
float east
in meters
float north
in meters
position in UTM coordinates Units: meters
struct pprzlog_transport pprzlog_tp
PPRZLOG transport structure.
Definition pprzlog_tp.c:29
Initialize pprzlog transport.
volatile uint32_t pwm_input_period_tics[PWM_INPUT_NB]
Definition pwm_input.c:36
arch independent PWM input capture API
SdioError sdLogWriteLog(const FileDes fd, const char *fmt,...)
Architecture independent timing functions.
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.