19 #include "clock_config.h" 21 #include "fsl_debug_console.h" 26 #include "Driver_I2C.h" 31 #include "issdk_hal.h" 32 #include "gpio_driver.h" 38 #define MD_SDCD_WT_DBCNT 0x00 39 #define SDCD_LTHS_LSB 0xC0 40 #define SDCD_LTHS_MSB 0x0F 41 #define SDCD_UTHS_LSB 0x40 42 #define SDCD_UTHS_MSB 0x00 110 PRINTF(
"\r\n ISSDK FXLS8962 sensor driver example for Orientation and Motion Detection.\r\n");
117 if (ARM_DRIVER_OK != status)
119 PRINTF(
"\r\n I2C Initialization Failed\r\n");
124 status = I2Cdrv->PowerControl(ARM_POWER_FULL);
125 if (ARM_DRIVER_OK != status)
127 PRINTF(
"\r\n I2C Power Mode setting Failed\r\n");
132 status = I2Cdrv->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
133 if (ARM_DRIVER_OK != status)
135 PRINTF(
"\r\n I2C Control Mode setting Failed\r\n");
144 PRINTF(
"\r\n Sensor Initialization Failed\r\n");
147 PRINTF(
"\r\n Successfully Initiliazed Sensor\r\n");
156 PRINTF(
"\r\n Write FXLS8962 Motion Configuration Failed!\r\n");
159 PRINTF(
"\r\n Successfully Applied FXLS8962 Sensor Configuration\r\n");
164 PRINTF(
"\r\n Waiting for Motion | MCU going to Deep Sleep Mode ...\r\n");
171 PRINTF(
"\r\n Motion detected | MCU Wake-up ...\r\n");
#define FXLS8962_SDCD_CONFIG1_Z_OT_EN_MASK
#define FXLS8962_SENS_CONFIG4_DRDY_PUL_DIS
This structure defines the Write command List.
#define FXLS8962_SENS_CONFIG3_WAKE_ODR_0_781HZ
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
#define FXLS8962_INT_EN_SDCD_OT_EN_EN
#define FXLS8962_SDCD_CONFIG2_OT_DBCTM_MASK
The fxls8962_drv.h file describes the FXLS8962AF driver interface and structures. ...
volatile bool gFxls8962EventReady
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.
#define FXLS8962_SDCD_CONFIG2_OT_DBCTM_CLEARED
Access structure of the GPIO Driver.
#define FXLS8962_SDCD_CONFIG2_SDCD_EN_MASK
const registerwritelist_t cFxls8962ConfigMotionDetect[]
Register Start Motion Detect Mode Register Write List.
#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
#define FXLS8962_SENS_CONFIG4_DRDY_PUL_MASK
This defines the sensor specific information for I2C.
#define FXLS8962_ORIENT_CONFIG_ORIENT_ENABLE_MASK
#define FXLS8962_SDCD_CONFIG2_SDCD_EN_EN
#define I2C_S_SIGNAL_EVENT
void fxls8962_int_callback(void *pUserData)
This is the Sensor Data Ready ISR implementation.
#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_INT_EN_SDCD_OT_EN_MASK
#define FXLS8962_SDCD_CONFIG1_Y_OT_EN_MASK
#define FXLS8962_SDCD_CONFIG1_X_OT_EN_EN
#define FXLS8962_SDCD_CONFIG2_WT_DBCTM_MASK
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...
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
#define FXLS8962_SDCD_CONFIG1_X_OT_EN_MASK
#define FXLS8962_SDCD_CONFIG1_Z_OT_EN_EN
#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
#define FXLS8962_SDCD_CONFIG2_REF_UPDM_SDCD_REF
int main(void)
This is the The main function implementation.
void BOARD_InitDebugConsole(void)
#define FXLS8962_WHOAMI_VALUE
void BOARD_InitPins(void)
Configures pin routing and optionally pin electrical features.
#define FXLS8962_ORIENT_CONFIG_ORIENT_ENABLE_DIS
#define FXLS8962_SDCD_CONFIG1_Y_OT_EN_EN