API for the DFRobot MMA7361 Analog Accelerometer.  
 More...
The driver was tested with the DFRobot MMA7361 Analog Accelerometer. It supports 3 Axes with a selectable 1.5G and 6G sensitivity.
  
  
  
  
  
  
  while (shouldRun)
    {
      float x, y, z;
      cout << "Acceleration x = "
           << x
           << " y = "
           << y
           << "z = "
           << z
           << endl;
      cout << "Volts x = "
           << x
           << " y = "
           << y
           << "z = "
           << z
           << endl;
      cout << endl;
      usleep(100000);
    }
  
 | 
|   | MMA7361 (int x_pin, int y_pin, int z_pin, int selftest_pin, int sleep_pin, int freefall_pin, int range_pin, float a_ref=5.0) | 
|   | 
|   | ~MMA7361 () | 
|   | 
| void  | setRange (bool range) | 
|   | 
| void  | setSleep (bool sleep) | 
|   | 
| bool  | isInFreefall () | 
|   | 
| void  | enableSelftest (bool enable) | 
|   | 
| void  | update () | 
|   | 
| void  | setOffset (float x, float y, float z) | 
|   | 
| void  | setScale (float x, float y, float z) | 
|   | 
| void  | getAcceleration (float *x, float *y, float *z) | 
|   | 
| float *  | getAcceleration () | 
|   | 
| void  | getVolts (float *x, float *y, float *z) | 
|   | 
| float *  | getVolts () | 
|   | 
| void  | getNormalized (float *x, float *y, float *z) | 
|   | 
| float *  | getNormalized () | 
|   | 
      
        
          | MMA7361  | 
          ( | 
          int  | 
          x_pin,  | 
        
        
           | 
           | 
          int  | 
          y_pin,  | 
        
        
           | 
           | 
          int  | 
          z_pin,  | 
        
        
           | 
           | 
          int  | 
          selftest_pin,  | 
        
        
           | 
           | 
          int  | 
          sleep_pin,  | 
        
        
           | 
           | 
          int  | 
          freefall_pin,  | 
        
        
           | 
           | 
          int  | 
          range_pin,  | 
        
        
           | 
           | 
          float  | 
          a_ref = 5.0  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
MMA7361 object constructor
- Parameters
 - 
  
    | x_pin | Analog pin to use for X axis. -1 to disable.  | 
    | y_pin | Analog pin to use for Y axis. -1 to disable.  | 
    | z_pin | Analog pin to use for Z axis. -1 to disable.  | 
    | selftest_pin | GPIO pin to use for self test. -1 to disable.  | 
    | sleep_pin | GPIO pin to use for sleep function. -1 to disable.  | 
    | freefall_pin | GPIO pin to use for free fall (0g) detection. -1 to disable.  | 
    | range_pin | GPIO pin to select range (1.5g or 6g). -1 to disable.  | 
    | a_ref | The analog reference voltage in use. Default 5.0.  | 
  
   
 
 
      
        
          | void setRange  | 
          ( | 
          bool  | 
          range | ) | 
           | 
        
      
 
Set the range of the device. This device supports two G ranges: 1.5 and 6. The default is 1.5G.
- Parameters
 - 
  
    | range | true for 6G, false for 1.5G  | 
  
   
 
 
      
        
          | void setSleep  | 
          ( | 
          bool  | 
          sleep | ) | 
           | 
        
      
 
Set sleep mode. When in sleep mode the sensor uses minimal power.
- Parameters
 - 
  
    | sleep | true to go into sleep mode, false to wake up  | 
  
   
 
 
Get freefall detection status.
- Returns
 - true if a freefall condition is detected, false otherwise. 
 
 
 
      
        
          | void enableSelftest  | 
          ( | 
          bool  | 
          enable | ) | 
           | 
        
      
 
Enable self test mode.
- Parameters
 - 
  
    | enable | true to enable the self test mode, false otherwise.  | 
  
   
 
 
      
        
          | void setOffset  | 
          ( | 
          float  | 
          x,  | 
        
        
           | 
           | 
          float  | 
          y,  | 
        
        
           | 
           | 
          float  | 
          z  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Set sensor offset. This offset is applied to the return values before scaling. Default is 0.0.
- Parameters
 - 
  
    | x | Offset to apply to X value  | 
    | y | Offset to apply to Y value  | 
    | z | Offset to apply to Z value  | 
  
   
 
 
      
        
          | void setScale  | 
          ( | 
          float  | 
          x,  | 
        
        
           | 
           | 
          float  | 
          y,  | 
        
        
           | 
           | 
          float  | 
          z  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Set sensor scale. The acceleration return values are scaled by this value before the offset is applied. Default is 1.0.
- Parameters
 - 
  
    | x | Scale to apply to X value  | 
    | y | Scale to apply to Y value  | 
    | z | Scale to apply to Z value  | 
  
   
 
 
      
        
          | void getAcceleration  | 
          ( | 
          float *  | 
          x,  | 
        
        
           | 
           | 
          float *  | 
          y,  | 
        
        
           | 
           | 
          float *  | 
          z  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Get computed acceleration from the sensor. update() must have been called prior to calling this function.
- Parameters
 - 
  
    | x | a pointer in which X acceleration data will be returned  | 
    | y | a pointer in which Y acceleration data will be returned  | 
    | z | a pointer in which Z acceleration data will be returned  | 
  
   
 
 
      
        
          | float * getAcceleration  | 
          ( | 
           | ) | 
           | 
        
      
 
Get computed acceleration from the sensor. update() must have been called prior to calling this function.
- Returns
 - a pointer to a statically allocated array of 3 floats containing the X, Y, and Z componenets. 
 
 
 
      
        
          | void getVolts  | 
          ( | 
          float *  | 
          x,  | 
        
        
           | 
           | 
          float *  | 
          y,  | 
        
        
           | 
           | 
          float *  | 
          z  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Get the measured volts from the sensor. update() must have been called prior to calling this function.
- Parameters
 - 
  
    | x | a pointer in which X volt data will be returned  | 
    | y | a pointer in which Y volt data will be returned  | 
    | z | a pointer in which Z volt data will be returned  | 
  
   
 
 
Get the measured volts from the sensor. update() must have been called prior to calling this function.
- Returns
 - a pointer to a statically allocated array of 3 floats containing the X, Y, and Z componenets. 
 
 
 
      
        
          | void getNormalized  | 
          ( | 
          float *  | 
          x,  | 
        
        
           | 
           | 
          float *  | 
          y,  | 
        
        
           | 
           | 
          float *  | 
          z  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Get the normalized ADC values from the sensor. update() must have been called prior to calling this function.
- Parameters
 - 
  
    | x | a pointer in which X normalized ADC data will be returned  | 
    | y | a pointer in which Y normalized ADC data will be returned  | 
    | z | a pointer in which Z normalized ADC data will be returned  | 
  
   
 
 
      
        
          | float * getNormalized  | 
          ( | 
           | ) | 
           | 
        
      
 
Get the normalized ADC values from the sensor. update() must have been called prior to calling this function.
- Returns
 - a pointer to a statically allocated array of 3 ints containing the X, Y, and Z componenets. 
 
 
 
The documentation for this class was generated from the following files:
- /iotdk/jenkins/workspace/upm-doc-stable/src/mma7361/mma7361.hpp
 
- /iotdk/jenkins/workspace/upm-doc-stable/src/mma7361/mma7361.cxx