// Button 1 scrolls through all patterns.
// Button 2 directly starts pattern X.
// Button 3 directly starts pattern XY.
// I'm undecided on implementing a button 4 for reverse scrolling.
// Only one pattern will run at a time of course.

#include <mechButton.h>

#define     MAX_INDEX   3   // The amount of patterns.

mechButton  scrollBtn(2);
mechButton  startBtn(3);
mechButton  altStartBtn(4);
enum        states { waiting, running, altRunning };
states      ourState;
int         index;


void setup(void) {

  Serial.begin(115200);
  scrollBtn.setCallback(scrollClk);
  startBtn.setCallback(startClk);
  altStartBtn.setCallback(altStartClk);
  index = 1;
  ourState = waiting;
  Serial.print("index : ");
  Serial.println(index);
}


void scrollClk(void) {

  if (!scrollBtn.getState()) {
    index++;
    if (index>MAX_INDEX) {
      index = 1;
    }
    Serial.print("Scroll click with index : ");
    Serial.println(index);
  }
}


void startClk(void) {

  if (!startBtn.getState()) {
    Serial.println("startBtn click");
  }
}


void altStartClk(void) {

  if (!altStartBtn.getState()) {
    Serial.println("altStartBtn click");
  }
}


void loop(void) {

  idle();
  switch(ourState) {
    case waiting  : break;
    case running  : 
    
    break;
    case altRunning  : 
    
    break;
  }
}