Minor modifications to adapt syntax to FreeIMU
Fork of L3G4200D by
Revision 4:d9e8ea9b4e20, committed 2013-06-24
- Comitter:
- pommzorz
- Date:
- Mon Jun 24 19:44:01 2013 +0000
- Parent:
- 3:14914cd8fdf3
- Commit message:
- Minor modifications to adapt syntax to FreeIMU
Changed in this revision
L3G4200D.cpp | Show annotated file Show diff for this revision Revisions of this file |
L3G4200D.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 14914cd8fdf3 -r d9e8ea9b4e20 L3G4200D.cpp --- a/L3G4200D.cpp Tue Jan 24 16:58:52 2012 +0000 +++ b/L3G4200D.cpp Mon Jun 24 19:44:01 2013 +0000 @@ -41,9 +41,11 @@ // Public Methods ////////////////////////////////////////////////////////////// // Constructor -L3G4200D::L3G4200D(PinName sda, PinName scl): - _device(sda, scl) +//L3G4200D::L3G4200D(PinName sda, PinName scl): +// _device(sda, scl) +L3G4200D::L3G4200D(I2C i2c_):_device(i2c_) { + //this->_device = i2c_; _device.frequency(400000); // Turns on the L3G4200D's gyro and places it in normal mode. // 0x0F = 0b00001111 @@ -96,4 +98,16 @@ g[0] = (short) (xha << 8 | xla); g[1] = (short) (yha << 8 | yla); g[2] = (short) (zha << 8 | zla); +} + +void L3G4200D::read(int *x,int *y,int *z) +{ + +int g[3]; +read(g); + +*x=g[0]; +*y=g[0]; +*z=g[0]; + } \ No newline at end of file
diff -r 14914cd8fdf3 -r d9e8ea9b4e20 L3G4200D.h --- a/L3G4200D.h Tue Jan 24 16:58:52 2012 +0000 +++ b/L3G4200D.h Mon Jun 24 19:44:01 2013 +0000 @@ -86,13 +86,15 @@ * @param sda is the pin for the I2C SDA line * @param scl is the pin for the I2C SCL line */ - L3G4200D(PinName sda, PinName scl); + //L3G4200D(PinName sda, PinName scl); + L3G4200D(I2C i2c_); /** Read gyro values * @param g Array containing x, y, and z gyro values * @return g Array containing x, y, and z gyro values */ void read(int g[3]); + void read(int *x,int *y, int *z); private: byte data[6];