static callback_t button_callback = NULL;
static void respond_to_gpio_interrupt(uint gpio, uint32_t event_mask) {
- if (gpio == button_pin && event_mask & GPIO_IRQ_EDGE_FALL &&
+ if (gpio == config_button_pin && event_mask & GPIO_IRQ_EDGE_FALL &&
button_callback) {
button_callback();
}
void begin_listening_for_button_press(callback_t callback) {
button_callback = callback;
- gpio_set_pulls(button_pin, 1, 0);
+ gpio_set_pulls(config_button_pin, 1, 0);
/* Allow some time for the pull-up to take effect.
* I'm not sure if this is necessary.
* the internal GPIO pull-up resistors are 50k. */
sleep_ms(100);
- gpio_set_irq_enabled_with_callback(button_pin, GPIO_IRQ_EDGE_FALL, 1,
+ gpio_set_irq_enabled_with_callback(config_button_pin, GPIO_IRQ_EDGE_FALL, 1,
respond_to_gpio_interrupt);
}