MMA8652 accelerometer library
Dependents: FRDM-FXS-MULTI2-B_SensorShield_HelloWorld ina-hack-2nd
MMA8652.h@1:ccaeb5d75dc2, 2017-04-24 (annotated)
- Committer:
- AswinSivakumar
- Date:
- Mon Apr 24 19:09:59 2017 +0000
- Revision:
- 1:ccaeb5d75dc2
- Parent:
- 0:6642dad09196
updated
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AswinSivakumar | 1:ccaeb5d75dc2 | 1 | /* |
AswinSivakumar | 1:ccaeb5d75dc2 | 2 | * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. |
AswinSivakumar | 1:ccaeb5d75dc2 | 3 | * Copyright 2016-2017 NXP |
AswinSivakumar | 1:ccaeb5d75dc2 | 4 | * |
AswinSivakumar | 1:ccaeb5d75dc2 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
AswinSivakumar | 1:ccaeb5d75dc2 | 6 | * are permitted provided that the following conditions are met: |
AswinSivakumar | 1:ccaeb5d75dc2 | 7 | * |
AswinSivakumar | 1:ccaeb5d75dc2 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
AswinSivakumar | 1:ccaeb5d75dc2 | 9 | * of conditions and the following disclaimer. |
AswinSivakumar | 1:ccaeb5d75dc2 | 10 | * |
AswinSivakumar | 1:ccaeb5d75dc2 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
AswinSivakumar | 1:ccaeb5d75dc2 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
AswinSivakumar | 1:ccaeb5d75dc2 | 13 | * other materials provided with the distribution. |
AswinSivakumar | 1:ccaeb5d75dc2 | 14 | * |
AswinSivakumar | 1:ccaeb5d75dc2 | 15 | * o Neither the name of the copyright holder nor the names of its |
AswinSivakumar | 1:ccaeb5d75dc2 | 16 | * contributors may be used to endorse or promote products derived from this |
AswinSivakumar | 1:ccaeb5d75dc2 | 17 | * software without specific prior written permission. |
AswinSivakumar | 1:ccaeb5d75dc2 | 18 | * |
AswinSivakumar | 1:ccaeb5d75dc2 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
AswinSivakumar | 1:ccaeb5d75dc2 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
AswinSivakumar | 1:ccaeb5d75dc2 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AswinSivakumar | 1:ccaeb5d75dc2 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
AswinSivakumar | 1:ccaeb5d75dc2 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
AswinSivakumar | 1:ccaeb5d75dc2 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
AswinSivakumar | 1:ccaeb5d75dc2 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
AswinSivakumar | 1:ccaeb5d75dc2 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
AswinSivakumar | 1:ccaeb5d75dc2 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
AswinSivakumar | 1:ccaeb5d75dc2 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AswinSivakumar | 1:ccaeb5d75dc2 | 29 | */ |
AswinSivakumar | 0:6642dad09196 | 30 | |
AswinSivakumar | 0:6642dad09196 | 31 | #ifndef MMA8652_H |
AswinSivakumar | 0:6642dad09196 | 32 | #define MMA8652_H |
AswinSivakumar | 0:6642dad09196 | 33 | #include "mbed.h" |
AswinSivakumar | 0:6642dad09196 | 34 | |
AswinSivakumar | 0:6642dad09196 | 35 | #define MMA8652_I2C_ADDRESS (0x1D<<1) |
AswinSivakumar | 0:6642dad09196 | 36 | |
AswinSivakumar | 0:6642dad09196 | 37 | #define MMA8652_STATUS 0x00 |
AswinSivakumar | 0:6642dad09196 | 38 | #define MMA8652_WHO_AM_I 0x0D |
AswinSivakumar | 0:6642dad09196 | 39 | #define MMA8652_CTRL_REG1 0x2A |
AswinSivakumar | 0:6642dad09196 | 40 | #define MMA8652_CTRL_REG2 0x2B |
AswinSivakumar | 0:6642dad09196 | 41 | #define MMA8652_WHO_AM_I_VALUE 0x4A |
AswinSivakumar | 0:6642dad09196 | 42 | |
AswinSivakumar | 0:6642dad09196 | 43 | class MMA8652 |
AswinSivakumar | 0:6642dad09196 | 44 | { |
AswinSivakumar | 0:6642dad09196 | 45 | public: |
AswinSivakumar | 0:6642dad09196 | 46 | |
AswinSivakumar | 0:6642dad09196 | 47 | MMA8652(PinName sda, PinName scl); |
AswinSivakumar | 0:6642dad09196 | 48 | |
AswinSivakumar | 0:6642dad09196 | 49 | void MMA8652_config(void); |
AswinSivakumar | 0:6642dad09196 | 50 | |
AswinSivakumar | 0:6642dad09196 | 51 | void acquire_MMA8652_data_g(float * du); |
AswinSivakumar | 0:6642dad09196 | 52 | |
AswinSivakumar | 0:6642dad09196 | 53 | private: |
AswinSivakumar | 0:6642dad09196 | 54 | I2C MMA8652_i2c; |
AswinSivakumar | 0:6642dad09196 | 55 | |
AswinSivakumar | 0:6642dad09196 | 56 | }; |
AswinSivakumar | 0:6642dad09196 | 57 | |
AswinSivakumar | 0:6642dad09196 | 58 | #endif |