From 58a7f04d0029e5a9c7e45de9636fe5fa49b48522 Mon Sep 17 00:00:00 2001 From: Cole Smith Date: Wed, 25 Jan 2023 12:46:53 -0800 Subject: [PATCH] added draculad keyboard --- boards/draculad/README.md | 24 ++++++++++++++ boards/draculad/kb.py | 69 +++++++++++++++++++++++++++++++++++++++ boards/draculad/main.py | 64 ++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+) create mode 100644 boards/draculad/README.md create mode 100644 boards/draculad/kb.py create mode 100644 boards/draculad/main.py diff --git a/boards/draculad/README.md b/boards/draculad/README.md new file mode 100644 index 0000000..d51e98d --- /dev/null +++ b/boards/draculad/README.md @@ -0,0 +1,24 @@ +# Draculad + + +The Draculad is is a feature-packed 30% split columnar staggered keyboard. +Retailers (USA) +[Boardsource](https://boardsource.xyz/store) + +Extensions enabled by default +- [Layers](/docs/en/layers.md) Need more keys than switches? Use layers. +- [ModTap](/docs/en/modtap.md) Allows mod keys to act as different keys when tapped. +- [Split](/docs/en/split_keyboards.md) Connects halves using a wire +- [peg_RGB_matrix](/docs/en/peg_rgb_matrix.md) Allows mod keys to act as different keys when tapped. +- [peg_oled_display](/docs/en/peg_oled_display.md) Connects halves using a wire + +Common Extensions +- [Power](/docs/enpower.md) Powersaving features for battery life + +## Microcontroller support + +Update this line in `kb.py` to any supported microcontroller in `kmk/quickpin/pro_micro`: + +```python +from kmk.quickpin.pro_micro.boardsource_blok import pinout as pins +``` diff --git a/boards/draculad/kb.py b/boards/draculad/kb.py new file mode 100644 index 0000000..763277d --- /dev/null +++ b/boards/draculad/kb.py @@ -0,0 +1,69 @@ +import board + +from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard +from kmk.quickpin.pro_Micro.avr_promicro import translate as avr +from kmk.quickpin.pro_micro.boardsource_blok import pinout as pins +from kmk.scanners import DiodeOrientation +# from kmk.scanners.encoder import RotaryioEncoder +from kmk.scanners.keypad import MatrixScanner + + +class KMKKeyboard(_KMKKeyboard): + def __init__(self): + # create and register the scanner + self.matrix = [ + MatrixScanner( + # required arguments: + column_pins = self.col_pins, + row_pins = self.row_pins, + # optional arguments with defaults: + columns_to_anodes=DiodeOrientation.COL2ROW, + interval=0.02, + max_events=64 + ), + # RotaryioEncoder( + # pin_a=self.pin_a1, + # pin_b=self.pin_b1, + # # optional + # divisor=4, + # ), + # RotaryioEncoder( + # pin_a=self.pin_a2, + # pin_b=self.pin_b2, + # # optional + # divisor=4, + # ) + ] + col_pins = ( + pins[avr["F4"]], + pins[avr["F5"]], + pins[avr["F6"]], + pins[avr["F7"]], + pins[avr["B1"]], + ) + row_pins = (pins[avr["D4"]], pins[avr["C6"]], pins[avr["D7"]], pins[avr["E6"]]) + data_pin = pins[avr["D2"]] + rgb_pixel_pin = pins[avr["D3"]] + rgb_num_pixels = 20 + i2c = board.I2C + SCL=pins[5] + SDA=pins[4] + pin_a1=pins[avr["B2"]] + pin_a2=pins[avr["B4"]] + pin_b1=pins[avr["B6"]] + pin_b2=pins[avr["B5"]] + led_key_pos=[ + 5,6,7,8,9,19,18,17,16,15,14,13,12,11,10,0,1,2,3,4 + ] + brightness_limit = 1.0 + num_pixels = 20 + + # NOQA + # flake8: noqa + # fmt: off + coord_mapping = [ + 0, 1, 2, 3, 4, 24, 23, 22, 21, 20, + 5, 6, 7, 8, 9, 29, 28, 27, 26, 25, + 10, 11, 12, 13, 14, 34, 33, 32, 31, 30, + 17, 18, 19, 39, 36, 35, + ] diff --git a/boards/draculad/main.py b/boards/draculad/main.py new file mode 100644 index 0000000..6debdab --- /dev/null +++ b/boards/draculad/main.py @@ -0,0 +1,64 @@ +from kb import KMKKeyboard + +from kmk.extensions.peg_oled_Display import ( + Oled, + OledData, + OledDisplayMode, + OledReactionType, +) +from kmk.extensions.peg_rgb_matrix import Rgb_matrix +from kmk.keys import KC +from kmk.modules.layers import Layers +from kmk.modules.modtap import ModTap +from kmk.modules.split import Split + +keyboard = KMKKeyboard() +keyboard.debug_enable=True + +modtap = ModTap() +layers_ext = Layers() +keyboard.modules.append(layers_ext) +keyboard.modules.append(modtap) +# oled +oled_ext = Oled(OledData(corner_one={0:OledReactionType.STATIC,1:["1 2 3 4 5 6","","","","","","",""]},corner_two={0:OledReactionType.STATIC,1:[" 7 8 Layer","","","","","",""," 7 8 Layer"]},corner_three={0:OledReactionType.LAYER,1:["^"," ^"," ^"," ^"," ^"," ^","",""]},corner_four={0:OledReactionType.LAYER,1:["","","","","",""," ^"," ^"]}),toDisplay=OledDisplayMode.TXT,flip= True) +# oled +keyboard.extensions.append(oled_ext) +# ledmap +rgb_ext = Rgb_matrix(ledDisplay=[[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,255,255]],split=True,rightSide=False,disable_auto_write=True) +# ledmap +keyboard.extensions.append(rgb_ext) +split = Split(use_pio=True) +keyboard.modules.append(split) +_______ = KC.TRNS +XXXXXXX = KC.NO + +LOWER = KC.MO(2) +RAISE = KC.MO(1) + +keyboard.keymap = [ + [ #QWERTY + KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P,\ + KC.A, KC.S, KC.D, KC.F, KC.G, KC.H, KC.J, KC.K, KC.L, KC.SCLN,\ + KC.Z, KC.X, KC.C, KC.V, KC.B, KC.N, KC.M, KC.COMM, KC.DOT, KC.SLSH,\ + KC.LCTL, LOWER, KC.SPC, KC.BSPC, RAISE, KC.ENT + + ], + [ #RAISE + KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0,\ + KC.TAB, KC.LEFT, KC.DOWN, KC.UP, KC.RGHT, XXXXXXX, KC.MINS, KC.EQL, KC.LBRC, KC.RBRC,\ + KC.LCTL, KC.GRV, KC.LGUI, KC.LALT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.BSLS, KC.QUOT,\ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + + ], + [ #LOWER + KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN,\ + KC.ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.UNDS, KC.PLUS, KC.LCBR, KC.RCBR,\ + KC.CAPS, KC.TILD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.PIPE, KC.DQT,\ + XXXXXXX, XXXXXXX, XXXXXXX, KC.ENT, XXXXXXX, KC.DEL + + + ] +] + +if __name__ == '__main__': + keyboard.go()