19 #include "clock_config.h" 21 #include "fsl_debug_console.h" 26 #include "issdk_hal.h" 27 #include "gpio_driver.h" 34 #include "Driver_SPI.h" 39 #define FXLS8962_DATA_SIZE (6) 40 #define FXLS8962_FIFO_WMRK_SIZE (16) 98 PRINTF(
"\r\n ISSDK FXLS8962 sensor driver example demonstration for SPI with FIFO Mode.\r\n");
108 if (ARM_DRIVER_OK != status)
110 PRINTF(
"\r\n SPI Initialization Failed\r\n");
115 status = pSPIdriver->PowerControl(ARM_POWER_FULL);
116 if (ARM_DRIVER_OK != status)
118 PRINTF(
"\r\n SPI Power Mode setting Failed\r\n");
123 status = pSPIdriver->Control(ARM_SPI_MODE_MASTER | ARM_SPI_CPOL0_CPHA0,
SPI_S_BAUDRATE);
124 if (ARM_DRIVER_OK != status)
126 PRINTF(
"\r\n SPI Control Mode setting Failed\r\n");
135 PRINTF(
"\r\n FXLS8962 Sensor Initialization Failed\r\n");
138 PRINTF(
"\r\n Successfully Initiliazed FXLS8962 Sensor\r\n");
147 PRINTF(
"\r\n FXLS8962 Sensor Configuration Failed, Err = %d\r\n", status);
150 PRINTF(
"\r\n Successfully Applied FXLS8962 Sensor Configuration\r\n");
169 if (ARM_DRIVER_OK != status)
171 PRINTF(
"\r\n Read Failed. \r\n");
184 PRINTF(
"\r\nX=%5d Y=%5d Z=%5d\r\n", rawData.
accel[0], rawData.
accel[1], rawData.
accel[2]);
#define FXLS8962_BUF_CONFIG1_BUF_MODE_STOP_MODE
This structure defines the fxls8962 raw data buffer.
#define FXLS8962_BUF_CONFIG1_BUF_MODE_MASK
This structure defines the Write command List.
#define ASK_USER_TO_RESUME(x)
#define FXLS8962_INT_EN_BUF_EN_EN
#define FXLS8962_SENS_CONFIG1_FSR_2G
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
The fxls8962_drv.h file describes the FXLS8962AF driver interface and structures. ...
const registerreadlist_t cFxls8962OutputFIF0[]
Address of Raw Accel Data in FIFO Mode.
#define FXLS8962_DATA_SIZE
int32_t FXLS8962_SPI_ReadData(fxls8962_spi_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
Access structure of the GPIO Driver.
#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 FXLS8962_SENS_CONFIG3_WAKE_ODR_MASK
void FXLS8962_SPI_SetIdleTask(fxls8962_spi_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the SPI Idle Task.
#define SPI_S_DEVICE_INDEX
#define BOARD_BootClockRUN
const registerwritelist_t cFxls8962ConfigFIFO[]
Register settings for FIFO (buffered) mode.
fxls8962_i2c_sensorhandle_t fxls8962Driver
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
#define FXLS8962_SENS_CONFIG3_WAKE_ODR_12_5HZ
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
GENERIC_DRIVER_GPIO * pGpioDriver
This defines the sensor specific information for SPI.
#define FXLS8962_FIFO_WMRK_SIZE
uint8_t data[FXLS8962_DATA_SIZE]
void fxls8962_int_data_ready_callback(void *pUserData)
The Data ready ISR callback function.
#define __END_READ_DATA__
#define FXLS8962_INT_EN_BUF_EN_MASK
fxos8700_accelmagdata_t rawData
int32_t FXLS8962_SPI_Configure(fxls8962_spi_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
void(* toggle_pin)(pinID_t aPinId)
int32_t FXLS8962_SPI_Initialize(fxls8962_spi_sensorhandle_t *pSensorHandle, ARM_DRIVER_SPI *pBus, uint8_t index, void *pSlaveSelect, uint8_t *whoami)
The interface function to initialize the sensor.
void BOARD_SystickEnable(void)
Function to enable systicks framework.
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.
#define FXLS8962_SENS_CONFIG1_FSR_MASK
gpioHandleKSDK_t GREEN_LED
#define SPI_S_SIGNAL_EVENT
void BOARD_InitDebugConsole(void)
#define FXLS8962_WHOAMI_VALUE
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
int main(void)
Main function.
#define FXLS8962_BUF_CONFIG2_BUF_WMRK_MASK
volatile bool gFxls8962DataReady