Skip to content

Commit

Permalink
Adjusted compensation in the BLE PalTimer to account for delays not o…
Browse files Browse the repository at this point in the history
…n a 100ms boundary.
  • Loading branch information
BrentK-ADI committed Mar 14, 2024
1 parent 31748bc commit 430fc07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void PalTimerDeInit(void)
/*************************************************************************************************/
/*!
* \brief Return scheduler timer state.
*/
/*************************************************************************************************/
void PalTimerExecCallback(void)
Expand Down Expand Up @@ -359,6 +359,9 @@ void PalTimerStart(uint32_t expUsec)

/* Convert the time based on our calibration */
expUsec += (expUsec / PAL_TMR_CALIB_TIME_US) * palTimerCb.usecDiff;
expUsec +=
((((int)expUsec % PAL_TMR_CALIB_TIME_US) * palTimerCb.usecDiff) / PAL_TMR_CALIB_TIME_US);

#if defined(USE_SHARED_WUT)
PalSysSetBusy();
uint64_t volatile compareValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void PalTimerDeInit(void)
/*************************************************************************************************/
/*!
* \brief Return scheduler timer state.
*/
/*************************************************************************************************/
void PalTimerExecCallback(void)
Expand Down Expand Up @@ -309,6 +309,7 @@ void PalTimerStart(uint32_t expUsec)

/* Convert the time based on our calibration */
expUsec += (expUsec / PAL_TMR_CALIB_TIME) * palTimerCb.usecDiff;
expUsec += ((((int)expUsec % PAL_TMR_CALIB_TIME) * palTimerCb.usecDiff) / PAL_TMR_CALIB_TIME);

/* Convert the start time to ticks */
MXC_TMR_SetCount(PAL_TMR, 0);
Expand Down

0 comments on commit 430fc07

Please sign in to comment.