summaryrefslogblamecommitdiff
path: root/src/components/device_bus.rs
blob: 9854ee94d70a51116b985410507bb19deeab965e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
             






                                                               










                                                                
use crate::*;


pub trait DeviceBus {
    fn read(&mut self, port: u8) -> u8;
    fn write(&mut self, port: u8, value: u8) -> Option<Signal>;
    fn wake(&mut self) -> bool;
}


pub trait Device {
    fn read(&mut self, port: u8) -> u8;
    fn write(&mut self, port: u8, value: u8) -> Option<Signal>;
    fn wake(&mut self) -> bool;
}

impl Device for () {
    fn read(&mut self, _: u8) -> u8 { 0 }
    fn write(&mut self, _: u8, _: u8) -> Option<Signal> { None }
    fn wake(&mut self) -> bool { false }
}