3-axis MEMS ultra low power accelerometer
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: X_NUCLEO_IKS01A3 X_NUCLEO_IKS01A3
LIS2DW12Sensor Class Reference
Abstract class of an LIS2DW12 Inertial Measurement Unit (IMU) 3 axes sensor. More...
#include <LIS2DW12Sensor.h>
Public Member Functions | |
LIS2DW12Sensor (DevI2C *i2c, uint8_t address=LIS2DW12_I2C_ADD_H, PinName int1_pin=NC, PinName int2_pin=NC) | |
Constructor. | |
LIS2DW12Sensor (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 LIS2DW12 Accelerometer and Gyroscope. | |
virtual int | get_x_axes (int32_t *pData) |
Read data from LIS2DW12 Accelerometer. | |
virtual int | get_x_sensitivity (float *pfData) |
Read Accelerometer Sensitivity. | |
virtual int | get_x_axes_raw (int16_t *pData) |
Read raw data from LIS2DW12 Accelerometer. | |
virtual int | get_x_odr (float *odr) |
Read LIS2DW12 Accelerometer output data rate. | |
virtual int | set_x_odr (float odr) |
Set LIS2DW12 Accelerometer output data rate. | |
virtual int | get_x_fs (float *fullScale) |
Read LIS2DW12 Accelerometer full scale. | |
virtual int | set_x_fs (float fullScale) |
Set LIS2DW12 Accelerometer full scale. | |
int | set_x_odr_with_mode (float odr, LIS2DW12_Operating_Mode_t mode=LIS2DW12_HIGH_PERFORMANCE_MODE, LIS2DW12_Low_Noise_t noise=LIS2DW12_LOW_NOISE_DISABLE) |
Set LIS2DW12 Accelerometer output data rate. | |
int | enable_x (void) |
Enable LIS2DW12 Accelerator. | |
int | disable_x (void) |
Disable LIS2DW12 Accelerator. | |
int | enable_wake_up_detection (void) |
Enable the wake up detection for LIS2DW12 accelerometer sensor. | |
int | disable_wake_up_detection (void) |
Disable the wake up detection for LIS2DW12 accelerometer sensor. | |
int | set_wake_up_threshold (uint8_t thr) |
Set the wake up threshold for LIS2DW12 accelerometer sensor. | |
int | set_wake_up_duration (uint8_t dur) |
Set the wake up duration for LIS2DW12 accelerometer sensor. | |
int | enable_inactivity_detection (void) |
Enable the inactivity detection for LIS2DW12 accelerometer sensor. | |
int | disable_inactivity_detection (void) |
Disable the inactivity detection for LIS2DW12 accelerometer sensor. | |
int | set_sleep_duration (uint8_t dur) |
Set the sleep duration for LIS2DW12 accelerometer sensor. | |
int | enable_6d_orientation (void) |
Enable the 6D orientation detection for LIS2DW12 accelerometer sensor. | |
int | disable_6d_orientation (void) |
Disable the 6D orientation detection for LIS2DW12 accelerometer sensor. | |
int | set_6d_orientation_threshold (uint8_t thr) |
Set the 6D orientation threshold for LIS2DW12 accelerometer sensor. | |
int | get_6d_orientation_xl (uint8_t *xl) |
Get the 6D orientation XL axis for LIS2DW12 accelerometer sensor. | |
int | get_6d_orientation_xh (uint8_t *xh) |
Get the 6D orientation XH axis for LIS2DW12 accelerometer sensor. | |
int | get_6d_orientation_yl (uint8_t *yl) |
Get the 6D orientation YL axis for LIS2DW12 accelerometer sensor. | |
int | get_6d_orientation_yh (uint8_t *yh) |
Get the 6D orientation YH axis for LIS2DW12 accelerometer sensor. | |
int | get_6d_orientation_zl (uint8_t *zl) |
Get the 6D orientation ZL axis for LIS2DW12 accelerometer sensor. | |
int | get_6d_orientation_zh (uint8_t *zh) |
Get the 6D orientation ZH axis for LIS2DW12 accelerometer sensor. | |
int | get_event_status (LIS2DW12_Event_Status_t *status) |
Get the status of all hardware events for LIS2DW12 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 LIS2DW12 Inertial Measurement Unit (IMU) 3 axes sensor.
Definition at line 94 of file LIS2DW12Sensor.h.
Constructor & Destructor Documentation
LIS2DW12Sensor | ( | DevI2C * | i2c, |
uint8_t | address = LIS2DW12_I2C_ADD_H , |
||
PinName | int1_pin = NC , |
||
PinName | int2_pin = NC |
||
) |
Constructor.
- Parameters:
-
i2c object of an helper class which handles the I2C peripheral address the address of the component's instance int1_pin the interrupt 1 pin int2_pin the interrupt 2 pin
Definition at line 53 of file LIS2DW12Sensor.cpp.
LIS2DW12Sensor | ( | SPI * | spi, |
PinName | cs_pin, | ||
PinName | int1_pin = NC , |
||
PinName | int2_pin = NC , |
||
SPI_type_t | spi_type = SPI4W |
||
) |
Constructor.
- Parameters:
-
spi object of an helper class which handles the SPI peripheral cs_pin the chip select pin int1_pin the interrupt 1 pin int2_pin the interrupt 2 pin spi_type the SPI type (4-Wires or 3-Wires)
Definition at line 70 of file LIS2DW12Sensor.cpp.
Member Function Documentation
void attach_int1_irq | ( | void(*)(void) | fptr ) |
Attaching an interrupt handler to the INT1 interrupt.
- Parameters:
-
fptr An interrupt handler.
- Return values:
-
None.
Definition at line 138 of file LIS2DW12Sensor.h.
void attach_int2_irq | ( | void(*)(void) | fptr ) |
Attaching an interrupt handler to the INT2 interrupt.
- Parameters:
-
fptr An interrupt handler.
- Return values:
-
None.
Definition at line 168 of file LIS2DW12Sensor.h.
int disable_6d_orientation | ( | void | ) |
Disable the 6D orientation detection for LIS2DW12 accelerometer sensor.
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1107 of file LIS2DW12Sensor.cpp.
int disable_inactivity_detection | ( | void | ) |
Disable the inactivity detection for LIS2DW12 accelerometer sensor.
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 996 of file LIS2DW12Sensor.cpp.
void disable_int1_irq | ( | void | ) |
Disabling the INT1 interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 158 of file LIS2DW12Sensor.h.
void disable_int2_irq | ( | void | ) |
Disabling the INT2 interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 188 of file LIS2DW12Sensor.h.
int disable_wake_up_detection | ( | void | ) |
Disable the wake up detection for LIS2DW12 accelerometer sensor.
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 875 of file LIS2DW12Sensor.cpp.
int disable_x | ( | void | ) |
Disable LIS2DW12 Accelerator.
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 172 of file LIS2DW12Sensor.cpp.
int enable_6d_orientation | ( | void | ) |
Enable the 6D orientation detection for LIS2DW12 accelerometer sensor.
- Note:
- This function sets the LIS2DW12 accelerometer ODR to 200Hz and the LIS2DW12 accelerometer full scale to 2g
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1069 of file LIS2DW12Sensor.cpp.
int enable_inactivity_detection | ( | void | ) |
Enable the inactivity detection for LIS2DW12 accelerometer sensor.
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 957 of file LIS2DW12Sensor.cpp.
void enable_int1_irq | ( | void | ) |
Enabling the INT1 interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 148 of file LIS2DW12Sensor.h.
void enable_int2_irq | ( | void | ) |
Enabling the INT2 interrupt handling.
- Parameters:
-
None.
- Return values:
-
None.
Definition at line 178 of file LIS2DW12Sensor.h.
int enable_wake_up_detection | ( | void | ) |
Enable the wake up detection for LIS2DW12 accelerometer sensor.
- Note:
- This function sets the LIS2DW12 accelerometer ODR to 200Hz and the LIS2DW12 accelerometer full scale to 2g
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 833 of file LIS2DW12Sensor.cpp.
int enable_x | ( | void | ) |
Enable LIS2DW12 Accelerator.
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 151 of file LIS2DW12Sensor.cpp.
int get_6d_orientation_xh | ( | uint8_t * | xh ) |
Get the 6D orientation XH axis for LIS2DW12 accelerometer sensor.
- Parameters:
-
xh the pointer to the 6D orientation XH axis
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1191 of file LIS2DW12Sensor.cpp.
int get_6d_orientation_xl | ( | uint8_t * | xl ) |
Get the 6D orientation XL axis for LIS2DW12 accelerometer sensor.
- Parameters:
-
xl the pointer to the 6D orientation XL axis
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1173 of file LIS2DW12Sensor.cpp.
int get_6d_orientation_yh | ( | uint8_t * | yh ) |
Get the 6D orientation YH axis for LIS2DW12 accelerometer sensor.
- Parameters:
-
yh the pointer to the 6D orientation YH axis
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1227 of file LIS2DW12Sensor.cpp.
int get_6d_orientation_yl | ( | uint8_t * | yl ) |
Get the 6D orientation YL axis for LIS2DW12 accelerometer sensor.
- Parameters:
-
yl the pointer to the 6D orientation YL axis
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1209 of file LIS2DW12Sensor.cpp.
int get_6d_orientation_zh | ( | uint8_t * | zh ) |
Get the 6D orientation ZH axis for LIS2DW12 accelerometer sensor.
- Parameters:
-
zh the pointer to the 6D orientation ZH axis
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1263 of file LIS2DW12Sensor.cpp.
int get_6d_orientation_zl | ( | uint8_t * | zl ) |
Get the 6D orientation ZL axis for LIS2DW12 accelerometer sensor.
- Parameters:
-
zl the pointer to the 6D orientation ZL axis
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1245 of file LIS2DW12Sensor.cpp.
int get_event_status | ( | LIS2DW12_Event_Status_t * | status ) |
Get the status of all hardware events for LIS2DW12 accelerometer sensor.
- Parameters:
-
status the pointer to the status of all hardware events
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1281 of file LIS2DW12Sensor.cpp.
int get_fifo_num_samples | ( | uint16_t * | num_samples ) |
Get the number of samples contained into the FIFO.
- Parameters:
-
num_samples the number of samples contained into the FIFO
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1327 of file LIS2DW12Sensor.cpp.
int get_x_axes | ( | int32_t * | acceleration ) | [virtual] |
Read data from LIS2DW12 Accelerometer.
- Parameters:
-
acceleration the pointer where the accelerometer data are stored
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 213 of file LIS2DW12Sensor.cpp.
int get_x_axes_raw | ( | int16_t * | value ) | [virtual] |
Read raw data from LIS2DW12 Accelerometer.
- Parameters:
-
value the pointer where the accelerometer raw data are stored
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 338 of file LIS2DW12Sensor.cpp.
int get_x_fs | ( | float * | full_scale ) | [virtual] |
Read LIS2DW12 Accelerometer full scale.
- Parameters:
-
full_scale the pointer to the full scale
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 769 of file LIS2DW12Sensor.cpp.
int get_x_odr | ( | float * | odr ) | [virtual] |
Read LIS2DW12 Accelerometer output data rate.
- Parameters:
-
odr the pointer to the output data rate
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 398 of file LIS2DW12Sensor.cpp.
int get_x_sensitivity | ( | float * | sensitivity ) | [virtual] |
Read Accelerometer Sensitivity.
- Parameters:
-
sensitivity the pointer where the accelerometer sensitivity is stored
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 241 of file LIS2DW12Sensor.cpp.
int init | ( | void * | init ) | [virtual] |
Initializing the component.
- Parameters:
-
[in] init pointer to device specific initalization structure.
- Return values:
-
0 in case of success, an error code otherwise.
Definition at line 102 of file LIS2DW12Sensor.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:
-
0 if ok, an error code otherwise.
Definition at line 200 of file LIS2DW12Sensor.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:
-
0 if ok, an error code otherwise.
Definition at line 233 of file LIS2DW12Sensor.h.
int read_id | ( | uint8_t * | id ) | [virtual] |
Read ID of LIS2DW12 Accelerometer and Gyroscope.
- Parameters:
-
p_id the pointer where the ID of the device is stored
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 194 of file LIS2DW12Sensor.cpp.
int read_reg | ( | uint8_t | reg, |
uint8_t * | data | ||
) |
Read the data from register.
- Parameters:
-
reg register address data register data
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1384 of file LIS2DW12Sensor.cpp.
int set_6d_orientation_threshold | ( | uint8_t | thr ) |
Set the 6D orientation threshold for LIS2DW12 accelerometer sensor.
- Parameters:
-
thr the threshold to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1155 of file LIS2DW12Sensor.cpp.
int set_fifo_mode | ( | uint8_t | mode ) |
Set the FIFO mode.
- Parameters:
-
mode FIFO mode
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1349 of file LIS2DW12Sensor.cpp.
int set_sleep_duration | ( | uint8_t | dur ) |
Set the sleep duration for LIS2DW12 accelerometer sensor.
- Parameters:
-
dur the duration to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1054 of file LIS2DW12Sensor.cpp.
int set_wake_up_duration | ( | uint8_t | dur ) |
Set the wake up duration for LIS2DW12 accelerometer sensor.
- Parameters:
-
dur the duration to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 943 of file LIS2DW12Sensor.cpp.
int set_wake_up_threshold | ( | uint8_t | thr ) |
Set the wake up threshold for LIS2DW12 accelerometer sensor.
- Parameters:
-
thr the threshold to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 928 of file LIS2DW12Sensor.cpp.
int set_x_fs | ( | float | full_scale ) | [virtual] |
Set LIS2DW12 Accelerometer full scale.
- Parameters:
-
full_scale the full scale to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 810 of file LIS2DW12Sensor.cpp.
int set_x_odr | ( | float | odr ) | [virtual] |
Set LIS2DW12 Accelerometer output data rate.
- Parameters:
-
odr the output data rate to be set
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 587 of file LIS2DW12Sensor.cpp.
int set_x_odr_with_mode | ( | float | odr, |
LIS2DW12_Operating_Mode_t | mode = LIS2DW12_HIGH_PERFORMANCE_MODE , |
||
LIS2DW12_Low_Noise_t | noise = LIS2DW12_LOW_NOISE_DISABLE |
||
) |
Set LIS2DW12 Accelerometer output data rate.
- Parameters:
-
odr the output data rate to be set mode the operating mode to be used noise the low noise option
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 599 of file LIS2DW12Sensor.cpp.
int write_reg | ( | uint8_t | reg, |
uint8_t | data | ||
) |
Write the data to register.
- Parameters:
-
reg register address data register data
- Return values:
-
0 in case of success, an error code otherwise
Definition at line 1400 of file LIS2DW12Sensor.cpp.
Generated on Thu Jul 14 2022 10:48:26 by 1.7.2