Library for interfacing with NXP FXOS8700CQ accelerometer/magnetometer

Dependents:   Hexi_GPSIMU_Hotshoe

Fork of FXOS8700CQ by Craig Evans

Files at this revision

API Documentation at this revision

Comitter:
whatnick
Date:
Thu Feb 02 03:07:59 2017 +0000
Parent:
0:f66eda6a492a
Commit message:
Added multiple addresses

Changed in this revision

FXOS8700CQ.h Show annotated file Show diff for this revision Revisions of this file
diff -r f66eda6a492a -r b320fe026cc5 FXOS8700CQ.h
--- a/FXOS8700CQ.h	Tue Jan 31 19:02:23 2017 +0000
+++ b/FXOS8700CQ.h	Thu Feb 02 03:07:59 2017 +0000
@@ -13,7 +13,13 @@
 #include "mbed.h"
 
 // mbed API uses 8-bit addresses so need to left-shift 7-bit addresses by 1
-#define FXOS8700CQ_ADDR   (0x1D << 1)    // for K64F board
+// FXOS8700CQ I2C address
+#define FXOS8700CQ_SLAVE_ADDR0 (0x1E<<1) // with pins SA0=0, SA1=0
+#define FXOS8700CQ_SLAVE_ADDR1 (0x1D<<1) // with pins SA0=1, SA1=0
+#define FXOS8700CQ_SLAVE_ADDR2 (0x1C<<1) // with pins SA0=0, SA1=1
+#define FXOS8700CQ_SLAVE_ADDR3 (0x1F<<1) // with pins SA0=1, SA1=1
+//#define FXOS8700CQ_ADDR   FXOS8700CQ_SLAVE_ADDR1    // for K64F board
+#define FXOS8700CQ_ADDR   FXOS8700CQ_SLAVE_ADDR0    // for Hexiwear board
 // values from 13.2 datasheet
 #define FXOS8700CQ_STATUS 0x00
 #define FXOS8700CQ_WHO_AM_I 0x0D
@@ -24,7 +30,7 @@
 #define FXOS8700CQ_WHO_AM_I_VAL 0xC7
 #define FXOS8700CQ_READ_LEN 13
 
-#define PI 3.14159265359f
+#define PI 3.14159265358979323846f
 #define RAD2DEG 57.2957795131f
 
 struct Data {