38 #include "lib/sensors.h" 
   39 #include "dev/button-sensor.h" 
   44 const struct sensors_sensor button_sensor;
 
   45 static struct timer debouncetimer;
 
   48 #define GPIO CC_CONCAT(pADI_GP, BUTTON_GPIO) 
   51 #define HANDLER CC_CONCAT(CC_CONCAT(Ext_Int, BUTTON_INT), _Handler) 
   54 #define IRQN CC_CONCAT(CC_CONCAT(EINT, BUTTON_INT), _IRQn) 
   59   pADI_INTERRUPT->EICLR = (1 << BUTTON_INT);
 
   64   sensors_changed(&button_sensor);
 
   67 config(
int type, 
int c)
 
   75     GPIO->GPCON &= ~(3UL << (BUTTON_PIN * 2));
 
   76     GPIO->GPOEN &= ~(1UL << BUTTON_PIN);
 
   77     GPIO->GPPUL |= (1UL << BUTTON_PIN);
 
   81     pADI_INTERRUPT->EI0CFG |= (0xaUL << (4 * (BUTTON_INT - 0)));
 
   83     pADI_INTERRUPT->EI1CFG |= (0xaUL << (4 * (BUTTON_INT - 4)));
 
   85     pADI_INTERRUPT->EICLR = (1 << BUTTON_INT);
 
   97     if(GPIO->GPIN & (1UL << BUTTON_PIN)) {
 
  104 SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, 
NULL, config, status);
 
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
Enable External Interrupt. 
 
void timer_set(struct timer *t, clock_time_t interval)
Set a timer. 
 
#define NULL
The null pointer. 
 
int timer_expired(struct timer *t)
Check if a timer has expired. 
 
#define CLOCK_SECOND
A second, measured in system clock time.