mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2025-04-08 16:07:27 +03:00
ubb-vga: option -d to double the number of set/clear pairs, improving resolution
- README: added compatibility of double mode - ubb-vga.c (usage, main): new option -d to double the number of set/clear pairs (making lines longer and the apparent pixel clock slower) - ubb-vga.c (grab, session, main): have a complete set/clear pair for each pixel in double mode
This commit is contained in:
parent
dab839ab66
commit
67107d0062
@ -43,11 +43,18 @@ don't mind.
|
|||||||
Compatibility
|
Compatibility
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
ubb-vga has been tested with the following monitors:
|
ubb-vga in single mode has been tested with the following monitors:
|
||||||
|
|
||||||
Display Size Quality
|
Display Monitor size Quality
|
||||||
----------------------- --------------- ----------------------------------
|
----------------------- --------------- ----------------------------------
|
||||||
Xenon XEN-1510T 15", 1024x768 good
|
Xenon XEN-1510T 15", 1024x768 good
|
||||||
Samsung 206NW 20", 1680x1050 poor (horizontal instability)
|
Samsung 206NW 20", 1680x1050 poor (horizontal instability)
|
||||||
LG W2243C 22", 1920x1080 acceptable (slight instability)
|
LG W2243C 22", 1920x1080 acceptable (slight instability)
|
||||||
LG W2243L 22", 1920x1080 acceptable (slight instability)
|
LG W2243L 22", 1920x1080 acceptable (slight instability)
|
||||||
|
|
||||||
|
In double mode:
|
||||||
|
|
||||||
|
Display Pixels missing Quality
|
||||||
|
left/right
|
||||||
|
----------------------- --------------- ------------------
|
||||||
|
Xenon XEN-1510T 5 / 25 good
|
||||||
|
@ -229,7 +229,7 @@ static void until(uint16_t cycles)
|
|||||||
/* ----- Frame buffer output ----------------------------------------------- */
|
/* ----- Frame buffer output ----------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
static int line_pairs = 160; /* set/unset pairs */
|
static int line_pairs = 160; /* set/clear pairs */
|
||||||
static int line_cycles = US(36); /* nominally 31.77 us, but we're too slow */
|
static int line_cycles = US(36); /* nominally 31.77 us, but we're too slow */
|
||||||
|
|
||||||
|
|
||||||
@ -366,19 +366,28 @@ static void grid(uint8_t *f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void grab(uint8_t *f)
|
static void grab(uint8_t *f, int single)
|
||||||
{
|
{
|
||||||
uint32_t *fb = map(0x01d00000, 4*320*240);
|
uint32_t *fb = map(0x01d00000, 4*320*240);
|
||||||
int x, y;
|
int x, y;
|
||||||
uint32_t pix;
|
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++) {
|
for (x = 0; x != 320; x++) {
|
||||||
pix = *fb++;
|
pix = *fb++;
|
||||||
*f++ = pattern(!(x & 1),
|
r = pix >> 16;
|
||||||
((pix >> 16) & 255) >= thres,
|
g = pix >> 8;
|
||||||
((pix >> 8) & 255) >= thres,
|
b = pix;
|
||||||
(pix & 255) >= thres);
|
if (single)
|
||||||
|
*f++ = pattern(!(x & 1),
|
||||||
|
r >= thres, g >= thres, b >= thres);
|
||||||
|
else {
|
||||||
|
*f++ = pattern(1,
|
||||||
|
r >= thres, g >= thres, b >= thres);
|
||||||
|
*f++ = pattern(0,
|
||||||
|
r >= thres, g >= thres, b >= thres);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,13 +395,13 @@ static void grab(uint8_t *f)
|
|||||||
/* ----- Command-line parsing and main loop -------------------------------- */
|
/* ----- Command-line parsing and main loop -------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
static void session(int frames)
|
static void session(int frames, int single)
|
||||||
{
|
{
|
||||||
uint8_t f[2*line_pairs*(240+1)];
|
uint8_t f[2*line_pairs*(240+1)];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(f, 0, sizeof(f));
|
memset(f, 0, sizeof(f));
|
||||||
grab(f);
|
grab(f, single);
|
||||||
// grid(f);
|
// grid(f);
|
||||||
|
|
||||||
disable_interrupts();
|
disable_interrupts();
|
||||||
@ -406,7 +415,12 @@ static void session(int frames)
|
|||||||
|
|
||||||
static void usage(const char *name)
|
static void usage(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: %s frames [threshold]\n", name);
|
fprintf(stderr,
|
||||||
|
"usage: %s frames -d [threshold]\n\n"
|
||||||
|
" frames number of frames to display\n"
|
||||||
|
" threshold channel on/off threshold\n\n"
|
||||||
|
" -d double the number of set/clear pairs\n"
|
||||||
|
, name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,10 +428,16 @@ 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, "d")) != EOF)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case 'd':
|
||||||
|
single = 0;
|
||||||
|
line_pairs = 320;
|
||||||
|
line_cycles = US(36+26);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage(*argv);
|
usage(*argv);
|
||||||
}
|
}
|
||||||
@ -434,7 +454,7 @@ int main(int argc, char *const *argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
session(frames);
|
session(frames, single);
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user