Skip to content
Snippets Groups Projects
Verified Commit c5ef259a authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

fix: better code format

parent 93e0d10e
No related branches found
No related tags found
1 merge request!23Support for serial data transfer 🔌
Pipeline #2501 passed
use crate::serial::SerialDevice; use crate::serial::SerialDevice;
pub struct PrinterDevice { pub struct PrinterDevice {}
}
impl PrinterDevice { impl PrinterDevice {
pub fn new() -> Self { pub fn new() -> Self {
......
...@@ -3,14 +3,12 @@ use std::io::{stdout, Write}; ...@@ -3,14 +3,12 @@ use std::io::{stdout, Write};
use crate::serial::SerialDevice; use crate::serial::SerialDevice;
pub struct StdoutDevice { pub struct StdoutDevice {
flush: bool flush: bool,
} }
impl StdoutDevice { impl StdoutDevice {
pub fn new(flush: bool) -> Self { pub fn new(flush: bool) -> Self {
Self { Self { flush }
flush
}
} }
} }
......
...@@ -2,6 +2,7 @@ use crate::{ ...@@ -2,6 +2,7 @@ use crate::{
apu::Apu, apu::Apu,
cpu::Cpu, cpu::Cpu,
data::{BootRom, CGB_BOOT, DMG_BOOT, DMG_BOOTIX, MGB_BOOTIX, SGB_BOOT}, data::{BootRom, CGB_BOOT, DMG_BOOT, DMG_BOOTIX, MGB_BOOTIX, SGB_BOOT},
devices::{printer::PrinterDevice, stdout::StdoutDevice},
gen::{COMPILATION_DATE, COMPILATION_TIME, COMPILER, COMPILER_VERSION}, gen::{COMPILATION_DATE, COMPILATION_TIME, COMPILER, COMPILER_VERSION},
mmu::Mmu, mmu::Mmu,
pad::{Pad, PadKey}, pad::{Pad, PadKey},
...@@ -9,7 +10,7 @@ use crate::{ ...@@ -9,7 +10,7 @@ use crate::{
rom::Cartridge, rom::Cartridge,
serial::Serial, serial::Serial,
timer::Timer, timer::Timer,
util::read_file, devices::{stdout::StdoutDevice, printer::PrinterDevice}, util::read_file,
}; };
use std::collections::VecDeque; use std::collections::VecDeque;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
pub mod apu; pub mod apu;
pub mod cpu; pub mod cpu;
pub mod devices;
pub mod data; pub mod data;
pub mod devices;
pub mod gb; pub mod gb;
pub mod gen; pub mod gen;
pub mod inst; pub mod inst;
......
...@@ -159,7 +159,7 @@ impl Serial { ...@@ -159,7 +159,7 @@ impl Serial {
if self.bit_count == 8 { if self.bit_count == 8 {
self.transferring = false; self.transferring = false;
self.length = 0; self.length = 0;
self.bit_count = 0; self.bit_count = 0;
// signals the interrupt for the serial // signals the interrupt for the serial
// transfer completion, indicating that // transfer completion, indicating that
...@@ -175,8 +175,7 @@ impl Default for Serial { ...@@ -175,8 +175,7 @@ impl Default for Serial {
} }
} }
pub struct NullDevice { pub struct NullDevice {}
}
impl NullDevice { impl NullDevice {
pub fn new() -> Self { pub fn new() -> Self {
...@@ -195,6 +194,5 @@ impl SerialDevice for NullDevice { ...@@ -195,6 +194,5 @@ impl SerialDevice for NullDevice {
0xff 0xff
} }
fn receive(&mut self, _: u8) { fn receive(&mut self, _: u8) {}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment