38 #include "lib/sensors.h"
39 #include "dev/button-sensor.h"
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);
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)) {
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
Enable External Interrupt.
void timer_set(struct timer *t, clock_time_t interval)
Set a timer.
const struct sensors_sensor button_sensor
Copyright (c) 2014, Analog Devices, Inc.
#define NULL
The null pointer.
static void config(uint32_t port_base, uint32_t pin_mask)
Common initialiser for all buttons.
#define CLOCK_SECOND
A second, measured in system clock time.
int timer_expired(struct timer *t)
Check if a timer has expired.