diff --git a/platform/cc2530dk/contiki-conf.h b/platform/cc2530dk/contiki-conf.h index 75e813a3c..5432e4df5 100644 --- a/platform/cc2530dk/contiki-conf.h +++ b/platform/cc2530dk/contiki-conf.h @@ -10,6 +10,8 @@ #include "project-conf.h" #endif /* PROJECT_CONF_H */ +#include "models.h" + /* * Define this as 1 to poll the etimer process from within main instead of from * the clock ISR. This reduces the ISR's stack usage and may prevent crashes. @@ -113,21 +115,6 @@ #define LPM_CONF_MODE 0 /* 0: no LPM, 1: MCU IDLE, 2: Drop to PM1 */ #endif -/* Some files include leds.h before us */ -#undef LEDS_GREEN -#undef LEDS_YELLOW -#undef LEDS_RED -#define LEDS_YELLOW 4 -#if MODEL_CC2531 -#undef LEDS_CONF_ALL -#define LEDS_CONF_ALL 3 -#define LEDS_RED 1 -#define LEDS_GREEN 2 -#else -#define LEDS_GREEN 1 -#define LEDS_RED 2 -#endif - /* DMA Configuration */ #ifndef DMA_CONF_ON #define DMA_CONF_ON 0 diff --git a/platform/cc2530dk/dev/leds-arch.c b/platform/cc2530dk/dev/leds-arch.c index 00c94e0df..e899893dd 100644 --- a/platform/cc2530dk/dev/leds-arch.c +++ b/platform/cc2530dk/dev/leds-arch.c @@ -40,38 +40,6 @@ #include "dev/leds.h" #include "dev/leds-arch.h" #include "cc253x.h" - -/* - * Smart RF LEDs - * 1: P1_0 (Green) - * 2: P1_1 (Red) - * 3: P1_4 (Yellow) - * 4: P0_1 (LED4 shares port/pin with B1 and is currently unused) - * - * USB Dongle LEDs - * 1: P0_0 (Red) - * 2: P1_1 (Green - active: low) - */ - -#if MODEL_CC2531 -#define LED2_PIN P0_0 -#define LED1_PIN P1_1 - -/* P0DIR and P0SEL masks */ -#define LED2_MASK 0x01 -#define LED1_MASK 0x02 -#else -/* H/W Connections */ -#define LED1_PIN P1_0 -#define LED2_PIN P1_1 -#define LED3_PIN P1_4 - -/* P0DIR and P0SEL masks */ -#define LED1_MASK 0x01 -#define LED2_MASK 0x02 -#define LED3_MASK 0x10 -#define LED4_MASK 0x02 -#endif /*---------------------------------------------------------------------------*/ void leds_arch_init(void) diff --git a/platform/cc2530dk/models.h b/platform/cc2530dk/models.h new file mode 100644 index 000000000..139fe5295 --- /dev/null +++ b/platform/cc2530dk/models.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2011, George Oikonomou - + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the Contiki operating system. + */ + +/** + * \file + * Header file use to configure differences between cc2530dk builds for + * the SmartRF/cc2530 and the cc2531 USB stick. + * + * These configuration directives are hardware-specific and you + * normally won't have to modify them. + * + * \author + * George Oikonomou - + */ + +#ifndef __MODELS_H__ +#define __MODELS_H__ + +/*---------------------------------------------------------------------------*/ +/* LEDs */ +/*---------------------------------------------------------------------------*/ +/* Some files include leds.h before us */ +#undef LEDS_GREEN +#undef LEDS_YELLOW +#undef LEDS_RED +#define LEDS_YELLOW 4 + +/* + * Smart RF LEDs + * 1: P1_0 (Green) + * 2: P1_1 (Red) + * 3: P1_4 (Yellow) + * 4: P0_1 (LED4 shares port/pin with B1 and is currently unused) + * + * USB Dongle LEDs + * 1: P0_0 (Red) + * 2: P1_1 (Green - active: low) + */ +#if MODEL_CC2531 +#undef LEDS_CONF_ALL +#define LEDS_CONF_ALL 3 +#define LEDS_RED 1 +#define LEDS_GREEN 2 + +/* H/W Connections */ +#define LED2_PIN P0_0 +#define LED1_PIN P1_1 + +/* P0DIR and P0SEL masks */ +#define LED2_MASK 0x01 +#define LED1_MASK 0x02 +#else +#define LEDS_GREEN 1 +#define LEDS_RED 2 + +/* H/W Connections */ +#define LED1_PIN P1_0 +#define LED2_PIN P1_1 +#define LED3_PIN P1_4 + +/* P0DIR and P0SEL masks */ +#define LED1_MASK 0x01 +#define LED2_MASK 0x02 +#define LED3_MASK 0x10 +#define LED4_MASK 0x02 +#endif +/*---------------------------------------------------------------------------*/ +/* Buttons */ +/*---------------------------------------------------------------------------*/ + +#endif /* __MODELS_H__ */