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