28 #include "generated/airframe.h"
33 #ifndef PTU_PRESSURE_OFFSET
34 #define PTU_PRESSURE_OFFSET 0
36 #ifndef PTU_PRESSURE_SCALE
37 #define PTU_PRESSURE_SCALE 1.0
39 #ifndef PTU_TEMPERATURE_OFFSET
40 #define PTU_TEMPERATURE_OFFSET 0
42 #ifndef PTU_TEMPERATURE_SCALE
43 #define PTU_TEMPERATURE_SCALE 1.0
45 #ifndef PTU_HUMIDTY_OFFSET
46 #define PTU_HUMIDTY_OFFSET 0
48 #ifndef PTU_HUMIDTY_SCALE
49 #define PTU_HUMIDTY_SCALE 1.0
53 #ifndef ADC_CHANNEL_PTU_NB_SAMPLES
54 #define ADC_CHANNEL_PTU_NB_SAMPLES DEFAULT_AV_NB_SAMPLE
66 #include "subsystems/chibios-libopencm3/chibios_sdlog.h"
67 bool_t log_ptu_started;
92 log_ptu_started =
FALSE;
106 if (pprzLogFile != -1) {
107 if (!log_ptu_started) {
108 sdLogWriteLog(pprzLogFile,
109 "P(adc) T(adc) H(usec) GPS_fix TOW(ms) Week Lat(1e7rad) Lon(1e7rad) HMSL(mm) gpseed(cm/s) course(1e7rad) climb(cm/s)\n");
110 log_ptu_started =
TRUE;
112 sdLogWriteLog(pprzLogFile,
"%d %d %d %d %d %d %d %d %d %d %d %d\n",
123 #define PTU_DATA_SIZE 3
124 float ptu_data[PTU_DATA_SIZE];
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void mf_ptu_init(void)
Data acquisition module for Meteo France PTU board.
#define PTU_PRESSURE_SCALE
#define ADC_CHANNEL_PTU_NB_SAMPLES
ADC buffers.
Some architecture independent helper functions for GPIOs.
struct adc_buf pressure_buf
#define PTU_HUMIDTY_SCALE
arch independent ADC (Analog to Digital Converter) API
Generic interface for all ADC hardware drivers, independent from microcontroller architecture.
uint16_t pressure_adc
Raw values.
int32_t hmsl
height above mean sea level in mm
void mf_ptu_periodic(void)
void gpio_set(uint32_t port, uint16_t pin)
Set a gpio output to high level.
#define PTU_TEMPERATURE_SCALE
uint32_t tow
GPS time of week in ms.
Device independent GPS code (interface)
int32_t lon
in degrees*1e7
void adc_buf_channel(uint8_t adc_channel, struct adc_buf *s, uint8_t av_nb_sample)
Registers a buffer to be used to store the specified converted channel Usage:
#define DefaultChannel
SITL.
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
#define PTU_TEMPERATURE_OFFSET
Common code for AP and FBW telemetry.
uint16_t gspeed
norm of 2d ground speed in cm/s
#define PTU_HUMIDTY_OFFSET
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
int32_t lat
in degrees*1e7
struct NedCoor_i ned_vel
speed NED in cm/s
struct GpsState gps
global GPS state
void gpio_setup_output(uint32_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
#define PTU_PRESSURE_OFFSET
Default scale and offset send raw values if nothing defined in airframe file.