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

#include "Gif1.h"
#include "Gif2.h"
#include "Gif3.h"
#include "Gif4.h"

#define SCREEN_I2C_ADDR 0x3C 
#define SCREEN_WIDTH 128     // OLED display width, in pixels
#define SCREEN_HEIGHT 64     // OLED display height, in pixels
#define OLED_RST_PIN -1      // Reset pin (-1 if not available)

Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST_PIN);

// OLED Animation: alarm clock
// Code auto-generated by https://wokwi.com/animator, graphics by icons8.com

#define FRAME_DELAY (10)
#define FRAME_WIDTH (32)
#define FRAME_HEIGHT (32)
#define FRAME_COUNT (sizeof(gif1) / sizeof(gif1[0]))


void setup() {
  Serial.begin(115200);
  display.begin(SSD1306_SWITCHCAPVCC, SCREEN_I2C_ADDR);

  Serial.println(FRAME_COUNT);
}

int frame = 0;
void loop() {
  display.clearDisplay();
  display.drawBitmap(16,0, gif1[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
  display.drawBitmap(16,32, gif2[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
  display.drawBitmap(80,0, gif3[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
  display.drawBitmap(80,32, gif4[frame], FRAME_WIDTH, FRAME_HEIGHT, 1);
  display.display();
  frame = (frame + 1) % FRAME_COUNT;
  delay(FRAME_DELAY);
}