コード例 #1
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public RadioFM1(int socketNumber)
        {
            this.radioTextWorkerRunning = true;
            this.currentRadioText       = "N/A";
            this.spacingDivisor         = 2;
            this.baseChannel            = 875;
            this.registers = new ushort[16];

            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

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

            this.resetPin = GTI.DigitalOutputFactory.Create(socket, Socket.Pin.Five, false, this);
            this.i2cBus   = new GTI.SoftwareI2CBus(socket, Socket.Pin.Eight, Socket.Pin.Nine, RadioFM1.I2C_ADDRESS, 100, this);
            this.i2cBus.LengthErrorBehavior = GTI.ErrorBehavior.ThrowException;

            this.InitializeDevice();

            this.SetChannelConfiguration(Spacing.USAAustrailia, Band.USAEurope);

            this.Channel = this.MinChannel;
            this.Volume  = RadioFM1.MIN_VOLUME;

            this.radioTextWorkerThread = new Thread(this.RadioTextWorker);
            this.radioTextWorkerThread.Start();
        }
コード例 #2
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public ColorSense(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

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

            this.writeBuffer = new byte[1];
            this.readBuffer  = new byte[2];
            this.led         = GTI.DigitalOutputFactory.Create(socket, Socket.Pin.Three, false, this);
            this.i2c         = new GTI.SoftwareI2CBus(socket, Socket.Pin.Five, Socket.Pin.Four, 0x39, 100, this);
            this.i2c.Write(new byte[] { 0x80, 0x03 });
        }
コード例 #3
0
        /// <summary>Constructs a new instance.</summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public TempHumidSI70(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

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

            this.i2c = new GTI.SoftwareI2CBus(socket, Socket.Pin.Five, Socket.Pin.Four, TempHumidSI70.I2C_ADDRESS, 400, this);

            this.writeBuffer1 = new byte[1] {
                TempHumidSI70.MEASURE_HUMIDITY_HOLD
            };
            this.writeBuffer2 = new byte[1] {
                TempHumidSI70.READ_TEMP_FROM_PREVIOUS
            };
            this.readBuffer1 = new byte[2];
            this.readBuffer2 = new byte[2];
        }
コード例 #4
0
ファイル: VideoOut_43.cs プロジェクト: valoni/NETMF-Gadgeteer
        /// <summary>Constructs a new instance.</summary>
        /// <param name="rSocketNumber">The mainboard socket that has the display's R socket connected to it.</param>
        /// <param name="gSocketNumber">The mainboard socket that has the display's G socket connected to it.</param>
        /// <param name="bSocketNumber">The mainboard socket that has the display's B socket connected to it.</param>
        /// <param name="i2cSocketNumber">The mainboard socket that has the display's I socket connected to it.</param>
        public VideoOut(int rSocketNumber, int gSocketNumber, int bSocketNumber, int i2cSocketNumber)
            : base(WpfMode.PassThrough)
        {
            this.currentHeight = 320;
            this.currentHeight = 240;

            var i2cSocket = Socket.GetSocket(i2cSocketNumber, true, this, null);

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

            this.i2c = new GTI.SoftwareI2CBus(i2cSocket, Socket.Pin.Five, Socket.Pin.Four, 0x76, 100, this);

            var rSocket = Socket.GetSocket(rSocketNumber, true, this, null);
            var gSocket = Socket.GetSocket(gSocketNumber, true, this, null);
            var bSocket = Socket.GetSocket(bSocketNumber, true, this, null);

            rSocket.EnsureTypeIsSupported('R', this);
            gSocket.EnsureTypeIsSupported('G', this);
            bSocket.EnsureTypeIsSupported('B', this);

            rSocket.ReservePin(Socket.Pin.Three, this);
            rSocket.ReservePin(Socket.Pin.Four, this);
            rSocket.ReservePin(Socket.Pin.Five, this);
            rSocket.ReservePin(Socket.Pin.Six, this);
            rSocket.ReservePin(Socket.Pin.Seven, this);
            rSocket.ReservePin(Socket.Pin.Eight, this);
            rSocket.ReservePin(Socket.Pin.Nine, this);

            gSocket.ReservePin(Socket.Pin.Three, this);
            gSocket.ReservePin(Socket.Pin.Four, this);
            gSocket.ReservePin(Socket.Pin.Five, this);
            gSocket.ReservePin(Socket.Pin.Six, this);
            gSocket.ReservePin(Socket.Pin.Seven, this);
            gSocket.ReservePin(Socket.Pin.Eight, this);
            gSocket.ReservePin(Socket.Pin.Nine, this);

            bSocket.ReservePin(Socket.Pin.Three, this);
            bSocket.ReservePin(Socket.Pin.Four, this);
            bSocket.ReservePin(Socket.Pin.Five, this);
            bSocket.ReservePin(Socket.Pin.Six, this);
            bSocket.ReservePin(Socket.Pin.Seven, this);
            bSocket.ReservePin(Socket.Pin.Eight, this);
            bSocket.ReservePin(Socket.Pin.Nine, this);
        }