diff options
-rw-r--r-- | keyboards/converter/xt_usb/config.h | 63 | ||||
-rw-r--r-- | keyboards/converter/xt_usb/info.json | 450 | ||||
-rw-r--r-- | keyboards/converter/xt_usb/keymaps/default/config.h | 1 | ||||
-rw-r--r-- | keyboards/converter/xt_usb/keymaps/default/keymap.c | 27 | ||||
-rw-r--r-- | keyboards/converter/xt_usb/matrix.c | 81 | ||||
-rw-r--r-- | keyboards/converter/xt_usb/rules.mk | 35 | ||||
-rw-r--r-- | keyboards/converter/xt_usb/xt_usb.h | 90 | ||||
-rw-r--r-- | tmk_core/protocol/xt.h | 39 | ||||
-rw-r--r-- | tmk_core/protocol/xt_interrupt.c | 7 |
9 files changed, 392 insertions, 401 deletions
diff --git a/keyboards/converter/xt_usb/config.h b/keyboards/converter/xt_usb/config.h index e5624d843d..5f93fbfc6d 100644 --- a/keyboards/converter/xt_usb/config.h +++ b/keyboards/converter/xt_usb/config.h @@ -19,14 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "config_common.h" -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6512 -#define DEVICE_VER 0x0001 -#define MANUFACTURER QMK -#define PRODUCT XT keyboard converter +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6512 +#define DEVICE_VER 0x0001 +#define MANUFACTURER QMK +#define PRODUCT XT keyboard converter - -/* matrix size */ +/* key matrix size */ #define MATRIX_ROWS 16 // keycode bit: 3-0 #define MATRIX_COLS 8 // keycode bit: 6-4 @@ -36,44 +36,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. get_mods() == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \ ) - -//#define NO_SUSPEND_POWER_DOWN - -/* - * XT Pin interrupt - */ -#define XT_CLOCK_PORT PORTD -#define XT_CLOCK_PIN PIND -#define XT_CLOCK_DDR DDRD -#define XT_CLOCK_BIT 1 -#define XT_DATA_PORT PORTD -#define XT_DATA_PIN PIND -#define XT_DATA_DDR DDRD -#define XT_DATA_BIT 0 -#define XT_RST_PORT PORTB -#define XT_RST_PIN PINB -#define XT_RST_DDR DDRB -#define XT_RST_BIT 7 +#define XT_CLOCK_PIN D1 +#define XT_DATA_PIN D0 +#define XT_RST_PIN B7 /* hard reset: low pulse for 500ms and after that HiZ for safety */ #define XT_RESET() do { \ - XT_RST_PORT &= ~(1<<XT_RST_BIT); \ - XT_RST_DDR |= (1<<XT_RST_BIT); \ - _delay_ms(500); \ - XT_RST_DDR &= ~(1<<XT_RST_BIT); \ + writePinLow(XT_RST_PIN); \ + setPinOutput(XT_RST_PIN); \ + wait_ms(500); \ + setPinInput(XT_RST_PIN); \ } while (0) /* INT1 for falling edge of clock line */ -#define XT_INT_INIT() do { \ - EICRA |= ((1<<ISC11) | \ - (0<<ISC10)); \ +#define XT_INT_INIT() do { \ + EICRA |= ((1 << ISC11) | (0 << ISC10)); \ } while (0) + /* clears flag and enables interrupt */ -#define XT_INT_ON() do { \ - EIFR |= (1<<INTF1); \ - EIMSK |= (1<<INT1); \ +#define XT_INT_ON() do { \ + EIFR |= (1 << INTF1); \ + EIMSK |= (1 << INT1); \ } while (0) -#define XT_INT_OFF() do { \ - EIMSK &= ~(1<<INT1); \ + +#define XT_INT_OFF() do { \ + EIMSK &= ~(1 << INT1); \ } while (0) -#define XT_INT_VECT INT1_vect + +#define XT_INT_VECT INT1_vect diff --git a/keyboards/converter/xt_usb/info.json b/keyboards/converter/xt_usb/info.json index db8a03cac0..4bae773623 100644 --- a/keyboards/converter/xt_usb/info.json +++ b/keyboards/converter/xt_usb/info.json @@ -1,228 +1,228 @@ { - "keyboard_name": "IBM PC XT", - "url": "", - "maintainer": "qmk", - "width": 21, - "height": 5, - "layouts": { - "LAYOUT_xt": { - "layout": [ - {"label":"F1", "x":0, "y":0}, - {"label":"F2", "x":1, "y":0}, - {"label":"Esc", "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":"Num Lock", "x":17, "y":0, "w":2}, - {"label":"Scroll Lock", "x":19, "y":0, "w":2}, - {"label":"F3", "x":0, "y":1}, - {"label":"F4", "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":"-", "x":20, "y":1}, - {"label":"F5", "x":0, "y":2}, - {"label":"F6", "x":1, "y":2}, - {"label":"Ctrl", "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":"Enter", "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":"F7", "x":0, "y":3}, - {"label":"F8", "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":"*", "x":16, "y":3}, - {"label":"1", "x":17, "y":3}, - {"label":"2", "x":18, "y":3}, - {"label":"3", "x":19, "y":3}, - {"label":"+", "x":20, "y":2, "h":3}, - {"label":"F9", "x":0, "y":4}, - {"label":"F10", "x":1, "y":4}, - {"label":"Alt", "x":2.25, "y":4, "w":2}, - {"label":"Space", "x":4.25, "y":4, "w":9.75}, - {"label":"Caps Lock", "x":14, "y":4, "w":2}, - {"label":"0", "x":16, "y":4, "w":2}, - {"label":".", "x":18, "y":4, "w":2} - ] - }, - "LAYOUT": { - "layout": [ - {"label":"F13", "x":2, "y":0}, - {"label":"F14", "x":3, "y":0}, - {"label":"F15", "x":4, "y":0}, - {"label":"F16", "x":5, "y":0}, - {"label":"F17", "x":6, "y":0}, - {"label":"F18", "x":7, "y":0}, - {"label":"F19", "x":8, "y":0}, - {"label":"F20", "x":9, "y":0}, - {"label":"F21", "x":10, "y":0}, - {"label":"F22", "x":11, "y":0}, - {"label":"F23", "x":12, "y":0}, - {"label":"F24", "x":13, "y":0}, - {"label":"Esc", "x":0, "y":1}, - {"label":"F1", "x":2, "y":1}, - {"label":"F2", "x":3, "y":1}, - {"label":"F3", "x":4, "y":1}, - {"label":"F4", "x":5, "y":1}, - {"label":"F5", "x":6, "y":1}, - {"label":"F6", "x":7, "y":1}, - {"label":"F7", "x":8, "y":1}, - {"label":"F8", "x":9, "y":1}, - {"label":"F9", "x":10, "y":1}, - {"label":"F10", "x":11, "y":1}, - {"label":"F11", "x":12, "y":1}, - {"label":"F12", "x":13, "y":1}, - {"label":"Print Screen", "x":15.25, "y":1}, - {"label":"Scroll Lock", "x":16.25, "y":1}, - {"label":"Pause", "x":17.25, "y":1}, - {"label":"Volume Down", "x":19.5, "y":1}, - {"label":"Volume Up", "x":20.5, "y":1}, - {"label":"Mute", "x":21.5, "y":1}, - {"label":"`", "x":0, "y":2.5}, - {"label":"1", "x":1, "y":2.5}, - {"label":"2", "x":2, "y":2.5}, - {"label":"3", "x":3, "y":2.5}, - {"label":"4", "x":4, "y":2.5}, - {"label":"5", "x":5, "y":2.5}, - {"label":"6", "x":6, "y":2.5}, - {"label":"7", "x":7, "y":2.5}, - {"label":"8", "x":8, "y":2.5}, - {"label":"9", "x":9, "y":2.5}, - {"label":"0", "x":10, "y":2.5}, - {"label":"-", "x":11, "y":2.5}, - {"label":"=", "x":12, "y":2.5}, - {"label":"JP Yen", "x":13, "y":2.5}, - {"label":"Back Space", "x":14, "y":2.5}, - {"label":"Insert", "x":15.25, "y":2.5}, - {"label":"Home", "x":16.25, "y":2.5}, - {"label":"Page Up", "x":17.25, "y":2.5}, - {"label":"Num Lock", "x":18.5, "y":2.5}, - {"label":"KP/", "x":19.5, "y":2.5}, - {"label":"KP*", "x":20.5, "y":2.5}, - {"label":"KP-", "x":21.5, "y":2.5}, - {"label":"Tab", "x":0, "y":3.5, "w":1.5}, - {"label":"Q", "x":1.5, "y":3.5}, - {"label":"W", "x":2.5, "y":3.5}, - {"label":"E", "x":3.5, "y":3.5}, - {"label":"R", "x":4.5, "y":3.5}, - {"label":"T", "x":5.5, "y":3.5}, - {"label":"Y", "x":6.5, "y":3.5}, - {"label":"U", "x":7.5, "y":3.5}, - {"label":"I", "x":8.5, "y":3.5}, - {"label":"O", "x":9.5, "y":3.5}, - {"label":"P", "x":10.5, "y":3.5}, - {"label":"[", "x":11.5, "y":3.5}, - {"label":"]", "x":12.5, "y":3.5}, - {"label":"\\", "x":13.5, "y":3.5, "w":1.5}, - {"label":"Delete", "x":15.25, "y":3.5}, - {"label":"End", "x":16.25, "y":3.5}, - {"label":"Page Down", "x":17.25, "y":3.5}, - {"label":"KP 7", "x":18.5, "y":3.5}, - {"label":"KP 8", "x":19.5, "y":3.5}, - {"label":"KP 9", "x":20.5, "y":3.5}, - {"label":"KP+", "x":21.5, "y":3.5}, - {"label":"Caps Lock", "x":0, "y":4.5, "w":1.75}, - {"label":"A", "x":1.75, "y":4.5}, - {"label":"S", "x":2.75, "y":4.5}, - {"label":"D", "x":3.75, "y":4.5}, - {"label":"F", "x":4.75, "y":4.5}, - {"label":"G", "x":5.75, "y":4.5}, - {"label":"H", "x":6.75, "y":4.5}, - {"label":"J", "x":7.75, "y":4.5}, - {"label":"K", "x":8.75, "y":4.5}, - {"label":"L", "x":9.75, "y":4.5}, - {"label":";", "x":10.75, "y":4.5}, - {"label":"'", "x":11.75, "y":4.5}, - {"label":"ISO #", "x":12.75, "y":4.5}, - {"label":"Enter", "x":13.75, "y":4.5, "w":1.25}, - {"label":"KP 4", "x":18.5, "y":4.5}, - {"label":"KP 5", "x":19.5, "y":4.5}, - {"label":"KP 6", "x":20.5, "y":4.5}, - {"label":"KP ,", "x":21.5, "y":4.5}, - {"label":"Shift", "x":0, "y":5.5, "w":1.25}, - {"label":"ISO \\", "x":1.25, "y":5.5}, - {"label":"Z", "x":2.25, "y":5.5}, - {"label":"X", "x":3.25, "y":5.5}, - {"label":"C", "x":4.25, "y":5.5}, - {"label":"V", "x":5.25, "y":5.5}, - {"label":"B", "x":6.25, "y":5.5}, - {"label":"N", "x":7.25, "y":5.5}, - {"label":"M", "x":8.25, "y":5.5}, - {"label":",", "x":9.25, "y":5.5}, - {"label":".", "x":10.25, "y":5.5}, - {"label":"/", "x":11.25, "y":5.5}, - {"label":"JP RO", "x":12.25, "y":5.5}, - {"label":"Shift", "x":13.25, "y":5.5, "w":1.75}, - {"label":"Up", "x":16.25, "y":5.5}, - {"label":"KP 1", "x":18.5, "y":5.5}, - {"label":"KP 2", "x":19.5, "y":5.5}, - {"label":"KP 3", "x":20.5, "y":5.5}, - {"label":"KP Enter", "x":21.5, "y":5.5}, - {"label":"Ctrl", "x":0, "y":6.5, "w":1.25}, - {"label":"GUI", "x":1.25, "y":6.5, "w":1.25}, - {"label":"Alt", "x":2.5, "y":6.5, "w":1.25}, - {"label":"Muhenkan", "x":3.75, "y":6.5, "w":1.25}, - {"label":"Space", "x":5, "y":6.5, "w":3.25}, - {"label":"Henkan", "x":8.25, "y":6.5, "w":1.25}, - {"label":"Kana", "x":9.5, "y":6.5, "w":1.25}, - {"label":"Alt", "x":10.75, "y":6.5}, - {"label":"GUI", "x":11.75, "y":6.5}, - {"label":"Menu", "x":12.75, "y":6.5}, - {"label":"Ctrl", "x":13.75, "y":6.5, "w":1.25}, - {"label":"Left", "x":15.25, "y":6.5}, - {"label":"Down", "x":16.25, "y":6.5}, - {"label":"Right", "x":17.25, "y":6.5}, - {"label":"KP 0", "x":18.5, "y":6.5, "w":2}, - {"label":"KP .", "x":20.5, "y":6.5}, - {"label":"KP =", "x":21.5, "y":6.5} - ] + "keyboard_name": "IBM PC XT", + "url": "", + "maintainer": "qmk", + "width": 21, + "height": 5, + "layouts": { + "LAYOUT_xt": { + "layout": [ + {"x": 0, "y": 0}, + {"x": 1, "y": 0}, + {"x": 2.25, "y": 0}, + {"x": 3.25, "y": 0}, + {"x": 4.25, "y": 0}, + {"x": 5.25, "y": 0}, + {"x": 6.25, "y": 0}, + {"x": 7.25, "y": 0}, + {"x": 8.25, "y": 0}, + {"x": 9.25, "y": 0}, + {"x": 10.25, "y": 0}, + {"x": 11.25, "y": 0}, + {"x": 12.25, "y": 0}, + {"x": 13.25, "y": 0}, + {"x": 14.25, "y": 0}, + {"x": 15.25, "y": 0, "w": 1.75}, + {"x": 17, "y": 0, "w": 2}, + {"x": 19, "y": 0, "w": 2}, + {"x": 0, "y": 1}, + {"x": 1, "y": 1}, + {"x": 2.25, "y": 1, "w": 1.5}, + {"x": 3.75, "y": 1}, + {"x": 4.75, "y": 1}, + {"x": 5.75, "y": 1}, + {"x": 6.75, "y": 1}, + {"x": 7.75, "y": 1}, + {"x": 8.75, "y": 1}, + {"x": 9.75, "y": 1}, + {"x": 10.75, "y": 1}, + {"x": 11.75, "y": 1}, + {"x": 12.75, "y": 1}, + {"x": 13.75, "y": 1}, + {"x": 14.75, "y": 1, "w": 1.25}, + {"x": 17, "y": 1}, + {"x": 18, "y": 1}, + {"x": 19, "y": 1}, + {"x": 20, "y": 1}, + {"x": 0, "y": 2}, + {"x": 1, "y": 2}, + {"x": 2.25, "y": 2, "w": 1.75}, + {"x": 4, "y": 2}, + {"x": 5, "y": 2}, + {"x": 6, "y": 2}, + {"x": 7, "y": 2}, + {"x": 8, "y": 2}, + {"x": 9, "y": 2}, + {"x": 10, "y": 2}, + {"x": 11, "y": 2}, + {"x": 12, "y": 2}, + {"x": 13, "y": 2}, + {"x": 14, "y": 2}, + {"x": 15, "y": 2}, + {"x": 16, "y": 1, "h": 2}, + {"x": 17, "y": 2}, + {"x": 18, "y": 2}, + {"x": 19, "y": 2}, + {"x": 0, "y": 3}, + {"x": 1, "y": 3}, + {"x": 2.25, "y": 3, "w": 1.25}, + {"x": 3.5, "y": 3}, + {"x": 4.5, "y": 3}, + {"x": 5.5, "y": 3}, + {"x": 6.5, "y": 3}, + {"x": 7.5, "y": 3}, + {"x": 8.5, "y": 3}, + {"x": 9.5, "y": 3}, + {"x": 10.5, "y": 3}, + {"x": 11.5, "y": 3}, + {"x": 12.5, "y": 3}, + {"x": 13.5, "y": 3}, + {"x": 14.5, "y": 3, "w": 1.5}, + {"x": 16, "y": 3}, + {"x": 17, "y": 3}, + {"x": 18, "y": 3}, + {"x": 19, "y": 3}, + {"x": 20, "y": 2, "h": 3}, + {"x": 0, "y": 4}, + {"x": 1, "y": 4}, + {"x": 2.25, "y": 4, "w": 2}, + {"x": 4.25, "y": 4, "w": 9.75}, + {"x": 14, "y": 4, "w": 2}, + {"x": 16, "y": 4, "w": 2}, + {"x": 18, "y": 4, "w": 2} + ] + }, + "LAYOUT": { + "layout": [ + {"x": 2, "y": 0}, + {"x": 3, "y": 0}, + {"x": 4, "y": 0}, + {"x": 5, "y": 0}, + {"x": 6, "y": 0}, + {"x": 7, "y": 0}, + {"x": 8, "y": 0}, + {"x": 9, "y": 0}, + {"x": 10, "y": 0}, + {"x": 11, "y": 0}, + {"x": 12, "y": 0}, + {"x": 13, "y": 0}, + {"x": 0, "y": 1}, + {"x": 2, "y": 1}, + {"x": 3, "y": 1}, + {"x": 4, "y": 1}, + {"x": 5, "y": 1}, + {"x": 6, "y": 1}, + {"x": 7, "y": 1}, + {"x": 8, "y": 1}, + {"x": 9, "y": 1}, + {"x": 10, "y": 1}, + {"x": 11, "y": 1}, + {"x": 12, "y": 1}, + {"x": 13, "y": 1}, + {"x": 15.25, "y": 1}, + {"x": 16.25, "y": 1}, + {"x": 17.25, "y": 1}, + {"x": 19.5, "y": 1}, + {"x": 20.5, "y": 1}, + {"x": 21.5, "y": 1}, + {"x": 0, "y": 2.5}, + {"x": 1, "y": 2.5}, + {"x": 2, "y": 2.5}, + {"x": 3, "y": 2.5}, + {"x": 4, "y": 2.5}, + {"x": 5, "y": 2.5}, + {"x": 6, "y": 2.5}, + {"x": 7, "y": 2.5}, + {"x": 8, "y": 2.5}, + {"x": 9, "y": 2.5}, + {"x": 10, "y": 2.5}, + {"x": 11, "y": 2.5}, + {"x": 12, "y": 2.5}, + {"x": 13, "y": 2.5}, + {"x": 14, "y": 2.5}, + {"x": 15.25, "y": 2.5}, + {"x": 16.25, "y": 2.5}, + {"x": 17.25, "y": 2.5}, + {"x": 18.5, "y": 2.5}, + {"x": 19.5, "y": 2.5}, + {"x": 20.5, "y": 2.5}, + {"x": 21.5, "y": 2.5}, + {"x": 0, "y": 3.5, "w": 1.5}, + {"x": 1.5, "y": 3.5}, + {"x": 2.5, "y": 3.5}, + {"x": 3.5, "y": 3.5}, + {"x": 4.5, "y": 3.5}, + {"x": 5.5, "y": 3.5}, + {"x": 6.5, "y": 3.5}, + {"x": 7.5, "y": 3.5}, + {"x": 8.5, "y": 3.5}, + {"x": 9.5, "y": 3.5}, + {"x": 10.5, "y": 3.5}, + {"x": 11.5, "y": 3.5}, + {"x": 12.5, "y": 3.5}, + {"x": 13.5, "y": 3.5, "w": 1.5}, + {"x": 15.25, "y": 3.5}, + {"x": 16.25, "y": 3.5}, + {"x": 17.25, "y": 3.5}, + {"x": 18.5, "y": 3.5}, + {"x": 19.5, "y": 3.5}, + {"x": 20.5, "y": 3.5}, + {"x": 21.5, "y": 3.5}, + {"x": 0, "y": 4.5, "w": 1.75}, + {"x": 1.75, "y": 4.5}, + {"x": 2.75, "y": 4.5}, + {"x": 3.75, "y": 4.5}, + {"x": 4.75, "y": 4.5}, + {"x": 5.75, "y": 4.5}, + {"x": 6.75, "y": 4.5}, + {"x": 7.75, "y": 4.5}, + {"x": 8.75, "y": 4.5}, + {"x": 9.75, "y": 4.5}, + {"x": 10.75, "y": 4.5}, + {"x": 11.75, "y": 4.5}, + {"x": 12.75, "y": 4.5}, + {"x": 13.75, "y": 4.5, "w": 1.25}, + {"x": 18.5, "y": 4.5}, + {"x": 19.5, "y": 4.5}, + {"x": 20.5, "y": 4.5}, + {"x": 21.5, "y": 4.5}, + {"x": 0, "y": 5.5, "w": 1.25}, + {"x": 1.25, "y": 5.5}, + {"x": 2.25, "y": 5.5}, + {"x": 3.25, "y": 5.5}, + {"x": 4.25, "y": 5.5}, + {"x": 5.25, "y": 5.5}, + {"x": 6.25, "y": 5.5}, + {"x": 7.25, "y": 5.5}, + {"x": 8.25, "y": 5.5}, + {"x": 9.25, "y": 5.5}, + {"x": 10.25, "y": 5.5}, + {"x": 11.25, "y": 5.5}, + {"x": 12.25, "y": 5.5}, + {"x": 13.25, "y": 5.5, "w": 1.75}, + {"x": 16.25, "y": 5.5}, + {"x": 18.5, "y": 5.5}, + {"x": 19.5, "y": 5.5}, + {"x": 20.5, "y": 5.5}, + {"x": 21.5, "y": 5.5}, + {"x": 0, "y": 6.5, "w": 1.25}, + {"x": 1.25, "y": 6.5, "w": 1.25}, + {"x": 2.5, "y": 6.5, "w": 1.25}, + {"x": 3.75, "y": 6.5, "w": 1.25}, + {"x": 5, "y": 6.5, "w": 3.25}, + {"x": 8.25, "y": 6.5, "w": 1.25}, + {"x": 9.5, "y": 6.5, "w": 1.25}, + {"x": 10.75, "y": 6.5}, + {"x": 11.75, "y": 6.5}, + {"x": 12.75, "y": 6.5}, + {"x": 13.75, "y": 6.5, "w": 1.25}, + {"x": 15.25, "y": 6.5}, + {"x": 16.25, "y": 6.5}, + {"x": 17.25, "y": 6.5}, + {"x": 18.5, "y": 6.5, "w": 2}, + {"x": 20.5, "y": 6.5}, + {"x": 21.5, "y": 6.5} + ] + } } - } } diff --git a/keyboards/converter/xt_usb/keymaps/default/config.h b/keyboards/converter/xt_usb/keymaps/default/config.h deleted file mode 100644 index 6f70f09bee..0000000000 --- a/keyboards/converter/xt_usb/keymaps/default/config.h +++ /dev/null @@ -1 +0,0 @@ -#pragma once diff --git a/keyboards/converter/xt_usb/keymaps/default/keymap.c b/keyboards/converter/xt_usb/keymaps/default/keymap.c index b44b946e8f..a8cd66ccea 100644 --- a/keyboards/converter/xt_usb/keymaps/default/keymap.c +++ b/keyboards/converter/xt_usb/keymaps/default/keymap.c @@ -1,6 +1,5 @@ #include QMK_KEYBOARD_H - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* IBM XT keyboard layout * ,-------. ,--------------------------------------------------------------------------. @@ -15,12 +14,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | F9|F10| | Alt | Space |CapsLck| 0 | . | | * `-------' `--------------------------------------------------------------------------' */ - LAYOUT_xt( \ - 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_SPC, KC_CAPS, KC_P0, KC_PDOT + LAYOUT_xt( + 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_SPC, KC_CAPS, KC_P0, KC_PDOT ), /* Extended keyboard layout @@ -43,13 +42,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ /* Try this if your keyboad has exotic keys. LAYOUT( - KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, - 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_SLCK,KC_PAUS, KC_VOLD,KC_VOLU,KC_MUTE, - 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_JYEN,KC_BSPC, KC_INS, KC_HOME,KC_PGUP, KC_NLCK,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_DEL, KC_END, 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_NUHS,KC_ENT, KC_P4, KC_P5, KC_P6, KC_PCMM, - 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_RO, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL,KC_LGUI,KC_LALT,KC_MHEN, KC_SPC, KC_HENK,KC_KANA,KC_RALT,KC_RGUI,KC_APP, KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0, KC_PDOT,KC_PEQL + KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, + 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_SLCK, KC_PAUS, KC_VOLD, KC_VOLU, KC_MUTE, + 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_JYEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, 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_DEL, KC_END, 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_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PCMM, + 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_RO, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PEQL, + KC_LCTL, KC_LGUI, KC_LALT, KC_MHEN, KC_SPC, KC_HENK, KC_KANA, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT ), */ }; diff --git a/keyboards/converter/xt_usb/matrix.c b/keyboards/converter/xt_usb/matrix.c index d75f077ce9..7a16750432 100644 --- a/keyboards/converter/xt_usb/matrix.c +++ b/keyboards/converter/xt_usb/matrix.c @@ -25,13 +25,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "xt.h" #include "matrix.h" - static void matrix_make(uint8_t code); static void matrix_break(uint8_t code); static uint8_t matrix[MATRIX_ROWS]; -#define ROW(code) (code>>3) -#define COL(code) (code&0x07) + +#define ROW(code) (code >> 3) +#define COL(code) (code & 0x07) __attribute__ ((weak)) void matrix_init_kb(void) { @@ -48,16 +48,16 @@ void matrix_init_user(void) { } __attribute__ ((weak)) -void matrix_scan_user(void) { -} +void matrix_scan_user(void) { } -void matrix_init(void) -{ +void matrix_init(void) { debug_enable = true; xt_host_init(); // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = 0x00; + } matrix_init_quantum(); } @@ -71,7 +71,7 @@ static uint8_t move_e0code(uint8_t code) { case 0x1C: return 0x6F; // Keypad Enter case 0x35: return 0x7F; // Keypad / - // Any XT keyobard with these keys? + // Any XT keyboard with these keys? // http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf // https://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc case 0x5B: return 0x5A; // Left GUI @@ -96,8 +96,7 @@ static uint8_t move_e0code(uint8_t code) { return 0x00; } -uint8_t matrix_scan(void) -{ +uint8_t matrix_scan(void) { static enum { XT_STATE_INIT, XT_STATE_E0, @@ -108,8 +107,13 @@ uint8_t matrix_scan(void) } state = XT_STATE_INIT; uint8_t code = xt_host_recv(); - if (!code) return 0; + + if (!code) { + return 0; + } + xprintf("%02X ", code); + switch (state) { case XT_STATE_INIT: switch (code) { @@ -120,10 +124,11 @@ uint8_t matrix_scan(void) state = XT_STATE_E1; break; default: - if (code < 0x80) + if (code < 0x80) { matrix_make(code); - else + } else { matrix_break(code & 0x7F); + } break; } break; @@ -137,10 +142,11 @@ uint8_t matrix_scan(void) state = XT_STATE_INIT; break; default: - if (code < 0x80) + if (code < 0x80) { matrix_make(move_e0code(code)); - else + } else { matrix_break(move_e0code(code & 0x7F)); + } state = XT_STATE_INIT; break; } @@ -181,59 +187,54 @@ uint8_t matrix_scan(void) default: state = XT_STATE_INIT; } + matrix_scan_quantum(); + return 1; } inline -uint8_t matrix_get_row(uint8_t row) -{ +uint8_t matrix_get_row(uint8_t row) { return matrix[row]; } -inline -static void matrix_make(uint8_t code) -{ +inline static void matrix_make(uint8_t code) { if (!matrix_is_on(ROW(code), COL(code))) { - matrix[ROW(code)] |= 1<<COL(code); + matrix[ROW(code)] |= 1 << COL(code); } } -inline -static void matrix_break(uint8_t code) -{ +inline static void matrix_break(uint8_t code) { if (matrix_is_on(ROW(code), COL(code))) { - matrix[ROW(code)] &= ~(1<<COL(code)); + matrix[ROW(code)] &= ~(1 << COL(code)); } } -void matrix_clear(void) -{ +void matrix_clear(void) { for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00; } -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return (matrix_get_row(row) & (1<<col)); +bool matrix_is_on(uint8_t row, uint8_t col) { + return (matrix_get_row(row) & (1 << col)); } #if (MATRIX_COLS <= 8) -# define print_matrix_header() print("\nr/c 01234567\n") -# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) #elif (MATRIX_COLS <= 16) -# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") -# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) #elif (MATRIX_COLS <= 32) -# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") -# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) #endif -void matrix_print(void) -{ +void matrix_print(void) { print_matrix_header(); for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - print_hex8(row); print(": "); + print_hex8(row); + print(": "); print_matrix_row(row); print("\n"); } diff --git a/keyboards/converter/xt_usb/rules.mk b/keyboards/converter/xt_usb/rules.mk index 986cdd4dc6..ca9382f8a6 100644 --- a/keyboards/converter/xt_usb/rules.mk +++ b/keyboards/converter/xt_usb/rules.mk @@ -2,28 +2,25 @@ 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 = halfkay # Build Options -# comment out to disable the options. +# change yes to no to disable # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = yes # USB Nkey Rollover -XT_ENABLE = yes -CUSTOM_MATRIX = yes +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # 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 +NKRO_ENABLE = yes # 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 +XT_ENABLE = yes +CUSTOM_MATRIX = yes SRC += matrix.c - -# Optimize size but this may cause error "relocation truncated to fit" -#EXTRALDFLAGS = -Wl,--relax diff --git a/keyboards/converter/xt_usb/xt_usb.h b/keyboards/converter/xt_usb/xt_usb.h index 88d9f576c8..570f1a376c 100644 --- a/keyboards/converter/xt_usb/xt_usb.h +++ b/keyboards/converter/xt_usb/xt_usb.h @@ -18,6 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "quantum.h" +#define XXX KC_NO + /* IBM XT keyboard layout * ,-------. ,--------------------------------------------------------------------------. * | F1| F2| |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS |NumLck |ScrLck | @@ -44,28 +46,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * `-------' `--------------------------------------------------------------------------' */ #define LAYOUT_xt( \ - K3B,K3C, K01,K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D,K0E, K45, K46, \ - K3D,K3E, K0F,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K1A,K1B, K47,K48,K49,K4A, \ - K3F,K40, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K1C,K4B,K4C,K4D, \ - K41,K42, K2A,K2B,K2C,K2D,K2E,K2F,K30,K31,K32,K33,K34,K35,K36,K37,K4F,K50,K51,K4E, \ - K43,K44, K38, K39, K3A, K52, K53 \ + k3B, k3C, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, k45, k46, \ + k3D, k3E, k0F, k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k47, k48, k49, k4A, \ + k3F, k40, k1D, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k1C, k4B, k4C, k4D, \ + k41, k42, k2A, k2B, k2C, k2D, k2E, k2F, k30, k31, k32, k33, k34, k35, k36, k37, k4F, k50, k51, k4E, \ + k43, k44, k38, k39, k3A, k52, k53 \ ) { \ - { KC_NO, K01, K02, K03, K04, K05, K06, K07 }, \ - { K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, \ - { K10, K11, K12, K13, K14, K15, K16, K17 }, \ - { K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, \ - { K20, K21, K22, K23, K24, K25, K26, K27 }, \ - { K28, K29, K2A, K2B, K2C, K2D, K2E, K2F }, \ - { K30, K31, K32, K33, K34, K35, K36, K37 }, \ - { K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, \ - { K40, K41, K42, K43, K44, K45, K46, K47 }, \ - { K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, \ - { K50, K51, K52, K53, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \ + { XXX, k01, k02, k03, k04, k05, k06, k07 }, \ + { k08, k09, k0A, k0B, k0C, k0D, k0E, k0F }, \ + { k10, k11, k12, k13, k14, k15, k16, k17 }, \ + { k18, k19, k1A, k1B, k1C, k1D, k1E, k1F }, \ + { k20, k21, k22, k23, k24, k25, k26, k27 }, \ + { k28, k29, k2A, k2B, k2C, k2D, k2E, k2F }, \ + { k30, k31, k32, k33, k34, k35, k36, k37 }, \ + { k38, k39, k3A, k3B, k3C, k3D, k3E, k3F }, \ + { k40, k41, k42, k43, k44, k45, k46, k47 }, \ + { k48, k49, k4A, k4B, k4C, k4D, k4E, k4F }, \ + { k50, k51, k52, k53, XXX, XXX, XXX, XXX }, \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX } \ } /* Extended keyboard layout @@ -105,28 +107,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * *: special handling codes */ #define LAYOUT( \ - K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D,K6E,K76, \ - K01, K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K57,K58, K54,K46,K55, K5D,K5E,K5F, \ - K29,K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D,K7D,K0E, K71,K74,K77, K45,K7F,K37,K4A, \ - K0F,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K1A,K1B, K2B, K72,K75,K78, K47,K48,K49,K4E, \ - K3A,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28, K00,K1C, K4B,K4C,K4D,K7E, \ - K2A,K56,K2C,K2D,K2E,K2F,K30,K31,K32,K33,K34,K35, K73,K36, K60, K4F,K50,K51,K6F, \ - K1D,K5A,K38,K7B, K39, K79,K70,K7C,K5B,K5C,K7A, K61,K62,K63, K52,K53,K59 \ + k64, k65, k66, k67, k68, k69, k6A, k6B, k6C, k6D, k6E, k76, \ + k01, k3B, k3C, k3D, k3E, k3F, k40, k41, k42, k43, k44, k57, k58, k54, k46, k55, k5D, k5E, k5F, \ + k29, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k7D, k0E, k71, k74, k77, k45, k7F, k37, k4A, \ + k0F, k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k2B, k72, k75, k78, k47, k48, k49, k4E, \ + k3A, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k28, k00, k1C, k4B, k4C, k4D, k7E, \ + k2A, k56, k2C, k2D, k2E, k2F, k30, k31, k32, k33, k34, k35, k73, k36, k60, k4F, k50, k51, k6F, \ + k1D, k5A, k38, k7B, k39, k79, k70, k7C, k5B, k5C, k7A, k61, k62, k63, k52, k53, k59 \ ) { \ - { K00, K01, K02, K03, K04, K05, K06, K07 }, \ - { K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, \ - { K10, K11, K12, K13, K14, K15, K16, K17 }, \ - { K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, \ - { K20, K21, K22, K23, K24, K25, K26, K27 }, \ - { K28, K29, K2A, K2B, K2C, K2D, K2E, K2F }, \ - { K30, K31, K32, K33, K34, K35, K36, K37 }, \ - { K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, \ - { K40, K41, K42, K43, K44, K45, K46, K47 }, \ - { K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, \ - { K50, K51, K52, K53, K54, K55, K56, K57 }, \ - { K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, \ - { K60, K61, K62, K63, K64, K65, K66, K67 }, \ - { K68, K69, K6A, K6B, K6C, K6D, K6E, K6F }, \ - { K70, K71, K72, K73, K74, K75, K76, K77 }, \ - { K78, K79, K7A, K7B, K7C, K7D, K7E, K7F } \ + { k00, k01, k02, k03, k04, k05, k06, k07 }, \ + { k08, k09, k0A, k0B, k0C, k0D, k0E, k0F }, \ + { k10, k11, k12, k13, k14, k15, k16, k17 }, \ + { k18, k19, k1A, k1B, k1C, k1D, k1E, k1F }, \ + { k20, k21, k22, k23, k24, k25, k26, k27 }, \ + { k28, k29, k2A, k2B, k2C, k2D, k2E, k2F }, \ + { k30, k31, k32, k33, k34, k35, k36, k37 }, \ + { k38, k39, k3A, k3B, k3C, k3D, k3E, k3F }, \ + { k40, k41, k42, k43, k44, k45, k46, k47 }, \ + { k48, k49, k4A, k4B, k4C, k4D, k4E, k4F }, \ + { k50, k51, k52, k53, k54, k55, k56, k57 }, \ + { k58, k59, k5A, k5B, k5C, k5D, k5E, k5F }, \ + { k60, k61, k62, k63, k64, k65, k66, k67 }, \ + { k68, k69, k6A, k6B, k6C, k6D, k6E, k6F }, \ + { k70, k71, k72, k73, k74, k75, k76, k77 }, \ + { k78, k79, k7A, k7B, k7C, k7D, k7E, k7F } \ } diff --git a/tmk_core/protocol/xt.h b/tmk_core/protocol/xt.h index 6dc5f19d00..cc55b7dbca 100644 --- a/tmk_core/protocol/xt.h +++ b/tmk_core/protocol/xt.h @@ -38,33 +38,36 @@ POSSIBILITY OF SUCH DAMAGE. #pragma once -#define XT_DATA_IN() \ - do { \ - XT_DATA_DDR &= ~(1 << XT_DATA_BIT); \ - XT_DATA_PORT |= (1 << XT_DATA_BIT); \ +#include "quantum.h" + +#define XT_DATA_IN() \ + do { \ + setPinInput(XT_DATA_PIN); \ + writePinHigh(XT_DATA_PIN); \ } while (0) -#define XT_DATA_READ() (XT_DATA_PIN & (1 << XT_DATA_BIT)) +#define XT_DATA_READ() readPin(XT_DATA_PIN) -#define XT_DATA_LO() \ - do { \ - XT_DATA_PORT &= ~(1 << XT_DATA_BIT); \ - XT_DATA_DDR |= (1 << XT_DATA_BIT); \ +#define XT_DATA_LO() \ + do { \ + writePinLow(XT_DATA_PIN); \ + setPinOutput(XT_DATA_PIN); \ } while (0) -#define XT_CLOCK_IN() \ - do { \ - XT_CLOCK_DDR &= ~(1 << XT_CLOCK_BIT); \ - XT_CLOCK_PORT |= (1 << XT_CLOCK_BIT); \ +#define XT_CLOCK_IN() \ + do { \ + setPinInput(XT_CLOCK_PIN); \ + writePinHigh(XT_CLOCK_PIN); \ } while (0) -#define XT_CLOCK_READ() (XT_CLOCK_PIN & (1 << XT_CLOCK_BIT)) +#define XT_CLOCK_READ() readPin(XT_CLOCK_PIN) -#define XT_CLOCK_LO() \ - do { \ - XT_CLOCK_PORT &= ~(1 << XT_CLOCK_BIT); \ - XT_CLOCK_DDR |= (1 << XT_CLOCK_BIT); \ +#define XT_CLOCK_LO() \ + do { \ + writePinLow(XT_CLOCK_PIN); \ + setPinOutput(XT_CLOCK_PIN); \ } while (0) void xt_host_init(void); + uint8_t xt_host_recv(void); diff --git a/tmk_core/protocol/xt_interrupt.c b/tmk_core/protocol/xt_interrupt.c index 51e52243fd..3dd7e6177b 100644 --- a/tmk_core/protocol/xt_interrupt.c +++ b/tmk_core/protocol/xt_interrupt.c @@ -38,7 +38,6 @@ POSSIBILITY OF SUCH DAMAGE. #include <stdbool.h> #include <avr/interrupt.h> -#include <util/delay.h> #include "xt.h" #include "wait.h" #include "debug.h" @@ -60,7 +59,7 @@ void xt_host_init(void) { /* soft reset: pull clock line down for 20ms */ XT_DATA_LO(); XT_CLOCK_LO(); - _delay_ms(20); + wait_ms(20); /* input mode with pullup */ XT_CLOCK_IN(); @@ -123,6 +122,7 @@ ISR(XT_INT_VECT) { static uint8_t pbuf[PBUF_SIZE]; static uint8_t pbuf_head = 0; static uint8_t pbuf_tail = 0; + static inline void pbuf_enqueue(uint8_t data) { uint8_t sreg = SREG; cli(); @@ -135,6 +135,7 @@ static inline void pbuf_enqueue(uint8_t data) { } SREG = sreg; } + static inline uint8_t pbuf_dequeue(void) { uint8_t val = 0; @@ -148,6 +149,7 @@ static inline uint8_t pbuf_dequeue(void) { return val; } + static inline bool pbuf_has_data(void) { uint8_t sreg = SREG; cli(); @@ -155,6 +157,7 @@ static inline bool pbuf_has_data(void) { SREG = sreg; return has_data; } + static inline void pbuf_clear(void) { uint8_t sreg = SREG; cli(); |