Adafruit FXOS8700 Accelerometer Magnetometer Library
Classes | Macros | Enumerations | Variables
Adafruit_FXOS8700.h File Reference
#include <Adafruit_BusIO_Register.h>
#include <Adafruit_I2CDevice.h>
#include <Adafruit_Sensor.h>
#include <Arduino.h>

Go to the source code of this file.

Classes

struct  fxos8700RawData_t
 Raw (integer) values from a 3dof sensor. More...
 
class  Adafruit_FXOS8700_Accelerometer
 
class  Adafruit_FXOS8700_Magnetometer
 
class  Adafruit_FXOS8700
 Unified sensor driver for the Adafruit FXOS8700 breakout. More...
 

Macros

#define FXOS8700_ID   (0xC7)
 

Enumerations

enum  fxos8700Registers_t {
  FXOS8700_REGISTER_STATUS = 0x00, FXOS8700_REGISTER_OUT_X_MSB = 0x01, FXOS8700_REGISTER_OUT_X_LSB = 0x02, FXOS8700_REGISTER_OUT_Y_MSB = 0x03,
  FXOS8700_REGISTER_OUT_Y_LSB = 0x04, FXOS8700_REGISTER_OUT_Z_MSB = 0x05, FXOS8700_REGISTER_OUT_Z_LSB = 0x06, FXOS8600_REGISTER_SYSMOD = 0x0B,
  FXOS8700_REGISTER_WHO_AM_I, FXOS8700_REGISTER_XYZ_DATA_CFG = 0x0E, FXOS8700_REGISTER_CTRL_REG1, FXOS8700_REGISTER_CTRL_REG2,
  FXOS8700_REGISTER_CTRL_REG3, FXOS8700_REGISTER_CTRL_REG4, FXOS8700_REGISTER_CTRL_REG5, FXOS8700_REGISTER_MSTATUS = 0x32,
  FXOS8700_REGISTER_MOUT_X_MSB = 0x33, FXOS8700_REGISTER_MOUT_X_LSB = 0x34, FXOS8700_REGISTER_MOUT_Y_MSB = 0x35, FXOS8700_REGISTER_MOUT_Y_LSB = 0x36,
  FXOS8700_REGISTER_MOUT_Z_MSB = 0x37, FXOS8700_REGISTER_MOUT_Z_LSB = 0x38, FXOS8700_REGISTER_MCTRL_REG1, FXOS8700_REGISTER_MCTRL_REG2,
  FXOS8700_REGISTER_MCTRL_REG3
}
 
enum  fxos8700SystemStatus_t { STANDBY = 0x00, WAKE = 0x01, SLEEP = 0x02 }
 
enum  fxos8700SensorMode_t { ACCEL_ONLY_MODE = 0b00, MAG_ONLY_MODE = 0b01, HYBRID_MODE = 0b11 }
 
enum  fxos8700ODR_t {
  ODR_800HZ, ODR_400HZ, ODR_200HZ, ODR_100HZ,
  ODR_50HZ, ODR_25HZ, ODR_12_5HZ, ODR_6_25HZ,
  ODR_3_125HZ, ODR_1_5625HZ, ODR_0_7813HZ
}
 
enum  fxos8700AccelRange_t { ACCEL_RANGE_2G = 0x00, ACCEL_RANGE_4G = 0x01, ACCEL_RANGE_8G = 0x02 }
 
enum  fxos8700MagOSR_t {
  MAG_OSR_0, MAG_OSR_1, MAG_OSR_2, MAG_OSR_3,
  MAG_OSR_4, MAG_OSR_5, MAG_OSR_6, MAG_OSR_7
}
 

Variables

const fxos8700ODR_t ACCEL_MAG_ONLY_AVAILABLE_ODRs []
 
const fxos8700ODR_t HYBRID_AVAILABLE_ODRs []
 
const uint16_t ODR_drBits []
 

Detailed Description

This is part of Adafruit's FXOS8700 driver for the Arduino platform. It is designed specifically to work with the Adafruit FXOS8700 breakout: https://www.adafruit.com/products/3463

These sensors use I2C to communicate, 2 pins (SCL+SDA) are required to interface with the breakout.

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Kevin "KTOWN" Townsend for Adafruit Industries.

MIT license, all text here must be included in any redistribution.

Macro Definition Documentation

◆ FXOS8700_ID

#define FXOS8700_ID   (0xC7)

7-bit I2C address for this sensor Device ID for this sensor (used as sanity check during init)

Enumeration Type Documentation

◆ fxos8700Registers_t

Raw register addresses used to communicate with the sensor.

Enumerator
FXOS8700_REGISTER_STATUS 

0x00

FXOS8700_REGISTER_OUT_X_MSB 

0x01

FXOS8700_REGISTER_OUT_X_LSB 

0x02

FXOS8700_REGISTER_OUT_Y_MSB 

0x03

FXOS8700_REGISTER_OUT_Y_LSB 

0x04

FXOS8700_REGISTER_OUT_Z_MSB 

0x05

FXOS8700_REGISTER_OUT_Z_LSB 

0x06

FXOS8600_REGISTER_SYSMOD 

0x0B

FXOS8700_REGISTER_WHO_AM_I 

0x0D (default value = 0b11000111, read only)

FXOS8700_REGISTER_XYZ_DATA_CFG 

0x0E

FXOS8700_REGISTER_CTRL_REG1 

0x2A (default value = 0b00000000, read/write)

FXOS8700_REGISTER_CTRL_REG2 

0x2B (default value = 0b00000000, read/write)

FXOS8700_REGISTER_CTRL_REG3 

0x2C (default value = 0b00000000, read/write)

FXOS8700_REGISTER_CTRL_REG4 

0x2D (default value = 0b00000000, read/write)

FXOS8700_REGISTER_CTRL_REG5 

0x2E (default value = 0b00000000, read/write)

FXOS8700_REGISTER_MSTATUS 

0x32

FXOS8700_REGISTER_MOUT_X_MSB 

0x33

FXOS8700_REGISTER_MOUT_X_LSB 

0x34

FXOS8700_REGISTER_MOUT_Y_MSB 

0x35

FXOS8700_REGISTER_MOUT_Y_LSB 

0x36

FXOS8700_REGISTER_MOUT_Z_MSB 

0x37

FXOS8700_REGISTER_MOUT_Z_LSB 

0x38

FXOS8700_REGISTER_MCTRL_REG1 

0x5B (default value = 0b00000000, read/write)

FXOS8700_REGISTER_MCTRL_REG2 

0x5C (default value = 0b00000000, read/write)

FXOS8700_REGISTER_MCTRL_REG3 

0x5D (default value = 0b00000000, read/write)

◆ fxos8700SystemStatus_t

System status for the overall FXOS8700 sensor. Gets the current mode as the 2bit sysmod[1:0] setting to ensure proper mode configuration

Enumerator
STANDBY 

sysmod[1:0]. Standby status

WAKE 

sysmod[1:0]. Wake status

SLEEP 

sysmod[1:0]. Sleep status

◆ fxos8700SensorMode_t

Sensor mode seetings for the overall FXOS8700 sensor. Sets the sensor in accelerometer-only, magnerometer-only, or hybrid modes. Sent to FXOS8700_REGISTER_MCTRL_REG1

Enumerator
ACCEL_ONLY_MODE 

m_hms[1:0] = 0b00. Accel-only mode

MAG_ONLY_MODE 

m_hms[1:0] = 0b01. Mag-only mode

HYBRID_MODE 

m_hms[1:0] = 0b11. Hybrid mode

◆ fxos8700ODR_t

Output Data Rate (ODR) key for the overall FXOS8700 sensor. Called by user for convenient variable name matching

Enumerator
ODR_800HZ 

800Hz, only available in accel/mag-only modes

ODR_400HZ 

400Hz, available in all modes

ODR_200HZ 

200Hz, available in all modes

ODR_100HZ 

100Hz, available in all modes

ODR_50HZ 

50Hz, available in all modes

ODR_25HZ 

25Hz, only available in hybrid mode

ODR_12_5HZ 

12.5Hz, only available in accel/mag-only modes

ODR_6_25HZ 

6.25Hz, available in all modes

ODR_3_125HZ 

3.125Hz, only available in hybrid mode

ODR_1_5625HZ 

3.125Hz, only available in accel/mag-only modes

ODR_0_7813HZ 

0.7813Hz, only available in hybrid mode

◆ fxos8700AccelRange_t

Range settings for the accelerometer sensor.

Enumerator
ACCEL_RANGE_2G 

+/- 2g range

ACCEL_RANGE_4G 

+/- 4g range

ACCEL_RANGE_8G 

+/- 8g range

◆ fxos8700MagOSR_t

Range settings for the accelerometer sensor.

Enumerator
MAG_OSR_0 

Mag oversampling ratio = 0

MAG_OSR_1 

Mag oversampling ratio = 1

MAG_OSR_2 

Mag oversampling ratio = 2

MAG_OSR_3 

Mag oversampling ratio = 3

MAG_OSR_4 

Mag oversampling ratio = 4

MAG_OSR_5 

Mag oversampling ratio = 5

MAG_OSR_6 

Mag oversampling ratio = 6

MAG_OSR_7 

Mag oversampling ratio = 7

Variable Documentation

◆ ACCEL_MAG_ONLY_AVAILABLE_ODRs

const fxos8700ODR_t ACCEL_MAG_ONLY_AVAILABLE_ODRs[]
Initial value:
= {
}
Definition: Adafruit_FXOS8700.h:118
Definition: Adafruit_FXOS8700.h:124
Definition: Adafruit_FXOS8700.h:117
Definition: Adafruit_FXOS8700.h:119
Definition: Adafruit_FXOS8700.h:121
Definition: Adafruit_FXOS8700.h:115
Definition: Adafruit_FXOS8700.h:122
Definition: Adafruit_FXOS8700.h:116

Output Data Rates (ODRs) available for accel/mag-only modes, type array of user set fxos8700ODR_t

◆ HYBRID_AVAILABLE_ODRs

const fxos8700ODR_t HYBRID_AVAILABLE_ODRs[]
Initial value:
= {
}
Definition: Adafruit_FXOS8700.h:118
Definition: Adafruit_FXOS8700.h:123
Definition: Adafruit_FXOS8700.h:117
Definition: Adafruit_FXOS8700.h:125
Definition: Adafruit_FXOS8700.h:119
Definition: Adafruit_FXOS8700.h:122
Definition: Adafruit_FXOS8700.h:120
Definition: Adafruit_FXOS8700.h:116

Output Data Rates (ODRs) available for hybrid mode, type array of user set fxos8700ODR_t

◆ ODR_drBits

const uint16_t ODR_drBits[]
Initial value:
= {
0x00,
0x08,
0x10,
0x18,
0x20,
0x28,
0x30,
0x38,
}

Output Data Rate (ODR) settings to write to the dr[2:0] bits in CTRL_REG_1, array type to pass the index from available accel/mag-only and hyrbrid modes