diff options
author | Alex Ong <the.onga@gmail.com> | 2019-01-04 19:39:14 +1100 |
---|---|---|
committer | Alex Ong <the.onga@gmail.com> | 2019-01-04 19:39:14 +1100 |
commit | 47c91fc7f75ae0a477e55b687aa0fc30da0a283c (patch) | |
tree | 65ad39452748ff2e6d4a83ce54ede6ca22c9ada9 /keyboards/converter/ibm_5291 | |
parent | ac9b88e8ccbbf38762871504cd827ff0d941c426 (diff) | |
parent | 563ce3f225d981ce460c12ca5130dfe47af41df0 (diff) | |
download | qmk_firmware-47c91fc7f75ae0a477e55b687aa0fc30da0a283c.tar.gz |
Merge branch 'master' of https://github.com/qmk/qmk_firmware
Diffstat (limited to 'keyboards/converter/ibm_5291')
-rw-r--r-- | keyboards/converter/ibm_5291/config.h | 42 | ||||
-rw-r--r-- | keyboards/converter/ibm_5291/ibm_5291.c | 3 | ||||
-rw-r--r-- | keyboards/converter/ibm_5291/ibm_5291.h | 69 | ||||
-rw-r--r-- | keyboards/converter/ibm_5291/info.json | 97 | ||||
-rw-r--r-- | keyboards/converter/ibm_5291/keymaps/default/keymap.c | 233 | ||||
-rw-r--r-- | keyboards/converter/ibm_5291/keymaps/kbdbabel_doc_ibm5291_kbd.pdf | bin | 0 -> 13054 bytes | |||
-rw-r--r-- | keyboards/converter/ibm_5291/matrix.c | 284 | ||||
-rw-r--r-- | keyboards/converter/ibm_5291/matrix.csv | 96 | ||||
-rw-r--r-- | keyboards/converter/ibm_5291/readme.md | 72 | ||||
-rw-r--r-- | keyboards/converter/ibm_5291/rules.mk | 72 |
10 files changed, 968 insertions, 0 deletions
diff --git a/keyboards/converter/ibm_5291/config.h b/keyboards/converter/ibm_5291/config.h new file mode 100644 index 000000000..5c9ca1e4a --- /dev/null +++ b/keyboards/converter/ibm_5291/config.h @@ -0,0 +1,42 @@ +/* +Copyright 2018 listofoptions <listofoptions@gmail.com> + +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" + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 1 +#define MANUFACTURER QMK +#define PRODUCT 5291 keyboard converter +#define DESCRIPTION 5291 keyboard converter + +#define MATRIX_ROWS 24 +#define MATRIX_COLS 4 + +#define MATRIX_ROW_PINS {B2, B3, B4, B5, B6} +#define MATRIX_COL_PINS {B0, B1} +#define MATRIX_DATA_PIN D0 +#define MATRIX_STROBE_PIN D1 +#define LED_PIN D6 + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 0 + + diff --git a/keyboards/converter/ibm_5291/ibm_5291.c b/keyboards/converter/ibm_5291/ibm_5291.c new file mode 100644 index 000000000..9b937a545 --- /dev/null +++ b/keyboards/converter/ibm_5291/ibm_5291.c @@ -0,0 +1,3 @@ +#include "ibm_5291.h" +#include <avr/io.h> +#include "quantum.h"
\ No newline at end of file diff --git a/keyboards/converter/ibm_5291/ibm_5291.h b/keyboards/converter/ibm_5291/ibm_5291.h new file mode 100644 index 000000000..aa1b40324 --- /dev/null +++ b/keyboards/converter/ibm_5291/ibm_5291.h @@ -0,0 +1,69 @@ +/* +Copyright 2018 listofoptions <listofoptions@gmail.com> + +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" + +/* + * ,-------. ,--------------------------------------------------------------------------. + * | F1| F2| |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS |NumLck |ScrLck | + * |-------| |--------------------------------------------------------------------------| + * | F3| F4| | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ] | | 7| 8| 9| -| + * |-------| |------------------------------------------------------|Ent|---------------| + * | F5| F6| | Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| | 4| 5| 6| | + * |-------| |----------------------------------------------------------------------| | + * | F7| F8| |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift|PrS| 1| 2| 3| +| + * |-------| |----------------------------------------------------------------------| | + * | F9|F10| | Alt | Space |CapsLck| 0 | . | | + * `-------' `--------------------------------------------------------------------------' +*/ + +#define LAYOUT_5291( \ + KEY_F1,KEY_F2, KEY_ESC, KEY_1, KEY_2,KEY_3,KEY_4,KEY_5,KEY_6,KEY_7,KEY_8,KEY_9, KEY_0, KEY_MIN, KEY_EQU, KEY_BACK, KEY_NLOCK, KEY_SLOCK, \ + KEY_F3,KEY_F4, KEY_TAB, KEY_Q, KEY_W,KEY_E,KEY_R,KEY_T,KEY_Y,KEY_U,KEY_I,KEY_O, KEY_P, KEY_LBRC,KEY_RBRC, KEY_PAD7,KEY_PAD8, KEY_PAD9,KEY_PMIN, \ + KEY_F5,KEY_F6, KEY_LCTR,KEY_A, KEY_S,KEY_D,KEY_F,KEY_G,KEY_H,KEY_J,KEY_K,KEY_L, KEY_SEMI,KEY_QUOT,KEY_TICK, KEY_ENTR,KEY_PAD4,KEY_PAD5, KEY_PAD6, \ + KEY_F7,KEY_F8, KEY_LSFS,KEY_BSLS,KEY_Z,KEY_X,KEY_C,KEY_V,KEY_B,KEY_N,KEY_M,KEY_COMM,KEY_DOT, KEY_SLS,KEY_RSFS, KEY_PAST,KEY_PAD1,KEY_PAD2, KEY_PAD3,KEY_PPLS, \ + KEY_F9,KEY_F10, KEY_LALT, KEY_SPACE, KEY_CLOCK, KEY_PAD0, KEY_PDOT \ +) \ +{ {KEY_Z, KEY_S, KEY_W, KEY_3 }\ +, {KEY_X, KEY_D, KEY_E, KEY_4 }\ +, {KEY_C, KEY_F, KEY_R, KEY_5 }\ +, {KEY_V, KEY_G, KEY_T, KEY_6 }\ +, {KEY_B, KEY_H, KEY_Y, KEY_7 }\ +, {KEY_N, KEY_J, KEY_U, KEY_8 }\ +, {KEY_PAD2, KEY_PAD5,KEY_PAD8,KEY_NLOCK }\ +, {KEY_M, KEY_K, KEY_I, KEY_9 }\ +, {KEY_COMM, KEY_L, KEY_O, KEY_0 }\ +, {KEY_DOT, KEY_SEMI,KEY_P, KEY_MIN }\ +, {KEY_SLS, KEY_QUOT,KEY_LBRC,KEY_EQU }\ +, {KEY_SPACE, KEY_RSFS,KEY_TICK,KEY_RBRC }\ +, {KEY_CLOCK, KEY_PAST,KEY_ENTR,KEY_BACK }\ +, {KEY_PAD0, KEY_PAD1,KEY_PAD4,KEY_PAD7 }\ +, {KEY_PPLS, KC_NO, KEY_PMIN,KEY_SLOCK }\ +, {KEY_PDOT, KEY_PAD3,KEY_PAD6,KEY_PAD9 }\ +, {KEY_BSLS, KEY_A, KEY_Q, KEY_2 }\ +, {KEY_LALT, KC_NO, KC_NO, KEY_1 }\ +, {KEY_F7, KEY_F5, KEY_F3, KEY_F1 }\ +, {KEY_F8, KEY_F6, KEY_F4, KEY_F2 }\ +, {KC_F10, KC_NO, KC_NO, KC_NO }\ +, {KC_F9, KC_NO, KC_NO, KC_NO }\ +, {KEY_LSFS, KEY_LCTR,KEY_TAB, KEY_ESC }\ +, {KC_NO, KC_NO, KC_NO, KC_NO }\ +} + +#define LAYOUT LAYOUT_5291
\ No newline at end of file diff --git a/keyboards/converter/ibm_5291/info.json b/keyboards/converter/ibm_5291/info.json new file mode 100644 index 000000000..2cb3b76c2 --- /dev/null +++ b/keyboards/converter/ibm_5291/info.json @@ -0,0 +1,97 @@ +{ + "keyboard_name": "IBM 5291", + "keyboard_folder": "converter/ibm_5291", + "url": "https://deskthority.net/wiki/IBM_Model_F#IBM_5291_Keyboard", + "maintainer": "listofoptions", + "width": 21, + "height": 5, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Sys Req", "x":0, "y":0}, + {"label":"Cmd", "x":1, "y":0}, + {"label":"`", "x":2.25, "y":0}, + {"label":"1", "x":3.25, "y":0}, + {"label":"2", "x":4.25, "y":0}, + {"label":"3", "x":5.25, "y":0}, + {"label":"4", "x":6.25, "y":0}, + {"label":"5", "x":7.25, "y":0}, + {"label":"6", "x":8.25, "y":0}, + {"label":"7", "x":9.25, "y":0}, + {"label":"8", "x":10.25, "y":0}, + {"label":"9", "x":11.25, "y":0}, + {"label":"0", "x":12.25, "y":0}, + {"label":"-", "x":13.25, "y":0}, + {"label":"=", "x":14.25, "y":0}, + {"label":"Backspace", "x":15.25, "y":0, "w":1.75}, + {"label":"Reverse Tab", "x":17, "y":0, "w":2}, + {"label":"Dup", "x":19, "y":0, "w":2}, + {"label":"Del", "x":0, "y":1}, + {"label":"Erase Input", "x":1, "y":1}, + {"label":"Tab", "x":2.25, "y":1, "w":1.5}, + {"label":"Q", "x":3.75, "y":1}, + {"label":"W", "x":4.75, "y":1}, + {"label":"E", "x":5.75, "y":1}, + {"label":"R", "x":6.75, "y":1}, + {"label":"T", "x":7.75, "y":1}, + {"label":"Y", "x":8.75, "y":1}, + {"label":"U", "x":9.75, "y":1}, + {"label":"I", "x":10.75, "y":1}, + {"label":"O", "x":11.75, "y":1}, + {"label":"P", "x":12.75, "y":1}, + {"label":"¢", "x":13.75, "y":1}, + {"label":"\\", "x":14.75, "y":1, "w":1.25}, + {"label":"7", "x":17, "y":1}, + {"label":"8", "x":18, "y":1}, + {"label":"9", "x":19, "y":1}, + {"label":"Field -", "x":20, "y":1}, + {"label":"Print", "x":0, "y":2}, + {"label":"Help", "x":1, "y":2}, + {"label":"Caps Lock", "x":2.25, "y":2, "w":1.75}, + {"label":"A", "x":4, "y":2}, + {"label":"S", "x":5, "y":2}, + {"label":"D", "x":6, "y":2}, + {"label":"F", "x":7, "y":2}, + {"label":"G", "x":8, "y":2}, + {"label":"H", "x":9, "y":2}, + {"label":"J", "x":10, "y":2}, + {"label":"K", "x":11, "y":2}, + {"label":"L", "x":12, "y":2}, + {"label":";", "x":13, "y":2}, + {"label":"'", "x":14, "y":2}, + {"label":"{", "x":15, "y":2}, + {"label":"Field Exit", "x":16, "y":1, "h":2}, + {"label":"4", "x":17, "y":2}, + {"label":"5", "x":18, "y":2}, + {"label":"6", "x":19, "y":2}, + {"label":"Roll Up", "x":0, "y":3}, + {"label":"Roll Down", "x":1, "y":3}, + {"label":"Shift", "x":2.25, "y":3, "w":1.25}, + {"label":"<", "x":3.5, "y":3}, + {"label":"Z", "x":4.5, "y":3}, + {"label":"X", "x":5.5, "y":3}, + {"label":"C", "x":6.5, "y":3}, + {"label":"V", "x":7.5, "y":3}, + {"label":"B", "x":8.5, "y":3}, + {"label":"N", "x":9.5, "y":3}, + {"label":"M", "x":10.5, "y":3}, + {"label":",", "x":11.5, "y":3}, + {"label":".", "x":12.5, "y":3}, + {"label":"/", "x":13.5, "y":3}, + {"label":"Shift", "x":14.5, "y":3, "w":1.5}, + {"label":"Return", "x":16, "y":3}, + {"label":"1", "x":17, "y":3}, + {"label":"2", "x":18, "y":3}, + {"label":"3", "x":19, "y":3}, + {"label":"Field +", "x":20, "y":2, "h":3}, + {"label":"Left", "x":0, "y":4}, + {"label":"Right", "x":1, "y":4}, + {"label":"Error Reset", "x":2.25, "y":4, "w":2}, + {"label":"Space", "x":4.25, "y":4, "w":9.75}, + {"label":"Enter Rec Adv", "x":14, "y":4, "w":2}, + {"label":"0", "x":16, "y":4, "w":2}, + {"label":".", "x":18, "y":4, "w":2} + ] + } + } +} diff --git a/keyboards/converter/ibm_5291/keymaps/default/keymap.c b/keyboards/converter/ibm_5291/keymaps/default/keymap.c new file mode 100644 index 000000000..9b286c887 --- /dev/null +++ b/keyboards/converter/ibm_5291/keymaps/default/keymap.c @@ -0,0 +1,233 @@ +/* +Copyright 2018 listofoptions <listofoptions@gmail.com> + +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 xt_keycodes + { XT_PAST = SAFE_RANGE // XT pad asterisk / print screen + , XT_SLCK // XT scroll lock / break + , XT_F6 // F6 / app key + , XT_F5 // F5 / gui + , XT_F9 // F9 / F11 + , XT_F10 // F10 / F12 + } ; + +static bool shift_pressed = false , + alt_pressed = false , + ctrl_pressed = false , + xt_pscr_pressed = false , + xt_brk_pressed = false , + xt_app_pressed = false , + xt_gui_pressed = false , + xt_lout_pressed = false , + xt_f11_pressed = false , + xt_f12_pressed = false ; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_LSFT: + case KC_RSFT: + if (record->event.pressed) { + shift_pressed = true ; + } else { + shift_pressed = false ; + } + return true; + break; + + case KC_LALT: + if (record->event.pressed) { + alt_pressed = true ; + } else { + alt_pressed = false ; + } + return true; + break; + + case KC_LCTL: + if (record->event.pressed) { + ctrl_pressed = true ; + } else { + ctrl_pressed = false ; + } + return true; + break; + + case XT_PAST: + if (record->event.pressed) { + if (shift_pressed) { + xt_pscr_pressed = true ; + register_code(KC_PSCR); + } else { + register_code(KC_PAST); + } + } else { + if (xt_pscr_pressed) { + xt_pscr_pressed = false ; + unregister_code(KC_PSCR); + } else { + unregister_code(KC_PAST); + } + } + return false; + break; + + case XT_SLCK: + if (record->event.pressed) { + if (ctrl_pressed) { + xt_brk_pressed = true ; + register_code(KC_BRK); + } else { + register_code(KC_SLCK); + } + } else { + if (xt_brk_pressed) { + xt_brk_pressed = false ; + unregister_code(KC_BRK); + } else { + unregister_code(KC_SLCK); + } + } + return false; + break; + + case XT_F6: + if (record->event.pressed) { + if (shift_pressed) { + xt_app_pressed = true ; + register_code(KC_APP); + } else { + register_code(KC_F6); + } + } else { + if (xt_app_pressed) { + xt_app_pressed = false ; + unregister_code(KC_APP); + } else { + unregister_code(KC_F6); + } + } + return false; + break; + + case XT_F5: + if (record->event.pressed) { + if (shift_pressed) { + xt_gui_pressed = true ; + register_code(KC_LGUI); + } else if (ctrl_pressed) { + xt_lout_pressed = true ; + register_code (KC_LGUI) ; + register_code (KC_L) ; + } else { + register_code(KC_F5); + } + } else { + if (xt_gui_pressed) { + xt_gui_pressed = false ; + unregister_code(KC_LGUI); + } else if (xt_lout_pressed) { + xt_lout_pressed = false ; + unregister_code (KC_LGUI) ; + unregister_code (KC_L) ; + } else { + unregister_code(KC_F5); + } + } + return false; + break; + + case XT_F9: + if (record->event.pressed) { + if (shift_pressed) { + xt_f11_pressed = true ; + register_code(KC_F11); + } else { + register_code(KC_F9); + } + } else { + if (xt_f11_pressed) { + xt_f11_pressed = false ; + unregister_code(KC_F11); + } else { + unregister_code(KC_F9); + } + } + return false; + break; + + case XT_F10: + if (record->event.pressed) { + if (shift_pressed) { + xt_f12_pressed = true ; + register_code(KC_F12); + } else { + register_code(KC_F10); + } + } else { + if (xt_f12_pressed) { + xt_f12_pressed = false ; + unregister_code(KC_F12); + } else { + unregister_code(KC_F10); + } + } + return false; + break; + + default: + return true; + break; + } + + return true; +} +*/ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +// default layout is the standard XT layout +/* + * ,-------. ,--------------------------------------------------------------------------. + * | F1| F2| |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS |NumLck |ScrLck | + * |-------| |--------------------------------------------------------------------------| + * | F3| F4| | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ] | | 7| 8| 9| -| + * |-------| |------------------------------------------------------|Ent|---------------| + * | F5| F6| | Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| | 4| 5| 6| | + * |-------| |----------------------------------------------------------------------| | + * | F7| F8| |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift| *| 1| 2| 3| +| + * |-------| |----------------------------------------------------------------------| | + * | F9|F10| | Alt | Space |CapsLck| 0 | . | | + * `-------' `--------------------------------------------------------------------------' +*/ +/* + [0] = LAYOUT ( + KC_F1,KC_F2, 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_NLCK, XT_SLCK, + KC_F3,KC_F4, 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_P7,KC_P8, KC_P9, KC_PMNS, + XT_F5,XT_F6, 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_GRV, KC_ENT, KC_P4,KC_P5, KC_P6, + KC_F7,KC_F8, KC_LSFT,KC_BSLS,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT, KC_SLSH,KC_RSFT,XT_PAST,KC_P1,KC_P2, KC_P3, KC_PPLS, + XT_F9,XT_F10,KC_LALT, KC_SPACE, KC_CAPS, KC_P0, KC_PDOT + ) +*/ + [0] = LAYOUT ( + KC_F1,KC_F2, 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_NLCK, KC_SLCK, + KC_F3,KC_F4, 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_P7,KC_P8, KC_P9, KC_PMNS, + KC_F5,KC_F6, 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_GRV, KC_ENT, KC_P4,KC_P5, KC_P6, + KC_F7,KC_F8, KC_LSFT,KC_BSLS,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT, KC_SLSH,KC_RSFT,KC_PAST,KC_P1,KC_P2, KC_P3, KC_PPLS, + KC_F9,KC_F10,KC_LALT, KC_SPACE, KC_CAPS, KC_P0, KC_PDOT + ) +} ; + diff --git a/keyboards/converter/ibm_5291/keymaps/kbdbabel_doc_ibm5291_kbd.pdf b/keyboards/converter/ibm_5291/keymaps/kbdbabel_doc_ibm5291_kbd.pdf Binary files differnew file mode 100644 index 000000000..3560598f0 --- /dev/null +++ b/keyboards/converter/ibm_5291/keymaps/kbdbabel_doc_ibm5291_kbd.pdf diff --git a/keyboards/converter/ibm_5291/matrix.c b/keyboards/converter/ibm_5291/matrix.c new file mode 100644 index 000000000..58f6e37b6 --- /dev/null +++ b/keyboards/converter/ibm_5291/matrix.c @@ -0,0 +1,284 @@ +/* +Copyright 2018 listofoptions <listofoptions@gmail.com> + +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 <stdint.h> +#include <stdbool.h> +#include <string.h> +#if defined(__AVR__) +#include <avr/io.h> +#endif +#include <util/delay.h> + +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "timer.h" + +#include "config.h" + + +#ifndef DEBOUNCING_DELAY +# define DEBOUNCING_DELAY 5 +#endif + +#define print_matrix_header() print("\nr/c 01234567\n") +#define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +#define matrix_bitpop(i) bitpop(matrix[i]) +#define ROW_SHIFTER ((uint8_t)1) +#define check_bit(var,pos) ((var) & (1<<(pos))) + +#define NUM_ROW_PINS 5 +#define NUM_COL_PINS 2 + +static const uint8_t row_pins [NUM_ROW_PINS] = MATRIX_ROW_PINS ; +static const uint8_t col_pins [NUM_ROW_PINS] = MATRIX_COL_PINS ; + +#if ( DEBOUNCING_DELAY > 0 ) +static uint16_t debouncing_time ; +static bool debouncing = false ; +#endif + +static uint8_t matrix [MATRIX_ROWS] = {0}; + +#if ( DEBOUNCING_DELAY > 0 ) +static uint8_t matrix_debounce [MATRIX_ROWS] = {0}; +#endif + +static +inline +void toggle_led(void) { + uint8_t pin = LED_PIN ; + _SFR_IO8((pin >> 4) + 2) ^= _BV(pin & 0xF); +} + +static +inline +void init_led(void) { + uint8_t pin = LED_PIN ; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static +inline +void init_data(void) { + uint8_t pin = MATRIX_DATA_PIN ; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // LO +} + +static +inline +void init_strobe(void) { + uint8_t pin = MATRIX_STROBE_PIN ; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI +} + +static +inline +void init_rows(void) { + for ( uint8_t i = 0 ; i < NUM_ROW_PINS; ++i ) { + uint8_t pin = row_pins[i]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW + } +} + +static +inline +void init_cols(void) { + for ( uint8_t i = 0 ; i < NUM_COL_PINS; ++i ) { + uint8_t pin = col_pins[i]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW + } +} + +static +inline +void select_row(uint8_t current_row) { + for ( uint8_t i = 0 ; i < NUM_ROW_PINS; ++i ) { + uint8_t pin = row_pins[i] ; + if ( check_bit( current_row, i ) ) { + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } else { + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW + } + } + wait_us(30) ; +} + +static +inline +void select_col(uint8_t current_col) { + for ( uint8_t i = 0 ; i < NUM_COL_PINS; ++i ) { + uint8_t pin = col_pins[i] ; + if ( check_bit( current_col, i ) ) { + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } else { + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW + } + } + wait_us(30) ; +} + +static +inline +uint8_t matrix_strobe(uint8_t col_index) { + uint8_t strobe_pin = MATRIX_STROBE_PIN ; + uint8_t data_pin = MATRIX_DATA_PIN ; + + // set strobe pin low + _SFR_IO8((strobe_pin >> 4) + 2) &= ~_BV(strobe_pin & 0xF); + + wait_us(30) ; + + // read data + uint8_t data = (_SFR_IO8(data_pin >> 4) & _BV(data_pin & 0xF)) ; + + // set strobe pin hi + _SFR_IO8((strobe_pin >> 4) + 2) |= _BV(strobe_pin & 0xF); + + uint8_t out = data ? (1 << col_index) : 0 ; + return out ; +} + +static +bool matrix_read(uint8_t current_matrix[], uint8_t current_row) { + // Store last value of row prior to reading + uint8_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + select_row(current_row); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; ++col_index) { + + select_col(col_index) ; + + // strobe the matrix + // Populate the matrix row with the state of the data pin + current_matrix[current_row] |= matrix_strobe(col_index) ; + } + + bool test = last_row_value != current_matrix[current_row] ; + return test ; +} + +__attribute__ ((weak)) +void matrix_init_quantum(void) { + matrix_init_kb(); +} + +__attribute__ ((weak)) +void matrix_scan_quantum(void) { + matrix_scan_kb(); +} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +inline +uint8_t matrix_rows(void) { + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) { + return MATRIX_COLS; +} + +inline +uint8_t matrix_get_row(uint8_t row) { + return matrix[row]; +} + +void matrix_init(void) { + init_led() ; + init_rows() ; + init_cols() ; + init_data() ; + init_strobe() ; + + // initialize matrix state: all keys off + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; +# if (DEBOUNCING_DELAY > 0) + matrix_debounce [i] = 0; +# endif + } + + matrix_init_quantum() ; +} + +uint8_t matrix_scan(void) { + for ( uint8_t current_row = 0; current_row < MATRIX_ROWS; ++current_row ) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = matrix_read(matrix_debounce, current_row); + + if (matrix_changed) { + debouncing = true ; + debouncing_time = timer_read(); + } + +# else + matrix_read(matrix, current_row); +# endif + } + +# if (DEBOUNCING_DELAY > 0) + if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debounce[i]; + } + debouncing = false; + } +# endif + + matrix_scan_quantum(); + return 1; +} + +void matrix_print(void) { + print_matrix_header(); + + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + phex(row); print(": "); + print_matrix_row(row); + print("\n"); + } +} diff --git a/keyboards/converter/ibm_5291/matrix.csv b/keyboards/converter/ibm_5291/matrix.csv new file mode 100644 index 000000000..40462c214 --- /dev/null +++ b/keyboards/converter/ibm_5291/matrix.csv @@ -0,0 +1,96 @@ +0,Z +1,S +2,W +3,3 +4,X +5,D +6,E +7,4 +8,C +9,F +10,R +11,5 +12,V +13,G +14,T +15,6 +16,B +17,H +18,Y +19,7 +20,N +21,J +22,U +23,8 +24,PAD_2 +25,PAD_5 +26,PAD_8 +27,NUM_LOCK +28,M +29,K +30,I +31,9 +32,COMMA +33,L +34,O +35,0 +36,PERIOD +37,SEMICOLON +38,P +39,MINUS +40,SLASH +41,QUOTE +42,LEFT_BRACE +43,EQUAL +44,SPACE +45,RSHIFT +46,BACK_QUOTE +47,RIGHT_BRACE +48,CAPS_LOCK +49,PAD_ASTERIX +50,ENTER +51,BACKSPACE +52,PAD_0 +53,PAD_1 +54,PAD_4 +55,PAD_7 +56,PAD_PLUS +57,UNASSIGNED +58,PAD_MINUS +59,SCROLL_LOCK +60,PAD_PERIOD +61,PAD_3 +62,PAD_6 +63,PAD_9 +64,BACKSLASH +65,A +66,Q +67,2 +68,LALT +69,UNASSIGNED +70,UNASSIGNED +71,1 +72,F7 +73,F5 +74,F3 +75,F1 +76,F8 +77,F6 +78,F4 +79,F2 +80,F10 +81,UNASSIGNED +82,UNASSIGNED +83,UNASSIGNED +84,F9 +85,UNASSIGNED +86,UNASSIGNED +87,UNASSIGNED +88,LSHIFT +89,LCTRL +90,TAB +91,ESC +92,UNASSIGNED +93,UNASSIGNED +94,UNASSIGNED +95,UNASSIGNED diff --git a/keyboards/converter/ibm_5291/readme.md b/keyboards/converter/ibm_5291/readme.md new file mode 100644 index 000000000..03406d3f9 --- /dev/null +++ b/keyboards/converter/ibm_5291/readme.md @@ -0,0 +1,72 @@ +# IBM 5291 keyboard converter + +[IBM 5291](https://deskthority.net/wiki/IBM_Model_F#IBM_5291_Keyboard) + +A converter for the eponymous keyboard. + +Keyboard Maintainer: [Listofoptions](https://github.com/listofoptions) +Hardware Supported: IBM 5291, Teensy 2.0 + +Make example for this keyboard (after setting up your build environment): + + make converter/ibm_5291:default + +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). + + +The pinout is as follows: + +IBM−5291−Cable to Pinhead−14 + +| pin | description +----|------------------------ +1 | GND +2 | NC +3 | GND +4 | GN) +5 | +5V +6 | D0 +7 | D1 +8 | D2 +9 | D3 +10| D4 +11| D5 +12| D6 +13| Strobe +14| Out + +The pins on this connector are organized +![here](https://geekhack.org/index.php?action=dlattach;topic=48950.0;attach=36759;image) + +IBM−5291−2 Cable with DB15M connector + +| pin | description +----|------------- +|1,2,3 | GND +|4 | +5V +|5 | D0 +|6 | D1 +|7 | D2 +|8 | D3 +|9 | D4 +|10 | D5 +|11 | D6 +|12 | Strobe +|13 | Out +|14 | PE +|15 | NC + +The above connector is actually numbered so it should be easier to determine +where the needed connections are. + +To connect to the teensy, the following are pins are needed (if you should choose not set your own): + +* PB0 -> PB6 are connected to D0 -> D6 +* +5V is connected to the corresponding teensy pin +* gnd is as well, only one of the gnd pins needs to be connected though. +* strobe is connected to pin PD1 +* data is connected to PD0 +* PE does not need to be connected to anything, but it could also be connected to gnd + +sources: + http://www.retrocomputing.eu/documents/5291_MaintenanceLibrary.pdf diff --git a/keyboards/converter/ibm_5291/rules.mk b/keyboards/converter/ibm_5291/rules.mk new file mode 100644 index 000000000..ca0c850c0 --- /dev/null +++ b/keyboards/converter/ibm_5291/rules.mk @@ -0,0 +1,72 @@ +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + +# Bootloader +# This definition is optional, and if your keyboard supports multiple bootloaders of +# different sizes, comment this out, and the correct address will be loaded +# automatically (+60). See bootloader.mk for all options. +BOOTLOADER = halfkay + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +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 +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. +API_SYSEX_ENABLE = no +SPLIT_KEYBOARD = no +WAIT_FOR_USB = yes + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +LAYOUTS_HAS_RGB = NO + +CUSTOM_MATRIX = yes +SRC = matrix.c
\ No newline at end of file |