Fix LED blinking protocol.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2016-05-21 Niibe Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* src/main.c (led_blink, main): Fix LED blink protocol.
|
||||||
|
|
||||||
2016-05-20 NIIBE Yutaka <gniibe@fsij.org>
|
2016-05-20 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* VERSION: 1.2.0.
|
* VERSION: 1.2.0.
|
||||||
|
|||||||
@@ -421,10 +421,11 @@ extern const uint8_t gnuk_string_serial[];
|
|||||||
#define LED_ONESHOT 1
|
#define LED_ONESHOT 1
|
||||||
#define LED_TWOSHOTS 2
|
#define LED_TWOSHOTS 2
|
||||||
#define LED_SHOW_STATUS 4
|
#define LED_SHOW_STATUS 4
|
||||||
#define LED_START_COMMAND 8
|
#define LED_FATAL 8
|
||||||
#define LED_FINISH_COMMAND 16
|
#define LED_SYNC 16
|
||||||
#define LED_FATAL 32
|
#define LED_GNUK_EXEC 32
|
||||||
#define LED_GNUK_EXEC 64
|
#define LED_START_COMMAND 64
|
||||||
|
#define LED_FINISH_COMMAND 128
|
||||||
void led_blink (int spec);
|
void led_blink (int spec);
|
||||||
|
|
||||||
#if defined(PINPAD_SUPPORT)
|
#if defined(PINPAD_SUPPORT)
|
||||||
|
|||||||
18
src/main.c
18
src/main.c
@@ -158,6 +158,12 @@ static void display_status_code (void)
|
|||||||
void
|
void
|
||||||
led_blink (int spec)
|
led_blink (int spec)
|
||||||
{
|
{
|
||||||
|
if (spec == LED_START_COMMAND || spec == LED_FINISH_COMMAND)
|
||||||
|
{
|
||||||
|
led_inverted = (spec == LED_START_COMMAND);
|
||||||
|
spec = LED_SYNC;
|
||||||
|
}
|
||||||
|
|
||||||
eventflag_signal (&led_event, spec);
|
eventflag_signal (&led_event, spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,18 +262,12 @@ main (int argc, char *argv[])
|
|||||||
case LED_SHOW_STATUS:
|
case LED_SHOW_STATUS:
|
||||||
display_status_code ();
|
display_status_code ();
|
||||||
break;
|
break;
|
||||||
case LED_START_COMMAND:
|
|
||||||
set_led (1);
|
|
||||||
led_inverted = 1;
|
|
||||||
chopstx_usec_wait (LED_TIMEOUT_STOP);
|
|
||||||
break;
|
|
||||||
case LED_FINISH_COMMAND:
|
|
||||||
led_inverted = 0;
|
|
||||||
set_led (0);
|
|
||||||
break;
|
|
||||||
case LED_FATAL:
|
case LED_FATAL:
|
||||||
display_fatal_code ();
|
display_fatal_code ();
|
||||||
break;
|
break;
|
||||||
|
case LED_SYNC:
|
||||||
|
set_led (led_inverted);
|
||||||
|
break;
|
||||||
case LED_GNUK_EXEC:
|
case LED_GNUK_EXEC:
|
||||||
goto exec;
|
goto exec;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user