Skip to content

Commit

Permalink
Removed intify_coordinate from code, boards, docs (KMKfw#924)
Browse files Browse the repository at this point in the history
Remove deprecated intify_coordinate mapping
  • Loading branch information
NDalt authored Dec 28, 2023
1 parent 53399b0 commit b778dda
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 64 deletions.
9 changes: 4 additions & 5 deletions boards/fingerpunch/ffkb/other_pro_micro/kb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.quickpin.pro_micro.boardsource_blok import pinout as pins
from kmk.scanners import DiodeOrientation
from kmk.scanners import intify_coordinate as ic


class KMKKeyboard(_KMKKeyboard):
Expand Down Expand Up @@ -33,8 +32,8 @@ class KMKKeyboard(_KMKKeyboard):
# flake8: noqa
# fmt: off
coord_mapping = [
ic(0, 0), ic(0, 1), ic(0, 2), ic(0, 3), ic(0, 4), ic(0, 5), ic(0, 6), ic(0, 7), ic(4, 3), ic(3, 4), ic(4, 5), ic(3, 7),
ic(1, 0), ic(1, 1), ic(1, 2), ic(1, 3), ic(1, 4), ic(1, 5), ic(4, 1), ic(1, 6), ic(1, 7), ic(3, 2), ic(4, 4), ic(3, 5), ic(4, 7),
ic(2, 0), ic(2, 1), ic(2, 2), ic(2, 3), ic(2, 4), ic(2, 5), ic(2, 6), ic(2, 7), ic(4, 2), ic(3, 3), ic(3, 6), ic(4, 6),
ic(5, 1), ic(5, 3), ic(5, 4), ic(5, 5), ic(5, 6), ic(5, 7), ic(5, 2), ic(5, 0)
0, 1, 2, 3, 4, 5, 6, 7, 35, 28, 37, 31,
8, 9, 10, 11, 12, 13, 33, 14, 15, 26, 36, 29, 39,
16, 17, 18, 19, 20, 21, 22, 23, 34, 27, 30, 38,
41, 43, 44, 45, 46, 47, 42, 40,
]
19 changes: 10 additions & 9 deletions boards/gtips/reviung41/kb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.quickpin.pro_micro.boardsource_blok import pinout as pins
from kmk.scanners import DiodeOrientation
from kmk.scanners import intify_coordinate as ic


class KMKKeyboard(_KMKKeyboard):
Expand All @@ -28,11 +27,13 @@ class KMKKeyboard(_KMKKeyboard):
rgb_pixel_pin = pins[0]
rgb_num_pixels = 11
i2c = board.I2C

coord_mapping = []
coord_mapping.extend(ic(0, x, 12) for x in range(12))
coord_mapping.extend(ic(1, x, 12) for x in range(12))
coord_mapping.extend(ic(2, x, 12) for x in range(12))

# And now, to handle R3, which at this point is down to just five keys
coord_mapping.extend(ic(3, x, 12) for x in range(5))

# flake8: noqa
# fmt: off
coord_mapping = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40,
]

20 changes: 9 additions & 11 deletions boards/kyria/kb_v1.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.quickpin.pro_micro.boardsource_blok import pinout as pins
from kmk.scanners import DiodeOrientation
from kmk.scanners import intify_coordinate as ic


class KMKKeyboard(_KMKKeyboard):
Expand All @@ -21,13 +20,12 @@ class KMKKeyboard(_KMKKeyboard):
rgb_pixel_pin = pins[0]
encoder_pin_0 = pins[11]
encoder_pin_1 = pins[7]

coord_mapping = []
coord_mapping.extend(ic(0, x, 8) for x in range(6))
coord_mapping.extend(ic(4, x, 8) for x in range(5, -1, -1))
coord_mapping.extend(ic(1, x, 8) for x in range(6))
coord_mapping.extend(ic(5, x, 8) for x in range(5, -1, -1))
coord_mapping.extend(ic(2, x, 8) for x in range(8))
coord_mapping.extend(ic(6, x, 8) for x in range(7, -1, -1))
coord_mapping.extend(ic(3, x, 8) for x in range(3, 8))
coord_mapping.extend(ic(7, x, 8) for x in range(7, 2, -1))

# flake8: noqa
# fmt: off
coord_mapping = [
0, 1, 2, 3, 4, 5, 37, 36, 35, 34, 33, 32,
8, 9, 10, 11, 12, 13, 45, 44, 43, 42, 41, 40,
16, 17, 18, 19, 20, 21, 22, 23, 55, 54, 53, 52, 51, 50, 49, 48,
27, 28, 29, 30, 31, 63, 62, 61, 60, 59,
]
19 changes: 1 addition & 18 deletions docs/en/porting_to_kmk.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,7 @@ provide a mapping directly. An example of this is the
columns for the bottom row. Split keyboards count as the total keyboard, not per
side, the right side being offset by the number of keys on the left side, as if
the rows were stacked.
That would look like this
```python
from kmk.scanners import intify_coordinate as ic

coord_mapping = []
coord_mapping.extend(ic(0, x, 6) for x in range(6))
coord_mapping.extend(ic(4, x, 6) for x in range(6))
coord_mapping.extend(ic(1, x, 6) for x in range(6))
coord_mapping.extend(ic(5, x, 6) for x in range(6))
coord_mapping.extend(ic(2, x, 6) for x in range(6))
coord_mapping.extend(ic(6, x, 6) for x in range(6))
# And now, to handle R3, which at this point is down to just six keys
coord_mapping.extend(ic(3, x, 6) for x in range(3, 6))
coord_mapping.extend(ic(7, x, 6) for x in range(0, 3))
```

`intify_coordinate` is the traditional way to generate key positions.
Here's an equivalent, maybe visually more explanatory version:
That would look like this:
```python
coord_mapping = [
0, 1, 2, 3, 4, 5, 24, 25, 26, 27, 28, 29,
Expand Down
17 changes: 0 additions & 17 deletions docs/ptBR/porting_to_kmk.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,6 @@ teclado [Corne](https://github.com/foostan/crkbd). Ele tem 12 colunas para 3
linhas, e 6 colunas para a linha inferior. Teclados repartidos são contados pelo
total, não por parte separada. Isto seria mais ou menos assim:

```python
from kmk.scanners import intify_coordinate as ic

coord_mapping = []
coord_mapping.extend(ic(0, x, 6) for x in range(6))
coord_mapping.extend(ic(4, x, 6) for x in range(6))
coord_mapping.extend(ic(1, x, 6) for x in range(6))
coord_mapping.extend(ic(5, x, 6) for x in range(6))
coord_mapping.extend(ic(2, x, 6) for x in range(6))
coord_mapping.extend(ic(6, x, 6) for x in range(6))
# And now, to handle R3, which at this point is down to just six keys
coord_mapping.extend(ic(3, x, 6) for x in range(3, 6))
coord_mapping.extend(ic(7, x, 6) for x in range(0, 3))
```

`intify_coordinate` é a maneira tradicional de gerar posições-chave.
Aqui está uma versão equivalente, talvez visualmente mais explicativa:
```python
coord_mapping = [
0, 1, 2, 3, 4, 5, 24, 25, 26, 27, 28, 29,
Expand Down
4 changes: 0 additions & 4 deletions kmk/scanners/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
def intify_coordinate(row, col, len_cols):
return len_cols * row + col


class DiodeOrientation:
'''
Orientation of diodes on handwired boards. You can think of:
Expand Down

0 comments on commit b778dda

Please sign in to comment.