[SCPI_CMD_SET_DIG_CHAN_STATE] = ":LOG%d:STAT %d",
[SCPI_CMD_GET_VERTICAL_OFFSET] = ":CHAN%d:POS?",
[SCPI_CMD_GET_HORIZ_TRIGGERPOS] = ":TIM:POS?",
- [SCPI_CMD_SET_HORIZ_TRIGGERPOS] = ":TIM:POS %E",
+ [SCPI_CMD_SET_HORIZ_TRIGGERPOS] = ":TIM:POS %s",
[SCPI_CMD_GET_ANALOG_CHAN_STATE] = ":CHAN%d:STAT?",
[SCPI_CMD_SET_ANALOG_CHAN_STATE] = ":CHAN%d:STAT %d",
};
{ 10, 1 },
};
-static const char *scope_analog_probe_names[] = {
+static const char *scope_analog_channel_names[] = {
"CH1",
"CH2",
"CH3",
"CH4",
};
-static const char *scope_digital_probe_names[] = {
+static const char *scope_digital_channel_names[] = {
"D0",
"D1",
"D2",
.digital_channels = 8,
.digital_pods = 1,
- .analog_names = &scope_analog_probe_names,
- .digital_names = &scope_digital_probe_names,
+ .analog_names = &scope_analog_channel_names,
+ .digital_names = &scope_digital_channel_names,
.hw_caps = &hmo_hwcaps,
.num_hwcaps = ARRAY_SIZE(hmo_hwcaps),
.digital_channels = 8,
.digital_pods = 1,
- .analog_names = &scope_analog_probe_names,
- .digital_names = &scope_digital_probe_names,
+ .analog_names = &scope_analog_channel_names,
+ .digital_names = &scope_digital_channel_names,
.hw_caps = &hmo_hwcaps,
.num_hwcaps = ARRAY_SIZE(hmo_hwcaps),
sr_info("Current samplerate: %s", tmp);
g_free(tmp);
- sr_info("Current trigger: %s (source), %s (slope) %2.2e (offset)",
+ sr_info("Current trigger: %s (source), %s (slope) %.2f (offset)",
(*config->trigger_sources)[state->trigger_source],
(*config->trigger_slopes)[state->trigger_slope],
state->horiz_triggerpos);
if (sr_scpi_get_float(sdi->conn,
(*config->scpi_dialect)[SCPI_CMD_GET_HORIZ_TRIGGERPOS],
- &state->horiz_triggerpos) != SR_OK)
+ &tmp_float) != SR_OK)
return SR_ERR;
+ state->horiz_triggerpos = tmp_float /
+ (((double) (*config->timebases)[state->timebase][0] /
+ (*config->timebases)[state->timebase][1]) * config->num_xdivs);
+ state->horiz_triggerpos -= 0.5;
+ state->horiz_triggerpos *= -1;
if (scope_state_get_array_option(sdi->conn,
(*config->scpi_dialect)[SCPI_CMD_GET_TRIGGER_SOURCE],
char tmp[25];
int model_index;
unsigned int i, j;
- struct sr_probe *probe;
+ struct sr_channel *ch;
struct dev_context *devc;
devc = sdi->priv;
return SR_ERR_NA;
}
- if (!(devc->analog_groups = g_try_malloc0(sizeof(struct sr_probe_group) *
+ if (!(devc->analog_groups = g_try_malloc0(sizeof(struct sr_channel_group) *
scope_models[model_index].analog_channels)))
return SR_ERR_MALLOC;
- if (!(devc->digital_groups = g_try_malloc0(sizeof(struct sr_probe_group) *
+ if (!(devc->digital_groups = g_try_malloc0(sizeof(struct sr_channel_group) *
scope_models[model_index].digital_pods)))
return SR_ERR_MALLOC;
/* Add analog channels. */
for (i = 0; i < scope_models[model_index].analog_channels; i++) {
- if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE,
+ if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
(*scope_models[model_index].analog_names)[i])))
return SR_ERR_MALLOC;
- sdi->probes = g_slist_append(sdi->probes, probe);
+ sdi->channels = g_slist_append(sdi->channels, ch);
devc->analog_groups[i].name =
(char *)(*scope_models[model_index].analog_names)[i];
- devc->analog_groups[i].probes = g_slist_append(NULL, probe);
+ devc->analog_groups[i].channels = g_slist_append(NULL, ch);
- sdi->probe_groups = g_slist_append(sdi->probe_groups,
+ sdi->channel_groups = g_slist_append(sdi->channel_groups,
&devc->analog_groups[i]);
}
- /* Add digital probe groups. */
+ /* Add digital channel groups. */
for (i = 0; i < scope_models[model_index].digital_pods; ++i) {
g_snprintf(tmp, 25, "POD%d", i);
devc->digital_groups[i].name = g_strdup(tmp);
- sdi->probe_groups = g_slist_append(sdi->probe_groups,
+ sdi->channel_groups = g_slist_append(sdi->channel_groups,
&devc->digital_groups[i < 8 ? 0 : 1]);
}
/* Add digital channels. */
for (i = 0; i < scope_models[model_index].digital_channels; i++) {
- if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
+ if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
(*scope_models[model_index].digital_names)[i])))
return SR_ERR_MALLOC;
- sdi->probes = g_slist_append(sdi->probes, probe);
+ sdi->channels = g_slist_append(sdi->channels, ch);
- devc->digital_groups[i < 8 ? 0 : 1].probes = g_slist_append(
- devc->digital_groups[i < 8 ? 0 : 1].probes, probe);
+ devc->digital_groups[i < 8 ? 0 : 1].channels = g_slist_append(
+ devc->digital_groups[i < 8 ? 0 : 1].channels, ch);
}
devc->model_config = &scope_models[model_index];
SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
{
- struct sr_probe *probe;
+ struct sr_channel *ch;
struct sr_dev_inst *sdi;
struct dev_context *devc;
struct sr_datafeed_packet packet;
return TRUE;
if (revents == G_IO_IN) {
- probe = devc->current_probe->data;
+ ch = devc->current_channel->data;
- switch (probe->type) {
- case SR_PROBE_ANALOG:
+ switch (ch->type) {
+ case SR_CHANNEL_ANALOG:
if (sr_scpi_get_floatv(sdi->conn, NULL, &data) != SR_OK) {
if (data)
g_array_free(data, TRUE);
packet.type = SR_DF_FRAME_BEGIN;
sr_session_send(sdi, &packet);
- analog.probes = g_slist_append(NULL, probe);
+ analog.channels = g_slist_append(NULL, ch);
analog.num_samples = data->len;
analog.data = (float *) data->data;
analog.mq = SR_MQ_VOLTAGE;
packet.type = SR_DF_ANALOG;
packet.payload = &analog;
sr_session_send(cb_data, &packet);
- g_slist_free(analog.probes);
+ g_slist_free(analog.channels);
g_array_free(data, TRUE);
break;
- case SR_PROBE_LOGIC:
+ case SR_CHANNEL_LOGIC:
if (sr_scpi_get_uint8v(sdi->conn, NULL, &data) != SR_OK) {
if (data)
g_free(data);
g_array_free(data, TRUE);
break;
default:
- sr_err("Invalid probe type.");
+ sr_err("Invalid channel type.");
break;
}
packet.type = SR_DF_FRAME_END;
sr_session_send(sdi, &packet);
- if (devc->current_probe->next) {
- devc->current_probe = devc->current_probe->next;
+ if (devc->current_channel->next) {
+ devc->current_channel = devc->current_channel->next;
hmo_request_data(sdi);
} else if (++devc->num_frames == devc->frame_limit) {
sdi->driver->dev_acquisition_stop(sdi, cb_data);
} else {
- devc->current_probe = devc->enabled_probes;
+ devc->current_channel = devc->enabled_channels;
hmo_request_data(sdi);
}
}