TI中文支持网
TI专业的中文技术问题搜集分享网站

CC1310: CC1310 simplelink_cc13x0_sdk_4_20_00_05 短延时API函数

Part Number:CC1310

大家好:

          请教大家一个问题,我使用的是simplelink_cc13x0_sdk_4_20_00_05版本 SDK中 sensor例程,我需要模拟一个I2C通信,需要短延时(比如 5ms  8ms等等)

         1、有没有相关的API?

         2、在代码中看到了 Task_sleep();这个能否使用?

Kevin Qiu1:

Task_sleep是RTOS中的API,它可以进行任务切换

只是想让CPU延时等待可以使用CPUdelay

//*****************************************************************************
//
//! \brief Provide a small non-zero delay using a simple loop counter.
//!
//! This function provides means for generating a constant length delay. It
//! is written in assembly to keep the delay consistent across tool chains,
//! avoiding the need to tune the delay based on the tool chain in use.
//!
//! \note It is not recommended using this function for long delays.
//!
//! Notice that interrupts can affect the delay if not manually disabled in advance.
//!
//! The delay depends on where code resides and the path for code fetching:
//! - Code in flash, cache enabled, prefetch enabled: 4 cycles per loop (Default)
//! - Code in flash, cache enabled, prefetch disabled : 5 cycles per loop
//! - Code in flash, cache disabled: 7 cycles per loop
//! - Code in SRAM: 6 cycles per loop
//! - Code in GPRAM: 3 cycles per loop
//!
//! \note If using an RTOS, consider using RTOS provided delay functions because
//! these will not block task scheduling and will potentially save power.
//!
//! Calculate delay count based on the wanted delay in microseconds (us):
//! - ui32Count = [delay in us] * [CPU clock in MHz] / [cycles per loop]
//!
//! Example: 250 us delay with code in flash and with cache and prefetch enabled:
//! - ui32Count = 250 * 48 / 4 = 3000
//!
//! \param ui32Count is the number of delay loop iterations to perform. Number must be greater than zero.
//!
//! \return None
//
//*****************************************************************************
extern void CPUdelay(uint32_t ui32Count);

,

Invoker:

您好,请问这个api在什么文件中,我在sensor例程中没有搜到

,

Kevin Qiu1:

在CC1310_LAUNCHXL_fxns.c中有用到,定义在cpu.h中

,

Invoker:

您好,我看到有的驱动例程 比如 “PWMled2” 中,有用到 usleep();在unistd.h中声明,这个sleep的机制是什么样的呢?能否使用

,

Kevin Qiu1:

这个是posix中的任务切换API,和Task_sleep是一样的

赞(0)
未经允许不得转载:TI中文支持网 » CC1310: CC1310 simplelink_cc13x0_sdk_4_20_00_05 短延时API函数
分享到: 更多 (0)