/// <summary> /// Default ctor /// </summary> public LocoIOConfig() { var pins = new PinConfig[16]; for (int i = 0; i < 16; i++) { pins[i] = new PinConfig(i + 1); } sv0 = new SVConfig(0); sv1 = new SVConfig(1); sv2 = new SVConfig(2); this.pins = new PinConfigList(pins); connectors = new ConnectorConfig[2]; connectors[0] = new ConnectorConfig(pins.Take(8).ToArray()); connectors[1] = new ConnectorConfig(pins.Skip(8).ToArray()); }
/// <summary> /// Use this mode to create a configuration using the /// given addresses for the given connector. /// </summary> public ConnectorConfig CreateConfig(Connector connector, AddressList addresses, int subMode) { var pinConfigs = new PinConfig[PinCount]; var pinOffset = GetPinOffset(subMode); for (int i = 0; i < PinCount; i++) { var pin = i + 1 + pinOffset; if (connector == Connector.Second) { pin += 8; } pinConfigs[i] = new PinConfig(pin); } var result = new ConnectorConfig(pinConfigs); Configure(result, addresses, subMode); return(result); }
/// <summary> /// Use this mode to configure the given target. /// </summary> protected abstract void Configure(ConnectorConfig target, AddressList addresses, int subMode);