PX4 Firmware
PX4 Autopilot Software http://px4.io
drv_sensor.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright (c) 2012-2017 PX4 Development Team. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  * 3. Neither the name PX4 nor the names of its contributors may be
16  * used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  ****************************************************************************/
33 
34 /**
35  * @file drv_sensor.h
36  *
37  * Common sensor API and ioctl definitions.
38  */
39 
40 #ifndef _DRV_SENSOR_H
41 #define _DRV_SENSOR_H
42 
43 #include <px4_platform_common/defines.h>
44 #include <stdint.h>
45 #include <sys/ioctl.h>
46 
47 #include "drv_device.h"
48 
49 /**
50  * Sensor type definitions.
51  *
52  * Used to create a unique device id for redundant and combo sensors
53  */
54 
55 #define DRV_MAG_DEVTYPE_HMC5883 0x01
56 #define DRV_MAG_DEVTYPE_LSM303D 0x02
57 #define DRV_MAG_DEVTYPE_MAGSIM 0x03
58 #define DRV_MAG_DEVTYPE_MPU9250 0x04
59 #define DRV_MAG_DEVTYPE_LIS3MDL 0x05
60 #define DRV_MAG_DEVTYPE_IST8310 0x06
61 #define DRV_MAG_DEVTYPE_RM3100 0x07
62 #define DRV_MAG_DEVTYPE_QMC5883 0x08
63 #define DRV_MAG_DEVTYPE_AK09916 0x09
64 #define DRV_DEVTYPE_ICM20948 0x0A
65 #define DRV_ACC_DEVTYPE_LSM303D 0x11
66 #define DRV_ACC_DEVTYPE_BMA180 0x12
67 #define DRV_ACC_DEVTYPE_MPU6000 0x13
68 #define DRV_ACC_DEVTYPE_ACCELSIM 0x14
69 #define DRV_ACC_DEVTYPE_MPU9250 0x16
70 #define DRV_ACC_DEVTYPE_BMI160 0x17
71 #define DRV_GYR_DEVTYPE_MPU6000 0x21
72 #define DRV_GYR_DEVTYPE_L3GD20 0x22
73 #define DRV_GYR_DEVTYPE_GYROSIM 0x23
74 #define DRV_GYR_DEVTYPE_MPU9250 0x24
75 #define DRV_GYR_DEVTYPE_BMI160 0x25
76 #define DRV_RNG_DEVTYPE_MB12XX 0x31
77 #define DRV_RNG_DEVTYPE_LL40LS 0x32
78 #define DRV_ACC_DEVTYPE_MPU6050 0x33
79 #define DRV_ACC_DEVTYPE_MPU6500 0x34
80 #define DRV_GYR_DEVTYPE_MPU6050 0x35
81 #define DRV_GYR_DEVTYPE_MPU6500 0x36
82 #define DRV_ACC_DEVTYPE_ICM20602 0x37
83 #define DRV_GYR_DEVTYPE_ICM20602 0x38
84 #define DRV_ACC_DEVTYPE_ICM20608 0x39
85 #define DRV_GYR_DEVTYPE_ICM20608 0x3A
86 #define DRV_ACC_DEVTYPE_ICM20689 0x3B
87 #define DRV_GYR_DEVTYPE_ICM20689 0x3C
88 #define DRV_BARO_DEVTYPE_MS5611 0x3D
89 #define DRV_BARO_DEVTYPE_MS5607 0x3E
90 #define DRV_BARO_DEVTYPE_BMP280 0x3F
91 #define DRV_BARO_DEVTYPE_LPS25H 0x40
92 #define DRV_ACC_DEVTYPE_BMI055 0x41
93 #define DRV_GYR_DEVTYPE_BMI055 0x42
94 #define DRV_MAG_DEVTYPE_BMM150 0x43
95 #define DRV_BARO_DEVTYPE_BMP285 0x44
96 #define DRV_DIFF_PRESS_DEVTYPE_ETS3 0x45
97 #define DRV_DIFF_PRESS_DEVTYPE_MS4525 0x46
98 #define DRV_DIFF_PRESS_DEVTYPE_MS5525 0x47
99 #define DRV_DIFF_PRESS_DEVTYPE_SDP31 0x48
100 #define DRV_DIFF_PRESS_DEVTYPE_SDP32 0x49
101 #define DRV_DIFF_PRESS_DEVTYPE_SDP33 0x50
102 #define DRV_BARO_DEVTYPE_MPL3115A2 0x51
103 #define DRV_ACC_DEVTYPE_FXOS8701C 0x52
104 
105 #define DRV_GYR_DEVTYPE_FXAS2100C 0x54
106 #define DRV_ACC_DEVTYPE_ADIS16448 0x55
107 #define DRV_MAG_DEVTYPE_ADIS16448 0x56
108 #define DRV_GYR_DEVTYPE_ADIS16448 0x57
109 #define DRV_BARO_DEVTYPE_LPS22HB 0x58
110 #define DRV_ACC_DEVTYPE_ADIS16477 0x59
111 #define DRV_GYR_DEVTYPE_ADIS16477 0x60
112 #define DRV_ACC_DEVTYPE_LSM303AGR 0x61
113 #define DRV_MAG_DEVTYPE_LSM303AGR 0x62
114 #define DRV_ACC_DEVTYPE_ADIS16497 0x63
115 #define DRV_GYR_DEVTYPE_ADIS16497 0x64
116 #define DRV_BARO_DEVTYPE_BAROSIM 0x65
117 #define DRV_DEVTYPE_BMI088 0x66
118 #define DRV_DEVTYPE_BMP388 0x67
119 
120 /*
121  * ioctl() definitions
122  *
123  * Note that a driver may not implement all of these operations, but
124  * if the operation is implemented it should conform to this API.
125  */
126 
127 #define _SENSORIOCBASE (0x2000)
128 #define _SENSORIOC(_n) (_PX4_IOC(_SENSORIOCBASE, _n))
129 
130 /**
131  * Set the driver polling rate to (arg) Hz, or one of the SENSOR_POLLRATE
132  * constants
133  */
134 #define SENSORIOCSPOLLRATE _SENSORIOC(0)
135 
136 #define SENSOR_POLLRATE_DEFAULT 1000003 /**< poll at driver normal rate */
137 
138 /**
139  * Reset the sensor to its default configuration
140  */
141 #define SENSORIOCRESET _SENSORIOC(4)
142 
143 #endif /* _DRV_SENSOR_H */
Generic device / sensor interface.