コード例 #1
0
ファイル: test.cs プロジェクト: Arakis/TamaniChess
		public void ledDemo() {
			Console.WriteLine("led demo");
			var hw = new TIOHardware();
			hw.init();

			for (var y = 0; y < 9; y++) {
				hw.clearBoardLeds();
				for (var x = 0; x < 9; x++) {
					hw.ledBitArray[x, y] = true;
				}
				hw.updateLeds();
				System.Threading.Thread.Sleep(1000);
			}

			for (var x = 0; x < 9; x++) {
				hw.clearBoardLeds();
				for (var y = 0; y < 9; y++) {
					hw.ledBitArray[x, y] = true;
				}
				hw.updateLeds();
				System.Threading.Thread.Sleep(1000);
			}

		}
コード例 #2
0
ファイル: temp.cs プロジェクト: Arakis/TamaniChess
		public void start() {
			//var cmdThread = new TCommandLineThread();
			//cmdThread.start();

			Console.WriteLine("starte test");
			//testFunc();
			Console.WriteLine("beende test");

			var bits = larne.io.ic.IOUtils.getBits(1);
			foreach (var bit in bits) Console.Write(bit ? 1 : 0);
			Console.WriteLine();
			//var bytes = larne.io.ic.IOUtils.ToByteArray(bits);
			//foreach (var b in bytes) Console.WriteLine(b);
			//Console.WriteLine() ;

			var device = new RPI();

			//var D16_SDI = new GPIOMem(GPIOPins.V2_GPIO_25, GPIODirection.Out, false);
			//var D17_CLK = new GPIOMem(GPIOPins.V2_GPIO_08, GPIODirection.Out, false);
			//var CS = new GPIOMem(GPIOPins.V2_GPIO_07, GPIODirection.Out, false);

			//var RST = device.createPin(GPIOPins.V2_GPIO_23, GPIODirection.Out, false);
			//var RS = new GPIOMem(GPIOPins.V2_GPIO_24, GPIODirection.Out, false);

			//---

			//var D16_SDI = new GPIOMem(GPIOPins.V2_GPIO_10, GPIODirection.Out, false);
			//var D17_CLK = new GPIOMem(GPIOPins.V2_GPIO_11, GPIODirection.Out, false);
			//var CS = new GPIOMem(GPIOPins.V2_GPIO_08, GPIODirection.Out, false);

			//var RST = device.createPin(GPIOPins.V2_GPIO_18, GPIODirection.Out, false);
			//var RS = new GPIOMem(GPIOPins.V2_GPIO_04, GPIODirection.Out, false);

			//var spi = new TSPIEmulator(D16_SDI, null, D17_CLK, CS);
			var rnd = new Random();
			var watch = new System.Diagnostics.Stopwatch();

			//var bus = new TOLEDSPIFastDataBus(spi, RST, RS);
			//var lcd = new TOLEDDisplay(bus);

			var hw = new TIOHardware();
			hw.init();
			hw.displayPowerOn();

			var lcd = hw.lcd;
			lcd.background(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)));

			lcd.orientation(3);

			var bg = (Bitmap)Image.FromFile(chess.shared.Config.applicationPath + "tmp/test.bmp");

			//lcd.drawImage(bmp, 0, 0, bmp.Width, bmp.Height);
			lcd.cls();

			adapter = new TOLEDDisplayAdapter(lcd);
			//adapter.update(bg, 0, 0, lcd.width, lcd.height);

			var bmp = new Bitmap(lcd.width, lcd.height);
			var gfx = Graphics.FromImage(bmp);
			gfx.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
			gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;

			var st = new List<string>();
			st.Add("Erster Eintrag");
			st.Add("Zweiter Eintrag");
			st.Add("Dritter Eintrag");
			st.Add("Vierter Eintrag");
			st.Add("Fünfter Eintrag");
			st.Add("Sechster Eintrag");
			st.Add("Siebter Eintrag");
			st.Add("Achter Eintrag");
			st.Add("Neunter Eintrag");
			st.Add("Zehnter Eintrag");
			//lcd.debug();
			lcd.fill(40, 10, 20, 30, Color.Red.ToArgb());
			//Console.ReadLine();

			while (true) {
				CommandLineThread.processEvents(onConsoleLine);
				//gfx.Clear(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)));
				gfx.DrawImage(bg, 0, 0);

				st.Add(st[0]);
				st.RemoveAt(0);
				//gfx.DrawString(string.Join("\n", st.ToArray()), new Font(FontFamily.GenericSansSerif, 11), new SolidBrush(Color.DarkBlue), new PointF(0, 0));

				gfx.DrawString("S", new Font(FontFamily.GenericSansSerif, 18), new SolidBrush(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255))), new PointF(rnd.Next(120) - 10, rnd.Next(130) - 10));

				watch.Restart();
				adapter.update(bmp, 0, 0, lcd.width, lcd.height);
				//lcd.background(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)));
				//lcd.cls();
				Console.WriteLine(watch.ElapsedMilliseconds);
				System.Threading.Thread.Sleep(400);
			}
			Console.ReadLine();
		}
コード例 #3
0
ファイル: test.cs プロジェクト: Arakis/TamaniChess
		public void allLEDsOn() {
			var hw = new TIOHardware();
			hw.init();
			hw.loadingLED = false;
			for (var y = 0; y < 9; y++) {
				for (var x = 0; x < 9; x++) {
					hw.ledBitArray[x, y] = true;
				}
			}
			hw.updateLeds();
		}