MMA7361L Class Reference
accelerometer More...
#include <MMA7361L.h>
Public Member Functions | |
MMA7361L (PinName xoutPin, PinName youtPin, PinName zoutPin, PinName zeroGDetectPin) | |
Creates an MMA7361L accelerometer interface, connected to the specified pins. | |
float | getAccel () |
Gets the current total acceleration. | |
float | getAccelX () |
Gets the current acceleration along the X axis. | |
float | getAccelY () |
Gets the current acceleration along the Y axis. | |
float | getAccelZ () |
Gets the current acceleration along the Z axis. | |
float | getTiltX () |
Computes the inclination of the X axis. | |
float | getTiltY () |
Computes the inclination of the Y axis. | |
float | getTiltZ () |
Computes the inclination of the Z axis. | |
bool | zeroGDetected () |
Tests whether 0G is detected. | |
void | setZeroGDetectListener (void(*func)(void)) |
Sets fucntion to be called when 0G is detected. | |
template<typename T > | |
void | setZeroGDetectListener (T *t, void(T::*func)(void)) |
Sets member fucntion to be called when 0G is detected. |
Detailed Description
accelerometer
Definition at line 6 of file MMA7361L.h.
Constructor & Destructor Documentation
MMA7361L | ( | PinName | xoutPin, |
PinName | youtPin, | ||
PinName | zoutPin, | ||
PinName | zeroGDetectPin | ||
) |
Creates an MMA7361L accelerometer interface, connected to the specified pins.
- Parameters:
-
xoutPin xout pin youtPin yout pin zoutPin zout pin zeroGDetectPin 0G detect pin
Definition at line 3 of file MMA7361L.cpp.
Member Function Documentation
float getAccel | ( | ) |
Gets the current total acceleration.
- Returns:
- total acceleration in g
Definition at line 21 of file MMA7361L.cpp.
float getAccelX | ( | ) |
Gets the current acceleration along the X axis.
- Returns:
- acceleration along the X axis in g
Definition at line 26 of file MMA7361L.cpp.
float getAccelY | ( | ) |
Gets the current acceleration along the Y axis.
- Returns:
- acceleration along the Y axis in g
Definition at line 31 of file MMA7361L.cpp.
float getAccelZ | ( | ) |
Gets the current acceleration along the Z axis.
- Returns:
- acceleration along the Z axis in g
Definition at line 36 of file MMA7361L.cpp.
float getTiltX | ( | ) |
Computes the inclination of the X axis.
- Returns:
- the inclination of the X axis
Definition at line 41 of file MMA7361L.cpp.
float getTiltY | ( | ) |
Computes the inclination of the Y axis.
- Returns:
- the inclination of the Y axis
Definition at line 46 of file MMA7361L.cpp.
float getTiltZ | ( | ) |
Computes the inclination of the Z axis.
- Returns:
- the inclination of the Z axis
Definition at line 51 of file MMA7361L.cpp.
void setZeroGDetectListener | ( | T * | t, |
void(T::*)(void) | func | ||
) |
Sets member fucntion to be called when 0G is detected.
- Parameters:
-
t pointer to the object to call the member function on func pointer to the member function tobe called when 0G is detected, 0 to reset as none
Definition at line 64 of file MMA7361L.cpp.
void setZeroGDetectListener | ( | void(*)(void) | func ) |
Sets fucntion to be called when 0G is detected.
- Parameters:
-
func pointer to a function called when 0G is detected, 0 to reset as none
Definition at line 60 of file MMA7361L.cpp.
bool zeroGDetected | ( | ) |
Tests whether 0G is detected.
- Returns:
- true if 0G is detected, false otherwise
Definition at line 56 of file MMA7361L.cpp.
Generated on Fri Jul 15 2022 21:20:24 by
