1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-24 01:00:36 +02:00

ubb-vga2.c: move display resolution to #defines

- ubb-vga2.c (XRES, line_words, session): don't hard-code the X resolution
- ubb-vga2.c (YRES, line_words, frame, session): don't hard-code the Y
  resolution
This commit is contained in:
Werner Almesberger 2011-04-28 02:14:15 -03:00
parent c8f19a0b4c
commit 6414d92412

View File

@ -37,8 +37,13 @@
#include "ubb-vga.h"
#define XRES 640
#define YRES 480
static int bad;
/* ----- I/O pin assignment ------------------------------------------------ */
@ -231,7 +236,7 @@ static void until(uint16_t cycles)
/* ----- Frame buffer output ----------------------------------------------- */
static int line_words = 640/8;
static int line_words = XRES/8;
//static int line_cycles = US(36); /* nominally 31.77 us, but we're too slow */
//static int line_cycles = US(32); /* nominally 31.77 us, but we're too slow */
static int line_cycles = US(29.6); /* nominally 31.77 us, but we're too fast */
@ -379,7 +384,7 @@ static void frame(const uint32_t *f)
*pddats = HSYNC;
until(line_cycles-US(0.79));
for (p = f; p != f+480*line_words; p += line_words)
for (p = f; p != f+YRES*line_words; p += line_words)
line(p, p+line_words);
/* Back porch */
@ -392,12 +397,12 @@ static void frame(const uint32_t *f)
static void session(void (*gen)(void *fb, int xres, int yres), int frames)
{
uint32_t f[2*240*(line_words+1)];
uint32_t f[YRES*(line_words+1)];
int i;
memset(f, 0, sizeof(f));
ccube_init();
gen(f, 640, 480);
gen(f, XRES, YRES);
disable_interrupts();