Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: etch-a-sketch-engo333 STEMEXplore_Guide ENGO333_Lab_etch-a-sketch
Fork of MMA7660 by
Revision 5:5e50f1d2bda1, committed 2015-10-30
- Comitter:
- mpetovello
- Date:
- Fri Oct 30 04:56:02 2015 +0000
- Parent:
- 4:36a163511e34
- Commit message:
- Updated comments for use with ENGO 333.
Changed in this revision
MMA7660.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MMA7660.h Tue May 13 18:14:34 2014 +0000 +++ b/MMA7660.h Fri Oct 30 04:56:02 2015 +0000 @@ -63,6 +63,64 @@ class MMA7660 { public: + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // START: Functions Relevant to ENGO 333 Lab #8 + + + // Constructor + // + // Arguments are the pins used for communicating with the device + // (do not worry about these details): + // sda - I2C data pin number + // scl - I2C clock pin number + // active - Set to true to enable the device (false = standby) + MMA7660(PinName sda, PinName scl, bool active = true); + + + // Test the connection with the sensor + // + // Arguments: + // None + // + // Returns: + // True if the connection is successful and false otherwise + bool testConnection( void ); + + + // Get the x-axis accelerometer data in units of G's (1G ~= 9.81 m/s/s) + // + // Arguments: + // None + // + // Returns: + // The x-axis acceleration in G's + float x( void ); + + + // Get the y-axis accelerometer data in units of G's (1G ~= 9.81 m/s/s) + // + // Arguments: + // None + // + // Returns: + // The y-axis acceleration in G's + float y( void ); + + + // Get the z-axis accelerometer data in units of G's (1G ~= 9.81 m/s/s) + // + // Arguments: + // None + // + // Returns: + // The z-axis acceleration in G's + float z( void ); + + + // END: Functions Relevant to ENGO 333 Lab #8 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /** * The 6 different orientations and unknown * @@ -77,24 +135,6 @@ Unknown }; - /** - * Creates a new MMA7660 object - * - * @param sda - I2C data pin - * @param scl - I2C clock pin - * @param active - true (default) to enable the device, false to keep it standby - */ - MMA7660(PinName sda, PinName scl, bool active = true); - - /** - * Tests if communication is possible with the MMA7660 - * - * Because the MMA7660 lacks a WHO_AM_I register, this function can only check - * if there is an I2C device that responds to the MMA7660 address - * - * @param return - true for successfull connection, false for no connection - */ - bool testConnection( void ); /** * Sets the active state of the MMA7660 @@ -117,27 +157,6 @@ void readData( float *data); /** - * Get X-data - * - * @param return - X-acceleration in g's - */ - float x( void ); - - /** - * Get Y-data - * - * @param return - Y-acceleration in g's - */ - float y( void ); - - /** - * Get Z-data - * - * @param return - Z-acceleration in g's - */ - float z( void ); - - /** * Sets the active samplerate * * The entered samplerate will be rounded to nearest supported samplerate.