Perfec 640x480 1bpp VGA.
This commit is contained in:
parent
ac5c39ff0c
commit
2baddfc76e
@ -36,7 +36,7 @@
|
|||||||
// to fill the vertical blanking interval at top and bottom
|
// to fill the vertical blanking interval at top and bottom
|
||||||
// of the display
|
// of the display
|
||||||
// (at 1BPP, this wastes about 1k)
|
// (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)
|
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
|
// skip wasted blanking lines
|
||||||
// (see frame struct declaration)
|
// (see frame struct declaration)
|
||||||
y += VBBLANK + VFBLANK;
|
y += VBBLANK + VSPULSE - 1;
|
||||||
|
|
||||||
// set bit
|
// set bit
|
||||||
frame[y * 80 + x / 8] |= (1 << x % 8);
|
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))
|
if (!valid_coord(x, y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
y += VBBLANK + VFBLANK;
|
y += VBBLANK + VSPULSE - 1;
|
||||||
frame[y * 80 + x / 8] &= ~(1 << x % 8);
|
frame[y * 80 + x / 8] &= ~(1 << x % 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ int main()
|
|||||||
// before the first DMA request, in order to
|
// before the first DMA request, in order to
|
||||||
// avoid any possible delay
|
// avoid any possible delay
|
||||||
dma_channel_configure(dma_channel, &dma_config, &pio0_hw->txf[2], &frame[0],
|
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;
|
dma_ready = true;
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user