1.1 --- a/examples/vga-pmp/main.c Tue Oct 23 22:14:20 2018 +0200
1.2 +++ b/examples/vga-pmp/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,7 @@
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 @@ -109,7 +104,7 @@
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) linedata), LINE_LENGTH,
1.44 + dma_set_transfer(0, PHYSICAL((uint32_t) linedata), display_config.line_length,
1.45 HW_PHYSICAL(PM_REG(0, PMxDIN)), 1,
1.46 TRANSFER_CELL_SIZE);
1.47
1.48 @@ -201,8 +196,8 @@
1.49
1.50 /* Set the line address. */
1.51
1.52 - linedata = screenstart;
1.53 - dma_set_source(0, PHYSICAL((uint32_t) linedata), LINE_LENGTH);
1.54 + linedata = display_config.screen_start;
1.55 + dma_set_source(0, PHYSICAL((uint32_t) linedata), display_config.line_length);
1.56
1.57 /* Enable the channel for the next line. */
1.58
1.59 @@ -217,14 +212,14 @@
1.60 {
1.61 /* Update the line address and handle wraparound. */
1.62
1.63 - if (!(line % LINE_MULTIPLIER))
1.64 + if (!(line % display_config.line_multiplier))
1.65 {
1.66 - linedata += LINE_LENGTH;
1.67 - if (linedata >= linedatalimit)
1.68 - linedata -= SCREEN_SIZE;
1.69 + linedata += display_config.line_length;
1.70 + if (linedata >= display_config.screen_limit)
1.71 + linedata -= display_config.screen_size;
1.72 }
1.73
1.74 - dma_set_source(0, PHYSICAL((uint32_t) linedata), LINE_LENGTH);
1.75 + dma_set_source(0, PHYSICAL((uint32_t) linedata), display_config.line_length);
1.76 return;
1.77 }
1.78