![]() |
ISSDK
1.7
IoT Sensing Software Development Kit
|
The fxlc95000_flash_demo.c file implements the ISSDK FXLC95000L sensor driver example demonstration for FLASH programming and Streaming for I2C Mode using Host I/O. More...
#include "board.h"
#include "pin_mux.h"
#include "fsl_lptmr.h"
#include "clock_config.h"
#include "Driver_I2C.h"
#include "Driver_USART.h"
#include "issdk_hal.h"
#include "gpio_driver.h"
#include "host_io_uart.h"
#include "systick_utils.h"
#include "fxlc95000_drv.h"
#include "auto_detection_service.h"
Go to the source code of this file.
Macros | |
#define | fxlc95000_odrCallback LPTMR0_IRQHandler /* Timer timeout Callback. */ |
#define | SAMPLING_RATE_ms 100 /* Timeout for the ODR Timer in ms. */ |
#define | FXLC95000_SAMPLE_SIZE 10 /* 4-Byte timestamp and 2-Byte X,Y,Z Data each. */ |
#define | APPLICATION_NAME "FXLC95000 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 | fxlc95000_odrCallback (void) |
int | fxlc95000_enSensor (fxlc95000_i2c_sensorhandle_t *pSensorHandle) |
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 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 registercommandlist_t | cFxlc95000FlashPreprocess [] |
const registercommandlist_t | cFxlc95000FlashPostprocess [] |
const registerreadlist_t | cFxlc95000ReadSample [] |
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 | bFxlc95000DataReady = false |
volatile bool | bFxlc95000Ready = false |
volatile bool | bFxlc95000Boot = false |
volatile bool | bFxlc95000Flashing = false |
fxlc95000_i2c_sensorhandle_t | fxlc95000Driver |
uint8_t | gStreamID |
GENERIC_DRIVER_GPIO * | pGpioDriver = &Driver_GPIO_KSDK |
The fxlc95000_flash_demo.c file implements the ISSDK FXLC95000L sensor driver example demonstration for FLASH programming and Streaming for I2C Mode using Host I/O.
Definition in file fxlc95000_flash_demo.c.
#define APPLICATION_NAME "FXLC95000 Accelerometer Demo" |
Unique Name for this application which should match the target GUI pkg name.
Definition at line 73 of file fxlc95000_flash_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 75 of file fxlc95000_flash_demo.c.
Referenced by main().
#define fxlc95000_odrCallback LPTMR0_IRQHandler /* Timer timeout Callback. */ |
Definition at line 68 of file fxlc95000_flash_demo.c.
#define FXLC95000_SAMPLE_SIZE 10 /* 4-Byte timestamp and 2-Byte X,Y,Z Data each. */ |
Definition at line 70 of file fxlc95000_flash_demo.c.
Referenced by main().
#define SAMPLING_RATE_ms 100 /* Timeout for the ODR Timer in ms. */ |
Definition at line 69 of file fxlc95000_flash_demo.c.
Referenced by main().
int fxlc95000_enSensor | ( | fxlc95000_i2c_sensorhandle_t * | pSensorHandle | ) |
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.
Definition at line 144 of file fxlc95000_flash_demo.c.
References bFxlc95000Boot, GENERIC_DRIVER_GPIO::clr_pin, FXLC95000_BUILD_ID, FXLC95000_I2C_ADDR, FXLC95000_I2C_CommandResponse(), FXLC95000_I2C_Initialize(), FXLC95000_I2C_SetIdleTask(), GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, int32_t(), RED_LED, SENSOR_ERROR_NONE, GENERIC_DRIVER_GPIO::set_pin, SMC, SMC_SetPowerModeWait(), and status.
Referenced by process_host_command().
void fxlc95000_odrCallback | ( | void | ) |
Definition at line 137 of file fxlc95000_flash_demo.c.
References bFxlc95000DataReady.
int main | ( | void | ) |
Main function.
Initialize the MCU hardware.
Initialize RED LED pin used by FRDM board
Initialize GREEN 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.
Register with Host I/O Service and get a Stream ID.
Populate streaming header.
Clear the data ready flag, it will be set again by the ISR.
Read raw sensor data from the FXLC95000.
Definition at line 336 of file fxlc95000_flash_demo.c.
References ADS_MAX_STRING_LENGTH, APPLICATION_NAME, APPLICATION_VERSION, bFxlc95000DataReady, BOARD_BootClockRUN, BOARD_DEBUG_UART_BAUDRATE, BOARD_RunADS(), BOARD_SystickEnable(), boardString, bStreamingEnabled, GENERIC_DRIVER_GPIO::clr_pin, fxlc95000_i2c_sensorhandle_t::deviceInfo, embAppName, FXLC95000_I2C_ADDR, FXLC95000_I2C_CommandResponse(), FXLC95000_SAMPLE_SIZE, GPIO_DIRECTION_OUT, GREEN_LED, gStreamID, 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_DRIVER, I2C_S_SIGNAL_EVENT, int32_t(), GENERIC_DRIVER_GPIO::pin_init, process_host_command(), RED_LED, SAMPLING_RATE_ms, GENERIC_DRIVER_GPIO::set_pin, SHIELD_NAME, shieldString, SMC, SMC_SetPowerModeWait(), status, STREAMING_HEADER_LEN, streamingPacket, 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 | ||
) |
Write Flash Preprocess Commands.
Write Flash Data Bytes.
Write Flash Postprocess Commands.
Definition at line 180 of file fxlc95000_flash_demo.c.
References bFxlc95000Boot, bFxlc95000Flashing, boardString, bStreamingEnabled, GENERIC_DRIVER_GPIO::clr_pin, embAppName, fxlc95000_enSensor(), FXLC95000_I2C_ADDR, FXLC95000_I2C_CheckRomMode(), FXLC95000_I2C_FlashCommands(), FXLC95000_I2C_FlashPayload(), GREEN_LED, gStreamID, HOST_CMD_FLASH_BYTES, HOST_CMD_FLASH_START, HOST_CMD_FLASH_STOP, HOST_CMD_START, HOST_CMD_STOP, HOST_MSG_CMD_ACT_OFFSET, HOST_MSG_LEN_LSB_OFFSET, HOST_PRO_CMD_W_CFG_TAG, HOST_PRO_INT_CMD_TAG, HOST_PRO_INT_DEV_TAG, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, RED_LED, SENSOR_ERROR_NONE, GENERIC_DRIVER_GPIO::set_pin, shieldString, and GENERIC_DRIVER_GPIO::toggle_pin.
Referenced by main().
volatile bool bFxlc95000Boot = false |
Definition at line 126 of file fxlc95000_flash_demo.c.
Referenced by fxlc95000_enSensor(), and process_host_command().
volatile bool bFxlc95000DataReady = false |
Definition at line 126 of file fxlc95000_flash_demo.c.
Referenced by fxlc95000_odrCallback(), and main().
volatile bool bFxlc95000Flashing = false |
Definition at line 127 of file fxlc95000_flash_demo.c.
Referenced by process_host_command().
volatile bool bFxlc95000Ready = false |
Definition at line 126 of file fxlc95000_flash_demo.c.
char boardString[ADS_MAX_STRING_LENGTH] = {0} |
Definition at line 124 of file fxlc95000_flash_demo.c.
Referenced by main(), and process_host_command().
volatile bool bStreamingEnabled = false |
Definition at line 126 of file fxlc95000_flash_demo.c.
Referenced by main(), and process_host_command().
const uint8_t cFxlc95000_SetODR_Cmd[] |
Create commands for setting FXLC95000L desired configuration.
Definition at line 81 of file fxlc95000_flash_demo.c.
const uint8_t cFxlc95000_SetRange_Cmd[] |
Definition at line 85 of file fxlc95000_flash_demo.c.
const uint8_t cFxlc95000_SetResolution_Cmd[] |
Definition at line 83 of file fxlc95000_flash_demo.c.
const registercommandlist_t cFxlc95000ConfigMBox[] |
Prepare the register write list to initialize FXLC95000L with desired MBox Settings.
Definition at line 89 of file fxlc95000_flash_demo.c.
const registercommandlist_t cFxlc95000ConfigSensor[] |
Prepare the register write list to configure FXLC95000L with desired Sampling Settings.
Definition at line 96 of file fxlc95000_flash_demo.c.
const registercommandlist_t cFxlc95000FlashPostprocess[] |
Prepare the register write list with Flash Postprocess Commands.
Definition at line 112 of file fxlc95000_flash_demo.c.
const registercommandlist_t cFxlc95000FlashPreprocess[] |
Prepare the register write list with Flash Preprocess Commands.
Definition at line 105 of file fxlc95000_flash_demo.c.
const registerreadlist_t cFxlc95000ReadSample[] |
Prepare the register read list to read the Timestamp and Accel data from FXLC95000.
Definition at line 118 of file fxlc95000_flash_demo.c.
char embAppName[ADS_MAX_STRING_LENGTH] = {0} |
Definition at line 125 of file fxlc95000_flash_demo.c.
Referenced by main(), and process_host_command().
fxlc95000_i2c_sensorhandle_t fxlc95000Driver |
Definition at line 128 of file fxlc95000_flash_demo.c.
Referenced by main().
uint8_t gStreamID |
Definition at line 130 of file fxlc95000_flash_demo.c.
Referenced by main(), and process_host_command().
GENERIC_DRIVER_GPIO* pGpioDriver = &Driver_GPIO_KSDK |
Definition at line 131 of file fxlc95000_flash_demo.c.
char shieldString[ADS_MAX_STRING_LENGTH] = {0} |
Definition at line 124 of file fxlc95000_flash_demo.c.
Referenced by main(), and process_host_command().