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 ST Expansion SW Team

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:

  1. a HTS221 Relative Humidity and Temperature Sensor,
  2. a LIS3MDL 3-Axis Magnetometer,
  3. a LPS25H MEMS Pressure Sensor, and
  4. 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

Files at this revision

API Documentation at this revision

Comitter:
Wolfgang Betz
Date:
Fri Mar 24 10:57:29 2017 +0100
Parent:
91:c21be6c34852
Commit message:
Align to latest `ST_INTERFACES`

Changed in this revision

Components/hts221/hts221_class.h Show annotated file Show diff for this revision Revisions of this file
Components/lis3mdl/lis3mdl_class.h Show annotated file Show diff for this revision Revisions of this file
Components/lps25h/lps25h_class.h Show annotated file Show diff for this revision Revisions of this file
Components/lsm6ds0/lsm6ds0_class.h Show annotated file Show diff for this revision Revisions of this file
Components/lsm6ds3/lsm6ds3_class.h Show annotated file Show diff for this revision Revisions of this file
x_nucleo_iks01a1.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c21be6c34852 -r d1c67d482bad Components/hts221/hts221_class.h
--- a/Components/hts221/hts221_class.h	Thu Mar 23 13:05:15 2017 +0000
+++ b/Components/hts221/hts221_class.h	Fri Mar 24 10:57:29 2017 +0100
@@ -53,17 +53,17 @@
 	/** Constructor
 	 * @param[in] i2c device I2C to be used for communication
 	 */
-        HTS221(DevI2C &i2c) : HumiditySensor(), TempSensor(), dev_i2c(i2c) {
+    HTS221(DevI2C &i2c) : HumiditySensor(), TempSensor(), dev_i2c(i2c) {
 		T0_degC = T1_degC = H0_rh = H1_rh = 0.0;
 		T0_out = T1_out = H0_T0_out = H1_T0_out = 0;
 	}
 	
 	/** Destructor
 	 */
-        virtual ~HTS221() {}
+    virtual ~HTS221() {}
 	
 	/*** Interface Methods ***/
-	virtual int Init(void *init_struct) {
+	virtual int init(void *init_struct) {
 		return HTS221_Init((HUM_TEMP_InitTypeDef*)init_struct);
 	}
 
@@ -75,7 +75,7 @@
 		return HTS221_Power_OFF();
 	}
 
-	virtual int ReadID(uint8_t *ht_id) {
+	virtual int read_id(uint8_t *ht_id) {
 		return HTS221_ReadID(ht_id);
 	}
 
@@ -87,11 +87,11 @@
 		return HTS221_RebootCmd();
 	}
 
-	virtual int GetHumidity(float *pfData) {
+	virtual int get_humidity(float *pfData) {
 		return HTS221_GetHumidity(pfData);
 	}
 
-	virtual int GetTemperature(float *pfData) {
+	virtual int get_temperature(float *pfData) {
 		return HTS221_GetTemperature(pfData);
 	}
 
diff -r c21be6c34852 -r d1c67d482bad Components/lis3mdl/lis3mdl_class.h
--- a/Components/lis3mdl/lis3mdl_class.h	Thu Mar 23 13:05:15 2017 +0000
+++ b/Components/lis3mdl/lis3mdl_class.h	Fri Mar 24 10:57:29 2017 +0100
@@ -60,19 +60,19 @@
         virtual ~LIS3MDL() {}
 	
 	/*** Interface Methods ***/
-	virtual int Init(void *init_struct) {
+	virtual int init(void *init_struct) {
 		return LIS3MDL_Init((MAGNETO_InitTypeDef*)init_struct);
 	}
 
-	virtual int ReadID(uint8_t *m_id) {
+	virtual int read_id(uint8_t *m_id) {
 		return LIS3MDL_Read_M_ID(m_id);
 	}
 
-	virtual int Get_M_Axes(int32_t *pData) {
+	virtual int get_m_axes(int32_t *pData) {
 		return LIS3MDL_M_GetAxes(pData);
 	}
 
-	virtual int Get_M_AxesRaw(int16_t *pData) {
+	virtual int get_m_axes_raw(int16_t *pData) {
 		return LIS3MDL_M_GetAxesRaw(pData);
 	}
 
diff -r c21be6c34852 -r d1c67d482bad Components/lps25h/lps25h_class.h
--- a/Components/lps25h/lps25h_class.h	Thu Mar 23 13:05:15 2017 +0000
+++ b/Components/lps25h/lps25h_class.h	Fri Mar 24 10:57:29 2017 +0100
@@ -62,7 +62,7 @@
         virtual ~LPS25H() {}
 	
 	/*** Interface Methods ***/
-	virtual int Init(void *init_struct) {
+	virtual int init(void *init_struct) {
 		return LPS25H_Init((PRESSURE_InitTypeDef*)init_struct);
 	}
 
@@ -74,7 +74,7 @@
 		return LPS25H_PowerOff();
 	}
 
-	virtual int ReadID(uint8_t *p_id) {
+	virtual int read_id(uint8_t *p_id) {
 		return LPS25H_ReadID(p_id);
 	}
 
@@ -86,11 +86,11 @@
 		return LPS25H_RebootCmd();
 	}
 
-	virtual int GetPressure(float *pfData) {
+	virtual int get_pressure(float *pfData) {
 		return LPS25H_GetPressure(pfData);
 	}
 
-	virtual int GetTemperature(float *pfData) {
+	virtual int get_temperature(float *pfData) {
 		return LPS25H_GetTemperature(pfData);
 	}
 
diff -r c21be6c34852 -r d1c67d482bad Components/lsm6ds0/lsm6ds0_class.h
--- a/Components/lsm6ds0/lsm6ds0_class.h	Thu Mar 23 13:05:15 2017 +0000
+++ b/Components/lsm6ds0/lsm6ds0_class.h	Fri Mar 24 10:57:29 2017 +0100
@@ -61,67 +61,67 @@
         virtual ~LSM6DS0() {}
 	
 	/*** Interface Methods ***/
-	virtual int Init(void *init_struct) {
+	virtual int init(void *init_struct) {
 		return LSM6DS0_Init((IMU_6AXES_InitTypeDef*)init_struct);
 	}
 
-	virtual int ReadID(uint8_t *xg_id) {
+	virtual int read_id(uint8_t *xg_id) {
 		return LSM6DS0_Read_XG_ID(xg_id);
 	}
 
-	virtual int Get_X_Axes(int32_t *pData) {
+	virtual int get_x_axes(int32_t *pData) {
 		return LSM6DS0_X_GetAxes(pData);
 	}
 
-	virtual int Get_X_AxesRaw(int16_t *pData) {
+	virtual int get_x_axes_raw(int16_t *pData) {
 		return LSM6DS0_X_GetAxesRaw(pData);
 	}
 
-	virtual int Get_G_Axes(int32_t *pData) {
+	virtual int get_g_axes(int32_t *pData) {
 		return LSM6DS0_G_GetAxes(pData);
 	}
 
-	virtual int Get_G_AxesRaw(int16_t *pData) {
+	virtual int get_g_axes_raw(int16_t *pData) {
 		return LSM6DS0_G_GetAxesRaw(pData);
 	}
 
-	virtual int Get_X_ODR(float *odr) {
+	virtual int get_x_odr(float *odr) {
 		return LSM6DS0_X_Get_ODR(odr);
 	}
 
-	virtual int Set_X_ODR(float odr) {
+	virtual int set_x_odr(float odr) {
 		return LSM6DS0_X_Set_ODR(odr);
 	}
 
-	virtual int Get_X_Sensitivity(float *pfData) {
+	virtual int get_x_sensitivity(float *pfData) {
 		return LSM6DS0_X_GetSensitivity(pfData);
 	}
 
-	virtual int Get_X_FS(float *fullScale) {
+	virtual int get_x_fs(float *fullScale) {
 		return LSM6DS0_X_Get_FS(fullScale);
 	}
 
-	virtual int Set_X_FS(float fullScale) {
+	virtual int set_x_fs(float fullScale) {
 		return LSM6DS0_X_Set_FS(fullScale);
 	}
 
-	virtual int Get_G_ODR(float *odr) {
+	virtual int get_g_odr(float *odr) {
 		return LSM6DS0_G_Get_ODR(odr);
 	}
 
-	virtual int Set_G_ODR(float odr) {
+	virtual int set_g_odr(float odr) {
 		return LSM6DS0_G_Set_ODR(odr);
 	}
 
-	virtual int Get_G_Sensitivity(float *pfData) {
+	virtual int get_g_sensitivity(float *pfData) {
 		return LSM6DS0_G_GetSensitivity(pfData);
 	}
 
-	virtual int Get_G_FS(float *fullScale) {
+	virtual int get_g_fs(float *fullScale) {
 		return LSM6DS0_G_Get_FS(fullScale);
 	}
 
-	virtual int Set_G_FS(float fullScale) {
+	virtual int set_g_fs(float fullScale) {
 		return LSM6DS0_G_Set_FS(fullScale);
 	}
 
diff -r c21be6c34852 -r d1c67d482bad Components/lsm6ds3/lsm6ds3_class.h
--- a/Components/lsm6ds3/lsm6ds3_class.h	Thu Mar 23 13:05:15 2017 +0000
+++ b/Components/lsm6ds3/lsm6ds3_class.h	Fri Mar 24 10:57:29 2017 +0100
@@ -63,67 +63,67 @@
         virtual ~LSM6DS3() {}
 	
 	/*** Interface Methods ***/
-	virtual int Init(void *init_struct) {
+	virtual int init(void *init_struct) {
 		return LSM6DS3_Init((IMU_6AXES_InitTypeDef*)init_struct);
 	}
 
-	virtual int ReadID(uint8_t *xg_id) {
+	virtual int read_id(uint8_t *xg_id) {
 		return LSM6DS3_Read_XG_ID(xg_id);
 	}
 
-	virtual int Get_X_Axes(int32_t *pData) {
+	virtual int get_x_axes(int32_t *pData) {
 		return LSM6DS3_X_GetAxes(pData);
 	}
 
-	virtual int Get_X_AxesRaw(int16_t *pData) {
+	virtual int get_x_axes_raw(int16_t *pData) {
 		return LSM6DS3_X_GetAxesRaw(pData);
 	}
 
-	virtual int Get_G_Axes(int32_t *pData) {
+	virtual int get_g_axes(int32_t *pData) {
 		return LSM6DS3_G_GetAxes(pData);
 	}
 
-	virtual int Get_G_AxesRaw(int16_t *pData) {
+	virtual int get_g_axes_raw(int16_t *pData) {
 		return LSM6DS3_G_GetAxesRaw(pData);
 	}
 
-	virtual int Get_X_ODR(float *odr) {
+	virtual int get_x_odr(float *odr) {
 		return LSM6DS3_X_Get_ODR(odr);
 	}
 
-	virtual int Set_X_ODR(float odr) {
+	virtual int set_x_odr(float odr) {
 		return LSM6DS3_X_Set_ODR(odr);
 	}
 
-	virtual int Get_X_Sensitivity(float *pfData) {
+	virtual int get_x_sensitivity(float *pfData) {
 		return LSM6DS3_X_GetSensitivity(pfData);
 	}
 
-	virtual int Get_X_FS(float *fullScale) {
+	virtual int get_x_fs(float *fullScale) {
 		return LSM6DS3_X_Get_FS(fullScale);
 	}
 
-	virtual int Set_X_FS(float fullScale) {
+	virtual int set_x_fs(float fullScale) {
 		return LSM6DS3_X_Set_FS(fullScale);
 	}
 
-	virtual int Get_G_ODR(float *odr) {
+	virtual int get_g_odr(float *odr) {
 		return LSM6DS3_G_Get_ODR(odr);
 	}
 
-	virtual int Set_G_ODR(float odr) {
+	virtual int set_g_odr(float odr) {
 		return LSM6DS3_G_Set_ODR(odr);
 	}
 
-	virtual int Get_G_Sensitivity(float *pfData) {
+	virtual int get_g_sensitivity(float *pfData) {
 		return LSM6DS3_G_GetSensitivity(pfData);
 	}
 
-	virtual int Get_G_FS(float *fullScale) {
+	virtual int get_g_fs(float *fullScale) {
 		return LSM6DS3_G_Get_FS(fullScale);
 	}
 
-	virtual int Set_G_FS(float fullScale) {
+	virtual int set_g_fs(float fullScale) {
 		return LSM6DS3_G_Set_FS(fullScale);
 	}
 
diff -r c21be6c34852 -r d1c67d482bad x_nucleo_iks01a1.cpp
--- 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; 
 		}