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/feature.h"
31 #include "pg/pg_ids.h"
33 #include "config/config.h"
34 #include "fc/runtime_config.h"
36 #include "sensors/sensors.h"
37 #include "sensors/adcinternal.h"
38 #include "sensors/acceleration.h"
39 #include "sensors/barometer.h"
40 #include "sensors/gyro.h"
41 #include "sensors/compass.h"
42 #include "sensors/rangefinder.h"
43 #include "sensors/initialisation.h"
45 // requestedSensors is not actually used
46 uint8_t requestedSensors
[SENSOR_INDEX_COUNT
] = { GYRO_NONE
, ACC_NONE
, BARO_NONE
, MAG_NONE
, RANGEFINDER_NONE
};
47 uint8_t detectedSensors
[SENSOR_INDEX_COUNT
] = { GYRO_NONE
, ACC_NONE
, BARO_NONE
, MAG_NONE
, RANGEFINDER_NONE
};
49 void sensorsPreInit(void)
62 bool sensorsAutodetect(void)
65 // gyro must be initialised before accelerometer
67 bool gyroDetected
= gyroInit();
71 accInit(gyro
.targetLooptime
);
80 baroDetect(&baro
.dev
, barometerConfig()->baro_hardware
);
83 #ifdef USE_RANGEFINDER
87 #ifdef USE_ADC_INTERNAL