1.1 --- a/examples/vga/main.c Tue Oct 23 22:14:20 2018 +0200
1.2 +++ b/examples/vga/main.c Tue Oct 23 23:25:47 2018 +0200
1.3 @@ -28,6 +28,7 @@
1.4 #include "devconfig.h"
1.5 #include "vga.h"
1.6 #include "display.h"
1.7 +#include "display_config.h"
1.8
1.9
1.10
1.11 @@ -38,12 +39,11 @@
1.12
1.13 /* Pointers to pixel lines. */
1.14
1.15 -static uint8_t *linedata, *linedatalimit, *screenstart;
1.16 +static uint8_t *linedata;
1.17
1.18 /* Pixel data. */
1.19
1.20 static const uint8_t zerodata[ZERO_LENGTH] = {0};
1.21 -static uint8_t framebuffer[SCREEN_SIZE];
1.22
1.23
1.24
1.25 @@ -77,12 +77,8 @@
1.26 {
1.27 line = 0;
1.28 state_handler = vbp_active;
1.29 - test_linedata(framebuffer);
1.30
1.31 - /* Initialise the current display line pointer and display limit. */
1.32 -
1.33 - linedatalimit = framebuffer + SCREEN_SIZE;
1.34 - screenstart = framebuffer;
1.35 + test_linedata(&display_config);
1.36
1.37 init_memory();
1.38 init_pins();
1.39 @@ -102,7 +98,8 @@
1.40 dma_init(0, 3);
1.41 dma_set_auto_enable(0, 1);
1.42 dma_set_interrupt(0, T2, 1);
1.43 - dma_set_transfer(0, PHYSICAL((uint32_t) screenstart), LINE_LENGTH,
1.44 + dma_set_transfer(0, PHYSICAL((uint32_t) display_config.screen_start),
1.45 + display_config.line_length,
1.46 HW_PHYSICAL(PORTB), 1,
1.47 TRANSFER_CELL_SIZE);
1.48
1.49 @@ -192,8 +189,8 @@
1.50
1.51 /* Set the line address. */
1.52
1.53 - linedata = screenstart;
1.54 - dma_set_source(0, PHYSICAL((uint32_t) linedata), LINE_LENGTH);
1.55 + linedata = display_config.screen_start;
1.56 + dma_set_source(0, PHYSICAL((uint32_t) linedata), display_config.line_length);
1.57
1.58 /* Enable the channel for the next line. */
1.59
1.60 @@ -210,14 +207,14 @@
1.61 {
1.62 /* Update the line address and handle wraparound. */
1.63
1.64 - if (!(line % LINE_MULTIPLIER))
1.65 + if (!(line % display_config.line_multiplier))
1.66 {
1.67 - linedata += LINE_LENGTH;
1.68 - if (linedata >= linedatalimit)
1.69 - linedata -= SCREEN_SIZE;
1.70 + linedata += display_config.line_length;
1.71 + if (linedata >= display_config.screen_limit)
1.72 + linedata -= display_config.screen_size;
1.73 }
1.74
1.75 - dma_set_source(0, PHYSICAL((uint32_t) linedata), LINE_LENGTH);
1.76 + dma_set_source(0, PHYSICAL((uint32_t) linedata), display_config.line_length);
1.77 return;
1.78 }
1.79