|
|
|
@ -33,10 +33,13 @@ void inline wait (int ticks) { // This works in libopenocm3 examples
|
|
|
|
|
int main (void) {
|
|
|
|
|
setup();
|
|
|
|
|
|
|
|
|
|
gpio_unset(GPIOC, GPIO8 | GPIO9);
|
|
|
|
|
while (gpio_get(GPIOA, GPIO0) == 0);
|
|
|
|
|
|
|
|
|
|
// Array of what leds should be on
|
|
|
|
|
uint16_t states[4] = {0, GPIO9, GPIO8, GPIO9 | GPIO8};
|
|
|
|
|
enum {FORWARD, BACKWARD} direction = FORWARD;
|
|
|
|
|
bool pressed = false;
|
|
|
|
|
bool pressed = true;
|
|
|
|
|
char state;
|
|
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
@ -48,7 +51,7 @@ int main (void) {
|
|
|
|
|
}
|
|
|
|
|
state = (direction == FORWARD ? (state + 1)%4 : (/*state+4-1*/ state+3)%4 );
|
|
|
|
|
|
|
|
|
|
gpio_set(GPIOC, states[state]);
|
|
|
|
|
gpio_set(GPIOC, states[state]); //FIXME: This doesn't work, as it does not write 0s to unmentioned pins!!
|
|
|
|
|
wait(DELAY);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|