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); }
/// <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; }
/// <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; }
// Constructor public Led(Microsoft.SPOT.Hardware.Cpu.Pin LedPin) { physicalLed = new OutputPort(LedPin, false); lockObject = new Object(); this.Off(); }
// Constructor public Led(Microsoft.SPOT.Hardware.Cpu.Pin LedPin) { physicalLed = new OutputPort(LedPin, false); currentStateLocker = new Object(); this.Off(); }
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); }
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); }
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); }
/// <summary> /// Instantiate the piezzo buzzer /// </summary> /// <param name="pin"></param> public PiezoBuzzer(Microsoft.SPOT.Hardware.Cpu.Pin pin) { speaker = new PWM(pin); }
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); }