public void Rs(object sender, SignalEventArgs e) { rs = e.Signal; }
public void EnableOutput(object sender, SignalEventArgs e) { var wasEnabled = outputEnabled; outputEnabled = e.Signal; if (!wasEnabled && outputEnabled) { th = new Thread(() => { ulong start; while (outputEnabled) { if (enableHigh) { Runner.AddTask((w) => { Output(this, new ByteEventArgs { Value = highValue }); }); } start = RaspExtern.Timers.bcm2835_st_read(); RaspExtern.Timers.bcm2835_st_delay(start, HalfCycleLength); if (!outputEnabled) { return; } if (enableLow) { Runner.AddTask((w) => { Output(this, new ByteEventArgs { Value = lowValue }); }); } start = RaspExtern.Timers.bcm2835_st_read(); RaspExtern.Timers.bcm2835_st_delay(start, HalfCycleLength); if (!repeat) { return; } } }); th.Start(); } else { if (th != null) { th.Abort(); } } }
public void EnableOutput(object sender, SignalEventArgs e) { var wasEnabled = outputEnabled; outputEnabled = e.Signal; if (!wasEnabled && outputEnabled) { th = new Thread(() => { ulong start; while (outputEnabled) { if (enableHigh) { Runner.AddTask((w) => { if (processBuffer) { buffer.Load(highValue, offset, highValue.Length); } if (Output != null) { Output(this.Output, new BufferEventArgs { Buffer = buffer, Offset = offset, Length = highValue.Length }); } }); } start = RaspExtern.Timers.bcm2835_st_read(); RaspExtern.Timers.bcm2835_st_delay(start, HalfCycleLength); if (!outputEnabled) { return; } if (enableLow) { Runner.AddTask((w) => { if (processBuffer) { buffer.Load(lowValue, offset, lowValue.Length); } if (Output != null) { Output(this.Output, new BufferEventArgs { Buffer = buffer, Offset = offset, Length = highValue.Length }); } }); } start = RaspExtern.Timers.bcm2835_st_read(); RaspExtern.Timers.bcm2835_st_delay(start, HalfCycleLength); if (!repeat) { return; } } }); th.Start(); } else { if (th != null) { th.Abort(); } } }
public void Input7(object sender, SignalEventArgs e) { Input(e.Signal, 8); }