NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sensors.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Copyright: collective.
5  * Cleanup: Martin Schröder <mkschreder.uk@gmail.com>
6  * Original source from Cleanflight.
7  *
8  * Ninjaflight is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * Ninjaflight is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #pragma once
23 
24 typedef enum {
25  SENSOR_GYRO = 1 << 0, // always present
26  SENSOR_ACC = 1 << 1,
27  SENSOR_BARO = 1 << 2,
28  SENSOR_MAG = 1 << 3,
29  SENSOR_SONAR = 1 << 4,
30  SENSOR_GPS = 1 << 5,
31  SENSOR_GPSMAG = 1 << 6,
32 } sensors_e;
33 
34 typedef enum {
35  ALIGN_DEFAULT = 0, // driver-provided alignment
36  CW0_DEG = 1,
37  CW90_DEG = 2,
38  CW180_DEG = 3,
39  CW270_DEG = 4,
45 
47  sensor_align_e gyro_align; // gyro alignment
48  sensor_align_e acc_align; // acc alignment
49  sensor_align_e mag_align; // mag alignment
50 } __attribute__((packed)) ;
51 
53  uint8_t acc_hardware; // Which acc hardware to use on boards with more than one device
54  uint8_t mag_hardware; // Which mag hardware to use on boards with more than one device
55  uint8_t baro_hardware; // Barometer hardware to use
56 } __attribute__((packed)) ;
57 
59  int16_t roll;
60  int16_t pitch;
61  int16_t yaw;
62 } __attribute__((packed)) flightDynamicsTrims_def_t;
63 
64 typedef union {
65  int16_t raw[3];
66  flightDynamicsTrims_def_t values;
67 } __attribute__((packed)) flightDynamicsTrims_t;
68 
70  flightDynamicsTrims_t accZero;
71  flightDynamicsTrims_t magZero;
72 } __attribute__((packed)) ;
73 
74 struct sensor_config {
78 } __attribute__((packed)) ;
79 
80 
struct sensor_alignment_config alignment
Definition: sensors.h:76
sensor_align_e
Definition: sensors.h:34
typedef __attribute__
int16_t yaw
Definition: sensors.h:61
Definition: sensors.h:42
Definition: sensors.h:29
uint8_t acc_hardware
Definition: sensors.h:53
Definition: sensors.h:27
Definition: sensors.h:58
Definition: sensors.h:35
flightDynamicsTrims_t magZero
Definition: sensors.h:71
sensor_align_e gyro_align
Definition: sensors.h:47
Definition: sensors.h:28
uint8_t baro_hardware
Definition: sensors.h:55
Definition: sensors.h:25
Definition: sensors.h:37
int16_t pitch
Definition: sensors.h:60
Definition: sensors.h:46
sensor_align_e mag_align
Definition: sensors.h:49
Definition: sensors.h:26
Definition: sensors.h:39
Definition: sensors.h:52
sensor_align_e acc_align
Definition: sensors.h:48
uint8_t mag_hardware
Definition: sensors.h:54
Definition: sensors.h:30
struct sensor_trims_config trims
Definition: sensors.h:77
Definition: sensors.h:69
sensors_e
Definition: sensors.h:24
Definition: sensors.h:43
Definition: sensors.h:38
int16_t roll
Definition: sensors.h:59
struct sensor_selection_config selection
Definition: sensors.h:75
flightDynamicsTrims_t accZero
Definition: sensors.h:70
Definition: sensors.h:31
flightDynamicsTrims_def_t values
Definition: sensors.h:66
Definition: sensors.h:41
Definition: sensors.h:74
Definition: sensors.h:40
Definition: sensors.h:36
int16_t raw[2]
Definition: accelerometer.h:51