class IMU nucleo

Dependents:   Coupe-Robotique-FIP-Main

Fork of IMU_FIP by Robotique FIP

Committer:
quentin9696
Date:
Thu May 21 11:21:58 2015 +0000
Revision:
5:e2e603447679
Parent:
0:528e23a13fb7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
quentin9696 0:528e23a13fb7 1 /**
quentin9696 0:528e23a13fb7 2 ******************************************************************************
quentin9696 0:528e23a13fb7 3 * @file x_cube_mems.cpp
quentin9696 0:528e23a13fb7 4 * @author AST / EST
quentin9696 0:528e23a13fb7 5 * @version V0.0.1
quentin9696 0:528e23a13fb7 6 * @date 08-October-2014
quentin9696 0:528e23a13fb7 7 * @brief Implementation file for the X_CUBE_MEMS singleton class
quentin9696 0:528e23a13fb7 8 ******************************************************************************
quentin9696 0:528e23a13fb7 9 * @attention
quentin9696 0:528e23a13fb7 10 *
quentin9696 0:528e23a13fb7 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
quentin9696 0:528e23a13fb7 12 *
quentin9696 0:528e23a13fb7 13 * Redistribution and use in source and binary forms, with or without modification,
quentin9696 0:528e23a13fb7 14 * are permitted provided that the following conditions are met:
quentin9696 0:528e23a13fb7 15 * 1. Redistributions of source code must retain the above copyright notice,
quentin9696 0:528e23a13fb7 16 * this list of conditions and the following disclaimer.
quentin9696 0:528e23a13fb7 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
quentin9696 0:528e23a13fb7 18 * this list of conditions and the following disclaimer in the documentation
quentin9696 0:528e23a13fb7 19 * and/or other materials provided with the distribution.
quentin9696 0:528e23a13fb7 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
quentin9696 0:528e23a13fb7 21 * may be used to endorse or promote products derived from this software
quentin9696 0:528e23a13fb7 22 * without specific prior written permission.
quentin9696 0:528e23a13fb7 23 *
quentin9696 0:528e23a13fb7 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
quentin9696 0:528e23a13fb7 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
quentin9696 0:528e23a13fb7 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
quentin9696 0:528e23a13fb7 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
quentin9696 0:528e23a13fb7 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
quentin9696 0:528e23a13fb7 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
quentin9696 0:528e23a13fb7 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
quentin9696 0:528e23a13fb7 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
quentin9696 0:528e23a13fb7 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
quentin9696 0:528e23a13fb7 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
quentin9696 0:528e23a13fb7 34 *
quentin9696 0:528e23a13fb7 35 ******************************************************************************
quentin9696 0:528e23a13fb7 36 */
quentin9696 0:528e23a13fb7 37
quentin9696 0:528e23a13fb7 38 /* Includes ------------------------------------------------------------------*/
quentin9696 0:528e23a13fb7 39 #include "mbed.h"
quentin9696 0:528e23a13fb7 40 #include "x_cube_mems.h"
quentin9696 0:528e23a13fb7 41
quentin9696 0:528e23a13fb7 42 /* Static variables ----------------------------------------------------------*/
quentin9696 0:528e23a13fb7 43 X_CUBE_MEMS* X_CUBE_MEMS::_instance = NULL;
quentin9696 0:528e23a13fb7 44
quentin9696 0:528e23a13fb7 45 /* Methods -------------------------------------------------------------------*/
quentin9696 0:528e23a13fb7 46 /**
quentin9696 0:528e23a13fb7 47 * @brief Constructor
quentin9696 0:528e23a13fb7 48 */
quentin9696 0:528e23a13fb7 49 X_CUBE_MEMS::X_CUBE_MEMS(void) : dev_i2c(PB_9,PB_8),
quentin9696 0:528e23a13fb7 50 hts221(dev_i2c),
quentin9696 0:528e23a13fb7 51 lps25h(dev_i2c),
quentin9696 0:528e23a13fb7 52 lis3mdl(dev_i2c),
quentin9696 0:528e23a13fb7 53 lsm6ds0(dev_i2c)
quentin9696 0:528e23a13fb7 54 {
quentin9696 0:528e23a13fb7 55
quentin9696 0:528e23a13fb7 56 }
quentin9696 0:528e23a13fb7 57
quentin9696 0:528e23a13fb7 58 /**
quentin9696 0:528e23a13fb7 59 * @brief Get singleton instance
quentin9696 0:528e23a13fb7 60 * @return a pointer to the singleton instance of class X_CUBE_MEMS
quentin9696 0:528e23a13fb7 61 */
quentin9696 0:528e23a13fb7 62 X_CUBE_MEMS* X_CUBE_MEMS::Instance(void) {
quentin9696 0:528e23a13fb7 63 if(_instance == NULL) {
quentin9696 0:528e23a13fb7 64 _instance = new X_CUBE_MEMS();
quentin9696 0:528e23a13fb7 65 }
quentin9696 0:528e23a13fb7 66 return _instance;
quentin9696 0:528e23a13fb7 67 }