Sigma: Only send trigger packet if enabled.

The Sigma hardware emits a default trigger event.
This commit is contained in:
Håvard Espeland 2011-01-18 22:24:23 +01:00
parent abda62ced8
commit 5b5ea7c6d2
2 changed files with 12 additions and 4 deletions

View File

@ -407,6 +407,7 @@ static int hw_init(char *deviceinfo)
sigma->num_probes = 0;
sigma->samples_per_event = 0;
sigma->capture_ratio = 50;
sigma->use_triggers = 0;
/* Register SIGMA device. */
sdi = sigrok_device_instance_new(0, ST_INITIALIZING,
@ -654,6 +655,9 @@ static int configure_probes(struct sigrok_device_instance *sdi, GSList *probes)
return SIGROK_ERR;
}
}
if (trigger_set)
sigma->use_triggers = 1;
}
return SIGROK_OK;
@ -913,10 +917,13 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
sent += tosend;
}
packet.type = DF_TRIGGER;
packet.length = 0;
packet.payload = 0;
session_bus(sigma->session_id, &packet);
/* Only send trigger if explicitly enabled. */
if (sigma->use_triggers) {
packet.type = DF_TRIGGER;
packet.length = 0;
packet.payload = 0;
session_bus(sigma->session_id, &packet);
}
}
/* Send rest of the chunk to sigrok. */

View File

@ -183,6 +183,7 @@ struct sigma {
int samples_per_event;
int capture_ratio;
struct sigma_trigger trigger;
int use_triggers;
struct sigma_state state;
gpointer session_id;
};