![]() |
ISSDK
1.8
IoT Sensing Software Development Kit
|
The fxls8962_demo.c file implements the ISSDK FXLS8962 sensor demo 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 "fxls8962_drv.h"
#include "host_io_uart.h"
#include "systick_utils.h"
#include "auto_detection_service.h"
Go to the source code of this file.
Data Structures | |
struct | fxls8962_acceldataUser_t |
This structure defines the fxls8962 raw data buffer. More... | |
Macros | |
#define | FXLS8962_DATA_SIZE 8 |
#define | FXLS8962_STREAM_DATA_SIZE 12 |
#define | FXLS8962_STREAM_SELF_TEST_SIZE 18 |
#define | APPLICATION_NAME "FXLS8962 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... | |
#define | HOST_CMD_RESET 6 /* 6 (Reset Sensor) */ |
#define | HOST_CMD_SELFTEST 7 /* 7 (Self Test Sensor) */ |
Functions | |
void | fxls8962_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... | |
The fxls8962_demo.c file implements the ISSDK FXLS8962 sensor demo example demonstration with interrupt mode.
Definition in file fxls8962_demo.c.
#define APPLICATION_NAME "FXLS8962 Accelerometer Demo" |
Unique Name for this application which should match the target GUI pkg name.
Definition at line 45 of file fxls8962_demo.c.
Referenced by main().
#define APPLICATION_VERSION "2.5" |
Version to distinguish between instances the same application based on target Shield and updates.
Definition at line 47 of file fxls8962_demo.c.
Referenced by main().
#define FXLS8962_DATA_SIZE 8 |
Definition at line 41 of file fxls8962_demo.c.
Referenced by main().
#define FXLS8962_STREAM_DATA_SIZE 12 |
Definition at line 42 of file fxls8962_demo.c.
Referenced by main().
#define FXLS8962_STREAM_SELF_TEST_SIZE 18 |
Definition at line 43 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
#define HOST_CMD_RESET 6 /* 6 (Reset Sensor) */ |
Definition at line 48 of file fxls8962_demo.c.
Referenced by process_host_command().
#define HOST_CMD_SELFTEST 7 /* 7 (Self Test Sensor) */ |
Definition at line 49 of file fxls8962_demo.c.
Referenced by process_host_command().
void fxls8962_int_data_ready_callback | ( | void * | pUserData | ) |
Set flag to indicate Sensor has signalled data ready.
Definition at line 186 of file fxls8962_demo.c.
References bFxls8962DataReady.
Referenced by main().
int main | ( | void | ) |
Main function.
Initialize the MCU hardware.
Initialize FXLS8962 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 FXLS8962 sensor driver.
Set the task to be executed while waiting for I2C transactions to complete.
Configure the FXLS8962 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 FXLS8962.
Convert the raw sensor data to signed 16-bit container for display to the debug port.
Clear the data ready flag, it will be set again by the ISR.
Read new raw sensor data from the FXLS8962.
Convert the raw sensor data to signed 16-bit container for display to the debug port.
Definition at line 378 of file fxls8962_demo.c.
References fxls8962_acceldataUser_t::accel, ADS_MAX_STRING_LENGTH, APPLICATION_NAME, APPLICATION_VERSION, bFxls8962DataReady, bFxls8962Ready, BOARD_BootClockRUN, BOARD_DEBUG_UART_BAUDRATE, BOARD_RunADS(), BOARD_SystickElapsedTime_us(), BOARD_SystickEnable(), boardString, bStreamingEnabled, GENERIC_DRIVER_GPIO::clr_pin, data, fxls8962_i2c_sensorhandle_t::deviceInfo, embAppName, FXLS8962_DATA_SIZE, FXLS8962_I2C_ADDR, FXLS8962_I2C_Configure(), FXLS8962_I2C_Initialize(), FXLS8962_I2C_ReadData(), FXLS8962_I2C_SetIdleTask(), FXLS8962_INT1, fxls8962_int_data_ready_callback(), FXLS8962_STREAM_DATA_SIZE, FXLS8962_STREAM_SELF_TEST_SIZE, FXLS8962_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, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, int32_t(), fxls8962_i2c_sensorhandle_t::pCommDrv, GENERIC_DRIVER_GPIO::pin_init, process_host_command(), Register_I2C_Write(), fxls8962_acceldataUser_t::sdcd, fxls8962_acceldataUser_t::selftest, SENSOR_ERROR_NONE, SHIELD_NAME, shieldString, SMC, SMC_SetPowerModeVlpr(), SMC_SetPowerModeWait(), st_on, st_sample, st_xn, st_xp, st_yn, st_yp, st_zn, st_zp, status, STREAMING_HEADER_LEN, streamingPacket, streamingPacket1, fxls8962_acceldataUser_t::temp, fxls8962_acceldataUser_t::timestamp, and GENERIC_DRIVER_GPIO::toggle_pin.
bool process_host_command | ( | uint8_t | tag, |
uint8_t * | hostCommand, | ||
uint8_t * | hostResponse, | ||
size_t * | hostMsgSize, | ||
size_t | respBufferSize | ||
) |
Definition at line 192 of file fxls8962_demo.c.
References bFxls8962Ready, BOARD_SystickStart(), boardString, bStreamingEnabled, GENERIC_DRIVER_GPIO::clr_pin, embAppName, fsr_scale, FXLS8962_I2C_ADDR, FXLS8962_I2C_Configure(), FXLS8962_I2C_DeInit(), FXLS8962_I2C_Initialize(), FXLS8962_STREAM_SELF_TEST_SIZE, FXLS8962_WHOAMI_VALUE, GREEN_LED, gStreamID, gSystick, HOST_CMD_RESET, HOST_CMD_SELFTEST, HOST_CMD_START, HOST_CMD_STOP, HOST_FORMAT_HDLC, Host_IO_Send(), HOST_MSG_CMD_ACT_OFFSET, HOST_MSG_LEN_LSB_OFFSET, HOST_PRO_CMD_R_REG_TAG, HOST_PRO_CMD_W_CFG_TAG, HOST_PRO_CMD_W_REG_TAG, HOST_PRO_INT_CMD_TAG, HOST_PRO_INT_DEV_TAG, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, fxls8962_acceldataUser_t::selftest, SENSOR_ERROR_NONE, shieldString, st_on, st_sample, status, STREAMING_HEADER_LEN, and streamingPacket1.
Referenced by main().
volatile bool bFxls8962DataReady = false |
Definition at line 171 of file fxls8962_demo.c.
Referenced by fxls8962_int_data_ready_callback(), and main().
volatile bool bFxls8962Ready = false |
Definition at line 171 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
char boardString[ADS_MAX_STRING_LENGTH] = {0} |
Definition at line 169 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
volatile bool bStreamingEnabled = false |
Definition at line 171 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
const registerwritelist_t cFxls896216G[] |
Definition at line 101 of file fxls8962_demo.c.
const registerwritelist_t cFxls8962ConfigNormal[] |
Register settings for Interrupt (non buffered) mode.
Definition at line 65 of file fxls8962_demo.c.
const registerwritelist_t cFxls8962ConfigNormal2[] |
Register settings for Interrupt (non buffered) mode.
Definition at line 88 of file fxls8962_demo.c.
const registerreadlist_t cFxls8962OutputNormal[] |
Address of Raw Accel Data in Normal Mode.
Definition at line 163 of file fxls8962_demo.c.
const registerwritelist_t cFxls8962STXN[] |
Register settings for Self-Test in X Axis (Negative polarity).
Definition at line 123 of file fxls8962_demo.c.
const registerwritelist_t cFxls8962STXP[] |
Register settings for Self-Test in X Axis (Positive polarity).
Definition at line 115 of file fxls8962_demo.c.
const registerwritelist_t cFxls8962STYN[] |
Register settings for Self-Test in Y Axis (Negative polarity).
Definition at line 139 of file fxls8962_demo.c.
const registerwritelist_t cFxls8962STYP[] |
Register settings for Self-Test in Y Axis (Positive polarity).
Definition at line 131 of file fxls8962_demo.c.
const registerwritelist_t cFxls8962STZN[] |
Register settings for Self-Test in Z Axis (Negative polarity).
Definition at line 155 of file fxls8962_demo.c.
const registerwritelist_t cFxls8962STZP[] |
Register settings for Self-Test in Z Axis (Positive polarity).
Definition at line 147 of file fxls8962_demo.c.
uint8_t data[FXLS8962_DATA_SIZE] |
Definition at line 174 of file fxls8962_demo.c.
Referenced by BOARD_ConfigMPU(), BOARD_InitDebugConsole(), BOARD_InitDebugConsole_Core1(), CONTROL_UART_IRQHandler(), JSON_BlockDataRead_BlockingCall(), main(), WIRED_UART_IRQHandler(), WIRED_USART_IRQHandler(), WIRELESS_UART_IRQHandler(), and zeroArray().
char embAppName[ADS_MAX_STRING_LENGTH] = {0} |
Definition at line 170 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
float fsr_scale |
Definition at line 180 of file fxls8962_demo.c.
Referenced by process_host_command().
fxls8962_i2c_sensorhandle_t fxls8962Driver |
Definition at line 176 of file fxls8962_demo.c.
Referenced by main().
uint8_t gStreamID |
Definition at line 172 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
int32_t gSystick |
Definition at line 177 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
GENERIC_DRIVER_GPIO* pGpioDriver = &Driver_GPIO_KSDK |
Definition at line 173 of file fxls8962_demo.c.
fxls8962_acceldataUser_t rawData = {.timestamp = 0} |
Definition at line 175 of file fxls8962_demo.c.
char shieldString[ADS_MAX_STRING_LENGTH] = {0} |
Definition at line 169 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
int16_t st_dx |
Definition at line 179 of file fxls8962_demo.c.
int16_t st_dy |
Definition at line 179 of file fxls8962_demo.c.
int st_on =0 |
Definition at line 178 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
int st_sample =0 |
Definition at line 178 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
int16_t st_xn |
Definition at line 179 of file fxls8962_demo.c.
Referenced by main().
int16_t st_xp |
Definition at line 179 of file fxls8962_demo.c.
Referenced by main().
int16_t st_yn |
Definition at line 179 of file fxls8962_demo.c.
Referenced by main().
int16_t st_yp |
Definition at line 179 of file fxls8962_demo.c.
Referenced by main().
int16_t st_zn |
Definition at line 179 of file fxls8962_demo.c.
Referenced by main().
int16_t st_zp |
Definition at line 179 of file fxls8962_demo.c.
Referenced by main().
int32_t status |
Definition at line 177 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().
uint8_t streamingPacket[STREAMING_HEADER_LEN+FXLS8962_STREAM_DATA_SIZE] |
Definition at line 174 of file fxls8962_demo.c.
Referenced by main().
uint8_t streamingPacket1[STREAMING_HEADER_LEN+FXLS8962_STREAM_SELF_TEST_SIZE] |
Definition at line 174 of file fxls8962_demo.c.
Referenced by main(), and process_host_command().