public MeadowApp() { Console.WriteLine("TftSpi sample"); Initialize(); Console.WriteLine("Clear"); display.Clear(); display.Show(); Console.WriteLine("Small rect"); graphics.Clear(); graphics.DrawRectangle(0, 0, 30, 30, Color.Azure, true); graphics.Show(); Thread.Sleep(1000); OverviewScreen(); Thread.Sleep(5000); while (true) { InvertTest(); PolarLineTest(); Thread.Sleep(5000); RoundRectTest(); Thread.Sleep(5000); QuadrantTest(); Thread.Sleep(5000); StrokeTest(); Thread.Sleep(5000); ShapeTest(); Thread.Sleep(5000); FontScaleTest(); Thread.Sleep(5000); ColorFontTest(); Thread.Sleep(5000); CircleTest(); Thread.Sleep(5000); } }
public TftSpiDisplayApp() { Console.WriteLine("TftSpi sample"); Console.WriteLine("Create Spi bus"); spiBus = Device.CreateSpiBus();// Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, 2000); Console.WriteLine("Create display driver instance"); display = new ST7789(device: Device, spiBus: spiBus, chipSelectPin: Device.Pins.D02, dcPin: Device.Pins.D01, resetPin: Device.Pins.D00, width: 240, height: 240); Console.WriteLine("Create graphics lib"); /* var graphicsLib = new GraphicsLibrary(display); * graphicsLib.CurrentFont = new Font8x8(); * * graphicsLib.Clear(); * * graphicsLib.DrawTriangle(10, 10, 50, 50, 10, 50, Meadow.Foundation.Color.Red); * * graphicsLib.DrawRectangle(20, 15, 40, 20, Meadow.Foundation.Color.Yellow, true); * * //graphicsLib.DrawCircle() * * graphicsLib.DrawText(5, 5, "Meadow F7 SPI"); * * graphicsLib.Show();*/ Console.WriteLine("Clear display"); display.ClearScreen(250); display.Refresh(); Console.WriteLine("Draw lines"); for (int i = 0; i < 30; i++) { display.DrawPixel(i, i, true); display.DrawPixel(30 + i, i, true); display.DrawPixel(60 + i, i, true); } display.Show(); }
void Benchmark() { display.SetPenColor(Color.BlueViolet); var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < 10; i++) { for (int x = 0; x < 240; x++) { for (int y = 0; y < 240; y++) { display.DrawPixel(x, y); } } display.Show(); } sw.Stop(); Console.WriteLine("Elapsed={0}", sw.Elapsed); }