1
- /* **************************************************************************
2
- This is a library for the LSM9DS0 Accelerometer and magnentometer/compass
1
+ /* !
2
+ * @file Adafruit_LSM9DS0.h
3
+ *
4
+ */
3
5
4
- Designed specifically to work with the Adafruit LSM9DS0 Breakouts
5
-
6
- These sensors use I2C to communicate, 2 pins are required to interface.
7
-
8
- Adafruit invests time and resources providing this open source code,
9
- please support Adafruit andopen-source hardware by purchasing products
10
- from Adafruit!
11
-
12
- Written by Kevin Townsend for Adafruit Industries.
13
- BSD license, all text above must be included in any redistribution
14
- ***************************************************************************/
15
6
#ifndef __LSM9DS0_H__
16
7
#define __LSM9DS0_H__
17
8
24
15
#include < Adafruit_Sensor.h>
25
16
#include < SPI.h>
26
17
27
- #define LSM9DS0_ADDRESS_ACCELMAG (0x1D ) // 3B >> 1 = 7bit default
28
- #define LSM9DS0_ADDRESS_GYRO (0x6B ) // D6 >> 1 = 7bit default
29
- #define LSM9DS0_XM_ID (0b01001001 )
30
- #define LSM9DS0_G_ID (0b11010100 )
18
+ #define LSM9DS0_ADDRESS_ACCELMAG (0x1D ) // !< 3B >> 1 = 7bit default
19
+ #define LSM9DS0_ADDRESS_GYRO (0x6B ) // !< D6 >> 1 = 7bit default
20
+ #define LSM9DS0_XM_ID \
21
+ (0b01001001 ) // !< Accelerometer & magnetometer ID register, WHO_AM_I_XM
22
+ #define LSM9DS0_G_ID (0b11010100 ) // !< Gyroscope ID register, WHO_AM_I_G
31
23
32
24
// Linear Acceleration: mg per LSB
33
- #define LSM9DS0_ACCEL_MG_LSB_2G (0 .061F )
34
- #define LSM9DS0_ACCEL_MG_LSB_4G (0 .122F )
35
- #define LSM9DS0_ACCEL_MG_LSB_6G (0 .183F )
36
- #define LSM9DS0_ACCEL_MG_LSB_8G (0 .244F )
37
- #define LSM9DS0_ACCEL_MG_LSB_16G (0 .732F ) // Is this right? Was expecting 0.488F
25
+ #define LSM9DS0_ACCEL_MG_LSB_2G \
26
+ (0 .061F ) // !< Linear acceleration sensitivity FS=+-2g
27
+ #define LSM9DS0_ACCEL_MG_LSB_4G \
28
+ (0 .122F ) // !< Linear acceleration sensitivity FS=+-4g
29
+
30
+ #define LSM9DS0_ACCEL_MG_LSB_6G \
31
+ (0 .183F ) // !< Linear acceleration sensitivity FS=+-6g
32
+ #define LSM9DS0_ACCEL_MG_LSB_8G \
33
+ (0 .244F ) // !< Linear acceleration sensitivity FS=+-8g
34
+ #define LSM9DS0_ACCEL_MG_LSB_16G \
35
+ (0 .732F ) // !< Linear acceleration sensitivity FS=+-16g
38
36
39
37
// Magnetic Field Strength: gauss range
40
- #define LSM9DS0_MAG_MGAUSS_2GAUSS (0 .08F )
41
- #define LSM9DS0_MAG_MGAUSS_4GAUSS (0 .16F )
42
- #define LSM9DS0_MAG_MGAUSS_8GAUSS (0 .32F )
43
- #define LSM9DS0_MAG_MGAUSS_12GAUSS (0 .48F )
38
+ #define LSM9DS0_MAG_MGAUSS_2GAUSS (0 .08F ) // !< Magnetic sensitivity FS=+-2 gauss
39
+ #define LSM9DS0_MAG_MGAUSS_4GAUSS (0 .16F ) // !< Magnetic sensitivity FS=+-4 gauss
40
+ #define LSM9DS0_MAG_MGAUSS_8GAUSS (0 .32F ) // !< Magnetic sensitivity FS=+-8 gauss
41
+ #define LSM9DS0_MAG_MGAUSS_12GAUSS \
42
+ (0 .48F ) // !< Magnetic sensitivity FS=+-12 gauss
44
43
45
44
// Angular Rate: dps per LSB
46
- #define LSM9DS0_GYRO_DPS_DIGIT_245DPS (0 .00875F )
47
- #define LSM9DS0_GYRO_DPS_DIGIT_500DPS (0 .01750F )
48
- #define LSM9DS0_GYRO_DPS_DIGIT_2000DPS (0 .07000F )
45
+ #define LSM9DS0_GYRO_DPS_DIGIT_245DPS \
46
+ (0 .00875F ) // !< Angular rate sensitivity FS=+-245dps
47
+ #define LSM9DS0_GYRO_DPS_DIGIT_500DPS \
48
+ (0 .01750F ) // !< Angular rate sensitivity FS=+-500dps
49
+ #define LSM9DS0_GYRO_DPS_DIGIT_2000DPS \
50
+ (0 .07000F ) // !< Angular rate sensitivity FS=+-2000dps
49
51
50
52
// Temperature: LSB per degree celsius
51
- #define LSM9DS0_TEMP_LSB_DEGREE_CELSIUS (8 ) // 1°C = 8, 25° = 200, etc.
53
+ #define LSM9DS0_TEMP_LSB_DEGREE_CELSIUS \
54
+ (8 ) // !< Temperature sensor output change vs. temperature. 1°C = 8, 25° = 200,
55
+ // !< etc.
52
56
53
- #define GYROTYPE (true )
54
- #define XMTYPE (false )
57
+ #define GYROTYPE (true ) // !< Used to enable gyroscope device
58
+ #define XMTYPE (false ) // !< Used to enable accellerometer & magnetometer device
55
59
56
60
/* Forward reference required for function pointers below. */
57
61
class Adafruit_LSM9DS0 ;
@@ -60,10 +64,15 @@ class Adafruit_LSM9DS0;
60
64
* used */
61
65
/* by the Adafruit_LSM9DS0::Sensor class to read and retrieve individual
62
66
* sensors. */
63
- typedef void (Adafruit_LSM9DS0::*lsm9ds0_read_func)(void );
64
- typedef void (Adafruit_LSM9DS0::*lsm9ds0_get_event_func)(sensors_event_t *,
65
- uint32_t );
66
- typedef void (Adafruit_LSM9DS0::*lsm9ds0_get_sensor_func)(sensor_t *);
67
+ typedef void (Adafruit_LSM9DS0::*lsm9ds0_read_func)(
68
+ void ); // !< Pointer to member functions to read. Used by
69
+ // !< Adafruit_LSM9DS0::Sensor class.
70
+ typedef void (Adafruit_LSM9DS0::*lsm9ds0_get_event_func)(
71
+ sensors_event_t *, uint32_t ); // !< Pointer to member functions to get event.
72
+ // !< Used by Adafruit_LSM9DS0::Sensor class.
73
+ typedef void (Adafruit_LSM9DS0::*lsm9ds0_get_sensor_func)(
74
+ sensor_t *); // !< Pointer to member functions to get sensor function. Used
75
+ // !< by Adafruit_LSM9DS0::Sensor class.
67
76
68
77
/* *! Interface object for LSM9DS0 9-DoF sensor */
69
78
class Adafruit_LSM9DS0 {
0 commit comments