dobova86 / TinyCLR_Port

TinyCLR Port for STM32F7xx
Apache License 2.0
0 stars 1 forks source link

Discovery F746 Display Graphics fails #2

Open weissar opened 6 years ago

weissar commented 6 years ago

Hello, I tried new simple Graphics APP on Discovery F476. Previous version (based on 0.10.0) works fine, but new one bsaed on 0.12.0 generates "'System.NotSupportedException' occurred in GHIElectronics.TinyCLR.Drawing.dll" ...

One things with these release - compiled version in \Build\DISCO-F746NG\ says version 0.9.0, so I compiled my one.

Testing code (with all nupkg 0.12.0 included):

` using GHIElectronics.TinyCLR.Devices.Display; using System.Drawing; using System.Threading;

namespace LCD_test_12 { class LCD_12_Program { static DisplayController _disp = null; static Graphics _gr = null;

static void InitDisplay()
{
  _disp = DisplayController.GetDefault();
  ParallelDisplayControllerSettings _settings = new ParallelDisplayControllerSettings()
  {
    Width = 480,
    Height = 272,
    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 // Must be RGB565
  };

  _disp.ApplySettings(_settings);
}

static void Main()
{
  int cnt = 0;

  InitDisplay();

  _disp.WriteString("\f* Discovery STM32F746 board *\n");
  _disp.WriteString("* TinyCLR 0.12.0 for STM32F7 *");

  _gr = Graphics.FromHdc(_disp.Hdc);   // emits NotSupportedException
  _gr.Clear(Color.Black);

  while (true)
  {
    cnt++;
    if (cnt >= 100)
      cnt = 0;

    _gr.Clear(Color.Black);
    _gr.FillRectangle(new SolidBrush(Color.Yellow), 0, cnt * 2, 480, 2);
    _gr.Flush();

    Thread.Sleep(100);
  }
}

} } ` Thanks for help Petr

dobova86 commented 6 years ago

I will check fw on Disco-F746 display and FromHDC() call ... thank you Do you see text strings by WriteString() on the display?

dobova86 commented 6 years ago

Ok, I found the problem https://forums.ghielectronics.com/t/next-step-in-porting-disc0-stm32f746/21197/101?u=dobova