X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fkorad-kaxxxxp%2Fprotocol.h;h=e4b133e1ac7f216e517aa29320edad55fce3f70e;hb=e91c9f6e258ca5de115cba8032ce42f91e300b19;hp=2423ce99a8e4f672d8d1aa0296546711d8f9afe5;hpb=ca314e060f653e6a0b5ec0f58914bac4d426217f;p=libsigrok.git diff --git a/src/hardware/korad-kaxxxxp/protocol.h b/src/hardware/korad-kaxxxxp/protocol.h index 2423ce99..e4b133e1 100644 --- a/src/hardware/korad-kaxxxxp/protocol.h +++ b/src/hardware/korad-kaxxxxp/protocol.h @@ -2,6 +2,7 @@ * This file is part of the libsigrok project. * * Copyright (C) 2015 Hannu Vuolasaho + * Copyright (C) 2018 Frank Stettner * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,6 +36,8 @@ enum { VELLEMAN_LABPS3005D, KORAD_KA3005P, KORAD_KA3005P_0X01, + KORAD_KD3005P, + RND_320K30PV, /* Support for future devices with this protocol. */ }; @@ -69,7 +72,7 @@ struct dev_context { struct sr_sw_limits limits; int64_t req_sent_at; - gboolean reply_pending; + GMutex rw_mutex; float current; /**< Last current value [A] read from device. */ float current_max; /**< Output current set. */ @@ -82,9 +85,8 @@ struct dev_context { gboolean ocp_enabled; /**< Output current protection enabled. */ gboolean ovp_enabled; /**< Output voltage protection enabled. */ - int target; /**< What reply to expect. */ + int acquisition_target; /**< What reply to expect. */ int program; /**< Program to store or recall. */ - char reply[6]; }; SR_PRIV int korad_kaxxxxp_send_cmd(struct sr_serial_dev_inst *serial, @@ -92,11 +94,9 @@ SR_PRIV int korad_kaxxxxp_send_cmd(struct sr_serial_dev_inst *serial, SR_PRIV int korad_kaxxxxp_read_chars(struct sr_serial_dev_inst *serial, int count, char *buf); SR_PRIV int korad_kaxxxxp_set_value(struct sr_serial_dev_inst *serial, - struct dev_context *devc); -SR_PRIV int korad_kaxxxxp_query_value(struct sr_serial_dev_inst *serial, - struct dev_context *devc); -SR_PRIV int korad_kaxxxxp_get_reply(struct sr_serial_dev_inst *serial, - struct dev_context *devc); + int target, struct dev_context *devc); +SR_PRIV int korad_kaxxxxp_get_value(struct sr_serial_dev_inst *serial, + int target, struct dev_context *devc); SR_PRIV int korad_kaxxxxp_get_all_values(struct sr_serial_dev_inst *serial, struct dev_context *devc); SR_PRIV int korad_kaxxxxp_receive_data(int fd, int revents, void *cb_data);