/** The device supports setting trigger slope. */
SR_CONF_TRIGGER_SLOPE,
+ /** The device supports setting a pattern for the logic trigger. */
+ SR_CONF_TRIGGER_PATTERN,
+
/** The device supports averaging. */
SR_CONF_AVERAGING,
case SR_CONF_TRIGGER_SLOPE:
*data = g_variant_new_string((*model->trigger_slopes)[state->trigger_slope]);
break;
+ case SR_CONF_TRIGGER_PATTERN:
+ *data = g_variant_new_string(state->trigger_pattern);
+ break;
case SR_CONF_HORIZ_TRIGGERPOS:
*data = g_variant_new_double(state->horiz_triggerpos);
break;
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
int ret, cg_type, idx, j;
- char command[MAX_COMMAND_SIZE], float_str[30];
+ char command[MAX_COMMAND_SIZE], float_str[30], *tmp_str;
struct dev_context *devc;
const struct scope_config *model;
struct scope_state *state;
(*model->trigger_slopes)[idx]);
ret = sr_scpi_send(sdi->conn, command);
break;
+ case SR_CONF_TRIGGER_PATTERN:
+ tmp_str = (char *)g_variant_get_string(data, 0);
+ idx = strlen(tmp_str);
+ if (idx == 0 || idx > model->analog_channels + model->digital_channels)
+ return SR_ERR_ARG;
+ g_snprintf(command, sizeof(command),
+ (*model->scpi_dialect)[SCPI_CMD_SET_TRIGGER_PATTERN],
+ tmp_str);
+ if (sr_scpi_send(sdi->conn, command) != SR_OK ||
+ sr_scpi_get_opc(sdi->conn) != SR_OK)
+ return SR_ERR;
+ g_free(state->trigger_pattern);
+ state->trigger_pattern = g_strdup(tmp_str);
+ ret = SR_OK;
+ break;
case SR_CONF_COUPLING:
if (!cg)
return SR_ERR_CHANNEL_GROUP;
[SCPI_CMD_SET_DIG_POD_STATE] = ":POD%d:STAT %d",
[SCPI_CMD_GET_TRIGGER_SLOPE] = ":TRIG:A:EDGE:SLOP?",
[SCPI_CMD_SET_TRIGGER_SLOPE] = ":TRIG:A:TYPE EDGE;:TRIG:A:EDGE:SLOP %s",
+ [SCPI_CMD_GET_TRIGGER_PATTERN] = ":TRIG:A:PATT:SOUR?",
+ [SCPI_CMD_SET_TRIGGER_PATTERN] = ":TRIG:A:TYPE LOGIC;" \
+ ":TRIG:A:PATT:FUNC AND;" \
+ ":TRIG:A:PATT:COND TRUE;" \
+ ":TRIG:A:PATT:MODE OFF;" \
+ ":TRIG:A:PATT:SOUR \"%s\"",
[SCPI_CMD_GET_TRIGGER_SOURCE] = ":TRIG:A:SOUR?",
[SCPI_CMD_SET_TRIGGER_SOURCE] = ":TRIG:A:SOUR %s",
[SCPI_CMD_GET_DIG_CHAN_STATE] = ":LOG%d:STAT?",
SR_CONF_HORIZ_TRIGGERPOS | SR_CONF_GET | SR_CONF_SET,
SR_CONF_TRIGGER_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_TRIGGER_SLOPE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+ SR_CONF_TRIGGER_PATTERN | SR_CONF_GET | SR_CONF_SET,
};
static const uint32_t devopts_cg_analog[] = {
sr_info("Current samplerate: %s", tmp);
g_free(tmp);
- 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 (!strcmp("PATT", (*config->trigger_sources)[state->trigger_source]))
+ sr_info("Current trigger: %s (pattern), %.2f (offset)",
+ state->trigger_pattern,
+ state->horiz_triggerpos);
+ else // Edge (slope) trigger
+ 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);
}
static int scope_state_get_array_option(struct sr_scpi_dev_inst *scpi,
&state->trigger_slope) != SR_OK)
return SR_ERR;
+ if (sr_scpi_get_string(sdi->conn,
+ (*config->scpi_dialect)[SCPI_CMD_GET_TRIGGER_PATTERN],
+ &state->trigger_pattern) != SR_OK)
+ return SR_ERR;
+
if (hmo_update_sample_rate(sdi) != SR_OK)
return SR_ERR;
#define LOG_PREFIX "hameg-hmo"
#define MAX_INSTRUMENT_VERSIONS 10
-#define MAX_COMMAND_SIZE 48
+#define MAX_COMMAND_SIZE 128
#define MAX_ANALOG_CHANNEL_COUNT 4
#define MAX_DIGITAL_CHANNEL_COUNT 16
#define MAX_DIGITAL_GROUP_COUNT 2
int trigger_source;
int trigger_slope;
+ char *trigger_pattern;
+
uint64_t sample_rate;
};
"Run length encoding", NULL},
{SR_CONF_TRIGGER_SLOPE, SR_T_STRING, "triggerslope",
"Trigger slope", NULL},
+ {SR_CONF_TRIGGER_PATTERN, SR_T_STRING, "triggerpattern",
+ "Trigger pattern", NULL},
{SR_CONF_AVERAGING, SR_T_BOOL, "averaging",
"Averaging", NULL},
{SR_CONF_AVG_SAMPLES, SR_T_UINT64, "avg_samples",
SCPI_CMD_SET_VERTICAL_DIV,
SCPI_CMD_GET_TRIGGER_SLOPE,
SCPI_CMD_SET_TRIGGER_SLOPE,
+ SCPI_CMD_GET_TRIGGER_PATTERN,
+ SCPI_CMD_SET_TRIGGER_PATTERN,
SCPI_CMD_GET_TRIGGER_SOURCE,
SCPI_CMD_SET_TRIGGER_SOURCE,
SCPI_CMD_GET_COUPLING,