Rename VGA pixel clock state machine.

This commit is contained in:
giomba 2022-12-02 22:54:25 +01:00
parent fa0734fec0
commit 74e5da5405
2 changed files with 9 additions and 7 deletions

View File

@ -26,14 +26,16 @@
static void vga_pixel_program_init(PIO pio, uint sm, uint offset)
{
// magic definition of the called function?
pio_sm_config config = vga_free_run_program_get_default_config(offset);
// config function automatically declared by SDK scripts
// based on the names given to programs in .pio
pio_sm_config config = vga_pixel_program_get_default_config(offset);
// destination pins for OUT instructions
sm_config_set_out_pins(&config, 22, 1);
sm_config_set_out_shift(&config, true, true, 0);
pio_gpio_init(pio, 22);
pio_sm_set_consecutive_pindirs(pio, sm, 22, 1, true);
sm_config_set_wrap(&config, offset + vga_free_run_wrap_target, offset + vga_free_run_wrap);
sm_config_set_wrap(&config, offset + vga_pixel_wrap_target, offset + vga_pixel_wrap);
pio_sm_init(pio, sm, offset, &config);
@ -197,9 +199,9 @@ int main()
// VGA pixel program
vga_pixel_ptr = &vga_pixel;
printf("Starting VGA pixel machine... ");
if (!pio_can_add_program(vga_pixel.pio, &vga_free_run_program))
if (!pio_can_add_program(vga_pixel.pio, &vga_pixel_program))
panic("cannot add program");
vga_pixel.offset = pio_add_program(vga_pixel.pio, &vga_free_run_program);
vga_pixel.offset = pio_add_program(vga_pixel.pio, &vga_pixel_program);
vga_pixel.sm = pio_claim_unused_sm(vga_pixel.pio, false);
vga_pixel_program_init(vga_pixel.pio, vga_pixel.sm, vga_pixel.offset);
pio_sm_put_blocking(vga_pixel.pio, vga_pixel.sm, 640 - 1);

View File

@ -1,6 +1,6 @@
.program vga_free_run
.program vga_pixel
entrypoint_vga_free_run:
entrypoint_vga_pixel:
pull
mov y, osr