 #define ONE_BUTTON P1_1
 #define ZERO_BUTTON P4_5
 
-const uint16_t code = 0b10100111001;
-const byte size = 11;
+#define MAX_CODE 6
 
-const unsigned int debounce_time = 40; // ms
+const bool code[] = {1, 0, 0, 1};
 
+const unsigned int debounce_time = 200; // ms
+
+const byte code_size = sizeof(code);
 byte code_idx = 0;
 
-enum State { LOCKED, PARTIAL, UNLOCKED };
+enum State {LOCKED, INCORRECT, PARTIAL, UNLOCKED};
 
 State state = LOCKED;
 

void unlocked() {
	digitalWrite(RED_LED, LOW);
	digitalWrite(GREEN_LED, HIGH);
}

StateFunc funcs[] = {locked, partial, unlocked};

void change(State next) {
	state = next;

	funcs[next]();
}

unsigned long last_one = 0;

	code_idx = 0;
}

void incorrect() {
	code_idx++;
}

void partial() {
	code_idx++;
}
