Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitkb kyria rev2 port #852

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions boards/kyria/kb_v2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.quickpin.pro_micro.sparkfun_promicro_rp2040 import pinout as pins
from kmk.scanners import DiodeOrientation
from kmk.scanners import intify_coordinate as ic
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused; remove this line.

from storage import getmount

isLeftSide = False if str(getmount('/').label)[-1] == 'R' else True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only works if the split sides were set up to use the mountpoint name to determine left and right.
The universal and future-proof way would be to request the "split-side" of a board from the split module. That's not technically your responsibility. The split module doesn't yet offer that functionality as, for example, a utility function. It should though, and I'm using this opportunity to point that out.
I'm proposing to factor out the split side/location heuristic into a public auxiliary function within the split module. Then you can call that sometime during the initialization to figure out what column and row pins to use.

leftColPins = (
pins[6],
pins[7],
pins[8],
pins[9],
pins[10],
pins[11],
pins[12],
pins[13],
)
leftRowPins = (pins[17], pins[16], pins[15], pins[14])

rightColPins = (
pins[10],
pins[11],
pins[12],
pins[13],
pins[14],
pins[15],
pins[16],
pins[17],
)
rightRowPins = (pins[6], pins[7], pins[8], pins[9])


colPins = ()
rowPins = ()

if isLeftSide:
colPins = leftColPins
rowPins = leftRowPins
else:
colPins = rightColPins
rowPins = rightRowPins


class KMKKeyboard(_KMKKeyboard):
SDA = pins[4]
SCL = pins[5]
col_pins = (
pins[6],
pins[7],
pins[8],
pins[9],
pins[10],
pins[11],
pins[12],
pins[13],
)
row_pins = (pins[17], pins[16], pins[15], pins[14])
diode_orientation = DiodeOrientation.COL2ROW
data_pin = pins[1]
rgb_pixel_pin = pins[0]
Comment on lines +59 to +60
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These members are legacy only and should not be used in new contributions. These pins are to be provided to the split and rgb modules directly.


coord_mapping = [
0, 1, 2, 3, 4, 5, 34, 35, 36, 37, 38, 39,
8, 9, 10, 11, 12, 13, 42, 43, 44, 45, 46, 47,
16, 17, 18, 19, 20, 21, 22, 23, 48, 49, 50, 51, 52, 53, 54, 55,
26, 28, 29, 30, 31, 56, 57, 58, 59, 61
]