Firmware Library for X-NUCLEO-IKS01A1 (MEMS Inertial & Environmental Sensors) Expansion Board
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: MultiTech_Dragonfly_2015_ATT_Gov_Solutions_Hackathon_Example HelloWorld_IKS01A1 LoRaWAN-test-10secs ServoMotorDemo ... more
Fork of X_NUCLEO_IKS01A1 by
X-NUCLEO-IKS01A1 MEMS Inertial & Environmental Sensor Nucleo Expansion Board Firmware Package
Introduction
This firmware package includes Components Device Drivers and Board Support Package for STMicroelectronics' X-NUCLEO-IKS01A1 MEMS Inertial & Environmental Sensors Nucleo Expansion Board.
Firmware Library
Class X_NUCLEO_IKS01A1 is intended to represent the MEMS inertial & environmental sensors expansion board with the same name.
The expansion board is basically featuring four IPs:
- a HTS221 Relative Humidity and Temperature Sensor,
- a LIS3MDL 3-Axis Magnetometer,
- a LPS25H MEMS Pressure Sensor, and
- a LSM6DS0 3D Accelerometer 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.:
// Sensors expansion board singleton instance static X_NUCLEO_IKS01A1 *sensors_expansion_board = X_NUCLEO_IKS01A1::Instance();
Furthermore, library ST_INTERFACES
contains all abstract classes which together constitute the common API to which all existing and future ST components will adhere to.
Example Applications
Diff: x_nucleo_iks01a1.cpp
- Revision:
- 92:d1c67d482bad
- Parent:
- 73:e5b028bdd350
--- a/x_nucleo_iks01a1.cpp Thu Mar 23 13:05:15 2017 +0000 +++ b/x_nucleo_iks01a1.cpp Fri Mar 24 10:57:29 2017 +0100 @@ -144,7 +144,7 @@ HUM_TEMP_InitTypeDef InitStructure; /* Check presence */ - if((ht_sensor->ReadID(&ht_id) != HUM_TEMP_OK) || + if((ht_sensor->read_id(&ht_id) != HUM_TEMP_OK) || (ht_id != I_AM_HTS221)) { delete ht_sensor; @@ -155,7 +155,7 @@ /* Configure sensor */ InitStructure.OutputDataRate = HTS221_ODR_12_5Hz; - if(ht_sensor->Init(&InitStructure) != HUM_TEMP_OK) + if(ht_sensor->init(&InitStructure) != HUM_TEMP_OK) { return false; } @@ -173,7 +173,7 @@ MAGNETO_InitTypeDef InitStructure; /* Check presence */ - if((magnetometer->ReadID(&m_id) != MAGNETO_OK) || + if((magnetometer->read_id(&m_id) != MAGNETO_OK) || (m_id != I_AM_LIS3MDL_M)) { delete magnetometer; @@ -187,7 +187,7 @@ InitStructure.M_XYOperativeMode = LIS3MDL_M_OM_HP; InitStructure.M_OutputDataRate = LIS3MDL_M_DO_80; - if(magnetometer->Init(&InitStructure) != MAGNETO_OK) + if(magnetometer->init(&InitStructure) != MAGNETO_OK) { return false; } @@ -205,7 +205,7 @@ PRESSURE_InitTypeDef InitStructure; /* Check presence */ - if((pt_sensor->ReadID(&p_id) != PRESSURE_OK) || + if((pt_sensor->read_id(&p_id) != PRESSURE_OK) || (p_id != I_AM_LPS25H)) { delete pt_sensor; @@ -221,7 +221,7 @@ InitStructure.PressureResolution = LPS25H_P_RES_AVG_32; InitStructure.TemperatureResolution = LPS25H_T_RES_AVG_16; - if(pt_sensor->Init(&InitStructure) != PRESSURE_OK) + if(pt_sensor->init(&InitStructure) != PRESSURE_OK) { return false; } @@ -240,7 +240,7 @@ /* Check presence */ if((gyro_lsm6ds3 != NULL) || // by default do not instantiate two gyroscopes - (gyro_lsm6ds0->ReadID(&xg_id) != IMU_6AXES_OK) || + (gyro_lsm6ds0->read_id(&xg_id) != IMU_6AXES_OK) || (xg_id != I_AM_LSM6DS0_XG)) { delete gyro_lsm6ds0; @@ -261,7 +261,7 @@ InitStructure.X_Y_Axis = 1; /* Enable */ InitStructure.X_Z_Axis = 1; /* Enable */ - if(gyro_lsm6ds0->Init(&InitStructure) != IMU_6AXES_OK) + if(gyro_lsm6ds0->init(&InitStructure) != IMU_6AXES_OK) { return false; } @@ -281,7 +281,7 @@ /* Check presence */ if(gyro_lsm6ds3 == NULL) return true; - if((gyro_lsm6ds3->ReadID(&xg_id) != IMU_6AXES_OK) || + if((gyro_lsm6ds3->read_id(&xg_id) != IMU_6AXES_OK) || (xg_id != I_AM_LSM6DS3_XG)) { delete gyro_lsm6ds3; @@ -302,7 +302,7 @@ InitStructure.X_Y_Axis = 1; /* Enable */ InitStructure.X_Z_Axis = 1; /* Enable */ - if(gyro_lsm6ds3->Init(&InitStructure) != IMU_6AXES_OK) + if(gyro_lsm6ds3->init(&InitStructure) != IMU_6AXES_OK) { return false; }