![]() |
ISSDK
1.7
IoT Sensing Software Development Kit
|
The mma865x_freefall.c file implements the ISSDK MMA865x sensor driver example demonstration for Freefall Detection. More...
#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_debug_console.h"
#include "Driver_I2C.h"
#include "issdk_hal.h"
#include "gpio_driver.h"
#include "mma865x_drv.h"
Go to the source code of this file.
Macros | |
#define | FF_MT_WT_DBCNT 0x28 /* Debounce count value. */ |
#define | FF_MT_THS_VALUE 0x03 /* Threshold Value. */ |
Functions | |
void | mma865x_int_event_ready_callback (void *pUserData) |
This is the Sensor Event Ready ISR implementation. More... | |
int | main (void) |
Main function. More... | |
Variables | |
const registerwritelist_t | cMma865xConfigFreeFall [] |
Register settings for freefall detection. More... | |
const registerreadlist_t | cMma865xFreeFallEvent [] = {{.readFrom = MMA865x_FF_MT_SRC, .numBytes = 1}, __END_READ_DATA__} |
Address of Freefall Status Register. More... | |
volatile bool | gMma865xEventReady |
The mma865x_freefall.c file implements the ISSDK MMA865x sensor driver example demonstration for Freefall Detection.
Definition in file mma865x_freefall.c.
#define FF_MT_THS_VALUE 0x03 /* Threshold Value. */ |
Definition at line 69 of file mma865x_freefall.c.
#define FF_MT_WT_DBCNT 0x28 /* Debounce count value. */ |
Definition at line 68 of file mma865x_freefall.c.
int main | ( | void | ) |
Main function.
Initialize MMA865x 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.
Configure the MMA865x sensor for Freefall detection Mode.
Clear the data ready flag, it will be set again by the ISR.
Read the Freefall event FLAGs from MMA865x.
Display that a freefall event has been detected.
Definition at line 120 of file mma865x_freefall.c.
References BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), Driver_GPIO_KSDK, gMma865xEventReady, GPIO_DIRECTION_IN, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, int32_t(), MMA8652_I2C_ADDR, MMA8652_INT1, MMA8652_WHOAMI_VALUE, MMA865x_FF_MT_SRC_EA_MASK, MMA865x_FF_MT_SRC_EA_NONE, MMA865x_I2C_Configure(), MMA865x_I2C_Initialize(), MMA865x_I2C_ReadData(), MMA865x_I2C_SetIdleTask(), mma865x_int_event_ready_callback(), pGpioDriver, GENERIC_DRIVER_GPIO::pin_init, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeWait(), and status.
void mma865x_int_event_ready_callback | ( | void * | pUserData | ) |
This is the Sensor Event Ready ISR implementation.
Set flag to indicate Sensor has signalled data ready.
Definition at line 112 of file mma865x_freefall.c.
References gMma865xEventReady.
Referenced by main().
const registerwritelist_t cMma865xConfigFreeFall[] |
Register settings for freefall detection.
Definition at line 75 of file mma865x_freefall.c.
const registerreadlist_t cMma865xFreeFallEvent[] = {{.readFrom = MMA865x_FF_MT_SRC, .numBytes = 1}, __END_READ_DATA__} |
Address of Freefall Status Register.
Definition at line 101 of file mma865x_freefall.c.
volatile bool gMma865xEventReady |
Definition at line 106 of file mma865x_freefall.c.
Referenced by main(), and mma865x_int_event_ready_callback().