Пример #1
0
        /// <summary>
        /// The initialisation method, this needs to be called before the screen is ready for use.
        /// </summary>
        /// <param name="rs">The number of the GPIO pin assigned to the RS pin on the display</param>
        /// <param name="rw">The number of the GPIO pin assigned to the RW pin on the display</param>
        /// <param name="enable">The number of the GPIO pin assigned to the Enable pin on the display</param>
        /// <param name="d7">The number of the GPIO pin assigned to the D7 pin on the display</param>
        /// <param name="d6">The number of the GPIO pin assigned to the D6 pin on the display</param>
        /// <param name="d5">The number of the GPIO pin assigned to the D5 pin on the display</param>
        /// <param name="d4">The number of the GPIO pin assigned to the D4 pin on the display</param>
        /// <param name="d3">The number of the GPIO pin assigned to the D3 pin on the display</param>
        /// <param name="d2">The number of the GPIO pin assigned to the D2 pin on the display</param>
        /// <param name="d1">The number of the GPIO pin assigned to the D1 pin on the display</param>
        /// <param name="d0">The number of the GPIO pin assigned to the D0 pin on the display</param>
        /// <returns>A notification of when the task completes</returns>
        public void Init(int rs, int rw, int enable, int d7, int d6, int d5, int d4, int d3, int d2, int d1, int d0)
        {
            var gpio = GpioController.GetDefault();

            rsPin = gpio.OpenPin(rs);
            rsPin.SetDriveMode(GpioPinDriveMode.Output);
            rwPin = gpio.OpenPin(rw);
            rwPin.SetDriveMode(GpioPinDriveMode.Output);
            enablePin = gpio.OpenPin(enable);
            enablePin.SetDriveMode(GpioPinDriveMode.Output);
            enablePin.Write(GpioPinValue.Low);
            d0Pin = gpio.OpenPin(d0);
            d0Pin.SetDriveMode(GpioPinDriveMode.Output);
            d1Pin = gpio.OpenPin(d1);
            d1Pin.SetDriveMode(GpioPinDriveMode.Output);
            d2Pin = gpio.OpenPin(d2);
            d2Pin.SetDriveMode(GpioPinDriveMode.Output);
            d3Pin = gpio.OpenPin(d3);
            d3Pin.SetDriveMode(GpioPinDriveMode.Output);
            d4Pin = gpio.OpenPin(d4);
            d4Pin.SetDriveMode(GpioPinDriveMode.Output);
            d5Pin = gpio.OpenPin(d5);
            d5Pin.SetDriveMode(GpioPinDriveMode.Output);
            d6Pin = gpio.OpenPin(d6);
            d6Pin.SetDriveMode(GpioPinDriveMode.Output);
            d7Pin = gpio.OpenPin(d7);
            d7Pin.SetDriveMode(GpioPinDriveMode.Output);

            isConfigured = true;

            TurnDisplayOff();
            TurnDisplayOn();
            ClearDisplay();
            ConfigureTextDisplay();
            ConfigureDisplay();
            SendInstruction(InstructionDefinitions.ENTRY_MODE_SET(true, false));
            SetCursorPosition(0, 0);
        }