mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-28 07:29:45 +00:00
Comments in slightly more detail.
This commit is contained in:
parent
a5057e6540
commit
1135576a3a
@ -48,13 +48,18 @@ class IntelligentKeyboard:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool serial_line_did_produce_bit(Serial::Line *, int bit) final {
|
bool serial_line_did_produce_bit(Serial::Line *, int bit) final {
|
||||||
|
// Shift.
|
||||||
command_ = (command_ >> 1) | (bit << 9);
|
command_ = (command_ >> 1) | (bit << 9);
|
||||||
|
|
||||||
|
// If that's 10 bits, decode a byte and stop.
|
||||||
bit_count_ = (bit_count_ + 1) % 10;
|
bit_count_ = (bit_count_ + 1) % 10;
|
||||||
if(!bit_count_) {
|
if(!bit_count_) {
|
||||||
dispatch_command(uint8_t(command_ >> 1));
|
dispatch_command(uint8_t(command_ >> 1));
|
||||||
command_ = 0;
|
command_ = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Continue.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user