diff --git a/html/_adafruit___l_s_m9_d_s1_8h_source.html b/html/_adafruit___l_s_m9_d_s1_8h_source.html index 4b60427..44dd6da 100644 --- a/html/_adafruit___l_s_m9_d_s1_8h_source.html +++ b/html/_adafruit___l_s_m9_d_s1_8h_source.html @@ -62,43 +62,43 @@
Adafruit_LSM9DS1.h
-
1 /***************************************************************************
2  This is a library for the LSM9DS1 Accelerometer and magnentometer/compass
3 
4  Designed specifically to work with the Adafruit LSM9DS1 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 #ifndef __LSM9DS1_H__
16 #define __LSM9DS1_H__
17 
18 #include "Arduino.h"
19 #include <Adafruit_I2CDevice.h>
20 #include <Adafruit_LIS3MDL.h>
21 #include <Adafruit_SPIDevice.h>
22 #include <Adafruit_Sensor.h>
23 
24 #define LSM9DS1_ADDRESS_ACCELGYRO (0x6B)
25 #define LSM9DS1_ADDRESS_MAG (0x1E)
26 #define LSM9DS1_XG_ID (0b01101000)
27 
28 // Linear Acceleration: mg per LSB
29 #define LSM9DS1_ACCEL_MG_LSB_2G (0.061F)
30 #define LSM9DS1_ACCEL_MG_LSB_4G (0.122F)
31 #define LSM9DS1_ACCEL_MG_LSB_8G (0.244F)
32 #define LSM9DS1_ACCEL_MG_LSB_16G (0.732F)
33 
34 // Magnetic Field Strength: gauss range
35 #define LSM9DS1_MAG_MGAUSS_4GAUSS (0.14F)
36 #define LSM9DS1_MAG_MGAUSS_8GAUSS (0.29F)
37 #define LSM9DS1_MAG_MGAUSS_12GAUSS (0.43F)
38 #define LSM9DS1_MAG_MGAUSS_16GAUSS (0.58F)
39 
40 // Angular Rate: dps per LSB
41 #define LSM9DS1_GYRO_DPS_DIGIT_245DPS (0.00875F)
42 #define LSM9DS1_GYRO_DPS_DIGIT_500DPS (0.01750F)
43 #define LSM9DS1_GYRO_DPS_DIGIT_2000DPS (0.07000F)
44 
45 // Temperature: LSB per degree celsius
46 #define LSM9DS1_TEMP_LSB_DEGREE_CELSIUS (8) // 1°C = 8, 25° = 200, etc.
47 
48 #define MAGTYPE (true)
49 #define XGTYPE (false)
50 
51 /* Forward reference required for function pointers below. */
52 class Adafruit_LSM9DS1;
53 
54 /* Pointer to member functions for read, get event, and get sensor. These are
55  * used */
56 /* by the Adafruit_LSM9DS1::Sensor class to read and retrieve individual
57  * sensors. */
58 typedef void (Adafruit_LSM9DS1::*lsm9ds1_read_func)(void);
59 typedef void (Adafruit_LSM9DS1::*lsm9ds1_get_event_func)(sensors_event_t *,
60  uint32_t);
61 typedef void (Adafruit_LSM9DS1::*lsm9ds1_get_sensor_func)(sensor_t *);
62 
65 public:
66  Adafruit_LSM9DS1(int32_t sensorID = 0);
67  Adafruit_LSM9DS1(TwoWire *wireBus, int32_t sensorID = 0);
68  Adafruit_LSM9DS1(int8_t xmcs, int8_t gcs, int32_t sensorID = 0);
69  Adafruit_LSM9DS1(int8_t clk, int8_t miso, int8_t mosi, int8_t xmcs,
70  int8_t gcs, int32_t sensorID = 0);
71 
73  typedef enum {
74  LSM9DS1_REGISTER_WHO_AM_I_XG = 0x0F,
75  LSM9DS1_REGISTER_CTRL_REG1_G = 0x10,
76  LSM9DS1_REGISTER_CTRL_REG2_G = 0x11,
77  LSM9DS1_REGISTER_CTRL_REG3_G = 0x12,
78  LSM9DS1_REGISTER_TEMP_OUT_L = 0x15,
79  LSM9DS1_REGISTER_TEMP_OUT_H = 0x16,
80  LSM9DS1_REGISTER_STATUS_REG = 0x17,
81  LSM9DS1_REGISTER_OUT_X_L_G = 0x18,
82  LSM9DS1_REGISTER_OUT_X_H_G = 0x19,
83  LSM9DS1_REGISTER_OUT_Y_L_G = 0x1A,
84  LSM9DS1_REGISTER_OUT_Y_H_G = 0x1B,
85  LSM9DS1_REGISTER_OUT_Z_L_G = 0x1C,
86  LSM9DS1_REGISTER_OUT_Z_H_G = 0x1D,
87  LSM9DS1_REGISTER_CTRL_REG4 = 0x1E,
88  LSM9DS1_REGISTER_CTRL_REG5_XL = 0x1F,
89  LSM9DS1_REGISTER_CTRL_REG6_XL = 0x20,
90  LSM9DS1_REGISTER_CTRL_REG7_XL = 0x21,
91  LSM9DS1_REGISTER_CTRL_REG8 = 0x22,
92  LSM9DS1_REGISTER_CTRL_REG9 = 0x23,
93  LSM9DS1_REGISTER_CTRL_REG10 = 0x24,
94 
95  LSM9DS1_REGISTER_OUT_X_L_XL = 0x28,
96  LSM9DS1_REGISTER_OUT_X_H_XL = 0x29,
97  LSM9DS1_REGISTER_OUT_Y_L_XL = 0x2A,
98  LSM9DS1_REGISTER_OUT_Y_H_XL = 0x2B,
99  LSM9DS1_REGISTER_OUT_Z_L_XL = 0x2C,
100  LSM9DS1_REGISTER_OUT_Z_H_XL = 0x2D,
102 
104  typedef enum {
105  LSM9DS1_ACCELRANGE_2G = (0b00 << 3),
106  LSM9DS1_ACCELRANGE_16G = (0b01 << 3),
107  LSM9DS1_ACCELRANGE_4G = (0b10 << 3),
108  LSM9DS1_ACCELRANGE_8G = (0b11 << 3),
110 
112  typedef enum {
113  LSM9DS1_ACCELDATARATE_POWERDOWN = (0b0000 << 4),
114  LSM9DS1_ACCELDATARATE_3_125HZ = (0b0001 << 4),
115  LSM9DS1_ACCELDATARATE_6_25HZ = (0b0010 << 4),
116  LSM9DS1_ACCELDATARATE_12_5HZ = (0b0011 << 4),
117  LSM9DS1_ACCELDATARATE_25HZ = (0b0100 << 4),
118  LSM9DS1_ACCELDATARATE_50HZ = (0b0101 << 4),
119  LSM9DS1_ACCELDATARATE_100HZ = (0b0110 << 4),
120  LSM9DS1_ACCELDATARATE_200HZ = (0b0111 << 4),
121  LSM9DS1_ACCELDATARATE_400HZ = (0b1000 << 4),
122  LSM9DS1_ACCELDATARATE_800HZ = (0b1001 << 4),
123  LSM9DS1_ACCELDATARATE_1600HZ = (0b1010 << 4)
125 
127  typedef enum {
128  LSM9DS1_MAGGAIN_4GAUSS = (0b00 << 5), // +/- 4 gauss
129  LSM9DS1_MAGGAIN_8GAUSS = (0b01 << 5), // +/- 8 gauss
130  LSM9DS1_MAGGAIN_12GAUSS = (0b10 << 5), // +/- 12 gauss
131  LSM9DS1_MAGGAIN_16GAUSS = (0b11 << 5) // +/- 16 gauss
133 
135  typedef enum {
136  LSM9DS1_GYROSCALE_245DPS =
137  (0b00 << 3), // +/- 245 degrees per second rotation
138  LSM9DS1_GYROSCALE_500DPS =
139  (0b01 << 3), // +/- 500 degrees per second rotation
140  LSM9DS1_GYROSCALE_2000DPS =
141  (0b11 << 3) // +/- 2000 degrees per second rotation
143 
145  typedef struct vector_s {
146  float x;
147  float y;
148  float z;
149  } lsm9ds1Vector_t;
150 
156  int16_t temperature;
157 
158  bool begin(void);
159  void read(void);
160  void readAccel(void);
161  void readGyro(void);
162  void readMag(void);
163  void readTemp(void);
164 
165  void setupAccel(lsm9ds1AccelRange_t range);
166  void setupMag(lsm9ds1MagGain_t gain);
167  void setupGyro(lsm9ds1GyroScale_t scale);
168 
169  /* Adafruit Unified Sensor Functions (not standard yet ... the current base
170  * class only */
171  /* supports one sensor type, and we need to update the unified base class to
172  * support */
173  /* multiple sensors in a single driver, returning an array */
174  bool getEvent(sensors_event_t *accel, sensors_event_t *mag,
175  sensors_event_t *gyro, sensors_event_t *temp);
176  void getSensor(sensor_t *accel, sensor_t *mag, sensor_t *gyro,
177  sensor_t *temp);
178 
181  class Sensor : public Adafruit_Sensor {
182  public:
184  Sensor() {}
185 
188  Sensor(const Sensor &copy)
189  : _parent(copy._parent), _readFunc(copy._readFunc),
190  _eventFunc(copy._eventFunc), _sensorFunc(copy._sensorFunc) {}
191 
198  Sensor(Adafruit_LSM9DS1 *parent, lsm9ds1_read_func readFunc,
199  lsm9ds1_get_event_func eventFunc, lsm9ds1_get_sensor_func sensorFunc)
200  : _parent(parent), _readFunc(readFunc), _eventFunc(eventFunc),
201  _sensorFunc(sensorFunc) {}
202 
206  virtual bool getEvent(sensors_event_t *event) {
207  (_parent->*_readFunc)();
208  (_parent->*_eventFunc)(event, millis());
209  return true;
210  }
211 
214  virtual void getSensor(sensor_t *sensor) {
215  (_parent->*_sensorFunc)(sensor);
216  }
217 
218  private:
219  Adafruit_LSM9DS1 *_parent;
220  lsm9ds1_read_func _readFunc;
221  lsm9ds1_get_event_func _eventFunc;
222  lsm9ds1_get_sensor_func _sensorFunc;
223  };
224 
227  Sensor &getAccel(void) { return _accelSensor; }
230  Sensor &getGyro(void) { return _gyroSensor; }
233  Sensor &getTemp(void) { return _tempSensor; }
236  Adafruit_Sensor &getMag(void) { return _magSensor; }
237 
238 private:
239  Adafruit_I2CDevice *i2c_dev = NULL;
240  Adafruit_SPIDevice *spi_dev = NULL;
241  void write8(boolean type, byte reg, byte value);
242  byte read8(boolean type, byte reg);
243  byte readBuffer(boolean type, byte reg, byte len, uint8_t *buffer);
244  void initSensor(int32_t sensorID);
245 
246  TwoWire *_wire = NULL;
247  int8_t _csm, _csxg, _mosi, _miso, _clk;
248  float _accel_mg_lsb;
249  float _gyro_dps_digit;
250  int32_t _lsm9dso_sensorid_accel;
251  int32_t _lsm9dso_sensorid_gyro;
252  int32_t _lsm9dso_sensorid_temp;
253  Sensor _accelSensor;
254  Adafruit_LIS3MDL _magSensor;
255  Sensor _gyroSensor;
256  Sensor _tempSensor;
257 
258  /* Functions to get individual sensor measurements and metadata. */
259  /* Note that these functions will NOT update the sensor state before getting
260  */
261  /* a new reading. You MUST call read() manually to update the sensor state */
262  /* before calling these functions! */
263  void getAccelEvent(sensors_event_t *event, uint32_t timestamp);
264  void getMagEvent(sensors_event_t *event, uint32_t timestamp);
265  void getGyroEvent(sensors_event_t *event, uint32_t timestamp);
266  void getTempEvent(sensors_event_t *event, uint32_t timestamp);
267  void getAccelSensor(sensor_t *sensor);
268  void getMagSensor(sensor_t *sensor);
269  void getGyroSensor(sensor_t *sensor);
270  void getTempSensor(sensor_t *sensor);
271 };
272 
273 #endif
Definition: Adafruit_LSM9DS1.h:64
+
1 /***************************************************************************
2  This is a library for the LSM9DS1 Accelerometer and magnentometer/compass
3 
4  Designed specifically to work with the Adafruit LSM9DS1 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 #ifndef __LSM9DS1_H__
16 #define __LSM9DS1_H__
17 
18 #include "Arduino.h"
19 #include <Adafruit_I2CDevice.h>
20 #include <Adafruit_LIS3MDL.h>
21 #include <Adafruit_SPIDevice.h>
22 #include <Adafruit_Sensor.h>
23 
24 #define LSM9DS1_ADDRESS_ACCELGYRO (0x6B)
25 #define LSM9DS1_ADDRESS_MAG (0x1E)
26 #define LSM9DS1_XG_ID (0b01101000)
27 
28 // Linear Acceleration: mg per LSB
29 #define LSM9DS1_ACCEL_MG_LSB_2G (0.061F)
30 #define LSM9DS1_ACCEL_MG_LSB_4G (0.122F)
31 #define LSM9DS1_ACCEL_MG_LSB_8G (0.244F)
32 #define LSM9DS1_ACCEL_MG_LSB_16G (0.732F)
33 
34 // Magnetic Field Strength: gauss range
35 #define LSM9DS1_MAG_MGAUSS_4GAUSS (0.14F)
36 #define LSM9DS1_MAG_MGAUSS_8GAUSS (0.29F)
37 #define LSM9DS1_MAG_MGAUSS_12GAUSS (0.43F)
38 #define LSM9DS1_MAG_MGAUSS_16GAUSS (0.58F)
39 
40 // Angular Rate: dps per LSB
41 #define LSM9DS1_GYRO_DPS_DIGIT_245DPS (0.00875F)
42 #define LSM9DS1_GYRO_DPS_DIGIT_500DPS (0.01750F)
43 #define LSM9DS1_GYRO_DPS_DIGIT_2000DPS (0.07000F)
44 
45 // Temperature: LSB per degree celsius
46 #define LSM9DS1_TEMP_LSB_DEGREE_CELSIUS (8) // 1°C = 8, 25° = 200, etc.
47 
48 #define MAGTYPE (true)
49 #define XGTYPE (false)
50 
51 /* Forward reference required for function pointers below. */
52 class Adafruit_LSM9DS1;
53 
54 /* Pointer to member functions for read, get event, and get sensor. These are
55  * used */
56 /* by the Adafruit_LSM9DS1::Sensor class to read and retrieve individual
57  * sensors. */
58 typedef void (Adafruit_LSM9DS1::*lsm9ds1_read_func)(void);
59 typedef void (Adafruit_LSM9DS1::*lsm9ds1_get_event_func)(sensors_event_t *,
60  uint32_t);
61 typedef void (Adafruit_LSM9DS1::*lsm9ds1_get_sensor_func)(sensor_t *);
62 
65 public:
66  Adafruit_LSM9DS1(int32_t sensorID = 0);
67  Adafruit_LSM9DS1(TwoWire *wireBus, int32_t sensorID = 0);
68  Adafruit_LSM9DS1(int8_t xmcs, int8_t gcs, int32_t sensorID = 0);
69  Adafruit_LSM9DS1(int8_t clk, int8_t miso, int8_t mosi, int8_t xmcs,
70  int8_t gcs, int32_t sensorID = 0);
71 
73  typedef enum {
74  LSM9DS1_REGISTER_WHO_AM_I_XG = 0x0F,
75  LSM9DS1_REGISTER_CTRL_REG1_G = 0x10,
76  LSM9DS1_REGISTER_CTRL_REG2_G = 0x11,
77  LSM9DS1_REGISTER_CTRL_REG3_G = 0x12,
78  LSM9DS1_REGISTER_TEMP_OUT_L = 0x15,
79  LSM9DS1_REGISTER_TEMP_OUT_H = 0x16,
80  LSM9DS1_REGISTER_STATUS_REG = 0x17,
81  LSM9DS1_REGISTER_OUT_X_L_G = 0x18,
82  LSM9DS1_REGISTER_OUT_X_H_G = 0x19,
83  LSM9DS1_REGISTER_OUT_Y_L_G = 0x1A,
84  LSM9DS1_REGISTER_OUT_Y_H_G = 0x1B,
85  LSM9DS1_REGISTER_OUT_Z_L_G = 0x1C,
86  LSM9DS1_REGISTER_OUT_Z_H_G = 0x1D,
87  LSM9DS1_REGISTER_CTRL_REG4 = 0x1E,
88  LSM9DS1_REGISTER_CTRL_REG5_XL = 0x1F,
89  LSM9DS1_REGISTER_CTRL_REG6_XL = 0x20,
90  LSM9DS1_REGISTER_CTRL_REG7_XL = 0x21,
91  LSM9DS1_REGISTER_CTRL_REG8 = 0x22,
92  LSM9DS1_REGISTER_CTRL_REG9 = 0x23,
93  LSM9DS1_REGISTER_CTRL_REG10 = 0x24,
94 
95  LSM9DS1_REGISTER_OUT_X_L_XL = 0x28,
96  LSM9DS1_REGISTER_OUT_X_H_XL = 0x29,
97  LSM9DS1_REGISTER_OUT_Y_L_XL = 0x2A,
98  LSM9DS1_REGISTER_OUT_Y_H_XL = 0x2B,
99  LSM9DS1_REGISTER_OUT_Z_L_XL = 0x2C,
100  LSM9DS1_REGISTER_OUT_Z_H_XL = 0x2D,
102 
104  typedef enum {
105  LSM9DS1_ACCELRANGE_2G = (0b00 << 3),
106  LSM9DS1_ACCELRANGE_16G = (0b01 << 3),
107  LSM9DS1_ACCELRANGE_4G = (0b10 << 3),
108  LSM9DS1_ACCELRANGE_8G = (0b11 << 3),
110 
112  typedef enum {
113  LSM9DS1_ACCELDATARATE_POWERDOWN = (0b0000 << 4),
114 
115  LSM9DS1_ACCELDATARATE_10HZ = (0b001 << 5),
116  LSM9DS1_ACCELDATARATE_50HZ = (0b010 << 5),
117  LSM9DS1_ACCELDATARATE_119HZ = (0b011 << 5),
118  LSM9DS1_ACCELDATARATE_238HZ = (0b100 << 5),
119  LSM9DS1_ACCELDATARATE_476HZ = (0b101 << 5),
120  LSM9DS1_ACCELDATARATE_952HZ = (0b110 << 5),
122 
124  typedef enum {
125  LSM9DS1_MAGGAIN_4GAUSS = (0b00 << 5), // +/- 4 gauss
126  LSM9DS1_MAGGAIN_8GAUSS = (0b01 << 5), // +/- 8 gauss
127  LSM9DS1_MAGGAIN_12GAUSS = (0b10 << 5), // +/- 12 gauss
128  LSM9DS1_MAGGAIN_16GAUSS = (0b11 << 5) // +/- 16 gauss
130 
132  typedef enum {
133  LSM9DS1_GYROSCALE_245DPS =
134  (0b00 << 3), // +/- 245 degrees per second rotation
135  LSM9DS1_GYROSCALE_500DPS =
136  (0b01 << 3), // +/- 500 degrees per second rotation
137  LSM9DS1_GYROSCALE_2000DPS =
138  (0b11 << 3) // +/- 2000 degrees per second rotation
140 
142  typedef struct vector_s {
143  float x;
144  float y;
145  float z;
146  } lsm9ds1Vector_t;
147 
153  int16_t temperature;
154 
155  bool begin(void);
156  void read(void);
157  void readAccel(void);
158  void readGyro(void);
159  void readMag(void);
160  void readTemp(void);
161 
163  void setupMag(lsm9ds1MagGain_t gain);
164  void setupGyro(lsm9ds1GyroScale_t scale);
165 
166  /* Adafruit Unified Sensor Functions (not standard yet ... the current base
167  * class only */
168  /* supports one sensor type, and we need to update the unified base class to
169  * support */
170  /* multiple sensors in a single driver, returning an array */
171  bool getEvent(sensors_event_t *accel, sensors_event_t *mag,
172  sensors_event_t *gyro, sensors_event_t *temp);
173  void getSensor(sensor_t *accel, sensor_t *mag, sensor_t *gyro,
174  sensor_t *temp);
175 
178  class Sensor : public Adafruit_Sensor {
179  public:
181  Sensor() {}
182 
185  Sensor(const Sensor &copy)
186  : _parent(copy._parent), _readFunc(copy._readFunc),
187  _eventFunc(copy._eventFunc), _sensorFunc(copy._sensorFunc) {}
188 
195  Sensor(Adafruit_LSM9DS1 *parent, lsm9ds1_read_func readFunc,
196  lsm9ds1_get_event_func eventFunc, lsm9ds1_get_sensor_func sensorFunc)
197  : _parent(parent), _readFunc(readFunc), _eventFunc(eventFunc),
198  _sensorFunc(sensorFunc) {}
199 
203  virtual bool getEvent(sensors_event_t *event) {
204  (_parent->*_readFunc)();
205  (_parent->*_eventFunc)(event, millis());
206  return true;
207  }
208 
211  virtual void getSensor(sensor_t *sensor) {
212  (_parent->*_sensorFunc)(sensor);
213  }
214 
215  private:
216  Adafruit_LSM9DS1 *_parent;
217  lsm9ds1_read_func _readFunc;
218  lsm9ds1_get_event_func _eventFunc;
219  lsm9ds1_get_sensor_func _sensorFunc;
220  };
221 
224  Sensor &getAccel(void) { return _accelSensor; }
227  Sensor &getGyro(void) { return _gyroSensor; }
230  Sensor &getTemp(void) { return _tempSensor; }
233  Adafruit_Sensor &getMag(void) { return _magSensor; }
234 
235 private:
236  Adafruit_I2CDevice *i2c_dev = NULL;
237  Adafruit_SPIDevice *spi_dev = NULL;
238  void write8(boolean type, byte reg, byte value);
239  byte read8(boolean type, byte reg);
240  byte readBuffer(boolean type, byte reg, byte len, uint8_t *buffer);
241  void initSensor(int32_t sensorID);
242 
243  TwoWire *_wire = NULL;
244  int8_t _csm, _csxg, _mosi, _miso, _clk;
245  float _accel_mg_lsb;
246  float _gyro_dps_digit;
247  int32_t _lsm9dso_sensorid_accel;
248  int32_t _lsm9dso_sensorid_gyro;
249  int32_t _lsm9dso_sensorid_temp;
250  Sensor _accelSensor;
251  Adafruit_LIS3MDL _magSensor;
252  Sensor _gyroSensor;
253  Sensor _tempSensor;
254 
255  /* Functions to get individual sensor measurements and metadata. */
256  /* Note that these functions will NOT update the sensor state before getting
257  */
258  /* a new reading. You MUST call read() manually to update the sensor state */
259  /* before calling these functions! */
260  void getAccelEvent(sensors_event_t *event, uint32_t timestamp);
261  void getMagEvent(sensors_event_t *event, uint32_t timestamp);
262  void getGyroEvent(sensors_event_t *event, uint32_t timestamp);
263  void getTempEvent(sensors_event_t *event, uint32_t timestamp);
264  void getAccelSensor(sensor_t *sensor);
265  void getMagSensor(sensor_t *sensor);
266  void getGyroSensor(sensor_t *sensor);
267  void getTempSensor(sensor_t *sensor);
268 };
269 
270 #endif
Definition: Adafruit_LSM9DS1.h:64
void readGyro(void)
Read the sensor gyroscope sensor component.
Definition: Adafruit_LSM9DS1.cpp:208
-
void setupAccel(lsm9ds1AccelRange_t range)
Configure the accelerometer ranging.
Definition: Adafruit_LSM9DS1.cpp:259
-
Sensor(const Sensor &copy)
Instantiate based on existing sensor.
Definition: Adafruit_LSM9DS1.h:188
-
lsm9ds1GyroScale_t
Definition: Adafruit_LSM9DS1.h:135
-
virtual void getSensor(sensor_t *sensor)
Get sensor metadata - type and range information.
Definition: Adafruit_LSM9DS1.h:214
-
Sensor(Adafruit_LSM9DS1 *parent, lsm9ds1_read_func readFunc, lsm9ds1_get_event_func eventFunc, lsm9ds1_get_sensor_func sensorFunc)
Instantiate based on existing sensor.
Definition: Adafruit_LSM9DS1.h:198
-
bool getEvent(sensors_event_t *accel, sensors_event_t *mag, sensors_event_t *gyro, sensors_event_t *temp)
Gets the most recent accel sensor events for all 4 sensors.
Definition: Adafruit_LSM9DS1.cpp:349
+
Sensor(const Sensor &copy)
Instantiate based on existing sensor.
Definition: Adafruit_LSM9DS1.h:185
+
lsm9ds1GyroScale_t
Definition: Adafruit_LSM9DS1.h:132
+
virtual void getSensor(sensor_t *sensor)
Get sensor metadata - type and range information.
Definition: Adafruit_LSM9DS1.h:211
+
Sensor(Adafruit_LSM9DS1 *parent, lsm9ds1_read_func readFunc, lsm9ds1_get_event_func eventFunc, lsm9ds1_get_sensor_func sensorFunc)
Instantiate based on existing sensor.
Definition: Adafruit_LSM9DS1.h:195
+
bool getEvent(sensors_event_t *accel, sensors_event_t *mag, sensors_event_t *gyro, sensors_event_t *temp)
Gets the most recent accel sensor events for all 4 sensors.
Definition: Adafruit_LSM9DS1.cpp:353
void readTemp(void)
Read the sensor temperature sensor component.
Definition: Adafruit_LSM9DS1.cpp:238
-
float x
X component.
Definition: Adafruit_LSM9DS1.h:146
-
lsm9ds1Vector_t magData
Last read magnetometer data will be available here.
Definition: Adafruit_LSM9DS1.h:155
+
float x
X component.
Definition: Adafruit_LSM9DS1.h:143
+
lsm9ds1Vector_t magData
Last read magnetometer data will be available here.
Definition: Adafruit_LSM9DS1.h:152
bool begin(void)
Initialize I2C or SPI and detect/initialize subsensors.
Definition: Adafruit_LSM9DS1.cpp:88
void readMag(void)
Read the sensor magnetometer sensor component.
Definition: Adafruit_LSM9DS1.cpp:167
-
lm9ds1AccelDataRate_t
Definition: Adafruit_LSM9DS1.h:112
-
Sensor & getTemp(void)
Return Adafruit_Sensor compatible interface for temperature.
Definition: Adafruit_LSM9DS1.h:233
+
Sensor & getTemp(void)
Return Adafruit_Sensor compatible interface for temperature.
Definition: Adafruit_LSM9DS1.h:230
Adafruit_LSM9DS1(int32_t sensorID=0)
Instantiate with default hardware I2C interface.
Definition: Adafruit_LSM9DS1.cpp:39
void readAccel(void)
Read the sensor accelerometer sensor component.
Definition: Adafruit_LSM9DS1.cpp:179
void read(void)
Read all four sensor subcomponents.
Definition: Adafruit_LSM9DS1.cpp:154
-
Definition: Adafruit_LSM9DS1.h:145
+
Definition: Adafruit_LSM9DS1.h:142
lsm9ds1AccGyroRegisters_t
Definition: Adafruit_LSM9DS1.h:73
-
void getSensor(sensor_t *accel, sensor_t *mag, sensor_t *gyro, sensor_t *temp)
Gets the sensor_t data for all 4 sub-sensors at once call.
Definition: Adafruit_LSM9DS1.cpp:380
-
lsm9ds1Vector_t accelData
Last read accelerometer data will be available here.
Definition: Adafruit_LSM9DS1.h:152
-
lsm9ds1Vector_t gyroData
Last read gyroscope data will be available here.
Definition: Adafruit_LSM9DS1.h:153
+
void getSensor(sensor_t *accel, sensor_t *mag, sensor_t *gyro, sensor_t *temp)
Gets the sensor_t data for all 4 sub-sensors at once call.
Definition: Adafruit_LSM9DS1.cpp:384
+
lsm9ds1Vector_t accelData
Last read accelerometer data will be available here.
Definition: Adafruit_LSM9DS1.h:149
+
lsm9ds1Vector_t gyroData
Last read gyroscope data will be available here.
Definition: Adafruit_LSM9DS1.h:150
struct Adafruit_LSM9DS1::vector_s lsm9ds1Vector_t
lsm9ds1AccelRange_t
Definition: Adafruit_LSM9DS1.h:104
-
Definition: Adafruit_LSM9DS1.h:181
-
Sensor()
Basic instatiator.
Definition: Adafruit_LSM9DS1.h:184
-
void setupMag(lsm9ds1MagGain_t gain)
Configure the magnetometer gain.
Definition: Adafruit_LSM9DS1.cpp:289
-
Sensor & getGyro(void)
Return Adafruit_Sensor compatible interface for gyroscope.
Definition: Adafruit_LSM9DS1.h:230
-
void setupGyro(lsm9ds1GyroScale_t scale)
Configure the gyroscope scaling.
Definition: Adafruit_LSM9DS1.cpp:313
-
virtual bool getEvent(sensors_event_t *event)
Get sensor event data.
Definition: Adafruit_LSM9DS1.h:206
-
float z
Z component.
Definition: Adafruit_LSM9DS1.h:148
-
float y
Y component.
Definition: Adafruit_LSM9DS1.h:147
-
Sensor & getAccel(void)
Return Adafruit_Sensor compatible interface for accelerometer.
Definition: Adafruit_LSM9DS1.h:227
-
lsm9ds1MagGain_t
Definition: Adafruit_LSM9DS1.h:127
-
Adafruit_Sensor & getMag(void)
Return Adafruit_Sensor compatible interface for magnetometer.
Definition: Adafruit_LSM9DS1.h:236
-
int16_t temperature
Last read temperzture data will be available here.
Definition: Adafruit_LSM9DS1.h:156
+
Definition: Adafruit_LSM9DS1.h:178
+
Sensor()
Basic instatiator.
Definition: Adafruit_LSM9DS1.h:181
+
void setupMag(lsm9ds1MagGain_t gain)
Configure the magnetometer gain.
Definition: Adafruit_LSM9DS1.cpp:293
+
Sensor & getGyro(void)
Return Adafruit_Sensor compatible interface for gyroscope.
Definition: Adafruit_LSM9DS1.h:227
+
void setupGyro(lsm9ds1GyroScale_t scale)
Configure the gyroscope scaling.
Definition: Adafruit_LSM9DS1.cpp:317
+
virtual bool getEvent(sensors_event_t *event)
Get sensor event data.
Definition: Adafruit_LSM9DS1.h:203
+
lsm9ds1AccelDataRate_t
Definition: Adafruit_LSM9DS1.h:112
+
float z
Z component.
Definition: Adafruit_LSM9DS1.h:145
+
float y
Y component.
Definition: Adafruit_LSM9DS1.h:144
+
Sensor & getAccel(void)
Return Adafruit_Sensor compatible interface for accelerometer.
Definition: Adafruit_LSM9DS1.h:224
+
lsm9ds1MagGain_t
Definition: Adafruit_LSM9DS1.h:124
+
Adafruit_Sensor & getMag(void)
Return Adafruit_Sensor compatible interface for magnetometer.
Definition: Adafruit_LSM9DS1.h:233
+
void setupAccel(lsm9ds1AccelRange_t range, lsm9ds1AccelDataRate_t rate)
Configure the accelerometer ranging.
Definition: Adafruit_LSM9DS1.cpp:262
+
int16_t temperature
Last read temperzture data will be available here.
Definition: Adafruit_LSM9DS1.h:153