Main Site Documentation

TFT CP7 display?


#1

Hello

please anybody can let me know if the old display CP7 is again supported with the TinyCLR ?
http://old.ghielectronics.com/catalog/product/376

the tutorial http://docs.ghielectronics.com/tinyclr/tutorials/display.html is not clear (for me !)

if yes, thanks to share any init
regards


#2

It should work, yes. You’ll just need to pull the display configuration from NETMF. There is no native touch driver though so you’ll have to port the NETMF one over.


#3

pleases can you think a little bit about VB users? there is never any VB samples

all example, tutorial are in C#

i’m doping some test from http://old.ghielectronics.com/docs/34/graphics#3200
or http://docs.ghielectronics.com/tinyclr/tutorials/display.html
but unlucky for now

regards


#4

The conversion between C# and VB is pretty straightforward and there are many code converters available online that can freely change between the languages. That said, multi-language tutorials are something we’re keeping an eye on, but don’t have anything there at the moment.


#5

sure John, that’s not the biggest problem !
the link http://old.ghielectronics.com/docs/34/graphics#3200 is about NTMF and i can’t import
using GHI.Processor;
using Microsoft.SPOT.Hardware

so my question is a sample working with TinyCLR, even in C#, would be usefull !

thanks


#6

There’s a bit of information here http://docs.ghielectronics.com/tinyclr/tutorials/display.html as you saw.

Fonts work very similar to NETMF. Add one of the two NETMF fonts to your project as a resource. Then:

var screen = Graphics.FromHdc(displayController.Hdc);
var font = Resources.GetFont(Resources.FontResources.small);

screen.DrawString("Hello", font, new SolidBrush(Color.White), 0, 50);

#7

that’s the sample i try to use …
but unlucky, unable to translate
globally, i don’t find any help on the differents Namespaces :face_with_raised_eyebrow:


#8

Visual Studio and the solution explorer will help, no? What can’t you figure out ?


#9

although I use .NET for many years, I’m confused!!!

i can’t find the definition and translate the simple line
displayController.ApplySettings(new ParallelDisplayControllerSettings {
Width = 480,
Height = 272,
DataFormat = DisplayDataFormat.Rgb565,
PixelClockRate = 20000000,
PixelPolarity = false,
OutputEnablePolarity = true,
OutputEnableIsFixed = false,
HorizontalFrontPorch = 2,
HorizontalBackPorch = 2,
HorizontalSyncPulseWidth = 41,
HorizontalSyncPolarity = false,
VerticalFrontPorch = 2,
VerticalBackPorch = 2,
VerticalSyncPulseWidth = 10,
VerticalSyncPolarity = false,
});

i can only translate it to :
displayController.ApplySettings(New DisplayControllerSettings)
can’t set the parameters of the screen !!


#10

John,

please can you send me a short sample to write “hello world” on this CP7 screen ?
VB preferably !

thanks in advance, regards


#11
using System.Drawing;
using GHIElectronics.TinyCLR.Devices.Display;
using TinyCLRApplication23.Properties;

namespace TinyCLRApplication23
{
    class Program
    {
        static void Main()
        {

            var displayController = GHIElectronics.TinyCLR.Devices.Display.DisplayController.GetDefault();

            displayController.ApplySettings(new LcdControllerSettings
            {
                Width = 800,
                Height = 480,                
                HorizontalBackPorch = 2,
                HorizontalFrontPorch = 9,
                HorizontalSyncPolarity = false,
                HorizontalSyncPulseWidth = 41,
                OutputEnableIsFixed = false,
                OutputEnablePolarity = false,
                PixelClockRate = 15000000,
                PixelPolarity = false,
                VerticalBackPorch = 2,
                VerticalFrontPorch = 2,
                VerticalSyncPolarity = false,
                VerticalSyncPulseWidth = 10
            });

            var font = Resources.GetFont(Resources.FontResources.small);
            var screen = Graphics.FromHdc(displayController.Hdc);

            screen.Clear(Color.Black);

            screen.DrawString("White: Hello, world", font, new SolidBrush(Color.White), 10, 190);
            screen.DrawString("Red: Hello, world", font, new SolidBrush(Color.Red), 10, 210);
            screen.DrawString("Green: Hello, world", font, new SolidBrush(Color.Green), 10, 230);
            screen.DrawString("Blue: Hello, world", font, new SolidBrush(Color.Blue), 10, 250);

            screen.Flush();

            System.Threading.Thread.Sleep(-1);            
        }
    }
}

#12

thanks Sir, but as explain, i don’t find the good translation in VB !

event if i check the syntac in the object explorer, i can’t find how translate the lines

  • displayController.ApplySettings(new LcdControllerSettings … ==> no options possible !!

  • var font = Resources.GetFont(Resources.FontResources.small); ==> GetFont is not a member of the 'system.Ressources

please provide me this sample in VB !

thanks for your support, regards


#13

http://converter.telerik.com/ is a useful tool to convert C# to VB code. For GetFont, you need to add a font resource to your project. You can find two sample fonts in the NETMF install directory.


#14

well i successful compile the sample now, but nothing is showed on the screen.
i’m not sure about the setting, what you show is different from that page :
http://docs.ghielectronics.com/hardware/legacy_products/gadgeteer/modules.html#display-cp7

but on that page, it is write “// these are the wrong values!” …

so which setting is ok please ?

thanks


#15

Here is for CP7. The previous one is 7 inch NHV

using System.Drawing;
using GHIElectronics.TinyCLR.Devices.Display;
using TinyCLRApplication23.Properties;

namespace TinyCLRApplication23
{
    class Program
    {
        static void Main()
        {

            var displayController = GHIElectronics.TinyCLR.Devices.Display.DisplayController.GetDefault();

            displayController.ApplySettings(new LcdControllerSettings
            {
                 Width = 800,
                Height = 480,
                HorizontalBackPorch = 46,
                HorizontalFrontPorch = 16,
                HorizontalSyncPolarity = true,
                HorizontalSyncPulseWidth = 1,
                OutputEnableIsFixed = true,
                OutputEnablePolarity = true,
                PixelClockRate = 24000000,
                PixelPolarity = false,
                VerticalBackPorch = 23,
                VerticalFrontPorch = 7,
                VerticalSyncPolarity = true,
                VerticalSyncPulseWidth = 1 }
            );

            var font = Resources.GetFont(Resources.FontResources.small);
            var screen = Graphics.FromHdc(displayController.Hdc);

            screen.Clear(Color.Black);

            screen.DrawString("White: Hello, world", font, new SolidBrush(Color.White), 10, 190);
            screen.DrawString("Red: Hello, world", font, new SolidBrush(Color.Red), 10, 210);
            screen.DrawString("Green: Hello, world", font, new SolidBrush(Color.Green), 10, 230);
            screen.DrawString("Blue: Hello, world", font, new SolidBrush(Color.Blue), 10, 250);

            screen.Flush();

            System.Threading.Thread.Sleep(-1);            
        }
    }
}

#16

wonderful, working now !

thanks for your patience :o)

regards


#17

Glad you got it working!