NXP's MPL3115A2 Pressure sensor library

Dependents:   FRDM-STBC-AGMP01_SensorStream RD-KL25Z-AGMP01_SensorStream RD-KL25Z-AGMP01_Nanosatelite RD-KL25Z-AGMP01_SensorStream

Fork of MPL3115A2 by Aswin Sivakumar

Committer:
AswinSivakumar
Date:
Wed Apr 26 00:10:29 2017 +0000
Revision:
2:c705222de18d
Parent:
0:2cc0f6ef330f
updated

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AswinSivakumar 2:c705222de18d 1 /*
AswinSivakumar 2:c705222de18d 2 * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc.
AswinSivakumar 2:c705222de18d 3 * Copyright 2016-2017 NXP
AswinSivakumar 2:c705222de18d 4 *
AswinSivakumar 2:c705222de18d 5 * Redistribution and use in source and binary forms, with or without modification,
AswinSivakumar 2:c705222de18d 6 * are permitted provided that the following conditions are met:
AswinSivakumar 2:c705222de18d 7 *
AswinSivakumar 2:c705222de18d 8 * o Redistributions of source code must retain the above copyright notice, this list
AswinSivakumar 2:c705222de18d 9 * of conditions and the following disclaimer.
AswinSivakumar 2:c705222de18d 10 *
AswinSivakumar 2:c705222de18d 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AswinSivakumar 2:c705222de18d 12 * list of conditions and the following disclaimer in the documentation and/or
AswinSivakumar 2:c705222de18d 13 * other materials provided with the distribution.
AswinSivakumar 2:c705222de18d 14 *
AswinSivakumar 2:c705222de18d 15 * o Neither the name of the copyright holder nor the names of its
AswinSivakumar 2:c705222de18d 16 * contributors may be used to endorse or promote products derived from this
AswinSivakumar 2:c705222de18d 17 * software without specific prior written permission.
AswinSivakumar 2:c705222de18d 18 *
AswinSivakumar 2:c705222de18d 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AswinSivakumar 2:c705222de18d 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AswinSivakumar 2:c705222de18d 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AswinSivakumar 2:c705222de18d 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AswinSivakumar 2:c705222de18d 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AswinSivakumar 2:c705222de18d 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AswinSivakumar 2:c705222de18d 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AswinSivakumar 2:c705222de18d 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AswinSivakumar 2:c705222de18d 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AswinSivakumar 2:c705222de18d 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AswinSivakumar 2:c705222de18d 29 */
AswinSivakumar 0:2cc0f6ef330f 30
AswinSivakumar 0:2cc0f6ef330f 31 #ifndef MPL3115_H
AswinSivakumar 0:2cc0f6ef330f 32 #define MPL3115_H
AswinSivakumar 0:2cc0f6ef330f 33 #include "mbed.h"
AswinSivakumar 0:2cc0f6ef330f 34
AswinSivakumar 0:2cc0f6ef330f 35 #define MPL3115_I2C_ADDRESS (0x60<<1)
AswinSivakumar 0:2cc0f6ef330f 36
AswinSivakumar 0:2cc0f6ef330f 37 #define MPL3115_STATUS 0x00
AswinSivakumar 0:2cc0f6ef330f 38 #define MPL3115_WHO_AM_I 0x0C
AswinSivakumar 0:2cc0f6ef330f 39 #define MPL3115_CTRL_REG1 0x26
AswinSivakumar 0:2cc0f6ef330f 40 #define MPL3115_CTRL_REG2 0x27
AswinSivakumar 0:2cc0f6ef330f 41 #define MPL3115_WHO_AM_I_VALUE 0xC4
AswinSivakumar 0:2cc0f6ef330f 42
AswinSivakumar 0:2cc0f6ef330f 43 class MPL3115
AswinSivakumar 0:2cc0f6ef330f 44 {
AswinSivakumar 0:2cc0f6ef330f 45 public:
AswinSivakumar 0:2cc0f6ef330f 46
AswinSivakumar 0:2cc0f6ef330f 47 MPL3115(PinName sda, PinName scl);
AswinSivakumar 0:2cc0f6ef330f 48
AswinSivakumar 0:2cc0f6ef330f 49 void MPL3115_config(void);
AswinSivakumar 0:2cc0f6ef330f 50
AswinSivakumar 0:2cc0f6ef330f 51 void acquire_MPL3115_data_Altitude_in_m(float * du);
AswinSivakumar 0:2cc0f6ef330f 52
AswinSivakumar 0:2cc0f6ef330f 53 private:
AswinSivakumar 0:2cc0f6ef330f 54 I2C MPL3115_i2c;
AswinSivakumar 0:2cc0f6ef330f 55
AswinSivakumar 0:2cc0f6ef330f 56 };
AswinSivakumar 0:2cc0f6ef330f 57
AswinSivakumar 0:2cc0f6ef330f 58 #endif