RGB fix
small RGB touchup convert boards to extensions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -8,3 +9,6 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.D9, board.D10, board.D11, board.D12, board.D13, board.SCL)
|
||||
row_pins = (board.A3, board.A4, board.A5, board.SCK, board.MOSI)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
||||
layers_ext = Layers()
|
||||
extensions = [layers_ext]
|
||||
|
@@ -1,5 +1,7 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -28,3 +30,6 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
rgb_pixel_pin = board.D9
|
||||
rgb_num_pixels = 12
|
||||
rgb_ext = RGB(pixel_pin=board.TX, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
extensions = [rgb_ext, layers_ext]
|
||||
|
@@ -1,5 +1,7 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -18,3 +20,7 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
rgb_pixel_pin = board.TX
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=9)
|
||||
layers_ext = Layers()
|
||||
extensions = [rgb_ext, layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -13,3 +16,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
split_type = 'UART'
|
||||
split_flip = True
|
||||
split_offsets = [7, 7, 7, 7]
|
||||
|
||||
rgb_ext = RGB(pixel_pin=board.TX, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -13,3 +16,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
split_type = 'UART'
|
||||
split_flip = True
|
||||
split_offsets = [6, 6, 6, 6, 6]
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
from kmk.matrix import intify_coordinate as ic
|
||||
@@ -41,3 +44,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
|
||||
# And now, to handle R4, which at this point is down to just six keys
|
||||
coord_mapping.extend(ic(4, x) for x in range(3, 9))
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,7 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -26,3 +28,7 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
rgb_pixel_pin = board.D13
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
extensions = [rgb_ext, layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -13,3 +16,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
split_type = 'UART'
|
||||
split_flip = True
|
||||
split_offsets = [6, 6, 6, 6]
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -16,3 +19,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
extra_data_pin = board.SDA
|
||||
rgb_pixel_pin = board.TX
|
||||
# led_pin = board.D7
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -10,6 +13,12 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
rgb_pixel_pin = board.TX
|
||||
uart_pin = board.SCL
|
||||
extra_data_pin = board.SDA
|
||||
split_type = 'UART'
|
||||
split_flip = True
|
||||
split_offsets = [6, 6, 6, 6, 6]
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -18,18 +18,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
uart_pin = board.SCL
|
||||
rgb_pixel_pin = board.TX
|
||||
extra_data_pin = board.SDA
|
||||
rgb_ext = RGB(
|
||||
pixel_pin=board.TX,
|
||||
num_pixels=12,
|
||||
val_limit=150,
|
||||
hue_step=10,
|
||||
sat_step=5,
|
||||
val_step=5,
|
||||
hue_default=260,
|
||||
sat_default=100,
|
||||
val_default=40,
|
||||
animation_speed=1,
|
||||
)
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=board.SCL, split_offsets=[6, 6, 6, 6, 6])
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,25 +0,0 @@
|
||||
import board
|
||||
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
# Will need additional work and testing
|
||||
col_pins = (
|
||||
board.A1,
|
||||
board.A2,
|
||||
board.A3,
|
||||
board.A4,
|
||||
board.A5,
|
||||
board.SCK,
|
||||
board.MOSI,
|
||||
board.D12,
|
||||
)
|
||||
row_pins = (board.A0, board.D13, board.D11, board.D10, board.D9, board.D7)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
rgb_pixel_pin = board.TX
|
||||
uart_pin = board.SCL
|
||||
split_type = 'UART'
|
||||
split_flip = False
|
||||
split_offsets = [8, 8, 8, 8, 8, 8]
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -13,3 +16,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
split_type = 'UART'
|
||||
split_flip = True
|
||||
split_offsets = [6, 6, 6, 6, 6]
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -27,3 +28,5 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
board.D13,
|
||||
)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
layers_ext = Layers()
|
||||
extensions = [layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -13,3 +16,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
split_type = 'UART'
|
||||
split_flip = True
|
||||
split_offsets = [7, 7, 7, 7, 7]
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -13,3 +16,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
split_type = 'UART'
|
||||
split_flip = True
|
||||
split_offsets = [7, 7, 7, 7, 7]
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -13,3 +16,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
split_type = 'UART'
|
||||
split_flip = True
|
||||
split_offsets = [6, 6, 6, 6]
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
|
||||
@@ -13,3 +16,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
split_type = 'UART'
|
||||
split_flip = True
|
||||
split_offsets = [6, 6, 6, 6]
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
from kmk.matrix import intify_coordinate as ic
|
||||
@@ -40,3 +41,6 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
coord_mapping.extend(ic(1, x) for x in range(12))
|
||||
coord_mapping.extend(ic(2, x) for x in range(12))
|
||||
coord_mapping.extend(ic(3, r3_swap(x)) for x in range(12))
|
||||
|
||||
layers_ext = Layers()
|
||||
extensions = [layers_ext]
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.extensions.split import Split
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
from kmk.matrix import intify_coordinate as ic
|
||||
@@ -31,3 +34,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
|
||||
# And now, to handle R3, which at this point is down to just six keys
|
||||
coord_mapping.extend(ic(3, x) for x in range(3, 9))
|
||||
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=12)
|
||||
layers_ext = Layers()
|
||||
split = Split(uart_pin=uart_pin, split_offsets=split_offsets)
|
||||
extensions = [rgb_ext, split, layers_ext]
|
||||
|
@@ -30,16 +30,16 @@ class RGB(Extension):
|
||||
self,
|
||||
pixel_pin,
|
||||
num_pixels=0,
|
||||
val_limit=255,
|
||||
val_limit=100,
|
||||
hue_default=0,
|
||||
sat_default=100,
|
||||
rgb_order=(1, 0, 2), # GRB WS2812
|
||||
val_default=100,
|
||||
hue_step=1,
|
||||
sat_step=1,
|
||||
val_step=1,
|
||||
hue_step=5,
|
||||
sat_step=5,
|
||||
val_step=5,
|
||||
animation_speed=1,
|
||||
breathe_center=1.5, # 1.0-2.7
|
||||
breathe_center=1, # 1.0-2.7
|
||||
knight_effect_length=3,
|
||||
animation_mode=AnimationModes.STATIC,
|
||||
effect_init=False,
|
||||
@@ -167,7 +167,7 @@ class RGB(Extension):
|
||||
|
||||
else:
|
||||
base = ((100 - sat) * val) / 100
|
||||
color = int((val - base) * ((hue % 60) / 60))
|
||||
color = (val - base) * ((hue % 60) / 60)
|
||||
|
||||
x = int(hue / 60)
|
||||
if x == 0:
|
||||
@@ -420,6 +420,7 @@ class RGB(Extension):
|
||||
if self.effect_init:
|
||||
self._init_effect()
|
||||
|
||||
if self.enable:
|
||||
if self.animation_mode == AnimationModes.BREATHING:
|
||||
return self.effect_breathing()
|
||||
elif self.animation_mode == AnimationModes.RAINBOW:
|
||||
@@ -542,6 +543,10 @@ class RGB(Extension):
|
||||
def _rgb_tog(self, key, state, *args, **kwargs):
|
||||
if self.animation_mode == AnimationModes.STATIC:
|
||||
self.animation_mode = AnimationModes.STATIC_STANDBY
|
||||
self._do_update()
|
||||
if self.animation_mode == AnimationModes.STATIC_STANDBY:
|
||||
self.animation_mode = AnimationModes.STATIC
|
||||
self._do_update()
|
||||
self.enable = not self.enable
|
||||
return state
|
||||
|
||||
|
Reference in New Issue
Block a user