#include "disp.h"

void drawGrid(rgba_t col)
{
  for(int y=0; y<screenWidth; y+=8)
  {
      drawVLine(screenHeight, y, col);
  }
  for(int x=0; x<screenHeight; x+=8)
  {
      drawHLine(screenWidth, x, col);
  }
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  disp_init();

  // colors
  rgba_t taskBarColor = getColor(164,164,164, 255);
  rgba_t bg = getColor(0,128,128, 255);
  rgba_t white = getColor(255,255,255, 255);
  rgba_t black = getColor(0,0,0, 255);

  // draw test rect
  drawRect(0,0, screenWidth,screenHeight, true, bg);

  // draw bg.
  //drawBinaryImage(0,0, 640,480, "bigbg.bin");

  // draw taskbar
  int tbWidth = screenWidth;
  int tbHeight = 32;

  int tb_x = 0;
  int tb_y = screenHeight-tbHeight;

  drawRect(tb_x,tb_y, tbWidth,tbHeight, true, taskBarColor);

  int fontSize = 8;
  char* text = "THIS DISPLAY WORKS!!!";
  int text_x = screenWidth/2 - ( (fontSize * (strlen(text)-1)) / 2 );
  int text_y = screenHeight-(tbHeight/2 + (fontSize/2));

  setCursor(text_x, text_y); // calculate the center of the taskbar x and y
  printText(text, black);

  // put a pattern onto the uart data monitor chip
  Serial1.write(0xaa);
}

void loop() {
  // put your main code here, to run repeatedly:

}
mega:SCL
mega:SDA
mega:AREF
mega:GND.1
mega:13
mega:12
mega:11
mega:10
mega:9
mega:8
mega:7
mega:6
mega:5
mega:4
mega:3
mega:2
mega:1
mega:0
mega:14
mega:15
mega:16
mega:17
mega:18
mega:19
mega:20
mega:21
mega:5V.1
mega:5V.2
mega:22
mega:23
mega:24
mega:25
mega:26
mega:27
mega:28
mega:29
mega:30
mega:31
mega:32
mega:33
mega:34
mega:35
mega:36
mega:37
mega:38
mega:39
mega:40
mega:41
mega:42
mega:43
mega:44
mega:45
mega:46
mega:47
mega:48
mega:49
mega:50
mega:51
mega:52
mega:53
mega:GND.4
mega:GND.5
mega:IOREF
mega:RESET
mega:3.3V
mega:5V
mega:GND.2
mega:GND.3
mega:VIN
mega:A0
mega:A1
mega:A2
mega:A3
mega:A4
mega:A5
mega:A6
mega:A7
mega:A8
mega:A9
mega:A10
mega:A11
mega:A12
mega:A13
mega:A14
mega:A15
interfacetestBreakout
sd1:CD
sd1:DO
sd1:GND
sd1:SCK
sd1:VCC
sd1:DI
sd1:CS
uart-data-monBreakout
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
led5:A
led5:C
led6:A
led6:C
led7:A
led7:C
led8:A
led8:C