diffpress4 2.1.0.0
Diff Press 4 Click Driver

API for configuring and manipulating Diff Press 4 Click driver. More...

Topics

 Diff Press 4 Registers List
 List of registers of Diff Press 4 Click driver.
 
 Diff Press 4 Registers Settings
 Settings for registers of Diff Press 4 Click driver.
 
 Diff Press 4 MikroBUS Map
 MikroBUS pin mapping of Diff Press 4 Click driver.
 

Functions

void diffpress4_cfg_setup (diffpress4_cfg_t *cfg)
 Diff Press 4 configuration object setup function.
 
err_t diffpress4_init (diffpress4_t *ctx, diffpress4_cfg_t *cfg)
 Diff Press 4 initialization function.
 
err_t diffpress4_set_slave_address (diffpress4_t *ctx, uint8_t slave_address)
 Diff Press 4 set I2C Slave address function.
 
err_t diffpress4_generic_write (diffpress4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Diff Press 4 I2C writing function.
 
err_t diffpress4_generic_read (diffpress4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Diff Press 4 I2C reading function.
 
err_t diffpress4_set_sleep_mode (diffpress4_t *ctx)
 Diff Press 4 set sleep mode function.
 
err_t diffpress4_sw_reset (diffpress4_t *ctx)
 Diff Press 4 software reset function.
 
err_t diffpress4_get_serial_number (diffpress4_t *ctx, uint32_t *serial_number)
 Diff Press 4 get serial number function.
 
err_t diffpress4_get_status (diffpress4_t *ctx, diffpress4_status_t *status)
 Diff Press 4 get status function.
 
err_t diffpress4_get_raw_data (diffpress4_t *ctx, int16_t *temp_data, int16_t *press_data)
 Diff Press 4 gets the raw data function.
 
err_t diffpress4_get_measurement_data (diffpress4_t *ctx, float *diff_press, float *temperature)
 Diff Press 4 gets the raw data function.
 

Detailed Description

API for configuring and manipulating Diff Press 4 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ diffpress4_cfg_setup()

void diffpress4_cfg_setup ( diffpress4_cfg_t * cfg)

Diff Press 4 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See diffpress4_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ diffpress4_generic_read()

err_t diffpress4_generic_read ( diffpress4_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Diff Press 4 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress4_generic_write()

err_t diffpress4_generic_write ( diffpress4_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Diff Press 4 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress4_get_measurement_data()

err_t diffpress4_get_measurement_data ( diffpress4_t * ctx,
float * diff_press,
float * temperature )

Diff Press 4 gets the raw data function.

This function reads the pressure and temperature raw data values of the SM9336, SMI ultra-low pressure digital sensor

Parameters
[in]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
[out]diff_press: Diff pressure [Pa].
[out]temperature: Temperature [degree Celsius].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress4_get_raw_data()

err_t diffpress4_get_raw_data ( diffpress4_t * ctx,
int16_t * temp_data,
int16_t * press_data )

Diff Press 4 gets the raw data function.

This function reads the pressure and temperature raw data values of the SM9336, SMI ultra-low pressure digital sensor

Parameters
[in]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
[out]temp_data: Temperature data.
[out]press_data: Pressure data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress4_get_serial_number()

err_t diffpress4_get_serial_number ( diffpress4_t * ctx,
uint32_t * serial_number )

Diff Press 4 get serial number function.

This function reads serial number data values of the SM9336, SMI ultra-low pressure digital sensor

Parameters
[in]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
[out]serial_number: Serial number value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress4_get_status()

err_t diffpress4_get_status ( diffpress4_t * ctx,
diffpress4_status_t * status )

Diff Press 4 get status function.

This function reads status data values of the SM9336, SMI ultra-low pressure digital sensor

Parameters
[in]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
[out]status: Status object. See diffpress4_status_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress4_init()

err_t diffpress4_init ( diffpress4_t * ctx,
diffpress4_cfg_t * cfg )

Diff Press 4 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See diffpress4_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress4_set_slave_address()

err_t diffpress4_set_slave_address ( diffpress4_t * ctx,
uint8_t slave_address )

Diff Press 4 set I2C Slave address function.

This function sets I2C address of the subordinate I2C device to address which is targeted by read and write operations.

Parameters
[in]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
[in]slave_addressSpecified I2C slave address.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
It is recommended to check return value for error.

◆ diffpress4_set_sleep_mode()

err_t diffpress4_set_sleep_mode ( diffpress4_t * ctx)

Diff Press 4 set sleep mode function.

This function is used to initiate a shutdown state of the SM9336, SMI ultra-low pressure digital sensor

Parameters
[in]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ diffpress4_sw_reset()

err_t diffpress4_sw_reset ( diffpress4_t * ctx)

Diff Press 4 software reset function.

This function performs the reset sequence of the SM9336, SMI ultra-low pressure digital sensor

Parameters
[in]ctx: Click context object. See diffpress4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
After reset the power-up sequence will be executed, i.e. the registers are loaded with data from the configuration memory, also a CRC check is performed.