diff --git a/.gitmodules b/.gitmodules index 48c7035afa44..8e3b8000d3a2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,3 +21,7 @@ [submodule "lib/pico-sdk"] path = lib/pico-sdk url = https://github.com/qmk/pico-sdk.git +[submodule "openocd"] + path = openocd + url = https://github.com/raspberrypi/openocd.git + branch = rp2040 diff --git a/flash-heavy.sh b/flash-heavy.sh new file mode 100755 index 000000000000..83c38c21719c --- /dev/null +++ b/flash-heavy.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -ex + +make system76/launch_heavy_3:default + +FIRMWARE="$(realpath .build/system76_launch_heavy_3_default.elf)" +./openocd.sh -c "program ${FIRMWARE} verify reset exit" diff --git a/flash-launch.sh b/flash-launch.sh new file mode 100755 index 000000000000..69441d5c17db --- /dev/null +++ b/flash-launch.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -ex + +make system76/launch_3:default + +FIRMWARE="$(realpath .build/system76_launch_3_default.elf)" +./openocd.sh -c "program ${FIRMWARE} verify reset exit" diff --git a/flash-virgo.sh b/flash-virgo.sh new file mode 100755 index 000000000000..4bc2889eb413 --- /dev/null +++ b/flash-virgo.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -ex + +make system76/virgo_keyboard_test_1:default + +FIRMWARE="$(realpath .build/system76_virgo_keyboard_test_1_default.elf)" +./openocd.sh -c "program ${FIRMWARE} verify reset exit" diff --git a/keyboards/system76/launch_1/config.h b/keyboards/system76/launch_1/config.h index 0431b9ab1718..09731a7d462a 100644 --- a/keyboards/system76/launch_1/config.h +++ b/keyboards/system76/launch_1/config.h @@ -80,7 +80,7 @@ // I2C { #define F_SCL 100000UL // Run I2C bus at 100 kHz #define I2C_START_RETRY_COUNT 20 -#define I2C_TIMEOUT 100 // milliseconds +#define I2C_TIMEOUT 10 // milliseconds // } I2C // EEPROM { diff --git a/keyboards/system76/launch_1/keymaps/default/keymap.c b/keyboards/system76/launch_1/keymaps/default/keymap.c index 1da2fbf4bc77..2b3c3456f0f0 100644 --- a/keyboards/system76/launch_1/keymaps/default/keymap.c +++ b/keyboards/system76/launch_1/keymaps/default/keymap.c @@ -16,6 +16,7 @@ */ #include QMK_KEYBOARD_H +#define ______ KC_TRNS const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -76,29 +77,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [1] = LAYOUT( - QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_TRNS, KC_VOLU, - KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_VAD, RGB_VAI, _______, KC_VOLU, + KC_PSCR, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, _______, _______, _______, KC_VOLD, + _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, KC_MUTE, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END ), [2] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), [3] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), }; diff --git a/keyboards/system76/launch_1/keymaps/jeremy/keymap.c b/keyboards/system76/launch_1/keymaps/jeremy/keymap.c new file mode 100644 index 000000000000..3bbaf119fcb0 --- /dev/null +++ b/keyboards/system76/launch_1/keymaps/jeremy/keymap.c @@ -0,0 +1,91 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | FN | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | CTRL | FN | LALT | LGUI | SPACE | BACKSPACE | ESC | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_BSPC, KC_ESC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || PLAY/ | +| RESET | | | | | | | | | | | | | || PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || VOLUME | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || UP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | LED | LED | LED || VOLUME | +|PRINT SCREEN| | | | | | | PGUP | HOME | PGDN | | DOWN | UP | TOGGLE || DOWN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | VOL | VOL | | | | | | | | | | | | + | | | DOWN | UP | MUTE | | LEFT | DOWN | UP | RIGHT | | | | | MUTE | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | | | | | | | END | | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | ENTER | DELETE | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_VOLU, + KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_HOME, KC_PGDN, KC_TRNS, RGB_VAD, RGB_VAI, RGB_TOG, KC_VOLD, + KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + + [2] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_1/keymaps/levi/keymap.c b/keyboards/system76/launch_1/keymaps/levi/keymap.c new file mode 100644 index 000000000000..574079c0740e --- /dev/null +++ b/keyboards/system76/launch_1/keymaps/levi/keymap.c @@ -0,0 +1,113 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, Dvorak layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | { | } | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | ' | , | . | | | | | | | | / | = | || | +| TAB | " | < | > | P | Y | F | G | C | R | L | ? | + | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | - | | | | + | CTRL | A | O | E | U | I | D | H | T | N | S | _ | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | : | | | | | | | | | | | | + | SHIFT | ; | Q | J | K | X | B | M | W | V | Z | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | FN | CTRL | LALT | LGUI | SPACE | FN | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_PGDN, + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_END, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, + MO(2), KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* Layer 1, QWERTY layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | CTRL | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | FN | CTRL | LALT | LGUI | SPACE | FN | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [1] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + MO(2), KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 2, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| RESET | | | | | | | | | | | | | || Dvorak | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| | | | | | | | | | | | | | || Qwerty | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| | Home | Up | End | PgUp | | PgUp | Home | Up | End | | | | PrtScr || | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | | | | | + | | Left | Down | Right | PgDn | | PgDn | Left | Down | Right | | | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | |PlayPaus| Prev | Next | VolDn | VolUp | VolMute| | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | Backspace | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [2] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(0), + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(1), + KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_TRNS, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_TRNS, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_TRNS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_1/launch_1.c b/keyboards/system76/launch_1/launch_1.c index fd780f6fee27..b9f9ff62f8f9 100644 --- a/keyboards/system76/launch_1/launch_1.c +++ b/keyboards/system76/launch_1/launch_1.c @@ -137,7 +137,9 @@ void matrix_init_kb(void) { } else { system76_ec_rgb_eeprom(false); } +} +void keyboard_post_init_user(void) { system76_ec_rgb_layer(layer_state); } diff --git a/keyboards/system76/launch_1/usb_mux.c b/keyboards/system76/launch_1/usb_mux.c index 6cb04dcdd716..5dd037b93426 100644 --- a/keyboards/system76/launch_1/usb_mux.c +++ b/keyboards/system76/launch_1/usb_mux.c @@ -333,23 +333,30 @@ i2c_status_t usb7206_gpio_init(struct USB7206_GPIO* self) { return 0; } +#define TCPC_CC_STATUS 0x1D +#define TCPC_ROLE_CONTROL 0x1A +#define TCPC_COMMAND 0x23 + +enum TCPC_TYPE { + TCPC_TYPE_SINK, + TCPC_TYPE_SOURCE, +}; + struct PTN5110 { + enum TCPC_TYPE type; uint8_t addr; uint8_t cc; struct USB7206_GPIO* gpio; }; -struct PTN5110 usb_sink = {.addr = 0x51, .gpio = &usb_gpio_sink}; -struct PTN5110 usb_source_left = {.addr = 0x52, .gpio = &usb_gpio_source_left}; -struct PTN5110 usb_source_right = {.addr = 0x50, .gpio = &usb_gpio_source_right}; +struct PTN5110 usb_sink = { .type = TCPC_TYPE_SINK, .addr = 0x51, .gpio = &usb_gpio_sink}; +struct PTN5110 usb_source_left = { .type = TCPC_TYPE_SOURCE, .addr = 0x52, .gpio = &usb_gpio_source_left}; +struct PTN5110 usb_source_right = { .type = TCPC_TYPE_SOURCE, .addr = 0x50, .gpio = &usb_gpio_source_right}; -// Initialize PTN5110. -// Returns zero on success or a negative number on error. -i2c_status_t ptn5110_init(struct PTN5110* self) { - // Set last cc to invalid value, to force update - self->cc = 0xFF; - // Initialize GPIO - return usb7206_gpio_init(self->gpio); +// Write PTN5110 ROLE_CONTROL +// Returns bytes written on success or negative number on error +int ptn5110_set_role_control(struct PTN5110 * self, uint8_t role_control) { + return i2c_writeReg(self->addr << 1, TCPC_ROLE_CONTROL, &role_control, 1, I2C_TIMEOUT); } // Read PTN5110 CC_STATUS. @@ -362,7 +369,7 @@ i2c_status_t ptn5110_set_ssmux(struct PTN5110* self, bool orientation) { return // Write PTN5110 COMMAND. // Returns zero on success or negative number on error. -i2c_status_t ptn5110_command(struct PTN5110* self, uint8_t command) { return i2c_writeReg(self->addr << 1, 0x23, &command, 1, I2C_TIMEOUT); } +i2c_status_t ptn5110_command(struct PTN5110* self, uint8_t command) { return i2c_writeReg(self->addr << 1, TCPC_COMMAND, &command, 1, I2C_TIMEOUT); } // Set orientation of PTN5110 operating as a sink, call this once. // Returns zero on success or a negative number on error. @@ -439,6 +446,32 @@ i2c_status_t ptn5110_source_update(struct PTN5110* self) { return 0; } +// Initialize PTN5110 +// Returns zero on success or negative number on error +int ptn5110_init(struct PTN5110 * self) { + int res; + + // Set last cc to invalid value, to force update + self->cc = 0xFF; + + // Initialize GPIO + res = usb7206_gpio_init(self->gpio); + if (res < 0) return res; + + switch (self->type) { + case TCPC_TYPE_SINK: + res = ptn5110_sink_set_orientation(self); + if (res < 0) return res; + break; + case TCPC_TYPE_SOURCE: + res = ptn5110_set_role_control(self, 0x05); + if (res < 0) return res; + break; + } + + return 0; +} + void usb_mux_event(void) { // Run this on every 1000th matrix scan static int cycle = 0; @@ -460,7 +493,6 @@ void usb_mux_init(void) { // Set up sink ptn5110_init(&usb_sink); - ptn5110_sink_set_orientation(&usb_sink); // Set up sources ptn5110_init(&usb_source_left); diff --git a/keyboards/system76/launch_2/README.md b/keyboards/system76/launch_2/README.md new file mode 100644 index 000000000000..16b8343e5de0 --- /dev/null +++ b/keyboards/system76/launch_2/README.md @@ -0,0 +1,40 @@ +## Flashing firmware: +* Clone this repository and `cd` into the `qmk_firmware` directory. +* After cloning, you probably need to run `make git-submodule` as well as `./util/qmk_install`. + - You may also need to install dependencies: `sudo apt install avrdude gcc-avr avr-libc` +* To build the firmware without flashing the keyboard, use `make (keyboard name):(layout name)` + - For example, if you want to build the `default` layout for the Launch keyboard, run: +``` +make system76/launch_2:default +``` +* To flash the firmware, you'll use the same build command, but with `dfu` added to the end: +``` +make system76/launch_2:default:dfu +``` + - After it builds, you will see a repeating message that says: +``` +dfu-programmer: no device present. +ERROR: Bootloader not found. Trying again in 5s. +``` +Next, unplug your keyboard from your computer, hold the ESC key (while the keyboard is unplugged), and plug the keyboard back in while holding the ESC key. Once the keyboard is plugged in, the ESC key can be released. +* Note: on some distros, dfu-programmer has trouble detecting the keyboard unless you run the `make` command with `sudo`. +* To flash the firmware using ISP, you will need a USBasp device, and a tag connect cable. + - Build the firmware and bootloader with: +``` +make system76/launch_2:default:production +``` + - Run avrdude to flash the fuses: +``` +avrdude -c usbasp -p at90usb646 -U lfuse:w:0x5E:m -U hfuse:w:0xDB:m -U efuse:w:0xFB:m -U lock:w:0xFF:m +``` + - Run avrdude to flash the ROM: +``` +avrdude -c usbasp -p at90usb646 -U flash:w:system76_launch_2_default_production.hex +``` + +## Making your own layout: +If you want to create your own layout, go to the `keymaps` directory and copy one of the maps in there. It will likely be easiest to start with the default layout, but the other layouts in there may be helpful references. The name of the directory you create will be the name of your layout. To prevent build errors, it is recommended to use only lowercase letters, underscores, and numbers for the name of your layout. + +Inside of each layout directory, there is a file called `keymap.c`. The commented out grid area in this file is a visual reference for the actual key assignments below it. When modifying a layout, modifying this visual reference first makes it easier to design a layout, as well as keeping the actual layout below it organized. + +Once your layout is designed, change the keycodes below to match your design. A full list of available keycodes can be found in the [QMK docs](https://beta.docs.qmk.fm/reference/keycodes). Use the shorter keycode alias to help keep these lined up (e.g. use `KC_ESC` instead of `KC_ESCAPE`). diff --git a/keyboards/system76/launch_2/config.h b/keyboards/system76/launch_2/config.h new file mode 100644 index 000000000000..bf3760b8d863 --- /dev/null +++ b/keyboards/system76/launch_2/config.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + + +/* + * Key matrix pins + * ROWS: AVR pins used for rows, top to bottom + * COLS: AVR pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { F0, F1, F2, F3, F4, F5 } +#define MATRIX_COL_PINS { C6, C5, C4, C3, C2, C1, C7, A7, A6, A5, A4, E6, C0, E7 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +#ifdef RGB_MATRIX_ENABLE +# define RGB_DI_PIN F7 +# define RGB_MATRIX_LED_COUNT 84 +# define RGB_MATRIX_KEYPRESSES // Reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // Reacts to keyreleases (instead of keypresses) +// # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enables framebuffer effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Turns off effects when suspended +// Limit brightness to support USB-A at 0.5 A +// TODO: Do this dynamically based on power source +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 176 // Limits maximum brightness of LEDs to 176 out of 255. If not defined, maximum brightness is set to 255 +# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Sets the default mode, if none has been set +# define RGB_MATRIX_DEFAULT_HUE 142 // Sets the default hue value, if none has been set +# define RGB_MATRIX_DEFAULT_SAT 255 // Sets the default saturation value, if none has been set +# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set +# define RGB_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set +# define RGB_MATRIX_DISABLE_KEYCODES // Disables control of rgb matrix by keycodes (must use code functions to control the feature) + +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +#endif // RGB_MATRIX_ENABLE + +// Mechanical locking support; use KC_LCAP, KC_LNUM, or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// I2C { +#define F_SCL 100000UL // Run I2C bus at 100 kHz +#define I2C_START_RETRY_COUNT 20 +#define I2C_TIMEOUT 100 // milliseconds +// } I2C + +// EEPROM { +#define EEPROM_SIZE 1024 +// TODO: Refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x02 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) +// } EEPROM + +// Dynamic keymap { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 +#define DYNAMIC_KEYMAP_MACRO_COUNT 0 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +// Dynamic macro starts after dynamic keymaps, it is disabled +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2)) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 0 +// } Dynamic keymap + +// System76 EC { +#define SYSTEM76_EC_EEPROM_ADDR (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE) +#define SYSTEM76_EC_EEPROM_SIZE (EEPROM_SIZE - SYSTEM76_EC_EEPROM_ADDR) +// } System76 EC diff --git a/keyboards/system76/launch_2/i2c.c b/keyboards/system76/launch_2/i2c.c new file mode 100644 index 000000000000..a46927fa59e2 --- /dev/null +++ b/keyboards/system76/launch_2/i2c.c @@ -0,0 +1,176 @@ +#include +#include +#include + +#include "i2c.h" + +#define TIMEOUT (F_CPU/1000) + +// Initialize I2C with specified buad rate +void i2c_init(unsigned long baud) { + TWAR = 0; + TWBR = (uint8_t)(((F_CPU / baud) - 16 ) / 2); + TWCR = 0; +} + +// Send an I2C start condition, a 7-bit address, and a read bit +// Returns zero on success or negative number on error +int i2c_start(uint8_t addr, bool read) { + uint32_t count; + uint8_t twst; + + // transmit START condition + TWCR = (1< 0) count -= 1; + if (count == 0) return -1; + + // check if the start condition was successfully transmitted + twst = TW_STATUS & 0xF8; + if ((twst != TW_START) && (twst != TW_REP_START)) return -1; + + // load slave addr into data register + TWDR = ((addr << 1) | read); + // start transmission of addr + TWCR = (1< 0) count -= 1; + if (count == 0) return -1; + + // check if the device has acknowledged the READ / WRITE mode + twst = TW_STATUS & 0xF8; + if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) return -1; + + return 0; +} + +// Send an I2C stop condition +// Always successful +void i2c_stop(void) { + // transmit STOP condition + TWCR = (1< 0) count -= 1; + // timed out + if (count == 0) return -1; + // failed to receive ack + if((TWSR & 0xF8) != TW_MT_DATA_ACK) return -1; + } + + return i; +} + +// Read a byte from the I2C bus, sending an ack if specified +// Returns byte data on success or negative number on error +int i2c_read_byte(bool ack) { + if (ack) { + // start TWI module and acknowledge data after reception + TWCR = (1< 0) count -= 1; + if (count == 0) return -1; + // return received data from TWDR + return (int)TWDR; +} + +// Read data from the I2C bus +// Returns bytes read on success or negative number on error +int i2c_read(uint8_t * data, int length) { + int res; + int i; + + for (i = 0; i < length; i++) { + bool ack = (i + 1) < length; + res = i2c_read_byte(ack); + if (res < 0) return res; + data[i] = (uint8_t)res; + } + + return i; +} + +// Receive data from a specified address on the I2C bus +// Returns bytes read on success or negative number on error +int i2c_recv(uint8_t addr, uint8_t* data, int length) { + int res = 0; + + res = i2c_start(addr, true); + if (res < 0) return res; + + res = i2c_read(data, length); + if (res < 0) return res; + + i2c_stop(); + + return res; +} + +// Send data to a specified address on the I2C bus +// Returns bytes written on success or negative number on error +int i2c_send(uint8_t addr, uint8_t* data, int length) { + int res = 0; + + res = i2c_start(addr, false); + if (res < 0) return res; + + res = i2c_write(data, length); + if (res < 0) return res; + + i2c_stop(); + + return res; +} + +// Get data from a specified address and register on the I2C bus +// Returns bytes read on success or negative number on error +int i2c_get(uint8_t addr, uint8_t reg, uint8_t* data, int length) { + int res = 0; + + res = i2c_start(addr, false); + if (res < 0) return res; + + res = i2c_write(®, 1); + if (res < 0) return res; + + return i2c_recv(addr, data, length); +} + +// Set data in a specified address and register on the I2C bus +// Returns bytes written on success or negative number on error +int i2c_set(uint8_t addr, uint8_t reg, uint8_t* data, int length) { + int res = 0; + + res = i2c_start(addr, false); + if (res < 0) return res; + + res = i2c_write(®, 1); + if (res < 0) return res; + + res = i2c_write(data, length); + if (res < 0) return res; + + i2c_stop(); + + return res; +} diff --git a/keyboards/system76/launch_2/i2c.h b/keyboards/system76/launch_2/i2c.h new file mode 100644 index 000000000000..f980a308dced --- /dev/null +++ b/keyboards/system76/launch_2/i2c.h @@ -0,0 +1,46 @@ +#ifndef I2C_H +#define I2C_H + +#include +#include + +// Initialize I2C with specified buad rate +void i2c_init(unsigned long baud); + +// Send an I2C start condition, a 7-bit address, and a read bit +// Returns zero on success or negative number on error +int i2c_start(uint8_t addr, bool read); + +// Send an I2C stop condition +// Always successful +void i2c_stop(void); + +// Write data to the I2C bus +// Returns bytes written on success or negative number on error +int i2c_write(uint8_t * data, int length); + +// Read a byte from the I2C bus, sending an ack if specified +// Returns byte data on success or negative number on error +int i2c_read_byte(bool ack); + +// Read data from the I2C bus +// Returns bytes read on success or negative number on error +int i2c_read(uint8_t * data, int length); + +// Receive data from a specified address on the I2C bus +// Returns bytes read on success or negative number on error +int i2c_recv(uint8_t addr, uint8_t* data, int length); + +// Send data to a specified address on the I2C bus +// Returns bytes written on success or negative number on error +int i2c_send(uint8_t addr, uint8_t* data, int length); + +// Get data from a specified address and register on the I2C bus +// Returns bytes read on success or negative number on error +int i2c_get(uint8_t addr, uint8_t reg, uint8_t* data, int length); + +// Set data in a specified address and register on the I2C bus +// Returns bytes written on success or negative number on error +int i2c_set(uint8_t addr, uint8_t reg, uint8_t* data, int length); + +#endif // I2C_H diff --git a/keyboards/system76/launch_2/info.json b/keyboards/system76/launch_2/info.json new file mode 100644 index 000000000000..a88623435b3e --- /dev/null +++ b/keyboards/system76/launch_2/info.json @@ -0,0 +1,102 @@ +{ + "keyboard_name": "Launch Configurable Keyboard (launch_2)", + "manufacturer": "System76", + "url": "https://system76.com/accessories/launch", + "usb": { + "vid": "0x3384", + "pid": "0x0006", + "device_version": "0.0.1" + }, + "processor": "at90usb646", + "bootloader": "qmk-dfu", + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "Esc", "x": 0, "y": 0 }, + { "label": "F1", "x": 1, "y": 0 }, + { "label": "F2", "x": 2, "y": 0 }, + { "label": "F3", "x": 3, "y": 0 }, + { "label": "F4", "x": 4, "y": 0 }, + { "label": "F5", "x": 5, "y": 0 }, + { "label": "F6", "x": 6, "y": 0 }, + { "label": "F7", "x": 7, "y": 0 }, + { "label": "F8", "x": 8, "y": 0 }, + { "label": "F9", "x": 9, "y": 0 }, + { "label": "F10", "x": 10, "y": 0 }, + { "label": "F11", "x": 11, "y": 0 }, + { "label": "F12", "x": 12, "y": 0 }, + { "label": "Del", "x": 13, "y": 0, "w": 1.5 }, + { "label": "Home", "x": 14.75, "y": 0 }, + { "label": "`", "x": 0, "y": 1 }, + { "label": "1", "x": 1, "y": 1 }, + { "label": "2", "x": 2, "y": 1 }, + { "label": "3", "x": 3, "y": 1 }, + { "label": "4", "x": 4, "y": 1 }, + { "label": "5", "x": 5, "y": 1 }, + { "label": "6", "x": 6, "y": 1 }, + { "label": "7", "x": 7, "y": 1 }, + { "label": "8", "x": 8, "y": 1 }, + { "label": "9", "x": 9, "y": 1 }, + { "label": "0", "x": 10, "y": 1 }, + { "label": "-", "x": 11, "y": 1 }, + { "label": "=", "x": 12, "y": 1 }, + { "label": "Bksp", "x": 13, "y": 1, "w": 1.5 }, + { "label": "PgUp", "x": 14.75, "y": 1 }, + { "label": "Tab", "x": 0, "y": 2, "w": 1.5 }, + { "label": "Q", "x": 1.5, "y": 2 }, + { "label": "W", "x": 2.5, "y": 2 }, + { "label": "E", "x": 3.5, "y": 2 }, + { "label": "R", "x": 4.5, "y": 2 }, + { "label": "T", "x": 5.5, "y": 2 }, + { "label": "Y", "x": 6.5, "y": 2 }, + { "label": "U", "x": 7.5, "y": 2 }, + { "label": "I", "x": 8.5, "y": 2 }, + { "label": "O", "x": 9.5, "y": 2 }, + { "label": "P", "x": 10.5, "y": 2 }, + { "label": "[", "x": 11.5, "y": 2 }, + { "label": "]", "x": 12.5, "y": 2 }, + { "label": "\\", "x": 13.5, "y": 2 }, + { "label": "PgDn", "x": 14.75, "y": 2 }, + { "label": "Caps", "x": 0.25, "y": 3, "w": 1.5 }, + { "label": "A", "x": 1.75, "y": 3 }, + { "label": "S", "x": 2.75, "y": 3 }, + { "label": "D", "x": 3.75, "y": 3 }, + { "label": "F", "x": 4.75, "y": 3 }, + { "label": "G", "x": 5.75, "y": 3 }, + { "label": "H", "x": 6.75, "y": 3 }, + { "label": "J", "x": 7.75, "y": 3 }, + { "label": "K", "x": 8.75, "y": 3 }, + { "label": "L", "x": 9.75, "y": 3 }, + { "label": ";", "x": 10.75, "y": 3 }, + { "label": "'", "x": 11.75, "y": 3 }, + { "label": "Enter", "x": 12.75, "y": 3, "w": 1.5 }, + { "label": "End", "x": 14.75, "y": 3 }, + { "label": "LShift", "x": 0.25, "y": 4, "w": 2 }, + { "label": "Z", "x": 2.25, "y": 4 }, + { "label": "X", "x": 3.25, "y": 4 }, + { "label": "C", "x": 4.25, "y": 4 }, + { "label": "V", "x": 5.25, "y": 4 }, + { "label": "B", "x": 6.25, "y": 4 }, + { "label": "N", "x": 7.25, "y": 4 }, + { "label": "M", "x": 8.25, "y": 4 }, + { "label": ",", "x": 9.25, "y": 4 }, + { "label": ".", "x": 10.25, "y": 4 }, + { "label": "/", "x": 11.25, "y": 4 }, + { "label": "RShift", "x": 12.25, "y": 4, "w": 1.5 }, + { "label": "Up", "x": 13.75, "y": 4 }, + { "label": "LCtrl", "x": 0.25, "y": 5, "w": 1.5 }, + { "label": "LAlt", "x": 1.75, "y": 5 }, + { "label": "LFn", "x": 2.75, "y": 5 }, + { "label": "Super", "x": 3.75, "y": 5 }, + { "label": "Space", "x": 4.75, "y": 5, "w": 2 }, + { "label": "Space", "x": 6.75, "y": 5, "w": 2 }, + { "label": "RCtrl", "x": 8.75, "y": 5 }, + { "label": "RAlt", "x": 9.75, "y": 5 }, + { "label": "RFn", "x": 10.75, "y": 5, "w": 1.5 }, + { "label": "Left", "x": 12.75, "y": 5 }, + { "label": "Down", "x": 13.75, "y": 5 }, + { "label": "Right", "x": 14.75, "y": 5 } + ] + } + } +} diff --git a/keyboards/system76/launch_2/keymaps/default/keymap.c b/keyboards/system76/launch_2/keymaps/default/keymap.c new file mode 100644 index 000000000000..bbbe8ef7b1b4 --- /dev/null +++ b/keyboards/system76/launch_2/keymaps/default/keymap.c @@ -0,0 +1,92 @@ +#include QMK_KEYBOARD_H +#define ______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | CTRL | LALT | FN | LGUI | SPACE | SPACE | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LALT, MO(1), KC_LGUI, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || PLAY/ | +| QK_BOOT| | | | | | | | | | | | | || PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | LED | LED | LED | || VOLUME | +| | | | | | | | | | | TOGGLE | DOWN | UP | || UP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || VOLUME | +|PRINT SCREEN| | | | | | HOME | PGDN | PGUP | END | | | | || DOWN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | | | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | | | | | MUTE | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'QK_BOOT' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_VAD, RGB_VAI, _______, KC_VOLU, + KC_PSCR, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, _______, _______, _______, KC_VOLD, + _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, KC_MUTE, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END + ), + + [2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [3] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_2/keymaps/jeremy/keymap.c b/keyboards/system76/launch_2/keymaps/jeremy/keymap.c new file mode 100644 index 000000000000..3bbaf119fcb0 --- /dev/null +++ b/keyboards/system76/launch_2/keymaps/jeremy/keymap.c @@ -0,0 +1,91 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | FN | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | CTRL | FN | LALT | LGUI | SPACE | BACKSPACE | ESC | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_BSPC, KC_ESC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || PLAY/ | +| RESET | | | | | | | | | | | | | || PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || VOLUME | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || UP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | LED | LED | LED || VOLUME | +|PRINT SCREEN| | | | | | | PGUP | HOME | PGDN | | DOWN | UP | TOGGLE || DOWN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | VOL | VOL | | | | | | | | | | | | + | | | DOWN | UP | MUTE | | LEFT | DOWN | UP | RIGHT | | | | | MUTE | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | | | | | | | END | | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | ENTER | DELETE | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_VOLU, + KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_HOME, KC_PGDN, KC_TRNS, RGB_VAD, RGB_VAI, RGB_TOG, KC_VOLD, + KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + + [2] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_2/keymaps/levi/keymap.c b/keyboards/system76/launch_2/keymaps/levi/keymap.c new file mode 100644 index 000000000000..ec717e13dc66 --- /dev/null +++ b/keyboards/system76/launch_2/keymaps/levi/keymap.c @@ -0,0 +1,133 @@ +#include QMK_KEYBOARD_H + +static bool lctl_pressed, rctl_pressed, esc_pressed; +void system76_ec_unlock(void); + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, Dvorak layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | { | } | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | ' | , | . | | | | | | | | / | = | || | +| TAB | " | < | > | P | Y | F | G | C | R | L | ? | + | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | - | | | | + | CTRL | A | O | E | U | I | D | H | T | N | S | _ | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | : | | | | | | | | | | | | + | SHIFT | ; | Q | J | K | X | B | M | W | V | Z | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | FN | CTRL | LALT | LGUI | SPACE | FN | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_PGDN, + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_END, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, + MO(2), KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RIGHT + ), + +/* Layer 1, QWERTY layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | CTRL | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | FN | CTRL | LALT | LGUI | SPACE | FN | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [1] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + MO(2), KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 2, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| RESET | | | Insert | | | | | | | | | | || Dvorak | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | LED | LED | LED | || | +| | | | | | | | | | | TOGGLE | DOWN | UP | || Qwerty | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| | Home | Up | End | PgUp | | PgUp | Home | Up | End | | | | PrtScr || | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | | | | | + | | Left | Down | Right | PgDn | | PgDn | Left | Down | Right | | | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | |PlayPaus| Prev | Next | VolDn | VolUp | VolMute| | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | Backspace | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [2] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(0), + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_TRNS, TO(1), + KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_TRNS, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_TRNS, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_TRNS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_LCTL: + lctl_pressed = record->event.pressed; + break; + case KC_RCTL: + rctl_pressed = record->event.pressed; + break; + case KC_ESC: + esc_pressed = record ->event.pressed; + break; + }; + return true; +} + +void matrix_scan_user(void) { + if (lctl_pressed && rctl_pressed && esc_pressed) { + system76_ec_unlock(); + } +} diff --git a/keyboards/system76/launch_2/launch_2.c b/keyboards/system76/launch_2/launch_2.c new file mode 100644 index 000000000000..21bcc6045954 --- /dev/null +++ b/keyboards/system76/launch_2/launch_2.c @@ -0,0 +1,287 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "launch_2.h" + +#include "usb_mux.h" + +#define GPIO_MASK_RESET_USB (1<<3) + +// clang-format off +#ifdef RGB_MATRIX_ENABLE +// LEDs by index +// 0 1 2 3 4 5 6 7 8 9 +// 00 LM4 LL4 LK4 LJ4 LI4 LH4 LG4 LF4 LE4 LD4 +// 10 LC4 LB4 LA4 LA5 LB5 LC5 LD5 LE5 LG5 LH5 +// 20 LI5 LJ5 LK5 LL5 LM5 LO3 LM3 LL3 LK3 LJ3 +// 30 LI3 LH3 LG3 LF3 LE3 LD3 LC3 LB3 LA3 LA2 +// 40 LB2 LC2 LD2 LE2 LF2 LG2 LH2 LI2 LJ2 LK2 +// 50 LL2 LM2 LN2 LO2 LO1 LN1 LM1 LL1 LK1 LJ1 +// 60 LI1 LH1 LG1 LF1 LE1 LD1 LC1 LB1 LA1 LA0 +// 70 LB0 LC0 LD0 LE0 LF0 LG0 LH0 LI0 LJ0 LK0 +// 80 LL0 LM0 LN0 LO0 +led_config_t g_led_config = { { + // Key matrix to LED index +/* A B C D E F G H I J K L M N O */ +/* 0 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, */ +/* 1 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, */ +/* 2 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, */ +/* 3 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, */ +/* 4 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, */ +/* 5 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 */ + { 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82 }, + { 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55 }, + { 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 }, + { 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 83 }, + { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 54 }, + { 13, 14, 15, 16, 17, 25, 18, 19, 20, 21, 22, 23, 24, 53 }, +}, { + // LED index to physical position (see leds.sh in `launch' repo) +/* 00 */ {209, 51}, {190, 51}, {171, 51}, {156, 51}, {140, 51}, {125, 51}, {110, 51}, {95, 51}, {80, 51}, {65, 51}, +/* 10 */ {49, 51}, {34, 51}, {11, 51}, {8, 64}, {27, 64}, {42, 64}, {57, 64}, {80, 64}, {110, 64}, {133, 64}, +/* 20 */ {148, 64}, {167, 64}, {194, 64}, {209, 64}, {224, 64}, {224, 38}, {197, 38}, {178, 38}, {163, 38}, {148, 38}, +/* 30 */ {133, 38}, {118, 38}, {103, 38}, {87, 38}, {72, 38}, {57, 38}, {42, 38}, {27, 38}, {8, 38}, {4, 26}, +/* 40 */ {23, 26}, {38, 26}, {53, 26}, {68, 26}, {84, 26}, {99, 26}, {114, 26}, {129, 26}, {144, 26}, {159, 26}, +/* 50 */ {175, 26}, {190, 26}, {205, 26}, {224, 26}, {224, 13}, {201, 13}, {182, 13}, {167, 13}, {152, 13}, {137, 13}, +/* 60 */ {121, 13}, {106, 13}, {91, 13}, {76, 13}, {61, 13}, {46, 13}, {30, 13}, {15, 13}, {0, 13}, {0, 0}, +/* 70 */ {15, 0}, {30, 0}, {46, 0}, {61, 0}, {76, 0}, {91, 0}, {106, 0}, {121, 0}, {137, 0}, {152, 0}, +/* 80 */ {167, 0}, {182, 0}, {201, 0}, {224, 0} +}, { + // LED index to flags (set all to LED_FLAG_KEYLIGHT) + /* 0 1 2 3 4 5 6 7 8 9 */ +/* 00 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 10 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 20 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 30 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 40 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 50 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 60 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 70 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 80 */ 4, 4, 4, 4 +} }; +#endif // RGB_MATRIX_ENABLE + +bool eeprom_is_valid(void) { + return ( + eeprom_read_word(((void *)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void *)EEPROM_VERSION_ADDR)) == EEPROM_VERSION + ); +} +// clang-format on + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void *)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void *)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void bootmagic_lite_reset_eeprom(void) { + // Set the keyboard-specific EEPROM state as invalid + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid + eeconfig_disable(); +} + +// The lite version of TMK's bootmagic based on Wilba. +// 100% less potential for accidentally making the keyboard do stupid things. +void bootmagic_lite(void) { + // Perform multiple scans because debouncing can't be turned off. + matrix_scan(); +#if defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); +#else + wait_ms(30); +#endif + matrix_scan(); + + // If the configured key (commonly Esc) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + uint8_t row = 0; // BOOTMAGIC_LITE_ROW; + uint8_t col = 0; // BOOTMAGIC_LITE_COLUMN; + + if (matrix_get_row(row) & (1 << col)) { + bootmagic_lite_reset_eeprom(); + + // Jump to bootloader. + bootloader_jump(); + } +} + +void system76_ec_rgb_eeprom(bool write); +void system76_ec_rgb_layer(layer_state_t layer_state); +void system76_ec_unlock(void); +bool system76_ec_is_unlocked(void); + +rgb_config_t layer_rgb[DYNAMIC_KEYMAP_LAYER_COUNT]; + +void matrix_init_kb(void) { + usb_mux_init(); + + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + system76_ec_rgb_eeprom(true); + eeprom_set_valid(true); + } else { + system76_ec_rgb_eeprom(false); + } +} + +void keyboard_post_init_user(void) { + system76_ec_rgb_layer(layer_state); +} + +void matrix_scan_kb(void) { + usb_mux_event(); + + matrix_scan_user(); +} + +#define LEVEL(value) (uint8_t)(((uint16_t)value) * ((uint16_t)RGB_MATRIX_MAXIMUM_BRIGHTNESS) / ((uint16_t)255)) + +// clang-format off +static const uint8_t levels[] = { + LEVEL(48), + LEVEL(72), + LEVEL(96), + LEVEL(144), + LEVEL(192), + LEVEL(255) +}; +// clang-format on + +static uint8_t toggle_level = RGB_MATRIX_MAXIMUM_BRIGHTNESS; +extern bool input_disabled; + +static void set_value_all_layers(uint8_t value) { + if (!system76_ec_is_unlocked()) { + for (int8_t layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) { + layer_rgb[layer].hsv.v = value; + } + system76_ec_rgb_layer(layer_state); + } +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (input_disabled) { + return false; + } + + if (!process_record_user(keycode, record)) { + return false; + } + + switch (keycode) { + case QK_BOOT: + if (record->event.pressed) { + system76_ec_unlock(); + } +#ifdef SYSTEM76_EC + return false; +#else + return true; +#endif + case RGB_VAD: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = sizeof(levels) - 1; i >= 0; i--) { + if (levels[i] < level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_VAI: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = 0; i < sizeof(levels); i++) { + if (levels[i] > level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_TOG: + if (record->event.pressed) { + uint8_t level = 0; + if (rgb_matrix_config.hsv.v == 0) { + level = toggle_level; + } else { + toggle_level = rgb_matrix_config.hsv.v; + } + set_value_all_layers(level); + } + return false; + } + + return true; +} + +layer_state_t layer_state_set_kb(layer_state_t layer_state) { + system76_ec_rgb_layer(layer_state); + + return layer_state_set_user(layer_state); +} + +#ifdef CONSOLE_ENABLE +void keyboard_post_init_user(void) { + debug_enable = true; + debug_matrix = false; + debug_keyboard = false; +} +#endif // CONSOLE_ENABLE + +void bootloader_jump(void) { + + // Disable all peripherals on AT90USB646 + UDCON = 1; + USBCON = (1<. + */ + +#pragma once + +#include "quantum.h" + +// clang-format off +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K5A, K5B \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K0E }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K1E }, \ + { K50, K51, K52, K53, K54, K3D, K55, K56, K57, K58, K59, K5A, K5B, K2E }, \ +} +// clang-format on diff --git a/keyboards/system76/launch_2/post_rules.mk b/keyboards/system76/launch_2/post_rules.mk new file mode 100644 index 000000000000..3751a8b8c31b --- /dev/null +++ b/keyboards/system76/launch_2/post_rules.mk @@ -0,0 +1,12 @@ +# System76 EC +# remove the RESET HID command +VALID_SYSTEM76_EC_TYPES := yes +SYSTEM76_EC_ENABLE ?= no +ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + ifeq ($(filter $(SYSTEM76_EC_ENABLE),$(VALID_SYSTEM76_EC_TYPES)),) + $(error SYSTEM76_EC_EN="$(strip $(SYSTEM76_EC_ENABLE))" is not a valid type for the System76 EC option) + endif + ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + OPT_DEFS += -DSYSTEM76_EC + endif +endif diff --git a/keyboards/system76/launch_2/readme.md b/keyboards/system76/launch_2/readme.md new file mode 100644 index 000000000000..066e54ada7b4 --- /dev/null +++ b/keyboards/system76/launch_2/readme.md @@ -0,0 +1,62 @@ +# System76 Launch Configurable Keyboard (launch_2) + +![System76 Launch Configurable Keyboard](https://images.prismic.io/system76/b71307ac-dae6-4863-b7ca-804cd61c7ef8_launch_overhead.png?auto=compress,format&w=750) + +The Launch Configurable Keyboard is engineered to be comfortable, fully customizable, and make your workflow more efficient. + +- High-speed USB Hub +- Works on Linux, Windows and macOS +- 100% Open Source +- Made in Colorado + +Additional Launch Keyboard resources: + +- Keyboard Maintainer: [System76](https://github.com/system76) +- Hardware Supported: [System76 Launch GitHub Repository](https://github.com/system76/launch) +- Hardware Availability: [Shop System76](https://system76.com/accessories/launch) + +## Building Firmware + +To build the firmware using `make` (after setting up the build environment), e.g.: + +```bash +make -r system76/launch_2:default +``` + +Equivalently, using the QMK CLI: + +```bash +qmk compile -kb system76/launch_2 -km default +``` + +## Flashing Firmware (DFU) + +To build and flash the firmware on the keyboard, e.g.: + +```bash +make -r system76/launch_2:default:flash +``` + +Equivalently, using the QMK CLI: + +```bash +qmk flash -kb system76/launch_2 -km default +``` + +## Flashing Firmware (ISP) + +To flash the firmware (and/or bootloader) using ISP refer to the [_ISP Flashing Guide_](https://docs.qmk.fm/#/isp_flashing_guide). + +> **Factory fuse values** => Low: `0x5E`, High: `0x99`, Extended: `0xF3`, Lock Bits: `0xFF` + +## Environment Setup + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. If new to QMK, start with the [_Complete Newbs Guide_](https://docs.qmk.fm/#/newbs). + +## Bootloader + +Enter the bootloader in 3 ways: + +- **Bootmagic reset**: Hold down the key at (0,0) in the matrix (Escape) and plug in the keyboard. +- **Keycode in layout**: Press the key mapped to `QK_BOOT` in the second layer (Escape). +- **Electrical reset**: Briefly short AVR ISP's GND (6) and RST (5) pads on the back of the PCB. diff --git a/keyboards/system76/launch_2/rgb_matrix_kb.inc b/keyboards/system76/launch_2/rgb_matrix_kb.inc new file mode 100644 index 000000000000..02de10ed500e --- /dev/null +++ b/keyboards/system76/launch_2/rgb_matrix_kb.inc @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +RGB_MATRIX_EFFECT(active_keys) +RGB_MATRIX_EFFECT(raw_rgb) +RGB_MATRIX_EFFECT(unlocked) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "dynamic_keymap.h" + +static bool active_keys_initialized = false; +static uint8_t active_keys_table[RGB_MATRIX_LED_COUNT] = {0}; + +static void active_keys_initialize(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + uint8_t led = g_led_config.matrix_co[row][col]; + if (led < RGB_MATRIX_LED_COUNT && row < 16 && col < 16) { + active_keys_table[led] = (row << 4) | col; + } + } + } + active_keys_initialized = true; +} + +static bool active_keys(effect_params_t* params) { + if (!active_keys_initialized) { + active_keys_initialize(); + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + uint8_t layer = get_highest_layer(layer_state); + RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + uint8_t rowcol = active_keys_table[i]; + uint8_t row = rowcol >> 4; + uint8_t col = rowcol & 0xF; + uint16_t keycode = dynamic_keymap_get_keycode(layer, row, col); + switch (keycode) { + case KC_NO: + case KC_TRNS: + rgb_matrix_set_color(i, 0, 0, 0); + break; + default: + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + break; + } + } + + return led_max < RGB_MATRIX_LED_COUNT; +} + +RGB raw_rgb_data[RGB_MATRIX_LED_COUNT] = {0}; + +static uint8_t normalize_component(uint8_t component) { + uint16_t x = (uint16_t)component; + x *= rgb_matrix_config.hsv.v; // Multiply by current brightness + x /= 255; // Divide by maximum brightness + return (uint8_t)x; +} + +static RGB normalize_index(uint8_t i) { + RGB raw = raw_rgb_data[i]; + RGB rgb = { + .r = normalize_component(raw.r), + .g = normalize_component(raw.g), + .b = normalize_component(raw.b), + }; + return rgb; +} + +static bool raw_rgb(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = normalize_index(i); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +static uint8_t unlocked_keys[8][2] = { + {2, 7}, // U + {4, 6}, // N + {3, 9}, // L + {2, 9}, // O + {4, 3}, // C + {3, 8}, // K + {2, 3}, // E + {3, 3}, // D +}; + +static uint8_t unlocked_ticks = 0; +static uint8_t unlocked_i = 0; +static uint8_t unlocked_leds_count = 0; +static uint8_t unlocked_leds[2] = {0, 0}; + +static bool unlocked(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + unlocked_ticks++; + + if (params->init) { + unlocked_ticks = 0; + unlocked_i = 0; + } + + if (unlocked_ticks == 0) { + if (unlocked_i == 8) { + unlocked_leds_count = 0; + unlocked_i = 0; + } else { + unlocked_leds_count = rgb_matrix_map_row_column_to_led(unlocked_keys[unlocked_i][0], unlocked_keys[unlocked_i][1], unlocked_leds); + unlocked_i++; + } + } + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv = { + .h = i + unlocked_ticks, + .s = 0xFF, + .v = 0x70, + }; + for (uint8_t j = 0; j < unlocked_leds_count; j++) { + if (i == unlocked_leds[j]) { + hsv.s = 0; + hsv.v = 0xFF; + } + } + + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/system76/launch_2/rules.mk b/keyboards/system76/launch_2/rules.mk new file mode 100644 index 000000000000..e20aa1fd585f --- /dev/null +++ b/keyboards/system76/launch_2/rules.mk @@ -0,0 +1,27 @@ +# CPU frequency divided by two since AVR is at 3.3 V +F_CPU = 8000000 + +# External oscillator is 16 MHz +F_USB = 16000000 + +# Build options +# change yes to no to disable +BOOTMAGIC_ENABLE = no # Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and system control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +NKRO_ENABLE = yes # USB N-key rollover +RAW_ENABLE = yes # Raw HID commands (used by Keyboard Configurator) +BACKLIGHT_ENABLE = no # RGB backlight (conflicts with RGB matrix) +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = yes # RGB matrix +RGB_MATRIX_DRIVER = WS2812 +RGB_MATRIX_CUSTOM_KB = yes # Custom keyboard effects +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes # Link-time optimization for smaller binary + +# Add System76 EC command interface as well as I2C and USB mux drivers +SRC += system76_ec.c usb_mux.c +QUANTUM_LIB_SRC += i2c_master.c diff --git a/keyboards/system76/launch_2/usb_mux.c b/keyboards/system76/launch_2/usb_mux.c new file mode 100644 index 000000000000..808f0bb3a72d --- /dev/null +++ b/keyboards/system76/launch_2/usb_mux.c @@ -0,0 +1,525 @@ +/* + * Copyright (C) 2021 System76 + * Copyright (C) 2021 Jimmy Cassis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include +#include "quantum.h" + +#include + +#include "i2c_master.h" +#include "wait.h" +#include "usb_mux.h" + +#define GPIO_RESET_USB A3 + +#define REG_PF1_CTL 0xBF800C04 +#define REG_PIO64_OEN 0xBF800908 +#define REG_PIO64_OUT 0xBF800928 +#define REG_VID 0xBF803000 +#define REG_PRT_SWAP 0xBF8030FA +#define REG_USB3_HUB_VID 0xBF809048 +#define REG_RUNTIME_FLAGS2 0xBFD23408 +#define REG_I2S_FEAT_SEL 0xBFD23412 + +struct USB7006 { + uint8_t addr; +}; + +struct USB7006 usb_hub = {.addr = 0x2D}; + +// Perform USB7006 register access. +// Returns zero on success or a negative number on error. +i2c_status_t usb7006_register_access(struct USB7006* self) { + uint8_t register_access[3] = { + 0x99, + 0x37, + 0x00, + }; + + return i2c_transmit(self->addr << 1, register_access, sizeof(register_access), I2C_TIMEOUT); +} + +// Read data from USB7006 register region. +// Returns number of bytes read on success or a negative number on error. +i2c_status_t usb7006_read_reg(struct USB7006* self, uint32_t addr, uint8_t* data, int length) { + i2c_status_t status; + + uint8_t register_read[9] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + 0x06, // Number of bytes to write to command block buffer area + 0x01, // Direction: 0 = write, 1 = read + (uint8_t)length, // Number of bytes to read from register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + }; + + status = i2c_transmit(self->addr << 1, register_read, sizeof(register_read), I2C_TIMEOUT); + if (status < 0) { + return status; + } + + status = usb7006_register_access(self); + if (status < 0) { + return status; + } + + uint8_t read[2] = { + 0x00, // Buffer address MSB: always 0 + 0x06, // Buffer address LSB: 6 to skip header + }; + + status = i2c_start((self->addr << 1) | I2C_WRITE, I2C_TIMEOUT); + if (status >= 0) { + for (uint16_t i = 0; i < sizeof(read); i++) { + status = i2c_write(read[i], I2C_TIMEOUT); + if (status < 0) { + goto error; + } + } + } else { + goto error; + } + + status = i2c_start((self->addr << 1) | I2C_READ, I2C_TIMEOUT); + if (status < 0) { + goto error; + } + + // Read and ignore buffer length + status = i2c_read_ack(I2C_TIMEOUT); + if (status < 0) { + goto error; + } + + for (uint16_t i = 0; i < (length - 1) && status >= 0; i++) { + status = i2c_read_ack(I2C_TIMEOUT); + if (status >= 0) { + data[i] = (uint8_t)status; + } + } + + if (status >= 0) { + status = i2c_read_nack(I2C_TIMEOUT); + if (status >= 0) { + data[(length - 1)] = (uint8_t)status; + } + } + +error: + i2c_stop(); + + return (status < 0) ? status : length; +} + +// Read 32-bit value from USB7006 register region. +// Returns number of bytes read on success or a negative number on error. +i2c_status_t usb7006_read_reg_32(struct USB7006* self, uint32_t addr, uint32_t* data) { + i2c_status_t status; + + // First byte is available length + uint8_t bytes[4] = {0, 0, 0, 0}; + + status = usb7006_read_reg(self, addr, bytes, sizeof(bytes)); + if (status < 0) { + return status; + } + + // Convert from little endian + *data = (((uint32_t)bytes[0]) << 0) | (((uint32_t)bytes[1]) << 8) | (((uint32_t)bytes[2]) << 16) | (((uint32_t)bytes[3]) << 24); + + return status; +} + +// Write data to USB7006 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7006_write_reg(struct USB7006* self, uint32_t addr, uint8_t* data, int length) { + i2c_status_t status; + + uint8_t register_write[9] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + ((uint8_t)length) + 6, // Number of bytes to write to command block buffer area + 0x00, // Direction: 0 = write, 1 = read + (uint8_t)length, // Number of bytes to write to register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + }; + + status = i2c_start((self->addr << 1) | I2C_WRITE, I2C_TIMEOUT); + if (status >= 0) { + for (uint16_t i = 0; i < sizeof(register_write); i++) { + status = i2c_write(register_write[i], I2C_TIMEOUT); + if (status < 0) { + goto error; + } + } + + for (uint16_t i = 0; i < length; i++) { + status = i2c_write(data[i], I2C_TIMEOUT); + if (status < 0) { + goto error; + } + } + } else { + goto error; + } + + i2c_stop(); + + status = usb7006_register_access(self); + if (status < 0) { + goto error; + } + +error: + i2c_stop(); + + return (status < 0) ? status : length; +} + +// Write 8-bit value to USB7006 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7006_write_reg_8(struct USB7006* self, uint32_t addr, uint8_t data) { return usb7006_write_reg(self, addr, &data, sizeof(data)); } + +// Write 32-bit value to USB7006 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7006_write_reg_32(struct USB7006* self, uint32_t addr, uint32_t data) { + // Convert to little endian + uint8_t bytes[4] = { + (uint8_t)(data >> 0), + (uint8_t)(data >> 8), + (uint8_t)(data >> 16), + (uint8_t)(data >> 24), + }; + + return usb7006_write_reg(self, addr, bytes, sizeof(bytes)); +} + +// Initialize USB7006. +// Returns zero on success or a negative number on error. +int usb7006_init(struct USB7006* self) { + i2c_status_t status; + uint32_t data; + + // DM and DP are swapped on ports 2 and 3 + status = usb7006_write_reg_8(self, REG_PRT_SWAP, 0x0C); + if (status < 0) { + return status; + } + + // Disable audio + status = usb7006_write_reg_8(self, REG_I2S_FEAT_SEL, 0); + if (status < 0) { + return status; + } + + // Set HFC_DISABLE + data = 0; + status = usb7006_read_reg_32(self, REG_RUNTIME_FLAGS2, &data); + if (status < 0) { + return status; + } + data |= 1; + status = usb7006_write_reg_32(self, REG_RUNTIME_FLAGS2, data); + if (status < 0) { + return status; + } + + // Set Vendor ID and Product ID of USB 2 hub + status = usb7006_write_reg_32(self, REG_VID, 0x00033384); + if (status < 0) { + return status; + } + + // Set Vendor ID and Product ID of USB 3 hub + status = usb7006_write_reg_32(self, REG_USB3_HUB_VID, 0x00043384); + if (status < 0) { + return status; + } + + return 0; +} + +// Attach USB7006. +// Returns bytes written on success or a negative number on error. +i2c_status_t usb7006_attach(struct USB7006* self) { + uint8_t data[3] = { + 0xAA, + 0x56, + 0x00, + }; + + return i2c_transmit(self->addr << 1, data, sizeof(data), I2C_TIMEOUT); +} + +struct USB7006_GPIO { + struct USB7006* usb7006; + uint32_t pf; +}; + +struct USB7006_GPIO usb_gpio_sink = {.usb7006 = &usb_hub, .pf = 29}; // UP_SEL = PF29 = GPIO93 +struct USB7006_GPIO usb_gpio_source_left = {.usb7006 = &usb_hub, .pf = 10}; // CL_SEL = PF10 = GPIO74 +struct USB7006_GPIO usb_gpio_source_right = {.usb7006 = &usb_hub, .pf = 25}; // CR_SEL = PF25 = GPIO88 + +// Set USB7006 GPIO to specified value. +// Returns zero on success or negative number on error. +i2c_status_t usb7006_gpio_set(struct USB7006_GPIO* self, bool value) { + i2c_status_t status; + uint32_t data; + + data = 0; + status = usb7006_read_reg_32(self->usb7006, REG_PIO64_OUT, &data); + if (status < 0) { + return status; + } + + if (value) { + data |= (((uint32_t)1) << self->pf); + } else { + data &= ~(((uint32_t)1) << self->pf); + } + status = usb7006_write_reg_32(self->usb7006, REG_PIO64_OUT, data); + if (status < 0) { + return status; + } + + return 0; +} + +// Initialize USB7006 GPIO. +// Returns zero on success or a negative number on error. +i2c_status_t usb7006_gpio_init(struct USB7006_GPIO* self) { + i2c_status_t status; + uint32_t data; + + // Set programmable function to GPIO + status = usb7006_write_reg_8(self->usb7006, REG_PF1_CTL + (self->pf - 1), 0); + if (status < 0) { + return status; + } + + // Set GPIO to false by default + usb7006_gpio_set(self, false); + + // Set GPIO to output + data = 0; + status = usb7006_read_reg_32(self->usb7006, REG_PIO64_OEN, &data); + if (status < 0) { + return status; + } + + data |= (((uint32_t)1) << self->pf); + status = usb7006_write_reg_32(self->usb7006, REG_PIO64_OEN, data); + if (status < 0) { + return status; + } + + return 0; +} + +#define TCPC_CC_STATUS 0x1D +#define TCPC_ROLE_CONTROL 0x1A +#define TCPC_COMMAND 0x23 + +enum TCPC_TYPE { + TCPC_TYPE_SINK, + TCPC_TYPE_SOURCE, +}; + +struct PTN5110 { + enum TCPC_TYPE type; + uint8_t addr; + uint8_t cc; + struct USB7006_GPIO * gpio; +}; + +struct PTN5110 usb_sink = { .type = TCPC_TYPE_SINK, .addr = 0x51, .gpio = &usb_gpio_sink }; +struct PTN5110 usb_source_left = { .type = TCPC_TYPE_SOURCE, .addr = 0x52, .gpio = &usb_gpio_source_left }; +struct PTN5110 usb_source_right = { .type = TCPC_TYPE_SOURCE, .addr = 0x50, .gpio = &usb_gpio_source_right }; + +// Read PTN5110 CC_STATUS +// Returns bytes read on success or negative number on error +int ptn5110_get_cc_status(struct PTN5110 * self, uint8_t * cc) { + return i2c_readReg(self->addr << 1, TCPC_CC_STATUS, cc, 1, I2C_TIMEOUT); +} + +// Write PTN5110 ROLE_CONTROL +// Returns bytes written on success or negative number on error +int ptn5110_set_role_control(struct PTN5110 * self, uint8_t role_control) { + return i2c_writeReg(self->addr << 1, TCPC_ROLE_CONTROL, &role_control, 1, I2C_TIMEOUT); +} + +// Set PTN5110 SSMUX orientation. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_set_ssmux(struct PTN5110* self, bool orientation) { return usb7006_gpio_set(self->gpio, orientation); } + +// Write PTN5110 COMMAND. +// Returns zero on success or negative number on error. +i2c_status_t ptn5110_command(struct PTN5110* self, uint8_t command) { return i2c_writeReg(self->addr << 1, TCPC_COMMAND, &command, 1, I2C_TIMEOUT); } + +// Set orientation of PTN5110 operating as a sink, call this once. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_sink_set_orientation(struct PTN5110* self) { + i2c_status_t status; + uint8_t cc; + + status = ptn5110_get_cc_status(self, &cc); + if (status < 0) { + return status; + } + + if ((cc & 0x03) == 0) { + status = ptn5110_set_ssmux(self, false); + if (status < 0) { + return status; + } + } else { + status = ptn5110_set_ssmux(self, true); + if (status < 0) { + return status; + } + } + + return 0; +} + +// Update PTN5110 operating as a source, call this repeatedly. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_source_update(struct PTN5110* self) { + i2c_status_t status; + uint8_t cc; + + status = ptn5110_get_cc_status(self, &cc); + if (status < 0) { + return status; + } + + if (cc != self->cc) { + // WARNING: Setting this here will disable retries + self->cc = cc; + + bool connected = false; + bool orientation = false; + if ((cc & 0x03) == 2) { + connected = true; + orientation = true; + } else if (((cc >> 2) & 0x03) == 2) { + connected = true; + orientation = false; + } + + if (connected) { + // Set SS mux orientation + status = ptn5110_set_ssmux(self, orientation); + if (status < 0) { + return status; + } + + // Enable source Vbus command + status = ptn5110_command(self, 0b01110111); + if (status < 0) { + return status; + } + } else { + // Disable source Vbus command + status = ptn5110_command(self, 0b01100110); + if (status < 0) { + return status; + } + } + } + + return 0; +} + +// Initialize PTN5110 +// Returns zero on success or negative number on error +int ptn5110_init(struct PTN5110 * self) { + int res; + + // Set last cc to invalid value, to force update + self->cc = 0xFF; + + // Initialize GPIO + res = usb7006_gpio_init(self->gpio); + if (res < 0) return res; + + switch (self->type) { + case TCPC_TYPE_SINK: + res = ptn5110_sink_set_orientation(self); + if (res < 0) return res; + break; + case TCPC_TYPE_SOURCE: + res = ptn5110_set_role_control(self, 0x05); + if (res < 0) return res; + break; + } + + return 0; +} + +void usb_mux_event(void) { + // Run this on every 1000th matrix scan + static int cycle = 0; + if (cycle >= 1000) { + cycle = 0; + ptn5110_source_update(&usb_source_left); + ptn5110_source_update(&usb_source_right); + } else { + cycle += 1; + } +} + +void usb_mux_init(void) { + // Put the USB hub in reset + setPinOutput(GPIO_RESET_USB); + writePinLow(GPIO_RESET_USB); + + + // Run I2C bus at 100 kHz + i2c_init(); + + _delay_ms(10); + writePinHigh(GPIO_RESET_USB); + + + _delay_ms(100); + // Set up hub + usb7006_init(&usb_hub); + + // Set up sink + ptn5110_init(&usb_sink); + + // Set up sources + ptn5110_init(&usb_source_left); + ptn5110_init(&usb_source_right); + + // Attach hub + usb7006_attach(&usb_hub); + + // Ensure orientation is correct after attaching hub + // TODO: Find reason why GPIO for sink orientation is reset + for (int i = 0; i < 100; i++) { + ptn5110_sink_set_orientation(&usb_sink); + wait_ms(10); + } +} diff --git a/keyboards/system76/launch_2/usb_mux.h b/keyboards/system76/launch_2/usb_mux.h new file mode 100644 index 000000000000..26f84de864b6 --- /dev/null +++ b/keyboards/system76/launch_2/usb_mux.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +void usb_mux_init(void); +void usb_mux_event(void); diff --git a/keyboards/system76/launch_3/config.h b/keyboards/system76/launch_3/config.h new file mode 100644 index 000000000000..2a678c3796b4 --- /dev/null +++ b/keyboards/system76/launch_3/config.h @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + + +/* + * Key matrix pins + * ROWS: GPIO pins used for rows, top to bottom + * COLS: GPIO pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { GP24, GP23, GP22, GP21, GP28, GP15 } +#define MATRIX_COL_PINS { GP12, GP11, GP10, GP9, GP8, GP6, GP13, GP14, GP16, GP17, GP18, GP19, GP7, GP25 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +#ifdef RGB_MATRIX_ENABLE +# define RGB_DI_PIN GP5 +# define RGB_MATRIX_LED_COUNT 84 +# define RGB_MATRIX_KEYPRESSES // Reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // Reacts to keyreleases (instead of keypresses) +// # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enables framebuffer effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Turns off effects when suspended +// Limit brightness to support USB-A at 0.5 A +// TODO: Do this dynamically based on power source +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 176 // Limits maximum brightness of LEDs to 176 out of 255. If not defined, maximum brightness is set to 255 +# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Sets the default mode, if none has been set +# define RGB_MATRIX_DEFAULT_HUE 142 // Sets the default hue value, if none has been set +# define RGB_MATRIX_DEFAULT_SAT 255 // Sets the default saturation value, if none has been set +# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set +# define RGB_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set +# define RGB_MATRIX_DISABLE_KEYCODES // Disables control of rgb matrix by keycodes (must use code functions to control the feature) + +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +#endif // RGB_MATRIX_ENABLE + +// Mechanical locking support; use KC_LCAP, KC_LNUM, or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// I2C { +#define I2C_DRIVER I2CD2 +#define I2C1_CLOCK_SPEED 100000UL // Run I2C bus at 100 kHz +#define I2C1_SCL_PIN GP27 +#define I2C1_SDA_PIN GP26 +// } I2C + +// EEPROM { +#define EEPROM_SIZE 1024 +// TODO: Refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x02 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) +// } EEPROM + +// Dynamic keymap { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 +#define DYNAMIC_KEYMAP_MACRO_COUNT 0 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +// Dynamic macro starts after dynamic keymaps, it is disabled +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2)) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 0 +// } Dynamic keymap + +// System76 EC { +#define SYSTEM76_EC_EEPROM_ADDR (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE) +#define SYSTEM76_EC_EEPROM_SIZE (EEPROM_SIZE - SYSTEM76_EC_EEPROM_ADDR) +// } System76 EC diff --git a/keyboards/system76/launch_3/halconf.h b/keyboards/system76/launch_3/halconf.h new file mode 100644 index 000000000000..8c220f68b6af --- /dev/null +++ b/keyboards/system76/launch_3/halconf.h @@ -0,0 +1,21 @@ +/* Copyright 2023 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/system76/launch_3/info.json b/keyboards/system76/launch_3/info.json new file mode 100644 index 000000000000..29b21bcbcd7e --- /dev/null +++ b/keyboards/system76/launch_3/info.json @@ -0,0 +1,102 @@ +{ + "keyboard_name": "Launch Configurable Keyboard (launch_3)", + "manufacturer": "System76", + "url": "https://system76.com/accessories/launch", + "usb": { + "vid": "0x3384", + "pid": "0x0009", + "device_version": "0.0.1" + }, + "processor": "RP2040", + "bootloader": "rp2040", + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "Esc", "x": 0, "y": 0 }, + { "label": "F1", "x": 1, "y": 0 }, + { "label": "F2", "x": 2, "y": 0 }, + { "label": "F3", "x": 3, "y": 0 }, + { "label": "F4", "x": 4, "y": 0 }, + { "label": "F5", "x": 5, "y": 0 }, + { "label": "F6", "x": 6, "y": 0 }, + { "label": "F7", "x": 7, "y": 0 }, + { "label": "F8", "x": 8, "y": 0 }, + { "label": "F9", "x": 9, "y": 0 }, + { "label": "F10", "x": 10, "y": 0 }, + { "label": "F11", "x": 11, "y": 0 }, + { "label": "F12", "x": 12, "y": 0 }, + { "label": "Del", "x": 13, "y": 0, "w": 1.5 }, + { "label": "Home", "x": 14.75, "y": 0 }, + { "label": "`", "x": 0, "y": 1 }, + { "label": "1", "x": 1, "y": 1 }, + { "label": "2", "x": 2, "y": 1 }, + { "label": "3", "x": 3, "y": 1 }, + { "label": "4", "x": 4, "y": 1 }, + { "label": "5", "x": 5, "y": 1 }, + { "label": "6", "x": 6, "y": 1 }, + { "label": "7", "x": 7, "y": 1 }, + { "label": "8", "x": 8, "y": 1 }, + { "label": "9", "x": 9, "y": 1 }, + { "label": "0", "x": 10, "y": 1 }, + { "label": "-", "x": 11, "y": 1 }, + { "label": "=", "x": 12, "y": 1 }, + { "label": "Bksp", "x": 13, "y": 1, "w": 1.5 }, + { "label": "PgUp", "x": 14.75, "y": 1 }, + { "label": "Tab", "x": 0, "y": 2, "w": 1.5 }, + { "label": "Q", "x": 1.5, "y": 2 }, + { "label": "W", "x": 2.5, "y": 2 }, + { "label": "E", "x": 3.5, "y": 2 }, + { "label": "R", "x": 4.5, "y": 2 }, + { "label": "T", "x": 5.5, "y": 2 }, + { "label": "Y", "x": 6.5, "y": 2 }, + { "label": "U", "x": 7.5, "y": 2 }, + { "label": "I", "x": 8.5, "y": 2 }, + { "label": "O", "x": 9.5, "y": 2 }, + { "label": "P", "x": 10.5, "y": 2 }, + { "label": "[", "x": 11.5, "y": 2 }, + { "label": "]", "x": 12.5, "y": 2 }, + { "label": "\\", "x": 13.5, "y": 2 }, + { "label": "PgDn", "x": 14.75, "y": 2 }, + { "label": "Caps", "x": 0.25, "y": 3, "w": 1.5 }, + { "label": "A", "x": 1.75, "y": 3 }, + { "label": "S", "x": 2.75, "y": 3 }, + { "label": "D", "x": 3.75, "y": 3 }, + { "label": "F", "x": 4.75, "y": 3 }, + { "label": "G", "x": 5.75, "y": 3 }, + { "label": "H", "x": 6.75, "y": 3 }, + { "label": "J", "x": 7.75, "y": 3 }, + { "label": "K", "x": 8.75, "y": 3 }, + { "label": "L", "x": 9.75, "y": 3 }, + { "label": ";", "x": 10.75, "y": 3 }, + { "label": "'", "x": 11.75, "y": 3 }, + { "label": "Enter", "x": 12.75, "y": 3, "w": 1.5 }, + { "label": "End", "x": 14.75, "y": 3 }, + { "label": "LShift", "x": 0.25, "y": 4, "w": 2 }, + { "label": "Z", "x": 2.25, "y": 4 }, + { "label": "X", "x": 3.25, "y": 4 }, + { "label": "C", "x": 4.25, "y": 4 }, + { "label": "V", "x": 5.25, "y": 4 }, + { "label": "B", "x": 6.25, "y": 4 }, + { "label": "N", "x": 7.25, "y": 4 }, + { "label": "M", "x": 8.25, "y": 4 }, + { "label": ",", "x": 9.25, "y": 4 }, + { "label": ".", "x": 10.25, "y": 4 }, + { "label": "/", "x": 11.25, "y": 4 }, + { "label": "RShift", "x": 12.25, "y": 4, "w": 1.5 }, + { "label": "Up", "x": 13.75, "y": 4 }, + { "label": "LCtrl", "x": 0.25, "y": 5, "w": 1.5 }, + { "label": "LAlt", "x": 1.75, "y": 5 }, + { "label": "LFn", "x": 2.75, "y": 5 }, + { "label": "Super", "x": 3.75, "y": 5 }, + { "label": "Space", "x": 4.75, "y": 5, "w": 2 }, + { "label": "Space", "x": 6.75, "y": 5, "w": 2 }, + { "label": "RCtrl", "x": 8.75, "y": 5 }, + { "label": "RAlt", "x": 9.75, "y": 5 }, + { "label": "RFn", "x": 10.75, "y": 5, "w": 1.5 }, + { "label": "Left", "x": 12.75, "y": 5 }, + { "label": "Down", "x": 13.75, "y": 5 }, + { "label": "Right", "x": 14.75, "y": 5 } + ] + } + } +} diff --git a/keyboards/system76/launch_3/keymaps/default/keymap.c b/keyboards/system76/launch_3/keymaps/default/keymap.c new file mode 100644 index 000000000000..3efec2d1df4e --- /dev/null +++ b/keyboards/system76/launch_3/keymaps/default/keymap.c @@ -0,0 +1,91 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | CTRL | LALT | FN | LGUI | SPACE | SPACE | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LALT, MO(1), KC_LGUI, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || PLAY/ | +| QK_BOOT | | | | | | | | | | | | | || PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | LED | LED | LED | || VOLUME | +| | | | | | | | | | | TOGGLE | DOWN | UP | || UP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || VOLUME | +|PRINT SCREEN| | | | | | HOME | PGDN | PGUP | END | | | | || DOWN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | | | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | | | | | MUTE | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'QK_BOOT' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_TRNS, KC_VOLU, + KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + + [2] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_3/launch_3.c b/keyboards/system76/launch_3/launch_3.c new file mode 100644 index 000000000000..a11c8527588a --- /dev/null +++ b/keyboards/system76/launch_3/launch_3.c @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "launch_3.h" +#include "eeprom.h" +#include "usb_mux.h" + +// clang-format off +#ifdef RGB_MATRIX_ENABLE +// LEDs by index +// 0 1 2 3 4 5 6 7 8 9 +// 00 LM4 LL4 LK4 LJ4 LI4 LH4 LG4 LF4 LE4 LD4 +// 10 LC4 LB4 LA4 LA5 LB5 LC5 LD5 LE5 LG5 LH5 +// 20 LI5 LJ5 LK5 LL5 LM5 LO3 LM3 LL3 LK3 LJ3 +// 30 LI3 LH3 LG3 LF3 LE3 LD3 LC3 LB3 LA3 LA2 +// 40 LB2 LC2 LD2 LE2 LF2 LG2 LH2 LI2 LJ2 LK2 +// 50 LL2 LM2 LN2 LO2 LO1 LN1 LM1 LL1 LK1 LJ1 +// 60 LI1 LH1 LG1 LF1 LE1 LD1 LC1 LB1 LA1 LA0 +// 70 LB0 LC0 LD0 LE0 LF0 LG0 LH0 LI0 LJ0 LK0 +// 80 LL0 LM0 LN0 LO0 +led_config_t g_led_config = { { + // Key matrix to LED index +/* A B C D E F G H I J K L M N O */ +/* 0 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, */ +/* 1 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, */ +/* 2 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, */ +/* 3 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, */ +/* 4 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, */ +/* 5 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 */ + { 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82 }, + { 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55 }, + { 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 }, + { 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 83 }, + { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 54 }, + { 13, 14, 15, 16, 17, 25, 18, 19, 20, 21, 22, 23, 24, 53 }, +}, { + // LED index to physical position (see leds.sh in `launch' repo) +/* 00 */ {209, 51}, {190, 51}, {171, 51}, {156, 51}, {140, 51}, {125, 51}, {110, 51}, {95, 51}, {80, 51}, {65, 51}, +/* 10 */ {49, 51}, {34, 51}, {11, 51}, {8, 64}, {27, 64}, {42, 64}, {57, 64}, {80, 64}, {110, 64}, {133, 64}, +/* 20 */ {148, 64}, {167, 64}, {194, 64}, {209, 64}, {224, 64}, {224, 38}, {197, 38}, {178, 38}, {163, 38}, {148, 38}, +/* 30 */ {133, 38}, {118, 38}, {103, 38}, {87, 38}, {72, 38}, {57, 38}, {42, 38}, {27, 38}, {8, 38}, {4, 26}, +/* 40 */ {23, 26}, {38, 26}, {53, 26}, {68, 26}, {84, 26}, {99, 26}, {114, 26}, {129, 26}, {144, 26}, {159, 26}, +/* 50 */ {175, 26}, {190, 26}, {205, 26}, {224, 26}, {224, 13}, {201, 13}, {182, 13}, {167, 13}, {152, 13}, {137, 13}, +/* 60 */ {121, 13}, {106, 13}, {91, 13}, {76, 13}, {61, 13}, {46, 13}, {30, 13}, {15, 13}, {0, 13}, {0, 0}, +/* 70 */ {15, 0}, {30, 0}, {46, 0}, {61, 0}, {76, 0}, {91, 0}, {106, 0}, {121, 0}, {137, 0}, {152, 0}, +/* 80 */ {167, 0}, {182, 0}, {201, 0}, {224, 0} +}, { + // LED index to flags (set all to LED_FLAG_KEYLIGHT) + /* 0 1 2 3 4 5 6 7 8 9 */ +/* 00 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 10 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 20 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 30 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 40 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 50 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 60 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 70 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 80 */ 4, 4, 4, 4 +} }; +#endif // RGB_MATRIX_ENABLE + +bool eeprom_is_valid(void) { + return ( + eeprom_read_word(((void *)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void *)EEPROM_VERSION_ADDR)) == EEPROM_VERSION + ); +} +// clang-format on + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void *)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void *)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void bootmagic_lite_reset_eeprom(void) { + // Set the keyboard-specific EEPROM state as invalid + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid + eeconfig_disable(); +} + +// The lite version of TMK's bootmagic based on Wilba. +// 100% less potential for accidentally making the keyboard do stupid things. +void bootmagic_lite(void) { + // Perform multiple scans because debouncing can't be turned off. + matrix_scan(); +#if defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); +#else + wait_ms(30); +#endif + matrix_scan(); + + // If the configured key (commonly Esc) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + uint8_t row = 0; // BOOTMAGIC_LITE_ROW; + uint8_t col = 0; // BOOTMAGIC_LITE_COLUMN; + + if (matrix_get_row(row) & (1 << col)) { + bootmagic_lite_reset_eeprom(); + + // Jump to bootloader. + bootloader_jump(); + } +} + +void system76_ec_rgb_eeprom(bool write); +void system76_ec_rgb_layer(layer_state_t layer_state); +void system76_ec_unlock(void); +bool system76_ec_is_unlocked(void); + +rgb_config_t layer_rgb[DYNAMIC_KEYMAP_LAYER_COUNT]; + +void matrix_init_kb(void) { + usb_mux_init(); + + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + system76_ec_rgb_eeprom(true); + eeprom_set_valid(true); + } else { + system76_ec_rgb_eeprom(false); + } +} + +void keyboard_post_init_user(void) { + system76_ec_rgb_layer(layer_state); +} + +void matrix_scan_kb(void) { + usb_mux_event(); + + matrix_scan_user(); +} + +#define LEVEL(value) (uint8_t)(((uint16_t)value) * ((uint16_t)RGB_MATRIX_MAXIMUM_BRIGHTNESS) / ((uint16_t)255)) + +// clang-format off +static const uint8_t levels[] = { + LEVEL(48), + LEVEL(72), + LEVEL(96), + LEVEL(144), + LEVEL(192), + LEVEL(255) +}; +// clang-format on + +static uint8_t toggle_level = RGB_MATRIX_MAXIMUM_BRIGHTNESS; +extern bool input_disabled; + +static void set_value_all_layers(uint8_t value) { + if (!system76_ec_is_unlocked()) { + for (int8_t layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) { + layer_rgb[layer].hsv.v = value; + } + system76_ec_rgb_layer(layer_state); + } +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (input_disabled) { + return false; + } + + if (!process_record_user(keycode, record)) { + return false; + } + + switch (keycode) { + case QK_BOOT: + if (record->event.pressed) { + system76_ec_unlock(); + } +#ifdef SYSTEM76_EC + return false; +#else + return true; +#endif + case RGB_VAD: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = sizeof(levels) - 1; i >= 0; i--) { + if (levels[i] < level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_VAI: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = 0; i < sizeof(levels); i++) { + if (levels[i] > level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_TOG: + if (record->event.pressed) { + uint8_t level = 0; + if (rgb_matrix_config.hsv.v == 0) { + level = toggle_level; + } else { + toggle_level = rgb_matrix_config.hsv.v; + } + set_value_all_layers(level); + } + return false; + } + + return true; +} + +layer_state_t layer_state_set_kb(layer_state_t layer_state) { + system76_ec_rgb_layer(layer_state); + + return layer_state_set_user(layer_state); +} + +#ifdef CONSOLE_ENABLE +void keyboard_post_init_user(void) { + debug_enable = true; + debug_matrix = false; + debug_keyboard = false; +} +#endif // CONSOLE_ENABLE diff --git a/keyboards/system76/launch_3/launch_3.h b/keyboards/system76/launch_3/launch_3.h new file mode 100644 index 000000000000..335b8ecbdf1b --- /dev/null +++ b/keyboards/system76/launch_3/launch_3.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "quantum.h" + +// clang-format off +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K5A, K5B \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K0E }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K1E }, \ + { K50, K51, K52, K53, K54, K3D, K55, K56, K57, K58, K59, K5A, K5B, K2E }, \ +} +// clang-format on diff --git a/keyboards/system76/launch_3/mcuconf.h b/keyboards/system76/launch_3/mcuconf.h new file mode 100644 index 000000000000..cd074149319a --- /dev/null +++ b/keyboards/system76/launch_3/mcuconf.h @@ -0,0 +1,25 @@ +/* Copyright 2023 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef RP_I2C_USE_I2C0 +#define RP_I2C_USE_I2C0 FALSE + +#undef RP_I2C_USE_I2C1 +#define RP_I2C_USE_I2C1 TRUE diff --git a/keyboards/system76/launch_3/post_rules.mk b/keyboards/system76/launch_3/post_rules.mk new file mode 100644 index 000000000000..3751a8b8c31b --- /dev/null +++ b/keyboards/system76/launch_3/post_rules.mk @@ -0,0 +1,12 @@ +# System76 EC +# remove the RESET HID command +VALID_SYSTEM76_EC_TYPES := yes +SYSTEM76_EC_ENABLE ?= no +ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + ifeq ($(filter $(SYSTEM76_EC_ENABLE),$(VALID_SYSTEM76_EC_TYPES)),) + $(error SYSTEM76_EC_EN="$(strip $(SYSTEM76_EC_ENABLE))" is not a valid type for the System76 EC option) + endif + ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + OPT_DEFS += -DSYSTEM76_EC + endif +endif diff --git a/keyboards/system76/launch_3/readme.md b/keyboards/system76/launch_3/readme.md new file mode 100644 index 000000000000..2cb363d62f07 --- /dev/null +++ b/keyboards/system76/launch_3/readme.md @@ -0,0 +1 @@ +# System76 Launch Configurable Keyboard (launch_3) diff --git a/keyboards/system76/launch_3/rgb_matrix_kb.inc b/keyboards/system76/launch_3/rgb_matrix_kb.inc new file mode 100644 index 000000000000..02de10ed500e --- /dev/null +++ b/keyboards/system76/launch_3/rgb_matrix_kb.inc @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +RGB_MATRIX_EFFECT(active_keys) +RGB_MATRIX_EFFECT(raw_rgb) +RGB_MATRIX_EFFECT(unlocked) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "dynamic_keymap.h" + +static bool active_keys_initialized = false; +static uint8_t active_keys_table[RGB_MATRIX_LED_COUNT] = {0}; + +static void active_keys_initialize(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + uint8_t led = g_led_config.matrix_co[row][col]; + if (led < RGB_MATRIX_LED_COUNT && row < 16 && col < 16) { + active_keys_table[led] = (row << 4) | col; + } + } + } + active_keys_initialized = true; +} + +static bool active_keys(effect_params_t* params) { + if (!active_keys_initialized) { + active_keys_initialize(); + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + uint8_t layer = get_highest_layer(layer_state); + RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + uint8_t rowcol = active_keys_table[i]; + uint8_t row = rowcol >> 4; + uint8_t col = rowcol & 0xF; + uint16_t keycode = dynamic_keymap_get_keycode(layer, row, col); + switch (keycode) { + case KC_NO: + case KC_TRNS: + rgb_matrix_set_color(i, 0, 0, 0); + break; + default: + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + break; + } + } + + return led_max < RGB_MATRIX_LED_COUNT; +} + +RGB raw_rgb_data[RGB_MATRIX_LED_COUNT] = {0}; + +static uint8_t normalize_component(uint8_t component) { + uint16_t x = (uint16_t)component; + x *= rgb_matrix_config.hsv.v; // Multiply by current brightness + x /= 255; // Divide by maximum brightness + return (uint8_t)x; +} + +static RGB normalize_index(uint8_t i) { + RGB raw = raw_rgb_data[i]; + RGB rgb = { + .r = normalize_component(raw.r), + .g = normalize_component(raw.g), + .b = normalize_component(raw.b), + }; + return rgb; +} + +static bool raw_rgb(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = normalize_index(i); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +static uint8_t unlocked_keys[8][2] = { + {2, 7}, // U + {4, 6}, // N + {3, 9}, // L + {2, 9}, // O + {4, 3}, // C + {3, 8}, // K + {2, 3}, // E + {3, 3}, // D +}; + +static uint8_t unlocked_ticks = 0; +static uint8_t unlocked_i = 0; +static uint8_t unlocked_leds_count = 0; +static uint8_t unlocked_leds[2] = {0, 0}; + +static bool unlocked(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + unlocked_ticks++; + + if (params->init) { + unlocked_ticks = 0; + unlocked_i = 0; + } + + if (unlocked_ticks == 0) { + if (unlocked_i == 8) { + unlocked_leds_count = 0; + unlocked_i = 0; + } else { + unlocked_leds_count = rgb_matrix_map_row_column_to_led(unlocked_keys[unlocked_i][0], unlocked_keys[unlocked_i][1], unlocked_leds); + unlocked_i++; + } + } + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv = { + .h = i + unlocked_ticks, + .s = 0xFF, + .v = 0x70, + }; + for (uint8_t j = 0; j < unlocked_leds_count; j++) { + if (i == unlocked_leds[j]) { + hsv.s = 0; + hsv.v = 0xFF; + } + } + + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/system76/launch_3/rules.mk b/keyboards/system76/launch_3/rules.mk new file mode 100644 index 000000000000..1fd48ebbc934 --- /dev/null +++ b/keyboards/system76/launch_3/rules.mk @@ -0,0 +1,24 @@ +# Build options +# change yes to no to disable +BOOTMAGIC_ENABLE = no # Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and system control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +EEPROM_DRIVER = wear_leveling +WEAR_LEVELING_DRIVER = rp2040_flash +NKRO_ENABLE = yes # USB N-key rollover +RAW_ENABLE = yes # Raw HID commands (used by Keyboard Configurator) +BACKLIGHT_ENABLE = no # RGB backlight (conflicts with RGB matrix) +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = yes # RGB matrix +RGB_MATRIX_DRIVER = WS2812 +WS2812_DRIVER = vendor +RGB_MATRIX_CUSTOM_KB = yes # Custom keyboard effects +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes # Link-time optimization for smaller binary + +# Add System76 EC command interface as well as I2C and USB mux drivers +SRC += system76_ec.c usb_mux.c +QUANTUM_LIB_SRC += i2c_master.c diff --git a/keyboards/system76/launch_3/usb_mux.c b/keyboards/system76/launch_3/usb_mux.c new file mode 100644 index 000000000000..7123ec77a49d --- /dev/null +++ b/keyboards/system76/launch_3/usb_mux.c @@ -0,0 +1,485 @@ +/* + * Copyright (C) 2021 System76 + * Copyright (C) 2021 Jimmy Cassis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "usb_mux.h" + +#include + +#include "gpio.h" +#include "i2c_master.h" +#include "wait.h" + +#define GPIO_RESET_USB GP20 + +#define REG_PF1_CTL 0xBF800C04 +#define REG_PIO64_OEN 0xBF800908 +#define REG_PIO64_OUT 0xBF800928 +#define REG_VID 0xBF803000 +#define REG_PRT_SWAP 0xBF8030FA +#define REG_USB3_HUB_VID 0xBFD2E548 +#define REG_RUNTIME_FLAGS2 0xBFD23408 +#define REG_I2S_FEAT_SEL 0xBFD23412 + +struct USB7206 { + uint8_t addr; +}; + +struct USB7206 usb_hub = {.addr = 0x2D}; + +// Perform USB7206 register access. +// Returns zero on success or a negative number on error. +i2c_status_t usb7206_register_access(struct USB7206* self) { + uint8_t register_access[3] = { + 0x99, + 0x37, + 0x00, + }; + + return i2c_transmit(self->addr << 1, register_access, sizeof(register_access), I2C_TIMEOUT); +} + +// Read 32-bit value from USB7206 register region. +// Returns number of bytes read on success or a negative number on error. +i2c_status_t usb7206_read_reg_32(struct USB7206* self, uint32_t addr, uint32_t* data) { + i2c_status_t status; + + uint8_t register_read[9] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + 0x06, // Number of bytes to write to command block buffer area + 0x01, // Direction: 0 = write, 1 = read + 4, // Number of bytes to read from register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + }; + + // First byte is available length + uint8_t bytes[5] = {0, 0, 0, 0, 0}; + + status = i2c_transmit(self->addr << 1, register_read, sizeof(register_read), I2C_TIMEOUT); + if (status < 0) { + return status; + } + + status = usb7206_register_access(self); + if (status < 0) { + return status; + } + + status = i2c_readReg16( + (self->addr << 1), + 0x006, // 6 to skip header + bytes, + sizeof(bytes), + I2C_TIMEOUT + ); + if (status < 0) { + return status; + } + + //TODO: check bytes[0] length + + // Convert from little endian + *data = + (((uint32_t)bytes[1]) << 0) | + (((uint32_t)bytes[2]) << 8) | + (((uint32_t)bytes[3]) << 16) | + (((uint32_t)bytes[4]) << 24); + + return 4; +} + +// Write 8-bit value to USB7206 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7206_write_reg_8(struct USB7206* self, uint32_t addr, uint8_t data) { + i2c_status_t status; + + uint8_t register_write[9 + 1] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + 1 + 6, // Number of bytes to write to command block buffer area + 0x00, // Direction: 0 = write, 1 = read + 1, // Number of bytes to write to register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + data + }; + + status = i2c_transmit((self->addr << 1), register_write, sizeof(register_write), I2C_TIMEOUT); + if (status < 0) { + return status; + } + + status = usb7206_register_access(self); + if (status < 0) { + return status; + } + + return 1; +} + +// Write 32-bit value to USB7206 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7206_write_reg_32(struct USB7206* self, uint32_t addr, uint32_t data) { + i2c_status_t status; + + uint8_t register_write[9 + 4] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + 4 + 6, // Number of bytes to write to command block buffer area + 0x00, // Direction: 0 = write, 1 = read + 4, // Number of bytes to write to register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + (uint8_t)(data >> 0), + (uint8_t)(data >> 8), + (uint8_t)(data >> 16), + (uint8_t)(data >> 24), + }; + + status = i2c_transmit((self->addr << 1), register_write, sizeof(register_write), I2C_TIMEOUT); + if (status < 0) { + return status; + } + + status = usb7206_register_access(self); + if (status < 0) { + return status; + } + + return 4; +} + +// Initialize USB7206. +// Returns zero on success or a negative number on error. +int usb7206_init(struct USB7206* self) { + i2c_status_t status; + uint32_t data; + + // DM and DP are swapped on ports 2 and 3 + status = usb7206_write_reg_8(self, REG_PRT_SWAP, 0x0C); + if (status < 0) { + return status; + } + + // Disable audio + status = usb7206_write_reg_8(self, REG_I2S_FEAT_SEL, 0); + if (status < 0) { + return status; + } + + // Set HFC_DISABLE + data = 0; + status = usb7206_read_reg_32(self, REG_RUNTIME_FLAGS2, &data); + if (status < 0) { + return status; + } + data |= 1; + status = usb7206_write_reg_32(self, REG_RUNTIME_FLAGS2, data); + if (status < 0) { + return status; + } + + // Set Vendor ID and Product ID of USB 2 hub + status = usb7206_write_reg_32(self, REG_VID, 0x00033384); + if (status < 0) { + return status; + } + + // Set Vendor ID and Product ID of USB 3 hub + status = usb7206_write_reg_32(self, REG_USB3_HUB_VID, 0x00043384); + if (status < 0) { + return status; + } + + return 0; +} + +// Attach USB7206. +// Returns bytes written on success or a negative number on error. +i2c_status_t usb7206_attach(struct USB7206* self) { + uint8_t data[3] = { + 0xAA, + 0x56, + 0x00, + }; + + return i2c_transmit(self->addr << 1, data, sizeof(data), I2C_TIMEOUT); +} + +struct USB7206_GPIO { + struct USB7206* usb7206; + uint32_t pf; +}; + +struct USB7206_GPIO usb_gpio_sink = {.usb7206 = &usb_hub, .pf = 29}; // UP_SEL = PF29 = GPIO93 +struct USB7206_GPIO usb_gpio_source_left = {.usb7206 = &usb_hub, .pf = 10}; // CL_SEL = PF10 = GPIO74 +struct USB7206_GPIO usb_gpio_source_right = {.usb7206 = &usb_hub, .pf = 25}; // CR_SEL = PF25 = GPIO88 + +// Set USB7206 GPIO to specified value. +// Returns zero on success or negative number on error. +i2c_status_t usb7206_gpio_set(struct USB7206_GPIO* self, bool value) { + i2c_status_t status; + uint32_t data; + + data = 0; + status = usb7206_read_reg_32(self->usb7206, REG_PIO64_OUT, &data); + if (status < 0) { + return status; + } + + if (value) { + data |= (((uint32_t)1) << self->pf); + } else { + data &= ~(((uint32_t)1) << self->pf); + } + status = usb7206_write_reg_32(self->usb7206, REG_PIO64_OUT, data); + if (status < 0) { + return status; + } + + return 0; +} + +// Initialize USB7206 GPIO. +// Returns zero on success or a negative number on error. +i2c_status_t usb7206_gpio_init(struct USB7206_GPIO* self) { + i2c_status_t status; + uint32_t data; + + // Set programmable function to GPIO + status = usb7206_write_reg_8(self->usb7206, REG_PF1_CTL + (self->pf - 1), 0); + if (status < 0) { + return status; + } + + // Set GPIO to false by default + usb7206_gpio_set(self, false); + + // Set GPIO to output + data = 0; + status = usb7206_read_reg_32(self->usb7206, REG_PIO64_OEN, &data); + if (status < 0) { + return status; + } + + data |= (((uint32_t)1) << self->pf); + status = usb7206_write_reg_32(self->usb7206, REG_PIO64_OEN, data); + if (status < 0) { + return status; + } + + return 0; +} + +#define TCPC_CC_STATUS 0x1D +#define TCPC_ROLE_CONTROL 0x1A +#define TCPC_COMMAND 0x23 + +enum TCPC_TYPE { + TCPC_TYPE_SINK, + TCPC_TYPE_SOURCE, +}; + +struct PTN5110 { + enum TCPC_TYPE type; + uint8_t addr; + uint8_t cc; + struct USB7206_GPIO * gpio; +}; + +struct PTN5110 usb_sink = { .type = TCPC_TYPE_SINK, .addr = 0x51, .gpio = &usb_gpio_sink }; +struct PTN5110 usb_source_left = { .type = TCPC_TYPE_SOURCE, .addr = 0x52, .gpio = &usb_gpio_source_left }; +struct PTN5110 usb_source_right = { .type = TCPC_TYPE_SOURCE, .addr = 0x50, .gpio = &usb_gpio_source_right }; + +// Read PTN5110 CC_STATUS +// Returns bytes read on success or negative number on error +int ptn5110_get_cc_status(struct PTN5110 * self, uint8_t * cc) { + return i2c_readReg(self->addr << 1, TCPC_CC_STATUS, cc, 1, I2C_TIMEOUT); +} + +// Write PTN5110 ROLE_CONTROL +// Returns bytes written on success or negative number on error +int ptn5110_set_role_control(struct PTN5110 * self, uint8_t role_control) { + return i2c_writeReg(self->addr << 1, TCPC_ROLE_CONTROL, &role_control, 1, I2C_TIMEOUT); +} + +// Set PTN5110 SSMUX orientation. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_set_ssmux(struct PTN5110* self, bool orientation) { return usb7206_gpio_set(self->gpio, orientation); } + +// Write PTN5110 COMMAND. +// Returns zero on success or negative number on error. +i2c_status_t ptn5110_command(struct PTN5110* self, uint8_t command) { return i2c_writeReg(self->addr << 1, TCPC_COMMAND, &command, 1, I2C_TIMEOUT); } + +// Set orientation of PTN5110 operating as a sink, call this once. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_sink_set_orientation(struct PTN5110* self) { + i2c_status_t status; + uint8_t cc; + + status = ptn5110_get_cc_status(self, &cc); + if (status < 0) { + return status; + } + + if ((cc & 0x03) == 0) { + status = ptn5110_set_ssmux(self, false); + if (status < 0) { + return status; + } + } else { + status = ptn5110_set_ssmux(self, true); + if (status < 0) { + return status; + } + } + + return 0; +} + +// Update PTN5110 operating as a source, call this repeatedly. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_source_update(struct PTN5110* self) { + i2c_status_t status; + uint8_t cc; + + status = ptn5110_get_cc_status(self, &cc); + if (status < 0) { + return status; + } + + if (cc != self->cc) { + // WARNING: Setting this here will disable retries + self->cc = cc; + + bool connected = false; + bool orientation = false; + if ((cc & 0x03) == 2) { + connected = true; + orientation = true; + } else if (((cc >> 2) & 0x03) == 2) { + connected = true; + orientation = false; + } + + if (connected) { + // Set SS mux orientation + status = ptn5110_set_ssmux(self, orientation); + if (status < 0) { + return status; + } + + // Enable source Vbus command + status = ptn5110_command(self, 0b01110111); + if (status < 0) { + return status; + } + } else { + // Disable source Vbus command + status = ptn5110_command(self, 0b01100110); + if (status < 0) { + return status; + } + } + } + + return 0; +} + +// Initialize PTN5110 +// Returns zero on success or negative number on error +int ptn5110_init(struct PTN5110 * self) { + int res; + + // Set last cc to invalid value, to force update + self->cc = 0xFF; + + // Initialize GPIO + res = usb7206_gpio_init(self->gpio); + if (res < 0) return res; + + switch (self->type) { + case TCPC_TYPE_SINK: + res = ptn5110_sink_set_orientation(self); + if (res < 0) return res; + break; + case TCPC_TYPE_SOURCE: + res = ptn5110_set_role_control(self, 0x05); + if (res < 0) return res; + break; + } + + return 0; +} + +void usb_mux_event(void) { + // Run this on every 1000th matrix scan + static int cycle = 0; + if (cycle >= 1000) { + cycle = 0; + ptn5110_source_update(&usb_source_left); + ptn5110_source_update(&usb_source_right); + } else { + cycle += 1; + } +} + +void usb_mux_init(void) { + // Put the USB hub in reset + setPinOutput(GPIO_RESET_USB); + writePinLow(GPIO_RESET_USB); + + // Run I2C bus at 100 kHz + i2c_init(); + + // Wait for power stable + wait_ms(10); + + // Take the USB hub out of reset + writePinHigh(GPIO_RESET_USB); + + // Wait for USB hub to come out of reset + wait_ms(100); + + // Set up hub + usb7206_init(&usb_hub); + + // Set up sink + ptn5110_init(&usb_sink); + + // Set up sources + ptn5110_init(&usb_source_left); + ptn5110_init(&usb_source_right); + + // Attach hub + usb7206_attach(&usb_hub); + + // Ensure orientation is correct after attaching hub + // TODO: Find reason why GPIO for sink orientation is reset + for (int i = 0; i < 100; i++) { + ptn5110_sink_set_orientation(&usb_sink); + wait_ms(10); + } +} diff --git a/keyboards/system76/launch_3/usb_mux.h b/keyboards/system76/launch_3/usb_mux.h new file mode 100644 index 000000000000..26f84de864b6 --- /dev/null +++ b/keyboards/system76/launch_3/usb_mux.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +void usb_mux_init(void); +void usb_mux_event(void); diff --git a/keyboards/system76/launch_alpha_1/README.md b/keyboards/system76/launch_alpha_1/README.md new file mode 100644 index 000000000000..a0e94a44bfcb --- /dev/null +++ b/keyboards/system76/launch_alpha_1/README.md @@ -0,0 +1,21 @@ +## Flashing firmware: +* Clone this repository and `cd` into the `qmk_firmware` directory. +* After cloning, you probably need to run `make git-submodule`. + - You may also need to install dependencies: `sudo apt install avrdude gcc-avr avr-libc` +* To build the firmware without flashing the keyboard, use `make (keyboard name):(layout name)` + - For example, if I want to build Levi's layout for the launch_alpha_1 keyboard, I will run: + `make system76/launch_alpha_1:levi` +* Before flashing firmware, disable your ModemManager: `systemctl stop ModemManager.service` + - It messes with the flasher, so just stop it before flashing. You can disable it with `systemctl disable ModemManager.service` if you wish to. +* To flash the firmware, you'll use the same build command, but with `flash` added to the end: + `make system76/launch_alpha_1:default:flash` + - After it builds, you will see a message that says `Detecting USB port, reset your controller now...`. You then want to hit the "RESET" key on the keyboard if it is programmed into the layout. + - In the default layout and the `levi` layout, it is Fn+Esc. If a RESET key is not programmed into the layout, unplugging and re-plugging the keyboard sometimes begins the flashing process. If it doesn't, you'll have to briefly bridge the RST and GND pins on the Arduino Pro Micro inside the keyboard. Don't attempt this unless you know what you are doing. + +## Making your own layout: +If you want to create your own layout, go to the `keymaps` directory and copy one of the maps in there. You'll probably want to start with the default layout, but the other layouts in there may be helpful references. The name of the directory you create will be the name of your layout. Ensure that it has no spaces or strange symbols, as this could lead to build errors. + +Inside of each layout directory, there is a file called `keymap.c`, which is what you will be customizing to create your own keymap. The commented out grid area in this file is a reference for the actual key assignments below it. When I am modifying a layout, I first update this grid. It helps me keep track of where I want everything. It does not matter what you label the keys in this grid since it is in a comment. Just try to keep it understandable for yourself and everyone else. + +The keycodes below that do have to be typed correctly. A full list of keycodes can be found here: https://beta.docs.qmk.fm/reference/keycodes . Use the shorter keycode alias to help keep these lined up (e.g. use `KC_ESC` instead of `KC_ESCAPE`). + diff --git a/keyboards/system76/launch_alpha_1/config.h b/keyboards/system76/launch_alpha_1/config.h new file mode 100644 index 000000000000..f5be1c757f6c --- /dev/null +++ b/keyboards/system76/launch_alpha_1/config.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "config_common.h" + +// key matrix size +#define MATRIX_ROWS 6 +#define MATRIX_COLS 14 + +/* + * Key matrix pins + * ROWS: AVR pins used for rows, top to bottom + * COLS: AVR pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { B0, C6, D7, E6, B4, B5 } +#define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6, F5, F4, D3, D2, D1, D0, D4, D5 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +// Set 0 if debouncing isn't needed +#define DEBOUNCE 5 + +// NKRO must be used +#define FORCE_NKRO + +// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// Dynamic keyboard support { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 + +// EEPROM usage +#define EEPROM_SIZE 1024 + +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x01 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) + +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +#define DYNAMIC_KEYMAP_EEPROM_SIZE (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2) +// Dynamic macro starts after dynamic keymaps +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + DYNAMIC_KEYMAP_EEPROM_SIZE) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE (EEPROM_SIZE - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR) +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 +// } Dynamic keyboard support diff --git a/keyboards/system76/launch_alpha_1/info.json b/keyboards/system76/launch_alpha_1/info.json new file mode 100644 index 000000000000..882352314ab6 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/info.json @@ -0,0 +1,9 @@ +{ + "keyboard_name": "Launch Alpha 1 (launch_alpha_1)", + "manufacturer": "System76", + "usb": { + "vid": "0x3384", + "pid": "0x0001", + "device_version": "0.0.1" + } +} diff --git a/keyboards/system76/launch_alpha_1/keymaps/carl/keymap.c b/keyboards/system76/launch_alpha_1/keymaps/carl/keymap.c new file mode 100644 index 000000000000..303a814b5409 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/keymaps/carl/keymap.c @@ -0,0 +1,72 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | [ | ] | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | CTRL | Alt | FN | LGUI | BACKSPACE | SPACE | RCTRL | RALT | FN | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LALT, MO(1), KC_LGUI, KC_BSPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| RESET | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | Home | PgUp | PgDn | End | | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PgUp | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | | | | | | | | | | Home | PgDn | End | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_PGDN, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_1/keymaps/default/keymap.c b/keyboards/system76/launch_alpha_1/keymaps/default/keymap.c new file mode 100644 index 000000000000..bfac0d8edeee --- /dev/null +++ b/keyboards/system76/launch_alpha_1/keymaps/default/keymap.c @@ -0,0 +1,72 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | [ | ] | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | CTRL | FN | LGUI | LALT | SPACE | SPACE | RCTRL | RALT | FN | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| RESET | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PgUp | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | | | | | | | | | | Home | PgDn | End | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_1/keymaps/ian/keymap.c b/keyboards/system76/launch_alpha_1/keymaps/ian/keymap.c new file mode 100644 index 000000000000..31b651092f72 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/keymaps/ian/keymap.c @@ -0,0 +1,70 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | [ | ] | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | CTRL | FN | LGUI | LALT | SPACE | SPACE | RALT | FN | RCTRL | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| POWER | | | MUTE | | VOL↓ | VOL↑ | | BRT↓ | BRT↑ | | | SLEEP | INSERT | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| PLAY | M_PREV | M_NEXT | | | | | | | | | | | RESET | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PgUp | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | | | | | | | | | | Home | PgDn | End | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [1] = LAYOUT( +KC_KB_POWER, KC_TRNS, KC_TRNS, KC_MUTE, KC_TRNS, KC_VOLD, KC_VOLU, KC_TRNS, KC_BRID, KC_BRIU, KC_TRNS, KC_TRNS, KC_SLEP, KC_INS, + KC_MPLY, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, QK_BOOT, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_1/keymaps/jeremy/keymap.c b/keyboards/system76/launch_alpha_1/keymaps/jeremy/keymap.c new file mode 100644 index 000000000000..d7285a7c244d --- /dev/null +++ b/keyboards/system76/launch_alpha_1/keymaps/jeremy/keymap.c @@ -0,0 +1,72 @@ +#include QMK_KEYBOARD_H + +#define FNESC LT(1, KC_ESC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | [ | ] | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | FN(ESC) | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | CTRL | FN | LALT | LGUI | SPACE | BACKSPACE | RCTRL | RALT | FN | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + FNESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_BSPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| RESET | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | PGUP | HOME | PGDN | | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | | | | | | | END | | | | | | PgUp | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | | | | | | DELETE | | | | Home | PgDn | End | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_HOME, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_1/keymaps/john/keymap.c b/keyboards/system76/launch_alpha_1/keymaps/john/keymap.c new file mode 100644 index 000000000000..c5a3d8270100 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/keymaps/john/keymap.c @@ -0,0 +1,72 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | [ | ] | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | CTRL | LGUI | FN | LALT | SPACE | SPACE | RCTRL | RALT | FN | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LGUI, MO(1), KC_LALT, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| RESET | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PgUp | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | | | | | | | | | | Home | PgDn | End | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_1/keymaps/levi/keymap.c b/keyboards/system76/launch_alpha_1/keymaps/levi/keymap.c new file mode 100644 index 000000000000..580db2bbefeb --- /dev/null +++ b/keyboards/system76/launch_alpha_1/keymaps/levi/keymap.c @@ -0,0 +1,103 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, dvorak layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | {[ | }] | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| TAB | '" | ,< | .> | P | Y | F | G | C | R | L | ?/ | =+ | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | CTRL | A | O | E | U | I | D | H | T | N | S | -_ | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | SHIFT | ;: | Q | J | K | X | B | M | W | V | Z | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | CTRL | FN | LALT | LGUI | SPACE | FN | RCTRL | RALT | FN | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, + KC_LCTL, MO(2), KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, qwerty layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | [ | ] | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | CTRL | FN | LALT | LGUI | SPACE | FN | RCTRL | RALT | FN | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [1] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(2), KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 2, function layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| RESET | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | Home | Up | End | PgUp | | PgUp | Home | Up | End | | | | PrtScr | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | Left | Down | Right | PgDn | | PgDn | Left | Down | Right | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | |PlayPaus| Prev | Next | VolDn | VolUp | VolMute| | | | | | PgUp | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | | | | | Backspace | | | | | Home | PgDn | End | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [2] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, TO(1), TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_TRNS, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_TRNS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_1/keymaps/nathaniel/keymap.c b/keyboards/system76/launch_alpha_1/keymaps/nathaniel/keymap.c new file mode 100644 index 000000000000..2202389b94b6 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/keymaps/nathaniel/keymap.c @@ -0,0 +1,72 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | [ | ] | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | LGUI | FN | LCTL | LALT | SPACE | SPACE | RCTRL | RALT | FN | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LGUI, MO(1), KC_LCTL, KC_LALT, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| RESET | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PgUp | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | | | | | | | | | | Home | PgDn | End | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_1/keymaps/sean/keymap.c b/keyboards/system76/launch_alpha_1/keymaps/sean/keymap.c new file mode 100644 index 000000000000..040dd905d5e9 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/keymaps/sean/keymap.c @@ -0,0 +1,72 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | [ | ] | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | CTRL | FN | LGUI | LALT | SPACE | BACKSPACE | RCTRL | RALT | FN | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LGUI, KC_LALT, KC_SPC, KC_BSPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| RESET | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PgUp | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | | | | | | | | | | Home | PgDn | End | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_1/keymaps/shpurk/keymap.c b/keyboards/system76/launch_alpha_1/keymaps/shpurk/keymap.c new file mode 100644 index 000000000000..e726fc0d9491 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/keymaps/shpurk/keymap.c @@ -0,0 +1,72 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, qwerty layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | [ | ] | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | CTRL | FN | LGUI | LALT | SPACE | Backspace | RCTRL | RALT | FN | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LGUI, KC_LALT, KC_SPC, KC_BSPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +___________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | +| RESET | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________| +| | | | | | | | | | | | | | | +| | Home | Up | End | PgUp | | PgUp | Home | Up | End | | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | Left | Down | Right | PgDn | | PgDn | Left | Down | Right | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________| + | | | | | | | | | | | | | | + | |PlayPaus| Prev | Next | VolDn | VolUp | VolMute| | | | | | PgUp | + ____|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | + | | | | | Backspace | | | | | Home | PgDn | End | + |____________|________|_______|________|_________________|_________________|________|________|_____________|________|________|________| +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_TRNS, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_TRNS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_1/launch_alpha_1.c b/keyboards/system76/launch_alpha_1/launch_alpha_1.c new file mode 100644 index 000000000000..ffd7fa3b9721 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/launch_alpha_1.c @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "dynamic_keymap.h" + +#include "launch_alpha_1.h" + +bool eeprom_is_valid(void) { + return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION); +} + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void eeprom_reset(void) { + // Set the keyboard specific EEPROM state as invalid. + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid. + eeconfig_disable(); +} + +void bootmagic_lite(void) { + // The lite version of TMK's bootmagic. + // 100% less potential for accidentally making the + // keyboard do stupid things. + + // We need multiple scans because debouncing can't be turned off. + matrix_scan(); + wait_ms(DEBOUNCE); + wait_ms(DEBOUNCE); + matrix_scan(); + + // If the Esc (matrix 0,0) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + if ( matrix_get_row(0) & (1<<0) ) { + eeprom_reset(); + bootloader_jump(); + } +} + +void matrix_init_kb(void) { + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + eeprom_set_valid(true); + } +} diff --git a/keyboards/system76/launch_alpha_1/launch_alpha_1.h b/keyboards/system76/launch_alpha_1/launch_alpha_1.h new file mode 100644 index 000000000000..85cf4a044b25 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/launch_alpha_1.h @@ -0,0 +1,24 @@ +#ifndef LAUNCH_ALPHA_1_H +#define LAUNCH_ALPHA_1_H + +#include "quantum.h" + +#define ___ KC_NO + +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K5A, K5B \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, ___ }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, ___ }, \ + { K50, K51, K52, K53, K54, ___, K55, K56, K57, K58, K59, K5A, K5B, ___ }, \ +} + +#endif // LAUNCH_ALPHA_1_H diff --git a/keyboards/system76/launch_alpha_1/rules.mk b/keyboards/system76/launch_alpha_1/rules.mk new file mode 100644 index 000000000000..30a711ac95d0 --- /dev/null +++ b/keyboards/system76/launch_alpha_1/rules.mk @@ -0,0 +1,25 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = caterina + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RAW_ENABLE = yes # Enable RAW HID commands (used by keyboard configurator) +USB_6KRO_ENABLE = no # 6key Rollover diff --git a/keyboards/system76/launch_alpha_2/README.md b/keyboards/system76/launch_alpha_2/README.md new file mode 100644 index 000000000000..f78b15e54755 --- /dev/null +++ b/keyboards/system76/launch_alpha_2/README.md @@ -0,0 +1,19 @@ +## Flashing firmware: +* Clone this repository and `cd` into the `qmk_firmware` directory. +* After cloning, you probably need to run `make git-submodule`. + - You may also need to install dependencies: `sudo apt install avrdude gcc-avr avr-libc` +* To build the firmware without flashing the keyboard, use `make (keyboard name):(layout name)` + - For example, if I want to build Jeremy's layout for the Launch keyboard, I will run: + `make system76/launch_alpha_2:jeremy` +* To flash the firmware, you'll use the same build command, but with `flash` added to the end: + `make system76/launch_alpha_2:default:flash` + - After it builds, you will see a message that says `Detecting USB port, reset your controller now...`. You then want to hit the "RESET" key on the keyboard if it is programmed into the layout. + - In the default layout, it is Fn+Esc. If a RESET key is not programmed into the layout, you will have to manually reset the controller. + +## Making your own layout: +If you want to create your own layout, go to the `keymaps` directory and copy one of the maps in there. You'll probably want to start with the default layout, but the other layouts in there may be helpful references. The name of the directory you create will be the name of your layout. Ensure that it has no spaces or strange symbols, as this could lead to build errors. + +Inside of each layout directory, there is a file called `keymap.c`, which is what you will be customizing to create your own keymap. The commented out grid area in this file is a reference for the actual key assignments below it. When I am modifying a layout, I first update this grid. It helps me keep track of where I want everything. It does not matter what you label the keys in this grid since it is in a comment. Just try to keep it understandable for yourself and everyone else. + +The keycodes below that do have to be typed correctly. A full list of keycodes can be found here: https://beta.docs.qmk.fm/reference/keycodes . Use the shorter keycode alias to help keep these lined up (e.g. use `KC_ESC` instead of `KC_ESCAPE`). + diff --git a/keyboards/system76/launch_alpha_2/config.h b/keyboards/system76/launch_alpha_2/config.h new file mode 100644 index 000000000000..7ec812fe5a38 --- /dev/null +++ b/keyboards/system76/launch_alpha_2/config.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "config_common.h" + +// key matrix size +#define MATRIX_ROWS 6 +#define MATRIX_COLS 15 + +/* + * Key matrix pins + * ROWS: AVR pins used for rows, top to bottom + * COLS: AVR pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { F5, F4, F1, F0, B3, F6 } +#define MATRIX_COL_PINS { B2, B0, D3, D2, D1, D0, D4, C6, D7, E6, B4, B5, B6, B7, D6 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +// Set 0 if debouncing isn't needed +#define DEBOUNCE 5 + +// NKRO must be used +#define FORCE_NKRO + +// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// Dynamic keyboard support { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 + +// EEPROM usage +#define EEPROM_SIZE 1024 + +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x01 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) + +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +#define DYNAMIC_KEYMAP_EEPROM_SIZE (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2) +// Dynamic macro starts after dynamic keymaps +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + DYNAMIC_KEYMAP_EEPROM_SIZE) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE (EEPROM_SIZE - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR) +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 +// } Dynamic keyboard support diff --git a/keyboards/system76/launch_alpha_2/info.json b/keyboards/system76/launch_alpha_2/info.json new file mode 100644 index 000000000000..c87fc767025a --- /dev/null +++ b/keyboards/system76/launch_alpha_2/info.json @@ -0,0 +1,9 @@ +{ + "keyboard_name": "Launch Alpha 2 (launch_alpha_2)", + "manufacturer": "System76", + "usb": { + "vid": "0x3384", + "pid": "0x0001", + "device_version": "0.0.1" + } +} diff --git a/keyboards/system76/launch_alpha_2/keymaps/default/keymap.c b/keyboards/system76/launch_alpha_2/keymaps/default/keymap.c new file mode 100644 index 000000000000..035930a41b03 --- /dev/null +++ b/keyboards/system76/launch_alpha_2/keymaps/default/keymap.c @@ -0,0 +1,73 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | CTRL | FN | LGUI | LALT | SPACE | SPACE | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| RESET | | | | | | | | | | | | | || | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| | | | | | | | | | | | | | || | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| | | | | | | | | | | | | | || | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_2/keymaps/jeremy/keymap.c b/keyboards/system76/launch_alpha_2/keymaps/jeremy/keymap.c new file mode 100644 index 000000000000..49763ea38ebd --- /dev/null +++ b/keyboards/system76/launch_alpha_2/keymaps/jeremy/keymap.c @@ -0,0 +1,73 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | FN | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | CTRL | FN | LALT | LGUI | SPACE | SPACE | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| RESET | | | | | | | | | | | | | || | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| | | | | | | | | | | | | | || | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| | | | | | | | PGUP | HOME | PGDN | | | | || | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | | | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | BSPC | DEL | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | | | | | | | END | | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_HOME, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_BSPC, KC_DEL, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_alpha_2/launch_alpha_2.c b/keyboards/system76/launch_alpha_2/launch_alpha_2.c new file mode 100644 index 000000000000..1cb8941c1dd5 --- /dev/null +++ b/keyboards/system76/launch_alpha_2/launch_alpha_2.c @@ -0,0 +1,48 @@ +#include "dynamic_keymap.h" + +#include "launch_alpha_2.h" + +bool eeprom_is_valid(void) { + return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION); +} + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void eeprom_reset(void) { + // Set the keyboard specific EEPROM state as invalid. + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid. + eeconfig_disable(); +} + +void bootmagic_lite(void) { + // The lite version of TMK's bootmagic. + // 100% less potential for accidentally making the + // keyboard do stupid things. + + // We need multiple scans because debouncing can't be turned off. + matrix_scan(); + wait_ms(DEBOUNCE); + wait_ms(DEBOUNCE); + matrix_scan(); + + // If the Esc (matrix 0,0) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + if ( matrix_get_row(0) & (1<<0) ) { + eeprom_reset(); + bootloader_jump(); + } +} + +void matrix_init_kb(void) { + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + eeprom_set_valid(true); + } +} diff --git a/keyboards/system76/launch_alpha_2/launch_alpha_2.h b/keyboards/system76/launch_alpha_2/launch_alpha_2.h new file mode 100644 index 000000000000..f1a0eebe491e --- /dev/null +++ b/keyboards/system76/launch_alpha_2/launch_alpha_2.h @@ -0,0 +1,24 @@ +#ifndef LAUNCH_ALPHA_2_H +#define LAUNCH_ALPHA_2_H + +#include "quantum.h" + +#define ___ KC_NO + +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K5A, K5B \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, ___, K3D }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, ___, ___ }, \ + { K50, K51, K52, K53, K54, ___, K55, K56, K57, K58, K59, K5A, K5B, ___, ___ }, \ +} + +#endif // LAUNCH_ALPHA_2_H diff --git a/keyboards/system76/launch_alpha_2/layout-files/system76-launch-configurable-keyboard-1-0.dxf b/keyboards/system76/launch_alpha_2/layout-files/system76-launch-configurable-keyboard-1-0.dxf new file mode 100644 index 000000000000..7d60047e9053 --- /dev/null +++ b/keyboards/system76/launch_alpha_2/layout-files/system76-launch-configurable-keyboard-1-0.dxf @@ -0,0 +1,8002 @@ + 0 +SECTION + 2 +HEADER + 9 +$ACADVER + 1 +AC1009 + 9 +$INSBASE + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$EXTMIN + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$EXTMAX + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$LIMMIN + 10 +0.0 + 20 +0.0 + 9 +$LIMMAX + 10 +12.0 + 20 +9.0 + 9 +$ORTHOMODE + 70 + 0 + 9 +$REGENMODE + 70 + 1 + 9 +$FILLMODE + 70 + 1 + 9 +$QTEXTMODE + 70 + 0 + 9 +$MIRRTEXT + 70 + 0 + 9 +$DRAGMODE + 70 + 2 + 9 +$LTSCALE + 40 +1.0 + 9 +$OSMODE + 70 + 37 + 9 +$ATTMODE + 70 + 1 + 9 +$TEXTSIZE + 40 +0.2 + 9 +$TRACEWID + 40 +0.05 + 9 +$TEXTSTYLE + 7 +STANDARD + 9 +$CLAYER + 8 +0 + 9 +$CELTYPE + 6 +BYLAYER + 9 +$CECOLOR + 62 + 256 + 9 +$DIMSCALE + 40 +1.0 + 9 +$DIMASZ + 40 +0.18 + 9 +$DIMEXO + 40 +0.0625 + 9 +$DIMDLI + 40 +0.38 + 9 +$DIMRND + 40 +0.0 + 9 +$DIMDLE + 40 +0.0 + 9 +$DIMEXE + 40 +0.18 + 9 +$DIMTP + 40 +0.0 + 9 +$DIMTM + 40 +0.0 + 9 +$DIMTXT + 40 +0.18 + 9 +$DIMCEN + 40 +0.09 + 9 +$DIMTSZ + 40 +0.0 + 9 +$DIMTOL + 70 + 0 + 9 +$DIMLIM + 70 + 0 + 9 +$DIMTIH + 70 + 1 + 9 +$DIMTOH + 70 + 1 + 9 +$DIMSE1 + 70 + 0 + 9 +$DIMSE2 + 70 + 0 + 9 +$DIMTAD + 70 + 0 + 9 +$DIMZIN + 70 + 0 + 9 +$DIMBLK + 1 + + 9 +$DIMASO + 70 + 1 + 9 +$DIMSHO + 70 + 1 + 9 +$DIMPOST + 1 + + 9 +$DIMAPOST + 1 + + 9 +$DIMALT + 70 + 0 + 9 +$DIMALTD + 70 + 2 + 9 +$DIMALTF + 40 +25.4 + 9 +$DIMLFAC + 40 +1.0 + 9 +$DIMTOFL + 70 + 0 + 9 +$DIMTVP + 40 +0.0 + 9 +$DIMTIX + 70 + 0 + 9 +$DIMSOXD + 70 + 0 + 9 +$DIMSAH + 70 + 0 + 9 +$DIMBLK1 + 1 + + 9 +$DIMBLK2 + 1 + + 9 +$DIMSTYLE + 2 +STANDARD + 9 +$DIMCLRD + 70 + 0 + 9 +$DIMCLRE + 70 + 0 + 9 +$DIMCLRT + 70 + 0 + 9 +$DIMTFAC + 40 +1.0 + 9 +$DIMGAP + 40 +0.09 + 9 +$LUNITS + 70 + 2 + 9 +$LUPREC + 70 + 4 + 9 +$SKETCHINC + 40 +0.1 + 9 +$FILLETRAD + 40 +0.0 + 9 +$AUNITS + 70 + 0 + 9 +$AUPREC + 70 + 0 + 9 +$MENU + 1 +. + 9 +$ELEVATION + 40 +0.0 + 9 +$PELEVATION + 40 +0.0 + 9 +$THICKNESS + 40 +0.0 + 9 +$LIMCHECK + 70 + 0 + 9 +$BLIPMODE + 70 + 0 + 9 +$CHAMFERA + 40 +0.0 + 9 +$CHAMFERB + 40 +0.0 + 9 +$SKPOLY + 70 + 0 + 9 +$TDCREATE + 40 +2458914.452037036885 + 9 +$TDUPDATE + 40 +2458914.452037036885 + 9 +$TDINDWG + 40 +0.0 + 9 +$TDUSRTIMER + 40 +0.0 + 9 +$USRTIMER + 70 + 1 + 9 +$ANGBASE + 50 +0.0 + 9 +$ANGDIR + 70 + 0 + 9 +$PDMODE + 70 + 0 + 9 +$PDSIZE + 40 +0.0 + 9 +$PLINEWID + 40 +0.0 + 9 +$COORDS + 70 + 1 + 9 +$SPLFRAME + 70 + 0 + 9 +$SPLINETYPE + 70 + 6 + 9 +$SPLINESEGS + 70 + 8 + 9 +$ATTDIA + 70 + 1 + 9 +$ATTREQ + 70 + 1 + 9 +$HANDLING + 70 + 1 + 9 +$HANDSEED + 5 +151 + 9 +$SURFTAB1 + 70 + 6 + 9 +$SURFTAB2 + 70 + 6 + 9 +$SURFTYPE + 70 + 6 + 9 +$SURFU + 70 + 6 + 9 +$SURFV + 70 + 6 + 9 +$UCSNAME + 2 + + 9 +$UCSORG + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSXDIR + 10 +1.0 + 20 +0.0 + 30 +0.0 + 9 +$UCSYDIR + 10 +0.0 + 20 +1.0 + 30 +0.0 + 9 +$PUCSNAME + 2 + + 9 +$PUCSORG + 10 +0.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSXDIR + 10 +1.0 + 20 +0.0 + 30 +0.0 + 9 +$PUCSYDIR + 10 +0.0 + 20 +1.0 + 30 +0.0 + 9 +$USERI1 + 70 + 0 + 9 +$USERI2 + 70 + 0 + 9 +$USERI3 + 70 + 0 + 9 +$USERI4 + 70 + 0 + 9 +$USERI5 + 70 + 0 + 9 +$USERR1 + 40 +0.0 + 9 +$USERR2 + 40 +0.0 + 9 +$USERR3 + 40 +0.0 + 9 +$USERR4 + 40 +0.0 + 9 +$USERR5 + 40 +0.0 + 9 +$WORLDVIEW + 70 + 1 + 9 +$SHADEDGE + 70 + 3 + 9 +$SHADEDIF + 70 + 70 + 9 +$TILEMODE + 70 + 1 + 9 +$MAXACTVP + 70 + 64 + 9 +$PLIMCHECK + 70 + 0 + 9 +$PEXTMIN + 10 +100000000000000000000.0 + 20 +100000000000000000000.0 + 30 +100000000000000000000.0 + 9 +$PEXTMAX + 10 +-100000000000000000000.0 + 20 +-100000000000000000000.0 + 30 +-100000000000000000000.0 + 9 +$PLIMMIN + 10 +0.0 + 20 +0.0 + 9 +$PLIMMAX + 10 +12.0 + 20 +9.0 + 9 +$UNITMODE + 70 + 0 + 9 +$VISRETAIN + 70 + 1 + 9 +$PLINEGEN + 70 + 0 + 9 +$PSLTSCALE + 70 + 1 + 0 +ENDSEC + 0 +SECTION + 2 +TABLES + 0 +ENDSEC + 0 +SECTION + 2 +ENTITIES + 0 +LINE + 5 +1 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +2.5 + 20 +2.5 + 30 +0.0 + 11 +16.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +2 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +16.5 + 20 +2.5 + 30 +0.0 + 11 +16.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +3 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +2.5 + 20 +16.5 + 30 +0.0 + 11 +16.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +4 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +2.5 + 20 +2.5 + 30 +0.0 + 11 +2.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +5 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +21.5 + 20 +2.5 + 30 +0.0 + 11 +35.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +6 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +35.5 + 20 +2.5 + 30 +0.0 + 11 +35.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +7 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +21.5 + 20 +16.5 + 30 +0.0 + 11 +35.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +8 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +21.5 + 20 +2.5 + 30 +0.0 + 11 +21.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +9 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +40.5 + 20 +2.5 + 30 +0.0 + 11 +54.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +54.5 + 20 +2.5 + 30 +0.0 + 11 +54.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +40.5 + 20 +16.5 + 30 +0.0 + 11 +54.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +40.5 + 20 +2.5 + 30 +0.0 + 11 +40.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +59.5 + 20 +2.5 + 30 +0.0 + 11 +73.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +73.5 + 20 +2.5 + 30 +0.0 + 11 +73.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +59.5 + 20 +16.5 + 30 +0.0 + 11 +73.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +10 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +59.5 + 20 +2.5 + 30 +0.0 + 11 +59.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +11 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +78.5 + 20 +2.5 + 30 +0.0 + 11 +92.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +12 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +92.5 + 20 +2.5 + 30 +0.0 + 11 +92.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +13 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +78.5 + 20 +16.5 + 30 +0.0 + 11 +92.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +14 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +78.5 + 20 +2.5 + 30 +0.0 + 11 +78.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +15 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +97.5 + 20 +2.5 + 30 +0.0 + 11 +111.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +16 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +111.5 + 20 +2.5 + 30 +0.0 + 11 +111.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +17 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +97.5 + 20 +16.5 + 30 +0.0 + 11 +111.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +18 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +97.5 + 20 +2.5 + 30 +0.0 + 11 +97.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +19 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +116.5 + 20 +2.5 + 30 +0.0 + 11 +130.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +1A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +130.5 + 20 +2.5 + 30 +0.0 + 11 +130.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +1B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +116.5 + 20 +16.5 + 30 +0.0 + 11 +130.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +1C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +116.5 + 20 +2.5 + 30 +0.0 + 11 +116.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +1D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +135.5 + 20 +2.5 + 30 +0.0 + 11 +149.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +1E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +149.5 + 20 +2.5 + 30 +0.0 + 11 +149.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +1F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +135.5 + 20 +16.5 + 30 +0.0 + 11 +149.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +20 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +135.5 + 20 +2.5 + 30 +0.0 + 11 +135.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +21 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +154.5 + 20 +2.5 + 30 +0.0 + 11 +168.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +22 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +168.5 + 20 +2.5 + 30 +0.0 + 11 +168.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +23 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +154.5 + 20 +16.5 + 30 +0.0 + 11 +168.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +24 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +154.5 + 20 +2.5 + 30 +0.0 + 11 +154.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +25 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +173.5 + 20 +2.5 + 30 +0.0 + 11 +187.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +26 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +187.5 + 20 +2.5 + 30 +0.0 + 11 +187.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +27 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +173.5 + 20 +16.5 + 30 +0.0 + 11 +187.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +28 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +173.5 + 20 +2.5 + 30 +0.0 + 11 +173.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +29 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +192.5 + 20 +2.5 + 30 +0.0 + 11 +206.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +2A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +206.5 + 20 +2.5 + 30 +0.0 + 11 +206.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +2B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +192.5 + 20 +16.5 + 30 +0.0 + 11 +206.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +2C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +192.5 + 20 +2.5 + 30 +0.0 + 11 +192.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +2D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.5 + 20 +2.5 + 30 +0.0 + 11 +225.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +2E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +225.5 + 20 +2.5 + 30 +0.0 + 11 +225.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +2F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.5 + 20 +16.5 + 30 +0.0 + 11 +225.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +30 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.5 + 20 +2.5 + 30 +0.0 + 11 +211.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +31 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +230.5 + 20 +2.5 + 30 +0.0 + 11 +244.5 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +32 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +244.5 + 20 +2.5 + 30 +0.0 + 11 +244.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +33 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +230.5 + 20 +16.5 + 30 +0.0 + 11 +244.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +34 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +230.5 + 20 +2.5 + 30 +0.0 + 11 +230.5 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +35 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +254.25 + 20 +2.5 + 30 +0.0 + 11 +268.25 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +36 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +268.25 + 20 +2.5 + 30 +0.0 + 11 +268.25 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +37 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +254.25 + 20 +16.5 + 30 +0.0 + 11 +268.25 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +38 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +254.25 + 20 +2.5 + 30 +0.0 + 11 +254.25 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +39 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +2.5 + 30 +0.0 + 11 +296.75 + 21 +2.5 + 31 +0.0 + 0 +LINE + 5 +3A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +296.75 + 20 +2.5 + 30 +0.0 + 11 +296.75 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +3B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +16.5 + 30 +0.0 + 11 +296.75 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +3C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +2.5 + 30 +0.0 + 11 +282.75 + 21 +16.5 + 31 +0.0 + 0 +LINE + 5 +3D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +2.5 + 20 +-16.5 + 30 +0.0 + 11 +16.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +3E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +16.5 + 20 +-16.5 + 30 +0.0 + 11 +16.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +3F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +2.5 + 20 +-2.5 + 30 +0.0 + 11 +16.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +40 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +2.5 + 20 +-16.5 + 30 +0.0 + 11 +2.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +41 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +21.5 + 20 +-16.5 + 30 +0.0 + 11 +35.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +42 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +35.5 + 20 +-16.5 + 30 +0.0 + 11 +35.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +43 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +21.5 + 20 +-2.5 + 30 +0.0 + 11 +35.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +44 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +21.5 + 20 +-16.5 + 30 +0.0 + 11 +21.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +45 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +40.5 + 20 +-16.5 + 30 +0.0 + 11 +54.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +46 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +54.5 + 20 +-16.5 + 30 +0.0 + 11 +54.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +47 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +40.5 + 20 +-2.5 + 30 +0.0 + 11 +54.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +48 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +40.5 + 20 +-16.5 + 30 +0.0 + 11 +40.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +49 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +59.5 + 20 +-16.5 + 30 +0.0 + 11 +73.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +4A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +73.5 + 20 +-16.5 + 30 +0.0 + 11 +73.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +4B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +59.5 + 20 +-2.5 + 30 +0.0 + 11 +73.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +4C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +59.5 + 20 +-16.5 + 30 +0.0 + 11 +59.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +4D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +78.5 + 20 +-16.5 + 30 +0.0 + 11 +92.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +4E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +92.5 + 20 +-16.5 + 30 +0.0 + 11 +92.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +4F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +78.5 + 20 +-2.5 + 30 +0.0 + 11 +92.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +50 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +78.5 + 20 +-16.5 + 30 +0.0 + 11 +78.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +51 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +97.5 + 20 +-16.5 + 30 +0.0 + 11 +111.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +52 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +111.5 + 20 +-16.5 + 30 +0.0 + 11 +111.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +53 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +97.5 + 20 +-2.5 + 30 +0.0 + 11 +111.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +54 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +97.5 + 20 +-16.5 + 30 +0.0 + 11 +97.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +55 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +116.5 + 20 +-16.5 + 30 +0.0 + 11 +130.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +56 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +130.5 + 20 +-16.5 + 30 +0.0 + 11 +130.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +57 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +116.5 + 20 +-2.5 + 30 +0.0 + 11 +130.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +58 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +116.5 + 20 +-16.5 + 30 +0.0 + 11 +116.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +59 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +135.5 + 20 +-16.5 + 30 +0.0 + 11 +149.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +5A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +149.5 + 20 +-16.5 + 30 +0.0 + 11 +149.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +5B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +135.5 + 20 +-2.5 + 30 +0.0 + 11 +149.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +5C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +135.5 + 20 +-16.5 + 30 +0.0 + 11 +135.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +5D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +154.5 + 20 +-16.5 + 30 +0.0 + 11 +168.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +5E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +168.5 + 20 +-16.5 + 30 +0.0 + 11 +168.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +5F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +154.5 + 20 +-2.5 + 30 +0.0 + 11 +168.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +60 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +154.5 + 20 +-16.5 + 30 +0.0 + 11 +154.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +61 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +173.5 + 20 +-16.5 + 30 +0.0 + 11 +187.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +62 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +187.5 + 20 +-16.5 + 30 +0.0 + 11 +187.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +63 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +173.5 + 20 +-2.5 + 30 +0.0 + 11 +187.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +64 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +173.5 + 20 +-16.5 + 30 +0.0 + 11 +173.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +65 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +192.5 + 20 +-16.5 + 30 +0.0 + 11 +206.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +66 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +206.5 + 20 +-16.5 + 30 +0.0 + 11 +206.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +67 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +192.5 + 20 +-2.5 + 30 +0.0 + 11 +206.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +68 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +192.5 + 20 +-16.5 + 30 +0.0 + 11 +192.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +69 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.5 + 20 +-16.5 + 30 +0.0 + 11 +225.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +6A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +225.5 + 20 +-16.5 + 30 +0.0 + 11 +225.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +6B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.5 + 20 +-2.5 + 30 +0.0 + 11 +225.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +6C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.5 + 20 +-16.5 + 30 +0.0 + 11 +211.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +6D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +230.5 + 20 +-16.5 + 30 +0.0 + 11 +244.5 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +6E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +244.5 + 20 +-16.5 + 30 +0.0 + 11 +244.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +6F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +230.5 + 20 +-2.5 + 30 +0.0 + 11 +244.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +70 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +230.5 + 20 +-16.5 + 30 +0.0 + 11 +230.5 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +71 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +254.25 + 20 +-16.5 + 30 +0.0 + 11 +268.25 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +72 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +268.25 + 20 +-16.5 + 30 +0.0 + 11 +268.25 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +73 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +254.25 + 20 +-2.5 + 30 +0.0 + 11 +268.25 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +74 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +254.25 + 20 +-16.5 + 30 +0.0 + 11 +254.25 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +75 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-16.5 + 30 +0.0 + 11 +296.75 + 21 +-16.5 + 31 +0.0 + 0 +LINE + 5 +76 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +296.75 + 20 +-16.5 + 30 +0.0 + 11 +296.75 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +77 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-2.5 + 30 +0.0 + 11 +296.75 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +78 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-16.5 + 30 +0.0 + 11 +282.75 + 21 +-2.5 + 31 +0.0 + 0 +LINE + 5 +79 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +7.25 + 20 +-35.5 + 30 +0.0 + 11 +21.25 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +7A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +21.25 + 20 +-35.5 + 30 +0.0 + 11 +21.25 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +7B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +7.25 + 20 +-21.5 + 30 +0.0 + 11 +21.25 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +7C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +7.25 + 20 +-35.5 + 30 +0.0 + 11 +7.25 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +7D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +31.0 + 20 +-35.5 + 30 +0.0 + 11 +45.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +7E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +45.0 + 20 +-35.5 + 30 +0.0 + 11 +45.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +7F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +31.0 + 20 +-21.5 + 30 +0.0 + 11 +45.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +80 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +31.0 + 20 +-35.5 + 30 +0.0 + 11 +31.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +81 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +50.0 + 20 +-35.5 + 30 +0.0 + 11 +64.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +82 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +64.0 + 20 +-35.5 + 30 +0.0 + 11 +64.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +83 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +50.0 + 20 +-21.5 + 30 +0.0 + 11 +64.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +84 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +50.0 + 20 +-35.5 + 30 +0.0 + 11 +50.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +85 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +69.0 + 20 +-35.5 + 30 +0.0 + 11 +83.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +86 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +83.0 + 20 +-35.5 + 30 +0.0 + 11 +83.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +87 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +69.0 + 20 +-21.5 + 30 +0.0 + 11 +83.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +88 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +69.0 + 20 +-35.5 + 30 +0.0 + 11 +69.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +89 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +88.0 + 20 +-35.5 + 30 +0.0 + 11 +102.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +8A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +102.0 + 20 +-35.5 + 30 +0.0 + 11 +102.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +8B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +88.0 + 20 +-21.5 + 30 +0.0 + 11 +102.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +8C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +88.0 + 20 +-35.5 + 30 +0.0 + 11 +88.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +8D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +107.0 + 20 +-35.5 + 30 +0.0 + 11 +121.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +8E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +121.0 + 20 +-35.5 + 30 +0.0 + 11 +121.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +8F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +107.0 + 20 +-21.5 + 30 +0.0 + 11 +121.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +90 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +107.0 + 20 +-35.5 + 30 +0.0 + 11 +107.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +91 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +126.0 + 20 +-35.5 + 30 +0.0 + 11 +140.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +92 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +140.0 + 20 +-35.5 + 30 +0.0 + 11 +140.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +93 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +126.0 + 20 +-21.5 + 30 +0.0 + 11 +140.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +94 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +126.0 + 20 +-35.5 + 30 +0.0 + 11 +126.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +95 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +145.0 + 20 +-35.5 + 30 +0.0 + 11 +159.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +96 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +159.0 + 20 +-35.5 + 30 +0.0 + 11 +159.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +97 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +145.0 + 20 +-21.5 + 30 +0.0 + 11 +159.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +98 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +145.0 + 20 +-35.5 + 30 +0.0 + 11 +145.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +99 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +164.0 + 20 +-35.5 + 30 +0.0 + 11 +178.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +9A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +178.0 + 20 +-35.5 + 30 +0.0 + 11 +178.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +9B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +164.0 + 20 +-21.5 + 30 +0.0 + 11 +178.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +9C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +164.0 + 20 +-35.5 + 30 +0.0 + 11 +164.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +9D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +183.0 + 20 +-35.5 + 30 +0.0 + 11 +197.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +9E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +197.0 + 20 +-35.5 + 30 +0.0 + 11 +197.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +9F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +183.0 + 20 +-21.5 + 30 +0.0 + 11 +197.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +A0 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +183.0 + 20 +-35.5 + 30 +0.0 + 11 +183.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +A1 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +202.0 + 20 +-35.5 + 30 +0.0 + 11 +216.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +A2 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +216.0 + 20 +-35.5 + 30 +0.0 + 11 +216.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +A3 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +202.0 + 20 +-21.5 + 30 +0.0 + 11 +216.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +A4 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +202.0 + 20 +-35.5 + 30 +0.0 + 11 +202.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +A5 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +221.0 + 20 +-35.5 + 30 +0.0 + 11 +235.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +A6 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +235.0 + 20 +-35.5 + 30 +0.0 + 11 +235.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +A7 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +221.0 + 20 +-21.5 + 30 +0.0 + 11 +235.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +A8 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +221.0 + 20 +-35.5 + 30 +0.0 + 11 +221.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +A9 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +240.0 + 20 +-35.5 + 30 +0.0 + 11 +254.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +AA +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +254.0 + 20 +-35.5 + 30 +0.0 + 11 +254.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +AB +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +240.0 + 20 +-21.5 + 30 +0.0 + 11 +254.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +AC +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +240.0 + 20 +-35.5 + 30 +0.0 + 11 +240.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +AD +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +259.0 + 20 +-35.5 + 30 +0.0 + 11 +273.0 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +AE +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +273.0 + 20 +-35.5 + 30 +0.0 + 11 +273.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +AF +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +259.0 + 20 +-21.5 + 30 +0.0 + 11 +273.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +B0 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +259.0 + 20 +-35.5 + 30 +0.0 + 11 +259.0 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +B1 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-35.5 + 30 +0.0 + 11 +296.75 + 21 +-35.5 + 31 +0.0 + 0 +LINE + 5 +B2 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +296.75 + 20 +-35.5 + 30 +0.0 + 11 +296.75 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +B3 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-21.5 + 30 +0.0 + 11 +296.75 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +B4 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-35.5 + 30 +0.0 + 11 +282.75 + 21 +-21.5 + 31 +0.0 + 0 +LINE + 5 +B5 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +12.0 + 20 +-54.5 + 30 +0.0 + 11 +26.0 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +B6 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +26.0 + 20 +-54.5 + 30 +0.0 + 11 +26.0 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +B7 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +12.0 + 20 +-40.5 + 30 +0.0 + 11 +26.0 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +B8 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +12.0 + 20 +-54.5 + 30 +0.0 + 11 +12.0 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +B9 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +35.75 + 20 +-54.5 + 30 +0.0 + 11 +49.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +BA +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +49.75 + 20 +-54.5 + 30 +0.0 + 11 +49.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +BB +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +35.75 + 20 +-40.5 + 30 +0.0 + 11 +49.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +BC +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +35.75 + 20 +-54.5 + 30 +0.0 + 11 +35.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +BD +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +54.75 + 20 +-54.5 + 30 +0.0 + 11 +68.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +BE +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +68.75 + 20 +-54.5 + 30 +0.0 + 11 +68.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +BF +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +54.75 + 20 +-40.5 + 30 +0.0 + 11 +68.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +C0 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +54.75 + 20 +-54.5 + 30 +0.0 + 11 +54.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +C1 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +73.75 + 20 +-54.5 + 30 +0.0 + 11 +87.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +C2 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +87.75 + 20 +-54.5 + 30 +0.0 + 11 +87.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +C3 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +73.75 + 20 +-40.5 + 30 +0.0 + 11 +87.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +C4 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +73.75 + 20 +-54.5 + 30 +0.0 + 11 +73.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +C5 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +92.75 + 20 +-54.5 + 30 +0.0 + 11 +106.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +C6 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +106.75 + 20 +-54.5 + 30 +0.0 + 11 +106.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +C7 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +92.75 + 20 +-40.5 + 30 +0.0 + 11 +106.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +C8 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +92.75 + 20 +-54.5 + 30 +0.0 + 11 +92.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +C9 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +111.75 + 20 +-54.5 + 30 +0.0 + 11 +125.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +CA +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +125.75 + 20 +-54.5 + 30 +0.0 + 11 +125.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +CB +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +111.75 + 20 +-40.5 + 30 +0.0 + 11 +125.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +CC +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +111.75 + 20 +-54.5 + 30 +0.0 + 11 +111.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +CD +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +130.75 + 20 +-54.5 + 30 +0.0 + 11 +144.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +CE +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +144.75 + 20 +-54.5 + 30 +0.0 + 11 +144.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +CF +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +130.75 + 20 +-40.5 + 30 +0.0 + 11 +144.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +D0 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +130.75 + 20 +-54.5 + 30 +0.0 + 11 +130.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +D1 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +149.75 + 20 +-54.5 + 30 +0.0 + 11 +163.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +D2 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +163.75 + 20 +-54.5 + 30 +0.0 + 11 +163.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +D3 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +149.75 + 20 +-40.5 + 30 +0.0 + 11 +163.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +D4 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +149.75 + 20 +-54.5 + 30 +0.0 + 11 +149.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +D5 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +168.75 + 20 +-54.5 + 30 +0.0 + 11 +182.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +D6 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +182.75 + 20 +-54.5 + 30 +0.0 + 11 +182.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +D7 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +168.75 + 20 +-40.5 + 30 +0.0 + 11 +182.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +D8 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +168.75 + 20 +-54.5 + 30 +0.0 + 11 +168.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +D9 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +187.75 + 20 +-54.5 + 30 +0.0 + 11 +201.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +DA +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +201.75 + 20 +-54.5 + 30 +0.0 + 11 +201.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +DB +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +187.75 + 20 +-40.5 + 30 +0.0 + 11 +201.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +DC +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +187.75 + 20 +-54.5 + 30 +0.0 + 11 +187.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +DD +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +206.75 + 20 +-54.5 + 30 +0.0 + 11 +220.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +DE +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +220.75 + 20 +-54.5 + 30 +0.0 + 11 +220.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +DF +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +206.75 + 20 +-40.5 + 30 +0.0 + 11 +220.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +E0 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +206.75 + 20 +-54.5 + 30 +0.0 + 11 +206.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +E1 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +225.75 + 20 +-54.5 + 30 +0.0 + 11 +239.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +E2 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +239.75 + 20 +-54.5 + 30 +0.0 + 11 +239.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +E3 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +225.75 + 20 +-40.5 + 30 +0.0 + 11 +239.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +E4 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +225.75 + 20 +-54.5 + 30 +0.0 + 11 +225.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +E5 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +249.5 + 20 +-54.5 + 30 +0.0 + 11 +263.5 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +E6 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +263.5 + 20 +-54.5 + 30 +0.0 + 11 +263.5 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +E7 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +249.5 + 20 +-40.5 + 30 +0.0 + 11 +263.5 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +E8 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +249.5 + 20 +-54.5 + 30 +0.0 + 11 +249.5 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +E9 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-54.5 + 30 +0.0 + 11 +296.75 + 21 +-54.5 + 31 +0.0 + 0 +LINE + 5 +EA +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +296.75 + 20 +-54.5 + 30 +0.0 + 11 +296.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +EB +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-40.5 + 30 +0.0 + 11 +296.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +EC +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-54.5 + 30 +0.0 + 11 +282.75 + 21 +-40.5 + 31 +0.0 + 0 +LINE + 5 +ED +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +16.75 + 20 +-73.5 + 30 +0.0 + 11 +30.75 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +EE +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +30.75 + 20 +-73.5 + 30 +0.0 + 11 +30.75 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +EF +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +16.75 + 20 +-59.5 + 30 +0.0 + 11 +30.75 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +F0 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +16.75 + 20 +-73.5 + 30 +0.0 + 11 +16.75 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +F1 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +45.25 + 20 +-73.5 + 30 +0.0 + 11 +59.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +F2 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +59.25 + 20 +-73.5 + 30 +0.0 + 11 +59.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +F3 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +45.25 + 20 +-59.5 + 30 +0.0 + 11 +59.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +F4 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +45.25 + 20 +-73.5 + 30 +0.0 + 11 +45.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +F5 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +64.25 + 20 +-73.5 + 30 +0.0 + 11 +78.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +F6 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +78.25 + 20 +-73.5 + 30 +0.0 + 11 +78.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +F7 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +64.25 + 20 +-59.5 + 30 +0.0 + 11 +78.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +F8 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +64.25 + 20 +-73.5 + 30 +0.0 + 11 +64.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +F9 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +83.25 + 20 +-73.5 + 30 +0.0 + 11 +97.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +FA +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +97.25 + 20 +-73.5 + 30 +0.0 + 11 +97.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +FB +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +83.25 + 20 +-59.5 + 30 +0.0 + 11 +97.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +FC +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +83.25 + 20 +-73.5 + 30 +0.0 + 11 +83.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +FD +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +102.25 + 20 +-73.5 + 30 +0.0 + 11 +116.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +FE +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +116.25 + 20 +-73.5 + 30 +0.0 + 11 +116.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +FF +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +102.25 + 20 +-59.5 + 30 +0.0 + 11 +116.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +100 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +102.25 + 20 +-73.5 + 30 +0.0 + 11 +102.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +101 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +121.25 + 20 +-73.5 + 30 +0.0 + 11 +135.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +102 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +135.25 + 20 +-73.5 + 30 +0.0 + 11 +135.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +103 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +121.25 + 20 +-59.5 + 30 +0.0 + 11 +135.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +104 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +121.25 + 20 +-73.5 + 30 +0.0 + 11 +121.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +105 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +140.25 + 20 +-73.5 + 30 +0.0 + 11 +154.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +106 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +154.25 + 20 +-73.5 + 30 +0.0 + 11 +154.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +107 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +140.25 + 20 +-59.5 + 30 +0.0 + 11 +154.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +108 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +140.25 + 20 +-73.5 + 30 +0.0 + 11 +140.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +109 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +159.25 + 20 +-73.5 + 30 +0.0 + 11 +173.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +10A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +173.25 + 20 +-73.5 + 30 +0.0 + 11 +173.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +10B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +159.25 + 20 +-59.5 + 30 +0.0 + 11 +173.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +10C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +159.25 + 20 +-73.5 + 30 +0.0 + 11 +159.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +10D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +178.25 + 20 +-73.5 + 30 +0.0 + 11 +192.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +10E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +192.25 + 20 +-73.5 + 30 +0.0 + 11 +192.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +10F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +178.25 + 20 +-59.5 + 30 +0.0 + 11 +192.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +110 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +178.25 + 20 +-73.5 + 30 +0.0 + 11 +178.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +111 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +197.25 + 20 +-73.5 + 30 +0.0 + 11 +211.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +112 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.25 + 20 +-73.5 + 30 +0.0 + 11 +211.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +113 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +197.25 + 20 +-59.5 + 30 +0.0 + 11 +211.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +114 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +197.25 + 20 +-73.5 + 30 +0.0 + 11 +197.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +115 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +216.25 + 20 +-73.5 + 30 +0.0 + 11 +230.25 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +116 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +230.25 + 20 +-73.5 + 30 +0.0 + 11 +230.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +117 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +216.25 + 20 +-59.5 + 30 +0.0 + 11 +230.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +118 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +216.25 + 20 +-73.5 + 30 +0.0 + 11 +216.25 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +119 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +240.0 + 20 +-73.5 + 30 +0.0 + 11 +254.0 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +11A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +254.0 + 20 +-73.5 + 30 +0.0 + 11 +254.0 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +11B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +240.0 + 20 +-59.5 + 30 +0.0 + 11 +254.0 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +11C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +240.0 + 20 +-73.5 + 30 +0.0 + 11 +240.0 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +11D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +263.75 + 20 +-73.5 + 30 +0.0 + 11 +277.75 + 21 +-73.5 + 31 +0.0 + 0 +LINE + 5 +11E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +277.75 + 20 +-73.5 + 30 +0.0 + 11 +277.75 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +11F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +263.75 + 20 +-59.5 + 30 +0.0 + 11 +277.75 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +120 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +263.75 + 20 +-73.5 + 30 +0.0 + 11 +263.75 + 21 +-59.5 + 31 +0.0 + 0 +LINE + 5 +121 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +12.0 + 20 +-92.5 + 30 +0.0 + 11 +26.0 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +122 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +26.0 + 20 +-92.5 + 30 +0.0 + 11 +26.0 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +123 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +12.0 + 20 +-78.5 + 30 +0.0 + 11 +26.0 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +124 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +12.0 + 20 +-92.5 + 30 +0.0 + 11 +12.0 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +125 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +35.75 + 20 +-92.5 + 30 +0.0 + 11 +49.75 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +126 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +49.75 + 20 +-92.5 + 30 +0.0 + 11 +49.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +127 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +35.75 + 20 +-78.5 + 30 +0.0 + 11 +49.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +128 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +35.75 + 20 +-92.5 + 30 +0.0 + 11 +35.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +129 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +54.75 + 20 +-92.5 + 30 +0.0 + 11 +68.75 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +12A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +68.75 + 20 +-92.5 + 30 +0.0 + 11 +68.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +12B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +54.75 + 20 +-78.5 + 30 +0.0 + 11 +68.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +12C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +54.75 + 20 +-92.5 + 30 +0.0 + 11 +54.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +12D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +73.75 + 20 +-92.5 + 30 +0.0 + 11 +87.75 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +12E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +87.75 + 20 +-92.5 + 30 +0.0 + 11 +87.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +12F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +73.75 + 20 +-78.5 + 30 +0.0 + 11 +87.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +130 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +73.75 + 20 +-92.5 + 30 +0.0 + 11 +73.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +131 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +102.25 + 20 +-92.5 + 30 +0.0 + 11 +116.25 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +132 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +116.25 + 20 +-92.5 + 30 +0.0 + 11 +116.25 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +133 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +102.25 + 20 +-78.5 + 30 +0.0 + 11 +116.25 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +134 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +102.25 + 20 +-92.5 + 30 +0.0 + 11 +102.25 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +135 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +140.25 + 20 +-92.5 + 30 +0.0 + 11 +154.25 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +136 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +154.25 + 20 +-92.5 + 30 +0.0 + 11 +154.25 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +137 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +140.25 + 20 +-78.5 + 30 +0.0 + 11 +154.25 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +138 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +140.25 + 20 +-92.5 + 30 +0.0 + 11 +140.25 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +139 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +168.75 + 20 +-92.5 + 30 +0.0 + 11 +182.75 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +13A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +182.75 + 20 +-92.5 + 30 +0.0 + 11 +182.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +13B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +168.75 + 20 +-78.5 + 30 +0.0 + 11 +182.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +13C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +168.75 + 20 +-92.5 + 30 +0.0 + 11 +168.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +13D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +187.75 + 20 +-92.5 + 30 +0.0 + 11 +201.75 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +13E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +201.75 + 20 +-92.5 + 30 +0.0 + 11 +201.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +13F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +187.75 + 20 +-78.5 + 30 +0.0 + 11 +201.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +140 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +187.75 + 20 +-92.5 + 30 +0.0 + 11 +187.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +141 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.5 + 20 +-92.5 + 30 +0.0 + 11 +225.5 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +142 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +225.5 + 20 +-92.5 + 30 +0.0 + 11 +225.5 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +143 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.5 + 20 +-78.5 + 30 +0.0 + 11 +225.5 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +144 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +211.5 + 20 +-92.5 + 30 +0.0 + 11 +211.5 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +145 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +244.75 + 20 +-92.5 + 30 +0.0 + 11 +258.75 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +146 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +258.75 + 20 +-92.5 + 30 +0.0 + 11 +258.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +147 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +244.75 + 20 +-78.5 + 30 +0.0 + 11 +258.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +148 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +244.75 + 20 +-92.5 + 30 +0.0 + 11 +244.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +149 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +263.75 + 20 +-92.5 + 30 +0.0 + 11 +277.75 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +14A +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +277.75 + 20 +-92.5 + 30 +0.0 + 11 +277.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +14B +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +263.75 + 20 +-78.5 + 30 +0.0 + 11 +277.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +14C +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +263.75 + 20 +-92.5 + 30 +0.0 + 11 +263.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +14D +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-92.5 + 30 +0.0 + 11 +296.75 + 21 +-92.5 + 31 +0.0 + 0 +LINE + 5 +14E +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +296.75 + 20 +-92.5 + 30 +0.0 + 11 +296.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +14F +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-78.5 + 30 +0.0 + 11 +296.75 + 21 +-78.5 + 31 +0.0 + 0 +LINE + 5 +150 +100 +AcDbEntity + 8 +0 +100 +AcDbLine + 10 +282.75 + 20 +-92.5 + 30 +0.0 + 11 +282.75 + 21 +-78.5 + 31 +0.0 + 0 +ENDSEC + 0 +SECTION + 2 +OBJECTS + 0 +ENDSEC + 0 +EOF diff --git a/keyboards/system76/launch_alpha_2/layout-files/system76-launch-configurable-keyboard-1-0.json b/keyboards/system76/launch_alpha_2/layout-files/system76-launch-configurable-keyboard-1-0.json new file mode 100644 index 000000000000..01c9dfd1f4b5 --- /dev/null +++ b/keyboards/system76/launch_alpha_2/layout-files/system76-launch-configurable-keyboard-1-0.json @@ -0,0 +1,196 @@ +[ + { + "name": "System76 Launch Configurable Keyboard 1.0", + "author": "Jeremy" + }, + [ + { + "a": 6 + }, + "Esc", + "F1", + "F2", + "F3", + "F4", + "F5", + "F6", + "F7", + "F8", + "F9", + "F10", + "F11", + "F12", + { + "w": 1.5 + }, + "Del", + { + "x": 0.25, + "a": 7 + }, + "Home" + ], + [ + { + "a": 4 + }, + "~\n`", + "!\n1", + "@\n2", + "#\n3", + "$\n4", + "%\n5", + "^\n6", + "&\n7", + "*\n8", + "(\n9", + ")\n0", + "_\n-", + "+\n=", + { + "a": 6, + "w": 1.5 + }, + "Bksp", + { + "x": 0.25, + "a": 7 + }, + "PgUp" + ], + [ + { + "a": 6, + "w": 1.5 + }, + "Tab", + { + "a": 4 + }, + "Q", + "W", + "E", + "R", + "T", + "Y", + "U", + "I", + "O", + "P", + "{\n[", + "}\n]", + "|\n\\", + { + "x": 0.25, + "a": 7 + }, + "PgDn" + ], + [ + { + "x": 0.25, + "a": 6, + "w": 1.5 + }, + "Caps", + { + "a": 4 + }, + "A", + "S", + "D", + { + "n": true + }, + "F", + "G", + "H", + { + "n": true + }, + "J", + "K", + "L", + ":\n;", + "\"\n'", + { + "a": 6, + "w": 1.5 + }, + "Enter", + { + "x": 0.5, + "a": 7 + }, + "End" + ], + [ + { + "x": 0.25, + "a": 6, + "w": 2 + }, + "Shift", + { + "a": 4 + }, + "Z", + "X", + "C", + "V", + "B", + "N", + "M", + "<\n,", + ">\n.", + "?\n/", + { + "a": 6, + "w": 1.5 + }, + "Shift", + { + "a": 7 + }, + "" + ], + [ + { + "x": 0.25, + "a": 6, + "w": 1.5 + }, + "Ctrl", + "Fn", + "Super", + "Alt", + { + "a": 7, + "w": 2 + }, + "", + { + "w": 2 + }, + "", + { + "a": 6 + }, + "Ctrl", + "Alt", + { + "w": 1.5 + }, + "Fn", + { + "x": 0.5, + "a": 7 + }, + "", + { + "n": true + }, + "", + "" + ] +] \ No newline at end of file diff --git a/keyboards/system76/launch_alpha_2/rules.mk b/keyboards/system76/launch_alpha_2/rules.mk new file mode 100644 index 000000000000..30a711ac95d0 --- /dev/null +++ b/keyboards/system76/launch_alpha_2/rules.mk @@ -0,0 +1,25 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = caterina + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RAW_ENABLE = yes # Enable RAW HID commands (used by keyboard configurator) +USB_6KRO_ENABLE = no # 6key Rollover diff --git a/keyboards/system76/launch_heavy_1/README.md b/keyboards/system76/launch_heavy_1/README.md new file mode 100644 index 000000000000..8ad57e3ff41c --- /dev/null +++ b/keyboards/system76/launch_heavy_1/README.md @@ -0,0 +1,40 @@ +## Flashing firmware: +* Clone this repository and `cd` into the `qmk_firmware` directory. +* After cloning, you probably need to run `make git-submodule` as well as `./util/qmk_install`. + - You may also need to install dependencies: `sudo apt install avrdude gcc-avr avr-libc` +* To build the firmware without flashing the keyboard, use `make (keyboard name):(layout name)` + - For example, if you want to build the `default` layout for the Launch keyboard, run: +``` +make system76/launch_heavy_1:default +``` +* To flash the firmware, you'll use the same build command, but with `dfu` added to the end: +``` +make system76/launch_heavy_1:default:dfu +``` + - After it builds, you will see a repeating message that says: +``` +dfu-programmer: no device present. +ERROR: Bootloader not found. Trying again in 5s. +``` +Next, unplug your keyboard from your computer, hold the ESC key (while the keyboard is unplugged), and plug the keyboard back in while holding the ESC key. Once the keyboard is plugged in, the ESC key can be released. +* Note: on some distros, dfu-programmer has trouble detecting the keyboard unless you run the `make` command with `sudo`. +* To flash the firmware using ISP, you will need a USBasp device, and a tag connect cable. + - Build the firmware and bootloader with: +``` +make system76/launch_heavy_1:default:production +``` + - Run avrdude to flash the fuses: +``` +avrdude -c usbasp -p at90usb646 -U lfuse:w:0x5E:m -U hfuse:w:0xDB:m -U efuse:w:0xFB:m -U lock:w:0xFF:m +``` + - Run avrdude to flash the ROM: +``` +avrdude -c usbasp -p at90usb646 -U flash:w:system76_launch_heavy_1_default_production.hex +``` + +## Making your own layout: +If you want to create your own layout, go to the `keymaps` directory and copy one of the maps in there. It will likely be easiest to start with the default layout, but the other layouts in there may be helpful references. The name of the directory you create will be the name of your layout. To prevent build errors, it is recommended to use only lowercase letters, underscores, and numbers for the name of your layout. + +Inside of each layout directory, there is a file called `keymap.c`. The commented out grid area in this file is a visual reference for the actual key assignments below it. When modifying a layout, modifying this visual reference first makes it easier to design a layout, as well as keeping the actual layout below it organized. + +Once your layout is designed, change the keycodes below to match your design. A full list of available keycodes can be found in the [QMK docs](https://beta.docs.qmk.fm/reference/keycodes). Use the shorter keycode alias to help keep these lined up (e.g. use `KC_ESC` instead of `KC_ESCAPE`). diff --git a/keyboards/system76/launch_heavy_1/config.h b/keyboards/system76/launch_heavy_1/config.h new file mode 100644 index 000000000000..f3c448e867b6 --- /dev/null +++ b/keyboards/system76/launch_heavy_1/config.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + + +/* + * Key matrix pins + * ROWS: AVR pins used for rows, top to bottom + * COLS: AVR pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { F0, F1, F2, F3, F4, F5, D2, D4, D5, D6, D7, E0 } +#define MATRIX_COL_PINS { C6, C5, C4, C3, C2, C1, C7, A7, A6, A5, A4, E6, C0, E7 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +#ifdef RGB_MATRIX_ENABLE +# define RGB_DI_PIN F7 +# define RGB_MATRIX_LED_COUNT 105 +# define RGB_MATRIX_KEYPRESSES // Reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // Reacts to keyreleases (instead of keypresses) +// # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enables framebuffer effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Turns off effects when suspended +// Limit brightness to support USB-A at 0.5 A +// TODO: Do this dynamically based on power source +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 176 // Limits maximum brightness of LEDs to 176 out of 255. If not defined, maximum brightness is set to 255 +# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Sets the default mode, if none has been set +# define RGB_MATRIX_DEFAULT_HUE 142 // Sets the default hue value, if none has been set +# define RGB_MATRIX_DEFAULT_SAT 255 // Sets the default saturation value, if none has been set +# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set +# define RGB_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set +# define RGB_MATRIX_DISABLE_KEYCODES // Disables control of rgb matrix by keycodes (must use code functions to control the feature) + +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +#endif // RGB_MATRIX_ENABLE + +// Mechanical locking support; use KC_LCAP, KC_LNUM, or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// I2C { +#define F_SCL 100000UL // Run I2C bus at 100 kHz +#define I2C_START_RETRY_COUNT 20 +#define I2C_TIMEOUT 100 // milliseconds +// } I2C + +// EEPROM { +#define EEPROM_SIZE 2048 +// TODO: Refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x02 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) +// } EEPROM + +// Dynamic keymap { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 +#define DYNAMIC_KEYMAP_MACRO_COUNT 0 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +// Dynamic macro starts after dynamic keymaps, it is disabled +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2)) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 0 +// } Dynamic keymap + +// System76 EC { +#define SYSTEM76_EC_EEPROM_ADDR (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE) +#define SYSTEM76_EC_EEPROM_SIZE (EEPROM_SIZE - SYSTEM76_EC_EEPROM_ADDR) +// } System76 EC diff --git a/keyboards/system76/launch_heavy_1/i2c.c b/keyboards/system76/launch_heavy_1/i2c.c new file mode 100644 index 000000000000..a46927fa59e2 --- /dev/null +++ b/keyboards/system76/launch_heavy_1/i2c.c @@ -0,0 +1,176 @@ +#include +#include +#include + +#include "i2c.h" + +#define TIMEOUT (F_CPU/1000) + +// Initialize I2C with specified buad rate +void i2c_init(unsigned long baud) { + TWAR = 0; + TWBR = (uint8_t)(((F_CPU / baud) - 16 ) / 2); + TWCR = 0; +} + +// Send an I2C start condition, a 7-bit address, and a read bit +// Returns zero on success or negative number on error +int i2c_start(uint8_t addr, bool read) { + uint32_t count; + uint8_t twst; + + // transmit START condition + TWCR = (1< 0) count -= 1; + if (count == 0) return -1; + + // check if the start condition was successfully transmitted + twst = TW_STATUS & 0xF8; + if ((twst != TW_START) && (twst != TW_REP_START)) return -1; + + // load slave addr into data register + TWDR = ((addr << 1) | read); + // start transmission of addr + TWCR = (1< 0) count -= 1; + if (count == 0) return -1; + + // check if the device has acknowledged the READ / WRITE mode + twst = TW_STATUS & 0xF8; + if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) return -1; + + return 0; +} + +// Send an I2C stop condition +// Always successful +void i2c_stop(void) { + // transmit STOP condition + TWCR = (1< 0) count -= 1; + // timed out + if (count == 0) return -1; + // failed to receive ack + if((TWSR & 0xF8) != TW_MT_DATA_ACK) return -1; + } + + return i; +} + +// Read a byte from the I2C bus, sending an ack if specified +// Returns byte data on success or negative number on error +int i2c_read_byte(bool ack) { + if (ack) { + // start TWI module and acknowledge data after reception + TWCR = (1< 0) count -= 1; + if (count == 0) return -1; + // return received data from TWDR + return (int)TWDR; +} + +// Read data from the I2C bus +// Returns bytes read on success or negative number on error +int i2c_read(uint8_t * data, int length) { + int res; + int i; + + for (i = 0; i < length; i++) { + bool ack = (i + 1) < length; + res = i2c_read_byte(ack); + if (res < 0) return res; + data[i] = (uint8_t)res; + } + + return i; +} + +// Receive data from a specified address on the I2C bus +// Returns bytes read on success or negative number on error +int i2c_recv(uint8_t addr, uint8_t* data, int length) { + int res = 0; + + res = i2c_start(addr, true); + if (res < 0) return res; + + res = i2c_read(data, length); + if (res < 0) return res; + + i2c_stop(); + + return res; +} + +// Send data to a specified address on the I2C bus +// Returns bytes written on success or negative number on error +int i2c_send(uint8_t addr, uint8_t* data, int length) { + int res = 0; + + res = i2c_start(addr, false); + if (res < 0) return res; + + res = i2c_write(data, length); + if (res < 0) return res; + + i2c_stop(); + + return res; +} + +// Get data from a specified address and register on the I2C bus +// Returns bytes read on success or negative number on error +int i2c_get(uint8_t addr, uint8_t reg, uint8_t* data, int length) { + int res = 0; + + res = i2c_start(addr, false); + if (res < 0) return res; + + res = i2c_write(®, 1); + if (res < 0) return res; + + return i2c_recv(addr, data, length); +} + +// Set data in a specified address and register on the I2C bus +// Returns bytes written on success or negative number on error +int i2c_set(uint8_t addr, uint8_t reg, uint8_t* data, int length) { + int res = 0; + + res = i2c_start(addr, false); + if (res < 0) return res; + + res = i2c_write(®, 1); + if (res < 0) return res; + + res = i2c_write(data, length); + if (res < 0) return res; + + i2c_stop(); + + return res; +} diff --git a/keyboards/system76/launch_heavy_1/i2c.h b/keyboards/system76/launch_heavy_1/i2c.h new file mode 100644 index 000000000000..f980a308dced --- /dev/null +++ b/keyboards/system76/launch_heavy_1/i2c.h @@ -0,0 +1,46 @@ +#ifndef I2C_H +#define I2C_H + +#include +#include + +// Initialize I2C with specified buad rate +void i2c_init(unsigned long baud); + +// Send an I2C start condition, a 7-bit address, and a read bit +// Returns zero on success or negative number on error +int i2c_start(uint8_t addr, bool read); + +// Send an I2C stop condition +// Always successful +void i2c_stop(void); + +// Write data to the I2C bus +// Returns bytes written on success or negative number on error +int i2c_write(uint8_t * data, int length); + +// Read a byte from the I2C bus, sending an ack if specified +// Returns byte data on success or negative number on error +int i2c_read_byte(bool ack); + +// Read data from the I2C bus +// Returns bytes read on success or negative number on error +int i2c_read(uint8_t * data, int length); + +// Receive data from a specified address on the I2C bus +// Returns bytes read on success or negative number on error +int i2c_recv(uint8_t addr, uint8_t* data, int length); + +// Send data to a specified address on the I2C bus +// Returns bytes written on success or negative number on error +int i2c_send(uint8_t addr, uint8_t* data, int length); + +// Get data from a specified address and register on the I2C bus +// Returns bytes read on success or negative number on error +int i2c_get(uint8_t addr, uint8_t reg, uint8_t* data, int length); + +// Set data in a specified address and register on the I2C bus +// Returns bytes written on success or negative number on error +int i2c_set(uint8_t addr, uint8_t reg, uint8_t* data, int length); + +#endif // I2C_H diff --git a/keyboards/system76/launch_heavy_1/info.json b/keyboards/system76/launch_heavy_1/info.json new file mode 100644 index 000000000000..3027fd370672 --- /dev/null +++ b/keyboards/system76/launch_heavy_1/info.json @@ -0,0 +1,128 @@ +{ + "keyboard_name": "Launch Heavy Configurable Keyboard (launch_heavy_1)", + "manufacturer": "System76", + "url": "https://system76.com/accessories/launch", + "usb": { + "vid": "0x3384", + "pid": "0x0007", + "device_version": "0.0.1" + }, + "processor": "at90usb646", + "bootloader": "qmk-dfu", + "layouts": { + "LAYOUT": { + "layout": [ + { "matrix":[0, 0], "x": 0, "y": 0 }, + { "matrix":[0, 1], "x": 1, "y": 0 }, + { "matrix":[0, 2], "x": 2, "y": 0 }, + { "matrix":[0, 3], "x": 3, "y": 0 }, + { "matrix":[0, 4], "x": 4, "y": 0 }, + { "matrix":[0, 5], "x": 5, "y": 0 }, + { "matrix":[0, 6], "x": 6, "y": 0 }, + { "matrix":[0, 7], "x": 7, "y": 0 }, + { "matrix":[0, 8], "x": 8, "y": 0 }, + { "matrix":[0, 9], "x": 9, "y": 0 }, + { "matrix":[0,10], "x": 10, "y": 0 }, + { "matrix":[0,11], "x": 11, "y": 0 }, + { "matrix":[0,12], "x": 12, "y": 0 }, + { "matrix":[0,13], "x": 13, "y": 0, "w": 1.5 }, + { "matrix":[3,13], "x": 14.75, "y": 0 }, + { "matrix":[6,12], "x": 16.25, "y": 0 }, + { "matrix":[6, 5], "x": 17.25, "y": 0 }, + { "matrix":[6, 4], "x": 18.25, "y": 0 }, + { "matrix":[6, 3], "x": 19.25, "y": 0 }, + + { "matrix":[1, 0], "x": 0, "y": 1 }, + { "matrix":[1, 1], "x": 1, "y": 1 }, + { "matrix":[1, 2], "x": 2, "y": 1 }, + { "matrix":[1, 3], "x": 3, "y": 1 }, + { "matrix":[1, 4], "x": 4, "y": 1 }, + { "matrix":[1, 5], "x": 5, "y": 1 }, + { "matrix":[1, 6], "x": 6, "y": 1 }, + { "matrix":[1, 7], "x": 7, "y": 1 }, + { "matrix":[1, 8], "x": 8, "y": 1 }, + { "matrix":[1, 9], "x": 9, "y": 1 }, + { "matrix":[1,10], "x": 10, "y": 1 }, + { "matrix":[1,11], "x": 11, "y": 1 }, + { "matrix":[1,12], "x": 12, "y": 1 }, + { "matrix":[1,13], "x": 13, "y": 1, "w": 1.5 }, + { "matrix":[4,13], "x": 14.75, "y": 1 }, + { "matrix":[7,12], "x": 16.25, "y": 1 }, + { "matrix":[7, 5], "x": 17.25, "y": 1 }, + { "matrix":[7, 4], "x": 18.25, "y": 1 }, + { "matrix":[7, 3], "x": 19.25, "y": 1 }, + + { "matrix":[2, 0], "x": 0, "y": 2, "w": 1.5 }, + { "matrix":[2, 1], "x": 1.5, "y": 2 }, + { "matrix":[2, 2], "x": 2.5, "y": 2 }, + { "matrix":[2, 3], "x": 3.5, "y": 2 }, + { "matrix":[2, 4], "x": 4.5, "y": 2 }, + { "matrix":[2, 5], "x": 5.5, "y": 2 }, + { "matrix":[2, 6], "x": 6.5, "y": 2 }, + { "matrix":[2, 7], "x": 7.5, "y": 2 }, + { "matrix":[2, 8], "x": 8.5, "y": 2 }, + { "matrix":[2, 9], "x": 9.5, "y": 2 }, + { "matrix":[2,10], "x": 10.5, "y": 2 }, + { "matrix":[2,11], "x": 11.5, "y": 2 }, + { "matrix":[2,12], "x": 12.5, "y": 2 }, + { "matrix":[2,13], "x": 13.5, "y": 2 }, + { "matrix":[5,13], "x": 14.75, "y": 2 }, + { "matrix":[8,12], "x": 16.25, "y": 2 }, + { "matrix":[8, 5], "x": 17.25, "y": 2 }, + { "matrix":[8, 4], "x": 18.25, "y": 2 }, + { "matrix":[8, 3], "x": 19.25, "y": 2, "h": 2 }, + + { "matrix":[3, 0], "x": 0.25, "y": 3, "w": 1.5 }, + { "matrix":[3, 1], "x": 1.75, "y": 3 }, + { "matrix":[3, 2], "x": 2.75, "y": 3 }, + { "matrix":[3, 3], "x": 3.75, "y": 3 }, + { "matrix":[3, 4], "x": 4.75, "y": 3 }, + { "matrix":[3, 5], "x": 5.75, "y": 3 }, + { "matrix":[3, 6], "x": 6.75, "y": 3 }, + { "matrix":[3, 7], "x": 7.75, "y": 3 }, + { "matrix":[3, 8], "x": 8.75, "y": 3 }, + { "matrix":[3, 9], "x": 9.75, "y": 3 }, + { "matrix":[3,10], "x": 10.75, "y": 3 }, + { "matrix":[3,11], "x": 11.75, "y": 3 }, + { "matrix":[3,12], "x": 12.75, "y": 3, "w": 1.5 }, + { "matrix":[5, 5], "x": 14.75, "y": 3 }, + { "matrix":[9,12], "x": 16.25, "y": 3 }, + { "matrix":[9, 5], "x": 17.25, "y": 3 }, + { "matrix":[9, 4], "x": 18.25, "y": 3 }, + + { "matrix":[ 4, 0], "x": 0.25, "y": 4, "w": 2 }, + { "matrix":[ 4, 1], "x": 2.25, "y": 4 }, + { "matrix":[ 4, 2], "x": 3.25, "y": 4 }, + { "matrix":[ 4, 3], "x": 4.25, "y": 4 }, + { "matrix":[ 4, 4], "x": 5.25, "y": 4 }, + { "matrix":[ 4, 5], "x": 6.25, "y": 4 }, + { "matrix":[ 4, 6], "x": 7.25, "y": 4 }, + { "matrix":[ 4, 7], "x": 8.25, "y": 4 }, + { "matrix":[ 4, 8], "x": 9.25, "y": 4 }, + { "matrix":[ 4, 9], "x": 10.25, "y": 4 }, + { "matrix":[ 4,10], "x": 11.25, "y": 4 }, + { "matrix":[ 4,11], "x": 12.25, "y": 4, "w": 1.5 }, + { "matrix":[ 4,12], "x": 13.75, "y": 4 }, + { "matrix":[10,12], "x": 16.25, "y": 4 }, + { "matrix":[10, 5], "x": 17.25, "y": 4 }, + { "matrix":[10, 4], "x": 18.25, "y": 4 }, + { "matrix":[10, 3], "x": 19.25, "y": 4, "h": 2 }, + + { "matrix":[ 5, 0], "x": 0.25, "y": 5, "w": 1.5 }, + { "matrix":[ 5, 1], "x": 1.75, "y": 5 }, + { "matrix":[ 5, 2], "x": 2.75, "y": 5 }, + { "matrix":[ 5, 3], "x": 3.75, "y": 5 }, + { "matrix":[ 5, 4], "x": 4.75, "y": 5, "w": 2 }, + { "matrix":[ 5, 6], "x": 6.75, "y": 5, "w": 2 }, + { "matrix":[ 5, 7], "x": 8.75, "y": 5 }, + { "matrix":[ 5, 8], "x": 9.75, "y": 5 }, + { "matrix":[ 5, 9], "x": 10.75, "y": 5, "w": 1.5 }, + { "matrix":[ 5,10], "x": 12.75, "y": 5 }, + { "matrix":[ 5,11], "x": 13.75, "y": 5 }, + { "matrix":[ 5,12], "x": 14.75, "y": 5 }, + { "matrix":[11,12], "x": 16.25, "y": 5, "w": 2 }, + { "matrix":[11, 4], "x": 18.25, "y": 5 } + ] + } + } +} diff --git a/keyboards/system76/launch_heavy_1/keymaps/default/keymap.c b/keyboards/system76/launch_heavy_1/keymaps/default/keymap.c new file mode 100644 index 000000000000..9921bde65e9f --- /dev/null +++ b/keyboards/system76/launch_heavy_1/keymaps/default/keymap.c @@ -0,0 +1,98 @@ +#include QMK_KEYBOARD_H +#define ______ KC_TRNS + +enum layers{ + First, + Second, + Third, + Fourth +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || || PRINT | MEDIA | PLAY/ | MEDIA | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME || SCREEN |PREVIOUS| PAUSE | NEXT | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | | | || || NUM | NUM | NUM | NUM | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP || LOCK | SLASH | * | - | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | [ | ] | || || NUM | NUM | NUM | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN || 7 | 8 | 9 | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| NUM | + | | | | | | | | | | | ; | ' | | | || NUM | NUM | NUM | + | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END || 4 | 5 | 6 | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | | | | | | | | , | . | / | | | | NUM | NUM | NUM | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | | 1 | 2 | 3 | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| NUM | + | | | | | | | | | | | | | || NUM | NUM | ENTER | + | CTRL | LALT | FN | LGUI | SPACE | SPACE | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT || 0 | . | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| +*/ + + [First] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, KC_PSCR, KC_MPRV, KC_MPLY, KC_MNXT, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, MO(1), KC_LGUI, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || PLAY/ || | | | | +| QK_BOOT| | | | | | | | | | | | | || PAUSE || | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | LED | LED | LED | || VOLUME || | | | | +| | | | | | | | | | | TOGGLE | DOWN | UP | || UP || | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | | | || VOLUME || | | | | +|PRINT SCREEN| | | | | | HOME | PGDN | PGUP | END | | | | || DOWN || | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| | + | | | | | | | | | | | | | | | || | | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | | | | | MUTE || | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | | | | | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| | + | | | | | | | | | | | | | || | | | + | | | | | | | | | | | HOME | PGDN | END || | | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| + * 'QK_BOOT' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board + * and plug it back in. + */ + + [Second] = LAYOUT( + QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_VAD, RGB_VAI, _______, KC_VOLU, _______, _______, _______, _______, + KC_PSCR, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, _______, _______, _______, KC_VOLD, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, KC_MUTE, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END, _______, _______ + ), + + [Third] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [Fourth] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_heavy_1/keymaps/levi/keymap.c b/keyboards/system76/launch_heavy_1/keymaps/levi/keymap.c new file mode 100644 index 000000000000..e5f983ce0082 --- /dev/null +++ b/keyboards/system76/launch_heavy_1/keymaps/levi/keymap.c @@ -0,0 +1,112 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, Dvorak +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || || PRINT | MEDIA | PLAY/ | MEDIA | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME || SCREEN |PREVIOUS| PAUSE | NEXT | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | [ | ] | || || NUM | NUM | NUM | NUM | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | { | } | BACKSPACE || PGUP || LOCK | SLASH | * | - | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | ' | , | . | | | | | | | | / | = | || || NUM | NUM | NUM | | +| TAB | " | < | > | P | Y | F | G | C | R | L | ? | + | | \ || PGDN || 7 | 8 | 9 | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| NUM | + | | | | | | | | | | | | - | | | || NUM | NUM | NUM | + | + | LCTL | A | O | E | U | I | D | H | T | N | S | _ | ENTER | | END || 4 | 5 | 6 | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | ; | | | | | | | | | | | | | NUM | NUM | NUM | | + | SHIFT | : | Q | J | K | X | B | M | W | V | Z | SHIFT | UP | | 1 | 2 | 3 | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| NUM | + | | | | | | | | | | | | | || NUM | NUM | ENTER | + | FN | UNDO | LALT | LGUI | SPACE | FN | RCTL | RALT | FN | | LEFT | DOWN | RIGHT || 0 | . | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, KC_PSCR, KC_MPRV, KC_MPLY, KC_MNXT, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_END, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + MO(2), C(KC_Z), KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + /* Layer 1, QWERTY +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || || PRINT | MEDIA | PLAY/ | MEDIA | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME || SCREEN |PREVIOUS| PAUSE | NEXT | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | | | || || NUM | NUM | NUM | NUM | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP || LOCK | SLASH | * | - | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | [ | ] | || || NUM | NUM | NUM | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN || 7 | 8 | 9 | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| NUM | + | | | | | | | | | | | ; | ' | | | || NUM | NUM | NUM | + | + | LCTL | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END || 4 | 5 | 6 | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | | | | | | | | , | . | / | | | | NUM | NUM | NUM | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | | 1 | 2 | 3 | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| NUM | + | | | | | | | | | | | | | || NUM | NUM | ENTER | + | FN | UNDO | LALT | LGUI | SPACE | FN | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT || 0 | . | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| +*/ + + [1] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, KC_PSCR, KC_MPRV, KC_MPLY, KC_MNXT, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + MO(2), C(KC_Z), KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + /* Layer 2, function layer +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || DVORAK || | | | | +| RESET | | | | | | | | | | | | | || || | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | LED | LED | LED | || QWERTY || | | | | +| | | | | | | | | | | TOGGLE | DOWN | UP | || || | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | | | || || | | | | +| | HOME | UP | END | PGUP | | PGUP | HOME | UP | END | | | | PRTSC || || | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| VOLUP | + | | | | | | | | | | | | | | | || | | | | + | | LEFT | DOWN | RIGHT | PGDN | | PGDN | LEFT | DOWN | RIGHT | | | | | || | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | | | | | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| VOLDN | + | | | | | | | | | | | | | || | | | + | | | | | | | | | | | HOME | PGDN | END || | | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| + * 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board + * and plug it back in. + */ + + [2] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_TRNS, TO(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_TRNS, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_TRNS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_heavy_1/launch_heavy_1.c b/keyboards/system76/launch_heavy_1/launch_heavy_1.c new file mode 100644 index 000000000000..b9c66809a6eb --- /dev/null +++ b/keyboards/system76/launch_heavy_1/launch_heavy_1.c @@ -0,0 +1,300 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "launch_heavy_1.h" + +#include "usb_mux.h" + +#define GPIO_MASK_RESET_USB (1<<3) +#define __ NO_LED + +// clang-format off +#ifdef RGB_MATRIX_ENABLE +// LEDs by index +// 0 1 2 3 4 5 6 7 8 9 +// 000 LM4 LL4 LK4 LJ4 LI4 LH4 LG4 LF4 LE4 LD4 +// 010 LC4 LB4 LA4 LA5 LB5 LC5 LD5 LE5 LG5 LH5 +// 020 LI5 LJ5 LK5 LL5 LM5 LO3 LM3 LL3 LK3 LJ3 +// 030 LI3 LH3 LG3 LF3 LE3 LD3 LC3 LB3 LA3 LA2 +// 040 LB2 LC2 LD2 LE2 LF2 LG2 LH2 LI2 LJ2 LK2 +// 050 LL2 LM2 LN2 LO2 LO1 LN1 LM1 LL1 LK1 LJ1 +// 060 LI1 LH1 LG1 LF1 LE1 LD1 LC1 LB1 LA1 LA0 +// 070 LB0 LC0 LD0 LE0 LF0 LG0 LH0 LI0 LJ0 LK0 +// 080 LL0 LM0 LN0 LO0 LD4 LC5 LA5 LA4 LB4 LC4 +// 090 LC3 LB3 LA3 LA2 LB2 LC2 LD2 LD1 LC1 LB1 +// 100 LA1 LA0 LB0 LC0 LD0 +led_config_t g_led_config = { { + // Key matrix to LED index (HEAVY) +/* A B C D E F G H I J K L M N O P Q R S */ +/* 0 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,101,102,103,104, */ +/* 1 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54,100, 99, 98, 97, */ +/* 2 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 93, 94, 95, 96, */ +/* 3 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 92, 91, 90, */ +/* 4 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 87, 88, 89, 84, */ +/* 5 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 86, 85 */ + { 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82}, + { 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55}, + { 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}, + { 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25}, + { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 87}, + { 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 86, 85}, + { __, __, __,104,103,102, __, __, __, __, __, __,101, __}, + { __, __, __, 97, 98, 99, __, __, __, __, __, __,100, __}, + { __, __, __, 96, 95, 94, __, __, __, __, __, __, 93, __}, + { __, __, __, __, 90, 91, __, __, __, __, __, __, 92, __}, + { __, __, __, 84, 89, 88, __, __, __, __, __, __, 87, __}, + { __, __, __, __, 85, __, __, __, __, __, __, __, 86, __} +}, { + // LED index to physical position (this is a pain, see qmk.sh in launch repo) +/* 000 */ {169, 40}, {157, 40}, {144, 40}, {134, 40}, {125, 40}, {115, 40}, {105, 40}, {95, 40}, {85, 40}, {75, 40}, +/* 010 */ {65, 40}, {55, 40}, {40, 40}, {37, 50}, {50, 50}, {60, 50}, {70, 50}, {85, 50}, {105, 50}, {120, 50}, +/* 020 */ {129, 50}, {142, 50}, {159, 50}, {169, 50}, {179, 50}, {179, 30}, {162, 30}, {149, 30}, {139, 30}, {129, 30}, +/* 030 */ {120, 30}, {110, 30}, {100, 30}, {90, 30}, {80, 30}, {70, 30}, {60, 30}, {50, 30}, {37, 30}, {35, 20}, +/* 040 */ {47, 20}, {57, 20}, {67, 20}, {77, 20}, {87, 20}, {97, 20}, {107, 20}, {117, 20}, {127, 20}, {137, 20}, +/* 050 */ {147, 20}, {157, 20}, {167, 20}, {179, 20}, {179, 10}, {164, 10}, {152, 10}, {142, 10}, {132, 10}, {122, 10}, +/* 060 */ {112, 10}, {102, 10}, {92, 10}, {82, 10}, {72, 10}, {62, 10}, {52, 10}, {42, 10}, {32, 10}, {32, 0}, +/* 070 */ {42, 0}, {52, 0}, {62, 0}, {72, 0}, {82, 0}, {92, 0}, {102, 0}, {112, 0}, {122, 0}, {132, 0}, +/* 080 */ {142, 0}, {152, 0}, {164, 0}, {179, 0}, {224, 45}, {214, 50}, {199, 50}, {194, 40}, {204, 40}, {214, 40}, +/* 090 */ {214, 30}, {204, 30}, {194, 30}, {194, 20}, {204, 20}, {214, 20}, {224, 25}, {224, 10}, {214, 10}, {204, 10}, +/* 100 */ {194, 10}, {194, 0}, {204, 0}, {214, 0}, {224, 0} +}, { + // LED index to flags (set all to LED_FLAG_KEYLIGHT) + /* 0 1 2 3 4 5 6 7 8 9 */ +/* 00 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 10 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 20 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 30 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 40 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 50 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 60 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 70 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 80 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 90 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/*100 */ 4, 4, 4, 4, 4 +} }; +#endif // RGB_MATRIX_ENABLE + +bool eeprom_is_valid(void) { + return ( + eeprom_read_word(((void *)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void *)EEPROM_VERSION_ADDR)) == EEPROM_VERSION + ); +} +// clang-format on + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void *)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void *)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void bootmagic_lite_reset_eeprom(void) { + // Set the keyboard-specific EEPROM state as invalid + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid + eeconfig_disable(); +} + +// The lite version of TMK's bootmagic based on Wilba. +// 100% less potential for accidentally making the keyboard do stupid things. +void bootmagic_lite(void) { + // Perform multiple scans because debouncing can't be turned off. + matrix_scan(); +#if defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); +#else + wait_ms(30); +#endif + matrix_scan(); + + // If the configured key (commonly Esc) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + uint8_t row = 0; // BOOTMAGIC_LITE_ROW; + uint8_t col = 0; // BOOTMAGIC_LITE_COLUMN; + + if (matrix_get_row(row) & (1 << col)) { + bootmagic_lite_reset_eeprom(); + + // Jump to bootloader. + bootloader_jump(); + } +} + +void system76_ec_rgb_eeprom(bool write); +void system76_ec_rgb_layer(layer_state_t layer_state); +void system76_ec_unlock(void); +bool system76_ec_is_unlocked(void); + +rgb_config_t layer_rgb[DYNAMIC_KEYMAP_LAYER_COUNT]; + +void matrix_init_kb(void) { + usb_mux_init(); + + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + system76_ec_rgb_eeprom(true); + eeprom_set_valid(true); + } else { + system76_ec_rgb_eeprom(false); + } +} + +void keyboard_post_init_user(void) { + system76_ec_rgb_layer(layer_state); +} + +void matrix_scan_kb(void) { + usb_mux_event(); + + matrix_scan_user(); +} + +#define LEVEL(value) (uint8_t)(((uint16_t)value) * ((uint16_t)RGB_MATRIX_MAXIMUM_BRIGHTNESS) / ((uint16_t)255)) + +// clang-format off +static const uint8_t levels[] = { + LEVEL(48), + LEVEL(72), + LEVEL(96), + LEVEL(144), + LEVEL(192), + LEVEL(255) +}; +// clang-format on + +static uint8_t toggle_level = RGB_MATRIX_MAXIMUM_BRIGHTNESS; +extern bool input_disabled; + +static void set_value_all_layers(uint8_t value) { + if (!system76_ec_is_unlocked()) { + for (int8_t layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) { + layer_rgb[layer].hsv.v = value; + } + system76_ec_rgb_layer(layer_state); + } +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (input_disabled) { + return false; + } + + if (!process_record_user(keycode, record)) { + return false; + } + + switch (keycode) { + case QK_BOOT: + if (record->event.pressed) { + system76_ec_unlock(); + } +#ifdef SYSTEM76_EC + return false; +#else + return true; +#endif + case RGB_VAD: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = sizeof(levels) - 1; i >= 0; i--) { + if (levels[i] < level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_VAI: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = 0; i < sizeof(levels); i++) { + if (levels[i] > level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_TOG: + if (record->event.pressed) { + uint8_t level = 0; + if (rgb_matrix_config.hsv.v == 0) { + level = toggle_level; + } else { + toggle_level = rgb_matrix_config.hsv.v; + } + set_value_all_layers(level); + } + return false; + } + + return true; +} + +layer_state_t layer_state_set_kb(layer_state_t layer_state) { + system76_ec_rgb_layer(layer_state); + + return layer_state_set_user(layer_state); +} + +#ifdef CONSOLE_ENABLE +void keyboard_post_init_user(void) { + debug_enable = true; + debug_matrix = false; + debug_keyboard = false; +} +#endif // CONSOLE_ENABLE + +void bootloader_jump(void) { + + // Disable all peripherals on AT90USB646 + UDCON = 1; + USBCON = (1<. + */ + +#pragma once + +#include "quantum.h" + +#define ___ KC_NO + +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H, K0I, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, K3G, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E, K4F, K4G, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K5A, K5B, K5C, K5D \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K0E }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K1E }, \ + { K50, K51, K52, K53, K54, K3D, K55, K56, K57, K58, K59, K5A, K5B, K2E }, \ + { ___, ___, ___, K0I, K0H, K0G, ___, ___, ___, ___, ___, ___, K0F, ___ }, \ + { ___, ___, ___, K1I, K1H, K1G, ___, ___, ___, ___, ___, ___, K1F, ___ }, \ + { ___, ___, ___, K2I, K2H, K2G, ___, ___, ___, ___, ___, ___, K2F, ___ }, \ + { ___, ___, ___, ___, K3G, K3F, ___, ___, ___, ___, ___, ___, K3E, ___ }, \ + { ___, ___, ___, K4G, K4F, K4E, ___, ___, ___, ___, ___, ___, K4D, ___ }, \ + { ___, ___, ___, ___, K5D, ___, ___, ___, ___, ___, ___, ___, K5C, ___ } \ +} diff --git a/keyboards/system76/launch_heavy_1/post_rules.mk b/keyboards/system76/launch_heavy_1/post_rules.mk new file mode 100644 index 000000000000..3751a8b8c31b --- /dev/null +++ b/keyboards/system76/launch_heavy_1/post_rules.mk @@ -0,0 +1,12 @@ +# System76 EC +# remove the RESET HID command +VALID_SYSTEM76_EC_TYPES := yes +SYSTEM76_EC_ENABLE ?= no +ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + ifeq ($(filter $(SYSTEM76_EC_ENABLE),$(VALID_SYSTEM76_EC_TYPES)),) + $(error SYSTEM76_EC_EN="$(strip $(SYSTEM76_EC_ENABLE))" is not a valid type for the System76 EC option) + endif + ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + OPT_DEFS += -DSYSTEM76_EC + endif +endif diff --git a/keyboards/system76/launch_heavy_1/readme.md b/keyboards/system76/launch_heavy_1/readme.md new file mode 100644 index 000000000000..2bcf19080384 --- /dev/null +++ b/keyboards/system76/launch_heavy_1/readme.md @@ -0,0 +1,62 @@ +# System76 Launch Configurable Keyboard (launch_heavy_1) + +![System76 Launch Configurable Keyboard](https://images.prismic.io/system76/b71307ac-dae6-4863-b7ca-804cd61c7ef8_launch_overhead.png?auto=compress,format&w=750) + +The Launch Configurable Keyboard is engineered to be comfortable, fully customizable, and make your workflow more efficient. + +- High-speed USB Hub +- Works on Linux, Windows and macOS +- 100% Open Source +- Made in Colorado + +Additional Launch Keyboard resources: + +- Keyboard Maintainer: [System76](https://github.com/system76) +- Hardware Supported: [System76 Launch GitHub Repository](https://github.com/system76/launch) +- Hardware Availability: [Shop System76](https://system76.com/accessories/launch) + +## Building Firmware + +To build the firmware using `make` (after setting up the build environment), e.g.: + +```bash +make -r system76/launch_heavy_1:default +``` + +Equivalently, using the QMK CLI: + +```bash +qmk compile -kb system76/launch_heavy_1 -km default +``` + +## Flashing Firmware (DFU) + +To build and flash the firmware on the keyboard, e.g.: + +```bash +make -r system76/launch_heavy_1:default:flash +``` + +Equivalently, using the QMK CLI: + +```bash +qmk flash -kb system76/launch_heavy_1 -km default +``` + +## Flashing Firmware (ISP) + +To flash the firmware (and/or bootloader) using ISP refer to the [_ISP Flashing Guide_](https://docs.qmk.fm/#/isp_flashing_guide). + +> **Factory fuse values** => Low: `0x5E`, High: `0x99`, Extended: `0xF3`, Lock Bits: `0xFF` + +## Environment Setup + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. If new to QMK, start with the [_Complete Newbs Guide_](https://docs.qmk.fm/#/newbs). + +## Bootloader + +Enter the bootloader in 3 ways: + +- **Bootmagic reset**: Hold down the key at (0,0) in the matrix (Escape) and plug in the keyboard. +- **Keycode in layout**: Press the key mapped to `QK_BOOT` in the second layer (Escape). +- **Electrical reset**: Briefly short AVR ISP's GND (6) and RST (5) pads on the back of the PCB. diff --git a/keyboards/system76/launch_heavy_1/rgb_matrix_kb.inc b/keyboards/system76/launch_heavy_1/rgb_matrix_kb.inc new file mode 100644 index 000000000000..02de10ed500e --- /dev/null +++ b/keyboards/system76/launch_heavy_1/rgb_matrix_kb.inc @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +RGB_MATRIX_EFFECT(active_keys) +RGB_MATRIX_EFFECT(raw_rgb) +RGB_MATRIX_EFFECT(unlocked) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "dynamic_keymap.h" + +static bool active_keys_initialized = false; +static uint8_t active_keys_table[RGB_MATRIX_LED_COUNT] = {0}; + +static void active_keys_initialize(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + uint8_t led = g_led_config.matrix_co[row][col]; + if (led < RGB_MATRIX_LED_COUNT && row < 16 && col < 16) { + active_keys_table[led] = (row << 4) | col; + } + } + } + active_keys_initialized = true; +} + +static bool active_keys(effect_params_t* params) { + if (!active_keys_initialized) { + active_keys_initialize(); + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + uint8_t layer = get_highest_layer(layer_state); + RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + uint8_t rowcol = active_keys_table[i]; + uint8_t row = rowcol >> 4; + uint8_t col = rowcol & 0xF; + uint16_t keycode = dynamic_keymap_get_keycode(layer, row, col); + switch (keycode) { + case KC_NO: + case KC_TRNS: + rgb_matrix_set_color(i, 0, 0, 0); + break; + default: + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + break; + } + } + + return led_max < RGB_MATRIX_LED_COUNT; +} + +RGB raw_rgb_data[RGB_MATRIX_LED_COUNT] = {0}; + +static uint8_t normalize_component(uint8_t component) { + uint16_t x = (uint16_t)component; + x *= rgb_matrix_config.hsv.v; // Multiply by current brightness + x /= 255; // Divide by maximum brightness + return (uint8_t)x; +} + +static RGB normalize_index(uint8_t i) { + RGB raw = raw_rgb_data[i]; + RGB rgb = { + .r = normalize_component(raw.r), + .g = normalize_component(raw.g), + .b = normalize_component(raw.b), + }; + return rgb; +} + +static bool raw_rgb(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = normalize_index(i); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +static uint8_t unlocked_keys[8][2] = { + {2, 7}, // U + {4, 6}, // N + {3, 9}, // L + {2, 9}, // O + {4, 3}, // C + {3, 8}, // K + {2, 3}, // E + {3, 3}, // D +}; + +static uint8_t unlocked_ticks = 0; +static uint8_t unlocked_i = 0; +static uint8_t unlocked_leds_count = 0; +static uint8_t unlocked_leds[2] = {0, 0}; + +static bool unlocked(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + unlocked_ticks++; + + if (params->init) { + unlocked_ticks = 0; + unlocked_i = 0; + } + + if (unlocked_ticks == 0) { + if (unlocked_i == 8) { + unlocked_leds_count = 0; + unlocked_i = 0; + } else { + unlocked_leds_count = rgb_matrix_map_row_column_to_led(unlocked_keys[unlocked_i][0], unlocked_keys[unlocked_i][1], unlocked_leds); + unlocked_i++; + } + } + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv = { + .h = i + unlocked_ticks, + .s = 0xFF, + .v = 0x70, + }; + for (uint8_t j = 0; j < unlocked_leds_count; j++) { + if (i == unlocked_leds[j]) { + hsv.s = 0; + hsv.v = 0xFF; + } + } + + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/system76/launch_heavy_1/rules.mk b/keyboards/system76/launch_heavy_1/rules.mk new file mode 100644 index 000000000000..e20aa1fd585f --- /dev/null +++ b/keyboards/system76/launch_heavy_1/rules.mk @@ -0,0 +1,27 @@ +# CPU frequency divided by two since AVR is at 3.3 V +F_CPU = 8000000 + +# External oscillator is 16 MHz +F_USB = 16000000 + +# Build options +# change yes to no to disable +BOOTMAGIC_ENABLE = no # Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and system control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +NKRO_ENABLE = yes # USB N-key rollover +RAW_ENABLE = yes # Raw HID commands (used by Keyboard Configurator) +BACKLIGHT_ENABLE = no # RGB backlight (conflicts with RGB matrix) +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = yes # RGB matrix +RGB_MATRIX_DRIVER = WS2812 +RGB_MATRIX_CUSTOM_KB = yes # Custom keyboard effects +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes # Link-time optimization for smaller binary + +# Add System76 EC command interface as well as I2C and USB mux drivers +SRC += system76_ec.c usb_mux.c +QUANTUM_LIB_SRC += i2c_master.c diff --git a/keyboards/system76/launch_heavy_1/usb_mux.c b/keyboards/system76/launch_heavy_1/usb_mux.c new file mode 100644 index 000000000000..808f0bb3a72d --- /dev/null +++ b/keyboards/system76/launch_heavy_1/usb_mux.c @@ -0,0 +1,525 @@ +/* + * Copyright (C) 2021 System76 + * Copyright (C) 2021 Jimmy Cassis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include +#include "quantum.h" + +#include + +#include "i2c_master.h" +#include "wait.h" +#include "usb_mux.h" + +#define GPIO_RESET_USB A3 + +#define REG_PF1_CTL 0xBF800C04 +#define REG_PIO64_OEN 0xBF800908 +#define REG_PIO64_OUT 0xBF800928 +#define REG_VID 0xBF803000 +#define REG_PRT_SWAP 0xBF8030FA +#define REG_USB3_HUB_VID 0xBF809048 +#define REG_RUNTIME_FLAGS2 0xBFD23408 +#define REG_I2S_FEAT_SEL 0xBFD23412 + +struct USB7006 { + uint8_t addr; +}; + +struct USB7006 usb_hub = {.addr = 0x2D}; + +// Perform USB7006 register access. +// Returns zero on success or a negative number on error. +i2c_status_t usb7006_register_access(struct USB7006* self) { + uint8_t register_access[3] = { + 0x99, + 0x37, + 0x00, + }; + + return i2c_transmit(self->addr << 1, register_access, sizeof(register_access), I2C_TIMEOUT); +} + +// Read data from USB7006 register region. +// Returns number of bytes read on success or a negative number on error. +i2c_status_t usb7006_read_reg(struct USB7006* self, uint32_t addr, uint8_t* data, int length) { + i2c_status_t status; + + uint8_t register_read[9] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + 0x06, // Number of bytes to write to command block buffer area + 0x01, // Direction: 0 = write, 1 = read + (uint8_t)length, // Number of bytes to read from register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + }; + + status = i2c_transmit(self->addr << 1, register_read, sizeof(register_read), I2C_TIMEOUT); + if (status < 0) { + return status; + } + + status = usb7006_register_access(self); + if (status < 0) { + return status; + } + + uint8_t read[2] = { + 0x00, // Buffer address MSB: always 0 + 0x06, // Buffer address LSB: 6 to skip header + }; + + status = i2c_start((self->addr << 1) | I2C_WRITE, I2C_TIMEOUT); + if (status >= 0) { + for (uint16_t i = 0; i < sizeof(read); i++) { + status = i2c_write(read[i], I2C_TIMEOUT); + if (status < 0) { + goto error; + } + } + } else { + goto error; + } + + status = i2c_start((self->addr << 1) | I2C_READ, I2C_TIMEOUT); + if (status < 0) { + goto error; + } + + // Read and ignore buffer length + status = i2c_read_ack(I2C_TIMEOUT); + if (status < 0) { + goto error; + } + + for (uint16_t i = 0; i < (length - 1) && status >= 0; i++) { + status = i2c_read_ack(I2C_TIMEOUT); + if (status >= 0) { + data[i] = (uint8_t)status; + } + } + + if (status >= 0) { + status = i2c_read_nack(I2C_TIMEOUT); + if (status >= 0) { + data[(length - 1)] = (uint8_t)status; + } + } + +error: + i2c_stop(); + + return (status < 0) ? status : length; +} + +// Read 32-bit value from USB7006 register region. +// Returns number of bytes read on success or a negative number on error. +i2c_status_t usb7006_read_reg_32(struct USB7006* self, uint32_t addr, uint32_t* data) { + i2c_status_t status; + + // First byte is available length + uint8_t bytes[4] = {0, 0, 0, 0}; + + status = usb7006_read_reg(self, addr, bytes, sizeof(bytes)); + if (status < 0) { + return status; + } + + // Convert from little endian + *data = (((uint32_t)bytes[0]) << 0) | (((uint32_t)bytes[1]) << 8) | (((uint32_t)bytes[2]) << 16) | (((uint32_t)bytes[3]) << 24); + + return status; +} + +// Write data to USB7006 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7006_write_reg(struct USB7006* self, uint32_t addr, uint8_t* data, int length) { + i2c_status_t status; + + uint8_t register_write[9] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + ((uint8_t)length) + 6, // Number of bytes to write to command block buffer area + 0x00, // Direction: 0 = write, 1 = read + (uint8_t)length, // Number of bytes to write to register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + }; + + status = i2c_start((self->addr << 1) | I2C_WRITE, I2C_TIMEOUT); + if (status >= 0) { + for (uint16_t i = 0; i < sizeof(register_write); i++) { + status = i2c_write(register_write[i], I2C_TIMEOUT); + if (status < 0) { + goto error; + } + } + + for (uint16_t i = 0; i < length; i++) { + status = i2c_write(data[i], I2C_TIMEOUT); + if (status < 0) { + goto error; + } + } + } else { + goto error; + } + + i2c_stop(); + + status = usb7006_register_access(self); + if (status < 0) { + goto error; + } + +error: + i2c_stop(); + + return (status < 0) ? status : length; +} + +// Write 8-bit value to USB7006 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7006_write_reg_8(struct USB7006* self, uint32_t addr, uint8_t data) { return usb7006_write_reg(self, addr, &data, sizeof(data)); } + +// Write 32-bit value to USB7006 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7006_write_reg_32(struct USB7006* self, uint32_t addr, uint32_t data) { + // Convert to little endian + uint8_t bytes[4] = { + (uint8_t)(data >> 0), + (uint8_t)(data >> 8), + (uint8_t)(data >> 16), + (uint8_t)(data >> 24), + }; + + return usb7006_write_reg(self, addr, bytes, sizeof(bytes)); +} + +// Initialize USB7006. +// Returns zero on success or a negative number on error. +int usb7006_init(struct USB7006* self) { + i2c_status_t status; + uint32_t data; + + // DM and DP are swapped on ports 2 and 3 + status = usb7006_write_reg_8(self, REG_PRT_SWAP, 0x0C); + if (status < 0) { + return status; + } + + // Disable audio + status = usb7006_write_reg_8(self, REG_I2S_FEAT_SEL, 0); + if (status < 0) { + return status; + } + + // Set HFC_DISABLE + data = 0; + status = usb7006_read_reg_32(self, REG_RUNTIME_FLAGS2, &data); + if (status < 0) { + return status; + } + data |= 1; + status = usb7006_write_reg_32(self, REG_RUNTIME_FLAGS2, data); + if (status < 0) { + return status; + } + + // Set Vendor ID and Product ID of USB 2 hub + status = usb7006_write_reg_32(self, REG_VID, 0x00033384); + if (status < 0) { + return status; + } + + // Set Vendor ID and Product ID of USB 3 hub + status = usb7006_write_reg_32(self, REG_USB3_HUB_VID, 0x00043384); + if (status < 0) { + return status; + } + + return 0; +} + +// Attach USB7006. +// Returns bytes written on success or a negative number on error. +i2c_status_t usb7006_attach(struct USB7006* self) { + uint8_t data[3] = { + 0xAA, + 0x56, + 0x00, + }; + + return i2c_transmit(self->addr << 1, data, sizeof(data), I2C_TIMEOUT); +} + +struct USB7006_GPIO { + struct USB7006* usb7006; + uint32_t pf; +}; + +struct USB7006_GPIO usb_gpio_sink = {.usb7006 = &usb_hub, .pf = 29}; // UP_SEL = PF29 = GPIO93 +struct USB7006_GPIO usb_gpio_source_left = {.usb7006 = &usb_hub, .pf = 10}; // CL_SEL = PF10 = GPIO74 +struct USB7006_GPIO usb_gpio_source_right = {.usb7006 = &usb_hub, .pf = 25}; // CR_SEL = PF25 = GPIO88 + +// Set USB7006 GPIO to specified value. +// Returns zero on success or negative number on error. +i2c_status_t usb7006_gpio_set(struct USB7006_GPIO* self, bool value) { + i2c_status_t status; + uint32_t data; + + data = 0; + status = usb7006_read_reg_32(self->usb7006, REG_PIO64_OUT, &data); + if (status < 0) { + return status; + } + + if (value) { + data |= (((uint32_t)1) << self->pf); + } else { + data &= ~(((uint32_t)1) << self->pf); + } + status = usb7006_write_reg_32(self->usb7006, REG_PIO64_OUT, data); + if (status < 0) { + return status; + } + + return 0; +} + +// Initialize USB7006 GPIO. +// Returns zero on success or a negative number on error. +i2c_status_t usb7006_gpio_init(struct USB7006_GPIO* self) { + i2c_status_t status; + uint32_t data; + + // Set programmable function to GPIO + status = usb7006_write_reg_8(self->usb7006, REG_PF1_CTL + (self->pf - 1), 0); + if (status < 0) { + return status; + } + + // Set GPIO to false by default + usb7006_gpio_set(self, false); + + // Set GPIO to output + data = 0; + status = usb7006_read_reg_32(self->usb7006, REG_PIO64_OEN, &data); + if (status < 0) { + return status; + } + + data |= (((uint32_t)1) << self->pf); + status = usb7006_write_reg_32(self->usb7006, REG_PIO64_OEN, data); + if (status < 0) { + return status; + } + + return 0; +} + +#define TCPC_CC_STATUS 0x1D +#define TCPC_ROLE_CONTROL 0x1A +#define TCPC_COMMAND 0x23 + +enum TCPC_TYPE { + TCPC_TYPE_SINK, + TCPC_TYPE_SOURCE, +}; + +struct PTN5110 { + enum TCPC_TYPE type; + uint8_t addr; + uint8_t cc; + struct USB7006_GPIO * gpio; +}; + +struct PTN5110 usb_sink = { .type = TCPC_TYPE_SINK, .addr = 0x51, .gpio = &usb_gpio_sink }; +struct PTN5110 usb_source_left = { .type = TCPC_TYPE_SOURCE, .addr = 0x52, .gpio = &usb_gpio_source_left }; +struct PTN5110 usb_source_right = { .type = TCPC_TYPE_SOURCE, .addr = 0x50, .gpio = &usb_gpio_source_right }; + +// Read PTN5110 CC_STATUS +// Returns bytes read on success or negative number on error +int ptn5110_get_cc_status(struct PTN5110 * self, uint8_t * cc) { + return i2c_readReg(self->addr << 1, TCPC_CC_STATUS, cc, 1, I2C_TIMEOUT); +} + +// Write PTN5110 ROLE_CONTROL +// Returns bytes written on success or negative number on error +int ptn5110_set_role_control(struct PTN5110 * self, uint8_t role_control) { + return i2c_writeReg(self->addr << 1, TCPC_ROLE_CONTROL, &role_control, 1, I2C_TIMEOUT); +} + +// Set PTN5110 SSMUX orientation. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_set_ssmux(struct PTN5110* self, bool orientation) { return usb7006_gpio_set(self->gpio, orientation); } + +// Write PTN5110 COMMAND. +// Returns zero on success or negative number on error. +i2c_status_t ptn5110_command(struct PTN5110* self, uint8_t command) { return i2c_writeReg(self->addr << 1, TCPC_COMMAND, &command, 1, I2C_TIMEOUT); } + +// Set orientation of PTN5110 operating as a sink, call this once. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_sink_set_orientation(struct PTN5110* self) { + i2c_status_t status; + uint8_t cc; + + status = ptn5110_get_cc_status(self, &cc); + if (status < 0) { + return status; + } + + if ((cc & 0x03) == 0) { + status = ptn5110_set_ssmux(self, false); + if (status < 0) { + return status; + } + } else { + status = ptn5110_set_ssmux(self, true); + if (status < 0) { + return status; + } + } + + return 0; +} + +// Update PTN5110 operating as a source, call this repeatedly. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_source_update(struct PTN5110* self) { + i2c_status_t status; + uint8_t cc; + + status = ptn5110_get_cc_status(self, &cc); + if (status < 0) { + return status; + } + + if (cc != self->cc) { + // WARNING: Setting this here will disable retries + self->cc = cc; + + bool connected = false; + bool orientation = false; + if ((cc & 0x03) == 2) { + connected = true; + orientation = true; + } else if (((cc >> 2) & 0x03) == 2) { + connected = true; + orientation = false; + } + + if (connected) { + // Set SS mux orientation + status = ptn5110_set_ssmux(self, orientation); + if (status < 0) { + return status; + } + + // Enable source Vbus command + status = ptn5110_command(self, 0b01110111); + if (status < 0) { + return status; + } + } else { + // Disable source Vbus command + status = ptn5110_command(self, 0b01100110); + if (status < 0) { + return status; + } + } + } + + return 0; +} + +// Initialize PTN5110 +// Returns zero on success or negative number on error +int ptn5110_init(struct PTN5110 * self) { + int res; + + // Set last cc to invalid value, to force update + self->cc = 0xFF; + + // Initialize GPIO + res = usb7006_gpio_init(self->gpio); + if (res < 0) return res; + + switch (self->type) { + case TCPC_TYPE_SINK: + res = ptn5110_sink_set_orientation(self); + if (res < 0) return res; + break; + case TCPC_TYPE_SOURCE: + res = ptn5110_set_role_control(self, 0x05); + if (res < 0) return res; + break; + } + + return 0; +} + +void usb_mux_event(void) { + // Run this on every 1000th matrix scan + static int cycle = 0; + if (cycle >= 1000) { + cycle = 0; + ptn5110_source_update(&usb_source_left); + ptn5110_source_update(&usb_source_right); + } else { + cycle += 1; + } +} + +void usb_mux_init(void) { + // Put the USB hub in reset + setPinOutput(GPIO_RESET_USB); + writePinLow(GPIO_RESET_USB); + + + // Run I2C bus at 100 kHz + i2c_init(); + + _delay_ms(10); + writePinHigh(GPIO_RESET_USB); + + + _delay_ms(100); + // Set up hub + usb7006_init(&usb_hub); + + // Set up sink + ptn5110_init(&usb_sink); + + // Set up sources + ptn5110_init(&usb_source_left); + ptn5110_init(&usb_source_right); + + // Attach hub + usb7006_attach(&usb_hub); + + // Ensure orientation is correct after attaching hub + // TODO: Find reason why GPIO for sink orientation is reset + for (int i = 0; i < 100; i++) { + ptn5110_sink_set_orientation(&usb_sink); + wait_ms(10); + } +} diff --git a/keyboards/system76/launch_heavy_1/usb_mux.h b/keyboards/system76/launch_heavy_1/usb_mux.h new file mode 100644 index 000000000000..26f84de864b6 --- /dev/null +++ b/keyboards/system76/launch_heavy_1/usb_mux.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +void usb_mux_init(void); +void usb_mux_event(void); diff --git a/keyboards/system76/launch_heavy_3/config.h b/keyboards/system76/launch_heavy_3/config.h new file mode 100644 index 000000000000..3006fd6bcd3d --- /dev/null +++ b/keyboards/system76/launch_heavy_3/config.h @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + + +/* + * Key matrix pins + * ROWS: GPIO pins used for rows, top to bottom + * COLS: GPIO pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { GP24, GP23, GP22, GP21, GP28, GP15, GP29, GP0, GP1, GP2, GP3, GP4 } +#define MATRIX_COL_PINS { GP12, GP11, GP10, GP9, GP8, GP6, GP13, GP14, GP16, GP17, GP18, GP19, GP7, GP25 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +#ifdef RGB_MATRIX_ENABLE +# define RGB_DI_PIN GP5 +# define RGB_MATRIX_LED_COUNT 105 +# define RGB_MATRIX_KEYPRESSES // Reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // Reacts to keyreleases (instead of keypresses) +// # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enables framebuffer effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Turns off effects when suspended +// Limit brightness to support USB-A at 0.5 A +// TODO: Do this dynamically based on power source +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 176 // Limits maximum brightness of LEDs to 176 out of 255. If not defined, maximum brightness is set to 255 +# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Sets the default mode, if none has been set +# define RGB_MATRIX_DEFAULT_HUE 142 // Sets the default hue value, if none has been set +# define RGB_MATRIX_DEFAULT_SAT 255 // Sets the default saturation value, if none has been set +# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set +# define RGB_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set +# define RGB_MATRIX_DISABLE_KEYCODES // Disables control of rgb matrix by keycodes (must use code functions to control the feature) + +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +#endif // RGB_MATRIX_ENABLE + +// Mechanical locking support; use KC_LCAP, KC_LNUM, or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// I2C { +#define I2C_DRIVER I2CD2 +#define I2C1_CLOCK_SPEED 100000UL // Run I2C bus at 100 kHz +#define I2C1_SCL_PIN GP27 +#define I2C1_SDA_PIN GP26 +// } I2C + +// EEPROM { +#define EEPROM_SIZE 1024 +// TODO: Refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x02 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) +// } EEPROM + +// Dynamic keymap { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 +#define DYNAMIC_KEYMAP_MACRO_COUNT 0 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +// Dynamic macro starts after dynamic keymaps, it is disabled +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2)) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 0 +// } Dynamic keymap + +// System76 EC { +#define SYSTEM76_EC_EEPROM_ADDR (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE) +#define SYSTEM76_EC_EEPROM_SIZE (EEPROM_SIZE - SYSTEM76_EC_EEPROM_ADDR) +// } System76 EC diff --git a/keyboards/system76/launch_heavy_3/halconf.h b/keyboards/system76/launch_heavy_3/halconf.h new file mode 100644 index 000000000000..8c220f68b6af --- /dev/null +++ b/keyboards/system76/launch_heavy_3/halconf.h @@ -0,0 +1,21 @@ +/* Copyright 2023 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/system76/launch_heavy_3/info.json b/keyboards/system76/launch_heavy_3/info.json new file mode 100644 index 000000000000..14be8b9eb012 --- /dev/null +++ b/keyboards/system76/launch_heavy_3/info.json @@ -0,0 +1,128 @@ +{ + "keyboard_name": "Launch Heavy Configurable Keyboard (launch_heavy_3)", + "manufacturer": "System76", + "url": "https://system76.com/accessories/launch", + "usb": { + "vid": "0x3384", + "pid": "0x000A", + "device_version": "0.0.1" + }, + "processor": "RP2040", + "bootloader": "rp2040", + "layouts": { + "LAYOUT": { + "layout": [ + { "matrix":[0, 0], "x": 0, "y": 0 }, + { "matrix":[0, 1], "x": 1, "y": 0 }, + { "matrix":[0, 2], "x": 2, "y": 0 }, + { "matrix":[0, 3], "x": 3, "y": 0 }, + { "matrix":[0, 4], "x": 4, "y": 0 }, + { "matrix":[0, 5], "x": 5, "y": 0 }, + { "matrix":[0, 6], "x": 6, "y": 0 }, + { "matrix":[0, 7], "x": 7, "y": 0 }, + { "matrix":[0, 8], "x": 8, "y": 0 }, + { "matrix":[0, 9], "x": 9, "y": 0 }, + { "matrix":[0,10], "x": 10, "y": 0 }, + { "matrix":[0,11], "x": 11, "y": 0 }, + { "matrix":[0,12], "x": 12, "y": 0 }, + { "matrix":[0,13], "x": 13, "y": 0, "w": 1.5 }, + { "matrix":[3,13], "x": 14.75, "y": 0 }, + { "matrix":[6,12], "x": 16.25, "y": 0 }, + { "matrix":[6, 5], "x": 17.25, "y": 0 }, + { "matrix":[6, 4], "x": 18.25, "y": 0 }, + { "matrix":[6, 3], "x": 19.25, "y": 0 }, + + { "matrix":[1, 0], "x": 0, "y": 1 }, + { "matrix":[1, 1], "x": 1, "y": 1 }, + { "matrix":[1, 2], "x": 2, "y": 1 }, + { "matrix":[1, 3], "x": 3, "y": 1 }, + { "matrix":[1, 4], "x": 4, "y": 1 }, + { "matrix":[1, 5], "x": 5, "y": 1 }, + { "matrix":[1, 6], "x": 6, "y": 1 }, + { "matrix":[1, 7], "x": 7, "y": 1 }, + { "matrix":[1, 8], "x": 8, "y": 1 }, + { "matrix":[1, 9], "x": 9, "y": 1 }, + { "matrix":[1,10], "x": 10, "y": 1 }, + { "matrix":[1,11], "x": 11, "y": 1 }, + { "matrix":[1,12], "x": 12, "y": 1 }, + { "matrix":[1,13], "x": 13, "y": 1, "w": 1.5 }, + { "matrix":[4,13], "x": 14.75, "y": 1 }, + { "matrix":[7,12], "x": 16.25, "y": 1 }, + { "matrix":[7, 5], "x": 17.25, "y": 1 }, + { "matrix":[7, 4], "x": 18.25, "y": 1 }, + { "matrix":[7, 3], "x": 19.25, "y": 1 }, + + { "matrix":[2, 0], "x": 0, "y": 2, "w": 1.5 }, + { "matrix":[2, 1], "x": 1.5, "y": 2 }, + { "matrix":[2, 2], "x": 2.5, "y": 2 }, + { "matrix":[2, 3], "x": 3.5, "y": 2 }, + { "matrix":[2, 4], "x": 4.5, "y": 2 }, + { "matrix":[2, 5], "x": 5.5, "y": 2 }, + { "matrix":[2, 6], "x": 6.5, "y": 2 }, + { "matrix":[2, 7], "x": 7.5, "y": 2 }, + { "matrix":[2, 8], "x": 8.5, "y": 2 }, + { "matrix":[2, 9], "x": 9.5, "y": 2 }, + { "matrix":[2,10], "x": 10.5, "y": 2 }, + { "matrix":[2,11], "x": 11.5, "y": 2 }, + { "matrix":[2,12], "x": 12.5, "y": 2 }, + { "matrix":[2,13], "x": 13.5, "y": 2 }, + { "matrix":[5,13], "x": 14.75, "y": 2 }, + { "matrix":[8,12], "x": 16.25, "y": 2 }, + { "matrix":[8, 5], "x": 17.25, "y": 2 }, + { "matrix":[8, 4], "x": 18.25, "y": 2 }, + { "matrix":[8, 3], "x": 19.25, "y": 2, "h": 2 }, + + { "matrix":[3, 0], "x": 0.25, "y": 3, "w": 1.5 }, + { "matrix":[3, 1], "x": 1.75, "y": 3 }, + { "matrix":[3, 2], "x": 2.75, "y": 3 }, + { "matrix":[3, 3], "x": 3.75, "y": 3 }, + { "matrix":[3, 4], "x": 4.75, "y": 3 }, + { "matrix":[3, 5], "x": 5.75, "y": 3 }, + { "matrix":[3, 6], "x": 6.75, "y": 3 }, + { "matrix":[3, 7], "x": 7.75, "y": 3 }, + { "matrix":[3, 8], "x": 8.75, "y": 3 }, + { "matrix":[3, 9], "x": 9.75, "y": 3 }, + { "matrix":[3,10], "x": 10.75, "y": 3 }, + { "matrix":[3,11], "x": 11.75, "y": 3 }, + { "matrix":[3,12], "x": 12.75, "y": 3, "w": 1.5 }, + { "matrix":[5, 5], "x": 14.75, "y": 3 }, + { "matrix":[9,12], "x": 16.25, "y": 3 }, + { "matrix":[9, 5], "x": 17.25, "y": 3 }, + { "matrix":[9, 4], "x": 18.25, "y": 3 }, + + { "matrix":[ 4, 0], "x": 0.25, "y": 4, "w": 2 }, + { "matrix":[ 4, 1], "x": 2.25, "y": 4 }, + { "matrix":[ 4, 2], "x": 3.25, "y": 4 }, + { "matrix":[ 4, 3], "x": 4.25, "y": 4 }, + { "matrix":[ 4, 4], "x": 5.25, "y": 4 }, + { "matrix":[ 4, 5], "x": 6.25, "y": 4 }, + { "matrix":[ 4, 6], "x": 7.25, "y": 4 }, + { "matrix":[ 4, 7], "x": 8.25, "y": 4 }, + { "matrix":[ 4, 8], "x": 9.25, "y": 4 }, + { "matrix":[ 4, 9], "x": 10.25, "y": 4 }, + { "matrix":[ 4,10], "x": 11.25, "y": 4 }, + { "matrix":[ 4,11], "x": 12.25, "y": 4, "w": 1.5 }, + { "matrix":[ 4,12], "x": 13.75, "y": 4 }, + { "matrix":[10,12], "x": 16.25, "y": 4 }, + { "matrix":[10, 5], "x": 17.25, "y": 4 }, + { "matrix":[10, 4], "x": 18.25, "y": 4 }, + { "matrix":[10, 3], "x": 19.25, "y": 4, "h": 2 }, + + { "matrix":[ 5, 0], "x": 0.25, "y": 5, "w": 1.5 }, + { "matrix":[ 5, 1], "x": 1.75, "y": 5 }, + { "matrix":[ 5, 2], "x": 2.75, "y": 5 }, + { "matrix":[ 5, 3], "x": 3.75, "y": 5 }, + { "matrix":[ 5, 4], "x": 4.75, "y": 5, "w": 2 }, + { "matrix":[ 5, 6], "x": 6.75, "y": 5, "w": 2 }, + { "matrix":[ 5, 7], "x": 8.75, "y": 5 }, + { "matrix":[ 5, 8], "x": 9.75, "y": 5 }, + { "matrix":[ 5, 9], "x": 10.75, "y": 5, "w": 1.5 }, + { "matrix":[ 5,10], "x": 12.75, "y": 5 }, + { "matrix":[ 5,11], "x": 13.75, "y": 5 }, + { "matrix":[ 5,12], "x": 14.75, "y": 5 }, + { "matrix":[11,12], "x": 16.25, "y": 5, "w": 2 }, + { "matrix":[11, 4], "x": 18.25, "y": 5 } + ] + } + } +} diff --git a/keyboards/system76/launch_heavy_3/keymaps/default/keymap.c b/keyboards/system76/launch_heavy_3/keymaps/default/keymap.c new file mode 100644 index 000000000000..9921bde65e9f --- /dev/null +++ b/keyboards/system76/launch_heavy_3/keymaps/default/keymap.c @@ -0,0 +1,98 @@ +#include QMK_KEYBOARD_H +#define ______ KC_TRNS + +enum layers{ + First, + Second, + Third, + Fourth +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || || PRINT | MEDIA | PLAY/ | MEDIA | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME || SCREEN |PREVIOUS| PAUSE | NEXT | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | | | || || NUM | NUM | NUM | NUM | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP || LOCK | SLASH | * | - | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | [ | ] | || || NUM | NUM | NUM | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN || 7 | 8 | 9 | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| NUM | + | | | | | | | | | | | ; | ' | | | || NUM | NUM | NUM | + | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END || 4 | 5 | 6 | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | | | | | | | | , | . | / | | | | NUM | NUM | NUM | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | | 1 | 2 | 3 | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| NUM | + | | | | | | | | | | | | | || NUM | NUM | ENTER | + | CTRL | LALT | FN | LGUI | SPACE | SPACE | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT || 0 | . | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| +*/ + + [First] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, KC_PSCR, KC_MPRV, KC_MPLY, KC_MNXT, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LALT, MO(1), KC_LGUI, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || PLAY/ || | | | | +| QK_BOOT| | | | | | | | | | | | | || PAUSE || | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | LED | LED | LED | || VOLUME || | | | | +| | | | | | | | | | | TOGGLE | DOWN | UP | || UP || | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | | | || VOLUME || | | | | +|PRINT SCREEN| | | | | | HOME | PGDN | PGUP | END | | | | || DOWN || | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| | + | | | | | | | | | | | | | | | || | | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | | | | | MUTE || | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | | | | | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| | + | | | | | | | | | | | | | || | | | + | | | | | | | | | | | HOME | PGDN | END || | | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| + * 'QK_BOOT' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board + * and plug it back in. + */ + + [Second] = LAYOUT( + QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_VAD, RGB_VAI, _______, KC_VOLU, _______, _______, _______, _______, + KC_PSCR, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, _______, _______, _______, KC_VOLD, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, KC_MUTE, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END, _______, _______ + ), + + [Third] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [Fourth] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_heavy_3/keymaps/levi/keymap.c b/keyboards/system76/launch_heavy_3/keymaps/levi/keymap.c new file mode 100644 index 000000000000..e5f983ce0082 --- /dev/null +++ b/keyboards/system76/launch_heavy_3/keymaps/levi/keymap.c @@ -0,0 +1,112 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, Dvorak +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || || PRINT | MEDIA | PLAY/ | MEDIA | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME || SCREEN |PREVIOUS| PAUSE | NEXT | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | [ | ] | || || NUM | NUM | NUM | NUM | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | { | } | BACKSPACE || PGUP || LOCK | SLASH | * | - | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | ' | , | . | | | | | | | | / | = | || || NUM | NUM | NUM | | +| TAB | " | < | > | P | Y | F | G | C | R | L | ? | + | | \ || PGDN || 7 | 8 | 9 | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| NUM | + | | | | | | | | | | | | - | | | || NUM | NUM | NUM | + | + | LCTL | A | O | E | U | I | D | H | T | N | S | _ | ENTER | | END || 4 | 5 | 6 | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | ; | | | | | | | | | | | | | NUM | NUM | NUM | | + | SHIFT | : | Q | J | K | X | B | M | W | V | Z | SHIFT | UP | | 1 | 2 | 3 | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| NUM | + | | | | | | | | | | | | | || NUM | NUM | ENTER | + | FN | UNDO | LALT | LGUI | SPACE | FN | RCTL | RALT | FN | | LEFT | DOWN | RIGHT || 0 | . | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, KC_PSCR, KC_MPRV, KC_MPLY, KC_MNXT, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_END, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + MO(2), C(KC_Z), KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + /* Layer 1, QWERTY +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || || PRINT | MEDIA | PLAY/ | MEDIA | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME || SCREEN |PREVIOUS| PAUSE | NEXT | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | | | || || NUM | NUM | NUM | NUM | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP || LOCK | SLASH | * | - | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | [ | ] | || || NUM | NUM | NUM | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN || 7 | 8 | 9 | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| NUM | + | | | | | | | | | | | ; | ' | | | || NUM | NUM | NUM | + | + | LCTL | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END || 4 | 5 | 6 | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | | | | | | | | , | . | / | | | | NUM | NUM | NUM | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | | 1 | 2 | 3 | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| NUM | + | | | | | | | | | | | | | || NUM | NUM | ENTER | + | FN | UNDO | LALT | LGUI | SPACE | FN | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT || 0 | . | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| +*/ + + [1] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, KC_PSCR, KC_MPRV, KC_MPLY, KC_MNXT, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, KC_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + MO(2), C(KC_Z), KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + /* Layer 2, function layer +__________________________________________________________________________________________________________________________________ ________ ___________________________________ +| | | | | | | | | | | | | | || DVORAK || | | | | +| RESET | | | | | | | | | | | | | || || | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | LED | LED | LED | || QWERTY || | | | | +| | | | | | | | | | | TOGGLE | DOWN | UP | || || | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________||________|________|________|________| +| | | | | | | | | | | | | | || || | | | | +| | HOME | UP | END | PGUP | | PGUP | HOME | UP | END | | | | PRTSC || || | | | | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________||________|________|________| VOLUP | + | | | | | | | | | | | | | | | || | | | | + | | LEFT | DOWN | RIGHT | PGDN | | PGDN | LEFT | DOWN | RIGHT | | | | | || | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________||________|________|________|________| + | | | | | | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | | | | | | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________ |________|________|________| VOLDN | + | | | | | | | | | | | | | || | | | + | | | | | | | | | | | HOME | PGDN | END || | | | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________||_________________|________|________| + * 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board + * and plug it back in. + */ + + [2] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_TRNS, TO(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_TRNS, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_TRNS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_heavy_3/launch_heavy_3.c b/keyboards/system76/launch_heavy_3/launch_heavy_3.c new file mode 100644 index 000000000000..5892c0b72357 --- /dev/null +++ b/keyboards/system76/launch_heavy_3/launch_heavy_3.c @@ -0,0 +1,262 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "launch_heavy_3.h" +#include "eeprom.h" +#include "usb_mux.h" + +#define __ NO_LED + +// clang-format off +#ifdef RGB_MATRIX_ENABLE +// LEDs by index +// 0 1 2 3 4 5 6 7 8 9 +// 000 LM4 LL4 LK4 LJ4 LI4 LH4 LG4 LF4 LE4 LD4 +// 010 LC4 LB4 LA4 LA5 LB5 LC5 LD5 LE5 LG5 LH5 +// 020 LI5 LJ5 LK5 LL5 LM5 LO3 LM3 LL3 LK3 LJ3 +// 030 LI3 LH3 LG3 LF3 LE3 LD3 LC3 LB3 LA3 LA2 +// 040 LB2 LC2 LD2 LE2 LF2 LG2 LH2 LI2 LJ2 LK2 +// 050 LL2 LM2 LN2 LO2 LO1 LN1 LM1 LL1 LK1 LJ1 +// 060 LI1 LH1 LG1 LF1 LE1 LD1 LC1 LB1 LA1 LA0 +// 070 LB0 LC0 LD0 LE0 LF0 LG0 LH0 LI0 LJ0 LK0 +// 080 LL0 LM0 LN0 LO0 LD4 LC5 LA5 LA4 LB4 LC4 +// 090 LC3 LB3 LA3 LA2 LB2 LC2 LD2 LD1 LC1 LB1 +// 100 LA1 LA0 LB0 LC0 LD0 +led_config_t g_led_config = { { + // Key matrix to LED index (HEAVY) +/* A B C D E F G H I J K L M N O P Q R S */ +/* 0 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,101,102,103,104, */ +/* 1 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54,100, 99, 98, 97, */ +/* 2 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 93, 94, 95, 96, */ +/* 3 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 92, 91, 90, */ +/* 4 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 87, 88, 89, 84, */ +/* 5 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 86, 85 */ + { 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82}, + { 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55}, + { 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52}, + { 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25}, + { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 87}, + { 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 86, 85}, + { __, __, __,104,103,102, __, __, __, __, __, __,101, __}, + { __, __, __, 97, 98, 99, __, __, __, __, __, __,100, __}, + { __, __, __, 96, 95, 94, __, __, __, __, __, __, 93, __}, + { __, __, __, __, 90, 91, __, __, __, __, __, __, 92, __}, + { __, __, __, 84, 89, 88, __, __, __, __, __, __, 87, __}, + { __, __, __, __, 85, __, __, __, __, __, __, __, 86, __} +}, { + // LED index to physical position (this is a pain, see qmk.sh in launch repo) +/* 000 */ {169, 40}, {157, 40}, {144, 40}, {134, 40}, {125, 40}, {115, 40}, {105, 40}, {95, 40}, {85, 40}, {75, 40}, +/* 010 */ {65, 40}, {55, 40}, {40, 40}, {37, 50}, {50, 50}, {60, 50}, {70, 50}, {85, 50}, {105, 50}, {120, 50}, +/* 020 */ {129, 50}, {142, 50}, {159, 50}, {169, 50}, {179, 50}, {179, 30}, {162, 30}, {149, 30}, {139, 30}, {129, 30}, +/* 030 */ {120, 30}, {110, 30}, {100, 30}, {90, 30}, {80, 30}, {70, 30}, {60, 30}, {50, 30}, {37, 30}, {35, 20}, +/* 040 */ {47, 20}, {57, 20}, {67, 20}, {77, 20}, {87, 20}, {97, 20}, {107, 20}, {117, 20}, {127, 20}, {137, 20}, +/* 050 */ {147, 20}, {157, 20}, {167, 20}, {179, 20}, {179, 10}, {164, 10}, {152, 10}, {142, 10}, {132, 10}, {122, 10}, +/* 060 */ {112, 10}, {102, 10}, {92, 10}, {82, 10}, {72, 10}, {62, 10}, {52, 10}, {42, 10}, {32, 10}, {32, 0}, +/* 070 */ {42, 0}, {52, 0}, {62, 0}, {72, 0}, {82, 0}, {92, 0}, {102, 0}, {112, 0}, {122, 0}, {132, 0}, +/* 080 */ {142, 0}, {152, 0}, {164, 0}, {179, 0}, {224, 45}, {214, 50}, {199, 50}, {194, 40}, {204, 40}, {214, 40}, +/* 090 */ {214, 30}, {204, 30}, {194, 30}, {194, 20}, {204, 20}, {214, 20}, {224, 25}, {224, 10}, {214, 10}, {204, 10}, +/* 100 */ {194, 10}, {194, 0}, {204, 0}, {214, 0}, {224, 0} +}, { + // LED index to flags (set all to LED_FLAG_KEYLIGHT) + /* 0 1 2 3 4 5 6 7 8 9 */ +/* 00 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 10 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 20 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 30 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 40 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 50 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 60 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 70 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 80 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 90 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/*100 */ 4, 4, 4, 4, 4 +} }; +#endif // RGB_MATRIX_ENABLE + +bool eeprom_is_valid(void) { + return ( + eeprom_read_word(((void *)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void *)EEPROM_VERSION_ADDR)) == EEPROM_VERSION + ); +} +// clang-format on + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void *)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void *)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void bootmagic_lite_reset_eeprom(void) { + // Set the keyboard-specific EEPROM state as invalid + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid + eeconfig_disable(); +} + +// The lite version of TMK's bootmagic based on Wilba. +// 100% less potential for accidentally making the keyboard do stupid things. +void bootmagic_lite(void) { + // Perform multiple scans because debouncing can't be turned off. + matrix_scan(); +#if defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); +#else + wait_ms(30); +#endif + matrix_scan(); + + // If the configured key (commonly Esc) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + uint8_t row = 0; // BOOTMAGIC_LITE_ROW; + uint8_t col = 0; // BOOTMAGIC_LITE_COLUMN; + + if (matrix_get_row(row) & (1 << col)) { + bootmagic_lite_reset_eeprom(); + + // Jump to bootloader. + bootloader_jump(); + } +} + +void system76_ec_rgb_eeprom(bool write); +void system76_ec_rgb_layer(layer_state_t layer_state); +void system76_ec_unlock(void); +bool system76_ec_is_unlocked(void); + +rgb_config_t layer_rgb[DYNAMIC_KEYMAP_LAYER_COUNT]; + +void matrix_init_kb(void) { + usb_mux_init(); + + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + system76_ec_rgb_eeprom(true); + eeprom_set_valid(true); + } else { + system76_ec_rgb_eeprom(false); + } +} + +void keyboard_post_init_user(void) { + system76_ec_rgb_layer(layer_state); +} + +void matrix_scan_kb(void) { + usb_mux_event(); + + matrix_scan_user(); +} + +#define LEVEL(value) (uint8_t)(((uint16_t)value) * ((uint16_t)RGB_MATRIX_MAXIMUM_BRIGHTNESS) / ((uint16_t)255)) + +// clang-format off +static const uint8_t levels[] = { + LEVEL(48), + LEVEL(72), + LEVEL(96), + LEVEL(144), + LEVEL(192), + LEVEL(255) +}; +// clang-format on + +static uint8_t toggle_level = RGB_MATRIX_MAXIMUM_BRIGHTNESS; +extern bool input_disabled; + +static void set_value_all_layers(uint8_t value) { + if (!system76_ec_is_unlocked()) { + for (int8_t layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) { + layer_rgb[layer].hsv.v = value; + } + system76_ec_rgb_layer(layer_state); + } +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (input_disabled) { + return false; + } + + if (!process_record_user(keycode, record)) { + return false; + } + + switch (keycode) { + case QK_BOOT: + if (record->event.pressed) { + system76_ec_unlock(); + } +#ifdef SYSTEM76_EC + return false; +#else + return true; +#endif + case RGB_VAD: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = sizeof(levels) - 1; i >= 0; i--) { + if (levels[i] < level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_VAI: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = 0; i < sizeof(levels); i++) { + if (levels[i] > level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_TOG: + if (record->event.pressed) { + uint8_t level = 0; + if (rgb_matrix_config.hsv.v == 0) { + level = toggle_level; + } else { + toggle_level = rgb_matrix_config.hsv.v; + } + set_value_all_layers(level); + } + return false; + } + + return true; +} + +layer_state_t layer_state_set_kb(layer_state_t layer_state) { + system76_ec_rgb_layer(layer_state); + + return layer_state_set_user(layer_state); +} + +#ifdef CONSOLE_ENABLE +void keyboard_post_init_user(void) { + debug_enable = true; + debug_matrix = false; + debug_keyboard = false; +} +#endif // CONSOLE_ENABLE diff --git a/keyboards/system76/launch_heavy_3/launch_heavy_3.h b/keyboards/system76/launch_heavy_3/launch_heavy_3.h new file mode 100644 index 000000000000..3ac3e5de8739 --- /dev/null +++ b/keyboards/system76/launch_heavy_3/launch_heavy_3.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "quantum.h" + +#define ___ KC_NO + +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H, K0I, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, K3G, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E, K4F, K4G, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K5A, K5B, K5C, K5D \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K0E }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K1E }, \ + { K50, K51, K52, K53, K54, K3D, K55, K56, K57, K58, K59, K5A, K5B, K2E }, \ + { ___, ___, ___, K0I, K0H, K0G, ___, ___, ___, ___, ___, ___, K0F, ___ }, \ + { ___, ___, ___, K1I, K1H, K1G, ___, ___, ___, ___, ___, ___, K1F, ___ }, \ + { ___, ___, ___, K2I, K2H, K2G, ___, ___, ___, ___, ___, ___, K2F, ___ }, \ + { ___, ___, ___, ___, K3G, K3F, ___, ___, ___, ___, ___, ___, K3E, ___ }, \ + { ___, ___, ___, K4G, K4F, K4E, ___, ___, ___, ___, ___, ___, K4D, ___ }, \ + { ___, ___, ___, ___, K5D, ___, ___, ___, ___, ___, ___, ___, K5C, ___ } \ +} diff --git a/keyboards/system76/launch_heavy_3/mcuconf.h b/keyboards/system76/launch_heavy_3/mcuconf.h new file mode 100644 index 000000000000..cd074149319a --- /dev/null +++ b/keyboards/system76/launch_heavy_3/mcuconf.h @@ -0,0 +1,25 @@ +/* Copyright 2023 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next + +#undef RP_I2C_USE_I2C0 +#define RP_I2C_USE_I2C0 FALSE + +#undef RP_I2C_USE_I2C1 +#define RP_I2C_USE_I2C1 TRUE diff --git a/keyboards/system76/launch_heavy_3/post_rules.mk b/keyboards/system76/launch_heavy_3/post_rules.mk new file mode 100644 index 000000000000..3751a8b8c31b --- /dev/null +++ b/keyboards/system76/launch_heavy_3/post_rules.mk @@ -0,0 +1,12 @@ +# System76 EC +# remove the RESET HID command +VALID_SYSTEM76_EC_TYPES := yes +SYSTEM76_EC_ENABLE ?= no +ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + ifeq ($(filter $(SYSTEM76_EC_ENABLE),$(VALID_SYSTEM76_EC_TYPES)),) + $(error SYSTEM76_EC_EN="$(strip $(SYSTEM76_EC_ENABLE))" is not a valid type for the System76 EC option) + endif + ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + OPT_DEFS += -DSYSTEM76_EC + endif +endif diff --git a/keyboards/system76/launch_heavy_3/readme.md b/keyboards/system76/launch_heavy_3/readme.md new file mode 100644 index 000000000000..5179da9dd144 --- /dev/null +++ b/keyboards/system76/launch_heavy_3/readme.md @@ -0,0 +1 @@ +# System76 Launch Heavy Configurable Keyboard (launch_heavy_3) diff --git a/keyboards/system76/launch_heavy_3/rgb_matrix_kb.inc b/keyboards/system76/launch_heavy_3/rgb_matrix_kb.inc new file mode 100644 index 000000000000..02de10ed500e --- /dev/null +++ b/keyboards/system76/launch_heavy_3/rgb_matrix_kb.inc @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +RGB_MATRIX_EFFECT(active_keys) +RGB_MATRIX_EFFECT(raw_rgb) +RGB_MATRIX_EFFECT(unlocked) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "dynamic_keymap.h" + +static bool active_keys_initialized = false; +static uint8_t active_keys_table[RGB_MATRIX_LED_COUNT] = {0}; + +static void active_keys_initialize(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + uint8_t led = g_led_config.matrix_co[row][col]; + if (led < RGB_MATRIX_LED_COUNT && row < 16 && col < 16) { + active_keys_table[led] = (row << 4) | col; + } + } + } + active_keys_initialized = true; +} + +static bool active_keys(effect_params_t* params) { + if (!active_keys_initialized) { + active_keys_initialize(); + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + uint8_t layer = get_highest_layer(layer_state); + RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + uint8_t rowcol = active_keys_table[i]; + uint8_t row = rowcol >> 4; + uint8_t col = rowcol & 0xF; + uint16_t keycode = dynamic_keymap_get_keycode(layer, row, col); + switch (keycode) { + case KC_NO: + case KC_TRNS: + rgb_matrix_set_color(i, 0, 0, 0); + break; + default: + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + break; + } + } + + return led_max < RGB_MATRIX_LED_COUNT; +} + +RGB raw_rgb_data[RGB_MATRIX_LED_COUNT] = {0}; + +static uint8_t normalize_component(uint8_t component) { + uint16_t x = (uint16_t)component; + x *= rgb_matrix_config.hsv.v; // Multiply by current brightness + x /= 255; // Divide by maximum brightness + return (uint8_t)x; +} + +static RGB normalize_index(uint8_t i) { + RGB raw = raw_rgb_data[i]; + RGB rgb = { + .r = normalize_component(raw.r), + .g = normalize_component(raw.g), + .b = normalize_component(raw.b), + }; + return rgb; +} + +static bool raw_rgb(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = normalize_index(i); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +static uint8_t unlocked_keys[8][2] = { + {2, 7}, // U + {4, 6}, // N + {3, 9}, // L + {2, 9}, // O + {4, 3}, // C + {3, 8}, // K + {2, 3}, // E + {3, 3}, // D +}; + +static uint8_t unlocked_ticks = 0; +static uint8_t unlocked_i = 0; +static uint8_t unlocked_leds_count = 0; +static uint8_t unlocked_leds[2] = {0, 0}; + +static bool unlocked(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + unlocked_ticks++; + + if (params->init) { + unlocked_ticks = 0; + unlocked_i = 0; + } + + if (unlocked_ticks == 0) { + if (unlocked_i == 8) { + unlocked_leds_count = 0; + unlocked_i = 0; + } else { + unlocked_leds_count = rgb_matrix_map_row_column_to_led(unlocked_keys[unlocked_i][0], unlocked_keys[unlocked_i][1], unlocked_leds); + unlocked_i++; + } + } + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv = { + .h = i + unlocked_ticks, + .s = 0xFF, + .v = 0x70, + }; + for (uint8_t j = 0; j < unlocked_leds_count; j++) { + if (i == unlocked_leds[j]) { + hsv.s = 0; + hsv.v = 0xFF; + } + } + + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/system76/launch_heavy_3/rules.mk b/keyboards/system76/launch_heavy_3/rules.mk new file mode 100644 index 000000000000..1fd48ebbc934 --- /dev/null +++ b/keyboards/system76/launch_heavy_3/rules.mk @@ -0,0 +1,24 @@ +# Build options +# change yes to no to disable +BOOTMAGIC_ENABLE = no # Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and system control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +EEPROM_DRIVER = wear_leveling +WEAR_LEVELING_DRIVER = rp2040_flash +NKRO_ENABLE = yes # USB N-key rollover +RAW_ENABLE = yes # Raw HID commands (used by Keyboard Configurator) +BACKLIGHT_ENABLE = no # RGB backlight (conflicts with RGB matrix) +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = yes # RGB matrix +RGB_MATRIX_DRIVER = WS2812 +WS2812_DRIVER = vendor +RGB_MATRIX_CUSTOM_KB = yes # Custom keyboard effects +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes # Link-time optimization for smaller binary + +# Add System76 EC command interface as well as I2C and USB mux drivers +SRC += system76_ec.c usb_mux.c +QUANTUM_LIB_SRC += i2c_master.c diff --git a/keyboards/system76/launch_heavy_3/usb_mux.c b/keyboards/system76/launch_heavy_3/usb_mux.c new file mode 100644 index 000000000000..7123ec77a49d --- /dev/null +++ b/keyboards/system76/launch_heavy_3/usb_mux.c @@ -0,0 +1,485 @@ +/* + * Copyright (C) 2021 System76 + * Copyright (C) 2021 Jimmy Cassis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "usb_mux.h" + +#include + +#include "gpio.h" +#include "i2c_master.h" +#include "wait.h" + +#define GPIO_RESET_USB GP20 + +#define REG_PF1_CTL 0xBF800C04 +#define REG_PIO64_OEN 0xBF800908 +#define REG_PIO64_OUT 0xBF800928 +#define REG_VID 0xBF803000 +#define REG_PRT_SWAP 0xBF8030FA +#define REG_USB3_HUB_VID 0xBFD2E548 +#define REG_RUNTIME_FLAGS2 0xBFD23408 +#define REG_I2S_FEAT_SEL 0xBFD23412 + +struct USB7206 { + uint8_t addr; +}; + +struct USB7206 usb_hub = {.addr = 0x2D}; + +// Perform USB7206 register access. +// Returns zero on success or a negative number on error. +i2c_status_t usb7206_register_access(struct USB7206* self) { + uint8_t register_access[3] = { + 0x99, + 0x37, + 0x00, + }; + + return i2c_transmit(self->addr << 1, register_access, sizeof(register_access), I2C_TIMEOUT); +} + +// Read 32-bit value from USB7206 register region. +// Returns number of bytes read on success or a negative number on error. +i2c_status_t usb7206_read_reg_32(struct USB7206* self, uint32_t addr, uint32_t* data) { + i2c_status_t status; + + uint8_t register_read[9] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + 0x06, // Number of bytes to write to command block buffer area + 0x01, // Direction: 0 = write, 1 = read + 4, // Number of bytes to read from register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + }; + + // First byte is available length + uint8_t bytes[5] = {0, 0, 0, 0, 0}; + + status = i2c_transmit(self->addr << 1, register_read, sizeof(register_read), I2C_TIMEOUT); + if (status < 0) { + return status; + } + + status = usb7206_register_access(self); + if (status < 0) { + return status; + } + + status = i2c_readReg16( + (self->addr << 1), + 0x006, // 6 to skip header + bytes, + sizeof(bytes), + I2C_TIMEOUT + ); + if (status < 0) { + return status; + } + + //TODO: check bytes[0] length + + // Convert from little endian + *data = + (((uint32_t)bytes[1]) << 0) | + (((uint32_t)bytes[2]) << 8) | + (((uint32_t)bytes[3]) << 16) | + (((uint32_t)bytes[4]) << 24); + + return 4; +} + +// Write 8-bit value to USB7206 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7206_write_reg_8(struct USB7206* self, uint32_t addr, uint8_t data) { + i2c_status_t status; + + uint8_t register_write[9 + 1] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + 1 + 6, // Number of bytes to write to command block buffer area + 0x00, // Direction: 0 = write, 1 = read + 1, // Number of bytes to write to register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + data + }; + + status = i2c_transmit((self->addr << 1), register_write, sizeof(register_write), I2C_TIMEOUT); + if (status < 0) { + return status; + } + + status = usb7206_register_access(self); + if (status < 0) { + return status; + } + + return 1; +} + +// Write 32-bit value to USB7206 register region. +// Returns number of bytes written on success or a negative number on error. +i2c_status_t usb7206_write_reg_32(struct USB7206* self, uint32_t addr, uint32_t data) { + i2c_status_t status; + + uint8_t register_write[9 + 4] = { + 0x00, // Buffer address MSB: always 0 + 0x00, // Buffer address LSB: always 0 + 4 + 6, // Number of bytes to write to command block buffer area + 0x00, // Direction: 0 = write, 1 = read + 4, // Number of bytes to write to register + (uint8_t)(addr >> 24), // Register address byte 3 + (uint8_t)(addr >> 16), // Register address byte 2 + (uint8_t)(addr >> 8), // Register address byte 1 + (uint8_t)(addr >> 0), // Register address byte 0 + (uint8_t)(data >> 0), + (uint8_t)(data >> 8), + (uint8_t)(data >> 16), + (uint8_t)(data >> 24), + }; + + status = i2c_transmit((self->addr << 1), register_write, sizeof(register_write), I2C_TIMEOUT); + if (status < 0) { + return status; + } + + status = usb7206_register_access(self); + if (status < 0) { + return status; + } + + return 4; +} + +// Initialize USB7206. +// Returns zero on success or a negative number on error. +int usb7206_init(struct USB7206* self) { + i2c_status_t status; + uint32_t data; + + // DM and DP are swapped on ports 2 and 3 + status = usb7206_write_reg_8(self, REG_PRT_SWAP, 0x0C); + if (status < 0) { + return status; + } + + // Disable audio + status = usb7206_write_reg_8(self, REG_I2S_FEAT_SEL, 0); + if (status < 0) { + return status; + } + + // Set HFC_DISABLE + data = 0; + status = usb7206_read_reg_32(self, REG_RUNTIME_FLAGS2, &data); + if (status < 0) { + return status; + } + data |= 1; + status = usb7206_write_reg_32(self, REG_RUNTIME_FLAGS2, data); + if (status < 0) { + return status; + } + + // Set Vendor ID and Product ID of USB 2 hub + status = usb7206_write_reg_32(self, REG_VID, 0x00033384); + if (status < 0) { + return status; + } + + // Set Vendor ID and Product ID of USB 3 hub + status = usb7206_write_reg_32(self, REG_USB3_HUB_VID, 0x00043384); + if (status < 0) { + return status; + } + + return 0; +} + +// Attach USB7206. +// Returns bytes written on success or a negative number on error. +i2c_status_t usb7206_attach(struct USB7206* self) { + uint8_t data[3] = { + 0xAA, + 0x56, + 0x00, + }; + + return i2c_transmit(self->addr << 1, data, sizeof(data), I2C_TIMEOUT); +} + +struct USB7206_GPIO { + struct USB7206* usb7206; + uint32_t pf; +}; + +struct USB7206_GPIO usb_gpio_sink = {.usb7206 = &usb_hub, .pf = 29}; // UP_SEL = PF29 = GPIO93 +struct USB7206_GPIO usb_gpio_source_left = {.usb7206 = &usb_hub, .pf = 10}; // CL_SEL = PF10 = GPIO74 +struct USB7206_GPIO usb_gpio_source_right = {.usb7206 = &usb_hub, .pf = 25}; // CR_SEL = PF25 = GPIO88 + +// Set USB7206 GPIO to specified value. +// Returns zero on success or negative number on error. +i2c_status_t usb7206_gpio_set(struct USB7206_GPIO* self, bool value) { + i2c_status_t status; + uint32_t data; + + data = 0; + status = usb7206_read_reg_32(self->usb7206, REG_PIO64_OUT, &data); + if (status < 0) { + return status; + } + + if (value) { + data |= (((uint32_t)1) << self->pf); + } else { + data &= ~(((uint32_t)1) << self->pf); + } + status = usb7206_write_reg_32(self->usb7206, REG_PIO64_OUT, data); + if (status < 0) { + return status; + } + + return 0; +} + +// Initialize USB7206 GPIO. +// Returns zero on success or a negative number on error. +i2c_status_t usb7206_gpio_init(struct USB7206_GPIO* self) { + i2c_status_t status; + uint32_t data; + + // Set programmable function to GPIO + status = usb7206_write_reg_8(self->usb7206, REG_PF1_CTL + (self->pf - 1), 0); + if (status < 0) { + return status; + } + + // Set GPIO to false by default + usb7206_gpio_set(self, false); + + // Set GPIO to output + data = 0; + status = usb7206_read_reg_32(self->usb7206, REG_PIO64_OEN, &data); + if (status < 0) { + return status; + } + + data |= (((uint32_t)1) << self->pf); + status = usb7206_write_reg_32(self->usb7206, REG_PIO64_OEN, data); + if (status < 0) { + return status; + } + + return 0; +} + +#define TCPC_CC_STATUS 0x1D +#define TCPC_ROLE_CONTROL 0x1A +#define TCPC_COMMAND 0x23 + +enum TCPC_TYPE { + TCPC_TYPE_SINK, + TCPC_TYPE_SOURCE, +}; + +struct PTN5110 { + enum TCPC_TYPE type; + uint8_t addr; + uint8_t cc; + struct USB7206_GPIO * gpio; +}; + +struct PTN5110 usb_sink = { .type = TCPC_TYPE_SINK, .addr = 0x51, .gpio = &usb_gpio_sink }; +struct PTN5110 usb_source_left = { .type = TCPC_TYPE_SOURCE, .addr = 0x52, .gpio = &usb_gpio_source_left }; +struct PTN5110 usb_source_right = { .type = TCPC_TYPE_SOURCE, .addr = 0x50, .gpio = &usb_gpio_source_right }; + +// Read PTN5110 CC_STATUS +// Returns bytes read on success or negative number on error +int ptn5110_get_cc_status(struct PTN5110 * self, uint8_t * cc) { + return i2c_readReg(self->addr << 1, TCPC_CC_STATUS, cc, 1, I2C_TIMEOUT); +} + +// Write PTN5110 ROLE_CONTROL +// Returns bytes written on success or negative number on error +int ptn5110_set_role_control(struct PTN5110 * self, uint8_t role_control) { + return i2c_writeReg(self->addr << 1, TCPC_ROLE_CONTROL, &role_control, 1, I2C_TIMEOUT); +} + +// Set PTN5110 SSMUX orientation. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_set_ssmux(struct PTN5110* self, bool orientation) { return usb7206_gpio_set(self->gpio, orientation); } + +// Write PTN5110 COMMAND. +// Returns zero on success or negative number on error. +i2c_status_t ptn5110_command(struct PTN5110* self, uint8_t command) { return i2c_writeReg(self->addr << 1, TCPC_COMMAND, &command, 1, I2C_TIMEOUT); } + +// Set orientation of PTN5110 operating as a sink, call this once. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_sink_set_orientation(struct PTN5110* self) { + i2c_status_t status; + uint8_t cc; + + status = ptn5110_get_cc_status(self, &cc); + if (status < 0) { + return status; + } + + if ((cc & 0x03) == 0) { + status = ptn5110_set_ssmux(self, false); + if (status < 0) { + return status; + } + } else { + status = ptn5110_set_ssmux(self, true); + if (status < 0) { + return status; + } + } + + return 0; +} + +// Update PTN5110 operating as a source, call this repeatedly. +// Returns zero on success or a negative number on error. +i2c_status_t ptn5110_source_update(struct PTN5110* self) { + i2c_status_t status; + uint8_t cc; + + status = ptn5110_get_cc_status(self, &cc); + if (status < 0) { + return status; + } + + if (cc != self->cc) { + // WARNING: Setting this here will disable retries + self->cc = cc; + + bool connected = false; + bool orientation = false; + if ((cc & 0x03) == 2) { + connected = true; + orientation = true; + } else if (((cc >> 2) & 0x03) == 2) { + connected = true; + orientation = false; + } + + if (connected) { + // Set SS mux orientation + status = ptn5110_set_ssmux(self, orientation); + if (status < 0) { + return status; + } + + // Enable source Vbus command + status = ptn5110_command(self, 0b01110111); + if (status < 0) { + return status; + } + } else { + // Disable source Vbus command + status = ptn5110_command(self, 0b01100110); + if (status < 0) { + return status; + } + } + } + + return 0; +} + +// Initialize PTN5110 +// Returns zero on success or negative number on error +int ptn5110_init(struct PTN5110 * self) { + int res; + + // Set last cc to invalid value, to force update + self->cc = 0xFF; + + // Initialize GPIO + res = usb7206_gpio_init(self->gpio); + if (res < 0) return res; + + switch (self->type) { + case TCPC_TYPE_SINK: + res = ptn5110_sink_set_orientation(self); + if (res < 0) return res; + break; + case TCPC_TYPE_SOURCE: + res = ptn5110_set_role_control(self, 0x05); + if (res < 0) return res; + break; + } + + return 0; +} + +void usb_mux_event(void) { + // Run this on every 1000th matrix scan + static int cycle = 0; + if (cycle >= 1000) { + cycle = 0; + ptn5110_source_update(&usb_source_left); + ptn5110_source_update(&usb_source_right); + } else { + cycle += 1; + } +} + +void usb_mux_init(void) { + // Put the USB hub in reset + setPinOutput(GPIO_RESET_USB); + writePinLow(GPIO_RESET_USB); + + // Run I2C bus at 100 kHz + i2c_init(); + + // Wait for power stable + wait_ms(10); + + // Take the USB hub out of reset + writePinHigh(GPIO_RESET_USB); + + // Wait for USB hub to come out of reset + wait_ms(100); + + // Set up hub + usb7206_init(&usb_hub); + + // Set up sink + ptn5110_init(&usb_sink); + + // Set up sources + ptn5110_init(&usb_source_left); + ptn5110_init(&usb_source_right); + + // Attach hub + usb7206_attach(&usb_hub); + + // Ensure orientation is correct after attaching hub + // TODO: Find reason why GPIO for sink orientation is reset + for (int i = 0; i < 100; i++) { + ptn5110_sink_set_orientation(&usb_sink); + wait_ms(10); + } +} diff --git a/keyboards/system76/launch_heavy_3/usb_mux.h b/keyboards/system76/launch_heavy_3/usb_mux.h new file mode 100644 index 000000000000..26f84de864b6 --- /dev/null +++ b/keyboards/system76/launch_heavy_3/usb_mux.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +void usb_mux_init(void); +void usb_mux_event(void); diff --git a/keyboards/system76/launch_lite_1/README.md b/keyboards/system76/launch_lite_1/README.md new file mode 100644 index 000000000000..7290dd6655fb --- /dev/null +++ b/keyboards/system76/launch_lite_1/README.md @@ -0,0 +1,40 @@ +## Flashing firmware: +* Clone this repository and `cd` into the `qmk_firmware` directory. +* After cloning, you probably need to run `make git-submodule` as well as `./util/qmk_install`. + - You may also need to install dependencies: `sudo apt install avrdude gcc-avr avr-libc` +* To build the firmware without flashing the keyboard, use `make (keyboard name):(layout name)` + - For example, if you want to build the `default` layout for the Launch keyboard, run: +``` +make system76/launch_lite_1:default +``` +* To flash the firmware, you'll use the same build command, but with `dfu` added to the end: +``` +make system76/launch_lite_1:default:dfu +``` + - After it builds, you will see a repeating message that says: +``` +dfu-programmer: no device present. +ERROR: Bootloader not found. Trying again in 5s. +``` +Next, unplug your keyboard from your computer, hold the ESC key (while the keyboard is unplugged), and plug the keyboard back in while holding the ESC key. Once the keyboard is plugged in, the ESC key can be released. +* Note: on some distros, dfu-programmer has trouble detecting the keyboard unless you run the `make` command with `sudo`. +* To flash the firmware using ISP, you will need a USBasp device, and a tag connect cable. + - Build the firmware and bootloader with: +``` +make system76/launch_lite_1:default:production +``` + - Run avrdude to flash the fuses: +``` +avrdude -c usbasp -p at90usb646 -U lfuse:w:0x5E:m -U hfuse:w:0xD9:m -U efuse:w:0xCB:m +``` + - Run avrdude to flash the ROM: +``` +avrdude -c usbasp -p at90usb646 -U flash:w:system76_launch_lite_1_default_production.hex +``` + +## Making your own layout: +If you want to create your own layout, go to the `keymaps` directory and copy one of the maps in there. It will likely be easiest to start with the default layout, but the other layouts in there may be helpful references. The name of the directory you create will be the name of your layout. To prevent build errors, it is recommended to use only lowercase letters, underscores, and numbers for the name of your layout. + +Inside of each layout directory, there is a file called `keymap.c`. The commented out grid area in this file is a visual reference for the actual key assignments below it. When modifying a layout, modifying this visual reference first makes it easier to design a layout, as well as keeping the actual layout below it organized. + +Once your layout is designed, change the keycodes below to match your design. A full list of available keycodes can be found in the [QMK docs](https://beta.docs.qmk.fm/reference/keycodes). Use the shorter keycode alias to help keep these lined up (e.g. use `KC_ESC` instead of `KC_ESCAPE`). diff --git a/keyboards/system76/launch_lite_1/config.h b/keyboards/system76/launch_lite_1/config.h new file mode 100644 index 000000000000..57ffef97dfaa --- /dev/null +++ b/keyboards/system76/launch_lite_1/config.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + + +/* + * Key matrix pins + * ROWS: AVR pins used for rows, top to bottom + * COLS: AVR pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { F1, F2, F3, F4, F5 } +#define MATRIX_COL_PINS { C6, C5, C4, C3, C2, C1, C7, A7, A6, A5, A4, E6, C0, E7 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +#ifdef RGB_MATRIX_ENABLE +# define RGB_DI_PIN F7 +# define RGB_MATRIX_LED_COUNT 70 +# define RGB_MATRIX_KEYPRESSES // Reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // Reacts to keyreleases (instead of keypresses) +// # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enables framebuffer effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Turns off effects when suspended +// Limit brightness to support USB-A at 0.5 A +// TODO: Do this dynamically based on power source +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 176 // Limits maximum brightness of LEDs to 176 out of 255. If not defined, maximum brightness is set to 255 +# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Sets the default mode, if none has been set +# define RGB_MATRIX_DEFAULT_HUE 142 // Sets the default hue value, if none has been set +# define RGB_MATRIX_DEFAULT_SAT 255 // Sets the default saturation value, if none has been set +# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set +# define RGB_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set +# define RGB_MATRIX_DISABLE_KEYCODES // Disables control of rgb matrix by keycodes (must use code functions to control the feature) + +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +#endif // RGB_MATRIX_ENABLE + +// Mechanical locking support; use KC_LCAP, KC_LNUM, or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// I2C { +#define F_SCL 100000UL // Run I2C bus at 100 kHz +#define I2C_START_RETRY_COUNT 20 +#define I2C_TIMEOUT 100 // milliseconds +// } I2C + +// EEPROM { +#define EEPROM_SIZE 1024 +// TODO: Refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x02 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) +// } EEPROM + +// Dynamic keymap { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 +#define DYNAMIC_KEYMAP_MACRO_COUNT 0 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +// Dynamic macro starts after dynamic keymaps, it is disabled +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2)) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 0 +// } Dynamic keymap + +// System76 EC { +#define SYSTEM76_EC_EEPROM_ADDR (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE) +#define SYSTEM76_EC_EEPROM_SIZE (EEPROM_SIZE - SYSTEM76_EC_EEPROM_ADDR) +// } System76 EC diff --git a/keyboards/system76/launch_lite_1/info.json b/keyboards/system76/launch_lite_1/info.json new file mode 100644 index 000000000000..2c4994948b02 --- /dev/null +++ b/keyboards/system76/launch_lite_1/info.json @@ -0,0 +1,92 @@ +{ + "keyboard_name": "Launch Lite Configurable Keyboard (launch_lite_1)", + "manufacturer": "System76", + "url": "https://system76.com/accessories/launch", + "usb": { + "vid": "0x3384", + "pid": "0x0005", + "device_version": "0.0.1" + }, + "processor": "at90usb646", + "bootloader": "qmk-dfu", + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "Esc", "x": 0, "y": 0 }, + { "label": "1", "x": 1, "y": 0 }, + { "label": "2", "x": 2, "y": 0 }, + { "label": "3", "x": 3, "y": 0 }, + { "label": "4", "x": 4, "y": 0 }, + { "label": "5", "x": 5, "y": 0 }, + { "label": "6", "x": 6, "y": 0 }, + { "label": "7", "x": 7, "y": 0 }, + { "label": "8", "x": 8, "y": 0 }, + { "label": "9", "x": 9, "y": 0 }, + { "label": "0", "x": 10, "y": 0 }, + { "label": "-", "x": 11, "y": 0 }, + { "label": "=", "x": 12, "y": 0 }, + { "label": "Del", "x": 13, "y": 0, "w": 1.5 }, + { "label": "Home", "x": 14.75, "y": 0 }, + + { "label": "Tab", "x": 0, "y": 1, "w": 1.5 }, + { "label": "Q", "x": 1.5, "y": 1 }, + { "label": "W", "x": 2.5, "y": 1 }, + { "label": "E", "x": 3.5, "y": 1 }, + { "label": "R", "x": 4.5, "y": 1 }, + { "label": "T", "x": 5.5, "y": 1 }, + { "label": "Y", "x": 6.5, "y": 1 }, + { "label": "U", "x": 7.5, "y": 1 }, + { "label": "I", "x": 8.5, "y": 1 }, + { "label": "O", "x": 9.5, "y": 1 }, + { "label": "P", "x": 10.5, "y": 1 }, + { "label": "[", "x": 11.5, "y": 1 }, + { "label": "]", "x": 12.5, "y": 1 }, + { "label": "\\", "x": 13.5, "y": 1 }, + { "label": "PgUp", "x": 14.75, "y": 1 }, + + { "label": "Caps", "x": 0.25, "y": 2, "w": 1.5 }, + { "label": "A", "x": 1.75, "y": 2 }, + { "label": "S", "x": 2.75, "y": 2 }, + { "label": "D", "x": 3.75, "y": 2 }, + { "label": "F", "x": 4.75, "y": 2 }, + { "label": "G", "x": 5.75, "y": 2 }, + { "label": "H", "x": 6.75, "y": 2 }, + { "label": "J", "x": 7.75, "y": 2 }, + { "label": "K", "x": 8.75, "y": 2 }, + { "label": "L", "x": 9.75, "y": 2 }, + { "label": ";", "x": 10.75, "y": 2 }, + { "label": "'", "x": 11.75, "y": 2 }, + { "label": "Enter", "x": 12.75, "y": 2, "w": 1.5 }, + { "label": "PgDn", "x": 14.75, "y": 2 }, + + { "label": "LShift", "x": 0.25, "y": 3, "w": 2 }, + { "label": "Z", "x": 2.25, "y": 3 }, + { "label": "X", "x": 3.25, "y": 3 }, + { "label": "C", "x": 4.25, "y": 3 }, + { "label": "V", "x": 5.25, "y": 3 }, + { "label": "B", "x": 6.25, "y": 3 }, + { "label": "N", "x": 7.25, "y": 3 }, + { "label": "M", "x": 8.25, "y": 3 }, + { "label": ",", "x": 9.25, "y": 3 }, + { "label": ".", "x": 10.25, "y": 3 }, + { "label": "/", "x": 11.25, "y": 3 }, + { "label": "RShift", "x": 12.25, "y": 3, "w": 1.5 }, + { "label": "Up", "x": 13.75, "y": 3 }, + { "label": "End", "x": 14.75, "y": 3 }, + + { "label": "LCtrl", "x": 0.25, "y": 4, "w": 1.5 }, + { "label": "LAlt", "x": 1.75, "y": 4 }, + { "label": "LFn", "x": 2.75, "y": 4 }, + { "label": "Super", "x": 3.75, "y": 4 }, + { "label": "Space", "x": 4.75, "y": 4, "w": 2 }, + { "label": "Space", "x": 6.75, "y": 4, "w": 2 }, + { "label": "RCtrl", "x": 8.75, "y": 4 }, + { "label": "RAlt", "x": 9.75, "y": 4 }, + { "label": "RFn", "x": 10.75, "y": 4, "w": 1.5 }, + { "label": "Left", "x": 12.75, "y": 4 }, + { "label": "Down", "x": 13.75, "y": 4 }, + { "label": "Right", "x": 14.75, "y": 4 } + ] + } + } +} diff --git a/keyboards/system76/launch_lite_1/keymaps/default/keymap.c b/keyboards/system76/launch_lite_1/keymaps/default/keymap.c new file mode 100644 index 000000000000..e1ea41240132 --- /dev/null +++ b/keyboards/system76/launch_lite_1/keymaps/default/keymap.c @@ -0,0 +1,79 @@ +#include QMK_KEYBOARD_H +#define ______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +____________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | | +| ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|_____________|________| +| | | | | | | | | | | | [ | ] | | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | PGUP | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________|________| + | | | | | | | | | | | ; | ' | | | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | | PGDN | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | END | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________| + | | | | | | | | | | | | | | + | CTRL | LALT | FN | LGUI | SPACE | SPACE | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, KC_LALT, MO(1), KC_LGUI, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +____________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | PLAY/ | +| ~ | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL | PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|_____________|________| +| | | | | | | | | | | | LED | LED | LED | VOLUME | +|PRINT SCREEN| | | | | | HOME | PGDN | PGUP | END | | DOWN | UP | TOGGLE | UP | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________|________| + | | | | | | | | | | | | | | | VOLUME | + | | | | | | | LEFT | DOWN | UP | RIGHT | | | | | DOWN | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | MUTE | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [1] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MPLY, + KC_PSCR, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, RGB_VAD, RGB_VAI, RGB_TOG, KC_VOLU, + _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, KC_VOLD, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_MUTE, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END + ), + + [2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [3] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_lite_1/keymaps/jeremy/keymap.c b/keyboards/system76/launch_lite_1/keymaps/jeremy/keymap.c new file mode 100644 index 000000000000..2707e9d294a0 --- /dev/null +++ b/keyboards/system76/launch_lite_1/keymaps/jeremy/keymap.c @@ -0,0 +1,81 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +____________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | | +| ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|_____________|________| +| | | | | | | | | | | | [ | ] | | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | PGUP | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________|________| + | | | | | | | | | | | ; | ' | | | | + | FN | A | S | D | F | G | H | J | K | L | : | " | ENTER | | PGDN | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | END | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________| + | | | | | | | | | | | | | | + | CTRL | FN | LALT | LGUI | SPACE | BACKSPACE | ESC | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_BSPC, KC_ESC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +____________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | PLAY/ | +| ~ | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE | PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|_____________|________| +| | | | | | | | | | | | LED | LED | LED | VOLUME | +|PRINT SCREEN| | | | | | | PGUP | HOME | PGDN | | DOWN | UP | TOGGLE | UP | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________|________| + | | | VOL | VOL | | | | | | | | | | | VOLUME | + | | | DOWN | UP | MUTE | | LEFT | DOWN | UP | RIGHT | | | | | DOWN | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | | + | | | | | | | END | | | | | | PGUP | MUTE | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________| + | | | | | | | | | | | | | | + | | | | | ENTER | DELETE | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'RESET' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_MPLY, + KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_HOME, KC_PGDN, KC_TRNS, RGB_VAD, RGB_VAI, RGB_TOG, KC_VOLU, + KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + + [2] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_lite_1/keymaps/levi/keymap.c b/keyboards/system76/launch_lite_1/keymaps/levi/keymap.c new file mode 100644 index 000000000000..51bf4a4ef5d0 --- /dev/null +++ b/keyboards/system76/launch_lite_1/keymaps/levi/keymap.c @@ -0,0 +1,117 @@ +#include QMK_KEYBOARD_H + +static bool lctl_pressed, rctl_pressed, esc_pressed; +void system76_ec_unlock(void); + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, dvorak layer +____________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | | +| ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|_____________|________| +| | ' | , | . | | | | | | | | / | + | | | +| TAB | " | < | > | P | Y | F | G | C | R | L | ? | = | | \ | PGUP | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________|________| + | | | | | | | | | | | | - | | | | + | LCTL | A | O | E | U | I | D | H | T | N | S | _ | ENTER | | PGDN | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | ; | | | | | | | | | | | | | + | SHIFT | : | Q | J | K | X | B | M | W | V | Z | SHIFT | UP | END | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________| + | | | | | | | | | | | | | | + | FN | LCTL | LALT | LGUI | SPACE | FN | RCTL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, KC_HOME, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_PGUP, + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_PGDN, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, KC_END, + MO(2), KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, qwerty layer +____________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | | +| ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE | HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|_____________|________| +| | | | | | | | | | | | [ | ] | | | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | PGUP | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________|________| + | | | | | | | | | | | ; | ' | | | | + | LCTL | A | S | D | F | G | H | J | K | L | : | " | ENTER | | PGDN | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | END | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________| + | | | | | | | | | | | | | | + | FN | LCTL | LALT | LGUI | SPACE | FN | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [1] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + MO(2), KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, MO(2), KC_RCTL, KC_RALT, MO(2), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 2, function layer +____________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | | +| ~ | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL | Dvorak | +|________|________|________|________|________|________|________|________|________|________|________|________|________|_____________|________| +| | | | | | | | | | | | | | | | +| | HOME | UP | END | PGUP | | PGUP | HOME | UP | END | | | | PRTSCR | Qwerty | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|_________|________| + | | | | | | | | | | | | | | | | + | | LEFT | DOWN | RIGHT | PGDN | | PGDN | LEFT | DOWN | RIGHT | | | | | | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | PLAY/ | MEDIA | MEDIA | VOLUME | VOLUME | VOLUME | | | | | | | | + | | PAUSE | PREV | NEXT | DOWN | UP | MUTE | | | | | | PGUP | RESET | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|________| + | | | | | | | | | | | | | | + | | | | | BACKSPACE | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [2] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, TO(0), + KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_TRNS, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, TO(1), + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_TRNS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, QK_BOOT, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_LCTL: + lctl_pressed = record->event.pressed; + break; + case KC_RCTL: + rctl_pressed = record->event.pressed; + break; + case KC_ESC: + esc_pressed = record ->event.pressed; + break; + }; + return true; +} + +void matrix_scan_user(void) { + if (lctl_pressed && rctl_pressed && esc_pressed) { + system76_ec_unlock(); + } +} diff --git a/keyboards/system76/launch_lite_1/launch_lite_1.c b/keyboards/system76/launch_lite_1/launch_lite_1.c new file mode 100644 index 000000000000..affa283e2044 --- /dev/null +++ b/keyboards/system76/launch_lite_1/launch_lite_1.c @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "launch_lite_1.h" + +// clang-format off +#ifdef RGB_MATRIX_ENABLE +// LEDs by index +// 0 1 2 3 4 5 6 7 8 9 +// 00 LM4 LL4 LK4 LJ4 LI4 LH4 LG4 LF4 LE4 LD4 +// 10 LC4 LB4 LA4 LA5 LB5 LC5 LD5 LE5 LG5 LH5 +// 20 LI5 LJ5 LK5 LL5 LM5 LO3 LM3 LL3 LK3 LJ3 +// 30 LI3 LH3 LG3 LF3 LE3 LD3 LC3 LB3 LA3 LA2 +// 40 LB2 LC2 LD2 LE2 LF2 LG2 LH2 LI2 LJ2 LK2 +// 50 LL2 LM2 LN2 LO2 LO1 LN1 LM1 LL1 LK1 LJ1 +// 60 LI1 LH1 LG1 LF1 LE1 LD1 LC1 LB1 LA1 LO0 +led_config_t g_led_config = { { + // Key matrix to LED index +/* A B C D E F G H I J K L M N O */ +/* 0 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 69 */ +/* 1 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54 */ +/* 2 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 53 */ +/* 3 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 25 */ +/* 4 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 */ + { 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55 }, + { 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 }, + { 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 69 }, + { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 54 }, + { 13, 14, 15, 16, 17, 25, 18, 19, 20, 21, 22, 23, 24, 53 } +}, { + // LED index to physical position (this is a pain, see leds-lite.sh in launch repo) +/* 00 */ {209, 48}, {190, 48}, {171, 48}, {156, 48}, {140, 48}, {125, 48}, {110, 48}, { 95, 48}, { 80, 48}, { 65, 48}, +/* 10 */ { 49, 48}, { 34, 48}, { 11, 48}, { 8, 64}, { 27, 64}, { 42, 64}, { 57, 64}, { 80, 64}, {110, 64}, {133, 64}, +/* 20 */ {148, 64}, {167, 64}, {194, 64}, {209, 64}, {224, 64}, {224, 48}, {197, 32}, {178, 32}, {163, 32}, {148, 32}, +/* 30 */ {133, 32}, {118, 32}, {103, 32}, { 87, 32}, { 72, 32}, { 57, 32}, { 42, 32}, { 27, 32}, { 8, 32}, { 4, 16}, +/* 40 */ { 23, 16}, { 38, 16}, { 53, 16}, { 68, 16}, { 84, 16}, { 99, 16}, {114, 16}, {129, 16}, {144, 16}, {159, 16}, +/* 50 */ {175, 16}, {190, 16}, {205, 16}, {224, 32}, {224, 16}, {201, 0}, {182, 0}, {167, 0}, {152, 0}, {137, 0}, +/* 60 */ {121, 0}, {106, 0}, { 91, 0}, { 76, 0}, { 61, 0}, { 46, 0}, { 30, 0}, { 15, 0}, { 0, 0}, {224, 0} +}, { + // LED index to flags (set all to LED_FLAG_KEYLIGHT) +/* 0 1 2 3 4 5 6 7 8 9 */ +/* 00 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 10 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 20 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 30 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 40 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 50 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 60 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 +} }; +#endif // RGB_MATRIX_ENABLE + +bool eeprom_is_valid(void) { + return ( + eeprom_read_word(((void *)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void *)EEPROM_VERSION_ADDR)) == EEPROM_VERSION + ); +} +// clang-format on + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void *)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void *)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void bootmagic_lite_reset_eeprom(void) { + // Set the keyboard-specific EEPROM state as invalid + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid + eeconfig_disable(); +} + +// The lite version of TMK's bootmagic based on Wilba. +// 100% less potential for accidentally making the keyboard do stupid things. +void bootmagic_lite(void) { + // Perform multiple scans because debouncing can't be turned off. + matrix_scan(); +#if defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); +#else + wait_ms(30); +#endif + matrix_scan(); + + // If the configured key (commonly Esc) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + uint8_t row = 0; // BOOTMAGIC_LITE_ROW; + uint8_t col = 0; // BOOTMAGIC_LITE_COLUMN; + + if (matrix_get_row(row) & (1 << col)) { + bootmagic_lite_reset_eeprom(); + + // Jump to bootloader. + bootloader_jump(); + } +} + +void system76_ec_rgb_eeprom(bool write); +void system76_ec_rgb_layer(layer_state_t layer_state); +void system76_ec_unlock(void); +bool system76_ec_is_unlocked(void); + +rgb_config_t layer_rgb[DYNAMIC_KEYMAP_LAYER_COUNT]; + +void matrix_init_kb(void) { + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + system76_ec_rgb_eeprom(true); + eeprom_set_valid(true); + } else { + system76_ec_rgb_eeprom(false); + } +} + +void keyboard_post_init_user(void) { + system76_ec_rgb_layer(layer_state); +} + +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +#define LEVEL(value) (uint8_t)(((uint16_t)value) * ((uint16_t)RGB_MATRIX_MAXIMUM_BRIGHTNESS) / ((uint16_t)255)) + +// clang-format off +static const uint8_t levels[] = { + LEVEL(48), + LEVEL(72), + LEVEL(96), + LEVEL(144), + LEVEL(192), + LEVEL(255) +}; +// clang-format on + +static uint8_t toggle_level = RGB_MATRIX_MAXIMUM_BRIGHTNESS; +extern bool input_disabled; + +static void set_value_all_layers(uint8_t value) { + if (!system76_ec_is_unlocked()) { + for (int8_t layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) { + layer_rgb[layer].hsv.v = value; + } + system76_ec_rgb_layer(layer_state); + } +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (input_disabled) { + return false; + } + + if (!process_record_user(keycode, record)) { + return false; + } + + switch (keycode) { + case QK_BOOT: + if (record->event.pressed) { + system76_ec_unlock(); + } +#ifdef SYSTEM76_EC + return false; +#else + return true; +#endif + case RGB_VAD: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = sizeof(levels) - 1; i >= 0; i--) { + if (levels[i] < level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_VAI: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = 0; i < sizeof(levels); i++) { + if (levels[i] > level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_TOG: + if (record->event.pressed) { + uint8_t level = 0; + if (rgb_matrix_config.hsv.v == 0) { + level = toggle_level; + } else { + toggle_level = rgb_matrix_config.hsv.v; + } + set_value_all_layers(level); + } + return false; + } + + return true; +} + +layer_state_t layer_state_set_kb(layer_state_t layer_state) { + system76_ec_rgb_layer(layer_state); + + return layer_state_set_user(layer_state); +} + +#ifdef CONSOLE_ENABLE +void keyboard_post_init_user(void) { + debug_enable = true; + debug_matrix = false; + debug_keyboard = false; +} +#endif // CONSOLE_ENABLE diff --git a/keyboards/system76/launch_lite_1/launch_lite_1.h b/keyboards/system76/launch_lite_1/launch_lite_1.h new file mode 100644 index 000000000000..458c290fdf11 --- /dev/null +++ b/keyboards/system76/launch_lite_1/launch_lite_1.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "quantum.h" + +// clang-format off +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K0E }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K1E }, \ + { K40, K41, K42, K43, K44, K3D, K45, K46, K47, K48, K49, K4A, K4B, K2D }, \ +} +// clang-format on diff --git a/keyboards/system76/launch_lite_1/post_rules.mk b/keyboards/system76/launch_lite_1/post_rules.mk new file mode 100644 index 000000000000..3751a8b8c31b --- /dev/null +++ b/keyboards/system76/launch_lite_1/post_rules.mk @@ -0,0 +1,12 @@ +# System76 EC +# remove the RESET HID command +VALID_SYSTEM76_EC_TYPES := yes +SYSTEM76_EC_ENABLE ?= no +ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + ifeq ($(filter $(SYSTEM76_EC_ENABLE),$(VALID_SYSTEM76_EC_TYPES)),) + $(error SYSTEM76_EC_EN="$(strip $(SYSTEM76_EC_ENABLE))" is not a valid type for the System76 EC option) + endif + ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + OPT_DEFS += -DSYSTEM76_EC + endif +endif diff --git a/keyboards/system76/launch_lite_1/readme.md b/keyboards/system76/launch_lite_1/readme.md new file mode 100644 index 000000000000..4748c3ef1537 --- /dev/null +++ b/keyboards/system76/launch_lite_1/readme.md @@ -0,0 +1,62 @@ +# System76 Launch Configurable Keyboard (launch_lite_1) + +![System76 Launch Configurable Keyboard](https://images.prismic.io/system76/b71307ac-dae6-4863-b7ca-804cd61c7ef8_launch_overhead.png?auto=compress,format&w=750) + +The Launch Configurable Keyboard is engineered to be comfortable, fully customizable, and make your workflow more efficient. + +- High-speed USB Hub +- Works on Linux, Windows and macOS +- 100% Open Source +- Made in Colorado + +Additional Launch Keyboard resources: + +- Keyboard Maintainer: [System76](https://github.com/system76) +- Hardware Supported: [System76 Launch GitHub Repository](https://github.com/system76/launch) +- Hardware Availability: [Shop System76](https://system76.com/accessories/launch) + +## Building Firmware + +To build the firmware using `make` (after setting up the build environment), e.g.: + +```bash +make -r system76/launch_lite_1:default +``` + +Equivalently, using the QMK CLI: + +```bash +qmk compile -kb system76/launch_lite_1 -km default +``` + +## Flashing Firmware (DFU) + +To build and flash the firmware on the keyboard, e.g.: + +```bash +make -r system76/launch_lite_1:default:flash +``` + +Equivalently, using the QMK CLI: + +```bash +qmk flash -kb system76/launch_lite_1 -km default +``` + +## Flashing Firmware (ISP) + +To flash the firmware (and/or bootloader) using ISP refer to the [_ISP Flashing Guide_](https://docs.qmk.fm/#/isp_flashing_guide). + +> **Factory fuse values** => Low: `0x5E`, High: `0x99`, Extended: `0xF3`, Lock Bits: `0xFF` + +## Environment Setup + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. If new to QMK, start with the [_Complete Newbs Guide_](https://docs.qmk.fm/#/newbs). + +## Bootloader + +Enter the bootloader in 3 ways: + +- **Bootmagic reset**: Hold down the key at (0,0) in the matrix (Escape) and plug in the keyboard. +- **Keycode in layout**: Press the key mapped to `QK_BOOT` in the second layer (Escape). +- **Electrical reset**: Briefly short AVR ISP's GND (6) and RST (5) pads on the back of the PCB. diff --git a/keyboards/system76/launch_lite_1/rgb_matrix_kb.inc b/keyboards/system76/launch_lite_1/rgb_matrix_kb.inc new file mode 100644 index 000000000000..6f29406feb78 --- /dev/null +++ b/keyboards/system76/launch_lite_1/rgb_matrix_kb.inc @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +RGB_MATRIX_EFFECT(active_keys) +RGB_MATRIX_EFFECT(raw_rgb) +RGB_MATRIX_EFFECT(unlocked) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "dynamic_keymap.h" + +static bool active_keys_initialized = false; +static uint8_t active_keys_table[RGB_MATRIX_LED_COUNT] = {0}; + +static void active_keys_initialize(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + uint8_t led = g_led_config.matrix_co[row][col]; + if (led < RGB_MATRIX_LED_COUNT && row < 16 && col < 16) { + active_keys_table[led] = (row << 4) | col; + } + } + } + active_keys_initialized = true; +} + +static bool active_keys(effect_params_t* params) { + if (!active_keys_initialized) { + active_keys_initialize(); + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + uint8_t layer = get_highest_layer(layer_state); + RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + uint8_t rowcol = active_keys_table[i]; + uint8_t row = rowcol >> 4; + uint8_t col = rowcol & 0xF; + uint16_t keycode = dynamic_keymap_get_keycode(layer, row, col); + switch (keycode) { + case KC_NO: + case KC_TRNS: + rgb_matrix_set_color(i, 0, 0, 0); + break; + default: + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + break; + } + } + + return led_max < RGB_MATRIX_LED_COUNT; +} + +RGB raw_rgb_data[RGB_MATRIX_LED_COUNT] = {0}; + +static uint8_t normalize_component(uint8_t component) { + uint16_t x = (uint16_t)component; + x *= rgb_matrix_config.hsv.v; // Multiply by current brightness + x /= 255; // Divide by maximum brightness + return (uint8_t)x; +} + +static RGB normalize_index(uint8_t i) { + RGB raw = raw_rgb_data[i]; + RGB rgb = { + .r = normalize_component(raw.r), + .g = normalize_component(raw.g), + .b = normalize_component(raw.b), + }; + return rgb; +} + +static bool raw_rgb(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = normalize_index(i); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +static uint8_t unlocked_keys[8][2] = { + {1, 7}, // U + {3, 6}, // N + {2, 9}, // L + {1, 9}, // O + {3, 3}, // C + {2, 8}, // K + {1, 3}, // E + {2, 3}, // D +}; + +static uint8_t unlocked_ticks = 0; +static uint8_t unlocked_i = 0; +static uint8_t unlocked_leds_count = 0; +static uint8_t unlocked_leds[2] = {0, 0}; + +static bool unlocked(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + unlocked_ticks++; + + if (params->init) { + unlocked_ticks = 0; + unlocked_i = 0; + } + + if (unlocked_ticks == 0) { + if (unlocked_i == 8) { + unlocked_leds_count = 0; + unlocked_i = 0; + } else { + unlocked_leds_count = rgb_matrix_map_row_column_to_led(unlocked_keys[unlocked_i][0], unlocked_keys[unlocked_i][1], unlocked_leds); + unlocked_i++; + } + } + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv = { + .h = i + unlocked_ticks, + .s = 0xFF, + .v = 0x70, + }; + for (uint8_t j = 0; j < unlocked_leds_count; j++) { + if (i == unlocked_leds[j]) { + hsv.s = 0; + hsv.v = 0xFF; + } + } + + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/system76/launch_lite_1/rules.mk b/keyboards/system76/launch_lite_1/rules.mk new file mode 100644 index 000000000000..39558a022174 --- /dev/null +++ b/keyboards/system76/launch_lite_1/rules.mk @@ -0,0 +1,27 @@ +# CPU frequency divided by two since AVR is at 3.3 V +F_CPU = 8000000 + +# External oscillator is 16 MHz +F_USB = 16000000 + +# Build options +# change yes to no to disable +BOOTMAGIC_ENABLE = no # Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and system control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +NKRO_ENABLE = yes # USB N-key rollover +RAW_ENABLE = yes # Raw HID commands (used by Keyboard Configurator) +BACKLIGHT_ENABLE = no # RGB backlight (conflicts with RGB matrix) +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = yes # RGB matrix +RGB_MATRIX_DRIVER = WS2812 +RGB_MATRIX_CUSTOM_KB = yes # Custom keyboard effects +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes # Link-time optimization for smaller binary + +# Add System76 EC command interface as well as I2C and USB mux drivers +SRC += system76_ec.c +QUANTUM_LIB_SRC += i2c_master.c diff --git a/keyboards/system76/launch_test/README.md b/keyboards/system76/launch_test/README.md new file mode 100644 index 000000000000..1bb62384a629 --- /dev/null +++ b/keyboards/system76/launch_test/README.md @@ -0,0 +1,19 @@ +## Flashing firmware: +* Clone this repository and `cd` into the `qmk_firmware` directory. +* After cloning, you probably need to run `make git-submodule`. + - You may also need to install dependencies: `sudo apt install avrdude gcc-avr avr-libc` +* To build the firmware without flashing the keyboard, use `make (keyboard name):(layout name)` + - For example, if I want to build Levi's layout for the Launch keyboard, I will run: + `make system76/launch:levi` +* To flash the firmware, you'll use the same build command, but with `flash` added to the end: + `make system76/launch:default:flash` + - After it builds, you will see a message that says `Detecting USB port, reset your controller now...`. You then want to hit the "RESET" key on the keyboard if it is programmed into the layout. + - In the default layout, it is Fn+Esc. If a RESET key is not programmed into the layout, you will have to manually reset the controller. + +## Making your own layout: +If you want to create your own layout, go to the `keymaps` directory and copy one of the maps in there. You'll probably want to start with the default layout, but the other layouts in there may be helpful references. The name of the directory you create will be the name of your layout. Ensure that it has no spaces or strange symbols, as this could lead to build errors. + +Inside of each layout directory, there is a file called `keymap.c`, which is what you will be customizing to create your own keymap. The commented out grid area in this file is a reference for the actual key assignments below it. When I am modifying a layout, I first update this grid. It helps me keep track of where I want everything. It does not matter what you label the keys in this grid since it is in a comment. Just try to keep it understandable for yourself and everyone else. + +The keycodes below that do have to be typed correctly. A full list of keycodes can be found here: https://beta.docs.qmk.fm/reference/keycodes . Use the shorter keycode alias to help keep these lined up (e.g. use `KC_ESC` instead of `KC_ESCAPE`). + diff --git a/keyboards/system76/launch_test/config.h b/keyboards/system76/launch_test/config.h new file mode 100644 index 000000000000..efc868a04d2f --- /dev/null +++ b/keyboards/system76/launch_test/config.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "config_common.h" + +// key matrix size +#define MATRIX_ROWS 2 +#define MATRIX_COLS 11 + +/* + * Key matrix pins + * ROWS: AVR pins used for rows, top to bottom + * COLS: AVR pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { F0, F1 } +#define MATRIX_COL_PINS { C6, B6, B5, B4, D7, D6, D4, D5, D3, D2, B7 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +// Set 0 if debouncing isn't needed +#define DEBOUNCE 5 + +#ifdef RGB_MATRIX_ENABLE +# define RGB_DI_PIN E6 +# define RGB_MATRIX_LED_COUNT 22 +# define RGB_MATRIX_KEYPRESSES // Reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // Reacts to keyreleases (instead of keypresses) +// # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enables framebuffer effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Turns off effects when suspended +// Limit brightness to support USB-A at 0.5 A +// TODO: Do this dynamically based on power source +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 176 // Limits maximum brightness of LEDs to 176 out of 255. If not defined, maximum brightness is set to 255 +# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Sets the default mode, if none has been set +# define RGB_MATRIX_DEFAULT_HUE 142 // Sets the default hue value, if none has been set +# define RGB_MATRIX_DEFAULT_SAT 255 // Sets the default saturation value, if none has been set +# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set +# define RGB_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set +# define RGB_MATRIX_DISABLE_KEYCODES // Disables control of rgb matrix by keycodes (must use code functions to control the feature) + +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +#endif // RGB_MATRIX_ENABLE + +// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// Dynamic keyboard support { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 + +// EEPROM usage +#define EEPROM_SIZE 1024 + +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x01 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) + +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +#define DYNAMIC_KEYMAP_EEPROM_SIZE (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2) +// Dynamic macro starts after dynamic keymaps +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + DYNAMIC_KEYMAP_EEPROM_SIZE) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE (EEPROM_SIZE - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR) +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 +// } Dynamic keyboard support diff --git a/keyboards/system76/launch_test/info.json b/keyboards/system76/launch_test/info.json new file mode 100644 index 000000000000..508d60bd73e0 --- /dev/null +++ b/keyboards/system76/launch_test/info.json @@ -0,0 +1,9 @@ +{ + "keyboard_name": "Launch Test (launch_test)", + "manufacturer": "System76", + "usb": { + "vid": "0x3384", + "pid": "0x0001", + "device_version": "0.0.1" + } +} diff --git a/keyboards/system76/launch_test/keymaps/default/keymap.c b/keyboards/system76/launch_test/keymaps/default/keymap.c new file mode 100644 index 000000000000..ea86ce4fd636 --- /dev/null +++ b/keyboards/system76/launch_test/keymaps/default/keymap.c @@ -0,0 +1,12 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + RGB_TOG, RGB_RMOD, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, RGB_M_P, QK_BOOT, + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0 + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/launch_test/launch_test.c b/keyboards/system76/launch_test/launch_test.c new file mode 100644 index 000000000000..eb954ba03392 --- /dev/null +++ b/keyboards/system76/launch_test/launch_test.c @@ -0,0 +1,132 @@ +#include "dynamic_keymap.h" +#include "raw_hid.h" +#include "version.h" + +#include "launch_test.h" + +enum Command { + // Probe for System76 EC protocol + CMD_PROBE = 1, + // Read board string + CMD_BOARD = 2, + // Read version string + CMD_VERSION = 3, + // Get keyboard map index + CMD_KEYMAP_GET = 9, + // Set keyboard map index + CMD_KEYMAP_SET = 10, +}; + +static bool keymap_get(uint8_t layer, uint8_t output, uint8_t input, uint16_t *value) { + if (layer < dynamic_keymap_get_layer_count()) { + if (output < MATRIX_ROWS) { + if (input < MATRIX_COLS) { + *value = dynamic_keymap_get_keycode(layer, output, input); + return true; + } + } + } + return false; +} + +static bool keymap_set(uint8_t layer, uint8_t output, uint8_t input, uint16_t value) { + if (layer < dynamic_keymap_get_layer_count()) { + if (output < MATRIX_ROWS) { + if (input < MATRIX_COLS) { + dynamic_keymap_set_keycode(layer, output, input, value); + return true; + } + } + } + return false; +} + +void raw_hid_receive(uint8_t *data, uint8_t length) { + // Error response by default, set to success by commands + data[1] = 1; + + switch (data[0]) { + case CMD_PROBE: + // Signature + data[2] = 0x76; + data[3] = 0xEC; + // Version + data[4] = 0x01; + data[1] = 0; + break; + case CMD_BOARD: + strncpy((char *)&data[2], QMK_KEYBOARD, length - 2); + data[1] = 0; + break; + case CMD_VERSION: + strncpy((char *)&data[2], QMK_VERSION, length - 2); + data[1] = 0; + break; + case CMD_KEYMAP_GET: + { + uint16_t value = 0; + if (keymap_get(data[2], data[3], data[4], &value)) { + data[5] = (uint8_t)value; + data[6] = (uint8_t)(value >> 8); + data[1] = 0; + } + } + break; + case CMD_KEYMAP_SET: + { + uint16_t value = + ((uint16_t)data[5]) | + (((uint16_t)data[6]) << 8); + if (keymap_set(data[2], data[3], data[4], value)) { + data[1] = 0; + } + } + } + + raw_hid_send(data, length); +} + +bool eeprom_is_valid(void) { + return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION); +} + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void eeprom_reset(void) { + // Set the keyboard specific EEPROM state as invalid. + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid. + eeconfig_disable(); +} + +void bootmagic_lite(void) { + // The lite version of TMK's bootmagic. + // 100% less potential for accidentally making the + // keyboard do stupid things. + + // We need multiple scans because debouncing can't be turned off. + matrix_scan(); + wait_ms(DEBOUNCE); + wait_ms(DEBOUNCE); + matrix_scan(); + + // If the Esc (matrix 0,0) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + if ( matrix_get_row(0) & (1<<0) ) { + eeprom_reset(); + bootloader_jump(); + } +} + +void matrix_init_kb(void) { + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + eeprom_set_valid(true); + } +} diff --git a/keyboards/system76/launch_test/launch_test.h b/keyboards/system76/launch_test/launch_test.h new file mode 100644 index 000000000000..bf57051630ea --- /dev/null +++ b/keyboards/system76/launch_test/launch_test.h @@ -0,0 +1,16 @@ +#ifndef LAUNCH_TEST_H +#define LAUNCH_TEST_H + +#include "quantum.h" + +#define ___ KC_NO + +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A } \ +} + +#endif // LAUNCH_TEST_H diff --git a/keyboards/system76/launch_test/rules.mk b/keyboards/system76/launch_test/rules.mk new file mode 100644 index 000000000000..ae6fd7b8b434 --- /dev/null +++ b/keyboards/system76/launch_test/rules.mk @@ -0,0 +1,30 @@ +# MCU name +MCU = atmega32u4 + +# Processor frequency +F_CPU = 16000000 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = atmel-dfu + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RAW_ENABLE = yes # Enable RAW HID commands (used by keyboard configurator) +RGBLIGHT_ENABLE = no # Support for RGB backlight +RGB_MATRIX_ENABLE = yes # RGB matrix +RGB_MATRIX_DRIVER = WS2812 diff --git a/keyboards/system76/ortho_split_2u/config.h b/keyboards/system76/ortho_split_2u/config.h new file mode 100644 index 000000000000..b036bc067ff0 --- /dev/null +++ b/keyboards/system76/ortho_split_2u/config.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "config_common.h" + +// key matrix size +#define MATRIX_ROWS 12 // 6, but each side is separate +#define MATRIX_COLS 16 + +/* + * Key matrix pins + * ROWS: AVR pins used for rows, top to bottom + * COLS: AVR pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3 } +#define MATRIX_COL_PINS { D1, B5, D4, C6, D7, E6, B4 } +#define MATRIX_ROW_PINS_RIGHT { F4, F5, F6, F7, B1, B3 } +#define MATRIX_COL_PINS_RIGHT { D3, D2, D1, B5, D4, C6, D7, E6, B4 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +// Set 0 if debouncing isn't needed +#define DEBOUNCE 5 + +// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// Settings for split keyboard +#define MASTER_RIGHT // Right half is the master, don't plug USB into left half +#define SOFT_SERIAL_PIN D0 // The halves communicate via serial on pin D0 diff --git a/keyboards/system76/ortho_split_2u/info.json b/keyboards/system76/ortho_split_2u/info.json new file mode 100644 index 000000000000..6dbf1f529e22 --- /dev/null +++ b/keyboards/system76/ortho_split_2u/info.json @@ -0,0 +1,9 @@ +{ + "keyboard_name": "Ortho Split 2U (ortho_split_2u)", + "manufacturer": "System76", + "usb": { + "vid": "0x3384", + "pid": "0x0001", + "device_version": "0.0.1" + } +} diff --git a/keyboards/system76/ortho_split_2u/keymaps/default/keymap.c b/keyboards/system76/ortho_split_2u/keymaps/default/keymap.c new file mode 100644 index 000000000000..261c80b7b9f9 --- /dev/null +++ b/keyboards/system76/ortho_split_2u/keymaps/default/keymap.c @@ -0,0 +1,58 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ Esc │ F1 │ F2 │ F3 │ F4 │ F5 │ F6 ││ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │PrtSc│ Del │ Ins │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤ + * │ ` ~ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 ││ 7 │ 8 │ 9 │ 0 │ - _ │ = + │ Backspace │ Home│ + * ├─────┴─────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┬─────┼─────┤ + * │ Tab │ Q │ W │ E │ R │ T ││ Y │ U │ I │ O │ P │ [ { │ ] } │ \ | │ PgUp│ + * ├───────────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤ + * │ Caps Lock │ A │ S │ D │ F │ G ││ H │ J │ K │ L │ ; : │ ' " │ Enter │ PgDn│ + * ├───────────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┴─────┬─────┼─────┤ + * │ Shift │ Z │ X │ C │ V │ B ││ N │ M │ , < │ . > │ / ? │ Shift │ Up │ End │ + * ├───────────┼─────┼─────┼─────┼─────┴─────┤├─────┴─────┼─────┼─────┼─────┴─────┬─────┼─────┼─────┤ + * │ Ctrl │ Fn │ Alt │Super│ Space ││ Space │ Alt │ Fn │ Ctrl │ Left│ Down│Right│ + * └───────────┴─────┴─────┴─────┴───────────┘└───────────┴─────┴─────┴───────────┴─────┴─────┴─────┘ + */ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_DEL, KC_INS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ │ │ │ │ │ │ ││ │ │ │ │ │ │ │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤ + * │ │ │ │ │ │ │ ││ │ │ │ │ │ │ │ │ + * ├─────┴─────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┬─────┼─────┤ + * │ │ │ │ │ │ ││ │ │ │ │ │ │ │ │ │ + * ├───────────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤ + * │ │ │ │ │ │ ││ │ │ │ │ │ │ │ │ + * ├───────────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┴─────┬─────┼─────┤ + * │ │ │ │ │ │ ││ │ │ │ │ │ │ │ │ + * ├───────────┼─────┼─────┼─────┼─────┴─────┤├─────┴─────┼─────┼─────┼─────┴─────┬─────┼─────┼─────┤ + * │ │ │ │ │ ││ │ │ │ │ │ │ │ + * └───────────┴─────┴─────┴─────┴───────────┘└───────────┴─────┴─────┴───────────┴─────┴─────┴─────┘ + */ + + [1] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/ortho_split_2u/keymaps/levi/keymap.c b/keyboards/system76/ortho_split_2u/keymaps/levi/keymap.c new file mode 100644 index 000000000000..59d3fbd0fb63 --- /dev/null +++ b/keyboards/system76/ortho_split_2u/keymaps/levi/keymap.c @@ -0,0 +1,58 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │ Esc │ F1 │ F2 │ F3 │ F4 │ F5 │ F6 ││ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │PrtSc│ Del │ Ins │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤ + * │ ` ~ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 ││ 7 │ 8 │ 9 │ 0 │ - _ │ = + │ Backspace │ Home│ + * ├─────┴─────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┬─────┼─────┤ + * │ Tab │ Q │ W │ E │ R │ T ││ Y │ U │ I │ O │ P │ [ { │ ] } │ \ | │ PgUp│ + * ├───────────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤ + * │ Caps Lock │ A │ S │ D │ F │ G ││ H │ J │ K │ L │ ; : │ ' " │ Enter │ PgDn│ + * ├───────────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┴─────┬─────┼─────┤ + * │ Shift │ Z │ X │ C │ V │ B ││ N │ M │ , < │ . > │ / ? │ Shift │ Up │ End │ + * ├───────────┼─────┼─────┼─────┼─────┴─────┤├─────┴─────┼─────┼─────┼─────┴─────┬─────┼─────┼─────┤ + * │ Ctrl │ Fn │ Alt │Super│ Space ││ Fn │BkSpc│ Alt │ Ctrl │ Left│ Down│Right│ + * └───────────┴─────┴─────┴─────┴───────────┘└───────────┴─────┴─────┴───────────┴─────┴─────┴─────┘ + */ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_DEL, KC_INS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, MO(1), KC_LALT, KC_LGUI, KC_SPC, MO(1), KC_BSPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer + * ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐ + * │RESET│ │ │ │ │ │ ││ │ │ │ │ │ │ │ │ │ + * ├─────┼─────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤ + * │ │ │ │ │ │ │ ││ │ │ │ │ │ │ │ │ + * ├─────┴─────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┬─────┼─────┤ + * │ │Home │ Up │End │PgUp │Mute ││PgUp │Home │ Up │End │ │ │ │ │ │ + * ├───────────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤ + * │ │Left │Down │Right│PgDn │VolU ││PgDn │Left │Down │Right│ │ │ │ │ + * ├───────────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼─────┼─────┼─────┼─────┴─────┬─────┼─────┤ + * │ │ │ │ │ │VolD ││MPly │MPrv │MNxt │ │ │ │ │ │ + * ├───────────┼─────┼─────┼─────┼─────┴─────┤├─────┴─────┼─────┼─────┼─────┴─────┬─────┼─────┼─────┤ + * │ │ │ │ │ Backspace ││ │ │ │ │ │ │ │ + * └───────────┴─────┴─────┴─────┴───────────┘└───────────┴─────┴─────┴───────────┴─────┴─────┴─────┘ + */ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_MUTE, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_VOLU, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_MPLY, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/ortho_split_2u/ortho_split_2u.c b/keyboards/system76/ortho_split_2u/ortho_split_2u.c new file mode 100644 index 000000000000..56fb53b5f8a2 --- /dev/null +++ b/keyboards/system76/ortho_split_2u/ortho_split_2u.c @@ -0,0 +1,9 @@ +#include "ortho_split_2u.h" + +void keyboard_post_init_user(void) { + // Customise these values to desired behaviour + debug_enable=true; + debug_matrix=true; + debug_keyboard=true; + //debug_mouse=true; +} diff --git a/keyboards/system76/ortho_split_2u/ortho_split_2u.h b/keyboards/system76/ortho_split_2u/ortho_split_2u.h new file mode 100644 index 000000000000..2de6f34c0869 --- /dev/null +++ b/keyboards/system76/ortho_split_2u/ortho_split_2u.h @@ -0,0 +1,31 @@ +#ifndef ORTHO_SPLIT_2U_H +#define ORTHO_SPLIT_2U_H + +#include "quantum.h" + +#define ___ KC_NO + +#define LAYOUT( \ + LA1, LA2, LA3, LA4, LA5, LA6, LA7, RA1, RA2, RA3, RA4, RA5, RA6, RA7, RA8, RA9, \ + LB1, LB2, LB3, LB4, LB5, LB6, LB7, RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB9, \ + LC2, LC3, LC4, LC5, LC6, LC7, RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, RC9, \ + LD2, LD3, LD4, LD5, LD6, LD7, RD1, RD2, RD3, RD4, RD5, RD6, RD7, RD9, \ + LE2, LE3, LE4, LE5, LE6, LE7, RE1, RE2, RE3, RE4, RE5, RE6, RE8, RE9, \ + LF2, LF3, LF4, LF5, LF7, RF1, RF3, RF4, RF5, RF7, RF8, RF9 \ + ) \ + { \ + { LA1, LA2, LA3, LA4, LA5, LA6, LA7 }, \ + { LB1, LB2, LB3, LB4, LB5, LB6, LB7 }, \ + { ___, LC2, LC3, LC4, LC5, LC6, LC7 }, \ + { ___, LD2, LD3, LD4, LD5, LD6, LD7 }, \ + { ___, LE2, LE3, LE4, LE5, LE6, LE7 }, \ + { ___, LF2, LF3, LF4, LF5, ___, LF7 }, \ + { RA1, RA2, RA3, RA4, RA5, RA6, RA7, RA8, RA9 }, \ + { RB1, RB2, RB3, RB4, RB5, RB6, RB7, ___, RB9 }, \ + { RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, RC9 }, \ + { RD1, RD2, RD3, RD4, RD5, RD6, RD7, ___, RD9 }, \ + { RE1, RE2, RE3, RE4, RE5, RE6, ___, RE8, RE9 }, \ + { RF1, ___, RF3, RF4, RF5, ___, RF7, RF8, RF9 } \ + } + +#endif // ORTHO_SPLIT_2U_H diff --git a/keyboards/system76/ortho_split_2u/rules.mk b/keyboards/system76/ortho_split_2u/rules.mk new file mode 100644 index 000000000000..a2f7b1f70cb6 --- /dev/null +++ b/keyboards/system76/ortho_split_2u/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = caterina + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +SPLIT_KEYBOARD = yes # Enables split keyboard diff --git a/keyboards/system76/system76_ec.c b/keyboards/system76/system76_ec.c index 63016590723f..0f80d78897bc 100644 --- a/keyboards/system76/system76_ec.c +++ b/keyboards/system76/system76_ec.c @@ -19,6 +19,7 @@ #include #include "dynamic_keymap.h" +#include "eeprom.h" #include "raw_hid.h" #include "rgb_matrix.h" #include "version.h" @@ -185,9 +186,9 @@ rgb_config_t layer_rgb[DYNAMIC_KEYMAP_LAYER_COUNT] = { // clang-format on // Read or write EEPROM data with checks for being inside System76 EC region. -static bool system76_ec_eeprom_op(void *buf, uint16_t size, uint16_t offset, bool write) { - uint16_t addr = SYSTEM76_EC_EEPROM_ADDR + offset; - uint16_t end = addr + size; +static bool system76_ec_eeprom_op(void *buf, size_t size, size_t offset, bool write) { + size_t addr = SYSTEM76_EC_EEPROM_ADDR + offset; + size_t end = addr + size; // Check for overflow and zero size if ((end > addr) && (addr >= SYSTEM76_EC_EEPROM_ADDR) && (end <= (SYSTEM76_EC_EEPROM_ADDR + SYSTEM76_EC_EEPROM_SIZE))) { if (write) { diff --git a/keyboards/system76/virgo/config.h b/keyboards/system76/virgo/config.h new file mode 100644 index 000000000000..bd18d5c430d2 --- /dev/null +++ b/keyboards/system76/virgo/config.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "config_common.h" + +// key matrix size +#define MATRIX_ROWS 6 +#define MATRIX_COLS 15 + +/* + * Key matrix pins + * ROWS: AVR pins used for rows, top to bottom + * COLS: AVR pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { F7, F6, F5, F4, F1, F0 } +#define MATRIX_COL_PINS { B2, B0, D3, D2, D1, D0, D4, C6, D7, E6, B4, B5, B6, B7, D6 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +// Set 0 if debouncing isn't needed +#define DEBOUNCE 5 + +// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE diff --git a/keyboards/system76/virgo/info.json b/keyboards/system76/virgo/info.json new file mode 100644 index 000000000000..bb723780c60b --- /dev/null +++ b/keyboards/system76/virgo/info.json @@ -0,0 +1,9 @@ +{ + "keyboard_name": "Virgo (virgo)", + "manufacturer": "System76", + "usb": { + "vid": "0x3384", + "pid": "0x0001", + "device_version": "0.0.1" + } +} diff --git a/keyboards/system76/virgo/keymaps/default/keymap.c b/keyboards/system76/virgo/keymaps/default/keymap.c new file mode 100644 index 000000000000..15c7d66756dd --- /dev/null +++ b/keyboards/system76/virgo/keymaps/default/keymap.c @@ -0,0 +1,71 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL | POWER | +|________|________|________|________|________|________|________|________|________|________|________|________|________|________|________| +| | | | | | | | | | | | | | BACK | PLAY / | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | SPACE | PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | [ | ] | | + | TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | + |________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |________|________|________|________|________|________|________|________|________|________|________|________|________|____ + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | | + | CTRL | FN | LALT | LGUI | SPACE | SPACE | FN | RALT | RCTRL | | LEFT | DOWN | RIGHT | + |________|________|_______|________|_________________|_________________|________|________|________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_PWR, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MPLY, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_SPC, MO(1), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT + ), + + /* Layer 1, function layer +________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|________|________| +| | | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | | + | | | | | | | | | | | | | | | + |________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | | + |________|________|________|________|________|________|________|________|________|________|________|________|________|____ + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | + ____|________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | | + | | | | | | | | | | | HOME | PGDN | END | + |________|________|_______|________|_________________|_________________|________|________|________| |________|________|________| + +*/ + + [1] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/virgo/keymaps/jeremy/keymap.c b/keyboards/system76/virgo/keymaps/jeremy/keymap.c new file mode 100644 index 000000000000..5a67ba4b18b2 --- /dev/null +++ b/keyboards/system76/virgo/keymaps/jeremy/keymap.c @@ -0,0 +1,71 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DEL | POWER | +|________|________|________|________|________|________|________|________|________|________|________|________|________|________|________| +| | | | | | | | | | | | | | BACK | PLAY / | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | SPACE | PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | [ | ] | | + | TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ | + |________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | ; | ' | | + | FN | A | S | D | F | G | H | J | K | L | : | " | ENTER | + |________|________|________|________|________|________|________|________|________|________|________|________|________|____ + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + ____|________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | BACK | | | | | | | | + | CTRL | FN | LALT | LGUI | SPACE | SPACE | ESC | RALT | RCTRL | | LEFT | DOWN | RIGHT | + |________|________|_______|________|_________________|_________________|________|________|________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_PWR, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_MPLY, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, MO(1), KC_LALT, KC_LGUI, KC_SPC, KC_BSPC, KC_ESC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +________________________________________________________________________________________________________________________________________ +| | | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|________|________| +| | | | | | | | | | | | | | | | +| | | | | | | | | | | | | | | | +|________|________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | | | | | + | | | | | | | | PGUP | HOME | PGDN | | | | | + |________|________|________|________|________|________|________|________|________|________|________|________|________|________| + | | | | | | | | | | | BACK | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | SPACE | DEL | | + |________|________|________|________|________|________|________|________|________|________|________|________|________|____ + | | | | | | | | | | | | | | + | | | | | | | END | | | | | | PGUP | + ____|________|________|________|________|________|________|________|________|________|________|________|________|________|_________ + | | | | | | | | | | | | | | + | | | | | | | | | | | HOME | PGDN | END | + |________|________|_______|________|_________________|_________________|________|________|________| |________|________|________| + +*/ + + [1] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_HOME, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_BSPC, KC_DEL, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/virgo/rules.mk b/keyboards/system76/virgo/rules.mk new file mode 100644 index 000000000000..02a94584a364 --- /dev/null +++ b/keyboards/system76/virgo/rules.mk @@ -0,0 +1,22 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = atmel-dfu + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work diff --git a/keyboards/system76/virgo/virgo.c b/keyboards/system76/virgo/virgo.c new file mode 100644 index 000000000000..1bb7b19599c6 --- /dev/null +++ b/keyboards/system76/virgo/virgo.c @@ -0,0 +1,9 @@ +#include "virgo.h" + +void keyboard_post_init_user(void) { + // Customise these values to desired behaviour + debug_enable=true; + debug_matrix=true; + debug_keyboard=true; + //debug_mouse=true; +} diff --git a/keyboards/system76/virgo/virgo.h b/keyboards/system76/virgo/virgo.h new file mode 100644 index 000000000000..d793e01119eb --- /dev/null +++ b/keyboards/system76/virgo/virgo.h @@ -0,0 +1,24 @@ +#ifndef VIRGO_H +#define VIRGO_H + +#include "quantum.h" + +#define ___ KC_NO + +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, \ + K50, K51, K52, K53, K54, K56, K57, K58, K59, K5B, K5C, K5D \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, ___ }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, ___, ___ }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, ___, ___ }, \ + { K50, K51, K52, K53, K54, ___, K56, K57, K58, K59, ___, K5B, K5C, K5D, ___ }, \ +} + +#endif // VIRGO_H diff --git a/keyboards/system76/virgo_keyboard_test_1/config.h b/keyboards/system76/virgo_keyboard_test_1/config.h new file mode 100644 index 000000000000..8fcbc33dc2e0 --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_1/config.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + + +/* + * Key matrix pins + * ROWS: GPIO pins used for rows, top to bottom + * COLS: GPIO pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { GP24, GP23, GP22, GP21, GP28, GP15 } +#define MATRIX_COL_PINS { GP12, GP11, GP10, GP9, GP8, GP6, GP13, GP14, GP16, GP17, GP18, GP19, GP7, GP25 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +#ifdef RGB_MATRIX_ENABLE +# define RGB_DI_PIN GP5 +# define RGB_MATRIX_LED_COUNT 84 +# define RGB_MATRIX_KEYPRESSES // Reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // Reacts to keyreleases (instead of keypresses) +// # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enables framebuffer effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Turns off effects when suspended +// Limit brightness to support USB-A at 0.5 A +// TODO: Do this dynamically based on power source +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 176 // Limits maximum brightness of LEDs to 176 out of 255. If not defined, maximum brightness is set to 255 +# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Sets the default mode, if none has been set +# define RGB_MATRIX_DEFAULT_HUE 142 // Sets the default hue value, if none has been set +# define RGB_MATRIX_DEFAULT_SAT 255 // Sets the default saturation value, if none has been set +# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set +# define RGB_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set +# define RGB_MATRIX_DISABLE_KEYCODES // Disables control of rgb matrix by keycodes (must use code functions to control the feature) + +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +#endif // RGB_MATRIX_ENABLE + +// Mechanical locking support; use KC_LCAP, KC_LNUM, or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// EEPROM { +#define EEPROM_SIZE 1024 +// TODO: Refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x02 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) +// } EEPROM + +// Dynamic keymap { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 +#define DYNAMIC_KEYMAP_MACRO_COUNT 0 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +// Dynamic macro starts after dynamic keymaps, it is disabled +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2)) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 0 +// } Dynamic keymap + +// System76 EC { +#define SYSTEM76_EC_EEPROM_ADDR (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE) +#define SYSTEM76_EC_EEPROM_SIZE (EEPROM_SIZE - SYSTEM76_EC_EEPROM_ADDR) +// } System76 EC diff --git a/keyboards/system76/virgo_keyboard_test_1/info.json b/keyboards/system76/virgo_keyboard_test_1/info.json new file mode 100644 index 000000000000..bc1f99cd5476 --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_1/info.json @@ -0,0 +1,101 @@ +{ + "keyboard_name": "Virgo Keyboard Test 1", + "manufacturer": "System76", + "usb": { + "vid": "0x3384", + "pid": "0x0008", + "device_version": "0.0.1" + }, + "processor": "RP2040", + "bootloader": "rp2040", + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "Esc", "x": 0, "y": 0 }, + { "label": "F1", "x": 1, "y": 0 }, + { "label": "F2", "x": 2, "y": 0 }, + { "label": "F3", "x": 3, "y": 0 }, + { "label": "F4", "x": 4, "y": 0 }, + { "label": "F5", "x": 5, "y": 0 }, + { "label": "F6", "x": 6, "y": 0 }, + { "label": "F7", "x": 7, "y": 0 }, + { "label": "F8", "x": 8, "y": 0 }, + { "label": "F9", "x": 9, "y": 0 }, + { "label": "F10", "x": 10, "y": 0 }, + { "label": "F11", "x": 11, "y": 0 }, + { "label": "F12", "x": 12, "y": 0 }, + { "label": "Del", "x": 13, "y": 0, "w": 1.5 }, + { "label": "Home", "x": 14.75, "y": 0 }, + { "label": "`", "x": 0, "y": 1 }, + { "label": "1", "x": 1, "y": 1 }, + { "label": "2", "x": 2, "y": 1 }, + { "label": "3", "x": 3, "y": 1 }, + { "label": "4", "x": 4, "y": 1 }, + { "label": "5", "x": 5, "y": 1 }, + { "label": "6", "x": 6, "y": 1 }, + { "label": "7", "x": 7, "y": 1 }, + { "label": "8", "x": 8, "y": 1 }, + { "label": "9", "x": 9, "y": 1 }, + { "label": "0", "x": 10, "y": 1 }, + { "label": "-", "x": 11, "y": 1 }, + { "label": "=", "x": 12, "y": 1 }, + { "label": "Bksp", "x": 13, "y": 1, "w": 1.5 }, + { "label": "PgUp", "x": 14.75, "y": 1 }, + { "label": "Tab", "x": 0, "y": 2, "w": 1.5 }, + { "label": "Q", "x": 1.5, "y": 2 }, + { "label": "W", "x": 2.5, "y": 2 }, + { "label": "E", "x": 3.5, "y": 2 }, + { "label": "R", "x": 4.5, "y": 2 }, + { "label": "T", "x": 5.5, "y": 2 }, + { "label": "Y", "x": 6.5, "y": 2 }, + { "label": "U", "x": 7.5, "y": 2 }, + { "label": "I", "x": 8.5, "y": 2 }, + { "label": "O", "x": 9.5, "y": 2 }, + { "label": "P", "x": 10.5, "y": 2 }, + { "label": "[", "x": 11.5, "y": 2 }, + { "label": "]", "x": 12.5, "y": 2 }, + { "label": "\\", "x": 13.5, "y": 2 }, + { "label": "PgDn", "x": 14.75, "y": 2 }, + { "label": "Caps", "x": 0.25, "y": 3, "w": 1.5 }, + { "label": "A", "x": 1.75, "y": 3 }, + { "label": "S", "x": 2.75, "y": 3 }, + { "label": "D", "x": 3.75, "y": 3 }, + { "label": "F", "x": 4.75, "y": 3 }, + { "label": "G", "x": 5.75, "y": 3 }, + { "label": "H", "x": 6.75, "y": 3 }, + { "label": "J", "x": 7.75, "y": 3 }, + { "label": "K", "x": 8.75, "y": 3 }, + { "label": "L", "x": 9.75, "y": 3 }, + { "label": ";", "x": 10.75, "y": 3 }, + { "label": "'", "x": 11.75, "y": 3 }, + { "label": "Enter", "x": 12.75, "y": 3, "w": 1.5 }, + { "label": "End", "x": 14.75, "y": 3 }, + { "label": "LShift", "x": 0.25, "y": 4, "w": 2 }, + { "label": "Z", "x": 2.25, "y": 4 }, + { "label": "X", "x": 3.25, "y": 4 }, + { "label": "C", "x": 4.25, "y": 4 }, + { "label": "V", "x": 5.25, "y": 4 }, + { "label": "B", "x": 6.25, "y": 4 }, + { "label": "N", "x": 7.25, "y": 4 }, + { "label": "M", "x": 8.25, "y": 4 }, + { "label": ",", "x": 9.25, "y": 4 }, + { "label": ".", "x": 10.25, "y": 4 }, + { "label": "/", "x": 11.25, "y": 4 }, + { "label": "RShift", "x": 12.25, "y": 4, "w": 1.5 }, + { "label": "Up", "x": 13.75, "y": 4 }, + { "label": "LCtrl", "x": 0.25, "y": 5, "w": 1.5 }, + { "label": "LAlt", "x": 1.75, "y": 5 }, + { "label": "LFn", "x": 2.75, "y": 5 }, + { "label": "Super", "x": 3.75, "y": 5 }, + { "label": "Space", "x": 4.75, "y": 5, "w": 2 }, + { "label": "Space", "x": 6.75, "y": 5, "w": 2 }, + { "label": "RCtrl", "x": 8.75, "y": 5 }, + { "label": "RAlt", "x": 9.75, "y": 5 }, + { "label": "RFn", "x": 10.75, "y": 5, "w": 1.5 }, + { "label": "Left", "x": 12.75, "y": 5 }, + { "label": "Down", "x": 13.75, "y": 5 }, + { "label": "Right", "x": 14.75, "y": 5 } + ] + } + } +} diff --git a/keyboards/system76/virgo_keyboard_test_1/keymaps/default/keymap.c b/keyboards/system76/virgo_keyboard_test_1/keymaps/default/keymap.c new file mode 100644 index 000000000000..3efec2d1df4e --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_1/keymaps/default/keymap.c @@ -0,0 +1,91 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | CTRL | LALT | FN | LGUI | SPACE | SPACE | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LALT, MO(1), KC_LGUI, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || PLAY/ | +| QK_BOOT | | | | | | | | | | | | | || PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | LED | LED | LED | || VOLUME | +| | | | | | | | | | | TOGGLE | DOWN | UP | || UP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || VOLUME | +|PRINT SCREEN| | | | | | HOME | PGDN | PGUP | END | | | | || DOWN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | | | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | | | | | MUTE | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'QK_BOOT' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_TRNS, KC_VOLU, + KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + + [2] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/virgo_keyboard_test_1/post_rules.mk b/keyboards/system76/virgo_keyboard_test_1/post_rules.mk new file mode 100644 index 000000000000..3751a8b8c31b --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_1/post_rules.mk @@ -0,0 +1,12 @@ +# System76 EC +# remove the RESET HID command +VALID_SYSTEM76_EC_TYPES := yes +SYSTEM76_EC_ENABLE ?= no +ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + ifeq ($(filter $(SYSTEM76_EC_ENABLE),$(VALID_SYSTEM76_EC_TYPES)),) + $(error SYSTEM76_EC_EN="$(strip $(SYSTEM76_EC_ENABLE))" is not a valid type for the System76 EC option) + endif + ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + OPT_DEFS += -DSYSTEM76_EC + endif +endif diff --git a/keyboards/system76/virgo_keyboard_test_1/readme.md b/keyboards/system76/virgo_keyboard_test_1/readme.md new file mode 100644 index 000000000000..f1d48b49f90d --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_1/readme.md @@ -0,0 +1 @@ +# Virgo Keyboard Test 1 diff --git a/keyboards/system76/virgo_keyboard_test_1/rgb_matrix_kb.inc b/keyboards/system76/virgo_keyboard_test_1/rgb_matrix_kb.inc new file mode 100644 index 000000000000..02de10ed500e --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_1/rgb_matrix_kb.inc @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +RGB_MATRIX_EFFECT(active_keys) +RGB_MATRIX_EFFECT(raw_rgb) +RGB_MATRIX_EFFECT(unlocked) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "dynamic_keymap.h" + +static bool active_keys_initialized = false; +static uint8_t active_keys_table[RGB_MATRIX_LED_COUNT] = {0}; + +static void active_keys_initialize(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + uint8_t led = g_led_config.matrix_co[row][col]; + if (led < RGB_MATRIX_LED_COUNT && row < 16 && col < 16) { + active_keys_table[led] = (row << 4) | col; + } + } + } + active_keys_initialized = true; +} + +static bool active_keys(effect_params_t* params) { + if (!active_keys_initialized) { + active_keys_initialize(); + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + uint8_t layer = get_highest_layer(layer_state); + RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + uint8_t rowcol = active_keys_table[i]; + uint8_t row = rowcol >> 4; + uint8_t col = rowcol & 0xF; + uint16_t keycode = dynamic_keymap_get_keycode(layer, row, col); + switch (keycode) { + case KC_NO: + case KC_TRNS: + rgb_matrix_set_color(i, 0, 0, 0); + break; + default: + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + break; + } + } + + return led_max < RGB_MATRIX_LED_COUNT; +} + +RGB raw_rgb_data[RGB_MATRIX_LED_COUNT] = {0}; + +static uint8_t normalize_component(uint8_t component) { + uint16_t x = (uint16_t)component; + x *= rgb_matrix_config.hsv.v; // Multiply by current brightness + x /= 255; // Divide by maximum brightness + return (uint8_t)x; +} + +static RGB normalize_index(uint8_t i) { + RGB raw = raw_rgb_data[i]; + RGB rgb = { + .r = normalize_component(raw.r), + .g = normalize_component(raw.g), + .b = normalize_component(raw.b), + }; + return rgb; +} + +static bool raw_rgb(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = normalize_index(i); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +static uint8_t unlocked_keys[8][2] = { + {2, 7}, // U + {4, 6}, // N + {3, 9}, // L + {2, 9}, // O + {4, 3}, // C + {3, 8}, // K + {2, 3}, // E + {3, 3}, // D +}; + +static uint8_t unlocked_ticks = 0; +static uint8_t unlocked_i = 0; +static uint8_t unlocked_leds_count = 0; +static uint8_t unlocked_leds[2] = {0, 0}; + +static bool unlocked(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + unlocked_ticks++; + + if (params->init) { + unlocked_ticks = 0; + unlocked_i = 0; + } + + if (unlocked_ticks == 0) { + if (unlocked_i == 8) { + unlocked_leds_count = 0; + unlocked_i = 0; + } else { + unlocked_leds_count = rgb_matrix_map_row_column_to_led(unlocked_keys[unlocked_i][0], unlocked_keys[unlocked_i][1], unlocked_leds); + unlocked_i++; + } + } + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv = { + .h = i + unlocked_ticks, + .s = 0xFF, + .v = 0x70, + }; + for (uint8_t j = 0; j < unlocked_leds_count; j++) { + if (i == unlocked_leds[j]) { + hsv.s = 0; + hsv.v = 0xFF; + } + } + + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/system76/virgo_keyboard_test_1/rules.mk b/keyboards/system76/virgo_keyboard_test_1/rules.mk new file mode 100644 index 000000000000..ddace91b9613 --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_1/rules.mk @@ -0,0 +1,23 @@ +# Build options +# change yes to no to disable +BOOTMAGIC_ENABLE = no # Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and system control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +EEPROM_DRIVER = wear_leveling +WEAR_LEVELING_DRIVER = rp2040_flash +NKRO_ENABLE = yes # USB N-key rollover +RAW_ENABLE = yes # Raw HID commands (used by Keyboard Configurator) +BACKLIGHT_ENABLE = no # RGB backlight (conflicts with RGB matrix) +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = yes # RGB matrix +RGB_MATRIX_DRIVER = WS2812 +WS2812_DRIVER = vendor +RGB_MATRIX_CUSTOM_KB = yes # Custom keyboard effects +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes # Link-time optimization for smaller binary + +# Add System76 EC command interface +SRC += system76_ec.c diff --git a/keyboards/system76/virgo_keyboard_test_1/virgo_keyboard_test_1.c b/keyboards/system76/virgo_keyboard_test_1/virgo_keyboard_test_1.c new file mode 100644 index 000000000000..d25fde602a8c --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_1/virgo_keyboard_test_1.c @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "virgo_keyboard_test_1.h" +#include "eeprom.h" + +// clang-format off +#ifdef RGB_MATRIX_ENABLE +// LEDs by index +// 0 1 2 3 4 5 6 7 8 9 +// 00 LM4 LL4 LK4 LJ4 LI4 LH4 LG4 LF4 LE4 LD4 +// 10 LC4 LB4 LA4 LA5 LB5 LC5 LD5 LE5 LG5 LH5 +// 20 LI5 LJ5 LK5 LL5 LM5 LO3 LM3 LL3 LK3 LJ3 +// 30 LI3 LH3 LG3 LF3 LE3 LD3 LC3 LB3 LA3 LA2 +// 40 LB2 LC2 LD2 LE2 LF2 LG2 LH2 LI2 LJ2 LK2 +// 50 LL2 LM2 LN2 LO2 LO1 LN1 LM1 LL1 LK1 LJ1 +// 60 LI1 LH1 LG1 LF1 LE1 LD1 LC1 LB1 LA1 LA0 +// 70 LB0 LC0 LD0 LE0 LF0 LG0 LH0 LI0 LJ0 LK0 +// 80 LL0 LM0 LN0 LO0 +led_config_t g_led_config = { { + // Key matrix to LED index +/* A B C D E F G H I J K L M N O */ +/* 0 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, */ +/* 1 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, */ +/* 2 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, */ +/* 3 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, */ +/* 4 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, */ +/* 5 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 */ + { 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82 }, + { 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55 }, + { 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 }, + { 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 83 }, + { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 54 }, + { 13, 14, 15, 16, 17, 25, 18, 19, 20, 21, 22, 23, 24, 53 }, +}, { + // LED index to physical position (see leds.sh in `launch' repo) +/* 00 */ {209, 51}, {190, 51}, {171, 51}, {156, 51}, {140, 51}, {125, 51}, {110, 51}, {95, 51}, {80, 51}, {65, 51}, +/* 10 */ {49, 51}, {34, 51}, {11, 51}, {8, 64}, {27, 64}, {42, 64}, {57, 64}, {80, 64}, {110, 64}, {133, 64}, +/* 20 */ {148, 64}, {167, 64}, {194, 64}, {209, 64}, {224, 64}, {224, 38}, {197, 38}, {178, 38}, {163, 38}, {148, 38}, +/* 30 */ {133, 38}, {118, 38}, {103, 38}, {87, 38}, {72, 38}, {57, 38}, {42, 38}, {27, 38}, {8, 38}, {4, 26}, +/* 40 */ {23, 26}, {38, 26}, {53, 26}, {68, 26}, {84, 26}, {99, 26}, {114, 26}, {129, 26}, {144, 26}, {159, 26}, +/* 50 */ {175, 26}, {190, 26}, {205, 26}, {224, 26}, {224, 13}, {201, 13}, {182, 13}, {167, 13}, {152, 13}, {137, 13}, +/* 60 */ {121, 13}, {106, 13}, {91, 13}, {76, 13}, {61, 13}, {46, 13}, {30, 13}, {15, 13}, {0, 13}, {0, 0}, +/* 70 */ {15, 0}, {30, 0}, {46, 0}, {61, 0}, {76, 0}, {91, 0}, {106, 0}, {121, 0}, {137, 0}, {152, 0}, +/* 80 */ {167, 0}, {182, 0}, {201, 0}, {224, 0} +}, { + // LED index to flags (set all to LED_FLAG_KEYLIGHT) + /* 0 1 2 3 4 5 6 7 8 9 */ +/* 00 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 10 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 20 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 30 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 40 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 50 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 60 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 70 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 80 */ 4, 4, 4, 4 +} }; +#endif // RGB_MATRIX_ENABLE + +bool eeprom_is_valid(void) { + return ( + eeprom_read_word(((void *)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void *)EEPROM_VERSION_ADDR)) == EEPROM_VERSION + ); +} +// clang-format on + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void *)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void *)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void bootmagic_lite_reset_eeprom(void) { + // Set the keyboard-specific EEPROM state as invalid + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid + eeconfig_disable(); +} + +// The lite version of TMK's bootmagic based on Wilba. +// 100% less potential for accidentally making the keyboard do stupid things. +void bootmagic_lite(void) { + // Perform multiple scans because debouncing can't be turned off. + matrix_scan(); +#if defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); +#else + wait_ms(30); +#endif + matrix_scan(); + + // If the configured key (commonly Esc) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + uint8_t row = 0; // BOOTMAGIC_LITE_ROW; + uint8_t col = 0; // BOOTMAGIC_LITE_COLUMN; + + if (matrix_get_row(row) & (1 << col)) { + bootmagic_lite_reset_eeprom(); + + // Jump to bootloader. + bootloader_jump(); + } +} + +void system76_ec_rgb_eeprom(bool write); +void system76_ec_rgb_layer(layer_state_t layer_state); +void system76_ec_unlock(void); +bool system76_ec_is_unlocked(void); + +rgb_config_t layer_rgb[DYNAMIC_KEYMAP_LAYER_COUNT]; + +void matrix_init_kb(void) { + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + system76_ec_rgb_eeprom(true); + eeprom_set_valid(true); + } else { + system76_ec_rgb_eeprom(false); + } + + system76_ec_rgb_layer(layer_state); +} + +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +#define LEVEL(value) (uint8_t)(((uint16_t)value) * ((uint16_t)RGB_MATRIX_MAXIMUM_BRIGHTNESS) / ((uint16_t)255)) + +// clang-format off +static const uint8_t levels[] = { + LEVEL(48), + LEVEL(72), + LEVEL(96), + LEVEL(144), + LEVEL(192), + LEVEL(255) +}; +// clang-format on + +static uint8_t toggle_level = RGB_MATRIX_MAXIMUM_BRIGHTNESS; +extern bool input_disabled; + +static void set_value_all_layers(uint8_t value) { + if (!system76_ec_is_unlocked()) { + for (int8_t layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) { + layer_rgb[layer].hsv.v = value; + } + system76_ec_rgb_layer(layer_state); + } +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (input_disabled) { + return false; + } + + if (!process_record_user(keycode, record)) { + return false; + } + + switch (keycode) { + case QK_BOOT: + if (record->event.pressed) { + system76_ec_unlock(); + } +#ifdef SYSTEM76_EC + return false; +#else + return true; +#endif + case RGB_VAD: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = sizeof(levels) - 1; i >= 0; i--) { + if (levels[i] < level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_VAI: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = 0; i < sizeof(levels); i++) { + if (levels[i] > level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_TOG: + if (record->event.pressed) { + uint8_t level = 0; + if (rgb_matrix_config.hsv.v == 0) { + level = toggle_level; + } else { + toggle_level = rgb_matrix_config.hsv.v; + } + set_value_all_layers(level); + } + return false; + } + + return true; +} + +layer_state_t layer_state_set_kb(layer_state_t layer_state) { + system76_ec_rgb_layer(layer_state); + + return layer_state_set_user(layer_state); +} + +#ifdef CONSOLE_ENABLE +void keyboard_post_init_user(void) { + debug_enable = true; + debug_matrix = false; + debug_keyboard = false; +} +#endif // CONSOLE_ENABLE diff --git a/keyboards/system76/virgo_keyboard_test_1/virgo_keyboard_test_1.h b/keyboards/system76/virgo_keyboard_test_1/virgo_keyboard_test_1.h new file mode 100644 index 000000000000..335b8ecbdf1b --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_1/virgo_keyboard_test_1.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "quantum.h" + +// clang-format off +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K5A, K5B \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K0E }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K1E }, \ + { K50, K51, K52, K53, K54, K3D, K55, K56, K57, K58, K59, K5A, K5B, K2E }, \ +} +// clang-format on diff --git a/keyboards/system76/virgo_keyboard_test_2/config.h b/keyboards/system76/virgo_keyboard_test_2/config.h new file mode 100644 index 000000000000..f01b80ec9d97 --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_2/config.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + + +/* + * Key matrix pins + * ROWS: GPIO pins used for rows, top to bottom + * COLS: GPIO pins used for columns, left to right + */ +#define MATRIX_ROW_PINS { GP10, GP9, GP8, GP7, GP28, GP29 } +#define MATRIX_COL_PINS { GP6, GP4, GP15, GP14, GP13, GP26, GP12, GP11, GP3, GP2, GP1, GP0, GP25, GP27 } + +/* + * Diode Direction + * COL2ROW = COL => Anode (+), ROW => Cathode (-) + * ROW2COL = ROW => Anode (+), COL => Cathode (-) + */ +#define DIODE_DIRECTION COL2ROW + +#ifdef RGB_MATRIX_ENABLE +# define RGB_DI_PIN GP5 +# define RGB_MATRIX_LED_COUNT 84 +# define RGB_MATRIX_KEYPRESSES // Reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // Reacts to keyreleases (instead of keypresses) +// # define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enables framebuffer effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED // Turns off effects when suspended +// Limit brightness to support USB-A at 0.5 A +// TODO: Do this dynamically based on power source +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 176 // Limits maximum brightness of LEDs to 176 out of 255. If not defined, maximum brightness is set to 255 +# define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Sets the default mode, if none has been set +# define RGB_MATRIX_DEFAULT_HUE 142 // Sets the default hue value, if none has been set +# define RGB_MATRIX_DEFAULT_SAT 255 // Sets the default saturation value, if none has been set +# define RGB_MATRIX_DEFAULT_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set +# define RGB_MATRIX_DEFAULT_SPD 127 // Sets the default animation speed, if none has been set +# define RGB_MATRIX_DISABLE_KEYCODES // Disables control of rgb matrix by keycodes (must use code functions to control the feature) + +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +#endif // RGB_MATRIX_ENABLE + +// Mechanical locking support; use KC_LCAP, KC_LNUM, or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// EEPROM { +#define EEPROM_SIZE 1024 +// TODO: Refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x76EC +#define EEPROM_MAGIC_ADDR 64 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x02 +#define EEPROM_VERSION_ADDR (EEPROM_MAGIC_ADDR + 2) +// } EEPROM + +// Dynamic keymap { +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 +#define DYNAMIC_KEYMAP_MACRO_COUNT 0 +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR (EEPROM_VERSION_ADDR + 1) +// Dynamic macro starts after dynamic keymaps, it is disabled +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR (DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2)) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 0 +// } Dynamic keymap + +// System76 EC { +#define SYSTEM76_EC_EEPROM_ADDR (DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE) +#define SYSTEM76_EC_EEPROM_SIZE (EEPROM_SIZE - SYSTEM76_EC_EEPROM_ADDR) +// } System76 EC diff --git a/keyboards/system76/virgo_keyboard_test_2/info.json b/keyboards/system76/virgo_keyboard_test_2/info.json new file mode 100644 index 000000000000..48ec0d483124 --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_2/info.json @@ -0,0 +1,101 @@ +{ + "keyboard_name": "Virgo Keyboard Test 2", + "manufacturer": "System76", + "usb": { + "vid": "0x3384", + "pid": "0x0008", + "device_version": "0.0.1" + }, + "processor": "RP2040", + "bootloader": "rp2040", + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "Esc", "x": 0, "y": 0 }, + { "label": "F1", "x": 1, "y": 0 }, + { "label": "F2", "x": 2, "y": 0 }, + { "label": "F3", "x": 3, "y": 0 }, + { "label": "F4", "x": 4, "y": 0 }, + { "label": "F5", "x": 5, "y": 0 }, + { "label": "F6", "x": 6, "y": 0 }, + { "label": "F7", "x": 7, "y": 0 }, + { "label": "F8", "x": 8, "y": 0 }, + { "label": "F9", "x": 9, "y": 0 }, + { "label": "F10", "x": 10, "y": 0 }, + { "label": "F11", "x": 11, "y": 0 }, + { "label": "F12", "x": 12, "y": 0 }, + { "label": "Del", "x": 13, "y": 0, "w": 1.5 }, + { "label": "Home", "x": 14.75, "y": 0 }, + { "label": "`", "x": 0, "y": 1 }, + { "label": "1", "x": 1, "y": 1 }, + { "label": "2", "x": 2, "y": 1 }, + { "label": "3", "x": 3, "y": 1 }, + { "label": "4", "x": 4, "y": 1 }, + { "label": "5", "x": 5, "y": 1 }, + { "label": "6", "x": 6, "y": 1 }, + { "label": "7", "x": 7, "y": 1 }, + { "label": "8", "x": 8, "y": 1 }, + { "label": "9", "x": 9, "y": 1 }, + { "label": "0", "x": 10, "y": 1 }, + { "label": "-", "x": 11, "y": 1 }, + { "label": "=", "x": 12, "y": 1 }, + { "label": "Bksp", "x": 13, "y": 1, "w": 1.5 }, + { "label": "PgUp", "x": 14.75, "y": 1 }, + { "label": "Tab", "x": 0, "y": 2, "w": 1.5 }, + { "label": "Q", "x": 1.5, "y": 2 }, + { "label": "W", "x": 2.5, "y": 2 }, + { "label": "E", "x": 3.5, "y": 2 }, + { "label": "R", "x": 4.5, "y": 2 }, + { "label": "T", "x": 5.5, "y": 2 }, + { "label": "Y", "x": 6.5, "y": 2 }, + { "label": "U", "x": 7.5, "y": 2 }, + { "label": "I", "x": 8.5, "y": 2 }, + { "label": "O", "x": 9.5, "y": 2 }, + { "label": "P", "x": 10.5, "y": 2 }, + { "label": "[", "x": 11.5, "y": 2 }, + { "label": "]", "x": 12.5, "y": 2 }, + { "label": "\\", "x": 13.5, "y": 2 }, + { "label": "PgDn", "x": 14.75, "y": 2 }, + { "label": "Caps", "x": 0.25, "y": 3, "w": 1.5 }, + { "label": "A", "x": 1.75, "y": 3 }, + { "label": "S", "x": 2.75, "y": 3 }, + { "label": "D", "x": 3.75, "y": 3 }, + { "label": "F", "x": 4.75, "y": 3 }, + { "label": "G", "x": 5.75, "y": 3 }, + { "label": "H", "x": 6.75, "y": 3 }, + { "label": "J", "x": 7.75, "y": 3 }, + { "label": "K", "x": 8.75, "y": 3 }, + { "label": "L", "x": 9.75, "y": 3 }, + { "label": ";", "x": 10.75, "y": 3 }, + { "label": "'", "x": 11.75, "y": 3 }, + { "label": "Enter", "x": 12.75, "y": 3, "w": 1.5 }, + { "label": "End", "x": 14.75, "y": 3 }, + { "label": "LShift", "x": 0.25, "y": 4, "w": 2 }, + { "label": "Z", "x": 2.25, "y": 4 }, + { "label": "X", "x": 3.25, "y": 4 }, + { "label": "C", "x": 4.25, "y": 4 }, + { "label": "V", "x": 5.25, "y": 4 }, + { "label": "B", "x": 6.25, "y": 4 }, + { "label": "N", "x": 7.25, "y": 4 }, + { "label": "M", "x": 8.25, "y": 4 }, + { "label": ",", "x": 9.25, "y": 4 }, + { "label": ".", "x": 10.25, "y": 4 }, + { "label": "/", "x": 11.25, "y": 4 }, + { "label": "RShift", "x": 12.25, "y": 4, "w": 1.5 }, + { "label": "Up", "x": 13.75, "y": 4 }, + { "label": "LCtrl", "x": 0.25, "y": 5, "w": 1.5 }, + { "label": "LAlt", "x": 1.75, "y": 5 }, + { "label": "LFn", "x": 2.75, "y": 5 }, + { "label": "Super", "x": 3.75, "y": 5 }, + { "label": "Space", "x": 4.75, "y": 5, "w": 2 }, + { "label": "Space", "x": 6.75, "y": 5, "w": 2 }, + { "label": "RCtrl", "x": 8.75, "y": 5 }, + { "label": "RAlt", "x": 9.75, "y": 5 }, + { "label": "RFn", "x": 10.75, "y": 5, "w": 1.5 }, + { "label": "Left", "x": 12.75, "y": 5 }, + { "label": "Down", "x": 13.75, "y": 5 }, + { "label": "Right", "x": 14.75, "y": 5 } + ] + } + } +} diff --git a/keyboards/system76/virgo_keyboard_test_2/keymaps/default/keymap.c b/keyboards/system76/virgo_keyboard_test_2/keymaps/default/keymap.c new file mode 100644 index 000000000000..3efec2d1df4e --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_2/keymaps/default/keymap.c @@ -0,0 +1,91 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 0, default layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || | +| ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE || HOME | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || | +| ~` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | _ - | = + | BACKSPACE || PGUP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | [ | ] | || | +| TAB | Q | W | E | R | T | Y | U | I | O | P | { | } | | \ || PGDN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | ; | ' | | | | + | CAPS | A | S | D | F | G | H | J | K | L | : | " | ENTER | | END | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | , | . | / | | | + | SHIFT | Z | X | C | V | B | N | M | < | > | ? | SHIFT | UP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | CTRL | LALT | FN | LGUI | SPACE | SPACE | RCTRL | RALT | FN | | LEFT | DOWN | RIGHT | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| +*/ + + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LALT, MO(1), KC_LGUI, KC_SPC, KC_SPC, KC_RCTL, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Layer 1, function layer +__________________________________________________________________________________________________________________________________ ________ +| | | | | | | | | | | | | | || PLAY/ | +| QK_BOOT | | | | | | | | | | | | | || PAUSE | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | LED | LED | LED | || VOLUME | +| | | | | | | | | | | TOGGLE | DOWN | UP | || UP | +|________|________|________|________|________|________|________|________|________|________|________|________|________|____________||________| +| | | | | | | | | | | | | | || VOLUME | +|PRINT SCREEN| | | | | | HOME | PGDN | PGUP | END | | | | || DOWN | +|____________|________|________|________|________|________|________|________|________|________|________|________|________|________||________| + | | | | | | | | | | | | | | | | + | | | | | | | LEFT | DOWN | UP | RIGHT | | | | | MUTE | + |____________|________|________|________|________|________|________|________|________|________|________|________|____________|___|________| + | | | | | | | | | | | | | | + | | | | | | | | | | | | | PGUP | + |________________|________|________|________|________|________|________|________|________|________|________|____________|________|_________ + | | | | | | | | | | | | | | + | | | | | | | | | | | HOME | PGDN | END | + |____________|________|_______|________|_________________|_________________|________|________|_____________| |________|________|________| + +* 'QK_BOOT' resets the controller and puts the board into firmware flashing mode. If this key is hit accidentally, just unplug the board +* and plug it back in. +*/ + + [1] = LAYOUT( + QK_BOOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_VAD, RGB_VAI, KC_TRNS, KC_VOLU, + KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END + ), + + [2] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/system76/virgo_keyboard_test_2/post_rules.mk b/keyboards/system76/virgo_keyboard_test_2/post_rules.mk new file mode 100644 index 000000000000..3751a8b8c31b --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_2/post_rules.mk @@ -0,0 +1,12 @@ +# System76 EC +# remove the RESET HID command +VALID_SYSTEM76_EC_TYPES := yes +SYSTEM76_EC_ENABLE ?= no +ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + ifeq ($(filter $(SYSTEM76_EC_ENABLE),$(VALID_SYSTEM76_EC_TYPES)),) + $(error SYSTEM76_EC_EN="$(strip $(SYSTEM76_EC_ENABLE))" is not a valid type for the System76 EC option) + endif + ifneq ($(strip $(SYSTEM76_EC_ENABLE)),no) + OPT_DEFS += -DSYSTEM76_EC + endif +endif diff --git a/keyboards/system76/virgo_keyboard_test_2/readme.md b/keyboards/system76/virgo_keyboard_test_2/readme.md new file mode 100644 index 000000000000..f1d48b49f90d --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_2/readme.md @@ -0,0 +1 @@ +# Virgo Keyboard Test 1 diff --git a/keyboards/system76/virgo_keyboard_test_2/rgb_matrix_kb.inc b/keyboards/system76/virgo_keyboard_test_2/rgb_matrix_kb.inc new file mode 100644 index 000000000000..02de10ed500e --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_2/rgb_matrix_kb.inc @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +RGB_MATRIX_EFFECT(active_keys) +RGB_MATRIX_EFFECT(raw_rgb) +RGB_MATRIX_EFFECT(unlocked) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +#include "dynamic_keymap.h" + +static bool active_keys_initialized = false; +static uint8_t active_keys_table[RGB_MATRIX_LED_COUNT] = {0}; + +static void active_keys_initialize(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + uint8_t led = g_led_config.matrix_co[row][col]; + if (led < RGB_MATRIX_LED_COUNT && row < 16 && col < 16) { + active_keys_table[led] = (row << 4) | col; + } + } + } + active_keys_initialized = true; +} + +static bool active_keys(effect_params_t* params) { + if (!active_keys_initialized) { + active_keys_initialize(); + } + + RGB_MATRIX_USE_LIMITS(led_min, led_max); + uint8_t layer = get_highest_layer(layer_state); + RGB rgb = hsv_to_rgb(rgb_matrix_config.hsv); + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + uint8_t rowcol = active_keys_table[i]; + uint8_t row = rowcol >> 4; + uint8_t col = rowcol & 0xF; + uint16_t keycode = dynamic_keymap_get_keycode(layer, row, col); + switch (keycode) { + case KC_NO: + case KC_TRNS: + rgb_matrix_set_color(i, 0, 0, 0); + break; + default: + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + break; + } + } + + return led_max < RGB_MATRIX_LED_COUNT; +} + +RGB raw_rgb_data[RGB_MATRIX_LED_COUNT] = {0}; + +static uint8_t normalize_component(uint8_t component) { + uint16_t x = (uint16_t)component; + x *= rgb_matrix_config.hsv.v; // Multiply by current brightness + x /= 255; // Divide by maximum brightness + return (uint8_t)x; +} + +static RGB normalize_index(uint8_t i) { + RGB raw = raw_rgb_data[i]; + RGB rgb = { + .r = normalize_component(raw.r), + .g = normalize_component(raw.g), + .b = normalize_component(raw.b), + }; + return rgb; +} + +static bool raw_rgb(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + RGB rgb = normalize_index(i); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +static uint8_t unlocked_keys[8][2] = { + {2, 7}, // U + {4, 6}, // N + {3, 9}, // L + {2, 9}, // O + {4, 3}, // C + {3, 8}, // K + {2, 3}, // E + {3, 3}, // D +}; + +static uint8_t unlocked_ticks = 0; +static uint8_t unlocked_i = 0; +static uint8_t unlocked_leds_count = 0; +static uint8_t unlocked_leds[2] = {0, 0}; + +static bool unlocked(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + unlocked_ticks++; + + if (params->init) { + unlocked_ticks = 0; + unlocked_i = 0; + } + + if (unlocked_ticks == 0) { + if (unlocked_i == 8) { + unlocked_leds_count = 0; + unlocked_i = 0; + } else { + unlocked_leds_count = rgb_matrix_map_row_column_to_led(unlocked_keys[unlocked_i][0], unlocked_keys[unlocked_i][1], unlocked_leds); + unlocked_i++; + } + } + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv = { + .h = i + unlocked_ticks, + .s = 0xFF, + .v = 0x70, + }; + for (uint8_t j = 0; j < unlocked_leds_count; j++) { + if (i == unlocked_leds[j]) { + hsv.s = 0; + hsv.v = 0xFF; + } + } + + RGB rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + return led_max < RGB_MATRIX_LED_COUNT; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/system76/virgo_keyboard_test_2/rules.mk b/keyboards/system76/virgo_keyboard_test_2/rules.mk new file mode 100644 index 000000000000..ddace91b9613 --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_2/rules.mk @@ -0,0 +1,23 @@ +# Build options +# change yes to no to disable +BOOTMAGIC_ENABLE = no # Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and system control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware +EEPROM_DRIVER = wear_leveling +WEAR_LEVELING_DRIVER = rp2040_flash +NKRO_ENABLE = yes # USB N-key rollover +RAW_ENABLE = yes # Raw HID commands (used by Keyboard Configurator) +BACKLIGHT_ENABLE = no # RGB backlight (conflicts with RGB matrix) +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = yes # RGB matrix +RGB_MATRIX_DRIVER = WS2812 +WS2812_DRIVER = vendor +RGB_MATRIX_CUSTOM_KB = yes # Custom keyboard effects +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes # Link-time optimization for smaller binary + +# Add System76 EC command interface +SRC += system76_ec.c diff --git a/keyboards/system76/virgo_keyboard_test_2/virgo_keyboard_test_2.c b/keyboards/system76/virgo_keyboard_test_2/virgo_keyboard_test_2.c new file mode 100644 index 000000000000..fc026d2c4b07 --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_2/virgo_keyboard_test_2.c @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "virgo_keyboard_test_2.h" +#include "eeprom.h" + +// clang-format off +#ifdef RGB_MATRIX_ENABLE +// LEDs by index +// 0 1 2 3 4 5 6 7 8 9 +// 00 LM4 LL4 LK4 LJ4 LI4 LH4 LG4 LF4 LE4 LD4 +// 10 LC4 LB4 LA4 LA5 LB5 LC5 LD5 LE5 LG5 LH5 +// 20 LI5 LJ5 LK5 LL5 LM5 LO3 LM3 LL3 LK3 LJ3 +// 30 LI3 LH3 LG3 LF3 LE3 LD3 LC3 LB3 LA3 LA2 +// 40 LB2 LC2 LD2 LE2 LF2 LG2 LH2 LI2 LJ2 LK2 +// 50 LL2 LM2 LN2 LO2 LO1 LN1 LM1 LL1 LK1 LJ1 +// 60 LI1 LH1 LG1 LF1 LE1 LD1 LC1 LB1 LA1 LA0 +// 70 LB0 LC0 LD0 LE0 LF0 LG0 LH0 LI0 LJ0 LK0 +// 80 LL0 LM0 LN0 LO0 +led_config_t g_led_config = { { + // Key matrix to LED index +/* A B C D E F G H I J K L M N O */ +/* 0 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, */ +/* 1 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, */ +/* 2 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, */ +/* 3 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, */ +/* 4 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, */ +/* 5 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 */ + { 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82 }, + { 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55 }, + { 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 }, + { 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 83 }, + { 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 54 }, + { 13, 14, 15, 16, 17, 25, 18, 19, 20, 21, 22, 23, 24, 53 }, +}, { + // LED index to physical position (see leds.sh in `launch' repo) +/* 00 */ {209, 51}, {190, 51}, {171, 51}, {156, 51}, {140, 51}, {125, 51}, {110, 51}, {95, 51}, {80, 51}, {65, 51}, +/* 10 */ {49, 51}, {34, 51}, {11, 51}, {8, 64}, {27, 64}, {42, 64}, {57, 64}, {80, 64}, {110, 64}, {133, 64}, +/* 20 */ {148, 64}, {167, 64}, {194, 64}, {209, 64}, {224, 64}, {224, 38}, {197, 38}, {178, 38}, {163, 38}, {148, 38}, +/* 30 */ {133, 38}, {118, 38}, {103, 38}, {87, 38}, {72, 38}, {57, 38}, {42, 38}, {27, 38}, {8, 38}, {4, 26}, +/* 40 */ {23, 26}, {38, 26}, {53, 26}, {68, 26}, {84, 26}, {99, 26}, {114, 26}, {129, 26}, {144, 26}, {159, 26}, +/* 50 */ {175, 26}, {190, 26}, {205, 26}, {224, 26}, {224, 13}, {201, 13}, {182, 13}, {167, 13}, {152, 13}, {137, 13}, +/* 60 */ {121, 13}, {106, 13}, {91, 13}, {76, 13}, {61, 13}, {46, 13}, {30, 13}, {15, 13}, {0, 13}, {0, 0}, +/* 70 */ {15, 0}, {30, 0}, {46, 0}, {61, 0}, {76, 0}, {91, 0}, {106, 0}, {121, 0}, {137, 0}, {152, 0}, +/* 80 */ {167, 0}, {182, 0}, {201, 0}, {224, 0} +}, { + // LED index to flags (set all to LED_FLAG_KEYLIGHT) + /* 0 1 2 3 4 5 6 7 8 9 */ +/* 00 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 10 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 20 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 30 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 40 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 50 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 60 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 70 */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, +/* 80 */ 4, 4, 4, 4 +} }; +#endif // RGB_MATRIX_ENABLE + +bool eeprom_is_valid(void) { + return ( + eeprom_read_word(((void *)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void *)EEPROM_VERSION_ADDR)) == EEPROM_VERSION + ); +} +// clang-format on + +void eeprom_set_valid(bool valid) { + eeprom_update_word(((void *)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void *)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} + +void bootmagic_lite_reset_eeprom(void) { + // Set the keyboard-specific EEPROM state as invalid + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid + eeconfig_disable(); +} + +// The lite version of TMK's bootmagic based on Wilba. +// 100% less potential for accidentally making the keyboard do stupid things. +void bootmagic_lite(void) { + // Perform multiple scans because debouncing can't be turned off. + matrix_scan(); +#if defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); +#else + wait_ms(30); +#endif + matrix_scan(); + + // If the configured key (commonly Esc) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + uint8_t row = 0; // BOOTMAGIC_LITE_ROW; + uint8_t col = 0; // BOOTMAGIC_LITE_COLUMN; + + if (matrix_get_row(row) & (1 << col)) { + bootmagic_lite_reset_eeprom(); + + // Jump to bootloader. + bootloader_jump(); + } +} + +void system76_ec_rgb_eeprom(bool write); +void system76_ec_rgb_layer(layer_state_t layer_state); +void system76_ec_unlock(void); +bool system76_ec_is_unlocked(void); + +rgb_config_t layer_rgb[DYNAMIC_KEYMAP_LAYER_COUNT]; + +void matrix_init_kb(void) { + bootmagic_lite(); + if (!eeprom_is_valid()) { + dynamic_keymap_reset(); + dynamic_keymap_macro_reset(); + system76_ec_rgb_eeprom(true); + eeprom_set_valid(true); + } else { + system76_ec_rgb_eeprom(false); + } + + system76_ec_rgb_layer(layer_state); +} + +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +#define LEVEL(value) (uint8_t)(((uint16_t)value) * ((uint16_t)RGB_MATRIX_MAXIMUM_BRIGHTNESS) / ((uint16_t)255)) + +// clang-format off +static const uint8_t levels[] = { + LEVEL(48), + LEVEL(72), + LEVEL(96), + LEVEL(144), + LEVEL(192), + LEVEL(255) +}; +// clang-format on + +static uint8_t toggle_level = RGB_MATRIX_MAXIMUM_BRIGHTNESS; +extern bool input_disabled; + +static void set_value_all_layers(uint8_t value) { + if (!system76_ec_is_unlocked()) { + for (int8_t layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) { + layer_rgb[layer].hsv.v = value; + } + system76_ec_rgb_layer(layer_state); + } +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (input_disabled) { + return false; + } + + if (!process_record_user(keycode, record)) { + return false; + } + + switch (keycode) { + case QK_BOOT: + if (record->event.pressed) { + system76_ec_unlock(); + } +#ifdef SYSTEM76_EC + return false; +#else + return true; +#endif + case RGB_VAD: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = sizeof(levels) - 1; i >= 0; i--) { + if (levels[i] < level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_VAI: + if (record->event.pressed) { + uint8_t level = rgb_matrix_config.hsv.v; + for (int i = 0; i < sizeof(levels); i++) { + if (levels[i] > level) { + level = levels[i]; + break; + } + } + set_value_all_layers(level); + } + return false; + case RGB_TOG: + if (record->event.pressed) { + uint8_t level = 0; + if (rgb_matrix_config.hsv.v == 0) { + level = toggle_level; + } else { + toggle_level = rgb_matrix_config.hsv.v; + } + set_value_all_layers(level); + } + return false; + } + + return true; +} + +layer_state_t layer_state_set_kb(layer_state_t layer_state) { + system76_ec_rgb_layer(layer_state); + + return layer_state_set_user(layer_state); +} + +#ifdef CONSOLE_ENABLE +void keyboard_post_init_user(void) { + debug_enable = true; + debug_matrix = false; + debug_keyboard = false; +} +#endif // CONSOLE_ENABLE diff --git a/keyboards/system76/virgo_keyboard_test_2/virgo_keyboard_test_2.h b/keyboards/system76/virgo_keyboard_test_2/virgo_keyboard_test_2.h new file mode 100644 index 000000000000..335b8ecbdf1b --- /dev/null +++ b/keyboards/system76/virgo_keyboard_test_2/virgo_keyboard_test_2.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "quantum.h" + +// clang-format off +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K5A, K5B \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K0E }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K1E }, \ + { K50, K51, K52, K53, K54, K3D, K55, K56, K57, K58, K59, K5A, K5B, K2E }, \ +} +// clang-format on diff --git a/keyboards/system76/virgo_stick_test_1/config.h b/keyboards/system76/virgo_stick_test_1/config.h new file mode 100644 index 000000000000..9e4493bd9cf7 --- /dev/null +++ b/keyboards/system76/virgo_stick_test_1/config.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2023 System76 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "config_common.h" + +#define MATRIX_ROWS 1 +#define MATRIX_COLS 1 + +#define MATRIX_ROW_PINS { F4 } +#define MATRIX_COL_PINS { F5 } + +#define DIODE_DIRECTION COL2ROW + +// Set 0 if debouncing isn't needed +#define DEBOUNCE 5 + +// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE + +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +#define PS2_CLOCK_PIN D2 +#define PS2_DATA_PIN D1 + +#define PS2_INT_INIT() do { \ + EICRA |= ((1<