NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
accgyro.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Ninjaflight 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.
8  *
9  * Ninjaflight 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.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 #include "sensor.h"
21 
22 typedef enum {
23  GYRO_NONE = 0,
32 } gyroSensor_e;
33 
34 // Type of accelerometer used/detected
35 typedef enum {
37  ACC_NONE = 1,
45  ACC_FAKE = 9,
47 
48 #define ACC_MAX ACC_FAKE
49 
50 typedef struct gyro_s {
51  sensorGyroInitFuncPtr init; // initialize function
52  sensorReadFuncPtr read; // read 3 axis data function
53  sensorReadFuncPtr temperature; // read temperature if available
54  sensorIsDataReadyFuncPtr isDataReady; // check if sensor has new readings
55  float scale; // scalefactor
56 } gyro_t;
57 
58 typedef struct acc_s {
59  sensorAccInitFuncPtr init; // initialize function
60  sensorReadFuncPtr read; // read 3 axis data function
61  uint16_t acc_1G;
62  char revisionCode; // a revision code for the sensor, if known
63 } acc_t;
64 
65 extern gyro_t gyro;
66 extern acc_t acc;
67 
68 
void(* sensorAccInitFuncPtr)(struct acc_s *acc)
Definition: sensor.h:24
Definition: accgyro.h:43
Definition: accgyro.h:37
sensorReadFuncPtr temperature
Definition: accgyro.h:53
sensorReadFuncPtr read
Definition: accgyro.h:52
accelerationSensor_e
Definition: accgyro.h:35
Definition: accgyro.h:38
sensorAccInitFuncPtr init
Definition: accgyro.h:59
Definition: accgyro.h:24
Definition: accgyro.h:28
Definition: accgyro.h:58
Definition: accgyro.h:45
struct gyro_s gyro_t
bool(* sensorReadFuncPtr)(int16_t *data)
Definition: sensor.h:21
Definition: accgyro.h:40
float scale
Definition: accgyro.h:55
Definition: accgyro.h:39
uint16_t acc_1G
Definition: accgyro.h:61
sensorGyroInitFuncPtr init
Definition: accgyro.h:51
Definition: accgyro.h:25
void(* sensorGyroInitFuncPtr)(uint8_t lpf)
Definition: sensor.h:25
acc_t acc
Definition: config.h:93
Definition: accgyro.h:23
Definition: accgyro.h:26
sensorReadFuncPtr read
Definition: accgyro.h:60
gyroSensor_e
Definition: accgyro.h:22
char revisionCode
Definition: accgyro.h:62
Definition: accgyro.h:27
gyro_t gyro
Definition: config.h:93
Definition: accgyro.h:31
Definition: accgyro.h:36
Definition: accgyro.h:29
bool(* sensorIsDataReadyFuncPtr)(void)
Definition: sensor.h:26
Definition: accgyro.h:42
Definition: accgyro.h:44
Definition: accgyro.h:30
Definition: accgyro.h:50
struct acc_s acc_t
Definition: accgyro.h:41
sensorIsDataReadyFuncPtr isDataReady
Definition: accgyro.h:54