ISSDK  1.8
IoT Sensing Software Development Kit
Macros | Functions | Variables
mma865x_doubletap-detection.c File Reference

The mma865x_doubletap-detection.c file implements the ISSDK MMA865x sensor example demonstration for double-tap 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 "mma865x_drv.h"
Include dependency graph for mma865x_doubletap-detection.c:

Go to the source code of this file.

Macros

#define PULSE_THX   0x12 /* X-axis pulse threshold value. */
 
#define PULSE_THY   0x12 /* Y-axis pulse threshold value. */
 
#define PULSE_THZ   0x12 /* Z-axis pulse threshold value. */
 
#define PULSE_TL   0x0C /* Time limit value for pulse detection. */
 
#define PULSE_LT   0x14 /* Latency time for second pulse detection. */
 
#define PULSE_WT   0x1E /* Window time for second pulse detection. */
 

Functions

void mma865x_isr_callback (void *pUserData)
 This is the Sensor Event ISR implementation. More...
 
int main (void)
 This is the The main function implementation. More...
 

Variables

const registerwritelist_t cMma865xConfigDoubleTap []
 
const registerreadlist_t gMma865xReadPulseSrc [] = {{.readFrom = MMA865x_PULSE_SRC, .numBytes = 1}, __END_READ_DATA__}
 Read register list for MMA8652 to read status bits for the pulse detection function. More...
 
volatile bool gMma865xIntFlag = false
 

Detailed Description

The mma865x_doubletap-detection.c file implements the ISSDK MMA865x sensor example demonstration for double-tap detection.

Definition in file mma865x_doubletap-detection.c.

Macro Definition Documentation

◆ PULSE_LT

#define PULSE_LT   0x14 /* Latency time for second pulse detection. */

Definition at line 45 of file mma865x_doubletap-detection.c.

◆ PULSE_THX

#define PULSE_THX   0x12 /* X-axis pulse threshold value. */

Definition at line 41 of file mma865x_doubletap-detection.c.

◆ PULSE_THY

#define PULSE_THY   0x12 /* Y-axis pulse threshold value. */

Definition at line 42 of file mma865x_doubletap-detection.c.

◆ PULSE_THZ

#define PULSE_THZ   0x12 /* Z-axis pulse threshold value. */

Definition at line 43 of file mma865x_doubletap-detection.c.

◆ PULSE_TL

#define PULSE_TL   0x0C /* Time limit value for pulse detection. */

Definition at line 44 of file mma865x_doubletap-detection.c.

◆ PULSE_WT

#define PULSE_WT   0x1E /* Window time for second pulse detection. */

Definition at line 46 of file mma865x_doubletap-detection.c.

Function Documentation

◆ 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.
Returns
void There is no return value.
Constraints:
None

No

Initialize the MCU hardware.

Initialize MMA865x 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 the MMA865x sensor driver.

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

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

Definition at line 111 of file mma865x_doubletap-detection.c.

References BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), Driver_GPIO_KSDK, gMma865xIntFlag, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, int32_t(), MMA8652_I2C_ADDR, MMA8652_INT1, MMA8652_WHOAMI_VALUE, MMA865x_I2C_Configure(), MMA865x_I2C_Initialize(), MMA865x_I2C_ReadData(), MMA865x_I2C_SetIdleTask(), mma865x_isr_callback(), MMA865x_PULSE_SRC_DPE_MASK, GENERIC_DRIVER_GPIO::pin_init, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeVlpr(), SMC_SetPowerModeWait(), status, and GENERIC_DRIVER_GPIO::toggle_pin.

Here is the call graph for this function:

◆ mma865x_isr_callback()

void mma865x_isr_callback ( void *  pUserData)

This is the Sensor Event ISR implementation.


This function sets the flag which indicates if a new event is detected.

Parameters
[in]pUserDataThis is a void pointer to the instance of the user specific data structure for the ISR.
Returns
void There is no return value.
Constraints:
None

Yes

Set flag to indicate Sensor has detected an event.

Definition at line 97 of file mma865x_doubletap-detection.c.

References gMma865xIntFlag.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

◆ cMma865xConfigDoubleTap

const registerwritelist_t cMma865xConfigDoubleTap[]
Initial value:
=
{
#define MMA865x_CTRL_REG1_DR_MASK
Definition: mma865x.h:1534
#define PULSE_WT
#define MMA865x_HP_FILTER_CUTOFF_PULSE_HPF_BYP_MASK
Definition: mma865x.h:580
#define MMA865x_PULSE_THSY_THSY_MASK
Definition: mma865x.h:1428
#define PULSE_THY
#define MMA865x_CTRL_REG4_INT_EN_PULSE_EN
Definition: mma865x.h:1774
#define PULSE_THZ
#define MMA865x_PULSE_CFG_YDPEFE_EN
Definition: mma865x.h:1284
#define MMA865x_PULSE_CFG_ZDPEFE_EN
Definition: mma865x.h:1280
#define MMA865x_PULSE_CFG_XDPEFE_MASK
Definition: mma865x.h:1243
#define __END_WRITE_DATA__
Definition: sensor_drv.h:45
#define MMA865x_CTRL_REG3_IPOL_MASK
Definition: mma865x.h:1664
#define MMA865x_PULSE_THSZ_THSZ_MASK
Definition: mma865x.h:1455
#define MMA865x_HP_FILTER_CUTOFF_PULSE_HPF_BYP_ENABLED
Definition: mma865x.h:587
#define MMA865x_CTRL_REG3_IPOL_ACTIVE_HIGH
Definition: mma865x.h:1701
#define MMA865x_CTRL_REG2_MODS_MASK
Definition: mma865x.h:1592
#define MMA865x_CTRL_REG5_INT_CFG_PULSE_INT1
Definition: mma865x.h:1849
#define MMA865x_CTRL_REG4_INT_EN_PULSE_MASK
Definition: mma865x.h:1746
#define MMA865x_CTRL_REG1_ACTIVE_STANDBY
Definition: mma865x.h:1558
#define MMA865x_CTRL_REG1_ACTIVE_MASK
Definition: mma865x.h:1528
#define MMA865x_CTRL_REG1_F_READ_MASK
Definition: mma865x.h:1531
#define MMA865x_PULSE_CFG_ZDPEFE_MASK
Definition: mma865x.h:1255
#define MMA865x_PULSE_CFG_YDPEFE_MASK
Definition: mma865x.h:1249
#define MMA865x_CTRL_REG1_ASLP_RATE_MASK
Definition: mma865x.h:1537
#define PULSE_LT
#define MMA865x_PULSE_CFG_XDPEFE_EN
Definition: mma865x.h:1288
#define MMA865x_PULSE_THSX_THSX_MASK
Definition: mma865x.h:1401
#define MMA865x_CTRL_REG5_INT_CFG_PULSE_MASK
Definition: mma865x.h:1821
#define PULSE_TL
#define PULSE_THX
#define MMA865x_CTRL_REG1_ASLP_RATE_50HZ
Definition: mma865x.h:1544
#define MMA865x_CTRL_REG2_MODS_LP
Definition: mma865x.h:1624
#define MMA865x_CTRL_REG1_F_READ_NORMAL
Definition: mma865x.h:1556
#define MMA865x_CTRL_REG1_DR_100HZ
Definition: mma865x.h:1551

Definition at line 51 of file mma865x_doubletap-detection.c.

◆ gMma865xIntFlag

volatile bool gMma865xIntFlag = false

Definition at line 84 of file mma865x_doubletap-detection.c.

Referenced by main(), and mma865x_isr_callback().

◆ gMma865xReadPulseSrc

const registerreadlist_t gMma865xReadPulseSrc[] = {{.readFrom = MMA865x_PULSE_SRC, .numBytes = 1}, __END_READ_DATA__}

Read register list for MMA8652 to read status bits for the pulse detection function.

Definition at line 79 of file mma865x_doubletap-detection.c.