From de64d42ef53fdec91e38bf2e09bece40b31e81e1 Mon Sep 17 00:00:00 2001 From: Maximilian Gerhardt Date: Sun, 17 Jan 2021 23:29:30 +0100 Subject: [PATCH 1/2] Prevent redefine of HSE_VALUE if already user-overridden Commercially sold Blackpill F411CE boards feature a 25MHz crystal, but if a board differs, HSE_VALUE can still be overridden while keeping everything else the same. With defensive programming like this, users of a custom (or differing commercially sold) board can easily use this variant with the same chip but just a slightly different crystal. --- variants/Generic_F411Cx/variant.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/Generic_F411Cx/variant.h b/variants/Generic_F411Cx/variant.h index c4488de4b3..d134651319 100644 --- a/variants/Generic_F411Cx/variant.h +++ b/variants/Generic_F411Cx/variant.h @@ -113,8 +113,10 @@ extern "C" { #define PIN_SERIAL_TX PA9 #ifdef ARDUINO_BLACKPILL_F411CE +#ifndef HSE_VALUE #define HSE_VALUE 25000000U #endif +#endif #ifdef __cplusplus } // extern "C" From 96368a33d161e073ba79cb08f0ffb9f533e1c6d0 Mon Sep 17 00:00:00 2001 From: Maximilian Gerhardt Date: Sun, 17 Jan 2021 23:31:48 +0100 Subject: [PATCH 2/2] Allow user-overridable HSE_VALUE for F401Cx boards Same reasoning as previous commit --- variants/Generic_F401Cx/variant.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/Generic_F401Cx/variant.h b/variants/Generic_F401Cx/variant.h index 819133bb62..c39bbc51a6 100644 --- a/variants/Generic_F401Cx/variant.h +++ b/variants/Generic_F401Cx/variant.h @@ -110,8 +110,10 @@ extern "C" { #define PIN_SERIAL_TX PA9 #ifdef ARDUINO_BLACKPILL_F401CC +#ifndef HSE_VALUE #define HSE_VALUE 25000000U #endif +#endif #ifdef __cplusplus } // extern "C"