]> www.fi.muni.cz Git - bike-lights.git/blobdiff - firmware/buttons.c
firmware: move buttons and GPIO LEDs
[bike-lights.git] / firmware / buttons.c
index 9a4c7e1172dfd52f1374969148f74945e3dc92bb..d0cbd51b10c5d2bff3ef35e85abc315d2f099907 100644 (file)
@@ -13,8 +13,8 @@ void init_buttons()
 {
        unsigned char i;
 
-       DDRB &= ~(_BV(PB4) | _BV(PB6));
-       PORTB |=  _BV(PB4) | _BV(PB6);
+       DDRA &= ~(_BV(PA3) | _BV(PA4));
+       PORTA |=  _BV(PA3) | _BV(PA4);
 
        for (i=0; i < N_BUTTONS; i++) {
                button_start[i] = 0;
@@ -23,7 +23,7 @@ void init_buttons()
 
        just_waked_up = 1;
 
-       // log_byte(PORTB);
+       // log_byte(PORTA);
 }
 
 static void do_sleep()
@@ -34,7 +34,7 @@ static void do_sleep()
        hw_suspend();
        gpio_before_poweroff(); // Set the status LED on again
 
-       while((PINB & _BV(PB6)) == 0)
+       while((PINA & _BV(PA3)) == 0)
                ; // wait for button release
 
        _delay_ms(100);
@@ -58,11 +58,11 @@ static void inline short_press(unsigned char n)
 
 void timer_check_buttons()
 {
-       unsigned char pinb = PINB;
+       unsigned char pin = PINA;
        unsigned char i;
        unsigned char port_states[N_BUTTONS] = {
-               pinb & _BV(PB6),
-               pinb & _BV(PB4),
+               pin & _BV(PA3),
+               pin & _BV(PA4),
        };
 
        for (i = 0; i < N_BUTTONS; i++) {