#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);

  drawGrid(white);

  // 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:

}
interfacetestBreakout
uart-data-monBreakout