Perfec 640x480 1bpp VGA.

This commit is contained in:
giomba 2022-12-02 21:10:54 +01:00
parent ac5c39ff0c
commit 2baddfc76e
1 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@
// to fill the vertical blanking interval at top and bottom
// of the display
// (at 1BPP, this wastes about 1k)
uint8_t frame[HPIXEL * (VPIXEL + VBBLANK + VFBLANK) * BPP / 8] = {0};
uint8_t frame[HPIXEL * (VSPULSE + VBBLANK + VPIXEL) * BPP / 8] = {0};
static void vga_pixel_program_init(PIO pio, uint sm, uint offset)
{
@ -166,7 +166,7 @@ void set_pixel(uint16_t x, uint16_t y)
// skip wasted blanking lines
// (see frame struct declaration)
y += VBBLANK + VFBLANK;
y += VBBLANK + VSPULSE - 1;
// set bit
frame[y * 80 + x / 8] |= (1 << x % 8);
@ -177,7 +177,7 @@ void clear_pixel(uint16_t x, uint16_t y)
if (!valid_coord(x, y))
return;
y += VBBLANK + VFBLANK;
y += VBBLANK + VSPULSE - 1;
frame[y * 80 + x / 8] &= ~(1 << x % 8);
}
@ -319,7 +319,7 @@ int main()
// before the first DMA request, in order to
// avoid any possible delay
dma_channel_configure(dma_channel, &dma_config, &pio0_hw->txf[2], &frame[0],
HPIXEL * (VPIXEL + VBBLANK + VFBLANK) / 32 - 1, true);
HPIXEL * (VSPULSE + VPIXEL + VBBLANK) / 32 - 1, true);
dma_ready = true;
printf("OK\n");