![]() |
ISSDK
1.8
IoT Sensing Software Development Kit
|
The mma865x_auto-wake-sleep.c file implements the ISSDK MMA865x sensor example demonstrating configuring MMA8652 Accel and enabling detection motion detection event. 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"
Go to the source code of this file.
Macros | |
#define | MT_FFMT_THS 0x07 /* Motion Threshold Value. */ |
#define | MT_FFMT_COUNT 0x00 |
#define | ASLP_COUNT 0x14 |
Functions | |
void | mma865x_isr_callback (void *pUserData) |
This is the Sensor ISR implementation. More... | |
int | main (void) |
This is the The main function implementation. More... | |
Variables | |
const registerwritelist_t | mma865x_autowake_motiondet_config [] |
const registerreadlist_t | gMma8562ReadSysMode [] = {{.readFrom = MMA865x_SYSMOD, .numBytes = 1}, __END_READ_DATA__} |
Read register list for MMA8562 to read SysMode Register. More... | |
volatile bool | gMma865xIntFlag = false |
The mma865x_auto-wake-sleep.c file implements the ISSDK MMA865x sensor example demonstrating configuring MMA8652 Accel and enabling detection motion detection event.
Definition in file mma865x_auto-wake-sleep.c.
#define ASLP_COUNT 0x14 |
Definition at line 40 of file mma865x_auto-wake-sleep.c.
#define MT_FFMT_COUNT 0x00 |
Definition at line 39 of file mma865x_auto-wake-sleep.c.
#define MT_FFMT_THS 0x07 /* Motion Threshold Value. */ |
Definition at line 38 of file mma865x_auto-wake-sleep.c.
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.
[in] | void | This is no input parameter. |
Initialize the MCU hardware.
Initialize MMA865x pin used by FRDM board
Initialize RGB LED 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.
Check whether Motion Interrupt has occurred and event status is Wake mode
Wake Mode Detected.
Clear the sensor event interrupt flag, it will be set again by the ISR.
Put MCU in low-power sleep.
Definition at line 102 of file mma865x_auto-wake-sleep.c.
References BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), GENERIC_DRIVER_GPIO::clr_pin, 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_SYSMOD_SYSMOD_WAKE, GENERIC_DRIVER_GPIO::pin_init, RED_LED, SENSOR_ERROR_NONE, GENERIC_DRIVER_GPIO::set_pin, SMC, SMC_SetPowerModeVlpr(), SMC_SetPowerModeWait(), and status.
void mma865x_isr_callback | ( | void * | pUserData | ) |
This is the Sensor ISR implementation.
This function sets the flag which indicates if a new sample(s) is available for reading or new event has occurred.
[in] | pUserData | This is a void pointer to the instance of the user specific data structure for the ISR. |
Set flag to indicate Sensor has detected an event.
Definition at line 88 of file mma865x_auto-wake-sleep.c.
References gMma865xIntFlag.
Referenced by main().
const registerreadlist_t gMma8562ReadSysMode[] = {{.readFrom = MMA865x_SYSMOD, .numBytes = 1}, __END_READ_DATA__} |
Read register list for MMA8562 to read SysMode Register.
Definition at line 69 of file mma865x_auto-wake-sleep.c.
volatile bool gMma865xIntFlag = false |
Definition at line 74 of file mma865x_auto-wake-sleep.c.
Referenced by main(), and mma865x_isr_callback().
const registerwritelist_t mma865x_autowake_motiondet_config[] |
Definition at line 45 of file mma865x_auto-wake-sleep.c.