1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +00:00

Comments in slightly more detail.

This commit is contained in:
Thomas Harte 2019-10-28 22:12:56 -04:00
parent a5057e6540
commit 1135576a3a

View File

@ -48,13 +48,18 @@ class IntelligentKeyboard:
}
bool serial_line_did_produce_bit(Serial::Line *, int bit) final {
// Shift.
command_ = (command_ >> 1) | (bit << 9);
// If that's 10 bits, decode a byte and stop.
bit_count_ = (bit_count_ + 1) % 10;
if(!bit_count_) {
dispatch_command(uint8_t(command_ >> 1));
command_ = 0;
return false;
}
// Continue.
return true;
}