Rev 0.1 Simple operation of just X, Y, Z values in floating point G's

Dependents:   Hello_FXLS8471Q Multi-Sensor sensor AerCloud_MutliTech_Socket_Modem_Example ... more

Committer:
JimCarver
Date:
Sat Apr 19 01:26:12 2014 +0000
Revision:
1:c80be04510fe
Parent:
0:f89f2dc4b003
Child:
2:6aae25fe9ab4
Added features

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JimCarver 1:c80be04510fe 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
JimCarver 1:c80be04510fe 2 *
JimCarver 1:c80be04510fe 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
JimCarver 1:c80be04510fe 4 * and associated documentation files (the "Software"), to deal in the Software without
JimCarver 1:c80be04510fe 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
JimCarver 1:c80be04510fe 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
JimCarver 1:c80be04510fe 7 * Software is furnished to do so, subject to the following conditions:
JimCarver 1:c80be04510fe 8 *
JimCarver 1:c80be04510fe 9 * The above copyright notice and this permission notice shall be included in all copies or
JimCarver 1:c80be04510fe 10 * substantial portions of the Software.
JimCarver 1:c80be04510fe 11 *
JimCarver 1:c80be04510fe 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
JimCarver 1:c80be04510fe 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
JimCarver 1:c80be04510fe 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
JimCarver 1:c80be04510fe 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
JimCarver 1:c80be04510fe 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
JimCarver 1:c80be04510fe 17 */
JimCarver 1:c80be04510fe 18
JimCarver 1:c80be04510fe 19
JimCarver 0:f89f2dc4b003 20 #ifndef FXLS8471Q_H
JimCarver 0:f89f2dc4b003 21 #define FXLS8471Q_H
JimCarver 0:f89f2dc4b003 22
JimCarver 0:f89f2dc4b003 23 #include "mbed.h"
JimCarver 0:f89f2dc4b003 24
JimCarver 0:f89f2dc4b003 25 // FXLS8471Q internal register addresses
JimCarver 0:f89f2dc4b003 26
JimCarver 0:f89f2dc4b003 27 #define FXLS8471Q_STATUS 0x00
JimCarver 1:c80be04510fe 28 #define FXLS8471Q_OUT_X_MSB 0x01
JimCarver 0:f89f2dc4b003 29 #define FXLS8471Q_WHOAMI 0x0D
JimCarver 0:f89f2dc4b003 30 #define FXLS8471Q_XYZ_DATA_CFG 0x0E
JimCarver 0:f89f2dc4b003 31 #define FXLS8471Q_CTRL_REG1 0x2A
JimCarver 0:f89f2dc4b003 32 #define FXLS8471Q_WHOAMI_VAL 0x6A
JimCarver 0:f89f2dc4b003 33
JimCarver 0:f89f2dc4b003 34 class FXLS8471Q
JimCarver 0:f89f2dc4b003 35 {
JimCarver 0:f89f2dc4b003 36 public:
JimCarver 1:c80be04510fe 37 /**
JimCarver 1:c80be04510fe 38 * FXOS8700Q constructor
JimCarver 1:c80be04510fe 39 *
JimCarver 1:c80be04510fe 40 * @param mosi MOSI pin
JimCarver 1:c80be04510fe 41 * @param miso MISO pin
JimCarver 1:c80be04510fe 42 * @param scl SCL pin
JimCarver 1:c80be04510fe 43 * @param cs Device Chip Select pin
JimCarver 1:c80be04510fe 44 */
JimCarver 0:f89f2dc4b003 45 FXLS8471Q(PinName mosi, PinName miso, PinName scl, PinName cs);
JimCarver 0:f89f2dc4b003 46
JimCarver 1:c80be04510fe 47
JimCarver 1:c80be04510fe 48 /**
JimCarver 1:c80be04510fe 49 * Get XYZ axis acceleration in G's
JimCarver 1:c80be04510fe 50 *
JimCarver 1:c80be04510fe 51 * @param res array where acceleration data will be stored
JimCarver 1:c80be04510fe 52 */
JimCarver 0:f89f2dc4b003 53 void ReadXYZ(float * a);
JimCarver 1:c80be04510fe 54
JimCarver 1:c80be04510fe 55 /**
JimCarver 1:c80be04510fe 56 * Get XYZ axis acceleration, signed 16 bit values
JimCarver 1:c80be04510fe 57 *
JimCarver 1:c80be04510fe 58 * @param res array where acceleration data will be stored
JimCarver 1:c80be04510fe 59 */
JimCarver 1:c80be04510fe 60 void ReadXYZraw(int16_t * d);
JimCarver 1:c80be04510fe 61
JimCarver 1:c80be04510fe 62 /**
JimCarver 1:c80be04510fe 63 * Get the value of the WHO_AM_I register
JimCarver 1:c80be04510fe 64 *
JimCarver 1:c80be04510fe 65 * @returns WHO_AM_I value
JimCarver 1:c80be04510fe 66 */
JimCarver 1:c80be04510fe 67 char getWhoAmI(void);
JimCarver 0:f89f2dc4b003 68
JimCarver 0:f89f2dc4b003 69 private:
JimCarver 0:f89f2dc4b003 70
JimCarver 0:f89f2dc4b003 71 SPI _spi;
JimCarver 0:f89f2dc4b003 72 DigitalOut _spi_cs;
JimCarver 1:c80be04510fe 73
JimCarver 0:f89f2dc4b003 74 void begin( void);
JimCarver 0:f89f2dc4b003 75 void RegWrite( int reg, int * d, int len);
JimCarver 0:f89f2dc4b003 76 void RegRead( int reg, int * d, int len);
JimCarver 0:f89f2dc4b003 77
JimCarver 0:f89f2dc4b003 78
JimCarver 0:f89f2dc4b003 79 };
JimCarver 0:f89f2dc4b003 80
JimCarver 0:f89f2dc4b003 81 #endif