[uart] Setup uart pins only if flags are set (#11914)

Co-authored-by: J. Nick Koston <nick+github@koston.org>
This commit is contained in:
Anton SergunovandJ. Nick Koston authored and GitHub committed 2025-11-17 14:25:00 +13:00
1 parent 3b860e784c
commit aa097a2fe6
4 files changed
+40 -16

No files matched your search

@@ -53,7 +53,7 @@ void LibreTinyUARTComponent::setup() {
auto shouldFallbackToSoftwareSerial = [&]() -> bool {
auto hasFlags = [](InternalGPIOPin *pin, const gpio::Flags mask) -> bool {
return pin && pin->get_flags() & mask != gpio::Flags::FLAG_NONE;
return pin && (pin->get_flags() & mask) != gpio::Flags::FLAG_NONE;
};
if (hasFlags(this->tx_pin_, gpio::Flags::FLAG_OPEN_DRAIN | gpio::Flags::FLAG_PULLUP | gpio::Flags::FLAG_PULLDOWN) ||
hasFlags(this->rx_pin_, gpio::Flags::FLAG_OPEN_DRAIN | gpio::Flags::FLAG_PULLUP | gpio::Flags::FLAG_PULLDOWN)) {