Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
dps310_i2c.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 OpenUAS
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
27#ifndef DPS310_I2C_H
28#define DPS310_I2C_H
29
31#include "mcu_periph/i2c.h"
32
50
68
69extern void dps310_i2c_init(struct Dps310_I2c *dps, struct i2c_periph *i2c_p, uint8_t addr);
70extern void dps310_i2c_periodic(struct Dps310_I2c *dps);
71extern void dps310_i2c_event(struct Dps310_I2c *dps);
72
73#endif /* DPS310_I2C_H */
struct i2c_transaction i2c_trans
I2C transaction (only one in flight at a time)
Definition dps310_i2c.h:53
Dps310Status
States of the non-blocking driver state machine.
Definition dps310_i2c.h:39
@ DPS310_STATUS_CONFIGURE_REGS
write PRS_CFG, TMP_CFG, MEAS_CFG (idle) and CFG_REG in one burst
Definition dps310_i2c.h:46
@ DPS310_STATUS_READ_DATA
operational: poll the 6 result registers
Definition dps310_i2c.h:48
@ DPS310_STATUS_GET_COEF_SRCE
read which temperature sensor the factory calibration used
Definition dps310_i2c.h:44
@ DPS310_STATUS_WAIT_RDY
wait for SENSOR_RDY and COEF_RDY (~40ms after power-up)
Definition dps310_i2c.h:43
@ DPS310_STATUS_CONFIGURE_MEAS
enable continuous pressure + temperature measurements
Definition dps310_i2c.h:47
@ DPS310_STATUS_TEMP_FIX
apply the 5-write temperature errata fix (genuine DPS310 only)
Definition dps310_i2c.h:42
@ DPS310_STATUS_GET_ID
read the product/revision ID register
Definition dps310_i2c.h:41
@ DPS310_STATUS_UNINIT
restart point: reset driver state, then detect the sensor
Definition dps310_i2c.h:40
@ DPS310_STATUS_GET_CALIB
read the 18 calibration coefficient bytes
Definition dps310_i2c.h:45
uint8_t temp_fix_step
current step of the temperature errata fix sequence
Definition dps310_i2c.h:62
float pressure
pressure in Pascal
Definition dps310_i2c.h:65
float temperature
temperature in deg Celsius
Definition dps310_i2c.h:66
struct i2c_periph * i2c_p
I2C peripheral used for communication.
Definition dps310_i2c.h:52
uint32_t timer
broken-sensor retry backoff timer
Definition dps310_i2c.h:58
int32_t raw_temperature
uncompensated temperature
Definition dps310_i2c.h:64
enum Dps310Status status
state machine status
Definition dps310_i2c.h:54
volatile bool data_available
data ready flag
Definition dps310_i2c.h:59
bool is_broken
sensor not found or persistently failing, retried after a backoff period
Definition dps310_i2c.h:56
void dps310_i2c_event(struct Dps310_I2c *dps)
Consume finished I2C transactions and advance the state machine.
Definition dps310_i2c.c:290
bool initialized
config done flag
Definition dps310_i2c.h:55
int32_t raw_pressure
uncompensated pressure
Definition dps310_i2c.h:63
uint8_t init_error_cnt
number of consecutive transaction failures
Definition dps310_i2c.h:57
uint8_t temp_coef_srce
TMP_COEF_SRCE bit read from the sensor, mirrored into TMP_CFG bit 7.
Definition dps310_i2c.h:61
void dps310_i2c_periodic(struct Dps310_I2c *dps)
Run the driver state machine, submitting at most one I2C transaction.
Definition dps310_i2c.c:199
void dps310_i2c_init(struct Dps310_I2c *dps, struct i2c_periph *i2c_p, uint8_t addr)
Initialize the driver instance (no bus traffic yet)
Definition dps310_i2c.c:174
struct dps310_reg_calib_data calib
calibration data
Definition dps310_i2c.h:60
Register definitions for Infineon DPS310 pressure sensor.
I2C transaction structure.
Definition i2c.h:94
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
uint16_t foo
Definition main_demo5.c:58
int int32_t
Typedef defining 32 bit int type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.