ph 2.0.0.0
|
API for configuring and manipulating pH Click driver. More...
Topics | |
pH Device Settings | |
Settings for registers of pH Click driver. | |
pH MikroBUS Map | |
MikroBUS pin mapping of pH Click driver. | |
Functions | |
void | ph_cfg_setup (ph_cfg_t *cfg) |
pH configuration object setup function. | |
err_t | ph_init (ph_t *ctx, ph_cfg_t *cfg) |
pH initialization function. | |
err_t | ph_default_cfg (ph_t *ctx) |
pH default configuration function. | |
err_t | ph_generic_write (ph_t *ctx, uint8_t *data_buf, uint16_t len) |
pH data writing function. | |
err_t | ph_generic_read (ph_t *ctx, uint8_t *data_buf, uint16_t max_len) |
pH data reading function. | |
void | ph_uart_write (ph_t *ctx, uint8_t input) |
UART Write Single Byte function. | |
void | ph_uart_read_until (ph_t *ctx, char *p_rx_data, char *delim) |
UART read until delimiter function. | |
void | ph_send_cmd (ph_t *ctx, char *p_cmd) |
Send command function. | |
void | ph_send_cmd_resp (ph_t *ctx, char *p_cmd, char *p_resp) |
Send command and get response function. | |
void | ph_send_cmd_w_num (ph_t *ctx, char *p_cmd, char *flt_val, char *p_resp) |
Send command with number and get response function. | |
void | ph_get_cmd_resp (ph_t *ctx, char *p_cmd, char *p_resp) |
Send get response function. | |
void | ph_switch_led (ph_t *ctx, uint8_t state, char *p_resp) |
Toggle LED function. | |
void | ph_chk_led_state (ph_t *ctx, char *p_resp) |
Check LED state function. | |
void | ph_find_dev (ph_t *ctx, char *p_resp) |
Find device function. | |
void | ph_cont_read (ph_t *ctx, uint8_t time, char *p_resp) |
Set Continous read function. | |
void | ph_chk_cont_read (ph_t *ctx, char *p_resp) |
Check Continous read settings function. | |
void | ph_perf_calib (ph_t *ctx, char *point, float flt_val, char *p_resp) |
Perform Calibration function. | |
void | ph_chk_calib (ph_t *ctx, char *p_resp) |
Check if Calibration was performed function. | |
void | ph_chk_slope (ph_t *ctx, char *p_resp) |
Check slope function. | |
void | ph_get_calib_exp_bytes_num (ph_t *ctx, char *p_resp) |
Export calibration data function. | |
void | ph_import_calib (ph_t *ctx, uint8_t *in_calib, char *p_resp) |
Import calibration data function. | |
void | ph_factory_rst (ph_t *ctx, char *p_resp) |
Perform Factory Reset function. | |
void | ph_set_temp_comp (ph_t *ctx, float flt_val, char *p_resp) |
Set Temperature Compensation function. | |
void | ph_get_temp_comp (ph_t *ctx, char *p_resp) |
Get Temperature Compensation function. | |
void | ph_set_name (ph_t *ctx, char *p_dev_name, char *p_resp) |
Set name function. | |
void | ph_show_name (ph_t *ctx, char *p_dev_name) |
Show Device Name function. | |
void | ph_get_dev_info (ph_t *ctx, char *p_resp) |
Get Device Information function. | |
void | ph_check_status (ph_t *ctx, char *p_resp) |
Check Device Status function. | |
void | ph_sleep (ph_t *ctx) |
Enter Sleep mode function. | |
void | ph_chng_baud_rate (ph_t *ctx, char *baud_rate, char *p_resp) |
Change Baud Rate function. | |
void | ph_chk_baud_rate (ph_t *ctx, char *p_resp) |
Check Baud Rate applied function. | |
void | ph_protocol_lock (ph_t *ctx, uint8_t state, char *p_resp) |
Protocol Lock enable/disable function. | |
void | ph_check_protocol_lock (ph_t *ctx, char *p_resp) |
Check Protocol Lock function. | |
void | ph_chng_i2c_adr (ph_t *ctx, uint32_t i2c_adr, char *p_resp) |
Change Device's I2C slave address function. | |
void | ph_single_read (ph_t *ctx, char *p_resp) |
Perform single read function. | |
uint8_t | ph_response (ph_t *ctx, char *p_resp) |
pH Response handler function | |
void | ph_clr_log_buf (char *p_str) |
Clear log buffer function. | |
API for configuring and manipulating pH Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void ph_cfg_setup | ( | ph_cfg_t * | cfg | ) |
pH configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See ph_cfg_t object definition for detailed explanation. |
void ph_check_protocol_lock | ( | ph_t * | ctx, |
char * | p_resp ) |
Check Protocol Lock function.
Function is used to check if the device is lock to UART mode.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. data. |
void ph_check_status | ( | ph_t * | ctx, |
char * | p_resp ) |
Check Device Status function.
Function is used to check status of the device.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
void ph_chk_baud_rate | ( | ph_t * | ctx, |
char * | p_resp ) |
Check Baud Rate applied function.
Function is used to check the baud rate.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
void ph_chk_calib | ( | ph_t * | ctx, |
char * | p_resp ) |
Check if Calibration was performed function.
Function is used to check if calibration was performed.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
void ph_chk_cont_read | ( | ph_t * | ctx, |
char * | p_resp ) |
Check Continous read settings function.
Function is used to check the settings of the continous read.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
void ph_chk_led_state | ( | ph_t * | ctx, |
char * | p_resp ) |
Check LED state function.
Function is used to check the state of the LED.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
void ph_chk_slope | ( | ph_t * | ctx, |
char * | p_resp ) |
Check slope function.
Function is used to check the slope of the probe.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
void ph_chng_baud_rate | ( | ph_t * | ctx, |
char * | baud_rate, | ||
char * | p_resp ) |
Change Baud Rate function.
Function is used to change the baud rate.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | baud_rate | : Baud rate. |
[out] | p_resp | : Pointer to response. |
void ph_chng_i2c_adr | ( | ph_t * | ctx, |
uint32_t | i2c_adr, | ||
char * | p_resp ) |
Change Device's I2C slave address function.
Function is used to set I2C address and reboot into I2C mode.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | i2c_adr | : Device slave address. |
[out] | p_resp | : Pointer to response. data. |
void ph_clr_log_buf | ( | char * | p_str | ) |
Clear log buffer function.
Function is used to empty log's data buffer.
[in] | p_str | : Data buffer. |
void ph_cont_read | ( | ph_t * | ctx, |
uint8_t | time, | ||
char * | p_resp ) |
Set Continous read function.
Function is used to enable, disable or change settings of the continous read.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | time | : Defines reading interval ranging from 1 to 90 seconds, if 0 is applied continous reading is disabled. |
[out] | p_resp | : Pointer to response. |
err_t ph_default_cfg | ( | ph_t * | ctx | ) |
pH default configuration function.
This function executes a default configuration of pH click board.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
0
- Success, -1
- Error.void ph_factory_rst | ( | ph_t * | ctx, |
char * | p_resp ) |
Perform Factory Reset function.
Function is used to perform factory reset.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
void ph_find_dev | ( | ph_t * | ctx, |
char * | p_resp ) |
Find device function.
Function is used to find the device.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
err_t ph_generic_read | ( | ph_t * | ctx, |
uint8_t * | data_buf, | ||
uint16_t | max_len ) |
pH data reading function.
This function reads a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | data_buf | : Output read data. |
[in] | max_len | : Number of bytes to be read. |
>0
- Number of data bytes read, <=0
- Error/Empty Ring buffer.err_t ph_generic_write | ( | ph_t * | ctx, |
uint8_t * | data_buf, | ||
uint16_t | len ) |
pH data writing function.
This function writes a desired number of data bytes by using UART serial interface.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | data_buf | : Data buffer for sending. |
[in] | len | : Number of bytes for sending. |
>=0
- Success, <0
- Error.void ph_get_calib_exp_bytes_num | ( | ph_t * | ctx, |
char * | p_resp ) |
Export calibration data function.
Function is used to export calibration data.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to exported calibration data |
void ph_get_cmd_resp | ( | ph_t * | ctx, |
char * | p_cmd, | ||
char * | p_resp ) |
Send get response function.
Function is used to get response from a command.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | p_cmd | : Pointer to input command. |
[out] | p_resp | : Pointer to response. |
void ph_get_dev_info | ( | ph_t * | ctx, |
char * | p_resp ) |
Get Device Information function.
Function is used to read information about the device.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
void ph_get_temp_comp | ( | ph_t * | ctx, |
char * | p_resp ) |
Get Temperature Compensation function.
Function is used to get temperature compensation.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to response. |
void ph_import_calib | ( | ph_t * | ctx, |
uint8_t * | in_calib, | ||
char * | p_resp ) |
Import calibration data function.
Function is used to import calibration data.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | in_calib | : Pointer to imported calibration data. |
[out] | p_resp | : Pointer to response. |
pH initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See ph_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.void ph_perf_calib | ( | ph_t * | ctx, |
char * | point, | ||
float | flt_val, | ||
char * | p_resp ) |
Perform Calibration function.
Function is used to perform calibration.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | point | : Pointer to calibration point ( mid, low or high ). |
[in] | flt_val | : Float value representing calibration reference. |
[out] | p_resp | : Pointer to response. |
void ph_protocol_lock | ( | ph_t * | ctx, |
uint8_t | state, | ||
char * | p_resp ) |
Protocol Lock enable/disable function.
Function is used to lock device to UART mode.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | state | : lock/unlock the protocol. |
[out] | p_resp | : Pointer to response. |
uint8_t ph_response | ( | ph_t * | ctx, |
char * | p_resp ) |
pH Response handler function
Function is used to handle collected data.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to collected data. |
void ph_send_cmd | ( | ph_t * | ctx, |
char * | p_cmd ) |
Send command function.
Function is used to send command and does not expect response.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | p_cmd | : Pointer to input command |
void ph_send_cmd_resp | ( | ph_t * | ctx, |
char * | p_cmd, | ||
char * | p_resp ) |
Send command and get response function.
Function is used to send command and gets the response.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | p_cmd | : Pointer to input command. |
[out] | p_resp | : Pointer to response. |
void ph_send_cmd_w_num | ( | ph_t * | ctx, |
char * | p_cmd, | ||
char * | flt_val, | ||
char * | p_resp ) |
Send command with number and get response function.
Function is used to send command alongside floating point number and gets the response.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
p_cmd | pointer to input command | |
name | flt_val input float value | |
[out] | p_resp | : Pointer to response. |
void ph_set_name | ( | ph_t * | ctx, |
char * | p_dev_name, | ||
char * | p_resp ) |
Set name function.
Function is used to name the device.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | p_dev_name | : Pointer to the devices name. |
[out] | p_resp | : Pointer to response. |
void ph_set_temp_comp | ( | ph_t * | ctx, |
float | flt_val, | ||
char * | p_resp ) |
Set Temperature Compensation function.
Function is used to set temperature compensation.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | flt_val | : Compensation temperature. |
[out] | p_resp | : Pointer to response. |
void ph_show_name | ( | ph_t * | ctx, |
char * | p_dev_name ) |
Show Device Name function.
Function is used to show the device's name.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | p_dev_name | : Pointer to the devices name |
void ph_single_read | ( | ph_t * | ctx, |
char * | p_resp ) |
Perform single read function.
Function is used to perform single read of the pH value.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_resp | : Pointer to pH value of the tested substance. |
void ph_sleep | ( | ph_t * | ctx | ) |
Enter Sleep mode function.
Function is used to enter the sleep mode.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
void ph_switch_led | ( | ph_t * | ctx, |
uint8_t | state, | ||
char * | p_resp ) |
Toggle LED function.
Function is used to turn LED on or off.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[in] | state | : Turns LED on or off |
[out] | p_resp | : Pointer to response. |
void ph_uart_read_until | ( | ph_t * | ctx, |
char * | p_rx_data, | ||
char * | delim ) |
UART read until delimiter function.
Function reads data until it finds delimiter.
[in] | ctx | : Click context object. See ph_t object definition for detailed explanation. |
[out] | p_tx_data | : Pointer to output data. |
[in] | delim | : Delimiter. |