Improved IO16-Bricklet.

This commit is contained in:
hg
2014-06-18 01:39:16 +02:00
parent 3514bf344b
commit 9c7858961b
+11 -1
View File
@@ -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);
}