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

The pedometer_stepcount_mma8451.c file implements the ISSDK prdometer example using MMA8451 sensor as the acceleration source. 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 "pedometer.h"
#include "mma845x_drv.h"
Include dependency graph for pedometer_stepcount_mma8451.c:

Go to the source code of this file.

Macros

#define RAW_ACCEL_DATA_SIZE   (6)
 

Functions

int main (void)
 Main function. More...
 

Variables

const registerwritelist_t mma845x_Config_Normal []
 
const registerreadlist_t mma845x_Data_Ready [] = {{.readFrom = MMA845x_STATUS, .numBytes = 1}, __END_READ_DATA__}
 
const registerreadlist_t mma845x_Output_Values []
 

Detailed Description

The pedometer_stepcount_mma8451.c file implements the ISSDK prdometer example using MMA8451 sensor as the acceleration source.

Definition in file pedometer_stepcount_mma8451.c.

Macro Definition Documentation

◆ RAW_ACCEL_DATA_SIZE

#define RAW_ACCEL_DATA_SIZE   (6)

Definition at line 58 of file pedometer_stepcount_mma8451.c.

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 MMA845x sensor driver.

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

Configure the MMA845x sensor driver with Non FIFO mode.

Initialize the pedometer

Configure the pedometer

Read the data ready status from MMA845x

Read the raw sensor data from the MMA845x.

Convert the raw sensor data for display to the debug port.

Execute the pedometer Algorithm

Definition at line 111 of file pedometer_stepcount_mma8451.c.

References mma845x_acceldata_t::accel, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), data, 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_STATUS_ZYXDR_MASK, pedometer_configure(), pedometer_init(), pedometer_run(), rawData, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeWait(), pedometer_t::status, status, and pedometer_t::pedometer_status_tag::stepcount.

Here is the call graph for this function:

Variable Documentation

◆ mma845x_Config_Normal

const registerwritelist_t mma845x_Config_Normal[]
Initial value:

Prepare the register write list to configure MMA845x in poll mode.

Definition at line 65 of file pedometer_stepcount_mma8451.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 75 of file pedometer_stepcount_mma8451.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 78 of file pedometer_stepcount_mma8451.c.