X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Flcr%2Fes51919.c;h=0e8635f6d06556de841cf1f127927d572ce72983;hb=64bc73f5282ec0e7da6e00a8d078191e5375dc5c;hp=862374129e3f836a226333cb413c86299dafbcb2;hpb=787ec9dbd9613d34e0afed6ec145f24917e450c5;p=libsigrok.git diff --git a/src/lcr/es51919.c b/src/lcr/es51919.c index 86237412..0e8635f6 100644 --- a/src/lcr/es51919.c +++ b/src/lcr/es51919.c @@ -21,7 +21,7 @@ #include #include #include -#include "libsigrok.h" +#include #include "libsigrok-internal.h" #define LOG_PREFIX "es51919" @@ -305,7 +305,6 @@ static int send_config_update_key(struct sr_dev_inst *sdi, uint32_t key, sr_config_free(cfg); return ret; - } /* @@ -403,7 +402,7 @@ static int send_config_update_key(struct sr_dev_inst *sdi, uint32_t key, #define PACKET_SIZE 17 -static const uint64_t frequencies[] = { +static const double frequencies[] = { 100, 120, 1000, 10000, 100000, 0, }; @@ -467,7 +466,7 @@ static int parse_mq(const uint8_t *pkt, int is_secondary, int is_parallel) switch (is_secondary << 8 | buf[0]) { case 0x001: - return is_parallel ? + return is_parallel ? SR_MQ_PARALLEL_INDUCTANCE : SR_MQ_SERIES_INDUCTANCE; case 0x002: return is_parallel ? @@ -607,7 +606,6 @@ static unsigned int parse_model(const uint8_t *pkt) return MODEL_PAR; else return MODEL_SER; - } static gboolean packet_valid(const uint8_t *pkt) @@ -638,7 +636,7 @@ static int do_config_update(struct sr_dev_inst *sdi, uint32_t key, static int send_freq_update(struct sr_dev_inst *sdi, unsigned int freq) { return do_config_update(sdi, SR_CONF_OUTPUT_FREQUENCY, - g_variant_new_uint64(frequencies[freq])); + g_variant_new_double(frequencies[freq])); } static int send_quant1_update(struct sr_dev_inst *sdi, unsigned int quant) @@ -792,16 +790,6 @@ static int receive_data(int fd, int revents, void *cb_data) return TRUE; } -static int add_channel(struct sr_dev_inst *sdi, int idx, const char *name) -{ - struct sr_channel *ch; - - ch = sr_channel_new(idx, SR_CHANNEL_ANALOG, TRUE, name); - sdi->channels = g_slist_append(sdi->channels, ch); - - return SR_OK; -} - static const char *const channel_names[] = { "P1", "P2" }; static int setup_channels(struct sr_dev_inst *sdi) @@ -811,11 +799,8 @@ static int setup_channels(struct sr_dev_inst *sdi) ret = SR_ERR_BUG; - for (i = 0; i < ARRAY_SIZE(channel_names); i++) { - ret = add_channel(sdi, i, channel_names[i]); - if (ret != SR_OK) - break; - } + for (i = 0; i < ARRAY_SIZE(channel_names); i++) + sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]); return ret; } @@ -892,7 +877,7 @@ SR_PRIV int es51919_serial_config_get(uint32_t key, GVariant **data, switch (key) { case SR_CONF_OUTPUT_FREQUENCY: - *data = g_variant_new_uint64(frequencies[devc->freq]); + *data = g_variant_new_double(frequencies[devc->freq]); break; case SR_CONF_MEASURED_QUANTITY: *data = g_variant_new_string(quantities1[devc->quant1]); @@ -975,8 +960,8 @@ SR_PRIV int es51919_serial_config_list(uint32_t key, GVariant **data, switch (key) { case SR_CONF_OUTPUT_FREQUENCY: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT64, - frequencies, ARRAY_SIZE(frequencies), sizeof(uint64_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_DOUBLE, + frequencies, ARRAY_SIZE(frequencies), sizeof(double)); break; case SR_CONF_MEASURED_QUANTITY: *data = g_variant_new_strv(list_quantities1,