#ifndef LIBSIGROK_HARDWARE_RDTECH_DPS_PROTOCOL_H
#define LIBSIGROK_HARDWARE_RDTECH_DPS_PROTOCOL_H
-#include <config.h>
+#include "config.h"
#include <glib.h>
#include <libsigrok/libsigrok.h>
MODEL_RD,
};
-struct rdtech_dps_model {
- enum rdtech_dps_model_type model_type;
- unsigned int id;
- const char *name;
+struct rdtech_dps_range {
+ const char *range_str;
unsigned int max_current;
unsigned int max_voltage;
unsigned int max_power;
unsigned int voltage_digits;
};
+struct rdtech_dps_model {
+ enum rdtech_dps_model_type model_type;
+ unsigned int id;
+ const char *name;
+ const struct rdtech_dps_range *ranges;
+ size_t n_ranges;
+};
+
struct dev_context {
const struct rdtech_dps_model *model;
double current_multiplier;
gboolean curr_ocp_state;
gboolean curr_cc_state;
gboolean curr_out_state;
+ size_t curr_range;
+ gboolean acquisition_started;
};
/* Container to get and set parameter values. */
STATE_VOLTAGE = 1 << 10,
STATE_CURRENT = 1 << 11,
STATE_POWER = 1 << 12,
+ STATE_RANGE = 1 << 13,
} mask;
gboolean lock;
gboolean output_enabled, regulation_cc;
float voltage_target, current_limit;
float ovp_threshold, ocp_threshold;
float voltage, current, power;
+ size_t range;
};
enum rdtech_dps_state_context {
SR_PRIV int rdtech_dps_get_model_version(struct sr_modbus_dev_inst *modbus,
enum rdtech_dps_model_type model_type,
uint16_t *model, uint16_t *version, uint32_t *serno);
+SR_PRIV void rdtech_dps_update_multipliers(const struct sr_dev_inst *sdi);
+SR_PRIV int rdtech_dps_update_range(const struct sr_dev_inst *sdi);
SR_PRIV int rdtech_dps_seed_receive(const struct sr_dev_inst *sdi);
SR_PRIV int rdtech_dps_receive_data(int fd, int revents, void *cb_data);