Ejemplo n.º 1
0
        /// <summary>Constructor</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);

            Echo    = new GTI.DigitalInput(socket, Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            Trigger = new GTI.DigitalOutput(socket, Socket.Pin.Four, false, this);
        }
Ejemplo n.º 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 = new GTI.DigitalInput(socket, Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.PullUp, this);
            _clk  = new GTI.DigitalOutput(socket, Socket.Pin.Four, false, this);
            _cs   = new GTI.DigitalOutput(socket, Socket.Pin.Five, true, this);
        }
Ejemplo n.º 3
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 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Three, true, null);
            this.out2 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Four, true, null);
            this.in1  = new GT.Interfaces.DigitalInput(socket, GT.Socket.Pin.Five, GT.Interfaces.GlitchFilterMode.Off, GT.Interfaces.ResistorMode.PullUp, null);
            this.in2  = new GT.Interfaces.DigitalInput(socket, GT.Socket.Pin.Six, GT.Interfaces.GlitchFilterMode.Off, GT.Interfaces.ResistorMode.PullUp, null);
            this.in3  = new GT.Interfaces.DigitalInput(socket, GT.Socket.Pin.Seven, GT.Interfaces.GlitchFilterMode.Off, GT.Interfaces.ResistorMode.PullUp, null);
            this.in4  = new GT.Interfaces.DigitalInput(socket, GT.Socket.Pin.Eight, GT.Interfaces.GlitchFilterMode.Off, GT.Interfaces.ResistorMode.PullUp, null);
        }
Ejemplo n.º 4
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 ButtonExtender(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            buttonArray[0] = new GTI.DigitalInput(socket, Socket.Pin.Three, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, this);
            buttonArray[1] = new GTI.DigitalInput(socket, Socket.Pin.Four, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, this);
            buttonArray[2] = new GTI.DigitalInput(socket, Socket.Pin.Five, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, this);
            buttonArray[3] = new GTI.DigitalInput(socket, Socket.Pin.Six, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, this);
            buttonArray[4] = new GTI.DigitalInput(socket, Socket.Pin.Seven, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, this);
            buttonArray[5] = new GTI.DigitalInput(socket, Socket.Pin.Eight, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, this);
            buttonArray[6] = new GTI.DigitalInput(socket, Socket.Pin.Nine, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, this);

            Timer pollButtonsTimer = new Timer(PollTimerInterval, Timer.BehaviorType.RunContinuously);

            pollButtonsTimer.Tick += PollButtonsTimer_Tick;
            pollButtonsTimer.Start();
        }
Ejemplo n.º 5
0
        /// <summary>Constructs a new PulseCount 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);

#if USE_SOFTWARE_SPI
            this.socket.EnsureTypeIsSupported('Y', this);

            this.CS    = new GTI.DigitalOutput(this.socket, Socket.Pin.Six, true, this);
            this.MISO  = new GTI.DigitalInput(this.socket, Socket.Pin.Eight, GTI.GlitchFilterMode.Off, GTI.ResistorMode.Disabled, this);
            this.MOSI  = new GTI.DigitalOutput(this.socket, Socket.Pin.Seven, false, this);
            this.CLOCK = new GTI.DigitalOutput(this.socket, Socket.Pin.Nine, false, this);
#else
            socket.EnsureTypeIsSupported('S', this);

            this.config = new GTI.SPI.Configuration(false, 0, 0, false, true, 1000);
            this.spi    = new GTI.SPI(socket, this.config, GTI.SPI.Sharing.Shared, socket, GT.Socket.Pin.Six, this);
#endif

            this.Initialize();
        }
Ejemplo n.º 6
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 StepperL6470(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported('S', this);

            // Initialize SPI
            spiConfig = new GTI.SPI.Configuration(false, 1000, 1000, true, true, 5000);
            spi       = new GTI.SPI(socket, spiConfig, GTI.SPI.Sharing.Shared, socket, Socket.Pin.Six, this);

            // Initialize pins
            busyPin   = new GTI.DigitalInput(socket, Socket.Pin.Three, GTI.GlitchFilterMode.Off, GTI.ResistorMode.PullUp, this);
            resetPin  = new GTI.DigitalOutput(socket, Socket.Pin.Four, true, this);
            stepClock = new GTI.DigitalOutput(socket, Socket.Pin.Five, false, this);

            // Initialize chip registers
            InitializeChip();

            Reset();
        }
Ejemplo n.º 7
0
        public Temp7410(int socketNumber, byte address)
        {
            // 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)
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported('I', this);
            Address               = address;
            this.input            = new GTI.InterruptInput(socket, GT.Socket.Pin.Three, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, GTI.InterruptMode.RisingAndFallingEdge, this);
            this.input.Interrupt += new GTI.InterruptInput.InterruptEventHandler(this.overTemperatureInterrupt);
            this.criticalOverTemp = new GTI.DigitalInput(socket, Socket.Pin.Four, GTI.GlitchFilterMode.On, GTI.ResistorMode.Disabled, this);

            Timer pollCrit = new Timer(1000);

            pollCrit.Tick += pollCrit_Tick;
            pollCrit.Start();

            I2CDevice.Configuration i2cConfig = new I2CDevice.Configuration(Address, ClockRateKhz);
            _adt7410 = new I2CDevice(i2cConfig);
            Initialize();
        }