mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
Easily configure B2 on the cc2531 USB stick as a General-Purpose or Reset button
This commit is contained in:
parent
cc76c649b1
commit
fea95ae088
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user