Merge branch 'master' of gitlab:wintermute/hackover2013-badge-firmware
[hackover2013-badge-firmware.git] / drivers / sensors / mpl115a2 / mpl115a2.h
1 /**************************************************************************/
2 /*!
3 @file mpl115a2.h
4 @author K. Townsend (microBuilder.eu)
5
6 @section LICENSE
7
8 Software License Agreement (BSD License)
9
10 Copyright (c) 2012, K. Townsend
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 1. Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 2. Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 3. Neither the name of the copyright holders nor the
21 names of its contributors may be used to endorse or promote products
22 derived from this software without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35 /**************************************************************************/
36
37 #ifndef _MPL115A2_H_
38 #define _MPL115A2_H_
39
40 #include "projectconfig.h"
41 #include "core/i2c/i2c.h"
42
43 #define MPL115A2_ADDRESS (0xC0) // 1100 000 shifted left 1 bit = 0xC0
44 #define MPL115A2_READBIT (0x01)
45
46 enum
47 {
48 MPL115A2_REGISTER_PRESSURE_MSB = 0x00,
49 MPL115A2_REGISTER_PRESSURE_LSB = 0x01,
50 MPL115A2_REGISTER_TEMP_MSB = 0x02,
51 MPL115A2_REGISTER_TEMP_LSB = 0x03,
52 MPL115A2_REGISTER_A0_COEFF_MSB = 0x04,
53 MPL115A2_REGISTER_A0_COEFF_LSB = 0x05,
54 MPL115A2_REGISTER_B1_COEFF_MSB = 0x06,
55 MPL115A2_REGISTER_B1_COEFF_LSB = 0x07,
56 MPL115A2_REGISTER_B2_COEFF_MSB = 0x08,
57 MPL115A2_REGISTER_B2_COEFF_LSB = 0x09,
58 MPL115A2_REGISTER_C12_COEFF_MSB = 0x0A,
59 MPL115A2_REGISTER_C12_COEFF_LSB = 0x0B,
60 MPL115A2_REGISTER_STARTCONVERSION = 0x12
61 };
62
63 typedef enum
64 {
65 MPL115A2_ERROR_OK = 0, // Everything executed normally
66 MPL115A2_ERROR_I2CINIT, // Unable to initialise I2C
67 MPL115A2_ERROR_I2CBUSY, // I2C already in use
68 MPL115A2_ERROR_LAST
69 }
70 mpl115a2Error_t;
71
72 mpl115a2Error_t mpl115a2Init(void);
73 mpl115a2Error_t mpl115a2GetPressure(float *pressure);
74
75 #endif
76
77
This page took 0.046164 seconds and 5 git commands to generate.