From: Bert Vermeulen Date: Tue, 1 Feb 2011 05:51:34 +0000 (+0100) Subject: demo: stored-pattern generator now keeps state X-Git-Tag: libsigrok-0.1.0~352 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=cddd1c5f4739e43365a48a9d17e49cb105d929c7;p=libsigrok.git demo: stored-pattern generator now keeps state --- diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index aac08599..f36024c8 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -206,14 +206,14 @@ static int hw_set_configuration(int device_index, int capability, void *value) static void samples_generator(uint8_t *buf, uint64_t size, void *data) { + static uint64_t p = 0; struct databag *mydata = data; - uint64_t p, i; + uint64_t i; memset(buf, 0, size); switch (mydata->sample_generator) { case GENMODE_DEFAULT: - p = 0; for (i = 0; i < size; i++) { *(buf + i) = ~(genmode_default[p] >> 1); if (++p == 64) @@ -352,6 +352,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) /* Run the demo thread. */ g_thread_init(NULL); + /* this needs to be done between g_thread_init() and g_thread_create() */ mydata->timer = g_timer_new(); thread_running = 1; my_thread =