X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Fhardware%2Fkorad-kaxxxxp%2Fprotocol.h;h=46a3896273103c154eae6d481bd1cc5363797883;hp=7082b1536d4e01b17a740a4ddf3d50866c4ce663;hb=051d85f28d2e48597d10aaba85dbd8949afd8e2a;hpb=1c0e1baaaaf0314f49470fb49a4f5e6ddc0ba1a1 diff --git a/src/hardware/korad-kaxxxxp/protocol.h b/src/hardware/korad-kaxxxxp/protocol.h index 7082b153..46a38962 100644 --- a/src/hardware/korad-kaxxxxp/protocol.h +++ b/src/hardware/korad-kaxxxxp/protocol.h @@ -2,7 +2,7 @@ * This file is part of the libsigrok project. * * Copyright (C) 2015 Hannu Vuolasaho - * Copyright (C) 2018 Frank Stettner + * Copyright (C) 2018-2019 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 @@ -37,12 +37,21 @@ enum { KORAD_KA3005P, KORAD_KA3005P_0X01, KORAD_KA3005P_0XBC, + KORAD_KA3005P_V42, + KORAD_KA3005P_V55, KORAD_KD3005P, KORAD_KD3005P_V20_NOSP, + KORAD_KD3005P_V21_NOSP, + RND_320_KD3005P, + RND_320_KA3005P, RND_320K30PV, + TENMA_72_2550_V2, TENMA_72_2540_V20, TENMA_72_2540_V21, + TENMA_72_2540_V52, + TENMA_72_2535_V21, STAMOS_SLS31_V20, + KORAD_KD6005P, /* Support for future devices with this protocol. */ }; @@ -60,9 +69,9 @@ struct korad_kaxxxxp_model { /* Reply targets */ enum { KAXXXXP_CURRENT, - KAXXXXP_CURRENT_MAX, + KAXXXXP_CURRENT_LIMIT, KAXXXXP_VOLTAGE, - KAXXXXP_VOLTAGE_MAX, + KAXXXXP_VOLTAGE_TARGET, KAXXXXP_STATUS, KAXXXXP_OUTPUT, KAXXXXP_BEEP, @@ -80,9 +89,9 @@ struct dev_context { GMutex rw_mutex; float current; /**< Last current value [A] read from device. */ - float current_max; /**< Output current set. */ + float current_limit; /**< Output current set. */ float voltage; /**< Last voltage value [V] read from device. */ - float voltage_max; /**< Output voltage set. */ + float voltage_target; /**< Output voltage set. */ gboolean cc_mode[2]; /**< Device is in CC mode (otherwise CV). */ gboolean output_enabled; /**< Is the output enabled? */ @@ -90,14 +99,27 @@ struct dev_context { gboolean ocp_enabled; /**< Output current protection enabled. */ gboolean ovp_enabled; /**< Output voltage protection enabled. */ + gboolean cc_mode_1_changed; /**< CC mode of channel 1 has changed. */ + gboolean cc_mode_2_changed; /**< CC mode of channel 2 has changed. */ + gboolean output_enabled_changed; /**< Output enabled state has changed. */ + gboolean ocp_enabled_changed; /**< OCP enabled state has changed. */ + gboolean ovp_enabled_changed; /**< OVP enabled state has changed. */ + int acquisition_target; /**< What reply to expect. */ int program; /**< Program to store or recall. */ + + float set_current_limit; /**< New output current to set. */ + float set_voltage_target; /**< New output voltage to set. */ + gboolean set_output_enabled; /**< New output enabled to set. */ + gboolean set_beep_enabled; /**< New enable beeper to set. */ + gboolean set_ocp_enabled; /**< New OCP enabled to set. */ + gboolean set_ovp_enabled; /**< New OVP enabled to set. */ }; SR_PRIV int korad_kaxxxxp_send_cmd(struct sr_serial_dev_inst *serial, const char *cmd); SR_PRIV int korad_kaxxxxp_read_chars(struct sr_serial_dev_inst *serial, - int count, char *buf); + size_t count, char *buf); SR_PRIV int korad_kaxxxxp_set_value(struct sr_serial_dev_inst *serial, int target, struct dev_context *devc); SR_PRIV int korad_kaxxxxp_get_value(struct sr_serial_dev_inst *serial,