Skip to content

Commit cf2aa52

Browse files
committed
Allow F_CPU redefinition
To avoid any issue with `F_CPU` value, it is defined by default to `SystemCoreClock` value which is updated automatically after each clock configuration update. Some libraries use `F_CPU` at build time for conditional purpose (ex to stm32duino#612). This commit allow to redefine it at build time using `build_opt.h` or `hal_conf_extra.h`: https://github.com/stm32duino/wiki/wiki/Custom-definitions then it will be possible to define it as a constant. Important note: **User have to ensure to set it to the proper value.** Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 7580479 commit cf2aa52

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: cores/arduino/stm32/stm32_def.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
|(STM32_CORE_VERSION_PATCH << 8U )\
2121
|(STM32_CORE_VERSION_EXTRA))
2222

23-
#define F_CPU SystemCoreClock
2423
#define USE_HAL_DRIVER
2524

2625
#ifdef STM32F0xx
@@ -53,6 +52,10 @@
5352
#error "STM32YYxx chip series is not defined in boards.txt."
5453
#endif
5554

55+
#ifndef F_CPU
56+
#define F_CPU SystemCoreClock
57+
#endif
58+
5659
// Here define some compatibility
5760
#ifndef CAN1
5861
#define CAN1 CAN

0 commit comments

Comments
 (0)