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/>.
27 #include "common/utils.h"
29 #include "config/config.h"
30 #include "config/feature.h"
32 #include "fc/runtime_config.h"
34 #include "flight/pid.h"
37 #include "pg/pg_ids.h"
39 #include "sensors/acceleration.h"
40 #include "sensors/adcinternal.h"
41 #include "sensors/barometer.h"
42 #include "sensors/compass.h"
43 #include "sensors/gyro.h"
44 #include "sensors/gyro_init.h"
45 #include "sensors/initialisation.h"
46 #include "sensors/rangefinder.h"
47 #include "sensors/sensors.h"
48 #include "sensors/opticalflow.h"
50 // requestedSensors is not actually used
51 uint8_t requestedSensors
[SENSOR_INDEX_COUNT
] = { GYRO_NONE
, ACC_NONE
, BARO_NONE
, MAG_NONE
, RANGEFINDER_NONE
, OPTICALFLOW_NONE
};
52 uint8_t detectedSensors
[SENSOR_INDEX_COUNT
] = { GYRO_NONE
, ACC_NONE
, BARO_NONE
, MAG_NONE
, RANGEFINDER_NONE
, OPTICALFLOW_NONE
};
54 void sensorsPreInit(void)
67 bool sensorsAutodetect(void)
70 // gyro must be initialised before accelerometer
72 bool gyroDetected
= gyroInit();
76 accInit(gyro
.accSampleRateHz
);
88 #ifdef USE_RANGEFINDER
92 #ifdef USE_OPTICALFLOW
96 #ifdef USE_ADC_INTERNAL