Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MotionSensor
Fork of FXOS8700Q by
Diff: FXOS8700Q.h
- Revision:
- 0:2562215f5bc0
- Child:
- 1:8b53edef272f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/FXOS8700Q.h Mon Apr 07 00:58:50 2014 +0000
@@ -0,0 +1,65 @@
+#ifndef FXOS8700Q_H
+#define FXOS8700Q_H
+
+#include "mbed.h"
+// FXOS8700CQ I2C address
+#define FXOS8700CQ_SLAVE_ADDR 0x3C // with pins SA0=0, SA1=0
+
+// FXOS8700CQ internal register addresses
+#define FXOS8700CQ_STATUS 0x00
+#define FXOS8700CQ_WHOAMI 0x0D
+#define FXOS8700CQ_XYZ_DATA_CFG 0x0E
+#define FXOS8700CQ_CTRL_REG1 0x2A
+#define FXOS8700CQ_M_CTRL_REG1 0x5B
+#define FXOS8700CQ_M_CTRL_REG2 0x5C
+#define FXOS8700CQ_WHOAMI_VAL 0xC7
+
+class FXOS8700Q
+{
+public:
+ /**
+ * MPL3115A2 constructor
+ *
+ * @param sda SDA pin
+ * @param sdl SCL pin
+ * @param addr addr of the I2C peripheral
+ */
+ FXOS8700Q(PinName sda, PinName scl);
+
+ /**
+ * Get the value of the WHO_AM_I register
+ *
+ * @returns DEVICE_ID value == ??
+ */
+ //uint8_t getDeviceID();
+
+ /**
+ * Return the STATUS register value
+ *
+ * @returns STATUS register value
+ */
+ //unsigned char getStatus( void);
+
+ /**
+ * Get the Accelerometer & Magnetometer values
+ * Accelerometer data is in G's
+ * MAgnetometer Data is in microteslas
+ *
+ * @returns altimeter value as float
+ */
+ void ReadXYZ(float * a, float * m);
+
+
+private:
+
+ I2C _i2c;
+ /** Set the device in active mode
+ */
+ void begin( void);
+
+ void RegRead( char reg, char * d, int len);
+
+
+};
+
+#endif
