2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
23 #include "common/time.h"
24 #include "drivers/io_types.h"
26 #define RANGEFINDER_OUT_OF_RANGE (-1)
27 #define RANGEFINDER_HARDWARE_FAILURE (-2)
28 #define RANGEFINDER_NO_NEW_DATA (-3)
30 typedef struct rangefinderHardwarePins_s
{
33 } rangefinderHardwarePins_t
;
35 struct rangefinderDev_s
;
36 typedef void (*rangefinderOpInitFuncPtr
)(struct rangefinderDev_s
* dev
);
37 typedef void (*rangefinderOpStartFuncPtr
)(struct rangefinderDev_s
* dev
);
38 typedef int32_t (*rangefinderOpReadFuncPtr
)(struct rangefinderDev_s
* dev
);
40 typedef struct rangefinderDev_s
{
44 // these are full detection cone angles, maximum tilt is half of this
45 int16_t detectionConeDeciDegrees
; // detection cone angle as in device spec
46 int16_t detectionConeExtendedDeciDegrees
; // device spec is conservative, in practice have slightly larger detection cone
49 rangefinderOpInitFuncPtr init
;
50 rangefinderOpStartFuncPtr update
;
51 rangefinderOpReadFuncPtr read
;
54 extern int16_t rangefinderMaxRangeCm
;
55 extern int16_t rangefinderMaxAltWithTiltCm
;
56 extern int16_t rangefinderCfAltCm
;