zoom/dactest/rearrange.c
jim 3bcb136417 DAC test stuff
git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@5920 ddd99763-3ecb-0310-9145-efcb8ce7c51f
2008-02-11 21:19:38 +00:00

41 lines
541 B
C

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
/* rearrange things so instead of
0 1
0 2
0 3
1 4
1 5
1 6
we just print
0 1 2 3
1 4 5 6
*/
int main(void)
{
uint32_t dac, adc;
uint32_t olddac;
int first = 1;
while(1) {
scanf("%d %d", &dac, &adc);
if (feof(stdin))
break;
if (first) {
printf("%ld ", dac);
first = 0;
} else if (dac != olddac) {
printf("\n%ld ", dac);
} else {
printf(" ");
}
printf("%ld", adc);
olddac = dac;
}
printf("\n");
return 0;
}