예제 #1
0
        // 21x7 LEDs in board, 2 rows at a time
        public static byte[] GetUsbPackets(LedBrightness ledBrightness, byte startingRow, byte b0, byte b1, byte b2, byte b3, byte b4, byte b5)
        {
            if (startingRow != 0
                && startingRow != 2
                && startingRow != 4
                && startingRow != 6)
                throw new ArgumentException("startingRow must be one of 0, 2, 4, or 6");

            byte brightness = (byte)ledBrightness;

            // need to reverse the order of the bits in each byte
            b0 = BitUtil.Reverse(b0);
            b1 = BitUtil.Reverse(b1);
            b2 = BitUtil.Reverse(b2);
            b3 = BitUtil.Reverse(b3);
            b4 = BitUtil.Reverse(b4);
            b5 = BitUtil.Reverse(b5);

            byte[] data = new byte[] {
                0x00, // padding?
                brightness, startingRow,
                b2, b1, b0,
                b5, b4, b3,
            };

            return data;
        }
예제 #2
0
 public void SetBrightness([FromBody] LedBrightness brightness)
 {
     Program.KillAllThreads();
     Program.SetBrightness(brightness.brightness);
 }
예제 #3
0
 /// <summary>
 /// Controls the backlight brightness of the entire keyboard.
 /// </summary>
 /// <param name="brightness">The brightness level requested</param>
 public void SetLedBrightness( LedBrightness brightness )
 {
     Send(0x40, 0x31, (int)brightness, 0);
 }
예제 #4
0
 /// <summary>
 /// Controls the backlight brightness of the entire keyboard.
 /// </summary>
 /// <param name="brightness">The brightness level requested</param>
 public void SetLedBrightness(LedBrightness brightness)
 {
     Send(0x40, 0x31, (int)brightness, 0);
 }