use crate::adi::AdiPort;
use crate::{
bindings,
controller::{Controller, ControllerId},
smart_port::SmartPort,
};
pub struct Peripherals {
pub master_controller: Controller,
pub partner_controller: Controller,
pub port01: SmartPort,
pub port02: SmartPort,
pub port03: SmartPort,
pub port04: SmartPort,
pub port05: SmartPort,
pub port06: SmartPort,
pub port07: SmartPort,
pub port08: SmartPort,
pub port09: SmartPort,
pub port10: SmartPort,
pub port11: SmartPort,
pub port12: SmartPort,
pub port13: SmartPort,
pub port14: SmartPort,
pub port15: SmartPort,
pub port16: SmartPort,
pub port17: SmartPort,
pub port18: SmartPort,
pub port19: SmartPort,
pub port20: SmartPort,
pub port21: SmartPort,
pub port_a: AdiPort,
pub port_b: AdiPort,
pub port_c: AdiPort,
pub port_d: AdiPort,
pub port_e: AdiPort,
pub port_f: AdiPort,
pub port_g: AdiPort,
pub port_h: AdiPort,
}
impl Peripherals {
pub unsafe fn new() -> Self {
Peripherals {
master_controller: Controller::new(ControllerId::Master),
partner_controller: Controller::new(ControllerId::Partner),
port01: SmartPort::new(1),
port02: SmartPort::new(2),
port03: SmartPort::new(3),
port04: SmartPort::new(4),
port05: SmartPort::new(5),
port06: SmartPort::new(6),
port07: SmartPort::new(7),
port08: SmartPort::new(8),
port09: SmartPort::new(9),
port10: SmartPort::new(10),
port11: SmartPort::new(11),
port12: SmartPort::new(12),
port13: SmartPort::new(13),
port14: SmartPort::new(14),
port15: SmartPort::new(15),
port16: SmartPort::new(16),
port17: SmartPort::new(17),
port18: SmartPort::new(18),
port19: SmartPort::new(19),
port20: SmartPort::new(20),
port21: SmartPort::new(21),
port_a: AdiPort::new(1, bindings::INTERNAL_ADI_PORT as u8),
port_b: AdiPort::new(2, bindings::INTERNAL_ADI_PORT as u8),
port_c: AdiPort::new(3, bindings::INTERNAL_ADI_PORT as u8),
port_d: AdiPort::new(4, bindings::INTERNAL_ADI_PORT as u8),
port_e: AdiPort::new(5, bindings::INTERNAL_ADI_PORT as u8),
port_f: AdiPort::new(6, bindings::INTERNAL_ADI_PORT as u8),
port_g: AdiPort::new(7, bindings::INTERNAL_ADI_PORT as u8),
port_h: AdiPort::new(8, bindings::INTERNAL_ADI_PORT as u8),
}
}
}