ph2 2.1.0.0
Modules | Functions
pH 2 Click Driver

API for configuring and manipulating pH 2 Click driver. More...

Modules

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

Functions

void ph2_cfg_setup (ph2_cfg_t *cfg)
 pH 2 configuration object setup function. More...
 
void ph2_drv_interface_selection (ph2_cfg_t *cfg, ph2_drv_t drv_sel)
 pH 2 driver interface setup function. More...
 
err_t ph2_init (ph2_t *ctx, ph2_cfg_t *cfg)
 pH 2 initialization function. More...
 
err_t ph2_read_raw_adc (ph2_t *ctx, uint16_t *raw_adc)
 pH 2 read raw ADC value function. More...
 
err_t ph2_read_voltage (ph2_t *ctx, float *voltage)
 pH 2 read voltage level function. More...
 
err_t ph2_set_vref (ph2_t *ctx, float vref)
 pH 2 set vref function. More...
 
err_t ph2_calibrate (ph2_t *ctx, float pH_value)
 Ph 2 calibrate function. More...
 
err_t ph2_calculate_ph (ph2_t *ctx, float *pH_value)
 Ph 2 calculate pH value function. More...
 
void ph2_calibrate_offset (ph2_t *ctx)
 Ph 2 calibrate offset function. More...
 
void ph2_enable_st1 (ph2_t *ctx)
 Ph 2 enable LED STAT1 function. More...
 
void ph2_disable_st1 (ph2_t *ctx)
 Ph 2 disable LED STAT1 function. More...
 
void ph2_enable_st2 (ph2_t *ctx)
 Ph 2 enable LED STAT2 function. More...
 
void ph2_disable_st2 (ph2_t *ctx)
 Ph 2 disable LED STAT2 function. More...
 

Detailed Description

API for configuring and manipulating pH 2 Click driver.

Function Documentation

◆ ph2_calculate_ph()

err_t ph2_calculate_ph ( ph2_t ctx,
float *  pH_value 
)

Ph 2 calculate pH value function.

This function is reading pH value wof substance where pH probe is placed.

Parameters
[in]ctx: Click context object. See ph2_t object definition for detailed explanation.
[out]pH_value: pH value of the substance.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ph2_calibrate()

err_t ph2_calibrate ( ph2_t ctx,
float  pH_value 
)

Ph 2 calibrate function.

This function is performing calibration of Ph 2 click driver with known pH value substance.

Parameters
[in]ctx: Click context object. See ph2_t object definition for detailed explanation.
[out]pH_value: pH value of the substance where calibration is performed.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ ph2_calibrate_offset()

void ph2_calibrate_offset ( ph2_t ctx)

Ph 2 calibrate offset function.

This function is used to calibrate offset of Ph 2 click driver.

Parameters
[in]ctx: Click context object. See ph2_t object definition for detailed explanation.
Returns
Nothing.
Note
Disconnect the probe and short-circuit the BNC connector in order to set the reference voltage. Adjust the potentiometer until the LEDs stop blinking or until the voltage of the OUT pin is exactly at half the value of the selected VCC voltage. If you are using LEDs for calibration, turn the potentiometer clockwise when STAT1 LED is blinking and counter-clockwise when STAT2 LED is blinking.

◆ ph2_cfg_setup()

void ph2_cfg_setup ( ph2_cfg_t cfg)

pH 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ ph2_disable_st1()

void ph2_disable_st1 ( ph2_t ctx)

Ph 2 disable LED STAT1 function.

This function is used turn off STAT1 LED of Ph 2 click driver.

Parameters
[in]ctx: Click context object. See ph2_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ ph2_disable_st2()

void ph2_disable_st2 ( ph2_t ctx)

Ph 2 disable LED STAT2 function.

This function is used turn off STAT2 LED of Ph 2 click driver.

Parameters
[in]ctx: Click context object. See ph2_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ ph2_drv_interface_selection()

void ph2_drv_interface_selection ( ph2_cfg_t cfg,
ph2_drv_t  drv_sel 
)

pH 2 driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See ph2_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See ph2_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ ph2_enable_st1()

void ph2_enable_st1 ( ph2_t ctx)

Ph 2 enable LED STAT1 function.

This function is used turn on STAT1 LED of Ph 2 click driver.

Parameters
[in]ctx: Click context object. See ph2_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ ph2_enable_st2()

void ph2_enable_st2 ( ph2_t ctx)

Ph 2 enable LED STAT2 function.

This function is used turn on STAT2 LED of Ph 2 click driver.

Parameters
[in]ctx: Click context object. See ph2_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ ph2_init()

err_t ph2_init ( ph2_t ctx,
ph2_cfg_t cfg 
)

pH 2 initialization function.

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

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

◆ ph2_read_raw_adc()

err_t ph2_read_raw_adc ( ph2_t ctx,
uint16_t *  raw_adc 
)

pH 2 read raw ADC value function.

This function reads raw ADC value.

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

◆ ph2_read_voltage()

err_t ph2_read_voltage ( ph2_t ctx,
float *  voltage 
)

pH 2 read voltage level function.

This function reads raw ADC value and converts it to proportional voltage level.

Parameters
[in]ctx: Click context object. See ph2_t object definition for detailed explanation.
[out]voltage: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered reference voltage.

◆ ph2_set_vref()

err_t ph2_set_vref ( ph2_t ctx,
float  vref 
)

pH 2 set vref function.

This function sets the voltage reference for pH 2 click driver.

Parameters
[in]ctx: Click context object. See ph2_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The default voltage reference set with ph2_init is 3.3V.