19 #include "clock_config.h" 20 #include "fsl_debug_console.h" 25 #include "issdk_hal.h" 26 #include "gpio_driver.h" 32 #include "Driver_SPI.h" 65 uint8_t gFxas21002DataReady;
77 PRINTF(
"\r\n ISSDK FXAS21002 sensor driver example demonstration for SPI with Poll Mode.\r\n");
81 if (ARM_DRIVER_OK != status)
83 PRINTF(
"\r\n SPI Initialization Failed\r\n");
88 status = pSPIdriver->PowerControl(ARM_POWER_FULL);
89 if (ARM_DRIVER_OK != status)
91 PRINTF(
"\r\n SPI Power Mode setting Failed\r\n");
96 status = pSPIdriver->Control(ARM_SPI_MODE_MASTER | ARM_SPI_CPOL0_CPHA0,
SPI_S_BAUDRATE);
97 if (ARM_DRIVER_OK != status)
99 PRINTF(
"\r\n SPI Control Mode setting Failed\r\n");
108 PRINTF(
"\r\n FXAS21002 Sensor Initialization Failed\r\n");
111 PRINTF(
"\r\n Successfully Initiliazed FXAS21002 Sensor\r\n");
120 PRINTF(
"\r\n FXAS21002 Sensor Configuration Failed, Err = %d\r\n", status);
123 PRINTF(
"\r\n Successfully Applied FXAS21002 Sensor Configuration\r\n");
136 if (ARM_DRIVER_OK != status)
138 PRINTF(
"\r\nRead Failed.\r\n");
143 rawData.
gyro[0] = ((int16_t)data[0] << 8) | data[1];
144 rawData.
gyro[1] = ((int16_t)data[2] << 8) | data[3];
145 rawData.
gyro[2] = ((int16_t)data[4] << 8) | data[5];
148 PRINTF(
"\r\n Gyro X = %d Y = %d Z = %d \r\n", rawData.
gyro[0], rawData.
gyro[1], rawData.
gyro[2]);
int32_t FXAS21002_SPI_Configure(fxas21002_spi_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
#define FXAS21002_WHO_AM_I_WHOAMI_PROD_VALUE
This structure defines the Write command List.
This defines the sensor specific information for SPI.
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
This structure defines the fxas21002 raw data buffer.
#define __END_WRITE_DATA__
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
#define SPI_S_BAUDRATE
Transfer baudrate - 500k.
#define SPI_S_DEVICE_INDEX
#define BOARD_BootClockRUN
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
int main(void)
This is the The main function implementation.
uint8_t data[FXLS8962_DATA_SIZE]
#define FXAS21002_DR_STATUS_ZYXDR_MASK
#define __END_READ_DATA__
The fxas21002_drv.h file describes the fxas21002 driver interface and structures. ...
fxos8700_accelmagdata_t rawData
const registerwritelist_t cFxas21002_Config_Normal[]
#define FXAS21002_GYRO_DATA_SIZE
The size of the FXAS21002 gyro data.
#define FXAS21002_CTRL_REG1_DR_MASK
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.
This structure defines the Read command List.
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.
#define SPI_S_SIGNAL_EVENT
void FXAS21002_SPI_SetIdleTask(fxas21002_spi_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the SPI Idle Task.
#define FXAS21002_CTRL_REG1_DR_12_5HZ
void BOARD_InitDebugConsole(void)
const registerreadlist_t cFxas21002_DataReady[]
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
const registerreadlist_t cFxas21002_Output_Values[]