本文整理汇总了C#中Microsoft.SPOT.Hardware.Cpu类的典型用法代码示例。如果您正苦于以下问题:C# Cpu类的具体用法?C# Cpu怎么用?C# Cpu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cpu类属于Microsoft.SPOT.Hardware命名空间,在下文中一共展示了Cpu类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Configuration
public Configuration(
Cpu.Pin ChipSelect_Port,
bool ChipSelect_ActiveState,
uint ChipSelect_SetupTime,
uint ChipSelect_HoldTime,
bool Clock_IdleState,
bool Clock_Edge,
uint Clock_RateKHz,
SPI_module SPI_mod,
Cpu.Pin BusyPin,
bool BusyPin_ActiveState
)
{
this.ChipSelect_Port = ChipSelect_Port;
this.ChipSelect_ActiveState = ChipSelect_ActiveState;
this.ChipSelect_SetupTime = ChipSelect_SetupTime;
this.ChipSelect_HoldTime = ChipSelect_HoldTime;
this.Clock_IdleState = Clock_IdleState;
this.Clock_Edge = Clock_Edge;
this.Clock_RateKHz = Clock_RateKHz;
this.SPI_mod = SPI_mod;
this.BusyPin = BusyPin;
this.BusyPin_ActiveState = BusyPin_ActiveState;
}
开发者ID:prabby,项目名称:miniclr,代码行数:25,代码来源:SPI.cs
示例17: GetSerialPins
override public void GetSerialPins(string comPort, out Cpu.Pin rxPin, out Cpu.Pin txPin, out Cpu.Pin ctsPin, out Cpu.Pin rtsPin)
{
switch (comPort)
{
case "COM1": // STDUART
rxPin = Pins.GPIO_PORT_PIN_46;
txPin = Pins.GPIO_PORT_PIN_47;
ctsPin = Pins.GPIO_NONE;
rtsPin = Pins.GPIO_NONE;
break;
case "COM2": // BTUART
rxPin = Pins.GPIO_PORT_PIN_42;
txPin = Pins.GPIO_PORT_PIN_43;
ctsPin = Pins.GPIO_PORT_PIN_44;
rtsPin = Pins.GPIO_PORT_PIN_45;
break;
case "COM3": // FFUART
rxPin = Pins.GPIO_PORT_PIN_96;
txPin = Pins.GPIO_PORT_PIN_99;
ctsPin = Pins.GPIO_PORT_PIN_100;
rtsPin = Pins.GPIO_PORT_PIN_98;
break;
default:
throw new NotSupportedException();
}
}
开发者ID:prabby,项目名称:miniclr,代码行数:26,代码来源:HardwareProvider.cs
示例18: clsLCD_MLC
/// <summary>
/// Constructor for parallel LCD connection
/// </summary>
/// <param name="rs"></param>
/// <param name="rw"></param>
/// <param name="enable"></param>
/// <param name="d4"></param>
/// <param name="d5"></param>
/// <param name="d6"></param>
/// <param name="d7"></param>
/// <param name="rows"></param>
/// <param name="cols"></param>
public clsLCD_MLC(Cpu.Pin rs, Cpu.Pin rw, Cpu.Pin enable, Cpu.Pin d4, Cpu.Pin d5, Cpu.Pin d6,
Cpu.Pin d7, byte rows, byte cols)
{
GpioLcdTransferProvider lcdProvider = new GpioLcdTransferProvider(rs, rw, enable, d4, d5, d6, d7);
lcd = new Lcd(lcdProvider);
lcd_begin(rows, cols);
}
开发者ID:edesiocs,项目名称:gigamega-micro,代码行数:19,代码来源:clsLCD_MLC.cs
示例19: RelayBoard
/// <summary>
/// Sets up the relay board using the passed in
/// pin map. If that is null, it will set up one
/// based on pin0 == GPIO_PIN_D2
/// </summary>
/// <param name="rawPinMap"></param>
public RelayBoard(bool inverse = true, Cpu.Pin[] rawPinMap = null)
{
Inverse = inverse;
if (null == rawPinMap)
{
rawPinMap = new Cpu.Pin[] {
Pins.GPIO_PIN_D2,
Pins.GPIO_PIN_D3,
Pins.GPIO_PIN_D4,
Pins.GPIO_PIN_D5,
Pins.GPIO_PIN_D6,
Pins.GPIO_PIN_D7,
Pins.GPIO_PIN_D8,
Pins.GPIO_PIN_D9
};
}
MaxPin = rawPinMap.Length;
// Build the outputs
bool initalState = Inverse ? true : false;
PinMap = new OutputPort[MaxPin];
for (int i = 0; i < MaxPin; i++)
{
PinMap[i] = new OutputPort(rawPinMap[i], initalState);
}
}
开发者ID:sdempsay,项目名称:Simple8Channel,代码行数:35,代码来源:RelayBoard.cs
示例20: Fan
public Fan(Cpu.PWMChannel pin)
{
this.pwmChannel = pin;
this.speed = Speed.None;
this.frequency = (double)100;
Start();
}
开发者ID:kevjett,项目名称:GrillMaster,代码行数:7,代码来源:Fan.cs
注:本文中的Microsoft.SPOT.Hardware.Cpu类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论