当前位置: 首页>>代码示例>>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;未经允许,请勿转载。