This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Manage power state using interrupt

void input_pin_handle(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
  // Shutdown device here
}

void gpio_init()
{
  ret_code_t err_code;

  err_code = nrf_drv_gpiote_init();
  APP_ERROR_CHECK(err_code);
  
  nrf_gpio_cfg_output(LED);
  nrf_gpio_pin_set(LED);

  nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
  in_config.pull = NRF_GPIO_PIN_PULLUP;

  err_code = nrf_drv_gpiote_in_init(BUTTON_1, &in_config, input_pin_handle);
  APP_ERROR_CHECK(err_code);

  nrf_drv_gpiote_in_event_enable(BUTTON_1, true);
}

I'm using this code to handle interrupt and power down the device. However, this code is not working the softdevice.

I just want to power on and power off using an interrupt signal.

Parents Reply Children
No Data
Related