🧑‍💻 GD32 fast write non-bool (#27806)

This commit is contained in:
B 2025-04-20 10:12:02 -07:00 committed by GitHub
parent d3687d933c
commit b23f86f83f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,9 +27,12 @@
#include <PinOps.hpp> #include <PinOps.hpp>
#include <PinOpsMap.hpp> #include <PinOpsMap.hpp>
static inline void fast_write_pin_wrapper(pin_size_t IO, bool V) { template<typename T>
if (V) gpio::fast_set_pin(getPortFromPin(IO), getPinInPort(IO)); static inline void fast_write_pin_wrapper(pin_size_t IO, T V) {
else gpio::fast_clear_pin(getPortFromPin(IO), getPinInPort(IO)); auto port = getPortFromPin(IO);
auto pin = getPinInPort(IO);
if (static_cast<bool>(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) { static inline bool fast_read_pin_wrapper(pin_size_t IO) {