diff --git a/platform/cc2530dk/contiki-conf.h b/platform/cc2530dk/contiki-conf.h index 5432e4df5..71a70b70b 100644 --- a/platform/cc2530dk/contiki-conf.h +++ b/platform/cc2530dk/contiki-conf.h @@ -102,6 +102,12 @@ #ifndef BUTTON_SENSOR_CONF_ON #define BUTTON_SENSOR_CONF_ON 1 /* Buttons */ #endif + +/* B2 on the cc2531 USB stick can be a reset button or a general-purpose one */ +#ifndef CC2531_CONF_B2_REBOOTS +#define CC2531_CONF_B2_REBOOTS 0 /* General Purpose by default */ +#endif + /* ADC - Turning this off will disable everything below */ #ifndef ADC_SENSOR_CONF_ON #define ADC_SENSOR_CONF_ON 1 diff --git a/platform/cc2530dk/dev/button-sensor.c b/platform/cc2530dk/dev/button-sensor.c index 385439701..7f4074740 100644 --- a/platform/cc2530dk/dev/button-sensor.c +++ b/platform/cc2530dk/dev/button-sensor.c @@ -34,6 +34,7 @@ */ #include "dev/port.h" #include "dev/button-sensor.h" +#include "dev/watchdog.h" /*---------------------------------------------------------------------------*/ static __data struct timer debouncetimer; /*---------------------------------------------------------------------------*/ @@ -150,7 +151,11 @@ port_1_isr(void) __interrupt(P1INT_VECTOR) if(BUTTON_IRQ_CHECK(2)) { if(timer_expired(&debouncetimer)) { timer_set(&debouncetimer, CLOCK_SECOND / 8); +#if CC2531_CONF_B2_REBOOTS + watchdog_reboot(); +#else /* General Purpose */ sensors_changed(&button_2_sensor); +#endif } }