Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LSM6DS33 Class Reference
LSM6DS33 Class - driver for the 6 DoF IMU. More...
#include <LSM6DS33_GR1.h>
Public Types | |
| enum | gyro_scale |
gyro_scale defines the possible full-scale ranges of the gyroscope: More... | |
| enum | gyro_odr |
gyro_odr defines all possible data rate/bandwidth combos of the gyro: More... | |
| enum | accel_scale |
accel_scale defines all possible FSR's of the accelerometer: More... | |
| enum | accel_odr |
accel_oder defines all possible output data rates of the accelerometer: More... | |
Public Member Functions | |
| LSM6DS33 (PinName sda, PinName scl, uint8_t xgAddr=LSM6DS33_AG_I2C_ADDR(1)) | |
| LSM6DS33 -- LSM6DS33 class constructor The constructor will set up a handful of private variables, and set the communication mode as well. | |
| uint16_t | begin (gyro_scale gScl=G_SCALE_250DPS, accel_scale aScl=A_SCALE_2G, gyro_odr gODR=G_ODR_104, accel_odr aODR=A_ODR_104) |
| begin() -- Initialize the gyro, and accelerometer. | |
| void | readGyro () |
| readGyro() -- Read the gyroscope output registers. | |
| void | readAccel () |
| readAccel() -- Read the accelerometer output registers. | |
| void | readTemp () |
| readTemp() -- Read the temperature output register. | |
| void | readIntr () |
| Read Interrupt. | |
| void | setGyroScale (gyro_scale gScl) |
| setGyroScale() -- Set the full-scale range of the gyroscope. | |
| void | setAccelScale (accel_scale aScl) |
| setAccelScale() -- Set the full-scale range of the accelerometer. | |
| void | setGyroODR (gyro_odr gRate) |
setGyroODR() -- Set the output data rate and bandwidth of the gyroscope Input:
| |
| void | setAccelODR (accel_odr aRate) |
setAccelODR() -- Set the output data rate of the accelerometer Input:
| |
| void | calibration (int16_t iter) |
| calibration() -- Calculate the offset of the accel and the gyro | |
Detailed Description
LSM6DS33 Class - driver for the 6 DoF IMU.
Definition at line 80 of file LSM6DS33_GR1.h.
Member Enumeration Documentation
| enum accel_odr |
accel_oder defines all possible output data rates of the accelerometer:
Definition at line 118 of file LSM6DS33_GR1.h.
| enum accel_scale |
accel_scale defines all possible FSR's of the accelerometer:
Definition at line 109 of file LSM6DS33_GR1.h.
| enum gyro_odr |
gyro_odr defines all possible data rate/bandwidth combos of the gyro:
Definition at line 95 of file LSM6DS33_GR1.h.
| enum gyro_scale |
gyro_scale defines the possible full-scale ranges of the gyroscope:
Definition at line 85 of file LSM6DS33_GR1.h.
Constructor & Destructor Documentation
| LSM6DS33 | ( | PinName | sda, |
| PinName | scl, | ||
| uint8_t | xgAddr = LSM6DS33_AG_I2C_ADDR(1) |
||
| ) |
LSM6DS33 -- LSM6DS33 class constructor The constructor will set up a handful of private variables, and set the communication mode as well.
Input:
- interface = Either MODE_SPI or MODE_I2C, whichever you're using to talk to the IC.
- xgAddr = If MODE_I2C, this is the I2C address of the accel/gyro. If MODE_SPI, this is the chip select pin of the accel/gyro (CS_A/G)
Definition at line 3 of file LSM6DS33_GR1.cpp.
Member Function Documentation
| uint16_t begin | ( | gyro_scale | gScl = G_SCALE_250DPS, |
| accel_scale | aScl = A_SCALE_2G, |
||
| gyro_odr | gODR = G_ODR_104, |
||
| accel_odr | aODR = A_ODR_104 |
||
| ) |
begin() -- Initialize the gyro, and accelerometer.
This will set up the scale and output rate of each sensor. It'll also "turn on" every sensor and every axis of every sensor. Input:
- gScl = The scale of the gyroscope. This should be a gyro_scale value.
- aScl = The scale of the accelerometer. Should be a accel_scale value.
- gODR = Output data rate of the gyroscope. gyro_odr value.
- aODR = Output data rate of the accelerometer. accel_odr value. Output: The function will return an unsigned 16-bit value. The most-sig bytes of the output are the WHO_AM_I reading of the accel/gyro. All parameters have a defaulted value, so you can call just "begin()". Default values are FSR's of: +/- 245DPS, 4g, 2Gs; ODRs of 119 Hz for gyro, 119 Hz for accelerometer. Use the return value of this function to verify communication.
Definition at line 20 of file LSM6DS33_GR1.cpp.
| void calibration | ( | int16_t | iter ) |
calibration() -- Calculate the offset of the accel and the gyro
Definition at line 513 of file LSM6DS33_GR1.cpp.
| void readAccel | ( | ) |
readAccel() -- Read the accelerometer output registers.
This function will read all six accelerometer output registers. The readings are stored in the class' ax_raw, ay_raw, and az_raw variables. Read those _after_ calling readAccel().
Definition at line 211 of file LSM6DS33_GR1.cpp.
| void readGyro | ( | ) |
readGyro() -- Read the gyroscope output registers.
This function will read all six gyroscope output registers. The readings are stored in the class' gx_raw, gy_raw, and gz_raw variables. Read those _after_ calling readGyro().
Definition at line 292 of file LSM6DS33_GR1.cpp.
| void readIntr | ( | ) |
Read Interrupt.
Definition at line 256 of file LSM6DS33_GR1.cpp.
| void readTemp | ( | ) |
readTemp() -- Read the temperature output register.
This function will read two temperature output registers. The combined readings are stored in the class' temperature variables. Read those _after_ calling readTemp().
Definition at line 267 of file LSM6DS33_GR1.cpp.
| void setAccelODR | ( | accel_odr | aRate ) |
setAccelODR() -- Set the output data rate of the accelerometer Input:
- aRate = The desired output rate of the accel.
Must be a value from the accel_odr enum (check above).
Definition at line 432 of file LSM6DS33_GR1.cpp.
| void setAccelScale | ( | accel_scale | aScl ) |
setAccelScale() -- Set the full-scale range of the accelerometer.
This function can be called to set the scale of the accelerometer to 2, 4, 8, or 16 g's. Input:
- aScl = The desired accelerometer scale. Must be one of five possible values from the accel_scale enum.
Definition at line 365 of file LSM6DS33_GR1.cpp.
| void setGyroODR | ( | gyro_odr | gRate ) |
setGyroODR() -- Set the output data rate and bandwidth of the gyroscope Input:
- gRate = The desired output rate and cutoff frequency of the gyro.
Must be a value from the gyro_odr enum (check above).
Definition at line 393 of file LSM6DS33_GR1.cpp.
| void setGyroScale | ( | gyro_scale | gScl ) |
setGyroScale() -- Set the full-scale range of the gyroscope.
This function can be called to set the scale of the gyroscope to 245, 500, or 2000 degrees per second. Input:
- gScl = The desired gyroscope scale. Must be one of three possible values from the gyro_scale enum.
Definition at line 337 of file LSM6DS33_GR1.cpp.
Generated on Sun Jul 24 2022 13:05:35 by
1.7.2