Exemplo n.º 1
0
 public Blur()
 {
     _input  = new InputPin("Input", PinMediaType.Image);
     _output = new OutputPin("Output", PinMediaType.Image);
     AddPin(_input);
     AddPin(_output);
 }
        public IEnumerator Test(IOutputPin output1, IOutputPin output2)
        {
            Debug.Log("Output");
            output1.setState(PinState.High);
            output2.setState(PinState.High);

            yield return(new WaitForSeconds(0.1f));
        }
Exemplo n.º 3
0
        public Resize()
        {
            _sizeProperty = new PointProperty("New size", FilterPropertyType.Size)
            {
                Value = new Size(400, 300)
            };;
            AddProperty(_sizeProperty);

            _input = new InputPin("Input", PinMediaType.Image);
            AddPin(_input);
            _output = new OutputPin("Output", PinMediaType.Image);
            AddPin(_output);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Hd44780LcdConnection"/> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="registerSelectPin">The register select pin.</param>
        /// <param name="clockPin">The clock pin.</param>
        /// <param name="dataPins">The data pins.</param>
        public Hd44780LcdConnection(Hd44780LcdConnectionSettings settings, IOutputPin registerSelectPin, IOutputPin clockPin, IEnumerable<IOutputPin> dataPins)
        {
            settings = settings ?? new Hd44780LcdConnectionSettings();

            this.registerSelectPin = registerSelectPin;
            this.clockPin = clockPin;
            this.dataPins = dataPins.ToArray();

            if (this.dataPins.Length != 4 && this.dataPins.Length != 8)
                throw new ArgumentOutOfRangeException("dataPins", this.dataPins.Length, "There must be either 4 or 8 data pins");

            width = settings.ScreenWidth;
            height = settings.ScreenHeight;
            if (height < 1 || height > 2)
                throw new ArgumentOutOfRangeException("ScreenHeight", height, "Screen must have either 1 or 2 rows");
            if (width * height > 80)
                throw new ArgumentException("At most 80 characters are allowed");

            if (settings.PatternWidth != 5)
                throw new ArgumentOutOfRangeException("PatternWidth", settings.PatternWidth, "Pattern must be 5 pixels width");
            if (settings.PatternHeight != 8 && settings.PatternHeight != 10)
                throw new ArgumentOutOfRangeException("PatternHeight", settings.PatternWidth, "Pattern must be either 7 or 10 pixels height");
            if (settings.PatternHeight == 10 && height == 2)
                throw new ArgumentException("10 pixels height pattern cannot be used with 2 rows");

            functions = (settings.PatternHeight == 8 ? Functions.Matrix5x8 : Functions.Matrix5x10)
                | (height == 1 ? Functions.OneLine : Functions.TwoLines)
                | (this.dataPins.Length == 4 ? Functions.Data4bits : Functions.Data8bits);

            entryModeFlags = /*settings.RightToLeft
                ? EntryModeFlags.EntryRight | EntryModeFlags.EntryShiftDecrement
                :*/ EntryModeFlags.EntryLeft | EntryModeFlags.EntryShiftDecrement;

            encoding = settings.Encoding;

            registerSelectPin.Write(false);
            clockPin.Write(false);
            foreach (var dataPin in this.dataPins)
                dataPin.Write(false);

            WriteByte(0x33, false); // Initialize
            WriteByte(0x32, false);

            WriteCommand(Command.SetFunctions, (int) functions);
            WriteCommand(Command.SetDisplayFlags, (int) displayFlags);
            WriteCommand(Command.SetEntryModeFlags, (int) entryModeFlags);

            Clear();
        }
Exemplo n.º 5
0
        private void _DragDrop(object sender, DragEventArgs e)
        {
            if (_potentialNeededPort != null)
            {
                IOutputPin pin = e
                                 .Data
                                 .GetFormats()
                                 .Select(format => e.Data.GetData(format))
                                 .OfType <IOutputPin>()
                                 .FirstOrDefault();

                if (pin != null && !_potentialNeededPort.IsConnected)
                {
                    pin.Connect(_potentialNeededPort);
                }
            }

            srcPoint  = null;
            destPoint = null;
            e.Effect  = DragDropEffects.None;
            Invalidate();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Hd44780LcdConnection"/> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="registerSelectPin">The register select pin.</param>
        /// <param name="clockPin">The clock pin.</param>
        /// <param name="dataPins">The data pins.</param>
        public Hd44780LcdConnection(Hd44780LcdConnectionSettings settings, IOutputPin registerSelectPin, IOutputPin clockPin, IEnumerable <IOutputPin> dataPins)
        {
            settings = settings ?? new Hd44780LcdConnectionSettings();

            this.registerSelectPin = registerSelectPin;
            this.clockPin          = clockPin;
            this.dataPins          = dataPins.ToArray();

            if (this.dataPins.Length != 4 && this.dataPins.Length != 8)
            {
                throw new ArgumentOutOfRangeException("dataPins", this.dataPins.Length, "There must be either 4 or 8 data pins");
            }

            width  = settings.ScreenWidth;
            height = settings.ScreenHeight;
            if (height < 1 || height > 2)
            {
                throw new ArgumentOutOfRangeException("ScreenHeight", height, "Screen must have either 1 or 2 rows");
            }
            if (width * height > 80)
            {
                throw new ArgumentException("At most 80 characters are allowed");
            }

            if (settings.PatternWidth != 5)
            {
                throw new ArgumentOutOfRangeException("PatternWidth", settings.PatternWidth, "Pattern must be 5 pixels width");
            }
            if (settings.PatternHeight != 8 && settings.PatternHeight != 10)
            {
                throw new ArgumentOutOfRangeException("PatternHeight", settings.PatternWidth, "Pattern must be either 7 or 10 pixels height");
            }
            if (settings.PatternHeight == 10 && height == 2)
            {
                throw new ArgumentException("10 pixels height pattern cannot be used with 2 rows");
            }

            functions = (settings.PatternHeight == 8 ? Functions.Matrix5x8 : Functions.Matrix5x10)
                        | (height == 1 ? Functions.OneLine : Functions.TwoLines)
                        | (this.dataPins.Length == 4 ? Functions.Data4bits : Functions.Data8bits);

            entryModeFlags = /*settings.RightToLeft
                              * ? EntryModeFlags.EntryRight | EntryModeFlags.EntryShiftDecrement
                              * :*/EntryModeFlags.EntryLeft | EntryModeFlags.EntryShiftDecrement;

            encoding = settings.Encoding;

            registerSelectPin.Write(false);
            clockPin.Write(false);
            foreach (var dataPin in this.dataPins)
            {
                dataPin.Write(false);
            }

            WriteByte(0x33, false); // Initialize
            WriteByte(0x32, false);

            WriteCommand(Command.SetFunctions, (int)functions);
            WriteCommand(Command.SetDisplayFlags, (int)displayFlags);
            WriteCommand(Command.SetEntryModeFlags, (int)entryModeFlags);

            Clear();
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hd44780LcdConnection"/> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="registerSelectPin">The register select pin.</param>
 /// <param name="clockPin">The clock pin.</param>
 /// <param name="dataPins">The data pins.</param>
 public Hd44780LcdConnection(Hd44780LcdConnectionSettings settings, IOutputPin registerSelectPin, IOutputPin clockPin, params IOutputPin[] dataPins) : this(settings, registerSelectPin, clockPin, (IEnumerable <IOutputPin>)dataPins)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hd44780LcdConnection"/> class.
 /// </summary>
 /// <param name="registerSelectPin">The register select pin.</param>
 /// <param name="clockPin">The clock pin.</param>
 /// <param name="dataPins">The data pins.</param>
 public Hd44780LcdConnection(IOutputPin registerSelectPin, IOutputPin clockPin, IEnumerable <IOutputPin> dataPins) : this(null, registerSelectPin, clockPin, dataPins)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Hd44780LcdConnection"/> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="registerSelectPin">The register select pin.</param>
 /// <param name="clockPin">The clock pin.</param>
 /// <param name="dataPins">The data pins.</param>
 public Hd44780LcdConnection(Hd44780LcdConnectionSettings settings, IOutputPin registerSelectPin, IOutputPin clockPin, params IOutputPin[] dataPins)
     : this(settings, registerSelectPin, clockPin, (IEnumerable<IOutputPin>)dataPins)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Hd44780LcdConnection"/> class.
 /// </summary>
 /// <param name="registerSelectPin">The register select pin.</param>
 /// <param name="clockPin">The clock pin.</param>
 /// <param name="dataPins">The data pins.</param>
 public Hd44780LcdConnection(IOutputPin registerSelectPin, IOutputPin clockPin, IEnumerable<IOutputPin> dataPins)
     : this(null, registerSelectPin, clockPin, dataPins)
 {
 }