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

The mma8491q_example.c file implements the ISSDK MMA8491Q sensor driver example demonstration with Timers. More...

#include "board.h"
#include "pin_mux.h"
#include "fsl_lptmr.h"
#include "clock_config.h"
#include "fsl_debug_console.h"
#include "Driver_I2C.h"
#include "issdk_hal.h"
#include "gpio_driver.h"
#include "mma8491q_drv.h"
Include dependency graph for mma8491q_example.c:

Go to the source code of this file.

Macros

#define mma8491q_en_callback   LPTMR0_IRQHandler
 
#define MMA8491Q_T_ODR_ms   100U
 
#define LPTMR_T_CORRECTION_ms   2
 

Functions

void mma8491q_en_delay ()
 
void mma8491q_en_callback (void)
 
void mma8491q_timer_fwk_init (uint32_t samplingInterval)
 
int main (void)
 Main function. More...
 

Variables

const registerreadlist_t cMma8491qStatus [] = {{.readFrom = MMA8491Q_STATUS, .numBytes = 1}, __END_READ_DATA__}
 Address of Status Register. More...
 
const registerreadlist_t cMma8491qOutput []
 Address and size of Raw Acceleration Data. More...
 
volatile bool bMma849qDataReady = false
 
gpioConfigKSDK_t gGpioConfigInPins
 
GENERIC_DRIVER_GPIOpGpioDriver = &Driver_GPIO_KSDK
 

Detailed Description

The mma8491q_example.c file implements the ISSDK MMA8491Q sensor driver example demonstration with Timers.

Definition in file mma8491q_example.c.

Macro Definition Documentation

◆ LPTMR_T_CORRECTION_ms

#define LPTMR_T_CORRECTION_ms   2

Definition at line 70 of file mma8491q_example.c.

Referenced by mma8491q_timer_fwk_init().

◆ mma8491q_en_callback

#define mma8491q_en_callback   LPTMR0_IRQHandler

Definition at line 66 of file mma8491q_example.c.

◆ MMA8491Q_T_ODR_ms

#define MMA8491Q_T_ODR_ms   100U

Definition at line 68 of file mma8491q_example.c.

Referenced by main().

Function Documentation

◆ main()

int main ( void  )

Main function.

Initialize the MCU hardware.

Initialize GREEN LED pin used by FRDM board

Initialize the I2C driver.

Set the I2C Power mode.

Set the I2C bus speed.

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

Initialize MMA8491_ODR Timer framework.

Process packets on Data ready Timer Expiry

Process packets only when data ready is indicated by the MMA8491Q.

Read the raw sensor data from the MMA8491Q.

Process the sample and convert the raw sensor data.

Definition at line 135 of file mma8491q_example.c.

References mma8491q_acceldata_t::accel, ASK_USER_TO_RESUME, bMma849qDataReady, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), GENERIC_DRIVER_GPIO::clr_pin, data, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, int32_t(), MMA8491_EN, MMA8491_I2C_ADDR, MMA8491_XOUT, MMA8491_YOUT, MMA8491_ZOUT, MMA8491Q_DATA_SIZE, mma8491q_en_delay(), MMA8491Q_I2C_Initialize(), MMA8491Q_I2C_ReadData(), MMA8491Q_I2C_SetIdleTask(), MMA8491Q_STATUS_ZYXDR_MASK, MMA8491Q_T_ODR_ms, mma8491q_timer_fwk_init(), GENERIC_DRIVER_GPIO::pin_init, rawData, GENERIC_DRIVER_GPIO::read_pin, SENSOR_ERROR_NONE, GENERIC_DRIVER_GPIO::set_pin, SMC, SMC_SetPowerModeWait(), status, mma8491q_acceldata_t::tilt, fxls8962_acceldataUser_t::timestamp, and GENERIC_DRIVER_GPIO::toggle_pin.

Here is the call graph for this function:

◆ mma8491q_en_callback()

void mma8491q_en_callback ( void  )

Definition at line 112 of file mma8491q_example.c.

References bMma849qDataReady.

◆ mma8491q_en_delay()

void mma8491q_en_delay ( )

Definition at line 99 of file mma8491q_example.c.

References MMA8491Q_T_ON_TYPICAL.

Referenced by main().

Here is the caller graph for this function:

◆ mma8491q_timer_fwk_init()

void mma8491q_timer_fwk_init ( uint32_t  samplingInterval)

Definition at line 119 of file mma8491q_example.c.

References LPTMR_T_CORRECTION_ms.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

◆ bMma849qDataReady

volatile bool bMma849qDataReady = false

Definition at line 85 of file mma8491q_example.c.

Referenced by main(), and mma8491q_en_callback().

◆ cMma8491qOutput

const registerreadlist_t cMma8491qOutput[]
Initial value:
= {{.readFrom = MMA8491Q_OUT_X_MSB, .numBytes = MMA8491Q_DATA_SIZE},
#define MMA8491Q_DATA_SIZE
Definition: mma8491q_drv.h:89
#define __END_READ_DATA__
Definition: sensor_drv.h:77

Address and size of Raw Acceleration Data.

Definition at line 79 of file mma8491q_example.c.

◆ cMma8491qStatus

const registerreadlist_t cMma8491qStatus[] = {{.readFrom = MMA8491Q_STATUS, .numBytes = 1}, __END_READ_DATA__}

Address of Status Register.

Definition at line 76 of file mma8491q_example.c.

◆ gGpioConfigInPins

gpioConfigKSDK_t gGpioConfigInPins
Initial value:
=
{
.pinConfig = {kGPIO_DigitalInput, 0},
.interruptMode = kPORT_InterruptOrDMADisabled,
.portPinConfig = {0},
.portPinConfig.mux = kPORT_MuxAsGpio,
}

Definition at line 86 of file mma8491q_example.c.

◆ pGpioDriver

Definition at line 93 of file mma8491q_example.c.

Referenced by main().