コード例 #1
0
ファイル: StepMotor.cs プロジェクト: gflerm/NetCNC
 public StepMotor(IDigitalOutputPort stepPort, IDigitalOutputPort directionPort, int motorSteps, StepResolution stepResolution)
 {
     this.direction = false;
     this.stepResolution = stepResolution;
     this.motorSteps = motorSteps;
     this.stepPort = stepPort;
     this.directionPort = directionPort;
 }
コード例 #2
0
        public Pcd8544(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin)
        {
            displayBuffer = new byte[Width * Height / 8];
            spiReceive = new byte[Width * Height / 8];

            dataCommandPort = device.CreateDigitalOutputPort(dcPin, true);
            resetPort = device.CreateDigitalOutputPort(resetPin, true);
            chipSelectPort = device.CreateDigitalOutputPort(chipSelectPin);

            spi = (SpiBus)spiBus;
            spiDisplay = new SpiPeripheral(spiBus, chipSelectPort);

            Initialize();
        }
コード例 #3
0
        /// <summary>
        ///     Create a new ST7565 object using the default parameters for
        /// </summary>
        public St7565(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin,
                      uint width = 128, uint height = 64)
        {
            dataCommandPort = device.CreateDigitalOutputPort(dcPin, false);
            resetPort       = device.CreateDigitalOutputPort(resetPin, false);
            chipSelectPort  = device.CreateDigitalOutputPort(chipSelectPin);

            spiPerihperal = new SpiPeripheral(spiBus, chipSelectPort);

            Width  = width;
            Height = height;

            InitST7565();
        }
コード例 #4
0
        /// <summary>
        ///     Create a new SSD1306 object using the default parameters for
        /// </summary>
        /// <remarks>
        ///     Note that by default, any pixels out of bounds will throw and exception.
        ///     This can be changed by setting the <seealso cref="IgnoreOutOfBoundsPixels" />
        ///     property to true.
        /// </remarks>
        /// <param name="displayType">Type of SSD1306 display (default = 128x64 pixel display).</param>
        ///
        public Ssd1306(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin,
                       DisplayType displayType = DisplayType.OLED128x64)
        {
            dataCommandPort = device.CreateDigitalOutputPort(dcPin, false);
            resetPort       = device.CreateDigitalOutputPort(resetPin, true);
            chipSelectPort  = device.CreateDigitalOutputPort(chipSelectPin, false);

            spi        = (SpiBus)spiBus;
            spiDisplay = new SpiPeripheral(spiBus, chipSelectPort);

            connectionType = ConnectionType.SPI;

            InitSSD1306(displayType);
        }
コード例 #5
0
ファイル: Max7219.cs プロジェクト: jovicde/Meadow.Foundation
        public Max7219(ISpiBus spiBus, IDigitalOutputPort csPort, int deviceCount = 1, Max7219Type maxMode = Max7219Type.Display)
        {
            spi            = (SpiBus)spiBus;
            chipSelectPort = csPort;

            max7219 = new SpiPeripheral(spiBus, csPort);

            DeviceCount = deviceCount;

            _buffer      = new byte[DeviceCount, NumDigits];
            _writeBuffer = new byte[2 * DeviceCount];
            _readBuffer  = new byte[2 * DeviceCount];

            Initialize(maxMode);
        }
コード例 #6
0
        public void ConfigurePorts()
        {
            Console.WriteLine("Creating Outputs...");
            redLed   = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedRed);
            blueLed  = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedBlue);
            greenLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedGreen);

            _leds = new List <PwmLed>()
            {
                new PwmLed(Device.CreatePwmPort(Device.Pins.D08), TypicalForwardVoltage.Red),
                new PwmLed(Device.CreatePwmPort(Device.Pins.D07), TypicalForwardVoltage.Green),
                new PwmLed(Device.CreatePwmPort(Device.Pins.D06), TypicalForwardVoltage.Blue),
                new PwmLed(Device.CreatePwmPort(Device.Pins.D05), TypicalForwardVoltage.Yellow)
            };
        }
コード例 #7
0
        public HvacController(
            IDigitalOutputPort heater,
            IDigitalOutputPort airConditioner,
            IDigitalOutputPort fan
            )
        {
            this.heater         = heater;
            this.airConditioner = airConditioner;
            this.fan            = fan;

            // start with everything off
            heater.State         = false;
            airConditioner.State = false;
            fan.State            = false;
        }
コード例 #8
0
        public void LedTestDuplicateInstance()
        {
            var green = Device.GetPin("OnboardLedGreen");

            Assert.NotNull(green);

            var leds = new IDigitalOutputPort[2];

            // this should be illegal and throw
            Assert.Throws <PortInUseException>(() =>
            {
                leds[0] = Device.CreateDigitalOutputPort(green);
                leds[1] = Device.CreateDigitalOutputPort(green);
            });
        }
コード例 #9
0
        public Lcd2004(H.Cpu.Pin RS, H.Cpu.Pin E, H.Cpu.Pin D4, H.Cpu.Pin D5, H.Cpu.Pin D6, H.Cpu.Pin D7)
        {
            DisplayConfig = new TextDisplayConfig {
                Height = 4, Width = 20
            };

            LCD_RS = new GPIO.SPOT.DigitalOutputPort(RS);
            LCD_E  = new GPIO.SPOT.DigitalOutputPort(E);
            LCD_D4 = new GPIO.SPOT.DigitalOutputPort(D4);
            LCD_D5 = new GPIO.SPOT.DigitalOutputPort(D5);
            LCD_D6 = new GPIO.SPOT.DigitalOutputPort(D6);
            LCD_D7 = new GPIO.SPOT.DigitalOutputPort(D7);

            Initialize();
        }
コード例 #10
0
        public Nrf24l01(
            ISpiBus spiBus,
            IDigitalOutputPort chipEnablePort,
            IDigitalOutputPort chipSelectPort,
            IDigitalInterruptPort interruptPort)
        {
            pipe0_reading_address[0] = 0;

            this.spiBus = spiBus;
            rf24        = new SpiPeripheral(spiBus, chipSelectPort);

            this.chipEnablePort = chipEnablePort;
            this.interruptPort  = interruptPort;

            Initialize();
        }
コード例 #11
0
ファイル: App.cs プロジェクト: Vinz68/Meadow_Samples
        public void InitHardware()
        {
            Console.WriteLine("Initialize hardware...");
            blueLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedBlue);

            sensor          = new SHT31D(Device.CreateI2cBus());
            sensor.Updated += Sensor_Updated;

            var st7789 = new ST7789(Device, Device.CreateSpiBus(),
                                    Device.Pins.D02, Device.Pins.D01, Device.Pins.D00,
                                    135, 240);

            display             = new GraphicsLibrary(st7789);
            display.CurrentFont = new Font12x20();
            display.Rotation    = GraphicsLibrary.RotationType._90Degrees;
        }
コード例 #12
0
        public CharacterDisplay(IIODevice device, IPin pinRS, IPin pinE, IPin pinD4, IPin pinD5, IPin pinD6, IPin pinD7,
                                ushort rows = 4, ushort columns = 20)
        {
            DisplayConfig = new TextDisplayConfig {
                Height = rows, Width = columns
            };

            LCD_RS = device.CreateDigitalOutputPort(pinRS);
            LCD_E  = device.CreateDigitalOutputPort(pinE);
            LCD_D4 = device.CreateDigitalOutputPort(pinD4);
            LCD_D5 = device.CreateDigitalOutputPort(pinD5);
            LCD_D6 = device.CreateDigitalOutputPort(pinD6);
            LCD_D7 = device.CreateDigitalOutputPort(pinD7);

            Initialize();
        }
コード例 #13
0
        public MeadowApp()
        {
            Console.WriteLine("Creating Outputs...");

            ledPort = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedGreen);

            display = new MAX7219(
                Device,
                din: Device.Pins.D00,
                cs: Device.Pins.D01,
                clk: Device.Pins.D02,
                displayCount: 1);

            Console.WriteLine("Run...");
            Run();
        }
コード例 #14
0
        public DisplayTftSpiBase(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin,
            uint width, uint height)
        {
            _width = width;
            _height = height;

            spi = (SpiBus)spiBus;

            spiBuffer = new byte[_width * _height * sizeof(ushort)];
            spiReceive = new byte[_width * _height * sizeof(ushort)];

            dataCommandPort = device.CreateDigitalOutputPort(dcPin, false);
            if (resetPin != null) { resetPort = device.CreateDigitalOutputPort(resetPin, true); }
            if (chipSelectPin != null) { chipSelectPort = device.CreateDigitalOutputPort(chipSelectPin, false); }

            spiDisplay = new SpiPeripheral(spiBus, chipSelectPort);
        }
コード例 #15
0
        public static void RunDigitalOutputTests()
        {
            // setup our timer
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            long elapsedTimePortsCreated;
            long elapsedTimePortsWritten;

            bool state          = false;
            int  writeLoopCount = 100;

            stopwatch.Start();

            // init some ports
            IDigitalOutputPort red   = MeadowApp.Device.CreateDigitalOutputPort(MeadowApp.Device.Pins.OnboardLedRed);
            IDigitalOutputPort green = MeadowApp.Device.CreateDigitalOutputPort(MeadowApp.Device.Pins.OnboardLedGreen);
            IDigitalOutputPort blue  = MeadowApp.Device.CreateDigitalOutputPort(MeadowApp.Device.Pins.OnboardLedBlue);

            elapsedTimePortsCreated = stopwatch.ElapsedMilliseconds;

            // write to the ports
            for (int i = 0; i < writeLoopCount; i++)
            {
                state       = !state;
                red.State   = state;
                green.State = state;
                blue.State  = state;
            }
            elapsedTimePortsWritten = stopwatch.ElapsedMilliseconds;

            // calculate times.
            long  timeToWrite      = elapsedTimePortsWritten - elapsedTimePortsCreated;
            float averageWriteTime = (float)timeToWrite / (float)(writeLoopCount * 3);

            // output
            Console.WriteLine("=======================================");
            Console.WriteLine($"Port Test Results:");
            Console.WriteLine($"| Port initialization | {elapsedTimePortsCreated}ms |");
            Console.WriteLine($"| {writeLoopCount * 3} Port writes | {timeToWrite}ms |");
            Console.WriteLine($"| Average time per write | {averageWriteTime}ms |");
            Console.WriteLine("=======================================");

            // cleanup
            red.Dispose();
            green.Dispose();
            blue.Dispose();
        }
コード例 #16
0
        public Lcd2004(MCP23008 mcp)
        {
            DisplayConfig = new TextDisplayConfig {
                Height = 4, Width = 20
            };

            LCD_RS = mcp.CreateOutputPort(1, false);
            LCD_E  = mcp.CreateOutputPort(2, false);
            LCD_D4 = mcp.CreateOutputPort(3, false);
            LCD_D5 = mcp.CreateOutputPort(4, false);
            LCD_D6 = mcp.CreateOutputPort(5, false);
            LCD_D7 = mcp.CreateOutputPort(6, false);

            var lite = mcp.CreateOutputPort(7, true);

            Initialize();
        }
コード例 #17
0
        /// <summary>
        /// Creates a SevenSegment connected to the especified IDigitalOutputPorts
        /// </summary>
        /// <param name="portA"></param>
        /// <param name="portB"></param>
        /// <param name="portC"></param>
        /// <param name="portD"></param>
        /// <param name="portE"></param>
        /// <param name="portF"></param>
        /// <param name="portG"></param>
        /// <param name="portDecimal"></param>
        /// <param name="isCommonCathode"></param>
        public SevenSegment(
            IDigitalOutputPort portA, IDigitalOutputPort portB,
            IDigitalOutputPort portC, IDigitalOutputPort portD,
            IDigitalOutputPort portE, IDigitalOutputPort portF,
            IDigitalOutputPort portG, IDigitalOutputPort portDecimal,
            bool isCommonCathode)
        {
            _portA       = portA;
            _portB       = portB;
            _portC       = portC;
            _portD       = portD;
            _portE       = portE;
            _portF       = portF;
            _portG       = portG;
            _portDecimal = portDecimal;

            _isCommonCathode = isCommonCathode;
        }
コード例 #18
0
        public Lcd2004(IDigitalOutputPort portRS,
                       IDigitalOutputPort portE,
                       IDigitalOutputPort portD4,
                       IDigitalOutputPort portD5,
                       IDigitalOutputPort portD6,
                       IDigitalOutputPort portD7,
                       ushort rows = 20, ushort columns = 4)
        {
            DisplayConfig = new TextDisplayConfig {
                Height = rows, Width = columns
            };

            LCD_RS = portRS;
            LCD_E  = portE;
            LCD_D4 = portD4;
            LCD_D5 = portD5;
            LCD_D6 = portD6;
            LCD_D7 = portD7;
        }
コード例 #19
0
ファイル: MeadowApp.cs プロジェクト: csuski/Meadow
        public void ConfigurePorts()
        {
            _blueLED = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedBlue);

            var config = new SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode3);

            _spiBus  = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config);
            _display = new St7789(device: Device, spiBus: _spiBus,
                                  chipSelectPin: Device.Pins.D02,
                                  dcPin: Device.Pins.D01,
                                  resetPin: Device.Pins.D00,
                                  width: 135, height: 240);

            _graphicsLib             = new GraphicsLibrary(_display);
            _graphicsLib.CurrentFont = new Font8x8();
            _graphicsLib.Clear();
            _graphicsLib.Rotation = GraphicsLibrary.RotationType._90Degrees;
            _display.Clear(Meadow.Foundation.Color.Black, true);
        }
コード例 #20
0
        public void ConfigureSpiPort()
        {
            try
            {
                ChipEnable = Device.CreateDigitalOutputPort(Device.Pins.D09, initialState: false);
                if (ChipEnable == null)
                {
                    Console.WriteLine("chipEnable == null");
                }

                var spiClockConfiguration = new SpiClockConfiguration(2000, SpiClockConfiguration.Mode.Mode0);
                spiBus = Device.CreateSpiBus(Device.Pins.SCK,
                                             Device.Pins.MOSI,
                                             Device.Pins.MISO,
                                             spiClockConfiguration);
                if (spiBus == null)
                {
                    Console.WriteLine("spiBus == null");
                }

                Console.WriteLine("Creating SPI NSS Port...");
                spiPeriphChipSelect = Device.CreateDigitalOutputPort(Device.Pins.D10, initialState: true);
                if (spiPeriphChipSelect == null)
                {
                    Console.WriteLine("spiPeriphChipSelect == null");
                }

                Console.WriteLine("nrf24L01Device Device...");
                nrf24L01Device = new SpiPeripheral(spiBus, spiPeriphChipSelect);
                if (nrf24L01Device == null)
                {
                    Console.WriteLine("nrf24L01Device == null");
                }

                Thread.Sleep(100);

                Console.WriteLine("ConfigureSpiPort Done...");
            }
            catch (Exception ex)
            {
                Console.WriteLine("ConfigureSpiPort " + ex.Message);
            }
        }
コード例 #21
0
        void Initialize()
        {
            Console.WriteLine("Initialize hardware...");

            // this causes unterrupts to fail, for some reason:
            //IDigitalInputPort test = Device.CreateDigitalInputPort(Device.Pins.D07);
            // this does not.
            IDigitalOutputPort test = Device.CreateDigitalOutputPort(Device.Pins.D07);

            Console.WriteLine("Made it here.");

            button1 = new PushButton(Device, Device.Pins.D13, ResistorMode.InternalPullDown);
            button2 = new PushButton(Device, Device.Pins.D12, ResistorMode.InternalPullDown);

            button1.PressStarted += Button1_PressStarted;
            button1.PressEnded   += Button1_PressEnded;
            button2.PressStarted += Button2_PressStarted;
            button2.PressEnded   += Button2_PressEnded;

            motorDriver = new Tb67h420ftg(Device,
                                          inA1: Device.Pins.D04, inA2: Device.Pins.D03, pwmA: Device.Pins.D01,
                                          inB1: Device.Pins.D05, inB2: Device.Pins.D06, pwmB: Device.Pins.D00,
                                          fault1: Device.Pins.D02, fault2: Device.Pins.D07,
                                          hbMode: Device.Pins.D11, tblkab: Device.Pins.D10);

            // 6V motors with a 12V input. this clamps them to 6V
            motorDriver.Motor1.MotorCalibrationMultiplier = 0.5f;
            motorDriver.Motor2.MotorCalibrationMultiplier = 0.5f;

            Console.WriteLine("Init encoder");
            encoder = new RotaryEncoder(Device, Device.Pins.D09, Device.Pins.D15);
            //    encoder.Rotated += Encoder_Rotated;

            Console.WriteLine("Init display");
            var ssd1306 = new Ssd1306(Device.CreateI2cBus(), 60, Ssd1306.DisplayType.OLED128x32);

            display             = new GraphicsLibrary(ssd1306);
            display.CurrentFont = new Font8x12();

            Console.WriteLine("Initialization complete.");
            UpdateDisplay("Initialization", "Complete");
        }
コード例 #22
0
        /// <summary>
        /// Create a new MarsRover object.
        /// </summary>
        public Rover()
        {
            _redLed   = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedRed);
            _greenLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedGreen);

            _driveController     = new DriveController(Device);
            _bluetoothController = new BluetoothController(Device);

            _bluetoothController.Forward.ValueSet += Forward_ValueSet;
            _bluetoothController.Reverse.ValueSet += Reverse_ValueSet;
            _bluetoothController.Left.ValueSet    += Left_ValueSet;
            _bluetoothController.Right.ValueSet   += Right_ValueSet;

            var i2cBus = Device.CreateI2cBus(I2cBusSpeed.FastPlus);

            _distanceSensor = new Vl53l0x(Device, i2cBus);
            _distanceSensor.DistanceUpdated += _distanceSensor_Updated;
            _distanceSensor.StartUpdating(TimeSpan.FromMilliseconds(250));

            EnableDriveSystem();
        }
コード例 #23
0
        void Initialize()
        {
            var onboardLed = new RgbPwmLed(
                device: Device,
                redPwmPin: Device.Pins.OnboardLedRed,
                greenPwmPin: Device.Pins.OnboardLedGreen,
                bluePwmPin: Device.Pins.OnboardLedBlue);

            onboardLed.SetColor(Color.Red);

            ISpiBus            spiBus = Device.CreateSpiBus();
            IDigitalOutputPort spiPeriphChipSelect =
                Device.CreateDigitalOutputPort(Device.Pins.D04);

            ledStrip = new Apa102(
                spiBus: spiBus,
                numberOfLeds: 18,
                pixelOrder: Apa102.PixelOrder.BGR);

            onboardLed.SetColor(Color.Green);
        }
コード例 #24
0
        public CharacterDisplay(IDigitalOutputPort portRS,
                                IDigitalOutputPort portE,
                                IDigitalOutputPort portD4,
                                IDigitalOutputPort portD5,
                                IDigitalOutputPort portD6,
                                IDigitalOutputPort portD7,
                                ushort rows = 4, ushort columns = 20)
        {
            DisplayConfig = new TextDisplayConfig {
                Height = rows, Width = columns
            };

            LCD_RS = portRS;
            LCD_E  = portE;
            LCD_D4 = portD4;
            LCD_D5 = portD5;
            LCD_D6 = portD6;
            LCD_D7 = portD7;

            Initialize();
        }
コード例 #25
0
        public TftSpiBase(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin,
                          int width, int height, DisplayColorMode mode = DisplayColorMode.Format16bppRgb565)
        {
            this.width  = width;
            this.height = height;

            spi = (SpiBus)spiBus;

            dataCommandPort = device.CreateDigitalOutputPort(dcPin, false);
            if (resetPin != null)
            {
                resetPort = device.CreateDigitalOutputPort(resetPin, true);
            }
            if (chipSelectPin != null)
            {
                chipSelectPort = device.CreateDigitalOutputPort(chipSelectPin, false);
            }

            spiDisplay = new SpiPeripheral(spiBus, chipSelectPort);

            SetColorMode(mode);
        }
コード例 #26
0
        /// <summary>
        /// Creates a SevenSegment connected to the especified IDigitalOutputPorts
        /// </summary>
        /// <param name="portA"></param>
        /// <param name="portB"></param>
        /// <param name="portC"></param>
        /// <param name="portD"></param>
        /// <param name="portE"></param>
        /// <param name="portF"></param>
        /// <param name="portG"></param>
        /// <param name="portDecimal"></param>
        /// <param name="isCommonCathode"></param>
        public FourDigitSevenSegment(
            IDigitalOutputPort portDigit1, IDigitalOutputPort portDigit2,
            IDigitalOutputPort portDigit3, IDigitalOutputPort portDigit4,
            IDigitalOutputPort portA, IDigitalOutputPort portB,
            IDigitalOutputPort portC, IDigitalOutputPort portD,
            IDigitalOutputPort portE, IDigitalOutputPort portF,
            IDigitalOutputPort portG, IDigitalOutputPort portDecimal,
            bool isCommonCathode)
        {
            digits    = new IDigitalOutputPort[4];
            digits[0] = portDigit1;
            digits[1] = portDigit2;
            digits[2] = portDigit3;
            digits[3] = portDigit4;

            sevenSegments = new SevenSegment[4];
            for (int i = 0; i < 4; i++)
            {
                sevenSegments[i] = new SevenSegment(portA, portB, portC, portD, portE, portF, portG, portDecimal, isCommonCathode);
            }

            cts = new CancellationTokenSource();
        }
コード例 #27
0
        void Initialize()
        {
            var onboardLed = new RgbPwmLed(device: Device,
                                           redPwmPin: Device.Pins.OnboardLedRed,
                                           greenPwmPin: Device.Pins.OnboardLedGreen,
                                           bluePwmPin: Device.Pins.OnboardLedBlue,
                                           3.3f, 3.3f, 3.3f,
                                           IRgbLed.CommonType.CommonAnode);

            onboardLed.SetColor(Color.Red);

            Console.WriteLine("Initialize hardware...");
            ISpiBus            spiBus = Device.CreateSpiBus();
            IDigitalOutputPort spiPeriphChipSelect =
                Device.CreateDigitalOutputPort(Device.Pins.D04);

            ledStrip = new Apa102(
                spiBus: spiBus,
                numberOfLeds: 18,
                pixelOrder: Apa102.PixelOrder.BGR);

            onboardLed.SetColor(Color.Green);
        }
コード例 #28
0
        void InitializeHardware()
        {
            Console.WriteLine("Configuring hardware");
            stereoLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedRed);

            Console.WriteLine("Create radio button");
            muteButton = Device.CreateDigitalInputPort(Device.Pins.D12);

            Console.WriteLine("Create Spi bus");

            var spiBus = Device.CreateSpiBus();

            Console.WriteLine("Create display");
            var st7565 = new ST7565(device: Device, spiBus: spiBus,
                                    chipSelectPin: Device.Pins.D02,
                                    dcPin: Device.Pins.D00,
                                    resetPin: Device.Pins.D01,
                                    width: 128, height: 64);

            st7565.SetContrast(5);

            Console.WriteLine("Create graphics lib");

            display             = new GraphicsLibrary(st7565);
            display.CurrentFont = new Font8x8();

            Console.WriteLine("Create I2C bus");
            var i2cBus = Device.CreateI2cBus();

            Console.WriteLine("Create TEA5767 instance");
            radio = new TEA5767(i2cBus);

            Thread.Sleep(500); //quick test

            radio.SetFrequency(94.9f);
        }
コード例 #29
0
        public GpioCharacterDisplay(
            IPwmPort portV0,
            IDigitalOutputPort portRS,
            IDigitalOutputPort portE,
            IDigitalOutputPort portD4,
            IDigitalOutputPort portD5,
            IDigitalOutputPort portD6,
            IDigitalOutputPort portD7,
            byte rows = 4, byte columns = 20)
        {
            DisplayConfig = new TextDisplayConfig {
                Height = rows, Width = columns
            };

            LCD_V0 = portV0; LCD_V0.Start();
            LCD_RS = portRS;
            LCD_E  = portE;
            LCD_D4 = portD4;
            LCD_D5 = portD5;
            LCD_D6 = portD6;
            LCD_D7 = portD7;

            Initialize();
        }
コード例 #30
0
 internal Bme280Spi(ISpiBus spi, IDigitalOutputPort chipSelect = null)
 {
     _spi        = spi;
     _chipSelect = chipSelect;
 }
コード例 #31
0
 /// <summary>
 /// This will explain the pins for 74HC595
 /// </summary>
 /// <param name="device">Board Device.</param>
 /// <param name="data">Pin 14 on the 74. That will indicate what value of bit we want to push to the shift register. Also known as SER</param>
 /// <param name="latch">Pin 12 on the 74. This will push to Qa - Qh when set to HIGH all of the values we included thus far. Also known as RCLK.</param>
 /// <param name="clock">Pin 11 on the 74. Thi swill push one bit from <see cref="data"/> to the shift register temp storage when set to HIGH.</param>
 /// <param name="clear">Pin 10 on the 74. Inverse pin. Normally should be set to HIGHT. When clearing need to be set to LOW. use <see cref="Clear"/> function </param>
 /// <param name="outputEnable">Pin 13 on the 74. Invese pin just like <see cref="clear"/> pin. Normally want to be set to LOW. When High output pins are disabled. <see cref="Disable"/> and <see cref="Enable"/> functions.</param>
 public Shift74HC595(IDigitalOutputPort data, IDigitalOutputPort latch, IDigitalOutputPort clock, IDigitalOutputPort clear = null, IDigitalOutputPort outputEnable = null)
 {
     this.data         = data;
     this.latch        = latch;
     this.clock        = clock;
     this.clear        = clear;
     this.outputEnable = outputEnable;
 }