![]() |
ISSDK
1.7
IoT Sensing Software Development Kit
|
The diff_p_demo.c file implements the ISSDK DIFF_P 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 "diff_p_drv.h"
#include "host_io_uart.h"
#include "systick_utils.h"
#include "auto_detection_service.h"
Go to the source code of this file.
Macros | |
#define | DIFF_P_DATA_SIZE (3) /* 2 byte Pressure and 1 byte Temperature. */ |
#define | DIFF_P_STREAM_DATA_SIZE (7) /* 7 byte Data */ |
#define | APPLICATION_NAME "NPS300x Differential Pressure 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 | diffp_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 | cDiffPConfigNormal [] |
Register settings for Normal (non buffered) mode. More... | |
const registerwritelist_t | cDiffPClearStatusBits [] |
Register settings for Clearing Pressure and Temperature Data Ready Bits. More... | |
const registerreadlist_t | cDiffPStatus [] = {{.readFrom = DIFF_P_INT_STATUS_0, .numBytes = 1}, __END_READ_DATA__} |
Address of Status Register. More... | |
const registerreadlist_t | cDiffPOutputNormal [] |
Address and size of Raw Pressure+Temperature Data in Normal Mode. More... | |
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 | bDiffPDataReady = false |
volatile bool | bDiffPReady = false |
uint8_t | gStreamID |
int32_t | gSystick |
GENERIC_DRIVER_GPIO * | pGpioDriver = &Driver_GPIO_KSDK |
The diff_p_demo.c file implements the ISSDK DIFF_P sensor driver example demonstration with Interrupt mode.
Definition in file diff_p_demo.c.
#define APPLICATION_NAME "NPS300x Differential Pressure Demo" |
Unique Name for this application which should match the target GUI pkg name.
Definition at line 71 of file diff_p_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 73 of file diff_p_demo.c.
Referenced by main().
Definition at line 67 of file diff_p_demo.c.
Referenced by main().
#define DIFF_P_STREAM_DATA_SIZE (7) /* 7 byte Data */ |
Definition at line 68 of file diff_p_demo.c.
Referenced by main().
void diffp_int_data_ready_callback | ( | void * | pUserData | ) |
Set flag to indicate Sensor has signalled data ready.
Definition at line 111 of file diff_p_demo.c.
References bDiffPDataReady.
Referenced by main().
int main | ( | void | ) |
Main function.
Initialize the MCU hardware.
Initialize INT1 DIFF_P 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.
Initialize DIFF_P sensor driver.
Configure the DIFF_P sensor.
Initialize streaming and assign a Stream ID.
Populate streaming header.
Clear the data ready flag, it will be set again by the ISR.
Check for both data ready bits from the DIFF_P.
If samples available, explicitly clear the Status Bits.
Read new raw sensor data from the DIFF_P.
Process the sample and convert the raw sensor data.
Definition at line 200 of file diff_p_demo.c.
References ADS_MAX_STRING_LENGTH, APPLICATION_NAME, APPLICATION_VERSION, bDiffPDataReady, bDiffPReady, BOARD_BootClockRUN, BOARD_DEBUG_UART_BAUDRATE, BOARD_RunADS(), BOARD_SystickElapsedTime_us(), BOARD_SystickEnable(), boardString, bStreamingEnabled, GENERIC_DRIVER_GPIO::clr_pin, data, diff_p_i2c_sensorhandle_t::deviceInfo, DIFF_P_DATA_SIZE, DIFF_P_I2C_ADDR, DIFF_P_I2C_Configure(), DIFF_P_I2C_Initialize(), DIFF_P_I2C_ReadData(), DIFF_P_INT1, DIFF_P_INT_STATUS_0_PDR_DRDY, DIFF_P_INT_STATUS_0_PDR_MASK, DIFF_P_INT_STATUS_0_TDR_DRDY, DIFF_P_INT_STATUS_0_TDR_MASK, DIFF_P_NPS3000VV_WHOAMI_VALUE, DIFF_P_NPS3001DV_WHOAMI_VALUE, DIFF_P_NPS3002VV_WHOAMI_VALUE, DIFF_P_NPS3005DV_WHOAMI_VALUE, DIFF_P_STREAM_DATA_SIZE, diffp_int_data_ready_callback(), embAppName, 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(), diff_p_i2c_sensorhandle_t::pCommDrv, GENERIC_DRIVER_GPIO::pin_init, diff_p_pressuredata_t::pressure, process_host_command(), rawData, SENSOR_ERROR_NONE, Sensor_I2C_Write(), SHIELD_NAME, shieldString, diff_p_i2c_sensorhandle_t::slaveAddress, SMC, SMC_SetPowerModeWait(), status, STREAMING_HEADER_LEN, streamingPacket, diff_p_pressuredata_t::temperature, fxls8962_acceldataUser_t::timestamp, diff_p_pressuredata_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 117 of file diff_p_demo.c.
References bDiffPReady, BOARD_SystickStart(), boardString, bStreamingEnabled, GENERIC_DRIVER_GPIO::clr_pin, embAppName, GREEN_LED, gStreamID, gSystick, 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, and shieldString.
Referenced by main().
volatile bool bDiffPDataReady = false |
Definition at line 102 of file diff_p_demo.c.
Referenced by diffp_int_data_ready_callback(), and main().
volatile bool bDiffPReady = false |
Definition at line 102 of file diff_p_demo.c.
Referenced by main(), and process_host_command().
char boardString[ADS_MAX_STRING_LENGTH] = {0} |
Definition at line 100 of file diff_p_demo.c.
Referenced by main(), and process_host_command().
volatile bool bStreamingEnabled = false |
Definition at line 102 of file diff_p_demo.c.
Referenced by main(), and process_host_command().
const registerwritelist_t cDiffPClearStatusBits[] |
Register settings for Clearing Pressure and Temperature Data Ready Bits.
Definition at line 87 of file diff_p_demo.c.
const registerwritelist_t cDiffPConfigNormal[] |
Register settings for Normal (non buffered) mode.
Definition at line 79 of file diff_p_demo.c.
const registerreadlist_t cDiffPOutputNormal[] |
Address and size of Raw Pressure+Temperature Data in Normal Mode.
Definition at line 94 of file diff_p_demo.c.
const registerreadlist_t cDiffPStatus[] = {{.readFrom = DIFF_P_INT_STATUS_0, .numBytes = 1}, __END_READ_DATA__} |
Address of Status Register.
Definition at line 91 of file diff_p_demo.c.
char embAppName[ADS_MAX_STRING_LENGTH] = {0} |
Definition at line 101 of file diff_p_demo.c.
Referenced by main(), and process_host_command().
uint8_t gStreamID |
Definition at line 103 of file diff_p_demo.c.
Referenced by main(), and process_host_command().
int32_t gSystick |
Definition at line 104 of file diff_p_demo.c.
Referenced by main(), and process_host_command().
GENERIC_DRIVER_GPIO* pGpioDriver = &Driver_GPIO_KSDK |
Definition at line 105 of file diff_p_demo.c.
char shieldString[ADS_MAX_STRING_LENGTH] = {0} |
Definition at line 100 of file diff_p_demo.c.
Referenced by main(), and process_host_command().