Change the way we switch between cc2530 models
The switch is now performed through a configuration define, which has also been renamed to better match Contiki's naming conventions
This commit is contained in:
parent
1b0470687b
commit
f30d92b101
|
@ -1,6 +1,3 @@
|
||||||
# To build for the cc2531 USB stick:
|
|
||||||
DEFINES+=MODEL_CC2531=1,
|
|
||||||
|
|
||||||
DEFINES+=PROJECT_CONF_H=\"project-conf.h\"
|
DEFINES+=PROJECT_CONF_H=\"project-conf.h\"
|
||||||
|
|
||||||
# We need uIPv6, therefore we also need banking
|
# We need uIPv6, therefore we also need banking
|
||||||
|
|
|
@ -53,4 +53,7 @@
|
||||||
|
|
||||||
#define UIP_FALLBACK_INTERFACE slip_interface
|
#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_ */
|
#endif /* PROJECT_CONF_H_ */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
CONTIKI_PROJECT = cc2531-usb-demo
|
CONTIKI_PROJECT = cc2531-usb-demo
|
||||||
|
|
||||||
DEFINES+=MODEL_CC2531=1
|
DEFINES+=MODELS_CONF_CC2531_USB_STICK=1
|
||||||
|
|
||||||
all: $(CONTIKI_PROJECT)
|
all: $(CONTIKI_PROJECT)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
DEFINES+=PROJECT_CONF_H
|
DEFINES+=PROJECT_CONF_H
|
||||||
DEFINES+=MODEL_CC2531=1
|
|
||||||
PROJECT_SOURCEFILES += stub-rdc.c
|
PROJECT_SOURCEFILES += stub-rdc.c
|
||||||
|
|
||||||
CONTIKI_PROJECT = sniffer
|
CONTIKI_PROJECT = sniffer
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
#define LPM_CONF_MODE 0
|
#define LPM_CONF_MODE 0
|
||||||
#define UART0_CONF_HIGH_SPEED 1
|
#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 */
|
/* Used by cc2531 USB dongle builds, has no effect on SmartRF builds */
|
||||||
#define USB_SERIAL_CONF_BUFFERED 1
|
#define USB_SERIAL_CONF_BUFFERED 1
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,14 @@
|
||||||
#include "project-conf.h"
|
#include "project-conf.h"
|
||||||
#endif /* 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"
|
#include "models.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -63,7 +63,7 @@ configure_b1(int type, int value)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SENSORS_HW_INIT:
|
case SENSORS_HW_INIT:
|
||||||
#if !MODEL_CC2531
|
#if !MODELS_CONF_CC2531_USB_STICK
|
||||||
P0INP |= 2; /* Tri-state */
|
P0INP |= 2; /* Tri-state */
|
||||||
#endif
|
#endif
|
||||||
BUTTON_IRQ_ON_PRESS(1);
|
BUTTON_IRQ_ON_PRESS(1);
|
||||||
|
@ -87,7 +87,7 @@ configure_b1(int type, int value)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Button 2 - cc2531 USb Dongle only */
|
/* Button 2 - cc2531 USb Dongle only */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
static int
|
static int
|
||||||
value_b2(int type)
|
value_b2(int type)
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ configure_b2(int type, int value)
|
||||||
#if CC_CONF_OPTIMIZE_STACK_SIZE
|
#if CC_CONF_OPTIMIZE_STACK_SIZE
|
||||||
#pragma exclude bits
|
#pragma exclude bits
|
||||||
#endif
|
#endif
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
void
|
void
|
||||||
port_1_isr(void) __interrupt(P1INT_VECTOR)
|
port_1_isr(void) __interrupt(P1INT_VECTOR)
|
||||||
{
|
{
|
||||||
|
@ -195,6 +195,6 @@ port_0_isr(void) __interrupt(P0INT_VECTOR)
|
||||||
#pragma restore
|
#pragma restore
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
SENSORS_SENSOR(button_1_sensor, BUTTON_SENSOR, value_b1, configure_b1, status_b1);
|
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);
|
SENSORS_SENSOR(button_2_sensor, BUTTON_SENSOR, value_b2, configure_b2, status_b2);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
* B2: P1_3
|
* B2: P1_3
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
#define BUTTON1_PORT 1
|
#define BUTTON1_PORT 1
|
||||||
#define BUTTON1_PIN 2
|
#define BUTTON1_PIN 2
|
||||||
#define BUTTON2_PORT 1
|
#define BUTTON2_PORT 1
|
||||||
|
@ -73,7 +73,7 @@ extern const struct sensors_sensor button_1_sensor;
|
||||||
extern const struct sensors_sensor button_2_sensor;
|
extern const struct sensors_sensor button_2_sensor;
|
||||||
|
|
||||||
#if BUTTON_SENSOR_ON
|
#if BUTTON_SENSOR_ON
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
/* USB Dongle */
|
/* USB Dongle */
|
||||||
/* Buttons: P1_2 & P1_3 - Port 1 ISR needed */
|
/* Buttons: P1_2 & P1_3 - Port 1 ISR needed */
|
||||||
void port_1_isr(void) __interrupt(P1INT_VECTOR);
|
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); \
|
button_2_sensor.configure(SENSORS_ACTIVE, 1); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#else /* MODEL_CC2531 */
|
#else /* MODELS_CONF_CC2531_USB_STICK */
|
||||||
/* SmartRF */
|
/* SmartRF */
|
||||||
/* Button 1: P0_1 - Port 0 ISR needed */
|
/* Button 1: P0_1 - Port 0 ISR needed */
|
||||||
void port_0_isr(void) __interrupt(P0INT_VECTOR);
|
void port_0_isr(void) __interrupt(P0INT_VECTOR);
|
||||||
#define BUTTON_SENSOR_ACTIVATE() button_sensor.configure(SENSORS_ACTIVE, 1)
|
#define BUTTON_SENSOR_ACTIVATE() button_sensor.configure(SENSORS_ACTIVE, 1)
|
||||||
#endif /* MODEL_CC2531 */
|
#endif /* MODELS_CONF_CC2531_USB_STICK */
|
||||||
|
|
||||||
#else /* BUTTON_SENSOR_ON */
|
#else /* BUTTON_SENSOR_ON */
|
||||||
#define BUTTON_SENSOR_ACTIVATE()
|
#define BUTTON_SENSOR_ACTIVATE()
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
#include "dev/usb-serial.h"
|
#include "dev/usb-serial.h"
|
||||||
#define IO_ARCH_PREFIX usb_serial
|
#define IO_ARCH_PREFIX usb_serial
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
void
|
void
|
||||||
leds_arch_init(void)
|
leds_arch_init(void)
|
||||||
{
|
{
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
P1SEL &= ~LED1_MASK;
|
P1SEL &= ~LED1_MASK;
|
||||||
P1DIR |= LED1_MASK;
|
P1DIR |= LED1_MASK;
|
||||||
P0SEL &= ~LED2_MASK;
|
P0SEL &= ~LED2_MASK;
|
||||||
|
@ -58,7 +58,7 @@ leds_arch_init(void)
|
||||||
unsigned char
|
unsigned char
|
||||||
leds_arch_get(void)
|
leds_arch_get(void)
|
||||||
{
|
{
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
return (unsigned char)(LED1_PIN | ((LED2_PIN ^ 0x01) << 1));
|
return (unsigned char)(LED1_PIN | ((LED2_PIN ^ 0x01) << 1));
|
||||||
#else
|
#else
|
||||||
return (unsigned char)(LED1_PIN | (LED2_PIN << 1) | (LED3_PIN << 2));
|
return (unsigned char)(LED1_PIN | (LED2_PIN << 1) | (LED3_PIN << 2));
|
||||||
|
@ -69,7 +69,7 @@ void
|
||||||
leds_arch_set(unsigned char leds)
|
leds_arch_set(unsigned char leds)
|
||||||
{
|
{
|
||||||
LED1_PIN = leds & 0x01;
|
LED1_PIN = leds & 0x01;
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
LED2_PIN = ((leds & 0x02) >> 1) ^ 0x01;
|
LED2_PIN = ((leds & 0x02) >> 1) ^ 0x01;
|
||||||
#else
|
#else
|
||||||
LED2_PIN = (leds & 0x02) >> 1;
|
LED2_PIN = (leds & 0x02) >> 1;
|
||||||
|
|
|
@ -47,7 +47,7 @@ const struct sensors_sensor *sensors[] = {
|
||||||
#endif
|
#endif
|
||||||
#if BUTTON_SENSOR_ON
|
#if BUTTON_SENSOR_ON
|
||||||
&button_1_sensor,
|
&button_1_sensor,
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
&button_2_sensor,
|
&button_2_sensor,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
* 1: P0_0 (Red)
|
* 1: P0_0 (Red)
|
||||||
* 2: P1_1 (Green - active: low)
|
* 2: P1_1 (Green - active: low)
|
||||||
*/
|
*/
|
||||||
#if MODEL_CC2531
|
#if MODELS_CONF_CC2531_USB_STICK
|
||||||
#define MODEL_STRING "TI cc2531 USB Dongle\n"
|
#define MODEL_STRING "TI cc2531 USB Dongle\n"
|
||||||
#define USB_CONF_ENABLE 1
|
#define USB_CONF_ENABLE 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue