1use crate::bindings;
2
3use super::AdiPort;
4
5pub struct AdiExpander {
7 pub port_a: AdiPort,
9 pub port_b: AdiPort,
11 pub port_c: AdiPort,
13 pub port_d: AdiPort,
15 pub port_e: AdiPort,
17 pub port_f: AdiPort,
19 pub port_g: AdiPort,
21 pub port_h: AdiPort,
23}
24
25impl AdiExpander {
26 pub unsafe fn new(smart_port: u8) -> Self {
34 assert!(
35 (1..22).contains(&smart_port) || smart_port == bindings::INTERNAL_ADI_PORT as u8,
36 "Cannot construct an ADI port with ADI extender on smart port {}",
37 smart_port
38 );
39 Self {
40 port_a: AdiPort::new(1, smart_port),
41 port_b: AdiPort::new(2, smart_port),
42 port_c: AdiPort::new(3, smart_port),
43 port_d: AdiPort::new(4, smart_port),
44 port_e: AdiPort::new(5, smart_port),
45 port_f: AdiPort::new(6, smart_port),
46 port_g: AdiPort::new(7, smart_port),
47 port_h: AdiPort::new(8, smart_port),
48 }
49 }
50}