42 #include "dev/button-sensor.h"
48 #define BUTTON_SELECT_PORT_BASE GPIO_PORT_TO_BASE(BUTTON_SELECT_PORT)
49 #define BUTTON_SELECT_PIN_MASK GPIO_PIN_MASK(BUTTON_SELECT_PIN)
51 #define BUTTON_LEFT_PORT_BASE GPIO_PORT_TO_BASE(BUTTON_LEFT_PORT)
52 #define BUTTON_LEFT_PIN_MASK GPIO_PIN_MASK(BUTTON_LEFT_PIN)
54 #define BUTTON_RIGHT_PORT_BASE GPIO_PORT_TO_BASE(BUTTON_RIGHT_PORT)
55 #define BUTTON_RIGHT_PIN_MASK GPIO_PIN_MASK(BUTTON_RIGHT_PIN)
57 #define BUTTON_UP_PORT_BASE GPIO_PORT_TO_BASE(BUTTON_UP_PORT)
58 #define BUTTON_UP_PIN_MASK GPIO_PIN_MASK(BUTTON_UP_PIN)
60 #define BUTTON_DOWN_PORT_BASE GPIO_PORT_TO_BASE(BUTTON_DOWN_PORT)
61 #define BUTTON_DOWN_PIN_MASK GPIO_PIN_MASK(BUTTON_DOWN_PIN)
63 static struct timer debouncetimer;
71 config(uint32_t port_base, uint32_t pin_mask)
99 btn_callback(uint8_t port, uint8_t pin)
110 case BUTTON_LEFT_PIN:
113 case BUTTON_RIGHT_PIN:
119 case BUTTON_DOWN_PIN:
140 config_select(
int type,
int value)
142 config(BUTTON_SELECT_PORT_BASE, BUTTON_SELECT_PIN_MASK);
164 config_left(
int type,
int value)
166 config(BUTTON_LEFT_PORT_BASE, BUTTON_LEFT_PIN_MASK);
188 config_right(
int type,
int value)
190 config(BUTTON_RIGHT_PORT_BASE, BUTTON_RIGHT_PIN_MASK);
212 config_up(
int type,
int value)
214 config(BUTTON_UP_PORT_BASE, BUTTON_UP_PIN_MASK);
236 config_down(
int type,
int value)
238 config(BUTTON_DOWN_PORT_BASE, BUTTON_DOWN_PIN_MASK);