/*
  Copyright (C) 2023, Pablo César Galdo Regueiro.
  info.wokwi(at)pcgaldo.com

  Project in editing process. Operation may be limited.

  A touchscreen in needed in order to
  activate two buttons simultaneously.


  License

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <https://www.gnu.org/licenses/>
*/

// Include Libraries
#include "Wire.h"
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"

// Splash Logo
#include "splash.h"

// Display Settings
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1

// OLED Display Instance
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// Function to initialize the SSD1306 display
bool initializeDisplay()
{
    if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
        Serial.println(F("Error: SSD1306 allocation failed. Check connections!"));
        return false; // Display initialization failed
    }
    return true; // Display initialized successfully
}

// ========== Initialization Functions ==========

void setup()
{

    // Begin serial communication with a baud rate of 9600
    Serial.begin(9600);

    // Initialize the SSD1306 display
    if (!initializeDisplay()) {
    // Display initialization failed, enter an infinite loop
    Serial.println(F("SSD1306 allocation failed"));
    while (true);
  }

  display.clearDisplay();
  display.drawBitmap(0, -10, splash, 128, 64, WHITE);
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 46);
  display.print(F("ARDUINADAS"));
  display.display();
  delay(2000);

}

// ========== Main Program Loop ==========

void loop()
{

}