23 static const uint8_t
ADDR = 0x28;
32 static void cb(uint8_t result);
35 static inline float sign(
float x)
37 return (x > 0) - (x < 0);
69 void cb(uint8_t result)
87 int16_t raw_diff_pressure = 0x3FFF & ((
buf_[0] << 8) +
buf_[1]);
88 int16_t raw_temp = ( 0xFFE0 & ((
buf_[2] << 8) +
buf_[3])) >> 5;
90 diff_press_ = -(((float)(raw_diff_pressure) - 1638.3f) / 6553.2
f - 1.0
f) * 6894.757f;
91 temp_ = ((200.0f * raw_temp) / 2047.0) - 50 ;
volatile uint32_t millis(void)
static void cb(uint8_t result)
static bool sensor_present_
static volatile uint8_t * status
void ms4525_async_read(float *differential_pressure, float *temp)
static float sign(float x)
bool i2cWrite(uint8_t addr_, uint8_t reg_, uint8_t data)
static volatile int16_t temp
static const uint8_t ADDR
static uint32_t last_update_ms_
void i2c_queue_job(i2cJobType_t type, uint8_t addr_, uint8_t reg_, uint8_t *data, uint8_t length, volatile uint8_t *status_, void(*CB)(uint8_t))
static uint32_t next_update_ms_
void ms4525_async_update()