Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
59 #define PH_CMD_CNG_BAUD_RATE "Baud,"
60 #define PH_CMD_CHK_BAUD_RATE "Baud,?"
61 #define PH_CMD_SET_CONT_READ "C,"
62 #define PH_CMD_CHK_CONT_READ "C,?"
63 #define PH_CMD_CALIB_PERF "Cal"
64 #define PH_CMD_CALIB_MID ",mid,"
65 #define PH_CMD_CALIB_LOW ",low,"
66 #define PH_CMD_CALIB_HIGH ",high,"
67 #define PH_CMD_CHK_CALIB "Cal,?"
68 #define PH_CMD_CALIB_EXP "Export"
69 #define PH_CMD_CHK_CALIB_EXP "Export,?"
70 #define PH_CMD_CALIB_IMP "Import,"
71 #define PH_CMD_EN_FTY_RST "Factory"
72 #define PH_CMD_DEV_FIND "Find"
73 #define PH_CMD_DEV_INFO "i"
74 #define PH_CMD_CNG_I2C "I2C,"
75 #define PH_CMD_EN_LED "L,"
76 #define PH_CMD_CHK_LED "L,?"
77 #define PH_CMD_SET_DEV_NAME "Name,"
78 #define PH_CMD_GET_DEV_NAME "Name,?"
79 #define PH_CMD_PROTOCOL_LOCK "Plock,"
80 #define PH_CMD_PROTOCOL_CKH "Plock,?"
81 #define PH_CMD_SET_SNGL_READ "r"
82 #define PH_CMD_ENTER_SLEEP "Sleep"
83 #define PH_CMD_RET_SLOPE "Slope,?"
84 #define PH_CMD_READ_STATUS "Status"
85 #define PH_CMD_TEMP_COMP "T,"
86 #define PH_CMD_CHK_TEMP_COMP "T,?"
87 #define PH_CMD_RSP_CODES "*OK"
88 #define PH_CMD_EN_RSP_CODES "*OK,1"
89 #define PH_CMD_DIS_RSP_CODES "*OK,0"
90 #define PH_CMD_CHK_RSP_CODES "*OK,?"
91 #define PH_CMD_END_COMMAND "\r"
97 #define PH_RSP_CODE_ERROR "*ER"
98 #define PH_RSP_CODE_OV_VOLT "*OV"
99 #define PH_RSP_CODE_UN_VOLT "*UV"
100 #define PH_RSP_CODE_RESET "*RS"
101 #define PH_RSP_CODE_READY "*RE"
102 #define PH_RSP_CODE_SLEEP_EN "*SL"
103 #define PH_RSP_CODE_WAKE_UP "*WA"
104 #define PH_RSP_CODE_ALL_GOOD "*OK"
111 #define PH_RST_CODE_POW_OFF "P"
112 #define PH_RST_CODE_SW_RST "S"
113 #define PH_RST_CODE_BRWN_OUT "B"
114 #define PH_RST_CODE_WTD "W"
115 #define PH_RST_CODE_UNKNOWN "U"
121 #define PH_BAUD_RATE_300 "300"
122 #define PH_BAUD_RATE_1200 "1200"
123 #define PH_BAUD_RATE_2400 "2400"
124 #define PH_BAUD_RATE_9600 "9600"
125 #define PH_BAUD_RATE_19200 "19200"
126 #define PH_BAUD_RATE_38400 "38400"
127 #define PH_BAUD_RATE_57600 "57600"
128 #define PH_BAUD_RATE_115200 "115200"
135 #define DRV_BUFFER_SIZE 200
153 #define PH_MAP_MIKROBUS( cfg, mikrobus ) \
154 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
155 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX )
void ph_chng_i2c_adr(ph_t *ctx, uint32_t i2c_adr, char *p_resp)
Change Device's I2C slave address function.
void ph_get_calib_exp_bytes_num(ph_t *ctx, char *p_resp)
Export calibration data function.
void ph_get_cmd_resp(ph_t *ctx, char *p_cmd, char *p_resp)
Send get response function.
void ph_protocol_lock(ph_t *ctx, uint8_t state, char *p_resp)
Protocol Lock enable/disable function.
void ph_chk_calib(ph_t *ctx, char *p_resp)
Check if Calibration was performed function.
void ph_send_cmd_resp(ph_t *ctx, char *p_cmd, char *p_resp)
Send command and get response function.
pin_name_t tx_pin
Definition: ph.h:182
void ph_send_cmd_w_num(ph_t *ctx, char *p_cmd, float flt_val, char *p_resp)
Send command with number and get response function.
uart_t uart
Definition: ph.h:166
pin_name_t rx_pin
Definition: ph.h:181
void ph_cont_read(ph_t *ctx, uint8_t time, char *p_resp)
Set Continous read function.
uint8_t ph_response(ph_t *ctx, char *p_resp)
pH Response handler function
void ph_chk_led_state(ph_t *ctx, char *p_resp)
Check LED state function.
void ph_set_name(ph_t *ctx, char *p_dev_name, char *p_resp)
Set name function.
bool uart_blocking
Definition: ph.h:186
void ph_find_dev(ph_t *ctx, char *p_resp)
Find device function.
err_t ph_generic_read(ph_t *ctx, char *data_buf, uint16_t max_len)
pH data reading function.
void ph_chk_slope(ph_t *ctx, char *p_resp)
Check slope function.
uart_stop_bits_t stop_bit
Definition: ph.h:189
void ph_set_temp_comp(ph_t *ctx, float flt_val, char *p_resp)
Set Temperature Compensation function.
void ph_clr_log_buf(char *p_str)
Clear log buffer function.
@ PH_ERROR
Definition: ph.h:200
#define DRV_BUFFER_SIZE
pH driver buffer size.
Definition: ph.h:135
void ph_check_protocol_lock(ph_t *ctx, char *p_resp)
Check Protocol Lock function.
void ph_get_dev_info(ph_t *ctx, char *p_resp)
Get Device Information function.
uart_parity_t parity_bit
Definition: ph.h:188
void ph_get_temp_comp(ph_t *ctx, char *p_resp)
Get Temperature Compensation function.
void ph_import_calib(ph_t *ctx, uint8_t *in_calib, char *p_resp)
Import calibration data function.
void ph_switch_led(ph_t *ctx, uint8_t state, char *p_resp)
Toggle LED function.
uart_data_bits_t data_bit
Definition: ph.h:187
void ph_chk_cont_read(ph_t *ctx, char *p_resp)
Check Continous read settings function.
void ph_factory_rst(ph_t *ctx, char *p_resp)
Perform Factory Reset function.
void ph_check_status(ph_t *ctx, char *p_resp)
Check Device Status function.
void ph_uart_write(ph_t *ctx, uint8_t input)
UART Write Single Byte function.
pH Click context object.
Definition: ph.h:164
@ PH_OK
Definition: ph.h:199
err_t ph_generic_write(ph_t *ctx, char *data_buf, uint16_t len)
pH data writing function.
void ph_perf_calib(ph_t *ctx, char *point, float flt_val, char *p_resp)
Perform Calibration function.
uint32_t baud_rate
Definition: ph.h:185
void ph_single_read(ph_t *ctx, char *p_resp)
Perform single read function.
void ph_cfg_setup(ph_cfg_t *cfg)
pH configuration object setup 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.
ph_return_value_t
pH Click return value data.
Definition: ph.h:198
void ph_chk_baud_rate(ph_t *ctx, char *p_resp)
Check Baud Rate applied function.
err_t ph_default_cfg(ph_t *ctx)
pH default configuration function.
void ph_show_name(ph_t *ctx, char *p_dev_name)
Show Device Name function.
err_t ph_init(ph_t *ctx, ph_cfg_t *cfg)
pH initialization function.
pH Click configuration object.
Definition: ph.h:179
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.