Hello,
we have a remote control with 7 buttons.
Every button shall wakeup the device from deep sleep.
Beside i will have an interrupt on Button 6 and 7.
So the problem is, if i call gpio_init(),
the button 1-5 won't work with :
bool Switch1(void) { return (bool)nrf_gpio_pin_read(BUTTON_1); }
( the wakeup is still working )
If i comment out gpio_init() all buttons are function as expected, beside that i don't have an intterupt.
static void gpio_init(void)
{
ret_code_t err_code;
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
in_config.pull = NRF_GPIO_PIN_PULLUP;
err_code = nrf_drv_gpiote_in_init(BUTTON_7, &in_config, in_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(BUTTON_7, true);
err_code = nrf_drv_gpiote_in_init(BUTTON_6, &in_config, in_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(BUTTON_6, true);
}
void InitIo(void)
{
nrf_gpio_cfg_output(POWER_PIN); // Power
nrf_gpio_cfg_output(LED_1);
nrf_gpio_cfg_output(LED_2);
nrf_gpio_cfg_output(LED_3);
nrf_gpio_cfg_output(LED_4);
nrf_gpio_cfg_output(LED_5);
nrf_gpio_cfg_output(LED_6);
nrf_gpio_cfg_output(LED_7);
nrf_gpio_cfg_output(LED_8);
nrf_gpio_cfg_output(LED_9);
nrf_gpio_cfg_output(LED_10);
nrf_gpio_cfg_input(BUTTON_1, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_input(BUTTON_2, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_input(BUTTON_3, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_input(BUTTON_4, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_input(BUTTON_5, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_input(BUTTON_6, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_input(BUTTON_7, NRF_GPIO_PIN_PULLUP);
// gpio_init() ;
nrf_gpio_cfg_sense_input(BUTTON_1, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
nrf_gpio_cfg_sense_input(BUTTON_2, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
nrf_gpio_cfg_sense_input(BUTTON_3, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
nrf_gpio_cfg_sense_input(BUTTON_4, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
nrf_gpio_cfg_sense_input(BUTTON_5, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
nrf_gpio_cfg_sense_input(BUTTON_6, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
nrf_gpio_cfg_sense_input(BUTTON_7, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
}