Hey
Been playing around with the SCM20260D Dev Board and encountered a issue when showing images on the screen. the images appear messed up.
The image shown on the screen:
The code is taken from the Getting started page: Graphics
Code:
using GHIElectronics.TinyCLR.Devices.Display;
using GHIElectronics.TinyCLR.Devices.Gpio;
using GHIElectronics.TinyCLR.Pins;
using System.Drawing;
using System.Threading;
namespace TinyCLRApplication1
{
class Program
{
private static void Main()
{
GpioPin backlight = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PA15);
backlight.SetDriveMode(GpioPinDriveMode.Output);
backlight.Write(GpioPinValue.High);
var displayController = DisplayController.GetDefault();
// Enter the proper display configurations
displayController.SetConfiguration(new ParallelDisplayControllerSettings
{
Width = 480,
Height = 272,
DataFormat = DisplayDataFormat.Rgb565,
Orientation = DisplayOrientation.Degrees0, //Rotate display.
PixelClockRate = 10000000,
PixelPolarity = false,
DataEnablePolarity = false,
DataEnableIsFixed = false,
HorizontalFrontPorch = 2,
HorizontalBackPorch = 2,
HorizontalSyncPulseWidth = 41,
HorizontalSyncPolarity = false,
VerticalFrontPorch = 2,
VerticalBackPorch = 2,
VerticalSyncPulseWidth = 10,
VerticalSyncPolarity = false,
});
displayController.Enable(); //This line turns on the display I/O and starts
// refreshing the display. Native displays are
// continually refreshed automatically after this
// command is executed.
var screen = Graphics.FromHdc(displayController.Hdc);
var image = Resource1.GetBitmap(Resource1.BitmapResources.test1);
screen.Clear();
screen.DrawImage(image, 0, 0);
screen.Flush();
Thread.Sleep(-1);
}
}
}