demo: Fixed glitching in increment signal

This commit is contained in:
Joel Holdsworth 2013-04-13 16:08:52 +01:00 committed by Bert Vermeulen
parent f0b6ae19a8
commit bbd7ef0f18
1 changed files with 3 additions and 4 deletions

View File

@ -347,9 +347,8 @@ static void samples_generator(uint8_t *buf, uint64_t size,
switch (devc->sample_generator) { switch (devc->sample_generator) {
case PATTERN_SIGROK: /* sigrok pattern */ case PATTERN_SIGROK: /* sigrok pattern */
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
*(buf + i) = ~(pattern_sigrok[p] >> 1); *(buf + i) = ~(pattern_sigrok[
if (++p == 64) p++ % sizeof(pattern_sigrok)] >> 1);
p = 0;
} }
break; break;
case PATTERN_RANDOM: /* Random */ case PATTERN_RANDOM: /* Random */
@ -358,7 +357,7 @@ static void samples_generator(uint8_t *buf, uint64_t size,
break; break;
case PATTERN_INC: /* Simple increment */ case PATTERN_INC: /* Simple increment */
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
*(buf + i) = i; *(buf + i) = p++;
break; break;
case PATTERN_ALL_LOW: /* All probes are low */ case PATTERN_ALL_LOW: /* All probes are low */
memset(buf, 0x00, size); memset(buf, 0x00, size);