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

wait function

Hi

during setup of a peripheral at startup, I need to add some wait periods in between steps of the setup. Is there some function like waitMS(int time) or something, that would make the processor wait during a number of milliseconds, without compromising the timeliness of the BLE stack? Or is there some other way of doing timed blocking functions ?

The alternative would be to split up the function into different steps - or states- , and re-enter the function with timer events. But that is just a lot more code. And also using an RTOS is somewhat overkill for this, as I would only use this during startup.

Parents
  • The header file "nrf_delay.h" has an in-line delay routine:

    void nrf_delay_us(uint32_t volatile number_of_us)

    and the declaration for

    void nrf_delay_ms(uint32_t volatile number_of_ms);

    If you are using Keil V5, with packs, you will find the source here:

    C:\Keil_v5\ARM\Pack\NordicSemiconductor\nRF_Drivers\1.2.1\hal\nrf_delay.c

    both the us and ms delay code are just spin loops.

Reply
  • The header file "nrf_delay.h" has an in-line delay routine:

    void nrf_delay_us(uint32_t volatile number_of_us)

    and the declaration for

    void nrf_delay_ms(uint32_t volatile number_of_ms);

    If you are using Keil V5, with packs, you will find the source here:

    C:\Keil_v5\ARM\Pack\NordicSemiconductor\nRF_Drivers\1.2.1\hal\nrf_delay.c

    both the us and ms delay code are just spin loops.

Children
Related