devc->logic_pattern = DEFAULT_LOGIC_PATTERN;
devc->num_analog_channels = num_analog_channels;
devc->limit_frames = limit_frames;
+ devc->capture_ratio = 20;
+ devc->stl = NULL;
if (num_logic_channels > 0) {
/* Logic channels, all in one channel group. */
uint8_t mask;
GHashTableIter iter;
void *value;
+ struct sr_trigger *trigger;
devc = sdi->priv;
devc->sent_samples = 0;
devc->sent_frame_samples = 0;
+ /* Setup triggers */
+ if ((trigger = sr_session_trigger_get(sdi->session))) {
+ int pre_trigger_samples = 0;
+ if (devc->limit_samples > 0)
+ pre_trigger_samples = (devc->capture_ratio * devc->limit_samples) / 100;
+ devc->stl = soft_trigger_logic_new(sdi, trigger, pre_trigger_samples);
+ if (!devc->stl)
+ return SR_ERR_MALLOC;
+
+ /* Disable all analog channels since using them when there are logic
+ * triggers set up would require having pre-trigger sample buffers
+ * for analog sample data.
+ */
+ for (l = sdi->channels; l; l = l->next) {
+ ch = l->data;
+ if (ch->type == SR_CHANNEL_ANALOG)
+ ch->enabled = FALSE;
+ }
+ }
+ devc->trigger_fired = FALSE;
+
/*
* Determine the numbers of logic and analog channels that are
* involved in the acquisition. Determine an offset and a mask to
std_session_send_df_end(sdi);
+ if (devc->stl) {
+ soft_trigger_logic_free(devc->stl);
+ devc->stl = NULL;
+ }
+
return SR_OK;
}