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

key delay and nrf_delay_ms() function

HI

   The SDK is "nRF5_SDK_for_Thread_and_Zigbee_v4.1.0" and I find a question that is: for all thread programs, add  nrf_ delay_ ms () function in while (true) will affect the operation delay of the key, what's the matter? 

  thanks!

Parents
  • Hi

    Seems like the app_sched_execute() is scheduling the button events for processing later, and that the delay blocks the app_sched_execute() which is what causes this delay. This depends on how you detect that something is happening and what happens in the interrupt. If the interrupt just schedules a handler that does something based on the button press later, then the handler will be run at a later point.

    You can check this by setting a breakpoint in the interrupt handler and see if it's triggered immediately when the button is pressed.

    Best regards,

    Simon

Reply
  • Hi

    Seems like the app_sched_execute() is scheduling the button events for processing later, and that the delay blocks the app_sched_execute() which is what causes this delay. This depends on how you detect that something is happening and what happens in the interrupt. If the interrupt just schedules a handler that does something based on the button press later, then the handler will be run at a later point.

    You can check this by setting a breakpoint in the interrupt handler and see if it's triggered immediately when the button is pressed.

    Best regards,

    Simon

Children
Related