slik-dispenser/arduino/state.ino

37 lines
790 B
Arduino
Raw Normal View History

enum state current_state;
void change_state(enum state new_state)
{
carrier.display.fillScreen(0x000);
switch (new_state) {
case STATE_CONNECTING:
carrier.display.setCursor(20, 100);
carrier.display.setTextSize(3);
carrier.display.print("Connecting..");
break;
case STATE_LOGGED_OUT:
carrier.display.setCursor(15, 100);
carrier.display.setTextSize(2);
carrier.display.print("Press Green Button");
carrier.leds.fill(green_led_color, 2, 1);
carrier.leds.setBrightness(5);
carrier.leds.show();
break;
case STATE_INPUT_PASSCODE:
break;
}
current_state = new_state;
}
void loop_state()
{
switch (current_state) {
case STATE_LOGGED_OUT:
if (carrier.Buttons.onTouchDown(TOUCH2)) {
change_state(STATE_INPUT_PASSCODE);
}
break;
};
}