upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
API for the MMA8X5X Three-Axis Accelerometer. More...
Description in web-link above: The NXP MMA8X5X are low-power, three-axis capacitive micromachined accelerometer with 10/12/14 bits of resolution. These accelerometer are packed with embedded functions with flexible user-programmable options configurable to two interrupt pins. The MMA8X5X have user-selectable full scales of +-2g/+-4g/+-8g.
Public Member Functions | |
MMA8X5X (int bus, mma8x5x_params_t *params=NULL, int devAddr=MMA8X5X_I2C_ADDRESS) | |
int | setDeviceName (uint8_t type) |
int | setDeviceParams (mma8x5x_params_t *params) |
int | setUserOffset (int8_t x, int8_t y, int8_t z) |
int | setActive (void) |
int | setStandby (void) |
int | isReady (void) |
int | sampleData (void) |
int16_t | getX (int bSampleData=0) |
int16_t | getY (int bSampleData=0) |
int16_t | getZ (int bSampleData=0) |
int | getData (mma8x5x_data_t *data, int bSampleData=0) |
MMA8X5X | ( | int | bus, |
mma8x5x_params_t * | params = NULL , |
||
int | devAddr = MMA8X5X_I2C_ADDRESS |
||
) |
Instantiates an MMA8X5X object
bus | Number of the used bus params Params of device |
devAddr | Address of the used I2C device |
int setDeviceName | ( | uint8_t | type | ) |
Set device name and type matching given type or read out devive_id to set name and type of device
type | Type of device if set or 0 if needed to find out by it |
int setDeviceParams | ( | mma8x5x_params_t * | params | ) |
Set device params to given data or set default params and read out devive_id to set type of device
params | Params of device if set by user NULL if it is not set by user |
int setUserOffset | ( | int8_t | x, |
int8_t | y, | ||
int8_t | z | ||
) |
Set user offset correction Offset correction register will be erased after accelerometer reset
x | Offset correction value for x-axis |
y | Offset correction value for y-axis |
z | Offset correction value for z-axis |
int setActive | ( | void | ) |
Set active mode, this enables periodic measurements
int setStandby | ( | void | ) |
Set standby mode, this disables periodic measurements
int isReady | ( | void | ) |
Check for new set of measurement data.
int sampleData | ( | void | ) |
Read & calculate accelerometer data in mg & saves them to variables
int16_t getX | ( | int | bSampleData = 0 | ) |
Get x-axis acceleration
bSampleData | Flag to read sensor |
int16_t getY | ( | int | bSampleData = 0 | ) |
Get y-axis acceleration
bSampleData | Flag to read sensor |
int16_t getZ | ( | int | bSampleData = 0 | ) |
Get z-axis acceleration
bSampleData | Flag to read sensor |
int getData | ( | mma8x5x_data_t * | data, |
int | bSampleData = 0 |
||
) |
Get sensor values
data | Sensor values |
bSampleData | Flag to read sensor |