korad-kaxxxxp: Add two channels "V" and "I", remove channel "CH1"
This commit is contained in:
parent
16e88c6b93
commit
23165d7bb2
|
@ -134,7 +134,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
sdi->inst_type = SR_INST_SERIAL;
|
||||
sdi->conn = serial;
|
||||
|
||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "CH1");
|
||||
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "V");
|
||||
sr_channel_new(sdi, 1, SR_CHANNEL_ANALOG, TRUE, "I");
|
||||
|
||||
devc = g_malloc0(sizeof(struct dev_context));
|
||||
sr_sw_limits_init(&devc->limits);
|
||||
|
|
|
@ -333,6 +333,7 @@ SR_PRIV int korad_kaxxxxp_receive_data(int fd, int revents, void *cb_data)
|
|||
struct sr_analog_meaning meaning;
|
||||
struct sr_analog_spec spec;
|
||||
uint64_t elapsed_us;
|
||||
GSList *l;
|
||||
|
||||
(void)fd;
|
||||
|
||||
|
@ -354,9 +355,11 @@ SR_PRIV int korad_kaxxxxp_receive_data(int fd, int revents, void *cb_data)
|
|||
/* Send the value forward. */
|
||||
packet.type = SR_DF_ANALOG;
|
||||
packet.payload = &analog;
|
||||
analog.meaning->channels = sdi->channels;
|
||||
analog.num_samples = 1;
|
||||
l = g_slist_copy(sdi->channels);
|
||||
if (devc->target == KAXXXXP_CURRENT) {
|
||||
l = g_slist_remove_link(l, g_slist_nth(l, 0));
|
||||
analog.meaning->channels = l;
|
||||
analog.meaning->mq = SR_MQ_CURRENT;
|
||||
analog.meaning->unit = SR_UNIT_AMPERE;
|
||||
analog.meaning->mqflags = 0;
|
||||
|
@ -365,7 +368,9 @@ SR_PRIV int korad_kaxxxxp_receive_data(int fd, int revents, void *cb_data)
|
|||
analog.data = &devc->current;
|
||||
sr_session_send(sdi, &packet);
|
||||
}
|
||||
if (devc->target == KAXXXXP_VOLTAGE) {
|
||||
else if (devc->target == KAXXXXP_VOLTAGE) {
|
||||
l = g_slist_remove_link(l, g_slist_nth(l, 1));
|
||||
analog.meaning->channels = l;
|
||||
analog.meaning->mq = SR_MQ_VOLTAGE;
|
||||
analog.meaning->unit = SR_UNIT_VOLT;
|
||||
analog.meaning->mqflags = SR_MQFLAG_DC;
|
||||
|
|
Loading…
Reference in New Issue