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

View File

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