#include "config.h"
#include "CycloneService.h"

// Global variables
CycloneService g_service(SERVICE_BRIGHTNESS_PIN, LCD_PIN_RS, LCD_PIN_EN, LCD_PIN_D4, LCD_PIN_D5, LCD_PIN_D6, LCD_PIN_D7,
                         LCD_ROWS_NUM, LCD_COLS_NUM, LEDRING_COUNT, LEDRING_PIN, NEO_GRB, NEO_KHZ800, GAMEBUZZ_PIN);


void setup(void) {
  // Init button
  pinMode(BUTTON_PIN, INPUT);
  attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), btnPressed, CHANGE);

  // Init service
  g_service.init();
}

void loop(void) {
  // Update service
  g_service.update();
}

void btnPressed(void) {
  // Call the corresponding event
  g_service.onActionButton((bool) digitalRead(BUTTON_PIN));
}