/// <summary> /// Raises the <see cref="InputsChanged"/> event. /// </summary> /// <param name="InterruptLatch">Byte mask specifying which pin caused the interrupt.</param> /// <param name="InputPinStates">Byte mask specifying the pin states at interrupt.</param> private void OnInputStatesChanged(byte InterruptLatch, byte InputPinStates) { if (InputsChanged != null) { InputsChangedEventArgs ie = new InputsChangedEventArgs(InterruptLatch, InputPinStates); InputsChanged(this, ie); } }
private void PiFace_InputsChanged(object sender, InputsChangedEventArgs e) { bool state = getState(e.InputPinStates); DateTime now = DateTime.Now; // if state is changed and time since last change is greater than GateDuration // (store and check GateDuration only on change from state false to true, // to prevent from stucking in half a cycle..) if (!this.State && state && now.Subtract(_lastChangeToTrueAt).TotalMilliseconds >= this.GateDuration) { this.State = state; _lastChangeToTrueAt = now; // raise event OnPinGroupChanged(state, (byte)(e.InterruptLatch & this.InputPinMask)); } else if (this.State && !state) { this.State = state; // raise event OnPinGroupChanged(state, (byte)(e.InterruptLatch & this.InputPinMask)); } }
private void _inputManagement_InputsChanged(object sender, InputsChangedEventArgs e) { LiveContext systemContext = VixenSystem.Contexts.GetSystemLiveContext(); systemContext.Execute(e.EffectNodes); }