|
|
|
@ -6,6 +6,7 @@
|
|
|
|
|
|
|
|
|
|
uint8_t expled;
|
|
|
|
|
uint8_t expbutton;
|
|
|
|
|
uint8_t expdouble;
|
|
|
|
|
uint16_t exptime;
|
|
|
|
|
uint16_t explong;
|
|
|
|
|
uint16_t longtime;
|
|
|
|
@ -123,13 +124,6 @@ int main(void)
|
|
|
|
|
PORTD &= ~(1<<ExpLED);
|
|
|
|
|
PORTD |= (1<<ExpButton);
|
|
|
|
|
|
|
|
|
|
expled = 0;
|
|
|
|
|
expbutton = 0;
|
|
|
|
|
exptime = 0;
|
|
|
|
|
explong = 0;
|
|
|
|
|
|
|
|
|
|
logtimer = 0;
|
|
|
|
|
|
|
|
|
|
hbw_init();
|
|
|
|
|
|
|
|
|
|
state = 255;
|
|
|
|
@ -156,17 +150,29 @@ int main(void)
|
|
|
|
|
} else {
|
|
|
|
|
exptime = now;
|
|
|
|
|
explong = 0;
|
|
|
|
|
if (expdouble == 1)
|
|
|
|
|
expdouble = 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bit_is_set(PIND, ExpButton)) {
|
|
|
|
|
if (exptime) {
|
|
|
|
|
if (now - exptime > 50 && !explong) {
|
|
|
|
|
if (now - exptime > 50 && !explong && (expdouble == 2)) {
|
|
|
|
|
expbutton++;
|
|
|
|
|
state = 1;
|
|
|
|
|
expdouble = 0;
|
|
|
|
|
}
|
|
|
|
|
if (now - exptime > 300 && !explong && (expdouble == 1)) {
|
|
|
|
|
expbutton++;
|
|
|
|
|
state = 2;
|
|
|
|
|
expdouble = 0;
|
|
|
|
|
}
|
|
|
|
|
if (now - exptime > 50 && explong)
|
|
|
|
|
if (now - exptime > 50 && !explong && (expdouble == 0))
|
|
|
|
|
expdouble = 1;
|
|
|
|
|
if (now - exptime > 50 && explong) {
|
|
|
|
|
state = 0;
|
|
|
|
|
expdouble = 0;
|
|
|
|
|
}
|
|
|
|
|
exptime = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -174,9 +180,9 @@ int main(void)
|
|
|
|
|
if (hbw_send_key(1, expbutton, state))
|
|
|
|
|
state = 255;
|
|
|
|
|
|
|
|
|
|
if (hbw_timer - logtimer < 100) {
|
|
|
|
|
if (logtimer && (hbw_timer - logtimer < 100)) {
|
|
|
|
|
led = 0;
|
|
|
|
|
if (bit_is_clear(PIND, ExpLED))
|
|
|
|
|
if (bit_is_set(PIND, ExpLED))
|
|
|
|
|
led = 200;
|
|
|
|
|
if (!hbw_send_channel(0, 1, &led))
|
|
|
|
|
logtimer += 300;
|
|
|
|
|