diff options
author | tiltowait <208040+tiltowait@users.noreply.github.com> | 2021-08-20 06:13:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-20 06:13:59 -0700 |
commit | 90ff4fe749346c3b92aa8ca6461f5091fabfa99e (patch) | |
tree | 244f81431b2872bdbb8b91f507de48d54bbce42c | |
parent | fd54992e1f65713a93115a0a1737e97d3e2d8522 (diff) | |
download | qmk_firmware-90ff4fe749346c3b92aa8ca6461f5091fabfa99e.tar.gz qmk_firmware-90ff4fe749346c3b92aa8ca6461f5091fabfa99e.zip |
[Keyboard] Add IBM Model M SSK configuration (#14050)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
-rw-r--r-- | keyboards/converter/modelm_ssk/config.h | 76 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/info.json | 457 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/keymaps/default/keymap.c | 114 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/keymaps/default/readme.md | 1 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/keymaps/tiltowait/config.h | 21 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/keymaps/tiltowait/keymap.c | 116 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/keymaps/tiltowait/readme.md | 11 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/modelm_ssk.c | 19 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/modelm_ssk.h | 45 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/readme.md | 55 | ||||
-rw-r--r-- | keyboards/converter/modelm_ssk/rules.mk | 23 |
11 files changed, 938 insertions, 0 deletions
diff --git a/keyboards/converter/modelm_ssk/config.h b/keyboards/converter/modelm_ssk/config.h new file mode 100644 index 0000000000..74d549ba49 --- /dev/null +++ b/keyboards/converter/modelm_ssk/config.h @@ -0,0 +1,76 @@ +/* +Copyright 2019-2021 iw0rm3r, tiltowait + +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 <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0000 +#define DEVICE_VER 0x0001 +#define MANUFACTURER tiltowait +#define PRODUCT IBM Model M Space-Saving Keyboard + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 16 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_COL_PINS { C7, C6, C5, C4, C3, C2, C1, C0, E1, E0, D7, D5, D4, D3, D2, D1 } +#define MATRIX_ROW_PINS { F0, F1, F2, F3, F4, F5, F6, F7 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION ROW2COL + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed (5 is default) */ +#define DEBOUNCE 5 + +/* The Model M does not have NKRO */ +#define MATRIX_HAS_GHOST + +#define LED_NUM_LOCK_PIN B4 +#define LED_CAPS_LOCK_PIN B6 +#define LED_SCROLL_LOCK_PIN B5 + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION diff --git a/keyboards/converter/modelm_ssk/info.json b/keyboards/converter/modelm_ssk/info.json new file mode 100644 index 0000000000..e347d66722 --- /dev/null +++ b/keyboards/converter/modelm_ssk/info.json @@ -0,0 +1,457 @@ +{ + "keyboard_name": "IBM Model M Space-Saving Keyboard", + "url": "https://github.com/tiltowait/qmk_firmware/tree/modelm_ssk/keyboards/converter/modelm_ssk", + "maintainer": "tiltowait", + "width": 17.75, + "height": 6.5, + "layouts": + { + "LAYOUT": + { + "layout": + [ + { + "label": "Esc", + "x": 0, + "y": 0 + }, + { + "label": "F1", + "x": 2, + "y": 0 + }, + { + "label": "F2", + "x": 3, + "y": 0 + }, + { + "label": "F3", + "x": 4, + "y": 0 + }, + { + "label": "F4", + "x": 5, + "y": 0 + }, + { + "label": "F5", + "x": 6.5, + "y": 0 + }, + { + "label": "F6", + "x": 7.5, + "y": 0 + }, + { + "label": "F7", + "x": 8.5, + "y": 0 + }, + { + "label": "F8", + "x": 9.5, + "y": 0 + }, + { + "label": "F9", + "x": 11, + "y": 0 + }, + { + "label": "F10", + "x": 12, + "y": 0 + }, + { + "label": "F11", + "x": 13, + "y": 0 + }, + { + "label": "F12", + "x": 14, + "y": 0 + }, + { + "label": "PrtSc", + "x": 15.25, + "y": 0 + }, + { + "label": "Scroll Lock", + "x": 16.25, + "y": 0 + }, + { + "label": "Pause", + "x": 17.25, + "y": 0 + }, + { + "label": "~", + "x": 0, + "y": 1.5 + }, + { + "label": "!", + "x": 1, + "y": 1.5 + }, + { + "label": "@", + "x": 2, + "y": 1.5 + }, + { + "label": "#", + "x": 3, + "y": 1.5 + }, + { + "label": "$", + "x": 4, + "y": 1.5 + }, + { + "label": "%", + "x": 5, + "y": 1.5 + }, + { + "label": "^", + "x": 6, + "y": 1.5 + }, + { + "label": "&", + "x": 7, + "y": 1.5 + }, + { + "label": "*", + "x": 8, + "y": 1.5 + }, + { + "label": "(", + "x": 9, + "y": 1.5 + }, + { + "label": ")", + "x": 10, + "y": 1.5 + }, + { + "label": "_", + "x": 11, + "y": 1.5 + }, + { + "label": "+", + "x": 12, + "y": 1.5 + }, + { + "label": "Backspace", + "x": 13, + "y": 1.5, + "w": 2 + }, + { + "label": "Insert", + "x": 15.25, + "y": 1.5 + }, + { + "label": "Home", + "x": 16.25, + "y": 1.5 + }, + { + "label": "PgUp", + "x": 17.25, + "y": 1.5 + }, + { + "label": "Tab", + "x": 0, + "y": 2.5, + "w": 1.5 + }, + { + "label": "Q", + "x": 1.5, + "y": 2.5 + }, + { + "label": "W", + "x": 2.5, + "y": 2.5 + }, + { + "label": "E", + "x": 3.5, + "y": 2.5 + }, + { + "label": "R", + "x": 4.5, + "y": 2.5 + }, + { + "label": "T", + "x": 5.5, + "y": 2.5 + }, + { + "label": "Y", + "x": 6.5, + "y": 2.5 + }, + { + "label": "U", + "x": 7.5, + "y": 2.5 + }, + { + "label": "I", + "x": 8.5, + "y": 2.5 + }, + { + "label": "O", + "x": 9.5, + "y": 2.5 + }, + { + "label": "P", + "x": 10.5, + "y": 2.5 + }, + { + "label": "{", + "x": 11.5, + "y": 2.5 + }, + { + "label": "}", + "x": 12.5, + "y": 2.5 + }, + { + "label": "|", + "x": 13.5, + "y": 2.5, + "w": 1.5 + }, + { + "label": "Delete", + "x": 15.25, + "y": 2.5 + }, + { + "label": "End", + "x": 16.25, + "y": 2.5 + }, + { + "label": "PgDn", + "x": 17.25, + "y": 2.5 + }, + { + "label": "Caps Lock", + "x": 0, + "y": 3.5, + "w": 1.5 + }, + { + "label": "A", + "x": 1.75, + "y": 3.5 + }, + { + "label": "S", + "x": 2.75, + "y": 3.5 + }, + { + "label": "D", + "x": 3.75, + "y": 3.5 + }, + { + "label": "F", + "x": 4.75, + "y": 3.5 + }, + { + "label": "G", + "x": 5.75, + "y": 3.5 + }, + { + "label": "H", + "x": 6.75, + "y": 3.5 + }, + { + "label": "J", + "x": 7.75, + "y": 3.5 + }, + { + "label": "K", + "x": 8.75, + "y": 3.5 + }, + { + "label": "L", + "x": 9.75, + "y": 3.5 + }, + { + "label": ":", + "x": 10.75, + "y": 3.5 + }, + { + "label": "\"", + "x": 11.75, + "y": 3.5 + }, + { + "label": "~", + "x": 12.75, + "y": 3.5 + }, + { + "label": "Enter", + "x": 13.75, + "y": 3.5, + "w": 1.25 + }, + { + "label": "Shift", + "x": 0, + "y": 4.5, + "w": 1.25 + }, + { + "label": "|", + "x": 1.25, + "y": 4.5 + }, + { + "label": "Z", + "x": 2.25, + "y": 4.5 + }, + { + "label": "X", + "x": 3.25, + "y": 4.5 + }, + { + "label": "C", + "x": 4.25, + "y": 4.5 + }, + { + "label": "V", + "x": 5.25, + "y": 4.5 + }, + { + "label": "B", + "x": 6.25, + "y": 4.5 + }, + { + "label": "N", + "x": 7.25, + "y": 4.5 + }, + { + "label": "M", + "x": 8.25, + "y": 4.5 + }, + { + "label": "<", + "x": 9.25, + "y": 4.5 + }, + { + "label": ">", + "x": 10.25, + "y": 4.5 + }, + { + "label": "?", + "x": 11.25, + "y": 4.5 + }, + { + "label": "Shift", + "x": 12.25, + "y": 4.5, + "w": 2.75 + }, + { + "label": "↑", + "x": 16.25, + "y": 4.5 + }, + { + "label": "Ctrl", + "x": 0, + "y": 5.5, + "w": 1.5 + }, + { + "label": "Alt", + "x": 2.5, + "y": 5.5, + "w": 1.5 + }, + { + "x": 4, + "y": 5.5, + "w": 7 + }, + { + "label": "Alt", + "x": 11, + "y": 5.5, + "w": 1.5 + }, + { + "label": "Ctrl", + "x": 13.5, + "y": 5.5, + "w": 1.5 + }, + { + "label": "←", + "x": 15.25, + "y": 5.5 + }, + { + "label": "↓", + "x": 16.25, + "y": 5.5 + }, + { + "label": "→", + "x": 17.25, + "y": 5.5 + } + ] + } + } +} diff --git a/keyboards/converter/modelm_ssk/keymaps/default/keymap.c b/keyboards/converter/modelm_ssk/keymaps/default/keymap.c new file mode 100644 index 0000000000..adf557b268 --- /dev/null +++ b/keyboards/converter/modelm_ssk/keymaps/default/keymap.c @@ -0,0 +1,114 @@ +/* Copyright 2019-2021 iw0rm3r, tiltowait + * + * 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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +enum custom_layers { + _BASE, + _NUMPAD, +}; + +enum custom_keycodes { + NUM_SCRL = SAFE_RANGE +}; + +void toggle_numpad_layer(int set_state); + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( /* Base layer */ + 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, NUM_SCRL, KC_PAUS, + 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_INS, KC_HOME, 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_DEL, KC_END, 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_NUHS, KC_ENT, + KC_LSFT, KC_NUBS, 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, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_NUMPAD] = LAYOUT( /* Numpad Layer */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_7, KC_KP_8, KC_KP_9, KC_TRNS, KC_KP_MINUS, KC_KP_PLUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_4, KC_KP_5, KC_KP_6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_ASTERISK, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_0, KC_TRNS, KC_KP_DOT, KC_KP_SLASH, 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) { + static uint16_t last_num_scroll = 0; /* For unregistering the proper key */ + + switch (keycode) { + case NUM_SCRL: /* Numlock / Scroll Lock */ + if (record->event.pressed) { + if (get_mods() & MOD_MASK_SHIFT) { + /* Remove the shift modifiers */ + uint8_t shift_mods = get_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)); + del_mods(MOD_MASK_SHIFT); + + last_num_scroll = KC_NUMLOCK; + register_code(last_num_scroll); + toggle_numpad_layer(-1); + + /* Reset the shift modifiers */ + set_mods(shift_mods); + } else { + last_num_scroll = KC_SCROLLLOCK; + register_code(last_num_scroll); + } + } else { + unregister_code(last_num_scroll); + } + break; + } + return true; +} + +void toggle_numpad_layer(int set_state) { + static uint8_t numlock_enabled = 0; + + /* set_state allows us to explicitly change the numlock state + rather than merely toggling it. */ + if (set_state == -1) { + numlock_enabled = !numlock_enabled; + } else { + numlock_enabled = set_state; + } + + if (numlock_enabled) { + layer_on(_NUMPAD); + } + else { + layer_off(_NUMPAD); + } +} + +bool led_update_user(led_t led_state) { + /* In rare and unlikely conditions, it's possible for numlock + state to change externally from the keyboard. If this happens, + we want to match the new state. + + On Windows and Linux, this means that the keyboard will technically + toggle the numpad layer twice. + */ + + static int8_t numlock_state = -1; /* Unknown state at default */ + + if (led_state.num_lock != numlock_state) { + numlock_state = led_state.num_lock; + toggle_numpad_layer(led_state.num_lock); + } + return true; +} + diff --git a/keyboards/converter/modelm_ssk/keymaps/default/readme.md b/keyboards/converter/modelm_ssk/keymaps/default/readme.md new file mode 100644 index 0000000000..bc829be266 --- /dev/null +++ b/keyboards/converter/modelm_ssk/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for modelm_ssk diff --git a/keyboards/converter/modelm_ssk/keymaps/tiltowait/config.h b/keyboards/converter/modelm_ssk/keymaps/tiltowait/config.h new file mode 100644 index 0000000000..151118fdf6 --- /dev/null +++ b/keyboards/converter/modelm_ssk/keymaps/tiltowait/config.h @@ -0,0 +1,21 @@ +/* Copyright 2021 tiltowait + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#pragma once + +// place overrides here + +#define PERMISSIVE_HOLD diff --git a/keyboards/converter/modelm_ssk/keymaps/tiltowait/keymap.c b/keyboards/converter/modelm_ssk/keymaps/tiltowait/keymap.c new file mode 100644 index 0000000000..58726fec86 --- /dev/null +++ b/keyboards/converter/modelm_ssk/keymaps/tiltowait/keymap.c @@ -0,0 +1,116 @@ +/* Copyright 2021 tiltowait + * + * 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 <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +enum custom_layers { + _BASE, + _SECOND, + _NUMPAD, +}; + +enum custom_keycodes { + NUM_SCRL = SAFE_RANGE /* Dual-purpose Scroll Lock / Numlock button as on original hardware */ +}; + +void toggle_numlock_layer(int set_state); + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( /* Base layer */ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_MUTE, KC_F10, KC_VOLD, KC_VOLU, S(G(KC_4)), NUM_SCRL, KC_PAUS, + + 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_BSLS, KC_INS, KC_HOME, KC_PGUP, + LT(_SECOND,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_BSPC, KC_DEL, KC_END, 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_NUHS, KC_ENT, + KC_LSFT, KC_NUBS, 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_LALT, LGUI_T(KC_ENT), KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_SECOND] = LAYOUT( /* Layer 1 */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, S(A(KC_MINS)), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, C(KC_LEFT), C(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_LEFT, KC_DOWN, KC_UP, KC_RGHT, S(A(KC_M)), KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, C(KC_SPC), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + [_NUMPAD] = LAYOUT( /* Numpad Layer */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_7, KC_KP_8, KC_KP_9, KC_TRNS, KC_KP_MINUS, KC_KP_PLUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_4, KC_KP_5, KC_KP_6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_ASTERISK, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_KP_0, KC_TRNS, KC_KP_DOT, KC_KP_SLASH, 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) { + static uint16_t last_num_scroll = 0; /* For unregistering the proper key */ + + switch (keycode) { + case NUM_SCRL: + if (record->event.pressed) { + if (get_mods() & MOD_MASK_SHIFT) { + /* Remove the shift modifiers */ + uint8_t shift_mods = get_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)); + set_mods(get_mods() & ~(MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) ); + + last_num_scroll = KC_NUMLOCK; + register_code(last_num_scroll); + toggle_numlock_layer(-1); + + /* Reset the shift modifiers */ + set_mods(shift_mods); + } else { + last_num_scroll = KC_SCROLLLOCK; + register_code(last_num_scroll); + } + } else { + unregister_code(last_num_scroll); + } + break; + } + return true; +} + +void toggle_numlock_layer(int set_state) { + static uint8_t numlock_enabled = 0; + + /* set_state allows us to explicitly change the numlock state + rather than merely toggling it. */ + if (set_state == -1) { + numlock_enabled = !numlock_enabled; + } else { + numlock_enabled = set_state; + } + + if (numlock_enabled) { + layer_on(_NUMPAD); + } + else { + layer_off(_NUMPAD); + } +} + +bool led_update_kb(led_t led_state) { + static int8_t numlock_state = -1; + + if (led_state.num_lock != numlock_state) { + numlock_state = led_state.num_lock; + toggle_numlock_layer(led_state.num_lock); + } + return true; +} diff --git a/keyboards/converter/modelm_ssk/keymaps/tiltowait/readme.md b/keyboards/converter/modelm_ssk/keymaps/tiltowait/readme.md new file mode 100644 index 0000000000..aecdd89b82 --- /dev/null +++ b/keyboards/converter/modelm_ssk/keymaps/tiltowait/readme.md @@ -0,0 +1,11 @@ +# The maintainer's personal keymap for modelm_ssk + +This is a keymap suitable for macOS use. + +* Backspace and backslash have been swapped (HHKB style) +* Capslock is LCTRL +* LCTRL is LALT +* LALT is LGUI +* Tab shifts to layer 1 on hold +* Layer 1 has a couple of Mac shortcuts, plus Vim-style arrow keys +* Shift+Numlock enables numlock diff --git a/keyboards/converter/modelm_ssk/modelm_ssk.c b/keyboards/converter/modelm_ssk/modelm_ssk.c new file mode 100644 index 0000000000..1b01115e5d --- /dev/null +++ b/keyboards/converter/modelm_ssk/modelm_ssk.c @@ -0,0 +1,19 @@ +/* Copyright 2019 iw0rm3r + * + * 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 <http://www.gnu.org/licenses/>. + */ +#include "modelm_ssk.h" + + + diff --git a/keyboards/converter/modelm_ssk/modelm_ssk.h b/keyboards/converter/modelm_ssk/modelm_ssk.h new file mode 100644 index 0000000000..5c4b9b80ea --- /dev/null +++ b/keyboards/converter/modelm_ssk/modelm_ssk.h @@ -0,0 +1,45 @@ +/* Copyright 2019-2021 iw0rm3r, tiltowait + * + * 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 <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include "quantum.h" + +/* This a shortcut to help you visually see your layout. + * The first section contains "names" for physical keys of the keyboard + * and defines their position on the board. + * The second section defines position of the keys on the switch matrix + * (where COLUMNS and ROWS crosses). */ + +#define LAYOUT( \ + K5A, K5B, K5C, K5D, K5E, K5F, K5G, K5H, K5I, K5J, K5K, K5L, K5M, K5N, K5O, K5P, \ + \ + K4A, K4B, K4C, K4D, K4E, K4F, K4G, K4H, K4I, K4J, K4K, K4L, K4M, K4N, K4O, K4P, K4Q, \ + K3A, K3B, K3C, K3D, K3E, K3F, K3G, K3H, K3I, K3J, K3K, K3L, K3M, K3N, K3O, K3P, K3Q, \ + K2A, K2B, K2C, K2D, K2E, K2F, K2G, K2H, K2I, K2J, K2K, K2L, K2M, K2N, \ + K1A, K1B, K1C, K1D, K1E, K1F, K1G, K1H, K1I, K1J, K1K, K1L, K1M, K1N, \ + K0A, K0B, K0C, K0D, K0E, K0F, K0G, K0H \ +) \ +{ \ +/* 00 */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K1G, K0C, K1H, KC_NO, KC_NO, K1L, K0G, K0H, KC_NO, K0F, K0D }, \ +/* 01 */ { K0E, K1M, K1C, K1D, K1E, K1F, K2N, K1I, K1J, K1K, KC_NO, KC_NO, KC_NO, KC_NO, K5P, KC_NO }, \ +/* 02 */ { KC_NO, KC_NO, K2B, K2C, K2D, K2E, K3N, K2H, K2I, K2J, K2K, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* 03 */ { KC_NO, KC_NO, K3B, K3C, K3D, K3E, KC_NO, K3H, K3I, K3J, K3K, KC_NO, KC_NO, KC_NO, KC_NO, K5O }, \ +/* 04 */ { KC_NO, KC_NO, K4B, K4C, K4D, K4E, K5K, K4H, K4I, K4J, K4K, K5L, K5M, K3Q, K3P, K5N }, \ +/* 05 */ { K0A, KC_NO, K4A, K5B, K5C, K4F, K5J, K4G, K4M, K5I, K4L, K3O, K4O, K4Q, K4P, KC_NO }, \ +/* 06 */ { KC_NO, K1A, K3A, K2A, K5D, K3F, K4N, K3G, K3M, K5H, K3L, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* 07 */ { KC_NO, KC_NO, K5A, KC_NO, K5E, K2F, K5F, K2G, K5G, KC_NO, K2L, KC_NO, KC_NO, KC_NO, K1N, K0B }, \ +} +/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ diff --git a/keyboards/converter/modelm_ssk/readme.md b/keyboards/converter/modelm_ssk/readme.md new file mode 100644 index 0000000000..8105a0c2df --- /dev/null +++ b/keyboards/converter/modelm_ssk/readme.md @@ -0,0 +1,55 @@ +# modelm_ssk + +![IBM Model M Space-Saving Keyboard](https://i.imgur.com/CSXrQI5.jpg) + +This is a QMK firmware configuration for the IBM Model M Space-Saving Keyboard (SSK). Based on [this project](https://github.com/qmk/qmk_firmware/tree/master/keyboards/converter/modelm101), it features a few slight improvements and, most importantly, a full remapping to match the SSK's matrix, which differs from its full-sized cousins. The modification is easily reversible, as no part of the keyboard is permanently changed. Just take out the replacement controller and reinstall the original, should you desire. + +The numpad layer (accessed with Shift + Scroll Lock as with the original controller) is mapped to layer 7 by default. All non-numpad keys are transparent. + +**Note:** As of this writing, this configuration has only been tested on the 1392464 SSK. It's possible other models differ in their internal matrices. Should the provided matrix not work for you (and you are certain of your connections), you can enable debugging with `CONSOLE_ENABLE = yes` in `rules.mk` and by following the directions in `default/keymap.c`. Once done, [QMK Toolbox](https://github.com/qmk/qmk_toolbox) will display row/col information to help you remap `modelm_ssk.h`. + +## Requirements + +* [Teensy++ 2.0](https://www.pjrc.com/store/teensypp.html) - I recommend buying one with pins already attached +* A Trio-Mate 16-pin ribbon connector (6-520315-6 or 6-520415-6) +* A Trio-Mate 8-pin ribbon connector (5-120628-8 or 5-520314-8). Alternatively, two 16-pin connectors can be used if the 8-pin is out of stock. Just be sure to line up your pins correctly +* Breadboard or perfboard. A perfboard is recommended due to its reduced height and low clearance inside the chassis +* Mini-B to USB-A cable +* Jumper wires and wire strippers/cutters +* Soldering iron if not using a breadboard + +## Setup + +![Finished controller](https://i.imgur.com/m1yuo4F.jpg) + +The controller uses the following mapping (in zero-indexed hex): + +``` +Column: 0 1 2 3 4 5 6 7 8 9 A B C D E F +Pin: C7 C6 C5 C4 C3 C2 C1 C0 E1 E0 D7 D5 D4 D3 D2 D1 +-------------------------------------------------------- +Row: 0 1 2 3 4 5 6 7 +Pin: F0 F1 F2 F3 F4 F5 F6 F7 +``` + +**IMPORTANT:** It is necessary to skip pin D6 on the Teensy. There is an LED attached to this pin, which can cause interference with registering keys. Alternatively, you can remove the LED from the board, which is likely to be a permanent modification of the Teensy. The choice is yours. I am not responsible for any damage to your Teensy or keyboard. + +## A note on the Unicomp Mini M + +This configuration will not work out of the box with the [Unicomp Mini M](https://www.pckeyboard.com/page/product/MINI_M). That keyboard uses a 16x12 matrix rather than the SSK's 16x8 in order to reduce occurrences of 2KRO lockup. It also features lock lights, which the SSK lacks. However, it should be possible to map out the Mini M's matrix to get it working. + +## Maintainer + +* Keyboard Maintainer: [tiltowait](https://github.com/tiltowait), original work by [iw0rm3r](https://github.com/iw0rm3r) +* Hardware Supported: Teensy 2.0++ board by PJRC +* Hardware Availability: https://www.pjrc.com/store/teensypp.html + +## Building + +Make example for this keyboard (after setting up your build environment): + + make converter/modelm_ssk:default + +You must press the button on the Teensy to enter the bootloader the first time. Afterward, so long as you keep `COMMAND_ENABLE = yes` in `rules.mk` (enabled by default), you can use `Left Shift + Right Shift + B` to enter the bootloader. With this method, you can omit `:teensy` from the end of the `make` command. + +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. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/converter/modelm_ssk/rules.mk b/keyboards/converter/modelm_ssk/rules.mk new file mode 100644 index 0000000000..31dbac78be --- /dev/null +++ b/keyboards/converter/modelm_ssk/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = at90usb1286 + +# Bootloader selection +BOOTLOADER = halfkay + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +# Do not enable NKRO_ENABLE. The SSK lacks diodes and cannot support it +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output |