void ui_init(void) { #ifdef USB_DEVICE_LPM_SUPPORT struct extint_chan_conf config_extint_chan; extint_chan_get_config_defaults(&config_extint_chan); config_extint_chan.gpio_pin = BUTTON_0_EIC_PIN; config_extint_chan.gpio_pin_mux = BUTTON_0_EIC_MUX; config_extint_chan.gpio_pin_pull = EXTINT_PULL_UP; config_extint_chan.filter_input_signal = true; config_extint_chan.detection_criteria = EXTINT_DETECT_FALLING; extint_chan_set_config(BUTTON_0_EIC_LINE, &config_extint_chan); extint_register_callback(ui_wakeup_handler, BUTTON_0_EIC_LINE, EXTINT_CALLBACK_TYPE_DETECT); extint_chan_enable_callback(BUTTON_0_EIC_LINE,EXTINT_CALLBACK_TYPE_DETECT); #endif /* Initialize LEDs */ LED_Off(); }
/** * \internal * \brief Setup function for callback mode test. * * This function sets up the GPIO pin, the external interrupt channel & * the callback function. * * \param test Current test case. */ static void setup_extint_callback_mode_test(const struct test_case *test) { /* Configure the GPIO pin */ port_get_config_defaults(&pin_conf); pin_conf.direction = PORT_PIN_DIR_OUTPUT; pin_conf.input_pull = PORT_PIN_PULL_NONE; port_pin_set_config(GPIO_TEST_PIN_EXTINT, &pin_conf); port_pin_set_output_level(GPIO_TEST_PIN_EXTINT, true); /* Configure the external interrupt channel */ extint_chan_get_config_defaults(&eic_conf); eic_conf.gpio_pin = EIC_TEST_PIN; eic_conf.gpio_pin_mux = EIC_TEST_PIN_MUX; eic_conf.gpio_pin_pull = EXTINT_PULL_UP; eic_conf.detection_criteria = EXTINT_DETECT_FALLING; extint_chan_set_config(EIC_TEST_CHANNEL, &eic_conf); /* Register and enable the callback function */ extint_register_callback(extint_user_callback, EIC_TEST_CHANNEL, EXTINT_CALLBACK_TYPE_DETECT); extint_chan_enable_callback(EIC_TEST_CHANNEL, EXTINT_CALLBACK_TYPE_DETECT); }
/*---------------------------------------------------------------------------*/ static int configure(int type, int value) { switch(type) { case SENSORS_HW_INIT: configure_button(); return 1; case SENSORS_ACTIVE: if(value) { if(!interrupt_enabled) { timer_set(&debouncetimer, 0); extint_chan_enable_callback(BUTTON_0_EIC_LINE, EXTINT_CALLBACK_TYPE_DETECT); interrupt_enabled = 1; } } else { extint_chan_disable_callback(BUTTON_0_EIC_LINE, EXTINT_CALLBACK_TYPE_DETECT); interrupt_enabled = 0; } return 1; } return 0; }
void cph_deca_isr_enable(void) { extint_chan_enable_callback(DW_IRQ_LINE, EXTINT_CALLBACK_TYPE_DETECT); }
void ui_wakeup_enable(void) { extint_chan_enable_callback(BUTTON_0_EIC_LINE,EXTINT_CALLBACK_TYPE_DETECT); }
/** Configures and registers the External Interrupt callback function with the * driver. */ static void configure_eic_callback(void) { extint_register_callback(extint_callback, EXTINT_CALLBACK_TYPE_DETECT); extint_chan_enable_callback(BUTTON_1_EIC_LINE, EXTINT_CALLBACK_TYPE_DETECT); }
void configure_extint_callbacks(void) { extint_register_callback(extint_detection_callback_1, 2, EXTINT_CALLBACK_TYPE_DETECT); extint_chan_enable_callback(2, EXTINT_CALLBACK_TYPE_DETECT); }