ST / IIS2DLPC

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Embed: (wiki syntax)

« Back to documentation index

IIS2DLPCSensor Class Reference

IIS2DLPCSensor Class Reference

Abstract class of an IIS2DLPC Inertial Measurement Unit (IMU) 3 axes sensor. More...

#include <IIS2DLPCSensor.h>

Public Member Functions

 IIS2DLPCSensor (DevI2C *i2c, uint8_t address=IIS2DLPC_I2C_ADD_H, PinName int1_pin=NC, PinName int2_pin=NC)
 Constructor.
 IIS2DLPCSensor (SPI *spi, PinName cs_pin, PinName int1_pin=NC, PinName int2_pin=NC, SPI_type_t spi_type=SPI4W)
 Constructor.
virtual int init (void *init)
 Initializing the component.
virtual int read_id (uint8_t *id)
 Read ID of IIS2DLPC Accelerometer and Gyroscope.
virtual int get_x_axes (int32_t *pData)
 Read data from IIS2DLPC Accelerometer.
virtual int get_x_sensitivity (float *pfData)
 Read Accelerometer Sensitivity.
virtual int get_x_axes_raw (int16_t *pData)
 Read raw data from IIS2DLPC Accelerometer.
virtual int get_x_odr (float *odr)
 Read IIS2DLPC Accelerometer output data rate.
virtual int set_x_odr (float odr)
 Set IIS2DLPC Accelerometer output data rate.
virtual int get_x_fs (float *fullScale)
 Read IIS2DLPC Accelerometer full scale.
virtual int set_x_fs (float fullScale)
 Set IIS2DLPC Accelerometer full scale.
int set_x_odr_with_mode (float odr, IIS2DLPC_Operating_Mode_t mode=IIS2DLPC_HIGH_PERFORMANCE_MODE, IIS2DLPC_Low_Noise_t noise=IIS2DLPC_LOW_NOISE_DISABLE)
 Set IIS2DLPC Accelerometer output data rate.
int enable_x (void)
 Enable IIS2DLPC Accelerator.
int disable_x (void)
 Disable IIS2DLPC Accelerator.
int enable_wake_up_detection (void)
 Enable the wake up detection for IIS2DLPC accelerometer sensor.
int disable_wake_up_detection (void)
 Disable the wake up detection for IIS2DLPC accelerometer sensor.
int set_wake_up_threshold (uint8_t thr)
 Set the wake up threshold for IIS2DLPC accelerometer sensor.
int set_wake_up_duration (uint8_t dur)
 Set the wake up duration for IIS2DLPC accelerometer sensor.
int enable_inactivity_detection (void)
 Enable the inactivity detection for IIS2DLPC accelerometer sensor.
int disable_inactivity_detection (void)
 Disable the inactivity detection for IIS2DLPC accelerometer sensor.
int set_sleep_duration (uint8_t dur)
 Set the sleep duration for IIS2DLPC accelerometer sensor.
int enable_6d_orientation (void)
 Enable the 6D orientation detection for IIS2DLPC accelerometer sensor.
int disable_6d_orientation (void)
 Disable the 6D orientation detection for IIS2DLPC accelerometer sensor.
int set_6d_orientation_threshold (uint8_t thr)
 Set the 6D orientation threshold for IIS2DLPC accelerometer sensor.
int get_6d_orientation_xl (uint8_t *xl)
 Get the 6D orientation XL axis for IIS2DLPC accelerometer sensor.
int get_6d_orientation_xh (uint8_t *xh)
 Get the 6D orientation XH axis for IIS2DLPC accelerometer sensor.
int get_6d_orientation_yl (uint8_t *yl)
 Get the 6D orientation YL axis for IIS2DLPC accelerometer sensor.
int get_6d_orientation_yh (uint8_t *yh)
 Get the 6D orientation YH axis for IIS2DLPC accelerometer sensor.
int get_6d_orientation_zl (uint8_t *zl)
 Get the 6D orientation ZL axis for IIS2DLPC accelerometer sensor.
int get_6d_orientation_zh (uint8_t *zh)
 Get the 6D orientation ZH axis for IIS2DLPC accelerometer sensor.
int get_event_status (IIS2DLPC_Event_Status_t *status)
 Get the status of all hardware events for IIS2DLPC accelerometer sensor.
int get_fifo_num_samples (uint16_t *num_samples)
 Get the number of samples contained into the FIFO.
int set_fifo_mode (uint8_t mode)
 Set the FIFO mode.
int read_reg (uint8_t reg, uint8_t *data)
 Read the data from register.
int write_reg (uint8_t reg, uint8_t data)
 Write the data to register.
void attach_int1_irq (void(*fptr)(void))
 Attaching an interrupt handler to the INT1 interrupt.
void enable_int1_irq (void)
 Enabling the INT1 interrupt handling.
void disable_int1_irq (void)
 Disabling the INT1 interrupt handling.
void attach_int2_irq (void(*fptr)(void))
 Attaching an interrupt handler to the INT2 interrupt.
void enable_int2_irq (void)
 Enabling the INT2 interrupt handling.
void disable_int2_irq (void)
 Disabling the INT2 interrupt handling.
uint8_t io_read (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead)
 Utility function to read data.
uint8_t io_write (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite)
 Utility function to write data.

Detailed Description

Abstract class of an IIS2DLPC Inertial Measurement Unit (IMU) 3 axes sensor.

Definition at line 97 of file IIS2DLPCSensor.h.


Constructor & Destructor Documentation

IIS2DLPCSensor ( DevI2C *  i2c,
uint8_t  address = IIS2DLPC_I2C_ADD_H,
PinName  int1_pin = NC,
PinName  int2_pin = NC 
)

Constructor.

Parameters:
i2cobject of an helper class which handles the I2C peripheral
addressthe address of the component's instance
int1_pinthe interrupt 1 pin
int2_pinthe interrupt 2 pin

Definition at line 53 of file IIS2DLPCSensor.cpp.

IIS2DLPCSensor ( SPI *  spi,
PinName  cs_pin,
PinName  int1_pin = NC,
PinName  int2_pin = NC,
SPI_type_t  spi_type = SPI4W 
)

Constructor.

Parameters:
spiobject of an helper class which handles the SPI peripheral
cs_pinthe chip select pin
int1_pinthe interrupt 1 pin
int2_pinthe interrupt 2 pin
spi_typethe SPI type (4-Wires or 3-Wires)

Definition at line 70 of file IIS2DLPCSensor.cpp.


Member Function Documentation

void attach_int1_irq ( void(*)(void)  fptr )

Attaching an interrupt handler to the INT1 interrupt.

Parameters:
fptrAn interrupt handler.
Return values:
None.

Definition at line 142 of file IIS2DLPCSensor.h.

void attach_int2_irq ( void(*)(void)  fptr )

Attaching an interrupt handler to the INT2 interrupt.

Parameters:
fptrAn interrupt handler.
Return values:
None.

Definition at line 172 of file IIS2DLPCSensor.h.

int disable_6d_orientation ( void   )

Disable the 6D orientation detection for IIS2DLPC accelerometer sensor.

Return values:
0in case of success, an error code otherwise

Definition at line 1195 of file IIS2DLPCSensor.cpp.

int disable_inactivity_detection ( void   )

Disable the inactivity detection for IIS2DLPC accelerometer sensor.

Return values:
0in case of success, an error code otherwise

Definition at line 1069 of file IIS2DLPCSensor.cpp.

void disable_int1_irq ( void   )

Disabling the INT1 interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 162 of file IIS2DLPCSensor.h.

void disable_int2_irq ( void   )

Disabling the INT2 interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 192 of file IIS2DLPCSensor.h.

int disable_wake_up_detection ( void   )

Disable the wake up detection for IIS2DLPC accelerometer sensor.

Return values:
0in case of success, an error code otherwise

Definition at line 933 of file IIS2DLPCSensor.cpp.

int disable_x ( void   )

Disable IIS2DLPC Accelerator.

Return values:
0in case of success, an error code otherwise

Definition at line 182 of file IIS2DLPCSensor.cpp.

int enable_6d_orientation ( void   )

Enable the 6D orientation detection for IIS2DLPC accelerometer sensor.

Note:
This function sets the IIS2DLPC accelerometer ODR to 200Hz and the IIS2DLPC accelerometer full scale to 2g
Return values:
0in case of success, an error code otherwise

Definition at line 1152 of file IIS2DLPCSensor.cpp.

int enable_inactivity_detection ( void   )

Enable the inactivity detection for IIS2DLPC accelerometer sensor.

Return values:
0in case of success, an error code otherwise

Definition at line 1025 of file IIS2DLPCSensor.cpp.

void enable_int1_irq ( void   )

Enabling the INT1 interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 152 of file IIS2DLPCSensor.h.

void enable_int2_irq ( void   )

Enabling the INT2 interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 182 of file IIS2DLPCSensor.h.

int enable_wake_up_detection ( void   )

Enable the wake up detection for IIS2DLPC accelerometer sensor.

Note:
This function sets the IIS2DLPC accelerometer ODR to 200Hz and the IIS2DLPC accelerometer full scale to 2g
Return values:
0in case of success, an error code otherwise

Definition at line 885 of file IIS2DLPCSensor.cpp.

int enable_x ( void   )

Enable IIS2DLPC Accelerator.

Return values:
0in case of success, an error code otherwise

Definition at line 159 of file IIS2DLPCSensor.cpp.

int get_6d_orientation_xh ( uint8_t *  xh )

Get the 6D orientation XH axis for IIS2DLPC accelerometer sensor.

Parameters:
xhthe pointer to the 6D orientation XH axis
Return values:
0in case of success, an error code otherwise

Definition at line 1289 of file IIS2DLPCSensor.cpp.

int get_6d_orientation_xl ( uint8_t *  xl )

Get the 6D orientation XL axis for IIS2DLPC accelerometer sensor.

Parameters:
xlthe pointer to the 6D orientation XL axis
Return values:
0in case of success, an error code otherwise

Definition at line 1270 of file IIS2DLPCSensor.cpp.

int get_6d_orientation_yh ( uint8_t *  yh )

Get the 6D orientation YH axis for IIS2DLPC accelerometer sensor.

Parameters:
yhthe pointer to the 6D orientation YH axis
Return values:
0in case of success, an error code otherwise

Definition at line 1327 of file IIS2DLPCSensor.cpp.

int get_6d_orientation_yl ( uint8_t *  yl )

Get the 6D orientation YL axis for IIS2DLPC accelerometer sensor.

Parameters:
ylthe pointer to the 6D orientation YL axis
Return values:
0in case of success, an error code otherwise

Definition at line 1308 of file IIS2DLPCSensor.cpp.

int get_6d_orientation_zh ( uint8_t *  zh )

Get the 6D orientation ZH axis for IIS2DLPC accelerometer sensor.

Parameters:
zhthe pointer to the 6D orientation ZH axis
Return values:
0in case of success, an error code otherwise

Definition at line 1365 of file IIS2DLPCSensor.cpp.

int get_6d_orientation_zl ( uint8_t *  zl )

Get the 6D orientation ZL axis for IIS2DLPC accelerometer sensor.

Parameters:
zlthe pointer to the 6D orientation ZL axis
Return values:
0in case of success, an error code otherwise

Definition at line 1346 of file IIS2DLPCSensor.cpp.

int get_event_status ( IIS2DLPC_Event_Status_t *  status )

Get the status of all hardware events for IIS2DLPC accelerometer sensor.

Parameters:
statusthe pointer to the status of all hardware events
Return values:
0in case of success, an error code otherwise

Definition at line 1384 of file IIS2DLPCSensor.cpp.

int get_fifo_num_samples ( uint16_t *  num_samples )

Get the number of samples contained into the FIFO.

Parameters:
num_samplesthe number of samples contained into the FIFO
Return values:
0in case of success, an error code otherwise

Definition at line 1439 of file IIS2DLPCSensor.cpp.

int get_x_axes ( int32_t *  acceleration ) [virtual]

Read data from IIS2DLPC Accelerometer.

Parameters:
accelerationthe pointer where the accelerometer data are stored
Return values:
0in case of success, an error code otherwise

Definition at line 227 of file IIS2DLPCSensor.cpp.

int get_x_axes_raw ( int16_t *  value ) [virtual]

Read raw data from IIS2DLPC Accelerometer.

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

Definition at line 359 of file IIS2DLPCSensor.cpp.

int get_x_fs ( float *  full_scale ) [virtual]

Read IIS2DLPC Accelerometer full scale.

Parameters:
full_scalethe pointer to the full scale
Return values:
0in case of success, an error code otherwise

Definition at line 818 of file IIS2DLPCSensor.cpp.

int get_x_odr ( float *  odr ) [virtual]

Read IIS2DLPC Accelerometer output data rate.

Parameters:
odrthe pointer to the output data rate
Return values:
0in case of success, an error code otherwise

Definition at line 422 of file IIS2DLPCSensor.cpp.

int get_x_sensitivity ( float *  sensitivity ) [virtual]

Read Accelerometer Sensitivity.

Parameters:
sensitivitythe pointer where the accelerometer sensitivity is stored
Return values:
0in case of success, an error code otherwise

Definition at line 257 of file IIS2DLPCSensor.cpp.

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.

Definition at line 104 of file IIS2DLPCSensor.cpp.

uint8_t io_read ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToRead 
)

Utility function to read data.

Parameters:
pBuffer,:pointer to data to be read.
RegisterAddr,:specifies internal address register to be read.
NumByteToRead,:number of bytes to be read.
Return values:
0if ok, an error code otherwise.

Definition at line 204 of file IIS2DLPCSensor.h.

uint8_t io_write ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToWrite 
)

Utility function to write data.

Parameters:
pBuffer,:pointer to data to be written.
RegisterAddr,:specifies internal address register to be written.
NumByteToWrite,:number of bytes to write.
Return values:
0if ok, an error code otherwise.

Definition at line 235 of file IIS2DLPCSensor.h.

int read_id ( uint8_t *  id ) [virtual]

Read ID of IIS2DLPC Accelerometer and Gyroscope.

Parameters:
p_idthe pointer where the ID of the device is stored
Return values:
0in case of success, an error code otherwise

Definition at line 206 of file IIS2DLPCSensor.cpp.

int read_reg ( uint8_t  reg,
uint8_t *  data 
)

Read the data from register.

Parameters:
regregister address
dataregister data
Return values:
0in case of success, an error code otherwise

Definition at line 1503 of file IIS2DLPCSensor.cpp.

int set_6d_orientation_threshold ( uint8_t  thr )

Set the 6D orientation threshold for IIS2DLPC accelerometer sensor.

Parameters:
thrthe threshold to be set
Return values:
0in case of success, an error code otherwise

Definition at line 1250 of file IIS2DLPCSensor.cpp.

int set_fifo_mode ( uint8_t  mode )

Set the FIFO mode.

Parameters:
modeFIFO mode
Return values:
0in case of success, an error code otherwise

Definition at line 1465 of file IIS2DLPCSensor.cpp.

int set_sleep_duration ( uint8_t  dur )

Set the sleep duration for IIS2DLPC accelerometer sensor.

Parameters:
durthe duration to be set
Return values:
0in case of success, an error code otherwise

Definition at line 1136 of file IIS2DLPCSensor.cpp.

int set_wake_up_duration ( uint8_t  dur )

Set the wake up duration for IIS2DLPC accelerometer sensor.

Parameters:
durthe duration to be set
Return values:
0in case of success, an error code otherwise

Definition at line 1010 of file IIS2DLPCSensor.cpp.

int set_wake_up_threshold ( uint8_t  thr )

Set the wake up threshold for IIS2DLPC accelerometer sensor.

Parameters:
thrthe threshold to be set
Return values:
0in case of success, an error code otherwise

Definition at line 994 of file IIS2DLPCSensor.cpp.

int set_x_fs ( float  full_scale ) [virtual]

Set IIS2DLPC Accelerometer full scale.

Parameters:
full_scalethe full scale to be set
Return values:
0in case of success, an error code otherwise

Definition at line 861 of file IIS2DLPCSensor.cpp.

int set_x_odr ( float  odr ) [virtual]

Set IIS2DLPC Accelerometer output data rate.

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

Definition at line 618 of file IIS2DLPCSensor.cpp.

int set_x_odr_with_mode ( float  odr,
IIS2DLPC_Operating_Mode_t  mode = IIS2DLPC_HIGH_PERFORMANCE_MODE,
IIS2DLPC_Low_Noise_t  noise = IIS2DLPC_LOW_NOISE_DISABLE 
)

Set IIS2DLPC Accelerometer output data rate.

Parameters:
odrthe output data rate to be set
modethe operating mode to be used
noisethe low noise option
Return values:
0in case of success, an error code otherwise

Definition at line 630 of file IIS2DLPCSensor.cpp.

int write_reg ( uint8_t  reg,
uint8_t  data 
)

Write the data to register.

Parameters:
regregister address
dataregister data
Return values:
0in case of success, an error code otherwise

Definition at line 1520 of file IIS2DLPCSensor.cpp.