1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #15111 from maribu/xtimer-assert

sys/{x,z}timer: assert() successful initialization of periph_timer
This commit is contained in:
Kaspar Schleiser 2020-09-30 08:52:34 +02:00 committed by GitHub
commit 2dab6c7b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,7 @@
#include "periph_conf.h"
#endif
#include "assert.h"
#include "xtimer.h"
#include "irq.h"
@ -65,7 +66,9 @@ void xtimer_init(void)
{
#ifndef MODULE_XTIMER_ON_ZTIMER
/* initialize low-level timer */
timer_init(XTIMER_DEV, XTIMER_HZ, _periph_timer_callback, NULL);
int ret = timer_init(XTIMER_DEV, XTIMER_HZ, _periph_timer_callback, NULL);
(void)ret;
assert(ret == 0);
#endif
/* register initial overflow tick */

View File

@ -20,6 +20,7 @@
* @}
*/
#include "assert.h"
#include "irq.h"
#include "ztimer/periph_timer.h"
@ -79,6 +80,8 @@ void ztimer_periph_timer_init(ztimer_periph_timer_t *clock, tim_t dev,
clock->dev = dev;
clock->super.ops = &_ztimer_periph_timer_ops;
clock->super.max_value = max_val;
timer_init(dev, freq, _ztimer_periph_timer_callback, clock);
int ret = timer_init(dev, freq, _ztimer_periph_timer_callback, clock);
(void)ret;
assert(ret == 0);
ztimer_init_extend(&clock->super);
}