ISSDK  1.7
IoT Sensing Software Development Kit
Functions | Variables
mma845x_interrupt.c File Reference

The mma845x_interrupt.c file implements the ISSDK MMA845x sensor driver example demonstration with Interrupt mode. 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 "mma845x_drv.h"
Include dependency graph for mma845x_interrupt.c:

Go to the source code of this file.

Functions

void mma845x_isr (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 mma845x_Config_Isr []
 
const registerreadlist_t MMA845x_Data_Ready [] = {{.readFrom = MMA845x_STATUS, .numBytes = 1}, __END_READ_DATA__}
 
const registerreadlist_t mma845x_Output_Values []
 
volatile bool mma845xInterrupt = false
 

Detailed Description

The mma845x_interrupt.c file implements the ISSDK MMA845x sensor driver example demonstration with Interrupt mode.

Definition in file mma845x_interrupt.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 INT1 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 MMA845x sensor driver.

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

Configure the MMA845x 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 MMA845x.

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

Definition at line 117 of file mma845x_interrupt.c.

References mma845x_acceldata_t::accel, ASK_USER_TO_RESUME, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), data, Driver_GPIO_KSDK, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, int32_t(), MMA8451_WHO_AM_I_WHOAMI_VALUE, MMA845x_ACCEL_DATA_SIZE, MMA845x_I2C_ADDR, MMA845x_I2C_Configure(), MMA845x_I2C_Initialize(), MMA845x_I2C_ReadData(), MMA845x_I2C_SetIdleTask(), MMA845x_INT1, mma845x_isr(), mma845xInterrupt, GENERIC_DRIVER_GPIO::pin_init, rawData, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeWait(), status, and GENERIC_DRIVER_GPIO::toggle_pin.

Here is the call graph for this function:

◆ mma845x_isr()

void mma845x_isr ( 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 103 of file mma845x_interrupt.c.

References mma845xInterrupt.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

◆ mma845x_Config_Isr

const registerwritelist_t mma845x_Config_Isr[]
Initial value:

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

Definition at line 65 of file mma845x_interrupt.c.

◆ MMA845x_Data_Ready

const registerreadlist_t MMA845x_Data_Ready[] = {{.readFrom = MMA845x_STATUS, .numBytes = 1}, __END_READ_DATA__}

Prepare the register read list to read the Data Ready Status from MMA845x.

Definition at line 81 of file mma845x_interrupt.c.

◆ mma845x_Output_Values

const registerreadlist_t mma845x_Output_Values[]
Initial value:
= {
#define __END_READ_DATA__
Definition: sensor_drv.h:77
#define MMA845x_ACCEL_DATA_SIZE
The size of the MMA845x accel data.
Definition: mma845x_drv.h:73

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

Definition at line 84 of file mma845x_interrupt.c.

◆ mma845xInterrupt

volatile bool mma845xInterrupt = false

Definition at line 90 of file mma845x_interrupt.c.

Referenced by main(), and mma845x_isr().