X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Frdtech-dps%2Fprotocol.h;h=d6619e5301321d109b68e3daa5156697a134e3d4;hb=e4204b1757459a03c0a70849a659f27387edc295;hp=3224e1b5220f1750c9cfe914e458e178efc4aa9b;hpb=8686b747cd40695c36f998603f6e853ee5eea883;p=libsigrok.git diff --git a/src/hardware/rdtech-dps/protocol.h b/src/hardware/rdtech-dps/protocol.h index 3224e1b5..d6619e53 100644 --- a/src/hardware/rdtech-dps/protocol.h +++ b/src/hardware/rdtech-dps/protocol.h @@ -2,6 +2,7 @@ * This file is part of the libsigrok project. * * Copyright (C) 2018 James Churchill + * Copyright (C) 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 @@ -33,12 +34,20 @@ struct rdtech_dps_model { unsigned int max_current; unsigned int max_voltage; unsigned int max_power; + unsigned int current_digits; + unsigned int voltage_digits; }; struct dev_context { const struct rdtech_dps_model *model; struct sr_sw_limits limits; - int expecting_registers; + GMutex rw_mutex; + double current_multiplier; + double voltage_multiplier; + gboolean actual_ovp_state; + gboolean actual_ocp_state; + uint16_t actual_regulation_state; + uint16_t actual_output_state; }; enum rdtech_dps_register { @@ -84,13 +93,15 @@ enum rdtech_dps_mode { MODE_CC = 1, }; -SR_PRIV int rdtech_dps_get_reg(struct sr_modbus_dev_inst *modbus, uint16_t address, uint16_t *value); -SR_PRIV int rdtech_dps_set_reg(struct sr_modbus_dev_inst *modbus, uint16_t address, uint16_t value); +SR_PRIV int rdtech_dps_read_holding_registers(struct sr_modbus_dev_inst *modbus, + int address, int nb_registers, uint16_t *registers); + +SR_PRIV int rdtech_dps_get_reg(const struct sr_dev_inst *sdi, uint16_t address, uint16_t *value); +SR_PRIV int rdtech_dps_set_reg(const struct sr_dev_inst *sdi, uint16_t address, uint16_t value); SR_PRIV int rdtech_dps_get_model_version(struct sr_modbus_dev_inst *modbus, uint16_t *model, uint16_t *version); -SR_PRIV int rdtech_dps_capture_start(const struct sr_dev_inst *sdi); SR_PRIV int rdtech_dps_receive_data(int fd, int revents, void *cb_data); #endif