Adafruit FXOS8700 Arduino Library
Public Member Functions | Public Attributes | List of all members
Adafruit_FXOS8700 Class Reference

Unified sensor driver for the Adafruit FXOS8700 breakout. More...

#include <Adafruit_FXOS8700.h>

Inheritance diagram for Adafruit_FXOS8700:

Public Member Functions

 Adafruit_FXOS8700 (int32_t accelSensorID=-1, int32_t magSensorID=-1)
 Instantiates a new Adafruit_FXOS8700 class, including assigning a unique ID to the accel and magnetometer for logging purposes. More...
 
bool begin (fxos8700AccelRange_t rng=ACCEL_RANGE_2G)
 Initializes the hardware, including setting the accelerometer range based on fxos8700AccelRange_t. More...
 
bool getEvent (sensors_event_t *accel)
 Reads a single sensor event from the accelerometer. More...
 
void getSensor (sensor_t *accel)
 Gets sensor details about the accelerometer. More...
 
bool getEvent (sensors_event_t *accel, sensors_event_t *mag)
 Gets the most recent sensor events. More...
 
void getSensor (sensor_t *accel, sensor_t *mag)
 Gets sensor_t data for both the accel and mag in one operation. More...
 
void standby (boolean standby)
 Puts device into/out of standby mode. More...
 

Public Attributes

fxos8700RawData_t accel_raw
 
fxos8700RawData_t mag_raw
 

Detailed Description

Unified sensor driver for the Adafruit FXOS8700 breakout.

Constructor & Destructor Documentation

◆ Adafruit_FXOS8700()

Adafruit_FXOS8700::Adafruit_FXOS8700 ( int32_t  accelSensorID = -1,
int32_t  magSensorID = -1 
)

Instantiates a new Adafruit_FXOS8700 class, including assigning a unique ID to the accel and magnetometer for logging purposes.

Parameters
accelSensorIDThe unique ID to associate with the accelerometer.
magSensorIDThe unique ID to associate with the magnetometer.

Member Function Documentation

◆ begin()

bool Adafruit_FXOS8700::begin ( fxos8700AccelRange_t  rng = ACCEL_RANGE_2G)

Initializes the hardware, including setting the accelerometer range based on fxos8700AccelRange_t.

Parameters
rngThe range to set for the accelerometer, based on fxos8700AccelRange_t
Returns
True if the device was successfully initialized, otherwise false.

◆ getEvent() [1/2]

bool Adafruit_FXOS8700::getEvent ( sensors_event_t *  accelEvent)

Reads a single sensor event from the accelerometer.

Attention

This function exists to keep Adafruit_Sensor happy since we need a single sensor in the canonical .getEvent call. The non-standard .getEvent call with two parameters should generally be used with this sensor.

Parameters
accelEventA reference to the sensors_event_t instances where the accelerometer data should be written.
Returns
True if the event read was successful, otherwise false.

◆ getSensor() [1/2]

void Adafruit_FXOS8700::getSensor ( sensor_t *  accelSensor)

Gets sensor details about the accelerometer.

Attention

This function exists to keep Adafruit_Sensor happy since we need a single sensor in the canonical .getSensor call. The non-standard .getSensor call with two parameters should generally be used with this sensor.

Parameters
accelSensorA reference to the sensor_t instances where the accelerometer sensor info should be written.

◆ getEvent() [2/2]

bool Adafruit_FXOS8700::getEvent ( sensors_event_t *  accelEvent,
sensors_event_t *  magEvent 
)

Gets the most recent sensor events.

This function reads from both the accelerometer and the magnetometer in one call, and is a deviation from the standard Adafruit_Sensor API, but is provided as a convenience since most AHRS algorithms require sensor samples to be as close in time as possible.

Parameters
accelEventA reference to the sensors_event_t instances where the accelerometer data should be written.
magEventA reference to the sensors_event_t instances where the magnetometer data should be written.
Returns
True if the event read was successful, otherwise false.

◆ getSensor() [2/2]

void Adafruit_FXOS8700::getSensor ( sensor_t *  accelSensor,
sensor_t *  magSensor 
)

Gets sensor_t data for both the accel and mag in one operation.

Parameters
accelSensorA reference to the sensor_t instances where the accelerometer sensor info should be written.
magSensorA reference to the sensor_t instances where the magnetometer sensor info should be written.

◆ standby()

void Adafruit_FXOS8700::standby ( boolean  standby)

Puts device into/out of standby mode.

Parameters
standbySet this to a non-zero value to enter standy mode.

Member Data Documentation

◆ accel_raw

fxos8700RawData_t Adafruit_FXOS8700::accel_raw

Raw accelerometer values from last sucsessful sensor read

◆ mag_raw

fxos8700RawData_t Adafruit_FXOS8700::mag_raw

Raw magnetometer values from last successful sensor read


The documentation for this class was generated from the following files: