コード例 #1
0
        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");
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        void Initialize()
        {
            Console.WriteLine("Create Spi bus");

            var config = new SpiClockConfiguration(24000, 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, //D14,
                                 dcPin: Device.Pins.D01,         //D03,
                                 resetPin: Device.Pins.D00,      //D04,
                                 width: 240, height: 240, displayColorMode: DisplayColorMode.Format12bppRgb444);

            Console.WriteLine("Create graphics lib");

            graphics = new GraphicsLibrary(display);
            //graphics.Rotation = GraphicsLibrary.RotationType._180Degrees;

            Console.WriteLine("Init complete");
        }
コード例 #4
0
 public SpriteWorker(BitArray s1, BitArray s2, int width, int height, int speed, Color color, TftSpiBase display)
 {
     S1           = s1;
     S2           = s2;
     this.speed   = speed;
     this.color   = color;
     this.width   = width;
     this.height  = height;
     posx         = 0;
     posy         = 0;
     this.display = display;
 }