NRF52832学习笔记(21)——系统延时使用

一、头文件

需要包含头文件
#include "nrf_delay.h"

二、原函数

/**
 * @brief Function for delaying execution for a number of microseconds.
 *
 * @param us_time Number of microseconds to wait.
 */
#define nrf_delay_us(us_time) NRFX_DELAY_US(us_time)


/**
 * @brief Function for delaying execution for a number of milliseconds.
 *
 * @param ms_time Number of milliseconds to wait.
 */

__STATIC_INLINE void nrf_delay_ms(uint32_t ms_time)
{
    if (ms_time == 0)
    {
        return;
    }

    do {
        nrf_delay_us(1000);
    } while (--ms_time);
}

三、调用函数

nrf_delay_ms(50);    // 延时50ms
nrf_delay_us(50);    // 延时50us

• 由 Leung 写于 2020 年 7 月 15 日

猜你喜欢

转载自blog.csdn.net/qq_36347513/article/details/107363765