From: Gerhard Sittig Date: Sun, 13 May 2018 17:40:00 +0000 (+0200) Subject: demo: add convenient bit mask for "all logic channels" X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=015f09702a95ca3f3d17f3f45f24657547312fe3 demo: add convenient bit mask for "all logic channels" Keep a context variable around with a bit mask for all logic channels. This is convenient in setup and generation routines, to avoid garbage in unassigned bit positions of session feed packets. --- diff --git a/src/hardware/demo/api.c b/src/hardware/demo/api.c index c5259b28..7f2971db 100644 --- a/src/hardware/demo/api.c +++ b/src/hardware/demo/api.c @@ -119,6 +119,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) devc->cur_samplerate = SR_KHZ(200); devc->num_logic_channels = num_logic_channels; devc->logic_unitsize = (devc->num_logic_channels + 7) / 8; + devc->all_logic_channels_mask = 1UL << 0; + devc->all_logic_channels_mask <<= devc->num_logic_channels; + devc->all_logic_channels_mask--; devc->logic_pattern = DEFAULT_LOGIC_PATTERN; devc->num_analog_channels = num_analog_channels; diff --git a/src/hardware/demo/protocol.h b/src/hardware/demo/protocol.h index e2934980..c35ea2d4 100644 --- a/src/hardware/demo/protocol.h +++ b/src/hardware/demo/protocol.h @@ -99,6 +99,7 @@ struct dev_context { /* Logic */ int32_t num_logic_channels; size_t logic_unitsize; + uint64_t all_logic_channels_mask; /* There is only ever one logic channel group, so its pattern goes here. */ enum logic_pattern_type logic_pattern; uint8_t logic_data[LOGIC_BUFSIZE];