Firmware Library for X-NUCLEO-IKS01A3 (MEMS Inertial & Environmental Sensors) Expansion Board
Dependencies: STTS751 LPS22HH LIS2MDL HTS221 LIS2DW12 LSM6DSO
Dependents: ELEC35XR-2019 ELEC35XR-2019_SEM calculate IKS01A3 ... more
XNucleoIKS01A3.h
00001 /** 00002 ****************************************************************************** 00003 * @file XNucleoIKS01A3.h 00004 * @author SRA 00005 * @version V1.0.0 00006 * @date 5-March-2019 00007 * @brief Header file for class XNucleoIKS01A3 representing a X-NUCLEO-IKS01A3 00008 * expansion board 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2> 00013 * 00014 * Redistribution and use in source and binary forms, with or without modification, 00015 * are permitted provided that the following conditions are met: 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 2. Redistributions in binary form must reproduce the above copyright notice, 00019 * this list of conditions and the following disclaimer in the documentation 00020 * and/or other materials provided with the distribution. 00021 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00033 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00034 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 ****************************************************************************** 00037 */ 00038 00039 /* Define to prevent from recursive inclusion --------------------------------*/ 00040 #ifndef __X_NUCLEO_IKS01A3_H 00041 #define __X_NUCLEO_IKS01A3_H 00042 00043 /* Includes ------------------------------------------------------------------*/ 00044 #include "mbed.h" 00045 #include "x_nucleo_iks01a3_targets.h" 00046 #include "HTS221Sensor.h" 00047 #include "LIS2DW12Sensor.h" 00048 #include "LIS2MDLSensor.h" 00049 #include "LPS22HHSensor.h" 00050 #include "LSM6DSOSensor.h" 00051 #include "STTS751Sensor.h" 00052 #include "DevI2C.h" 00053 00054 /* Macros -------------------------------------------------------------------*/ 00055 #define CALL_METH(obj, meth, param, ret) ((obj == NULL) ? \ 00056 ((*(param) = (ret)), 0) : \ 00057 ((obj)->meth(param)) \ 00058 ) 00059 00060 /* Classes -------------------------------------------------------------------*/ 00061 /** Class XNucleoIKS01A3 is intended to represent the MEMS Inertial & Environmental 00062 * Nucleo Expansion Board with the same name. 00063 * 00064 * The expansion board is featuring basically four IPs:\n 00065 * -# a HTS221 Relative Humidity and Temperature Sensor\n 00066 * -# a LPS22HH MEMS Pressure Sensor (and Temperature Sensor)\n 00067 * -# a STTS751 MEMS Temperature Sensor\n 00068 * -# a LIS2DW12 3D Acceleromenter\n 00069 * -# a LIS2MDL 3D Magnetometer\n 00070 * -# and a LSM6DSO 3D Acceleromenter and 3D Gyroscope\n 00071 * 00072 * The expansion board features also a DIL 24-pin socket which makes it possible 00073 * to add further MEMS adapters and other sensors (e.g. UV index). 00074 * 00075 * It is intentionally implemented as a singleton because only one 00076 * X_NUCLEO_IKS01A3 at a time might be deployed in a HW component stack.\n 00077 * In order to get the singleton instance you have to call class method `Instance()`, 00078 * e.g.: 00079 * @code 00080 * // Inertial & Environmental expansion board singleton instance 00081 * static X_NUCLEO_IKS01A3 *<TODO>_expansion_board = X_NUCLEO_IKS01A3::Instance(); 00082 * @endcode 00083 */ 00084 class XNucleoIKS01A3 { 00085 protected: 00086 XNucleoIKS01A3(DevI2C *ext_i2c, PinName lsm6dso_int1, PinName lsm6dso_int2, PinName lis2dw12_int1, PinName lps22hh_int, PinName stts751_int); 00087 00088 ~XNucleoIKS01A3(void) 00089 { 00090 /* should never be called */ 00091 error("Trial to delete XNucleoIKS01A3 singleton!\n"); 00092 } 00093 00094 public: 00095 static XNucleoIKS01A3 *instance(DevI2C *ext_i2c = NULL, PinName lsm6dso_int1 = IKS01A3_PIN_LSM6DSO_INT1, PinName lsm6dso_int2 = IKS01A3_PIN_LSM6DSO_INT2, PinName lis2dw12_int1 = IKS01A3_PIN_LIS2DW12_INT1, PinName lps22hh_int = IKS01A3_PIN_LPS22HH_INT, PinName stts751_int = IKS01A3_PIN_STTS751_INT); 00096 static XNucleoIKS01A3 *instance(PinName sda, PinName scl, PinName lsm6dso_int1 = IKS01A3_PIN_LSM6DSO_INT1, PinName lsm6dso_int2 = IKS01A3_PIN_LSM6DSO_INT2, PinName lis2dw12_int1 = IKS01A3_PIN_LIS2DW12_INT1, PinName lps22hh_int = IKS01A3_PIN_LPS22HH_INT, PinName stts751_int = IKS01A3_PIN_STTS751_INT); 00097 00098 DevI2C *dev_i2c; 00099 00100 HTS221Sensor *ht_sensor; 00101 LIS2MDLSensor *magnetometer; 00102 LIS2DW12Sensor *accelerometer; 00103 LPS22HHSensor *pt_sensor; 00104 LSM6DSOSensor *acc_gyro; 00105 STTS751Sensor *t_sensor; 00106 00107 private: 00108 static XNucleoIKS01A3 *_instance; 00109 }; 00110 00111 #endif /* __X_NUCLEO_IKS01A3_H */
Generated on Tue Jul 12 2022 18:41:49 by 1.7.2