serial: dont fake a connection if it's not there
This commit is contained in:
parent
a9886a773a
commit
932e70a443
|
@ -35,11 +35,15 @@ pub struct Serial {
|
|||
output_byte: u8,
|
||||
bits_remaining: u8,
|
||||
control: SerialControl,
|
||||
is_connected: bool,
|
||||
}
|
||||
|
||||
impl Serial {
|
||||
pub fn tick(&mut self, steps: usize) -> bool {
|
||||
let mut will_interrupt = false;
|
||||
if !self.is_connected {
|
||||
return false;
|
||||
}
|
||||
for _ in 0..steps {
|
||||
if self.control.transfer_in_progress {
|
||||
self.output_byte = self.output_byte << 1 | self.byte >> 7;
|
||||
|
@ -98,6 +102,7 @@ impl Default for Serial {
|
|||
output_byte: 0,
|
||||
bits_remaining: 7,
|
||||
control: SerialControl::default(),
|
||||
is_connected: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue