pyupm_mma8x5x module

class pyupm_mma8x5x.MMA8X5X(bus, params=None, devAddr=29)[source]

Bases: object

API for the MMA8X5X Three-Axis Accelerometer.

ID: mma8x5x

Name: MMA8X5X Three-Axis Accelerometer

Other Chips: mma8451 mma8452 mma8453 mma8652 mma8653

Category: accelerometer compass

Manufacturer: freescale

Link:http://www.nxp.com/products/sensors/accelerometers:DRSNSAXLRTN

Connection: i2c 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.

C++ includes: mma8x5x.hpp

getData(data, bSampleData=0)[source]

int getData(mma8x5x_data_t *data, int bSampleData=0)

Get sensor values

data: Sensor values

bSampleData: Flag to read sensor

0 on success -1 on error

getX(bSampleData=0)[source]

int16_t getX(int bSampleData=0)

Get x-axis acceleration

bSampleData: Flag to read sensor

The x-axis acceleration on success -999 on error

getY(bSampleData=0)[source]

int16_t getY(int bSampleData=0)

Get y-axis acceleration

bSampleData: Flag to read sensor

The y-axis acceleration on success -999 on error

getZ(bSampleData=0)[source]

int16_t getZ(int bSampleData=0)

Get z-axis acceleration

bSampleData: Flag to read sensor

The z-axis acceleration on success -999 on error

isReady()[source]

int isReady(void)

Check for new set of measurement data.

MMA8X5X_DATA_READY if new sample is ready MMA8X5X_NODATA if nothing is available

sampleData()[source]

int sampleData(void)

Read & calculate accelerometer data in mg & saves them to variables

0 on success -1 on error

setActive()[source]

int setActive(void)

Set active mode, this enables periodic measurements

0 on success -1 on error

setDeviceName(type)[source]

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

0 on success -1 on error

setDeviceParams(params)[source]

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

0 on success -1 on error

setStandby()[source]

int setStandby(void)

Set standby mode, this disables periodic measurements

0 on success -1 on error

setUserOffset(x, y, z)[source]

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

0 on success -1 on error

class pyupm_mma8x5x.mma8x5x_data_t[source]

Bases: object

x
y
z
class pyupm_mma8x5x.mma8x5x_params_t[source]

Bases: object

offsetX
offsetY
offsetZ
range
rate
type