26 #define DPS280_REG_PRESS 0x00 27 #define DPS280_REG_TEMP 0x03 28 #define DPS280_REG_PCONF 0x06 29 #define DPS280_REG_TCONF 0x07 30 #define DPS280_REG_MCONF 0x08 31 #define DPS280_REG_CREG 0x09 32 #define DPS280_REG_ISTS 0x0A 33 #define DPS280_REG_FSTS 0x0B 34 #define DPS280_REG_RESET 0x0C 35 #define DPS280_REG_PID 0x0D 36 #define DPS280_REG_COEF 0x10 37 #define DPS280_REG_CSRC 0x28 39 #define DPS280_WHOAMI 0x10 56 if (!sensor || !sensor->
init()) {
68 if (v > int16_t((1U<<(bits-1))-1)) {
78 if (v > int32_t((1U<<(bits-1))-1)) {
96 calibration.
C00 = ((buf[4]<<4) + (buf[3]<<12)) + ((buf[5]>>4) & 0x0F);
135 printf(
"DPS280 whoami=0x%x\n", whoami);
167 const float scaling_16 = 1.0/253952;
172 temp_scaled = float(UT) * scaling_16;
173 temperature = cal.
C0 * 0.5 + cal.
C1 * temp_scaled;
175 press_scaled = float(UP) * scaling_16;
178 pressure += press_scaled * (cal.
C10 + press_scaled * (cal.
C20 + press_scaled * cal.
C30));
179 pressure += temp_scaled * cal.
C01;
180 pressure += temp_scaled * press_scaled * (cal.
C11 + press_scaled * cal.
C21);
200 int32_t press = (buf[2]) + (buf[1]<<8) + (buf[0]<<16);
201 int32_t temp = (buf[5]) + (buf[4]<<8) + (buf[3]<<16);
int printf(const char *fmt,...)
void fix_config_bits16(int16_t &v, uint8_t bits) const
virtual PeriodicHandle register_periodic_callback(uint32_t period_usec, PeriodicCb)=0
void _copy_to_frontend(uint8_t instance, float pressure, float temperature)
uint8_t register_sensor(void)
virtual AP_HAL::Semaphore * get_semaphore()=0
#define HAL_SEMAPHORE_BLOCK_FOREVER
virtual bool take(uint32_t timeout_ms) WARN_IF_UNUSED=0
struct AP_Baro_DPS280::dps280_cal calibration
static AP_Baro_Backend * probe(AP_Baro &baro, AP_HAL::OwnPtr< AP_HAL::Device > dev)
AP_HAL::OwnPtr< AP_HAL::Device > dev
virtual bool take_nonblocking() WARN_IF_UNUSED=0
static AP_HAL::OwnPtr< AP_HAL::Device > dev
virtual bool set_speed(Speed speed)=0
bool pressure_ok(float press)
bool read_calibration(void)
AP_Baro_DPS280(AP_Baro &baro, AP_HAL::OwnPtr< AP_HAL::Device > dev)
bool read_registers(uint8_t first_reg, uint8_t *recv, uint32_t recv_len)
void fix_config_bits32(int32_t &v, uint8_t bits) const
#define FUNCTOR_BIND_MEMBER(func, rettype,...)
bool write_register(uint8_t reg, uint8_t val, bool checked=false)
void calculate_PT(int32_t UT, int32_t UP, float &pressure, float &temperature)