示例#1
0
 public void Rs(object sender, SignalEventArgs e)
 {
     rs = e.Signal;
 }
示例#2
0
        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();
                }
            }
        }
示例#3
0
        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();
                }
            }
        }
示例#4
0
 public void Input7(object sender, SignalEventArgs e)
 {
     Input(e.Signal, 8);
 }