1.1 --- a/examples/vga/main.c Sat Nov 03 16:42:17 2018 +0100
1.2 +++ b/examples/vga/main.c Sat Nov 03 21:47:40 2018 +0100
1.3 @@ -81,6 +81,12 @@
1.4
1.5
1.6
1.7 +/* Framebuffer memory. */
1.8 +
1.9 +static uint8_t framebuffer[FRAME_SIZE * FRAME_COUNT];
1.10 +
1.11 +
1.12 +
1.13 /* Bundled image and font data. */
1.14
1.15 extern uint8_t screendata[];
1.16 @@ -309,6 +315,13 @@
1.17 pm_on(0);
1.18 #endif
1.19
1.20 + uart_init(1, FPB, 115200);
1.21 + uart_on(1);
1.22 +
1.23 + /* Initialise memory for a double-buffered display. */
1.24 +
1.25 + init_display(&display_config, framebuffer, LINE_LENGTH, LINE_COUNT, FRAME_COUNT);
1.26 +
1.27 /* Initialise VGA output with one or two line channels, configuring a line
1.28 timer and any transfer timer, with an initiating channel being introduced
1.29 if a transfer timer is specified. */
1.30 @@ -321,16 +334,13 @@
1.31 vga_configure_transfer(VGA_OUTPUT);
1.32 vga_configure_sync(1, 2);
1.33
1.34 - uart_init(1, FPB, 115200);
1.35 - uart_on(1);
1.36 -
1.37 interrupts_on();
1.38
1.39 /* Plot the image centred on the screen. */
1.40
1.41 copy_display(&display_config, screendata, screendata_width, screendata_height,
1.42 - (LINE_LENGTH - screendata_width) / 2,
1.43 - (LINE_COUNT - screendata_height) / 2, -1, 1);
1.44 + (display_config.line_length - screendata_width) / 2,
1.45 + (display_config.line_count - screendata_height) / 2, -1, 1);
1.46
1.47 /* Write a sequence of characters. */
1.48
1.49 @@ -338,7 +348,7 @@
1.50
1.51 /* Move a sprite around on the screen with a delay between each movement. */
1.52
1.53 - animate(1 << 21);
1.54 + animate(1 << 18);
1.55 }
1.56
1.57