Simple Timer API :: Bare Metal Programming Series 9

preview_player
Показать описание
In this installment of the bare metal programming series, we're taking a minute to build a very simple timer API, allowing us to quickly setup, check, and reset software based timers - accounting for any drift that may occur between checks!

=[ 🔗 Links 🔗 ]=

Рекомендации по теме
Комментарии
Автор

I think we should pass true for auto reset not timer->auto_reset
void timer) {
simple_timer_setup(timer, timer->wait_time, true);
}

osamamahmoud
Автор

this `drift` calculation seems overly complicated, can't you just do `target_time += wait_time`, and it'll be taken care of, without touching `now`?

meiskam
Автор

Wouldn't it be more appropriate to rename "simple_timer_has_elapsed" function to something like

evugar
visit shbcf.ru