1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-09-28 23:10:45 +03:00

ubb-vga2.c: make frame buffer fully VGA-sized; more cleanup

- ubb-vga2.c (frame, grab, session): keep all 480 lines in the frame
  buffer instead of duplicating them on output
- ubb-vga2.c (bad): make "static"
- ubb-vga2.c (session, main): removed the "single" argument
- ubb-vga2.c (main): complain about timeouts only if any occurred
This commit is contained in:
Werner Almesberger 2011-04-27 20:20:59 -03:00
parent 9a455c55fc
commit 625d9877ab

View File

@ -36,7 +36,7 @@
static uint8_t thres = 63;
int bad;
static int bad;
/* ----- I/O pin assignment ------------------------------------------------ */
@ -378,10 +378,8 @@ static void frame(const uint32_t *f)
*pddats = HSYNC;
until(line_cycles-US(0.79));
for (p = f; p != f+240*line_words; p += line_words) {
line(p, p);
for (p = f; p != f+480*line_words; p += line_words)
line(p, p+line_words);
}
/* Back porch */
hdelay(14);
@ -462,23 +460,27 @@ static void grab(uint8_t *f)
uint32_t pix;
uint8_t r, g, b;
for (y = 0; y != 240; y++)
for (y = 0; y != 240; y++) {
for (x = 0; x != 320; x++) {
pix = *fb++;
r = pix >> 16;
g = pix >> 8;
b = pix;
*f++ = pattern(r >= thres, g >= thres, b >= thres);
f[0] = f[320] =
pattern(r >= thres, g >= thres, b >= thres);
f++;
}
f += 320;
}
}
/* ----- Command-line parsing and main loop -------------------------------- */
static void session(int frames, int single)
static void session(int frames)
{
uint32_t f[2*240*line_words];
uint32_t f[2*240*(line_words+1)];
int i;
memset(f, 0, sizeof(f));
@ -508,7 +510,6 @@ static void usage(const char *name)
int main(int argc, char *const *argv)
{
int frames;
int single = 1;
int c;
while ((c = getopt(argc, argv, "")) != EOF)
@ -529,9 +530,10 @@ int main(int argc, char *const *argv)
}
setup();
session(frames, single);
session(frames);
cleanup();
printf("%d\n", bad);
if (bad)
printf("%d timeout%s\n", bad, bad == 1 ? "" : "s");
return 0;
}