#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#include "Display.h"
#include "Led.h"
#include "Square.h"

Generic_Display display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

Led mled(&display, (SCREEN_WIDTH  / 2), (SCREEN_HEIGHT  / 2));
Square squ(&display);

void setup()
{
  Serial.begin(9600);
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }

  mled.init();
  display.display();
}

void loop()
{
  unsigned long curr_time = millis();
  squ.handle(curr_time);
  mled.handle(curr_time);

  // The Led Class Method only manipulates display memory
  display.display();
}