From b0ea51af3202c1a1d23132b833aa018ba9e068ce Mon Sep 17 00:00:00 2001 From: WillyJL Date: Wed, 24 Sep 2025 04:59:21 +0200 Subject: [PATCH] Custom xPortInIsrContext() for RP2xx0 --- src/platform/nrf52/architecture.h | 1 + src/platform/rp2xx0/architecture.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index b1a2439e6..56b46088a 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -150,4 +150,5 @@ #define USE_SEGGER #endif +// Detect if running in ISR context (ARM Cortex-M4) #define xPortInIsrContext() ((SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) == 0 ? pdFALSE : pdTRUE) diff --git a/src/platform/rp2xx0/architecture.h b/src/platform/rp2xx0/architecture.h index 506c19c83..0c168ceee 100644 --- a/src/platform/rp2xx0/architecture.h +++ b/src/platform/rp2xx0/architecture.h @@ -35,4 +35,7 @@ #define HW_VENDOR meshtastic_HardwareModel_RP2040_FEATHER_RFM95 #elif defined(PRIVATE_HW) #define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW -#endif \ No newline at end of file +#endif + +// Detect if running in ISR context (ARM Cortex-M33 / RISC-V) +#define xPortInIsrContext() (__get_current_exception() == 0 ? pdFALSE : pdTRUE)