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

The mma865x_interrupt.c file implements the ISSDK MMA865x sensor driver example demonstration with Interrupt mode. 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_interrupt.c:

Go to the source code of this file.

Macros

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

Functions

void mma865x_int_data_ready_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 cMma865xConfigInterrupt []
 
const registerreadlist_t cMma865xOutputValues []
 
volatile bool gMma865xDataReady = false
 

Detailed Description

The mma865x_interrupt.c file implements the ISSDK MMA865x sensor driver example demonstration with Interrupt mode.

Definition in file mma865x_interrupt.c.

Macro Definition Documentation

◆ MMA865x_ACCEL_DATA_SIZE

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

Definition at line 38 of file mma865x_interrupt.c.

Referenced by main().

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.

Configure the MMA865x sensor driver with No FIFO mode.

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

Read the raw sensor data from the MMA865x.

Convert the raw sensor data to signed 16-bit container for display to the debug port.

Definition at line 93 of file mma865x_interrupt.c.

References mma865x_acceldata_t::accel, ASK_USER_TO_RESUME, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), data, Driver_GPIO_KSDK, gMma865xDataReady, 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_ACCEL_DATA_SIZE, MMA865x_I2C_Configure(), MMA865x_I2C_Initialize(), MMA865x_I2C_ReadData(), MMA865x_I2C_SetIdleTask(), mma865x_int_data_ready_callback(), 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:

◆ mma865x_int_data_ready_callback()

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

Yes

Set flag to indicate Sensor has signalled data ready.

Definition at line 79 of file mma865x_interrupt.c.

References gMma865xDataReady.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

◆ cMma865xConfigInterrupt

const registerwritelist_t cMma865xConfigInterrupt[]
Initial value:
=
{
#define MMA865x_CTRL_REG1_DR_6_25HZ
Definition: mma865x.h:1554
#define MMA865x_CTRL_REG1_DR_MASK
Definition: mma865x.h:1534
#define MMA865x_CTRL_REG5_INT_CFG_DRDY_MASK
Definition: mma865x.h:1815
#define MMA865x_XYZ_DATA_CFG_FS_MASK
Definition: mma865x.h:530
#define MMA865x_CTRL_REG5_INT_CFG_DRDY_INT1
Definition: mma865x.h:1853
#define __END_WRITE_DATA__
Definition: sensor_drv.h:45
#define MMA865x_CTRL_REG3_IPOL_MASK
Definition: mma865x.h:1664
#define MMA865x_CTRL_REG3_IPOL_ACTIVE_HIGH
Definition: mma865x.h:1701
#define MMA865x_CTRL_REG2_MODS_MASK
Definition: mma865x.h:1592
#define MMA865x_CTRL_REG4_INT_EN_DRDY_EN
Definition: mma865x.h:1778
#define MMA865x_CTRL_REG2_MODS_HR
Definition: mma865x.h:1623
#define MMA865x_XYZ_DATA_CFG_FS_2G
Definition: mma865x.h:542
#define MMA865x_CTRL_REG4_INT_EN_DRDY_MASK
Definition: mma865x.h:1740

Prepare the register write list to configure MMA865x in non-FIFO and ISR mode.

Definition at line 44 of file mma865x_interrupt.c.

◆ cMma865xOutputValues

const registerreadlist_t cMma865xOutputValues[]
Initial value:
= {{.readFrom = MMA865x_OUT_X_MSB, .numBytes = MMA865x_ACCEL_DATA_SIZE},
#define __END_READ_DATA__
Definition: sensor_drv.h:51
#define MMA865x_ACCEL_DATA_SIZE

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

Definition at line 60 of file mma865x_interrupt.c.

◆ gMma865xDataReady

volatile bool gMma865xDataReady = false

Definition at line 66 of file mma865x_interrupt.c.

Referenced by main(), and mma865x_int_data_ready_callback().