Blackbox device type 'file' (SITL) considered working when file handler is available
[inav.git] / src / main / sensors / rangefinder.h
blob4c2a4e629aa78e0127cf8ef88f9e90cc9d2d2374
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 <stdint.h>
21 #include "config/parameter_group.h"
22 #include "drivers/rangefinder/rangefinder.h"
24 typedef enum {
25 RANGEFINDER_NONE = 0,
26 RANGEFINDER_SRF10 = 1,
27 RANGEFINDER_VL53L0X = 2,
28 RANGEFINDER_MSP = 3,
29 RANGEFINDER_BENEWAKE = 4,
30 RANGEFINDER_VL53L1X = 5,
31 RANGEFINDER_US42 = 6,
32 RANGEFINDER_TOF10102I2C = 7,
33 RANGEFINDER_FAKE = 8,
34 RANGEFINDER_TERARANGER_EVO = 9,
35 RANGEFINDER_USD1_V0 = 10,
36 RANGEFINDER_NANORADAR = 11,
37 } rangefinderType_e;
39 typedef struct rangefinderConfig_s {
40 uint8_t rangefinder_hardware;
41 uint8_t use_median_filtering;
42 } rangefinderConfig_t;
44 PG_DECLARE(rangefinderConfig_t, rangefinderConfig);
46 typedef struct rangefinder_s {
47 rangefinderDev_t dev;
48 float maxTiltCos;
49 int32_t rawAltitude;
50 int32_t calculatedAltitude;
51 timeMs_t lastValidResponseTimeMs;
52 } rangefinder_t;
54 extern rangefinder_t rangefinder;
56 bool rangefinderInit(void);
58 int32_t rangefinderGetLatestAltitude(void);
59 int32_t rangefinderGetLatestRawAltitude(void);
61 timeDelta_t rangefinderUpdate(void);
62 bool rangefinderProcess(float cosTiltAngle);
63 bool rangefinderIsHealthy(void);