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

GPIO Configuration as sense input conflict

Hi,

I am developing one of the my project on custom board, in which I have to configured the two GPIO Pin's as input to sense the those pin and take actions assigned on it.

For these I have configured the NRF51822: Pin 3 and Pin 6 for the input sensing.

But I am facing problem while developing code for same, Whenever I am pressing Pin 6 it gives proper output but when we press the Pin 3 at the same time it does not give desired output as coded in the program. 

I need to develop the code for the two button configurations and having two different work on it.

Below I am sharing Piece of code for the reference.... 

Looking forward for the possible solution and guidance for the same...

And please Correct if I am going wrong ...

Thanks

My Code

int main(void)
{
		nrf_gpio_cfg_output(BLUE_LED);
	  nrf_gpio_pin_set(BLUE_LED);
		
		nrf_gpio_cfg_output(RED_LED);
	  nrf_gpio_pin_set(RED_LED);
	
		nrf_gpio_cfg_sense_input(nBOOT_PIN,NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);
		nrf_gpio_cfg_sense_input(USB_SENSE,NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);
		
    while (1)
    {
				while(nrf_gpio_pin_read(USB_SENSE) == 1)
					{
									nrf_gpio_pin_toggle(RED_LED);
									nrf_delay_ms(1000);
										if(nrf_gpio_pin_read(USB_SENSE) == 1)
										break;
							
					}
					
				while(nrf_gpio_pin_read(nBOOT_PIN) == 0)
					{
									nrf_gpio_pin_toggle(BLUE_LED);
									nrf_delay_ms(1000);
										if(nrf_gpio_pin_read(nBOOT_PIN) == 0)
										break;
						
					}

Parents Reply Children
No Data
Related