51 #define FXLS8471Q_COUNTSPERG 8192.0 52 #define FXLS8471Q_ACCEL_FIFO_SIZE 32 115 #if (ACCEL_ODR_HZ <= 1) 117 #elif (ACCEL_ODR_HZ <= 6) 119 #elif (ACCEL_ODR_HZ <= 12) 121 #elif (ACCEL_ODR_HZ <= 50) 123 #elif (ACCEL_ODR_HZ <= 100) 125 #elif (ACCEL_ODR_HZ <= 200) 127 #elif (ACCEL_ODR_HZ <= 400) 160 sfg->Accel.iWhoAmI = reg;
177 sfg->Accel.isEnabled =
true;
187 uint16_t sensor_fifo_count = 1;
201 sensor_fifo_count = Data_Buffer[0] & 0x3F;
210 FXLS8471Q_DATA_READ->
numBytes = 6 * sensor_fifo_count;
217 for (j=0; j<sensor_fifo_count; j++) {
218 sample[
CHX] = (Data_Buffer[6*j ] << 8) | Data_Buffer[6*j + 1] ;
219 sample[
CHY] = (Data_Buffer[6*j + 2] << 8) | Data_Buffer[6*j + 3] ;
220 sample[
CHZ] = (Data_Buffer[6*j + 4] << 8) | Data_Buffer[6*j + 5] ;
249 sfg->Accel.isEnabled =
false;
The sensor_drv.h file contains sensor state and error definitions.
fpSpiWritePreprocessFn_t pWritePreprocessFN
#define __END_WRITE_DATA__
void * bus_driver
should be of type (ARM_DRIVER_I2C* for I2C-based sensors, ARM_DRIVER_SPI* for SPI) ...
#define CHY
Used to access Y-channel entries in various data data structures.
#define FXLS8471Q_CTRL_REG1_DR_1DOT56HZ
const registerwritelist_t FXLS8471Q_Initialization[]
The fxls8471q_drv.h file describes the fxls8471q driver interface and structures. ...
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
#define FXLS8471Q_SPI_CMD_LEN
The size of the Sensor specific SPI Header.
void FXLS8471Q_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
The SPI Read Pre-Process function to generate Sensor specific SPI Message Header. ...
#define FXLS8471Q_WHO_AM_I_WHOAMI_VALUE
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.
#define ACCEL_FIFO_SIZE
FXOS8700 (accel), MMA8652, FXLS8952 all have 32 element FIFO.
#define FXLS8471Q_CTRL_REG1_DR_50HZ
#define FXLS8471Q_CTRL_REG2_MODS_HIGHRES
#define __END_READ_DATA__
registerreadlist_t FXLS8471Q_DATA_READ[]
The top level fusion structure.
void FXLS8471Q_SPI_WritePreprocess(void *pCmdOut, uint32_t offset, uint32_t size, void *pWritebuffer)
The SPI Write Pre-Process function to generate Sensor specific SPI Message Header.
const registerwritelist_t FXLS8471Q_IDLE[]
#define FXLS8471Q_F_SETUP_F_MODE_FIFOMOSTRECENT
#define FXLS8471Q_SS_ACTIVE_VALUE
Is the Slave Select Pin Active Low or High.
uint16_t addr
I2C address if applicable.
#define FXLS8471Q_CTRL_REG1_DR_200HZ
void addToFifo(union FifoSensor *sensor, uint16_t maxFifoSize, int16_t sample[3])
addToFifo is called from within sensor driver read functions
The sensor_fusion.h file implements the top level programming interface.
The FifoSensor union allows us to use common pointers for Accel, Mag & Gyro logical sensor structures...
#define FXLS8471Q_COUNTSPERG
#define CHZ
Used to access Z-channel entries in various data data structures.
uint16_t isInitialized
Bitfields to indicate sensor is active (use SensorBitFields from build.h)
spiSlaveSpecificParams_t slaveParams
SPI specific parameters. Not used for I2C.
registerDeviceInfo_t deviceInfo
I2C device context.
Provides function prototypes for driver level interfaces.
#define FXLS8471Q_CTRL_REG1_MODE_ACTIVE
int8_t FXLS8471Q_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
#define CHX
Used to access X-channel entries in various data data structures.
The fxls8471q.h file contains the register definitions for fxls8471q sensor driver.
The sensor_io_spi.h file declares low-level interface functions for reading and writing sensor regist...
GENERIC_DRIVER_GPIO * pGPIODriver
int32_t Sensor_SPI_Write(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, const registerwritelist_t *pRegWriteList)
Write register data to a sensor.
#define FXLS8471Q_CTRL_REG1_DR_6DOT25HZ
void conditionSample(int16_t sample[3])
conditionSample ensures that we never encounter the maximum negative two's complement value for a 16-...
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
Access structure of the GPIO Driver.
int32_t Register_SPI_Read(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pReadParams, uint8_t offset, uint8_t length, uint8_t *pOutBuffer)
The interface function to read a sensor register.
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.
int8_t FXLS8471Q_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
This structure defines the Write command List.
#define FXLS8471Q_CTRL_REG1_DR_12DOT5HZ
#define FXLS8471Q_ACCEL_FIFO_SIZE
This structure defines the Read command List.
#define F_USING_ACCEL
nominally 0x0001 if an accelerometer is to be used, 0x0000 otherwise
int8_t FXLS8471Q_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
int32_t Sensor_SPI_Read(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pReadParams, const registerreadlist_t *pReadList, uint8_t *pOutBuffer)
Read register data from a sensor.
#define FXLS8471Q_CTRL_REG1_DR_100HZ
const registerreadlist_t FXLS8471Q_F_STATUS_READ[]
An instance of PhysicalSensor structure type should be allocated for each physical sensors (combo dev...
The register_io_spi.h file declares low-level interface functions for reading and writing sensor regi...
const registerreadlist_t FXLS8471Q_WHO_AM_I_READ[]
The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor regist...
#define FXLS8471Q_CTRL_REG1_DR_400HZ
fpSpiReadPreprocessFn_t pReadPreprocessFN
#define FXLS8471Q_XYZ_DATA_CFG_FS_FS_RANGE_4G
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.