osd batt cleanup
[inav.git] / src / main / sensors / barometer.h
blobc2722e7d3c928a43c9e95474312bb5430b0b62f7
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "config/parameter_group.h"
22 #include "drivers/barometer/barometer.h"
24 typedef enum {
25 BARO_NONE = 0,
26 BARO_AUTODETECT = 1,
27 BARO_BMP085 = 2,
28 BARO_MS5611 = 3,
29 BARO_BMP280 = 4,
30 BARO_MS5607 = 5,
31 BARO_LPS25H = 6,
32 BARO_SPL06 = 7,
33 BARO_BMP388 = 8,
34 BARO_DPS310 = 9,
35 BARO_B2SMPB = 10,
36 BARO_MSP = 11,
37 BARO_FAKE = 12,
38 BARO_MAX = BARO_FAKE
39 } baroSensor_e;
41 typedef struct baro_s {
42 baroDev_t dev;
43 int32_t BaroAlt;
44 int32_t baroTemperature; // Use temperature for telemetry
45 int32_t baroPressure; // Use pressure for telemetry
46 } baro_t;
48 extern baro_t baro;
50 #ifdef USE_BARO
52 typedef struct barometerConfig_s {
53 uint8_t baro_hardware; // Barometer hardware to use
54 uint16_t baro_calibration_tolerance; // Baro calibration tolerance (cm at sea level)
55 } barometerConfig_t;
57 PG_DECLARE(barometerConfig_t, barometerConfig);
60 bool baroInit(void);
61 bool baroIsCalibrationComplete(void);
62 void baroStartCalibration(void);
63 uint32_t baroUpdate(void);
64 int32_t baroCalculateAltitude(void);
65 int32_t baroGetLatestAltitude(void);
66 int16_t baroGetTemperature(void);
67 bool baroIsHealthy(void);
69 #endif