/// <summary> /// /// </summary> /// <param name="options">if <c>null</c> set to default <see cref="BrickOptions"/></param> /// <param name="logger">if <c>null</c> set to default <see cref="NullLogger"/></param> public Brick(BrickOptions options = null, ILogger <Brick> logger = null) : base(ChainLayer.One) { Options = options ?? new BrickOptions(); Logger = logger ?? new NullLogger <Brick>(); Console = new BrickConsole(); Sound = new Sound(); Display = new Display(); Led = new Led(); Battery = new Battery(); Drive = new Drive(); Buttons = new Buttons(); Memory = new Memory(); //Init IO Ports IOPort = new IOPort(); Slave1 = new IOPorts(ChainLayer.Two); Slave2 = new IOPorts(ChainLayer.Three); Slave3 = new IOPorts(ChainLayer.Four); //add ports to internal dictionary IOPort.AddPorts(this); IOPort.AddPorts(Slave1); IOPort.AddPorts(Slave2); IOPort.AddPorts(Slave3); //connect any devices from configuration if available DeviceConfiguration.Connect(IOPort, Options.Devices); }
internal void AddPorts(IOPorts ports) { Ports.Add(ports.InputPort.One.Number, ports.InputPort.One); Ports.Add(ports.InputPort.Two.Number, ports.InputPort.Two); Ports.Add(ports.InputPort.Three.Number, ports.InputPort.Three); Ports.Add(ports.InputPort.Four.Number, ports.InputPort.Four); }
public void AddPorts(IOPorts ports) { Ports.Add(ports.OutputPort.A.Number, ports.OutputPort.A); Ports.Add(ports.OutputPort.B.Number, ports.OutputPort.B); Ports.Add(ports.OutputPort.C.Number, ports.OutputPort.C); Ports.Add(ports.OutputPort.D.Number, ports.OutputPort.D); }
public void AddPorts(IOPorts ports) { Input.AddPorts(ports); Output.AddPorts(ports); }