Merge pull request #10558 from iNavFlight/MrD_Correct-comments-on-OSD-symbols
[inav.git] / src / main / drivers / sensor.h
blobbe828d5007c6f9729b8ab86db7e4e6388bfc289c
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 #include <stdbool.h>
21 #include <stdint.h>
23 #include "drivers/io_types.h"
24 #include "drivers/bus.h"
26 typedef enum {
27 ALIGN_DEFAULT = 0, // driver-provided alignment
28 CW0_DEG = 1,
29 CW90_DEG = 2,
30 CW180_DEG = 3,
31 CW270_DEG = 4,
32 CW0_DEG_FLIP = 5,
33 CW90_DEG_FLIP = 6,
34 CW180_DEG_FLIP = 7,
35 CW270_DEG_FLIP = 8
36 } sensor_align_e;
38 typedef bool (*sensorInitFuncPtr)(void); // sensor init prototype
39 typedef bool (*sensorReadFuncPtr)(int16_t *data); // sensor read and align prototype
40 typedef bool (*sensorInterruptFuncPtr)(void);
41 struct accDev_s;
42 typedef void (*sensorAccInitFuncPtr)(struct accDev_s *acc);
43 typedef bool (*sensorAccReadFuncPtr)(struct accDev_s *acc);
44 struct gyroDev_s;
45 typedef void (*sensorGyroInitFuncPtr)(struct gyroDev_s *gyro);
46 typedef bool (*sensorGyroReadFuncPtr)(struct gyroDev_s *gyro);
47 typedef bool (*sensorGyroUpdateFuncPtr)(struct gyroDev_s *gyro);
48 typedef bool (*sensorGyroReadDataFuncPtr)(struct gyroDev_s *gyro, int16_t *data);
49 typedef bool (*sensorGyroInterruptStatusFuncPtr)(struct gyroDev_s *gyro);
50 struct magDev_s;
51 typedef bool (*sensorMagInitFuncPtr)(struct magDev_s *mag);
52 typedef bool (*sensorMagReadFuncPtr)(struct magDev_s *mag);
53 struct temperatureDev_s;
54 typedef bool (*sensorTempReadFuncPtr)(struct temperatureDev_s *tempDev, int16_t *temperature);
55 struct opflowDev_s;
56 typedef bool (*sensorOpflowInitFuncPtr)(struct opflowDev_s *mag);
57 typedef bool (*sensorOpflowUpdateFuncPtr)(struct opflowDev_s *mag);