19 #include "clock_config.h" 21 #include "fsl_debug_console.h" 26 #include "Driver_I2C.h" 29 #include "issdk_hal.h" 30 #include "gpio_driver.h" 40 #define SDCD_WT_DBCNT 0x0A 41 #define SDCD_LTHS_LSB 0x33 42 #define SDCD_LTHS_MSB 0x0F 43 #define SDCD_UTHS_LSB 0xCD 44 #define SDCD_UTHS_MSB 0x00 113 PRINTF(
"\r\n ISSDK FXLS8962 sensor driver example for Freefall Detection. \r\n");
120 if (ARM_DRIVER_OK != status)
122 PRINTF(
"\r\n I2C Initialization Failed\r\n");
127 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
128 if (ARM_DRIVER_OK != status)
130 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
135 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
136 if (ARM_DRIVER_OK != status)
138 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
147 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
152 PRINTF(
"\r\n Successfully Initialized Gemini with WHO_AM_I = 0x%X\r\n", whoami);
156 PRINTF(
"\r\n Successfully Initialized Timandra with WHO_AM_I = 0x%X\r\n", whoami);
160 PRINTF(
"\r\n Successfully Initialized Newstein with WHO_AM_I = 0x%X\r\n", whoami);
164 PRINTF(
"\r\n Bad WHO_AM_I = 0x%X\r\n", whoami);
177 PRINTF(
"\r\n FXLS8962 Sensor Configuration Failed, Err = %d \r\n", status);
180 PRINTF(
"\r\n FXLS8962 now active and detecting freefall... \r\n");
199 PRINTF(
"\r\n Read Failed\r\n");
209 PRINTF(
"\r\n Freefall detected !!!\r\n");
#define FXLS8962_SDCD_CONFIG1_Y_WT_EN_MASK
#define FXLS8962_SDCD_CONFIG1_Y_WT_EN_EN
This structure defines the Write command List.
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. ...
#define FXLS8962_SDCD_CONFIG1_WT_ELE_EN
int32_t FXLS8962_I2C_Initialize(fxls8962_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t *whoami)
The interface function to initialize the sensor.
Access structure of the GPIO Driver.
#define FXLS8962_SDCD_CONFIG2_SDCD_EN_MASK
#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 FXLS8962_SENS_CONFIG3_WAKE_ODR_MASK
This defines the sensor specific information for I2C.
#define FXLS8967_WHOAMI_VALUE
#define FXLS8962_SDCD_CONFIG2_SDCD_EN_EN
#define I2C_S_SIGNAL_EVENT
#define FXLS8962_SDCD_INT_SRC2_WT_EA_MASK
#define BOARD_BootClockRUN
#define FXLS8962_SDCD_CONFIG2_REF_UPDM_MASK
fxls8962_i2c_sensorhandle_t fxls8962Driver
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
GENERIC_DRIVER_GPIO * pGpioDriver
#define FXLS8962_SDCD_INT_SRC2_WT_EA_EVENT_NO
int main(void)
Main function.
#define __END_READ_DATA__
#define FXLS8962_INT_EN_SDCD_WT_EN_EN
const registerreadlist_t cFxls8962FreeFallEvent[]
Address of SDCD Status Register.
int32_t FXLS8962_I2C_ReadData(fxls8962_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
void fxls8962_int_event_ready_callback(void *pUserData)
This is the Sensor Data Ready ISR implementation.
#define FXLS8962_SDCD_CONFIG1_Z_WT_EN_EN
const registerwritelist_t cFxls8962ConfigFreeFall[]
Register settings for free-fall detection.
#define FXLS8962_SDCD_CONFIG1_WT_ELE_MASK
#define FXLS8962_SDCD_CONFIG2_WT_DBCTM_MASK
#define FXLS8962_SDCD_CONFIG2_REF_UPDM_FIXED_VAL
#define FXLS8962_SENS_CONFIG3_WAKE_ODR_100HZ
#define FXLS8962_INT_EN_SDCD_WT_EN_MASK
#define FXLS8962_SDCD_CONFIG1_Z_WT_EN_MASK
void BOARD_SystickEnable(void)
Function to enable systicks framework.
int32_t FXLS8962_I2C_Configure(fxls8962_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
#define FXLS8962_SDCD_CONFIG1_X_WT_EN_EN
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
#define FXLS8962_SDCD_CONFIG2_WT_DBCTM_CLEARED
This structure defines the Read command List.
#define FXLS8974_WHOAMI_VALUE
#define I2C_S_DEVICE_INDEX
void FXLS8962_I2C_SetIdleTask(fxls8962_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
#define FXLS8962_I2C_ADDR
void BOARD_InitDebugConsole(void)
#define FXLS8962_WHOAMI_VALUE
#define FXLS8962_SDCD_CONFIG1_X_WT_EN_MASK
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
#define FXLS8964_WHOAMI_VALUE
volatile bool gFxls8962EventReady