arachnid-labs-re-load-pro: Get a response when in acquision mode.
This commit is contained in:
parent
706350360a
commit
b3e715e528
|
@ -325,26 +325,33 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_source_add(sdi->session, serial, G_IO_IN, 100,
|
|
||||||
reloadpro_receive_data, (void *)sdi);
|
|
||||||
|
|
||||||
sr_sw_limits_acquisition_start(&devc->limits);
|
sr_sw_limits_acquisition_start(&devc->limits);
|
||||||
std_session_send_df_header(sdi);
|
std_session_send_df_header(sdi);
|
||||||
|
|
||||||
memset(devc->buf, 0, RELOADPRO_BUFSIZE);
|
memset(devc->buf, 0, RELOADPRO_BUFSIZE);
|
||||||
devc->buflen = 0;
|
devc->buflen = 0;
|
||||||
|
|
||||||
|
g_mutex_init(&devc->acquisition_mutex);
|
||||||
|
|
||||||
|
serial_source_add(sdi->session, serial, G_IO_IN, 100,
|
||||||
|
reloadpro_receive_data, (void *)sdi);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
|
int ret;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
devc->acquisition_running = FALSE;
|
devc->acquisition_running = FALSE;
|
||||||
|
|
||||||
return std_serial_dev_acquisition_stop(sdi);
|
ret = std_serial_dev_acquisition_stop(sdi);
|
||||||
|
g_mutex_clear(&devc->acquisition_mutex);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
|
static struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
#define READ_TIMEOUT_MS 1000
|
#define READ_TIMEOUT_MS 500
|
||||||
|
|
||||||
static int send_cmd(const struct sr_dev_inst *sdi, const char *cmd,
|
static int send_cmd(const struct sr_dev_inst *sdi, const char *cmd,
|
||||||
char *replybuf, int replybufsize)
|
char *replybuf, int replybufsize)
|
||||||
|
@ -66,55 +66,67 @@ static int send_cmd(const struct sr_dev_inst *sdi, const char *cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int reloadpro_set_current_limit(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_set_current_limit(const struct sr_dev_inst *sdi,
|
||||||
float current)
|
float current_limit)
|
||||||
{
|
{
|
||||||
|
struct dev_context *devc;
|
||||||
int ret, ma;
|
int ret, ma;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
if (current < 0 || current > 6) {
|
devc = sdi->priv;
|
||||||
sr_err("The current limit must be 0-6 A (was %f A).", current);
|
|
||||||
|
if (current_limit < 0 || current_limit > 6) {
|
||||||
|
sr_err("The current limit must be 0-6 A (was %f A).", current_limit);
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hardware expects current in mA, integer (0..6000). */
|
/* Hardware expects current limit in mA, integer (0..6000). */
|
||||||
ma = (int)round(current * 1000);
|
ma = (int)round(current_limit * 1000);
|
||||||
|
|
||||||
sr_spew("Setting current limit to %f A (%d mA).", current, ma);
|
|
||||||
|
|
||||||
cmd = g_strdup_printf("set %d\n", ma);
|
cmd = g_strdup_printf("set %d\n", ma);
|
||||||
if ((ret = send_cmd(sdi, cmd, (char *)&buf, sizeof(buf))) < 0) {
|
g_mutex_lock(&devc->acquisition_mutex);
|
||||||
sr_err("Error sending current limit command: %d.", ret);
|
ret = send_cmd(sdi, cmd, (char *)&buf, sizeof(buf));
|
||||||
g_free(cmd);
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
g_free(cmd);
|
g_free(cmd);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
sr_err("Error sending current limit command: %d.", ret);
|
||||||
|
return SR_ERR;
|
||||||
|
}
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int reloadpro_set_on_off(const struct sr_dev_inst *sdi, gboolean on)
|
SR_PRIV int reloadpro_set_on_off(const struct sr_dev_inst *sdi, gboolean on)
|
||||||
{
|
{
|
||||||
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
|
|
||||||
|
devc = sdi->priv;
|
||||||
|
|
||||||
cmd = (on) ? "on\n" : "off\n";
|
cmd = (on) ? "on\n" : "off\n";
|
||||||
if ((ret = send_cmd(sdi, cmd, (char *)&buf, sizeof(buf))) < 0) {
|
g_mutex_lock(&devc->acquisition_mutex);
|
||||||
|
ret = send_cmd(sdi, cmd, (char *)&buf, sizeof(buf));
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
sr_err("Error sending on/off command: %d.", ret);
|
sr_err("Error sending on/off command: %d.", ret);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int reloadpro_set_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_set_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
||||||
float voltage)
|
float voltage)
|
||||||
{
|
{
|
||||||
|
struct dev_context *devc;
|
||||||
int ret, mv;
|
int ret, mv;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (voltage < 0 || voltage > 60) {
|
if (voltage < 0 || voltage > 60) {
|
||||||
sr_err("The under voltage threshold must be 0-60 V (was %f V).",
|
sr_err("The under voltage threshold must be 0-60 V (was %f V).",
|
||||||
voltage);
|
voltage);
|
||||||
|
@ -127,56 +139,86 @@ SR_PRIV int reloadpro_set_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
||||||
sr_spew("Setting under voltage threshold to %f V (%d mV).", voltage, mv);
|
sr_spew("Setting under voltage threshold to %f V (%d mV).", voltage, mv);
|
||||||
|
|
||||||
cmd = g_strdup_printf("uvlo %d\n", mv);
|
cmd = g_strdup_printf("uvlo %d\n", mv);
|
||||||
if ((ret = send_cmd(sdi, cmd, (char *)&buf, sizeof(buf))) < 0) {
|
g_mutex_lock(&devc->acquisition_mutex);
|
||||||
sr_err("Error sending under voltage threshold command: %d.", ret);
|
ret = send_cmd(sdi, cmd, (char *)&buf, sizeof(buf));
|
||||||
g_free(cmd);
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
g_free(cmd);
|
g_free(cmd);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
sr_err("Error sending under voltage threshold command: %d.", ret);
|
||||||
|
return SR_ERR;
|
||||||
|
}
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int reloadpro_get_current_limit(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_get_current_limit(const struct sr_dev_inst *sdi,
|
||||||
float *current)
|
float *current_limit)
|
||||||
{
|
{
|
||||||
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
struct dev_context *devc;
|
gint64 end_time;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
g_mutex_lock(&devc->acquisition_mutex);
|
||||||
if ((ret = send_cmd(sdi, "set\n", (char *)&buf, sizeof(buf))) < 0) {
|
if ((ret = send_cmd(sdi, "set\n", (char *)&buf, sizeof(buf))) < 0) {
|
||||||
sr_err("Error sending current limit query: %d.", ret);
|
sr_err("Error sending current limit query: %d.", ret);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!devc->acquisition_running) {
|
if (devc->acquisition_running) {
|
||||||
/* Hardware sends current in mA, integer (0..6000). */
|
end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND;
|
||||||
*current = g_ascii_strtod(buf + 4, NULL) / 1000;
|
if (!g_cond_wait_until(&devc->current_limit_cond,
|
||||||
|
&devc->acquisition_mutex, end_time)) {
|
||||||
|
// timeout has passed.
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
|
return SR_ERR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Hardware sends current limit in mA, integer (0..6000). */
|
||||||
|
devc->current_limit = g_ascii_strtod(buf + 4, NULL) / 1000;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
|
|
||||||
|
if (current_limit)
|
||||||
|
*current_limit = devc->current_limit;
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV int reloadpro_get_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_get_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
||||||
float *voltage)
|
float *uvc_threshold)
|
||||||
{
|
{
|
||||||
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
struct dev_context *devc;
|
gint64 end_time;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
g_mutex_lock(&devc->acquisition_mutex);
|
||||||
if ((ret = send_cmd(sdi, "uvlo\n", (char *)&buf, sizeof(buf))) < 0) {
|
if ((ret = send_cmd(sdi, "uvlo\n", (char *)&buf, sizeof(buf))) < 0) {
|
||||||
sr_err("Error sending under voltage threshold query: %d.", ret);
|
sr_err("Error sending under voltage threshold query: %d.", ret);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!devc->acquisition_running) {
|
if (devc->acquisition_running) {
|
||||||
|
end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND;
|
||||||
|
if (!g_cond_wait_until(&devc->uvc_threshold_cond,
|
||||||
|
&devc->acquisition_mutex, end_time)) {
|
||||||
|
// timeout has passed.
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
|
return SR_ERR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
/* Hardware sends voltage in mV, integer (0..60000). */
|
/* Hardware sends voltage in mV, integer (0..60000). */
|
||||||
*voltage = g_ascii_strtod(buf + 5, NULL) / 1000;
|
devc->uvc_threshold = g_ascii_strtod(buf + 5, NULL) / 1000;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
|
|
||||||
|
if (uvc_threshold)
|
||||||
|
*uvc_threshold = devc->uvc_threshold;
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -184,27 +226,41 @@ SR_PRIV int reloadpro_get_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
||||||
SR_PRIV int reloadpro_get_voltage_current(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_get_voltage_current(const struct sr_dev_inst *sdi,
|
||||||
float *voltage, float *current)
|
float *voltage, float *current)
|
||||||
{
|
{
|
||||||
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
char buf[100];
|
char buf[100];
|
||||||
char **tokens;
|
char **tokens;
|
||||||
struct dev_context *devc;
|
gint64 end_time;
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
g_mutex_lock(&devc->acquisition_mutex);
|
||||||
if ((ret = send_cmd(sdi, "read\n", (char *)&buf, sizeof(buf))) < 0) {
|
if ((ret = send_cmd(sdi, "read\n", (char *)&buf, sizeof(buf))) < 0) {
|
||||||
sr_err("Error sending voltage/current query: %d.", ret);
|
sr_err("Error sending voltage/current query: %d.", ret);
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!devc->acquisition_running) {
|
if (devc->acquisition_running) {
|
||||||
|
end_time = g_get_monotonic_time () + 5 * G_TIME_SPAN_SECOND;
|
||||||
|
if (!g_cond_wait_until(&devc->voltage_cond,
|
||||||
|
&devc->acquisition_mutex, end_time)) {
|
||||||
|
// timeout has passed.
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
|
return SR_ERR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
/* Reply: "read <current> <voltage>". */
|
/* Reply: "read <current> <voltage>". */
|
||||||
tokens = g_strsplit((const char *)&buf, " ", 3);
|
tokens = g_strsplit((const char *)&buf, " ", 3);
|
||||||
if (voltage)
|
devc->voltage = g_ascii_strtod(tokens[2], NULL) / 1000;
|
||||||
*voltage = g_ascii_strtod(tokens[2], NULL) / 1000;
|
devc->current = g_ascii_strtod(tokens[1], NULL) / 1000;
|
||||||
if (current)
|
|
||||||
*current = g_ascii_strtod(tokens[1], NULL) / 1000;
|
|
||||||
g_strfreev(tokens);
|
g_strfreev(tokens);
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
|
|
||||||
|
if (voltage)
|
||||||
|
*voltage = devc->voltage;
|
||||||
|
if (current)
|
||||||
|
*current = devc->current;
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +292,6 @@ static int send_config_update_key(const struct sr_dev_inst *sdi,
|
||||||
|
|
||||||
static void handle_packet(const struct sr_dev_inst *sdi)
|
static void handle_packet(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
float voltage, current;
|
|
||||||
struct sr_datafeed_packet packet;
|
struct sr_datafeed_packet packet;
|
||||||
struct sr_datafeed_analog analog;
|
struct sr_datafeed_analog analog;
|
||||||
struct sr_analog_encoding encoding;
|
struct sr_analog_encoding encoding;
|
||||||
|
@ -271,18 +326,20 @@ static void handle_packet(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
if (g_str_has_prefix((const char *)devc->buf, "set ")) {
|
if (g_str_has_prefix((const char *)devc->buf, "set ")) {
|
||||||
tokens = g_strsplit((const char *)devc->buf, " ", 2);
|
tokens = g_strsplit((const char *)devc->buf, " ", 2);
|
||||||
current = g_ascii_strtod(tokens[1], NULL) / 1000;
|
devc->current_limit = g_ascii_strtod(tokens[1], NULL) / 1000;
|
||||||
g_strfreev(tokens);
|
g_strfreev(tokens);
|
||||||
|
g_cond_signal(&devc->current_limit_cond);
|
||||||
send_config_update_key(sdi, SR_CONF_CURRENT_LIMIT,
|
send_config_update_key(sdi, SR_CONF_CURRENT_LIMIT,
|
||||||
g_variant_new_double(current));
|
g_variant_new_double(devc->current_limit));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_str_has_prefix((const char *)devc->buf, "uvlo ")) {
|
if (g_str_has_prefix((const char *)devc->buf, "uvlo ")) {
|
||||||
tokens = g_strsplit((const char *)devc->buf, " ", 2);
|
tokens = g_strsplit((const char *)devc->buf, " ", 2);
|
||||||
voltage = g_ascii_strtod(tokens[1], NULL) / 1000;
|
devc->uvc_threshold = g_ascii_strtod(tokens[1], NULL) / 1000;
|
||||||
g_strfreev(tokens);
|
g_strfreev(tokens);
|
||||||
if (voltage == .0) {
|
g_cond_signal(&devc->uvc_threshold_cond);
|
||||||
|
if (devc->uvc_threshold == .0) {
|
||||||
send_config_update_key(sdi, SR_CONF_UNDER_VOLTAGE_CONDITION,
|
send_config_update_key(sdi, SR_CONF_UNDER_VOLTAGE_CONDITION,
|
||||||
g_variant_new_boolean(FALSE));
|
g_variant_new_boolean(FALSE));
|
||||||
} else {
|
} else {
|
||||||
|
@ -290,7 +347,7 @@ static void handle_packet(const struct sr_dev_inst *sdi)
|
||||||
g_variant_new_boolean(TRUE));
|
g_variant_new_boolean(TRUE));
|
||||||
send_config_update_key(sdi,
|
send_config_update_key(sdi,
|
||||||
SR_CONF_UNDER_VOLTAGE_CONDITION_THRESHOLD,
|
SR_CONF_UNDER_VOLTAGE_CONDITION_THRESHOLD,
|
||||||
g_variant_new_double(voltage));
|
g_variant_new_double(devc->uvc_threshold));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -301,8 +358,8 @@ static void handle_packet(const struct sr_dev_inst *sdi)
|
||||||
}
|
}
|
||||||
|
|
||||||
tokens = g_strsplit((const char *)devc->buf, " ", 3);
|
tokens = g_strsplit((const char *)devc->buf, " ", 3);
|
||||||
voltage = g_ascii_strtod(tokens[2], NULL) / 1000;
|
devc->voltage = g_ascii_strtod(tokens[2], NULL) / 1000;
|
||||||
current = g_ascii_strtod(tokens[1], NULL) / 1000;
|
devc->current = g_ascii_strtod(tokens[1], NULL) / 1000;
|
||||||
g_strfreev(tokens);
|
g_strfreev(tokens);
|
||||||
|
|
||||||
/* Begin frame. */
|
/* Begin frame. */
|
||||||
|
@ -323,7 +380,7 @@ static void handle_packet(const struct sr_dev_inst *sdi)
|
||||||
meaning.mq = SR_MQ_VOLTAGE;
|
meaning.mq = SR_MQ_VOLTAGE;
|
||||||
meaning.mqflags = SR_MQFLAG_DC;
|
meaning.mqflags = SR_MQFLAG_DC;
|
||||||
meaning.unit = SR_UNIT_VOLT;
|
meaning.unit = SR_UNIT_VOLT;
|
||||||
analog.data = &voltage;
|
analog.data = &devc->voltage;
|
||||||
sr_session_send(sdi, &packet);
|
sr_session_send(sdi, &packet);
|
||||||
g_slist_free(l);
|
g_slist_free(l);
|
||||||
|
|
||||||
|
@ -334,7 +391,7 @@ static void handle_packet(const struct sr_dev_inst *sdi)
|
||||||
meaning.mq = SR_MQ_CURRENT;
|
meaning.mq = SR_MQ_CURRENT;
|
||||||
meaning.mqflags = SR_MQFLAG_DC;
|
meaning.mqflags = SR_MQFLAG_DC;
|
||||||
meaning.unit = SR_UNIT_AMPERE;
|
meaning.unit = SR_UNIT_AMPERE;
|
||||||
analog.data = ¤t;
|
analog.data = &devc->current;
|
||||||
sr_session_send(sdi, &packet);
|
sr_session_send(sdi, &packet);
|
||||||
g_slist_free(l);
|
g_slist_free(l);
|
||||||
|
|
||||||
|
@ -358,20 +415,25 @@ static void handle_new_data(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
len = RELOADPRO_BUFSIZE - devc->buflen;
|
len = RELOADPRO_BUFSIZE - devc->buflen;
|
||||||
buf = devc->buf;
|
buf = devc->buf;
|
||||||
|
g_mutex_lock(&devc->acquisition_mutex);
|
||||||
if (serial_readline(serial, &buf, &len, 250) != SR_OK) {
|
if (serial_readline(serial, &buf, &len, 250) != SR_OK) {
|
||||||
sr_err("Err: ");
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0) {
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
return; /* No new bytes, nothing to do. */
|
return; /* No new bytes, nothing to do. */
|
||||||
|
}
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
sr_err("Serial port read error: %d.", len);
|
sr_err("Serial port read error: %d.", len);
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
devc->buflen += len;
|
devc->buflen += len;
|
||||||
|
|
||||||
handle_packet(sdi);
|
handle_packet(sdi);
|
||||||
|
g_mutex_unlock(&devc->acquisition_mutex);
|
||||||
memset(devc->buf, 0, RELOADPRO_BUFSIZE);
|
memset(devc->buf, 0, RELOADPRO_BUFSIZE);
|
||||||
devc->buflen = 0;
|
devc->buflen = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,23 +30,35 @@
|
||||||
#define RELOADPRO_BUFSIZE 100
|
#define RELOADPRO_BUFSIZE 100
|
||||||
|
|
||||||
struct dev_context {
|
struct dev_context {
|
||||||
gboolean acquisition_running;
|
|
||||||
struct sr_sw_limits limits;
|
struct sr_sw_limits limits;
|
||||||
|
|
||||||
char buf[RELOADPRO_BUFSIZE];
|
char buf[RELOADPRO_BUFSIZE];
|
||||||
int buflen;
|
int buflen;
|
||||||
|
|
||||||
|
float current_limit;
|
||||||
|
float voltage;
|
||||||
|
float current;
|
||||||
gboolean otp_active;
|
gboolean otp_active;
|
||||||
gboolean uvc_active;
|
gboolean uvc_active;
|
||||||
|
float uvc_threshold;
|
||||||
|
|
||||||
|
gboolean acquisition_running;
|
||||||
|
GMutex acquisition_mutex;
|
||||||
|
|
||||||
|
GCond current_limit_cond;
|
||||||
|
GCond voltage_cond;
|
||||||
|
GCond uvc_threshold_cond;
|
||||||
};
|
};
|
||||||
|
|
||||||
SR_PRIV int reloadpro_set_current_limit(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_set_current_limit(const struct sr_dev_inst *sdi,
|
||||||
float current);
|
float current);
|
||||||
SR_PRIV int reloadpro_set_on_off(const struct sr_dev_inst *sdi, gboolean on);
|
SR_PRIV int reloadpro_set_on_off(const struct sr_dev_inst *sdi, gboolean on);
|
||||||
SR_PRIV int reloadpro_set_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_set_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
||||||
float voltage);
|
float uvc_threshold);
|
||||||
SR_PRIV int reloadpro_get_current_limit(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_get_current_limit(const struct sr_dev_inst *sdi,
|
||||||
float *current);
|
float *current_limit);
|
||||||
SR_PRIV int reloadpro_get_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_get_under_voltage_threshold(const struct sr_dev_inst *sdi,
|
||||||
float *voltage);
|
float *uvc_threshold);
|
||||||
SR_PRIV int reloadpro_get_voltage_current(const struct sr_dev_inst *sdi,
|
SR_PRIV int reloadpro_get_voltage_current(const struct sr_dev_inst *sdi,
|
||||||
float *voltage, float *current);
|
float *voltage, float *current);
|
||||||
SR_PRIV int reloadpro_receive_data(int fd, int revents, void *cb_data);
|
SR_PRIV int reloadpro_receive_data(int fd, int revents, void *cb_data);
|
||||||
|
|
Loading…
Reference in New Issue