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

The fxos8700_demo.c file implements the ISSDK FXOS8700 sensor driver example demonstration with interrupt mode. More...

#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "Driver_I2C.h"
#include "Driver_USART.h"
#include "issdk_hal.h"
#include "gpio_driver.h"
#include "fxos8700_drv.h"
#include "host_io_uart.h"
#include "systick_utils.h"
#include "auto_detection_service.h"
Include dependency graph for fxos8700_demo.c:

Go to the source code of this file.

Data Structures

struct  fxos8700_accelmagdataUser_t
 This structure defines the fxos8700 raw data buffer. More...
 

Macros

#define RAW_ACCEL_MAG_DATA_SIZE   12
 
#define FXOS8700_STREAM_DATA_SIZE   17
 
#define APPLICATION_NAME   "FXOS8700 6-axis (Accel, Mag) 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 fxos8700_isr_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 fxos8700_Config_InterruptHybrid []
 
const registerreadlist_t FXOS8700_ACCEL_READ []
 
const registerreadlist_t cFXOS8700_int_src []
 
const registerreadlist_t cFXOS8700_ffmt_src []
 
const registerreadlist_t cFXOS8700_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 bFxos8700DataReady = false
 
volatile bool bFxos8700Ready = false
 
uint8_t gStreamID
 
int32_t gSystick
 
GENERIC_DRIVER_GPIOpGpioDriver = &Driver_GPIO_KSDK
 

Detailed Description

The fxos8700_demo.c file implements the ISSDK FXOS8700 sensor driver example demonstration with interrupt mode.

The fxos8700_demo.c file implements the ISSDK FXOS8700 sensor driver example demonstration with Poll mode.

Definition in file fxos8700_demo.c.

Macro Definition Documentation

◆ APPLICATION_NAME

#define APPLICATION_NAME   "FXOS8700 6-axis (Accel, Mag) Demo"

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

Definition at line 71 of file fxos8700_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 73 of file fxos8700_demo.c.

Referenced by main().

◆ FXOS8700_STREAM_DATA_SIZE

#define FXOS8700_STREAM_DATA_SIZE   17

Definition at line 68 of file fxos8700_demo.c.

Referenced by main().

◆ RAW_ACCEL_MAG_DATA_SIZE

#define RAW_ACCEL_MAG_DATA_SIZE   12

Definition at line 67 of file fxos8700_demo.c.

Referenced by main().

Function Documentation

◆ fxos8700_isr_callback()

void fxos8700_isr_callback ( void *  pUserData)

Set flag to indicate Sensor has signalled data ready.

Definition at line 167 of file fxos8700_demo.c.

References bFxos8700DataReady.

Referenced by main().

Here is the caller graph for this function:

◆ main()

int main ( void  )

Main function.

Initialize the MCU hardware.

Initialize INT1_FXAS21002 pin used by FRDM board

Initialize RGB LED pin used by FRDM board

Initialize the I2C driver.

Set the I2C Power mode.

Set the I2C bus speed.

Initialize the UART driver.

Set the UART Power mode.

Set UART Baud Rate.

Initialize the FXOS8700 sensor driver.

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

Configure the fxos8700 sensor driver.

Initialize streaming and assign a Stream ID.

Populate streaming header.

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

Read the raw sensor data from the fxos8700.

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

Definition at line 256 of file fxos8700_demo.c.

References fxos8700_accelmagdataUser_t::accel, ADS_MAX_STRING_LENGTH, APPLICATION_NAME, APPLICATION_VERSION, bFxos8700DataReady, bFxos8700Ready, BOARD_BootClockRUN, BOARD_DEBUG_UART_BAUDRATE, BOARD_RunADS(), BOARD_SystickElapsedTime_us(), BOARD_SystickEnable(), boardString, bStreamingEnabled, GENERIC_DRIVER_GPIO::clr_pin, data, fxos8700_i2c_sensorhandle_t::deviceInfo, embAppName, FXOS8700_I2C_ADDR, FXOS8700_I2C_Configure(), FXOS8700_I2C_Initialize(), FXOS8700_I2C_ReadData(), FXOS8700_I2C_SetIdleTask(), FXOS8700_INT2, fxos8700_isr_callback(), FXOS8700_STREAM_DATA_SIZE, FXOS8700_WHO_AM_I_PROD_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, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, int32_t(), fxos8700_accelmagdataUser_t::intsrc, fxos8700_accelmagdataUser_t::mag, fxos8700_i2c_sensorhandle_t::pCommDrv, GENERIC_DRIVER_GPIO::pin_init, process_host_command(), RAW_ACCEL_MAG_DATA_SIZE, rawData, SENSOR_ERROR_NONE, SHIELD_NAME, shieldString, SMC, SMC_SetPowerModeWait(), status, STREAMING_HEADER_LEN, streamingPacket, fxos8700_accelmagdataUser_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

◆ bFxos8700DataReady

volatile bool bFxos8700DataReady = false

Definition at line 158 of file fxos8700_demo.c.

Referenced by fxos8700_isr_callback(), and main().

◆ bFxos8700Ready

volatile bool bFxos8700Ready = false

Definition at line 158 of file fxos8700_demo.c.

Referenced by main(), and process_host_command().

◆ boardString

char boardString[ADS_MAX_STRING_LENGTH] = {0}

Definition at line 156 of file fxos8700_demo.c.

Referenced by main(), and process_host_command().

◆ bStreamingEnabled

volatile bool bStreamingEnabled = false

Definition at line 158 of file fxos8700_demo.c.

Referenced by main(), and process_host_command().

◆ cFXOS8700_ffmt_src

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

Definition at line 147 of file fxos8700_demo.c.

◆ cFXOS8700_int_src

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

Definition at line 144 of file fxos8700_demo.c.

◆ cFXOS8700_pl_status

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

Definition at line 150 of file fxos8700_demo.c.

◆ embAppName

char embAppName[ADS_MAX_STRING_LENGTH] = {0}

Definition at line 157 of file fxos8700_demo.c.

Referenced by main(), and process_host_command().

◆ FXOS8700_ACCEL_READ

const registerreadlist_t FXOS8700_ACCEL_READ[]
Initial value:
= {
#define __END_READ_DATA__
Definition: sensor_drv.h:77
#define RAW_ACCEL_MAG_DATA_SIZE
Definition: fxos8700_demo.c:67

Command definition to read the Accel+Mag Data

Definition at line 141 of file fxos8700_demo.c.

◆ fxos8700_Config_InterruptHybrid

const registerwritelist_t fxos8700_Config_InterruptHybrid[]

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

Definition at line 88 of file fxos8700_demo.c.

◆ gStreamID

uint8_t gStreamID

Definition at line 159 of file fxos8700_demo.c.

Referenced by main(), and process_host_command().

◆ gSystick

int32_t gSystick

Definition at line 160 of file fxos8700_demo.c.

Referenced by main(), and process_host_command().

◆ pGpioDriver

Definition at line 161 of file fxos8700_demo.c.

◆ shieldString

char shieldString[ADS_MAX_STRING_LENGTH] = {0}

Definition at line 156 of file fxos8700_demo.c.

Referenced by main(), and process_host_command().