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

The fxlc95000_accel_i2c.c file implements the ISSDK FXLC95000 sensor driver example demonstration as for I2C Mode. More...

#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#include "fsl_lptmr.h"
#include "fsl_debug_console.h"
#include "Driver_I2C.h"
#include "issdk_hal.h"
#include "fxlc95000_drv.h"
#include "systick_utils.h"
Include dependency graph for fxlc95000_accel_i2c.c:

Go to the source code of this file.

Macros

#define SAMPLING_RATE_us   (100000) /* Timeout for the ODR Timer. */
 
#define FXLC95000_SAMPLE_SIZE   (10) /* 4-Byte timestamp and 2-Byte X,Y,Z Data each. */
 
#define fxlc95000_odr_callback   LPTMR0_IRQHandler /* Timer timeout Callback. */
 

Functions

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

Variables

const uint8_t cFxlc95000_SetODR_Cmd []
 
const uint8_t cFxlc95000_SetResolution_Cmd []
 
const uint8_t cFxlc95000_SetRange_Cmd []
 
const registercommandlist_t cFxlc95000ConfigMBox []
 
const registercommandlist_t cFxlc95000ConfigSensor []
 
const registerreadlist_t cFxlc95000ReadSample []
 
volatile bool gFxlc95000DataRead
 

Detailed Description

The fxlc95000_accel_i2c.c file implements the ISSDK FXLC95000 sensor driver example demonstration as for I2C Mode.

Definition in file fxlc95000_accel_i2c.c.

Macro Definition Documentation

◆ fxlc95000_odr_callback

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

Definition at line 35 of file fxlc95000_accel_i2c.c.

◆ FXLC95000_SAMPLE_SIZE

#define FXLC95000_SAMPLE_SIZE   (10) /* 4-Byte timestamp and 2-Byte X,Y,Z Data each. */

Definition at line 34 of file fxlc95000_accel_i2c.c.

Referenced by main().

◆ SAMPLING_RATE_us

#define SAMPLING_RATE_us   (100000) /* Timeout for the ODR Timer. */

Definition at line 33 of file fxlc95000_accel_i2c.c.

Referenced by main().

Function Documentation

◆ fxlc95000_odr_callback()

void fxlc95000_odr_callback ( void  )

Definition at line 77 of file fxlc95000_accel_i2c.c.

References gFxlc95000DataRead.

◆ 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 FXLC95000 sensor driver.

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

Configure the FXLC95000 with MBox settings.

Configure the FXLC95000 with Sampling settings.

Read the raw sensor data from the FXLC95000.

Convert the raw bytes to sensor data with correct endianness.

Definition at line 86 of file fxlc95000_accel_i2c.c.

References fxlc95000_acceldata_t::accel, ASK_USER_TO_RESUME, BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), BOARD_SystickEnable(), data, FXLC95000_BUILD_ID, FXLC95000_I2C_ADDR, FXLC95000_I2C_CommandResponse(), FXLC95000_I2C_Initialize(), FXLC95000_I2C_SetIdleTask(), FXLC95000_SAMPLE_SIZE, fxlc95000Driver, gFxlc95000DataRead, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, I2Cdrv, int32_t(), rawData, SAMPLING_RATE_us, SENSOR_ERROR_NONE, SMC, SMC_SetPowerModeVlpr(), status, and fxlc95000_acceldata_t::timestamp.

Here is the call graph for this function:

Variable Documentation

◆ cFxlc95000_SetODR_Cmd

const uint8_t cFxlc95000_SetODR_Cmd[]
Initial value:
#define SAMPLING_RATE_us
#define FXLC95000_SST_ODR_PAYLOAD(x)
The FXLC95000 Set Report Rate Payload Bytes.
Definition: fxlc95000.h:51
#define FXLC95000_SET_ODR_CMD_HDR
The FXLC95000 Set Report Rate Command Header Bytes.
Definition: fxlc95000.h:42

Create commands for setting FXLC95000L desired configuration.

Definition at line 41 of file fxlc95000_accel_i2c.c.

◆ cFxlc95000_SetRange_Cmd

const uint8_t cFxlc95000_SetRange_Cmd[]
Initial value:
#define FXLC95000_SET_RANGE_CMD_HDR
The FXLC95000 Set Range Command Header Bytes.
Definition: fxlc95000.h:48
#define FXLC95000_ACCEL_RANGE_2G
The FXLC95000 FS Range 2G.
Definition: fxlc95000.h:54

Definition at line 45 of file fxlc95000_accel_i2c.c.

◆ cFxlc95000_SetResolution_Cmd

const uint8_t cFxlc95000_SetResolution_Cmd[]
Initial value:
#define FXLC95000_SET_RESOLUTION_CMD_HDR
The FXLC95000 Set Resolution Command Header Bytes.
Definition: fxlc95000.h:45
#define FXLC95000_ACCEL_RESOLUTION_14_BIT
The FXLC95000 Resoultion 14-Bit.
Definition: fxlc95000.h:69

Definition at line 43 of file fxlc95000_accel_i2c.c.

◆ cFxlc95000ConfigMBox

const registercommandlist_t cFxlc95000ConfigMBox[]
Initial value:
= {
{QuickReadInterruptDisable, 0, sizeof(QuickReadInterruptDisable)},
{ConfigureMBoxCmd, 0, sizeof(ConfigureMBoxCmd)},
}
#define __END_WRITE_CMD__
Definition: sensor_drv.h:57

Prepare the register write list to initialize FXLC95000L with desired MBox Settings.

Definition at line 49 of file fxlc95000_accel_i2c.c.

◆ cFxlc95000ConfigSensor

const registercommandlist_t cFxlc95000ConfigSensor[]
Initial value:
= {
{StopDataCmd, 0, sizeof(StopDataCmd)},
{StartDataCmd, 0, sizeof(StartDataCmd)},
const uint8_t cFxlc95000_SetResolution_Cmd[]
const uint8_t cFxlc95000_SetRange_Cmd[]
#define __END_WRITE_CMD__
Definition: sensor_drv.h:57
const uint8_t cFxlc95000_SetODR_Cmd[]

Prepare the register write list to configure FXLC95000L with desired Sampling Settings.

Definition at line 56 of file fxlc95000_accel_i2c.c.

◆ cFxlc95000ReadSample

const registerreadlist_t cFxlc95000ReadSample[]
Initial value:
= {
#define FXLC95000_SAMPLE_SIZE
#define __END_READ_DATA__
Definition: sensor_drv.h:51
#define FXLC95000_SAMPLE_OFFSET
Time stamp and XYZ Data Register Offset.
Definition: fxlc95000.h:15

Prepare the register read list to read the Timestamp and Accel data from FXLC95000.

Definition at line 65 of file fxlc95000_accel_i2c.c.

◆ gFxlc95000DataRead

volatile bool gFxlc95000DataRead

Definition at line 71 of file fxlc95000_accel_i2c.c.

Referenced by fxlc95000_odr_callback(), and main().