STM Imu acquisition setup using ethernet

Dependencies:   F7_Ethernet mbed HTS221 LPS22HB LSM303AGR LSM6DSL

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
nirnakern
Date:
Fri Jan 26 09:53:08 2018 +0000
Revision:
3:758e8ed30819
First commit of IMU acquisition program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nirnakern 3:758e8ed30819 1 /**
nirnakern 3:758e8ed30819 2 ******************************************************************************
nirnakern 3:758e8ed30819 3 * @file XNucleoIKS01A2.h
nirnakern 3:758e8ed30819 4 * @author CLab
nirnakern 3:758e8ed30819 5 * @version V1.0.0
nirnakern 3:758e8ed30819 6 * @date 9-August-2016
nirnakern 3:758e8ed30819 7 * @brief Header file for class XNucleoIKS01A2 representing a X-NUCLEO-IKS01A2
nirnakern 3:758e8ed30819 8 * expansion board
nirnakern 3:758e8ed30819 9 ******************************************************************************
nirnakern 3:758e8ed30819 10 * @attention
nirnakern 3:758e8ed30819 11 *
nirnakern 3:758e8ed30819 12 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
nirnakern 3:758e8ed30819 13 *
nirnakern 3:758e8ed30819 14 * Redistribution and use in source and binary forms, with or without modification,
nirnakern 3:758e8ed30819 15 * are permitted provided that the following conditions are met:
nirnakern 3:758e8ed30819 16 * 1. Redistributions of source code must retain the above copyright notice,
nirnakern 3:758e8ed30819 17 * this list of conditions and the following disclaimer.
nirnakern 3:758e8ed30819 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
nirnakern 3:758e8ed30819 19 * this list of conditions and the following disclaimer in the documentation
nirnakern 3:758e8ed30819 20 * and/or other materials provided with the distribution.
nirnakern 3:758e8ed30819 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
nirnakern 3:758e8ed30819 22 * may be used to endorse or promote products derived from this software
nirnakern 3:758e8ed30819 23 * without specific prior written permission.
nirnakern 3:758e8ed30819 24 *
nirnakern 3:758e8ed30819 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
nirnakern 3:758e8ed30819 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
nirnakern 3:758e8ed30819 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
nirnakern 3:758e8ed30819 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
nirnakern 3:758e8ed30819 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
nirnakern 3:758e8ed30819 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
nirnakern 3:758e8ed30819 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
nirnakern 3:758e8ed30819 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
nirnakern 3:758e8ed30819 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
nirnakern 3:758e8ed30819 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nirnakern 3:758e8ed30819 35 *
nirnakern 3:758e8ed30819 36 ******************************************************************************
nirnakern 3:758e8ed30819 37 */
nirnakern 3:758e8ed30819 38
nirnakern 3:758e8ed30819 39 /* Define to prevent from recursive inclusion --------------------------------*/
nirnakern 3:758e8ed30819 40 #ifndef __X_NUCLEO_IKS01A2_H
nirnakern 3:758e8ed30819 41 #define __X_NUCLEO_IKS01A2_H
nirnakern 3:758e8ed30819 42
nirnakern 3:758e8ed30819 43 /* Includes ------------------------------------------------------------------*/
nirnakern 3:758e8ed30819 44 #include "mbed.h"
nirnakern 3:758e8ed30819 45 #include "x_nucleo_iks01a2_targets.h"
nirnakern 3:758e8ed30819 46 #include "HTS221Sensor.h"
nirnakern 3:758e8ed30819 47 #include "LSM303AGRAccSensor.h"
nirnakern 3:758e8ed30819 48 #include "LSM303AGRMagSensor.h"
nirnakern 3:758e8ed30819 49 #include "LPS22HBSensor.h"
nirnakern 3:758e8ed30819 50 #include "LSM6DSLSensor.h"
nirnakern 3:758e8ed30819 51 #include "DevI2C.h"
nirnakern 3:758e8ed30819 52
nirnakern 3:758e8ed30819 53 /* Macros -------------------------------------------------------------------*/
nirnakern 3:758e8ed30819 54 #define CALL_METH(obj, meth, param, ret) ((obj == NULL) ? \
nirnakern 3:758e8ed30819 55 ((*(param) = (ret)), 0) : \
nirnakern 3:758e8ed30819 56 ((obj)->meth(param)) \
nirnakern 3:758e8ed30819 57 )
nirnakern 3:758e8ed30819 58
nirnakern 3:758e8ed30819 59 /* Classes -------------------------------------------------------------------*/
nirnakern 3:758e8ed30819 60 /** Class XNucleoIKS01A2 is intended to represent the MEMS Inertial & Environmental
nirnakern 3:758e8ed30819 61 * Nucleo Expansion Board with the same name.
nirnakern 3:758e8ed30819 62 *
nirnakern 3:758e8ed30819 63 * The expansion board is featuring basically four IPs:\n
nirnakern 3:758e8ed30819 64 * -# a HTS221 Relative Humidity and Temperature Sensor\n
nirnakern 3:758e8ed30819 65 * -# a LSM303AGR 3-Axis Magnetometer and 3D Acceleromenter\n
nirnakern 3:758e8ed30819 66 * -# a LPS22HB MEMS Pressure Sensor (and Temperature Sensor)\n
nirnakern 3:758e8ed30819 67 * -# and a LSM6DSL 3D Acceleromenter and 3D Gyroscope\n
nirnakern 3:758e8ed30819 68 *
nirnakern 3:758e8ed30819 69 * The expansion board features also a DIL 24-pin socket which makes it possible
nirnakern 3:758e8ed30819 70 * to add further MEMS adapters and other sensors (e.g. UV index).
nirnakern 3:758e8ed30819 71 *
nirnakern 3:758e8ed30819 72 * It is intentionally implemented as a singleton because only one
nirnakern 3:758e8ed30819 73 * X_NUCLEO_IKS01A2 at a time might be deployed in a HW component stack.\n
nirnakern 3:758e8ed30819 74 * In order to get the singleton instance you have to call class method `Instance()`,
nirnakern 3:758e8ed30819 75 * e.g.:
nirnakern 3:758e8ed30819 76 * @code
nirnakern 3:758e8ed30819 77 * // Inertial & Environmental expansion board singleton instance
nirnakern 3:758e8ed30819 78 * static X_NUCLEO_IKS01A2 *<TODO>_expansion_board = X_NUCLEO_IKS01A2::Instance();
nirnakern 3:758e8ed30819 79 * @endcode
nirnakern 3:758e8ed30819 80 */
nirnakern 3:758e8ed30819 81 class XNucleoIKS01A2
nirnakern 3:758e8ed30819 82 {
nirnakern 3:758e8ed30819 83 protected:
nirnakern 3:758e8ed30819 84 XNucleoIKS01A2(DevI2C *ext_i2c, PinName int1, PinName int2);
nirnakern 3:758e8ed30819 85
nirnakern 3:758e8ed30819 86 ~XNucleoIKS01A2(void) {
nirnakern 3:758e8ed30819 87 /* should never be called */
nirnakern 3:758e8ed30819 88 error("Trial to delete XNucleoIKS01A2 singleton!\n");
nirnakern 3:758e8ed30819 89 }
nirnakern 3:758e8ed30819 90
nirnakern 3:758e8ed30819 91 public:
nirnakern 3:758e8ed30819 92 static XNucleoIKS01A2* instance(DevI2C *ext_i2c = NULL, PinName int1 = IKS01A2_PIN_LSM6DSL_INT1, PinName int2 = IKS01A2_PIN_LSM6DSL_INT2);
nirnakern 3:758e8ed30819 93 static XNucleoIKS01A2* instance(PinName sda, PinName scl, PinName int1 = IKS01A2_PIN_LSM6DSL_INT1, PinName int2 = IKS01A2_PIN_LSM6DSL_INT2);
nirnakern 3:758e8ed30819 94
nirnakern 3:758e8ed30819 95 DevI2C *dev_i2c;
nirnakern 3:758e8ed30819 96
nirnakern 3:758e8ed30819 97 HTS221Sensor *ht_sensor;
nirnakern 3:758e8ed30819 98 LSM303AGRMagSensor *magnetometer;
nirnakern 3:758e8ed30819 99 LSM303AGRAccSensor *accelerometer;
nirnakern 3:758e8ed30819 100 LPS22HBSensor *pt_sensor;
nirnakern 3:758e8ed30819 101 LSM6DSLSensor *acc_gyro;
nirnakern 3:758e8ed30819 102
nirnakern 3:758e8ed30819 103 private:
nirnakern 3:758e8ed30819 104 static XNucleoIKS01A2 *_instance;
nirnakern 3:758e8ed30819 105 };
nirnakern 3:758e8ed30819 106
nirnakern 3:758e8ed30819 107 #endif /* __X_NUCLEO_IKS01A2_H */