pit_fast: fix off by one error with mode 2 counter

This commit is contained in:
Adrien Moulin
2022-08-02 22:38:20 +02:00
parent f394fb20fb
commit 81978c9539

View File

@@ -145,6 +145,8 @@ pitf_dump_and_disable_timer(ctrf_t *ctr)
{
if (ctr->using_timer && timer_is_enabled(&ctr->timer)) {
ctr->count = pitf_read_timer(ctr);
if (ctr->m == 2)
ctr->count--; /* Don't store the offset from pitf_read_timer */
timer_disable(&ctr->timer);
}
}