Engduino v2.1
|
Much of this header file was created by Freescale. More...
Files | |
file | EngduinoAccelerometer.cpp |
Engduino accelerometer driver. | |
file | EngduinoAccelerometer.h |
Engduino Accelerometer driver. | |
Functions | |
EngduinoAccelerometerClass::EngduinoAccelerometerClass () | |
Constructor. | |
void | EngduinoAccelerometerClass::begin () |
begin function - must be called before using other functions | |
void | EngduinoAccelerometerClass::end () |
end function - switch off the button | |
void | EngduinoAccelerometerClass::xyz (float buf[3]) |
Read the xyz values in g from the accelerometer. | |
void | EngduinoAccelerometerClass::xyzRaw (uint16_t buf[3]) |
Read the raw xyz values from the accelerometer. |
Much of this header file was created by Freescale.
This is the driver code for Accelerometer on the Engduino In v1.0 this accelerometer is a freescale MMA8652.
void EngduinoAccelerometerClass::begin | ( | ) |
begin function - must be called before using other functions
This function enables the accelerometer. The accelerometer is an I2C device so we initialise the I2C communications, make contact with the accelerometer, and check that it's what we think it is.
We set the accelerometer to its 2G range, and don't use a FIFO. Other options are possible, but will need to be implemented in this driver.
Definition at line 43 of file EngduinoAccelerometer.cpp.
void EngduinoAccelerometerClass::end | ( | ) |
end function - switch off the button
Send the accelerometer to sleep
Definition at line 94 of file EngduinoAccelerometer.cpp.
EngduinoAccelerometerClass::EngduinoAccelerometerClass | ( | ) |
Constructor.
C++ constructor for this class. Empty.
Definition at line 27 of file EngduinoAccelerometer.cpp.
void EngduinoAccelerometerClass::xyz | ( | float | buf[3] | ) |
Read the xyz values in g from the accelerometer.
buf | A buffer of floats to put the accelerometer values in g into |
Get the instantaneous accelerometer values for the xyz axes. Convert the 12 bit digital value to a float value that is expressed in g.
Definition at line 109 of file EngduinoAccelerometer.cpp.
void EngduinoAccelerometerClass::xyzRaw | ( | uint16_t | buf[3] | ) |
Read the raw xyz values from the accelerometer.
buf | A buffer of uint16s to hold the 12 bit raw accelerometer values |
Get the instantaneous accelerometer values for the xyz axes. We return the raw values without converting them into g. To convert to g, if we are using a 2G scale, then simply divide by 16384
Definition at line 153 of file EngduinoAccelerometer.cpp.