mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-16 18:45:54 +02: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:
parent
9a455c55fc
commit
625d9877ab
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
|
|
||||||
static uint8_t thres = 63;
|
static uint8_t thres = 63;
|
||||||
int bad;
|
static int bad;
|
||||||
|
|
||||||
/* ----- I/O pin assignment ------------------------------------------------ */
|
/* ----- I/O pin assignment ------------------------------------------------ */
|
||||||
|
|
||||||
@ -378,10 +378,8 @@ static void frame(const uint32_t *f)
|
|||||||
*pddats = HSYNC;
|
*pddats = HSYNC;
|
||||||
until(line_cycles-US(0.79));
|
until(line_cycles-US(0.79));
|
||||||
|
|
||||||
for (p = f; p != f+240*line_words; p += line_words) {
|
for (p = f; p != f+480*line_words; p += line_words)
|
||||||
line(p, p);
|
|
||||||
line(p, p+line_words);
|
line(p, p+line_words);
|
||||||
}
|
|
||||||
|
|
||||||
/* Back porch */
|
/* Back porch */
|
||||||
hdelay(14);
|
hdelay(14);
|
||||||
@ -462,23 +460,27 @@ static void grab(uint8_t *f)
|
|||||||
uint32_t pix;
|
uint32_t pix;
|
||||||
uint8_t r, g, b;
|
uint8_t r, g, b;
|
||||||
|
|
||||||
for (y = 0; y != 240; y++)
|
for (y = 0; y != 240; y++) {
|
||||||
for (x = 0; x != 320; x++) {
|
for (x = 0; x != 320; x++) {
|
||||||
pix = *fb++;
|
pix = *fb++;
|
||||||
r = pix >> 16;
|
r = pix >> 16;
|
||||||
g = pix >> 8;
|
g = pix >> 8;
|
||||||
b = pix;
|
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 -------------------------------- */
|
/* ----- 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;
|
int i;
|
||||||
|
|
||||||
memset(f, 0, sizeof(f));
|
memset(f, 0, sizeof(f));
|
||||||
@ -508,7 +510,6 @@ static void usage(const char *name)
|
|||||||
int main(int argc, char *const *argv)
|
int main(int argc, char *const *argv)
|
||||||
{
|
{
|
||||||
int frames;
|
int frames;
|
||||||
int single = 1;
|
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "")) != EOF)
|
while ((c = getopt(argc, argv, "")) != EOF)
|
||||||
@ -529,9 +530,10 @@ int main(int argc, char *const *argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
session(frames, single);
|
session(frames);
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
printf("%d\n", bad);
|
if (bad)
|
||||||
|
printf("%d timeout%s\n", bad, bad == 1 ? "" : "s");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user