1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples/blinky: use coreclk() instead of CLOCK_CORECLOCK

This commit is contained in:
Alexandre Abadie 2021-12-05 11:55:56 +01:00
parent 16baad825d
commit 91927c988b
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
2 changed files with 3 additions and 7 deletions

View File

@ -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

View File

@ -20,6 +20,7 @@
#include <stdio.h>
#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++) { }
}
}