Library for supporting the Nucleo Sensor Shield.

Dependents:   Nucleo_Sensors_Demo m2x-temp_ethernet_demo m2x-MEMS_ACKme_Wifi_demo m2x_MEMS_Ublox_Cellular_demo ... more

Fork of Nucleo_Sensor_Shield by Daniel Griffin

Warning: Deprecated!

Supported drivers and applications can be found at this link.

Committer:
dangriffin
Date:
Tue Dec 16 21:14:32 2014 +0000
Revision:
2:57888ec40e75
Parent:
0:0433918efb54
Additional checking of return code in pressure sensor driver.

Who changed what in which revision?

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