예제 #1
0
            public DigitalInput(byte pin, GTI.GlitchFilterMode glitchFilter, GTI.ResistorMode resistorMode, IO60P16 io60)
            {
                this.io60 = io60;
                this.pin  = pin;

                this.io60.SetIOMode(this.pin, IO60P16.IOState.Input, resistorMode);
            }
예제 #2
0
 public DigitalIOImplementation(byte pin, bool initialState, GTI.GlitchFilterMode glitchFilter, GTI.ResistorMode resistorMode, IO60P16 io60)
 {
     this.io60         = io60;
     this.pin          = pin;
     this.resistorMode = resistorMode;
     this.Mode         = GTI.IOMode.Input;
     this.io60.WriteDigital(this.pin, initialState);
 }
예제 #3
0
            public InterruptInput(byte pin, GTI.GlitchFilterMode glitchFilter, GTI.ResistorMode resistorMode, GTI.InterruptMode interruptMode, IO60P16 io60)
            {
                this.io60 = io60;
                this.pin  = pin;

                this.io60.SetIOMode(this.pin, IO60P16.IOState.InputInterrupt, resistorMode);
                this.io60.RegisterInterruptHandler(this.pin, interruptMode, this.RaiseInterrupt);
            }
예제 #4
0
            public void SetIOMode(byte pin, IOState state, GTI.ResistorMode resistorMode)
            {
                switch (resistorMode)
                {
                case GTI.ResistorMode.Disabled: this.SetIOMode(pin, state, ResistorMode.Floating); break;

                case GTI.ResistorMode.PullDown: this.SetIOMode(pin, state, ResistorMode.PullDown); break;

                case GTI.ResistorMode.PullUp: this.SetIOMode(pin, state, ResistorMode.PullUp); break;
                }
            }
예제 #5
0
        private void SetIOMode(byte pin, IOState state, GTI.ResistorMode resistorMode)
        {
            switch (resistorMode)
            {
            case GTI.ResistorMode.Disabled: this.SetIOMode(pin, state, ResistorMode.HighImpedence); break;

            case GTI.ResistorMode.PullDown: this.SetIOMode(pin, state, ResistorMode.ResistivePullDown); break;

            case GTI.ResistorMode.PullUp: this.SetIOMode(pin, state, ResistorMode.ResistivePullUp); break;
            }
        }
예제 #6
0
		/// <summary>Creates an interrupt input on the given pin.</summary>
		/// <param name="pin">The pin to create the interface on.</param>
		/// <param name="glitchFilterMode">The glitch filter mode for the interface.</param>
		/// <param name="resistorMode">The resistor mode for the interface.</param>
		/// <param name="interruptMode">The interrupt mode for the interface.</param>
		/// <returns>The new interface.</returns>
		public GTI.InterruptInput CreateInterruptInput(Socket.Pin pin, GTI.GlitchFilterMode glitchFilterMode, GTI.ResistorMode resistorMode, GTI.InterruptMode interruptMode) {
			return GTI.InterruptInputFactory.Create(this.socket, pin, glitchFilterMode, resistorMode, interruptMode, this);
		}
예제 #7
0
		/// <summary>Creates a digital input/output on the given pin.</summary>
		/// <param name="pin">The pin to create the interface on.</param>
		/// <param name="initialState">The initial state for the interface.</param>
		/// <param name="glitchFilterMode">The glitch filter mode for the interface.</param>
		/// <param name="resistorMode">The resistor mode for the interface.</param>
		/// <returns>The new interface.</returns>
		public GTI.DigitalIO CreateDigitalIO(Socket.Pin pin, bool initialState, GTI.GlitchFilterMode glitchFilterMode, GTI.ResistorMode resistorMode) {
			return GTI.DigitalIOFactory.Create(this.socket, pin, initialState, glitchFilterMode, resistorMode, this);
		}
예제 #8
0
		/// <summary>Creates a digital input on the given pin.</summary>
		/// <param name="pin">The pin to create the interface on.</param>
		/// <param name="glitchFilterMode">The glitch filter mode for the interface.</param>
		/// <param name="resistorMode">The resistor mode for the interface.</param>
		/// <returns>The new interface.</returns>
		public GTI.DigitalInput CreateDigitalInput(Socket.Pin pin, GTI.GlitchFilterMode glitchFilterMode, GTI.ResistorMode resistorMode) {
			return GTI.DigitalInputFactory.Create(this.socket, pin, glitchFilterMode, resistorMode, this);
		}
예제 #9
0
 /// <summary>Creates an interrrupt input on the input port on the module.</summary>
 /// <param name="glitchFilterMode">The glitch filter mode for the input.</param>
 /// <param name="resistorMode">The resistor mode for the input.</param>
 /// <param name="interruptMode">The interrupt mode for the input.</param>
 /// <returns>The new input.</returns>
 public GTI.InterruptInput CreateInterruptInput(GTI.GlitchFilterMode glitchFilterMode, GTI.ResistorMode resistorMode, GTI.InterruptMode interruptMode)
 {
     return(GTI.InterruptInputFactory.Create(this.socket, Socket.Pin.Three, glitchFilterMode, resistorMode, interruptMode, this));
 }
예제 #10
0
        /// <summary>Creates an interrupt input on the given pin.</summary>
        /// <param name="port">The port to create the interface on.</param>
        /// <param name="pin">The pin to create the interface on.</param>
        /// <param name="glitchFilterMode">The glitch filter mode for the interface.</param>
        /// <param name="resistorMode">The resistor mode for the interface.</param>
        /// <param name="interruptMode">The interrupt mode for the interface.</param>
        /// <returns>The new interface.</returns>
        public GTI.InterruptInput CreateInterruptInput(int port, int pin, GTI.GlitchFilterMode glitchFilterMode, GTI.ResistorMode resistorMode, GTI.InterruptMode interruptMode)
        {
            if (port < 0 || port > 7)
            {
                throw new ArgumentOutOfRangeException("port", "port must be between 0 and 7.");
            }
            if (pin < 0 || pin > 7)
            {
                throw new ArgumentOutOfRangeException("pin", "pin must be between 0 and 7.");
            }

            return(new InterruptInput((byte)((port << 4) | pin), glitchFilterMode, resistorMode, interruptMode, this));
        }
예제 #11
0
        /// <summary>Creates a digital input/output on the given pin.</summary>
        /// <param name="port">The port to create the interface on.</param>
        /// <param name="pin">The pin to create the interface on.</param>
        /// <param name="initialState">The initial state for the interface.</param>
        /// <param name="glitchFilterMode">The glitch filter mode for the interface.</param>
        /// <param name="resistorMode">The resistor mode for the interface.</param>
        /// <returns>The new interface.</returns>
        public GTI.DigitalIO CreateDigitalIO(int port, int pin, bool initialState, GTI.GlitchFilterMode glitchFilterMode, GTI.ResistorMode resistorMode)
        {
            if (port < 0 || port > 7)
            {
                throw new ArgumentOutOfRangeException("port", "port must be between 0 and 7.");
            }
            if (pin < 0 || pin > 7)
            {
                throw new ArgumentOutOfRangeException("pin", "pin must be between 0 and 7.");
            }

            return(new DigitalIO((byte)((port << 4) | pin), initialState, glitchFilterMode, resistorMode, this));
        }