43 #include "gpio_driver.h" 64 *pWBuff = offset | 0x80;
80 *pWBuff = offset & 0x7F;
83 memcpy(pWBuff + FXAS21002_SPI_CMD_LEN, pWritebuffer, size);
102 if ((pSensorHandle == NULL) || (pBus == NULL) || (pSlaveSelect == NULL))
123 pGPIODriver->
set_pin(pSlaveSelect);
127 pGPIODriver->
clr_pin(pSlaveSelect);
133 if ((ARM_DRIVER_OK != status) || (whoAmi != reg))
156 if ((pSensorHandle == NULL) || (pRegWriteList == NULL))
170 if (ARM_DRIVER_OK != status)
178 if (ARM_DRIVER_OK != status)
186 if (ARM_DRIVER_OK != status)
201 if ((pSensorHandle == NULL) || (pReadList == NULL) || (pBuffer == NULL))
215 if (ARM_DRIVER_OK != status)
227 if (pSensorHandle == NULL)
241 if (ARM_DRIVER_OK != status)
261 if ((pSensorHandle == NULL) || (pBus == NULL))
272 if ((ARM_DRIVER_OK != status) || (whoAmi != reg))
298 if ((pSensorHandle == NULL) || (pRegWriteList == NULL))
313 if (ARM_DRIVER_OK != status)
321 if (ARM_DRIVER_OK != status)
330 if (ARM_DRIVER_OK != status)
345 if ((pSensorHandle == NULL) || (pReadList == NULL) || (pBuffer == NULL))
359 if (ARM_DRIVER_OK != status)
371 if (pSensorHandle == NULL)
386 if (ARM_DRIVER_OK != status)
#define FXAS21002_SPI_CMD_LEN
The size of the Sensor specific SPI Header.
int32_t FXAS21002_SPI_ReadData(fxas21002_spi_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
fpSpiWritePreprocessFn_t pWritePreprocessFN
registeridlefunction_t idleFunction
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
int32_t FXAS21002_I2C_Deinit(fxas21002_i2c_sensorhandle_t *pSensorHandle)
The interface function to De Initialize sensor..
void FXAS21002_SPI_SetIdleTask(fxas21002_spi_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the SPI Idle Task.
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(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
The fxas21002_drv.h file describes the fxas21002 driver interface and structures. ...
int32_t FXAS21002_SPI_Deinit(fxas21002_spi_sensorhandle_t *pSensorHandle)
The interface function to De Initialize sensor..
void FXAS21002_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 FXAS21002_CTRL_REG1_RST_MASK
void FXAS21002_SPI_ReadPreprocess(void *pCmdOut, uint32_t offset, uint32_t size)
The SPI Read Pre-Process function to generate Sensor specific SPI Message Header. ...
int32_t FXAS21002_SPI_Configure(fxas21002_spi_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
#define FXAS21002_CTRL_REG1_MODE_STANDBY
This defines the sensor specific information for I2C.
uint8_t fxas21002_spiRead_CmdBuffer[FXAS21002_SPI_MAX_MSG_SIZE]
registerDeviceInfo_t deviceInfo
int32_t FXAS21002_SPI_Initialize(fxas21002_spi_sensorhandle_t *pSensorHandle, ARM_DRIVER_SPI *pBus, uint8_t index, void *pSlaveSelect, uint8_t whoAmi)
The interface function to initialize the sensor.
void(* set_pin)(pinID_t aPinId)
void(* clr_pin)(pinID_t aPinId)
int32_t FXAS21002_I2C_ReadData(fxas21002_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
The SPI Slave Transfer Command Params SDK2.0 Driver.
#define SPI_SS_ACTIVE_LOW
uint8_t fxas21002_spiRead_DataBuffer[FXAS21002_SPI_MAX_MSG_SIZE]
ARM_DRIVER_SPI * pCommDrv
#define FXAS21002_CTRL_REG1_RST_TRIGGER
GENERIC_DRIVER_GPIO * pGPIODriver
int32_t FXAS21002_I2C_Configure(fxas21002_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
int32_t Sensor_SPI_Write(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, const registerwritelist_t *pRegWriteList)
Write register data to a sensor.
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
void FXAS21002_I2C_SetIdleTask(fxas21002_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
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.
spiSlaveSpecificParams_t slaveParams
This defines the sensor specific information for SPI.
int32_t Register_I2C_Write(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, uint8_t offset, uint8_t value, uint8_t mask, bool repeatedStart)
The interface function to write a sensor register.
This structure defines the Write command List.
This structure defines the Read command List.
#define FXAS21002_CTRL_REG1_MODE_MASK
#define FXAS21002_CTRL_REG1_MODE_ACTIVE
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 FXAS21002_SPI_MAX_MSG_SIZE
The MAX size of SPI message.
uint8_t fxas21002_spiWrite_CmdDataBuffer[FXAS21002_SPI_MAX_MSG_SIZE]
fpSpiReadPreprocessFn_t pReadPreprocessFN
int32_t FXAS21002_I2C_Initialize(fxas21002_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
#define FXAS21002_SS_ACTIVE_VALUE
Is the Slave Select Pin Active Low or High.
ARM_DRIVER_I2C * pCommDrv
int32_t Register_SPI_Write(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, uint8_t offset, uint8_t value, uint8_t mask)
The interface function to write a sensor register.
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