From b23f86f83f6ff5f2e8fcedc4203ca081cbc58596 Mon Sep 17 00:00:00 2001 From: B Date: Sun, 20 Apr 2025 10:12:02 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20GD32=20fast?= =?UTF-8?q?=20write=20non-bool=20(#27806)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/GD32_MFL/fastio.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Marlin/src/HAL/GD32_MFL/fastio.h b/Marlin/src/HAL/GD32_MFL/fastio.h index 8185be73a4..35bd2b1ef7 100644 --- a/Marlin/src/HAL/GD32_MFL/fastio.h +++ b/Marlin/src/HAL/GD32_MFL/fastio.h @@ -27,9 +27,12 @@ #include #include -static inline void fast_write_pin_wrapper(pin_size_t IO, bool V) { - if (V) gpio::fast_set_pin(getPortFromPin(IO), getPinInPort(IO)); - else gpio::fast_clear_pin(getPortFromPin(IO), getPinInPort(IO)); +template +static inline void fast_write_pin_wrapper(pin_size_t IO, T V) { + auto port = getPortFromPin(IO); + auto pin = getPinInPort(IO); + if (static_cast(V)) gpio::fast_set_pin(port, pin); + else gpio::fast_clear_pin(port, pin); } static inline bool fast_read_pin_wrapper(pin_size_t IO) {