Shih-Ho Hsieh / Mbed 2 deprecated Motor_XYZ_UI_SPI_I2C_5mag

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

LSM6DS33 Class Reference

Class representing a LSM6DS33 sensor component. More...

#include <lsm6ds33_class.h>

Inherits GyroSensor, and MotionSensor.

Public Member Functions

 LSM6DS33 (DevI2C &i2c, uint16_t SA0=1)
 Constructor.
virtual ~LSM6DS33 ()
 Destructor.
virtual int init (void *init_struct)
 Initializing the component.
virtual int read_id (uint8_t *xg_id)
 Getting the ID of the component.
virtual int get_x_axes (int32_t *pData)
 Get current accelerometer linear acceleration X/Y/Z-axes values in standard data units [mg].
virtual int get_x_axes_raw (int16_t *pData)
 Get current accelerometer raw data X/Y/Z-axes values in device sepcific LSB units.
virtual int get_g_axes (int32_t *pData)
 Get current gyroscope angular rate X/Y/Z-axes values in standard data units [mdps].
virtual int get_g_axes_raw (int16_t *pData)
 Get current gyroscope raw data X/Y/Z-axes values in device sepcific LSB units.
virtual int get_x_odr (float *odr)
 Get accelerometer's current output data rate [Hz].
virtual int set_x_odr (float odr)
 Set accelerometer's output data rate.
virtual int get_x_sensitivity (float *pfData)
 Get accelerometer's current sensitivity [mg/LSB].
virtual int get_x_fs (float *fullScale)
 Get accelerometer's full scale value i.e. min/max measurable value [g].
virtual int set_x_fs (float fullScale)
 Set accelerometer's full scale value i.e. min/max measurable value.
virtual int get_g_odr (float *odr)
 Get gyroscope's current output data rate [Hz].
virtual int set_g_odr (float odr)
 Set gyroscope's output data rate.
virtual int get_g_sensitivity (float *pfData)
 Get gyroscope's current sensitivity [mdps/LSB].
virtual int get_g_fs (float *fullScale)
 Get gyroscope's full scale value i.e. min/max measurable value [dps].
virtual int set_g_fs (float fullScale)
 Set gyroscope's full scale value i.e. min/max measurable value.

Protected Member Functions

IMU_6AXES_StatusTypeDef LSM6DS33_Init (IMU_6AXES_InitTypeDef *LSM6DS33_Init)
 Set LSM6DS33 Initialization.
IMU_6AXES_StatusTypeDef LSM6DS33_Read_XG_ID (uint8_t *xg_id)
 Read ID of LSM6DS33 Accelerometer and Gyroscope.
IMU_6AXES_StatusTypeDef LSM6DS33_X_GetAxes (int32_t *pData)
 Read data from LSM6DS33 Accelerometer and calculate linear acceleration in mg.
IMU_6AXES_StatusTypeDef LSM6DS33_X_GetAxesRaw (int16_t *pData)
 Read raw data from LSM6DS33 Accelerometer output register.
IMU_6AXES_StatusTypeDef LSM6DS33_G_GetAxes (int32_t *pData)
 Read data from LSM6DS33 Gyroscope and calculate angular rate in mdps.
IMU_6AXES_StatusTypeDef LSM6DS33_G_GetAxesRaw (int16_t *pData)
 Read raw data from LSM6DS33 Gyroscope output register.
IMU_6AXES_StatusTypeDef LSM6DS33_X_Get_ODR (float *odr)
 Read Accelero Output Data Rate.
IMU_6AXES_StatusTypeDef LSM6DS33_X_Set_ODR (float odr)
 Write Accelero Output Data Rate.
IMU_6AXES_StatusTypeDef LSM6DS33_X_GetSensitivity (float *pfData)
 Read Accelero Sensitivity.
IMU_6AXES_StatusTypeDef LSM6DS33_X_Get_FS (float *fullScale)
 Read Accelero Full Scale.
IMU_6AXES_StatusTypeDef LSM6DS33_X_Set_FS (float fullScale)
 Write Accelero Full Scale.
IMU_6AXES_StatusTypeDef LSM6DS33_G_Get_ODR (float *odr)
 Read Gyro Output Data Rate.
IMU_6AXES_StatusTypeDef LSM6DS33_G_Set_ODR (float odr)
 Write Gyro Output Data Rate.
IMU_6AXES_StatusTypeDef LSM6DS33_G_GetSensitivity (float *pfData)
 Read Gyro Sensitivity.
IMU_6AXES_StatusTypeDef LSM6DS33_G_Get_FS (float *fullScale)
 Read Gyro Full Scale.
IMU_6AXES_StatusTypeDef LSM6DS33_G_Set_FS (float fullScale)
 Write Gyro Full Scale.
IMU_6AXES_StatusTypeDef LSM6DS33_Common_Sensor_Enable (void)
 Set LSM6DS33 common initialization.
IMU_6AXES_StatusTypeDef LSM6DS33_X_Set_Axes_Status (uint8_t enableX, uint8_t enableY, uint8_t enableZ)
 Set the status of the axes for accelerometer.
IMU_6AXES_StatusTypeDef LSM6DS33_G_Set_Axes_Status (uint8_t enableX, uint8_t enableY, uint8_t enableZ)
 Set the status of the axes for gyroscope.
void LSM6DS33_IO_ITConfig (void)
 Configures LSM6DS33 interrupt lines for NUCLEO boards.
IMU_6AXES_StatusTypeDef LSM6DS33_IO_Init (void)
 Configures LSM6DS33 I2C interface.
IMU_6AXES_StatusTypeDef LSM6DS33_IO_Read (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead)
 Utility function to read data from LSM6DS33.
IMU_6AXES_StatusTypeDef LSM6DS33_IO_Write (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite)
 Utility function to write data to LSM6DS33.

Detailed Description

Class representing a LSM6DS33 sensor component.

Definition at line 51 of file lsm6ds33_class.h.


Constructor & Destructor Documentation

LSM6DS33 ( DevI2C i2c,
uint16_t  SA0 = 1 
)

Constructor.

Parameters:
[in]i2cdevice I2C to be used for communication
[in]irq_pinpin name for free fall detection interrupt

Definition at line 57 of file lsm6ds33_class.h.

virtual ~LSM6DS33 (  ) [virtual]

Destructor.

Definition at line 64 of file lsm6ds33_class.h.


Member Function Documentation

virtual int get_g_axes ( int32_t *  p_data ) [virtual]

Get current gyroscope angular rate X/Y/Z-axes values in standard data units [mdps].

Parameters:
[out]p_dataPointer to where to store angular rates to. p_data must point to an array of (at least) three elements, where: p_data[0] corresponds to X-axis, p_data[1] corresponds to Y-axis, and p_data[2] corresponds to Z-axis.
Returns:
0 in case of success, an error code otherwise

Implements GyroSensor.

Definition at line 83 of file lsm6ds33_class.h.

virtual int get_g_axes_raw ( int16_t *  p_data ) [virtual]

Get current gyroscope raw data X/Y/Z-axes values in device sepcific LSB units.

Parameters:
[out]p_dataPointer to where to store gyroscope raw data to. p_data must point to an array of (at least) three elements, where: p_data[0] corresponds to X-axis, p_data[1] corresponds to Y-axis, and p_data[2] corresponds to Z-axis.
Returns:
0 in case of success, an error code otherwise

Implements GyroSensor.

Definition at line 87 of file lsm6ds33_class.h.

virtual int get_g_fs ( float *  pf_data ) [virtual]

Get gyroscope's full scale value i.e. min/max measurable value [dps].

Parameters:
[out]pf_dataPointer to where the gyroscope full scale value is stored to
Returns:
0 in case of success, an error code otherwise

Implements GyroSensor.

Definition at line 123 of file lsm6ds33_class.h.

virtual int get_g_odr ( float *  pf_data ) [virtual]

Get gyroscope's current output data rate [Hz].

Parameters:
[out]pf_dataPointer to where the gyroscope output data rate is stored to
Returns:
0 in case of success, an error code otherwise

Implements GyroSensor.

Definition at line 111 of file lsm6ds33_class.h.

virtual int get_g_sensitivity ( float *  pf_data ) [virtual]

Get gyroscope's current sensitivity [mdps/LSB].

Parameters:
[out]pf_dataPointer to where the gyroscope's sensitivity is stored to
Returns:
0 in case of success, an error code otherwise

Implements GyroSensor.

Definition at line 119 of file lsm6ds33_class.h.

virtual int get_x_axes ( int32_t *  p_data ) [virtual]

Get current accelerometer linear acceleration X/Y/Z-axes values in standard data units [mg].

Parameters:
[out]p_dataPointer to where to store linear accelerations to. p_data must point to an array of (at least) three elements, where: p_data[0] corresponds to X-axis, p_data[1] corresponds to Y-axis, and p_data[2] corresponds to Z-axis.
Returns:
0 in case of success, an error code otherwise

Implements MotionSensor.

Definition at line 75 of file lsm6ds33_class.h.

virtual int get_x_axes_raw ( int16_t *  p_data ) [virtual]

Get current accelerometer raw data X/Y/Z-axes values in device sepcific LSB units.

Parameters:
[out]p_dataPointer to where to store accelerometer raw data to. p_data must point to an array of (at least) three elements, where: p_data[0] corresponds to X-axis, p_data[1] corresponds to Y-axis, and p_data[2] corresponds to Z-axis.
Returns:
0 in case of success, an error code otherwise

Implements MotionSensor.

Definition at line 79 of file lsm6ds33_class.h.

virtual int get_x_fs ( float *  pf_data ) [virtual]

Get accelerometer's full scale value i.e. min/max measurable value [g].

Parameters:
[out]pf_dataPointer to where the accelerometer full scale value is stored to
Returns:
0 in case of success, an error code otherwise

Implements MotionSensor.

Definition at line 103 of file lsm6ds33_class.h.

virtual int get_x_odr ( float *  pf_data ) [virtual]

Get accelerometer's current output data rate [Hz].

Parameters:
[out]pf_dataPointer to where the accelerometer output data rate is stored to
Returns:
0 in case of success, an error code otherwise

Implements MotionSensor.

Definition at line 91 of file lsm6ds33_class.h.

virtual int get_x_sensitivity ( float *  pf_data ) [virtual]

Get accelerometer's current sensitivity [mg/LSB].

Parameters:
[out]pf_dataPointer to where the accelerometer's sensitivity is stored to
Returns:
0 in case of success, an error code otherwise

Implements MotionSensor.

Definition at line 99 of file lsm6ds33_class.h.

virtual int init ( void *  init ) [virtual]

Initializing the component.

Parameters:
[in]initpointer to device specific initalization structure.
Return values:
0in case of success, an error code otherwise.

Implements Component.

Definition at line 67 of file lsm6ds33_class.h.

IMU_6AXES_StatusTypeDef LSM6DS33_Common_Sensor_Enable ( void   ) [protected]

Set LSM6DS33 common initialization.

Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 132 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_G_Get_FS ( float *  fullScale ) [protected]

Read Gyro Full Scale.

Parameters:
fullScalethe pointer where the gyroscope full scale is stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 746 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_G_Get_ODR ( float *  odr ) [protected]

Read Gyro Output Data Rate.

Parameters:
odrthe pointer where the gyroscope output data rate is stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 604 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_G_GetAxes ( int32_t *  pData ) [protected]

Read data from LSM6DS33 Gyroscope and calculate angular rate in mdps.

Parameters:
pDatathe pointer where the gyroscope data are stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 368 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_G_GetAxesRaw ( int16_t *  pData ) [protected]

Read raw data from LSM6DS33 Gyroscope output register.

Parameters:
pDatathe pointer where the gyroscope raw data are stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 246 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_G_GetSensitivity ( float *  pfData ) [protected]

Read Gyro Sensitivity.

Parameters:
pfDatathe pointer where the gyroscope sensitivity is stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 693 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_G_Set_Axes_Status ( uint8_t  enableX,
uint8_t  enableY,
uint8_t  enableZ 
) [protected]

Set the status of the axes for gyroscope.

Parameters:
enableXthe status of the x axis to be set
enableYthe status of the y axis to be set
enableZthe status of the z axis to be set
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 327 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_G_Set_FS ( float  fullScale ) [protected]

Write Gyro Full Scale.

Parameters:
fullScalethe gyroscope full scale to be set
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 799 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_G_Set_ODR ( float  odr ) [protected]

Write Gyro Output Data Rate.

Parameters:
odrthe gyroscope output data rate to be set
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 657 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_Init ( IMU_6AXES_InitTypeDef LSM6DS33_Init ) [protected]

Set LSM6DS33 Initialization.

Parameters:
LSM6DS33_Initthe configuration setting for the LSM6DS3
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 53 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_IO_Init ( void   ) [protected]

Configures LSM6DS33 I2C interface.

Returns:
IMU_6AXES_OK in case of success, an error code otherwise

Definition at line 164 of file lsm6ds33_class.h.

void LSM6DS33_IO_ITConfig ( void   ) [protected]

Configures LSM6DS33 interrupt lines for NUCLEO boards.

Definition at line 156 of file lsm6ds33_class.h.

IMU_6AXES_StatusTypeDef LSM6DS33_IO_Read ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToRead 
) [protected]

Utility function to read data from LSM6DS33.

Parameters:
[out]pBufferpointer to the byte-array to read data in to
[in]RegisterAddrspecifies internal address register to read from.
[in]NumByteToReadnumber of bytes to be read.
Return values:
IMU_6AXES_OKif ok,
IMU_6AXES_ERRORif an I2C error has occured

Definition at line 177 of file lsm6ds33_class.h.

IMU_6AXES_StatusTypeDef LSM6DS33_IO_Write ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToWrite 
) [protected]

Utility function to write data to LSM6DS33.

Parameters:
[in]pBufferpointer to the byte-array data to send
[in]RegisterAddrspecifies internal address register to read from.
[in]NumByteToWritenumber of bytes to write.
Return values:
IMU_6AXES_OKif ok,
IMU_6AXES_ERRORif an I2C error has occured

Definition at line 198 of file lsm6ds33_class.h.

IMU_6AXES_StatusTypeDef LSM6DS33_Read_XG_ID ( uint8_t *  xg_id ) [protected]

Read ID of LSM6DS33 Accelerometer and Gyroscope.

Parameters:
xg_idthe pointer where the ID of the device is stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 118 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_X_Get_FS ( float *  fullScale ) [protected]

Read Accelero Full Scale.

Parameters:
fullScalethe pointer where the accelerometer full scale is stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 533 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_X_Get_ODR ( float *  odr ) [protected]

Read Accelero Output Data Rate.

Parameters:
odrthe pointer where the accelerometer output data rate is stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 396 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_X_GetAxes ( int32_t *  pData ) [protected]

Read data from LSM6DS33 Accelerometer and calculate linear acceleration in mg.

Parameters:
pDatathe pointer where the accelerometer data are stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 216 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_X_GetAxesRaw ( int16_t *  pData ) [protected]

Read raw data from LSM6DS33 Accelerometer output register.

Parameters:
pDatathe pointer where the accelerometer raw data are stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 178 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_X_GetSensitivity ( float *  pfData ) [protected]

Read Accelero Sensitivity.

Parameters:
pfDatathe pointer where the accelerometer sensitivity is stored
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 493 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_X_Set_Axes_Status ( uint8_t  enableX,
uint8_t  enableY,
uint8_t  enableZ 
) [protected]

Set the status of the axes for accelerometer.

Parameters:
enableXthe status of the x axis to be set
enableYthe status of the y axis to be set
enableZthe status of the z axis to be set
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 284 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_X_Set_FS ( float  fullScale ) [protected]

Write Accelero Full Scale.

Parameters:
fullScalethe accelerometer full scale to be set
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 573 of file lsm6ds33_class.cpp.

IMU_6AXES_StatusTypeDef LSM6DS33_X_Set_ODR ( float  odr ) [protected]

Write Accelero Output Data Rate.

Parameters:
odrthe accelerometer output data rate to be set
Return values:
IMU_6AXES_OKin case of success, an error code otherwise

Definition at line 455 of file lsm6ds33_class.cpp.

virtual int read_id ( uint8_t *  id ) [virtual]

Getting the ID of the component.

Parameters:
[out]idpointer to an allocated variable to store the ID into.
Return values:
0in case of success, an error code otherwise.

Implements Component.

Definition at line 71 of file lsm6ds33_class.h.

virtual int set_g_fs ( float  fs ) [virtual]

Set gyroscope's full scale value i.e. min/max measurable value.

Parameters:
[in]fsNew full scale value for gyroscope in [dps]
Returns:
0 in case of success, an error code otherwise

Implements GyroSensor.

Definition at line 127 of file lsm6ds33_class.h.

virtual int set_g_odr ( float  odr ) [virtual]

Set gyroscope's output data rate.

Parameters:
[in]odrNew value for gyroscope's output data rate in [Hz]
Returns:
0 in case of success, an error code otherwise

Implements GyroSensor.

Definition at line 115 of file lsm6ds33_class.h.

virtual int set_x_fs ( float  fs ) [virtual]

Set accelerometer's full scale value i.e. min/max measurable value.

Parameters:
[in]fsNew full scale value for accelerometer in [g]
Returns:
0 in case of success, an error code otherwise

Implements MotionSensor.

Definition at line 107 of file lsm6ds33_class.h.

virtual int set_x_odr ( float  odr ) [virtual]

Set accelerometer's output data rate.

Parameters:
[in]odrNew value for accelerometer's output data rate in [Hz]
Returns:
0 in case of success, an error code otherwise

Implements MotionSensor.

Definition at line 95 of file lsm6ds33_class.h.