21 #define FXOS8700_ACCEL_FIFO_SIZE 32 22 #define FXOS8700_MAG_FIFO_SIZE 1
103 #if (ACCEL_ODR_HZ <= 1) // select 0.78Hz ODR 105 #elif (ACCEL_ODR_HZ <= 3) // select 3.125Hz ODR 107 #elif (ACCEL_ODR_HZ <= 6) // select 6.25Hz ODR 109 #elif (ACCEL_ODR_HZ <= 30) // select 25Hz ODR 111 #elif (ACCEL_ODR_HZ <= 50) // select 50Hz ODR 113 #elif (ACCEL_ODR_HZ <= 100) // select 100Hz ODR 115 #elif (ACCEL_ODR_HZ <= 200) // select 200Hz ODR 117 #else // select 400Hz ODR 123 #define FXOS8700_COUNTSPERG 8192.0 124 #define FXOS8700_COUNTSPERUT 10 139 sfg->Accel.iWhoAmI = reg;
163 sfg->Accel.isEnabled =
true;
178 uint8_t sensor_fifo_count;
190 #ifdef SIMULATOR_MODE 191 sensor_fifo_count = 1;
193 sensor_fifo_count = I2C_Buffer[0] & 0x3F;
201 FXOS8700_DATA_READ[0].
numBytes = 6 * sensor_fifo_count;
205 for (j = 0; j < sensor_fifo_count; j++) {
206 sample[
CHX] = (I2C_Buffer[6 * j] << 8) | (I2C_Buffer[6 * j + 1]);
207 sample[
CHY] = (I2C_Buffer[6 * j + 2] << 8) | (I2C_Buffer[6 * j + 3]);
208 sample[
CHZ] = (I2C_Buffer[6 * j + 4] << 8) | (I2C_Buffer[6 * j + 5]);
222 uint8_t I2C_Buffer[6];
237 sample[
CHX] = (I2C_Buffer[0] << 8) | I2C_Buffer[1];
238 sample[
CHY] = (I2C_Buffer[2] << 8) | I2C_Buffer[3];
239 sample[
CHZ] = (I2C_Buffer[4] << 8) | I2C_Buffer[5];
254 sts1 = FXOS8700_ReadAccData(sensor, sfg);
287 sfg->Accel.isEnabled =
false;
#define FXOS8700_COUNTSPERG
int32_t Sensor_I2C_Read(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerreadlist_t *pReadList, uint8_t *pOutBuffer)
Read register data from a sensor.
void * bus_driver
should be of type (ARM_DRIVER_I2C* for I2C-based sensors, ARM_DRIVER_SPI* for SPI) ...
This structure defines the Write command List.
#define F_USING_ACCEL
nominally 0x0001 if an accelerometer is to be used, 0x0000 otherwise
int8_t FXOS8700_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
Provides function prototypes for driver level interfaces.
int32_t Register_I2C_Read(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, uint8_t offset, uint8_t length, uint8_t *pOutBuffer)
The interface function to read a sensor register.
#define FXOS8700_WHO_AM_I_PROD_VALUE
An instance of PhysicalSensor structure type should be allocated for each physical sensors (combo dev...
void conditionSample(int16_t sample[3])
conditionSample ensures that we never encounter the maximum negative two's complement value for a 16-...
int8_t FXOS8700_ReadMagData(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
#define CHZ
Used to access Z-channel entries in various data data structures.
void addToFifo(union FifoSensor *sensor, uint16_t maxFifoSize, int16_t sample[3])
addToFifo is called from within sensor driver read functions
Application-specific status subsystem.
struct MagSensor Mag
magnetometer storage
#define __END_WRITE_DATA__
The top level fusion structure.
#define CHY
Used to access Y-channel entries in various data data structures.
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
float fCountsPeruT
counts per uT
#define ACCEL_FIFO_SIZE
FXOS8700 (accel), MMA8652, FXLS8952 all have 32 element FIFO.
#define FXOS8700_ACCEL_FIFO_SIZE
FXOS8700 (accel), MMA8652, FXLS8952 all have 32 element FIFO.
bool isEnabled
true if the device is sampling
const registerreadlist_t FXOS8700_F_STATUS_READ[]
int32_t Sensor_I2C_Write(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerwritelist_t *pRegWriteList)
Write register data to a sensor.
int8_t FXOS8700_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
registerDeviceInfo_t deviceInfo
I2C device context.
#define MAG_FIFO_SIZE
FXOS8700 (mag), MAG3110 have no FIFO so equivalent to 1 element FIFO.
The sensor_fusion.h file implements the top level programming interface.
#define __END_READ_DATA__
const registerwritelist_t FXOS8700_Initialization[]
const registerreadlist_t FXOS8700_WHO_AM_I_READ[]
const registerwritelist_t FXOS8700_FULL_IDLE[]
float fuTPerCount
uT per count
The fxos8700_drv.h file describes the fxos8700 driver interface and structures.
uint16_t isInitialized
Bitfields to indicate sensor is active (use SensorBitFields from build.h)
registerreadlist_t FXOS8700_DATA_READ[]
int8_t FXOS8700_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
This structure defines the Read command List.
#define CHX
Used to access X-channel entries in various data data structures.
The FifoSensor union allows us to use common pointers for Accel, Mag & Gyro logical sensor structures...
uint16_t addr
I2C address if applicable.
The fxos8700.h file contains the register definitions for FXOS8700 sensor driver. ...
#define FXOS8700_COUNTSPERUT
uint8_t iWhoAmI
sensor whoami
int16_t iCountsPeruT
counts per uT
The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor regist...