Fork
Dependents: BG96_K6xF_pelion-example-frdm BG96_K6xF_pelion-example-frdm_Temp
Revision 3:eb1271ef90bc, committed 2014-04-17
- Comitter:
- JimCarver
- Date:
- Thu Apr 17 17:54:13 2014 +0000
- Parent:
- 1:8b53edef272f
- Child:
- 4:be6abf9f2d59
- Commit message:
- Added necessary Comments and API documentation
Changed in this revision
| FXOS8700Q.cpp | Show annotated file Show diff for this revision Revisions of this file |
| FXOS8700Q.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/FXOS8700Q.cpp Sun Apr 13 21:22:58 2014 +0000 +++ b/FXOS8700Q.cpp Thu Apr 17 17:54:13 2014 +0000 @@ -1,3 +1,21 @@ +/* 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. +*/ + #include "FXOS8700Q.h" #define UINT14_MAX 16383
--- a/FXOS8700Q.h Sun Apr 13 21:22:58 2014 +0000
+++ b/FXOS8700Q.h Thu Apr 17 17:54:13 2014 +0000
@@ -1,3 +1,21 @@
+/* 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 FXOS8700Q_H
#define FXOS8700Q_H
@@ -22,6 +40,32 @@
#define FXOS8700Q_M_CTRL_REG2 0x5C
#define FXOS8700Q_WHOAMI_VAL 0xC7
+
+/**
+* MMA8451Q accelerometer example
+*
+* @code
+* #include "mbed.h"
+* #include "FXOS8700Q.h"
+*
+*
+* int main(void) {
+*
+* FXOS8700Q combo( A4, A5, FXOS8700Q_I2C_ADDRESS0);
+* PwmOut rled(LED_RED);
+* PwmOut gled(LED_GREEN);
+* PwmOut bled(LED_BLUE);
+*
+* while (true) {
+* rled = 1.0 - combo(acc.getAccX());
+* gled = 1.0 - combo(acc.getAccY());
+* bled = 1.0 - combo(acc.getAccZ());
+* wait(0.1);
+* }
+* }
+* @endcode
+*/
+
class FXOS8700Q
{
public:
@@ -74,8 +118,28 @@
* @param res array where acceleration data will be stored
*/
void getAccAllAxis(float * res);
+
+ /**
+ * Get XYZ axis acceleration, signed 16 bit values
+ *
+ * @param res array where acceleration data will be stored
+ */
void AccXYZraw(int16_t * d);
+
+ /**
+ * Get XYZ axis magnetometer readings, signed 16 bit values
+ *
+ * @param res array where acceleration data will be stored
+ */
void MagXYZraw(int16_t * d);
+
+ /**
+ * Read FXOS8700Q internal registers
+ *
+ * @param Register Address
+ * @param Pointer to whare results will be stored
+ * @param Number of registers to read
+ */
void readRegs(int addr, uint8_t * data, int len);
private:
Daniel Lee