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:
parent
16baad825d
commit
91927c988b
@ -19,9 +19,3 @@ QUIET ?= 1
|
|||||||
FEATURES_OPTIONAL += periph_timer
|
FEATURES_OPTIONAL += periph_timer
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
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
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "clk.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
#include "timex.h"
|
#include "timex.h"
|
||||||
@ -41,7 +42,8 @@ static void delay(void)
|
|||||||
* compilers would detect that the loop is only wasting CPU cycles and
|
* compilers would detect that the loop is only wasting CPU cycles and
|
||||||
* optimize it out - but here the wasting of CPU cycles is desired.
|
* 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++) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user