diff options
Diffstat (limited to 'keyboards/converter')
30 files changed, 1917 insertions, 474 deletions
diff --git a/keyboards/converter/a1200/miss1200/rules.mk b/keyboards/converter/a1200/miss1200/rules.mk index cf8291d064..4ccdf5bb3e 100644 --- a/keyboards/converter/a1200/miss1200/rules.mk +++ b/keyboards/converter/a1200/miss1200/rules.mk @@ -7,7 +7,7 @@ BOOTLOADER = atmel-dfu # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug diff --git a/keyboards/converter/a1200/teensy2pp/rules.mk b/keyboards/converter/a1200/teensy2pp/rules.mk index 29624324e8..5f74692015 100644 --- a/keyboards/converter/a1200/teensy2pp/rules.mk +++ b/keyboards/converter/a1200/teensy2pp/rules.mk @@ -7,7 +7,7 @@ BOOTLOADER = halfkay # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug diff --git a/keyboards/converter/adb_usb/adb.c b/keyboards/converter/adb_usb/adb.c new file mode 100644 index 0000000000..28f14c9fe8 --- /dev/null +++ b/keyboards/converter/adb_usb/adb.c @@ -0,0 +1,531 @@ +/* +Copyright 2011-19 Jun WAKO <wakojun@gmail.com> +Copyright 2013 Shay Green <gblargg@gmail.com> + +This software is licensed with a Modified BSD License. +All of this is supposed to be Free Software, Open Source, DFSG-free, +GPL-compatible, and OK to use in both free and proprietary applications. +Additions and corrections to this file are welcome. + + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +* Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <stdbool.h> +#include <util/delay.h> +#include <avr/io.h> +#include <avr/interrupt.h> +#include "adb.h" +#include "print.h" + +// GCC doesn't inline functions normally +#define data_lo() (ADB_DDR |= (1 << ADB_DATA_BIT)) +#define data_hi() (ADB_DDR &= ~(1 << ADB_DATA_BIT)) +#define data_in() (ADB_PIN & (1 << ADB_DATA_BIT)) + +#ifdef ADB_PSW_BIT +static inline void psw_lo(void); +static inline void psw_hi(void); +static inline bool psw_in(void); +#endif + +static inline void attention(void); +static inline void place_bit0(void); +static inline void place_bit1(void); +static inline void send_byte(uint8_t data); +static inline uint16_t wait_data_lo(uint16_t us); +static inline uint16_t wait_data_hi(uint16_t us); + +void adb_host_init(void) { + ADB_PORT &= ~(1 << ADB_DATA_BIT); + data_hi(); +#ifdef ADB_PSW_BIT + psw_hi(); +#endif +} + +#ifdef ADB_PSW_BIT +bool adb_host_psw(void) { return psw_in(); } +#endif + +/* + * Don't call this in a row without the delay, otherwise it makes some of poor controllers + * overloaded and misses strokes. Recommended interval is 12ms. + * + * Thanks a lot, blargg! + * <http://geekhack.org/index.php?topic=14290.msg1068919#msg1068919> + * <http://geekhack.org/index.php?topic=14290.msg1070139#msg1070139> + */ +uint16_t adb_host_kbd_recv(void) { return adb_host_talk(ADB_ADDR_KEYBOARD, ADB_REG_0); } + +#ifdef ADB_MOUSE_ENABLE +uint16_t adb_host_mouse_recv(void) { return adb_host_talk(ADB_ADDR_MOUSE, ADB_REG_0); } +#endif + +// This sends Talk command to read data from register and returns length of the data. +uint8_t adb_host_talk_buf(uint8_t addr, uint8_t reg, uint8_t *buf, uint8_t len) { + for (int8_t i = 0; i < len; i++) buf[i] = 0; + + cli(); + attention(); + send_byte((addr << 4) | ADB_CMD_TALK | reg); + place_bit0(); // Stopbit(0) + // TODO: Service Request(Srq): + // Device holds low part of comannd stopbit for 140-260us + // + // Command: + // ......._ ______________________ ___ ............_ ------- + // | | | | | | | + // Command | | | | | Data bytes | | + // ........|___| | 140-260 |__| |_............|___| + // |stop0 | Tlt Stop-to-Start |start1| |stop0 | + // + // Command without data: + // ......._ __________________________ + // | | + // Command | | + // ........|___| | 140-260 | + // |stop0 | Tlt Stop-to-Start | + // + // Service Request: + // ......._ ______ ___ ............_ ------- + // | 140-260 | | | | | | + // Command | Service Request | | | | Data bytes | | + // ........|___________________| |__| |_............|___| + // |stop0 | |start1| |stop0 | + // ......._ __________ + // | 140-260 | + // Command | Service Request | + // ........|___________________| + // |stop0 | + // This can be happened? + // ......._ ______________________ ___ ............_ ----- + // | | | | | | 140-260 | + // Command | | | | | Data bytes | Service Request | + // ........|___| | 140-260 |__| |_............|_________________| + // |stop0 | Tlt Stop-to-Start |start1| |stop0 | + // + // "Service requests are issued by the devices during a very specific time at the + // end of the reception of the command packet. + // If a device in need of service issues a service request, it must do so within + // the 65 µs of the Stop Bit’s low time and maintain the line low for a total of 300 µs." + // + // "A device sends a Service Request signal by holding the bus low during the low + // portion of the stop bit of any command or data transaction. The device must lengthen + // the stop by a minimum of 140 J.lS beyond its normal duration, as shown in Figure 8-15." + // http://ww1.microchip.com/downloads/en/AppNotes/00591b.pdf + if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored + xprintf("R"); + sei(); + return 0; + } + if (!wait_data_lo(500)) { // Tlt/Stop to Start(140-260us) + sei(); + return 0; // No data from device(not error); + } + + // start bit(1) + if (!wait_data_hi(40)) { + xprintf("S"); + sei(); + return 0; + } + if (!wait_data_lo(100)) { + xprintf("s"); + sei(); + return 0; + } + + uint8_t n = 0; // bit count + do { + // + // |<- bit_cell_max(130) ->| + // | |<- lo ->| + // | | |<-hi->| + // _______ + // | | | + // | 130-lo | lo-hi | + // |________| | + // + uint8_t lo = (uint8_t)wait_data_hi(130); + if (!lo) goto error; // no more bit or after stop bit + + uint8_t hi = (uint8_t)wait_data_lo(lo); + if (!hi) goto error; // stop bit extedned by Srq? + + if (n / 8 >= len) continue; // can't store in buf + + buf[n / 8] <<= 1; + if ((130 - lo) < (lo - hi)) { + buf[n / 8] |= 1; + } + } while (++n); + +error: + sei(); + return n / 8; +} + +uint16_t adb_host_talk(uint8_t addr, uint8_t reg) { + uint8_t len; + uint8_t buf[8]; + len = adb_host_talk_buf(addr, reg, buf, 8); + if (len != 2) return 0; + return (buf[0] << 8 | buf[1]); +} + +void adb_host_listen_buf(uint8_t addr, uint8_t reg, uint8_t *buf, uint8_t len) { + cli(); + attention(); + send_byte((addr << 4) | ADB_CMD_LISTEN | reg); + place_bit0(); // Stopbit(0) + // TODO: Service Request + _delay_us(200); // Tlt/Stop to Start + place_bit1(); // Startbit(1) + for (int8_t i = 0; i < len; i++) { + send_byte(buf[i]); + // xprintf("%02X ", buf[i]); + } + place_bit0(); // Stopbit(0); + sei(); +} + +void adb_host_listen(uint8_t addr, uint8_t reg, uint8_t data_h, uint8_t data_l) { + uint8_t buf[2] = {data_h, data_l}; + adb_host_listen_buf(addr, reg, buf, 2); +} + +void adb_host_flush(uint8_t addr) { + cli(); + attention(); + send_byte((addr << 4) | ADB_CMD_FLUSH); + place_bit0(); // Stopbit(0) + _delay_us(200); // Tlt/Stop to Start + sei(); +} + +// send state of LEDs +void adb_host_kbd_led(uint8_t led) { + // Listen Register2 + // upper byte: not used + // lower byte: bit2=ScrollLock, bit1=CapsLock, bit0=NumLock + adb_host_listen(ADB_ADDR_KEYBOARD, ADB_REG_2, 0, led & 0x07); +} + +#ifdef ADB_PSW_BIT +static inline void psw_lo() { + ADB_DDR |= (1 << ADB_PSW_BIT); + ADB_PORT &= ~(1 << ADB_PSW_BIT); +} +static inline void psw_hi() { + ADB_PORT |= (1 << ADB_PSW_BIT); + ADB_DDR &= ~(1 << ADB_PSW_BIT); +} +static inline bool psw_in() { + ADB_PORT |= (1 << ADB_PSW_BIT); + ADB_DDR &= ~(1 << ADB_PSW_BIT); + return ADB_PIN & (1 << ADB_PSW_BIT); +} +#endif + +static inline void attention(void) { + data_lo(); + _delay_us(800 - 35); // bit1 holds lo for 35 more + place_bit1(); +} + +static inline void place_bit0(void) { + data_lo(); + _delay_us(65); + data_hi(); + _delay_us(35); +} + +static inline void place_bit1(void) { + data_lo(); + _delay_us(35); + data_hi(); + _delay_us(65); +} + +static inline void send_byte(uint8_t data) { + for (int i = 0; i < 8; i++) { + if (data & (0x80 >> i)) + place_bit1(); + else + place_bit0(); + } +} + +// These are carefully coded to take 6 cycles of overhead. +// inline asm approach became too convoluted +static inline uint16_t wait_data_lo(uint16_t us) { + do { + if (!data_in()) break; + _delay_us(1 - (6 * 1000000.0 / F_CPU)); + } while (--us); + return us; +} + +static inline uint16_t wait_data_hi(uint16_t us) { + do { + if (data_in()) break; + _delay_us(1 - (6 * 1000000.0 / F_CPU)); + } while (--us); + return us; +} + +/* +ADB Protocol +============ + +Resources +--------- +ADB - The Untold Story: Space Aliens Ate My Mouse + http://developer.apple.com/legacy/mac/library/#technotes/hw/hw_01.html +ADB Manager + http://developer.apple.com/legacy/mac/library/documentation/mac/pdf/Devices/ADB_Manager.pdf + Service request(5-17) +Apple IIgs Hardware Reference Second Edition [Chapter6 p121] + ftp://ftp.apple.asimov.net/pub/apple_II/documentation/Apple%20IIgs%20Hardware%20Reference.pdf +ADB Keycode + http://72.0.193.250/Documentation/macppc/adbkeycodes/ + http://m0115.web.fc2.com/m0115.jpg + [Inside Macintosh volume V, pages 191-192] + http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-421.18.3/IOHIDFamily/Cosmo_USB2ADB.c +ADB Signaling + http://kbdbabel.sourceforge.net/doc/kbd_signaling_pcxt_ps2_adb.pdf +ADB Overview & History + http://en.wikipedia.org/wiki/Apple_Desktop_Bus +Microchip Application Note: ADB device(with code for PIC16C) + http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011062 +AVR ATtiny2131 ADB to PS/2 converter(Japanese) + http://hp.vector.co.jp/authors/VA000177/html/KeyBoardA5DEA5CBA5A2II.html + + +Pinouts +------- + ADB female socket from the front: + __________ + | | <--- top + | 4o o3 | + |2o o1| + | == | + |________| <--- bottom + | | <--- 4pins + + + ADB female socket from bottom: + + ========== <--- front + | | + | | + |2o o1| + |4o o3| + ---------- <--- back + + 1: Data + 2: Power SW(low when press Power key) + 3: Vcc(5V) + 4: GND + + +Commands +-------- + ADB command is 1byte and consists of 4bit-address, 2bit-command + type and 2bit-register. The commands are always sent by Host. + + Command format: + 7 6 5 4 3 2 1 0 + | | | |------------ address + | |-------- command type + | |---- register + + bits commands + ------------------------------------------------------ + - - - - 0 0 0 0 Send Reset(reset all devices) + A A A A 0 0 0 1 Flush(reset a device) + - - - - 0 0 1 0 Reserved + - - - - 0 0 1 1 Reserved + - - - - 0 1 - - Reserved + A A A A 1 0 R R Listen(write to a device) + A A A A 1 1 R R Talk(read from a device) + + The command to read keycodes from keyboard is 0x2C which + consist of keyboard address 2 and Talk against register 0. + + Address: + 2: keyboard + 3: mice + + Registers: + 0: application(keyboard uses this to store its data.) + 1: application + 2: application(keyboard uses this for LEDs and state of modifiers) + 3: status and command + + +Communication +------------- + This is a minimum information for keyboard communication. + See "Resources" for detail. + + Signaling: + + ~~~~____________~~||||||||||||__~~~~~_~~|||||||||||||||__~~~~ + + |800us | |7 Command 0| | | |15-64 Data 0|Stopbit(0) + +Attention | | | +Startbit(1) + +Startbit(1) | +Tlt(140-260us) + +stopbit(0) + + Bit cells: + + bit0: ______~~~ + 65 :35us + + bit1: ___~~~~~~ + 35 :65us + + bit0 low time: 60-70% of bit cell(42-91us) + bit1 low time: 30-40% of bit cell(21-52us) + bit cell time: 70-130us + [from Apple IIgs Hardware Reference Second Edition] + + Criterion for bit0/1: + After 55us if line is low/high then bit is 0/1. + + Attention & start bit: + Host asserts low in 560-1040us then places start bit(1). + + Tlt(Stop to Start): + Bus stays high in 140-260us then device places start bit(1). + + Global reset: + Host asserts low in 2.8-5.2ms. All devices are forced to reset. + + Service request from device(Srq): + Device can request to send at commad(Global only?) stop bit. + Requesting device keeps low for 140-260us at stop bit of command. + + +Keyboard Data(Register0) + This 16bit data can contains two keycodes and two released flags. + First keycode is palced in upper byte. When one keyocode is sent, + lower byte is 0xFF. + Release flag is 1 when key is released. + + 1514 . . . . . 8 7 6 . . . . . 0 + | | | | | | | | | +-+-+-+-+-+-+- Keycode2 + | | | | | | | | +--------------- Released2(1 when the key is released) + | +-+-+-+-+-+-+----------------- Keycode1 + +------------------------------- Released1(1 when the key is released) + + Keycodes: + Scancode consists of 7bit keycode and 1bit release flag. + Device can send two keycodes at once. If just one keycode is sent + keycode1 contains it and keyocode2 is 0xFF. + + Power switch: + You can read the state from PSW line(active low) however + the switch has a special scancode 0x7F7F, so you can + also read from Data line. It uses 0xFFFF for release scancode. + +Keyboard LEDs & state of keys(Register2) + This register hold current state of three LEDs and nine keys. + The state of LEDs can be changed by sending Listen command. + + 1514 . . . . . . 7 6 5 . 3 2 1 0 + | | | | | | | | | | | | | | | +- LED1(NumLock) + | | | | | | | | | | | | | | +--- LED2(CapsLock) + | | | | | | | | | | | | | +----- LED3(ScrollLock) + | | | | | | | | | | +-+-+------- Reserved + | | | | | | | | | +------------- ScrollLock + | | | | | | | | +--------------- NumLock + | | | | | | | +----------------- Apple/Command + | | | | | | +------------------- Option + | | | | | +--------------------- Shift + | | | | +----------------------- Control + | | | +------------------------- Reset/Power + | | +--------------------------- CapsLock + | +----------------------------- Delete + +------------------------------- Reserved + +Address, Handler ID and bits(Register3) + 1514131211 . . 8 7 . . . . . . 0 + | | | | | | | | | | | | | | | | + | | | | | | | | +-+-+-+-+-+-+-+- Handler ID + | | | | +-+-+-+----------------- Address + | | | +------------------------- 0 + | | +--------------------------- Service request enable(1 = enabled) + | +----------------------------- Exceptional event(alwyas 1 if not used) + +------------------------------- 0 + +ADB Bit Cells + bit cell time: 70-130us + low part of bit0: 60-70% of bit cell + low part of bit1: 30-40% of bit cell + + bit cell time 70us 130us + -------------------------------------------- + low part of bit0 42-49 78-91 + high part of bit0 21-28 39-52 + low part of bit1 21-28 39-52 + high part of bit1 42-49 78-91 + + + bit0: + 70us bit cell: + ____________~~~~~~ + 42-49 21-28 + + 130us bit cell: + ____________~~~~~~ + 78-91 39-52 + + bit1: + 70us bit cell: + ______~~~~~~~~~~~~ + 21-28 42-49 + + 130us bit cell: + ______~~~~~~~~~~~~ + 39-52 78-91 + + [from Apple IIgs Hardware Reference Second Edition] + +Keyboard Handle ID + Apple Standard Keyboard M0116: 0x01 + Apple Extended Keyboard M0115: 0x02 + Apple Extended Keyboard II M3501: 0x02 + Apple Adjustable Keybaord: 0x10 + + http://lxr.free-electrons.com/source/drivers/macintosh/adbhid.c?v=4.4#L802 + +END_OF_ADB +*/ diff --git a/keyboards/converter/adb_usb/adb.h b/keyboards/converter/adb_usb/adb.h new file mode 100644 index 0000000000..fe8becc2d5 --- /dev/null +++ b/keyboards/converter/adb_usb/adb.h @@ -0,0 +1,106 @@ +/* +Copyright 2011-19 Jun WAKO <wakojun@gmail.com> + +This software is licensed with a Modified BSD License. +All of this is supposed to be Free Software, Open Source, DFSG-free, +GPL-compatible, and OK to use in both free and proprietary applications. +Additions and corrections to this file are welcome. + + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +* Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +#pragma once + +#include <stdint.h> +#include <stdbool.h> + +#if !(defined(ADB_PORT) && defined(ADB_PIN) && defined(ADB_DDR) && defined(ADB_DATA_BIT)) +# error "ADB port setting is required in config.h" +#endif + +#define ADB_POWER 0x7F +#define ADB_CAPS 0x39 + +/* ADB commands */ +// Default Address +#define ADB_ADDR_0 0 +#define ADB_ADDR_DONGLE 1 +#define ADB_ADDR_KEYBOARD 2 +#define ADB_ADDR_MOUSE 3 +#define ADB_ADDR_TABLET 4 +#define ADB_ADDR_APPLIANCE 7 +#define ADB_ADDR_8 8 +#define ADB_ADDR_9 9 +#define ADB_ADDR_10 10 +#define ADB_ADDR_11 11 +#define ADB_ADDR_12 12 +#define ADB_ADDR_13 13 +#define ADB_ADDR_14 14 +#define ADB_ADDR_15 15 +// for temporary purpose, do not use for polling +#define ADB_ADDR_TMP 15 +#define ADB_ADDR_MOUSE_POLL 10 +// Command Type +#define ADB_CMD_RESET 0 +#define ADB_CMD_FLUSH 1 +#define ADB_CMD_LISTEN 8 +#define ADB_CMD_TALK 12 +// Register +#define ADB_REG_0 0 +#define ADB_REG_1 1 +#define ADB_REG_2 2 +#define ADB_REG_3 3 + +/* ADB keyboard handler id */ +#define ADB_HANDLER_STD 0x01 /* IIGS, M0116 */ +#define ADB_HANDLER_AEK 0x02 /* M0115, M3501 */ +#define ADB_HANDLER_AEK_RMOD 0x03 /* M0115, M3501, alternate mode enableing right modifiers */ +#define ADB_HANDLER_STD_ISO 0x04 /* M0118, ISO swapping keys */ +#define ADB_HANDLER_AEK_ISO 0x05 /* M0115, M3501, ISO swapping keys */ +#define ADB_HANDLER_M1242_ANSI 0x10 /* Adjustable keyboard */ +#define ADB_HANDLER_CLASSIC1_MOUSE 0x01 +#define ADB_HANDLER_CLASSIC2_MOUSE 0x02 +#define ADB_HANDLER_EXTENDED_MOUSE 0x04 +#define ADB_HANDLER_TURBO_MOUSE 0x32 + +// ADB host +void adb_host_init(void); +bool adb_host_psw(void); +uint16_t adb_host_talk(uint8_t addr, uint8_t reg); +uint8_t adb_host_talk_buf(uint8_t addr, uint8_t reg, uint8_t *buf, uint8_t len); +void adb_host_listen(uint8_t addr, uint8_t reg, uint8_t data_h, uint8_t data_l); +void adb_host_listen_buf(uint8_t addr, uint8_t reg, uint8_t *buf, uint8_t len); +void adb_host_flush(uint8_t addr); +void adb_host_kbd_led(uint8_t led); +uint16_t adb_host_kbd_recv(void); +uint16_t adb_host_mouse_recv(void); + +// ADB Mouse +void adb_mouse_task(void); +void adb_mouse_init(void); diff --git a/keyboards/converter/adb_usb/adb_usb.h b/keyboards/converter/adb_usb/adb_usb.h index 3db303b039..ddbbd71564 100644 --- a/keyboards/converter/adb_usb/adb_usb.h +++ b/keyboards/converter/adb_usb/adb_usb.h @@ -17,11 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. Ported to QMK by Peter Roe <pete@13bit.me> */ -#ifndef ADB_USB_H -#define ADB_USB_H +#pragma once #include "quantum.h" +#define XXX KC_NO + /* M0115/M3501 Apple Extended Keyboard ANSI * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---. * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr| @@ -39,29 +40,29 @@ Ported to QMK by Peter Roe <pete@13bit.me> * `-----------------------------------------------------------' `-----------' `---------------' */ #define LAYOUT_ext_ansi( \ - K35, K7A,K78,K63,K76,K60,K61,K62,K64,K65,K6D,K67,K6F, K69,K6B,K71, K7F, \ - K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \ - K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \ - K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \ - K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \ - K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \ + k35, k7A, k78, k63, k76, k60, k61, k62, k64, k65, k6D, k67, k6F, k69, k6B, k71, k7F, \ + k32, k12, k13, k14, k15, k17, k16, k1A, k1C, k19, k1D, k1B, k18, k33, k72, k73, k74, k47, k51, k4B, k43, \ + k30, k0C, k0D, k0E, k0F, k11, k10, k20, k22, k1F, k23, k21, k1E, k2A, k75, k77, k79, k59, k5B, k5C, k4E, \ + k39, k00, k01, k02, k03, k05, k04, k26, k28, k25, k29, k27, k24, k56, k57, k58, k45, \ + k38, k06, k07, k08, k09, k0B, k2D, k2E, k2B, k2F, k2C, k7B, k3E, k53, k54, k55,\ + k36, k3A, k37, k31, k7C, k7D, k3B, k3D, k3C, k52, k41, k4C \ ) { \ - { K00, K01, K02, K03, K04, K05, K06, K07 }, \ - { K08, K09, KC_NO, 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, KC_NO, K35, K36, K37 }, \ - { K38, K39, K3A, K3B, K3C, K3D, K3E, KC_NO, }, \ - { KC_NO, K41, KC_NO, K43, KC_NO, K45, KC_NO, K47 }, \ - { KC_NO, KC_NO, KC_NO, K4B, K4C, KC_NO, K4E, KC_NO, }, \ - { KC_NO, K51, K52, K53, K54, K55, K56, K57 }, \ - { K58, K59, KC_NO, K5B, K5C, KC_NO, KC_NO, KC_NO, }, \ - { K60, K61, K62, K63, K64, K65, KC_NO, K67 }, \ - { KC_NO, K69, KC_NO, K6B, KC_NO, K6D, KC_NO, K6F }, \ - { KC_NO, K71, K72, K73, K74, K75, K76, K77 }, \ - { K78, K79, K7A, K7B, K7C, K7D, KC_NO, K7F } \ + { k00, k01, k02, k03, k04, k05, k06, k07 }, \ + { k08, k09, XXX, 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, XXX, k35, k36, k37 }, \ + { k38, k39, k3A, k3B, k3C, k3D, k3E, XXX }, \ + { XXX, k41, XXX, k43, XXX, k45, XXX, k47 }, \ + { XXX, XXX, XXX, k4B, k4C, XXX, k4E, XXX }, \ + { XXX, k51, k52, k53, k54, k55, k56, k57 }, \ + { k58, k59, XXX, k5B, k5C, XXX, XXX, XXX }, \ + { k60, k61, k62, k63, k64, k65, XXX, k67 }, \ + { XXX, k69, XXX, k6B, XXX, k6D, XXX, k6F }, \ + { XXX, k71, k72, k73, k74, k75, k76, k77 }, \ + { k78, k79, k7A, k7B, k7C, k7D, XXX, k7F } \ } /* M0116 Apple Standard Keyboard ANSI @@ -81,29 +82,27 @@ Ported to QMK by Peter Roe <pete@13bit.me> * +---------------------------------------------------------+ +-------+---+---+ */ #define LAYOUT_m0116_ansi( \ - K7F, \ - K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \ - K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K45, \ - K36,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K4E, \ - K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K53,K54,K55, \ - K39,K3A,K37,K32, K31, K2A,K3B,K3C,K3D,K3E, K52, K41,K4C \ + k7F, \ + k35, k12, k13, k14, k15, k17, k16, k1A, k1C, k19, k1D, k1B, k18, k33, k47, k51, k4B, k43, \ + k30, k0C, k0D, k0E, k0F, k11, k10, k20, k22, k1F, k23, k21, k1E, k59, k5B, k5C, k45, \ + k36, k00, k01, k02, k03, k05, k04, k26, k28, k25, k29, k27, k24, k56, k57, k58, k4E, \ + k38, k06, k07, k08, k09, k0B, k2D, k2E, k2B, k2F, k2C, k7B, k53, k54, k55, \ + k39, k3A, k37, k32, k31, k2A, k3B, k3C, k3D, k3E, k52, k41, k4C \ ) { \ - { K00, K01, K02, K03, K04, K05, K06, K07 }, \ - { K08, K09, KC_NO, 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, KC_NO, K35, K36, K37 }, \ - { K38, K39, K3A, K3B, K3C, K3D, K3E, KC_NO }, \ - { KC_NO, K41, KC_NO, K43, KC_NO, K45, KC_NO, K47 }, \ - { KC_NO, KC_NO, KC_NO, K4B, K4C, KC_NO, K4E, KC_NO }, \ - { KC_NO, K51, K52, K53, K54, K55, K56, K57 }, \ - { K58, K59, KC_NO, K5B, K5C, 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, K7B, KC_NO, KC_NO, KC_NO, K7F } \ + { k00, k01, k02, k03, k04, k05, k06, k07 }, \ + { k08, k09, XXX, 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, XXX, k35, k36, k37 }, \ + { k38, k39, k3A, k3B, k3C, k3D, k3E, XXX }, \ + { XXX, k41, XXX, k43, XXX, k45, XXX, k47 }, \ + { XXX, XXX, XXX, k4B, k4C, XXX, k4E, XXX }, \ + { XXX, k51, k52, k53, k54, k55, k56, k57 }, \ + { k58, k59, XXX, k5B, k5C, 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, k7B, XXX, XXX, XXX, k7F } \ } - -#endif diff --git a/keyboards/converter/adb_usb/matrix.c b/keyboards/converter/adb_usb/matrix.c index 9e5399de5d..e6a4921960 100644 --- a/keyboards/converter/adb_usb/matrix.c +++ b/keyboards/converter/adb_usb/matrix.c @@ -31,6 +31,10 @@ Ported to QMK by Peter Roe <pete@13bit.me> #include "led.h" #include "timer.h" +#ifndef ADB_MOUSE_MAXACC +# define ADB_MOUSE_MAXACC 8 +#endif + static bool is_iso_layout = false; // matrix state buffer(1:on, 0:off) @@ -84,6 +88,10 @@ void matrix_init(void) static report_mouse_t mouse_report = {}; +void housekeeping_task_kb(void) { + adb_mouse_task(); +} + void adb_mouse_task(void) { uint16_t codes; diff --git a/keyboards/converter/adb_usb/rules.mk b/keyboards/converter/adb_usb/rules.mk index 56967770b3..8f4649f556 100644 --- a/keyboards/converter/adb_usb/rules.mk +++ b/keyboards/converter/adb_usb/rules.mk @@ -16,7 +16,9 @@ NKRO_ENABLE = no # USB Nkey Rollover - not yet supported in LUFA EXTRAKEY_ENABLE = yes USB_HID_ENABLE = yes BACKLIGHT_ENABLE = no -#BLUETOOTH = AdafruitBLE # For Adafruit Feather 32U4 BLE support, uncomment this line CUSTOM_MATRIX = yes SRC = matrix.c adb.c led.c + +# ADB_MOUSE_ENABLE +# OPT_DEFS += -DADB_MOUSE_ENABLE -DMOUSE_ENABLE diff --git a/keyboards/converter/ibm_terminal/config.h b/keyboards/converter/ibm_terminal/config.h index 5d8e5f8135..2cd36c5fb0 100644 --- a/keyboards/converter/ibm_terminal/config.h +++ b/keyboards/converter/ibm_terminal/config.h @@ -16,9 +16,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef CONFIG_H -#define CONFIG_H - +#pragma once #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6535 @@ -47,15 +45,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef PS2_USE_USART /* XCK for clock line */ -#define PS2_CLOCK_PORT PORTD -#define PS2_CLOCK_PIN PIND -#define PS2_CLOCK_DDR DDRD -#define PS2_CLOCK_BIT 5 -/* RXD for data line */ -#define PS2_DATA_PORT PORTD -#define PS2_DATA_PIN PIND -#define PS2_DATA_DDR DDRD -#define PS2_DATA_BIT 2 +#define PS2_CLOCK_PIN D5 +#define PS2_DATA_PIN D2 /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */ /* set DDR of CLOCK as input to be slave */ @@ -95,15 +86,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifdef PS2_USE_INT /* uses INT1 for clock line(ATMega32U4) */ -#define PS2_CLOCK_PORT PORTD -#define PS2_CLOCK_PIN PIND -#define PS2_CLOCK_DDR DDRD -#define PS2_CLOCK_BIT 1 - -#define PS2_DATA_PORT PORTD -#define PS2_DATA_PIN PIND -#define PS2_DATA_DDR DDRD -#define PS2_DATA_BIT 0 +#define PS2_CLOCK_PIN D1 +#define PS2_DATA_PIN D0 #define PS2_INT_INIT() do { \ EICRA |= ((1<<ISC11) | \ @@ -123,15 +107,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * PS/2 Busywait configuration */ #ifdef PS2_USE_BUSYWAIT -#define PS2_CLOCK_PORT PORTD -#define PS2_CLOCK_PIN PIND -#define PS2_CLOCK_DDR DDRD -#define PS2_CLOCK_BIT 1 - -#define PS2_DATA_PORT PORTD -#define PS2_DATA_PIN PIND -#define PS2_DATA_DDR DDRD -#define PS2_DATA_BIT 0 -#endif - +#define PS2_CLOCK_PIN D1 +#define PS2_DATA_PIN D0 #endif diff --git a/keyboards/converter/ibm_terminal/ibm_terminal.h b/keyboards/converter/ibm_terminal/ibm_terminal.h index adf048206e..ce50e5f437 100644 --- a/keyboards/converter/ibm_terminal/ibm_terminal.h +++ b/keyboards/converter/ibm_terminal/ibm_terminal.h @@ -1,8 +1,9 @@ -#ifndef IBM_TERMINAL_H -#define IBM_TERMINAL_H +#pragma once #include "quantum.h" +#define XXX KC_NO + void matrix_init_user(void); /* @@ -20,63 +21,61 @@ void matrix_init_user(void); * +---------+ */ #define LAYOUT( \ - K08,K10,K18,K20,K28,K30,K38,K40,K48,K50,K57,K5F, \ - K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, \ - \ - K05,K06, K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K5D,K66, K67,K6E,K6F, K76,K77,K7E,K84, \ - K04,K0C, K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, K5C, K64,K65,K6D, K6C,K75,K7D,K7C, \ - K03,K0B, K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K53,K5A, K63, K6B,K73,K74,K7B, \ - K83,K0A, K12,K13,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K51,K59, K61,K62,K6A, K69,K72,K7A,K79, \ - K01,K09, K11, K19, K29, K39, K58, K60, K68,K70,K71,K78 \ + k08, k10, k18, k20, k28, k30, k38, k40, k48, k50, k57, k5F, \ + k07, k0F, k17, k1F, k27, k2F, k37, k3F, k47, k4F, k56, k5E, \ +\ + k05, k06, k0E, k16, k1E, k26, k25, k2E, k36, k3D, k3E, k46, k45, k4E, k55, k5D, k66, k67, k6E, k6F, k76, k77, k7E, k84, \ + k04, k0C, k0D, k15, k1D, k24, k2D, k2C, k35, k3C, k43, k44, k4D, k54, k5B, k5C, k64, k65, k6D, k6C, k75, k7D, k7C, \ + k03, k0B, k14, k1C, k1B, k23, k2B, k34, k33, k3B, k42, k4B, k4C, k52, k53, k5A, k63, k6B, k73, k74, k7B, \ + k83, k0A, k12, k13, k1A, k22, k21, k2A, k32, k31, k3A, k41, k49, k4A, k51, k59, k61, k62, k6A, k69, k72, k7A, k79, \ + k01, k09, k11, k19, k29, k39, k58, k60, k68, k70, k71, k78 \ ) { \ - { KC_NO, K01, KC_NO, 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, KC_NO }, \ - { KC_NO, KC_NO, KC_NO, K83, K84, KC_NO, KC_NO, KC_NO } \ + { XXX, k01, XXX, 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, XXX }, \ + { XXX, XXX, XXX, k83, k84, XXX, XXX, XXX } \ } /* * IBM Terminal keyboard 1399625, 101-key */ #define LAYOUT_101( \ - K08, K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, K57,K5F,K62, \ - \ - K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, K67,K6E,K6F, K76,K77,K7E,K84, \ - K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5C, K64,K65,K6D, K6C,K75,K7D, \ - K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K7C, \ - K12, K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, K63, K69,K72,K7A, \ - K11, K19, K29, K39, K58, K61,K60,K6A, K70, K71,K79 \ + k08, k07, k0F, k17, k1F, k27, k2F, k37, k3F, k47, k4F, k56, k5E, k57, k5F, k62, \ +\ + k0E, k16, k1E, k26, k25, k2E, k36, k3D, k3E, k46, k45, k4E, k55, k66, k67, k6E, k6F, k76, k77, k7E, k84, \ + k0D, k15, k1D, k24, k2D, k2C, k35, k3C, k43, k44, k4D, k54, k5B, k5C, k64, k65, k6D, k6C, k75, k7D, \ + k14, k1C, k1B, k23, k2B, k34, k33, k3B, k42, k4B, k4C, k52, k5A, k6B, k73, k74, k7C, \ + k12, k1A, k22, k21, k2A, k32, k31, k3A, k41, k49, k4A, k59, k63, k69, k72, k7A, \ + k11, k19, k29, k39, k58, k61, k60, k6A, k70, k71, k79 \ ) { \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K07 }, \ - { K08, KC_NO, KC_NO, KC_NO, KC_NO, K0D, K0E, K0F }, \ - { KC_NO, K11, K12, KC_NO, K14, K15, K16, K17 }, \ - { KC_NO, K19, K1A, K1B, K1C, K1D, K1E, K1F }, \ - { KC_NO, K21, K22, K23, K24, K25, K26, K27 }, \ - { KC_NO, K29, K2A, K2B, K2C, K2D, K2E, K2F }, \ - { KC_NO, K31, K32, K33, K34, K35, K36, K37 }, \ - { KC_NO, K39, K3A, K3B, K3C, K3D, K3E, K3F }, \ - { KC_NO, K41, K42, K43, K44, K45, K46, K47 }, \ - { KC_NO, K49, K4A, K4B, K4C, K4D, K4E, K4F }, \ - { KC_NO, KC_NO, K52, KC_NO, K54, K55, K56, K57 }, \ - { K58, K59, K5A, K5B, K5C, KC_NO, K5E, K5F }, \ - { K60, K61, K62, K63, K64, K65, K66, K67 }, \ - { KC_NO, K69, K6A, K6B, K6C, K6D, K6E, K6F }, \ - { K70, K71, K72, K73, K74, K75, K76, K77 }, \ - { KC_NO, K79, K7A, KC_NO, K7C, K7D, K7E, KC_NO }, \ - { KC_NO, KC_NO, KC_NO, KC_NO, K84, KC_NO, KC_NO, KC_NO } \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, k07 }, \ + { k08, XXX, XXX, XXX, XXX, k0D, k0E, k0F }, \ + { XXX, k11, k12, XXX, k14, k15, k16, k17 }, \ + { XXX, k19, k1A, k1B, k1C, k1D, k1E, k1F }, \ + { XXX, k21, k22, k23, k24, k25, k26, k27 }, \ + { XXX, k29, k2A, k2B, k2C, k2D, k2E, k2F }, \ + { XXX, k31, k32, k33, k34, k35, k36, k37 }, \ + { XXX, k39, k3A, k3B, k3C, k3D, k3E, k3F }, \ + { XXX, k41, k42, k43, k44, k45, k46, k47 }, \ + { XXX, k49, k4A, k4B, k4C, k4D, k4E, k4F }, \ + { XXX, XXX, k52, XXX, k54, k55, k56, k57 }, \ + { k58, k59, k5A, k5B, k5C, XXX, k5E, k5F }, \ + { k60, k61, k62, k63, k64, k65, k66, k67 }, \ + { XXX, k69, k6A, k6B, k6C, k6D, k6E, k6F }, \ + { k70, k71, k72, k73, k74, k75, k76, k77 }, \ + { XXX, k79, k7A, XXX, k7C, k7D, k7E, XXX }, \ + { XXX, XXX, XXX, XXX, k84, XXX, XXX, XXX } \ } - -#endif diff --git a/keyboards/converter/m0110_usb/m0110.c b/keyboards/converter/m0110_usb/m0110.c new file mode 100644 index 0000000000..64f2fa50ab --- /dev/null +++ b/keyboards/converter/m0110_usb/m0110.c @@ -0,0 +1,583 @@ +/* +Copyright 2011,2012 Jun WAKO <wakojun@gmail.com> + +This software is licensed with a Modified BSD License. +All of this is supposed to be Free Software, Open Source, DFSG-free, +GPL-compatible, and OK to use in both free and proprietary applications. +Additions and corrections to this file are welcome. + + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +* Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +/* M0110A Support was contributed by skagon@github */ + +#include <stdbool.h> +#include <avr/io.h> +#include <avr/interrupt.h> +#include <util/delay.h> +#include "m0110.h" +#include "debug.h" + +static inline uint8_t raw2scan(uint8_t raw); +static inline uint8_t inquiry(void); +static inline uint8_t instant(void); +static inline void clock_lo(void); +static inline void clock_hi(void); +static inline bool clock_in(void); +static inline void data_lo(void); +static inline void data_hi(void); +static inline bool data_in(void); +static inline uint16_t wait_clock_lo(uint16_t us); +static inline uint16_t wait_clock_hi(uint16_t us); +static inline uint16_t wait_data_lo(uint16_t us); +static inline uint16_t wait_data_hi(uint16_t us); +static inline void idle(void); +static inline void request(void); + +#define WAIT_US(stat, us, err) \ + do { \ + if (!wait_##stat(us)) { \ + m0110_error = err; \ + goto ERROR; \ + } \ + } while (0) + +#define WAIT_MS(stat, ms, err) \ + do { \ + uint16_t _ms = ms; \ + while (_ms) { \ + if (wait_##stat(1000)) { \ + break; \ + } \ + _ms--; \ + } \ + if (_ms == 0) { \ + m0110_error = err; \ + goto ERROR; \ + } \ + } while (0) + +#define KEY(raw) ((raw)&0x7f) +#define IS_BREAK(raw) (((raw)&0x80) == 0x80) + +uint8_t m0110_error = 0; + +void m0110_init(void) { + idle(); + _delay_ms(1000); + + /* Not needed to initialize in fact. + uint8_t data; + m0110_send(M0110_MODEL); + data = m0110_recv(); + print("m0110_init model: "); print_hex8(data); print("\n"); + + m0110_send(M0110_TEST); + data = m0110_recv(); + print("m0110_init test: "); print_hex8(data); print("\n"); + */ +} + +uint8_t m0110_send(uint8_t data) { + m0110_error = 0; + + request(); + WAIT_MS(clock_lo, 250, 1); // keyboard may block long time + for (uint8_t bit = 0x80; bit; bit >>= 1) { + WAIT_US(clock_lo, 250, 3); + if (data & bit) { + data_hi(); + } else { + data_lo(); + } + WAIT_US(clock_hi, 200, 4); + } + _delay_us(100); // hold last bit for 80us + idle(); + return 1; +ERROR: + print("m0110_send err: "); + print_hex8(m0110_error); + print("\n"); + _delay_ms(500); + idle(); + return 0; +} + +uint8_t m0110_recv(void) { + uint8_t data = 0; + m0110_error = 0; + + WAIT_MS(clock_lo, 250, 1); // keyboard may block long time + for (uint8_t i = 0; i < 8; i++) { + data <<= 1; + WAIT_US(clock_lo, 200, 2); + WAIT_US(clock_hi, 200, 3); + if (data_in()) { + data |= 1; + } + } + idle(); + return data; +ERROR: + print("m0110_recv err: "); + print_hex8(m0110_error); + print("\n"); + _delay_ms(500); + idle(); + return 0xFF; +} + +/* +Handling for exceptional case of key combinations for M0110A + +Shift and Calc/Arrow key could be operated simultaneously: + + Case Shift Arrow Events Interpret + ------------------------------------------------------------------- + 1 Down Down 71, 79, DD Calc(d)*a *b + 2 Down Up 71, 79, UU Arrow&Calc(u)*a + 3 Up Down F1, 79, DD Shift(u) *c + 4 Up Up F1, 79, UU Shift(u) and Arrow&Calc(u)*a + + Case Shift Calc Events Interpret + ------------------------------------------------------------------- + 5(1) Down Down 71, 71, 79, DD Shift(d) and Cacl(d) + 6(2) Down Up F1, 71, 79, UU Shift(u) and Arrow&Calc(u)*a + 7(1) Up Down F1, 71, 79, DD Shift(u) and Calc(d) + 8(4) Up Up F1, F1, 79, UU Shift(ux2) and Arrow&Calc(u)*a + +During Calc key is hold: + Case Shift Arrow Events Interpret + ------------------------------------------------------------------- + A(3) ---- Down F1, 79, DD Shift(u) *c + B ---- Up 79, UU Arrow&Calc(u)*a + C Down ---- F1, 71 Shift(u) and Shift(d) + D Up ---- F1 Shift(u) + E Hold Down 79, DD Normal + F Hold Up 79, UU Arrow&Calc(u)*a + G(1) Down Down F1, 71, 79, DD Shift(u)*b and Calc(d)*a + H(2) Down Up F1, 71, 79, UU Shift(u) and Arrow&Calc(u)*a + I(3) Up Down F1, F1, 79, DD Shift(ux2) *c + J(4) Up Up F1, 79, UU Shift(u) and Arrow&Calc(u)*a + + Case Shift Calc Events Interpret + ------------------------------------------------------------------- + K(1) ---- Down 71, 79, DD Calc(d)*a + L(4) ---- Up F1, 79, UU Shift(u) and Arrow&Calc(u)*a + M(1) Hold Down 71, 79, DD Calc(d)*a + N Hold Up 79, UU Arrow&Calc(u)*a + + Where DD/UU indicates part of Keypad Down/Up event. + *a: Impossible to distinguish btween Arrow and Calc event. + *b: Shift(d) event is ignored. + *c: Arrow/Calc(d) event is ignored. +*/ +uint8_t m0110_recv_key(void) { + static uint8_t keybuf = 0x00; + static uint8_t keybuf2 = 0x00; + static uint8_t rawbuf = 0x00; + uint8_t raw, raw2, raw3; + + if (keybuf) { + raw = keybuf; + keybuf = 0x00; + return raw; + } + if (keybuf2) { + raw = keybuf2; + keybuf2 = 0x00; + return raw; + } + + if (rawbuf) { + raw = rawbuf; + rawbuf = 0x00; + } else { + raw = instant(); // Use INSTANT for better response. Should be INQUIRY ? + } + switch (KEY(raw)) { + case M0110_KEYPAD: + raw2 = instant(); + switch (KEY(raw2)) { + case M0110_ARROW_UP: + case M0110_ARROW_DOWN: + case M0110_ARROW_LEFT: + case M0110_ARROW_RIGHT: + if (IS_BREAK(raw2)) { + // Case B,F,N: + keybuf = (raw2scan(raw2) | M0110_CALC_OFFSET); // Calc(u) + return (raw2scan(raw2) | M0110_KEYPAD_OFFSET); // Arrow(u) + } + break; + } + // Keypad or Arrow + return (raw2scan(raw2) | M0110_KEYPAD_OFFSET); + break; + case M0110_SHIFT: + raw2 = instant(); + switch (KEY(raw2)) { + case M0110_SHIFT: + // Case: 5-8,C,G,H + rawbuf = raw2; + return raw2scan(raw); // Shift(d/u) + break; + case M0110_KEYPAD: + // Shift + Arrow, Calc, or etc. + raw3 = instant(); + switch (KEY(raw3)) { + case M0110_ARROW_UP: + case M0110_ARROW_DOWN: + case M0110_ARROW_LEFT: + case M0110_ARROW_RIGHT: + if (IS_BREAK(raw)) { + if (IS_BREAK(raw3)) { + // Case 4: + print("(4)\n"); + keybuf2 = raw2scan(raw); // Shift(u) + keybuf = (raw2scan(raw3) | M0110_CALC_OFFSET); // Calc(u) + return (raw2scan(raw3) | M0110_KEYPAD_OFFSET); // Arrow(u) + } else { + // Case 3: + print("(3)\n"); + return (raw2scan(raw)); // Shift(u) + } + } else { + if (IS_BREAK(raw3)) { + // Case 2: + print("(2)\n"); + keybuf = (raw2scan(raw3) | M0110_CALC_OFFSET); // Calc(u) + return (raw2scan(raw3) | M0110_KEYPAD_OFFSET); // Arrow(u) + } else { + // Case 1: + print("(1)\n"); + return (raw2scan(raw3) | M0110_CALC_OFFSET); // Calc(d) + } + } + break; + default: + // Shift + Keypad + keybuf = (raw2scan(raw3) | M0110_KEYPAD_OFFSET); + return raw2scan(raw); // Shift(d/u) + break; + } + break; + default: + // Shift + Normal keys + keybuf = raw2scan(raw2); + return raw2scan(raw); // Shift(d/u) + break; + } + break; + default: + // Normal keys + return raw2scan(raw); + break; + } +} + +static inline uint8_t raw2scan(uint8_t raw) { return (raw == M0110_NULL) ? M0110_NULL : ((raw == M0110_ERROR) ? M0110_ERROR : (((raw & 0x80) | ((raw & 0x7F) >> 1)))); } + +static inline uint8_t inquiry(void) { + m0110_send(M0110_INQUIRY); + return m0110_recv(); +} + +static inline uint8_t instant(void) { + m0110_send(M0110_INSTANT); + uint8_t data = m0110_recv(); + if (data != M0110_NULL) { + debug_hex(data); + debug(" "); + } + return data; +} + +static inline void clock_lo() { + M0110_CLOCK_PORT &= ~(1 << M0110_CLOCK_BIT); + M0110_CLOCK_DDR |= (1 << M0110_CLOCK_BIT); +} +static inline void clock_hi() { + /* input with pull up */ + M0110_CLOCK_DDR &= ~(1 << M0110_CLOCK_BIT); + M0110_CLOCK_PORT |= (1 << M0110_CLOCK_BIT); +} +static inline bool clock_in() { + M0110_CLOCK_DDR &= ~(1 << M0110_CLOCK_BIT); + M0110_CLOCK_PORT |= (1 << M0110_CLOCK_BIT); + _delay_us(1); + return M0110_CLOCK_PIN & (1 << M0110_CLOCK_BIT); +} +static inline void data_lo() { + M0110_DATA_PORT &= ~(1 << M0110_DATA_BIT); + M0110_DATA_DDR |= (1 << M0110_DATA_BIT); +} +static inline void data_hi() { + /* input with pull up */ + M0110_DATA_DDR &= ~(1 << M0110_DATA_BIT); + M0110_DATA_PORT |= (1 << M0110_DATA_BIT); +} +static inline bool data_in() { + M0110_DATA_DDR &= ~(1 << M0110_DATA_BIT); + M0110_DATA_PORT |= (1 << M0110_DATA_BIT); + _delay_us(1); + return M0110_DATA_PIN & (1 << M0110_DATA_BIT); +} + +static inline uint16_t wait_clock_lo(uint16_t us) { + while (clock_in() && us) { + asm(""); + _delay_us(1); + us--; + } + return us; +} +static inline uint16_t wait_clock_hi(uint16_t us) { + while (!clock_in() && us) { + asm(""); + _delay_us(1); + us--; + } + return us; +} +static inline uint16_t wait_data_lo(uint16_t us) { + while (data_in() && us) { + asm(""); + _delay_us(1); + us--; + } + return us; +} +static inline uint16_t wait_data_hi(uint16_t us) { + while (!data_in() && us) { + asm(""); + _delay_us(1); + us--; + } + return us; +} + +static inline void idle(void) { + clock_hi(); + data_hi(); +} + +static inline void request(void) { + clock_hi(); + data_lo(); +} + +/* +Primitive M0110 Library for AVR +============================== + + +Signaling +--------- +CLOCK is always from KEYBOARD. DATA are sent with MSB first. + +1) IDLE: both lines are high. + CLOCK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + DATA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +2) KEYBOARD->HOST: HOST reads bit on rising edge. + CLOCK ~~~~~~~~~~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~~~~~~~~~ + DATA ~~~~~~~~~~~~X777777X666666X555555X444444X333333X222222X111111X000000X~~~~~~~ + <--> 160us(clock low) + <---> 180us(clock high) + +3) HOST->KEYBOARD: HOST asserts bit on falling edge. + CLOCK ~~~~~~~~~~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~|__|~~~~~~~~~~~ + DATA ~~~~~~|_____X777777X666666X555555X444444X333333X222222X111111X000000X~~~~~~~ + <----> 840us(request to send by host) <---> 80us(hold DATA) + <--> 180us(clock low) + <---> 220us(clock high) + + +Protocol +-------- +COMMAND: + Inquiry 0x10 get key event with block + Instant 0x12 get key event + Model 0x14 get model number(M0110 responds with 0x09) + bit 7 1 if another device connected(used when keypad exists?) + bit4-6 next device model number + bit1-3 keyboard model number + bit 0 always 1 + Test 0x16 test(ACK:0x7D/NAK:0x77) + +KEY EVENT: + bit 7 key state(0:press 1:release) + bit 6-1 scan code(see below) + bit 0 always 1 + To get scan code use this: ((bits&(1<<7)) | ((bits&0x7F))>>1). + + Note: On the M0110A, Keypad keys and Arrow keys are preceded by 0x79. + Moreover, some Keypad keys(=, /, * and +) are preceded by 0x71 on press and 0xF1 on release. + +ARROW KEYS: + Arrow keys and Calc keys(+,*,/,= on keypad) share same byte sequence and preceding byte of + Calc keys(0x71 and 0xF1) means press and release event of SHIFT. This causes a very confusing situation, + it is difficult or impossible to tell Calc key from Arrow key plus SHIFT in some cases. + + Raw key events: + press release + ---------------- ---------------- + Left: 0x79, 0x0D 0x79, 0x8D + Right: 0x79, 0x05 0x79, 0x85 + Up: 0x79, 0x1B 0x79, 0x9B + Down: 0x79, 0x11 0x79, 0x91 + Pad+: 0x71, 0x79, 0x0D 0xF1, 0x79, 0x8D + Pad*: 0x71, 0x79, 0x05 0xF1, 0x79, 0x85 + Pad/: 0x71, 0x79, 0x1B 0xF1, 0x79, 0x9B + Pad=: 0x71, 0x79, 0x11 0xF1, 0x79, 0x91 + + +RAW CODE: + M0110A + ,---------------------------------------------------------. ,---------------. + | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Clr| =| /| *| + |---------------------------------------------------------| |---------------| + |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| + |-----------------------------------------------------' | |---------------| + |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| + |---------------------------------------------------------| |---------------| + |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | + |---------------------------------------------------------' |-----------|Ent| + |Optio|Mac | Space | \|Lft|Rgt|Dn | | 0| .| | + `---------------------------------------------------------' `---------------' + ,---------------------------------------------------------. ,---------------. + | 65| 25| 27| 29| 2B| 2F| 2D| 35| 39| 33| 3B| 37| 31| 67| |+0F|*11|*1B|*05| + |---------------------------------------------------------| |---------------| + | 61| 19| 1B| 1D| 1F| 23| 21| 41| 45| 3F| 47| 43| 3D| | |+33|+37|+39|+1D| + |-----------------------------------------------------' | |---------------| + | 73| 01| 03| 05| 07| 0B| 09| 4D| 51| 4B| 53| 4F| 49| |+2D|+2F|+31|*0D| + |---------------------------------------------------------| |---------------| + | 71| 0D| 0F| 11| 13| 17| 5B| 5D| 27| 5F| 59| 71|+1B| |+27|+29|+2B| | + |---------------------------------------------------------' |-----------|+19| + | 75| 6F| 63 | 55|+0D|+05|+11| | +25|+03| | + `---------------------------------------------------------' `---------------' + + 0x79, 0xDD / 0xF1, 0xUU + * 0x71, 0x79,DD / 0xF1, 0x79, 0xUU + + +MODEL NUMBER: + M0110: 0x09 00001001 : model number 4 (100) + M0110A: 0x0B 00001011 : model number 5 (101) + M0110 & M0120: ??? + + +Scan Code +--------- + m0110_recv_key() function returns following scan codes instead of M0110 raw codes. + Scan codes are 1 byte size and MSB(bit7) is set when key is released. + + scancode = ((raw&0x80) | ((raw&0x7F)>>1)) + + M0110 M0120 + ,---------------------------------------------------------. ,---------------. + | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| -|Lft|Rgt| + |---------------------------------------------------------| |---------------| + |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9|Up | + |---------------------------------------------------------| |---------------| + |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6|Dn | + |---------------------------------------------------------| |---------------| + |Shift | Z| X| C| V| B| N| M| ,| ,| /| | | 1| 2| 3| | + `---------------------------------------------------------' |-----------|Ent| + |Opt|Mac | Space |Enter|Opt| | 0| .| | + `------------------------------------------------' `---------------' + ,---------------------------------------------------------. ,---------------. + | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 4E| 46| 42| + |---------------------------------------------------------| |---------------| + | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4D| + |---------------------------------------------------------| |---------------| + | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 48| + |---------------------------------------------------------| |---------------| + | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| | 53| 54| 55| | + `---------------------------------------------------------' |-----------| 4C| + | 3A| 37| 31 | 34| 3A| | 52| 41| | + `------------------------------------------------' `---------------' + + International keyboard(See page 22 of "Technical Info for 128K/512K") + ,---------------------------------------------------------. + | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| + |---------------------------------------------------------| + | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| + |------------------------------------------------------ | + | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | + |---------------------------------------------------------| + | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 0A| 38| + `---------------------------------------------------------' + | 3A| 37| 34 | 31| 3A| + `------------------------------------------------' + + M0110A + ,---------------------------------------------------------. ,---------------. + | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Clr| =| /| *| + |---------------------------------------------------------| |---------------| + |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -| + |-----------------------------------------------------' | |---------------| + |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +| + |---------------------------------------------------------| |---------------| + |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| | + |---------------------------------------------------------' |-----------|Ent| + |Optio|Mac | Space | \|Lft|Rgt|Dn | | 0| .| | + `---------------------------------------------------------' `---------------' + ,---------------------------------------------------------. ,---------------. + | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62| + |---------------------------------------------------------| |---------------| + | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| | | 59| 5B| 5C| 4E| + |-----------------------------------------------------' | |---------------| + | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 66| + |---------------------------------------------------------| |---------------| + | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| 4D| | 53| 54| 55| | + |---------------------------------------------------------' |-----------| 4C| + | 3A| 37| 31 | 2A| 46| 42| 48| | 52| 41| | + `---------------------------------------------------------' `---------------' + + +References +---------- +Technical Info for 128K/512K and Plus + ftp://ftp.apple.asimov.net/pub/apple_II/documentation/macintosh/Mac%20Hardware%20Info%20-%20Mac%20128K.pdf + ftp://ftp.apple.asimov.net/pub/apple_II/documentation/macintosh/Mac%20Hardware%20Info%20-%20Mac%20Plus.pdf +Protocol: + Page 20 of Tech Info for 128K/512K + http://www.mac.linux-m68k.org/devel/plushw.php +Connector: + Page 20 of Tech Info for 128K/512K + http://www.kbdbabel.org/conn/kbd_connector_macplus.png +Signaling: + http://www.kbdbabel.org/signaling/kbd_signaling_mac.png + http://typematic.blog.shinobi.jp/Entry/14/ +M0110 raw scan codes: + Page 22 of Tech Info for 128K/512K + Page 07 of Tech Info for Plus + http://m0115.web.fc2.com/m0110.jpg + http://m0115.web.fc2.com/m0110a.jpg +*/ diff --git a/keyboards/converter/m0110_usb/m0110.h b/keyboards/converter/m0110_usb/m0110.h new file mode 100644 index 0000000000..63ff3e90ec --- /dev/null +++ b/keyboards/converter/m0110_usb/m0110.h @@ -0,0 +1,81 @@ +/* +Copyright 2011,2012 Jun WAKO <wakojun@gmail.com> + +This software is licensed with a Modified BSD License. +All of this is supposed to be Free Software, Open Source, DFSG-free, +GPL-compatible, and OK to use in both free and proprietary applications. +Additions and corrections to this file are welcome. + + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +* Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +#pragma once + +/* port settings for clock and data line */ +#if !(defined(M0110_CLOCK_PORT) && defined(M0110_CLOCK_PIN) && defined(M0110_CLOCK_DDR) && defined(M0110_CLOCK_BIT)) +# error "M0110 clock port setting is required in config.h" +#endif + +#if !(defined(M0110_DATA_PORT) && defined(M0110_DATA_PIN) && defined(M0110_DATA_DDR) && defined(M0110_DATA_BIT)) +# error "M0110 data port setting is required in config.h" +#endif + +/* Commands */ +#define M0110_INQUIRY 0x10 +#define M0110_INSTANT 0x14 +#define M0110_MODEL 0x16 +#define M0110_TEST 0x36 + +/* Response(raw byte from M0110) */ +#define M0110_NULL 0x7B +#define M0110_KEYPAD 0x79 +#define M0110_TEST_ACK 0x7D +#define M0110_TEST_NAK 0x77 +#define M0110_SHIFT 0x71 +#define M0110_ARROW_UP 0x1B +#define M0110_ARROW_DOWN 0x11 +#define M0110_ARROW_LEFT 0x0D +#define M0110_ARROW_RIGHT 0x05 + +/* This inidcates no response. */ +#define M0110_ERROR 0xFF + +/* scan code offset for keypad and arrow keys */ +#define M0110_KEYPAD_OFFSET 0x40 +#define M0110_CALC_OFFSET 0x60 + +extern uint8_t m0110_error; + +/* host role */ +void m0110_init(void); +uint8_t m0110_send(uint8_t data); +uint8_t m0110_recv(void); +uint8_t m0110_recv_key(void); +uint8_t m0110_inquiry(void); +uint8_t m0110_instant(void); diff --git a/keyboards/converter/m0110_usb/m0110_usb.h b/keyboards/converter/m0110_usb/m0110_usb.h index 88e74024fc..944296afdc 100644 --- a/keyboards/converter/m0110_usb/m0110_usb.h +++ b/keyboards/converter/m0110_usb/m0110_usb.h @@ -16,12 +16,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. Ported to QMK by Techsock <info@techsock.com> */ -#ifndef M0110_USB_H -#define M0110_USB_H -#endif +#pragma once #include "quantum.h" +#define XXX KC_NO + /* Common layout for M0110 and M0110A * This keymap works with both keyboards. As you can see, the M0110A is * a superset of M0110 keyboard, only one exception is 'Enter'(34) of M0110 @@ -67,26 +67,26 @@ Ported to QMK by Techsock <info@techsock.com> * Two right and left keys of 38 and 3A are identical, you cannot discriminate those two. */ #define LAYOUT_ansi( \ - K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \ - K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K4E, \ - K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K66, \ - K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K4D, K53,K54,K55,K4C, \ - K3A,K37, K31, K34,K2A,K46,K42,K48, K52, K41 \ + K32, K12, K13, K14, K15, K17, K16, K1A, K1C, K19, K1D, K1B, K18, K33, K47, K68, K6D, K62, \ + K30, K0C, K0D, K0E, K0F, K11, K10, K20, K22, K1F, K23, K21, K1E, K59, K5B, K5C, K4E, \ + K39, K00, K01, K02, K03, K05, K04, K26, K28, K25, K29, K27, K24, K56, K57, K58, K66, \ + K38, K06, K07, K08, K09, K0B, K2D, K2E, K2B, K2F, K2C, K4D, K53, K54, K55, K4C, \ + K3A, K37, K31, K34, K2A, K46, K42, K48, K52, K41 \ ) { \ - { K00, K01, K02, K03, K04, K05, K06, K07 }, \ - { K08, K09, KC_NO, 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, KC_NO, KC_NO, K37 }, \ - { K38, K39, K3A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, K41, K42, KC_NO, KC_NO, KC_NO, K46, K47 }, \ - { K48, KC_NO, KC_NO, KC_NO, K4C, K4D, K4E, KC_NO }, \ - { KC_NO, KC_NO, K52, K53, K54, K55, K56, K57 }, \ - { K58, K59, KC_NO, K5B, K5C, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, KC_NO, K62, KC_NO, KC_NO, KC_NO, K66, KC_NO }, \ - { K68, KC_NO, KC_NO, KC_NO, KC_NO, K6D, KC_NO, KC_NO }, \ + { K00, K01, K02, K03, K04, K05, K06, K07 }, \ + { K08, K09, XXX, 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, XXX, XXX, K37 }, \ + { K38, K39, K3A, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, K41, K42, XXX, XXX, XXX, K46, K47 }, \ + { K48, XXX, XXX, XXX, K4C, K4D, K4E, XXX }, \ + { XXX, XXX, K52, K53, K54, K55, K56, K57 }, \ + { K58, K59, XXX, K5B, K5C, XXX, XXX, XXX }, \ + { XXX, XXX, K62, XXX, XXX, XXX, K66, XXX }, \ + { K68, XXX, XXX, XXX, XXX, K6D, XXX, XXX } \ } /* International keyboard layout for M0110 + M0120 @@ -108,24 +108,24 @@ Ported to QMK by Techsock <info@techsock.com> * Two right and left keys of 38 and 3A are identical, you cannot discriminate those two. */ #define LAYOUT_iso( \ - K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \ - K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K59,K5B,K5C,K4E, \ - K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K24, K56,K57,K58,K66, \ - K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K0A, K53,K54,K55,K4C, \ - K3A,K37, K34, K31, K52, K41 \ + K32, K12, K13, K14, K15, K17, K16, K1A, K1C, K19, K1D, K1B, K18, K33, K47, K68, K6D, K62, \ + K30, K0C, K0D, K0E, K0F, K11, K10, K20, K22, K1F, K23, K21, K1E, K2A, K59, K5B, K5C, K4E, \ + K39, K00, K01, K02, K03, K05, K04, K26, K28, K25, K29, K27, K24, K56, K57, K58, K66, \ + K38, K06, K07, K08, K09, K0B, K2D, K2E, K2B, K2F, K2C, K0A, K53, K54, K55, K4C, \ + K3A, K37, K34, K31, K52, K41 \ ) { \ - { 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, KC_NO, KC_NO, K37 }, \ - { K38, K39, K3A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, K41, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K47 }, \ - { KC_NO, KC_NO, KC_NO, KC_NO, K4C, KC_NO, K4E, KC_NO }, \ - { KC_NO, KC_NO, K52, K53, K54, K55, K56, K57 }, \ - { K58, K59, KC_NO, K5B, K5C, KC_NO, KC_NO, KC_NO }, \ - { KC_NO, KC_NO, K62, KC_NO, KC_NO, KC_NO, K66, KC_NO }, \ - { K68, KC_NO, KC_NO, KC_NO, KC_NO, K6D, KC_NO, KC_NO }, \ + { 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, XXX, XXX, K37 }, \ + { K38, K39, K3A, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, K41, XXX, XXX, XXX, XXX, XXX, K47 }, \ + { XXX, XXX, XXX, XXX, K4C, XXX, K4E, XXX }, \ + { XXX, XXX, K52, K53, K54, K55, K56, K57 }, \ + { K58, K59, XXX, K5B, K5C, XXX, XXX, XXX }, \ + { XXX, XXX, K62, XXX, XXX, XXX, K66, XXX }, \ + { K68, XXX, XXX, XXX, XXX, K6D, XXX, XXX } \ } diff --git a/keyboards/converter/m0110_usb/rules.mk b/keyboards/converter/m0110_usb/rules.mk index f59530ce46..288b1729f0 100644 --- a/keyboards/converter/m0110_usb/rules.mk +++ b/keyboards/converter/m0110_usb/rules.mk @@ -19,7 +19,6 @@ NKRO_ENABLE = no # USB Nkey Rollover - not yet supported in LUFA EXTRAKEY_ENABLE = yes USB_HID_ENABLE = yes BACKLIGHT_ENABLE = no -#BLUETOOTH = AdafruitBLE # For Adafruit Feather 32U4 BLE support, uncomment this line CUSTOM_MATRIX = yes SRC = matrix.c m0110.c diff --git a/keyboards/converter/modelm_ssk/rules.mk b/keyboards/converter/modelm_ssk/rules.mk index 4b05b0ae0c..eab17f7d95 100644 --- a/keyboards/converter/modelm_ssk/rules.mk +++ b/keyboards/converter/modelm_ssk/rules.mk @@ -7,7 +7,7 @@ BOOTLOADER = halfkay # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug diff --git a/keyboards/converter/palm_usb/post_rules.mk b/keyboards/converter/palm_usb/post_rules.mk new file mode 100644 index 0000000000..9c11076701 --- /dev/null +++ b/keyboards/converter/palm_usb/post_rules.mk @@ -0,0 +1,7 @@ +ifdef HARDWARE_SERIAL + # Untested with palm_usb + SRC += protocol/serial_uart.c + OPT_DEFS += -DHARDWARE_SERIAL +else + SRC += protocol/serial_soft.c +endif diff --git a/keyboards/converter/palm_usb/rules.mk b/keyboards/converter/palm_usb/rules.mk index e7bedd4add..f83a18afd6 100644 --- a/keyboards/converter/palm_usb/rules.mk +++ b/keyboards/converter/palm_usb/rules.mk @@ -23,12 +23,5 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes SRC += matrix.c -ifdef HARDWARE_SERIAL - # Untested with palm_usb - SRC += protocol/serial_uart.c - OPT_DEFS += -DHARDWARE_SERIAL -else - SRC += protocol/serial_soft.c -endif DEFAULT_FOLDER = converter/palm_usb/stowaway diff --git a/keyboards/converter/sun_usb/config.h b/keyboards/converter/sun_usb/config.h index f073e61e44..c67ae5ebae 100644 --- a/keyboards/converter/sun_usb/config.h +++ b/keyboards/converter/sun_usb/config.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x3333 @@ -81,5 +80,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* idle */ \ SERIAL_SOFT_TXD_ON(); \ } while (0) - -#endif diff --git a/keyboards/converter/sun_usb/post_rules.mk b/keyboards/converter/sun_usb/post_rules.mk new file mode 100644 index 0000000000..2ea1f0a5bf --- /dev/null +++ b/keyboards/converter/sun_usb/post_rules.mk @@ -0,0 +1,6 @@ +ifdef HARDWARE_SERIAL + SRC += protocol/serial_uart.c + OPT_DEFS += -DHARDWARE_SERIAL +else + SRC += protocol/serial_soft.c +endif diff --git a/keyboards/converter/sun_usb/rules.mk b/keyboards/converter/sun_usb/rules.mk index 1decefe519..0f53fde80e 100644 --- a/keyboards/converter/sun_usb/rules.mk +++ b/keyboards/converter/sun_usb/rules.mk @@ -23,11 +23,5 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes SRC += matrix.c led.c -ifdef HARDWARE_SERIAL - SRC += protocol/serial_uart.c - OPT_DEFS += -DHARDWARE_SERIAL -else - SRC += protocol/serial_soft.c -endif DEFAULT_FOLDER = converter/sun_usb/type5 diff --git a/keyboards/converter/sun_usb/type3/type3.h b/keyboards/converter/sun_usb/type3/type3.h index f6f14f4eff..b84a703d6b 100644 --- a/keyboards/converter/sun_usb/type3/type3.h +++ b/keyboards/converter/sun_usb/type3/type3.h @@ -15,11 +15,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef TYPE3_H -#define TYPE3_H +#pragma once #include "quantum.h" +#define XXX KC_NO + /* Sun type 3 keyboard ,-------. ,-----------------------------------------------------------. ,-----------. | 01| 03| | 05| 06| 08| 0A| 0C| 0E| 10| 11| 12| 2B| | 15| 16| 17| @@ -35,32 +36,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | 77 | 78 | 79 | 7A | 13 | `-----------------------------------------------------------' */ - - -#define LAYOUT( \ - K01,K03, K05,K06, K08, K0A, K0C, K0E, K10,K11,K12,K2B, K15,K16,K17, \ - K19,K1A, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2D,K2E,K2F, \ - K31,K33, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K42, K44,K45,K46, \ - K48,K49, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \ - K5F,K61, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E,K6F, K70,K71,K72, \ - K77,K78, K79, K7A,K13 \ +#define LAYOUT( \ + k01, k03, k05, k06, k08, k0A, k0C, k0E, k10, k11, k12, k2B, k15, k16, k17, \ + k19, k1A, k1D, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k58, k2A, k2D, k2E, k2F, \ + k31, k33, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, k3F, k40, k41, k42, k44, k45, k46, \ + k48, k49, k4C, k4D, k4E, k4F, k50, k51, k52, k53, k54, k55, k56, k57, k59, k5B, k5C, k5D, \ + k5F, k61, k63, k64, k65, k66, k67, k68, k69, k6A, k6B, k6C, k6D, k6E, k6F, k70, k71, k72, \ + k77, k78, k79, k7A, k13 \ ) { \ - { KC_NO, K01 , KC_NO, K03 , KC_NO, K05 , K06 , KC_NO }, \ - { K08 , KC_NO, K0A , KC_NO, K0C , KC_NO, K0E , KC_NO }, \ - { K10 , K11 , K12 , K13 , KC_NO, K15 , K16 , K17 }, \ - { KC_NO, K19 , K1A , KC_NO, KC_NO, K1D , K1E , K1F }, \ - { K20 , K21 , K22 , K23 , K24 , K25 , K26 , K27 }, \ - { K28 , K29 , K2A , K2B , KC_NO, K2D , K2E , K2F }, \ - { KC_NO, K31 , KC_NO, K33 , KC_NO, K35 , K36 , K37 }, \ - { K38 , K39 , K3A , K3B , K3C , K3D , K3E , K3F }, \ - { K40 , K41 , K42 , KC_NO, K44 , K45 , K46 , KC_NO }, \ - { K48 , K49 , KC_NO, KC_NO, K4C , K4D , K4E , K4F }, \ - { K50 , K51 , K52 , K53 , K54 , K55 , K56 , K57 }, \ - { K58 , K59 , KC_NO, K5B , K5C , K5D , KC_NO, K5F }, \ - { KC_NO, K61 , KC_NO, K63 , K64 , K65 , K66 , K67 }, \ - { K68 , K69 , K6A , K6B , K6C , K6D , K6E , K6F }, \ - { K70 , K71 , K72 , KC_NO, KC_NO, KC_NO, KC_NO, K77 }, \ - { K78 , K79 , K7A , KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \ + { XXX, k01, XXX, k03, XXX, k05, k06, XXX }, \ + { k08, XXX, k0A, XXX, k0C, XXX, k0E, XXX }, \ + { k10, k11, k12, k13, XXX, k15, k16, k17 }, \ + { XXX, k19, k1A, XXX, XXX, k1D, k1E, k1F }, \ + { k20, k21, k22, k23, k24, k25, k26, k27 }, \ + { k28, k29, k2A, k2B, XXX, k2D, k2E, k2F }, \ + { XXX, k31, XXX, k33, XXX, k35, k36, k37 }, \ + { k38, k39, k3A, k3B, k3C, k3D, k3E, k3F }, \ + { k40, k41, k42, XXX, k44, k45, k46, XXX }, \ + { k48, k49, XXX, XXX, k4C, k4D, k4E, k4F }, \ + { k50, k51, k52, k53, k54, k55, k56, k57 }, \ + { k58, k59, XXX, k5B, k5C, k5D, XXX, k5F }, \ + { XXX, k61, XXX, k63, k64, k65, k66, k67 }, \ + { k68, k69, k6A, k6B, k6C, k6D, k6E, k6F }, \ + { k70, k71, k72, XXX, XXX, XXX, XXX, k77 }, \ + { k78, k79, k7A, XXX, XXX, XXX, XXX, XXX } \ } - -#endif diff --git a/keyboards/converter/sun_usb/type5/type5.h b/keyboards/converter/sun_usb/type5/type5.h index da66d80abc..d4c9cc267c 100644 --- a/keyboards/converter/sun_usb/type5/type5.h +++ b/keyboards/converter/sun_usb/type5/type5.h @@ -15,11 +15,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef TYPE5_H -#define TYPE5_H +#pragma once #include "quantum.h" +#define XXX KC_NO + /* sun type 5 keyboard, JP Unix-style ,-------. ,---, ,---------------. ,---------------. ,---------------. ,-----------. ,---------------. | 76 | | 0F| | 05| 06| 08| 0A| | 0C| 0E| 10| 11| | 12| 07| 09| 0B| | 16| 17| 15| | 2D| 02| 04| 30| @@ -36,30 +37,30 @@ | 5F| 61| | 77 | 13| 78 |*73 | 79 |*74 |*75| 7A | 43| 0D| | 18| 1B| 1C| | 5E | 32| | `-------' `-----------------------------------------------------------' `-----------' `---------------' */ -#define LAYOUT_jp_unix( \ - K76, K0F, K05,K06,K08,K0A, K0C,K0E,K10,K11, K12,K07,K09,K0B, K16,K17,K15, K2D,K02,K04,K30, \ - K01,K03, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2C,K34,K60, K62,K2E,K2F,K47, \ - K19,K1A, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K2B, K42,K4A,K7B, K44,K45,K46,K7D, \ - K31,K33, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \ - K48,K49, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E, K14, K70,K71,K72,K5A, \ - K5F,K61, K77,K13, K78, K73, K79, K74, K75, K7A, K43, K0D, K18,K1B,K1C, K5E, K32 \ +#define LAYOUT_jp_unix( \ + K76, K0F, K05, K06, K08, K0A, K0C, K0E, K10, K11, K12, K07, K09, K0B, K16, K17, K15, K2D, K02, K04, K30, \ + K01, K03, K1D, K1E, K1F, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K58, K2A, K2C, K34, K60, K62, K2E, K2F, K47, \ + K19, K1A, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, K40, K41, K2B, K42, K4A, K7B, K44, K45, K46, K7D, \ + K31, K33, K4C, K4D, K4E, K4F, K50, K51, K52, K53, K54, K55, K56, K57, K59, K5B, K5C, K5D, \ + K48, K49, K63, K64, K65, K66, K67, K68, K69, K6A, K6B, K6C, K6D, K6E, K14, K70, K71, K72, K5A, \ + K5F, K61, K77, K13, K78, K73, K79, K74, K75, K7A, K43, K0D, K18, K1B, K1C, K5E, K32 \ ) { \ - { 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 , KC_NO, 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 , KC_NO }, \ - { K70 , K71 , K72 , K73 , K74 , K75 , K76 , K77 }, \ - { K78 , K79 , K7A , K7B , KC_NO, K7D , 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, XXX, 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, XXX }, \ + { K70, K71, K72, K73, K74, K75, K76, K77 }, \ + { K78, K79, K7A, K7B, XXX, K7D, XXX, XXX } \ } /* Sun type 5 keyboard, US Unix-style @@ -78,30 +79,30 @@ | 5F| 61| | 77 | 13| 78 | 79 | 7A | 43| 0D| | 18| 1B| 1C| | 5E | 32| | `-------' `-----------------------------------------------------------' `-----------' `---------------' */ -#define LAYOUT_us_unix( \ - K76, K0F, K05,K06,K08,K0A, K0C,K0E,K10,K11, K12,K07,K09,K0B, K16,K17,K15, K2D,K02,K04,K30, \ - K01,K03, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2C,K34,K60, K62,K2E,K2F,K47, \ - K19,K1A, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K2B, K42,K4A,K7B, K44,K45,K46,K7D, \ - K31,K33, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \ - K48,K49, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E, K14, K70,K71,K72,K5A, \ - K5F,K61, K77,K13, K78, K79, K7A, K43, K0D, K18,K1B,K1C, K5E, K32 \ +#define LAYOUT_us_unix( \ + K76, K0F, K05, K06, K08, K0A, K0C, K0E, K10, K11, K12, K07, K09, K0B, K16, K17, K15, K2D, K02, K04, K30, \ + K01, K03, K1D, K1E, K1F, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K58, K2A, K2C, K34, K60, K62, K2E, K2F, K47, \ + K19, K1A, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, K40, K41, K2B, K42, K4A, K7B, K44, K45, K46, K7D, \ + K31, K33, K4C, K4D, K4E, K4F, K50, K51, K52, K53, K54, K55, K56, K57, K59, K5B, K5C, K5D, \ + K48, K49, K63, K64, K65, K66, K67, K68, K69, K6A, K6B, K6C, K6D, K6E, K14, K70, K71, K72, K5A, \ + K5F, K61, K77, K13, K78, K79, K7A, K43, K0D, K18, K1B, K1C, K5E, K32 \ ) { \ - { 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 , KC_NO, 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 , KC_NO }, \ - { K70 , K71 , K72 , KC_NO, KC_NO, KC_NO, K76 , K77 }, \ - { K78 , K79 , K7A , K7B , KC_NO, K7D , 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, XXX, 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, XXX }, \ + { K70, K71, K72, XXX, XXX, XXX, K76, K77 }, \ + { K78, K79, K7A, K7B, XXX, K7D, XXX, XXX } \ } /* Sun type 5 keyboard, US ANSI-style @@ -120,29 +121,28 @@ | 5F| 61| | 4C | 13| 78 | 79 | 7A | 43| 0D| | 18| 1B| 1C| | 5E | 32| | `-------' `-----------------------------------------------------------' `-----------' `---------------' */ -#define LAYOUT_ansi( \ - K76, K1D, K05,K06,K08,K0A, K0C,K0E,K10,K11, K12,K07,K09,K0B, K16,K17,K15, K2D,K02,K04,K30, \ - K01,K03, K2A,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29, K2B, K2C,K34,K60, K62,K2E,K2F,K47, \ - K19,K1A, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K58, K42,K4A,K7B, K44,K45,K46,K7D, \ - K31,K33, K77, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \ - K48,K49, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E, K14, K70,K71,K72,K5A, \ - K5F,K61, K4C,K13, K78, K79, K7A, K43, K0D, K18,K1B,K1C, K5E, K32 \ +#define LAYOUT_ansi( \ + K76, K1D, K05, K06, K08, K0A, K0C, K0E, K10, K11, K12, K07, K09, K0B, K16, K17, K15, K2D, K02, K04, K30, \ + K01, K03, K2A, K1E, K1F, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2B, K2C, K34, K60, K62, K2E, K2F, K47, \ + K19, K1A, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, K40, K41, K58, K42, K4A, K7B, K44, K45, K46, K7D, \ + K31, K33, K77, K4D, K4E, K4F, K50, K51, K52, K53, K54, K55, K56, K57, K59, K5B, K5C, K5D, \ + K48, K49, K63, K64, K65, K66, K67, K68, K69, K6A, K6B, K6C, K6D, K6E, K14, K70, K71, K72, K5A, \ + K5F, K61, K4C, K13, K78, K79, K7A, K43, K0D, K18, K1B, K1C, K5E, K32 \ ) { \ - { KC_NO, K01 , K02 , K03 , K04 , K05 , K06 , K07 }, \ - { K08 , K09 , K0A , K0B , K0C , K0D , K0E , KC_NO,}, \ - { 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 , KC_NO, 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 , KC_NO }, \ - { K70 , K71 , K72 , KC_NO, KC_NO, KC_NO, K76 , K77 }, \ - { K78 , K79 , K7A , K7B , KC_NO, K7D , KC_NO, KC_NO } \ + { XXX, K01, K02, K03, K04, K05, K06, K07 }, \ + { K08, K09, K0A, K0B, K0C, K0D, K0E, XXX }, \ + { 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, XXX, 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, XXX }, \ + { K70, K71, K72, XXX, XXX, XXX, K76, K77 }, \ + { K78, K79, K7A, K7B, XXX, K7D, XXX, XXX } \ } -#endif diff --git a/keyboards/converter/usb_usb/ble/ble.h b/keyboards/converter/usb_usb/ble/ble.h index d28629643a..3dccc23a41 100644 --- a/keyboards/converter/usb_usb/ble/ble.h +++ b/keyboards/converter/usb_usb/ble/ble.h @@ -1,6 +1,3 @@ -#ifndef BLE_H -#define BLE_H +#pragma once #include QMK_KEYBOARD_H - -#endif diff --git a/keyboards/converter/usb_usb/ble/rules.mk b/keyboards/converter/usb_usb/ble/rules.mk index 438dec834a..ad4d206a51 100644 --- a/keyboards/converter/usb_usb/ble/rules.mk +++ b/keyboards/converter/usb_usb/ble/rules.mk @@ -12,9 +12,9 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend NKRO_ENABLE = no # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID AUDIO_ENABLE = no # Audio output -BLUETOOTH = AdafruitBLE -ADAFRUIT_BLE_ENABLE = yes + +BLUETOOTH_ENABLE = yes +BLUETOOTH_DRIVER = AdafruitBLE EXTRAFLAGS += -flto diff --git a/keyboards/converter/usb_usb/config.h b/keyboards/converter/usb_usb/config.h index 7ff8ceeebd..d2488336a5 100644 --- a/keyboards/converter/usb_usb/config.h +++ b/keyboards/converter/usb_usb/config.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once /* USB Device descriptor parameter */ #define VENDOR_ID 0xFEED @@ -46,5 +45,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -#endif diff --git a/keyboards/converter/usb_usb/hasu/hasu.h b/keyboards/converter/usb_usb/hasu/hasu.h index d5e7855860..3dccc23a41 100644 --- a/keyboards/converter/usb_usb/hasu/hasu.h +++ b/keyboards/converter/usb_usb/hasu/hasu.h @@ -1,6 +1,3 @@ -#ifndef HASU_H -#define HASU_H +#pragma once #include QMK_KEYBOARD_H - -#endif diff --git a/keyboards/converter/usb_usb/pro_micro/pro_micro.h b/keyboards/converter/usb_usb/pro_micro/pro_micro.h index 566df9f20f..3dccc23a41 100644 --- a/keyboards/converter/usb_usb/pro_micro/pro_micro.h +++ b/keyboards/converter/usb_usb/pro_micro/pro_micro.h @@ -1,6 +1,3 @@ -#ifndef PRO_MICRO_H -#define PRO_MICRO_H +#pragma once #include QMK_KEYBOARD_H - -#endif diff --git a/keyboards/converter/usb_usb/usb_usb.h b/keyboards/converter/usb_usb/usb_usb.h index 1d1b6770d1..3acd67634a 100644 --- a/keyboards/converter/usb_usb/usb_usb.h +++ b/keyboards/converter/usb_usb/usb_usb.h @@ -15,11 +15,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef USB_USB_H -#define USB_USB_H +#pragma once #include "quantum.h" +#define XXX KC_NO + #define ______ KC_TRNS /* ,---------------. ,---------------. ,---------------. @@ -63,46 +64,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * TODO: use same keycode to pass through instead of KC_NO? */ #define LAYOUT_all( \ - K68,K69,K6A,K6B,K6C,K6D,K6E,K6F,K70,K71,K72,K73, \ - K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, K81,K80,K7F,K66, K75, \ - K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K89,K2A, K49,K4A,K4B, K53,K54,K55,K56, K78,K79, \ - K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K31, K4C,K4D,K4E, K5F,K60,K61,K57, K76,K7A, \ - K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K32,K28, K5C,K5D,K5E,K85, K77,K7C, \ - KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,K67, K74,K7D, \ - KE0,KE3,KE2,K8B,K91, K2C, K90,K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58, K7E,K7B \ + k68, k69, k6A, k6B, k6C, k6D, k6E, k6F, k70, k71, k72, k73, \ + k29, k3A, k3B, k3C, k3D, k3E, k3F, k40, k41, k42, k43, k44, k45, k46, k47, k48, k81, k80, k7F, k66, k75, \ +\ + k35, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k2D, k2E, k89, k2A, k49, k4A, k4B, k53, k54, k55, k56, k78, k79, \ + k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k31, k4C, k4D, k4E, k5F, k60, k61, k57, k76, k7A, \ + k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k32, k28, k5C, k5D, k5E, k85, k77, k7C, \ + kE1, k64, k1D, k1B, k06, k19, k05, k11, k10, k36, k37, k38, k87, kE5, k52, k59, k5A, k5B, k67, k74, k7D, \ + kE0, kE3, kE2, k8B, k91, k2C, k90, k8A, k88, kE6, kE7, k65, kE4, k50, k51, k4F, k62, k63, k58, k7E, k7B \ ) { \ - { KC_NO, KC_NO, KC_NO, KC_NO, K04, K05, K06, K07, /* 00-07 */ \ - K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, /* 08-0F */ \ - { K10, K11, K12, K13, K14, K15, K16, K17, /* 10-17 */ \ - K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, /* 18-1F */ \ - { K20, K21, K22, K23, K24, K25, K26, K27, /* 20-27 */ \ - K28, K29, K2A, K2B, K2C, K2D, K2E, K2F }, /* 28-2F */ \ - { K30, K31, K32, K33, K34, K35, K36, K37, /* 30-37 */ \ - K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, /* 38-3F */ \ - { K40, K41, K42, K43, K44, K45, K46, K47, /* 40-47 */ \ - K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, /* 48-4F */ \ - { K50, K51, K52, K53, K54, K55, K56, K57, /* 50-57 */ \ - K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, /* 58-5F */ \ - { K60, K61, K62, K63, K64, K65, K66, K67, /* 60-67 */ \ - K68, K69, K6A, K6B, K6C, K6D, K6E, K6F }, /* 68-6F */ \ - { K70, K71, K72, K73, K74, K75, K76, K77, /* 70-77 */ \ - K78, K79, K7A, K7B, K7C, K7D, K7E, K7F }, /* 78-7F */ \ - { K80, K81, KC_NO, KC_NO, KC_NO, K85, KC_NO, K87, /* 80-87 */ \ - K88, K89, K8A, K8B, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \ - { K90, K91, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* 90-97 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 98-9F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* A0-A7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A8-AF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* B0-B7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B8-BF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* C0-C7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C8-CF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* D0-D7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D8-DF */ \ - { KE0, KE1, KE2, KE3, KE4, KE5, KE6, KE7, /* E0-E7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* E8-EF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* F0-F7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \ + { XXX, XXX, XXX, XXX, 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 }, \ + { k80, k81, XXX, XXX, XXX, k85, XXX, k87, k88, k89, k8A, k8B, XXX, XXX, XXX, XXX }, \ + { k90, k91, 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, 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 }, \ + { kE0, kE1, kE2, kE3, kE4, kE5, kE6, kE7, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX } \ } /* ,---. ,---------------. ,---------------. ,---------------. ,-----------. @@ -121,45 +107,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * `-----------------------------------------------------------' `-----------' `---------------' */ #define LAYOUT_ansi( \ - K29,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, \ - K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K2A, K49,K4A,K4B, K53,K54,K55,K56, \ - K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,K31, K4C,K4D,K4E, K5F,K60,K61, \ - K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K28, K5C,K5D,K5E,K57, \ - KE1,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KE5, K52, K59,K5A,K5B, \ - KE0,KE3,KE2, K2C, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58 \ + k29, k3A, k3B, k3C, k3D, k3E, k3F, k40, k41, k42, k43, k44, k45, k46, k47, k48, \ +\ + k35, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k2D, k2E, k2A, k49, k4A, k4B, k53, k54, k55, k56, \ + k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k31, k4C, k4D, k4E, k5F, k60, k61, \ + k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k28, k5C, k5D, k5E, k57, \ + kE1, k1D, k1B, k06, k19, k05, k11, k10, k36, k37, k38, kE5, k52, k59, k5A, k5B, \ + kE0, kE3, kE2, k2C, kE6, kE7, k65, kE4, k50, k51, k4F, k62, k63, k58 \ ) { \ - { KC_NO, KC_NO, KC_NO, KC_NO, K04, K05, K06, K07, /* 00-07 */ \ - K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, /* 08-0F */ \ - { K10, K11, K12, K13, K14, K15, K16, K17, /* 10-17 */ \ - K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, /* 18-1F */ \ - { K20, K21, K22, K23, K24, K25, K26, K27, /* 20-27 */ \ - K28, K29, K2A, K2B, K2C, K2D, K2E, K2F }, /* 28-2F */ \ - { K30, K31, KC_NO, K33, K34, K35, K36, K37, /* 30-37 */ \ - K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, /* 38-3F */ \ - { K40, K41, K42, K43, K44, K45, K46, K47, /* 40-47 */ \ - K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, /* 48-4F */ \ - { K50, K51, K52, K53, K54, K55, K56, K57, /* 50-57 */ \ - K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, /* 58-5F */ \ - { K60, K61, K62, K63, KC_NO, K65, KC_NO, KC_NO, /* 60-67 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, /* 68-6F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* 70-77 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, /* 78-7F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* 80-87 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* 90-97 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 98-9F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* A0-A7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A8-AF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* B0-B7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B8-BF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* C0-C7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C8-CF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* D0-D7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D8-DF */ \ - { KE0, KE1, KE2, KE3, KE4, KE5, KE6, KE7, /* E0-E7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* E8-EF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* F0-F7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \ + { XXX, XXX, XXX, XXX, 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, XXX, 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, XXX, k65, 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, 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, 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 }, \ + { kE0, kE1, kE2, kE3, kE4, kE5, kE6, kE7, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX } \ } /* ,---. ,---------------. ,---------------. ,---------------. ,-----------. @@ -178,45 +149,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * `-----------------------------------------------------------' `-----------' `---------------' */ #define LAYOUT_iso( \ - K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, \ - K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K2A, K49,K4A,K4B, K53,K54,K55,K56, \ - K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,K28, K4C,K4D,K4E, K5F,K60,K61,K57, \ - K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,K32, K5C,K5D,K5E, \ - KE1,K64,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KE5, K52, K59,K5A,K5B,K58, \ - KE0,KE3,KE2, K2C, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63 \ + k29, k3A, k3B, k3C, k3D, k3E, k3F, k40, k41, k42, k43, k44, k45, k46, k47, k48, \ +\ + k35, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k2D, k2E, k2A, k49, k4A, k4B, k53, k54, k55, k56, \ + k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k28, k4C, k4D, k4E, k5F, k60, k61, k57, \ + k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k32, k5C, k5D, k5E, \ + kE1, k64, k1D, k1B, k06, k19, k05, k11, k10, k36, k37, k38, kE5, k52, k59, k5A, k5B, k58, \ + kE0, kE3, kE2, k2C, kE6, kE7, k65, kE4, k50, k51, k4F, k62, k63 \ ) { \ - { KC_NO, KC_NO, KC_NO, KC_NO, K04, K05, K06, K07, /* 00-07 */ \ - K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, /* 08-0F */ \ - { K10, K11, K12, K13, K14, K15, K16, K17, /* 10-17 */ \ - K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, /* 18-1F */ \ - { K20, K21, K22, K23, K24, K25, K26, K27, /* 20-27 */ \ - K28, K29, K2A, K2B, K2C, K2D, K2E, K2F }, /* 28-2F */ \ - { K30, K31, K32, K33, K34, K35, K36, K37, /* 30-37 */ \ - K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, /* 38-3F */ \ - { K40, K41, K42, K43, K44, K45, K46, K47, /* 40-47 */ \ - K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, /* 48-4F */ \ - { K50, K51, K52, K53, K54, K55, K56, K57, /* 50-57 */ \ - K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, /* 58-5F */ \ - { K60, K61, K62, K63, K64, K65, KC_NO, KC_NO, /* 60-67 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, /* 68-6F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* 70-77 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, /* 78-7F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* 80-87 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* 90-97 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 98-9F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* A0-A7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A8-AF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* B0-B7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B8-BF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* C0-C7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C8-CF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* D0-D7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D8-DF */ \ - { KE0, KE1, KE2, KE3, KE4, KE5, KE6, KE7, /* E0-E7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* E8-EF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* F0-F7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \ + { XXX, XXX, XXX, XXX, 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, 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, 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, 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 }, \ + { kE0, kE1, kE2, kE3, kE4, kE5, kE6, kE7, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX } \ } /* ,---. ,---------------. ,---------------. ,---------------. ,-----------. @@ -235,44 +191,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * `-----------------------------------------------------------' `-----------' `---------------' */ #define LAYOUT_jis( \ - K29, K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, \ - K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K89,K2A, K49,K4A,K4B, K53,K54,K55,K56, \ - K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30, K28, K4C,K4D,K4E, K5F,K60,K61,K57, \ - K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34,K32, K5C,K5D,K5E, \ - KE1,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, K87,KE5, K52, K59,K5A,K5B,K58, \ - KE0,KE3,KE2,K8B, K2C, K8A,K88,KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63 \ + k29, k3A, k3B, k3C, k3D, k3E, k3F, k40, k41, k42, k43, k44, k45, k46, k47, k48, \ +\ + k35, k1E, k1F, k20, k21, k22, k23, k24, k25, k26, k27, k2D, k2E, k89, k2A, k49, k4A, k4B, k53, k54, k55, k56, \ + k2B, k14, k1A, k08, k15, k17, k1C, k18, k0C, k12, k13, k2F, k30, k28, k4C, k4D, k4E, k5F, k60, k61, k57, \ + k39, k04, k16, k07, k09, k0A, k0B, k0D, k0E, k0F, k33, k34, k32, k5C, k5D, k5E, \ + kE1, k1D, k1B, k06, k19, k05, k11, k10, k36, k37, k38, k87, kE5, k52, k59, k5A, k5B, k58, \ + kE0, kE3, kE2, k8B, k2C, k8A, k88, kE6, kE7, k65, kE4, k50, k51, k4F, k62, k63 \ ) { \ - { KC_NO, KC_NO, KC_NO, KC_NO, K04, K05, K06, K07, /* 00-07 */ \ - K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, /* 08-0F */ \ - { K10, K11, K12, K13, K14, K15, K16, K17, /* 10-17 */ \ - K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, /* 18-1F */ \ - { K20, K21, K22, K23, K24, K25, K26, K27, /* 20-27 */ \ - K28, K29, K2A, K2B, K2C, K2D, K2E, K2F }, /* 28-2F */ \ - { K30, K31, K32, K33, K34, K35, K36, K37, /* 30-37 */ \ - K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, /* 38-3F */ \ - { K40, K41, K42, K43, K44, K45, K46, K47, /* 40-47 */ \ - K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, /* 48-4F */ \ - { K50, K51, K52, K53, K54, K55, K56, K57, /* 50-57 */ \ - K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, /* 58-5F */ \ - { K60, K61, K62, K63, K64, K65, KC_NO, KC_NO, /* 60-67 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, /* 68-6F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* 70-77 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, /* 78-7F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K87, /* 80-87 */ \ - K88, K89, K8A, K8B, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* 90-97 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 98-9F */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* A0-A7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A8-AF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* B0-B7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B8-BF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* C0-C7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C8-CF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* D0-D7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D8-DF */ \ - { KE0, KE1, KE2, KE3, KE4, KE5, KE6, KE7, /* E0-E7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* E8-EF */ \ - { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, /* F0-F7 */ \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \ + { XXX, XXX, XXX, XXX, 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, 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, k87, k88, k89, k8A, k8B, 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, 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 }, \ + { kE0, kE1, kE2, kE3, kE4, kE5, kE6, kE7, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \ + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX } \ } -#endif diff --git a/keyboards/converter/xt_usb/rules.mk b/keyboards/converter/xt_usb/rules.mk index 519d76f4d4..8033614447 100644 --- a/keyboards/converter/xt_usb/rules.mk +++ b/keyboards/converter/xt_usb/rules.mk @@ -19,7 +19,6 @@ NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output -XT_ENABLE = yes CUSTOM_MATRIX = yes -SRC += matrix.c +SRC += matrix.c xt_interrupt.c diff --git a/keyboards/converter/xt_usb/xt.h b/keyboards/converter/xt_usb/xt.h new file mode 100644 index 0000000000..538ff0e459 --- /dev/null +++ b/keyboards/converter/xt_usb/xt.h @@ -0,0 +1,73 @@ +/* +Copyright 2018 Jun WAKO <wakojun@gmail.com> +Copyright 2016 Ethan Apodaca <papodaca@gmail.com> + +This software is licensed with a Modified BSD License. +All of this is supposed to be Free Software, Open Source, DFSG-free, +GPL-compatible, and OK to use in both free and proprietary applications. +Additions and corrections to this file are welcome. + + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +* Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +#pragma once + +#include "quantum.h" + +#define XT_DATA_IN() \ + do { \ + setPinInput(XT_DATA_PIN); \ + writePinHigh(XT_DATA_PIN); \ + } while (0) + +#define XT_DATA_READ() readPin(XT_DATA_PIN) + +#define XT_DATA_LO() \ + do { \ + writePinLow(XT_DATA_PIN); \ + setPinOutput(XT_DATA_PIN); \ + } while (0) + +#define XT_CLOCK_IN() \ + do { \ + setPinInput(XT_CLOCK_PIN); \ + writePinHigh(XT_CLOCK_PIN); \ + } while (0) + +#define XT_CLOCK_READ() readPin(XT_CLOCK_PIN) + +#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/keyboards/converter/xt_usb/xt_interrupt.c b/keyboards/converter/xt_usb/xt_interrupt.c new file mode 100644 index 0000000000..ba9d71848f --- /dev/null +++ b/keyboards/converter/xt_usb/xt_interrupt.c @@ -0,0 +1,166 @@ +/* +Copyright 2018 Jun WAKO <wakojun@gmail.com> +Copyright 2016 Ethan Apodaca <papodaca@gmail.com> + +This software is licensed with a Modified BSD License. +All of this is supposed to be Free Software, Open Source, DFSG-free, +GPL-compatible, and OK to use in both free and proprietary applications. +Additions and corrections to this file are welcome. + + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +* Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <stdbool.h> +#include <avr/interrupt.h> +#include "xt.h" +#include "wait.h" +#include "debug.h" + +static inline uint8_t pbuf_dequeue(void); +static inline void pbuf_enqueue(uint8_t data); +static inline bool pbuf_has_data(void); +static inline void pbuf_clear(void); + +void xt_host_init(void) { + XT_INT_INIT(); + XT_INT_OFF(); + + /* hard reset */ +#ifdef XT_RESET + XT_RESET(); +#endif + + /* soft reset: pull clock line down for 20ms */ + XT_DATA_LO(); + XT_CLOCK_LO(); + wait_ms(20); + + /* input mode with pullup */ + XT_CLOCK_IN(); + XT_DATA_IN(); + + XT_INT_ON(); +} + +/* get data received by interrupt */ +uint8_t xt_host_recv(void) { + if (pbuf_has_data()) { + return pbuf_dequeue(); + } else { + return 0; + } +} + +ISR(XT_INT_VECT) { + /* + * XT signal format consits of 10 or 9 clocks and sends start bits and 8-bit data, + * which should be read on falling edge of clock. + * + * start(0), start(1), bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7 + * + * Original IBM XT keyboard sends start(0) bit while some of clones don't. + * Start(0) bit is read as low on data line while start(1) as high. + * + * https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-XT-Keyboard-Protocol + */ + static enum { START, BIT0, BIT1, BIT2, BIT3, BIT4, BIT5, BIT6, BIT7 } state = START; + static uint8_t data = 0; + + uint8_t dbit = XT_DATA_READ(); + + // This is needed if using PCINT which can be called on both falling and rising edge + // if (XT_CLOCK_READ()) return; + + switch (state) { + case START: + // ignore start(0) bit + if (!dbit) return; + break; + case BIT0 ... BIT7: + data >>= 1; + if (dbit) data |= 0x80; + break; + } + if (state++ == BIT7) { + pbuf_enqueue(data); + state = START; + data = 0; + } + return; +} + +/*-------------------------------------------------------------------- + * Ring buffer to store scan codes from keyboard + *------------------------------------------------------------------*/ +#define PBUF_SIZE 32 +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(); + uint8_t next = (pbuf_head + 1) % PBUF_SIZE; + if (next != pbuf_tail) { + pbuf[pbuf_head] = data; + pbuf_head = next; + } else { + dprintf("pbuf: full\n"); + } + SREG = sreg; +} + +static inline uint8_t pbuf_dequeue(void) { + uint8_t val = 0; + + uint8_t sreg = SREG; + cli(); + if (pbuf_head != pbuf_tail) { + val = pbuf[pbuf_tail]; + pbuf_tail = (pbuf_tail + 1) % PBUF_SIZE; + } + SREG = sreg; + + return val; +} + +static inline bool pbuf_has_data(void) { + uint8_t sreg = SREG; + cli(); + bool has_data = (pbuf_head != pbuf_tail); + SREG = sreg; + return has_data; +} + +static inline void pbuf_clear(void) { + uint8_t sreg = SREG; + cli(); + pbuf_head = pbuf_tail = 0; + SREG = sreg; +} |