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

nrf51822 strange timmer behaviour

Hi all.

i just want to wake up or put into sleep my device once the user push a button for more than 3s. 

(the rest of the program works perfectly, also the timmer etc..) 

I am usin sdk 12.3 BLE_UART, PWM and TWI 

my gpio 29 is in charge to wake up the device and works perfectly if i just push it 

FOR SLEEPING 

I have included this in the timer_event_handler function

if(!nrf_gpio_pin_read(29)){
contador_delay++;
if (contador_delay>=3000*20){
contador_delay=0;
sleep();
}
}

HERE THE SYSTEM GOES TO SLEEP BUT NEVER WAKES UP AGAIN WHEN I PUSH THE BUTTON 



FOR WAKE UP: 

in the main function: 

contador_tiempo_timer_flow=0;

while(!nrf_gpio_pin_read(29)){

}

if(contador_tiempo_timer_flow<=10000*20){
dormir();
}

(contador_tiempo_timer is increasing in timer_event_handler function)

HERE IS LIKE IF contador_tiempo_timer IS ALWAYS 0 OR RESETED

none of those cases are working... 

My doubt is: Can i use nrf_gpio_pim_red(29).. if i have declared that pin as the one incharge to wake up the device? if yes.. what is happening? 

Thanks a lot  

Related