25 #define FXLS8471Q_COUNTSPERG 8192.0 26 #define FXLS8471Q_ACCEL_FIFO_SIZE 32 89 #if (ACCEL_ODR_HZ <= 1) 91 #elif (ACCEL_ODR_HZ <= 6) 93 #elif (ACCEL_ODR_HZ <= 12) 95 #elif (ACCEL_ODR_HZ <= 50) 97 #elif (ACCEL_ODR_HZ <= 100) 99 #elif (ACCEL_ODR_HZ <= 200) 101 #elif (ACCEL_ODR_HZ <= 400) 134 sfg->Accel.iWhoAmI = reg;
151 sfg->Accel.isEnabled =
true;
161 uint16_t sensor_fifo_count = 1;
175 sensor_fifo_count = Data_Buffer[0] & 0x3F;
184 FXLS8471Q_DATA_READ->
numBytes = 6 * sensor_fifo_count;
191 for (j=0; j<sensor_fifo_count; j++) {
192 sample[
CHX] = (Data_Buffer[6*j ] << 8) | Data_Buffer[6*j + 1] ;
193 sample[
CHY] = (Data_Buffer[6*j + 2] << 8) | Data_Buffer[6*j + 3] ;
194 sample[
CHZ] = (Data_Buffer[6*j + 4] << 8) | Data_Buffer[6*j + 5] ;
223 sfg->Accel.isEnabled =
false;
const registerwritelist_t FXLS8471Q_Initialization[]
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.
#define FXLS8471Q_F_SETUP_F_MODE_FIFOMOSTRECENT
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.
The sensor_io_spi.h file declares low-level interface functions for reading and writing sensor regist...
#define FXLS8471Q_CTRL_REG1_DR_1DOT56HZ
#define F_USING_ACCEL
nominally 0x0001 if an accelerometer is to be used, 0x0000 otherwise
The fxls8471q.h file contains the register definitions for fxls8471q sensor driver.
int8_t FXLS8471Q_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
#define FXLS8471Q_ACCEL_FIFO_SIZE
GENERIC_DRIVER_GPIO * pGPIODriver
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.
An instance of PhysicalSensor structure type should be allocated for each physical sensors (combo dev...
#define FXLS8471Q_XYZ_DATA_CFG_FS_FS_RANGE_4G
#define FXLS8471Q_CTRL_REG2_MODS_HIGHRES
The register_io_spi.h file declares low-level interface functions for reading and writing sensor regi...
#define FXLS8471Q_CTRL_REG1_MODE_ACTIVE
spiSlaveSpecificParams_t slaveParams
SPI specific parameters. Not used for I2C.
void conditionSample(int16_t sample[3])
conditionSample ensures that we never encounter the maximum negative two's complement value for a 16-...
#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
Access structure of the GPIO Driver.
registerreadlist_t FXLS8471Q_DATA_READ[]
The fxls8471q_drv.h file describes the fxls8471q driver interface and structures. ...
const registerwritelist_t FXLS8471Q_IDLE[]
The sensor_drv.h file contains sensor state and error definitions.
#define __END_WRITE_DATA__
The top level fusion structure.
#define FXLS8471Q_WHO_AM_I_WHOAMI_VALUE
#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.
#define FXLS8471Q_CTRL_REG1_DR_6DOT25HZ
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 ACCEL_FIFO_SIZE
FXOS8700 (accel), MMA8652, FXLS8952 all have 32 element FIFO.
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.
registerDeviceInfo_t deviceInfo
I2C device context.
#define FXLS8471Q_CTRL_REG1_DR_400HZ
fpSpiReadPreprocessFn_t pReadPreprocessFN
int8_t FXLS8471Q_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
const registerreadlist_t FXLS8471Q_F_STATUS_READ[]
The sensor_fusion.h file implements the top level programming interface.
#define FXLS8471Q_CTRL_REG1_DR_12DOT5HZ
#define __END_READ_DATA__
int8_t FXLS8471Q_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)
#define FXLS8471Q_SPI_CMD_LEN
The size of the Sensor specific SPI Header.
#define FXLS8471Q_CTRL_REG1_DR_50HZ
#define FXLS8471Q_CTRL_REG1_DR_100HZ
uint16_t isInitialized
Bitfields to indicate sensor is active (use SensorBitFields from build.h)
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. ...
const registerreadlist_t FXLS8471Q_WHO_AM_I_READ[]
#define FXLS8471Q_CTRL_REG1_DR_200HZ
#define FXLS8471Q_COUNTSPERG
fpSpiWritePreprocessFn_t pWritePreprocessFN
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
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.
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_SS_ACTIVE_VALUE
Is the Slave Select Pin Active Low or High.
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.
The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor regist...