Merge pull request #179 from fontikos/bugfix/leds

Bugfix in HAL for LEDs (leds.c)
This commit is contained in:
Simon Duquennoy 2017-11-13 17:30:44 +01:00 committed by GitHub
commit 51f50738e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,19 +33,11 @@
#include "dev/leds.h"
#include "sys/clock.h"
static unsigned char leds;
/*---------------------------------------------------------------------------*/
static inline void
show_leds(unsigned char new_leds)
{
leds_arch_set(new_leds);
}
/*---------------------------------------------------------------------------*/
void
leds_init(void)
{
leds_arch_init();
leds = 0;
}
/*---------------------------------------------------------------------------*/
void
@ -53,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);
@ -69,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);
}
/*---------------------------------------------------------------------------*/