vkb.led package¶
Submodules¶
vkb.led.effects module¶
Module contents¶
-
class
vkb.led.ColorMode[source]¶ Bases:
enum.IntEnumAn enumeration.
-
COLOR1= 0¶
-
COLOR1_d_2= 2¶
-
COLOR1_p_2= 4¶
-
COLOR2= 1¶
-
COLOR2_d_1= 3¶
-
-
class
vkb.led.LEDConfig(led: int, color_mode: int = 0, led_mode: int = 0, color1: str = None, color2: str = None)[source]¶ Bases:
objectAn configuration for an LED in a VKB device.
Setting the LEDs consists of a possible 30 LED configs each of which is a 4 byte structure as follows:
byte 0: LED ID bytes 2-4: a 24 bit color config as follows:
000 001 010 011 100 101 110 111 clm lem b2 g2 r2 b1 g1 r1
- color mode (clm):
- 0 - color1 1 - color2 2 - color1/2 3 - color2/1 4 - color1+2
- led mode (lem):
- 0 - off 1 - constant 2 - slow blink 3 - fast blink 4 - ultra fast
- Colors:
- VKB uses a simple RGB color configuration for all LEDs. Non-rgb LEDs will not light if you set their primary color to 0 in the color config. The LEDs have a very reduced color range due to VKB using 0-7 to determine the brightness of R, G, and B. LEDConfig takes in a standard hex color code and converts it into this smaller range, so color reproduction will not be accurate.
- Bytes:
Convert the LEDConfig to an appropriate binary representation by using bytes:
>>> led1 = LEDConfig(led=1, led_mode=LEDMode.CONSTANT) >>> bytes(led1)
b’x01x07px04’
Parameters:
-
class
vkb.led.LEDMode[source]¶ Bases:
enum.IntEnumAn enumeration.
-
CONSTANT= 1¶
-
FAST_BLINK= 3¶
-
OFF= 0¶
-
SLOW_BLINK= 2¶
-
ULTRA_BLINK= 4¶
-
-
vkb.led.get_led_configs(dev: <sphinx.ext.autodoc.importer._MockObject object at 0x7f241205e390>)[source]¶ Returns a list of
LEDConfig`s that have currently been set on the given `devHidDevice.Warning
This will only return LED configs that have been set into the device. Either with this library or with the test LED tool in VKBDevCfg. LED profiles that are configured normally are not retrieved in this manor and not configured the same way.
-
vkb.led.hex_color_to_vkb_color(hex_code: str) → [<class 'int'>][source]¶ Takes a hex formatted color and converts it to VKB color format.
>>> hex_color_to_led("#FF3300") [7, 1, 0]
Parameters: hex_code – Hex color code string to be converted to a VKB color code Returns: List of integers in a VKB LED color code format, [R, G, B]