diff --git a/main.c b/main.c index 4ef62d5..f8e7cd9 100644 --- a/main.c +++ b/main.c @@ -16,6 +16,7 @@ #include "Crystalfontz128x128_ST7735.h" #include #include "buttons.h" +#include "grlib/grlib.h" #include "sampling.h" #include #include "inc/hw_memmap.h" @@ -79,6 +80,25 @@ int main(void) { while (true) { GrContextForegroundSet(&sContext, ClrBlack); GrRectFill(&sContext, &rectFullScreen); // fill screen with black + + // assumming square lcd + #define HEIGHT LCD_VERTICAL_MAX + #define PIXELS_PER_DIV 20 + + GrContextForegroundSet(&sContext, ClrBlue); + + uint8_t xy_pos; + // draw gridlines from the center out + for (xy_pos = HEIGHT/2; xy_pos < HEIGHT; xy_pos += PIXELS_PER_DIV) { + GrLineDrawV(&sContext, xy_pos, 0, 128); // right + GrLineDrawV(&sContext, HEIGHT - xy_pos, 0, 128); // left + + GrLineDrawH(&sContext, 0, 128, xy_pos); // down + GrLineDrawH(&sContext, 0, 128, HEIGHT - xy_pos); // up + } + + + time = gTime; // read shared global only once uint32_t hundredths = time % 100;