public MeadowApp() { Console.WriteLine("TftSpi sample"); Console.WriteLine("Create Spi bus"); spiBus = Device.CreateSpiBus(3000); Console.WriteLine("Create display driver instance"); display = new Ssd1351(device: Device, spiBus: spiBus, chipSelectPin: Device.Pins.D02, dcPin: Device.Pins.D01, resetPin: Device.Pins.D00, width: 128, height: 128); Console.WriteLine("Create graphics lib"); var graphicsLib = new GraphicsLibrary(display); graphicsLib.CurrentFont = new Font8x12(); graphicsLib.Clear(); graphicsLib.DrawCircle(80, 80, 40, Meadow.Foundation.Color.Cyan, false); int indent = 0; int spacing = 10; int y = indent; graphicsLib.DrawText(indent, y, "Meadow F7 (SSD1351)"); graphicsLib.DrawText(indent, y += spacing, "Red", Meadow.Foundation.Color.Red); graphicsLib.DrawText(indent, y += spacing, "Purple", Meadow.Foundation.Color.Purple); graphicsLib.DrawText(indent, y += spacing, "BlueViolet", Meadow.Foundation.Color.BlueViolet); graphicsLib.DrawText(indent, y += spacing, "Blue", Meadow.Foundation.Color.Blue); graphicsLib.DrawText(indent, y += spacing, "Cyan", Meadow.Foundation.Color.Cyan); graphicsLib.DrawText(indent, y += spacing, "LawnGreen", Meadow.Foundation.Color.LawnGreen); graphicsLib.DrawText(indent, y += spacing, "GreenYellow", Meadow.Foundation.Color.GreenYellow); graphicsLib.DrawText(indent, y += spacing, "Yellow", Meadow.Foundation.Color.Yellow); graphicsLib.DrawText(indent, y += spacing, "Orange", Meadow.Foundation.Color.Orange); graphicsLib.DrawText(indent, y += spacing, "Brown", Meadow.Foundation.Color.Brown); Console.WriteLine("Show"); graphicsLib.Show(); Console.WriteLine("Show complete"); }
public RPSLSView(DisplayTftSpiBase controller) { this.controller = controller; Console.WriteLine("Load images"); LoadImages(); Console.WriteLine("Init graphics lib"); display = new GraphicsLibrary(controller); display.CurrentFont = new Font12x16(); //Draw static content display.Clear(); //black background display.DrawText(60, 10, "R.P.S.L.S.", White); display.DrawText(48, 290, "aka.ms/rpsls", White); }
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 InitializeHardware() { Console.WriteLine("Initialize hardware"); var spiBus = Device.CreateSpiBus(48000); Console.WriteLine($"SPI speed: {spiBus.Configuration.SpeedKHz}kHz"); display = new Ili9341(device: Device, spiBus: spiBus, chipSelectPin: Device.Pins.D13, dcPin: Device.Pins.D14, resetPin: Device.Pins.D15, width: 240, height: 320); Console.WriteLine("Init button"); // yellowButton = Device.CreateDigitalInputPort(Device.Pins.D04, InterruptMode.EdgeBoth, ResistorMode.Disabled, 400); // yellowButton.Changed += YellowButton_Changed; }
void Initialize() { Console.WriteLine("Create Spi bus"); var config = new SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode3); var spiBus = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config); 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"); graphics = new GraphicsLibrary(display); }
void Initialize() { Console.WriteLine("Create Spi bus"); var config = new SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode0); var spiBus = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config); Console.WriteLine("Create display driver instance"); display = new Hx8357b(device: Device, spiBus: spiBus, resetPin: Device.Pins.D00, dcPin: Device.Pins.D01, chipSelectPin: Device.Pins.D02, width: 320, height: 480, displayColorMode: DisplayColorMode.Format16bppRgb565); Console.WriteLine("Create graphics lib"); graphics = new GraphicsLibrary(display); Console.WriteLine("Init complete"); }
public MeadowApp() { Console.WriteLine("TftSpi sample"); Console.WriteLine("Create Spi bus"); var config = new SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode3); spiBus = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config); 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 Font8x12(); graphicsLib.Clear(); graphicsLib.DrawTriangle(120, 20, 200, 100, 120, 100, Meadow.Foundation.Color.Red, false); graphicsLib.DrawRectangle(140, 30, 40, 90, Meadow.Foundation.Color.Yellow, false); graphicsLib.DrawCircle(160, 80, 40, Meadow.Foundation.Color.Cyan, false); int indent = 5; int spacing = 14; int y = indent; graphicsLib.DrawText(indent, y, "Meadow F7 SPI ST7789!!"); graphicsLib.DrawText(indent, y += spacing, "Red", Meadow.Foundation.Color.Red); graphicsLib.DrawText(indent, y += spacing, "Purple", Meadow.Foundation.Color.Purple); graphicsLib.DrawText(indent, y += spacing, "BlueViolet", Meadow.Foundation.Color.BlueViolet); graphicsLib.DrawText(indent, y += spacing, "Blue", Meadow.Foundation.Color.Blue); graphicsLib.DrawText(indent, y += spacing, "Cyan", Meadow.Foundation.Color.Cyan); graphicsLib.DrawText(indent, y += spacing, "LawnGreen", Meadow.Foundation.Color.LawnGreen); graphicsLib.DrawText(indent, y += spacing, "GreenYellow", Meadow.Foundation.Color.GreenYellow); graphicsLib.DrawText(indent, y += spacing, "Yellow", Meadow.Foundation.Color.Yellow); graphicsLib.DrawText(indent, y += spacing, "Orange", Meadow.Foundation.Color.Orange); graphicsLib.DrawText(indent, y += spacing, "Brown", Meadow.Foundation.Color.Brown); graphicsLib.Show(); Console.WriteLine("Show complete"); }