ISSDK  1.8
IoT Sensing Software Development Kit
Macros | Functions | Variables
fxls8974cf_motion_wakeup.c File Reference
#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#include "fsl_debug_console.h"
#include "issdk_hal.h"
#include "gpio_driver.h"
#include "fxls8974_drv.h"
#include "systick_utils.h"
#include "Driver_I2C.h"
Include dependency graph for fxls8974cf_motion_wakeup.c:

Go to the source code of this file.

Macros

#define FXLS8974_DATA_SIZE   6
 
#define FXLS8974_STANDBY_MODE   0
 
#define FXLS8974_ACTIVE_MODE   1
 

Functions

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

Variables

const registerwritelist_t cFxls8974AwsConfig []
 Register settings for configuring SDCD-OT for tap-detection and Auto-Wake/Sleep in interrupt mode. More...
 
const registerreadlist_t cFxls8974ReadSysMode [] = {{.readFrom = FXLS8974_SYS_MODE, .numBytes = 1}, __END_READ_DATA__}
 Read register list to read SysMode Register. More...
 
const registerreadlist_t cFxls8974ReadIntStatus [] = {{.readFrom = FXLS8974_INT_STATUS, .numBytes = 1}, __END_READ_DATA__}
 Read register list to read INT_STATUS Register. More...
 
volatile bool gFxls8974IntFlag = false
 
ARM_DRIVER_I2C * I2Cdrv = &I2C_S_DRIVER
 
fxls8974_i2c_sensorhandle_t fxls8974Driver
 
GENERIC_DRIVER_GPIOpGpioDriver = &Driver_GPIO_KSDK
 

Macro Definition Documentation

◆ FXLS8974_ACTIVE_MODE

#define FXLS8974_ACTIVE_MODE   1

Definition at line 40 of file fxls8974cf_motion_wakeup.c.

◆ FXLS8974_DATA_SIZE

#define FXLS8974_DATA_SIZE   6

Definition at line 38 of file fxls8974cf_motion_wakeup.c.

◆ FXLS8974_STANDBY_MODE

#define FXLS8974_STANDBY_MODE   0

Definition at line 39 of file fxls8974cf_motion_wakeup.c.

Function Documentation

◆ fxls8974_int_callback()

void fxls8974_int_callback ( void *  pUserData)

This is the Sensor Data Ready ISR implementation.


This function sets the flag which indicates if a new sample(s) is available for reading.

Parameters
[in]pUserDataThis is a void pointer to the instance of the user specific data structure for the ISR.

void There is no return value.

Set flag to indicate Sensor has signalled data ready.

Definition at line 95 of file fxls8974cf_motion_wakeup.c.

References gFxls8974IntFlag.

Referenced by main().

Here is the caller graph for this function:

◆ main()

int main ( void  )

This is the The main function implementation.


This function invokes board initializes routines, then then brings up the sensor and finally enters an endless loop to continuously read available samples.

Parameters
[in]voidThis is no input parameter.

void There is no return value.

Initialize the MCU hardware.

Initialize FXLS8974 pin used by FRDM board

Initialize RGB LED pin used by FRDM board

Initialize the I2C driver.

Set the I2C Power mode.

Set the I2C bus speed.

Initialize FXLS8974 sensor driver.

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

Configure the FXLS8974 sensor.

Read new raw sensor data from the FXLS8974.

Wake Mode Detected.

Definition at line 107 of file fxls8974cf_motion_wakeup.c.

References BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), BOARD_SystickEnable(), GENERIC_DRIVER_GPIO::clr_pin, FXLS8962_WHOAMI_VALUE, FXLS8964_WHOAMI_VALUE, FXLS8967_WHOAMI_VALUE, FXLS8968_WHOAMI_VALUE, FXLS8974_I2C_ADDR, FXLS8974_I2C_Configure(), FXLS8974_I2C_Initialize(), FXLS8974_I2C_ReadData(), FXLS8974_I2C_SetIdleTask(), FXLS8974_INT1, fxls8974_int_callback(), FXLS8974_SYS_MODE_SYS_MODE_WAKE, FXLS8974_WHOAMI_VALUE, gFxls8974IntFlag, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, int32_t(), GENERIC_DRIVER_GPIO::pin_init, RED_LED, SENSOR_ERROR_NONE, GENERIC_DRIVER_GPIO::set_pin, SMC, SMC_SetPowerModeVlpr(), SMC_SetPowerModeWait(), and status.

Here is the call graph for this function:

Variable Documentation

◆ cFxls8974AwsConfig

const registerwritelist_t cFxls8974AwsConfig[]
Initial value:
= {
#define FXLS8974_SENS_CONFIG3_SLEEP_ODR_MASK
Definition: fxls8974.h:548
#define FXLS8974_SENS_CONFIG1_FSR_MASK
Definition: fxls8974.h:423
#define FXLS8974_SDCD_CONFIG1_Y_OT_EN_MASK
Definition: fxls8974.h:1523
#define FXLS8974_SDCD_CONFIG2_REF_UPDM_MASK
Definition: fxls8974.h:1618
#define FXLS8974_SDCD_CONFIG2_REF_UPDM_SDCD_REF
Definition: fxls8974.h:1633
#define FXLS8974_SDCD_CONFIG1_X_OT_EN_MASK
Definition: fxls8974.h:1526
#define FXLS8974_INT_PIN_SEL_WK_OUT_INT2_MASK
Definition: fxls8974.h:913
#define __END_WRITE_DATA__
Definition: sensor_drv.h:45
#define FXLS8974_SENS_CONFIG4_INT_POL_MASK
Definition: fxls8974.h:618
#define FXLS8974_INT_PIN_SEL_WK_OUT_INT2_DIS
Definition: fxls8974.h:968
#define FXLS8974_INT_EN_WAKE_OUT_EN_MASK
Definition: fxls8974.h:829
#define FXLS8974_SDCD_CONFIG1_Z_OT_EN_EN
Definition: fxls8974.h:1556
#define FXLS8974_SDCD_CONFIG1_X_OT_EN_EN
Definition: fxls8974.h:1548
#define FXLS8974_SENS_CONFIG1_FSR_4G
Definition: fxls8974.h:455
#define FXLS8974_SDCD_CONFIG2_SDCD_EN_MASK
Definition: fxls8974.h:1621
#define FXLS8974_SDCD_CONFIG2_SDCD_EN_EN
Definition: fxls8974.h:1628
#define FXLS8974_SENS_CONFIG3_WAKE_ODR_MASK
Definition: fxls8974.h:551
#define FXLS8974_SDCD_CONFIG1_OT_ELE_DIS
Definition: fxls8974.h:1538
#define FXLS8974_INT_EN_WAKE_OUT_EN_EN
Definition: fxls8974.h:876
#define FXLS8974_SENS_CONFIG4_WK_SDCD_OT_EN
Definition: fxls8974.h:655
#define FXLS8974_SENS_CONFIG3_WAKE_ODR_400HZ
Definition: fxls8974.h:560
#define FXLS8974_SENS_CONFIG4_INT_POL_ACT_HIGH
Definition: fxls8974.h:680
#define FXLS8974_SDCD_CONFIG1_Z_OT_EN_MASK
Definition: fxls8974.h:1520
#define FXLS8974_SENS_CONFIG3_SLEEP_ODR_6_25HZ
Definition: fxls8974.h:579
#define FXLS8974_SDCD_CONFIG1_Y_OT_EN_EN
Definition: fxls8974.h:1552
#define FXLS8974_SENS_CONFIG4_WK_SDCD_OT_MASK
Definition: fxls8974.h:633
#define FXLS8974_SDCD_CONFIG1_OT_ELE_MASK
Definition: fxls8974.h:1532

Register settings for configuring SDCD-OT for tap-detection and Auto-Wake/Sleep in interrupt mode.

Definition at line 45 of file fxls8974cf_motion_wakeup.c.

◆ cFxls8974ReadIntStatus

const registerreadlist_t cFxls8974ReadIntStatus[] = {{.readFrom = FXLS8974_INT_STATUS, .numBytes = 1}, __END_READ_DATA__}

Read register list to read INT_STATUS Register.

Definition at line 76 of file fxls8974cf_motion_wakeup.c.

◆ cFxls8974ReadSysMode

const registerreadlist_t cFxls8974ReadSysMode[] = {{.readFrom = FXLS8974_SYS_MODE, .numBytes = 1}, __END_READ_DATA__}

Read register list to read SysMode Register.

Definition at line 73 of file fxls8974cf_motion_wakeup.c.

◆ fxls8974Driver

Definition at line 84 of file fxls8974cf_motion_wakeup.c.

Referenced by main().

◆ gFxls8974IntFlag

volatile bool gFxls8974IntFlag = false

Definition at line 81 of file fxls8974cf_motion_wakeup.c.

Referenced by fxls8974_int_callback(), and main().

◆ I2Cdrv

ARM_DRIVER_I2C* I2Cdrv = &I2C_S_DRIVER

Definition at line 83 of file fxls8974cf_motion_wakeup.c.

Referenced by main().

◆ pGpioDriver

Definition at line 85 of file fxls8974cf_motion_wakeup.c.