大家好!
我在SimpleBLECentral例子的OnBoard.h中看到如下宏定义
#define TICK_TIME 1000 /* Timer per tick - in micro-sec */
#define TICK_COUNT 1
#define OSAL_TIMER HAL_TIMER_3
我知道这定义系统的节拍为1微妙,定时器为定时器4.但是我在程序其他地方没有看到哪里使用了这些宏定义.
我想知道系统时钟在哪里初始化的,初始化时做了哪些事?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
/*********************************************************************
* @fn osalTimeUpdate
*
* @brief Uses the free running rollover count of the MAC backoff timer;
* this timer runs freely with a constant 320 usec interval. The
* count of 320-usec ticks is converted to msecs and used to update
* the OSAL clock and Timers by invoking osalClockUpdate() and
* osalTimerUpdate(). This function is intended to be invoked
* from the background, not interrupt level.
*
* @param None.
*
* @return None.
*/
void osalTimeUpdate( void )
{
uint16 tmp;
uint16 ticks625us;
uint16 elapsedMSec = 0;
// Get the free-running count of 625us timer ticks
tmp = ll_McuPrecisionCount();
if ( tmp != previousLLTimerTick )
{
// Calculate the elapsed ticks of the free-running timer.
ticks625us = tmp - previousLLTimerTick;
// Store the LL Timer tick count for the next time through this function.
previousLLTimerTick = tmp;
/* It is necessary to loop to convert the usecs to msecs in increments so as
* not to overflow the 16-bit variables.
*/
while ( ticks625us > MAXCALCTICKS )
{
ticks625us -= MAXCALCTICKS;
elapsedMSec += MAXCALCTICKS * 5 / 8;
remUsTicks += MAXCALCTICKS * 5 % 8;
}
// update converted number with remaining ticks from loop and the
// accumulated remainder from loop
tmp = (ticks625us * 5) + remUsTicks;
// Convert the 625 us ticks into milliseconds and a remainder
elapsedMSec += tmp / 8;
remUsTicks = tmp % 8;
// Update OSAL Clock and Timers
if ( elapsedMSec )
{
osalClockUpdate( elapsedMSec );
osalTimerUpdate( elapsedMSec );
}
}
}
不知道ll_McuPrecisionCount这个函数的做了什么?
节拍是320us吗?还是625us?