1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-02 10:53:01 +02:00

Fixed PU/PD support.

This commit is contained in:
Stefan de Bruijn
2020-10-26 09:26:38 +01:00
parent 270029fd75
commit 82d97745a2

View File

@@ -137,16 +137,19 @@ namespace Pins {
// Handle attributes: // Handle attributes:
uint8_t pinModeValue = 0; uint8_t pinModeValue = 0;
if (value.has(PinAttributes::PullUp)) { if (value.has(PinAttributes::Input)) {
pinModeValue |= INPUT_PULLUP;
} else if (value.has(PinAttributes::PullDown)) {
pinModeValue |= INPUT_PULLDOWN;
} else if (value.has(PinAttributes::Input)) {
pinModeValue |= INPUT; pinModeValue |= INPUT;
} else if (value.has(PinAttributes::Output)) { } else if (value.has(PinAttributes::Output)) {
pinModeValue |= OUTPUT; pinModeValue |= OUTPUT;
} }
// PU/PD should be specified by the user. Code has nothing to do with them:
if (_attributes.has(PinAttributes::PullUp)) {
pinModeValue |= PULLUP;
} else if (_attributes.has(PinAttributes::PullDown)) {
pinModeValue |= PULLDOWN;
}
// If the pin is ActiveLow, we should take that into account here: // If the pin is ActiveLow, we should take that into account here:
if (value.has(PinAttributes::InitialOn)) { if (value.has(PinAttributes::InitialOn)) {
__digitalWrite(_index, HIGH ^ _readWriteMask); __digitalWrite(_index, HIGH ^ _readWriteMask);