protected virtual void OnOptocouplerInputChange(OctocouplerInputEventArgs e) { OptocouplerInputEventHandler handler = OptocouplerInputChanged; if (handler != null) { handler(this, e); } }
/// <summary> /// Will be fired when optocoupler input 4 state is changed. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void Optocoupler4_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args) { if (args.Edge == GpioPinEdge.RisingEdge) { OctocouplerInputEventArgs ea = new OctocouplerInputEventArgs(4, false); OnOptocouplerInputChange(ea); } else if (args.Edge == GpioPinEdge.FallingEdge) { OctocouplerInputEventArgs ea = new OctocouplerInputEventArgs(4, true); OnOptocouplerInputChange(ea); } }