From: Gerhard Sittig Date: Wed, 22 Dec 2021 12:17:59 +0000 (+0100) Subject: input: optionally send trigger markers from common feed queue helper X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=f478c3e613ac047572cfad9c5dcde965050b17fe input: optionally send trigger markers from common feed queue helper This further simplifies callers, which need not care about flushing previously queued samples before a trigger packet is sent. The queue itself handles the order of packet initiation. --- diff --git a/src/input/feed_queue.c b/src/input/feed_queue.c index bd5c16c7..b25fa77a 100644 --- a/src/input/feed_queue.c +++ b/src/input/feed_queue.c @@ -95,6 +95,21 @@ SR_API int feed_queue_logic_flush(struct feed_queue_logic *q) return SR_OK; } +SR_API int feed_queue_logic_send_trigger(struct feed_queue_logic *q) +{ + int ret; + + ret = feed_queue_logic_flush(q); + if (ret != SR_OK) + return ret; + + ret = std_session_send_df_trigger(q->sdi); + if (ret != SR_OK) + return ret; + + return SR_OK; +} + SR_API void feed_queue_logic_free(struct feed_queue_logic *q) { diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 7b64c714..4e414300 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -2692,6 +2692,7 @@ SR_API struct feed_queue_logic *feed_queue_logic_alloc( SR_API int feed_queue_logic_submit(struct feed_queue_logic *q, const uint8_t *data, size_t count); SR_API int feed_queue_logic_flush(struct feed_queue_logic *q); +SR_API int feed_queue_logic_send_trigger(struct feed_queue_logic *q); SR_API void feed_queue_logic_free(struct feed_queue_logic *q); SR_API struct feed_queue_analog *feed_queue_analog_alloc(