public UltraSonicSensor(Cpu.Pin echoPin, Cpu.Pin triggerPin) { _echoPin = new InterruptPort(echoPin, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth); _triggerPin = new OutputPort(triggerPin, false); _echoPin.OnInterrupt += port_OnInterrupt; _echoPin.DisableInterrupt(); }
public TemperatureHumiditySensorPro(BaseShield.DigitalPorts port) : base(port) { outputPort = new TristatePort(Pin1, true, false, Port.ResistorMode.PullUp); inputPort = new InterruptPort(Pin2, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow); inputPort.DisableInterrupt(); inputPort.OnInterrupt += new NativeEventHandler(inputPort_OnInterrupt); dataReceivedEvent = new AutoResetEvent(false); }
private float temp; // Temperature #endregion Fields #region Constructors // Instantiated via derived class protected DhtSensor(Cpu.Pin pin1, Cpu.Pin pin2, PullUpResistor pullUp) { var resistorMode = (Port.ResistorMode)pullUp; portIn = new InterruptPort(pin2, false, resistorMode, Port.InterruptMode.InterruptEdgeLow); portIn.OnInterrupt += new NativeEventHandler(portIn_OnInterrupt); portIn.DisableInterrupt(); // Enabled automatically in the previous call portOut = new TristatePort(pin1, true, false, resistorMode); if(!CheckPins()) { throw new InvalidOperationException("DHT sensor pins are not connected together."); } }
public AX88796C(SPI.SPI_module spiBusID, Cpu.Pin csPinID, Cpu.Pin intPinID, Cpu.Pin resetPinID, Cpu.Pin wakeupPinID) { // create our chip select pin and SPI bus objects _chipSelectPin = new OutputPort(csPinID, true); _spi = new SPI(new SPI.Configuration(Cpu.Pin.GPIO_NONE, false, 0, 0, false, true, 40000, spiBusID)); // wire up our interrupt, for future use _interruptPin = new InterruptPort(intPinID, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow); _interruptPin.DisableInterrupt(); _interruptPin.OnInterrupt += _interruptPin_OnInterrupt; // save our reset pin ID (which we will use to control the reset pin a bit later on) _resetPinID = resetPinID; // save our wakeup pin ID (which we can use to create an InterruptPort right before we go to sleep) _wakeupPinID = wakeupPinID; // create our _sendPacketTxPagesFreeEvent _sendPacketTxPagesFreeEvent = new System.Threading.AutoResetEvent(false); // we are not initialized; we will initialize when we are started. _isInitialized = false; }
public ENC28J60(SPI.SPI_module spiBusID, Cpu.Pin csPinID, Cpu.Pin intPinID, Cpu.Pin resetPinID, Cpu.Pin wakeupPinID) { // create our chip select pin and SPI bus objects _chipSelectPin = new OutputPort(csPinID, true); // ERRATA NOTE: per ENC28J60 errata 1, our SPI clock speed must be at least 8,000,000Hz. Because our SPI drivers may be clocked via a "/2^x" division, our clock rate must be 16MHz-20MHz. */ _spi = new SPI(new SPI.Configuration(Cpu.Pin.GPIO_NONE, false, 0, 0, false, true, 20000, spiBusID)); // wire up our interrupt, for future use _interruptPin = new InterruptPort(intPinID, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow); _interruptPin.DisableInterrupt(); _interruptPin.OnInterrupt += _interruptPin_OnInterrupt; // save our reset pin ID (which we will use to control the reset pin a bit later on) _resetPinID = resetPinID; // save our wakeup pin ID (which we can use to create an InterruptPort right before we go to sleep) _wakeupPinID = wakeupPinID; // create our _sendPacketTxBufferFreeEvent _sendPacketTxBufferFreeEvent = new System.Threading.AutoResetEvent(false); // we are not initialized; we will initialize when we are started. _isInitialized = false; }