draw gridlines
This commit is contained in:
parent
fa95b4a93a
commit
c2a0fdd210
1 changed files with 20 additions and 0 deletions
20
main.c
20
main.c
|
@ -16,6 +16,7 @@
|
|||
#include "Crystalfontz128x128_ST7735.h"
|
||||
#include <stdio.h>
|
||||
#include "buttons.h"
|
||||
#include "grlib/grlib.h"
|
||||
#include "sampling.h"
|
||||
#include <math.h>
|
||||
#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;
|
||||
|
|
Loading…
Reference in a new issue