/// <summary>Constructs a new instance.</summary> /// <param name="DigitalPin9onGSocket">Pin 9 on Socket G.</param> public void ConfigureDisplay() { display = DisplayController.GetDefault(); var controllerSetting = new GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings { Width = 480, Height = 272, DataFormat = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565, PixelClockRate = 10000000, PixelPolarity = false, DataEnablePolarity = false, DataEnableIsFixed = false, HorizontalFrontPorch = 2, HorizontalBackPorch = 2, HorizontalSyncPulseWidth = 41, HorizontalSyncPolarity = false, VerticalFrontPorch = 2, VerticalBackPorch = 2, VerticalSyncPulseWidth = 10, VerticalSyncPolarity = false, }; display.SetConfiguration(controllerSetting); display.Enable(); Screen = Graphics.FromHdc(display.Hdc); //Calling flush on the object returned will flush to the display represented by Hdc. Only one active display is supported at this time. var ptr = Memory.UnmanagedMemory.Allocate(640 * 480 * 2); var data = Memory.UnmanagedMemory.ToBytes(ptr, 640 * 480 * 2); }
public static void Main() { UCMStandard.SetModel(UCMModel.UC5550); var gpioController = GpioController.GetDefault(); var displayController = DisplayController.GetDefault(); var backlight = gpioController.OpenPin(UCMStandard.GpioPin.A); backlight.SetDriveMode(GpioPinDriveMode.Output); backlight.Write(GpioPinValue.High); displayController.SetConfiguration(new ParallelDisplayControllerSettings { Width = 800, Height = 480, DataFormat = DisplayDataFormat.Rgb565, HorizontalBackPorch = 46, HorizontalFrontPorch = 16, HorizontalSyncPolarity = false, HorizontalSyncPulseWidth = 1, DataEnableIsFixed = false, DataEnablePolarity = false, PixelClockRate = 24_000_000, PixelPolarity = false, VerticalBackPorch = 23, VerticalFrontPorch = 7, VerticalSyncPolarity = false, VerticalSyncPulseWidth = 1 });
public DisplayTest() { _display = DisplayController.GetDefault(); ParallelDisplayControllerSettings _settings = new ParallelDisplayControllerSettings() { Width = 800, Height = 480, PixelClockRate = 9600000, // not used in native code PixelPolarity = false, //OutputEnablePolarity = true, // this must be true //OutputEnableIsFixed = true, HorizontalFrontPorch = 8, HorizontalBackPorch = 43, HorizontalSyncPulseWidth = 2, HorizontalSyncPolarity = false, VerticalFrontPorch = 2, VerticalBackPorch = 2, VerticalSyncPulseWidth = 10, VerticalSyncPolarity = false, DataFormat = DisplayDataFormat.Rgb565 // not really correct: it is Rgb888 for Disco-746 display... }; _display.SetConfiguration(_settings); _display.DrawString("\f\n\n* Discovery STM32F69 board *\n\n"); _display.DrawString("* TinyCLR 1.0.0 pvw for STM32F7 *"); _screen = Graphics.FromHdc(_display.Hdc); }
static void Main() { var backlight = GpioController.GetDefault().OpenPin(G120E.GpioPin.P3_17); backlight.SetDriveMode(GpioPinDriveMode.Output); backlight.Write(GpioPinValue.Low); var displayController = DisplayController.GetDefault(); // Enter the proper display configurations displayController.SetConfiguration(new ParallelDisplayControllerSettings { Width = 320, Height = 240, DataFormat = DisplayDataFormat.Rgb565, PixelClockRate = 15_000_000, PixelPolarity = false, DataEnablePolarity = true, DataEnableIsFixed = true, HorizontalFrontPorch = 51, HorizontalBackPorch = 27, HorizontalSyncPulseWidth = 41, HorizontalSyncPolarity = false, VerticalFrontPorch = 16, VerticalBackPorch = 8, VerticalSyncPulseWidth = 10, VerticalSyncPolarity = false, });
/// <summary>Constructs a new instance.</summary> /// <param name="DigitalPin9onGSocket">Pin 9 on Socket G.</param> public DisplayT35(int DigitalPin9onGSocket) { var controller = GpioController.GetDefault(); this.backlightPin = controller.OpenPin(DigitalPin9onGSocket); this.backlightPin.SetDriveMode(GpioPinDriveMode.Output); this.BacklightEnabled = true; var displayController = DisplayController.GetDefault(); //Currently returns the hardware LCD controller by default //Enables the display displayController.ApplySettings(new ParallelDisplayControllerSettings { Width = ScreenWidth, Height = ScreenHeight, PixelClockRate = 16625, PixelPolarity = true, OutputEnablePolarity = true, OutputEnableIsFixed = true, HorizontalFrontPorch = 51, HorizontalBackPorch = 29, // Was 27 causing 2 pixel shift x axis HorizontalSyncPulseWidth = 41, HorizontalSyncPolarity = false, VerticalFrontPorch = 16, VerticalBackPorch = 3, // Was 8 VerticalSyncPulseWidth = 10, VerticalSyncPolarity = false, }); Screen = Graphics.FromHdc(displayController.Hdc); //Calling flush on the object returned will flush to the display represented by Hdc. Only one active display is supported at this time. }
static void Main() { var gpioController = GpioController.GetDefault(); // Turn backlight on var backlight = gpioController.OpenPin(SC20260.GpioPin.PA15); backlight.SetDriveMode(GpioPinDriveMode.Output); backlight.Write(GpioPinValue.High); // Init display controller var displayController = DisplayController.GetDefault(); displayController.SetConfiguration(new GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings { Width = 480, Height = 272, DataFormat = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565, 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(); // Draw on screen var screen = Graphics.FromHdc(displayController.Hdc); screen.Clear(); screen.FillEllipse(new SolidBrush(Color.FromArgb(100, 0xFF, 0, 0)), 0, 0, 100, 100); screen.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 0, 0xFF)), 0, 100, 100, 100); screen.DrawEllipse(new Pen(Color.Blue), 100, 0, 100, 100); screen.DrawRectangle(new Pen(Color.Red), 0, 0, 100, 100); screen.DrawLine(new Pen(Color.Green, 5), 250, 0, 220, 240); screen.Flush(); // Init Touch var i2cController = I2cController.FromName(SC20260.I2cBus.I2c1); var silead = new GSL1680Controller(i2cController, GpioController.GetDefault().OpenPin(SC20260.GpioPin.PJ14)); silead.CursorChanged += Silead_CusorChanged; Thread.Sleep(-1); }
static void InitLcd() { const int Backlight = SC20260.GpioPin.PA15; var backlight = GpioController.GetDefault().OpenPin(Backlight); backlight.SetDriveMode(GpioPinDriveMode.Output); backlight.Write(GpioPinValue.Low); Thread.Sleep(100); backlight.Write(GpioPinValue.High); var displayController = DisplayController.GetDefault(); var controllerSetting = new GHIElectronics.TinyCLR.Devices.Display.ParallelDisplayControllerSettings { Width = 480, Height = 272, DataFormat = GHIElectronics.TinyCLR.Devices.Display.DisplayDataFormat.Rgb565, 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.SetConfiguration(controllerSetting); displayController.Enable(); screen = Graphics.FromHdc(displayController.Hdc); font = Resources.GetFont(Resources.FontResources.NinaB); }
static void initialScreen() { var displayController = DisplayController.GetDefault(); // Enter the proper display configurations displayController.SetConfiguration(new ParallelDisplayControllerSettings { Width = 480, Height = 272, DataFormat = DisplayDataFormat.Rgb565, PixelClockRate = 20000000, PixelPolarity = false, DataEnablePolarity = true, DataEnableIsFixed = false, HorizontalFrontPorch = 2, HorizontalBackPorch = 2, HorizontalSyncPulseWidth = 41, HorizontalSyncPolarity = false, VerticalFrontPorch = 2, VerticalBackPorch = 2, VerticalSyncPulseWidth = 10, VerticalSyncPolarity = false, }); displayController.Enable(); screen = Graphics.FromHdc(displayController.Hdc); screen.Clear(Color.Black); screen.DrawImage(Resource2.GetBitmap(Resource2.BitmapResources.randall3hrs), 300, 0); screen.DrawString("Abdullahs crappy game", font2, new SolidBrush(Color.Red), 20, 40); screen.DrawString("To: ", font2, new SolidBrush(Color.Blue), 20, 20); screen.DrawString("Welcome", font2, new SolidBrush(Color.Yellow), 20, 0); screen.DrawString("Click UP to play", font2, new SolidBrush(Color.Green), 20, 100); screen.DrawString("Click DOWN to view highscores ", font2, new SolidBrush(Color.Green), 20, 120); screen.DrawString("Click RIGHT for about", font2, new SolidBrush(Color.Green), 20, 140); screen.DrawString("Click LEFT for instructions", font2, new SolidBrush(Color.Green), 20, 160); screen.Flush(); }
/// <summary>Constructs a new instance.</summary> /// <param name="DigitalPin9onGSocket">Pin 9 on Socket G.</param> public void ConfigureDisplay() { var displayController = DisplayController.GetDefault(); //Currently returns the hardware LCD controller by default if (DisplayType == DisplayTypes.Display7inch) { //Enables the display displayController.ApplySettings(new LcdControllerSettings { Width = 800, Height = 480, PixelClockRate = 20000, PixelPolarity = false, OutputEnablePolarity = true, OutputEnableIsFixed = false, HorizontalFrontPorch = 40, HorizontalBackPorch = 88, HorizontalSyncPulseWidth = 48, HorizontalSyncPolarity = false, VerticalFrontPorch = 13, VerticalBackPorch = 32, VerticalSyncPulseWidth = 3, VerticalSyncPolarity = false, }); /* * UsesCommonSyncPin = false, //not the proper property, but we needed it for OutputEnableIsFixed * CommonSyncPinIsActiveHigh = true, //not the proper property, but we needed it for OutputEnablePolarity * PixelDataIsValidOnClockRisingEdge = false, * MaximumClockSpeed = 20000, * HorizontalSyncPulseIsActiveHigh = false, * HorizontalSyncPulseWidth = 48, * HorizontalBackPorch = 88, * HorizontalFrontPorch = 40, * VerticalSyncPulseIsActiveHigh = false, * VerticalSyncPulseWidth = 3, * VerticalBackPorch = 32, * VerticalFrontPorch = 13, * 800, 480 */ } else if (DisplayType == DisplayTypes.Display43Inch) { displayController.ApplySettings(new LcdControllerSettings { Width = 480, Height = 272, PixelClockRate = 20000, PixelPolarity = false, OutputEnablePolarity = true, OutputEnableIsFixed = false, HorizontalFrontPorch = 2, HorizontalBackPorch = 2, HorizontalSyncPulseWidth = 41, HorizontalSyncPolarity = false, VerticalFrontPorch = 2, VerticalBackPorch = 2, VerticalSyncPulseWidth = 10, VerticalSyncPolarity = false, }); /* * UsesCommonSyncPin = false, //not the proper property, but we needed it for OutputEnableIsFixed * CommonSyncPinIsActiveHigh = true, //not the proper property, but we needed it for OutputEnablePolarity * PixelDataIsValidOnClockRisingEdge = false, * MaximumClockSpeed = 20000, * HorizontalSyncPulseIsActiveHigh = false, * HorizontalSyncPulseWidth = 41, * HorizontalBackPorch = 2, * HorizontalFrontPorch = 2, * VerticalSyncPulseIsActiveHigh = false, * VerticalSyncPulseWidth = 10, * VerticalBackPorch = 2, * VerticalFrontPorch = 2, * 480, 272, */ } Screen = Graphics.FromHdc(displayController.Hdc); //Calling flush on the object returned will flush to the display represented by Hdc. Only one active display is supported at this time. }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors public Application() : this(DisplayController.GetDefault()) { }
static void Main() { var displayController = DisplayController.GetDefault(); var font = Resource1.GetFont(Resource1.FontResources.Ariel72); // Enter the proper display configurationsok displayController.SetConfiguration(new ParallelDisplayControllerSettings { Width = 480, Height = 272, DataFormat = DisplayDataFormat.Rgb565, PixelClockRate = 20000000, PixelPolarity = false, DataEnablePolarity = true, DataEnableIsFixed = false, HorizontalFrontPorch = 2, HorizontalBackPorch = 2, HorizontalSyncPulseWidth = 41, HorizontalSyncPolarity = false, VerticalFrontPorch = 2, VerticalBackPorch = 2, VerticalSyncPulseWidth = 10, VerticalSyncPolarity = false, }); displayController.Enable(); screen = Graphics.FromHdc(displayController.Hdc); var GreenPen = new Pen(Color.Green); // Start Drawing (to memroy) screen.Clear(Color.Black); //screen.DrawEllipse(GreenPen, 10, 10, 20, 10); screen.DrawString("Kunal", font, new SolidBrush(Color.Yellow), 20, 20); screen.DrawString("Mukherjee", font, new SolidBrush(Color.Yellow), 20, 100); screen.DrawString("EE 356", font, new SolidBrush(Color.Blue), 20, 180); // Flush the memory to the display. This is a very fast operation. screen.Flush(); GpioPin padUp = GpioController.GetDefault().OpenPin( GHIElectronics.TinyCLR.Pins.G400D.GpioPin.PA24); GpioPin padDown = GpioController.GetDefault().OpenPin( GHIElectronics.TinyCLR.Pins.G400D.GpioPin.PA4); GpioPin padRight = GpioController.GetDefault().OpenPin( GHIElectronics.TinyCLR.Pins.G400D.GpioPin.PD9); GpioPin padLeft = GpioController.GetDefault().OpenPin( GHIElectronics.TinyCLR.Pins.G400D.GpioPin.PD7); int locationY = 272 / 2; while (padUp.Read() != 0) { Thread.Sleep(100); } while (true) { if (win == 0) { if (padUp.Read() == 0) { if (locationY > (0 + 5)) { locationY -= 2; } } else if (padDown.Read() == 0) { if (locationY < (272 - 20)) { locationY += 2; } } Thread.Sleep(33); //33 UpdateScreen(locationY); score++; } else { showScore(); score = 1; win = 0; locationY = 272 / 2; initialRandom(); updateCavern(); while (padLeft.Read() != 0) { Thread.Sleep(100); } UpdateScreen(locationY); } } }
/// <summary>Sets the output type and resolution and the mainboard's configuration.</summary> /// <param name="resolution">The desired output type and resolution.</param> /// <remarks>This method must be called to change the resolution. Setting the processor's display configuration is not enough.</remarks> public void SetDisplayConfiguration(Resolution resolution) { switch (resolution) { case Resolution.Rca320x240: this.currentWidth = 320; this.currentHeight = 240; this.Write320x240RcaRegisters(); break; case Resolution.Rca640x480: this.currentWidth = 640; this.currentHeight = 480; this.Write640x480RcaRegisters(); break; case Resolution.Rca800x600: this.currentWidth = 800; this.currentHeight = 600; this.Write800x600RcaRegisters(); break; case Resolution.Vga320x240: this.currentWidth = 320; this.currentHeight = 240; this.Write320x240VgaRegisters(); break; case Resolution.Vga640x480: this.currentWidth = 640; this.currentHeight = 480; this.Write640x480VgaRegisters(); break; case Resolution.Vga800x600: this.currentWidth = 800; this.currentHeight = 600; this.Write800x600VgaRegisters(); break; case Resolution.RcaPal320x240: this.currentWidth = 320; this.currentHeight = 240; this.Write320x240RcaPalRegisters(); break; } var displayController = DisplayController.GetDefault(); //Currently returns the hardware LCD controller by default displayController.ApplySettings(new ParallelDisplayControllerSettings { Width = this.currentWidth, Height = this.currentHeight, PixelClockRate = 10000, PixelPolarity = false, // OutputEnablePolarity = false, // OutputEnableIsFixed = false, // HorizontalFrontPorch = 10, HorizontalBackPorch = 10, HorizontalSyncPulseWidth = 10, HorizontalSyncPolarity = true,// VerticalFrontPorch = 10, VerticalBackPorch = 10, VerticalSyncPulseWidth = 10, VerticalSyncPolarity = true }); Screen = Graphics.FromHdc(displayController.Hdc); //Calling flush on the object returned will flush to the display represented by Hdc. Only one active display is supported at this time. /* * var config = new DisplayModule.TimingRequirements() { * PixelDataIsActiveHigh = true, //not the proper property, but we needed it for PriorityEnable * UsesCommonSyncPin = false, //not the proper property, but we needed it for OutputEnableIsFixed * CommonSyncPinIsActiveHigh = false, //not the proper property, but we needed it for OutputEnablePolarity * HorizontalSyncPulseIsActiveHigh = true, * VerticalSyncPulseIsActiveHigh = true, * PixelDataIsValidOnClockRisingEdge = false, * HorizontalSyncPulseWidth = 10, * HorizontalBackPorch = 10, * HorizontalFrontPorch = 10, * VerticalSyncPulseWidth = 10, * VerticalBackPorch = 10, * VerticalFrontPorch = 10, * MaximumClockSpeed = 10000 * }; */ //base.OnDisplayConnected("Video Out", this.currentWidth, this.currentHeight, DisplayOrientation.Normal, config); Thread.Sleep(1000); var ud = ReadRegister(0x00); if (ud != 0x55 && ud != 0x54) { this.ErrorPrint("Setting the display configuration failed."); } }