#ifndef BMP280_H #define BMP280_H #include /* * BMP280 / BME280 barometer driver. * * Probes I2C1 at 0x76 then 0x77. * Returns chip_id (0x58=BMP280, 0x60=BME280) on success, negative if not found. * Requires i2c1_init() to have been called first. * * All I2C operations use 100ms timeouts — init will not hang on missing hardware. */ int bmp280_init(void); void bmp280_read(int32_t *pressure_pa, int16_t *temp_x10); /* * BME280-only humidity readout. Call AFTER bmp280_read() (uses cached t_fine). * Returns humidity in %RH × 10 (e.g. 500 = 50.0 %RH). * Returns -1 if chip is BMP280 (no humidity) or not initialised. */ int16_t bmp280_read_humidity(void); /* Convert pressure (Pa) to altitude above sea level (cm), ISA p0=101325 Pa. */ int32_t bmp280_pressure_to_alt_cm(int32_t pressure_pa); #endif /* BMP280_H */