Yong Jee / X_NUCLEO_IKS01A1

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   test2

Embed: (wiki syntax)

« Back to documentation index

X_NUCLEO_IKS01A1 Class Reference

X_NUCLEO_IKS01A1 Class Reference

Class X_NUCLEO_IKS01A1 is intended to represent the MEMS Inertial & Environmental Nucleo Expansion Board with the same name. More...

#include <x_nucleo_iks01a1.h>

Static Public Member Functions

static X_NUCLEO_IKS01A1Instance (DevI2C *ext_i2c=NULL, PinName ff_irq_pin=IKS01A1_PIN_FF)
 Get singleton instance.
static X_NUCLEO_IKS01A1Instance (PinName sda, PinName scl, PinName ff_irq_pin=NC)
 Get singleton instance.

Protected Member Functions

 X_NUCLEO_IKS01A1 (DevI2C *ext_i2c, PinName ff_irq_pin)
 Constructor.
bool Init (void)
 Initialize the singleton's sensors to default settings.
bool Init_Gyro (void)
 Initialize the singleton's gyroscope.
bool Init_HTS221 (void)
 Initialize the singleton's HT sensor.
bool Init_LIS3MDL (void)
 Initialize the singleton's magnetometer.
bool Init_LPS25H (void)
 Initialize the singleton's pressure sensor.
bool Init_LSM6DS0 (void)
 Initialize the singleton's LSM6DS0 gyroscope.
bool Init_LSM6DS3 (void)
 Initialize the singleton's LSMDS3 gyroscope.

Detailed Description

Class X_NUCLEO_IKS01A1 is intended to represent the MEMS Inertial & Environmental Nucleo Expansion Board with the same name.

The expansion board is featuring basically four IPs:

  1. a HTS221 Relative Humidity and Temperature Sensor
  2. a LIS3MDL 3-Axis Magnetometer
  3. a LPS25H MEMS Pressure Sensor (and Temperature Sensor)
  4. and a LSM6DS0 3D Acceleromenter and 3D Gyroscope

The expansion board features also a DIL 24-pin socket which makes it possible to add further MEMS adapters and other sensors (e.g. UV index).

It is intentionally implemented as a singleton because only one X_NUCLEO_IKS01A1 at a time might be deployed in a HW component stack.
In order to get the singleton instance you have to call class method `Instance()`, e.g.:

 // Inertial & Environmental expansion board singleton instance
 static X_NUCLEO_IKS01A1 *<TODO>_expansion_board = X_NUCLEO_IKS01A1::Instance();

Definition at line 81 of file x_nucleo_iks01a1.h.


Constructor & Destructor Documentation

X_NUCLEO_IKS01A1 ( DevI2C *  ext_i2c,
PinName  ff_irq_pin 
) [protected]

Constructor.

Definition at line 50 of file x_nucleo_iks01a1.cpp.


Member Function Documentation

bool Init ( void   ) [protected]

Initialize the singleton's sensors to default settings.

Return values:
trueif initialization successful,
falseotherwise

Definition at line 96 of file x_nucleo_iks01a1.h.

bool Init_Gyro ( void   ) [protected]

Initialize the singleton's gyroscope.

Return values:
trueif initialization successful,
falseotherwise
Note:
only one sensor among LSM6DS3 & LSM6DS0 will be instantiated with a preference on LSM6DS3 when available

Definition at line 110 of file x_nucleo_iks01a1.h.

bool Init_HTS221 ( void   ) [protected]

Initialize the singleton's HT sensor.

Return values:
trueif initialization successful,
falseotherwise

Definition at line 142 of file x_nucleo_iks01a1.cpp.

bool Init_LIS3MDL ( void   ) [protected]

Initialize the singleton's magnetometer.

Return values:
trueif initialization successful,
falseotherwise

Definition at line 171 of file x_nucleo_iks01a1.cpp.

bool Init_LPS25H ( void   ) [protected]

Initialize the singleton's pressure sensor.

Return values:
trueif initialization successful,
falseotherwise

Definition at line 203 of file x_nucleo_iks01a1.cpp.

bool Init_LSM6DS0 ( void   ) [protected]

Initialize the singleton's LSM6DS0 gyroscope.

Return values:
trueif initialization successful,
falseotherwise

Definition at line 237 of file x_nucleo_iks01a1.cpp.

bool Init_LSM6DS3 ( void   ) [protected]

Initialize the singleton's LSMDS3 gyroscope.

Return values:
trueif initialization successful,
falseotherwise

Definition at line 277 of file x_nucleo_iks01a1.cpp.

X_NUCLEO_IKS01A1 * Instance ( DevI2C *  ext_i2c = NULL,
PinName  ff_irq_pin = IKS01A1_PIN_FF 
) [static]

Get singleton instance.

Returns:
a pointer to the initialized singleton instance of class X_NUCLEO_IKS01A1. A return value of NULL indicates an out of memory situation.
Parameters:
[in]ext_i2c(optional) pointer to an instance of DevI2C to be used for communication on the expansion board. Defaults to NULL. Taken into account only on the very first call of one of the 'Instance' functions. If not provided a new DevI2C will be created with standard configuration parameters. The used DevI2C object gets saved in instance variable dev_i2c.
[in]ff_irq_pin(optional) PinName of the pin associated to asynchronous (i.e. interrupt based) free fall detection in case a LSM6DS3 3D Acceleromenter and 3D Gyroscope is mounted on top of the DIL 24-pin socket. Defaults to IKS01A1_PIN_FF. Taken into account only on the very first call of one of the 'Instance' functions. A value of 'NC' will avoid instantiation of the LSM6DS3 even if present.

Definition at line 81 of file x_nucleo_iks01a1.cpp.

X_NUCLEO_IKS01A1 * Instance ( PinName  sda,
PinName  scl,
PinName  ff_irq_pin = NC 
) [static]

Get singleton instance.

Returns:
a pointer to the initialized singleton instance of class X_NUCLEO_IKS01A1. A return value of NULL indicates an out of memory situation.
Parameters:
[in]sdaI2C data line pin. Taken into account only on the very first call of one of the 'Instance' functions. A new DevI2C will be created based on parameters 'sda' and 'scl'. The used DevI2C object gets saved in instance variable dev_i2c.
[in]sclI2C clock line pin. Taken into account only on the very first call of one of the 'Instance' functions. A new DevI2C will be created based on parameters 'sda' and 'scl'. The used DevI2C object gets saved in instance variable dev_i2c.
[in]ff_irq_pin(optional) PinName of the pin associated to asynchronous (i.e. interrupt based) free fall detection in case a LSM6DS3 3D Acceleromenter and 3D Gyroscope is mounted on top of the DIL 24-pin socket. Defaults to NC. Taken into account only on the very first call of one of the 'Instance' functions. A value of 'NC' will avoid instantiation of the LSM6DS3 even if present.

Definition at line 119 of file x_nucleo_iks01a1.cpp.