LSM6DSO accelerometer and gyroscope sensor library

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   X_NUCLEO_IKS01A3

Committer:
martlefebvre94
Date:
Tue Sep 17 08:40:49 2019 +0000
Revision:
4:bcf0cf6e43a7
Parent:
3:4274d9103f1d
Child:
5:213250c75a9e
Addition of functions for the configuration of the accelerometer and gyroscope sensor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cparata 0:6d69e896ce38 1 /**
cparata 0:6d69e896ce38 2 ******************************************************************************
cparata 0:6d69e896ce38 3 * @file LSM6DSOSensor.h
cparata 0:6d69e896ce38 4 * @author SRA
cparata 0:6d69e896ce38 5 * @version V1.0.0
cparata 0:6d69e896ce38 6 * @date February 2019
cparata 0:6d69e896ce38 7 * @brief Abstract Class of an LSM6DSO Inertial Measurement Unit (IMU) 6 axes
cparata 0:6d69e896ce38 8 * sensor.
cparata 0:6d69e896ce38 9 ******************************************************************************
cparata 0:6d69e896ce38 10 * @attention
cparata 0:6d69e896ce38 11 *
cparata 0:6d69e896ce38 12 * <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
cparata 0:6d69e896ce38 13 *
cparata 0:6d69e896ce38 14 * Redistribution and use in source and binary forms, with or without modification,
cparata 0:6d69e896ce38 15 * are permitted provided that the following conditions are met:
cparata 0:6d69e896ce38 16 * 1. Redistributions of source code must retain the above copyright notice,
cparata 0:6d69e896ce38 17 * this list of conditions and the following disclaimer.
cparata 0:6d69e896ce38 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
cparata 0:6d69e896ce38 19 * this list of conditions and the following disclaimer in the documentation
cparata 0:6d69e896ce38 20 * and/or other materials provided with the distribution.
cparata 0:6d69e896ce38 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
cparata 0:6d69e896ce38 22 * may be used to endorse or promote products derived from this software
cparata 0:6d69e896ce38 23 * without specific prior written permission.
cparata 0:6d69e896ce38 24 *
cparata 0:6d69e896ce38 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
cparata 0:6d69e896ce38 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
cparata 0:6d69e896ce38 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
cparata 0:6d69e896ce38 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
cparata 0:6d69e896ce38 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
cparata 0:6d69e896ce38 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
cparata 0:6d69e896ce38 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
cparata 0:6d69e896ce38 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
cparata 0:6d69e896ce38 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
cparata 0:6d69e896ce38 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cparata 0:6d69e896ce38 35 *
cparata 0:6d69e896ce38 36 ******************************************************************************
cparata 0:6d69e896ce38 37 */
cparata 0:6d69e896ce38 38
cparata 0:6d69e896ce38 39
cparata 0:6d69e896ce38 40 /* Prevent recursive inclusion -----------------------------------------------*/
cparata 0:6d69e896ce38 41
cparata 0:6d69e896ce38 42 #ifndef __LSM6DSOSensor_H__
cparata 0:6d69e896ce38 43 #define __LSM6DSOSensor_H__
cparata 0:6d69e896ce38 44
cparata 0:6d69e896ce38 45
cparata 0:6d69e896ce38 46 /* Includes ------------------------------------------------------------------*/
cparata 0:6d69e896ce38 47 #include "DevI2C.h"
cparata 0:6d69e896ce38 48 #include "lsm6dso_reg.h"
cparata 0:6d69e896ce38 49 #include "MotionSensor.h"
cparata 0:6d69e896ce38 50 #include "GyroSensor.h"
cparata 0:6d69e896ce38 51 #include <assert.h>
cparata 0:6d69e896ce38 52
cparata 0:6d69e896ce38 53 /* Defines -------------------------------------------------------------------*/
cparata 0:6d69e896ce38 54
cparata 0:6d69e896ce38 55 #define LSM6DSO_ACC_SENSITIVITY_FS_2G 0.061f
cparata 0:6d69e896ce38 56 #define LSM6DSO_ACC_SENSITIVITY_FS_4G 0.122f
cparata 0:6d69e896ce38 57 #define LSM6DSO_ACC_SENSITIVITY_FS_8G 0.244f
cparata 0:6d69e896ce38 58 #define LSM6DSO_ACC_SENSITIVITY_FS_16G 0.488f
cparata 0:6d69e896ce38 59
cparata 0:6d69e896ce38 60 #define LSM6DSO_GYRO_SENSITIVITY_FS_125DPS 4.375f
cparata 0:6d69e896ce38 61 #define LSM6DSO_GYRO_SENSITIVITY_FS_250DPS 8.750f
cparata 0:6d69e896ce38 62 #define LSM6DSO_GYRO_SENSITIVITY_FS_500DPS 17.500f
cparata 0:6d69e896ce38 63 #define LSM6DSO_GYRO_SENSITIVITY_FS_1000DPS 35.000f
cparata 0:6d69e896ce38 64 #define LSM6DSO_GYRO_SENSITIVITY_FS_2000DPS 70.000f
cparata 0:6d69e896ce38 65
cparata 0:6d69e896ce38 66
cparata 0:6d69e896ce38 67 /* Typedefs ------------------------------------------------------------------*/
cparata 0:6d69e896ce38 68
cparata 3:4274d9103f1d 69 typedef enum {
cparata 3:4274d9103f1d 70 LSM6DSO_INT1_PIN,
cparata 3:4274d9103f1d 71 LSM6DSO_INT2_PIN,
cparata 0:6d69e896ce38 72 } LSM6DSO_Interrupt_Pin_t;
cparata 0:6d69e896ce38 73
cparata 3:4274d9103f1d 74 typedef struct {
cparata 3:4274d9103f1d 75 unsigned int FreeFallStatus : 1;
cparata 3:4274d9103f1d 76 unsigned int TapStatus : 1;
cparata 3:4274d9103f1d 77 unsigned int DoubleTapStatus : 1;
cparata 3:4274d9103f1d 78 unsigned int WakeUpStatus : 1;
cparata 3:4274d9103f1d 79 unsigned int StepStatus : 1;
cparata 3:4274d9103f1d 80 unsigned int TiltStatus : 1;
cparata 3:4274d9103f1d 81 unsigned int D6DOrientationStatus : 1;
cparata 3:4274d9103f1d 82 unsigned int SleepStatus : 1;
cparata 0:6d69e896ce38 83 } LSM6DSO_Event_Status_t;
cparata 0:6d69e896ce38 84
cparata 0:6d69e896ce38 85
cparata 0:6d69e896ce38 86 /* Class Declaration ---------------------------------------------------------*/
cparata 3:4274d9103f1d 87
cparata 0:6d69e896ce38 88 /**
cparata 0:6d69e896ce38 89 * Abstract class of an LSM6DSO Inertial Measurement Unit (IMU) 6 axes
cparata 0:6d69e896ce38 90 * sensor.
cparata 0:6d69e896ce38 91 */
cparata 3:4274d9103f1d 92 class LSM6DSOSensor : public MotionSensor, public GyroSensor {
cparata 3:4274d9103f1d 93 public:
cparata 0:6d69e896ce38 94 enum SPI_type_t {SPI3W, SPI4W};
cparata 3:4274d9103f1d 95 LSM6DSOSensor(SPI *spi, PinName cs_pin, PinName int1_pin = NC, PinName int2_pin = NC, SPI_type_t spi_type = SPI4W);
cparata 3:4274d9103f1d 96 LSM6DSOSensor(DevI2C *i2c, uint8_t address = LSM6DSO_I2C_ADD_H, PinName int1_pin = NC, PinName int2_pin = NC);
cparata 0:6d69e896ce38 97 virtual int init(void *init);
cparata 0:6d69e896ce38 98 virtual int read_id(uint8_t *id);
cparata 0:6d69e896ce38 99 virtual int get_x_axes(int32_t *acceleration);
cparata 0:6d69e896ce38 100 virtual int get_g_axes(int32_t *angular_rate);
cparata 0:6d69e896ce38 101 virtual int get_x_sensitivity(float *sensitivity);
cparata 0:6d69e896ce38 102 virtual int get_g_sensitivity(float *sensitivity);
cparata 0:6d69e896ce38 103 virtual int get_x_axes_raw(int16_t *value);
cparata 0:6d69e896ce38 104 virtual int get_g_axes_raw(int16_t *value);
cparata 0:6d69e896ce38 105 virtual int get_x_odr(float *odr);
cparata 0:6d69e896ce38 106 virtual int get_g_odr(float *odr);
cparata 0:6d69e896ce38 107 virtual int set_x_odr(float odr);
cparata 0:6d69e896ce38 108 virtual int set_g_odr(float odr);
cparata 0:6d69e896ce38 109 virtual int get_x_fs(float *full_scale);
cparata 0:6d69e896ce38 110 virtual int get_g_fs(float *full_scale);
cparata 0:6d69e896ce38 111 virtual int set_x_fs(float full_scale);
cparata 0:6d69e896ce38 112 virtual int set_g_fs(float full_scale);
martlefebvre94 4:bcf0cf6e43a7 113 virtual int get_x_power_mode(uint8_t *xl_hm_mode, uint8_t *xl_ulp_en);
martlefebvre94 4:bcf0cf6e43a7 114 virtual int set_x_power_mode(uint8_t xl_hm_mode, uint8_t xl_ulp_en);
cparata 0:6d69e896ce38 115 int enable_x(void);
cparata 0:6d69e896ce38 116 int enable_g(void);
cparata 0:6d69e896ce38 117 int disable_x(void);
cparata 0:6d69e896ce38 118 int disable_g(void);
cparata 0:6d69e896ce38 119 int enable_free_fall_detection(LSM6DSO_Interrupt_Pin_t pin = LSM6DSO_INT1_PIN);
cparata 0:6d69e896ce38 120 int disable_free_fall_detection(void);
cparata 0:6d69e896ce38 121 int set_free_fall_threshold(uint8_t thr);
cparata 0:6d69e896ce38 122 int set_free_fall_duration(uint8_t dur);
cparata 0:6d69e896ce38 123 int enable_pedometer(void);
cparata 0:6d69e896ce38 124 int disable_pedometer(void);
cparata 0:6d69e896ce38 125 int get_step_counter(uint16_t *step_count);
cparata 0:6d69e896ce38 126 int reset_step_counter(void);
cparata 0:6d69e896ce38 127 int enable_tilt_detection(LSM6DSO_Interrupt_Pin_t pin = LSM6DSO_INT1_PIN);
cparata 0:6d69e896ce38 128 int disable_tilt_detection(void);
cparata 1:888ac5f8d970 129 int enable_wake_up_detection(LSM6DSO_Interrupt_Pin_t pin = LSM6DSO_INT1_PIN);
cparata 0:6d69e896ce38 130 int disable_wake_up_detection(void);
cparata 0:6d69e896ce38 131 int set_wake_up_threshold(uint8_t thr);
cparata 0:6d69e896ce38 132 int set_wake_up_duration(uint8_t dur);
cparata 0:6d69e896ce38 133 int enable_single_tap_detection(LSM6DSO_Interrupt_Pin_t pin = LSM6DSO_INT1_PIN);
cparata 0:6d69e896ce38 134 int disable_single_tap_detection(void);
cparata 0:6d69e896ce38 135 int enable_double_tap_detection(LSM6DSO_Interrupt_Pin_t pin = LSM6DSO_INT1_PIN);
cparata 0:6d69e896ce38 136 int disable_double_tap_detection(void);
cparata 0:6d69e896ce38 137 int set_tap_threshold(uint8_t thr);
cparata 0:6d69e896ce38 138 int set_tap_shock_time(uint8_t time);
cparata 0:6d69e896ce38 139 int set_tap_quiet_time(uint8_t time);
cparata 0:6d69e896ce38 140 int set_tap_duration_time(uint8_t time);
cparata 0:6d69e896ce38 141 int enable_6d_orientation(LSM6DSO_Interrupt_Pin_t pin = LSM6DSO_INT1_PIN);
cparata 0:6d69e896ce38 142 int disable_6d_orientation(void);
cparata 0:6d69e896ce38 143 int set_6d_orientation_threshold(uint8_t thr);
cparata 0:6d69e896ce38 144 int get_6d_orientation_xl(uint8_t *xl);
cparata 0:6d69e896ce38 145 int get_6d_orientation_xh(uint8_t *xh);
cparata 0:6d69e896ce38 146 int get_6d_orientation_yl(uint8_t *yl);
cparata 0:6d69e896ce38 147 int get_6d_orientation_yh(uint8_t *yh);
cparata 0:6d69e896ce38 148 int get_6d_orientation_zl(uint8_t *zl);
cparata 0:6d69e896ce38 149 int get_6d_orientation_zh(uint8_t *zh);
cparata 0:6d69e896ce38 150 int get_event_status(LSM6DSO_Event_Status_t *status);
cparata 0:6d69e896ce38 151 int read_reg(uint8_t reg, uint8_t *data);
cparata 0:6d69e896ce38 152 int write_reg(uint8_t reg, uint8_t data);
cparata 0:6d69e896ce38 153 int set_interrupt_latch(uint8_t status);
cparata 0:6d69e896ce38 154 int get_x_drdy_status(uint8_t *status);
cparata 0:6d69e896ce38 155 int set_x_self_test(uint8_t status);
cparata 0:6d69e896ce38 156 int get_g_drdy_status(uint8_t *status);
cparata 0:6d69e896ce38 157 int set_g_self_test(uint8_t status);
cparata 0:6d69e896ce38 158 int get_fifo_num_samples(uint16_t *num_samples);
cparata 0:6d69e896ce38 159 int get_fifo_full_status(uint8_t *status);
cparata 0:6d69e896ce38 160 int set_fifo_int1_fifo_full(uint8_t status);
cparata 0:6d69e896ce38 161 int set_fifo_watermark_level(uint16_t watermark);
cparata 0:6d69e896ce38 162 int set_fifo_stop_on_fth(uint8_t status);
cparata 0:6d69e896ce38 163 int set_fifo_mode(uint8_t mode);
cparata 0:6d69e896ce38 164 int get_fifo_tag(uint8_t *tag);
cparata 0:6d69e896ce38 165 int get_fifo_data(uint8_t *data);
cparata 0:6d69e896ce38 166 int get_fifo_x_axes(int32_t *acceleration);
cparata 0:6d69e896ce38 167 int set_fifo_x_bdr(float bdr);
cparata 0:6d69e896ce38 168 int get_fifo_g_axes(int32_t *angular_velocity);
cparata 0:6d69e896ce38 169 int set_fifo_g_bdr(float bdr);
cparata 3:4274d9103f1d 170
cparata 0:6d69e896ce38 171 /**
cparata 0:6d69e896ce38 172 * @brief Attaching an interrupt handler to the INT1 interrupt.
cparata 0:6d69e896ce38 173 * @param fptr An interrupt handler.
cparata 0:6d69e896ce38 174 * @retval None.
cparata 0:6d69e896ce38 175 */
cparata 0:6d69e896ce38 176 void attach_int1_irq(void (*fptr)(void))
cparata 0:6d69e896ce38 177 {
cparata 0:6d69e896ce38 178 _int1_irq.rise(fptr);
cparata 0:6d69e896ce38 179 }
cparata 0:6d69e896ce38 180
cparata 0:6d69e896ce38 181 /**
cparata 0:6d69e896ce38 182 * @brief Enabling the INT1 interrupt handling.
cparata 0:6d69e896ce38 183 * @param None.
cparata 0:6d69e896ce38 184 * @retval None.
cparata 0:6d69e896ce38 185 */
cparata 0:6d69e896ce38 186 void enable_int1_irq(void)
cparata 0:6d69e896ce38 187 {
cparata 0:6d69e896ce38 188 _int1_irq.enable_irq();
cparata 0:6d69e896ce38 189 }
cparata 3:4274d9103f1d 190
cparata 0:6d69e896ce38 191 /**
cparata 0:6d69e896ce38 192 * @brief Disabling the INT1 interrupt handling.
cparata 0:6d69e896ce38 193 * @param None.
cparata 0:6d69e896ce38 194 * @retval None.
cparata 0:6d69e896ce38 195 */
cparata 0:6d69e896ce38 196 void disable_int1_irq(void)
cparata 0:6d69e896ce38 197 {
cparata 0:6d69e896ce38 198 _int1_irq.disable_irq();
cparata 0:6d69e896ce38 199 }
cparata 3:4274d9103f1d 200
cparata 0:6d69e896ce38 201 /**
cparata 0:6d69e896ce38 202 * @brief Attaching an interrupt handler to the INT2 interrupt.
cparata 0:6d69e896ce38 203 * @param fptr An interrupt handler.
cparata 0:6d69e896ce38 204 * @retval None.
cparata 0:6d69e896ce38 205 */
cparata 0:6d69e896ce38 206 void attach_int2_irq(void (*fptr)(void))
cparata 0:6d69e896ce38 207 {
cparata 0:6d69e896ce38 208 _int2_irq.rise(fptr);
cparata 0:6d69e896ce38 209 }
cparata 0:6d69e896ce38 210
cparata 0:6d69e896ce38 211 /**
cparata 0:6d69e896ce38 212 * @brief Enabling the INT2 interrupt handling.
cparata 0:6d69e896ce38 213 * @param None.
cparata 0:6d69e896ce38 214 * @retval None.
cparata 0:6d69e896ce38 215 */
cparata 0:6d69e896ce38 216 void enable_int2_irq(void)
cparata 0:6d69e896ce38 217 {
cparata 0:6d69e896ce38 218 _int2_irq.enable_irq();
cparata 0:6d69e896ce38 219 }
cparata 3:4274d9103f1d 220
cparata 0:6d69e896ce38 221 /**
cparata 0:6d69e896ce38 222 * @brief Disabling the INT2 interrupt handling.
cparata 0:6d69e896ce38 223 * @param None.
cparata 0:6d69e896ce38 224 * @retval None.
cparata 0:6d69e896ce38 225 */
cparata 0:6d69e896ce38 226 void disable_int2_irq(void)
cparata 0:6d69e896ce38 227 {
cparata 0:6d69e896ce38 228 _int2_irq.disable_irq();
cparata 0:6d69e896ce38 229 }
cparata 3:4274d9103f1d 230
cparata 0:6d69e896ce38 231 /**
cparata 0:6d69e896ce38 232 * @brief Utility function to read data.
cparata 0:6d69e896ce38 233 * @param pBuffer: pointer to data to be read.
cparata 0:6d69e896ce38 234 * @param RegisterAddr: specifies internal address register to be read.
cparata 0:6d69e896ce38 235 * @param NumByteToRead: number of bytes to be read.
cparata 0:6d69e896ce38 236 * @retval 0 if ok, an error code otherwise.
cparata 0:6d69e896ce38 237 */
cparata 3:4274d9103f1d 238 uint8_t io_read(uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead)
cparata 3:4274d9103f1d 239 {
cparata 0:6d69e896ce38 240 if (_dev_spi) {
cparata 0:6d69e896ce38 241 /* Write Reg Address */
cparata 0:6d69e896ce38 242 _dev_spi->lock();
cparata 3:4274d9103f1d 243 _cs_pin = 0;
cparata 3:4274d9103f1d 244 if (_spi_type == SPI4W) {
cparata 0:6d69e896ce38 245 _dev_spi->write(RegisterAddr | 0x80);
cparata 3:4274d9103f1d 246 for (int i = 0; i < NumByteToRead; i++) {
cparata 3:4274d9103f1d 247 *(pBuffer + i) = _dev_spi->write(0x00);
cparata 0:6d69e896ce38 248 }
cparata 3:4274d9103f1d 249 } else if (_spi_type == SPI3W) {
cparata 0:6d69e896ce38 250 /* Write RD Reg Address with RD bit*/
cparata 3:4274d9103f1d 251 uint8_t TxByte = RegisterAddr | 0x80;
cparata 0:6d69e896ce38 252 _dev_spi->write((char *)&TxByte, 1, (char *)pBuffer, (int) NumByteToRead);
cparata 3:4274d9103f1d 253 }
cparata 0:6d69e896ce38 254 _cs_pin = 1;
cparata 3:4274d9103f1d 255 _dev_spi->unlock();
cparata 0:6d69e896ce38 256 return 0;
cparata 3:4274d9103f1d 257 }
cparata 3:4274d9103f1d 258 if (_dev_i2c) {
cparata 3:4274d9103f1d 259 return (uint8_t) _dev_i2c->i2c_read(pBuffer, _address, RegisterAddr, NumByteToRead);
cparata 3:4274d9103f1d 260 }
cparata 0:6d69e896ce38 261 return 1;
cparata 0:6d69e896ce38 262 }
cparata 3:4274d9103f1d 263
cparata 0:6d69e896ce38 264 /**
cparata 0:6d69e896ce38 265 * @brief Utility function to write data.
cparata 0:6d69e896ce38 266 * @param pBuffer: pointer to data to be written.
cparata 0:6d69e896ce38 267 * @param RegisterAddr: specifies internal address register to be written.
cparata 0:6d69e896ce38 268 * @param NumByteToWrite: number of bytes to write.
cparata 0:6d69e896ce38 269 * @retval 0 if ok, an error code otherwise.
cparata 0:6d69e896ce38 270 */
cparata 3:4274d9103f1d 271 uint8_t io_write(uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite)
cparata 0:6d69e896ce38 272 {
cparata 3:4274d9103f1d 273 if (_dev_spi) {
cparata 0:6d69e896ce38 274 _dev_spi->lock();
cparata 0:6d69e896ce38 275 _cs_pin = 0;
cparata 3:4274d9103f1d 276 _dev_spi->write(RegisterAddr);
cparata 3:4274d9103f1d 277 _dev_spi->write((char *)pBuffer, (int) NumByteToWrite, NULL, 0);
cparata 3:4274d9103f1d 278 _cs_pin = 1;
cparata 0:6d69e896ce38 279 _dev_spi->unlock();
cparata 3:4274d9103f1d 280 return 0;
cparata 3:4274d9103f1d 281 }
cparata 3:4274d9103f1d 282 if (_dev_i2c) {
cparata 3:4274d9103f1d 283 return (uint8_t) _dev_i2c->i2c_write(pBuffer, _address, RegisterAddr, NumByteToWrite);
cparata 3:4274d9103f1d 284 }
cparata 0:6d69e896ce38 285 return 1;
cparata 0:6d69e896ce38 286 }
cparata 0:6d69e896ce38 287
cparata 3:4274d9103f1d 288 private:
cparata 0:6d69e896ce38 289 int set_x_odr_when_enabled(float odr);
cparata 0:6d69e896ce38 290 int set_g_odr_when_enabled(float odr);
cparata 0:6d69e896ce38 291 int set_x_odr_when_disabled(float odr);
cparata 0:6d69e896ce38 292 int set_g_odr_when_disabled(float odr);
cparata 0:6d69e896ce38 293
cparata 0:6d69e896ce38 294 /* Helper classes. */
cparata 0:6d69e896ce38 295 DevI2C *_dev_i2c;
cparata 0:6d69e896ce38 296 SPI *_dev_spi;
cparata 0:6d69e896ce38 297
cparata 0:6d69e896ce38 298 /* Configuration */
cparata 0:6d69e896ce38 299 uint8_t _address;
cparata 3:4274d9103f1d 300 DigitalOut _cs_pin;
cparata 0:6d69e896ce38 301 InterruptIn _int1_irq;
cparata 0:6d69e896ce38 302 InterruptIn _int2_irq;
cparata 0:6d69e896ce38 303 SPI_type_t _spi_type;
cparata 3:4274d9103f1d 304
cparata 0:6d69e896ce38 305 uint8_t _x_is_enabled;
cparata 0:6d69e896ce38 306 lsm6dso_odr_xl_t _x_last_odr;
cparata 0:6d69e896ce38 307 uint8_t _g_is_enabled;
cparata 0:6d69e896ce38 308 lsm6dso_odr_g_t _g_last_odr;
cparata 0:6d69e896ce38 309
cparata 0:6d69e896ce38 310 lsm6dso_ctx_t _reg_ctx;
cparata 0:6d69e896ce38 311 };
cparata 0:6d69e896ce38 312
cparata 0:6d69e896ce38 313 #ifdef __cplusplus
cparata 3:4274d9103f1d 314 extern "C" {
cparata 0:6d69e896ce38 315 #endif
cparata 3:4274d9103f1d 316 int32_t LSM6DSO_io_write(void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite);
cparata 3:4274d9103f1d 317 int32_t LSM6DSO_io_read(void *handle, uint8_t ReadAddr, uint8_t *pBuffer, uint16_t nBytesToRead);
cparata 0:6d69e896ce38 318 #ifdef __cplusplus
cparata 3:4274d9103f1d 319 }
cparata 0:6d69e896ce38 320 #endif
cparata 0:6d69e896ce38 321
cparata 0:6d69e896ce38 322 #endif