diffpress2 2.0.0.0
Diff Press 2 Click Driver

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

Topics

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

Functions

void diffpress2_cfg_setup (diffpress2_cfg_t *cfg)
 Diff Press 2 configuration object setup function.
 
err_t diffpress2_init (diffpress2_t *ctx, diffpress2_cfg_t *cfg)
 Diff Press 2 initialization function.
 
err_t diffpress2_default_cfg (diffpress2_t *ctx)
 Diff Press 2 default configuration function.
 
err_t diffpress2_send_command (diffpress2_t *ctx, uint16_t cmd)
 Command writing function.
 
err_t diffpress2_generic_read (diffpress2_t *ctx, uint16_t cmd, uint16_t *rx_buf, uint8_t rx_len)
 Command reading function.
 
err_t diffpress2_raw_read (diffpress2_t *ctx, uint16_t *rx_buf, uint8_t rx_len)
 Reading function.
 
err_t diffpress2_get_id (diffpress2_t *ctx)
 Reads device ID's.
 
err_t diffpress2_reset (diffpress2_t *ctx)
 Reset device.
 
err_t diffpress2_trigger_measurement (diffpress2_t *ctx, uint16_t trigger_type, float *diff_press, float *temperature)
 Pressure and temperature reading.
 

Detailed Description

API for configuring and manipulating Diff Press 2 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

◆ diffpress2_cfg_setup()

void diffpress2_cfg_setup ( diffpress2_cfg_t * cfg)

Diff Press 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ diffpress2_default_cfg()

err_t diffpress2_default_cfg ( diffpress2_t * ctx)

Diff Press 2 default configuration function.

This function executes a default configuration of Diff Press 2 click board.

Parameters
[in]ctx: Click context object. See diffpress2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ diffpress2_generic_read()

err_t diffpress2_generic_read ( diffpress2_t * ctx,
uint16_t cmd,
uint16_t * rx_buf,
uint8_t rx_len )

Command reading function.

This function reads a desired number of data words from the selected command.

Parameters
[in]ctx: Click context object. See diffpress2_t object definition for detailed explanation.
[in]cmd: Command.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ diffpress2_get_id()

err_t diffpress2_get_id ( diffpress2_t * ctx)

Reads device ID's.

This function reads a product and serial id's from device. Checks if product ID is correctly read and stores them in context object.

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

◆ diffpress2_init()

err_t diffpress2_init ( diffpress2_t * ctx,
diffpress2_cfg_t * cfg )

Diff Press 2 initialization function.

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

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

◆ diffpress2_raw_read()

err_t diffpress2_raw_read ( diffpress2_t * ctx,
uint16_t * rx_buf,
uint8_t rx_len )

Reading function.

This function reads a desired number of data words.

Parameters
[in]ctx: Click context object. See diffpress2_t object definition for detailed explanation.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ diffpress2_reset()

err_t diffpress2_reset ( diffpress2_t * ctx)

Reset device.

This function resets device with reset sequence command.

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

◆ diffpress2_send_command()

err_t diffpress2_send_command ( diffpress2_t * ctx,
uint16_t cmd )

Command writing function.

This function sends a word of data to device.

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

◆ diffpress2_trigger_measurement()

err_t diffpress2_trigger_measurement ( diffpress2_t * ctx,
uint16_t trigger_type,
float * diff_press,
float * temperature )

Pressure and temperature reading.

This function reads a pressure and temperature for selected type of trigger measurement and calculates value with scale factors for pressure and temperature.

Parameters
[in]ctx: Click context object. See diffpress2_t object definition for detailed explanation.
[in]tigger_type: Trigger measurement type.
[out]diff_press: Output pressure data in Pasacl.
[out]temperature: Output temperature data in degrees Celsius.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.