diff --git a/src/devices/TfIO16Bricklet.cpp b/src/devices/TfIO16Bricklet.cpp index 5068077..144ec01 100644 --- a/src/devices/TfIO16Bricklet.cpp +++ b/src/devices/TfIO16Bricklet.cpp @@ -197,7 +197,17 @@ void TfIO16Bricklet::setPort(char port, uint8_t value_mask) { } void TfIO16Bricklet::setPort(char port, uint8_t pin_mask, bool value) { - throw TfError("Not implemented", TfErrorCode::E_UNKNOWN_ERROR_CODE); + uint8_t mask; + if (port == 'a') { + mask = outMapA = (outMapA & ~pin_mask) | ((value ? 0xFF : 0x00) & pin_mask); + } else if (port == 'b') { + mask = outMapB = (outMapB & ~pin_mask) | ((value ? 0xFF : 0x00) & pin_mask); + } else { + std::ostringstream ss; + ss << "Unknown Port: " << port << "."; + throw TfError(ss.str(), TfErrorCode::E_INVALID_PARAMETER); + } + setPort(port, mask); }