From bf32958ccd9df0b476c73050b02bfb3d5b7cd3a1 Mon Sep 17 00:00:00 2001 From: AlbertEEWork Date: Tue, 27 Jan 2026 11:47:21 +0200 Subject: [PATCH] Removed this to enable PC Interupt for PCINT6 and & the Stop en reset buttons --- DEBUG.md | 21 +++++++++++++++++++++ src/PinChangeInterruptSettings.h | 29 +++++++++++++++++++++++------ 2 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 DEBUG.md diff --git a/DEBUG.md b/DEBUG.md new file mode 100644 index 0000000..8843fc9 --- /dev/null +++ b/DEBUG.md @@ -0,0 +1,21 @@ +PinChangeInterrupt library debug + +This library already supports a local debug macro in `PinChangeInterruptSettings.h`: + +- `__PCINT_DEBUG__` (default 0) controls `PCINT_DEBUG_PRINT(...)` which prints + with `Serial.println(F("..."))` when enabled. + +Examples to enable: +- platformio.ini (per-environment): + + [env:program_DiamexISP] + build_flags = -D__PCINT_DEBUG__=1 + +- Or define before including the library headers: + + #define __PCINT_DEBUG__ 1 + #include + +Notes: +- Debug prints use `F("string")` to keep strings in flash (saves RAM). +- When disabled, `PCINT_DEBUG_PRINT(...)` expands to nothing. diff --git a/src/PinChangeInterruptSettings.h b/src/PinChangeInterruptSettings.h index 8f8b07b..d48cdfb 100644 --- a/src/PinChangeInterruptSettings.h +++ b/src/PinChangeInterruptSettings.h @@ -24,6 +24,23 @@ THE SOFTWARE. // include guard #pragma once +// Per-library debug control for PinChangeInterrupt. +// Set __PCINT_DEBUG__ to 1 to enable lightweight debug prints for this library. +// We use PCINT_DEBUG_PRINT(...) so other libraries are unaffected. +#ifndef __PCINT_DEBUG__ +#define __PCINT_DEBUG__ 0 +#endif + +#if __PCINT_DEBUG__ +#ifdef ARDUINO +#define PCINT_DEBUG_PRINT(...) Serial.println(F(__VA_ARGS__)) +#else +#define PCINT_DEBUG_PRINT(...) +#endif +#else +#define PCINT_DEBUG_PRINT(...) +#endif + //================================================================================ // General Settings //================================================================================ @@ -120,12 +137,12 @@ PCINT_CALLBACK(3, 19); /* Pin Interrupt 1 */ #endif // deactivate crystal and reset pins by default -#if defined(PCINT_ENABLE_PCINT6) -#undef PCINT_ENABLE_PCINT6 // crystal -#endif -#if defined(PCINT_ENABLE_PCINT7) -#undef PCINT_ENABLE_PCINT7 // crystal -#endif +// #if defined(PCINT_ENABLE_PCINT6) +// #undef PCINT_ENABLE_PCINT6 // crystal +// #endif +// #if defined(PCINT_ENABLE_PCINT7) +// #undef PCINT_ENABLE_PCINT7 // crystal +// #endif #if defined(PCINT_ENABLE_PCINT14) #undef PCINT_ENABLE_PCINT14 // reset #endif