1.1 --- a/examples/vga/main.c Thu Nov 08 23:07:09 2018 +0100
1.2 +++ b/examples/vga/main.c Thu Nov 08 23:40:26 2018 +0100
1.3 @@ -18,19 +18,19 @@
1.4 */
1.5
1.6
1.7 -#include "pic32_c.h"
1.8 +#include "debug.h"
1.9 +#include "display.h"
1.10 +#include "font.h"
1.11 #include "init.h"
1.12 -#include "debug.h"
1.13 +#include "pic32_c.h"
1.14 +#include "utils.h"
1.15 +#include "vga_display.h"
1.16
1.17 /* Specific functionality. */
1.18
1.19 #include "devconfig.h"
1.20 -#include "display.h"
1.21 #include "display_config.h"
1.22 -#include "font.h"
1.23 #include "main.h"
1.24 -#include "vga.h"
1.25 -#include "vga_display.h"
1.26
1.27
1.28
1.29 @@ -106,34 +106,6 @@
1.30
1.31
1.32
1.33 -/* Busy wait. */
1.34 -
1.35 -static void wait(uint32_t delay)
1.36 -{
1.37 - uint32_t counter = delay;
1.38 -
1.39 - if (!delay) return;
1.40 - while (counter--) __asm__(""); /* retain loop */
1.41 -}
1.42 -
1.43 -/* Blink an attached LED with delays implemented using a loop. */
1.44 -
1.45 -static void blink(uint32_t delay, uint32_t port, uint32_t pins)
1.46 -{
1.47 - /* Clear outputs (LED). */
1.48 -
1.49 - CLR_REG(port, pins);
1.50 -
1.51 - while (1)
1.52 - {
1.53 - wait(delay);
1.54 -
1.55 - /* Invert outputs (LED). */
1.56 -
1.57 - INV_REG(port, pins);
1.58 - }
1.59 -}
1.60 -
1.61 /* Copy to the store from the display, then blit the image. */
1.62
1.63 static void plot_sprite(uint8_t *background, int x, int y)
1.64 @@ -155,18 +127,6 @@
1.65 x, y, -1, 1);
1.66 }
1.67
1.68 -/* Wrap a value within the bounds [0, limit). */
1.69 -
1.70 -static int wrap_value(int value, int limit)
1.71 -{
1.72 - if (value < 0)
1.73 - return limit - (-value % limit);
1.74 - else if (value >= limit)
1.75 - return (value - limit) % limit;
1.76 - else
1.77 - return value;
1.78 -}
1.79 -
1.80 /* Plot the revealed region at the edge of the screen after scrolling. */
1.81
1.82 static void plot_screen_edge(int xorigin, int yorigin, int xstep)