Initial IO remapping capability
[betaflight.git] / src / main / sensors / sonar.h
blob6a91ce14495be7003d964fc1d21da30f3397245a
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 "sensors/battery.h"
21 #include "drivers/sonar_hcsr04.h"
23 #define SONAR_OUT_OF_RANGE (-1)
25 extern int16_t sonarMaxRangeCm;
26 extern int16_t sonarCfAltCm;
27 extern int16_t sonarMaxAltWithTiltCm;
29 struct sonarHardware_s;
30 const struct sonarHardware_s *sonarGetHardwareConfiguration(currentSensor_e currentSensor);
31 void sonarInit(sonarConfig_t *sonarConfig);
32 void sonarUpdate(void);
33 int32_t sonarRead(void);
34 int32_t sonarCalculateAltitude(int32_t sonarDistance, float cosTiltAngle);
35 int32_t sonarGetLatestAltitude(void);