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

The mma9553_pedometer_interrupt.c file implements the ISSDK MMA9553L sensor driver example demonstration as a Pedometer in I2C Mode with Interrupts. 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 "mma9553_drv.h"
#include "gpio_driver.h"
#include "systick_utils.h"
Include dependency graph for mma9553_pedometer_interrupt.c:

Go to the source code of this file.

Macros

#define MMA9553_ACCEL_DATA_SIZE   (6) /* 2 byte X,Y,Z Axis Data each. */
 
#define MMA9553_INT_O   A0 /* The INT_O pin of MMA9553 on the FRDM-STBC-SA955x Board. */
 

Functions

void mma9553_int_data_ready_callback (void *pUserData)
 
int main (void)
 Main function. More...
 

Variables

const registercommandlist_t cMma9553Config30Hz []
 
const registerreadlist_t cMma9553ReadRawOutput []
 
const registercommandlist_t cMma9553ReadPedometerCommand []
 
const registercommandlist_t cMma9553EnableInterruptCommand []
 
const registerreadlist_t cMma9553ReadPedometerOutput []
 
volatile bool gMma9553DataReady
 

Detailed Description

The mma9553_pedometer_interrupt.c file implements the ISSDK MMA9553L sensor driver example demonstration as a Pedometer in I2C Mode with Interrupts.

Definition in file mma9553_pedometer_interrupt.c.

Macro Definition Documentation

◆ MMA9553_ACCEL_DATA_SIZE

#define MMA9553_ACCEL_DATA_SIZE   (6) /* 2 byte X,Y,Z Axis Data each. */

Definition at line 33 of file mma9553_pedometer_interrupt.c.

◆ MMA9553_INT_O

#define MMA9553_INT_O   A0 /* The INT_O pin of MMA9553 on the FRDM-STBC-SA955x Board. */

Definition at line 34 of file mma9553_pedometer_interrupt.c.

Referenced by main().

Function Documentation

◆ main()

int main ( void  )

Main function.

Initialize the MCU hardware

Initialize the I2C driver.

Set the I2C Power mode.

Set the I2C bus speed.

Initialize the MMA9553 sensor driver.

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

Configure the MMA9553 sensor driver with 30Hz Mode settings.

MMA9553_I2C_Configure sets the part to Legacy Mode. To enable MMA9553_INT_O interrupt for MMA9553 we need to override this by setting Legacy+AFE Sampling Interrupt.

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

Read the Pedometer data from the MMA9553.

Read the raw sensor data from the MMA9553.

Definition at line 80 of file mma9553_pedometer_interrupt.c.

References mma9553_acceldata_t::accel, ASK_USER_TO_RESUME, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), BOARD_SystickEnable(), Driver_GPIO_KSDK, gMma9553DataReady, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, int32_t(), MMA9553_I2C_ADDR, MMA9553_I2C_CommandResponse(), MMA9553_I2C_Configure(), MMA9553_I2C_Initialize(), MMA9553_I2C_SetIdleTask(), mma9553_int_data_ready_callback(), MMA9553_INT_O, pGpioDriver, GENERIC_DRIVER_GPIO::pin_init, rawData, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeVlpr(), SMC_SetPowerModeWait(), status, and GENERIC_DRIVER_GPIO::toggle_pin.

Here is the call graph for this function:

◆ mma9553_int_data_ready_callback()

void mma9553_int_data_ready_callback ( void *  pUserData)

Definition at line 72 of file mma9553_pedometer_interrupt.c.

References gMma9553DataReady.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

◆ cMma9553Config30Hz

const registercommandlist_t cMma9553Config30Hz[]
Initial value:
= {
{SetFSRange_2g, 0, sizeof(SetFSRange_2g)},
const uint8_t SetAFEPriority_for3Hz[5]
Definition: mma9553_drv.c:85
const uint8_t SetSampleRate_3Hz[5]
Definition: mma9553_drv.c:75
const uint8_t SetFSRange_2g[5]
Full-Scale Range Selections.
Definition: mma9553_drv.c:63
const uint8_t SetMBoxPriority_for3Hz[5]
Definition: mma9553_drv.c:95
#define __END_WRITE_CMD__
Definition: sensor_drv.h:57

Prepare the register write list to configure MMA9553L in 30Hz Mode.

Definition at line 40 of file mma9553_pedometer_interrupt.c.

◆ cMma9553EnableInterruptCommand

const registercommandlist_t cMma9553EnableInterruptCommand[]
Initial value:
#define __END_WRITE_CMD__
Definition: sensor_drv.h:57
const uint8_t SetLegacyIntMode[5]
Set Sensor to Legacy Mode with INT_O interrupt on completion of the AFE sampling. ...
Definition: mma9553_drv.c:54

Prepare the command list to enable interrupts for AFE sampling completion with Legacy Mode for MMA9553.

Definition at line 56 of file mma9553_pedometer_interrupt.c.

◆ cMma9553ReadPedometerCommand

const registercommandlist_t cMma9553ReadPedometerCommand[]
Initial value:
const uint8_t ReadPedometerData[4]
Command to Read Pedometer Data.
Definition: mma9553_drv.c:98
#define __END_WRITE_CMD__
Definition: sensor_drv.h:57

Prepare the command list to read the Pedometer data from MMA9553.

Definition at line 52 of file mma9553_pedometer_interrupt.c.

◆ cMma9553ReadPedometerOutput

const registerreadlist_t cMma9553ReadPedometerOutput[]
Initial value:
= {{.readFrom = 0, .numBytes = sizeof(mma9553_pedometerdata_t)},
This structure defines the Size of response for pedometer data read command.
Definition: mma9553_drv.h:60
#define __END_READ_DATA__
Definition: sensor_drv.h:51

Prepare the read list to read the Pedometer data from MMA9553.

Definition at line 60 of file mma9553_pedometer_interrupt.c.

◆ cMma9553ReadRawOutput

const registerreadlist_t cMma9553ReadRawOutput[]
Initial value:
= {
#define MMA9553_ACCEL_DATA_SIZE
#define MMA9553_XYZ_DATA_OFFSET
XYZ Data Register Offset.
Definition: mma9553.h:23
#define __END_READ_DATA__
Definition: sensor_drv.h:51

Prepare the register read list to read the raw Accel data from MMA9553.

Definition at line 48 of file mma9553_pedometer_interrupt.c.

◆ gMma9553DataReady

volatile bool gMma9553DataReady

Definition at line 66 of file mma9553_pedometer_interrupt.c.

Referenced by main(), and mma9553_int_data_ready_callback().