Main Site Documentation

Maybe a bug with fez raptor: display and gpio (version 0.12.0)


#1

I’ve try to use display T43 with fez raptor and a button (gadgeteer) on socket 11. If I can use led on button without issue, pin3 which is connected on switch can’t be open. There’s Nothing else connected on mainboard. I’ve try to open pin before initialized display, in this case, display throw an exception.

using System;
using System.Collections;
using System.Drawing;
using System.Text;
using System.Threading;
using GHIElectronics.TinyCLR.Devices.Display;
using GHIElectronics.TinyCLR.Devices.Gpio;
using GHIElectronics.TinyCLR.Pins;

namespace G400GpioBug
{
    class Program
    {
        static void Main()
        {
            var ctrl = GpioController.GetDefault();
            var displayController = DisplayController.GetDefault();

            // Enter the proper display configurations
            displayController.ApplySettings(new ParallelDisplayControllerSettings
            {
                Width = 480,
                Height = 272,
                PixelClockRate = 20 * 1000 * 1000,
                PixelPolarity = false,
                OutputEnablePolarity = true,
                OutputEnableIsFixed = false,
                HorizontalFrontPorch = 2,
                HorizontalBackPorch = 2,
                HorizontalSyncPulseWidth = 41,
                HorizontalSyncPolarity = false,
                VerticalFrontPorch = 2,
                VerticalBackPorch = 2,
                VerticalSyncPulseWidth = 10,
                VerticalSyncPolarity = false
            });

            // Some needed objects
            var screen = Graphics.FromHdc(displayController.Hdc);
            var GreenPen = new Pen(Color.Green);
            // Start Drawing (to memroy)
            screen.Clear(Color.Black);
            screen.DrawEllipse(GreenPen, 40, 30, 20, 10);
            // Flush the memory to the display. This is a very fast operation.
            screen.Flush();

            // Try to connect led on Socket 11: no issue
            GpioPin buttonLed = ctrl.OpenPin(FEZRaptor.GpioPin.Socket11.Pin4);
            buttonLed.SetDriveMode(GpioPinDriveMode.Output);
            // BUG: impossible to open pin
            GpioPin button = ctrl.OpenPin(FEZRaptor.GpioPin.Socket11.Pin3);
            button.SetDriveMode(GpioPinDriveMode.InputPullUp);
        }
    }
}

#2

That pin PC26 and looks like one of LCD pins.


#3

@Dat_Tran: yes it’s pc26, but socket 14, 15, 16 or 17 (connected to lcd) doesn’t contain this pc26 pin.


#4

That pin is LCD Contrast Control that is not used in Raptor. We may separate this pin as an option.


#5

It could be a good thing Indeed.


#6

Thanks, we removed this pin for next release.


#7

What a speedy correction :smile: