TI 2540 自带时钟功能 osal clock

参考文档:(协议栈中,有OSAL API.pdf)
D:\Texas Instruments\BLE-CC254x-1.4.2.2\Documents\osal

用法:

两种表示时间的方法

TI 2540 自带时钟功能 osal clock_第1张图片
image.png

void osal_setClock( UTCTime newTime );

newTime – new time in seconds since 0 hrs, 0 minutes, 0 seconds, on 1 January 2000 UTC.
其中UTCTime 是uint32
用这个方法设置系统时间
不set的话默认好像是0

UTCTime osal_getClock( void );

获取当前系统时间。比如你刚才set了时间为1,一秒后get得到的结果将是2

void osal_ConvertUTCTime( UTCTimeStruct * tm, UTCTime secTime );

将UTCTime转换为时间结构体

osalTimeUpdate( ) 不要自己调用!

  • Called from osal_run_system() to update the time.
  • This function reads the number of MAC 320usec ticks to maintain the OSAL Clock time.
  • Do not call this function anywhere else.

说明

这个系统时间是系统自己维护的,不需要我们在哪里设置update它
只需要在想要的时候set和get就行了!

你可能感兴趣的:(TI 2540 自带时钟功能 osal clock)