ISSDK  1.7
IoT Sensing Software Development Kit
Macros | Functions | Variables
diff_p_threshold.c File Reference

The diff_p_threshold.c file implements the ISSDK DIFF_P sensor driver example demonstration with Threshold detection mode. More...

#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_debug_console.h"
#include "Driver_I2C.h"
#include "issdk_hal.h"
#include "diff_p_drv.h"
#include "systick_utils.h"
Include dependency graph for diff_p_threshold.c:

Go to the source code of this file.

Macros

#define P_TGT0_MSB   0x03
 
#define P_TGT0_LSB   0x20
 

Functions

void diff_p_isr (void *pUserData)
 This is the Sensor Data Ready ISR implementation. More...
 
int main (void)
 Main function. More...
 

Variables

volatile bool diff_pInterrupt = false
 
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_1, .numBytes = 1}, __END_READ_DATA__}
 Address of Status Register. More...
 

Detailed Description

The diff_p_threshold.c file implements the ISSDK DIFF_P sensor driver example demonstration with Threshold detection mode.

Definition in file diff_p_threshold.c.

Macro Definition Documentation

◆ P_TGT0_LSB

#define P_TGT0_LSB   0x20

Definition at line 63 of file diff_p_threshold.c.

Referenced by main().

◆ P_TGT0_MSB

#define P_TGT0_MSB   0x03

Definition at line 62 of file diff_p_threshold.c.

Referenced by main().

Function Documentation

◆ diff_p_isr()

void diff_p_isr ( void *  pUserData)

This is the Sensor Data Ready ISR implementation.


This function sets the flag which indicates if a new sample(s) is available for reading.

Parameters
[in]pUserDataThis is a void pointer to the instance of the user specific data structure for the ISR.
Returns
void There is no return value.
Constraints:
None

Yes

Set flag to indicate Sensor has signalled data ready.

Definition at line 101 of file diff_p_threshold.c.

References diff_pInterrupt.

Referenced by main().

Here is the caller graph for this function:

◆ main()

int main ( void  )

Main function.

Initialize INT1_DIFF_P 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 DIFF_P sensor driver.

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

Configure the DIFF_P sensor.

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

Check for event ready bits from the DIFF_P.

Explicitly clear the Status Bits.

Definition at line 109 of file diff_p_threshold.c.

References BOARD_BootClockRUN, BOARD_InitDebugConsole(), BOARD_InitPins(), BOARD_SystickEnable(), diff_p_i2c_sensorhandle_t::deviceInfo, DIFF_P_I2C_ADDR, DIFF_P_I2C_Configure(), DIFF_P_I2C_Initialize(), DIFF_P_I2C_ReadData(), DIFF_P_I2C_SetIdleTask(), DIFF_P_INT1, DIFF_P_INT_STATUS_1_P_TGT0_MASK, DIFF_P_INT_STATUS_1_P_TGT0_REACHED, diff_p_isr(), DIFF_P_NPS3000VV_WHOAMI_VALUE, DIFF_P_NPS3001DV_WHOAMI_VALUE, DIFF_P_NPS3002VV_WHOAMI_VALUE, DIFF_P_NPS3005DV_WHOAMI_VALUE, diff_pInterrupt, Driver_GPIO_KSDK, GPIO_DIRECTION_IN, GPIO_DIRECTION_OUT, GREEN_LED, I2C_S_DEVICE_INDEX, I2C_S_DRIVER, I2C_S_SIGNAL_EVENT, int32_t(), NPS3000VV_PRESSURE_DIV_FACTOR, NPS3001DV_PRESSURE_DIV_FACTOR, NPS3002VV_PRESSURE_DIV_FACTOR, NPS3005DV_PRESSURE_DIV_FACTOR, P_TGT0_LSB, P_TGT0_MSB, diff_p_i2c_sensorhandle_t::pCommDrv, GENERIC_DRIVER_GPIO::pin_init, SENSOR_ERROR_NONE, Sensor_I2C_Write(), diff_p_i2c_sensorhandle_t::slaveAddress, SMC, SMC_SetPowerModeWait(), status, and GENERIC_DRIVER_GPIO::toggle_pin.

Here is the call graph for this function:

Variable Documentation

◆ cDiffPClearStatusBits

const registerwritelist_t cDiffPClearStatusBits[]
Initial value:
#define __END_WRITE_DATA__
Definition: sensor_drv.h:71
#define DIFF_P_INT_STATUS_1_P_TGT0_MASK
Definition: diff_p.h:222

Register settings for Clearing Pressure and Temperature Data Ready Bits.

Definition at line 84 of file diff_p_threshold.c.

◆ cDiffPConfigNormal

const registerwritelist_t cDiffPConfigNormal[]
Initial value:
= {
#define __END_WRITE_DATA__
Definition: sensor_drv.h:71
#define DIFF_P_CTRL_REG2_ODR_MASK
Definition: diff_p.h:774
#define DIFF_P_INT_MASK1_P_TGT0_INT_EN
Definition: diff_p.h:462
#define DIFF_P_CTRL_REG1_OSR_MASK
Definition: diff_p.h:709
#define DIFF_P_CTRL_REG2_ODR_ODR6P25
Definition: diff_p.h:799
#define DIFF_P_CTRL_REG1_OSR_OSR512
Definition: diff_p.h:731
#define P_TGT0_LSB
#define DIFF_P_CTRL_REG3_IPOL1_ACTIVE_HIGH
Definition: diff_p.h:862
#define P_TGT0_MSB
#define DIFF_P_INT_MASK1_P_TGT0_MASK
Definition: diff_p.h:443
#define DIFF_P_CTRL_REG3_IPOL1_MASK
Definition: diff_p.h:849

Register settings for Normal (non buffered) mode.

Definition at line 74 of file diff_p_threshold.c.

◆ cDiffPStatus

const registerreadlist_t cDiffPStatus[] = {{.readFrom = DIFF_P_INT_STATUS_1, .numBytes = 1}, __END_READ_DATA__}

Address of Status Register.

Definition at line 88 of file diff_p_threshold.c.

◆ diff_pInterrupt

volatile bool diff_pInterrupt = false

Definition at line 68 of file diff_p_threshold.c.

Referenced by diff_p_isr(), and main().