Merge pull request #15004 from kaspar030/ztimer_periodic_wakeup_32bit

ztimer: use uint32_t in ztimer_periodic_wakeup
This commit is contained in:
Kaspar Schleiser 2020-09-11 11:13:19 +02:00 committed by GitHub
commit 474cde6046
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,14 +55,13 @@ void ztimer_sleep(ztimer_clock_t *clock, uint32_t duration)
mutex_lock(&mutex); mutex_lock(&mutex);
} }
void ztimer_periodic_wakeup(ztimer_clock_t *clock, ztimer_now_t *last_wakeup, void ztimer_periodic_wakeup(ztimer_clock_t *clock, uint32_t *last_wakeup,
uint32_t period) uint32_t period)
{ {
unsigned state = irq_disable(); unsigned state = irq_disable();
ztimer_now_t now = ztimer_now(clock); uint32_t now = ztimer_now(clock);
ztimer_now_t target = *last_wakeup + period; uint32_t target = *last_wakeup + period;
ztimer_now_t offset = target - now; uint32_t offset = target - now;
irq_restore(state); irq_restore(state);
if (offset <= period) { if (offset <= period) {