rgb matrix now can work out what side its on using the drive name

This commit is contained in:
Cole Smith 2022-05-28 08:15:44 -07:00 committed by Kyle Brown
parent 08d3386643
commit b91974bce2
2 changed files with 7 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# Getting Started # Getting Started
> Life was like a box of chocolates. You never know what you're gonna get. > Life was like a box of chocolates. You never know what you're gonna get.
KMK is a keyboard focused layer that sits on top of [CircuitPython](https://circuitpython.org/). As such, it should work with most [boards that support CircuitPython](https://circuitpython.org/downloads). It is best to use the last stable version (>5.0). KMK is a keyboard focused layer that sits on top of [CircuitPython](https://circuitpython.org/). As such, it should work with most [boards that support CircuitPython](https://circuitpython.org/downloads). It is best to use the last stable version (>7.0).
Known working and recommended devices can be found [here](Officially_Supported_Microcontrollers.md) Known working and recommended devices can be found [here](Officially_Supported_Microcontrollers.md)
<br> <br>

View File

@ -3,6 +3,7 @@ import neopixel
from kmk.extensions import Extension from kmk.extensions import Extension
from kmk.handlers.stock import passthrough as handler_passthrough from kmk.handlers.stock import passthrough as handler_passthrough
from kmk.keys import make_key from kmk.keys import make_key
from storage import getmount
class Color: class Color:
@ -46,10 +47,15 @@ class Rgb_matrix(Extension):
split=False, split=False,
rightSide=False, rightSide=False,
): ):
name = str(getmount('/').label)
self.rgb_order = rgb_order self.rgb_order = rgb_order
self.disable_auto_write = disable_auto_write self.disable_auto_write = disable_auto_write
self.split = split self.split = split
self.rightSide = rightSide self.rightSide = rightSide
if name.endswith('L'):
self.rightSide = False
elif name.endswith('R'):
self.rightSide = True
if type(ledDisplay) is Rgb_matrix_data: if type(ledDisplay) is Rgb_matrix_data:
self.ledDisplay = ledDisplay.data self.ledDisplay = ledDisplay.data
else: else: