ISSDK  1.7
IoT Sensing Software Development Kit
Data Structures | Macros | Functions | Variables
fxls8471_demo.c File Reference

The fxls8471_demo.c file implements the ISSDK FXLS8471 sensor demo example demonstration with interrupt mode. More...

#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "Driver_SPI.h"
#include "Driver_USART.h"
#include "issdk_hal.h"
#include "gpio_driver.h"
#include "host_io_uart.h"
#include "systick_utils.h"
#include "fxls8471q_drv.h"
#include "auto_detection_service.h"
Include dependency graph for fxls8471_demo.c:

Go to the source code of this file.

Data Structures

struct  fxls8471q_acceldataUser_t
 

Macros

#define FXLS8471_STREAM_DATA_SIZE   11
 
#define APPLICATION_NAME   "FXLS8471 Accelerometer Demo"
 Unique Name for this application which should match the target GUI pkg name. More...
 
#define APPLICATION_VERSION   "2.5"
 Version to distinguish between instances the same application based on target Shield and updates. More...
 

Functions

void fxls8471_int_data_ready_callback (void *pUserData)
 
bool process_host_command (uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse, size_t *hostMsgSize, size_t respBufferSize)
 
int main (void)
 Main function. More...
 

Variables

const registerwritelist_t cFxls8471q_Config_Isr []
 
const registerreadlist_t cFxls8471q_Output_Values []
 
const registerreadlist_t cFxls8471q_int_src []
 
const registerreadlist_t cFxls8471q_ffmt_src []
 
const registerreadlist_t cFxls8471q_pl_status []
 
char boardString [ADS_MAX_STRING_LENGTH] = {0}
 
char shieldString [ADS_MAX_STRING_LENGTH] = {0}
 
char embAppName [ADS_MAX_STRING_LENGTH] = {0}
 
volatile bool bStreamingEnabled = false
 
volatile bool bFxls8471DataReady = false
 
volatile bool bFxls8471Ready = false
 
uint8_t gStreamID
 
int32_t gSystick
 
GENERIC_DRIVER_GPIOpGpioDriver = &Driver_GPIO_KSDK
 

Detailed Description

The fxls8471_demo.c file implements the ISSDK FXLS8471 sensor demo example demonstration with interrupt mode.

Definition in file fxls8471_demo.c.

Macro Definition Documentation

◆ APPLICATION_NAME

#define APPLICATION_NAME   "FXLS8471 Accelerometer Demo"

Unique Name for this application which should match the target GUI pkg name.

Definition at line 69 of file fxls8471_demo.c.

Referenced by main().

◆ APPLICATION_VERSION

#define APPLICATION_VERSION   "2.5"

Version to distinguish between instances the same application based on target Shield and updates.

Definition at line 71 of file fxls8471_demo.c.

Referenced by main().

◆ FXLS8471_STREAM_DATA_SIZE

#define FXLS8471_STREAM_DATA_SIZE   11

Definition at line 67 of file fxls8471_demo.c.

Referenced by main().

Function Documentation

◆ fxls8471_int_data_ready_callback()

void fxls8471_int_data_ready_callback ( void *  pUserData)

Set flag to indicate Sensor has signalled data ready.

Definition at line 164 of file fxls8471_demo.c.

References bFxls8471DataReady.

Referenced by main().

Here is the caller graph for this function:

◆ main()

int main ( void  )

Main function.

Initialize the MCU hardware.

Initialize FXLS8471 pin used by FRDM board

Initialize RGB LED pin used by FRDM board

Initialize the SPI driver.

Set the SPI Power mode.

Set the SPI Slave speed.

Initialize the UART driver.

Set the UART Power mode.

Set UART Baud Rate.

Initialize FXLS8471 sensor driver.

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

Configure the FXLS8471 sensor.

Initialize streaming and assign a Stream ID.

Populate streaming header.

Clear the data ready flag, it will be set again by the ISR.

Read new raw sensor data from the FXLS8471.

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

Definition at line 253 of file fxls8471_demo.c.

References fxls8471q_acceldataUser_t::accel, ADS_MAX_STRING_LENGTH, APPLICATION_NAME, APPLICATION_VERSION, bFxls8471DataReady, bFxls8471Ready, BOARD_BootClockRUN, BOARD_DEBUG_UART_BAUDRATE, BOARD_RunADS(), BOARD_SystickElapsedTime_us(), BOARD_SystickEnable(), boardString, bStreamingEnabled, GENERIC_DRIVER_GPIO::clr_pin, data, fxls8471q_spi_sensorhandle_t::deviceInfo, embAppName, FXLS8471_INT1, fxls8471_int_data_ready_callback(), FXLS8471_SPI_CS, FXLS8471_STREAM_DATA_SIZE, FXLS8471Q_ACCEL_DATA_SIZE, FXLS8471Q_I2C_ADDRESS_SA0_0_SA1_0, FXLS8471Q_SPI_Configure(), FXLS8471Q_SPI_Initialize(), FXLS8471Q_SPI_ReadData(), FXLS8471Q_SPI_SetIdleTask(), FXLS8471Q_WHO_AM_I_WHOAMI_VALUE, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, gStreamID, gSystick, HOST_FORMAT_HDLC, Host_IO_Add_ISO_Header(), Host_IO_Init(), Host_IO_Receive(), Host_IO_Send(), HOST_S_DRIVER, HOST_S_SIGNAL_EVENT, int32_t(), fxls8471q_acceldataUser_t::intsrc, fxls8471q_spi_sensorhandle_t::pCommDrv, GENERIC_DRIVER_GPIO::pin_init, process_host_command(), rawData, SENSOR_ERROR_NONE, SHIELD_NAME, shieldString, fxls8471q_spi_sensorhandle_t::slaveParams, SMC, SMC_SetPowerModeWait(), SPI_S_BAUDRATE, SPI_S_DEVICE_INDEX, SPI_S_DRIVER, SPI_S_SIGNAL_EVENT, status, STREAMING_HEADER_LEN, streamingPacket, fxls8471q_acceldataUser_t::timestamp, fxls8962_acceldataUser_t::timestamp, and GENERIC_DRIVER_GPIO::toggle_pin.

Here is the call graph for this function:

◆ process_host_command()

bool process_host_command ( uint8_t  tag,
uint8_t *  hostCommand,
uint8_t *  hostResponse,
size_t *  hostMsgSize,
size_t  respBufferSize 
)

Variable Documentation

◆ bFxls8471DataReady

volatile bool bFxls8471DataReady = false

Definition at line 155 of file fxls8471_demo.c.

Referenced by fxls8471_int_data_ready_callback(), and main().

◆ bFxls8471Ready

volatile bool bFxls8471Ready = false

Definition at line 155 of file fxls8471_demo.c.

Referenced by main(), and process_host_command().

◆ boardString

char boardString[ADS_MAX_STRING_LENGTH] = {0}

Definition at line 153 of file fxls8471_demo.c.

Referenced by main(), and process_host_command().

◆ bStreamingEnabled

volatile bool bStreamingEnabled = false

Definition at line 155 of file fxls8471_demo.c.

Referenced by main(), and process_host_command().

◆ cFxls8471q_Config_Isr

const registerwritelist_t cFxls8471q_Config_Isr[]

Prepare the register write list to configure FXLS8471Q in non-FIFO mode.

Definition at line 84 of file fxls8471_demo.c.

◆ cFxls8471q_ffmt_src

const registerreadlist_t cFxls8471q_ffmt_src[]
Initial value:
= {
{.readFrom = FXLS8471Q_A_FFMT_SRC , .numBytes = 1}, __END_READ_DATA__}
#define __END_READ_DATA__
Definition: sensor_drv.h:77

Definition at line 144 of file fxls8471_demo.c.

◆ cFxls8471q_int_src

const registerreadlist_t cFxls8471q_int_src[]
Initial value:
= {
{.readFrom = FXLS8471Q_INT_SOURCE, .numBytes = 1}, __END_READ_DATA__}
#define __END_READ_DATA__
Definition: sensor_drv.h:77

Definition at line 141 of file fxls8471_demo.c.

◆ cFxls8471q_Output_Values

const registerreadlist_t cFxls8471q_Output_Values[]
Initial value:
= {
#define __END_READ_DATA__
Definition: sensor_drv.h:77
#define FXLS8471Q_ACCEL_DATA_SIZE
The size of the FXLS8471Q accel data.
Definition: fxls8471q_drv.h:74

Prepare the register read list to read the raw accel data from the FXLS8471Q.

Definition at line 138 of file fxls8471_demo.c.

◆ cFxls8471q_pl_status

const registerreadlist_t cFxls8471q_pl_status[]
Initial value:
= {
{.readFrom = FXLS8471Q_PL_STATUS, .numBytes = 1}, __END_READ_DATA__}
#define __END_READ_DATA__
Definition: sensor_drv.h:77

Definition at line 147 of file fxls8471_demo.c.

◆ embAppName

char embAppName[ADS_MAX_STRING_LENGTH] = {0}

Definition at line 154 of file fxls8471_demo.c.

Referenced by main(), and process_host_command().

◆ gStreamID

uint8_t gStreamID

Definition at line 156 of file fxls8471_demo.c.

Referenced by main(), and process_host_command().

◆ gSystick

int32_t gSystick

Definition at line 157 of file fxls8471_demo.c.

Referenced by main(), and process_host_command().

◆ pGpioDriver

Definition at line 158 of file fxls8471_demo.c.

◆ shieldString

char shieldString[ADS_MAX_STRING_LENGTH] = {0}

Definition at line 153 of file fxls8471_demo.c.

Referenced by main(), and process_host_command().