static void Main() { var leds = new WS2812(SC20260.GpioPin.PA0, NUM_LED); leds.SetColor(0, 0xFF, 0xFF, 0xFF); leds.SetColor(1, 0x00, 0xFF, 0xFF); leds.SetColor(2, 0x00, 0x00, 0xFF); leds.SetColor(24, 0xFF, 0xFF, 0xFF); leds.SetColor(23, 0x00, 0xFF, 0xFF); leds.SetColor(22, 0xFF, 0x00, 0x00); while (true) { leds.Draw(); } }
static void DrawBuffer(byte[] data) { var x = 0; for (var i = 0; i < data.Length; i += 2) { var color16 = (ushort)((data[i + 1] << 8) | data[i]); var r = (byte)(((color16 >> 11) & 0x1F) << 3); var g = (byte)(((color16 >> 5) & 0x3F) << 2); var b = (byte)(((color16 >> 0) & 0x1F) << 3); leds.SetColor(RemapLedMatrix(x), r, g, b); x++; } leds.Draw(); }