From: HÃ¥vard Espeland Date: Fri, 30 Apr 2010 20:18:55 +0000 (+0200) Subject: cli: Show trigger event in bits plugin. X-Git-Tag: libsigrok-0.1.0~538 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5045c217e69d6bbb5ca52c75799a4d64c72bfafd;p=libsigrok.git cli: Show trigger event in bits plugin. --- diff --git a/output/output_text.c b/output/output_text.c index b10f6eb7..82487df0 100644 --- a/output/output_text.c +++ b/output/output_text.c @@ -37,6 +37,7 @@ struct context { int spl_cnt; uint8_t *linevalues; char *header; + int mark_trigger; }; static void flush_linebufs(struct context *ctx, char *outbuf) @@ -60,6 +61,12 @@ static void flush_linebufs(struct context *ctx, char *outbuf) sprintf(outbuf + strlen(outbuf), "%*s:%s\n", max_probename_len, ctx->probelist[i], ctx->linebuf + i * ctx->linebuf_len); } + + /* Mark trigger with ^ */ + if (ctx->mark_trigger != -1) + sprintf(outbuf + strlen(outbuf), "T:%*s^\n", + ctx->mark_trigger + (ctx->mark_trigger / 8), ""); + memset(ctx->linebuf, 0, i * ctx->linebuf_len); } @@ -86,6 +93,7 @@ static int init(struct output *o, int default_spl) ctx->unitsize = (ctx->num_enabled_probes + 7) / 8; ctx->line_offset = 0; ctx->spl_cnt = 0; + ctx->mark_trigger = -1; if (o->param && o->param[0]) ctx->samples_per_line = strtoul(o->param, NULL, 10); @@ -121,6 +129,7 @@ static int event(struct output *o, int event_type, char **data_out, ctx = o->internal; switch (event_type) { case DF_TRIGGER: + ctx->mark_trigger = ctx->spl_cnt; break; case DF_END: outsize = ctx->num_enabled_probes @@ -189,6 +198,7 @@ static int data_bits(struct output *o, char *data_in, uint64_t length_in, if (ctx->spl_cnt >= ctx->samples_per_line) { flush_linebufs(ctx, outbuf); ctx->line_offset = ctx->spl_cnt = 0; + ctx->mark_trigger = -1; } } } else