Library for MMA7660FC Accelerometer device
Dependents: TestCode_MMA7660FC 3D_Accelerometer_Tester RTOS-aap-board-modules embed_Grove_3-Axis_Digital_Accelerometer ... more
Revision 5:d2f90c0be13f, committed 2012-07-05
- Comitter:
- edodm85
- Date:
- Thu Jul 05 17:47:12 2012 +0000
- Parent:
- 4:6e931d9bbf4b
- Child:
- 6:10aa804dee97
- Commit message:
- Rev 6
Changed in this revision
MMA7660FC.cpp | Show annotated file Show diff for this revision Revisions of this file |
MMA7660FC.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MMA7660FC.cpp Wed Jul 04 20:20:27 2012 +0000 +++ b/MMA7660FC.cpp Thu Jul 05 17:47:12 2012 +0000 @@ -74,15 +74,15 @@ m_i2c.read(m_addr, buf, 3); // Read register content into buffer with 6bit // returns the x, y, z coordinates transformed into full degrees - *x = TILT_XY[buf[0]]; - *y = TILT_XY[buf[1]]; - *z = TILT_Z[buf[2]]; + *x = TILT_XY[(int)buf[0]]; + *y = TILT_XY[(int)buf[1]]; + *z = TILT_Z[(int)buf[2]]; } // Reads x data -float MMA7660FC::read_x() +int MMA7660FC::read_x() { m_i2c.start(); // Start @@ -93,13 +93,13 @@ char x = m_i2c.read(0); // Read the data m_i2c.stop(); - return (float)x; + return (int)x; } // Reads y data -float MMA7660FC::read_y() +int MMA7660FC::read_y() { m_i2c.start(); // Start @@ -110,13 +110,13 @@ char y = m_i2c.read(0); // Read the data m_i2c.stop(); - return (float)y; + return (int)y; } // Reads z data -float MMA7660FC::read_z() +int MMA7660FC::read_z() { m_i2c.start(); // Start @@ -127,7 +127,7 @@ char z = m_i2c.read(0); // Read the data m_i2c.stop(); - return (float)z; + return (int)z; }
--- a/MMA7660FC.h Wed Jul 04 20:20:27 2012 +0000 +++ b/MMA7660FC.h Thu Jul 05 17:47:12 2012 +0000 @@ -86,19 +86,19 @@ * * @returns The value of x acceleration */ - float read_x(); + int read_x(); /** Read the y register of the MMA7660FC * * @returns The value of y acceleration */ - float read_y(); + int read_y(); /** Read the z register of the MMA7660FC * * @returns The value of z acceleration */ - float read_z(); + int read_z(); /** Read from specified MMA7660FC register *