The friendly Operating System for the Internet of Things

Interface definition for the MMA8x5x accelerometer driver. More...

Detailed Description

#include <stdint.h>
#include "periph/i2c.h"
+ Include dependency graph for mma8x5x.h:

Go to the source code of this file.

Data Structures

struct  mma8x5x_params_t
 Configuration parameters. More...
 
struct  mma8x5x_t
 Device descriptor for MMA8x5x accelerometers. More...
 
struct  mma8x5x_data_t
 Data type for the result data. More...
 

Macros

#define MMA8X5X_I2C_ADDRESS   0x1D
 Accelerometer Default Address.
 

Enumerations

enum  {
  MMA8X5X_TYPE_MMA8652 = 0x4a, MMA8X5X_TYPE_MMA8653 = 0x5a, MMA8X5X_TYPE_MMA8451 = 0x1a, MMA8X5X_TYPE_MMA8452 = 0x2a,
  MMA8X5X_TYPE_MMA8453 = 0x3a
}
 Devices supported by this driver. More...
 
enum  {
  MMA8X5X_RATE_800HZ = (0 << 3), MMA8X5X_RATE_400HZ = (1 << 3), MMA8X5X_RATE_200HZ = (2 << 3), MMA8X5X_RATE_100HZ = (3 << 3),
  MMA8X5X_RATE_50HZ = (4 << 3), MMA8X5X_RATE_1HZ25 = (5 << 3), MMA8X5X_RATE_6HZ25 = (6 << 3), MMA8X5X_RATE_1HZ56 = (7 << 3)
}
 Available sampling rates. More...
 
enum  { MMA8X5X_RANGE_2G = 0, MMA8X5X_RANGE_4G = 1, MMA8X5X_RANGE_8G = 2 }
 Available range options. More...
 
enum  {
  MMA8X5X_OK = 0, MMA8X5X_DATA_READY = 1, MMA8X5X_NOI2C = -1, MMA8X5X_NODEV = -2,
  MMA8X5X_NODATA = -3
}
 Named return values. More...
 

Functions

int mma8x5x_init (mma8x5x_t *dev, const mma8x5x_params_t *params)
 Initialize the MMA8x5x accelerometer driver. More...
 
void mma8x5x_set_user_offset (mma8x5x_t *dev, int8_t x, int8_t y, int8_t z)
 Set user offset correction. More...
 
void mma8x5x_set_active (mma8x5x_t *dev)
 Set active mode, this enables periodic measurements. More...
 
void mma8x5x_set_standby (mma8x5x_t *dev)
 Set standby mode. More...
 
int mma8x5x_is_ready (mma8x5x_t *dev)
 Check for new set of measurement data. More...
 
void mma8x5x_read (mma8x5x_t *dev, mma8x5x_data_t *data)
 Read accelerometer's data. More...