Example #1
0
        /// <summary>Constructor</summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public Distance_US3(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported(new char[] { 'X', 'Y' }, this);

            Echo = GTI.DigitalInputFactory.Create(socket, Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            Trigger = GTI.DigitalOutputFactory.Create(socket, Socket.Pin.Four, false, this);
        }
Example #2
0
        // Note: A constructor summary is auto-generated by the doc builder.
        /// <summary></summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public Thermocouple(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported(new char[] { 'X', 'Y' }, this);

            _miso = GTI.DigitalInputFactory.Create(socket, Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.PullUp, this);
            _clk  = GTI.DigitalOutputFactory.Create(socket, Socket.Pin.Four, false, this);
            _cs   = GTI.DigitalOutputFactory.Create(socket, Socket.Pin.Five, true, this);
        }
Example #3
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public DistanceUS3(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported(new char[] { 'X', 'Y' }, this);

            this.echo    = GTI.DigitalInputFactory.Create(socket, Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            this.trigger = GTI.DigitalOutputFactory.Create(socket, Socket.Pin.Four, false, this);

            this.AcceptableErrors = 10;
        }
Example #4
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public KeypadKP16(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported('Y', this);

            this.out1 = GT.SocketInterfaces.DigitalOutputFactory.Create(socket, GT.Socket.Pin.Three, true, null);
            this.out2 = GT.SocketInterfaces.DigitalOutputFactory.Create(socket, GT.Socket.Pin.Four, true, null);
            this.in1  = GT.SocketInterfaces.DigitalInputFactory.Create(socket, GT.Socket.Pin.Five, GT.SocketInterfaces.GlitchFilterMode.Off, GT.SocketInterfaces.ResistorMode.PullUp, null);
            this.in2  = GT.SocketInterfaces.DigitalInputFactory.Create(socket, GT.Socket.Pin.Six, GT.SocketInterfaces.GlitchFilterMode.Off, GT.SocketInterfaces.ResistorMode.PullUp, null);
            this.in3  = GT.SocketInterfaces.DigitalInputFactory.Create(socket, GT.Socket.Pin.Seven, GT.SocketInterfaces.GlitchFilterMode.Off, GT.SocketInterfaces.ResistorMode.PullUp, null);
            this.in4  = GT.SocketInterfaces.DigitalInputFactory.Create(socket, GT.Socket.Pin.Eight, GT.SocketInterfaces.GlitchFilterMode.Off, GT.SocketInterfaces.ResistorMode.PullUp, null);
        }
Example #5
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public PulseCount(int socketNumber)
        {
            this.socket = Socket.GetSocket(socketNumber, true, this, null);
            this.socket.EnsureTypeIsSupported('Y', this);

            this.write1 = new byte[1];
            this.write2 = new byte[2];
            this.read5  = new byte[5];

            this.cs     = GTI.DigitalOutputFactory.Create(this.socket, Socket.Pin.Six, true, this);
            this.miso   = GTI.DigitalInputFactory.Create(this.socket, Socket.Pin.Eight, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            this.mosi   = GTI.DigitalOutputFactory.Create(this.socket, Socket.Pin.Seven, false, this);
            this.clock  = GTI.DigitalOutputFactory.Create(this.socket, Socket.Pin.Nine, false, this);
            this.enable = GTI.DigitalOutputFactory.Create(this.socket, Socket.Pin.Five, true, this);

            this.Initialize();
        }
        /// <summary>Constructs a new instance.</summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public StepperL6470(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported('S', this);

            this.spi       = GTI.SpiFactory.Create(socket, new GTI.SpiConfiguration(false, 1000, 1000, true, true, 5000), GTI.SpiSharing.Shared, socket, Socket.Pin.Six, this);
            this.busyPin   = GTI.DigitalInputFactory.Create(socket, Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.PullUp, this);
            this.resetPin  = GTI.DigitalOutputFactory.Create(socket, Socket.Pin.Four, true, this);
            this.stepClock = GTI.DigitalOutputFactory.Create(socket, Socket.Pin.Five, false, this);

            this.send    = new byte[1];
            this.receive = new byte[1];

            this.InitializeChip();

            this.Reset();
        }
        // Note: A constructor summary is auto-generated by the doc builder.
        /// <summary></summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        /// <param name="socketNumberTwo">The second socket that this module is plugged in to.</param>
        public TripWireModule(int socketNumber)
        {
            // This finds the Socket instance from the user-specified socket number.
            // This will generate user-friendly error messages if the socket is invalid.
            // If there is more than one socket on this module, then instead of "null" for the last parameter,
            // put text that identifies the socket to the user (e.g. "S" if there is a socket type S)
            this.socketA = Socket.GetSocket(socketNumber, true, this, null);

            this.socketB = Socket.SocketInterfaces.CreateUnnumberedSocket(socketNumber.ToString() + "-" + " Extender");
            this.socketB.SupportedTypes = this.socketA.SupportedTypes;

            for (int i = 3; i < 10; i++)
                this.socketB.CpuPins[i] = this.socketA.CpuPins[i];

            this.socketB.SerialPortName = this.socketA.SerialPortName;
            this.socketB.SPIModule = this.socketA.SPIModule;
            this.socketB.AnalogOutput5 = this.socketA.AnalogOutput5;
            this.socketB.AnalogInput3 = this.socketA.AnalogInput3;
            this.socketB.AnalogInput4 = this.socketA.AnalogInput4;
            this.socketB.AnalogInput5 = this.socketA.AnalogInput5;
            this.socketB.PWM7 = this.socketA.PWM7;
            this.socketB.PWM8 = this.socketA.PWM8;
            this.socketB.PWM9 = this.socketA.PWM9;
            this.socketB.AnalogInputIndirector = this.socketA.AnalogInputIndirector;
            this.socketB.AnalogOutputIndirector = this.socketA.AnalogOutputIndirector;
            this.socketB.DigitalInputIndirector = this.socketA.DigitalInputIndirector;
            this.socketB.DigitalIOIndirector = this.socketA.DigitalIOIndirector;
            this.socketB.DigitalOutputIndirector = this.socketA.DigitalOutputIndirector;
            this.socketB.I2CBusIndirector = this.socketA.I2CBusIndirector;
            this.socketB.InterruptIndirector = this.socketA.InterruptIndirector;
            this.socketB.PwmOutputIndirector = this.socketA.PwmOutputIndirector;
            this.socketB.SpiIndirector = this.socketA.SpiIndirector;
            this.socketB.SerialIndirector = this.socketA.SerialIndirector;

            TripWire1 = GTI.DigitalInputFactory.Create(socketA, Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            TripWire2 = GTI.DigitalInputFactory.Create(socketA, Socket.Pin.Four, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            TripWire3 = GTI.DigitalInputFactory.Create(socketA, Socket.Pin.Five, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            TripWire4 = GTI.DigitalInputFactory.Create(socketA, Socket.Pin.Six, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            TripWire5 = GTI.DigitalInputFactory.Create(socketA, Socket.Pin.Seven, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            TripWire6 = GTI.DigitalInputFactory.Create(socketA, Socket.Pin.Eight, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            TripWire7 = GTI.DigitalInputFactory.Create(socketA, Socket.Pin.Nine, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
        }