ISSDK  1.8
IoT Sensing Software Development Kit
Macros | Functions | Variables
fxls8962_freefall.c File Reference

The fxls8962_freefall.c file implements the ISSDK FXLS8962 sensor driver example demonstration for Freefall Detection. More...

#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#include "fsl_debug_console.h"
#include "Driver_I2C.h"
#include "issdk_hal.h"
#include "gpio_driver.h"
#include "fxls8962_drv.h"
#include "systick_utils.h"
Include dependency graph for fxls8962_freefall.c:

Go to the source code of this file.

Macros

#define SDCD_WT_DBCNT   0x0A /* Debounce count value. */
 
#define SDCD_LTHS_LSB   0x33 /* Lower Threshold LSB value. */
 
#define SDCD_LTHS_MSB   0x0F /* Lower Threshold MSB value. */
 
#define SDCD_UTHS_LSB   0xCD /* Upper Threshold LSB value. */
 
#define SDCD_UTHS_MSB   0x00 /* Upper Threshold MSB value. */
 

Functions

void fxls8962_int_event_ready_callback (void *pUserData)
 This is the Sensor Data Ready ISR implementation. More...
 
int main (void)
 Main function. More...
 

Variables

const registerwritelist_t cFxls8962ConfigFreeFall []
 Register settings for free-fall detection. More...
 
const registerreadlist_t cFxls8962FreeFallEvent []
 Address of SDCD Status Register. More...
 
volatile bool gFxls8962EventReady = false
 

Detailed Description

The fxls8962_freefall.c file implements the ISSDK FXLS8962 sensor driver example demonstration for Freefall Detection.

Definition in file fxls8962_freefall.c.

Macro Definition Documentation

◆ SDCD_LTHS_LSB

#define SDCD_LTHS_LSB   0x33 /* Lower Threshold LSB value. */

Definition at line 41 of file fxls8962_freefall.c.

◆ SDCD_LTHS_MSB

#define SDCD_LTHS_MSB   0x0F /* Lower Threshold MSB value. */

Definition at line 42 of file fxls8962_freefall.c.

◆ SDCD_UTHS_LSB

#define SDCD_UTHS_LSB   0xCD /* Upper Threshold LSB value. */

Definition at line 43 of file fxls8962_freefall.c.

◆ SDCD_UTHS_MSB

#define SDCD_UTHS_MSB   0x00 /* Upper Threshold MSB value. */

Definition at line 44 of file fxls8962_freefall.c.

◆ SDCD_WT_DBCNT

#define SDCD_WT_DBCNT   0x0A /* Debounce count value. */

Definition at line 40 of file fxls8962_freefall.c.

Function Documentation

◆ fxls8962_int_event_ready_callback()

void fxls8962_int_event_ready_callback ( void *  pUserData)

This is the Sensor Data Ready ISR implementation.

Set flag to indicate Sensor has signalled data ready.

Definition at line 91 of file fxls8962_freefall.c.

References gFxls8962EventReady.

Referenced by main().

Here is the caller graph for this function:

◆ main()

int main ( void  )

Main function.

Initialize FXLS8962 pin used by FRDM board

Initialize the I2C driver.

Set the I2C Power mode.

Set the I2C bus speed.

Initialize the FXLS8962 sensor driver.

Set the task to be executed while waiting for I2C transactions to complete.

Configure the FXLS8962 sensor for Freefall detection Mode.

Clear the data ready flag, it will be set again by the ISR.

Read the Freefall event FLAGs from FXLS8962.

Display that a freefall event has been detected.

Definition at line 99 of file fxls8962_freefall.c.

References BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), BOARD_SystickEnable(), Driver_GPIO_KSDK, FXLS8962_I2C_ADDR, FXLS8962_I2C_Configure(), FXLS8962_I2C_Initialize(), FXLS8962_I2C_ReadData(), FXLS8962_I2C_SetIdleTask(), FXLS8962_INT1, fxls8962_int_event_ready_callback(), FXLS8962_SDCD_INT_SRC2_WT_EA_EVENT_NO, FXLS8962_SDCD_INT_SRC2_WT_EA_MASK, FXLS8962_WHOAMI_VALUE, fxls8962Driver, FXLS8964_WHOAMI_VALUE, FXLS8967_WHOAMI_VALUE, FXLS8974_WHOAMI_VALUE, gFxls8962EventReady, GPIO_DIRECTION_IN, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, int32_t(), pGpioDriver, GENERIC_DRIVER_GPIO::pin_init, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeVlpr(), SMC_SetPowerModeWait(), and status.

Here is the call graph for this function:

Variable Documentation

◆ cFxls8962ConfigFreeFall

const registerwritelist_t cFxls8962ConfigFreeFall[]
Initial value:
= {
#define SDCD_LTHS_LSB
#define FXLS8962_SDCD_CONFIG1_Y_WT_EN_MASK
Definition: fxls8962.h:1514
#define FXLS8962_SDCD_CONFIG1_Y_WT_EN_EN
Definition: fxls8962.h:1564
#define SDCD_UTHS_LSB
#define FXLS8962_SDCD_CONFIG1_WT_ELE_EN
Definition: fxls8962.h:1544
#define FXLS8962_SDCD_CONFIG2_SDCD_EN_MASK
Definition: fxls8962.h:1621
#define __END_WRITE_DATA__
Definition: sensor_drv.h:45
#define FXLS8962_SENS_CONFIG3_WAKE_ODR_MASK
Definition: fxls8962.h:551
#define FXLS8962_SDCD_CONFIG2_SDCD_EN_EN
Definition: fxls8962.h:1628
#define FXLS8962_SDCD_CONFIG2_REF_UPDM_MASK
Definition: fxls8962.h:1618
#define SDCD_WT_DBCNT
#define SDCD_UTHS_MSB
#define FXLS8962_INT_EN_SDCD_WT_EN_EN
Definition: fxls8962.h:863
#define FXLS8962_SDCD_CONFIG1_Z_WT_EN_EN
Definition: fxls8962.h:1568
#define FXLS8962_SDCD_CONFIG1_WT_ELE_MASK
Definition: fxls8962.h:1529
#define FXLS8962_SDCD_CONFIG2_WT_DBCTM_MASK
Definition: fxls8962.h:1612
#define FXLS8962_SDCD_CONFIG2_REF_UPDM_FIXED_VAL
Definition: fxls8962.h:1637
#define FXLS8962_SENS_CONFIG3_WAKE_ODR_100HZ
Definition: fxls8962.h:562
#define FXLS8962_INT_EN_SDCD_WT_EN_MASK
Definition: fxls8962.h:841
#define FXLS8962_SDCD_CONFIG1_Z_WT_EN_MASK
Definition: fxls8962.h:1511
#define FXLS8962_SDCD_CONFIG1_X_WT_EN_EN
Definition: fxls8962.h:1560
#define FXLS8962_SDCD_CONFIG2_WT_DBCTM_CLEARED
Definition: fxls8962.h:1648
#define SDCD_LTHS_MSB
#define FXLS8962_SDCD_CONFIG1_X_WT_EN_MASK
Definition: fxls8962.h:1517

Register settings for free-fall detection.

Definition at line 50 of file fxls8962_freefall.c.

◆ cFxls8962FreeFallEvent

const registerreadlist_t cFxls8962FreeFallEvent[]
Initial value:
= {{.readFrom = FXLS8962_SDCD_INT_SRC2, .numBytes = 1},
#define __END_READ_DATA__
Definition: sensor_drv.h:51

Address of SDCD Status Register.

Definition at line 79 of file fxls8962_freefall.c.

◆ gFxls8962EventReady

volatile bool gFxls8962EventReady = false

Definition at line 85 of file fxls8962_freefall.c.

Referenced by fxls8962_int_event_ready_callback(), and main().