1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
pub mod dc_motor; mod large_motor; mod medium_motor; pub mod servo_motor; pub mod tacho_motor; pub use self::dc_motor::DcMotor; pub use self::servo_motor::ServoMotor; pub use self::tacho_motor::TachoMotor; pub use self::large_motor::LargeMotor; pub use self::medium_motor::MediumMotor; use crate::{Device, Port}; pub trait Motor: Device {} pub enum MotorPort { OutA, OutB, OutC, OutD, } impl Port for MotorPort { fn address(&self) -> String { match self { MotorPort::OutA => "outA".to_owned(), MotorPort::OutB => "outB".to_owned(), MotorPort::OutC => "outC".to_owned(), MotorPort::OutD => "outD".to_owned(), } } }