void Draw(byte[][] data) { Console.WriteLine($" Drawing {data[0].Length * 8}x{data.Length}..."); Stopwatch sw = new Stopwatch(); sw.Start(); graphics.Clear(true); for (int y = 0; y < data.Length; y++) { // each line of data is a 1 bit bitmap graphics.DrawReverseBitmap(0, y, data[y].Length, 1, data[y], displayColor); } graphics.Show(); sw.Stop(); Console.WriteLine($" Draw took {sw.ElapsedMilliseconds / 1000.0}s"); }
void Initialize() { Console.WriteLine("Initializing..."); var config = new SpiClockConfiguration(48000, SpiClockConfiguration.Mode.Mode3); var spiBus = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config); display = new St7789( device: Device, spiBus: spiBus, chipSelectPin: null, dcPin: Device.Pins.D01, resetPin: Device.Pins.D00, width: (uint)displayWidth, height: (uint)displayHeight); // extended graphics library graphics = new GraphicsLibraryEx(display); graphics.Rotation = GraphicsLibrary.RotationType._270Degrees; graphics.CurrentFont = new Font12x20(); graphics.Clear(true); }