public async void DisplayUpdate() { //Task.Start(() => { if (drawQueue.Count != 0) { CDrawInstruction di = drawQueue.Dequeue(); doInstruction(di); } //}); }
public void DrawPixelTEMP(uint x, uint y, uint color) { if ((x < 0) || (x >= screenwidth) || (y < 0) || (y >= screenheight)) { return; } CDrawInstruction di = new CDrawInstruction(x, y, 1, 1); byte hicolor = (byte)(color >> 8); byte locolor = (byte)(color & 0xff); di.data = new byte[] { hicolor, locolor };; drawQueue.Enqueue(di); //Task.Run(() => doInstruction(di)); }
/**** ---- temp to try out **/ public void DrawFillRectTEMP(uint x, uint y, uint w, uint h, uint color) { if ((x >= screenwidth) || (y >= screenheight)) { return; } if ((x + w - 1) >= screenwidth) { w = screenwidth - x; } if ((y + h - 1) >= screenheight) { h = screenheight - y; } if (w < 0 | h < 0) { return; } /*for (y = h; y > 0; y--) * { * for (x = w; x > 0; x--) * { * //PushColor(color); * PushColorTEMP(x, y, color); * } * }*/ CDrawInstruction di = new CDrawInstruction(x, y, w, h); byte[] data = new byte[w * h * 2]; byte hicolor = (byte)(color >> 8); byte locolor = (byte)(color & 0xff); for (int i = 0; i < w * h; i++) { data[i * 2] = hicolor; data[(i * 2) + 1] = locolor; } di.data = data; drawQueue.Enqueue(di); //Task.Run(() => doInstruction(di)); }
private void doInstruction(CDrawInstruction di) { addressSet((uint)di.x, (uint)di.y, (uint)(di.w - 1 + di.x), (uint)(di.h - 1 + di.y)); DisplaySendData(di.data); /* Send the data over SPI */ //Debug.WriteLine(di); }