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_SRF10
= 1,
27 RANGEFINDER_VL53L0X
= 2,
29 RANGEFINDER_BENEWAKE
= 4,
30 RANGEFINDER_VL53L1X
= 5,
32 RANGEFINDER_TOF10102I2C
= 7,
34 RANGEFINDER_TERARANGER_EVO
= 9,
35 RANGEFINDER_USD1_V0
= 10,
36 RANGEFINDER_NANORADAR
= 11,
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
{
50 int32_t calculatedAltitude
;
51 timeMs_t lastValidResponseTimeMs
;
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);