private static void DisplayTestMode() { _max.SetDisplayTest(Max72197221.DisplayTestRegister.DisplayTestMode); Thread.Sleep(4000); _max.SetDisplayTest(Max72197221.DisplayTestRegister.NormalOperation); }
/*public static void SetPixel(int x, int y, bool color) { * if (x < 0 || x > WIDTH - 1 || y < 0 || y > HEIGHT - 1) * return; * y = 7 - y; * if(color) * vram[(x / 8) + (y * line.Length)] |= (byte)(1 << x % 8); * else * vram[(x / 8) + (y * line.Length)] &= (byte)(~(1 << x % 8)); * * }*/ private static void Main() { var chipSelect = GpioController.GetDefault().OpenPin(SC20100.GpioPin.PD3); var settings = new SpiConnectionSettings() { ChipSelectType = SpiChipSelectType.None, //ChipSelectLine = SC20100.GpioPin.PD3, Mode = SpiMode.Mode0, ClockFrequency = 4_000_000, //4Mhz DataBitLength = 8, }; var controller = SpiController.FromName(SC20100.SpiBus.Spi3); var device = controller.GetDevice(settings); //byte[] data = new byte[2]; //data[0] = 9; //data[1] = 0x0f; //device.Write(data) ledchip = new Max72197221(chipSelect, device); ledchip.SetDisplayTest(Max72197221.DisplayTestRegister.DisplayTestMode); Thread.Sleep(100); ledchip.SetDisplayTest(Max72197221.DisplayTestRegister.NormalOperation); Thread.Sleep(100); for (int x = 0; x < 20; x++) { ledchip.SetDecodeMode(Max72197221.DecodeModeRegister.NoDecodeMode); } for (int x = 0; x < 20; x++) { ledchip.SetDigitScanLimit(7); } for (int x = 0; x < 20; x++) { ledchip.SetIntensity(0x07); } for (int x = 0; x < 20; x++) { ledchip.Shutdown(Max72197221.ShutdownRegister.NormalOperation); } int v = 100; BasicDrawing pen = new BasicDrawing(WIDTH, HEIGHT); pen.ClearScreen(); while (true) { pen.ClearScreen(); pen.DrawText(v--, 0, "Stay at home!!!"); Flush(pen.vram); if (v < -100) { v = 100; } Thread.Sleep(50); } }