1.1 --- a/lib/vga_display.c Wed Oct 24 15:31:56 2018 +0200
1.2 +++ b/lib/vga_display.c Wed Oct 24 15:46:42 2018 +0200
1.3 @@ -34,9 +34,7 @@
1.4 void init_vga(display_config_t *display_config,
1.5 void (*start_visible)(),
1.6 void (*update_visible)(),
1.7 - void (*stop_visible)(),
1.8 - void (*vsync_high)(),
1.9 - void (*vsync_low)())
1.10 + void (*stop_visible)())
1.11 {
1.12 /* Display parameters. */
1.13
1.14 @@ -48,11 +46,6 @@
1.15 vga_display.update_visible = update_visible;
1.16 vga_display.stop_visible = stop_visible;
1.17
1.18 - /* Vertical sync operations. */
1.19 -
1.20 - vga_display.vsync_high = vsync_high;
1.21 - vga_display.vsync_low = vsync_low;
1.22 -
1.23 /* Initial state. */
1.24
1.25 vga_display.state_handler = vbp_active;
1.26 @@ -64,6 +57,12 @@
1.27
1.28 void vga_configure_sync(int hsync_unit, int vsync_unit, int timer)
1.29 {
1.30 + /* Record the peripherals in use. */
1.31 +
1.32 + vga_display.hsync_unit = hsync_unit;
1.33 + vga_display.vsync_unit = vsync_unit;
1.34 + vga_display.timer = timer;
1.35 +
1.36 /* Configure a timer for the horizontal sync. The timer has no prescaling
1.37 (0). */
1.38
1.39 @@ -163,7 +162,7 @@
1.40
1.41 /* Bring vsync low when the next line starts. */
1.42
1.43 - vga_display.vsync_low();
1.44 + vsync_low();
1.45 }
1.46
1.47 /* Vertical sync region. */
1.48 @@ -180,5 +179,25 @@
1.49
1.50 /* Bring vsync high when the next line starts. */
1.51
1.52 - vga_display.vsync_high();
1.53 + vsync_high();
1.54 }
1.55 +
1.56 +
1.57 +
1.58 +/* Bring vsync low (single compare, output driven low) when the next line
1.59 + starts. */
1.60 +
1.61 +void vsync_low(void)
1.62 +{
1.63 + oc_init(vga_display.vsync_unit, 0b010, vga_display.timer);
1.64 + oc_on(vga_display.vsync_unit);
1.65 +}
1.66 +
1.67 +/* Bring vsync high (single compare, output driven high) when the next line
1.68 + starts. */
1.69 +
1.70 +void vsync_high(void)
1.71 +{
1.72 + oc_init(vga_display.vsync_unit, 0b001, vga_display.timer);
1.73 + oc_on(vga_display.vsync_unit);
1.74 +}