diff --git a/examples/blinky/Makefile b/examples/blinky/Makefile index 904e9ead10..2d58be2d6b 100644 --- a/examples/blinky/Makefile +++ b/examples/blinky/Makefile @@ -19,9 +19,3 @@ QUIET ?= 1 FEATURES_OPTIONAL += periph_timer include $(RIOTBASE)/Makefile.include - -ifeq (native,$(BOARD)) - # For the native board, CLOCK_CORECLOCK is undefined. But we need - # a valid number to get the example compiled - CFLAGS += -DCLOCK_CORECLOCK=1000000000 -endif diff --git a/examples/blinky/main.c b/examples/blinky/main.c index 038cd27d6d..ac90ccbc15 100644 --- a/examples/blinky/main.c +++ b/examples/blinky/main.c @@ -20,6 +20,7 @@ #include +#include "clk.h" #include "board.h" #include "periph_conf.h" #include "timex.h" @@ -41,7 +42,8 @@ static void delay(void) * compilers would detect that the loop is only wasting CPU cycles and * optimize it out - but here the wasting of CPU cycles is desired. */ - for (volatile uint32_t i = 0; i < CLOCK_CORECLOCK / 20; i++) { } + uint32_t loops = coreclk() / 20; + for (volatile uint32_t i = 0; i < loops; i++) { } } }