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

button exmaple is not working in SDK version 9.0.0

Hello evryone,

i cloned button example form github to sdk version 9.0.0 and i modified the neccesary changes between app.gpiote.c//nrf_drv_gpiote.c files and set the GPIOTE ENABLED to 0 after that it is getting compiled with no errors but the baord shows nothing if the press any of the button can anyone suggest me what modifications has to be done or any changes?

ble_app_template.zip

Thank you

prabhu

Parents
  • Hi prabhudurai,

    still havent gone through your code, but had a quick look. I saw this below code in your init_gpio() function

    NRF_GPIO->PIN_CNF[6] = (GPIO_PIN_CNF_DRIVE_H0D1 << GPIO_PIN_CNF_DRIVE_Pos);

    This is wrong as you are setting every other bits to '0' and only setting the drive strength. With this the pin will be configured as input. To do this correctly, you need to do this below

    NRF_GPIO->PIN_CNF[6] &= ~(GPIO_PIN_CNF_DRIVE_Msk); // reset drive setting
    NRF_GPIO->PIN_CNF[6] |= (GPIO_PIN_CNF_DRIVE_H0D1 << GPIO_PIN_CNF_DRIVE_Pos); // set to high drive
    

    you need to do this for pin settings 7 also.

  • When you are using the same button for recognizing 3 seconds push and 5 seconds push then it is normal that it is getting confused when you 3 seconds are expired.

    t You can change your logic like this. When you press the button, start the 3 second timer. When the 3 sec timer expires and its callback is called, check if the button is still pressed, If it is still shows that the button is pressed, start 2 seconds timer. When the two seconds timer expires and the callback is called, check again if the button is being pressed. If it is not pressed, then it was 3 seconds push and start the buzzer. If it is still being pressed it is a 5 second push so stop the buzzer.

Reply
  • When you are using the same button for recognizing 3 seconds push and 5 seconds push then it is normal that it is getting confused when you 3 seconds are expired.

    t You can change your logic like this. When you press the button, start the 3 second timer. When the 3 sec timer expires and its callback is called, check if the button is still pressed, If it is still shows that the button is pressed, start 2 seconds timer. When the two seconds timer expires and the callback is called, check again if the button is being pressed. If it is not pressed, then it was 3 seconds push and start the buzzer. If it is still being pressed it is a 5 second push so stop the buzzer.

Children
No Data
Related