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/>.
21 #include "config/parameter_group.h"
22 #include "drivers/rangefinder/rangefinder.h"
26 RANGEFINDER_HCSR04
= 1,
27 RANGEFINDER_SRF10
= 2,
28 RANGEFINDER_HCSR04I2C
= 3,
29 RANGEFINDER_VL53L0X
= 4,
31 RANGEFINDER_UNUSED
= 6, // Was UIB
32 RANGEFINDER_BENEWAKE
= 7,
33 RANGEFINDER_VL53L1X
= 8,
37 typedef struct rangefinderConfig_s
{
38 uint8_t rangefinder_hardware
;
39 uint8_t use_median_filtering
;
40 } rangefinderConfig_t
;
42 PG_DECLARE(rangefinderConfig_t
, rangefinderConfig
);
44 typedef struct rangefinder_s
{
48 int32_t calculatedAltitude
;
49 timeMs_t lastValidResponseTimeMs
;
52 extern rangefinder_t rangefinder
;
54 const rangefinderHardwarePins_t
* rangefinderGetHardwarePins(void);
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);