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
Diff: FXLS8471Q.h
- Revision:
- 1:c80be04510fe
- Parent:
- 0:f89f2dc4b003
- Child:
- 2:6aae25fe9ab4
--- a/FXLS8471Q.h Mon Apr 07 00:58:10 2014 +0000 +++ b/FXLS8471Q.h Sat Apr 19 01:26:12 2014 +0000 @@ -1,3 +1,22 @@ +/* Copyright (c) 2010-2011 mbed.org, MIT License +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of this software +* and associated documentation files (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or +* substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + + #ifndef FXLS8471Q_H #define FXLS8471Q_H @@ -6,6 +25,7 @@ // FXLS8471Q internal register addresses #define FXLS8471Q_STATUS 0x00 +#define FXLS8471Q_OUT_X_MSB 0x01 #define FXLS8471Q_WHOAMI 0x0D #define FXLS8471Q_XYZ_DATA_CFG 0x0E #define FXLS8471Q_CTRL_REG1 0x2A @@ -14,24 +34,43 @@ class FXLS8471Q { public: - /** - * MPL3115A2 constructor - * - * @param sda SDA pin - * @param sdl SCL pin - * @param addr addr of the I2C peripheral - */ + /** + * FXOS8700Q constructor + * + * @param mosi MOSI pin + * @param miso MISO pin + * @param scl SCL pin + * @param cs Device Chip Select pin + */ FXLS8471Q(PinName mosi, PinName miso, PinName scl, PinName cs); + + /** + * Get XYZ axis acceleration in G's + * + * @param res array where acceleration data will be stored + */ void ReadXYZ(float * a); + + /** + * Get XYZ axis acceleration, signed 16 bit values + * + * @param res array where acceleration data will be stored + */ +void ReadXYZraw(int16_t * d); + + /** + * Get the value of the WHO_AM_I register + * + * @returns WHO_AM_I value + */ +char getWhoAmI(void); private: SPI _spi; DigitalOut _spi_cs; - //I2C _i2c; - /** Set the device in active mode - */ + void begin( void); void RegWrite( int reg, int * d, int len); void RegRead( int reg, int * d, int len);