Ejemplo n.º 1
0
        public NativeSpi(Socket socket, SpiConfiguration configuration, SpiSharing sharing, Hardware.Cpu.Pin chipSelectPin, Hardware.Cpu.Pin busyPin, Module module, Hardware.SPI.SPI_module spiModule)
        {
            _hardwareInstance = GetAndUseInstance(socket, sharing, module, spiModule);
            _chipSelectPin = chipSelectPin;
            _busyPin = busyPin;
            _configuration = ToNativeConfiguration(configuration, chipSelectPin, busyPin, spiModule);

            if (_hardwareInstance.Interface == null && _configuration != null)
                _hardwareInstance.Interface = new Hardware.SPI(_configuration);
        }
Ejemplo n.º 2
0
 /// <summary>Constructs a new button definition</summary>
 /// <remarks>This version of the constructor defaults the ResistorMode to PullUp</remarks>
 /// <param name="Button">The button value to assign to the GPIO pin.</param>
 /// <param name="AutoRepeat">Boolean flag to indicate if this button should auto-repeat</param>
 public ButtonDefinition(Microsoft.SPOT.Hardware.Button Button
     , bool AutoRepeat
     )
 {
     this._Button = Button;
     this._Pin = HardwareProvider.HwProvider.GetButtonPins(Button);
     this._AutoRepeat = AutoRepeat;
 }
Ejemplo n.º 3
0
 /// <summary>Constructs a new button definition</summary>
 /// <remarks>
 /// The resistor mode can influence the detection of an up/down press.
 /// Setting it incorrectly can cause unexpected results. Check with the
 /// hardware design schematics or documentation for best results. 
 /// </remarks>
 /// <param name="Button">The button value to assign to the GPIO pin.</param>
 /// <param name="AutoRepeat">Boolean flag to indicate if this button should auto-repeat</param>
 /// <param name="ResistorMode">
 /// Resistor mode to configure for the GPIO pin [may be ignored on hardware that
 /// does not support dynamic configuration ]
 /// </param>
 /// <param name="InterruptMode">
 /// Interrupt mode to configure for the GPIO pin [may be ignored on hardware that
 /// does not support dynamic configuration ]
 /// </param>
 public ButtonDefinition( Microsoft.SPOT.Hardware.Button Button
     , bool AutoRepeat
     , Port.ResistorMode ResistorMode
     , Port.InterruptMode InterruptMode
     )
 {
     this._Button = Button;
     this._Pin = Pin;
     this._AutoRepeat = AutoRepeat;
     this._ResistorMode = ResistorMode;
     this._InterruptMode = InterruptMode;
 }
Ejemplo n.º 4
0
 // Constructor
 public Led(Microsoft.SPOT.Hardware.Cpu.Pin LedPin)
 {
     physicalLed = new OutputPort(LedPin, false);
     lockObject  = new Object();
     this.Off();
 }
Ejemplo n.º 5
0
 // Constructor
 public Led(Microsoft.SPOT.Hardware.Cpu.Pin LedPin)
 {
     physicalLed        = new OutputPort(LedPin, false);
     currentStateLocker = new Object();
     this.Off();
 }
Ejemplo n.º 6
0
        public NativeDigitalIO(Socket socket, Socket.Pin pin, bool initialState, GlitchFilterMode glitchFilterMode, ResistorMode resistorMode, Module module, Hardware.Cpu.Pin cpuPin)
        {
            if (cpuPin == Hardware.Cpu.Pin.GPIO_NONE)
            {
                // this is a mainboard error but should not happen since we check for this, but it doesnt hurt to double-check
                throw Socket.InvalidSocketException.FunctionalityException(socket, "DigitalIO");
            }

            _port = new Hardware.TristatePort(cpuPin, initialState, glitchFilterMode == GlitchFilterMode.On, (Hardware.Port.ResistorMode)resistorMode);
        }
Ejemplo n.º 7
0
        public NativeDigitalOutput(Socket socket, Socket.Pin pin, bool initialState, Module module, Hardware.Cpu.Pin cpuPin)
        {
            if (cpuPin == Hardware.Cpu.Pin.GPIO_NONE)
            {
                // this is a mainboard error but should not happen since we check for this, but it doesnt hurt to double-check
                throw Socket.InvalidSocketException.FunctionalityException(socket, "DigitalOutput");
            }

            _port = new Hardware.OutputPort(cpuPin, initialState);
        }
 /// <summary>
 /// Creates a new DigitalOutputPort from a pin.
 /// </summary>
 /// <param name="pin"></param>
 /// <param name="initialState"></param>
 public DigitalOutputPort(H.Cpu.Pin pin, bool initialState = false) : base(initialState)
 {
     this._digitalOutPort = new H.OutputPort(pin, initialState);
 }
Ejemplo n.º 9
0
        public static HBridgeMotor CreateForNetduino(Microsoft.SPOT.Hardware.Cpu.PWMChannel enable, Microsoft.SPOT.Hardware.Cpu.Pin a1, Microsoft.SPOT.Hardware.Cpu.Pin a2)
        {
            var leftPwm   = new Robotics.Micro.Devices.PwmOutputPin(enable);
            var leftMotor = new HBridgeMotor(leftPwm);

            leftMotor.A1Output.ConnectTo(new Robotics.Micro.Devices.DigitalOutputPin(a1).Input);
            leftMotor.A2Output.ConnectTo(new Robotics.Micro.Devices.DigitalOutputPin(a2).Input);
            return(leftMotor);
        }
 public HumiditySensorController(MSH.Cpu.Pin analogPort, MSH.Cpu.Pin digitalPort)
 {
     _analogPort  = new SLH.AnalogInput(analogPort);
     _digitalPort = new MSH.OutputPort(digitalPort, false);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Instantiate the piezzo buzzer
 /// </summary>
 /// <param name="pin"></param>
 public PiezoBuzzer(Microsoft.SPOT.Hardware.Cpu.Pin pin)
 {
     speaker = new PWM(pin);
 }
Ejemplo n.º 12
0
        public NativeInterruptInput(Socket socket, Socket.Pin pin, GlitchFilterMode glitchFilterMode, ResistorMode resistorMode, InterruptMode interruptMode, Module module, Hardware.Cpu.Pin cpuPin)
        {
            if (cpuPin == Hardware.Cpu.Pin.GPIO_NONE)
            {
                // this is a mainboard error but should not happen since we check for this, but it doesnt hurt to double-check
                throw Socket.InvalidSocketException.FunctionalityException(socket, "InterruptInput");
            }

            _port = new Hardware.InterruptPort(cpuPin, glitchFilterMode == GlitchFilterMode.On, (Hardware.Port.ResistorMode)resistorMode, (Hardware.Port.InterruptMode)interruptMode);
        }