Set blackbox file handler to NULL after closing file
[inav.git] / src / main / sensors / sensors.h
blob2b706f7dfc6397a40f07f37747d849e7a69b4bc0
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 typedef enum {
21 SENSOR_INDEX_GYRO = 0,
22 SENSOR_INDEX_ACC,
23 SENSOR_INDEX_BARO,
24 SENSOR_INDEX_MAG,
25 SENSOR_INDEX_RANGEFINDER,
26 SENSOR_INDEX_PITOT,
27 SENSOR_INDEX_OPFLOW,
28 SENSOR_INDEX_COUNT
29 } sensorIndex_e;
31 typedef struct int16_flightDynamicsTrims_s {
32 int16_t roll;
33 int16_t pitch;
34 int16_t yaw;
35 } flightDynamicsTrims_def_t;
37 typedef union flightDynamicsTrims_u {
38 int16_t raw[3];
39 flightDynamicsTrims_def_t values;
40 } flightDynamicsTrims_t;
42 #define CALIBRATING_BARO_TIME_MS 2000
43 #define CALIBRATING_PITOT_TIME_MS 4000
44 #define CALIBRATING_GYRO_TIME_MS 2000
45 #define CALIBRATING_ACC_TIME_MS 500
46 #define CALIBRATING_GYRO_MORON_THRESHOLD 32
48 // These bits have to be aligned with sensorIndex_e
49 typedef enum {
50 SENSOR_GYRO = 1 << 0, // always present
51 SENSOR_ACC = 1 << 1,
52 SENSOR_BARO = 1 << 2,
53 SENSOR_MAG = 1 << 3,
54 SENSOR_RANGEFINDER = 1 << 4,
55 SENSOR_PITOT = 1 << 5,
56 SENSOR_OPFLOW = 1 << 6,
57 SENSOR_GPS = 1 << 7,
58 SENSOR_GPSMAG = 1 << 8,
59 SENSOR_TEMP = 1 << 9
60 } sensors_e;
62 extern uint8_t requestedSensors[SENSOR_INDEX_COUNT];
63 extern uint8_t detectedSensors[SENSOR_INDEX_COUNT];