SPI accelerometer library

Dependents:   FRDMSTBC-A8471_SensorShield_HelloWorld

Fork of MMA8652FC by NXP

Committer:
AswinSivakumar
Date:
Wed Mar 23 05:34:00 2016 +0000
Revision:
1:ac1a9afd8401
Parent:
MMA8652.h@0:6642dad09196
Child:
2:0eacd0e5db3b
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AswinSivakumar 0:6642dad09196 1 /* Copyright (c) 2015 NXP Semiconductors. MIT License
AswinSivakumar 0:6642dad09196 2 *
AswinSivakumar 0:6642dad09196 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
AswinSivakumar 0:6642dad09196 4 * and associated documentation files (the "Software"), to deal in the Software without
AswinSivakumar 0:6642dad09196 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
AswinSivakumar 0:6642dad09196 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
AswinSivakumar 0:6642dad09196 7 * Software is furnished to do so, subject to the following conditions:
AswinSivakumar 0:6642dad09196 8 *
AswinSivakumar 0:6642dad09196 9 * The above copyright notice and this permission notice shall be included in all copies or
AswinSivakumar 0:6642dad09196 10 * substantial portions of the Software.
AswinSivakumar 0:6642dad09196 11 *
AswinSivakumar 0:6642dad09196 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
AswinSivakumar 0:6642dad09196 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
AswinSivakumar 0:6642dad09196 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
AswinSivakumar 0:6642dad09196 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
AswinSivakumar 0:6642dad09196 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AswinSivakumar 0:6642dad09196 17 */
AswinSivakumar 0:6642dad09196 18
AswinSivakumar 1:ac1a9afd8401 19 #ifndef FXLS8471_H
AswinSivakumar 1:ac1a9afd8401 20 #define FXLS8471_H
AswinSivakumar 0:6642dad09196 21 #include "mbed.h"
AswinSivakumar 0:6642dad09196 22
AswinSivakumar 1:ac1a9afd8401 23 #define FXLS8471_STATUS 0x00
AswinSivakumar 1:ac1a9afd8401 24 #define FXLS8471_WHO_AM_I 0x0D
AswinSivakumar 1:ac1a9afd8401 25 #define FXLS8471_CTRL_REG1 0x2A
AswinSivakumar 1:ac1a9afd8401 26 #define FXLS8471_CTRL_REG2 0x2B
AswinSivakumar 1:ac1a9afd8401 27 #define FXLS8471_WHO_AM_I_VALUE 0x6A
AswinSivakumar 0:6642dad09196 28
AswinSivakumar 1:ac1a9afd8401 29 class FXLS8471
AswinSivakumar 0:6642dad09196 30 {
AswinSivakumar 0:6642dad09196 31 public:
AswinSivakumar 0:6642dad09196 32
AswinSivakumar 1:ac1a9afd8401 33 FXLS8471(PinName MOSI, PinName MISO, PinName CLK, PinName CS);
AswinSivakumar 0:6642dad09196 34
AswinSivakumar 1:ac1a9afd8401 35 void FXLS8471_config(void);
AswinSivakumar 0:6642dad09196 36
AswinSivakumar 1:ac1a9afd8401 37 void acquire_FXLS8471_data_g(float * du);
AswinSivakumar 0:6642dad09196 38
AswinSivakumar 0:6642dad09196 39 private:
AswinSivakumar 1:ac1a9afd8401 40 SPI FXLS8471_spi;
AswinSivakumar 1:ac1a9afd8401 41 DigitalOut FXLS8471_cs;
AswinSivakumar 0:6642dad09196 42
AswinSivakumar 0:6642dad09196 43 };
AswinSivakumar 0:6642dad09196 44
AswinSivakumar 0:6642dad09196 45 #endif