aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlistofoptions <39714365+listofoptions@users.noreply.github.com>2018-11-26 12:53:49 -0500
committerDrashna Jaelre <drashna@live.com>2018-11-26 09:53:49 -0800
commit4ebd27002a344b017276dc70796435a8e718f46a (patch)
tree4414504e6cd7d6192f77b918f576abe2b91d4e41
parentf3ffd6ad50f0a4bf24f0a0453cc5502b4b88f390 (diff)
downloadqmk_firmware-4ebd27002a344b017276dc70796435a8e718f46a.tar.gz
qmk_firmware-4ebd27002a344b017276dc70796435a8e718f46a.zip
Keyboard: 5291 firmware to replace the existing soarers controller firmware (#4483)
* compiles but is not working * still testing 5291 * compiles but is not working * still testing 5291 * fixed a but in the layout (reversed key order in row) * compiles but is not working * still testing 5291 * fixed a but in the layout (reversed key order in row) * fixed some issues * doumentation needed * doumentation needed * documentation needed * documentation needed * Update readme.md documentation * Update readme.md i dislike markdown <_> * merge preperation
-rw-r--r--keyboards/converter/ibm_5291/config.h42
-rw-r--r--keyboards/converter/ibm_5291/ibm_5291.c3
-rw-r--r--keyboards/converter/ibm_5291/ibm_5291.h69
-rw-r--r--keyboards/converter/ibm_5291/info.json6
-rw-r--r--keyboards/converter/ibm_5291/keymaps/default/keymap.c233
-rw-r--r--keyboards/converter/ibm_5291/keymaps/kbdbabel_doc_ibm5291_kbd.pdfbin0 -> 13054 bytes
-rw-r--r--keyboards/converter/ibm_5291/matrix.c284
-rw-r--r--keyboards/converter/ibm_5291/matrix.csv96
-rw-r--r--keyboards/converter/ibm_5291/readme.md70
-rw-r--r--keyboards/converter/ibm_5291/rules.mk72
10 files changed, 875 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 @@
1/*
2Copyright 2018 listofoptions <listofoptions@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "config_common.h"
21
22#define VENDOR_ID 0xFEED
23#define PRODUCT_ID 0x6060
24#define DEVICE_VER 1
25#define MANUFACTURER QMK
26#define PRODUCT 5291 keyboard converter
27#define DESCRIPTION 5291 keyboard converter
28
29#define MATRIX_ROWS 24
30#define MATRIX_COLS 4
31
32#define MATRIX_ROW_PINS {B2, B3, B4, B5, B6}
33#define MATRIX_COL_PINS {B0, B1}
34#define MATRIX_DATA_PIN D0
35#define MATRIX_STROBE_PIN D1
36#define LED_PIN D6
37
38
39/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
40#define DEBOUNCING_DELAY 0
41
42
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 @@
1#include "ibm_5291.h"
2#include <avr/io.h>
3#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 @@
1/*
2Copyright 2018 listofoptions <listofoptions@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "quantum.h"
21
22/*
23 * ,-------. ,--------------------------------------------------------------------------.
24 * | F1| F2| |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS |NumLck |ScrLck |
25 * |-------| |--------------------------------------------------------------------------|
26 * | F3| F4| | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ] | | 7| 8| 9| -|
27 * |-------| |------------------------------------------------------|Ent|---------------|
28 * | F5| F6| | Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| | 4| 5| 6| |
29 * |-------| |----------------------------------------------------------------------| |
30 * | F7| F8| |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift|PrS| 1| 2| 3| +|
31 * |-------| |----------------------------------------------------------------------| |
32 * | F9|F10| | Alt | Space |CapsLck| 0 | . | |
33 * `-------' `--------------------------------------------------------------------------'
34*/
35
36#define LAYOUT_5291( \
37 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, \
38 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, \
39 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, \
40 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, \
41 KEY_F9,KEY_F10, KEY_LALT, KEY_SPACE, KEY_CLOCK, KEY_PAD0, KEY_PDOT \
42) \
43{ {KEY_Z, KEY_S, KEY_W, KEY_3 }\
44, {KEY_X, KEY_D, KEY_E, KEY_4 }\
45, {KEY_C, KEY_F, KEY_R, KEY_5 }\
46, {KEY_V, KEY_G, KEY_T, KEY_6 }\
47, {KEY_B, KEY_H, KEY_Y, KEY_7 }\
48, {KEY_N, KEY_J, KEY_U, KEY_8 }\
49, {KEY_PAD2, KEY_PAD5,KEY_PAD8,KEY_NLOCK }\
50, {KEY_M, KEY_K, KEY_I, KEY_9 }\
51, {KEY_COMM, KEY_L, KEY_O, KEY_0 }\
52, {KEY_DOT, KEY_SEMI,KEY_P, KEY_MIN }\
53, {KEY_SLS, KEY_QUOT,KEY_LBRC,KEY_EQU }\
54, {KEY_SPACE, KEY_RSFS,KEY_TICK,KEY_RBRC }\
55, {KEY_CLOCK, KEY_PAST,KEY_ENTR,KEY_BACK }\
56, {KEY_PAD0, KEY_PAD1,KEY_PAD4,KEY_PAD7 }\
57, {KEY_PPLS, KC_NO, KEY_PMIN,KEY_SLOCK }\
58, {KEY_PDOT, KEY_PAD3,KEY_PAD6,KEY_PAD9 }\
59, {KEY_BSLS, KEY_A, KEY_Q, KEY_2 }\
60, {KEY_LALT, KC_NO, KC_NO, KEY_1 }\
61, {KEY_F7, KEY_F5, KEY_F3, KEY_F1 }\
62, {KEY_F8, KEY_F6, KEY_F4, KEY_F2 }\
63, {KC_F10, KC_NO, KC_NO, KC_NO }\
64, {KC_F9, KC_NO, KC_NO, KC_NO }\
65, {KEY_LSFS, KEY_LCTR,KEY_TAB, KEY_ESC }\
66, {KC_NO, KC_NO, KC_NO, KC_NO }\
67}
68
69#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..080a16336
--- /dev/null
+++ b/keyboards/converter/ibm_5291/info.json
@@ -0,0 +1,6 @@
1{
2 "keyboard_name": "IBM 5291",
3 "keyboard_folder": "converter/5291",
4 "url": "https://deskthority.net/wiki/IBM_Model_F#IBM_5291_Keyboard",
5 "maintainer": "listofoptions",
6}
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 @@
1/*
2Copyright 2018 listofoptions <listofoptions@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include QMK_KEYBOARD_H
19/*
20enum xt_keycodes
21 { XT_PAST = SAFE_RANGE // XT pad asterisk / print screen
22 , XT_SLCK // XT scroll lock / break
23 , XT_F6 // F6 / app key
24 , XT_F5 // F5 / gui
25 , XT_F9 // F9 / F11
26 , XT_F10 // F10 / F12
27 } ;
28
29static bool shift_pressed = false ,
30 alt_pressed = false ,
31 ctrl_pressed = false ,
32 xt_pscr_pressed = false ,
33 xt_brk_pressed = false ,
34 xt_app_pressed = false ,
35 xt_gui_pressed = false ,
36 xt_lout_pressed = false ,
37 xt_f11_pressed = false ,
38 xt_f12_pressed = false ;
39
40bool process_record_user(uint16_t keycode, keyrecord_t *record) {
41 switch (keycode) {
42 case KC_LSFT:
43 case KC_RSFT:
44 if (record->event.pressed) {
45 shift_pressed = true ;
46 } else {
47 shift_pressed = false ;
48 }
49 return true;
50 break;
51
52 case KC_LALT:
53 if (record->event.pressed) {
54 alt_pressed = true ;
55 } else {
56 alt_pressed = false ;
57 }
58 return true;
59 break;
60
61 case KC_LCTL:
62 if (record->event.pressed) {
63 ctrl_pressed = true ;
64 } else {
65 ctrl_pressed = false ;
66 }
67 return true;
68 break;
69
70 case XT_PAST:
71 if (record->event.pressed) {
72 if (shift_pressed) {
73 xt_pscr_pressed = true ;
74 register_code(KC_PSCR);
75 } else {
76 register_code(KC_PAST);
77 }
78 } else {
79 if (xt_pscr_pressed) {
80 xt_pscr_pressed = false ;
81 unregister_code(KC_PSCR);
82 } else {
83 unregister_code(KC_PAST);
84 }
85 }
86 return false;
87 break;
88
89 case XT_SLCK:
90 if (record->event.pressed) {
91 if (ctrl_pressed) {
92 xt_brk_pressed = true ;
93 register_code(KC_BRK);
94 } else {
95 register_code(KC_SLCK);
96 }
97 } else {
98 if (xt_brk_pressed) {
99 xt_brk_pressed = false ;
100 unregister_code(KC_BRK);
101 } else {
102 unregister_code(KC_SLCK);
103 }
104 }
105 return false;
106 break;
107
108 case XT_F6:
109 if (record->event.pressed) {
110 if (shift_pressed) {
111 xt_app_pressed = true ;
112 register_code(KC_APP);
113 } else {
114 register_code(KC_F6);
115 }
116 } else {
117 if (xt_app_pressed) {
118 xt_app_pressed = false ;
119 unregister_code(KC_APP);
120 } else {
121 unregister_code(KC_F6);
122 }
123 }
124 return false;
125 break;
126
127 case XT_F5:
128 if (record->event.pressed) {
129 if (shift_pressed) {
130 xt_gui_pressed = true ;
131 register_code(KC_LGUI);
132 } else if (ctrl_pressed) {
133 xt_lout_pressed = true ;
134 register_code (KC_LGUI) ;
135 register_code (KC_L) ;
136 } else {
137 register_code(KC_F5);
138 }
139 } else {
140 if (xt_gui_pressed) {
141 xt_gui_pressed = false ;
142 unregister_code(KC_LGUI);
143 } else if (xt_lout_pressed) {
144 xt_lout_pressed = false ;
145 unregister_code (KC_LGUI) ;
146 unregister_code (KC_L) ;
147 } else {
148 unregister_code(KC_F5);
149 }
150 }
151 return false;
152 break;
153
154 case XT_F9:
155 if (record->event.pressed) {
156 if (shift_pressed) {
157 xt_f11_pressed = true ;
158 register_code(KC_F11);
159 } else {
160 register_code(KC_F9);
161 }
162 } else {
163 if (xt_f11_pressed) {
164 xt_f11_pressed = false ;
165 unregister_code(KC_F11);
166 } else {
167 unregister_code(KC_F9);
168 }
169 }
170 return false;
171 break;
172
173 case XT_F10:
174 if (record->event.pressed) {
175 if (shift_pressed) {
176 xt_f12_pressed = true ;
177 register_code(KC_F12);
178 } else {
179 register_code(KC_F10);
180 }
181 } else {
182 if (xt_f12_pressed) {
183 xt_f12_pressed = false ;
184 unregister_code(KC_F12);
185 } else {
186 unregister_code(KC_F10);
187 }
188 }
189 return false;
190 break;
191
192 default:
193 return true;
194 break;
195 }
196
197 return true;
198}
199*/
200
201const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
202// default layout is the standard XT layout
203/*
204 * ,-------. ,--------------------------------------------------------------------------.
205 * | F1| F2| |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS |NumLck |ScrLck |
206 * |-------| |--------------------------------------------------------------------------|
207 * | F3| F4| | Tab | Q| W| E| R| T| Y| U| I| O| P| [| ] | | 7| 8| 9| -|
208 * |-------| |------------------------------------------------------|Ent|---------------|
209 * | F5| F6| | Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `| | 4| 5| 6| |
210 * |-------| |----------------------------------------------------------------------| |
211 * | F7| F8| |Shif| \| Z| X| C| V| B| N| M| ,| .| /|Shift| *| 1| 2| 3| +|
212 * |-------| |----------------------------------------------------------------------| |
213 * | F9|F10| | Alt | Space |CapsLck| 0 | . | |
214 * `-------' `--------------------------------------------------------------------------'
215*/
216/*
217 [0] = LAYOUT (
218 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,
219 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,
220 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,
221 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,
222 XT_F9,XT_F10,KC_LALT, KC_SPACE, KC_CAPS, KC_P0, KC_PDOT
223 )
224*/
225 [0] = LAYOUT (
226 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,
227 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,
228 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,
229 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,
230 KC_F9,KC_F10,KC_LALT, KC_SPACE, KC_CAPS, KC_P0, KC_PDOT
231 )
232} ;
233
diff --git a/keyboards/converter/ibm_5291/keymaps/kbdbabel_doc_ibm5291_kbd.pdf b/keyboards/converter/ibm_5291/keymaps/kbdbabel_doc_ibm5291_kbd.pdf
new file mode 100644
index 000000000..3560598f0
--- /dev/null
+++ b/keyboards/converter/ibm_5291/keymaps/kbdbabel_doc_ibm5291_kbd.pdf
Binary files differ
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 @@
1/*
2Copyright 2018 listofoptions <listofoptions@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <string.h>
21#if defined(__AVR__)
22#include <avr/io.h>
23#endif
24#include <util/delay.h>
25
26#include "wait.h"
27#include "print.h"
28#include "debug.h"
29#include "util.h"
30#include "matrix.h"
31#include "timer.h"
32
33#include "config.h"
34
35
36#ifndef DEBOUNCING_DELAY
37# define DEBOUNCING_DELAY 5
38#endif
39
40#define print_matrix_header() print("\nr/c 01234567\n")
41#define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
42#define matrix_bitpop(i) bitpop(matrix[i])
43#define ROW_SHIFTER ((uint8_t)1)
44#define check_bit(var,pos) ((var) & (1<<(pos)))
45
46#define NUM_ROW_PINS 5
47#define NUM_COL_PINS 2
48
49static const uint8_t row_pins [NUM_ROW_PINS] = MATRIX_ROW_PINS ;
50static const uint8_t col_pins [NUM_ROW_PINS] = MATRIX_COL_PINS ;
51
52#if ( DEBOUNCING_DELAY > 0 )
53static uint16_t debouncing_time ;
54static bool debouncing = false ;
55#endif
56
57static uint8_t matrix [MATRIX_ROWS] = {0};
58
59#if ( DEBOUNCING_DELAY > 0 )
60static uint8_t matrix_debounce [MATRIX_ROWS] = {0};
61#endif
62
63static
64inline
65void toggle_led(void) {
66 uint8_t pin = LED_PIN ;
67 _SFR_IO8((pin >> 4) + 2) ^= _BV(pin & 0xF);
68}
69
70static
71inline
72void init_led(void) {
73 uint8_t pin = LED_PIN ;
74 _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
75 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
76}
77
78static
79inline
80void init_data(void) {
81 uint8_t pin = MATRIX_DATA_PIN ;
82 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
83 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // LO
84}
85
86static
87inline
88void init_strobe(void) {
89 uint8_t pin = MATRIX_STROBE_PIN ;
90 _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
91 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
92}
93
94static
95inline
96void init_rows(void) {
97 for ( uint8_t i = 0 ; i < NUM_ROW_PINS; ++i ) {
98 uint8_t pin = row_pins[i];
99 _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
100 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
101 }
102}
103
104static
105inline
106void init_cols(void) {
107 for ( uint8_t i = 0 ; i < NUM_COL_PINS; ++i ) {
108 uint8_t pin = col_pins[i];
109 _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
110 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
111 }
112}
113
114static
115inline
116void select_row(uint8_t current_row) {
117 for ( uint8_t i = 0 ; i < NUM_ROW_PINS; ++i ) {
118 uint8_t pin = row_pins[i] ;
119 if ( check_bit( current_row, i ) ) {
120 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
121 } else {
122 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
123 }
124 }
125 wait_us(30) ;
126}
127
128static
129inline
130void select_col(uint8_t current_col) {
131 for ( uint8_t i = 0 ; i < NUM_COL_PINS; ++i ) {
132 uint8_t pin = col_pins[i] ;
133 if ( check_bit( current_col, i ) ) {
134 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
135 } else {
136 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
137 }
138 }
139 wait_us(30) ;
140}
141
142static
143inline
144uint8_t matrix_strobe(uint8_t col_index) {
145 uint8_t strobe_pin = MATRIX_STROBE_PIN ;
146 uint8_t data_pin = MATRIX_DATA_PIN ;
147
148 // set strobe pin low
149 _SFR_IO8((strobe_pin >> 4) + 2) &= ~_BV(strobe_pin & 0xF);
150
151 wait_us(30) ;
152
153 // read data
154 uint8_t data = (_SFR_IO8(data_pin >> 4) & _BV(data_pin & 0xF)) ;
155
156 // set strobe pin hi
157 _SFR_IO8((strobe_pin >> 4) + 2) |= _BV(strobe_pin & 0xF);
158
159 uint8_t out = data ? (1 << col_index) : 0 ;
160 return out ;
161}
162
163static
164bool matrix_read(uint8_t current_matrix[], uint8_t current_row) {
165 // Store last value of row prior to reading
166 uint8_t last_row_value = current_matrix[current_row];
167
168 // Clear data in matrix row
169 current_matrix[current_row] = 0;
170
171 select_row(current_row);
172
173 // For each col...
174 for(uint8_t col_index = 0; col_index < MATRIX_COLS; ++col_index) {
175
176 select_col(col_index) ;
177
178 // strobe the matrix
179 // Populate the matrix row with the state of the data pin
180 current_matrix[current_row] |= matrix_strobe(col_index) ;
181 }
182
183 bool test = last_row_value != current_matrix[current_row] ;
184 return test ;
185}
186
187__attribute__ ((weak))
188void matrix_init_quantum(void) {
189 matrix_init_kb();
190}
191
192__attribute__ ((weak))
193void matrix_scan_quantum(void) {
194 matrix_scan_kb();
195}
196
197__attribute__ ((weak))
198void matrix_init_kb(void) {
199 matrix_init_user();
200}
201
202__attribute__ ((weak))
203void matrix_scan_kb(void) {
204 matrix_scan_user();
205}
206
207__attribute__ ((weak))
208void matrix_init_user(void) {
209}
210
211__attribute__ ((weak))
212void matrix_scan_user(void) {
213}
214
215inline
216uint8_t matrix_rows(void) {
217 return MATRIX_ROWS;
218}
219
220inline
221uint8_t matrix_cols(void) {
222 return MATRIX_COLS;
223}
224
225inline
226uint8_t matrix_get_row(uint8_t row) {
227 return matrix[row];
228}
229
230void matrix_init(void) {
231 init_led() ;
232 init_rows() ;
233 init_cols() ;
234 init_data() ;
235 init_strobe() ;
236
237 // initialize matrix state: all keys off
238 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
239 matrix[i] = 0;
240# if (DEBOUNCING_DELAY > 0)
241 matrix_debounce [i] = 0;
242# endif
243 }
244
245 matrix_init_quantum() ;
246}
247
248uint8_t matrix_scan(void) {
249 for ( uint8_t current_row = 0; current_row < MATRIX_ROWS; ++current_row ) {
250# if (DEBOUNCING_DELAY > 0)
251 bool matrix_changed = matrix_read(matrix_debounce, current_row);
252
253 if (matrix_changed) {
254 debouncing = true ;
255 debouncing_time = timer_read();
256 }
257
258# else
259 matrix_read(matrix, current_row);
260# endif
261 }
262
263# if (DEBOUNCING_DELAY > 0)
264 if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
265 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
266 matrix[i] = matrix_debounce[i];
267 }
268 debouncing = false;
269 }
270# endif
271
272 matrix_scan_quantum();
273 return 1;
274}
275
276void matrix_print(void) {
277 print_matrix_header();
278
279 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
280 phex(row); print(": ");
281 print_matrix_row(row);
282 print("\n");
283 }
284}
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 @@
10,Z
21,S
32,W
43,3
54,X
65,D
76,E
87,4
98,C
109,F
1110,R
1211,5
1312,V
1413,G
1514,T
1615,6
1716,B
1817,H
1918,Y
2019,7
2120,N
2221,J
2322,U
2423,8
2524,PAD_2
2625,PAD_5
2726,PAD_8
2827,NUM_LOCK
2928,M
3029,K
3130,I
3231,9
3332,COMMA
3433,L
3534,O
3635,0
3736,PERIOD
3837,SEMICOLON
3938,P
4039,MINUS
4140,SLASH
4241,QUOTE
4342,LEFT_BRACE
4443,EQUAL
4544,SPACE
4645,RSHIFT
4746,BACK_QUOTE
4847,RIGHT_BRACE
4948,CAPS_LOCK
5049,PAD_ASTERIX
5150,ENTER
5251,BACKSPACE
5352,PAD_0
5453,PAD_1
5554,PAD_4
5655,PAD_7
5756,PAD_PLUS
5857,UNASSIGNED
5958,PAD_MINUS
6059,SCROLL_LOCK
6160,PAD_PERIOD
6261,PAD_3
6362,PAD_6
6463,PAD_9
6564,BACKSLASH
6665,A
6766,Q
6867,2
6968,LALT
7069,UNASSIGNED
7170,UNASSIGNED
7271,1
7372,F7
7473,F5
7574,F3
7675,F1
7776,F8
7877,F6
7978,F4
8079,F2
8180,F10
8281,UNASSIGNED
8382,UNASSIGNED
8483,UNASSIGNED
8584,F9
8685,UNASSIGNED
8786,UNASSIGNED
8887,UNASSIGNED
8988,LSHIFT
9089,LCTRL
9190,TAB
9291,ESC
9392,UNASSIGNED
9493,UNASSIGNED
9594,UNASSIGNED
9695,UNASSIGNED
diff --git a/keyboards/converter/ibm_5291/readme.md b/keyboards/converter/ibm_5291/readme.md
new file mode 100644
index 000000000..06ae2e994
--- /dev/null
+++ b/keyboards/converter/ibm_5291/readme.md
@@ -0,0 +1,70 @@
1# IBM 5291 keyboard converter
2
3![5291](https://deskthority.net/wiki/IBM_Model_F#IBM_5291_Keyboard)
4
5A converter for the eponymous keyboard.
6
7Keyboard Maintainer: [Listofoptions](https://github.com/listofoptions)
8Hardware Supported: IBM 5291, Teensy 2.0
9
10Make example for this keyboard (after setting up your build environment):
11
12 make converter/ibm_5291:default
13
14See 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).
15
16
17the pinout is as follows:
18
19IBM−5291−Cable to Pinhead−14
20
21| pin | description
22----|------------------------
231 | GND
242 | NC
253 | GND
264 | GN)
275 | +5V
286 | D0
297 | D1
308 | D2
319 | D3
3210| D4
3311| D5
3412| D6
3513| Strobe
3614| Out
37
38the pins on this connector are organized ![here](https://geekhack.org/index.php?action=dlattach;topic=48950.0;attach=36759;image)
39
40IBM−5291−2 Cable with DB15M connector
41
42| pin | description
43----|-------------
44|1,2,3 | GND
45|4 | +5V
46|5 | D0
47|6 | D1
48|7 | D2
49|8 | D3
50|9 | D4
51|10 | D5
52|11 | D6
53|12 | Strobe
54|13 | Out
55|14 | PE
56|15 | NC
57
58the above connector is actually numbered so it should be easier to determine
59where the needed connections are.
60
61to connect to the teensy, the following are pins are needed (if you should choose not set your own):
62* PB0 -> PB6 are connected to D0 -> D6
63* +5V is connected to the corresponding teensy pin
64* gnd is as well, only one of the gnd pins needs to be connected though.
65* strobe is connected to pin PD1
66* data is connected to PD0
67* PE does not need to be connected to anything, but it could also be connected to gnd
68
69sources:
70 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 @@
1# MCU name
2#MCU = at90usb1287
3MCU = atmega32u4
4
5# Processor frequency.
6# This will define a symbol, F_CPU, in all source code files equal to the
7# processor frequency in Hz. You can then use this symbol in your source code to
8# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
9# automatically to create a 32-bit value in your source code.
10#
11# This will be an integer division of F_USB below, as it is sourced by
12# F_USB after it has run through any CPU prescalers. Note that this value
13# does not *change* the processor frequency - it should merely be updated to
14# reflect the processor speed set externally so that the code can use accurate
15# software delays.
16F_CPU = 16000000
17
18#
19# LUFA specific
20#
21# Target architecture (see library "Board Types" documentation).
22ARCH = AVR8
23
24# Input clock frequency.
25# This will define a symbol, F_USB, in all source code files equal to the
26# input clock frequency (before any prescaling is performed) in Hz. This value may
27# differ from F_CPU if prescaling is used on the latter, and is required as the
28# raw input clock is fed directly to the PLL sections of the AVR for high speed
29# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
30# at the end, this will be done automatically to create a 32-bit value in your
31# source code.
32#
33# If no clock division is performed on the input clock inside the AVR (via the
34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
35F_USB = $(F_CPU)
36
37# Interrupt driven control endpoint task(+60)
38OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
39
40# Bootloader
41# This definition is optional, and if your keyboard supports multiple bootloaders of
42# different sizes, comment this out, and the correct address will be loaded
43# automatically (+60). See bootloader.mk for all options.
44BOOTLOADER = halfkay
45
46# Build Options
47# change to "no" to disable the options, or define them in the Makefile in
48# the appropriate keymap folder that will get included automatically
49#
50BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
51MOUSEKEY_ENABLE = no # Mouse keys(+4700)
52EXTRAKEY_ENABLE = no # Audio control and System control(+450)
53CONSOLE_ENABLE = no # Console for debug(+400)
54COMMAND_ENABLE = no # Commands for debug and configuration
55NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
56BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
57MIDI_ENABLE = no # MIDI controls
58AUDIO_ENABLE = no # Audio output on port C6
59UNICODE_ENABLE = no # Unicode
60BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
61RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
62API_SYSEX_ENABLE = no
63SPLIT_KEYBOARD = no
64WAIT_FOR_USB = yes
65
66# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
67SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
68
69LAYOUTS_HAS_RGB = NO
70
71CUSTOM_MATRIX = yes
72SRC = matrix.c \ No newline at end of file