Bugfix in HAL for LEDs. Static variable leds removed.

Bugfix in HAL for LEDs. Inline function show_leds removed.
This commit is contained in:
Xenofon (Fontas) Fafoutis 2017-11-13 13:09:05 +00:00
parent 828ed7a9c6
commit f206ee6fe6
1 changed files with 5 additions and 16 deletions

View File

@ -33,22 +33,11 @@
#include "dev/leds.h" #include "dev/leds.h"
#include "sys/clock.h" #include "sys/clock.h"
static unsigned char leds;
/*---------------------------------------------------------------------------*/
static inline void
show_leds(unsigned char new_leds)
{
leds = new_leds;
leds_arch_set(new_leds);
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
leds_init(void) leds_init(void)
{ {
leds_arch_init(); leds_arch_init();
leds = 0;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
@ -56,7 +45,7 @@ leds_blink(void)
{ {
/* Blink all leds that were initially off. */ /* Blink all leds that were initially off. */
unsigned char blink; unsigned char blink;
blink = ~leds; blink = ~leds_arch_get();
leds_toggle(blink); leds_toggle(blink);
clock_delay(400); clock_delay(400);
@ -72,24 +61,24 @@ leds_get(void) {
void void
leds_set(unsigned char ledv) leds_set(unsigned char ledv)
{ {
show_leds(ledv); leds_arch_set(ledv);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
leds_on(unsigned char ledv) leds_on(unsigned char ledv)
{ {
show_leds(leds | ledv); leds_arch_set(leds_arch_get() | ledv);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
leds_off(unsigned char ledv) leds_off(unsigned char ledv)
{ {
show_leds(leds & ~ledv); leds_arch_set(leds_arch_get() & ~ledv);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
leds_toggle(unsigned char ledv) leds_toggle(unsigned char ledv)
{ {
show_leds(leds ^ ledv); leds_arch_set(leds_arch_get() ^ ledv);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/