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

The mma9553_pedometer_spi.c file implements the ISSDK MMA9553L sensor driver example demonstration as a Pedometer in SPI Mode. More...

#include "board.h"
#include "pin_mux.h"
#include "fsl_lptmr.h"
#include "clock_config.h"
#include "fsl_debug_console.h"
#include "Driver_SPI.h"
#include "issdk_hal.h"
#include "gpio_driver.h"
#include "mma9553_drv.h"
#include "systick_utils.h"
Include dependency graph for mma9553_pedometer_spi.c:

Go to the source code of this file.

Macros

#define SAMPLING_RATE_ms   (100) /* Timeout for the ODR Timer. */
 
#define MMA9553_ACCEL_DATA_SIZE   (6) /* 2 byte X,Y,Z Axis Data each. */
 
#define mma9553_en_callback   LPTMR0_IRQHandler /* Timer timeout Callback. */
 
#define MMA9553_SSB_IO3   D10 /* The SSB_IO3 pin of MMA9553 on the FRDM-STBC-SA955x Board. */
 
#define RESET_GPIO   A3 /* The RESET_GPIO pin of MMA9553 on the FRDM-STBC-SA955x Board. */
 

Functions

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

Variables

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

Detailed Description

The mma9553_pedometer_spi.c file implements the ISSDK MMA9553L sensor driver example demonstration as a Pedometer in SPI Mode.

Definition in file mma9553_pedometer_spi.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 61 of file mma9553_pedometer_spi.c.

◆ mma9553_en_callback

#define mma9553_en_callback   LPTMR0_IRQHandler /* Timer timeout Callback. */

Definition at line 62 of file mma9553_pedometer_spi.c.

◆ MMA9553_SSB_IO3

#define MMA9553_SSB_IO3   D10 /* The SSB_IO3 pin of MMA9553 on the FRDM-STBC-SA955x Board. */

Definition at line 63 of file mma9553_pedometer_spi.c.

Referenced by main().

◆ RESET_GPIO

#define RESET_GPIO   A3 /* The RESET_GPIO pin of MMA9553 on the FRDM-STBC-SA955x Board. */

Definition at line 64 of file mma9553_pedometer_spi.c.

Referenced by main().

◆ SAMPLING_RATE_ms

#define SAMPLING_RATE_ms   (100) /* Timeout for the ODR Timer. */

Definition at line 60 of file mma9553_pedometer_spi.c.

Referenced by main().

Function Documentation

◆ main()

int main ( void  )

Main function.

Initialize the MCU hardware

Initialize the SPI driver.

Set the SPI Power mode.

Set the SPI Slave 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.

Read the Pedometer data from the MMA9553.

Read the raw sensor data from the MMA9553.

Definition at line 107 of file mma9553_pedometer_spi.c.

References mma9553_acceldata_t::accel, ASK_USER_TO_RESUME, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), BOARD_SystickEnable(), gMma9553DataReady, int32_t(), MMA9553_SPI_CommandResponse(), MMA9553_SPI_Configure(), MMA9553_SPI_Initialize(), MMA9553_SPI_SetIdleTask(), MMA9553_SSB_IO3, rawData, RESET_GPIO, SAMPLING_RATE_ms, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeWait(), SPI_S_BAUDRATE, SPI_S_DEVICE_INDEX, SPI_S_DRIVER, SPI_S_SIGNAL_EVENT, and status.

Here is the call graph for this function:

◆ mma9553_en_callback()

void mma9553_en_callback ( void  )

Definition at line 98 of file mma9553_pedometer_spi.c.

References gMma9553DataReady.

Variable Documentation

◆ cMma9553Config30Hz

const registercommandlist_t cMma9553Config30Hz[]
Initial value:
= {
{SetFSRange_2g, 0, sizeof(SetFSRange_2g)},
const uint8_t SetFSRange_2g[5]
Full-Scale Range Selections.
Definition: mma9553_drv.c:89
const uint8_t SetMBoxPriority_for30Hz[5]
Definition: mma9553_drv.c:118
const uint8_t SetAFEPriority_for30Hz[5]
Definition: mma9553_drv.c:108
const uint8_t SetSampleRate_30Hz[5]
Definition: mma9553_drv.c:98
#define __END_WRITE_CMD__
Definition: sensor_drv.h:83

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

Definition at line 70 of file mma9553_pedometer_spi.c.

◆ cMma9553ReadPedometerCommand

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

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

Definition at line 82 of file mma9553_pedometer_spi.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:86
#define __END_READ_DATA__
Definition: sensor_drv.h:77

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

Definition at line 86 of file mma9553_pedometer_spi.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:22
#define __END_READ_DATA__
Definition: sensor_drv.h:77

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

Definition at line 78 of file mma9553_pedometer_spi.c.

◆ gMma9553DataReady

volatile bool gMma9553DataReady

Definition at line 92 of file mma9553_pedometer_spi.c.

Referenced by main(), and mma9553_en_callback().