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

Small problem with using the GPIO to power system ON/OFF

Hi, I am really new to the Nordic products and programming for that matters. But, the thing is that I am in somewhat of a hurry. I would like to use a similar code to below to the one below to put my device in system on/off on GPIO inputs. The only problem is that it isn't working for the moment. Can someone please hep me ? Here is my main function :

// Initialize
timers_init();
ble_stack_init();
scheduler_init();
gap_params_init();
advertising_init();
conn_params_init();
sec_params_init();
LEDS_CONFIGURE(LEDS_MASK);

  //Configure Pin P0.00 as an input
	nrf_gpio_cfg_input(0, NRF_GPIO_PIN_PULLDOWN);
	
  //Configure Pin P0.01 in sense mode
	nrf_gpio_cfg_sense_input(1, NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_HIGH);


      // Start execution
      advertising_start();
      sd_ble_gap_tx_power_set(-40);

      // Enter main loop
for (;;)
{
    app_sched_execute();
    power_manage();
		  if (nrf_gpio_pin_read(0) == 1)
			{
				sd_power_system_off();
			}
}
Related