Fix LED blinking protocol.

This commit is contained in:
NIIBE Yutaka
2016-05-20 19:36:03 +09:00
parent f86f97cdbe
commit ff190a8053
3 changed files with 18 additions and 13 deletions

View File

@@ -421,10 +421,11 @@ extern const uint8_t gnuk_string_serial[];
#define LED_ONESHOT 1
#define LED_TWOSHOTS 2
#define LED_SHOW_STATUS 4
#define LED_START_COMMAND 8
#define LED_FINISH_COMMAND 16
#define LED_FATAL 32
#define LED_GNUK_EXEC 64
#define LED_FATAL 8
#define LED_SYNC 16
#define LED_GNUK_EXEC 32
#define LED_START_COMMAND 64
#define LED_FINISH_COMMAND 128
void led_blink (int spec);
#if defined(PINPAD_SUPPORT)

View File

@@ -158,6 +158,12 @@ static void display_status_code (void)
void
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);
}
@@ -256,18 +262,12 @@ main (int argc, char *argv[])
case LED_SHOW_STATUS:
display_status_code ();
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:
display_fatal_code ();
break;
case LED_SYNC:
set_led (led_inverted);
break;
case LED_GNUK_EXEC:
goto exec;
default: