Paparazzi UAS  v5.15_devel-81-gd13dafb
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
airspeed_sdp3x.c File Reference

Airspeed driver for the SDP3X pressure sensor via I2C. More...

#include "std.h"
#include "mcu_periph/i2c.h"
#include "modules/sensors/airspeed_sdp3x.h"
#include "subsystems/abi.h"
#include "mcu_periph/uart.h"
#include "pprzlink/messages.h"
#include "subsystems/datalink/downlink.h"
#include "subsystems/datalink/telemetry.h"
+ Include dependency graph for airspeed_sdp3x.c:

Go to the source code of this file.

Macros

#define SDP3X_SCALE_TEMPERATURE   200.0f
 Commands and scales. More...
 
#define SDP3X_RESET_ADDR   0x00
 
#define SDP3X_RESET_CMD   0x06
 
#define SDP3X_CONT_MEAS_AVG_MODE   0x3615
 
#define SDP3X_CONT_NONE_MODE   0x361E
 
#define SDP3X_SCALE_PRESSURE_SDP31   60
 
#define SDP3X_SCALE_PRESSURE_SDP32   240
 
#define SDP3X_SCALE_PRESSURE_SDP33   20
 
#define SDP3X_I2C_ADDR   0x42
 Sensor I2C slave address (existing defaults 0x42, 0x44 and 0x46) More...
 
#define SDP3X_MODE   SDP3X_CONT_MEAS_AVG_MODE
 Default operation mode. More...
 
#define SDP3X_PRESSURE_SCALE   SDP3X_SCALE_PRESSURE_SDP31
 Default scale for SDP31. More...
 
#define SDP3X_PRESSURE_OFFSET   0.f
 
#define SDP3X_SYNC_SEND   FALSE
 Send a AIRSPEED_MS45XX message with every new measurement. More...
 
#define SDP3X_AIRSPEED_SCALE   1.6327
 Quadratic scale factor for indicated airspeed. More...
 

Functions

static bool sdp3x_crc (const uint8_t data[], unsigned size, uint8_t checksum)
 
static void sdp3x_downlink (struct transport_tx *trans, struct link_device *dev)
 
void sdp3x_init (void)
 
void sdp3x_periodic (void)
 
void sdp3x_event (void)
 

Variables

struct AirspeedSdp3x sdp3x
 
static struct i2c_transaction sdp3x_trans
 

Detailed Description

Airspeed driver for the SDP3X pressure sensor via I2C.

Definition in file airspeed_sdp3x.c.

Macro Definition Documentation

#define SDP3X_AIRSPEED_SCALE   1.6327

Quadratic scale factor for indicated airspeed.

airspeed = sqrt(2*p_diff/density) With p_diff in Pa and standard air density of 1.225 kg/m^3, default airspeed scale is 2/1.225

Definition at line 91 of file airspeed_sdp3x.c.

Referenced by sdp3x_init().

#define SDP3X_CONT_MEAS_AVG_MODE   0x3615

Definition at line 44 of file airspeed_sdp3x.c.

#define SDP3X_CONT_NONE_MODE   0x361E

Definition at line 45 of file airspeed_sdp3x.c.

#define SDP3X_I2C_ADDR   0x42

Sensor I2C slave address (existing defaults 0x42, 0x44 and 0x46)

Definition at line 54 of file airspeed_sdp3x.c.

Referenced by sdp3x_periodic().

#define SDP3X_MODE   SDP3X_CONT_MEAS_AVG_MODE

Default operation mode.

Definition at line 60 of file airspeed_sdp3x.c.

Referenced by sdp3x_periodic().

#define SDP3X_PRESSURE_OFFSET   0.f

Definition at line 72 of file airspeed_sdp3x.c.

Referenced by sdp3x_init().

#define SDP3X_PRESSURE_SCALE   SDP3X_SCALE_PRESSURE_SDP31

Default scale for SDP31.

Definition at line 66 of file airspeed_sdp3x.c.

Referenced by sdp3x_init().

#define SDP3X_RESET_ADDR   0x00

Definition at line 41 of file airspeed_sdp3x.c.

#define SDP3X_RESET_CMD   0x06

Definition at line 42 of file airspeed_sdp3x.c.

#define SDP3X_SCALE_PRESSURE_SDP31   60

Definition at line 47 of file airspeed_sdp3x.c.

#define SDP3X_SCALE_PRESSURE_SDP32   240

Definition at line 48 of file airspeed_sdp3x.c.

#define SDP3X_SCALE_PRESSURE_SDP33   20

Definition at line 49 of file airspeed_sdp3x.c.

#define SDP3X_SCALE_TEMPERATURE   200.0f

Commands and scales.

Definition at line 40 of file airspeed_sdp3x.c.

Referenced by sdp3x_event().

#define SDP3X_SYNC_SEND   FALSE

Send a AIRSPEED_MS45XX message with every new measurement.

FIXME Mainly for debugging, use with caution, sends message at ~100Hz.

Definition at line 82 of file airspeed_sdp3x.c.

Referenced by sdp3x_init().

Function Documentation

static bool sdp3x_crc ( const uint8_t  data[],
unsigned  size,
uint8_t  checksum 
)
static

Definition at line 97 of file airspeed_sdp3x.c.

Referenced by sdp3x_event().

+ Here is the caller graph for this function:

static void sdp3x_downlink ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 119 of file airspeed_sdp3x.c.

References AirspeedSdp3x::airspeed, AirspeedSdp3x::pressure, sdp3x, and AirspeedSdp3x::temperature.

Referenced by sdp3x_event(), and sdp3x_init().

+ Here is the caller graph for this function:

void sdp3x_periodic ( void  )

Variable Documentation

struct AirspeedSdp3x sdp3x

Definition at line 94 of file airspeed_sdp3x.c.

Referenced by sdp3x_downlink(), sdp3x_event(), sdp3x_init(), and sdp3x_periodic().

struct i2c_transaction sdp3x_trans
static

Definition at line 95 of file airspeed_sdp3x.c.

Referenced by sdp3x_event(), sdp3x_init(), and sdp3x_periodic().