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);
}
}
}