Library for the MMA7660 triple axis accelerometer
Dependents: mbed_Shield_LCD_Accelerometer mbed_Shield_Accelerometer
Fork of MMA7660 by
Revision 3:05babde28906, committed 2014-04-02
- Comitter:
- sam_grove
- Date:
- Wed Apr 02 16:25:39 2014 +0000
- Parent:
- 2:a8e20db7901e
- Commit message:
- Remove config from constructor and do when connection is tested. Bump speed up to 400k
Changed in this revision
| MMA7660.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a8e20db7901e -r 05babde28906 MMA7660.cpp
--- a/MMA7660.cpp Wed Oct 17 16:38:05 2012 +0000
+++ b/MMA7660.cpp Wed Apr 02 16:25:39 2014 +0000
@@ -2,17 +2,17 @@
MMA7660::MMA7660(PinName sda, PinName scl, bool active) : _i2c(sda, scl)
{
- setActive(active);
- samplerate = 64;
-
+ _i2c.frequency(400000);
}
//Since the MMA lacks a WHO_AM_I register, we can only check if there is a device that answers to the I2C address
bool MMA7660::testConnection( void )
{
- if (_i2c.write(MMA7660_ADDRESS, NULL, 0) == 0 )
+ if (_i2c.write(MMA7660_ADDRESS, NULL, 0) == 0 ) {
+ setActive(active);
+ samplerate = 64;
return true;
- else
+ } else
return false;
}
