From: Lothar Waßmann Date: Thu, 30 Jun 2016 10:01:49 +0000 (+0200) Subject: karo: tx28: enable activity led only on stk5-v3 baseboard X-Git-Tag: KARO-TX-2016-07-05~3^2~6 X-Git-Url: https://git.karo-electronics.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=22b815e25c06ab2f1920e9e1c531fd8fc36f442f karo: tx28: enable activity led only on stk5-v3 baseboard --- diff --git a/board/karo/tx28/tx28.c b/board/karo/tx28/tx28.c index 4f524b4ad5..f1fca4a17a 100644 --- a/board/karo/tx28/tx28.c +++ b/board/karo/tx28/tx28.c @@ -362,14 +362,18 @@ enum { LED_STATE_INIT = -1, LED_STATE_OFF, LED_STATE_ON, + LED_STATE_DISABLED, }; +static int led_state = LED_STATE_DISABLED; + void show_activity(int arg) { - static int led_state = LED_STATE_INIT; static ulong last; - if (led_state == LED_STATE_INIT) { + if (led_state == LED_STATE_DISABLED) { + return; + } else if (led_state == LED_STATE_INIT) { last = get_timer(0); gpio_set_value(TX28_LED_GPIO, 1); led_state = LED_STATE_ON; @@ -378,10 +382,11 @@ void show_activity(int arg) last = get_timer(0); if (led_state == LED_STATE_ON) { gpio_set_value(TX28_LED_GPIO, 0); + led_state = LED_STATE_OFF; } else { gpio_set_value(TX28_LED_GPIO, 1); + led_state = LED_STATE_ON; } - led_state = 1 - led_state; } } } @@ -819,6 +824,7 @@ static void stk5_board_init(void) static void stk5v3_board_init(void) { + led_state = LED_STATE_INIT; stk5_board_init(); }