X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fhardware%2Fdemo%2Fapi.c;h=645ef5f2317744a3f019cb033528c5a9306266fe;hb=01f2adb07a66a4e8e8a6102c7f6bb905007d606a;hp=c6c27e3c0b8b7fb619b2224fc69eba6646ed403d;hpb=471ac344a5885c73f58cbcd0d0c87f416926afc2;p=libsigrok.git diff --git a/src/hardware/demo/api.c b/src/hardware/demo/api.c index c6c27e3c..645ef5f2 100644 --- a/src/hardware/demo/api.c +++ b/src/hardware/demo/api.c @@ -29,16 +29,21 @@ #include "protocol.h" #define DEFAULT_NUM_LOGIC_CHANNELS 8 -#define DEFAULT_NUM_ANALOG_CHANNELS 4 +#define DEFAULT_LOGIC_PATTERN PATTERN_SIGROK +#define DEFAULT_NUM_ANALOG_CHANNELS 4 #define DEFAULT_ANALOG_AMPLITUDE 10 +/* Note: No spaces allowed because of sigrok-cli. */ static const char *logic_pattern_str[] = { "sigrok", "random", "incremental", + "walking-one", + "walking-zero", "all-low", "all-high", + "squid", }; static const uint32_t drvopts[] = { @@ -114,7 +119,7 @@ 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->logic_pattern = PATTERN_SIGROK; + devc->logic_pattern = DEFAULT_LOGIC_PATTERN; devc->num_analog_channels = num_analog_channels; if (num_logic_channels > 0) { @@ -130,6 +135,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) } /* Analog channels, channel groups and pattern generators. */ + devc->ch_ag = g_hash_table_new(g_direct_hash, g_direct_equal); if (num_analog_channels > 0) { pattern = 0; /* An "Analog" channel group with all analog channels in it. */ @@ -137,7 +143,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) acg->name = g_strdup("Analog"); sdi->channel_groups = g_slist_append(sdi->channel_groups, acg); - devc->ch_ag = g_hash_table_new(g_direct_hash, g_direct_equal); for (i = 0; i < num_analog_channels; i++) { snprintf(channel_name, 16, "A%d", i); ch = sr_channel_new(sdi, i + num_logic_channels, SR_CHANNEL_ANALOG, @@ -152,6 +157,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) /* Every channel gets a generator struct. */ ag = g_malloc(sizeof(struct analog_gen)); + ag->ch = ch; ag->amplitude = DEFAULT_ANALOG_AMPLITUDE; sr_analog_init(&ag->packet, &ag->encoding, &ag->meaning, &ag->spec, 2); ag->packet.meaning->channels = cg->channels;