46 #include "clock_config.h" 51 #include "Driver_I2C.h" 52 #include "Driver_USART.h" 57 #include "issdk_hal.h" 58 #include "gpio_driver.h" 62 #include "auto_detection_service.h" 67 #define DIFF_P_DATA_SIZE (3) 68 #define DIFF_P_STREAM_DATA_SIZE (7) 71 #define APPLICATION_NAME "NPS300x Differential Pressure Demo" 73 #define APPLICATION_VERSION "2.5" 118 uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse,
size_t *hostMsgSize,
size_t respBufferSize)
120 bool success =
false;
135 if (respBufferSize >= boardNameLen + shieldNameLen + appNameLen + 3)
144 hostResponse[*hostMsgSize] = appNameLen;
147 memcpy(hostResponse + *hostMsgSize,
embAppName, appNameLen);
148 *hostMsgSize += appNameLen;
150 hostResponse[*hostMsgSize] = boardNameLen;
153 memcpy(hostResponse + *hostMsgSize,
boardString, boardNameLen);
154 *hostMsgSize += boardNameLen;
156 hostResponse[*hostMsgSize] = shieldNameLen;
159 memcpy(hostResponse + *hostMsgSize,
shieldString, shieldNameLen);
160 *hostMsgSize += shieldNameLen;
170 switch (hostCommand[0])
232 if (ARM_DRIVER_OK != status)
238 status = pI2cDriver->PowerControl(ARM_POWER_FULL);
239 if (ARM_DRIVER_OK != status)
245 status = pI2cDriver->Control(ARM_I2C_BUS_SPEED, ARM_I2C_BUS_SPEED_FAST);
246 if (ARM_DRIVER_OK != status)
253 if (ARM_DRIVER_OK != status)
259 status = pUartDriver->PowerControl(ARM_POWER_FULL);
260 if (ARM_DRIVER_OK != status)
267 if (ARM_DRIVER_OK != status)
348 if (ARM_DRIVER_OK != status)
362 cDiffPClearStatusBits);
363 if (ARM_DRIVER_OK != status)
371 if (ARM_DRIVER_OK != status)
380 rawData.
pressure = ((int16_t)(data[1]) << 8) | data[0];
This defines the sensor specific information for I2C.
uint32_t BOARD_SystickElapsedTime_us(int32_t *pStart)
Function to compute the Elapsed Time.
#define DIFF_P_INT_MASK0_PDR_INT_EN
#define DIFF_P_INT_MASK0_TDR_MASK
#define __END_WRITE_DATA__
#define HOST_PRO_CMD_W_CFG_TAG
#define DIFF_P_CTRL_REG2_ODR_MASK
#define HOST_S_SIGNAL_EVENT
int32_t DIFF_P_I2C_Configure(diff_p_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
void Host_IO_Receive(host_cmd_proc_fn_t process_host_command, uint8_t encoding)
void(* pin_init)(pinID_t aPinId, gpio_direction_t dir, void *apPinConfig, gpio_isr_handler_t aIsrHandler, void *apUserData)
#define DIFF_P_CTRL_REG2_ODR_ODR0P781
#define BOARD_BootClockRUN
#define DIFF_P_INT_STATUS_0_PDR_DRDY
uint8_t data[FXLS8962_DATA_SIZE]
void(* toggle_pin)(pinID_t aPinId)
int32_t DIFF_P_I2C_ReadData(diff_p_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
volatile bool bStreamingEnabled
#define ADS_MAX_STRING_LENGTH
char boardString[ADS_MAX_STRING_LENGTH]
#define HOST_PRO_INT_DEV_TAG
uint8_t streamingPacket[STREAMING_HEADER_LEN+FXLS8962_STREAM_DATA_SIZE]
#define APPLICATION_VERSION
Version to distinguish between instances the same application based on target Shield and updates...
#define HOST_PRO_INT_CMD_TAG
Bit aligned values for Host Protocol Interface IDs (Bits 5-6).
int main(void)
Main function.
#define DIFF_P_NPS3001DV_WHOAMI_VALUE
#define APPLICATION_NAME
Unique Name for this application which should match the target GUI pkg name.
#define __END_READ_DATA__
registerDeviceInfo_t deviceInfo
int32_t DIFF_P_I2C_Initialize(diff_p_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
The diff_p_drv.h file describes the DIFF_P driver interface and structures.
const registerreadlist_t cDiffPOutputNormal[]
Address and size of Raw Pressure+Temperature Data in Normal Mode.
#define DIFF_P_INT_STATUS_0_PDR_MASK
GENERIC_DRIVER_GPIO * pGpioDriver
gpioHandleKSDK_t GREEN_LED
#define DIFF_P_STREAM_DATA_SIZE
void Host_IO_Add_ISO_Header(uint8_t streamID, uint8_t *pStreamingPacket, size_t sizePayload)
void Host_IO_Send(uint8_t *pMsg, size_t size, uint8_t encoding)
void(* clr_pin)(pinID_t aPinId)
char embAppName[ADS_MAX_STRING_LENGTH]
void BOARD_SystickEnable(void)
Function to enable systicks framework.
volatile bool bDiffPReady
#define I2C_S_DEVICE_INDEX
#define DIFF_P_INT_STATUS_0_TDR_MASK
#define DIFF_P_NPS3000VV_WHOAMI_VALUE
GENERIC_DRIVER_GPIO Driver_GPIO_KSDK
This structure defines the diff_p data buffer in Pressure Mode.
const registerwritelist_t cDiffPConfigNormal[]
Register settings for Normal (non buffered) mode.
#define BOARD_DEBUG_UART_BAUDRATE
#define DIFF_P_CTRL_REG3_IPOL1_ACTIVE_HIGH
Access structure of the GPIO Driver.
void BOARD_SystickStart(int32_t *pStart)
Function to Record the Start systick.
ARM_DRIVER_I2C * pCommDrv
volatile bool bDiffPDataReady
void diffp_int_data_ready_callback(void *pUserData)
void BOARD_RunADS(const char *appName, char *boardString, char *shieldString, size_t bufferLength)
The function to register Application Name and initialte ADS.
const registerwritelist_t cDiffPClearStatusBits[]
Register settings for Clearing Pressure and Temperature Data Ready Bits.
#define DIFF_P_INT_MASK0_PDR_MASK
fxls8962_acceldataUser_t rawData
#define DIFF_P_NPS3002VV_WHOAMI_VALUE
uint8_t Host_IO_Init(ARM_DRIVER_USART *pDrv, void *pBus, void *pDevInfo, void *spiSlaveParams, uint16_t slaveAddress)
This structure defines the Write command List.
This structure defines the Read command List.
The host_io_uart.h file contains the Host Protocol interface definitions and configuration.
#define STREAMING_HEADER_LEN
#define DIFF_P_NPS3005DV_WHOAMI_VALUE
bool process_host_command(uint8_t tag, uint8_t *hostCommand, uint8_t *hostResponse, size_t *hostMsgSize, size_t respBufferSize)
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
#define DIFF_P_CTRL_REG3_IPOL1_MASK
char shieldString[ADS_MAX_STRING_LENGTH]
#define DIFF_P_INT_STATUS_0_TDR_DRDY
#define I2C_S_SIGNAL_EVENT
#define DIFF_P_INT_MASK0_TDR_INT_EN
int32_t Sensor_I2C_Write(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerwritelist_t *pRegWriteList)
Write register data to a sensor.
const registerreadlist_t cDiffPStatus[]
Address of Status Register.