Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
XNucleoIKS01A2.h
00001 /** 00002 ****************************************************************************** 00003 * @file XNucleoIKS01A2.h 00004 * @author CLab 00005 * @version V1.0.0 00006 * @date 9-August-2016 00007 * @brief Header file for class XNucleoIKS01A2 representing a X-NUCLEO-IKS01A2 00008 * expansion board 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2016 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_IKS01A2_H 00041 #define __X_NUCLEO_IKS01A2_H 00042 00043 /* Includes ------------------------------------------------------------------*/ 00044 #include "mbed.h" 00045 #include "x_nucleo_iks01a2_targets.h" 00046 #include "HTS221Sensor.h" 00047 #include "LSM303AGRAccSensor.h" 00048 #include "LSM303AGRMagSensor.h" 00049 #include "LPS22HBSensor.h" 00050 #include "LSM6DSLSensor.h" 00051 #include "DevI2C.h" 00052 00053 /* Macros -------------------------------------------------------------------*/ 00054 #define CALL_METH(obj, meth, param, ret) ((obj == NULL) ? \ 00055 ((*(param) = (ret)), 0) : \ 00056 ((obj)->meth(param)) \ 00057 ) 00058 00059 /* Classes -------------------------------------------------------------------*/ 00060 /** Class XNucleoIKS01A2 is intended to represent the MEMS Inertial & Environmental 00061 * Nucleo Expansion Board with the same name. 00062 * 00063 * The expansion board is featuring basically four IPs:\n 00064 * -# a HTS221 Relative Humidity and Temperature Sensor\n 00065 * -# a LSM303AGR 3-Axis Magnetometer and 3D Acceleromenter\n 00066 * -# a LPS22HB MEMS Pressure Sensor (and Temperature Sensor)\n 00067 * -# and a LSM6DSL 3D Acceleromenter and 3D Gyroscope\n 00068 * 00069 * The expansion board features also a DIL 24-pin socket which makes it possible 00070 * to add further MEMS adapters and other sensors (e.g. UV index). 00071 * 00072 * It is intentionally implemented as a singleton because only one 00073 * X_NUCLEO_IKS01A2 at a time might be deployed in a HW component stack.\n 00074 * In order to get the singleton instance you have to call class method `Instance()`, 00075 * e.g.: 00076 * @code 00077 * // Inertial & Environmental expansion board singleton instance 00078 * static X_NUCLEO_IKS01A2 *<TODO>_expansion_board = X_NUCLEO_IKS01A2::Instance(); 00079 * @endcode 00080 */ 00081 class XNucleoIKS01A2 00082 { 00083 protected: 00084 XNucleoIKS01A2(DevI2C *ext_i2c, PinName int1, PinName int2); 00085 00086 ~XNucleoIKS01A2(void) { 00087 /* should never be called */ 00088 error("Trial to delete XNucleoIKS01A2 singleton!\n"); 00089 } 00090 00091 public: 00092 static XNucleoIKS01A2* instance(DevI2C *ext_i2c = NULL, PinName int1 = IKS01A2_PIN_LSM6DSL_INT1, PinName int2 = IKS01A2_PIN_LSM6DSL_INT2); 00093 static XNucleoIKS01A2* instance(PinName sda, PinName scl, PinName int1 = IKS01A2_PIN_LSM6DSL_INT1, PinName int2 = IKS01A2_PIN_LSM6DSL_INT2); 00094 00095 DevI2C *dev_i2c; 00096 00097 HTS221Sensor *ht_sensor; 00098 LSM303AGRMagSensor *magnetometer; 00099 LSM303AGRAccSensor *accelerometer; 00100 LPS22HBSensor *pt_sensor; 00101 LSM6DSLSensor *acc_gyro; 00102 00103 private: 00104 static XNucleoIKS01A2 *_instance; 00105 }; 00106 00107 #endif /* __X_NUCLEO_IKS01A2_H */
Generated on Tue Jul 12 2022 21:38:09 by
1.7.2