summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikey Sklar <[email protected]>2026-07-09 16:27:50 -0700
committerMikey Sklar <[email protected]>2026-07-10 06:17:38 -0700
commit72e14c7e027a66e1b640ed696e06b67e7ad47e2e (patch)
treeaf60c8f228081f024cfb48194d55bd602a4024fa
parentfa750d6bf045f1df4314d283dfe0508d0d066559 (diff)
nrf5x: fix hfclk_running() for nrfx v2.0.0
nrf_clock_is_running() was added in nrfx 2.1.0 (MDK 8.30.2), but the version autodetect puts 2.0.0 (MDK 8.29.0) in the v2 bucket, so hfclk_running() fails to compile on that nrfx. Route v2 through nrf_clock_hf_is_running(), which all of 2.x provides. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
-rw-r--r--src/portable/nordic/nrf5x/dcd_nrf5x.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c
index 53d045d61..dc85ff78e 100644
--- a/src/portable/nordic/nrf5x/dcd_nrf5x.c
+++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c
@@ -843,6 +843,10 @@ static bool hfclk_running(void) {
#if CFG_TUD_NRF_NRFX_VERSION == 1
return nrf_clock_hf_is_running(NRF_CLOCK_HFCLK_HIGH_ACCURACY);
+ #elif CFG_TUD_NRF_NRFX_VERSION == 2
+ // nrfx 2.0.0 (MDK 8.29.0) has no nrf_clock_is_running(); it arrived in 2.1.0.
+ // nrf_clock_hf_is_running() is present in all of 2.0.0-2.11.0 (deprecated from 2.1.0).
+ return nrf_clock_hf_is_running(NRF_CLOCK, NRF_CLOCK_HFCLK_HIGH_ACCURACY);
#else
return nrf_clock_is_running(NRF_CLOCK, NRF_CLOCK_DOMAIN_HFCLK, NULL);
#endif