當前位置: 首頁>>代碼示例>>C#>>正文


C# Hardware.Cpu類代碼示例

本文整理匯總了C#中Microsoft.SPOT.Hardware.Cpu的典型用法代碼示例。如果您正苦於以下問題:C# Cpu類的具體用法?C# Cpu怎麽用?C# Cpu使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Cpu類屬於Microsoft.SPOT.Hardware命名空間,在下文中一共展示了Cpu類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LEDStrip

 public LEDStrip(Cpu.Pin clockPin, Cpu.Pin dataPin)
 {
     NumOfLEDs = 32;
     _clock = new OutputPort(clockPin, false);
     _data = new OutputPort(dataPin, false);
     post_frame();
 }
開發者ID:AndyCross,項目名稱:netmfazurequeue,代碼行數:7,代碼來源:LEDStrip.cs

示例2: ShiftRegister74HC595

        private OutputPort stcpPort; // Storage Register Clock pin

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ds">Pin Serial Data</param>
        /// <param name="shcp">Pin Shift Register Clock</param>
        /// <param name="stcp">Pin Storage Register Clock</param>
        /// <param name="mr">Pin Master Reset</param>
        /// <param name="oe">Pin Output Enable</param>
        /// <param name="bitOrder">Bit order during transferring</param>
        public ShiftRegister74HC595(Cpu.Pin ds, Cpu.Pin shcp, Cpu.Pin stcp, Cpu.Pin mr, Cpu.Pin oe, BitOrder bitOrder)
        {
            // Serial Data (DS) pin is necessary
            if (ds == Cpu.Pin.GPIO_NONE)
                throw new ArgumentException("Serial Data (DS) pin is necessary");
            this.dsPort = new OutputPort(ds, false);

            // Shift Register Clock (SHCP) pin is necessary
            if (shcp == Cpu.Pin.GPIO_NONE)
                throw new ArgumentException("Shift Register Clock (SHCP) pin is necessary");
            this.shcpPort = new OutputPort(shcp, false);

            // you can save 1 pin connecting STCP and SHCP together
            if (stcp != Cpu.Pin.GPIO_NONE)
                this.stcpPort = new OutputPort(stcp, false);

            // you can save 1 pin connecting MR pin to Vcc (no reset)
            if (mr != Cpu.Pin.GPIO_NONE)
                this.mrPort = new OutputPort(mr, true);

            // you can save 1 pin connecting OE pin to GND (shift register output pins are always enabled)
            if (oe != Cpu.Pin.GPIO_NONE)
                this.oePort = new OutputPort(oe, false);

            this.bitOrder = bitOrder;
        }
開發者ID:ppatierno,項目名稱:uplibrary,代碼行數:41,代碼來源:ShiftRegister74HC595.cs

示例3: RelayPort

 public RelayPort(Cpu.Pin pin, bool initialState, int timeout)
     : base(pin, initialState)
 {
     currentstate = initialState;
     relayThread = new Thread(new ThreadStart(RelayLoop));
     relayThread.Start();
 }
開發者ID:mbaldini,項目名稱:NovaOS,代碼行數:7,代碼來源:RelayPort.cs

示例4: LEDRGB

 /// <summary>
 /// LEDRGB Constructor.
 /// </summary>
 /// <param name="r">Red LED PWM channel</param>
 /// <param name="g">Green LED PWM channel</param>
 /// <param name="b">Blkue LED PWM channel</param>
 public LEDRGB(Cpu.PWMChannel r, Cpu.PWMChannel g, Cpu.PWMChannel b)
 {
     red = new PWM(r, 255, 0, PWM.ScaleFactor.Microseconds, false);
     green = new PWM(g, 255, 0, PWM.ScaleFactor.Microseconds, false);
     blue = new PWM(b, 255, 0, PWM.ScaleFactor.Microseconds, false);
     color = new RGBColor(0, 0, 0);
 }
開發者ID:ltj,項目名稱:ixdlib,代碼行數:13,代碼來源:LEDRGB.cs

示例5: OLED_sh1106

 public OLED_sh1106(Cpu.Pin csPin, OutputPort dcPin, OutputPort rsPin)
 {
     displayStr = "";
     spiDevice = new SPI(new SPI.Configuration(csPin, false, 0, 0, false, true, 10000, SPI.SPI_module.SPI1));
     dataCommandPin = dcPin;
     resetOutputPort = rsPin;
 }
開發者ID:wjmwjm119,項目名稱:NetduinoOLED,代碼行數:7,代碼來源:OLED_sh1106.cs

示例6: GetSerialPins

 public override void GetSerialPins(string comPort, out Cpu.Pin rxPin, out Cpu.Pin txPin, out Cpu.Pin ctsPin, out Cpu.Pin rtsPin)
 {
     switch (comPort)
     {
         case "COM1":
             rxPin = Pins.P6_5;
             txPin = Pins.P6_4;
             ctsPin = Pins.GPIO_NONE;
             rtsPin = Pins.GPIO_NONE;
             break;
         case "COM2":
             rxPin = Pins.P1_14;
             txPin = Pins.P5_6;
             ctsPin = Pins.P5_4;
             rtsPin = Pins.P4_2;
             break;
         case "COM3":
             rxPin = Pins.P2_11;
             txPin = Pins.P2_10;
             ctsPin = Pins.GPIO_NONE;
             rtsPin = Pins.GPIO_NONE;
             break;
         default:
             throw new NotSupportedException();
     }
 }
開發者ID:porchaya,項目名稱:netmf-lpc43xx,代碼行數:26,代碼來源:HardwareProvider.cs

示例7: MidiDriver

        public MidiDriver(Cpu.Pin resetPin, string serialPortName = Serial.COM2)
        {
            _resetPinPort = new OutputPort(resetPin, false);

            _serialPort = new SerialPort(serialPortName, 31250, Parity.None, 8, StopBits.One);
            _serialPort.Open();
        }
開發者ID:cjdaly,項目名稱:napkin,代碼行數:7,代碼來源:MidiDriver.cs

示例8: Start

 public static TempSensor Start(Cpu.Pin pin, int sampleInterval = 1000, TempSensorMode mode = TempSensorMode.Celcius)
 {
     TempSensor sensor = new TempSensor(pin, sampleInterval, mode);
     sensor._thread = new Thread(sensor.Run);
     sensor._thread.Start();
     return sensor;
 }
開發者ID:adamgilmore,項目名稱:Bewarro,代碼行數:7,代碼來源:TempSensor.cs

示例9: ShiftRegisterWriter

 //private OutputPort _commitPin;
 public ShiftRegisterWriter(Cpu.Pin clock, Cpu.Pin reset, Cpu.Pin data, Cpu.Pin commit)
 {
     _clockPin = new OutputPort(clock, false);
     _dataPin = new OutputPort(data, false);
     _resetPin = new OutputPort(reset, false);
     _commitPin = new OutputPort(commit, false);
 }
開發者ID:John-Leitch,項目名稱:fpga-md5-cracker,代碼行數:8,代碼來源:ShiftRegisterWriter.cs

示例10: RGBLed

 /// <summary>
 /// Common RGB-led
 /// </summary>
 /// <param name="RedPin">The PWM-pin connected to Red</param>
 /// <param name="GreenPin">The PWM-pin connected to Green</param>
 /// <param name="BluePin">The PWM-pin connected to Blue</param>
 /// <param name="CommonAnode">Specifies if the led is common anode</param>
 public RGBLed(Cpu.Pin RedPin, Cpu.Pin GreenPin, Cpu.Pin BluePin, bool CommonAnode = true)
 {
     this._Red = new PWM(RedPin);
     this._Green = new PWM(GreenPin);
     this._Blue = new PWM(BluePin);
     this._CommonAnode = CommonAnode;
 }
開發者ID:masterhou,項目名稱:webgl2012,代碼行數:14,代碼來源:RGBLed.cs

示例11: PanTilter

 public PanTilter(Cpu.Pin panPin, int panMin, int panMax, Cpu.Pin tiltPin, int tiltMin, int tiltMax)
 {
     this.tilter = new PWM(tiltPin);
     this.tiltMin = tiltMin;
     this.tiltMax = tiltMax;
     this.tilter.SetDutyCycle(0);
 }
開發者ID:thisismyrobot,項目名稱:hug,代碼行數:7,代碼來源:PanTilter.cs

示例12: ContactSensor

        public ContactSensor(Cpu.Pin sensorPin)
        {
            this.sensorPin = sensorPin;

            sensorPort = new InterruptPort(sensorPin, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLevelLow);
            sensorPort.OnInterrupt += new NativeEventHandler(OnInterrupt);
        }
開發者ID:gflerm,項目名稱:NetCNC,代碼行數:7,代碼來源:ContactSensor.cs

示例13: Stepper

        public Stepper(Cpu.Pin pinCoil1A, Cpu.Pin pinCoil1B, Cpu.Pin pinCoil2A, Cpu.Pin pinCoil2B, uint stepsPerRevolution, string name)
            : base(name, "stepper")
        {
            // remember the steps per revolution
            this.StepsPerRevolution = stepsPerRevolution;

            // reset the step-counter
            this.currentStep = 0;

            // determine correct pins for the coils; turn off all motor pins
            this.portCoil1A = new OutputPort(pinCoil1A, false);

            Util.Delay(500);
            this.portCoil1B = new OutputPort(pinCoil1B, false);

            Util.Delay(500);
            this.portCoil2A = new OutputPort(pinCoil2A, false);

            Util.Delay(500);

            this.portCoil2B = new OutputPort(pinCoil2B, false);

            // set the maximum speed
            SetSpeed(120);
        }
開發者ID:StephanieMak,項目名稱:IoT-Maker-Den-NETMF,代碼行數:25,代碼來源:Stepper.cs

示例14: Connect

 public void Connect(Cpu.Pin pinTrig, Cpu.Pin pinEcho)
 {
     _portOut = new OutputPort(pinTrig, false);
     _interIn = new InterruptPort(pinEcho, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeLow);
     _interIn.OnInterrupt += new NativeEventHandler(interIn_OnInterrupt);
     Reset();
 }
開發者ID:WesDaniels,項目名稱:ColdBeer,代碼行數:7,代碼來源:Ping.cs

示例15: Piezo

 /// <summary>
 /// Piezo speaker driver and notes and playback manager
 /// </summary>
 /// <param name="pin">From the SecretLabs.NETMF.Hardware.NetduinoPlus.PWMChannels namespace</param>
 /// <param name="name">Unique identifying name for command and control</param>
 public Piezo(Cpu.PWMChannel pin, string name)
     : base(name, "piezo")
 {
     //_piezo = new PWM(pin, 2048, 0, PWM.ScaleFactor.Milliseconds, false);
     _piezo = new PWM(pin, 2048, 0, false);
     _piezo.Start();
 }
開發者ID:StephanieMak,項目名稱:IoT-Maker-Den-NETMF,代碼行數:12,代碼來源:Piezo.cs


注:本文中的Microsoft.SPOT.Hardware.Cpu類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。