Revise chtm.c to allow time chaining of same object

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@16311 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
fxcoder 2023-07-06 05:57:10 +00:00
parent c124680e97
commit f77d00b0c9
1 changed files with 6 additions and 4 deletions

View File

@ -152,11 +152,13 @@ NOINLINE void chTMStopMeasurementX(time_measurement_t *tmp) {
NOINLINE void chTMChainMeasurementToX(time_measurement_t *tmp1,
time_measurement_t *tmp2) {
/* Starts new measurement.*/
tmp2->last = chSysGetRealtimeCounterX();
/* Get current time for measurement.*/
rtcnt_t now = chSysGetRealtimeCounterX();
/* Stops previous measurement using the same time stamp.*/
tm_stop(tmp1, tmp2->last, (rtcnt_t)0);
/* Stop previous measurement using current time. Update chained only after
stop since the same measurement object may be used.*/
tm_stop(tmp1, now, (rtcnt_t)0);
tmp2->last = now;
}
#endif /* CH_CFG_USE_TM == TRUE */