14 #ifndef _ADAFRUIT_LSM6DS_H 15 #define _ADAFRUIT_LSM6DS_H 18 #include <Adafruit_BusIO_Register.h> 19 #include <Adafruit_I2CDevice.h> 20 #include <Adafruit_Sensor.h> 23 #define LSM6DS_I2CADDR_DEFAULT 0x6A 25 #define LSM6DS_FUNC_CFG_ACCESS 0x1 26 #define LSM6DS_INT1_CTRL 0x0D 27 #define LSM6DS_INT2_CTRL 0x0E 28 #define LSM6DS_WHOAMI 0x0F 29 #define LSM6DS_CTRL1_XL 0x10 30 #define LSM6DS_CTRL2_G 0x11 31 #define LSM6DS_CTRL3_C 0x12 32 #define LSM6DS_CTRL8_XL 0x17 33 #define LSM6DS_CTRL10_C 0x19 34 #define LSM6DS_WAKEUP_SRC 0x1B 35 #define LSM6DS_STATUS_REG 0X1E 36 #define LSM6DS_OUT_TEMP_L 0x20 37 #define LSM6DS_OUTX_L_G 0x22 38 #define LSM6DS_OUTX_L_A 0x28 39 #define LSM6DS_STEPCOUNTER 0x4B 40 #define LSM6DS_TAP_CFG 0x58 41 #define LSM6DS_WAKEUP_THS \ 43 #define LSM6DS_WAKEUP_DUR \ 45 #define LSM6DS_MD1_CFG 0x5E 64 LSM6DS_ACCEL_RANGE_2_G,
65 LSM6DS_ACCEL_RANGE_16_G,
66 LSM6DS_ACCEL_RANGE_4_G,
67 LSM6DS_ACCEL_RANGE_8_G
72 LSM6DS_GYRO_RANGE_125_DPS = 0b0010,
73 LSM6DS_GYRO_RANGE_250_DPS = 0b0000,
74 LSM6DS_GYRO_RANGE_500_DPS = 0b0100,
75 LSM6DS_GYRO_RANGE_1000_DPS = 0b1000,
76 LSM6DS_GYRO_RANGE_2000_DPS = 0b1100,
77 ISM330DHCX_GYRO_RANGE_4000_DPS = 0b0001
82 LSM6DS_HPF_ODR_DIV_50 = 0,
83 LSM6DS_HPF_ODR_DIV_100 = 1,
84 LSM6DS_HPF_ODR_DIV_9 = 2,
85 LSM6DS_HPF_ODR_DIV_400 = 3,
100 int _sensorID = 0x6D0;
117 int _sensorID = 0x6D1;
131 int _sensorID = 0x6D2;
146 TwoWire *wire = &Wire, int32_t sensorID = 0);
148 bool begin_SPI(uint8_t cs_pin, SPIClass *theSPI = &SPI, int32_t sensorID = 0,
149 uint32_t frequency = 1000000);
150 bool begin_SPI(int8_t cs_pin, int8_t sck_pin, int8_t miso_pin,
151 int8_t mosi_pin, int32_t sensorID = 0,
152 uint32_t frequency = 1000000);
154 bool getEvent(sensors_event_t *accel, sensors_event_t *gyro,
155 sensors_event_t *temp);
170 void configIntOutputs(
bool active_low,
bool open_drain);
171 void configInt1(
bool drdy_temp,
bool drdy_g,
bool drdy_xl,
172 bool step_detect =
false,
bool wakeup =
false);
173 void configInt2(
bool drdy_temp,
bool drdy_g,
bool drdy_xl);
176 void enableWakeup(
bool enable, uint8_t duration = 0, uint8_t thresh = 20);
180 void enablePedometer(
bool enable);
181 void resetPedometer(
void);
182 uint16_t readPedometer(
void);
185 int readAcceleration(
float &x,
float &y,
float &z);
186 float accelerationSampleRate(
void);
187 int accelerationAvailable(
void);
189 int readGyroscope(
float &x,
float &y,
float &z);
190 float gyroscopeSampleRate(
void);
191 int gyroscopeAvailable(
void);
209 Adafruit_Sensor *getTemperatureSensor(
void);
210 Adafruit_Sensor *getAccelerometerSensor(
void);
211 Adafruit_Sensor *getGyroSensor(
void);
214 uint8_t chipID(
void);
215 uint8_t status(
void);
216 virtual void _read(
void);
217 virtual bool _init(int32_t sensor_id);
219 uint16_t _sensorid_accel,
223 Adafruit_I2CDevice *i2c_dev = NULL;
224 Adafruit_SPIDevice *spi_dev = NULL;
226 float temperature_sensitivity =
247 void fillTempEvent(sensors_event_t *temp, uint32_t timestamp);
248 void fillAccelEvent(sensors_event_t *accel, uint32_t timestamp);
249 void fillGyroEvent(sensors_event_t *gyro, uint32_t timestamp);
gyro_range
Definition: Adafruit_LSM6DS.h:71
enum data_rate lsm6ds_data_rate_t
float temperature
Last reading's temperature (C)
Definition: Adafruit_LSM6DS.h:201
uint16_t _sensorid_temp
ID number for temperature.
Definition: Adafruit_LSM6DS.h:219
Definition: Adafruit_LSM6DS.h:105
bool getEvent(sensors_event_t *)
Gets the temperature as a standard sensor event.
Definition: Adafruit_LSM6DS.cpp:682
enum gyro_range lsm6ds_gyro_range_t
enum accel_range lsm6ds_accel_range_t
int16_t rawTemp
Last reading's raw temperature reading.
Definition: Adafruit_LSM6DS.h:193
accel_range
Definition: Adafruit_LSM6DS.h:63
enum hpf_range lsm6ds_hp_filter_t
Adafruit_LSM6DS_Gyro(Adafruit_LSM6DS *parent)
Create an Adafruit_Sensor compatible object for the gyro sensor.
Definition: Adafruit_LSM6DS.h:126
Definition: Adafruit_LSM6DS.h:122
void getSensor(sensor_t *)
Gets the sensor_t data for the LSM6DS's tenperature.
Definition: Adafruit_LSM6DS.cpp:659
Definition: Adafruit_LSM6DS.h:91
Base class for use with LSM6DS series acclerometer gyro sensors from STMicroelectronics. DO NOT USE DIRECTLY. Specific sensor variants should be subclassed as needed.
Definition: Adafruit_LSM6DS.h:140
hpf_range
Definition: Adafruit_LSM6DS.h:81
Adafruit_LSM6DS_Temp(Adafruit_LSM6DS *parent)
Create an Adafruit_Sensor compatible object for the temp sensor.
Definition: Adafruit_LSM6DS.h:95
Adafruit_LSM6DS_Accelerometer(Adafruit_LSM6DS *parent)
Create an Adafruit_Sensor compatible object for the accelerometer sensor.
Definition: Adafruit_LSM6DS.h:110
data_rate
Definition: Adafruit_LSM6DS.h:48
#define LSM6DS_I2CADDR_DEFAULT
LSM6DS default i2c address.
Definition: Adafruit_LSM6DS.h:23