ph 2.0.0.0
ph.h File Reference

This file contains API for pH Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  ph_t
 pH Click context object. More...
 
struct  ph_cfg_t
 pH Click configuration object. More...
 

Macros

#define PH_CMD_CNG_BAUD_RATE   "Baud,"
 pH control commands.
 
#define PH_CMD_CHK_BAUD_RATE   "Baud,?"
 
#define PH_CMD_SET_CONT_READ   "C,"
 
#define PH_CMD_CHK_CONT_READ   "C,?"
 
#define PH_CMD_CALIB_PERF   "Cal"
 
#define PH_CMD_CALIB_MID   ",mid,"
 
#define PH_CMD_CALIB_LOW   ",low,"
 
#define PH_CMD_CALIB_HIGH   ",high,"
 
#define PH_CMD_CHK_CALIB   "Cal,?"
 
#define PH_CMD_CALIB_EXP   "Export"
 
#define PH_CMD_CHK_CALIB_EXP   "Export,?"
 
#define PH_CMD_CALIB_IMP   "Import,"
 
#define PH_CMD_EN_FTY_RST   "Factory"
 
#define PH_CMD_DEV_FIND   "Find"
 
#define PH_CMD_DEV_INFO   "i"
 
#define PH_CMD_CNG_I2C   "I2C,"
 
#define PH_CMD_EN_LED   "L,"
 
#define PH_CMD_CHK_LED   "L,?"
 
#define PH_CMD_SET_DEV_NAME   "Name,"
 
#define PH_CMD_GET_DEV_NAME   "Name,?"
 
#define PH_CMD_PROTOCOL_LOCK   "Plock,"
 
#define PH_CMD_PROTOCOL_CKH   "Plock,?"
 
#define PH_CMD_SET_SNGL_READ   "r"
 
#define PH_CMD_ENTER_SLEEP   "Sleep"
 
#define PH_CMD_RET_SLOPE   "Slope,?"
 
#define PH_CMD_READ_STATUS   "Status"
 
#define PH_CMD_TEMP_COMP   "T,"
 
#define PH_CMD_CHK_TEMP_COMP   "T,?"
 
#define PH_CMD_RSP_CODES   "*OK"
 
#define PH_CMD_EN_RSP_CODES   "*OK,1"
 
#define PH_CMD_DIS_RSP_CODES   "*OK,0"
 
#define PH_CMD_CHK_RSP_CODES   "*OK,?"
 
#define PH_CMD_END_COMMAND   "\r"
 
#define PH_RSP_CODE_ERROR   "*ER"
 pH Response codes list.
 
#define PH_RSP_CODE_OV_VOLT   "*OV"
 
#define PH_RSP_CODE_UN_VOLT   "*UV"
 
#define PH_RSP_CODE_RESET   "*RS"
 
#define PH_RSP_CODE_READY   "*RE"
 
#define PH_RSP_CODE_SLEEP_EN   "*SL"
 
#define PH_RSP_CODE_WAKE_UP   "*WA"
 
#define PH_RSP_CODE_ALL_GOOD   "*OK"
 
#define PH_RST_CODE_POW_OFF   "P"
 pH Restart codes list.
 
#define PH_RST_CODE_SW_RST   "S"
 
#define PH_RST_CODE_BRWN_OUT   "B"
 
#define PH_RST_CODE_WTD   "W"
 
#define PH_RST_CODE_UNKNOWN   "U"
 
#define PH_BAUD_RATE_300   "300"
 pH Baud rate list.
 
#define PH_BAUD_RATE_1200   "1200"
 
#define PH_BAUD_RATE_2400   "2400"
 
#define PH_BAUD_RATE_9600   "9600"
 
#define PH_BAUD_RATE_19200   "19200"
 
#define PH_BAUD_RATE_38400   "38400"
 
#define PH_BAUD_RATE_57600   "57600"
 
#define PH_BAUD_RATE_115200   "115200"
 
#define DRV_BUFFER_SIZE   200
 pH driver buffer size.
 
#define PH_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  ph_return_value_t { PH_OK = 0 , PH_ERROR = -1 }
 pH Click return value data. More...
 

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.
 

Detailed Description

This file contains API for pH Click Driver.

Enumeration Type Documentation

◆ ph_return_value_t

pH Click return value data.

Predefined enum values for driver return values.

Enumerator
PH_OK 
PH_ERROR