ph2 2.1.0.0
|
API for configuring and manipulating pH 2 Click driver. More...
Topics | |
pH 2 Commands List | |
List of commands 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. | |
void | ph2_drv_interface_selection (ph2_cfg_t *cfg, ph2_drv_t drv_sel) |
pH 2 driver interface setup function. | |
err_t | ph2_init (ph2_t *ctx, ph2_cfg_t *cfg) |
pH 2 initialization function. | |
err_t | ph2_read_raw_adc (ph2_t *ctx, uint16_t *raw_adc) |
pH 2 read raw ADC value function. | |
err_t | ph2_read_voltage (ph2_t *ctx, float *voltage) |
pH 2 read voltage level function. | |
err_t | ph2_set_vref (ph2_t *ctx, float vref) |
pH 2 set vref function. | |
err_t | ph2_calibrate (ph2_t *ctx, float pH_value) |
Ph 2 calibrate function. | |
err_t | ph2_calculate_ph (ph2_t *ctx, float *pH_value) |
Ph 2 calculate pH value function. | |
void | ph2_calibrate_offset (ph2_t *ctx) |
Ph 2 calibrate offset function. | |
void | ph2_enable_st1 (ph2_t *ctx) |
Ph 2 enable LED STAT1 function. | |
void | ph2_disable_st1 (ph2_t *ctx) |
Ph 2 disable LED STAT1 function. | |
void | ph2_enable_st2 (ph2_t *ctx) |
Ph 2 enable LED STAT2 function. | |
void | ph2_disable_st2 (ph2_t *ctx) |
Ph 2 disable LED STAT2 function. | |
err_t | ph2_ds18b20_init (ph2_t *ctx, ph2_cfg_t *cfg) |
pH 2 DS18B20 initialization function. | |
err_t | ph2_ds18b20_check_communication (ph2_t *ctx) |
pH 2 DS18B20 check communication function. | |
err_t | ph2_ds18b20_select_device (ph2_t *ctx) |
pH 2 DS18B20 select device function. | |
err_t | ph2_ds18b20_read_scratchpad (ph2_t *ctx, uint8_t *scratchpad) |
pH 2 DS18B20 read scratchpad function. | |
err_t | ph2_ds18b20_write_scratchpad (ph2_t *ctx, uint8_t temp_high, uint8_t temp_low, uint8_t config) |
pH 2 DS18B20 write scratchpad function. | |
err_t | ph2_ds18b20_default_cfg (ph2_t *ctx) |
pH 2 DS18B20 default configuration function. | |
err_t | ph2_ds18b20_start_measurement (ph2_t *ctx) |
pH 2 DS18B20 start measurement function. | |
err_t | ph2_ds18b20_read_temperature (ph2_t *ctx, float *temperature) |
pH 2 DS18B20 read temperature function. | |
API for configuring and manipulating pH 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
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.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
[out] | pH_value | : pH value of the substance. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void ph2_calibrate_offset | ( | ph2_t * | ctx | ) |
Ph 2 calibrate offset function.
This function is used to calibrate offset of Ph 2 click driver.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
void ph2_cfg_setup | ( | ph2_cfg_t * | cfg | ) |
pH 2 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See ph2_cfg_t object definition for detailed explanation. |
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.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
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.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
pH 2 driver interface setup function.
This function sets a serial driver interface which will be used further in the click driver.
[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. |
err_t ph2_ds18b20_check_communication | ( | ph2_t * | ctx | ) |
pH 2 DS18B20 check communication function.
This function checks the communication by reading the ROM address as well as verifying family code and Maxim CRC 8.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ph2_ds18b20_default_cfg | ( | ph2_t * | ctx | ) |
pH 2 DS18B20 default configuration function.
This function executes a default configuration of pH 2 DS18B20 sensor.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. pH 2 DS18B20 initialization function.
This function initializes all necessary pins and peripherals used for DS18B20 sensor.
[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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ph2_ds18b20_read_scratchpad | ( | ph2_t * | ctx, |
uint8_t * | scratchpad ) |
pH 2 DS18B20 read scratchpad function.
This function reads a desired number of scratchpad bytes using One Wire communication protocol.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
[out] | scratchpad | : Output read scratchpad. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ph2_ds18b20_read_temperature | ( | ph2_t * | ctx, |
float * | temperature ) |
pH 2 DS18B20 read temperature function.
This function reads the temperature value in Celsius.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
[out] | temperature | : Temperature in Celsius. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ph2_ds18b20_select_device | ( | ph2_t * | ctx | ) |
pH 2 DS18B20 select device function.
This function selects the device by performing a skip or match ROM commands depending on the address value set in the ctx->address.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ph2_ds18b20_start_measurement | ( | ph2_t * | ctx | ) |
pH 2 DS18B20 start measurement function.
This function starts the measurement by sending an appropriate command for that.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ph2_ds18b20_write_scratchpad | ( | ph2_t * | ctx, |
uint8_t | temp_high, | ||
uint8_t | temp_low, | ||
uint8_t | config ) |
pH 2 DS18B20 write scratchpad function.
This function writes the temperature thresholds and configuration byte to the scratchpad.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
[in] | temp_high | : Temperature high limit. |
[in] | temp_low | : Temperature low limit. |
[in] | config | : Configuration byte. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
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.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
pH 2 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
[out] | raw_adc | : Output ADC result. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
[out] | voltage | : Output voltage level [V]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
[in] | ctx | : Click context object. See ph2_t object definition for detailed explanation. |
[in] | vref | : Reference voltage (volts). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.