mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-26 15:32:04 +00:00
Corrects centralised ADB decoder.
I still think it's appropriate to do this in only a single place, given that using it is optional.
This commit is contained in:
parent
52c38e72f6
commit
6e53b4c507
@ -50,7 +50,7 @@ void Bus::set_device_output(size_t device_id, bool output) {
|
||||
device->adb_bus_did_observe_event(Event::Attention);
|
||||
}
|
||||
shift_register_ = 1;
|
||||
printf("!!! atn\n");
|
||||
phase_ = Phase::AttentionCapture;
|
||||
} else if(low_microseconds < 50.0) {
|
||||
shift(1);
|
||||
} else if(low_microseconds < 72.0) {
|
||||
@ -72,14 +72,17 @@ void Bus::set_device_output(size_t device_id, bool output) {
|
||||
|
||||
void Bus::shift(unsigned int value) {
|
||||
shift_register_ = (shift_register_ << 1) | value;
|
||||
printf("!!! %d\n", value);
|
||||
|
||||
// Trigger a byte whenever a start bit hits bit 8.
|
||||
if(shift_register_ & 0x100) {
|
||||
for(auto device: devices_) {
|
||||
device->adb_bus_did_observe_event(Event::Byte, uint8_t(shift_register_));
|
||||
}
|
||||
shift_register_ = 1;
|
||||
|
||||
// Expect a real start bit only if moving from attention capture to packet
|
||||
// capture. Otherwise adopt an implied start bit.
|
||||
shift_register_ = phase_ == Phase::PacketCapture;
|
||||
phase_ = Phase::PacketCapture;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,10 @@ class Bus {
|
||||
size_t next_device_id_ = 0;
|
||||
|
||||
inline void shift(unsigned int);
|
||||
enum class Phase {
|
||||
PacketCapture,
|
||||
AttentionCapture
|
||||
} phase_ = Phase::AttentionCapture;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user