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!
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!
Hi
I'm having some trouble understanding what exactly you mean. Are you asking whether adding a delay to the main loop will cause a delay in your application? If so, yes it will.
Best regards,
Simon
Hi
What I mean is adding a delay to the main loop will cause a delay of button event and I have tryed several programs are the same result.
You want a delay on a button in your application, is that correct? Please check out the button handler library, because a delay function in your main loop will just add a delay between what ever functions are on either side between the two.
Best regards,
Simon
Hi
Yes,you are right,but my question is adding a delay to the main loop why cause a delay of button event? you can have a try ,so you can know what I say. and if I add code segment in main loop it will cause button maybe invalid.
thanks.
static void bsp_event_handler(bsp_event_t event)
{
switch (event)
{
case BSP_EVENT_KEY_0:
nrf_gpio_pin_clear(14);// new add
//thread_coap_utils_unicast_light_request_send(THREAD_COAP_UTILS_LIGHT_CMD_TOGGLE);
break;
while (true)
{
thread_process();
app_sched_execute();
nrf_delay_ms(1000); //new add
if (NRF_LOG_PROCESS() == false)
{
thread_sleep();
}
}
Hi again
I'm still not sure I understand you correctly. A delay in your main loop should not cause any interrupts to be delayed, as interrupts are meant to interrupt things like delays. Unfortunately, the code snippet you've added is not very helpful.
Can you try to explain what you said in your last sentence again? What do you mean by "if I add code segment in main loop it will cause button maybe invalid"?
Best regards,
Simon