From 0dfd39adcf17b82aaa3ca750976ea05410dc4d83 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Wed, 28 Feb 2018 21:32:28 +0000 Subject: [PATCH] Adjust data types for legacy LED API implementations --- arch/cpu/msp430/leds-arch.c | 6 +++--- arch/platform/cooja/dev/leds-arch.c | 6 +++--- arch/platform/jn516x/dev/dongle/leds-arch.c | 6 +++--- arch/platform/native/dev/leds-arch.c | 6 +++--- arch/platform/nrf52dk/dev/leds-arch.c | 6 +++--- arch/platform/nrf52dk/nrf52dk-def.h | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/arch/cpu/msp430/leds-arch.c b/arch/cpu/msp430/leds-arch.c index fe63d8ae4..c8131ee3e 100644 --- a/arch/cpu/msp430/leds-arch.c +++ b/arch/cpu/msp430/leds-arch.c @@ -46,10 +46,10 @@ leds_arch_init(void) LEDS_PxOUT |= (LEDS_CONF_RED | LEDS_CONF_GREEN | LEDS_CONF_YELLOW); } /*---------------------------------------------------------------------------*/ -unsigned char +leds_mask_t leds_arch_get(void) { - unsigned char leds; + leds_mask_t leds; leds = LEDS_PxOUT; return ((leds & LEDS_CONF_RED) ? 0 : LEDS_RED) | ((leds & LEDS_CONF_GREEN) ? 0 : LEDS_GREEN) @@ -57,7 +57,7 @@ leds_arch_get(void) } /*---------------------------------------------------------------------------*/ void -leds_arch_set(unsigned char leds) +leds_arch_set(leds_mask_t leds) { LEDS_PxOUT = (LEDS_PxOUT & ~(LEDS_CONF_RED|LEDS_CONF_GREEN|LEDS_CONF_YELLOW)) | ((leds & LEDS_RED) ? 0 : LEDS_CONF_RED) diff --git a/arch/platform/cooja/dev/leds-arch.c b/arch/platform/cooja/dev/leds-arch.c index db91e9baa..b65df2945 100644 --- a/arch/platform/cooja/dev/leds-arch.c +++ b/arch/platform/cooja/dev/leds-arch.c @@ -34,18 +34,18 @@ const struct simInterface leds_interface; // COOJA variables -unsigned char simLedsValue; +leds_mask_t simLedsValue; /*-----------------------------------------------------------------------------------*/ void leds_arch_init() { simLedsValue = 0; } /*-----------------------------------------------------------------------------------*/ -unsigned char leds_arch_get() { +leds_mask_t leds_arch_get() { return simLedsValue; } /*-----------------------------------------------------------------------------------*/ -void leds_arch_set(unsigned char leds) { +void leds_arch_set(leds_mask_t leds) { if(leds != simLedsValue) { simLedsValue = leds; } diff --git a/arch/platform/jn516x/dev/dongle/leds-arch.c b/arch/platform/jn516x/dev/dongle/leds-arch.c index 5eff3c63e..513d52b76 100644 --- a/arch/platform/jn516x/dev/dongle/leds-arch.c +++ b/arch/platform/jn516x/dev/dongle/leds-arch.c @@ -38,7 +38,7 @@ #define LED_G (1 << 16) #define LED_R (1 << 17) -static volatile uint8_t leds; +static volatile leds_mask_t leds; /*---------------------------------------------------------------------------*/ void @@ -49,14 +49,14 @@ leds_arch_init(void) leds = 0; } /*---------------------------------------------------------------------------*/ -unsigned char +leds_mask_t leds_arch_get(void) { return leds; } /*---------------------------------------------------------------------------*/ void -leds_arch_set(unsigned char c) +leds_arch_set(leds_mask_t c) { uint32 on_mask = 0; uint32 off_mask = 0; diff --git a/arch/platform/native/dev/leds-arch.c b/arch/platform/native/dev/leds-arch.c index 1308c57dc..07addc84e 100644 --- a/arch/platform/native/dev/leds-arch.c +++ b/arch/platform/native/dev/leds-arch.c @@ -38,7 +38,7 @@ */ #include "dev/leds.h" -static unsigned char leds; +static leds_mask_t leds; /*---------------------------------------------------------------------------*/ void leds_arch_init(void) @@ -46,14 +46,14 @@ leds_arch_init(void) leds = 0; } /*---------------------------------------------------------------------------*/ -unsigned char +leds_mask_t leds_arch_get(void) { return leds; } /*---------------------------------------------------------------------------*/ void -leds_arch_set(unsigned char l) +leds_arch_set(leds_mask_t l) { leds = l; } diff --git a/arch/platform/nrf52dk/dev/leds-arch.c b/arch/platform/nrf52dk/dev/leds-arch.c index 019589493..cda1317ef 100644 --- a/arch/platform/nrf52dk/dev/leds-arch.c +++ b/arch/platform/nrf52dk/dev/leds-arch.c @@ -55,14 +55,14 @@ leds_arch_init(void) LEDS_OFF(LEDS_MASK); } /*---------------------------------------------------------------------------*/ -unsigned char +leds_mask_t leds_arch_get(void) { - return (unsigned char)(LED_IS_ON(LEDS_MASK) >> LED_START); + return (leds_mask_t)(LED_IS_ON(LEDS_MASK) >> LED_START); } /*---------------------------------------------------------------------------*/ void -leds_arch_set(unsigned char leds) +leds_arch_set(leds_mask_t leds) { unsigned int mask = (unsigned int)leds << LED_START; LEDS_OFF(LEDS_MASK); diff --git a/arch/platform/nrf52dk/nrf52dk-def.h b/arch/platform/nrf52dk/nrf52dk-def.h index b5de033e4..0e387f0f0 100644 --- a/arch/platform/nrf52dk/nrf52dk-def.h +++ b/arch/platform/nrf52dk/nrf52dk-def.h @@ -67,10 +67,10 @@ #define LEDS_3 (1 << (LED_3 - LED_START)) // 4 #define LEDS_4 (1 << (LED_4 - LED_START)) // 8 -#define LEDS_GREEN LEDS_1 -#define LEDS_YELLOW LEDS_2 -#define LEDS_RED LEDS_3 -#define LEDS_BLUE LEDS_4 +#define LEDS_CONF_GREEN LEDS_1 +#define LEDS_CONF_YELLOW LEDS_2 +#define LEDS_CONF_RED LEDS_3 +#define LEDS_CONF_BLUE LEDS_4 #define LEDS_CONF_ALL (LEDS_1 | LEDS_2 | LEDS_3 | LEDS_4)