Unified sensor driver for the Adafruit FXOS8700 breakout.
More...
#include <Adafruit_FXOS8700.h>
|
Adafruit_I2CDevice * | i2c_dev = NULL |
| Pointer to I2C bus interface.
|
|
Unified sensor driver for the Adafruit FXOS8700 breakout.
◆ 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
-
accelSensorID | The unique ID to associate with the accelerometer. |
magSensorID | The unique ID to associate with the magnetometer. |
◆ begin()
bool Adafruit_FXOS8700::begin |
( |
uint8_t |
addr = 0x1F , |
|
|
TwoWire * |
wire = &Wire |
|
) |
| |
Initializes the hardware.
- Parameters
-
addr | I2C address for the device. |
wire | Pointer to Wire instance |
- Returns
- True if the device was successfully initialized, otherwise false.
◆ getEvent() [1/2]
bool Adafruit_FXOS8700::getEvent |
( |
sensors_event_t * |
singleSensorEvent | ) |
|
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
-
singleSensorEvent | A reference to the sensors_event_t instances where the accelerometer or magnetometer 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
-
accelSensor | A 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
-
accelEvent | A reference to the sensors_event_t instances where the accelerometer data should be written. |
magEvent | A 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
-
accelSensor | A reference to the sensor_t instances where the accelerometer sensor info should be written. |
magSensor | A 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
-
standby | Set this to a non-zero value to enter standy mode. |
◆ getMagnetometerSensor()
Adafruit_Sensor * Adafruit_FXOS8700::getMagnetometerSensor |
( |
void |
| ) |
|
Gets an Adafruit Unified Sensor object for the mag sensor component.
- Returns
- Adafruit_Sensor pointer to mag sensor
◆ getAccelerometerSensor()
Adafruit_Sensor * Adafruit_FXOS8700::getAccelerometerSensor |
( |
void |
| ) |
|
Gets an Adafruit Unified Sensor object for the accelerometer sensor component.
- Returns
- Adafruit_Sensor pointer to accelerometer sensor
◆ setSensorMode()
Set the sensor mode to hybrid, or accel/mag-only modes.
- Parameters
-
mode | The sensor mode to set. |
◆ getSensorMode()
Get the sensor mode (either hybrid, or accel/mag-only).
- Returns
- The sensor mode.
◆ setAccelRange()
Set the accelerometer full scale range.
- Attention
This function resets the lnoise bit to low if a 8G accelerometer range is requested. Otherwise, the active lnoise bit won't allow the sensor to measure past 4G.
- Parameters
-
range | The accelerometer full scale range to set. |
◆ getAccelRange()
Get the accelerometer full scale range.
- Returns
- The accelerometer full scale range.
◆ setOutputDataRate()
Set the FXOS8700's ODR from any sensor mode.
- Parameters
-
◆ getOutputDataRate()
Get the FXOS8700's Hybrid ODR.
- Returns
- The FXOS8700's Hybrid ODR.
◆ setMagOversamplingRatio()
Set the magnetometer oversampling ratio (OSR)
- Parameters
-
ratio | The magnetometer OSR to set. |
◆ getMagOversamplingRatio()
Get the magnetometer oversampling ratio (OSR).
- Returns
- The magnetometer OSR.
◆ accel_raw
Raw accelerometer values from last sucsessful sensor read
◆ mag_raw
Raw magnetometer values from last successful sensor read
◆ accel_sensor
Initial value:
Accelerometer data object.
The documentation for this class was generated from the following files: