diff --git a/examples/cc2530dk/border-router/Makefile b/examples/cc2530dk/border-router/Makefile index 763b34cca..e37325dc6 100644 --- a/examples/cc2530dk/border-router/Makefile +++ b/examples/cc2530dk/border-router/Makefile @@ -1,6 +1,3 @@ -# To build for the cc2531 USB stick: -DEFINES+=MODEL_CC2531=1, - DEFINES+=PROJECT_CONF_H=\"project-conf.h\" # We need uIPv6, therefore we also need banking diff --git a/examples/cc2530dk/border-router/project-conf.h b/examples/cc2530dk/border-router/project-conf.h index 1de93e878..01e64dead 100644 --- a/examples/cc2530dk/border-router/project-conf.h +++ b/examples/cc2530dk/border-router/project-conf.h @@ -53,4 +53,7 @@ #define UIP_FALLBACK_INTERFACE slip_interface +/* Change to 0 to build for the SmartRF + cc2530 EM */ +#define MODELS_CONF_CC2531_USB_STICK 1 + #endif /* PROJECT_CONF_H_ */ diff --git a/examples/cc2530dk/cc2531-usb-demo/Makefile b/examples/cc2530dk/cc2531-usb-demo/Makefile index 404f8ce14..c6cbb7f84 100644 --- a/examples/cc2530dk/cc2531-usb-demo/Makefile +++ b/examples/cc2530dk/cc2531-usb-demo/Makefile @@ -1,6 +1,6 @@ CONTIKI_PROJECT = cc2531-usb-demo -DEFINES+=MODEL_CC2531=1 +DEFINES+=MODELS_CONF_CC2531_USB_STICK=1 all: $(CONTIKI_PROJECT) diff --git a/examples/cc2530dk/sniffer/Makefile b/examples/cc2530dk/sniffer/Makefile index 2fcdf669d..d9491a92c 100644 --- a/examples/cc2530dk/sniffer/Makefile +++ b/examples/cc2530dk/sniffer/Makefile @@ -1,5 +1,4 @@ DEFINES+=PROJECT_CONF_H -DEFINES+=MODEL_CC2531=1 PROJECT_SOURCEFILES += stub-rdc.c CONTIKI_PROJECT = sniffer diff --git a/examples/cc2530dk/sniffer/project-conf.h b/examples/cc2530dk/sniffer/project-conf.h index a08744337..9f8af335a 100644 --- a/examples/cc2530dk/sniffer/project-conf.h +++ b/examples/cc2530dk/sniffer/project-conf.h @@ -47,6 +47,9 @@ #define LPM_CONF_MODE 0 #define UART0_CONF_HIGH_SPEED 1 +/* Change to 0 to build for the SmartRF + cc2530 EM */ +#define MODELS_CONF_CC2531_USB_STICK 1 + /* Used by cc2531 USB dongle builds, has no effect on SmartRF builds */ #define USB_SERIAL_CONF_BUFFERED 1 diff --git a/platform/cc2530dk/contiki-conf.h b/platform/cc2530dk/contiki-conf.h index f4fd61879..4c9804dd1 100644 --- a/platform/cc2530dk/contiki-conf.h +++ b/platform/cc2530dk/contiki-conf.h @@ -10,6 +10,14 @@ #include "project-conf.h" #endif /* PROJECT_CONF_H */ +/* + * Build for SmartRF05EB+CC2530EM by default. + * This define needs to have its final value before inclusion of models.h + */ +#ifndef MODELS_CONF_CC2531_USB_STICK +#define MODELS_CONF_CC2531_USB_STICK 0 +#endif + #include "models.h" /* diff --git a/platform/cc2530dk/dev/button-sensor.c b/platform/cc2530dk/dev/button-sensor.c index 4f5f1347d..27db847af 100644 --- a/platform/cc2530dk/dev/button-sensor.c +++ b/platform/cc2530dk/dev/button-sensor.c @@ -63,7 +63,7 @@ configure_b1(int type, int value) { switch(type) { case SENSORS_HW_INIT: -#if !MODEL_CC2531 +#if !MODELS_CONF_CC2531_USB_STICK P0INP |= 2; /* Tri-state */ #endif BUTTON_IRQ_ON_PRESS(1); @@ -87,7 +87,7 @@ configure_b1(int type, int value) /*---------------------------------------------------------------------------*/ /* Button 2 - cc2531 USb Dongle only */ /*---------------------------------------------------------------------------*/ -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK static int value_b2(int type) { @@ -138,7 +138,7 @@ configure_b2(int type, int value) #if CC_CONF_OPTIMIZE_STACK_SIZE #pragma exclude bits #endif -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK void port_1_isr(void) __interrupt(P1INT_VECTOR) { @@ -195,6 +195,6 @@ port_0_isr(void) __interrupt(P0INT_VECTOR) #pragma restore /*---------------------------------------------------------------------------*/ SENSORS_SENSOR(button_1_sensor, BUTTON_SENSOR, value_b1, configure_b1, status_b1); -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK SENSORS_SENSOR(button_2_sensor, BUTTON_SENSOR, value_b2, configure_b2, status_b2); #endif diff --git a/platform/cc2530dk/dev/button-sensor.h b/platform/cc2530dk/dev/button-sensor.h index 6fd1a2fb5..82cd2ec17 100644 --- a/platform/cc2530dk/dev/button-sensor.h +++ b/platform/cc2530dk/dev/button-sensor.h @@ -54,7 +54,7 @@ * B2: P1_3 * */ -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK #define BUTTON1_PORT 1 #define BUTTON1_PIN 2 #define BUTTON2_PORT 1 @@ -73,7 +73,7 @@ extern const struct sensors_sensor button_1_sensor; extern const struct sensors_sensor button_2_sensor; #if BUTTON_SENSOR_ON -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK /* USB Dongle */ /* Buttons: P1_2 & P1_3 - Port 1 ISR needed */ void port_1_isr(void) __interrupt(P1INT_VECTOR); @@ -82,12 +82,12 @@ void port_1_isr(void) __interrupt(P1INT_VECTOR); button_2_sensor.configure(SENSORS_ACTIVE, 1); \ } while(0) -#else /* MODEL_CC2531 */ +#else /* MODELS_CONF_CC2531_USB_STICK */ /* SmartRF */ /* Button 1: P0_1 - Port 0 ISR needed */ void port_0_isr(void) __interrupt(P0INT_VECTOR); #define BUTTON_SENSOR_ACTIVATE() button_sensor.configure(SENSORS_ACTIVE, 1) -#endif /* MODEL_CC2531 */ +#endif /* MODELS_CONF_CC2531_USB_STICK */ #else /* BUTTON_SENSOR_ON */ #define BUTTON_SENSOR_ACTIVATE() diff --git a/platform/cc2530dk/dev/io-arch.h b/platform/cc2530dk/dev/io-arch.h index f5811e0b6..33c9a026f 100644 --- a/platform/cc2530dk/dev/io-arch.h +++ b/platform/cc2530dk/dev/io-arch.h @@ -48,7 +48,7 @@ #include "contiki.h" /*---------------------------------------------------------------------------*/ -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK #include "dev/usb-serial.h" #define IO_ARCH_PREFIX usb_serial diff --git a/platform/cc2530dk/dev/leds-arch.c b/platform/cc2530dk/dev/leds-arch.c index 566fb000c..00fbb3b0e 100644 --- a/platform/cc2530dk/dev/leds-arch.c +++ b/platform/cc2530dk/dev/leds-arch.c @@ -44,7 +44,7 @@ void leds_arch_init(void) { -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK P1SEL &= ~LED1_MASK; P1DIR |= LED1_MASK; P0SEL &= ~LED2_MASK; @@ -58,7 +58,7 @@ leds_arch_init(void) unsigned char leds_arch_get(void) { -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK return (unsigned char)(LED1_PIN | ((LED2_PIN ^ 0x01) << 1)); #else return (unsigned char)(LED1_PIN | (LED2_PIN << 1) | (LED3_PIN << 2)); @@ -69,7 +69,7 @@ void leds_arch_set(unsigned char leds) { LED1_PIN = leds & 0x01; -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK LED2_PIN = ((leds & 0x02) >> 1) ^ 0x01; #else LED2_PIN = (leds & 0x02) >> 1; diff --git a/platform/cc2530dk/dev/smartrf-sensors.c b/platform/cc2530dk/dev/smartrf-sensors.c index 4bac66dab..d3fedc006 100644 --- a/platform/cc2530dk/dev/smartrf-sensors.c +++ b/platform/cc2530dk/dev/smartrf-sensors.c @@ -47,7 +47,7 @@ const struct sensors_sensor *sensors[] = { #endif #if BUTTON_SENSOR_ON &button_1_sensor, -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK &button_2_sensor, #endif #endif diff --git a/platform/cc2530dk/models.h b/platform/cc2530dk/models.h index 06f4f72cb..23989915c 100644 --- a/platform/cc2530dk/models.h +++ b/platform/cc2530dk/models.h @@ -64,7 +64,7 @@ * 1: P0_0 (Red) * 2: P1_1 (Green - active: low) */ -#if MODEL_CC2531 +#if MODELS_CONF_CC2531_USB_STICK #define MODEL_STRING "TI cc2531 USB Dongle\n" #define USB_CONF_ENABLE 1