public void switch_update_rule(ushort number, EventType event_type, SwitchRule rule, DriverState[] linked_drivers, bool drive_outputs_now) { int numDrivers = 0; if (linked_drivers != null) { numDrivers = linked_drivers.Length; } bool use_column_8 = g_machineType == MachineType.WPC; if (firstTime) { firstTime = false; SwitchConfig switchConfig = new SwitchConfig(); switchConfig.Clear = false; switchConfig.UseColumn8 = use_column_8; switchConfig.UseColumn9 = false; // No WPC machines actually use this switchConfig.HostEventsEnable = true; switchConfig.DirectMatrixScanLoopTime = 2; // Milliseconds switchConfig.PulsesBeforeCheckingRX = 10; switchConfig.InactivePulsesAfterBurst = 12; switchConfig.PulsesPerBurst = 6; switchConfig.PulseHalfPeriodTime = 13; // Milliseconds lock (procSyncObject) { PinProc.PRSwitchUpdateConfig(ProcHandle, ref switchConfig); } } Result r; lock (procSyncObject) { r = PinProc.PRSwitchUpdateRule(ProcHandle, (byte)number, event_type, ref rule, linked_drivers, numDrivers, drive_outputs_now); } if (r == Result.Success) { // Possibly we should flush the write data here } else { Logger.Log(String.Format("SwitchUpdateRule FAILED for #{0} event_type={1} numDrivers={2} drive_outputs_now={3}", number, event_type.ToString(), numDrivers, drive_outputs_now)); } }
public void switch_update_rule(ushort number, EventType event_type, SwitchRule rule, DriverState[] linked_drivers, bool drive_outputs_now) { int rule_index = ((int)event_type * 256) + number; List <IDriver> d = new List <IDriver>(); if (linked_drivers != null) { foreach (DriverState s in linked_drivers) { d.Add(drivers[s.DriverNum]); } } if (rule_index >= switch_rules.Length) { return; } this.switch_rules[rule_index] = new FakeSwitchRule() { Drivers = d, NotifyHost = rule.NotifyHost }; }
public static extern Result PRSwitchUpdateRule(IntPtr handle, byte switchNum, EventType eventType, ref SwitchRule rule, DriverState[] linkedDrivers, int numDrivers, bool drive_outputs_now);