19 #include "clock_config.h" 21 #include "fsl_debug_console.h" 26 #include "issdk_hal.h" 27 #include "gpio_driver.h" 33 #include "Driver_SPI.h" 100 PRINTF(
"\r\n ISSDK FXLS8471Q sensor driver example demonstration with interrupt mode.\r\n");
109 if (ARM_DRIVER_OK != status)
111 PRINTF(
"\r\n SPI Initialization Failed\r\n");
116 status = pSPIdriver->PowerControl(ARM_POWER_FULL);
117 if (ARM_DRIVER_OK != status)
119 PRINTF(
"\r\n SPI Power Mode setting Failed\r\n");
125 status = pSPIdriver->Control(ARM_SPI_MODE_MASTER | ARM_SPI_CPOL1_CPHA0,
SPI_S_BAUDRATE);
127 status = pSPIdriver->Control(ARM_SPI_MODE_MASTER | ARM_SPI_SS_MASTER_HW_OUTPUT,
SPI_S_BAUDRATE);
129 if (ARM_DRIVER_OK != status)
131 PRINTF(
"\r\n SPI Control Mode setting Failed\r\n");
140 PRINTF(
"\r\n FXLS8471Q Sensor Initialization Failed\r\n");
143 PRINTF(
"\r\n Successfully Initiliazed FXLS8471Q Sensor\r\n");
152 PRINTF(
"\r\n FXLS8471Q Sensor Configuration Failed, Err = %d\r\n", status);
155 PRINTF(
"\r\n Successfully Applied FXLS8471Q Sensor Configuration\r\n");
173 if (ARM_DRIVER_OK != status)
175 PRINTF(
"\r\n Read Failed. \r\n");
180 rawData.
accel[0] = ((int16_t)data[0] << 8) | (int16_t)data[1];
181 rawData.
accel[0] /= 4;
182 rawData.
accel[1] = ((int16_t)data[2] << 8) | (int16_t)data[3];
183 rawData.
accel[1] /= 4;
184 rawData.
accel[2] = ((int16_t)data[4] << 8) | (int16_t)data[5];
185 rawData.
accel[2] /= 4;
188 PRINTF(
"\r\n Accel X = %d Y = %d Z = %d\r\n", rawData.
accel[0], rawData.
accel[1], rawData.
accel[2]);
#define FXLS8471Q_CTRL_REG5_INT_CFG_DRDY_MASK
This defines the sensor specific information for SPI.
This structure defines the Write command List.
#define ASK_USER_TO_RESUME(x)
int32_t FXLS8471Q_SPI_Initialize(fxls8471q_spi_sensorhandle_t *pSensorHandle, ARM_DRIVER_SPI *pBus, uint8_t index, void *pSlaveSelect, uint8_t whoAmi)
The interface function to initialize the sensor for I2C.
int32_t FXLS8471Q_SPI_ReadData(fxls8471q_spi_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
#define FXLS8471Q_CTRL_REG4_INT_EN_DRDY_MASK
volatile bool gFxls8471qDataReady
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
#define FXLS8471Q_CTRL_REG3_PP_OD_PUSHPULL
#define FXLS8471Q_CTRL_REG5_INT_CFG_DRDY_INT1
#define FXLS8471Q_ACCEL_DATA_SIZE
The size of the FXLS8471Q accel data.
Access structure of the GPIO Driver.
#define FXLS8471Q_CTRL_REG3_PP_OD_MASK
The fxls8471q_drv.h file describes the fxls8471q driver interface and structures. ...
void FXLS8471Q_SPI_SetIdleTask(fxls8471q_spi_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the SPI Idle Task.
#define __END_WRITE_DATA__
#define FXLS8471Q_WHO_AM_I_WHOAMI_VALUE
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 FXLS8471Q_CTRL_REG4_INT_EN_DRDY_ENABLED
#define BOARD_BootClockRUN
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
This structure defines the fxls8471q raw data buffer.
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
uint8_t data[FXLS8962_DATA_SIZE]
#define FXLS8471Q_CTRL_REG1_DR_12DOT5HZ
#define __END_READ_DATA__
#define FXLS8471Q_CTRL_REG3_IPOL_MASK
fxos8700_accelmagdata_t rawData
const registerwritelist_t cFxls8471q_Config_Isr[]
#define FXLS8471Q_CTRL_REG3_IPOL_HIGH
void(* toggle_pin)(pinID_t aPinId)
#define FXLS8471Q_CTRL_REG1_DR_MASK
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
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.
gpioHandleKSDK_t GREEN_LED
#define SPI_S_SIGNAL_EVENT
const registerreadlist_t cFxls8471q_Output_Values[]
void fxls8471q_isr(void *pUserData)
This is the Sensor Data Ready ISR implementation.
void BOARD_InitDebugConsole(void)
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
int main(void)
This is the The main function implementation.
int32_t FXLS8471Q_SPI_Configure(fxls8471q_spi_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.