Simple library for MAG3110 magenetometer as built into Avnet Wi-Go module
Dependents: XtrinsicSensorEVK KL46Z KL46Z_CS213A_HW1 KL46Z_NokiaLCD ... more
Fork of MAG3110 by
Revision 5:9644c7d596a1, committed 2013-10-10
- Comitter:
- jppang
- Date:
- Thu Oct 10 02:22:13 2013 +0000
- Parent:
- 4:cf40601402b7
- Commit message:
- modified to fit XtrinsicSensorEVK
Changed in this revision
MAG3110.cpp | Show annotated file Show diff for this revision Revisions of this file |
MAG3110.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r cf40601402b7 -r 9644c7d596a1 MAG3110.cpp --- a/MAG3110.cpp Fri May 24 20:16:24 2013 +0000 +++ b/MAG3110.cpp Thu Oct 10 02:22:13 2013 +0000 @@ -5,14 +5,14 @@ /****************************************************************************** * Constructors ******************************************************************************/ -MAG3110::MAG3110(PinName sda, PinName scl): _i2c(sda, scl), - _i2c_address(0x1D), _pc(NULL), _debug(false) +MAG3110::MAG3110(PinName sda, PinName scl, int addr): _i2c(sda, scl), + _i2c_address(addr), _pc(NULL), _debug(false) { begin(); } -MAG3110::MAG3110(PinName sda, PinName scl, Serial *pc): _i2c(sda, scl), - _i2c_address(0x1D), _pc(pc), _debug(true) +MAG3110::MAG3110(PinName sda, PinName scl, int addr, Serial *pc): _i2c(sda, scl), + _i2c_address(addr), _pc(pc), _debug(true) { begin(); }
diff -r cf40601402b7 -r 9644c7d596a1 MAG3110.h --- a/MAG3110.h Fri May 24 20:16:24 2013 +0000 +++ b/MAG3110.h Thu Oct 10 02:22:13 2013 +0000 @@ -10,7 +10,7 @@ #define PI 3.14159265359 -#define MAG_ADDR 0x1D +//#define MAG_ADDR 0x0E // define registers #define MAG_DR_STATUS 0x00 @@ -86,7 +86,7 @@ * @param sdl SCL pin * @param addr addr of the I2C peripheral */ - MAG3110(PinName sda, PinName scl); + MAG3110(PinName sda, PinName scl, int addr); /** * Debug version of constructor * @param sda SDA pin @@ -94,7 +94,7 @@ * @param addr Address of the I2C peripheral * @param pc Serial object to output debug messages */ - MAG3110(PinName sda, PinName scl, Serial *pc); //pass serial for debug + MAG3110(PinName sda, PinName scl, int addr, Serial *pc); //pass serial for debug /** * Setup the Magnetometer *