X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=firmware%2Fbuttons.c;h=2e80142b3be896c0bbf2ffa9961c1b2c48127a58;hb=5d0f6ceb47eed2282aeb11eb57eebc390add234e;hp=c1a785d0492c93d9bf91fff728b7e646c3879d9b;hpb=647f353f4d8c87c5cf18cae905e9d600cd0e6bcb;p=bike-lights.git diff --git a/firmware/buttons.c b/firmware/buttons.c index c1a785d..2e80142 100644 --- a/firmware/buttons.c +++ b/firmware/buttons.c @@ -133,8 +133,8 @@ void susp_buttons() DDRA &= ~(_BV(PA3) | _BV(PA4)); // set as input PORTA |= _BV(PA3) | _BV(PA4); // enable internal pull-ups - GIMSK &= ~_BV(PCIE1); // disable pin-change IRQ on port B - GIMSK |= _BV(PCIE0); + GIMSK &= ~_BV(PCIE0); + GIMSK |= _BV(PCIE1); PCMSK0 = _BV(PCINT3) | _BV(PCINT4); // disable pin-change IRQs on all pins except PA3,PA4 @@ -152,16 +152,16 @@ static void handle_button(unsigned char button, unsigned char cur, } else if (!cur && !prev) { // --- is still pressed --- uint16_t duration = jiffies - button_start[button]; - if (duration > 80) { + if (duration > 160) { set_status_led(button, on1_pattern); // acknowledge long press } } else if (cur && !prev) { // --- just released --- uint16_t duration = jiffies - button_start[button]; - if (duration > 6 && duration < 30) { + if (duration > 6 && duration < 60) { short_press(button); - } else if (duration > 80) { + } else if (duration > 160) { set_status_led(button, NULL); long_press(button); }