aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md12
-rw-r--r--converter/adb_usb/Makefile141
-rw-r--r--converter/adb_usb/Makefile.pjrc73
-rw-r--r--converter/adb_usb/README.md103
-rw-r--r--converter/adb_usb/config.h63
-rw-r--r--converter/adb_usb/keymap_ansi.c16
-rw-r--r--converter/adb_usb/keymap_common.c30
-rw-r--r--converter/adb_usb/keymap_common.h212
-rw-r--r--converter/adb_usb/keymap_hasu.c58
-rw-r--r--converter/adb_usb/keymap_iso.c16
-rw-r--r--converter/adb_usb/led.c27
-rw-r--r--converter/adb_usb/matrix.c296
-rw-r--r--converter/ascii_usb/Makefile82
-rw-r--r--converter/ascii_usb/README38
-rw-r--r--converter/ascii_usb/config.h70
-rw-r--r--converter/ascii_usb/keymap.c42
-rw-r--r--converter/ascii_usb/led.c25
-rw-r--r--converter/ascii_usb/matrix.c195
-rw-r--r--converter/ibm4704_usb/Makefile93
-rw-r--r--converter/ibm4704_usb/README.md72
-rw-r--r--converter/ibm4704_usb/config.h61
-rw-r--r--converter/ibm4704_usb/ibm4704.txt182
-rw-r--r--converter/ibm4704_usb/keymap_50key.c17
-rw-r--r--converter/ibm4704_usb/keymap_alps102key.c50
-rw-r--r--converter/ibm4704_usb/keymap_common.c30
-rw-r--r--converter/ibm4704_usb/keymap_common.h146
-rw-r--r--converter/ibm4704_usb/keymap_hasu.c85
-rw-r--r--converter/ibm4704_usb/keymap_plain.c50
-rw-r--r--converter/ibm4704_usb/led.c24
-rw-r--r--converter/ibm4704_usb/matrix.c162
-rw-r--r--converter/m0110_usb/Makefile96
-rw-r--r--converter/m0110_usb/Makefile.teensy98
-rw-r--r--converter/m0110_usb/Makefile.tmk_rev196
-rw-r--r--converter/m0110_usb/Makefile.tmk_rev296
-rw-r--r--converter/m0110_usb/README.md79
-rw-r--r--converter/m0110_usb/config.h62
-rw-r--r--converter/m0110_usb/keymap_common.c37
-rw-r--r--converter/m0110_usb/keymap_common.h133
-rw-r--r--converter/m0110_usb/keymap_default.c137
-rw-r--r--converter/m0110_usb/keymap_hasu.c87
-rw-r--r--converter/m0110_usb/keymap_intl.c73
-rw-r--r--converter/m0110_usb/keymap_spacefn.c71
-rw-r--r--converter/m0110_usb/led.c32
-rw-r--r--converter/m0110_usb/matrix.c142
-rw-r--r--converter/news_usb/Makefile.pjrc74
-rw-r--r--converter/news_usb/config_pjrc.h62
-rw-r--r--converter/news_usb/keymap.c125
-rw-r--r--converter/news_usb/led.c26
-rw-r--r--converter/news_usb/matrix.c142
-rw-r--r--converter/next_usb/Makefile87
-rw-r--r--converter/next_usb/Makefile.pjrc63
-rw-r--r--converter/next_usb/README45
-rw-r--r--converter/next_usb/config.h190
-rw-r--r--converter/next_usb/keymap.c177
-rw-r--r--converter/next_usb/led.c60
-rw-r--r--converter/next_usb/matrix.c271
-rw-r--r--converter/next_usb/next_timings.jpgbin407936 -> 0 bytes
-rw-r--r--converter/pc98_usb/Makefile83
-rw-r--r--converter/pc98_usb/README67
-rw-r--r--converter/pc98_usb/config.h123
-rw-r--r--converter/pc98_usb/keymap.c208
-rw-r--r--converter/pc98_usb/led.c33
-rw-r--r--converter/pc98_usb/matrix.c211
-rw-r--r--converter/ps2_usb/Makefile105
-rw-r--r--converter/ps2_usb/Makefile.mbed46
-rw-r--r--converter/ps2_usb/Makefile.pjrc75
-rw-r--r--converter/ps2_usb/Makefile.tmk_rev198
-rw-r--r--converter/ps2_usb/Makefile.tmk_rev298
-rw-r--r--converter/ps2_usb/Makefile.vusb107
-rw-r--r--converter/ps2_usb/README.md84
-rw-r--r--converter/ps2_usb/config.h173
-rw-r--r--converter/ps2_usb/config_mbed.h60
-rw-r--r--converter/ps2_usb/config_tmk_rev1.h147
-rw-r--r--converter/ps2_usb/config_tmk_rev2.h85
-rw-r--r--converter/ps2_usb/keymap_common.c31
-rw-r--r--converter/ps2_usb/keymap_common.h173
-rw-r--r--converter/ps2_usb/keymap_jis.c34
-rw-r--r--converter/ps2_usb/keymap_plain.c32
-rw-r--r--converter/ps2_usb/keymap_spacefn.c61
-rw-r--r--converter/ps2_usb/led.c33
-rw-r--r--converter/ps2_usb/main.cpp46
-rw-r--r--converter/ps2_usb/matrix.c486
-rw-r--r--converter/ps2_usb/usbconfig.h377
-rw-r--r--converter/serialmouse_usb/Makefile106
-rw-r--r--converter/serialmouse_usb/README.md11
-rw-r--r--converter/serialmouse_usb/config.h119
-rw-r--r--converter/serialmouse_usb/keymap.c33
-rw-r--r--converter/serialmouse_usb/keymap_common.c30
-rw-r--r--converter/serialmouse_usb/keymap_common.h174
-rw-r--r--converter/serialmouse_usb/led.c24
-rw-r--r--converter/serialmouse_usb/matrix.c83
-rw-r--r--converter/sun_usb/Makefile85
-rw-r--r--converter/sun_usb/README106
-rw-r--r--converter/sun_usb/command_extra.c61
-rw-r--r--converter/sun_usb/config.h95
-rw-r--r--converter/sun_usb/keymap.c192
-rw-r--r--converter/sun_usb/keymap_sun3.c173
-rw-r--r--converter/sun_usb/led.c35
-rw-r--r--converter/sun_usb/matrix.c186
-rw-r--r--converter/terminal_bluefruit/Makefile99
-rw-r--r--converter/terminal_bluefruit/README37
-rw-r--r--converter/terminal_bluefruit/config.h112
-rw-r--r--converter/terminal_bluefruit/keymap.c227
-rw-r--r--converter/terminal_bluefruit/led.c35
-rw-r--r--converter/terminal_bluefruit/matrix.c262
-rw-r--r--converter/terminal_usb/Makefile98
-rw-r--r--converter/terminal_usb/README37
-rw-r--r--converter/terminal_usb/config.h138
-rw-r--r--converter/terminal_usb/keymap.c216
-rw-r--r--converter/terminal_usb/led.c33
-rw-r--r--converter/terminal_usb/matrix.c262
-rw-r--r--converter/usb_usb/Makefile140
-rw-r--r--converter/usb_usb/README74
-rw-r--r--converter/usb_usb/config.h39
-rw-r--r--converter/usb_usb/keymap.c115
-rw-r--r--converter/usb_usb/keymap_common.c31
-rw-r--r--converter/usb_usb/keymap_common.h77
-rw-r--r--converter/usb_usb/keymap_hasu.c158
-rw-r--r--converter/usb_usb/keymap_spacefn.c61
-rw-r--r--converter/usb_usb/main.cpp132
-rw-r--r--converter/usb_usb/matrix.c133
-rw-r--r--converter/x68k_usb/Makefile101
-rw-r--r--converter/x68k_usb/README151
-rw-r--r--converter/x68k_usb/config_pjrc.h67
-rw-r--r--converter/x68k_usb/keymap.c150
-rw-r--r--converter/x68k_usb/led.c43
-rw-r--r--converter/x68k_usb/matrix.c142
-rw-r--r--doc/BUILD_GUIDE.md (renamed from BUILD_GUIDE.md)0
-rw-r--r--doc/COPYING.GPLv2 (renamed from tmk_core/doc/COPYING.GPLv2)0
-rw-r--r--doc/COPYING.GPLv3 (renamed from tmk_core/doc/COPYING.GPLv3)0
-rwxr-xr-xdoc/CYGWIN_GUIDE.md (renamed from keyboard/planck/CYGWIN_GUIDE.md)0
-rw-r--r--doc/FUSE.txt (renamed from tmk_core/doc/FUSE.txt)0
-rw-r--r--doc/HAND_WIRE.md (renamed from HAND_WIRE.md)0
-rw-r--r--doc/PCB_GUIDE.md (renamed from keyboard/planck/PCB_GUIDE.md)0
-rw-r--r--doc/POWER.txt (renamed from tmk_core/doc/POWER.txt)0
-rw-r--r--doc/TMK_README.md (renamed from TMK_README.md)0
-rw-r--r--doc/USB_NKRO.txt (renamed from tmk_core/doc/USB_NKRO.txt)0
-rw-r--r--doc/VAGRANT_GUIDE.md (renamed from VAGRANT_GUIDE.md)8
-rw-r--r--doc/build_old.md (renamed from tmk_core/doc/build.md)1
-rw-r--r--doc/keycode.txt (renamed from tmk_core/doc/keycode.txt)0
-rw-r--r--doc/keymap.md (renamed from tmk_core/doc/keymap.md)0
-rw-r--r--doc/other_projects.md (renamed from tmk_core/doc/other_projects.md)0
-rwxr-xr-xkeyboard/atomic/flash-pcb.sh3
-rw-r--r--keyboard/ergodox_ez/readme.md2
-rwxr-xr-xkeyboard/planck/flash-pcb.sh3
-rwxr-xr-xkeyboard/preonic/flash-pcb.sh3
-rw-r--r--util/1-setup-path-win.bat (renamed from 1-setup-path-win.bat)0
-rw-r--r--util/2-setup-environment-win.bat (renamed from 2-setup-environment-win.bat)0
-rw-r--r--util/Vagrantfile (renamed from Vagrantfile)0
-rw-r--r--util/avr_setup.sh (renamed from avr_setup.sh)0
-rwxr-xr-xutil/new_project.sh (renamed from new_project.sh)0
151 files changed, 12 insertions, 12799 deletions
diff --git a/README.md b/README.md
index c848d477d..a6bd3c495 100644
--- a/README.md
+++ b/README.md
@@ -14,18 +14,18 @@ The OLKB product firmwares are maintained by Jack, the Ergodox EZ by Erez, and t
14This is not a tiny project. While this is the main Readme, there are many other files you might want to consult. Here are some points of interest: 14This is not a tiny project. While this is the main Readme, there are many other files you might want to consult. Here are some points of interest:
15 15
16* The Readme for your own keyboard: This is found under `keyboards/<your keyboards's name>/`. So for the ErgoDox EZ, it's [here](keyboard/ergodox_ez/); for the Atomic, it's [here](keyboard/atomic/) and so on. 16* The Readme for your own keyboard: This is found under `keyboards/<your keyboards's name>/`. So for the ErgoDox EZ, it's [here](keyboard/ergodox_ez/); for the Atomic, it's [here](keyboard/atomic/) and so on.
17* The [build guide](BUILD_GUIDE.md), also mentioned in the next section. This is how you put your development environment together so you can compile the firmware. 17* The [build guide](doc/BUILD_GUIDE.md), also mentioned in the next section. This is how you put your development environment together so you can compile the firmware.
18* The list of possible keycodes you can use in your keymap is actually spread out in a few different places: 18* The list of possible keycodes you can use in your keymap is actually spread out in a few different places:
19 * [tmk_core/common/keycode.h](tmk_core/common/keycode.h) - the base TMK keycodes. This is the actual source file. 19 * [tmk_core/common/keycode.h](tmk_core/common/keycode.h) - the base TMK keycodes. This is the actual source file.
20 * [tmk_core/doc/keycode.txt](tmk_core/doc/keycode.txt) - an explanation of those same keycodes. 20 * [doc/keycode.txt](doc/keycode.txt) - an explanation of those same keycodes.
21 * [quantum/keymap_common.h](quantum/keymap_common.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap_common.h` is where they're actually defined. 21 * [quantum/keymap_common.h](quantum/keymap_common.h) - this is where the QMK-specific aliases are all set up. Things like the Hyper and Meh key, the Leader key, and all of the other QMK innovations. These are also explained and documented below, but `keymap_common.h` is where they're actually defined.
22* The [TMK documentation](tmk_core/doc). QMK is based on TMK, and this explains how it works internally. 22* The [TMK documentation](doc/TMK_README.md). QMK is based on TMK, and this explains how it works internally.
23 23
24## Getting started 24## Getting started
25 25
26* [BUILD_GUIDE.md](BUILD_GUIDE.md) contains instructions to set up a build environment, build the firmware, and deploy it to a keyboard. Once your build environment has been set up, all `make` commands to actually build the firmware must be run from a folder in `keyboard/`. 26* [BUILD_GUIDE.md](doc/BUILD_GUIDE.md) contains instructions to set up a build environment, build the firmware, and deploy it to a keyboard. Once your build environment has been set up, all `make` commands to actually build the firmware must be run from a folder in `keyboard/`.
27* If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there. 27* If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there.
28* If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh <project_name>`, which will create `/keyboard/<project_name>` with all the necessary components for a Quantum project. 28* If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `util/new_project.sh <project_name>`, which will create `/keyboard/<project_name>` with all the necessary components for a Quantum project.
29 29
30### Makefile Options 30### Makefile Options
31 31
@@ -205,7 +205,7 @@ rounded up (5 bits per key). For example on Planck (48 keys) it uses
205 205
206### Remember: These are just aliases 206### Remember: These are just aliases
207 207
208These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk ACTION_* functions, please see the [TMK documentation](https://github.com/jackhumbert/qmk_firmware/blob/master/tmk_core/doc/keymap.md#2-action). 208These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk ACTION_* functions, please see the [TMK documentation](https://github.com/jackhumbert/qmk_firmware/blob/master/doc/keymap.md#2-action).
209 209
210Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them. 210Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them.
211 211
diff --git a/converter/adb_usb/Makefile b/converter/adb_usb/Makefile
deleted file mode 100644
index 2369ee70a..000000000
--- a/converter/adb_usb/Makefile
+++ /dev/null
@@ -1,141 +0,0 @@
1#----------------------------------------------------------------------------
2# On command line:
3#
4# make all = Make software.
5#
6# make clean = Clean out built project files.
7#
8# make coff = Convert ELF to AVR COFF.
9#
10# make extcoff = Convert ELF to AVR Extended COFF.
11#
12# make program = Download the hex file to the device.
13# Please customize your programmer settings(PROGRAM_CMD)
14#
15# make teensy = Download the hex file to the device, using teensy_loader_cli.
16# (must have teensy_loader_cli installed).
17#
18# make dfu = Download the hex file to the device, using dfu-programmer (must
19# have dfu-programmer installed).
20#
21# make flip = Download the hex file to the device, using Atmel FLIP (must
22# have Atmel FLIP installed).
23#
24# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
25# (must have dfu-programmer installed).
26#
27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
28# (must have Atmel FLIP installed).
29#
30# make debug = Start either simulavr or avarice as specified for debugging,
31# with avr-gdb or avr-insight as the front end for debugging.
32#
33# make filename.s = Just compile filename.c into the assembler code only.
34#
35# make filename.i = Create a preprocessed source file for use in submitting
36# bug reports to the GCC project.
37#
38# To rebuild project do "make clean" then "make all".
39#----------------------------------------------------------------------------
40
41# Target file name (without extension).
42TARGET = adb_usb_lufa
43
44# Directory common source filess exist
45TMK_DIR = ../../tmk_core
46
47# Directory keyboard dependent files exist
48TARGET_DIR = .
49
50# project specific files
51SRC = keymap_common.c \
52 matrix.c \
53 led.c \
54 adb.c
55
56ifdef KEYMAP
57 SRC := keymap_$(KEYMAP).c $(SRC)
58else
59 SRC := keymap_ansi.c $(SRC)
60endif
61
62CONFIG_H = config.h
63
64
65# MCU name
66#MCU = at90usb1287
67MCU = atmega32u4
68
69# Processor frequency.
70# This will define a symbol, F_CPU, in all source code files equal to the
71# processor frequency in Hz. You can then use this symbol in your source code to
72# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
73# automatically to create a 32-bit value in your source code.
74#
75# This will be an integer division of F_USB below, as it is sourced by
76# F_USB after it has run through any CPU prescalers. Note that this value
77# does not *change* the processor frequency - it should merely be updated to
78# reflect the processor speed set externally so that the code can use accurate
79# software delays.
80F_CPU = 16000000
81
82
83#
84# LUFA specific
85#
86# Target architecture (see library "Board Types" documentation).
87ARCH = AVR8
88
89# Input clock frequency.
90# This will define a symbol, F_USB, in all source code files equal to the
91# input clock frequency (before any prescaling is performed) in Hz. This value may
92# differ from F_CPU if prescaling is used on the latter, and is required as the
93# raw input clock is fed directly to the PLL sections of the AVR for high speed
94# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
95# at the end, this will be done automatically to create a 32-bit value in your
96# source code.
97#
98# If no clock division is performed on the input clock inside the AVR (via the
99# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
100F_USB = $(F_CPU)
101
102# Interrupt driven control endpoint task(+60)
103OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
104
105
106# Boot Section Size in *bytes*
107# Teensy halfKay 512
108# Teensy++ halfKay 1024
109# Atmel DFU loader 4096
110# LUFA bootloader 4096
111# USBaspLoader 2048
112OPT_DEFS += -DBOOTLOADER_SIZE=4096
113
114
115# Build Options
116# comment out to disable the options.
117#
118#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
119MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
120EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
121CONSOLE_ENABLE = yes # Console for debug(+400)
122COMMAND_ENABLE = yes # Commands for debug and configuration
123#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
124#NKRO_ENABLE = yes # USB Nkey Rollover
125ADB_MOUSE_ENABLE = yes
126
127# ADB Mice need acceleration for todays much bigger screens.
128OPT_DEFS += -DADB_MOUSE_MAXACC=8
129
130
131# Optimize size but this may cause error "relocation truncated to fit"
132#EXTRALDFLAGS = -Wl,--relax
133
134# Search Path
135VPATH += $(TARGET_DIR)
136VPATH += $(TMK_DIR)
137
138include $(TMK_DIR)/protocol/lufa.mk
139include $(TMK_DIR)/protocol.mk
140include $(TMK_DIR)/common.mk
141include $(TMK_DIR)/rules.mk
diff --git a/converter/adb_usb/Makefile.pjrc b/converter/adb_usb/Makefile.pjrc
deleted file mode 100644
index c320c09d2..000000000
--- a/converter/adb_usb/Makefile.pjrc
+++ /dev/null
@@ -1,73 +0,0 @@
1# Target file name (without extension).
2TARGET = adb_usb_pjrc
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap_common.c \
12 matrix.c \
13 led.c \
14 adb.c
15
16ifdef KEYMAP
17 SRC := keymap_$(KEYMAP).c $(SRC)
18else
19 SRC := keymap_ansi.c $(SRC)
20endif
21
22CONFIG_H = config.h
23
24
25# MCU name, you MUST set this to match the board you are using
26# type "make clean" after changing this, so all files will be rebuilt
27#MCU = at90usb162 # Teensy 1.0
28MCU = atmega32u4 # Teensy 2.0
29#MCU = at90usb646 # Teensy++ 1.0
30#MCU = at90usb1286 # Teensy++ 2.0
31
32
33# Processor frequency.
34# Normally the first thing your program should do is set the clock prescaler,
35# so your program will run at the correct speed. You should also set this
36# variable to same clock speed. The _delay_ms() macro uses this, and many
37# examples use this variable to calculate timings. Do not add a "UL" here.
38F_CPU = 16000000
39
40
41# Boot Section Size in *bytes*
42# Teensy halfKay 512
43# Teensy++ halfKay 1024
44# Atmel DFU loader 4096
45# LUFA bootloader 4096
46# USBaspLoader 2048
47OPT_DEFS += -DBOOTLOADER_SIZE=4096
48
49
50# Build Options
51# comment out to disable the options.
52#
53BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
54MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
55EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
56CONSOLE_ENABLE = yes # Console for debug
57COMMAND_ENABLE = yes # Commands for debug and configuration
58#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
59#NKRO_ENABLE = yes # USB Nkey Rollover(+500)
60ADB_MOUSE_ENABLE = yes
61
62# ADB Mice need acceleration for todays much bigger screens.
63OPT_DEFS += -DADB_MOUSE_MAXACC=8
64
65
66# Search Path
67VPATH += $(TARGET_DIR)
68VPATH += $(TMK_DIR)
69
70include $(TMK_DIR)/protocol/pjrc.mk
71include $(TMK_DIR)/protocol.mk
72include $(TMK_DIR)/common.mk
73include $(TMK_DIR)/rules.mk
diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md
deleted file mode 100644
index 46082ff67..000000000
--- a/converter/adb_usb/README.md
+++ /dev/null
@@ -1,103 +0,0 @@
1ADB to USB keyboard converter
2=============================
3This firmware converts ADB keyboard protocol to USB.
4You can use PJRC Teensy for this converter, though, other USB AVR(ATMega32U4, AT90USB64/128 or etc) should work.
5But binary size is about 10KB or more it doesn't fit into 8K flash like ATMega8U2.
6
7Discuss: http://geekhack.org/showwiki.php?title=Island:14290
8
9
10
11README FIRST
12------------
13https://github.com/tmk/tmk_keyboard
14https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb
15
16Also check these when you are in trouble.
17
18https://github.com/tmk/tmk_keyboard/wiki
19https://github.com/tmk/tmk_keyboard/labels/NOTE
20
21
22Wiring
23------
24Connect ADB pins to controller just by 3 lines(Vcc, GND, Data). By default Data line uses port PD0.
25
26ADB female socket from the front:
27
28 ,--_--.
29 / o4 3o \ 1: DATA
30 | o2 1o | 2: Power SW
31 - === - 3: VCC
32 `-___-' 4: GND
33
34This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable. The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended.(It is almost must!)
35https://github.com/tmk/tmk_keyboard/wiki/FAQ#pull-up-resistor
36
37Pull-up resister:
38
39 Keyboard Conveter
40 ,------.
41 5V------+------|VCC |
42 | | |
43 [R] | |
44 | | |
45 Signal--+------|PD0 |
46 | |
47 GND------------|GND |
48 `------'
49 R: 1K Ohm resistor
50
51
52Define following macros for ADB connection in config.h if you use other than port PD0.
53
54 ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT
55
56
57Build
58-----
59See doc/build.md. In short,
60
61 $ make clean
62 $ make
63
64You can select keymap(ansi is default) like this:
65
66 $ make KEYMAP=[ansi|iso|hasu]
67
68
69Keymap
70------
71You can change a keymap by editing code of keymap_[ansi|iso|hasu|yours].c.
72How to define the keymap is probably obvious. You can find key symbols in common/keycode.h. And see doc/keymap.md for more detail.
73
74
75Magic command
76-------------
77To get help press `h` holding Magic key. Magic key is `Power key`.
78
79
80Locking CapsLock
81----------------
82Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature.
83https://github.com/tmk/tmk_keyboard/blob/master/README.md#mechanical-locking-support
84
85Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch.
86
87
88Notes
89-----
90Not-extended ADB keyboards have no discrimination between right modifier and left one,
91you will always see left control even if you press right control key.
92Apple Extended Keyboard and Apple Extended Keyboard II can discriminate both side
93modifiers except for GUI key(Windows/Command).
94
95And most ADB keyboard has no diodes in its matrix so they are not NKRO,
96though ADB protocol itself supports it. See protocol/adb.c for more info.
97
98If keyboard has ISO layout you need to use ISO keymap with `make KEYMAP=iso`. With ANSI
99keymap you will suffer from swapped keys problem.
100
101https://github.com/tmk/tmk_keyboard/issues/35
102
103EOF
diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h
deleted file mode 100644
index 5ce5c2215..000000000
--- a/converter/adb_usb/config.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21
22#define VENDOR_ID 0xFEED
23#define PRODUCT_ID 0x0ADB
24#define DEVICE_VER 0x0101
25#define MANUFACTURER t.m.k.
26#define PRODUCT ADB keyboard converter
27#define DESCRIPTION convert ADB keyboard to USB
28
29/* matrix size */
30#define MATRIX_ROWS 16 // keycode bit: 3-0
31#define MATRIX_COLS 8 // keycode bit: 6-4
32
33#define MATRIX_ROW(code) ((code)>>3&0x0F)
34#define MATRIX_COL(code) ((code)&0x07)
35
36
37/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
38#define LOCKING_SUPPORT_ENABLE
39/* Locking resynchronize hack */
40#define LOCKING_RESYNC_ENABLE
41
42
43/* legacy keymap support */
44#define USE_LEGACY_KEYMAP
45
46
47/* ADB port setting */
48#define ADB_PORT PORTD
49#define ADB_PIN PIND
50#define ADB_DDR DDRD
51#define ADB_DATA_BIT 0
52//#define ADB_PSW_BIT 1 // optional
53
54/* key combination for command */
55#ifndef __ASSEMBLER__
56#include "adb.h"
57#include "matrix.h"
58#define IS_COMMAND() ( \
59 matrix_is_on(MATRIX_ROW(ADB_POWER), MATRIX_COL(ADB_POWER)) \
60)
61#endif
62
63#endif
diff --git a/converter/adb_usb/keymap_ansi.c b/converter/adb_usb/keymap_ansi.c
deleted file mode 100644
index 4ea601be0..000000000
--- a/converter/adb_usb/keymap_ansi.c
+++ /dev/null
@@ -1,16 +0,0 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 KEYMAP_EXT_ANSI(
6 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO,
7 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
8 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS,
9 LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
10 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
11 LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
12 ),
13};
14
15const uint16_t PROGMEM fn_actions[] = {
16};
diff --git a/converter/adb_usb/keymap_common.c b/converter/adb_usb/keymap_common.c
deleted file mode 100644
index 55a13793c..000000000
--- a/converter/adb_usb/keymap_common.c
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include "keymap_common.h"
18
19
20/* translates key to keycode */
21uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
22{
23 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
24}
25
26/* translates Fn keycode to action */
27action_t keymap_fn_to_action(uint8_t keycode)
28{
29 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
30}
diff --git a/converter/adb_usb/keymap_common.h b/converter/adb_usb/keymap_common.h
deleted file mode 100644
index bdca38e12..000000000
--- a/converter/adb_usb/keymap_common.h
+++ /dev/null
@@ -1,212 +0,0 @@
1/*
2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#ifndef KEYMAP_COMMON_H
18#define KEYMAP_COMMON_H
19
20#include <stdint.h>
21#include <stdbool.h>
22#include <avr/pgmspace.h>
23#include "keycode.h"
24#include "action.h"
25#include "action_macro.h"
26#include "report.h"
27#include "print.h"
28#include "debug.h"
29#include "keymap.h"
30
31
32extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
33extern const uint16_t fn_actions[];
34
35
36/* M0115 Apple Extended Keyboard ANSI
37 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
38 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
39 * `---' `---------------' `---------------' `---------------' `-----------' `---'
40 * ,-----------------------------------------------------------. ,-----------. ,---------------.
41 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
42 * |-----------------------------------------------------------| |-----------| |---------------|
43 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -|
44 * |-----------------------------------------------------------| `-----------' |---------------|
45 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
46 * |-----------------------------------------------------------| ,---. |---------------|
47 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
48 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
49 * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| |
50 * `-----------------------------------------------------------' `-----------' `---------------'
51 */
52#define KEYMAP_EXT_ANSI( \
53 K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \
54 K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \
55 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \
56 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \
57 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \
58 K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \
59) { \
60 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
61 { KC_##K08, KC_##K09, KC_NUBS, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
62 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
63 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
64 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
65 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
66 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_PENT, KC_##K35, KC_##K36, KC_##K37 }, \
67 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
68 { KC_F17, KC_##K41, KC_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \
69 { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \
70 { KC_F19, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
71 { KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_INT3, KC_INT1, KC_PCMM }, \
72 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \
73 { KC_LANG1, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \
74 { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
75 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \
76}
77
78/* M0115 Apple Extended Keyboard ISO
79 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
80 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
81 * `---' `---------------' `---------------' `---------------' `-----------' `---'
82 * ,-----------------------------------------------------------. ,-----------. ,---------------.
83 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
84 * |-----------------------------------------------------------| |-----------| |---------------|
85 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Retur| |Del|End|PgD| | 7| 8| 9| -|
86 * |------------------------------------------------------` | `-----------' |---------------|
87 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #| | | 4| 5| 6| +|
88 * |-----------------------------------------------------------| ,---. |---------------|
89 * |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
90 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
91 * |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| |
92 * `-----------------------------------------------------------' `-----------' `---------------'
93 */
94#define KEYMAP_EXT_ISO( \
95 K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \
96 K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \
97 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K24, K75,K77,K79, K59,K5B,K5C,K4E, \
98 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A, K56,K57,K58,K45, \
99 K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \
100 K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \
101) { \
102 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
103 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
104 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
105 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
106 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
107 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
108 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_PENT, KC_##K35, KC_##K36, KC_##K37 }, \
109 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
110 { KC_F17, KC_##K41, KC_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \
111 { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \
112 { KC_F19, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
113 { KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_INT3, KC_INT1, KC_PCMM }, \
114 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \
115 { KC_LANG1, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \
116 { KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
117 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \
118}
119
120
121
122
123/* M0116 Apple Standard Keyboard ANSI
124* +-------+
125* | power |
126* +-------+
127* +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
128* |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
129* +---------------------------------------------------------+ +---+---+---+---+
130* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | | | 7 | 8 | 9 | + |
131* +-----------------------------------------------------+ | +---+---+---+---+
132* | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
133* +---------------------------------------------------------+ +---+---+---+---+
134* | shift | z | x | c | v | b | n | m | , | . | / | shift | | 1 | 2 | 3 | |
135* +---------------------------------------------------------+ +-------+---|ent|
136* |cap|opt|comnd| ` | | \ |lef|rig|dwn|up | | 0 | . | |
137* +---------------------------------------------------------+ +-------+---+---+
138*/
139#define KEYMAP_M0116_ANSI( \
140 K7F, \
141 K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \
142 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K45, \
143 K36,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K4E, \
144 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K53,K54,K55, \
145 K39,K3A,K37,K32, K31, K2A,K3B,K3C,K3D,K3E, K52, K41,K4C \
146) { \
147 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
148 { KC_##K08, KC_##K09, KC_NO, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
149 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
150 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
151 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
152 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
153 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \
154 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
155 { KC_NO, KC_##K41, KC_NO, KC_##K43, KC_NO, KC_##K45, KC_NO, KC_##K47 }, \
156 { KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_NO }, \
157 { KC_NO, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
158 { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_NO, KC_NO, KC_NO }, \
159 { KC_NO, KC_NO, KC_NO, KC_NO , KC_NO, KC_NO, KC_NO, KC_NO }, \
160 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
161 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
162 { KC_NO , KC_NO, KC_NO , KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \
163}
164
165#endif
166
167
168/*
169ADB ANSI/ISO Keymapping Note
170============================
171ANSI
172,----------- ----------.
173| *a| 1| 2 =|Backspa|
174|----------- ----------|
175|Tab | Q| | ]| *c|
176|----------- ----------|
177|CapsLo| A| '|Return |
178|----------- ----------|
179|Shift | Shift |
180`----------- ----------'
181
182ISO
183,----------- ----------.
184| *a| 1| 2 =|Backspa|
185|----------- ----------|
186|Tab | Q| | ]|Retur|
187|----------- -----` |
188|CapsLo| A| '| *c| |
189|----------- ----------|
190|Shif| *b| Shift |
191`----------- ----------'
192
193ADB Keyboard scan code:
194 ADB scan code USB usage
195 ------------- ---------
196Key ANSI ISO ANSI ISO
197---------------------------------------------
198*a 0x32 0x0A 0x35 0x35
199*b ---- 0x32 ---- 0x64
200*c 0x2A 0x2A 0x31 0x31(or 0x32)
201
202
203TMK ADB-USB mapping:
204ADB USB(ANSI) USB(ISO)
205---------------------------------
2060x32 0x35 0x64
2070x0A ---- 0x35
2080x2A 0x31 0x31(or 0x32)
209
210Note that mappings of ADB code 0x32 are diffrent between ANSI and ISO keyboard.
211https://github.com/tmk/tmk_keyboard/issues/35
212 */
diff --git a/converter/adb_usb/keymap_hasu.c b/converter/adb_usb/keymap_hasu.c
deleted file mode 100644
index a0b3f1fc6..000000000
--- a/converter/adb_usb/keymap_hasu.c
+++ /dev/null
@@ -1,58 +0,0 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 /* Default Layer: plain keymap
6 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
7 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | |
8 * `---' `---------------' `---------------' `---------------' `-----------' `---'
9 * ,-----------------------------------------------------------. ,-----------. ,---------------.
10 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
11 * |-----------------------------------------------------------| |-----------| |---------------|
12 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Fn0| |Del|End|PgD| | 7| 8| 9| -|
13 * |-----------------------------------------------------------| `-----------' |---------------|
14 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
15 * |-----------------------------------------------------------| ,---. |---------------|
16 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
17 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
18 * |Ctrl |Gui |Alt | Space |Alt |Gui |Ctrl | |Lef|Dow|Rig| | 0| .| |
19 * `-----------------------------------------------------------' `-----------' `---------------'
20 */
21 KEYMAP_EXT_ANSI(
22 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO,
23 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST,
24 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,FN0, DEL, END, PGDN, P7, P8, P9, PMNS,
25 LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
26 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
27 LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
28 ),
29
30 /* Default Layer: plain keymap
31 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
32 * |` | |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | |
33 * `---' `---------------' `---------------' `---------------' `-----------' `---'
34 * ,-----------------------------------------------------------. ,-----------. ,---------------.
35 * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Delete | |Ins|Hom|PgU| |NmL|Mb1|Mb2|Mb3|
36 * |-----------------------------------------------------------| |-----------| |---------------|
37 * |Tab | Q| W| E| R| T| Y| U|PrS|ScL|Pau|Up |Ins| Fn0| |Del|End|PgD| |MwD|McU|MwU|MwD|
38 * |-----------------------------------------------------------| `-----------' |---------------|
39 * |CapsLo|VoD|VoU|Mut| F| G| H| J|Hom|PgU|Lef|Rig|Return | |McL|McD|McR|MwU|
40 * |-----------------------------------------------------------| ,---. |---------------|
41 * |Shift | Z| X| C| V| B| N| M|End|PgD|Dow|Shift | |PgU| |MwL|McD|MwR| |
42 * |-----------------------------------------------------------| ,-----------. |-----------|Mb3|
43 * |Ctrl |Gui |Alt | Space |Alt |Gui |Ctrl | |Hom|PgD|End| | Mb1|Mb2| |
44 * `-----------------------------------------------------------' `-----------' `---------------'
45 */
46 KEYMAP_EXT_ANSI(
47 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO,
48 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,BTN1,BTN2,BTN3,
49 TAB, Q, W, E, R, T, Y, U, PSCR,SLCK,PAUS,UP, INS, FN0, DEL, END, PGDN, WH_D,MS_U,WH_U,WH_D,
50 LCAP,VOLD,VOLU,MUTE,F, G, H, J, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_U,
51 LSFT,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R,
52 LCTL,LGUI,LALT, SPC, RGUI,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3
53 ),
54};
55
56const uint16_t PROGMEM fn_actions[] = {
57 [0] = ACTION_LAYER_TAP_KEY(1, KC_BSLS),
58};
diff --git a/converter/adb_usb/keymap_iso.c b/converter/adb_usb/keymap_iso.c
deleted file mode 100644
index a1b1a5ebd..000000000
--- a/converter/adb_usb/keymap_iso.c
+++ /dev/null
@@ -1,16 +0,0 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 KEYMAP_EXT_ISO(
6 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO,
7 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
8 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, DEL, END, PGDN, P7, P8, P9, PMNS,
9 LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, PPLS,
10 LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
11 LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
12 ),
13};
14
15const uint16_t PROGMEM fn_actions[] = {
16};
diff --git a/converter/adb_usb/led.c b/converter/adb_usb/led.c
deleted file mode 100644
index 3ee64a8e7..000000000
--- a/converter/adb_usb/led.c
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <util/delay.h>
20#include "adb.h"
21#include "led.h"
22
23
24void led_set(uint8_t usb_led)
25{
26 adb_host_kbd_led(~usb_led);
27}
diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c
deleted file mode 100644
index 6220ee6e1..000000000
--- a/converter/adb_usb/matrix.c
+++ /dev/null
@@ -1,296 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/*
19 * scan matrix
20 */
21#include <stdint.h>
22#include <stdbool.h>
23#include <avr/io.h>
24#include <util/delay.h>
25#include "print.h"
26#include "util.h"
27#include "debug.h"
28#include "adb.h"
29#include "matrix.h"
30#include "report.h"
31#include "host.h"
32
33
34#if (MATRIX_COLS > 16)
35# error "MATRIX_COLS must not exceed 16"
36#endif
37#if (MATRIX_ROWS > 255)
38# error "MATRIX_ROWS must not exceed 255"
39#endif
40
41
42static bool is_modified = false;
43static report_mouse_t mouse_report = {};
44
45// matrix state buffer(1:on, 0:off)
46#if (MATRIX_COLS <= 8)
47static uint8_t matrix[MATRIX_ROWS];
48#else
49static uint16_t matrix[MATRIX_ROWS];
50#endif
51
52#ifdef MATRIX_HAS_GHOST
53static bool matrix_has_ghost_in_row(uint8_t row);
54#endif
55static void register_key(uint8_t key);
56
57
58inline
59uint8_t matrix_rows(void)
60{
61 return MATRIX_ROWS;
62}
63
64inline
65uint8_t matrix_cols(void)
66{
67 return MATRIX_COLS;
68}
69
70void matrix_init(void)
71{
72 adb_host_init();
73 // wait for keyboard to boot up and receive command
74 _delay_ms(1000);
75 // Enable keyboard left/right modifier distinction
76 // Addr:Keyboard(0010), Cmd:Listen(10), Register3(11)
77 // upper byte: reserved bits 0000, device address 0010
78 // lower byte: device handler 00000011
79 adb_host_listen(0x2B,0x02,0x03);
80
81 // initialize matrix state: all keys off
82 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
83
84 debug_enable = true;
85 //debug_matrix = true;
86 //debug_keyboard = true;
87 //debug_mouse = true;
88 print("debug enabled.\n");
89 return;
90}
91
92#ifdef ADB_MOUSE_ENABLE
93
94#ifdef MAX
95#undef MAX
96#endif
97#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
98
99void adb_mouse_task(void)
100{
101 uint16_t codes;
102 int16_t x, y;
103 static int8_t mouseacc;
104 _delay_ms(12); // delay for preventing overload of poor ADB keyboard controller
105 codes = adb_host_mouse_recv();
106 // If nothing received reset mouse acceleration, and quit.
107 if (!codes) {
108 mouseacc = 1;
109 return;
110 };
111 // Bit sixteen is button.
112 if (~codes & (1 << 15))
113 mouse_report.buttons |= MOUSE_BTN1;
114 if (codes & (1 << 15))
115 mouse_report.buttons &= ~MOUSE_BTN1;
116 // lower seven bits are movement, as signed int_7.
117 // low byte is X-axis, high byte is Y.
118 y = (codes>>8 & 0x3F);
119 x = (codes>>0 & 0x3F);
120 // bit seven and fifteen is negative
121 // usb does not use int_8, but int_7 (measuring distance) with sign-bit.
122 if (codes & (1 << 6))
123 x = (x-0x40);
124 if (codes & (1 << 14))
125 y = (y-0x40);
126 // Accelerate mouse. (They weren't meant to be used on screens larger than 320x200).
127 x *= mouseacc;
128 y *= mouseacc;
129 // Cap our two bytes per axis to one byte.
130 // Easier with a MIN-function, but since -MAX(-a,-b) = MIN(a,b)...
131 // I.E. MIN(MAX(x,-127),127) = -MAX(-MAX(x, -127), -127) = MIN(-MIN(-x,127),127)
132 mouse_report.x = -MAX(-MAX(x, -127), -127);
133 mouse_report.y = -MAX(-MAX(y, -127), -127);
134 if (debug_mouse) {
135 print("adb_host_mouse_recv: "); print_bin16(codes); print("\n");
136 print("adb_mouse raw: [");
137 phex(mouseacc); print(" ");
138 phex(mouse_report.buttons); print("|");
139 print_decs(mouse_report.x); print(" ");
140 print_decs(mouse_report.y); print("]\n");
141 }
142 // Send result by usb.
143 host_mouse_send(&mouse_report);
144 // increase acceleration of mouse
145 mouseacc += ( mouseacc < ADB_MOUSE_MAXACC ? 1 : 0 );
146 return;
147}
148#endif
149
150uint8_t matrix_scan(void)
151{
152 /* extra_key is volatile and more convoluted than necessary because gcc refused
153 to generate valid code otherwise. Making extra_key uint8_t and constructing codes
154 here via codes = extra_key<<8 | 0xFF; would consistently fail to even LOAD
155 extra_key from memory, and leave garbage in the high byte of codes. I tried
156 dozens of code variations and it kept generating broken assembly output. So
157 beware if attempting to make extra_key code more logical and efficient. */
158 static volatile uint16_t extra_key = 0xFFFF;
159 uint16_t codes;
160 uint8_t key0, key1;
161
162 is_modified = false;
163
164 codes = extra_key;
165 extra_key = 0xFFFF;
166
167 if ( codes == 0xFFFF )
168 {
169 _delay_ms(12); // delay for preventing overload of poor ADB keyboard controller
170 codes = adb_host_kbd_recv();
171 }
172 key0 = codes>>8;
173 key1 = codes&0xFF;
174
175 if (debug_matrix && codes) {
176 print("adb_host_kbd_recv: "); phex16(codes); print("\n");
177 }
178
179 if (codes == 0) { // no keys
180 return 0;
181 } else if (codes == 0x7F7F) { // power key press
182 register_key(0x7F);
183 } else if (codes == 0xFFFF) { // power key release
184 register_key(0xFF);
185 } else if (key0 == 0xFF) { // error
186 xprintf("adb_host_kbd_recv: ERROR(%d)\n", codes);
187 return key1;
188 } else {
189 register_key(key0);
190 if (key1 != 0xFF) // key1 is 0xFF when no second key.
191 extra_key = key1<<8 | 0xFF; // process in a separate call
192 }
193
194 return 1;
195}
196
197bool matrix_is_modified(void)
198{
199 return is_modified;
200}
201
202inline
203bool matrix_has_ghost(void)
204{
205#ifdef MATRIX_HAS_GHOST
206 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
207 if (matrix_has_ghost_in_row(i))
208 return true;
209 }
210#endif
211 return false;
212}
213
214inline
215bool matrix_is_on(uint8_t row, uint8_t col)
216{
217 return (matrix[row] & (1<<col));
218}
219
220inline
221#if (MATRIX_COLS <= 8)
222uint8_t matrix_get_row(uint8_t row)
223#else
224uint16_t matrix_get_row(uint8_t row)
225#endif
226{
227 return matrix[row];
228}
229
230void matrix_print(void)
231{
232 if (!debug_matrix) return;
233#if (MATRIX_COLS <= 8)
234 print("r/c 01234567\n");
235#else
236 print("r/c 0123456789ABCDEF\n");
237#endif
238 for (uint8_t row = 0; row < matrix_rows(); row++) {
239 phex(row); print(": ");
240#if (MATRIX_COLS <= 8)
241 pbin_reverse(matrix_get_row(row));
242#else
243 pbin_reverse16(matrix_get_row(row));
244#endif
245#ifdef MATRIX_HAS_GHOST
246 if (matrix_has_ghost_in_row(row)) {
247 print(" <ghost");
248 }
249#endif
250 print("\n");
251 }
252}
253
254uint8_t matrix_key_count(void)
255{
256 uint8_t count = 0;
257 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
258#if (MATRIX_COLS <= 8)
259 count += bitpop(matrix[i]);
260#else
261 count += bitpop16(matrix[i]);
262#endif
263 }
264 return count;
265}
266
267#ifdef MATRIX_HAS_GHOST
268inline
269static bool matrix_has_ghost_in_row(uint8_t row)
270{
271 // no ghost exists in case less than 2 keys on
272 if (((matrix[row] - 1) & matrix[row]) == 0)
273 return false;
274
275 // ghost exists in case same state as other row
276 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
277 if (i != row && (matrix[i] & matrix[row]) == matrix[row])
278 return true;
279 }
280 return false;
281}
282#endif
283
284inline
285static void register_key(uint8_t key)
286{
287 uint8_t col, row;
288 col = key&0x07;
289 row = (key>>3)&0x0F;
290 if (key&0x80) {
291 matrix[row] &= ~(1<<col);
292 } else {
293 matrix[row] |= (1<<col);
294 }
295 is_modified = true;
296}
diff --git a/converter/ascii_usb/Makefile b/converter/ascii_usb/Makefile
deleted file mode 100644
index 6d977afc0..000000000
--- a/converter/ascii_usb/Makefile
+++ /dev/null
@@ -1,82 +0,0 @@
1# Target file name (without extension).
2TARGET = ascii_usb
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap.c \
12 matrix.c \
13 led.c \
14 protocol/serial_uart.c
15
16CONFIG_H = config.h
17
18
19# MCU name, you MUST set this to match the board you are using
20# type "make clean" after changing this, so all files will be rebuilt
21#MCU = at90usb162 # Teensy 1.0
22MCU = atmega32u4 # Teensy 2.0
23#MCU = at90usb646 # Teensy++ 1.0
24#MCU = at90usb1286 # Teensy++ 2.0
25
26
27# Processor frequency.
28# Normally the first thing your program should do is set the clock prescaler,
29# so your program will run at the correct speed. You should also set this
30# variable to same clock speed. The _delay_ms() macro uses this, and many
31# examples use this variable to calculate timings. Do not add a "UL" here.
32F_CPU = 16000000
33
34
35#
36# LUFA specific
37#
38# Target architecture (see library "Board Types" documentation).
39ARCH = AVR8
40
41# Input clock frequency.
42# This will define a symbol, F_USB, in all source code files equal to the
43# input clock frequency (before any prescaling is performed) in Hz. This value may
44# differ from F_CPU if prescaling is used on the latter, and is required as the
45# raw input clock is fed directly to the PLL sections of the AVR for high speed
46# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
47# at the end, this will be done automatically to create a 32-bit value in your
48# source code.
49#
50# If no clock division is performed on the input clock inside the AVR (via the
51# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
52F_USB = $(F_CPU)
53
54# Interrupt driven control endpoint task
55OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
56
57
58# Build Options
59# *Comment out* to disable the options.
60#
61#MOUSEKEY_ENABLE = yes # Mouse keys
62#EXTRAKEY_ENABLE = yes # Audio control and System control
63CONSOLE_ENABLE = yes # Console for debug
64#NKRO_ENABLE = yes # USB Nkey Rollover
65
66
67# Boot Section Size in bytes
68# Teensy halfKay 512
69# Atmel DFU loader 4096
70# LUFA bootloader 4096
71OPT_DEFS += -DBOOTLOADER_SIZE=4096
72
73
74# Search Path
75VPATH += $(TARGET_DIR)
76VPATH += $(TMK_DIR)
77
78
79include $(TMK_DIR)/protocol/lufa.mk
80include $(TMK_DIR)/protocol.mk
81include $(TMK_DIR)/common.mk
82include $(TMK_DIR)/rules.mk
diff --git a/converter/ascii_usb/README b/converter/ascii_usb/README
deleted file mode 100644
index 02fa064ed..000000000
--- a/converter/ascii_usb/README
+++ /dev/null
@@ -1,38 +0,0 @@
1ASCII to USB keyboard protocol converter
2========================================
3This converts serial console terminal into USB keyboard, tested with TRS-80 model 100 TELCOM application.
4Target MCU is ATMega32u4 but other USB capable AVR will also work.
5
6
7Hardware
8--------
9Connect RX, TX and GND to UART pin of AVR. Note that you may need line driver/level shifter like MAX232 to interface high voltage of RS-232C.
10
11
12
13Build Firmware
14--------------
15Configure UART setting and Just use 'make'
16
17 $ cd ascii_usb
18 $ make
19
20Then, load the binary to MCU with your favorite programmer.
21
22
23
24Limitation
25----------
26- This cannot see key up event, you cannot hold a key.
27- Alt, Gui(Win/Mac) modifier key are not available.
28
29
30
31TRS-80 model 100
32----------------
33Use TELCOM program with setting: 19200bps/8bit/odd parity/1stop bit
34To set this configuration push Stat(F3) and input '9801D,10'. Then push Term(F4) to connect.
35
36
37
38
diff --git a/converter/ascii_usb/config.h b/converter/ascii_usb/config.h
deleted file mode 100644
index 0908997a5..000000000
--- a/converter/ascii_usb/config.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2Copyright 2014 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#define VENDOR_ID 0xFEED
22#define PRODUCT_ID 0x5C01
23#define DEVICE_VER 0x0100
24#define MANUFACTURER t.m.k.
25#define PRODUCT ASCII keyboard converter
26#define DESCRIPTION converts Serial Console Terminal into USB keyboard
27
28
29/* matrix size */
30#define MATRIX_ROWS 16
31#define MATRIX_COLS 16
32
33/* key combination for command */
34#define IS_COMMAND() ( \
35 host_get_first_key() == KC_BRK \
36)
37
38
39/*
40 * Serial(USART) configuration
41 * asynchronous, positive logic, 19200baud, bit order: LSB first
42 * 1-start bit, 8-data bit, odd parity, 1-stop bit
43 */
44#ifdef __AVR_ATmega32U4__
45 #define SERIAL_UART_BAUD 19200
46 #define SERIAL_UART_DATA UDR1
47 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
48 #define SERIAL_UART_RXD_VECT USART1_RX_vect
49 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
50 #define SERIAL_UART_INIT() do { \
51 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
52 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
53 UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
54 UCSR1B |= (0<<TXCIE1) | (1<<TXEN1); /* TX interrupt, TX: enable */ \
55 UCSR1C |= (1<<UPM11) | (1<<UPM10); /* parity: none(00), even(01), odd(11) */ \
56 sei(); \
57 } while(0)
58#else
59 #error "USART configuration is needed."
60#endif
61
62/* disable action features */
63#define NO_ACTION_LAYER
64#define NO_ACTION_TAPPING
65#define NO_ACTION_ONESHOT
66#define NO_ACTION_MACRO
67#define NO_ACTION_FUNCTION
68
69
70#endif
diff --git a/converter/ascii_usb/keymap.c b/converter/ascii_usb/keymap.c
deleted file mode 100644
index a0c61ce8d..000000000
--- a/converter/ascii_usb/keymap.c
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/pgmspace.h>
21#include "keycode.h"
22#include "action.h"
23#include "action_macro.h"
24#include "action_util.h"
25#include "util.h"
26#include "print.h"
27#include "keymap.h"
28
29
30// Keymap is not used. See matrix.c.
31
32/* translates key to keycode */
33uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
34{
35 return KC_NO;
36}
37
38/* translates Fn keycode to action */
39action_t keymap_fn_to_action(uint8_t keycode)
40{
41 return (action_t) { .code = ACTION_NO };
42}
diff --git a/converter/ascii_usb/led.c b/converter/ascii_usb/led.c
deleted file mode 100644
index d1c39bc65..000000000
--- a/converter/ascii_usb/led.c
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "stdint.h"
19#include "serial.h"
20#include "led.h"
21
22
23void led_set(uint8_t usb_led)
24{
25}
diff --git a/converter/ascii_usb/matrix.c b/converter/ascii_usb/matrix.c
deleted file mode 100644
index e1ea8e0ab..000000000
--- a/converter/ascii_usb/matrix.c
+++ /dev/null
@@ -1,195 +0,0 @@
1/*
2Copyright 2014 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/io.h>
21#include <util/delay.h>
22#include "print.h"
23#include "util.h"
24#include "matrix.h"
25#include "debug.h"
26#include "action_util.h"
27#include "protocol/serial.h"
28
29
30/*
31 * Not use Matrix.
32 *
33 * ROW: 16(4bits)
34 * COL: 16(4bits)
35 *
36 * 8bit wide
37 * +---------+
38 * 0|00 ... 0F|
39 * 1|08 ... 1F|
40 * :| ... |
41 * :| ... |
42 * E|E0 ... EF|
43 * F|F0 ... FF|
44 * +---------+
45 */
46
47
48inline
49uint8_t matrix_rows(void)
50{
51 return MATRIX_ROWS;
52}
53
54inline
55uint8_t matrix_cols(void)
56{
57 return MATRIX_COLS;
58}
59
60void matrix_init(void)
61{
62 debug_matrix = true;
63 serial_init();
64
65 debug("init\n");
66 return;
67}
68
69static void type_key(uint16_t keycode)
70{
71 if (keycode == 0) return;
72
73 uint8_t mods = keycode>>8;
74 uint8_t key = keycode&0xFF;
75 if (mods) {
76 add_mods(mods);
77 send_keyboard_report();
78 }
79
80 add_key(key);
81 send_keyboard_report();
82
83 del_key(key);
84 send_keyboard_report();
85
86 if (mods) {
87 del_mods(mods);
88 send_keyboard_report();
89 }
90}
91static uint16_t code2key(uint8_t code)
92{
93 // ASCII to key combination in US laout
94 switch (code) {
95 case 0x01 ... 0x08: // Ctrl-[a-z]
96 return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01));
97 case 0x09: return KC_TAB; // TAB(Ctrl-i)
98 case 0x0A ... 0x0C: // Ctrl-[a-z]
99 return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01));
100 case 0x0D: return KC_ENTER; // Enter(Ctrl-m)
101 case 0x0E ... 0x1A: // Ctrl-[a-z]
102 return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01));
103 case 0x1B: return KC_ESC;
104 case 0x1C: return KC_RIGHT;
105 case 0x1D: return KC_LEFT;
106 case 0x1E: return KC_UP;
107 case 0x1F: return KC_DOWN;
108 case 0x20: return KC_SPACE;
109 case 0x21: return MOD_BIT(KC_LSHIFT)<<8 | KC_1; // !
110 case 0x22: return MOD_BIT(KC_LSHIFT)<<8 | KC_QUOTE; // "
111 case 0x23: return MOD_BIT(KC_LSHIFT)<<8 | KC_3; // #
112 case 0x24: return MOD_BIT(KC_LSHIFT)<<8 | KC_4; // $
113 case 0x25: return MOD_BIT(KC_LSHIFT)<<8 | KC_5; // %
114 case 0x26: return MOD_BIT(KC_LSHIFT)<<8 | KC_7; // &
115 case 0x27: return KC_QUOTE; // '
116 case 0x28: return MOD_BIT(KC_LSHIFT)<<8 | KC_9; // (
117 case 0x29: return MOD_BIT(KC_LSHIFT)<<8 | KC_0; // )
118 case 0x2A: return MOD_BIT(KC_LSHIFT)<<8 | KC_8; // *
119 case 0x2B: return MOD_BIT(KC_LSHIFT)<<8 | KC_EQUAL; // +
120 case 0x2C: return KC_COMMA; // ,
121 case 0x2D: return KC_MINUS; // -
122 case 0x2E: return KC_DOT; // .
123 case 0x2F: return KC_SLASH; // /
124 case 0x30: return KC_0;
125 case 0x31 ... 0x39: // 1-9
126 return KC_1 + (code-0x31);
127 case 0x3A: return MOD_BIT(KC_LSHIFT)<<8 | KC_SCLN; // :
128 case 0x3B: return KC_SCLN; // ;
129 case 0x3C: return MOD_BIT(KC_LSHIFT)<<8 | KC_COMMA; // <
130 case 0x3D: return KC_EQUAL; // =
131 case 0x3E: return MOD_BIT(KC_LSHIFT)<<8 | KC_DOT; // >
132 case 0x3F: return MOD_BIT(KC_LSHIFT)<<8 | KC_SLASH; // ?
133 case 0x40: return MOD_BIT(KC_LSHIFT)<<8 | KC_2; // @
134 case 0x41 ... 0x5A: // A-Z
135 return MOD_BIT(KC_LSHIFT)<<8 | (KC_A + (code-0x41));
136 case 0x5B: return KC_LBRACKET; // [
137 case 0x5C: return KC_BSLASH; //
138 case 0x5D: return KC_RBRACKET; // ]
139 case 0x5E: return MOD_BIT(KC_LSHIFT)<<8 | KC_6; // ^
140 case 0x5F: return MOD_BIT(KC_LSHIFT)<<8 | KC_MINUS; // _
141 case 0x61 ... 0x7A: // a-z
142 return KC_A + (code-0x61);
143 case 0x7B: return MOD_BIT(KC_LSHIFT)<<8 | KC_LBRACKET; // {
144 case 0x7C: return MOD_BIT(KC_LSHIFT)<<8 | KC_BSLASH; // |
145 case 0x7D: return MOD_BIT(KC_LSHIFT)<<8 | KC_RBRACKET; // }
146 case 0x7E: return MOD_BIT(KC_LSHIFT)<<8 | KC_GRAVE; // }
147 case 0x7F: return KC_DELETE; //
148 }
149 return 0;
150}
151
152uint8_t matrix_scan(void)
153{
154 uint16_t code = serial_recv2();
155 if (code == -1) {
156 return 0;
157 }
158
159 print_hex8(code); print(" ");
160
161 // echo back
162 serial_send(code);
163 type_key(code2key(code));
164
165
166 return code;
167}
168
169inline
170bool matrix_has_ghost(void)
171{
172 return false;
173}
174
175inline
176bool matrix_is_on(uint8_t row, uint8_t col)
177{
178 return false;
179}
180
181inline
182matrix_row_t matrix_get_row(uint8_t row)
183{
184 return 0;
185}
186
187void matrix_print(void)
188{
189 print("\nr/c 0123456789ABCDEF\n");
190 for (uint8_t row = 0; row < matrix_rows(); row++) {
191 phex(row); print(": ");
192 pbin_reverse(matrix_get_row(row));
193 print("\n");
194 }
195}
diff --git a/converter/ibm4704_usb/Makefile b/converter/ibm4704_usb/Makefile
deleted file mode 100644
index b5c97d2d3..000000000
--- a/converter/ibm4704_usb/Makefile
+++ /dev/null
@@ -1,93 +0,0 @@
1# Target file name (without extension).
2TARGET = ibm4704_usb
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# project specific files
11SRC = keymap_common.c \
12 matrix.c \
13 led.c \
14 protocol/ibm4704.c
15
16ifdef KEYMAP
17 SRC := keymap_$(KEYMAP).c $(SRC)
18else
19 SRC := keymap_plain.c $(SRC)
20endif
21
22CONFIG_H = config.h
23
24
25# MCU name
26#MCU = at90usb1287
27MCU = atmega32u4
28
29# Processor frequency.
30# This will define a symbol, F_CPU, in all source code files equal to the
31# processor frequency in Hz. You can then use this symbol in your source code to
32# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
33# automatically to create a 32-bit value in your source code.
34#
35# This will be an integer division of F_USB below, as it is sourced by
36# F_USB after it has run through any CPU prescalers. Note that this value
37# does not *change* the processor frequency - it should merely be updated to
38# reflect the processor speed set externally so that the code can use accurate
39# software delays.
40F_CPU = 16000000
41
42
43#
44# LUFA specific
45#
46# Target architecture (see library "Board Types" documentation).
47ARCH = AVR8
48
49# Input clock frequency.
50# This will define a symbol, F_USB, in all source code files equal to the
51# input clock frequency (before any prescaling is performed) in Hz. This value may
52# differ from F_CPU if prescaling is used on the latter, and is required as the
53# raw input clock is fed directly to the PLL sections of the AVR for high speed
54# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
55# at the end, this will be done automatically to create a 32-bit value in your
56# source code.
57#
58# If no clock division is performed on the input clock inside the AVR (via the
59# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
60F_USB = $(F_CPU)
61
62# Interrupt driven control endpoint task(+60)
63OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
64
65
66# Boot Section Size in *bytes*
67# Teensy halfKay 512
68# Teensy++ halfKay 1024
69# Atmel DFU loader 4096
70# LUFA bootloader 4096
71# USBaspLoader 2048
72OPT_DEFS += -DBOOTLOADER_SIZE=4096
73
74
75# Build Options
76# comment out to disable the options.
77#
78#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
79MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
80EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
81CONSOLE_ENABLE = yes # Console for debug(+400)
82COMMAND_ENABLE = yes # Commands for debug and configuration
83#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
84
85
86# Search Path
87VPATH += $(TARGET_DIR)
88VPATH += $(TMK_DIR)
89
90include $(TMK_DIR)/protocol.mk
91include $(TMK_DIR)/protocol/lufa.mk
92include $(TMK_DIR)/common.mk
93include $(TMK_DIR)/rules.mk
diff --git a/converter/ibm4704_usb/README.md b/converter/ibm4704_usb/README.md
deleted file mode 100644
index 68db4bd05..000000000
--- a/converter/ibm4704_usb/README.md
+++ /dev/null
@@ -1,72 +0,0 @@
1IBM 4704 to USB keyboard converter
2==================================
3This firmware converts IBM 4704 keyboard protocol to USB HID.
4
5Keyboard initialization process takes a few seconds at start up. During that you will hear buzzer from the keyboard. **You need to plug USB cable after hooking up your keyboard to the converter.**
6
7
8Update
9------
102015/09/07 Added keymap for Alps 102-key. Thanks, tai @ geekhack!
112015/05/05 Added keymaps for 107-key, 77-key and 50-key. Thanks, orihalcon @ geekhack!
122015/05/19 Fixed a protocol handling bug.
13
14
15
16Supported Keyboard
17------------------
18### IBM capacitive switch models:
19- 6019273 Model 100 50-key (grid layout) http://kishy.ca/?p=894
20- 6019284 Model 200 62-key Alpha(60% layout) http://kishy.ca/?p=894
21- 6019303 Model 300 77-key Expanded Alpha http://deskthority.net/photos-f62/ibm-6019303-t8502.html
22- 6020218 Model 400 107-key Full key http://kishy.ca/?p=894
23
24### Alps switch(vintage Green) models:
25
26- 5954339 Japanese 102-key http://deskthority.net/post87127.html#p87127
27- 6112883 Japanese 102-key http://geekhack.org/index.php?topic=52888.msg1194489#msg1194489
28- 6112884 Japanese 102-key http://geekhack.org/index.php?topic=50437.msg1193047#msg1193047
29- 6341739 Chinese 102-key http://geekhack.org/index.php?topic=52888.msg1176566#msg1176566
30
31
32Connector
33---------
34Keyboard Plug from front:
35
36 DSUB-9
37 -------------
38 \ N 2 3 4 5 /
39 \ N N N N /
40 ---------
41 2 GND
42 3 VCC 5V
43 4 DATA
44 5 CLOCK
45 N No connection/No pin.
46
47
48Connection
49----------
50In case of using ATMega32U4(Teensy2.0):
51
521. Supply power with VCC and GND.
532. Connect CLOCK to PD1 and DATA to PD0. You can change pin with config.h.
543. Optionally you may need pull-up register. 1KOhm probably work.
55
56
57Build Firmware
58--------------
59Just run `make`:
60
61 $ make
62
63To select keymap:
64
65 $ make KEYMAP=[plain|...]
66
67
68Keymap
69------
70Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document(you can find in top README.md) and existent keymap files.
71
72Use `KEYMAP_ALPS102()` to define your keymap for Alps models.
diff --git a/converter/ibm4704_usb/config.h b/converter/ibm4704_usb/config.h
deleted file mode 100644
index 2fee10fd6..000000000
--- a/converter/ibm4704_usb/config.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2Copyright 2014 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include <avr/interrupt.h>
22
23#define VENDOR_ID 0xFEED
24#define PRODUCT_ID 0x4707
25#define DEVICE_VER 0x0001
26#define MANUFACTURER t.m.k.
27#define PRODUCT IBM 4704 keyboard converter
28#define DESCRIPTION convert IBM 4704 keyboard to USB
29
30
31/* matrix size */
32#define MATRIX_ROWS 16 // keycode bit3-6
33#define MATRIX_COLS 8 // keycode bit0-2
34
35
36/* key combination for command */
37#define IS_COMMAND() ( \
38 keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) || \
39 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
40)
41
42
43
44/* Pin configuration */
45#define IBM4704_CLOCK_PORT PORTD
46#define IBM4704_CLOCK_PIN PIND
47#define IBM4704_CLOCK_DDR DDRD
48#define IBM4704_CLOCK_BIT 1
49#define IBM4704_DATA_PORT PORTD
50#define IBM4704_DATA_PIN PIND
51#define IBM4704_DATA_DDR DDRD
52#define IBM4704_DATA_BIT 0
53
54/* Pin interrupt on rising edge of clock */
55#define IBM4704_INT_INIT() do { EICRA |= ((1<<ISC11)|(1<<ISC10)); } while (0)
56#define IBM4704_INT_ON() do { EIFR |= (1<<INTF1); EIMSK |= (1<<INT1); } while (0)
57#define IBM4704_INT_OFF() do { EIMSK &= ~(1<<INT1); } while (0)
58#define IBM4704_INT_VECT INT1_vect
59
60
61#endif
diff --git a/converter/ibm4704_usb/ibm4704.txt b/converter/ibm4704_usb/ibm4704.txt
deleted file mode 100644
index e2d42f08f..000000000
--- a/converter/ibm4704_usb/ibm4704.txt
+++ /dev/null
@@ -1,182 +0,0 @@
1IBM 4704 Keyboard
2=================
3IBM capacitive switch models:
4 6019273 Model 100 50-key (grid layout) http://kishy.ca/?p=894
5 6019284 Model 200 62-key Alpha(60% layout) http://kishy.ca/?p=894
6 6019303 Model 300 77-key Expanded Alpha http://deskthority.net/photos-f62/ibm-6019303-t8502.html
7 6020218 Model 400 107-key Full key http://kishy.ca/?p=894
8
9Alps switch(vintage Green) models:
10 5954339 Japanese 102-key http://deskthority.net/post87127.html#p87127
11 6112883 Japanese 102-key http://geekhack.org/index.php?topic=52888.msg1194489#msg1194489
12 6112884 Japanese 102-key http://geekhack.org/index.php?topic=50437.msg1193047#msg1193047
13 6341739 Chinese 102-key http://geekhack.org/index.php?topic=52888.msg1176566#msg1176566
14
15Resourse
16--------
17The IBM 4704: lots of pictures and info
18http://kishy.dyndns.org/?p=648#more-648
19
20Brochure:
21http://ed-thelen.org/comp-hist/IBM-ProdAnn/4700.pdf
22
23
24
25IBM 4704 Keyboard Protocol
26==========================
27On powering up keyboard sends keyboard ID; A3h for 6019284(62-key), for example.
28After that the keyboard enters FC command mode and waits for parameter data from host
29so that it doesn't send any scancode until you send 'FF'(End of FC command mode).
30
31 Keyboard ID
32 -------------------------------
33 Model 100 50-key A2h
34 Model 200 62-key A3h
35 Model 300 77-key A4h
36 Model 400 107-key A5h
37 Japanese/Chinese 102-key A6h
38
39
40Connector
41---------
42 Keyboard Plug from front
43
44 DSUB-9
45 -------------
46 \ N 2 3 4 5 /
47 \ N N N N /
48 ---------
49 2 GND
50 3 VCC 5V
51 4 DATA
52 5 CLOCK
53 N No connection/No pin.
54
55
56Keyboard to Host
57----------------
58Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part.
59
60 ____ __ __ __ __ __ __ __ __ __ _______
61 Clock \_____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
62 ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
63 Data ____/ X____X____X____X____X____X____X____X____X____X________
64 Start 0 1 2 3 4 5 6 7 P Stop
65
66Start bit: can be long as 300-350us.
67Inhibit: Pull Data line down to inhibit keyboard to send.
68Timing: Host reads bit while Clock is hi.(rising edge)
69Stop bit: Keyboard pulls down Data line to lo after 9th clock.
70
71
72Host to Keyboard
73----------------
74Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part.
75
76 ____ __ __ __ __ __ __ __ __ __ ________
77 Clock \______/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
78 ^ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___
79 Data ____|__/ X____X____X____X____X____X____X____X____X____X \___
80 | Start 0 1 2 3 4 5 6 7 P Stop
81 Request by host
82
83Start bit: can be long as 300-350us.
84Request: Host pulls Clock line down to request to send a command.
85Timing: After Request keyboard pull up Data and down Clock line to low for start bit.
86 After request host release Clock line once Data line becomes hi.
87 Host wirtes a bit while Clock is hi and Keyboard reads while low.
88Stop bit: Host releases or pulls up Data line to hi after 9th clock and waits for keybaord pull down the line to lo.
89
90
91Scancodes
92---------
93Keyboard doesn't send Break code for all keys except for Alt by default.
94
95 6019284 62-key:
96 ,-----------------------------------------------------------.
97 | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS |
98 |-----------------------------------------------------------|
99 |Tab | Q| W| E| R| T| Y| U| I| O| P| ¢| \| PD2|
100 |-----------------------------------------------------------|
101 |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| {}| PD3|
102 |-----------------------------------------------------------|
103 |Shif| <>| Z| X| C| V| B| N| M| ,| ,| /|???|Shift |
104 |-----------------------------------------------------------|
105 |Reset|blk|Alt | Space |Alt |blk|Enter|
106 `-----------------------------------------------------------'
107 +----------+---------------------+----------+----------+
108 |` 00|PD1 04|Caps 20|LShift 30|Reset 31|
109 |1 18|q 05|a 21|<> 3E|Rblank 41|
110 |2 19|w 06|s 22|z 32|Alt 3F|
111 |3 1A|e 13|d 23|x 33|Space 40|
112 |4 10|r 14|f 24|c 34|Alt 3F|
113 |5 11|t 15|g 25|v 35|Lblank 42|
114 |6 12|y 16|h 26|b 36|Enter 2F|
115 |7 08|u 17|j 27|n 37| |
116 |8 09|i 01|k 28|m 38| |
117 |9 0A|o 02|l 29|, 39| |
118 |0 0F|p 03|; 2A|. 3A| |
119 |- 1F|¢ 1B|' 2B|/ 3B| |
120 |= 0D|\ 1C|{} 2C|??? 3C| |
121 |??? 0C|PD2 1D|PD3 2D|RShift 3D| |
122 |BS 0E| | | | |
123 +----------+---------------------+----------+----------+
124 Bit7 is 'press flag' which set 1 on press and 0 on release when break code is enabled.
125
126NOTE: When break code is enabled the key sends scancode with setting 7th bit on press
127and without it on release. That is, '`' sends 80h on press and 00h on release.
128
129
130Keyboard command
131----------------
132Keyboard accepts these commands from host.
133
134 Description Entry point
135 -----------------------------------------------------------
136 FF Soft Reset 0008h
137 FE Resend 00e8h
138 FD Buzzer(emits a short beep) 00edh
139 FC Set Key Flag 00f6h
140 FB Soft Reset 0008h
141 FA Reset 0000h
142
143
144Keyboard response
145-----------------
146Keyobard sends these bytes to host.
147
148 Description Entry point
149 -----------------------------------------------------------
150 FE Overflow(key event/receive data) 00c5h, 0346h
151 Memory test error 0224h
152 FD Command out of bound 00d8h
153 Key out of bound
154 7E Read/Parity error in receive from host 00bch
155
156
157Set Key Flag command(FC)
158------------------------
159After 'Power on Reset' firmware enters this command mode and waits for data from host,
160so that you don't need to send 'FC' and it doesn't send any scancode until you send 'FF'.
161
162Data sent from host:
163
164 bit: 7 6 ... 0
165 en | |
166 | `-----`--- scan code
167 `------------- enable bit(0: enable repeat, 1: enable break)
168
169 00-79 Enable repeat
170 80-F9 Enable break(FA-FF are used as other commands, see above.)
171 FE Resend(011ah) no need to use
172 FF End(0114h) exits FC command mode.
173
174Response from keyboard:
175 FD Out of bound - Invalid scancode
176 -- OK - No response means that command is accepted.
177
178Examples:
179 To enable break code of all keys.
180
181 FC 80 81 ... F7 FF
182
diff --git a/converter/ibm4704_usb/keymap_50key.c b/converter/ibm4704_usb/keymap_50key.c
deleted file mode 100644
index 97294fb45..000000000
--- a/converter/ibm4704_usb/keymap_50key.c
+++ /dev/null
@@ -1,17 +0,0 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 KEYMAP_50(
6 F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, \
7 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, \
8 Q, W, E, R, T, Y, U, I, O, P, \
9 A, S, D, F, G, H, J, K, L, SCLN, \
10 Z, X, C, V, B, N, M, COMM,DOT, SLSH \
11 ),
12};
13
14const uint16_t PROGMEM fn_actions[] = {
15};
16
17
diff --git a/converter/ibm4704_usb/keymap_alps102key.c b/converter/ibm4704_usb/keymap_alps102key.c
deleted file mode 100644
index f3dda718a..000000000
--- a/converter/ibm4704_usb/keymap_alps102key.c
+++ /dev/null
@@ -1,50 +0,0 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 /* Layer 0:
6 * ,---------------------------------------------------------------. ,-----------. ,---------------.
7 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BS |BS |F21| |PSC|SLK|PAU| |F1 |F2 |F3 |F4 |
8 * |---------------------------------------------------------------| |-----------| |---------------|
9 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|F22| |Ins|Hom|PgU| |F5 |F6 |F7 |F8 |
10 * |---------------------------------------------------------------| |-----------| |---------------|
11 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Ret|Ret |F23| |Del|End|PgD| |F9 |F10|F11|F12|
12 * |---------------------------------------------------------------| |-----------| |---------------|
13 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shf|Shift |F24| | |Up | | |F13|F14|F15|F16|
14 * |---------------------------------------------------------------| |-----------| |---------------|
15 * |Fn0 |Gui|Alt | Space |Alt* |Gui|Fn0 | |Lef|Dow|Rig| |F17|F18|F19|F20|
16 * `---------------------------------------------------------------' `-----------' `---------------'
17 */
18 KEYMAP_ALPS102(
19 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,BSPC,F21, PSCR,SLCK,PAUS, F1, F2, F3, F4, \
20 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, F22, INS, HOME,PGUP, F5, F6, F7, F8, \
21 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, F23, DEL, END, PGDN, F9, F10, F11, F12, \
22 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,RSFT, F24, NO, UP, NO, F13, F14, F15, F16, \
23 FN0, LGUI,LALT, SPC, RALT,RGUI, FN0, LEFT,DOWN,RGHT, F17, F18, F19, F20 \
24 ),
25
26 /* Layer 1:
27 * ,---------------------------------------------------------------. ,-----------. ,---------------.
28 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BS |BS |F21| |VoD|VoU|Mut| |F1 |F2 |F3 |F4 |
29 * |---------------------------------------------------------------| |-----------| |---------------|
30 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|F22| |Ins|Hom|PgU| |F5 |F6 |F7 |F8 |
31 * |---------------------------------------------------------------| |-----------| |---------------|
32 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Ret|Ret |F23| |Del|End|PgD| |F9 |F10|F11|F12|
33 * |---------------------------------------------------------------| |-----------| |---------------|
34 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shf|Shift |F24| | |PgU| | |F13|F14|F15|F16|
35 * |---------------------------------------------------------------| |-----------| |---------------|
36 * |Fn0 |Gui|Alt | Space |Alt* |Gui|Fn0 | |Hom|PgD|End| |F17|F18|F19|F20|
37 * `---------------------------------------------------------------' `-----------' `---------------'
38 */
39 KEYMAP_ALPS102(
40 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, VOLD,VOLU,MUTE, TRNS,TRNS,TRNS,TRNS, \
41 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, \
42 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, \
43 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,PGUP,TRNS, TRNS,TRNS,TRNS,TRNS, \
44 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS, HOME,PGDN,END, TRNS,TRNS,TRNS,TRNS \
45 ),
46};
47
48const uint16_t PROGMEM fn_actions[] = {
49 [0] = ACTION_LAYER_MOMENTARY(1),
50};
diff --git a/converter/ibm4704_usb/keymap_common.c b/converter/ibm4704_usb/keymap_common.c
deleted file mode 100644
index 55a13793c..000000000
--- a/converter/ibm4704_usb/keymap_common.c
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include "keymap_common.h"
18
19
20/* translates key to keycode */
21uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
22{
23 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
24}
25
26/* translates Fn keycode to action */
27action_t keymap_fn_to_action(uint8_t keycode)
28{
29 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
30}
diff --git a/converter/ibm4704_usb/keymap_common.h b/converter/ibm4704_usb/keymap_common.h
deleted file mode 100644
index 9cb23b0b8..000000000
--- a/converter/ibm4704_usb/keymap_common.h
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#ifndef KEYMAP_COMMON_H
18#define KEYMAP_COMMON_H
19
20#include <stdint.h>
21#include <stdbool.h>
22#include <avr/pgmspace.h>
23#include "keycode.h"
24#include "action.h"
25#include "action_macro.h"
26#include "report.h"
27#include "print.h"
28#include "debug.h"
29#include "keymap.h"
30
31
32// 32*8(256) byte array which converts PS/2 code into USB code
33extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
34extern const uint16_t fn_actions[];
35
36
37/* 107-key */
38#define KEYMAP( \
39 K46,K64, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, K47,K48,K49,K4A, \
40 K56,K66, K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, K6D,K6E,K6F, K4B,K4C,K4D,K4E, \
41 K71,K77, K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K70,K65,K72, K50,K51,K52,K53, \
42 K44,K45, K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, K74,K75,K76, K5E,K58,K59,K5A, \
43 K54,K55, K31,K41,K3F, K40, K42,K2F, K78,K67,K79, K5B,K5C,K5D,K57 \
44) { \
45 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO }, \
46 { KC_##K08, KC_##K09, KC_##K0A, KC_NO, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
47 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
48 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_NO, KC_##K1F }, \
49 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
50 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_NO, KC_##K2F }, \
51 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
52 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
53 { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
54 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
55 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
56 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_NO }, \
57 { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
58 { KC_NO, KC_NO, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
59 { KC_##K70, KC_##K71, KC_##K72, KC_NO, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
60 { KC_##K78, KC_##K79, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
61}
62
63/* 77-key */
64#define KEYMAP_77( \
65 K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, \
66 K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, K6D,K6E,K6F, \
67 K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K70,K65,K72, \
68 K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, K74,K75,K76, \
69 K31,K41,K3F, K40, K42,K2F, K78,K67,K79 \
70) KEYMAP( \
71 F1, F2, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, NLCK,PSLS,PAST,PMNS, \
72 F3, F4, K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, K6D,K6E,K6F, P7, P8, P9, PPLS, \
73 F5, F6, K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K70,K65,K72, P4, P5, P6, PPLS, \
74 F7, F8, K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, K74,K75,K76, P1, P2, P3, PENT, \
75 F9, F10, K31,K41,K3F, K40, K42,K2F, K78,K67,K79 P0, P0, PDOT,PENT \
76)
77
78/* 62-key */
79#define KEYMAP_62( \
80 K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, \
81 K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, \
82 K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, \
83 K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, \
84 K31,K41,K3F, K40, K42,K2F \
85) KEYMAP( \
86 F1, F2, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \
87 F3, F4, K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, DEL, END, PGDN, P7, P8, P9, PPLS, \
88 F5, F6, K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, PSCR,SLCK,PAUS, P4, P5, P6, PPLS, \
89 F7, F8, K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, F11, UP, F12, P1, P2, P3, PENT, \
90 F9, F10, K31,K41,K3F, K40, K42,K2F, LEFT,DOWN,RGHT, P0, P0, PDOT,PENT \
91)
92
93/* 50-key */
94#define KEYMAP_50( \
95 K00,K01,K02, K03,K04,K05, K20,K21,K22,K23, \
96 K08,K09,K0A, K0B,K0C,K0D, K28,K29,K2A,K35, \
97 K10,K11,K12, K13,K14,K15, K30,K31,K32,K36, \
98 K18,K19,K1A, K1B,K1C,K1D, K38,K39,K3A,K37, \
99 K16,K1E,K0E, K0F,K1F,K17, K33,K3B,K2B,K3F \
100) { \
101 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_NO, KC_NO, }, \
102 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
103 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
104 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
105 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_NO, KC_NO, KC_NO, KC_NO, }, \
106 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_NO, KC_NO, KC_NO, KC_NO, }, \
107 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \
108 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_NO, KC_NO, KC_NO, KC_##K3F }, \
109 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
110 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
111 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
112 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
113 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
114 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
115 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
116 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, } \
117}
118
119/* Alps 102-key */
120#define KEYMAP_ALPS102( \
121 K00, K0F, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K44, K45, K46, K43, K41, K42, K4A, \
122 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K54, K55, K56, K50, K51, K52, K5A, \
123 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K64, K65, K66, K60, K61, K62, K6B, \
124 K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K74, K75, K76, K70, K71, K72, K7B, \
125 K31, K47, K3F, K40, K4F, K48, K2F, K77, K67, K57, K73, K63, K53, K4E \
126) { \
127 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
128 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
129 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
130 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO, }, \
131 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
132 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
133 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
134 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
135 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
136 { KC_##K48, KC_NO, KC_##K4A, KC_NO, KC_NO, KC_NO, KC_##K4E, KC_##K4F }, \
137 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
138 { KC_NO, KC_NO, KC_##K5A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
139 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
140 { KC_NO, KC_NO, KC_NO, KC_##K6B, KC_NO, KC_NO, KC_NO, KC_NO, }, \
141 { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
142 { KC_NO, KC_NO, KC_NO, KC_##K7B, KC_NO, KC_NO, KC_NO, KC_NO, } \
143}
144
145
146#endif
diff --git a/converter/ibm4704_usb/keymap_hasu.c b/converter/ibm4704_usb/keymap_hasu.c
deleted file mode 100644
index 14c171179..000000000
--- a/converter/ibm4704_usb/keymap_hasu.c
+++ /dev/null
@@ -1,85 +0,0 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 /* 0: default
6 * ,-----------------------------------------------------------.
7 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS |
8 * |-----------------------------------------------------------|
9 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
10 * |-----------------------------------------------------------|
11 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|xxx|Ret |
12 * |-----------------------------------------------------------|
13 * |Shif|xxx| Z| X| C| V| B| N| M| ,| ,| /|xxx|Shift |
14 * |-----------------------------------------------------------|
15 * |Ctrl |Gui|Alt | Space |Alt |Gui|Ctrl |
16 * `-----------------------------------------------------------'
17 */
18 KEYMAP_62(
19 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
20 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
21 LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,NO, ENT, \
22 LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, FN2, NO, FN0, \
23 LCTL,LGUI,LALT, FN3, RGUI,RCTL \
24 ),
25
26 KEYMAP_62(
27 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
28 CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSPC, \
29 LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO, ENT, \
30 LSFT,NO, NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,NO, TRNS, \
31 LCTL,LGUI,LALT, SPC, RGUI,RCTL \
32 ),
33
34 KEYMAP_62(
35 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
36 TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,WSTP,WBAK,WFWD,BSPC, \
37 LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,NO, NO, ENT, \
38 LSFT,NO, NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, NO, RSFT,\
39 LCTL,LGUI,LALT, BTN1, RGUI,RCTL \
40 ),
41
42 KEYMAP_62(
43 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
44 TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \
45 LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, ENT, \
46 LSFT,NO, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS,NO, RSFT, \
47 LCTL,LGUI,LALT, SPC, RGUI,RCTL \
48 ),
49
50 KEYMAP_62(
51 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
52 TAB, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN4, \
53 LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,BTN1,NO, NO, ENT, \
54 LSFT,NO, NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, NO, NO, \
55 LCTL,LGUI,LALT, TRNS, RGUI,RCTL \
56 ),
57};
58
59enum macro_id {
60 ALT_TAB,
61};
62
63const uint16_t PROGMEM fn_actions[] = {
64 [0] = ACTION_LAYER_MOMENTARY(1),
65 [1] = ACTION_LAYER_TAP_KEY(2, KC_SCLN),
66 [2] = ACTION_LAYER_TAP_KEY(3, KC_SLASH),
67 [3] = ACTION_LAYER_TAP_KEY(4, KC_SPC),
68 [4] = ACTION_MACRO(ALT_TAB),
69};
70
71/*
72 * Macro definition
73 */
74const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
75{
76 keyevent_t event = record->event;
77
78 switch (id) {
79 case ALT_TAB:
80 return (event.pressed ?
81 MACRO( D(LALT), D(TAB), END ) :
82 MACRO( U(TAB), END ));
83 }
84 return MACRO_NONE;
85}
diff --git a/converter/ibm4704_usb/keymap_plain.c b/converter/ibm4704_usb/keymap_plain.c
deleted file mode 100644
index 4aed684e4..000000000
--- a/converter/ibm4704_usb/keymap_plain.c
+++ /dev/null
@@ -1,50 +0,0 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 /* 0: default
6 * ,-----------------------------------------------------------.
7 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS |
8 * |-----------------------------------------------------------|
9 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
10 * |-----------------------------------------------------------|
11 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Ret|Ret |
12 * |-----------------------------------------------------------|
13 * |Shif|Shf| Z| X| C| V| B| N| M| ,| ,| /|???|Shift |
14 * |-----------------------------------------------------------|
15 * |Ctrl |Gui|Alt | Space |Alt* |Gui|Fn |
16 * `-----------------------------------------------------------'
17 */
18 KEYMAP(
19 F1, F2, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NO, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \
20 F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, \
21 F5, F6, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, ENT, PSCR,SLCK,PAUS, P4, P5, P6, PPLS, \
22 F7, F8, LSFT,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, F11, UP, F12, P1, P2, P3, PENT, \
23 F9, F10, LCTL,LGUI,LALT, SPC, RGUI,FN0, LEFT,DOWN,RGHT, P0, P0, PDOT,PENT \
24 ),
25
26 /* 1: HHKB
27 * ,-----------------------------------------------------------.
28 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|???|Del|
29 * |-----------------------------------------------------------|
30 * |Caps | | | | | | | |Psc|Slk|Pau| Up| | Ins|
31 * |-----------------------------------------------------------|
32 * |Ctrl |VoD|VoU|VoM| | | *| /|Hom|PgU|Lef|Rig|Ret|Ret |
33 * |-----------------------------------------------------------|
34 * |Shif|Shi| | | | | | +| -|End|PgD|Dow|???|Shift |
35 * |-----------------------------------------------------------|
36 * |Ctrl |Gui|Alt | Space |Alt* |Gui|Fn |
37 * `-----------------------------------------------------------'
38 */
39 KEYMAP(
40 F1, F2, ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, NO, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \
41 F3, F4, CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, INS, DEL, END, PGDN, P7, P8, P9, PPLS, \
42 F5, F6, TRNS,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, ENT, PSCR,SLCK,PAUS, P4, P5, P6, PPLS, \
43 F7, F8, TRNS,TRNS,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,NO, TRNS, F11, UP, F12, P1, P2, P3, PENT, \
44 F9, F10, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, LEFT,DOWN,RGHT, P0, P0, PDOT,PENT \
45 ),
46};
47
48const uint16_t PROGMEM fn_actions[] = {
49 [0] = ACTION_LAYER_MOMENTARY(1),
50};
diff --git a/converter/ibm4704_usb/led.c b/converter/ibm4704_usb/led.c
deleted file mode 100644
index f76545f0b..000000000
--- a/converter/ibm4704_usb/led.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "stdint.h"
19#include "led.h"
20
21
22void led_set(uint8_t usb_led)
23{
24}
diff --git a/converter/ibm4704_usb/matrix.c b/converter/ibm4704_usb/matrix.c
deleted file mode 100644
index 5b91d49f8..000000000
--- a/converter/ibm4704_usb/matrix.c
+++ /dev/null
@@ -1,162 +0,0 @@
1/*
2Copyright 2014 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/io.h>
21#include <util/delay.h>
22#include "action.h"
23#include "print.h"
24#include "debug.h"
25#include "util.h"
26#include "ibm4704.h"
27#include "matrix.h"
28
29
30static void matrix_make(uint8_t code);
31static void matrix_break(uint8_t code);
32static void matrix_clear(void);
33
34
35/*
36 * Matrix Array usage:
37 * IBM 4704 scan codes are assigned into 128(16x8)-cell matrix.
38 *
39 * 8bit wide
40 * +---------+
41 * 0| |
42 * :| XX | 00-7F
43 * f| |
44 * +---------+
45 *
46 * Exceptions:
47 */
48static uint8_t matrix[MATRIX_ROWS];
49
50// scan code bits 7654 3210
51// R:row/C:column -RRR RCCC
52#define ROW(code) ((code>>3)&0x0f)
53#define COL(code) (code&0x07)
54
55
56inline
57uint8_t matrix_rows(void)
58{
59 return MATRIX_ROWS;
60}
61
62inline
63uint8_t matrix_cols(void)
64{
65 return MATRIX_COLS;
66}
67
68static void enable_break(void)
69{
70 print("Enable break: ");
71 while (ibm4704_send(0xFC)) { _delay_ms(10); }
72 // valid scancode: 00-79h
73 for (uint8_t code = 0; code < 0x7F; code++) {
74 while (ibm4704_send(0x80|code)) _delay_ms(10);
75 _delay_ms(5); // wait for response
76 // No response(FF) when ok, FD when out of bound
77 xprintf("s%02X:r%02X ", code, ibm4704_recv());
78 }
79 while (ibm4704_send(0xFF)) { _delay_ms(10); } // End
80 print("End\n");
81}
82
83
84void matrix_setup(void)
85{
86 ibm4704_init();
87}
88
89void matrix_init(void)
90{
91 debug_enable = true;
92
93 print("IBM 4704 converter\n");
94 matrix_clear();
95 _delay_ms(2000); // wait for keyboard starting up
96 xprintf("Keyboard ID: %02X\n", ibm4704_recv());
97 enable_break();
98}
99
100/*
101 * IBM 4704 Scan Code
102 */
103uint8_t matrix_scan(void)
104{
105 uint8_t code = ibm4704_recv();
106 if (code==0xFF) {
107 // Not receivd
108 return 0;
109 } else if ((code&0x7F) >= 0x7A) {
110 // 0xFF-FA and 0x7F-7A is not scancode
111 xprintf("Error: %02X\n", code);
112 matrix_clear();
113 return 0;
114 } else if (code&0x80) {
115 dprintf("%02X\n", code);
116 matrix_make(code);
117 } else {
118 dprintf("%02X\n", code);
119 matrix_break(code);
120 }
121 return 1;
122}
123
124inline
125bool matrix_is_on(uint8_t row, uint8_t col)
126{
127 return (matrix[row] & (1<<col));
128}
129
130inline
131uint8_t matrix_get_row(uint8_t row)
132{
133 return matrix[row];
134}
135
136void matrix_print(void)
137{
138 print("\nr/c 01234567\n");
139 for (uint8_t row = 0; row < matrix_rows(); row++) {
140 xprintf("%02X: %08b\n", row, bitrev(matrix_get_row(row)));
141 }
142}
143
144
145
146inline
147static void matrix_make(uint8_t code)
148{
149 matrix[ROW(code)] |= 1<<COL(code);
150}
151
152inline
153static void matrix_break(uint8_t code)
154{
155 matrix[ROW(code)] &= ~(1<<COL(code));
156}
157
158inline
159static void matrix_clear(void)
160{
161 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
162}
diff --git a/converter/m0110_usb/Makefile b/converter/m0110_usb/Makefile
deleted file mode 100644
index e83645632..000000000
--- a/converter/m0110_usb/Makefile
+++ /dev/null
@@ -1,96 +0,0 @@
1# Target file name (without extension).
2TARGET = m0110_lufa
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = matrix.c \
12 led.c \
13 keymap_common.c \
14 m0110.c
15
16# To use own keymap file run make like: make keymap=hasu
17ifdef KEYMAP
18 SRC += keymap_$(KEYMAP).c
19else
20 SRC += keymap_default.c
21endif
22
23CONFIG_H = config.h
24
25
26# MCU name, you MUST set this to match the board you are using
27# type "make clean" after changing this, so all files will be rebuilt
28MCU = atmega32u2 # TMK converter rev2
29#MCU = atmega32u4 # TMK converter rev1
30
31
32# Processor frequency.
33# Normally the first thing your program should do is set the clock prescaler,
34# so your program will run at the correct speed. You should also set this
35# variable to same clock speed. The _delay_ms() macro uses this, and many
36# examples use this variable to calculate timings. Do not add a "UL" here.
37F_CPU = 16000000
38
39
40#
41# LUFA specific
42#
43# Target architecture (see library "Board Types" documentation).
44ARCH = AVR8
45
46# Input clock frequency.
47# This will define a symbol, F_USB, in all source code files equal to the
48# input clock frequency (before any prescaling is performed) in Hz. This value may
49# differ from F_CPU if prescaling is used on the latter, and is required as the
50# raw input clock is fed directly to the PLL sections of the AVR for high speed
51# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
52# at the end, this will be done automatically to create a 32-bit value in your
53# source code.
54#
55# If no clock division is performed on the input clock inside the AVR (via the
56# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
57F_USB = $(F_CPU)
58
59# Interrupt driven control endpoint task
60OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
61
62
63# Boot Section Size in bytes
64# Teensy halfKay 512
65# Atmel DFU loader 4096
66# LUFA bootloader 4096
67OPT_DEFS += -DBOOTLOADER_SIZE=4096
68
69
70# Build Options
71# *Comment out* to disable the options.
72#
73#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
74MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
75EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
76CONSOLE_ENABLE = yes # Console for debug(+400)
77COMMAND_ENABLE = yes # Commands for debug and configuration
78#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
79#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
80#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
81
82
83
84#---------------- Programming Options --------------------------
85PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
86
87
88# Search Path
89VPATH += $(TARGET_DIR)
90VPATH += $(TMK_DIR)
91
92
93include $(TMK_DIR)/protocol/lufa.mk
94include $(TMK_DIR)/protocol.mk
95include $(TMK_DIR)/common.mk
96include $(TMK_DIR)/rules.mk
diff --git a/converter/m0110_usb/Makefile.teensy b/converter/m0110_usb/Makefile.teensy
deleted file mode 100644
index 394b66050..000000000
--- a/converter/m0110_usb/Makefile.teensy
+++ /dev/null
@@ -1,98 +0,0 @@
1# Target file name (without extension).
2TARGET = m0110_lufa
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = matrix.c \
12 led.c \
13 keymap_common.c \
14 m0110.c
15
16# To use own keymap file run make like: make keymap=hasu
17ifdef KEYMAP
18 SRC += keymap_$(KEYMAP).c
19else
20 SRC += keymap_default.c
21endif
22
23CONFIG_H = config.h
24
25
26# MCU name, you MUST set this to match the board you are using
27# type "make clean" after changing this, so all files will be rebuilt
28#MCU = at90usb162 # Teensy 1.0
29MCU = atmega32u4 # Teensy 2.0
30#MCU = at90usb646 # Teensy++ 1.0
31#MCU = at90usb1286 # Teensy++ 2.0
32
33
34# Processor frequency.
35# Normally the first thing your program should do is set the clock prescaler,
36# so your program will run at the correct speed. You should also set this
37# variable to same clock speed. The _delay_ms() macro uses this, and many
38# examples use this variable to calculate timings. Do not add a "UL" here.
39F_CPU = 16000000
40
41
42#
43# LUFA specific
44#
45# Target architecture (see library "Board Types" documentation).
46ARCH = AVR8
47
48# Input clock frequency.
49# This will define a symbol, F_USB, in all source code files equal to the
50# input clock frequency (before any prescaling is performed) in Hz. This value may
51# differ from F_CPU if prescaling is used on the latter, and is required as the
52# raw input clock is fed directly to the PLL sections of the AVR for high speed
53# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
54# at the end, this will be done automatically to create a 32-bit value in your
55# source code.
56#
57# If no clock division is performed on the input clock inside the AVR (via the
58# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
59F_USB = $(F_CPU)
60
61# Interrupt driven control endpoint task
62OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
63
64
65# Boot Section Size in bytes
66# Teensy halfKay 512
67# Atmel DFU loader 4096
68# LUFA bootloader 4096
69OPT_DEFS += -DBOOTLOADER_SIZE=512
70
71
72# Build Options
73# *Comment out* to disable the options.
74#
75#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
76MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
77EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
78CONSOLE_ENABLE = yes # Console for debug(+400)
79COMMAND_ENABLE = yes # Commands for debug and configuration
80#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
81#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
82#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
83
84
85
86#---------------- Programming Options --------------------------
87PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
88
89
90# Search Path
91VPATH += $(TARGET_DIR)
92VPATH += $(TMK_DIR)
93
94
95include $(TMK_DIR)/protocol/lufa.mk
96include $(TMK_DIR)/protocol.mk
97include $(TMK_DIR)/common.mk
98include $(TMK_DIR)/rules.mk
diff --git a/converter/m0110_usb/Makefile.tmk_rev1 b/converter/m0110_usb/Makefile.tmk_rev1
deleted file mode 100644
index f36fcc4b5..000000000
--- a/converter/m0110_usb/Makefile.tmk_rev1
+++ /dev/null
@@ -1,96 +0,0 @@
1# Target file name (without extension).
2TARGET = m0110_lufa
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = matrix.c \
12 led.c \
13 keymap_common.c \
14 m0110.c
15
16# To use own keymap file run make like: make keymap=hasu
17ifdef KEYMAP
18 SRC += keymap_$(KEYMAP).c
19else
20 SRC += keymap_default.c
21endif
22
23CONFIG_H = config.h
24
25
26# MCU name, you MUST set this to match the board you are using
27# type "make clean" after changing this, so all files will be rebuilt
28#MCU = atmega32u2 # TMK converter rev2
29MCU = atmega32u4 # TMK converter rev1
30
31
32# Processor frequency.
33# Normally the first thing your program should do is set the clock prescaler,
34# so your program will run at the correct speed. You should also set this
35# variable to same clock speed. The _delay_ms() macro uses this, and many
36# examples use this variable to calculate timings. Do not add a "UL" here.
37F_CPU = 16000000
38
39
40#
41# LUFA specific
42#
43# Target architecture (see library "Board Types" documentation).
44ARCH = AVR8
45
46# Input clock frequency.
47# This will define a symbol, F_USB, in all source code files equal to the
48# input clock frequency (before any prescaling is performed) in Hz. This value may
49# differ from F_CPU if prescaling is used on the latter, and is required as the
50# raw input clock is fed directly to the PLL sections of the AVR for high speed
51# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
52# at the end, this will be done automatically to create a 32-bit value in your
53# source code.
54#
55# If no clock division is performed on the input clock inside the AVR (via the
56# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
57F_USB = $(F_CPU)
58
59# Interrupt driven control endpoint task
60OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
61
62
63# Boot Section Size in bytes
64# Teensy halfKay 512
65# Atmel DFU loader 4096
66# LUFA bootloader 4096
67OPT_DEFS += -DBOOTLOADER_SIZE=4096
68
69
70# Build Options
71# *Comment out* to disable the options.
72#
73#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
74MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
75EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
76CONSOLE_ENABLE = yes # Console for debug(+400)
77COMMAND_ENABLE = yes # Commands for debug and configuration
78#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
79#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
80#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
81
82
83
84#---------------- Programming Options --------------------------
85PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
86
87
88# Search Path
89VPATH += $(TARGET_DIR)
90VPATH += $(TMK_DIR)
91
92
93include $(TMK_DIR)/protocol/lufa.mk
94include $(TMK_DIR)/protocol.mk
95include $(TMK_DIR)/common.mk
96include $(TMK_DIR)/rules.mk
diff --git a/converter/m0110_usb/Makefile.tmk_rev2 b/converter/m0110_usb/Makefile.tmk_rev2
deleted file mode 100644
index e83645632..000000000
--- a/converter/m0110_usb/Makefile.tmk_rev2
+++ /dev/null
@@ -1,96 +0,0 @@
1# Target file name (without extension).
2TARGET = m0110_lufa
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = matrix.c \
12 led.c \
13 keymap_common.c \
14 m0110.c
15
16# To use own keymap file run make like: make keymap=hasu
17ifdef KEYMAP
18 SRC += keymap_$(KEYMAP).c
19else
20 SRC += keymap_default.c
21endif
22
23CONFIG_H = config.h
24
25
26# MCU name, you MUST set this to match the board you are using
27# type "make clean" after changing this, so all files will be rebuilt
28MCU = atmega32u2 # TMK converter rev2
29#MCU = atmega32u4 # TMK converter rev1
30
31
32# Processor frequency.
33# Normally the first thing your program should do is set the clock prescaler,
34# so your program will run at the correct speed. You should also set this
35# variable to same clock speed. The _delay_ms() macro uses this, and many
36# examples use this variable to calculate timings. Do not add a "UL" here.
37F_CPU = 16000000
38
39
40#
41# LUFA specific
42#
43# Target architecture (see library "Board Types" documentation).
44ARCH = AVR8
45
46# Input clock frequency.
47# This will define a symbol, F_USB, in all source code files equal to the
48# input clock frequency (before any prescaling is performed) in Hz. This value may
49# differ from F_CPU if prescaling is used on the latter, and is required as the
50# raw input clock is fed directly to the PLL sections of the AVR for high speed
51# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
52# at the end, this will be done automatically to create a 32-bit value in your
53# source code.
54#
55# If no clock division is performed on the input clock inside the AVR (via the
56# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
57F_USB = $(F_CPU)
58
59# Interrupt driven control endpoint task
60OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
61
62
63# Boot Section Size in bytes
64# Teensy halfKay 512
65# Atmel DFU loader 4096
66# LUFA bootloader 4096
67OPT_DEFS += -DBOOTLOADER_SIZE=4096
68
69
70# Build Options
71# *Comment out* to disable the options.
72#
73#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
74MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
75EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
76CONSOLE_ENABLE = yes # Console for debug(+400)
77COMMAND_ENABLE = yes # Commands for debug and configuration
78#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
79#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
80#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
81
82
83
84#---------------- Programming Options --------------------------
85PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
86
87
88# Search Path
89VPATH += $(TARGET_DIR)
90VPATH += $(TMK_DIR)
91
92
93include $(TMK_DIR)/protocol/lufa.mk
94include $(TMK_DIR)/protocol.mk
95include $(TMK_DIR)/common.mk
96include $(TMK_DIR)/rules.mk
diff --git a/converter/m0110_usb/README.md b/converter/m0110_usb/README.md
deleted file mode 100644
index bfd3261df..000000000
--- a/converter/m0110_usb/README.md
+++ /dev/null
@@ -1,79 +0,0 @@
1M0110/M0110A to USB keyboard converter
2======================================
3This firmware converts the protocol of Apple Macintosh keyboard **M0110**, **M0110A** and **M0120** into USB. Target of this project is USB AVR controller like **ATmega32U2** and **ATmega32U4**. Using this converter you can revive these retro keyboards with modern computer.
4
5Read README of top directory too.
6
7Pictures of **M0110 + M0120** and **M0110A**.
8
9![M0110+M0120](http://i.imgur.com/dyvXb2Tm.jpg)
10![M0110A](http://i.imgur.com/HuHOEoHm.jpg)
11
12
13- M0110A support was contributed by [skagon@github](https://github.com/skagon).
14- M0120 also is supported. keys(+ * / and ,) on M0120 are recognized as cursor keys.
15
16
17
18Update
19------
20- 2013/08: Change port for signals `PF` to `PD`
21- 2013/09: Change port again, it uses inversely `PD0` for data and `PD1` for clock line now.
22- 2014/06: Change keymaps
23- 2015/03: Add support for "International"(ISO) keyboard(keymap_intl.c)
24
25
26
27Building Hardware
28-----------------
29You need [TMK converter] or AVR dev board like PJRC [Teensy]. Port of the MCU `PD1` is assigned to `CLOCK` line and `PD0` to `DATA` by default, you can change pin configuration with editing `config.h`.
30
31[![M0110 Converter](http://i.imgur.com/4G2ZOegm.jpg)](http://i.imgur.com/4G2ZOeg.jpg)
32
33### 4P4C phone handset cable
34Note that original cable used with Mac is **straight** while phone handset cable is **crossover**.
35
36<http://en.wikipedia.org/wiki/Modular_connector#4P4C>
37
38Close-up picture of handset cable. You can see one end of plug has reverse color codes against the other. Click to enlarge.
39[![4P4C cable](http://i.imgur.com/3S9P1mYm.jpg?1)](http://i.imgur.com/3S9P1mY.jpg?1)
40
41[Teensy]: http://www.pjrc.com/teensy/
42[TMK converter]: https://github.com/tmk/keyboard_converter
43
44
45### Socket Pinout
46- <http://pinouts.ru/Inputs/MacKeyboard_pinout.shtml>
47
48![Jack fig](http://www.kbdbabel.org/conn/kbd_connector_macplus.png)
49
50
51### Pull-up Resistor
52You may need pull-up resistors on signal lines(`CLOCK`, `DATA`) in particular when you have long or coiled cable. **1k-10k Ohm** will be OK for this purpose. In that case the converter may not read signal from keyboard correctly without pull-up resistors.
53
54
55
56Building Firmware
57-----------------
58To compile firmware you need AVR GCC. You can edit *Makefile* and *config.h* to change compile options and pin configuration. Also `KEYMAP` option can be used to select keymap.
59
60 $ git clone git://github.com/tmk/tmk_keyboard.git (or download source)
61 $ cd m0110_usb
62 $ make -f Makefile.rev2 clean
63 $ make -f Makefile.rev2 [KEYMAP={default|intl|spacefn|hasu}]
64
65Use `Maefile.tmk_rev1` for TMK converter Rev.1, `Makefile.teensy` for Teensy instead.
66
67
68
69Keymap
70------
71To create your own keymap copy existent keymap file to `keymap_name.c` and edit it.
72
73
74
75Debug
76-----
77You can use [PJRC HID listen](http://www.pjrc.com/teensy/hid_listen.html) to see debug output. The converter has some functions for debug, press `<Magic>+H` simultaneously to get help.
78
79- Magic combo: `Shift+Option+⌘` or `Shift+Option+Ctrl`(`Shift+Alt+Gui` or `Shift+Alt+Control`)
diff --git a/converter/m0110_usb/config.h b/converter/m0110_usb/config.h
deleted file mode 100644
index 801bc4ebf..000000000
--- a/converter/m0110_usb/config.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21
22#define VENDOR_ID 0xFEED
23#define PRODUCT_ID 0x0110
24#define DEVICE_VER 0x0101
25#define MANUFACTURER t.m.k.
26#define PRODUCT M0110 keyboard converter
27#define DESCRIPTION convert M0110 keyboard to USB
28
29
30/* matrix size */
31#define MATRIX_ROWS 14
32#define MATRIX_COLS 8
33
34
35/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
36#define LOCKING_SUPPORT_ENABLE
37/* Locking resynchronize hack */
38#define LOCKING_RESYNC_ENABLE
39
40
41/* magic key */
42#define IS_COMMAND() ( \
43 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) || \
44 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LCTL)) \
45)
46
47/* boot magic key */
48#define BOOTMAGIC_KEY_SALT KC_FN0
49#define BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL KC_LCAP
50
51
52/* ports */
53#define M0110_CLOCK_PORT PORTD
54#define M0110_CLOCK_PIN PIND
55#define M0110_CLOCK_DDR DDRD
56#define M0110_CLOCK_BIT 1
57#define M0110_DATA_PORT PORTD
58#define M0110_DATA_PIN PIND
59#define M0110_DATA_DDR DDRD
60#define M0110_DATA_BIT 0
61
62#endif
diff --git a/converter/m0110_usb/keymap_common.c b/converter/m0110_usb/keymap_common.c
deleted file mode 100644
index 4ac2d7178..000000000
--- a/converter/m0110_usb/keymap_common.c
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2Copyright 2011,2012,2014 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include <avr/pgmspace.h>
19#include "action.h"
20#include "keycode.h"
21#include "keymap.h"
22#include "keymap_common.h"
23
24
25/* translates key to keycode */
26uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
27{
28 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
29}
30
31/* translates Fn index to action */
32action_t keymap_fn_to_action(uint8_t keycode)
33{
34 action_t action;
35 action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
36 return action;
37}
diff --git a/converter/m0110_usb/keymap_common.h b/converter/m0110_usb/keymap_common.h
deleted file mode 100644
index 925556d97..000000000
--- a/converter/m0110_usb/keymap_common.h
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2Copyright 2011,2012,2014,2015 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include <avr/pgmspace.h>
19#include "keycode.h"
20#include "keymap.h"
21
22
23extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
24extern const uint16_t fn_actions[];
25
26
27/* Common layout for M0110 and M0110A
28 * This keymap works with both keyboards. As you can see, the M0110A is
29 * a superset of M0110 keyboard, only one exception is 'Enter'(34) of M0110
30 * does not exist on the M0110A.
31 *
32 * ,---------------------------------------------------------. ,---------------.
33 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| =| /| *|
34 * |---------------------------------------------------------| |---------------|
35 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
36 * |-----------------------------------------------------' | |---------------|
37 * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
38 * |---------------------------------------------------------| |---------------|
39 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
40 * |---------------------------------------------------------| |-----------|Ent|
41 * |Opt |Mac | Space |Ent| \|Lft|Rgt|Dn | | 0| .| |
42 * `---------------------------------------------------------' `---------------'
43 *
44 * M0110A scan codes
45 * ,---------------------------------------------------------. ,---------------.
46 * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62|
47 * |---------------------------------------------------------| |---------------|
48 * | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| | | 59| 5B| 5C| 4E|
49 * |-----------------------------------------------------' | |---------------|
50 * | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 66|
51 * |---------------------------------------------------------| |---------------|
52 * | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| 4D| | 53| 54| 55| |
53 * `---------------------------------------------------------' |-----------| 4C|
54 * | 3A| 37| 31 | 2A| 46| 42| 48| | 52| 41| |
55 * `---------------------------------------------------------' `---------------'
56 *
57 * M0110 + M0120 scan codes
58 * ,---------------------------------------------------------. ,---------------.
59 * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62|
60 * |---------------------------------------------------------| |---------------|
61 * | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4E|
62 * |---------------------------------------------------------| |---------------|
63 * | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 66|
64 * |---------------------------------------------------------| |---------------|
65 * | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| | 53| 54| 55| |
66 * `---------------------------------------------------------' |-----------| 4C|
67 * | 3A| 37| 31 | 34| 3A| | 52| 41| |
68 * `------------------------------------------------' `---------------'
69 * Two right and left keys of 38 and 3A are identical, you cannot discriminate those two.
70 */
71#define KEYMAP( \
72 K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \
73 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K4E, \
74 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K66, \
75 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K4D, K53,K54,K55,K4C, \
76 K3A,K37, K31, K34,K2A,K46,K42,K48, K52, K41 \
77) { \
78 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
79 { KC_##K08, KC_##K09, KC_NO, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
80 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
81 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
82 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
83 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
84 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_NO, KC_##K37 }, \
85 { KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
86 { KC_NO, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_NO, KC_##K46, KC_##K47 }, \
87 { KC_##K48, KC_NO, KC_NO, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
88 { KC_NO, KC_NO, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
89 { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_NO, KC_NO, KC_NO }, \
90 { KC_NO, KC_NO, KC_##K62, KC_NO, KC_NO, KC_NO, KC_##K66, KC_NO }, \
91 { KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \
92}
93
94/* International keyboard layout for M0110 + M0120
95 * https://en.wikipedia.org/wiki/File:Apple_Macintosh_Plus_Keyboard.jpg
96 * Probably International keyboard layout of M0110A doesn't exist.
97 *
98 * M0110 + M0120 scan codes
99 * ,---------------------------------------------------------. ,---------------.
100 * | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62|
101 * |---------------------------------------------------------| |---------------|
102 * | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4E|
103 * |------------------------------------------------------, | |---------------|
104 * | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | | 56| 57| 58| 66|
105 * |---------------------------------------------------------| |---------------|
106 * | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 0A| 38| | 53| 54| 55| |
107 * `---------------------------------------------------------' |-----------| 4C|
108 * | 3A| 37| 34 | 31| 3A| | 52| 41| |
109 * `------------------------------------------------' `---------------'
110 * Two right and left keys of 38 and 3A are identical, you cannot discriminate those two.
111 */
112#define KEYMAP_INTL( \
113 K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \
114 K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K59,K5B,K5C,K4E, \
115 K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K24, K56,K57,K58,K66, \
116 K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K0A, K53,K54,K55,K4C, \
117 K3A,K37, K34, K31, K52, K41 \
118) { \
119 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
120 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
121 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
122 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
123 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
124 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
125 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO, KC_NO, KC_##K37 }, \
126 { KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
127 { KC_NO, KC_##K41, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K47 }, \
128 { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K4C, KC_NO, KC_##K4E, KC_NO }, \
129 { KC_NO, KC_NO, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
130 { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_NO, KC_NO, KC_NO }, \
131 { KC_NO, KC_NO, KC_##K62, KC_NO, KC_NO, KC_NO, KC_##K66, KC_NO }, \
132 { KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \
133}
diff --git a/converter/m0110_usb/keymap_default.c b/converter/m0110_usb/keymap_default.c
deleted file mode 100644
index ff7478d1b..000000000
--- a/converter/m0110_usb/keymap_default.c
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2Copyright 2011,2012,2015 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include "keycode.h"
19#include "keymap_common.h"
20
21
22
23#ifdef KEYMAP_SECTION_ENABLE
24const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
25#else
26const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
27#endif
28 /* Default:
29 * M0110 M0120
30 * ,---------------------------------------------------------. ,---------------.
31 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| =| /| *|
32 * |---------------------------------------------------------| |---------------|
33 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| -|
34 * |---------------------------------------------------------| |---------------|
35 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
36 * |---------------------------------------------------------| |---------------|
37 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
38 * `---------------------------------------------------------' |-----------|Ent|
39 * |Opt|Mac | Space |Fn |Opt| | 0| .| |
40 * `-----------------------------------------------' `---------------'
41 * M0110A
42 * ,---------------------------------------------------------. ,---------------.
43 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| =| /| *|
44 * |---------------------------------------------------------| |---------------|
45 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
46 * |-----------------------------------------------------' | |---------------|
47 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
48 * |---------------------------------------------------------| |---------------|
49 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
50 * |---------------------------------------------------------| |-----------|Ent|
51 * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| |
52 * `---------------------------------------------------------' `---------------'
53 */
54 [0] = KEYMAP(
55 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST,
56 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
57 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
58 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT,
59 LALT,LGUI, SPC, FN0, FN13,LEFT,RGHT,DOWN, P0, PDOT
60 ),
61 /* Cursor Layer:
62 * M0110 M0120
63 * ,---------------------------------------------------------. ,---------------.
64 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *|
65 * |---------------------------------------------------------| |---------------|
66 * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |INS| | | 7| 8| 9| -|
67 * |---------------------------------------------------------| |---------------|
68 * |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| +|
69 * |---------------------------------------------------------| |---------------|
70 * |Shift |End| |PgD| | | | |End|PgD|Dow|Shift | | 1| 2| 3| |
71 * `---------------------------------------------------------' |-----------|Ent|
72 * |Opt|Mac | Space |Fn |Opt| | 0| .| |
73 * `-----------------------------------------------' `---------------'
74 * M0110A
75 * ,---------------------------------------------------------. ,---------------.
76 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *|
77 * |---------------------------------------------------------| |---------------|
78 * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |INS| | | 7| 8| 9| -|
79 * |-----------------------------------------------------' | |---------------|
80 * |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| +|
81 * |---------------------------------------------------------| |---------------|
82 * |Shift |End| |PgD| | | | |End|PgD|Dow|Shft|PgU| | 1| 2| 3| |
83 * |---------------------------------------------------------| |-----------|Ent|
84 * |Opt |Mac | Space | \|Hom|End|PgD| | 0| .| |
85 * `---------------------------------------------------------' `---------------'
86 */
87 [1] = KEYMAP(
88 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
89 CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, INS, P7, P8, P9, PMNS,
90 LCTL,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT, P4, P5, P6, PPLS,
91 LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT,
92 LALT,LGUI, SPC, FN0, FN13,HOME,END, PGDN, P0, PDOT
93 ),
94};
95
96
97/*
98 * Fn action definition
99 */
100#ifdef KEYMAP_SECTION_ENABLE
101const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
102#else
103const uint16_t fn_actions[] PROGMEM = {
104#endif
105 [0] = ACTION_LAYER_MOMENTARY(1),
106 [1] = ACTION_LAYER_MOMENTARY(2),
107 [2] = ACTION_LAYER_MOMENTARY(3),
108 [3] = ACTION_LAYER_MOMENTARY(4),
109 [4] = ACTION_LAYER_MOMENTARY(5),
110 [5] = ACTION_LAYER_MOMENTARY(6),
111 [6] = ACTION_LAYER_MOMENTARY(7),
112 [7] = ACTION_LAYER_TOGGLE(1),
113 [8] = ACTION_LAYER_TOGGLE(2),
114 [9] = ACTION_LAYER_TOGGLE(3),
115 [10] = ACTION_LAYER_TAP_TOGGLE(1),
116 [11] = ACTION_LAYER_TAP_TOGGLE(2),
117 [12] = ACTION_LAYER_TAP_TOGGLE(3),
118 [13] = ACTION_LAYER_TAP_KEY(1, KC_BSLASH),
119 [14] = ACTION_LAYER_TAP_KEY(2, KC_TAB),
120 [15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER),
121 [16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE),
122 [17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON),
123 [18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE),
124 [19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH),
125 [20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE),
126 [21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE),
127 [22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE),
128 [23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER),
129 [24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC),
130 [25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE),
131 [26] = ACTION_MODS_ONESHOT(MOD_LCTL),
132 [27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC),
133 [28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE),
134 [29] = ACTION_MODS_ONESHOT(MOD_LSFT),
135 [30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE),
136 [31] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_BSLASH),
137};
diff --git a/converter/m0110_usb/keymap_hasu.c b/converter/m0110_usb/keymap_hasu.c
deleted file mode 100644
index 11f1a4f39..000000000
--- a/converter/m0110_usb/keymap_hasu.c
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2Copyright 2014 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include "keycode.h"
19#include "keymap_common.h"
20
21
22const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
23 /* Default:
24 * M0110
25 * ,---------------------------------------------------------.
26 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs|
27 * |---------------------------------------------------------|
28 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
29 * |---------------------------------------------------------|
30 * |Ctrl | A| S| D| F| G| H| J| K| L| Fn| '|Return|
31 * |---------------------------------------------------------|
32 * |Shift | Z| X| C| V| B| N| M| ,| ,| Fn|Shift |
33 * `---------------------------------------------------------'
34 * |Fn |alt | Fn |Gui |Fn |
35 * `-----------------------------------------------'
36 */
37 [0] = KEYMAP(
38 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST,
39 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
40 LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT, ENT, P4, P5, P6, PPLS,
41 LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN1, UP, P1, P2, P3, PENT,
42 FN0, LALT, FN2, LGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT
43 ),
44 // IJKL cursor
45 [1] = KEYMAP(
46 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
47 CAPS,NO, NO, NO, NO, NO, HOME,PGDN,UP, PGUP,END, NO, NO, P7, P8, P9, PMNS,
48 LCTL,VOLD,VOLU,MUTE,NO, NO, HOME,LEFT,DOWN,RGHT,END, NO, ENT, P4, P5, P6, PPLS,
49 LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, PGUP, P1, P2, P3, PENT,
50 TRNS,LALT, SPC, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
51 ),
52 // HJKL cursor
53 [2] = KEYMAP(
54 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
55 CAPS,NO, NO, NO, NO, NO, HOME,PGDN,UP, PGUP,END, NO, NO, P7, P8, P9, PMNS,
56 LCTL,VOLD,VOLU,MUTE,NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS,
57 LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS, PGUP, P1, P2, P3, PENT,
58 TRNS,LALT, SPC, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
59 ),
60 // Mousekey
61 [3] = KEYMAP(
62 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
63 CAPS,Q, W, E, R, T, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD, P7, P8, P9, PMNS,
64 LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,BTN1,NO, ENT, P4, P5, P6, PPLS,
65 LSFT,Z, X, C, V, B, BTN2,BTN1,BTN4,BTN5,NO, PGUP, P1, P2, P3, PENT,
66 NO, LALT, TRNS, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
67 ),
68 // Mousekey
69 [4] = KEYMAP(
70 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
71 CAPS,Q, W, E, R, T, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD, P7, P8, P9, PMNS,
72 LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,TRNS,NO, ENT, P4, P5, P6, PPLS,
73 LSFT,Z, X, C, V, B, BTN2,BTN1,BTN4,BTN5,NO, PGUP, P1, P2, P3, PENT,
74 NO, LALT, BTN1, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
75 ),
76};
77
78
79/*
80 * Fn action definition
81 */
82const uint16_t fn_actions[] PROGMEM = {
83 [0] = ACTION_LAYER_MOMENTARY(1),
84 [1] = ACTION_LAYER_TAP_KEY(2, KC_SLASH),
85 [2] = ACTION_LAYER_TAP_KEY(3, KC_SPACE),
86 [3] = ACTION_LAYER_TAP_KEY(4, KC_SCOLON),
87};
diff --git a/converter/m0110_usb/keymap_intl.c b/converter/m0110_usb/keymap_intl.c
deleted file mode 100644
index 6cc251a28..000000000
--- a/converter/m0110_usb/keymap_intl.c
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2Copyright 2015 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include "keycode.h"
19#include "keymap_common.h"
20
21
22
23const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
24 /* International keyboard
25 * M0110 M0120
26 * ,---------------------------------------------------------. ,---------------.
27 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *|
28 * |---------------------------------------------------------| |---------------|
29 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Ret| | 7| 8| 9| /|
30 * |------------------------------------------------------, | |---------------|
31 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| \| | | 4| 5| 6| ,|
32 * |---------------------------------------------------------| |---------------|
33 * |Shif| <| Z| X| C| V| B| N| M| ,| ,| /| | | 1| 2| 3| |
34 * `---------------------------------------------------------' |-----------|Ent|
35 * |Opt|Mac | Space |Fn | | | 0| .| |
36 * `-----------------------------------------------' `---------------'
37 */
38 [0] = KEYMAP_INTL(
39 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST,
40 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, P7, P8, P9, PMNS,
41 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, P4, P5, P6, PPLS,
42 LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, P1, P2, P3, PENT,
43 LALT,LGUI, SPC, FN0, P0, PDOT
44 ),
45 /* Cursor Layer
46 * ,---------------------------------------------------------. ,---------------.
47 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| -| +| *|
48 * |---------------------------------------------------------| |---------------|
49 * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up | |Ret| | 7| 8| 9| /|
50 * |------------------------------------------------------, | |---------------|
51 * |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Ins| | | 4| 5| 6| ,|
52 * |---------------------------------------------------------| |---------------|
53 * |Shif| <|End| |PgD| | | | |End|PgD|Dow| | | 1| 2| 3| |
54 * `---------------------------------------------------------' |-----------|Ent|
55 * |Opt|Mac | Space |Fn | | | 0| .| |
56 * `-----------------------------------------------' `---------------'
57 */
58 [1] = KEYMAP_INTL(
59 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
60 CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, ENT, P7, P8, P9, PMNS,
61 LCTL,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT,INS, P4, P5, P6, PPLS,
62 LSFT,NO, END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, P1, P2, P3, PENT,
63 LALT,LGUI, SPC, FN0, P0, PDOT
64 ),
65};
66
67
68/*
69 * Fn action definition
70 */
71const uint16_t fn_actions[] PROGMEM = {
72 [0] = ACTION_LAYER_MOMENTARY(1),
73};
diff --git a/converter/m0110_usb/keymap_spacefn.c b/converter/m0110_usb/keymap_spacefn.c
deleted file mode 100644
index 5017861a3..000000000
--- a/converter/m0110_usb/keymap_spacefn.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2Copyright 2014 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include "keycode.h"
19#include "keymap_common.h"
20
21
22const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
23 /* Default:
24 * M0110 M0120
25 * ,---------------------------------------------------------. ,---------------.
26 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *|
27 * |---------------------------------------------------------| |---------------|
28 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | 7| 8| 9| /|
29 * |---------------------------------------------------------| |---------------|
30 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| ,|
31 * |---------------------------------------------------------| |---------------|
32 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | 1| 2| 3| |
33 * `---------------------------------------------------------' |-----------|Ent|
34 * |Opt|Mac | Space |Mac |Opt| | 0| .| |
35 * `-----------------------------------------------' `---------------'
36 * M0110A
37 * ,---------------------------------------------------------. ,---------------.
38 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Nlk| =| /| *|
39 * |---------------------------------------------------------| |---------------|
40 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
41 * |-----------------------------------------------------' | |---------------|
42 * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
43 * |---------------------------------------------------------| |---------------|
44 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
45 * |---------------------------------------------------------' |-----------|Ent|
46 * |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| |
47 * `---------------------------------------------------------' `---------------'
48 */
49 [0] = KEYMAP(
50 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,PEQL,PSLS,PAST,
51 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
52 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
53 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, UP, P1, P2, P3, PENT,
54 LALT,LGUI, FN0, RGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT
55 ),
56 [1] = KEYMAP(
57 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
58 TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, P7, P8, P9, PMNS,
59 LCTL,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
60 TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, PGUP, P1, P2, P3, PENT,
61 TRNS,TRNS, TRNS, TRNS,INS, HOME,END, PGDN, P0, PDOT
62 ),
63};
64
65/*
66 * Fn action definition
67 */
68const uint16_t fn_actions[] PROGMEM = {
69 [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
70 [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
71};
diff --git a/converter/m0110_usb/led.c b/converter/m0110_usb/led.c
deleted file mode 100644
index 3822a131b..000000000
--- a/converter/m0110_usb/led.c
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <avr/io.h>
20#include "led.h"
21
22
23void led_set(uint8_t usb_led)
24{
25 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
26 DDRD |= (1<<6);
27 PORTD |= (1<<6);
28 } else {
29 DDRD |= (1<<6);
30 PORTD &= ~(1<<6);
31 }
32}
diff --git a/converter/m0110_usb/matrix.c b/converter/m0110_usb/matrix.c
deleted file mode 100644
index 2189c0b56..000000000
--- a/converter/m0110_usb/matrix.c
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/*
19 * scan matrix
20 */
21#include <stdint.h>
22#include <stdbool.h>
23#include <avr/io.h>
24#include <util/delay.h>
25#include "print.h"
26#include "util.h"
27#include "debug.h"
28#include "host.h"
29#include "led.h"
30#include "m0110.h"
31#include "matrix.h"
32
33
34#define CAPS 0x39
35#define CAPS_BREAK (CAPS | 0x80)
36#define ROW(key) ((key)>>3&0x0F)
37#define COL(key) ((key)&0x07)
38
39
40static bool is_modified = false;
41
42// matrix state buffer(1:on, 0:off)
43static uint8_t *matrix;
44static uint8_t _matrix0[MATRIX_ROWS];
45
46static void register_key(uint8_t key);
47
48
49inline
50uint8_t matrix_rows(void)
51{
52 return MATRIX_ROWS;
53}
54
55inline
56uint8_t matrix_cols(void)
57{
58 return MATRIX_COLS;
59}
60
61void matrix_init(void)
62{
63 m0110_init();
64 // initialize matrix state: all keys off
65 for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00;
66 matrix = _matrix0;
67 return;
68}
69
70uint8_t matrix_scan(void)
71{
72 uint8_t key;
73
74 is_modified = false;
75 key = m0110_recv_key();
76
77 if (key == M0110_NULL) {
78 return 0;
79 } else if (key == M0110_ERROR) {
80 return 0;
81 } else {
82 is_modified = true;
83 register_key(key);
84 }
85
86 if (debug_enable) {
87 print("["); phex(key); print("]\n");
88 }
89 return 1;
90}
91
92bool matrix_is_modified(void)
93{
94 return is_modified;
95}
96
97inline
98bool matrix_has_ghost(void)
99{
100 return false;
101}
102
103inline
104bool matrix_is_on(uint8_t row, uint8_t col)
105{
106 return (matrix[row] & (1<<col));
107}
108
109inline
110uint8_t matrix_get_row(uint8_t row)
111{
112 return matrix[row];
113}
114
115void matrix_print(void)
116{
117 print("\nr/c 01234567\n");
118 for (uint8_t row = 0; row < matrix_rows(); row++) {
119 phex(row); print(": ");
120 pbin_reverse(matrix_get_row(row));
121 print("\n");
122 }
123}
124
125uint8_t matrix_key_count(void)
126{
127 uint8_t count = 0;
128 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
129 count += bitpop(matrix[i]);
130 }
131 return count;
132}
133
134inline
135static void register_key(uint8_t key)
136{
137 if (key&0x80) {
138 matrix[ROW(key)] &= ~(1<<COL(key));
139 } else {
140 matrix[ROW(key)] |= (1<<COL(key));
141 }
142}
diff --git a/converter/news_usb/Makefile.pjrc b/converter/news_usb/Makefile.pjrc
deleted file mode 100644
index 80cadcc73..000000000
--- a/converter/news_usb/Makefile.pjrc
+++ /dev/null
@@ -1,74 +0,0 @@
1#
2# Makefile for PJRC Teensy
3#
4
5
6# Target file name (without extension).
7TARGET = news_usb_pjrc
8
9# Directory common source filess exist
10TMK_DIR = ../../tmk_core
11
12# Directory keyboard dependent files exist
13TARGET_DIR = .
14
15# keyboard dependent files
16SRC = keymap.c \
17 matrix.c \
18 led.c \
19 news.c
20
21CONFIG_H = config_pjrc.h
22
23
24# MCU name, you MUST set this to match the board you are using
25# type "make clean" after changing this, so all files will be rebuilt
26#MCU = at90usb162 # Teensy 1.0
27MCU = atmega32u4 # Teensy 2.0
28#MCU = at90usb646 # Teensy++ 1.0
29#MCU = at90usb1286 # Teensy++ 2.0
30
31
32# Processor frequency.
33# Normally the first thing your program should do is set the clock prescaler,
34# so your program will run at the correct speed. You should also set this
35# variable to same clock speed. The _delay_ms() macro uses this, and many
36# examples use this variable to calculate timings. Do not add a "UL" here.
37F_CPU = 16000000
38
39
40# Boot Section Size in *bytes*
41# Teensy halfKay 512
42# Teensy++ halfKay 1024
43# Atmel DFU loader 4096
44# LUFA bootloader 4096
45# USBaspLoader 2048
46OPT_DEFS += -DBOOTLOADER_SIZE=4096
47
48
49# Build Options
50# *Comment out* to disable the options.
51#
52BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
53MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
54EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
55CONSOLE_ENABLE = yes # Console for debug
56COMMAND_ENABLE = yes # Commands for debug and configuration
57#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
58NKRO_ENABLE = yes # USB Nkey Rollover(+500)
59
60
61
62#---------------- Programming Options --------------------------
63PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
64
65
66# Search Path
67VPATH += $(TARGET_DIR)
68VPATH += $(TMK_DIR)
69
70
71include $(TMK_DIR)/protocol/pjrc.mk
72include $(TMK_DIR)/protocol.mk
73include $(TMK_DIR)/common.mk
74include $(TMK_DIR)/rules.mk
diff --git a/converter/news_usb/config_pjrc.h b/converter/news_usb/config_pjrc.h
deleted file mode 100644
index adce014c9..000000000
--- a/converter/news_usb/config_pjrc.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21
22#define VENDOR_ID 0xFEED
23#define PRODUCT_ID 0x5021
24#define MANUFACTURER t.m.k.
25#define PRODUCT SONY NEWS keyboard converter
26#define DESCRIPTION converts SONY NEWS protocol into USB
27
28
29/* matrix size */
30#define MATRIX_ROWS 16 // keycode bit: 3-0
31#define MATRIX_COLS 8 // keycode bit: 6-4
32
33
34/* legacy keymap support */
35#define USE_LEGACY_KEYMAP
36
37
38/* key combination for command */
39#define IS_COMMAND() ( \
40 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
41 keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
42)
43
44
45/* Asynchronous USART
46 * 8-data bit, non parity, 1-stop bit, no flow control
47 */
48#ifdef __AVR_ATmega32U4__
49# define NEWS_KBD_RX_VECT USART1_RX_vect
50# define NEWS_KBD_RX_DATA UDR1
51# define NEWS_KBD_RX_BAUD 9600
52# define NEWS_KBD_RX_UBBR ((F_CPU/(16UL*NEWS_KBD_RX_BAUD))-1)
53# define NEWS_KBD_RX_INIT() do { \
54 UBRR1L = (uint8_t) NEWS_KBD_RX_UBBR; \
55 UBRR1H = (uint8_t) (NEWS_KBD_RX_UBBR>>8); \
56 UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); \
57 } while(0)
58#else
59# error "USART configuration is needed."
60#endif
61
62#endif
diff --git a/converter/news_usb/keymap.c b/converter/news_usb/keymap.c
deleted file mode 100644
index 058f2914b..000000000
--- a/converter/news_usb/keymap.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/pgmspace.h>
21#include "keycode.h"
22#include "util.h"
23#include "keymap.h"
24
25
26
27
28// Following macros help you to define a keymap with the form of actual keyboard layout.
29
30/* SONY NEWS NWP-5461 */
31#define KEYMAP( \
32 K7A, K01,K02,K03,K04,K05, K06,K07,K08,K09,K0A, K68,K69, K64,K65,K52, \
33 K0B,K0C,K0D,K0E,K0F,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19, K6A, K4B,K4C,K4D,K4E, \
34 K1A,K1B,K1C,K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27, K6B, K4F,K50,K51,K56, \
35 K28,K29,K2A,K2B,K2C,K2D,K2E,K2F,K30,K31,K32,K33,K34, K35, K6C, K53,K54,K55,K5A, \
36 K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K42, K6D, K57,K59,K58, \
37 K43,K44,K45, K46, K47, K48,K49,K4A, K6E, K66,K5B,K5C,K5D \
38) { \
39 { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
40 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
41 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
42 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
43 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
44 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
45 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
46 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
47 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
48 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
49 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
50 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_NO, KC_NO }, \
51 { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K64, KC_##K65, KC_##K66, KC_NO }, \
52 { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_NO }, \
53 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
54 { KC_NO, KC_NO, KC_##K7A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
55}
56
57
58// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
59static const uint8_t PROGMEM fn_layer[] = {
60 0, // Fn0
61 0, // Fn1
62 0, // Fn2
63 0, // Fn3
64 0, // Fn4
65 0, // Fn5
66 0, // Fn6
67 0 // Fn7
68};
69
70// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
71// See layer.c for details.
72static const uint8_t PROGMEM fn_keycode[] = {
73 KC_NO, // Fn0
74 KC_NO, // Fn1
75 KC_NO, // Fn2
76 KC_NO, // Fn3
77 KC_NO, // Fn4
78 KC_NO, // Fn5
79 KC_NO, // Fn6
80 KC_NO // Fn7
81};
82
83
84static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
85 /* 0: default
86 * ,---. ,------------------------, ,------------------------. ,---------.
87 * |Pow| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| ,-----------.
88 * `---' `------------------------' `------------------------' `---------' | *| /| +|
89 * ,-------------------------------------------------------------. ,---. ,---------------|
90 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| BS | |Hlp| | 7| 8| 9| -|
91 * |-------------------------------------------------------------| |---| |---------------|
92 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Del| | |Ins| | 4| 5| 6| ,|
93 * |---------------------------------------------------------' | |---| |---------------|
94 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `|Return| |Clr| | 1| 2| 3| |
95 * |-------------------------------------------------------------| |---| |-----------|Ent|
96 * |Shift | Z| X| C| V| B| N| M| ,| ,| /| |Shift | |PgU| | 0| .| Up| |
97 * |-------------------------------------------------------------| |---| |---------------|
98 * |Alt |Gui |Alt | Space | |Gui|App|Ctrl | |PgD| |Tab|Lef|Dow|Rig|
99 * `-------------------------------------------------------------' `---' `---------------'
100 */
101 KEYMAP(
102 PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PAST,PSLS,PPLS,
103 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, HELP, P7, P8, P9, PMNS,
104 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,DEL, INS, P4, P5, P6, PCMM,
105 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, CLR, P1, P2, P3, PENT,
106 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, RSFT, PGUP, P0, PDOT,UP,
107 LALT,CAPS,LALT, SPC, ERAS, RALT,RGUI,RCTL, PGDN, TAB, LEFT,DOWN,RGHT
108 ),
109};
110
111
112uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
113{
114 return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
115}
116
117uint8_t keymap_fn_layer(uint8_t index)
118{
119 return pgm_read_byte(&fn_layer[index]);
120}
121
122uint8_t keymap_fn_keycode(uint8_t index)
123{
124 return pgm_read_byte(&fn_keycode[index]);
125}
diff --git a/converter/news_usb/led.c b/converter/news_usb/led.c
deleted file mode 100644
index 51e601318..000000000
--- a/converter/news_usb/led.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "stdint.h"
19#include "news.h"
20#include "led.h"
21
22
23void led_set(uint8_t usb_led)
24{
25 // not supported now
26}
diff --git a/converter/news_usb/matrix.c b/converter/news_usb/matrix.c
deleted file mode 100644
index f0d5b5863..000000000
--- a/converter/news_usb/matrix.c
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/io.h>
21#include <util/delay.h>
22#include "print.h"
23#include "util.h"
24#include "news.h"
25#include "matrix.h"
26#include "debug.h"
27
28
29/*
30 * Matrix Array usage:
31 *
32 * ROW: 16
33 * COL:8
34 *
35 * 8bit wide
36 * +---------+
37 * 0|00 ... 07|
38 * 1|08 ... 0F|
39 * :| ... |
40 * :| ... |
41 * E|70 ... 77|
42 * F|78 ... 7F|
43 * +---------+
44 *
45 */
46static uint8_t matrix[MATRIX_ROWS];
47#define ROW(code) ((code>>3)&0xF)
48#define COL(code) (code&0x07)
49
50static bool is_modified = false;
51
52
53inline
54uint8_t matrix_rows(void)
55{
56 return MATRIX_ROWS;
57}
58
59inline
60uint8_t matrix_cols(void)
61{
62 return MATRIX_COLS;
63}
64
65void matrix_init(void)
66{
67 news_init();
68
69 // initialize matrix state: all keys off
70 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
71
72 return;
73}
74
75uint8_t matrix_scan(void)
76{
77 is_modified = false;
78
79 uint8_t code;
80 code = news_recv();
81 if (code == 0) {
82 return 0;
83 }
84
85 phex(code); print(" ");
86 if (code&0x80) {
87 // break code
88 if (matrix_is_on(ROW(code), COL(code))) {
89 matrix[ROW(code)] &= ~(1<<COL(code));
90 is_modified = true;
91 }
92 } else {
93 // make code
94 if (!matrix_is_on(ROW(code), COL(code))) {
95 matrix[ROW(code)] |= (1<<COL(code));
96 is_modified = true;
97 }
98 }
99 return code;
100}
101
102bool matrix_is_modified(void)
103{
104 return is_modified;
105}
106
107inline
108bool matrix_has_ghost(void)
109{
110 return false;
111}
112
113inline
114bool matrix_is_on(uint8_t row, uint8_t col)
115{
116 return (matrix[row] & (1<<col));
117}
118
119inline
120uint8_t matrix_get_row(uint8_t row)
121{
122 return matrix[row];
123}
124
125void matrix_print(void)
126{
127 print("\nr/c 01234567\n");
128 for (uint8_t row = 0; row < matrix_rows(); row++) {
129 phex(row); print(": ");
130 pbin_reverse(matrix_get_row(row));
131 print("\n");
132 }
133}
134
135uint8_t matrix_key_count(void)
136{
137 uint8_t count = 0;
138 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
139 count += bitpop(matrix[i]);
140 }
141 return count;
142}
diff --git a/converter/next_usb/Makefile b/converter/next_usb/Makefile
deleted file mode 100644
index 7190f1eaf..000000000
--- a/converter/next_usb/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
1# Target file name (without extension).
2TARGET = next_usb
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap.c \
12 matrix.c \
13 led.c
14
15CONFIG_H = config.h
16
17# MCU name, you MUST set this to match the board you are using
18# type "make clean" after changing this, so all files will be rebuilt
19#MCU = at90usb162 # Teensy 1.0
20#MCU = atmega32u4 # Teensy 2.0
21#MCU = at90usb646 # Teensy++ 1.0
22#MCU = at90usb1286 # Teensy++ 2.0
23MCU = atmega32u2 # TMK converter
24
25
26# Processor frequency.
27# Normally the first thing your program should do is set the clock prescaler,
28# so your program will run at the correct speed. You should also set this
29# variable to same clock speed. The _delay_ms() macro uses this, and many
30# examples use this variable to calculate timings. Do not add a "UL" here.
31F_CPU = 16000000
32
33
34#
35# LUFA specific
36#
37# Target architecture (see library "Board Types" documentation).
38ARCH = AVR8
39
40# Input clock frequency.
41# This will define a symbol, F_USB, in all source code files equal to the
42# input clock frequency (before any prescaling is performed) in Hz. This value may
43# differ from F_CPU if prescaling is used on the latter, and is required as the
44# raw input clock is fed directly to the PLL sections of the AVR for high speed
45# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
46# at the end, this will be done automatically to create a 32-bit value in your
47# source code.
48#
49# If no clock division is performed on the input clock inside the AVR (via the
50# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
51F_USB = $(F_CPU)
52
53# Interrupt driven control endpoint task(+60)
54#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
55
56
57# Boot Section Size in *bytes*
58# Teensy halfKay 512
59# Teensy++ halfKay 1024
60# Atmel DFU loader 4096
61# LUFA bootloader 4096
62# USBaspLoader 2048
63OPT_DEFS += -DBOOTLOADER_SIZE=4096
64
65
66# Build Options
67# *Comment out* to disable the options.
68#
69#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
70MOUSEKEY_ENABLE = yes # Mouse keys
71EXTRAKEY_ENABLE = yes # Audio control and System control
72CONSOLE_ENABLE = yes # Console for debug(+400)
73COMMAND_ENABLE = yes # Commands for debug and configuration
74#NKRO_ENABLE = yes # USB Nkey Rollover
75
76SRC += next_kbd.c
77
78
79# Search Path
80VPATH += $(TARGET_DIR)
81VPATH += $(TMK_DIR)
82
83
84include $(TMK_DIR)/protocol.mk
85include $(TMK_DIR)/protocol/lufa.mk
86include $(TMK_DIR)/common.mk
87include $(TMK_DIR)/rules.mk
diff --git a/converter/next_usb/Makefile.pjrc b/converter/next_usb/Makefile.pjrc
deleted file mode 100644
index 5813c9d6d..000000000
--- a/converter/next_usb/Makefile.pjrc
+++ /dev/null
@@ -1,63 +0,0 @@
1# Target file name (without extension).
2TARGET = next_usb
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap.c \
12 matrix.c \
13 led.c
14
15CONFIG_H = config.h
16
17# MCU name, you MUST set this to match the board you are using
18# type "make clean" after changing this, so all files will be rebuilt
19#MCU = at90usb162 # Teensy 1.0
20MCU = atmega32u4 # Teensy 2.0
21#MCU = at90usb646 # Teensy++ 1.0
22#MCU = at90usb1286 # Teensy++ 2.0
23
24
25# Processor frequency.
26# Normally the first thing your program should do is set the clock prescaler,
27# so your program will run at the correct speed. You should also set this
28# variable to same clock speed. The _delay_ms() macro uses this, and many
29# examples use this variable to calculate timings. Do not add a "UL" here.
30F_CPU = 16000000
31
32
33# Boot Section Size in *bytes*
34# Teensy halfKay 512
35# Teensy++ halfKay 1024
36# Atmel DFU loader 4096
37# LUFA bootloader 4096
38# USBaspLoader 2048
39OPT_DEFS += -DBOOTLOADER_SIZE=4096
40
41
42# Build Options
43# *Comment out* to disable the options.
44#
45#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
46MOUSEKEY_ENABLE = yes # Mouse keys
47EXTRAKEY_ENABLE = yes # Audio control and System control
48CONSOLE_ENABLE = yes # Console for debug(+400)
49COMMAND_ENABLE = yes # Commands for debug and configuration
50#NKRO_ENABLE = yes # USB Nkey Rollover
51
52SRC += next_kbd.c
53
54
55# Search Path
56VPATH += $(TARGET_DIR)
57VPATH += $(TMK_DIR)
58
59
60include $(TMK_DIR)/protocol.mk
61include $(TMK_DIR)/protocol/pjrc.mk
62include $(TMK_DIR)/common.mk
63include $(TMK_DIR)/rules.mk
diff --git a/converter/next_usb/README b/converter/next_usb/README
deleted file mode 100644
index 07ac89de3..000000000
--- a/converter/next_usb/README
+++ /dev/null
@@ -1,45 +0,0 @@
1NeXT non-ADB Keyboard Converter
2-------------------------------
3
4Cable connector inside keyboard case:
5+-----+
6|Black|\
7|Green|-\
8|Yello|--\-------- to computer via Mini-Din 5a Connector
9|Orang|--/--------
10|Red |-/
11|Brown|/
12+-----+
13
14Black - Ground to outer metal part of Mini Din 5a connector (not used)
15Green - Ground
16Yellow - Power button signal
17Orange - Keyboard Out
18Red - Keyboard In
19Brown - Vcc
20
21ATmega32u4 connections (pinout provided for Arduino Pro Micro):
22
23Keyboard out (orange) : PD0 (pin 3)
24Keyboard in (red) : PD1 (pin 2)
25Power Button (yellow) : PD4 (pin 4)
26Ground (black) : GND
27Vcc (brown) : VCC
28
29See attached next_timings.jpg file for a detailed illustration of NeXT keyboard protocol timings.
30
31Power button signal line is normally high when the keyboard is powered/initialized. It is pulled to ground when pressed. The converter automatically translates this to a "normal" keypress with code 0x5A. This connection is technically optional, the only side effect of not making this connection is the power key will do nothing.
32
33Converter is based heavily on Ladyada's original "USB NeXT Keyboard with Arduino Micro" tutorial (http://learn.adafruit.com/usb-next-keyboard-with-arduino-micro/overview). If you build this converter, show Adafruit some love and do it using an Arduino Micro (http://www.adafruit.com/products/1315) or their ATmega 32u4 Breakout Board (http://www.adafruit.com/products/296). Arduino Micro should work fine using the Arduino Pro Micro configuration above, same pins numbers and everything.
34
35TODO:
36-----
37
38I believe it might be possible to run the keyboard off of 3V; during testing I observed that the keyboard could sometimes function even without Vcc connected as long as the ground connection was good and the Keyboard In line was connected. If that works it should be easy to do a Bluetooth conversion and run the keyboard right off of a LiPo battery without a boost circuit
39
40Utilize second LED as status indicator for good initialization; also try to make hot plugging much more robust.
41
42Figure a better use for the Power button. Too easy to hit it by mistake to use for Suspend or Power Off - maybe move cap to different part of the board and consider that
43
44Figure out a better use for the lock LEDs. Right now they just light up when you press shift. Lame. Maybe implement proper Caps/Num/Scroll Locks
45
diff --git a/converter/next_usb/config.h b/converter/next_usb/config.h
deleted file mode 100644
index a06affc5e..000000000
--- a/converter/next_usb/config.h
+++ /dev/null
@@ -1,190 +0,0 @@
1/*
2NeXT non-ADB Keyboard USB Converter
3
4Copyright 2013, Benjamin Gould (bgould@github.com)
5
6Based on:
7TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
8Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
9
10Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
11Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
12Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
13
14This software is licensed with a Modified BSD License.
15All of this is supposed to be Free Software, Open Source, DFSG-free,
16GPL-compatible, and OK to use in both free and proprietary applications.
17Additions and corrections to this file are welcome.
18
19Redistribution and use in source and binary forms, with or without
20modification, are permitted provided that the following conditions are met:
21
22* Redistributions of source code must retain the above copyright
23 notice, this list of conditions and the following disclaimer.
24
25* Redistributions in binary form must reproduce the above copyright
26 notice, this list of conditions and the following disclaimer in
27 the documentation and/or other materials provided with the
28 distribution.
29
30* Neither the name of the copyright holders nor the names of
31 contributors may be used to endorse or promote products derived
32 from this software without specific prior written permission.
33
34THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
38LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44POSSIBILITY OF SUCH DAMAGE.
45
46*/
47
48#define VENDOR_ID 0xFEED
49#define PRODUCT_ID 0xBCBC
50#define DEVICE_VER 0x0500
51#define MANUFACTURER t.m.k.
52#define PRODUCT NeXT Keyboard to USB converter
53#define DESCRIPTION USB converter for NeXT non-ADB Keyboard
54
55/* matrix size */
56#define MATRIX_ROWS 12 // keycode bit: 3-0
57#define MATRIX_COLS 8 // keycode bit: 6-4
58
59#define DEBUG_ON_INIT 1
60
61//#define TEENSY_CONFIG 1
62//#define PRO_MICRO_CONFIG 1
63#define TMK_CONFIG 1
64
65// comment out if you don't want the keyboard's LEDs to flash upon initialization or pressing shift
66//#define NEXT_KBD_INIT_FLASH_LEDS
67//#define NEXT_KBD_SHIFT_FLASH_LEDS
68
69//============= Start of Arduino Pro Micro Configuration ==============
70#ifdef PRO_MICRO_CONFIG
71
72// this is the debugging LED that flashes when a key is being pressed
73// comment out in order to disable debugging LED
74#define NEXT_KBD_LED1_PORT PORTD
75#define NEXT_KBD_LED1_PIN PIND
76#define NEXT_KBD_LED1_DDR DDRD
77#define NEXT_KBD_LED1_BIT 5
78
79#define NEXT_KBD_LED1_ON NEXT_KBD_LED1_PORT &= ~(1<<NEXT_KBD_LED1_BIT);
80#define NEXT_KBD_LED1_OFF NEXT_KBD_LED1_PORT |= (1<<NEXT_KBD_LED1_BIT);
81
82// reserved for future use
83#define NEXT_KBD_LED2_PORT PORTB
84#define NEXT_KBD_LED2_PIN PINB
85#define NEXT_KBD_LED2_DDR DDRB
86#define NEXT_KBD_LED2_BIT 6
87
88#define NEXT_KBD_LED2_ON NEXT_KBD_LED2_PORT &= ~(1<<NEXT_KBD_LED2_BIT);
89#define NEXT_KBD_LED2_OFF NEXT_KBD_LED2_PORT |= (1<<NEXT_KBD_LED2_BIT);
90
91// corresponds to the Keyboard In wire on the NeXT connector
92// (red wire in NeXT connector) - pin 2 on the Pro Micro
93#define NEXT_KBD_OUT_PORT PORTD
94#define NEXT_KBD_OUT_PIN PIND
95#define NEXT_KBD_OUT_DDR DDRD
96#define NEXT_KBD_OUT_BIT 1
97
98// corresponds to the Keyboard Out wire on the NeXT connector
99// (orange wire in NeXT connector) - pin 3 on the Pro Micro
100#define NEXT_KBD_IN_PORT PORTD
101#define NEXT_KBD_IN_PIN PIND
102#define NEXT_KBD_IN_DDR DDRD
103#define NEXT_KBD_IN_BIT 0
104
105// this pin is an input for the power key on the NeXT keyboard
106// as the keyboard is powered on this should be normally high;
107// if it is pulled low it means the power button is being preseed
108// (yellow wire in NeXT connector) - pin 4 on the Pro Micro
109#define NEXT_KBD_PWR_PORT PORTD
110#define NEXT_KBD_PWR_PIN PIND
111#define NEXT_KBD_PWR_DDR DDRD
112#define NEXT_KBD_PWR_BIT 4
113
114#endif
115//============== End of Arduino Pro Micro Configuration ===============
116
117
118//================ Start of Teensy 2.0 Configuration =================
119#ifdef TEENSY_CONFIG
120
121// this is the debugging LED that flashes when a key is being pressed
122// comment out in order to disable debugging LED
123#define NEXT_KBD_LED_PORT PORTD
124#define NEXT_KBD_LED_PIN PIND
125#define NEXT_KBD_LED_DDR DDRD
126#define NEXT_KBD_LED_BIT 6
127
128#define NEXT_KBD_LED_ON NEXT_KBD_LED_PORT |= (1<<NEXT_KBD_LED_BIT);
129#define NEXT_KBD_LED_OFF NEXT_KBD_LED_PORT &= ~(1<<NEXT_KBD_LED_BIT);
130
131// corresponds to the Keyboard In wire on the NeXT connector
132// (red wire in NeXT connector)
133#define NEXT_KBD_OUT_PORT PORTB
134#define NEXT_KBD_OUT_PIN PINB
135#define NEXT_KBD_OUT_DDR DDRB
136#define NEXT_KBD_OUT_BIT 1
137
138// corresponds to the Keyboard Out wire on the NeXT connector
139// (orange wire in NeXT connector)
140#define NEXT_KBD_IN_PORT PORTB
141#define NEXT_KBD_IN_PIN PINB
142#define NEXT_KBD_IN_DDR DDRB
143#define NEXT_KBD_IN_BIT 0
144
145#endif
146//================= End of Teensy 2.0 Configuration ==================
147
148
149//================ Start of TMK converter Configuration =================
150#ifdef TMK_CONFIG
151
152// this is the debugging LED that flashes when a key is being pressed
153// comment out in order to disable debugging LED
154#define NEXT_KBD_LED1_PORT PORTD
155#define NEXT_KBD_LED1_PIN PIND
156#define NEXT_KBD_LED1_DDR DDRD
157#define NEXT_KBD_LED1_BIT 6
158
159#define NEXT_KBD_LED1_ON NEXT_KBD_LED1_PORT |= (1<<NEXT_KBD_LED1_BIT);
160#define NEXT_KBD_LED1_OFF NEXT_KBD_LED1_PORT &= ~(1<<NEXT_KBD_LED1_BIT);
161
162// corresponds to the Keyboard In wire on the NeXT connector
163#define NEXT_KBD_OUT_PORT PORTD
164#define NEXT_KBD_OUT_PIN PIND
165#define NEXT_KBD_OUT_DDR DDRD
166#define NEXT_KBD_OUT_BIT 1
167
168// corresponds to the Keyboard Out wire on the NeXT connector
169#define NEXT_KBD_IN_PORT PORTD
170#define NEXT_KBD_IN_PIN PIND
171#define NEXT_KBD_IN_DDR DDRD
172#define NEXT_KBD_IN_BIT 0
173
174// this pin is an input for the power key on the NeXT keyboard
175// as the keyboard is powered on this should be normally high;
176// if it is pulled low it means the power button is being preseed
177#define NEXT_KBD_PWR_PORT PORTD
178#define NEXT_KBD_PWR_PIN PIND
179#define NEXT_KBD_PWR_DDR DDRD
180#define NEXT_KBD_PWR_BIT 4
181
182#endif
183//================= End of TMK converter Configuration ==================
184
185/* key combination for command */
186#define IS_COMMAND() ( \
187 (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \
188 (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RALT))) || \
189 (keyboard_report->mods == (MOD_BIT(KC_RGUI) | MOD_BIT(KC_RGUI))) \
190)
diff --git a/converter/next_usb/keymap.c b/converter/next_usb/keymap.c
deleted file mode 100644
index 0041df543..000000000
--- a/converter/next_usb/keymap.c
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2NeXT non-ADB Keyboard USB Converter
3
4Copyright 2013, Benjamin Gould (bgould@github.com)
5
6Based on:
7---------
8* TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
9* Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/) \
10 released under BSD license \
11 https://github.com/adafruit/USB-NeXT-Keyboard
12
13Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
14Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
15Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
16
17This software is licensed with a Modified BSD License.
18All of this is supposed to be Free Software, Open Source, DFSG-free,
19GPL-compatible, and OK to use in both free and proprietary applications.
20Additions and corrections to this file are welcome.
21
22Redistribution and use in source and binary forms, with or without
23modification, are permitted provided that the following conditions are met:
24
25* Redistributions of source code must retain the above copyright
26 notice, this list of conditions and the following disclaimer.
27
28* Redistributions in binary form must reproduce the above copyright
29 notice, this list of conditions and the following disclaimer in
30 the documentation and/or other materials provided with the
31 distribution.
32
33* Neither the name of the copyright holders nor the names of
34 contributors may be used to endorse or promote products derived
35 from this software without specific prior written permission.
36
37THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
41LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
43SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
44INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
45CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
47POSSIBILITY OF SUCH DAMAGE.
48
49*/
50
51#include <stdint.h>
52#include <stdbool.h>
53#include <avr/pgmspace.h>
54#include "keycode.h"
55#include "print.h"
56#include "debug.h"
57#include "util.h"
58#include "keymap.h"
59#include "keycode.h"
60
61// 32*8(256) byte array which converts PS/2 code into USB code
62static const uint16_t PROGMEM fn_actions[] = {
63 ACTION_LAYER_MOMENTARY(1), // FN0 - left command key
64 ACTION_LAYER_MOMENTARY(1), // FN1 - right command key
65 ACTION_KEY(KC_BSLS), // FN2 - number pad slash & backslash
66 ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), // FN3 - number pad equals & pipe
67 ACTION_MODS_KEY(MOD_LCTL, KC_Z), // FN4 - cmd+undo on layer 1
68 ACTION_MODS_KEY(MOD_LCTL, KC_X), // FN5 - cmd+cut on layer 1
69 ACTION_MODS_KEY(MOD_LCTL, KC_C), // FN6 - cmd+copy on layer 1
70 ACTION_MODS_KEY(MOD_LCTL, KC_V), // FN7 - cmd+paste on layer 1
71};
72
73/* This is the physical layout that I am starting with:
74 * Note: there is some strangeness on the number pad;
75 * the equal sign shifts to pipe and forward slash shifts to backslash
76 * ,-----------------------------------------------------------. ,-----------. ,---------------.
77 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS | |VUp|Pwr|BrU| |` | =| /| *|
78 * |-----------------------------------------------------------| |-----------| |---------------|
79 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |VDn| |BrD| | 7| 8| 9| -|
80 * |------------------------------------------------------ | `---' `---' |-----------|---|
81 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
82 * |-----------------------------------------------------------| ,---. |---------------|
83 * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
84 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
85 * |Alt |Cmd | Space |Cmd |Alt | |Lef|Dow|Rig| | 0| .| |
86 * `-----------------------------------------------------------' `-----------' `---------------'
87 *
88 * Keymap array:
89 * 8 bytes
90 * +---------+
91 * 0| |
92 * :| | 0x00-0x87
93 * ;| |
94 * 11| |
95 * +---------+
96 */
97#define KEYMAP( \
98 K49,K4A,K4B,K4C,K4D,K50,K4F,K4E,K1E,K1F,K20,K1D,K1C,K1B, K1A,K58,K19, K26,K27,K28,K25, \
99 K41,K42,K43,K44,K45,K48,K47,K46,K06,K07,K08,K05,K04,K03, K02, K01, K21,K22,K23,K24, \
100 K57,K39,K3A,K3B,K3C,K3D,K40,K3F,K3E,K2D,K2C,K2B, K2A, K12,K18,K13,K15, \
101 K56, K31,K32,K33,K34,K35,K37,K36,K2E,K2F,K30, K55, K16, K11,K17,K14, \
102 K52,K54, K38, K53,K51, K09,K0F,K10, K0B, K0C,K0D \
103) { \
104 { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
105 { KC_##K08, KC_##K09, KC_##K10, KC_##K0B, KC_##K0C, KC_##K0D, KC_NO, KC_##K0F }, \
106 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
107 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
108 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
109 { KC_##K28, KC_NO, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
110 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
111 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
112 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
113 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
114 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
115 { KC_##K58, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
116}
117
118
119static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
120
121 /* Layer 0: default
122 * ,-----------------------------------------------------------. ,-----------. ,---------------.
123 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS | |Ins|Ref|Hom| |` | =| /| *|
124 * |-----------------------------------------------------------| |-----------| |---------------|
125 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |Del| |End| | 7| 8| 9| -|
126 * |-----------------------------------------------------' | `---' `---' |-----------|---|
127 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
128 * |-----------------------------------------------------------| ,---. |---------------|
129 * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
130 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
131 * |Fn0 |Alt | Space |LGui |Fn1 | |Lef|Dow|Rig| | 0| .| |
132 * `-----------------------------------------------------------' `-----------' `---------------'
133 */
134 KEYMAP(
135 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, WREF,HOME, GRV, FN3, FN2, PAST,
136 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,NO, DEL, END, P7, P8, P9, PMNS,
137 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
138 LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
139 FN0, LALT, SPC, LGUI,FN1, LEFT,DOWN,RGHT, P0, PDOT,PENT
140
141 ),
142
143 /* Layer 1: extra keys
144 * ,-----------------------------------------------------------. ,-----------. ,---------------.
145 * |Grv| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| BS | |VUp|VMu|PgU| |` | =| /| *|
146 * |-----------------------------------------------------------| |-----------| |---------------|
147 * |Tab |Pau| W| E| R| T| Y| U| I| O|PSc| \| ]| | |VDn| |PgD| | 7| 8| 9| -|
148 * |-----------------------------------------------------' | `---' `---' |-----------|---|
149 * |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
150 * |-----------------------------------------------------------| ,---. |---------------|
151 * |Shift |UND|CUT|COP|PST| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
152 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
153 * |Fn0 |Alt | Space |RGui |Fn1 | |Lef|Dow|Rig| | 0| .| |
154 * `-----------------------------------------------------------' `-----------' `---------------'
155 */
156 KEYMAP(
157
158 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, VOLU,MUTE,PGUP, TRNS,TRNS,TRNS,TRNS,
159 TRNS,PAUS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,FN3, BSLS,TRNS, VOLD, PGDN, BTN1,MS_U,BTN2,WH_U,
160 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, MS_L,MS_D,MS_R,WH_D,
161 TRNS, FN4, FN5, FN6, FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,
162 TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS
163
164 )
165};
166
167/* translates key to keycode */
168uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
169{
170 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
171}
172
173/* translates Fn keycode to action */
174action_t keymap_fn_to_action(uint8_t keycode)
175{
176 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
177}
diff --git a/converter/next_usb/led.c b/converter/next_usb/led.c
deleted file mode 100644
index 2bd0ef6dd..000000000
--- a/converter/next_usb/led.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2NeXT non-ADB Keyboard USB Converter
3
4Copyright 2013, Benjamin Gould (bgould@github.com)
5
6Based on:
7TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
8Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
9
10Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
11Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
12Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
13
14This software is licensed with a Modified BSD License.
15All of this is supposed to be Free Software, Open Source, DFSG-free,
16GPL-compatible, and OK to use in both free and proprietary applications.
17Additions and corrections to this file are welcome.
18
19Redistribution and use in source and binary forms, with or without
20modification, are permitted provided that the following conditions are met:
21
22* Redistributions of source code must retain the above copyright
23 notice, this list of conditions and the following disclaimer.
24
25* Redistributions in binary form must reproduce the above copyright
26 notice, this list of conditions and the following disclaimer in
27 the documentation and/or other materials provided with the
28 distribution.
29
30* Neither the name of the copyright holders nor the names of
31 contributors may be used to endorse or promote products derived
32 from this software without specific prior written permission.
33
34THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
38LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44POSSIBILITY OF SUCH DAMAGE.
45
46*/
47
48#include "stdint.h"
49#include "led.h"
50#include "next_kbd.h"
51
52
53void led_set(uint8_t usb_led)
54{
55 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
56 next_kbd_set_leds(true, true);
57 } else {
58 next_kbd_set_leds(false, false);
59 }
60}
diff --git a/converter/next_usb/matrix.c b/converter/next_usb/matrix.c
deleted file mode 100644
index d91cd2577..000000000
--- a/converter/next_usb/matrix.c
+++ /dev/null
@@ -1,271 +0,0 @@
1/*
2NeXT non-ADB Keyboard USB Converter
3
4Copyright 2013, Benjamin Gould (bgould@github.com)
5
6Based on:
7TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
8Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
9
10Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
11Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
12Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
13
14This software is licensed with a Modified BSD License.
15All of this is supposed to be Free Software, Open Source, DFSG-free,
16GPL-compatible, and OK to use in both free and proprietary applications.
17Additions and corrections to this file are welcome.
18
19Redistribution and use in source and binary forms, with or without
20modification, are permitted provided that the following conditions are met:
21
22* Redistributions of source code must retain the above copyright
23 notice, this list of conditions and the following disclaimer.
24
25* Redistributions in binary form must reproduce the above copyright
26 notice, this list of conditions and the following disclaimer in
27 the documentation and/or other materials provided with the
28 distribution.
29
30* Neither the name of the copyright holders nor the names of
31 contributors may be used to endorse or promote products derived
32 from this software without specific prior written permission.
33
34THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
38LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44POSSIBILITY OF SUCH DAMAGE.
45
46*/
47
48#include <stdint.h>
49#include <stdbool.h>
50#include <avr/io.h>
51#include <util/delay.h>
52#include "print.h"
53#include "util.h"
54#include "serial.h"
55#include "matrix.h"
56#include "debug.h"
57#include "matrix.h"
58#include "next_kbd.h"
59
60static void matrix_make(uint8_t code);
61static void matrix_break(uint8_t code);
62
63static uint8_t matrix[MATRIX_ROWS];
64#define ROW(code) ((code>>3)&0xF)
65#define COL(code) (code&0x07)
66
67static bool is_modified = false;
68
69/* number of matrix rows */
70inline
71uint8_t matrix_rows(void)
72{
73 return MATRIX_ROWS;
74}
75
76/* number of matrix columns */
77inline
78uint8_t matrix_cols(void)
79{
80 return MATRIX_COLS;
81}
82
83#ifndef NEXT_KBD_LED1_ON
84#define NEXT_KBD_LED1_ON
85#endif
86
87#ifndef NEXT_KBD_LED1_OFF
88#define NEXT_KBD_LED1_OFF
89#endif
90
91#define NEXT_KBD_PWR_READ (NEXT_KBD_PWR_PIN&(1<<NEXT_KBD_PWR_BIT))
92
93static bool power_state = false;
94
95/* intialize matrix for scanning. should be called once. */
96void matrix_init(void)
97{
98#ifdef DEBUG_ON_INIT
99 debug_enable = true;
100#endif
101
102 // I've found that the matrix likes a little while for things to
103 // settle down before it gets started. Not sure why :)
104 _delay_ms(250);
105
106 dprintf("[ Intializing NeXT keyboard ]\n");
107 NEXT_KBD_LED1_DDR |= (1<<NEXT_KBD_LED1_BIT); // LED pin to output
108 NEXT_KBD_LED1_ON;
109
110 NEXT_KBD_PWR_DDR &= ~(1<<NEXT_KBD_PWR_BIT); // Power Button pin to input
111 NEXT_KBD_PWR_PIN |= (1<<NEXT_KBD_PWR_BIT); // KBD_PWR pull up
112
113 power_state = NEXT_KBD_PWR_READ ? false : true;
114 dprintf("Initial power button state: %b\n", power_state);
115
116 next_kbd_init();
117
118 // initialize matrix state: all keys off
119 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
120
121#ifdef NEXT_KBD_INIT_FLASH_LEDS
122 dprintf("flashing LEDs:");
123 // flash the LEDs after initialization
124 bool leds_on = true;
125 for (uint8_t i = 0; i <= 6; i++)
126 {
127 leds_on = leds_on ? false : true;
128 dprintf(" %b", leds_on);
129 next_kbd_set_leds(leds_on, leds_on);
130 _delay_ms(250);
131 }
132 dprintf("\n");
133#endif
134
135 dprintf("[ NeXT keyboard initialized ]\n");
136
137 return;
138}
139
140#define NEXT_KBD_KEYCODE(response) (uint8_t)((response&0xFF)>>1)
141#define NEXT_KBD_PRESSED_KEYCODE(response) (uint8_t)(((response)&0xF00)==0x400)
142#define NEXT_KBD_PRESSED(response, mask) (uint8_t)(((response)&mask)>0)
143#define NEXT_KBD_PRESSED_CONTROL(response) NEXT_KBD_PRESSED(response,0x01000)
144#define NEXT_KBD_PRESSED_SHIFT_LEFT(response) NEXT_KBD_PRESSED(response,0x02000)
145#define NEXT_KBD_PRESSED_SHIFT_RGHT(response) NEXT_KBD_PRESSED(response,0x04000)
146#define NEXT_KBD_PRESSED_CMD_LEFT(response) NEXT_KBD_PRESSED(response,0x08000)
147#define NEXT_KBD_PRESSED_CMD_RGHT(response) NEXT_KBD_PRESSED(response,0x10000)
148#define NEXT_KBD_PRESSED_ALT_LEFT(response) NEXT_KBD_PRESSED(response,0x20000)
149#define NEXT_KBD_PRESSED_ALT_RGHT(response) NEXT_KBD_PRESSED(response,0x40000)
150#define NEXT_KBD_MAKE_OR_BREAK(key, code) \
151 do { \
152 if (NEXT_KBD_PRESSED_##key(resp) > 0) \
153 matrix_make(code); \
154 else \
155 matrix_break(code); \
156 } while (0);
157
158#define NEXT_KBD_PWR_KEYCODE 0x58
159
160/* scan all key states on matrix */
161uint8_t matrix_scan(void)
162{
163 _delay_ms(5);
164
165 //next_kbd_set_leds(false, false);
166 NEXT_KBD_LED1_OFF;
167
168 is_modified = false;
169
170 if (!NEXT_KBD_PWR_READ) {
171 matrix_make(NEXT_KBD_PWR_KEYCODE);
172 power_state = 1;
173 if (is_modified)
174 {
175 dprintf("Power state 1\n");
176
177 }
178 } else {
179 matrix_break(NEXT_KBD_PWR_KEYCODE);
180 power_state = 0;
181 if (is_modified)
182 {
183 dprintf("Power state 0\n");
184
185 }
186 }
187
188 uint32_t resp = (next_kbd_recv());
189
190 if (resp == NEXT_KBD_KMBUS_IDLE)
191 {
192 return 0;
193 }
194
195 NEXT_KBD_LED1_ON;
196
197#ifdef NEXT_KBD_SHIFT_FLASH_LEDS
198 next_kbd_set_leds(
199 NEXT_KBD_PRESSED_SHIFT_LEFT(resp) ? true : false,
200 NEXT_KBD_PRESSED_SHIFT_RGHT(resp) ? true : false
201 );
202#endif
203
204 dprintf("[ r=%04lX keycode=%02X pressed=%X CTRL=%X SHIFT_LEFT=%X SHIFT_RGHT=%X CMD_LEFT=%X CMD_RGHT=%X ALT_LEFT=%X ALT_RGHT=%X ]\n", \
205 resp, \
206 NEXT_KBD_KEYCODE(resp), \
207 NEXT_KBD_PRESSED_KEYCODE(resp), \
208 NEXT_KBD_PRESSED_CONTROL(resp), \
209 NEXT_KBD_PRESSED_SHIFT_LEFT(resp), \
210 NEXT_KBD_PRESSED_SHIFT_RGHT(resp), \
211 NEXT_KBD_PRESSED_CMD_LEFT(resp), \
212 NEXT_KBD_PRESSED_CMD_RGHT(resp), \
213 NEXT_KBD_PRESSED_ALT_LEFT(resp), \
214 NEXT_KBD_PRESSED_ALT_RGHT(resp) \
215 );
216
217 // Modifier keys don't return keycode; have to check the upper bits
218 NEXT_KBD_MAKE_OR_BREAK(ALT_RGHT, 0x51);
219 NEXT_KBD_MAKE_OR_BREAK(ALT_LEFT, 0x52);
220 NEXT_KBD_MAKE_OR_BREAK(CMD_RGHT, 0x53);
221 NEXT_KBD_MAKE_OR_BREAK(CMD_LEFT, 0x54);
222 NEXT_KBD_MAKE_OR_BREAK(SHIFT_RGHT, 0x55);
223 NEXT_KBD_MAKE_OR_BREAK(SHIFT_LEFT, 0x56);
224 NEXT_KBD_MAKE_OR_BREAK(CONTROL, 0x57);
225 NEXT_KBD_MAKE_OR_BREAK(KEYCODE, NEXT_KBD_KEYCODE(resp));
226
227 return 1;
228}
229
230/* whether modified from previous scan. used after matrix_scan. */
231bool matrix_is_modified()
232{
233 return is_modified;
234}
235
236/* whether a switch is on */
237inline
238bool matrix_is_on(uint8_t row, uint8_t col)
239{
240 return (matrix[row] & (1<<col));
241}
242
243/* matrix state on row */
244inline
245uint8_t matrix_get_row(uint8_t row)
246{
247 return matrix[row];
248}
249
250/* print matrix for debug */
251void matrix_print(void)
252{
253}
254
255inline
256static void matrix_make(uint8_t code)
257{
258 if (!matrix_is_on(ROW(code), COL(code))) {
259 matrix[ROW(code)] |= 1<<COL(code);
260 is_modified = true;
261 }
262}
263
264inline
265static void matrix_break(uint8_t code)
266{
267 if (matrix_is_on(ROW(code), COL(code))) {
268 matrix[ROW(code)] &= ~(1<<COL(code));
269 is_modified = true;
270 }
271}
diff --git a/converter/next_usb/next_timings.jpg b/converter/next_usb/next_timings.jpg
deleted file mode 100644
index c9e429fe1..000000000
--- a/converter/next_usb/next_timings.jpg
+++ /dev/null
Binary files differ
diff --git a/converter/pc98_usb/Makefile b/converter/pc98_usb/Makefile
deleted file mode 100644
index 9892276d7..000000000
--- a/converter/pc98_usb/Makefile
+++ /dev/null
@@ -1,83 +0,0 @@
1# Target file name (without extension).
2TARGET = pc98_usb
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap.c \
12 matrix.c \
13 led.c \
14 protocol/serial_uart.c
15# protocol/serial_soft.c
16
17CONFIG_H = config.h
18
19
20# MCU name, you MUST set this to match the board you are using
21# type "make clean" after changing this, so all files will be rebuilt
22#MCU = at90usb162 # Teensy 1.0
23MCU = atmega32u4 # Teensy 2.0
24#MCU = at90usb646 # Teensy++ 1.0
25#MCU = at90usb1286 # Teensy++ 2.0
26
27
28# Processor frequency.
29# Normally the first thing your program should do is set the clock prescaler,
30# so your program will run at the correct speed. You should also set this
31# variable to same clock speed. The _delay_ms() macro uses this, and many
32# examples use this variable to calculate timings. Do not add a "UL" here.
33F_CPU = 16000000
34
35
36#
37# LUFA specific
38#
39# Target architecture (see library "Board Types" documentation).
40ARCH = AVR8
41
42# Input clock frequency.
43# This will define a symbol, F_USB, in all source code files equal to the
44# input clock frequency (before any prescaling is performed) in Hz. This value may
45# differ from F_CPU if prescaling is used on the latter, and is required as the
46# raw input clock is fed directly to the PLL sections of the AVR for high speed
47# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
48# at the end, this will be done automatically to create a 32-bit value in your
49# source code.
50#
51# If no clock division is performed on the input clock inside the AVR (via the
52# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
53F_USB = $(F_CPU)
54
55# Interrupt driven control endpoint task
56OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
57
58
59# Build Options
60# *Comment out* to disable the options.
61#
62MOUSEKEY_ENABLE = yes # Mouse keys
63EXTRAKEY_ENABLE = yes # Audio control and System control
64CONSOLE_ENABLE = yes # Console for debug
65#NKRO_ENABLE = yes # USB Nkey Rollover
66
67
68# Boot Section Size in bytes
69# Teensy halfKay 512
70# Atmel DFU loader 4096
71# LUFA bootloader 4096
72OPT_DEFS += -DBOOTLOADER_SIZE=4096
73
74
75# Search Path
76VPATH += $(TARGET_DIR)
77VPATH += $(TMK_DIR)
78
79
80include $(TMK_DIR)/protocol/lufa.mk
81include $(TMK_DIR)/protocol.mk
82include $(TMK_DIR)/common.mk
83include $(TMK_DIR)/rules.mk
diff --git a/converter/pc98_usb/README b/converter/pc98_usb/README
deleted file mode 100644
index c9bdf3d84..000000000
--- a/converter/pc98_usb/README
+++ /dev/null
@@ -1,67 +0,0 @@
1PC98 to USB keyboard protocol converter
2=======================================
3Target MCU is ATMega32u4 but other USB capable AVR will also work.
4
5
6Connector
7---------
8
9 8Pin mini DIN
10 ___ ___
11 / |_| \
12 / 8 7 6 \
13 | 5 4 3 |
14 \_ 2 1 _/
15 \_____/
16 (receptacle)
17
18
19Wiring: You can change this with editing config.h.
20
21 Pin mini DIN MCU
22 ----------------------------------
23 1 ~RST(TXD) PD3
24 2 GND GND
25 3 ~RDY PD4
26 4 RXD PD2
27 5 ~RTY PD5
28 6 NC
29 7 NC
30 8 5V VCC
31
32
33
34
35Protocol
36--------
37Signal: Asynchronous, Positive logic, 19200baud, Least bit first
38Frame format: 1-Start bit(Lo), 8-Data bits, Odd-Parity, 1-Stop bit
39
40
41
42Build Firmware
43--------------
44Just use 'make'
45
46 $ cd pc98_usb
47 $ make
48
49Then, load the binary to MCU with your favorite programmer.
50
51
52
53Other PC98 converter projects and resource
54------------------------------------------
55PC98 to USB
56http://davy.nyacom.net/kbd98usb/
57
58PC98 to PS/2
59http://www.tsp.ne.jp/~sawada/mago/c_gka98at.htm
60http://www.tsp.ne.jp/~sawada/mago/src/gka98at.asm
61
62PC98 keyboard commands
63http://www.webtech.co.jp/company/doc/undocumented_mem/io_kb.txt
64
65
66Inhibit repeating key:
670x9C, 0x70
diff --git a/converter/pc98_usb/config.h b/converter/pc98_usb/config.h
deleted file mode 100644
index b8d676e4c..000000000
--- a/converter/pc98_usb/config.h
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#define VENDOR_ID 0xFEED
22#define PRODUCT_ID 0x9898
23#define DEVICE_VER 0x0100
24#define MANUFACTURER t.m.k.
25#define PRODUCT PC98 keyboard converter
26#define DESCRIPTION converts PC98 keyboard protocol into USB
27
28
29/* matrix size */
30#define MATRIX_ROWS 16
31#define MATRIX_COLS 8
32
33/* key combination for command */
34#define IS_COMMAND() ( \
35 host_get_first_key() == KC_CANCEL \
36)
37
38
39/* PC98 Reset Port shared with TXD */
40#define PC98_RST_DDR DDRD
41#define PC98_RST_PORT PORTD
42#define PC98_RST_BIT 3
43/* PC98 Ready Port */
44#define PC98_RDY_DDR DDRD
45#define PC98_RDY_PORT PORTD
46#define PC98_RDY_BIT 4
47/* PC98 Retry Port */
48#define PC98_RTY_DDR DDRD
49#define PC98_RTY_PORT PORTD
50#define PC98_RTY_BIT 5
51
52/*
53 * PC98 Serial(USART) configuration
54 * asynchronous, positive logic, 19200baud, bit order: LSB first
55 * 1-start bit, 8-data bit, odd parity, 1-stop bit
56 */
57/*
58 * Software Serial
59 */
60#define SERIAL_SOFT_BAUD 19200
61#define SERIAL_SOFT_PARITY_ODD
62#define SERIAL_SOFT_BIT_ORDER_LSB
63#define SERIAL_SOFT_LOGIC_POSITIVE
64/* RXD Port */
65#define SERIAL_SOFT_RXD_DDR DDRD
66#define SERIAL_SOFT_RXD_PORT PORTD
67#define SERIAL_SOFT_RXD_PIN PIND
68#define SERIAL_SOFT_RXD_BIT 2
69#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
70/* RXD Interupt */
71#define SERIAL_SOFT_RXD_VECT INT2_vect
72#define SERIAL_SOFT_RXD_INIT() do { \
73 /* pin configuration: input with pull-up */ \
74 SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
75 SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
76 /* enable interrupt: INT2(falling edge) */ \
77 EICRA |= ((1<<ISC21)|(0<<ISC20)); \
78 EIMSK |= (1<<INT2); \
79 sei(); \
80} while (0)
81#define SERIAL_SOFT_RXD_INT_ENTER()
82#define SERIAL_SOFT_RXD_INT_EXIT() do { \
83 /* clear interrupt flag */ \
84 EIFR = (1<<INTF2); \
85} while (0)
86/* TXD Port */
87#define SERIAL_SOFT_TXD_DDR DDRD
88#define SERIAL_SOFT_TXD_PORT PORTD
89#define SERIAL_SOFT_TXD_PIN PIND
90#define SERIAL_SOFT_TXD_BIT 3
91#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
92#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
93#define SERIAL_SOFT_TXD_INIT() do { \
94 /* pin configuration: output */ \
95 SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
96 /* idle */ \
97 SERIAL_SOFT_TXD_ON(); \
98} while (0)
99
100
101/*
102 * Hardware Serial(UART)
103 */
104#ifdef __AVR_ATmega32U4__
105 #define SERIAL_UART_BAUD 19200
106 #define SERIAL_UART_DATA UDR1
107 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
108 #define SERIAL_UART_RXD_VECT USART1_RX_vect
109 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
110 #define SERIAL_UART_INIT() do { \
111 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
112 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
113 UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
114 UCSR1B |= (0<<TXCIE1) | (1<<TXEN1); /* TX interrupt, TX: enable */ \
115 UCSR1C |= (1<<UPM11) | (1<<UPM10); /* parity: none(00), even(01), odd(11) */ \
116 sei(); \
117 } while(0)
118#else
119 #error "USART configuration is needed."
120#endif
121
122
123#endif
diff --git a/converter/pc98_usb/keymap.c b/converter/pc98_usb/keymap.c
deleted file mode 100644
index 8922ea7ba..000000000
--- a/converter/pc98_usb/keymap.c
+++ /dev/null
@@ -1,208 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/pgmspace.h>
21#include "keycode.h"
22#include "action.h"
23#include "action_macro.h"
24#include "util.h"
25#include "keymap.h"
26
27
28
29
30/* PC-9801-98-S02 Raku Raku keyboard(Luckyboard) Normal Mode
31 ,---------------------------------------------------------------.
32 | 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 36| 37| 3F| 3E|
33 `---------------------------------------------------------------'
34 ,---------------------------------------------------------------.
35 | 00| 01| 02| 03| 04| 05| 58| 71| 06| 07| 08| 09| 0A| 0E|
36 |---------------------------------------------------------------|
37 | 0F| 10| 11| 12| 13| 14| 3A | 15| 16| 17| 18| 19| 1C|
38 |---------------------------------------------------------'. |
39 | 74| 20| 21| 22| 23| 24| 3B | 3C | 25| 26| 27| 28| 29| |
40 |---------------------------------------------------------------|
41 | 70| 2A| 2B| 2C| 2D| 2E| 38| 3D | 39| 2F| 30| 31| 32| 33| 70|
42 `---------------------------------------------------------------'
43 | 73| 51| 5B| 59| 34| 5A| 35| xx|
44 `-----------------------------------------------'
45 xx: 74 35 F4 B5
46*/
47#define KEYMAP( \
48 K60, K61, K62, K63, K64, K65, K66, K67, K68, K69, K6A, K6B, K36, K37, K3F, K3E, \
49 K00, K01, K02, K03, K04, K05, K58, K71, K06, K07, K08, K09, K0A, K0E, \
50 K0F, K10, K11, K12, K13, K14, K3A, K15, K16, K17, K18, K19, K1C, \
51 K74, K20, K21, K22, K23, K24, K3B, K3C, K25, K26, K27, K28, K29, \
52 K70,K2A, K2B, K2C, K2D, K2E, K38, K3D, K39, K2F, K30, K31, K32, K33, \
53 K73, K51, K5B, K59, K34, K5A, K35 \
54) { \
55 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
56 { KC_##K08, KC_##K09, KC_##K0A, KC_NO, KC_NO, KC_NO, KC_##K0E, KC_##K0F }, \
57 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
58 { KC_##K18, KC_##K19, KC_NO, KC_NO, KC_##K1C, KC_NO, KC_NO, KC_NO }, \
59 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
60 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
61 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
62 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
63 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
64 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
65 { KC_NO, KC_##K51, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
66 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_NO, KC_NO, KC_NO }, \
67 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
68 { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_NO, KC_NO, KC_NO, KC_NO }, \
69 { KC_##K70, KC_##K71, KC_NO, KC_##K73, KC_##K74, KC_NO, KC_NO, KC_NO }, \
70 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
71}
72
73
74
75static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
76 /*
77 ,---------------------------------------------------------------.
78 | 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 36| 37| 3F| 3E|
79 `---------------------------------------------------------------'
80 ,---------------------------------------------------------------.
81 | 00| 01| 02| 03| 04| 05| 58| 71| 06| 07| 08| 09| 0A| 0E|
82 |---------------------------------------------------------------|
83 | 0F| 10| 11| 12| 13| 14| 3A | 15| 16| 17| 18| 19| 1C|
84 |---------------------------------------------------------------|
85 | 74| 20| 21| 22| 23| 24| MINS| EQL| 25| 26| 27| 28| 29| |
86 |---------------------------------------------------------------|
87 | 70| 2A| 2B| 2C| 2D| 2E| 38| 3D | 39| 2F| 30| 31| 32| 33| 70|
88 `---------------------------------------------------------------'
89 | 73| 51| 5B| 59| 34| 5A| 35| xx|
90 `-----------------------------------------------'
91 */
92 KEYMAP(
93 CANCEL,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, FN6,
94 ESC, 1, 2, 3, 4, 5, FN4, FN5, 6, 7, 8, 9, 0, BSPC,
95 TAB, Q, W, E, R, T, UP, Y, U, I, O, P, ENT,
96 LCTL, A, S, D, F, G, MINS, EQL, H, J, K, L, FN2,
97 LSFT, Z, X, C, V, B, GRV, BSLS, QUOT, N, M,COMM, DOT, FN1,
98 LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
99 ),
100 KEYMAP(
101 PAUS,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14,
102 GRV, F1, F2, F3, F4, F5, NO, NO, F6, F7, F8, F9, F10, DEL,
103 TAB, Q, W, E, R, T, UP, HOME,PGDN,PGUP, END, P, ENT,
104 LCTL, A, S, D, F, G, MINS, EQL, LEFT,DOWN, UP,RGHT,SCLN,
105 LSFT, Z, X, C, V, B, INS, DOWN, DEL,HOME,PGDN,PGUP, END,TRNS,
106 LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
107 ),
108 KEYMAP(
109 PAUS,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14,
110 GRV, F1, F2, F3, F4, F5, NO, NO, F6, F7, F8, F9, F10, DEL,
111 TAB, Q, W, E, R, T, UP, WH_L,WH_D,WH_U,WH_R, P, ENT,
112 LCTL, A, S, D, F, G, MINS, EQL, MS_L,MS_D,MS_U,MS_R,TRNS,
113 LSFT, Z, X, C, V, B, INS, DOWN, BTN3,BTN2,BTN1,BTN4,BTN5,TRNS,
114 LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
115 ),
116};
117static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {};
118
119/*
120 * Macro definition
121 */
122enum macro_id {
123 LBRACKET,
124 RBRACKET,
125 DUMMY,
126};
127
128const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
129{
130 keyevent_t event = record->event;
131 //uint8_t tap_count = record->tap_count;
132
133 switch (id) {
134 case LBRACKET:
135 return (event.pressed ?
136 MACRO( T(LBRC), END ) :
137 MACRO( T(LBRC), END ) );
138 case RBRACKET:
139 return (event.pressed ?
140 MACRO( T(RBRC), END ) :
141 MACRO( T(RBRC), END ) );
142 }
143 return MACRO_NONE;
144}
145
146/*
147 * Action function
148 */
149void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
150{
151/*
152 keyevent_t event = record->event;
153 uint8_t tap_count = record->tap_count;
154 switch (id) {
155 case 0xFF:
156 action_macro_play(get_macro(opt, event.pressed));
157 break;
158 }
159*/
160}
161
162
163/*
164 * Fn actions
165 */
166static const uint16_t PROGMEM fn_actions[] = {
167 ACTION_LAYER_TAP_TOGGLE(0), // FN0
168 ACTION_LAYER_TAP_KEY(1, KC_SLASH), // FN1
169 ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN2
170 ACTION_LAYER_MOMENTARY(2), // FN3
171 ACTION_MACRO(LBRACKET), // FN4
172 ACTION_MACRO(RBRACKET), // FN5
173 ACTION_MACRO(DUMMY), // FN6
174};
175
176
177
178
179
180
181/*
182 * No need to edit.
183 */
184#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
185#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
186
187/* translates key to keycode */
188uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
189{
190 if (layer < KEYMAPS_SIZE) {
191 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
192 } else {
193 // fall back to layer 0
194 return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
195 }
196}
197
198/* translates Fn keycode to action */
199action_t keymap_fn_to_action(uint8_t keycode)
200{
201 action_t action;
202 if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
203 action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
204 } else {
205 action.code = ACTION_NO;
206 }
207 return action;
208}
diff --git a/converter/pc98_usb/led.c b/converter/pc98_usb/led.c
deleted file mode 100644
index 48c3f1c2b..000000000
--- a/converter/pc98_usb/led.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "stdint.h"
19#include "serial.h"
20#include "led.h"
21
22
23void led_set(uint8_t usb_led)
24{
25 uint8_t sun_led = 0;
26 if (usb_led & (1<<USB_LED_NUM_LOCK)) sun_led |= (1<<0);
27 if (usb_led & (1<<USB_LED_COMPOSE)) sun_led |= (1<<1);
28 if (usb_led & (1<<USB_LED_SCROLL_LOCK)) sun_led |= (1<<2);
29 if (usb_led & (1<<USB_LED_CAPS_LOCK)) sun_led |= (1<<3);
30
31 serial_send(0x0E);
32 serial_send(sun_led);
33}
diff --git a/converter/pc98_usb/matrix.c b/converter/pc98_usb/matrix.c
deleted file mode 100644
index 8833e0a85..000000000
--- a/converter/pc98_usb/matrix.c
+++ /dev/null
@@ -1,211 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/io.h>
21#include <util/delay.h>
22#include "print.h"
23#include "util.h"
24#include "matrix.h"
25#include "debug.h"
26#include "protocol/serial.h"
27
28
29/*
30 * Matrix Array usage:
31 *
32 * ROW: 16(4bits)
33 * COL: 8(3bits)
34 *
35 * 8bit wide
36 * +---------+
37 * 0|00 ... 07|
38 * 1|08 ... 0F|
39 * :| ... |
40 * :| ... |
41 * E|70 ... 77|
42 * F|78 ... 7F|
43 * +---------+
44 */
45static uint8_t matrix[MATRIX_ROWS];
46#define ROW(code) ((code>>3)&0xF)
47#define COL(code) (code&0x07)
48
49static bool is_modified = false;
50
51
52inline
53uint8_t matrix_rows(void)
54{
55 return MATRIX_ROWS;
56}
57
58inline
59uint8_t matrix_cols(void)
60{
61 return MATRIX_COLS;
62}
63
64static void pc98_inhibit_repeat(void)
65{
66 uint8_t code;
67
68 while (serial_recv()) ;
69RETRY:
70 PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
71 _delay_ms(500);
72 serial_send(0x9C);
73
74 PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
75 _delay_ms(100);
76 while (!(code = serial_recv())) ;
77 print("PC98: send 9C: "); print_hex8(code); print("\n");
78 if (code != 0xFA) goto RETRY;
79
80
81
82 PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
83 _delay_ms(100);
84 serial_send(0x70);
85
86 PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
87 _delay_ms(100);
88 //code = serial_recv();
89 while (!(code = serial_recv())) ;
90 print("PC98: send 70: "); print_hex8(code); print("\n");
91 if (code != 0xFA) goto RETRY;
92}
93
94void matrix_init(void)
95{
96 PC98_RST_DDR |= (1<<PC98_RST_BIT);
97 PC98_RDY_DDR |= (1<<PC98_RDY_BIT);
98 PC98_RTY_DDR |= (1<<PC98_RTY_BIT);
99 PC98_RST_PORT |= (1<<PC98_RST_BIT);
100 PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
101 PC98_RTY_PORT |= (1<<PC98_RTY_BIT);
102
103
104 serial_init();
105
106 // PC98 reset
107/*
108 PC98_RST_PORT &= ~(1<<PC98_RST_BIT);
109 _delay_us(15);
110 PC98_RST_PORT |= (1<<PC98_RST_BIT);
111 _delay_us(13);
112 PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
113*/
114
115 _delay_ms(500);
116 pc98_inhibit_repeat();
117
118
119 // PC98 ready
120 PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
121
122 // initialize matrix state: all keys off
123 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
124
125 debug("init\n");
126 return;
127}
128
129uint8_t matrix_scan(void)
130{
131 is_modified = false;
132
133 uint16_t code;
134 PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
135 _delay_us(30);
136 code = serial_recv2();
137 PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
138 if (code == -1) return 0;
139
140if (code == 0x60) {
141 pc98_inhibit_repeat();
142
143/*
144 PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
145 _delay_ms(100);
146 serial_send(0x96);
147 PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
148*/
149
150 return 0;
151}
152
153 print_hex8(code); print(" ");
154
155 if (code&0x80) {
156 // break code
157 if (matrix_is_on(ROW(code), COL(code))) {
158 matrix[ROW(code)] &= ~(1<<COL(code));
159 is_modified = true;
160 }
161 } else {
162 // make code
163 if (!matrix_is_on(ROW(code), COL(code))) {
164 matrix[ROW(code)] |= (1<<COL(code));
165 is_modified = true;
166 }
167 }
168 return code;
169}
170
171bool matrix_is_modified(void)
172{
173 return is_modified;
174}
175
176inline
177bool matrix_has_ghost(void)
178{
179 return false;
180}
181
182inline
183bool matrix_is_on(uint8_t row, uint8_t col)
184{
185 return (matrix[row] & (1<<col));
186}
187
188inline
189uint8_t matrix_get_row(uint8_t row)
190{
191 return matrix[row];
192}
193
194void matrix_print(void)
195{
196 print("\nr/c 01234567\n");
197 for (uint8_t row = 0; row < matrix_rows(); row++) {
198 phex(row); print(": ");
199 pbin_reverse(matrix_get_row(row));
200 print("\n");
201 }
202}
203
204uint8_t matrix_key_count(void)
205{
206 uint8_t count = 0;
207 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
208 count += bitpop(matrix[i]);
209 }
210 return count;
211}
diff --git a/converter/ps2_usb/Makefile b/converter/ps2_usb/Makefile
deleted file mode 100644
index 51b222566..000000000
--- a/converter/ps2_usb/Makefile
+++ /dev/null
@@ -1,105 +0,0 @@
1#
2# Makefile for Teensy
3#
4# Target file name (without extension).
5TARGET = ps2_usb_lufa
6
7# Directory common source filess exist
8TMK_DIR = ../../tmk_core
9
10# Directory keyboard dependent files exist
11TARGET_DIR = .
12
13# project specific files
14SRC = keymap_common.c \
15 matrix.c \
16 led.c
17
18ifdef KEYMAP
19 SRC := keymap_$(KEYMAP).c $(SRC)
20else
21 SRC := keymap_plain.c $(SRC)
22endif
23
24CONFIG_H = config.h
25
26
27# MCU name
28#MCU = at90usb1287
29MCU = atmega32u4
30
31# Processor frequency.
32# This will define a symbol, F_CPU, in all source code files equal to the
33# processor frequency in Hz. You can then use this symbol in your source code to
34# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
35# automatically to create a 32-bit value in your source code.
36#
37# This will be an integer division of F_USB below, as it is sourced by
38# F_USB after it has run through any CPU prescalers. Note that this value
39# does not *change* the processor frequency - it should merely be updated to
40# reflect the processor speed set externally so that the code can use accurate
41# software delays.
42F_CPU = 16000000
43
44
45#
46# LUFA specific
47#
48# Target architecture (see library "Board Types" documentation).
49ARCH = AVR8
50
51# Input clock frequency.
52# This will define a symbol, F_USB, in all source code files equal to the
53# input clock frequency (before any prescaling is performed) in Hz. This value may
54# differ from F_CPU if prescaling is used on the latter, and is required as the
55# raw input clock is fed directly to the PLL sections of the AVR for high speed
56# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
57# at the end, this will be done automatically to create a 32-bit value in your
58# source code.
59#
60# If no clock division is performed on the input clock inside the AVR (via the
61# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
62F_USB = $(F_CPU)
63
64# Interrupt driven control endpoint task(+60)
65#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
66
67
68# Boot Section Size in *bytes*
69# Teensy halfKay 512
70# Teensy++ halfKay 1024
71# Atmel DFU loader 4096
72# LUFA bootloader 4096
73# USBaspLoader 2048
74OPT_DEFS += -DBOOTLOADER_SIZE=512
75
76
77# Build Options
78# comment out to disable the options.
79#
80#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
81MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
82EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
83CONSOLE_ENABLE = yes # Console for debug(+400)
84COMMAND_ENABLE = yes # Commands for debug and configuration
85NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
86
87
88# PS/2 Options
89#
90#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
91PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
92#PS2_USE_BUSYWAIT = yes # uses primitive reference code
93
94
95# Optimize size but this may cause error "relocation truncated to fit"
96#EXTRALDFLAGS = -Wl,--relax
97
98# Search Path
99VPATH += $(TARGET_DIR)
100VPATH += $(TMK_DIR)
101
102include $(TMK_DIR)/protocol.mk
103include $(TMK_DIR)/protocol/lufa.mk
104include $(TMK_DIR)/common.mk
105include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/Makefile.mbed b/converter/ps2_usb/Makefile.mbed
deleted file mode 100644
index a7ea5bcf2..000000000
--- a/converter/ps2_usb/Makefile.mbed
+++ /dev/null
@@ -1,46 +0,0 @@
1PROJECT = ps2_usb
2
3TMK_DIR = ../../tmk_core
4MBED_DIR = $(TMK_DIR)/tool/mbed/mbed-sdk
5
6#VPATH += $(MBED_DIR):$(TMK_DIR)
7vpath %.s .:$(MBED_DIR):$(TMK_DIR)
8vpath %.c .:$(MBED_DIR):$(TMK_DIR)
9vpath %.cpp .:$(MBED_DIR):$(TMK_DIR)
10
11OBJDIR = ./build
12
13OBJECTS = \
14 $(OBJDIR)/protocol/ps2_busywait.o \
15 $(OBJDIR)/protocol/ps2_io_mbed.o \
16 $(OBJDIR)/./keymap_common.o \
17 $(OBJDIR)/./matrix.o \
18 $(OBJDIR)/./led.o \
19 $(OBJDIR)/./main.o
20
21ifdef KEYMAP
22 OBJECTS := $(OBJDIR)/keymap_$(KEYMAP).o $(OBJECTS)
23else
24 OBJECTS := $(OBJDIR)/keymap_plain.o $(OBJECTS)
25endif
26
27CONFIG_H = config_mbed.h
28
29SYS_OBJECTS =
30
31INCLUDE_PATHS = -I.
32
33LIBRARY_PATHS =
34LIBRARIES =
35
36# Build Options
37# Comment out to disable
38#BOOTMAGIC_ENABLE = yes
39MOUSEKEY_ENABLE = yes
40
41
42#include $(TMK_DIR)/tool/mbed/mk20d50m.mk
43include $(TMK_DIR)/tool/mbed/lpc11u35_501.mk
44include $(TMK_DIR)/tool/mbed/mbed.mk
45include $(TMK_DIR)/tool/mbed/common.mk
46include $(TMK_DIR)/tool/mbed/gcc.mk
diff --git a/converter/ps2_usb/Makefile.pjrc b/converter/ps2_usb/Makefile.pjrc
deleted file mode 100644
index 64319aca8..000000000
--- a/converter/ps2_usb/Makefile.pjrc
+++ /dev/null
@@ -1,75 +0,0 @@
1# Target file name (without extension).
2TARGET = ps2_usb_pjrc
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap_common.c \
12 matrix.c \
13 led.c
14
15ifdef KEYMAP
16 SRC := keymap_$(KEYMAP).c $(SRC)
17else
18 SRC := keymap_plain.c $(SRC)
19endif
20
21CONFIG_H = config.h
22
23
24# MCU name, you MUST set this to match the board you are using
25# type "make clean" after changing this, so all files will be rebuilt
26#MCU = at90usb162 # Teensy 1.0
27MCU = atmega32u4 # Teensy 2.0
28#MCU = at90usb646 # Teensy++ 1.0
29#MCU = at90usb1286 # Teensy++ 2.0
30
31
32# Processor frequency.
33# Normally the first thing your program should do is set the clock prescaler,
34# so your program will run at the correct speed. You should also set this
35# variable to same clock speed. The _delay_ms() macro uses this, and many
36# examples use this variable to calculate timings. Do not add a "UL" here.
37F_CPU = 16000000
38
39
40# Boot Section Size in *bytes*
41# Teensy halfKay 512
42# Teensy++ halfKay 1024
43# Atmel DFU loader 4096
44# LUFA bootloader 4096
45# USBaspLoader 2048
46OPT_DEFS += -DBOOTLOADER_SIZE=4096
47
48
49# Build Options
50# *Comment out* to disable the options.
51#
52#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
53MOUSEKEY_ENABLE = yes # Mouse keys
54EXTRAKEY_ENABLE = yes # Audio control and System control
55CONSOLE_ENABLE = yes # Console for debug(+400)
56COMMAND_ENABLE = yes # Commands for debug and configuration
57NKRO_ENABLE = yes # USB Nkey Rollover
58
59
60# PS/2 Options
61#
62#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
63#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
64PS2_USE_BUSYWAIT = yes # uses primitive reference code
65
66
67# Search Path
68VPATH += $(TARGET_DIR)
69VPATH += $(TMK_DIR)
70
71
72include $(TMK_DIR)/protocol.mk
73include $(TMK_DIR)/protocol/pjrc.mk
74include $(TMK_DIR)/common.mk
75include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/Makefile.tmk_rev1 b/converter/ps2_usb/Makefile.tmk_rev1
deleted file mode 100644
index 6aaef4996..000000000
--- a/converter/ps2_usb/Makefile.tmk_rev1
+++ /dev/null
@@ -1,98 +0,0 @@
1#
2# Makefile for TMK keyboard converter rev2
3# https://github.com/tmk/keyboard_converter#pcb-rev1
4#
5# Target file name (without extension).
6TARGET = ps2_usb_tmk_rev1
7
8# Directory common source filess exist
9TMK_DIR = ../../tmk_core
10
11# Directory keyboard dependent files exist
12TARGET_DIR = .
13
14# project specific files
15SRC = keymap_common.c \
16 matrix.c \
17 led.c
18
19ifdef KEYMAP
20 SRC := keymap_$(KEYMAP).c $(SRC)
21else
22 SRC := keymap_plain.c $(SRC)
23endif
24
25CONFIG_H = config_tmk_rev1.h
26
27
28# MCU name
29MCU = atmega32u4
30
31# Processor frequency.
32# This will define a symbol, F_CPU, in all source code files equal to the
33# processor frequency in Hz. You can then use this symbol in your source code to
34# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
35# automatically to create a 32-bit value in your source code.
36#
37# This will be an integer division of F_USB below, as it is sourced by
38# F_USB after it has run through any CPU prescalers. Note that this value
39# does not *change* the processor frequency - it should merely be updated to
40# reflect the processor speed set externally so that the code can use accurate
41# software delays.
42F_CPU = 16000000
43
44
45#
46# LUFA specific
47#
48# Target architecture (see library "Board Types" documentation).
49ARCH = AVR8
50
51# Input clock frequency.
52# This will define a symbol, F_USB, in all source code files equal to the
53# input clock frequency (before any prescaling is performed) in Hz. This value may
54# differ from F_CPU if prescaling is used on the latter, and is required as the
55# raw input clock is fed directly to the PLL sections of the AVR for high speed
56# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
57# at the end, this will be done automatically to create a 32-bit value in your
58# source code.
59#
60# If no clock division is performed on the input clock inside the AVR (via the
61# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
62F_USB = $(F_CPU)
63
64
65# Boot Section Size in *bytes*
66# Teensy halfKay 512
67# Teensy++ halfKay 1024
68# Atmel DFU loader 4096
69# LUFA bootloader 4096
70# USBaspLoader 2048
71OPT_DEFS += -DBOOTLOADER_SIZE=4096
72
73
74# Build Options
75# comment out to disable the options.
76#
77#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
78MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
79EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
80CONSOLE_ENABLE = yes # Console for debug(+400)
81COMMAND_ENABLE = yes # Commands for debug and configuration
82#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
83
84
85# PS/2 Options
86#
87PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
88#PS2_USE_BUSYWAIT = yes # uses primitive reference code
89
90
91# Search Path
92VPATH += $(TARGET_DIR)
93VPATH += $(TMK_DIR)
94
95include $(TMK_DIR)/protocol.mk
96include $(TMK_DIR)/protocol/lufa.mk
97include $(TMK_DIR)/common.mk
98include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/Makefile.tmk_rev2 b/converter/ps2_usb/Makefile.tmk_rev2
deleted file mode 100644
index 5049a2270..000000000
--- a/converter/ps2_usb/Makefile.tmk_rev2
+++ /dev/null
@@ -1,98 +0,0 @@
1#
2# Makefile for TMK keyboard converter rev2
3# https://github.com/tmk/keyboard_converter#pcb-rev2
4#
5# Target file name (without extension).
6TARGET = ps2_usb_tmk_rev2
7
8# Directory common source filess exist
9TMK_DIR = ../../tmk_core
10
11# Directory keyboard dependent files exist
12TARGET_DIR = .
13
14# project specific files
15SRC = keymap_common.c \
16 matrix.c \
17 led.c
18
19ifdef KEYMAP
20 SRC := keymap_$(KEYMAP).c $(SRC)
21else
22 SRC := keymap_plain.c $(SRC)
23endif
24
25CONFIG_H = config_tmk_rev2.h
26
27
28# MCU name
29MCU = atmega32u2
30
31# Processor frequency.
32# This will define a symbol, F_CPU, in all source code files equal to the
33# processor frequency in Hz. You can then use this symbol in your source code to
34# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
35# automatically to create a 32-bit value in your source code.
36#
37# This will be an integer division of F_USB below, as it is sourced by
38# F_USB after it has run through any CPU prescalers. Note that this value
39# does not *change* the processor frequency - it should merely be updated to
40# reflect the processor speed set externally so that the code can use accurate
41# software delays.
42F_CPU = 16000000
43
44
45#
46# LUFA specific
47#
48# Target architecture (see library "Board Types" documentation).
49ARCH = AVR8
50
51# Input clock frequency.
52# This will define a symbol, F_USB, in all source code files equal to the
53# input clock frequency (before any prescaling is performed) in Hz. This value may
54# differ from F_CPU if prescaling is used on the latter, and is required as the
55# raw input clock is fed directly to the PLL sections of the AVR for high speed
56# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
57# at the end, this will be done automatically to create a 32-bit value in your
58# source code.
59#
60# If no clock division is performed on the input clock inside the AVR (via the
61# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
62F_USB = $(F_CPU)
63
64
65# Boot Section Size in *bytes*
66# Teensy halfKay 512
67# Teensy++ halfKay 1024
68# Atmel DFU loader 4096
69# LUFA bootloader 4096
70# USBaspLoader 2048
71OPT_DEFS += -DBOOTLOADER_SIZE=4096
72
73
74# Build Options
75# comment out to disable the options.
76#
77#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
78MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
79EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
80CONSOLE_ENABLE = yes # Console for debug(+400)
81COMMAND_ENABLE = yes # Commands for debug and configuration
82#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
83
84
85# PS/2 Options
86#
87PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
88#PS2_USE_BUSYWAIT = yes # uses primitive reference code
89
90
91# Search Path
92VPATH += $(TARGET_DIR)
93VPATH += $(TMK_DIR)
94
95include $(TMK_DIR)/protocol.mk
96include $(TMK_DIR)/protocol/lufa.mk
97include $(TMK_DIR)/common.mk
98include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/Makefile.vusb b/converter/ps2_usb/Makefile.vusb
deleted file mode 100644
index d9fa12bcd..000000000
--- a/converter/ps2_usb/Makefile.vusb
+++ /dev/null
@@ -1,107 +0,0 @@
1# Target file name (without extension).
2TARGET = ps2_usb_vusb
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap_common.c \
12 matrix.c \
13 led.c
14
15ifdef KEYMAP
16 SRC := keymap_$(KEYMAP).c $(SRC)
17else
18 SRC := keymap_plain.c $(SRC)
19endif
20
21CONFIG_H = config.h
22
23
24# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful.
25PS2_USE_USART = yes
26
27
28# V-USB debug level: To use ps2_usart.c level must be 0
29# ps2_usart.c requires USART to receive PS/2 signal.
30OPT_DEFS += -DDEBUG_LEVEL=0
31
32
33# MCU name, you MUST set this to match the board you are using
34# type "make clean" after changing this, so all files will be rebuilt
35#MCU = at90usb162 # Teensy 1.0
36#MCU = atmega32u4 # Teensy 2.0
37#MCU = at90usb646 # Teensy++ 1.0
38#MCU = at90usb1286 # Teensy++ 2.0
39MCU = atmega168
40
41
42# Processor frequency.
43# Normally the first thing your program should do is set the clock prescaler,
44# so your program will run at the correct speed. You should also set this
45# variable to same clock speed. The _delay_ms() macro uses this, and many
46# examples use this variable to calculate timings. Do not add a "UL" here.
47F_CPU = 20000000
48
49
50# Build Options
51# comment out to disable the options.
52#
53MOUSEKEY_ENABLE = yes # Mouse keys
54EXTRAKEY_ENABLE = yes # Audio control and System control
55#NKRO_ENABLE = yes # USB Nkey Rollover
56NO_UART = yes # UART is unavailable
57
58
59
60#---------------- Programming Options --------------------------
61AVRDUDE = avrdude
62# Type: avrdude -c ? to get a full listing.
63AVRDUDE_PROGRAMMER = usbasp
64AVRDUDE_PORT =
65AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
66#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
67
68# Uncomment the following if you want avrdude's erase cycle counter.
69# Note that this counter needs to be initialized first using -Yn,
70# see avrdude manual.
71#AVRDUDE_ERASE_COUNTER = -y
72
73# Uncomment the following if you do /not/ wish a verification to be
74# performed after programming the device.
75#AVRDUDE_NO_VERIFY = -V
76
77# Increase verbosity level. Please use this when submitting bug
78# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
79# to submit bug reports.
80#AVRDUDE_VERBOSE = -v -v
81
82#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
83AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
84AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
85AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
86AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
87
88PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
89
90
91# Boot Section Size in bytes
92# Teensy halfKay 512
93# Atmel DFU loader 4096
94# LUFA bootloader 4096
95# USBasp 2048
96OPT_DEFS += -DBOOTLOADER_SIZE=2048
97
98
99# Search Path
100VPATH += $(TARGET_DIR)
101VPATH += $(TMK_DIR)
102
103
104include $(TMK_DIR)/protocol.mk
105include $(TMK_DIR)/common.mk
106include $(TMK_DIR)/protocol/vusb.mk
107include $(TMK_DIR)/rules.mk
diff --git a/converter/ps2_usb/README.md b/converter/ps2_usb/README.md
deleted file mode 100644
index 74464e264..000000000
--- a/converter/ps2_usb/README.md
+++ /dev/null
@@ -1,84 +0,0 @@
1PS/2 to USB keyboard converter
2==============================
3This firmware converts PS/2 keyboard protocol to USB.(It supports Scan Code Set 2.)
4
5
6Connect Wires
7-------------
8In case of Teensy2.0(ATMega32U4):
9
101. Connect **Vcc** and **GND**.
112. Connect **Clock** and **Data** line.
12 - **Interrupt**: **Clock** is on `PD1` and **Data** on `PD0`.(Recommended. Soarer's converter compatible)
13 - **Busywait**: **Clock** is on `PD1` and **Data** on `PD0`.
14 - **USART**: **Clock** is on `PD5` and **Data** on `PD2`.
153. Optionally you need pull-up resistor. 1K-10K Ohm is OK.
16
17To change pin configuration edit **config.h** and **Makefile**.
18
19
20Build Firmware
21--------------
22For **PJRC Teensy** just run `make`:
23
24 $ make clean
25 $ make
26
27To select keymap:
28
29 $ make clean
30 $ make KEYMAP=[plain|jis|spacefn|...]
31
32After that you will find HEX file `ps2_usb_lufa.hex` in current directory.
33
34
35- For **TMK converter Rev.1** use `make -f Makefile.tmk_rev1` instead of `make` and HEX file is `ps2_usb_tmk_rev1.hex`.
36
37- For **TMK converter Rev.2** use `make -f Makefile.tmk_rev2` instead of `make` and HEX file is `ps2_usb_tmk_rev2.hex`.
38
39
40Keymap
41------
42Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document(you can find in README.md of top directory) and existent keymap files.
43
44
45PS/2 signal handling implementations
46------------------------------------
47Following three methods can be used to implement PS/2 signal handling.
48
49### Simple and stupid busy-wait(ps2_busywait.c)
50 This is expected to implemented with portable C code for reference.
51### Interrupt driven(ps2_interrupt.c)
52 Uses pin interrupt to detect falling edge of clock line.
53### USART hardware module(ps2_usart.c)
54 Uses AVR USART engine to receive PS/2 signal.
55
56To select method edit Makefile.
57
58
59V-USB Support
60-------------
61With V-USB you can use this converter on ATmega(168/328) but it doesn't support NKRO at this time.
62
63Circuit:
64
65 +---+ +---------------+
66 USB GND | | ATmega168 |
67 === C3 | |
68 5V <-------+--------+---|Vcc,AVCC | PS/2
69 R1 | | ====
70 D- <----+--+-----R2-----|INT1 RXD|------->DATA
71 D+ <----|---+----R3-----|INT0 XCK|------->CLOCK
72 Z1 Z2 | | ->5V
73 GND<----+---+--+--+-----|GND | ->GND
74 | | | |
75 | C2-+--|XTAL1 |
76 | X1 | |
77 +--C3-+--|XTAL2 |
78 +---------------+
79 R1: 1.5K Ohm
80 R2,R3: 68 Ohm
81 Z1,Z2: Zenner 3.6V
82 C1,C2: 22pF
83 C3: 0.1uF
84 X1: Crystal 20MHz(16MHz/12MHz)
diff --git a/converter/ps2_usb/config.h b/converter/ps2_usb/config.h
deleted file mode 100644
index c0a4fab13..000000000
--- a/converter/ps2_usb/config.h
+++ /dev/null
@@ -1,173 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include <avr/interrupt.h>
22
23#define VENDOR_ID 0xFEED
24#define PRODUCT_ID 0x6512
25#define DEVICE_VER 0x0001
26#define MANUFACTURER t.m.k.
27#define PRODUCT PS/2 keyboard converter
28#define DESCRIPTION convert PS/2 keyboard to USB
29
30
31/* matrix size */
32#define MATRIX_ROWS 32 // keycode bit: 3-0
33#define MATRIX_COLS 8 // keycode bit: 6-4
34
35
36/* key combination for command */
37#define IS_COMMAND() ( \
38 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
39 keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
40)
41
42
43//#define NO_SUSPEND_POWER_DOWN
44
45
46/*
47 * PS/2 Busywait
48 */
49#ifdef PS2_USE_BUSYWAIT
50#define PS2_CLOCK_PORT PORTD
51#define PS2_CLOCK_PIN PIND
52#define PS2_CLOCK_DDR DDRD
53#define PS2_CLOCK_BIT 1
54#define PS2_DATA_PORT PORTD
55#define PS2_DATA_PIN PIND
56#define PS2_DATA_DDR DDRD
57#define PS2_DATA_BIT 0
58#endif
59
60/*
61 * PS/2 Pin interrupt
62 */
63#ifdef PS2_USE_INT
64/* uses INT1 for clock line(ATMega32U4) */
65#define PS2_CLOCK_PORT PORTD
66#define PS2_CLOCK_PIN PIND
67#define PS2_CLOCK_DDR DDRD
68#define PS2_CLOCK_BIT 1
69#define PS2_DATA_PORT PORTD
70#define PS2_DATA_PIN PIND
71#define PS2_DATA_DDR DDRD
72#define PS2_DATA_BIT 0
73#define PS2_INT_INIT() do { \
74 EICRA |= ((1<<ISC11) | \
75 (0<<ISC10)); \
76} while (0)
77#define PS2_INT_ON() do { \
78 EIMSK |= (1<<INT1); \
79} while (0)
80#define PS2_INT_OFF() do { \
81 EIMSK &= ~(1<<INT1); \
82} while (0)
83#define PS2_INT_VECT INT1_vect
84#endif
85
86/*
87 * PS/2 USART
88 */
89#ifdef PS2_USE_USART
90#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
91/* XCK for clock line and RXD for data line */
92#define PS2_CLOCK_PORT PORTD
93#define PS2_CLOCK_PIN PIND
94#define PS2_CLOCK_DDR DDRD
95#define PS2_CLOCK_BIT 5
96#define PS2_DATA_PORT PORTD
97#define PS2_DATA_PIN PIND
98#define PS2_DATA_DDR DDRD
99#define PS2_DATA_BIT 2
100/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
101/* set DDR of CLOCK as input to be slave */
102#define PS2_USART_INIT() do { \
103 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
104 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
105 UCSR1C = ((1 << UMSEL10) | \
106 (3 << UPM10) | \
107 (0 << USBS1) | \
108 (3 << UCSZ10) | \
109 (0 << UCPOL1)); \
110 UCSR1A = 0; \
111 UBRR1H = 0; \
112 UBRR1L = 0; \
113} while (0)
114#define PS2_USART_RX_INT_ON() do { \
115 UCSR1B = ((1 << RXCIE1) | \
116 (1 << RXEN1)); \
117} while (0)
118#define PS2_USART_RX_POLL_ON() do { \
119 UCSR1B = (1 << RXEN1); \
120} while (0)
121#define PS2_USART_OFF() do { \
122 UCSR1C = 0; \
123 UCSR1B &= ~((1 << RXEN1) | \
124 (1 << TXEN1)); \
125} while (0)
126#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
127#define PS2_USART_RX_DATA UDR1
128#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
129#define PS2_USART_RX_VECT USART1_RX_vect
130#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
131/* XCK for clock line and RXD for data line */
132#define PS2_CLOCK_PORT PORTD
133#define PS2_CLOCK_PIN PIND
134#define PS2_CLOCK_DDR DDRD
135#define PS2_CLOCK_BIT 4
136#define PS2_DATA_PORT PORTD
137#define PS2_DATA_PIN PIND
138#define PS2_DATA_DDR DDRD
139#define PS2_DATA_BIT 0
140/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
141/* set DDR of CLOCK as input to be slave */
142#define PS2_USART_INIT() do { \
143 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
144 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
145 UCSR0C = ((1 << UMSEL00) | \
146 (3 << UPM00) | \
147 (0 << USBS0) | \
148 (3 << UCSZ00) | \
149 (0 << UCPOL0)); \
150 UCSR0A = 0; \
151 UBRR0H = 0; \
152 UBRR0L = 0; \
153} while (0)
154#define PS2_USART_RX_INT_ON() do { \
155 UCSR0B = ((1 << RXCIE0) | \
156 (1 << RXEN0)); \
157} while (0)
158#define PS2_USART_RX_POLL_ON() do { \
159 UCSR0B = (1 << RXEN0); \
160} while (0)
161#define PS2_USART_OFF() do { \
162 UCSR0C = 0; \
163 UCSR0B &= ~((1 << RXEN0) | \
164 (1 << TXEN0)); \
165} while (0)
166#define PS2_USART_RX_READY (UCSR0A & (1<<RXC0))
167#define PS2_USART_RX_DATA UDR0
168#define PS2_USART_ERROR (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
169#define PS2_USART_RX_VECT USART_RX_vect
170#endif
171#endif
172
173#endif
diff --git a/converter/ps2_usb/config_mbed.h b/converter/ps2_usb/config_mbed.h
deleted file mode 100644
index 5819763e6..000000000
--- a/converter/ps2_usb/config_mbed.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_MBED_H
19#define CONFIG_MBED_H
20
21
22#if 0
23// duplicated name against mbed USBDeivce
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x6512
26#endif
27#define DEVICE_VER 0x0001
28#define MANUFACTURER t.m.k.
29#define PRODUCT PS/2 keyboard converter
30#define DESCRIPTION convert PS/2 keyboard to USB
31
32
33/* matrix size */
34#define MATRIX_ROWS 32 // keycode bit: 3-0
35#define MATRIX_COLS 8 // keycode bit: 6-4
36
37
38/* key combination for command */
39#define IS_COMMAND() ( \
40 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
41 keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
42)
43
44
45/*
46 * PS/2 Busywait
47 */
48#ifdef PS2_USE_BUSYWAIT
49# define PS2_CLOCK_PORT PORTD
50# define PS2_CLOCK_PIN PIND
51# define PS2_CLOCK_DDR DDRD
52# define PS2_CLOCK_BIT 5
53# define PS2_DATA_PORT PORTD
54# define PS2_DATA_PIN PIND
55# define PS2_DATA_DDR DDRD
56# define PS2_DATA_BIT 2
57#endif
58
59
60#endif
diff --git a/converter/ps2_usb/config_tmk_rev1.h b/converter/ps2_usb/config_tmk_rev1.h
deleted file mode 100644
index 75dc97df3..000000000
--- a/converter/ps2_usb/config_tmk_rev1.h
+++ /dev/null
@@ -1,147 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include <avr/interrupt.h>
22
23#define VENDOR_ID 0xFEED
24#define PRODUCT_ID 0x6512
25#define DEVICE_VER 0x0001
26#define MANUFACTURER t.m.k.
27#define PRODUCT PS/2 keyboard converter
28#define DESCRIPTION convert PS/2 keyboard to USB
29
30
31/* matrix size */
32#define MATRIX_ROWS 32 // keycode bit: 3-0
33#define MATRIX_COLS 8 // keycode bit: 6-4
34
35
36/* key combination for command */
37#define IS_COMMAND() ( \
38 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
39 keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
40)
41
42
43//#define NO_SUSPEND_POWER_DOWN
44
45
46/*
47 * PS/2 Busywait
48 */
49#ifdef PS2_USE_BUSYWAIT
50#define PS2_CLOCK_PORT PORTD
51#define PS2_CLOCK_PIN PIND
52#define PS2_CLOCK_DDR DDRD
53#define PS2_CLOCK_BIT 5
54#define PS2_DATA_PORT PORTD
55#define PS2_DATA_PIN PIND
56#define PS2_DATA_DDR DDRD
57#define PS2_DATA_BIT 2
58#endif
59
60/*
61 * PS/2 USART
62 */
63#ifdef PS2_USE_USART
64#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
65/* XCK for clock line and RXD for data line */
66#define PS2_CLOCK_PORT PORTD
67#define PS2_CLOCK_PIN PIND
68#define PS2_CLOCK_DDR DDRD
69#define PS2_CLOCK_BIT 5
70#define PS2_DATA_PORT PORTD
71#define PS2_DATA_PIN PIND
72#define PS2_DATA_DDR DDRD
73#define PS2_DATA_BIT 2
74/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
75/* set DDR of CLOCK as input to be slave */
76#define PS2_USART_INIT() do { \
77 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
78 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
79 UCSR1C = ((1 << UMSEL10) | \
80 (3 << UPM10) | \
81 (0 << USBS1) | \
82 (3 << UCSZ10) | \
83 (0 << UCPOL1)); \
84 UCSR1A = 0; \
85 UBRR1H = 0; \
86 UBRR1L = 0; \
87} while (0)
88#define PS2_USART_RX_INT_ON() do { \
89 UCSR1B = ((1 << RXCIE1) | \
90 (1 << RXEN1)); \
91} while (0)
92#define PS2_USART_RX_POLL_ON() do { \
93 UCSR1B = (1 << RXEN1); \
94} while (0)
95#define PS2_USART_OFF() do { \
96 UCSR1C = 0; \
97 UCSR1B &= ~((1 << RXEN1) | \
98 (1 << TXEN1)); \
99} while (0)
100#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
101#define PS2_USART_RX_DATA UDR1
102#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
103#define PS2_USART_RX_VECT USART1_RX_vect
104#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
105/* XCK for clock line and RXD for data line */
106#define PS2_CLOCK_PORT PORTD
107#define PS2_CLOCK_PIN PIND
108#define PS2_CLOCK_DDR DDRD
109#define PS2_CLOCK_BIT 4
110#define PS2_DATA_PORT PORTD
111#define PS2_DATA_PIN PIND
112#define PS2_DATA_DDR DDRD
113#define PS2_DATA_BIT 0
114/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
115/* set DDR of CLOCK as input to be slave */
116#define PS2_USART_INIT() do { \
117 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
118 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
119 UCSR0C = ((1 << UMSEL00) | \
120 (3 << UPM00) | \
121 (0 << USBS0) | \
122 (3 << UCSZ00) | \
123 (0 << UCPOL0)); \
124 UCSR0A = 0; \
125 UBRR0H = 0; \
126 UBRR0L = 0; \
127} while (0)
128#define PS2_USART_RX_INT_ON() do { \
129 UCSR0B = ((1 << RXCIE0) | \
130 (1 << RXEN0)); \
131} while (0)
132#define PS2_USART_RX_POLL_ON() do { \
133 UCSR0B = (1 << RXEN0); \
134} while (0)
135#define PS2_USART_OFF() do { \
136 UCSR0C = 0; \
137 UCSR0B &= ~((1 << RXEN0) | \
138 (1 << TXEN0)); \
139} while (0)
140#define PS2_USART_RX_READY (UCSR0A & (1<<RXC0))
141#define PS2_USART_RX_DATA UDR0
142#define PS2_USART_ERROR (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
143#define PS2_USART_RX_VECT USART_RX_vect
144#endif
145#endif
146
147#endif
diff --git a/converter/ps2_usb/config_tmk_rev2.h b/converter/ps2_usb/config_tmk_rev2.h
deleted file mode 100644
index 2e91838e2..000000000
--- a/converter/ps2_usb/config_tmk_rev2.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include <avr/interrupt.h>
22
23#define VENDOR_ID 0xFEED
24#define PRODUCT_ID 0x6512
25#define DEVICE_VER 0x0001
26#define MANUFACTURER t.m.k.
27#define PRODUCT PS/2 keyboard converter
28#define DESCRIPTION convert PS/2 keyboard to USB
29
30
31/* matrix size */
32#define MATRIX_ROWS 32 // keycode bit: 3-0
33#define MATRIX_COLS 8 // keycode bit: 6-4
34
35
36/* key combination for command */
37#define IS_COMMAND() ( \
38 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
39)
40
41
42//#define NO_SUSPEND_POWER_DOWN
43
44
45/*
46 * PS/2 Busywait
47 */
48#ifdef PS2_USE_BUSYWAIT
49#define PS2_CLOCK_PORT PORTD
50#define PS2_CLOCK_PIN PIND
51#define PS2_CLOCK_DDR DDRD
52#define PS2_CLOCK_BIT 1
53#define PS2_DATA_PORT PORTD
54#define PS2_DATA_PIN PIND
55#define PS2_DATA_DDR DDRD
56#define PS2_DATA_BIT 0
57#endif
58
59/*
60 * PS/2 Pin interrupt
61 */
62#ifdef PS2_USE_INT
63/* uses INT1 for clock line(ATMega32U4) */
64#define PS2_CLOCK_PORT PORTD
65#define PS2_CLOCK_PIN PIND
66#define PS2_CLOCK_DDR DDRD
67#define PS2_CLOCK_BIT 1
68#define PS2_DATA_PORT PORTD
69#define PS2_DATA_PIN PIND
70#define PS2_DATA_DDR DDRD
71#define PS2_DATA_BIT 0
72#define PS2_INT_INIT() do { \
73 EICRA |= ((1<<ISC11) | \
74 (0<<ISC10)); \
75} while (0)
76#define PS2_INT_ON() do { \
77 EIMSK |= (1<<INT1); \
78} while (0)
79#define PS2_INT_OFF() do { \
80 EIMSK &= ~(1<<INT1); \
81} while (0)
82#define PS2_INT_VECT INT1_vect
83#endif
84
85#endif
diff --git a/converter/ps2_usb/keymap_common.c b/converter/ps2_usb/keymap_common.c
deleted file mode 100644
index e344fb416..000000000
--- a/converter/ps2_usb/keymap_common.c
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include "keymap_common.h"
18#include "progmem.h"
19
20
21/* translates key to keycode */
22uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
23{
24 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
25}
26
27/* translates Fn keycode to action */
28action_t keymap_fn_to_action(uint8_t keycode)
29{
30 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
31}
diff --git a/converter/ps2_usb/keymap_common.h b/converter/ps2_usb/keymap_common.h
deleted file mode 100644
index d783e01de..000000000
--- a/converter/ps2_usb/keymap_common.h
+++ /dev/null
@@ -1,173 +0,0 @@
1/*
2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#ifndef KEYMAP_COMMON_H
18#define KEYMAP_COMMON_H
19
20#include <stdint.h>
21#include <stdbool.h>
22#include "keycode.h"
23#include "action.h"
24#include "action_macro.h"
25#include "report.h"
26#include "print.h"
27#include "debug.h"
28#include "keymap.h"
29
30
31// 32*8(256) byte array which converts PS/2 code into USB code
32extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
33extern const uint16_t fn_actions[];
34
35
36/* All keys */
37#define KEYMAP_ALL( \
38 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
39 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
40 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
41 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
42 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
43 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
44 \
45 K61, /* for European ISO */ \
46 K51, K13, K6A, K64, K67, /* for Japanese JIS */ \
47 K08, K10, K18, K20, K28, K30, K38, K40, K48, K50, K57, K5F, /* F13-24 */ \
48 KB7, KBF, KDE, /* System Power, Sleep, Wake */ \
49 KA3, KB2, KA1, /* Mute, Volume Up, Volume Down */ \
50 KCD, K95, KBB, KB4, KD0, /* Next, Previous, Stop, Pause, Media Select */ \
51 KC8, KAB, KC0, /* Mail, Calculator, My Computer */ \
52 K90, KBA, KB8, KB0, /* WWW Search, Home, Back, Forward */ \
53 KA8, KA0, K98 /* WWW Stop, Refresh, Favorites */ \
54) { \
55 { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
56 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_NO }, \
57 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO }, \
58 { KC_##K18, KC_NO, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO }, \
59 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
60 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_NO }, \
61 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_NO }, \
62 { KC_##K38, KC_NO, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
63 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
64 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
65 { KC_##K50, KC_##K51, KC_##K52, KC_NO, KC_##K54, KC_##K55, KC_NO, KC_##K57 }, \
66 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_##K5D, KC_NO, KC_##K5F }, \
67 { KC_NO, KC_##K61, KC_NO, KC_NO, KC_##K64, KC_NO, KC_##K66, KC_##K67 }, \
68 { KC_NO, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_NO, KC_NO, KC_NO }, \
69 { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
70 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \
71 { KC_NO, KC_NO, KC_NO, KC_##K83, KC_NO, KC_NO, KC_NO, KC_NO }, \
72 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
73 { KC_##K90, KC_##K91, KC_NO, KC_NO, KC_##K94, KC_##K95, KC_NO, KC_NO }, \
74 { KC_##K98, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K9F }, \
75 { KC_##KA0, KC_##KA1, KC_NO, KC_##KA3, KC_NO, KC_NO, KC_NO, KC_##KA7 }, \
76 { KC_##KA8, KC_NO, KC_NO, KC_##KAB, KC_NO, KC_NO, KC_NO, KC_##KAF }, \
77 { KC_##KB0, KC_NO, KC_##KB2, KC_NO, KC_##KB4, KC_NO, KC_NO, KC_##KB7 }, \
78 { KC_##KB8, KC_NO, KC_##KBA, KC_##KBB, KC_NO, KC_NO, KC_NO, KC_##KBF }, \
79 { KC_##KC0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
80 { KC_##KC8, KC_NO, KC_##KCA, KC_NO, KC_NO, KC_##KCD, KC_NO, KC_NO }, \
81 { KC_##KD0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
82 { KC_NO, KC_NO, KC_##KDA, KC_NO, KC_NO, KC_NO, KC_##KDE, KC_NO }, \
83 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
84 { KC_NO, KC_##KE9, KC_NO, KC_##KEB, KC_##KEC, KC_NO, KC_NO, KC_NO }, \
85 { KC_##KF0, KC_##KF1, KC_##KF2, KC_NO, KC_##KF4, KC_##KF5, KC_NO, KC_NO }, \
86 { KC_NO, KC_NO, KC_##KFA, KC_NO, KC_##KFC, KC_##KFD, KC_##KFE, KC_NO }, \
87}
88
89/* US layout */
90#define KEYMAP( \
91 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
92 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
93 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
94 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
95 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
96 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
97) \
98KEYMAP_ALL( \
99 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
100 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
101 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
102 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
103 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
104 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
105 \
106 NUBS, \
107 RO, KANA, JYEN, HENK, MHEN, \
108 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
109 SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
110 AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
111 MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
112 MAIL, CALCULATOR, MY_COMPUTER, \
113 WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
114 WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
115)
116
117/* ISO layout */
118#define KEYMAP_ISO( \
119 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
120 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
121 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
122 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D,K5A, K6B,K73,K74,K79, \
123 K12,K61,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
124 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
125) \
126KEYMAP_ALL( \
127 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
128 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
129 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
130 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
131 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
132 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
133 \
134 K61, \
135 RO, KANA, JYEN, HENK, MHEN, \
136 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
137 SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
138 AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
139 MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
140 MAIL, CALCULATOR, MY_COMPUTER, \
141 WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
142 WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
143)
144
145/* JIS layout */
146#define KEYMAP_JIS( \
147 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
148 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K6A,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
149 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
150 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D, K5A, K6B,K73,K74,K79, \
151 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K51, K59, KF5, K69,K72,K7A, \
152 K14,K9F,K11, K67,K29,K64,K13, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
153) \
154KEYMAP_ALL( \
155 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
156 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
157 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
158 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
159 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
160 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
161 \
162 NUBS, \
163 K51, K13, K6A, K64, K67, \
164 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
165 SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
166 AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
167 MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
168 MAIL, CALCULATOR, MY_COMPUTER, \
169 WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
170 WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
171)
172
173#endif
diff --git a/converter/ps2_usb/keymap_jis.c b/converter/ps2_usb/keymap_jis.c
deleted file mode 100644
index 02585150f..000000000
--- a/converter/ps2_usb/keymap_jis.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * JIS layout Japanese keyboard
3 */
4#include "keymap_common.h"
5
6const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7 /* 0: JIS LAYOUT
8 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
9 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
10 * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
11 * ,-----------------------------------------------------------. ,-----------. ,---------------.
12 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| JY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -|
13 * |-----------------------------------------------------------| |-----------| |---------------|
14 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Ret | |Del|End|PgD| | 7| 8| 9| |
15 * |------------------------------------------------------` | `-----------' |-----------| +|
16 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| :| \| | | 4| 5| 6| |
17 * |-----------------------------------------------------------| ,---. |---------------|
18 * |Shift | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3| |
19 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
20 * |Ctrl |Gui |Alt |MHEN| Space |HENK|KANA|Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
21 * `-----------------------------------------------------------' `-----------' `---------------'
22 */
23 KEYMAP_JIS(
24 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
25 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
26 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, END, PGDN, P7, P8, P9,
27 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, ENT, P4, P5, P6, PPLS,
28 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, RSFT, UP, P1, P2, P3,
29 LCTL,LGUI,LALT, MHEN,SPC, HENK,KANA, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
30 ),
31};
32
33const uint16_t PROGMEM fn_actions[] = {
34};
diff --git a/converter/ps2_usb/keymap_plain.c b/converter/ps2_usb/keymap_plain.c
deleted file mode 100644
index 51b2fddb5..000000000
--- a/converter/ps2_usb/keymap_plain.c
+++ /dev/null
@@ -1,32 +0,0 @@
1#include "keymap_common.h"
2
3
4const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5 /* 0: default
6 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
7 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
8 * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
9 * ,-----------------------------------------------------------. ,-----------. ,---------------.
10 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
11 * |-----------------------------------------------------------| |-----------| |---------------|
12 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
13 * |-----------------------------------------------------------| `-----------' |-----------| +|
14 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
15 * |-----------------------------------------------------------| ,---. |---------------|
16 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
17 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
18 * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
19 * `-----------------------------------------------------------' `-----------' `---------------'
20 */
21 KEYMAP(
22 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
23 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
24 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
25 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
26 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
27 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
28 ),
29};
30
31const uint16_t PROGMEM fn_actions[] = {
32};
diff --git a/converter/ps2_usb/keymap_spacefn.c b/converter/ps2_usb/keymap_spacefn.c
deleted file mode 100644
index bffd2bc60..000000000
--- a/converter/ps2_usb/keymap_spacefn.c
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * SpaceFN layout
3 * http://geekhack.org/index.php?topic=51069.0
4 */
5#include "keymap_common.h"
6
7
8const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
9 /* 0: default
10 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
11 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
12 * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
13 * ,-----------------------------------------------------------. ,-----------. ,---------------.
14 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
15 * |-----------------------------------------------------------| |-----------| |---------------|
16 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
17 * |-----------------------------------------------------------| `-----------' |-----------| +|
18 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
19 * |-----------------------------------------------------------| ,---. |---------------|
20 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
21 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
22 * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
23 * `-----------------------------------------------------------' `-----------' `---------------'
24 */
25 KEYMAP(
26 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
27 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
28 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
29 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
30 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
31 LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
32 ),
33
34 /* 1: SpaceFN
35 * ,-----------------------------------------------------------.
36 * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
37 * |-----------------------------------------------------------|
38 * | | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins |
39 * |-----------------------------------------------------------|
40 * | | | | | | |PgU|Lef|Dow|Rig| | | |
41 * |-----------------------------------------------------------|
42 * | | | | | |Spc|PgD|` |~ | |Men| |
43 * |-----------------------------------------------------------|
44 * | | | | | | | | |
45 * `-----------------------------------------------------------'
46 */
47 KEYMAP(
48 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
49 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
50 TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9,
51 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
52 TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS, UP, P1, P2, P3,
53 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
54 ),
55};
56
57const uint16_t PROGMEM fn_actions[] = {
58 [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
59 [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
60};
61
diff --git a/converter/ps2_usb/led.c b/converter/ps2_usb/led.c
deleted file mode 100644
index e448e84ec..000000000
--- a/converter/ps2_usb/led.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "stdint.h"
19#include "ps2.h"
20#include "led.h"
21
22
23void led_set(uint8_t usb_led)
24{
25 uint8_t ps2_led = 0;
26 if (usb_led & (1<<USB_LED_SCROLL_LOCK))
27 ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
28 if (usb_led & (1<<USB_LED_NUM_LOCK))
29 ps2_led |= (1<<PS2_LED_NUM_LOCK);
30 if (usb_led & (1<<USB_LED_CAPS_LOCK))
31 ps2_led |= (1<<PS2_LED_CAPS_LOCK);
32 ps2_host_set_led(ps2_led);
33}
diff --git a/converter/ps2_usb/main.cpp b/converter/ps2_usb/main.cpp
deleted file mode 100644
index 860af149a..000000000
--- a/converter/ps2_usb/main.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
1#include "mbed.h"
2#include "debug.h"
3#include "timer.h"
4#include "action.h"
5#include "keycode.h"
6#include "host.h"
7#include "host_driver.h"
8#include "mbed_driver.h"
9
10
11// Button and LEDs of LPC11U35 board
12DigitalIn isp(P0_1); // ISP button
13DigitalOut led_red(P0_20);
14DigitalOut led_green(P0_21);
15
16
17int main(void) {
18 isp.mode(PullUp);
19 led_red = 1;
20 led_green = 0;
21
22 timer_init();
23 host_set_driver(&mbed_driver);
24 keyboard_init();
25
26 //debug_enable = true;
27 xprintf("mbed_onekey ver.eee:\r\n");
28
29
30 bool last_isp = isp;
31 while (1) {
32 keyboard_task();
33
34 //led_green = !led_green;
35 if (last_isp == isp) continue;
36 last_isp = isp;
37 if (last_isp == 0) {
38 led_red = 0; // on
39 dprintf("timer: %i\r\n", timer_read());
40 //register_code(KC_A);
41 } else {
42 led_red = 1; // off
43 //unregister_code(KC_A);
44 }
45 }
46}
diff --git a/converter/ps2_usb/matrix.c b/converter/ps2_usb/matrix.c
deleted file mode 100644
index 45cf2a4a9..000000000
--- a/converter/ps2_usb/matrix.c
+++ /dev/null
@@ -1,486 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include "action.h"
21#include "print.h"
22#include "util.h"
23#include "debug.h"
24#include "ps2.h"
25#include "matrix.h"
26
27
28static void matrix_make(uint8_t code);
29static void matrix_break(uint8_t code);
30static void matrix_clear(void);
31#ifdef MATRIX_HAS_GHOST
32static bool matrix_has_ghost_in_row(uint8_t row);
33#endif
34
35
36/*
37 * Matrix Array usage:
38 * 'Scan Code Set 2' is assigned into 256(32x8)cell matrix.
39 * Hmm, it is very sparse and not efficient :(
40 *
41 * Notes:
42 * Both 'Hanguel/English'(F1) and 'Hanja'(F2) collide with 'Delete'(E0 71) and 'Down'(E0 72).
43 * These two Korean keys need exceptional handling and are not supported for now. Sorry.
44 *
45 * 8bit wide
46 * +---------+
47 * 0| |
48 * :| XX | 00-7F for normal codes(without E0-prefix)
49 * f|_________|
50 * 10| |
51 * :| E0 YY | 80-FF for E0-prefixed codes
52 * 1f| | (<YY>|0x80) is used as matrix position.
53 * +---------+
54 *
55 * Exceptions:
56 * 0x83: F7(0x83) This is a normal code but beyond 0x7F.
57 * 0xFC: PrintScreen
58 * 0xFE: Pause
59 */
60static uint8_t matrix[MATRIX_ROWS];
61#define ROW(code) (code>>3)
62#define COL(code) (code&0x07)
63
64// matrix positions for exceptional keys
65#define F7 (0x83)
66#define PRINT_SCREEN (0xFC)
67#define PAUSE (0xFE)
68
69static bool is_modified = false;
70
71
72inline
73uint8_t matrix_rows(void)
74{
75 return MATRIX_ROWS;
76}
77
78inline
79uint8_t matrix_cols(void)
80{
81 return MATRIX_COLS;
82}
83
84void matrix_init(void)
85{
86 debug_enable = true;
87 ps2_host_init();
88
89 // initialize matrix state: all keys off
90 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
91
92 return;
93}
94
95/*
96 * PS/2 Scan Code Set 2: Exceptional Handling
97 *
98 * There are several keys to be handled exceptionally.
99 * The scan code for these keys are varied or prefix/postfix'd
100 * depending on modifier key state.
101 *
102 * Keyboard Scan Code Specification:
103 * http://www.microsoft.com/whdc/archive/scancode.mspx
104 * http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc
105 *
106 *
107 * 1) Insert, Delete, Home, End, PageUp, PageDown, Up, Down, Right, Left
108 * a) when Num Lock is off
109 * modifiers | make | break
110 * ----------+---------------------------+----------------------
111 * Ohter | <make> | <break>
112 * LShift | E0 F0 12 <make> | <break> E0 12
113 * RShift | E0 F0 59 <make> | <break> E0 59
114 * L+RShift | E0 F0 12 E0 F0 59 <make> | <break> E0 59 E0 12
115 *
116 * b) when Num Lock is on
117 * modifiers | make | break
118 * ----------+---------------------------+----------------------
119 * Other | E0 12 <make> | <break> E0 F0 12
120 * Shift'd | <make> | <break>
121 *
122 * Handling: These prefix/postfix codes are ignored.
123 *
124 *
125 * 2) Keypad /
126 * modifiers | make | break
127 * ----------+---------------------------+----------------------
128 * Ohter | <make> | <break>
129 * LShift | E0 F0 12 <make> | <break> E0 12
130 * RShift | E0 F0 59 <make> | <break> E0 59
131 * L+RShift | E0 F0 12 E0 F0 59 <make> | <break> E0 59 E0 12
132 *
133 * Handling: These prefix/postfix codes are ignored.
134 *
135 *
136 * 3) PrintScreen
137 * modifiers | make | break
138 * ----------+--------------+-----------------------------------
139 * Other | E0 12 E0 7C | E0 F0 7C E0 F0 12
140 * Shift'd | E0 7C | E0 F0 7C
141 * Control'd | E0 7C | E0 F0 7C
142 * Alt'd | 84 | F0 84
143 *
144 * Handling: These prefix/postfix codes are ignored, and both scan codes
145 * 'E0 7C' and 84 are seen as PrintScreen.
146 *
147 * 4) Pause
148 * modifiers | make(no break code)
149 * ----------+--------------------------------------------------
150 * Other | E1 14 77 E1 F0 14 F0 77
151 * Control'd | E0 7E E0 F0 7E
152 *
153 * Handling: Both code sequences are treated as a whole.
154 * And we need a ad hoc 'pseudo break code' hack to get the key off
155 * because it has no break code.
156 *
157 */
158uint8_t matrix_scan(void)
159{
160
161 // scan code reading states
162 static enum {
163 INIT,
164 F0,
165 E0,
166 E0_F0,
167 // Pause
168 E1,
169 E1_14,
170 E1_14_77,
171 E1_14_77_E1,
172 E1_14_77_E1_F0,
173 E1_14_77_E1_F0_14,
174 E1_14_77_E1_F0_14_F0,
175 // Control'd Pause
176 E0_7E,
177 E0_7E_E0,
178 E0_7E_E0_F0,
179 } state = INIT;
180
181
182 is_modified = false;
183
184 // 'pseudo break code' hack
185 if (matrix_is_on(ROW(PAUSE), COL(PAUSE))) {
186 matrix_break(PAUSE);
187 }
188
189 uint8_t code = ps2_host_recv();
190 if (code) xprintf("%i\r\n", code);
191 if (!ps2_error) {
192 switch (state) {
193 case INIT:
194 switch (code) {
195 case 0xE0:
196 state = E0;
197 break;
198 case 0xF0:
199 state = F0;
200 break;
201 case 0xE1:
202 state = E1;
203 break;
204 case 0x83: // F7
205 matrix_make(F7);
206 state = INIT;
207 break;
208 case 0x84: // Alt'd PrintScreen
209 matrix_make(PRINT_SCREEN);
210 state = INIT;
211 break;
212 case 0x00: // Overrun [3]p.25
213 matrix_clear();
214 clear_keyboard();
215 print("Overrun\n");
216 state = INIT;
217 break;
218 default: // normal key make
219 if (code < 0x80) {
220 matrix_make(code);
221 } else {
222 matrix_clear();
223 clear_keyboard();
224 xprintf("unexpected scan code at INIT: %02X\n", code);
225 }
226 state = INIT;
227 }
228 break;
229 case E0: // E0-Prefixed
230 switch (code) {
231 case 0x12: // to be ignored
232 case 0x59: // to be ignored
233 state = INIT;
234 break;
235 case 0x7E: // Control'd Pause
236 state = E0_7E;
237 break;
238 case 0xF0:
239 state = E0_F0;
240 break;
241 default:
242 if (code < 0x80) {
243 matrix_make(code|0x80);
244 } else {
245 matrix_clear();
246 clear_keyboard();
247 xprintf("unexpected scan code at E0: %02X\n", code);
248 }
249 state = INIT;
250 }
251 break;
252 case F0: // Break code
253 switch (code) {
254 case 0x83: // F7
255 matrix_break(F7);
256 state = INIT;
257 break;
258 case 0x84: // Alt'd PrintScreen
259 matrix_break(PRINT_SCREEN);
260 state = INIT;
261 break;
262 case 0xF0:
263 matrix_clear();
264 clear_keyboard();
265 xprintf("unexpected scan code at F0: F0(clear and cont.)\n");
266 break;
267 default:
268 if (code < 0x80) {
269 matrix_break(code);
270 } else {
271 matrix_clear();
272 clear_keyboard();
273 xprintf("unexpected scan code at F0: %02X\n", code);
274 }
275 state = INIT;
276 }
277 break;
278 case E0_F0: // Break code of E0-prefixed
279 switch (code) {
280 case 0x12: // to be ignored
281 case 0x59: // to be ignored
282 state = INIT;
283 break;
284 default:
285 if (code < 0x80) {
286 matrix_break(code|0x80);
287 } else {
288 matrix_clear();
289 clear_keyboard();
290 xprintf("unexpected scan code at E0_F0: %02X\n", code);
291 }
292 state = INIT;
293 }
294 break;
295 // following are states of Pause
296 case E1:
297 switch (code) {
298 case 0x14:
299 state = E1_14;
300 break;
301 default:
302 state = INIT;
303 }
304 break;
305 case E1_14:
306 switch (code) {
307 case 0x77:
308 state = E1_14_77;
309 break;
310 default:
311 state = INIT;
312 }
313 break;
314 case E1_14_77:
315 switch (code) {
316 case 0xE1:
317 state = E1_14_77_E1;
318 break;
319 default:
320 state = INIT;
321 }
322 break;
323 case E1_14_77_E1:
324 switch (code) {
325 case 0xF0:
326 state = E1_14_77_E1_F0;
327 break;
328 default:
329 state = INIT;
330 }
331 break;
332 case E1_14_77_E1_F0:
333 switch (code) {
334 case 0x14:
335 state = E1_14_77_E1_F0_14;
336 break;
337 default:
338 state = INIT;
339 }
340 break;
341 case E1_14_77_E1_F0_14:
342 switch (code) {
343 case 0xF0:
344 state = E1_14_77_E1_F0_14_F0;
345 break;
346 default:
347 state = INIT;
348 }
349 break;
350 case E1_14_77_E1_F0_14_F0:
351 switch (code) {
352 case 0x77:
353 matrix_make(PAUSE);
354 state = INIT;
355 break;
356 default:
357 state = INIT;
358 }
359 break;
360 // Following are states of Control'd Pause
361 case E0_7E:
362 if (code == 0xE0)
363 state = E0_7E_E0;
364 else
365 state = INIT;
366 break;
367 case E0_7E_E0:
368 if (code == 0xF0)
369 state = E0_7E_E0_F0;
370 else
371 state = INIT;
372 break;
373 case E0_7E_E0_F0:
374 if (code == 0x7E)
375 matrix_make(PAUSE);
376 state = INIT;
377 break;
378 default:
379 state = INIT;
380 }
381 }
382
383 // TODO: request RESEND when error occurs?
384/*
385 if (PS2_IS_FAILED(ps2_error)) {
386 uint8_t ret = ps2_host_send(PS2_RESEND);
387 xprintf("Resend: %02X\n", ret);
388 }
389*/
390 return 1;
391}
392
393bool matrix_is_modified(void)
394{
395 return is_modified;
396}
397
398inline
399bool matrix_has_ghost(void)
400{
401#ifdef MATRIX_HAS_GHOST
402 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
403 if (matrix_has_ghost_in_row(i))
404 return true;
405 }
406#endif
407 return false;
408}
409
410inline
411bool matrix_is_on(uint8_t row, uint8_t col)
412{
413 return (matrix[row] & (1<<col));
414}
415
416inline
417uint8_t matrix_get_row(uint8_t row)
418{
419 return matrix[row];
420}
421
422void matrix_print(void)
423{
424 print("\nr/c 01234567\n");
425 for (uint8_t row = 0; row < matrix_rows(); row++) {
426 phex(row); print(": ");
427 pbin_reverse(matrix_get_row(row));
428#ifdef MATRIX_HAS_GHOST
429 if (matrix_has_ghost_in_row(row)) {
430 print(" <ghost");
431 }
432#endif
433 print("\n");
434 }
435}
436
437uint8_t matrix_key_count(void)
438{
439 uint8_t count = 0;
440 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
441 count += bitpop(matrix[i]);
442 }
443 return count;
444}
445
446#ifdef MATRIX_HAS_GHOST
447inline
448static bool matrix_has_ghost_in_row(uint8_t row)
449{
450 // no ghost exists in case less than 2 keys on
451 if (((matrix[row] - 1) & matrix[row]) == 0)
452 return false;
453
454 // ghost exists in case same state as other row
455 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
456 if (i != row && (matrix[i] & matrix[row]) == matrix[row])
457 return true;
458 }
459 return false;
460}
461#endif
462
463
464inline
465static void matrix_make(uint8_t code)
466{
467 if (!matrix_is_on(ROW(code), COL(code))) {
468 matrix[ROW(code)] |= 1<<COL(code);
469 is_modified = true;
470 }
471}
472
473inline
474static void matrix_break(uint8_t code)
475{
476 if (matrix_is_on(ROW(code), COL(code))) {
477 matrix[ROW(code)] &= ~(1<<COL(code));
478 is_modified = true;
479 }
480}
481
482inline
483static void matrix_clear(void)
484{
485 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
486}
diff --git a/converter/ps2_usb/usbconfig.h b/converter/ps2_usb/usbconfig.h
deleted file mode 100644
index d0ca4c717..000000000
--- a/converter/ps2_usb/usbconfig.h
+++ /dev/null
@@ -1,377 +0,0 @@
1/* Name: usbconfig.h
2 * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 * Author: Christian Starkjohann
4 * Creation Date: 2005-04-01
5 * Tabsize: 4
6 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
9 */
10
11#ifndef __usbconfig_h_included__
12#define __usbconfig_h_included__
13
14
15/*
16General Description:
17This file is an example configuration (with inline documentation) for the USB
18driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
19also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
20wire the lines to any other port, as long as D+ is also wired to INT0 (or any
21other hardware interrupt, as long as it is the highest level interrupt, see
22section at the end of this file).
23*/
24
25/* ---------------------------- Hardware Config ---------------------------- */
26
27#define USB_CFG_IOPORTNAME D
28/* This is the port where the USB bus is connected. When you configure it to
29 * "B", the registers PORTB, PINB and DDRB will be used.
30 */
31#define USB_CFG_DMINUS_BIT 3
32/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
33 * This may be any bit in the port.
34 */
35#define USB_CFG_DPLUS_BIT 2
36/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
37 * This may be any bit in the port. Please note that D+ must also be connected
38 * to interrupt pin INT0! [You can also use other interrupts, see section
39 * "Optional MCU Description" below, or you can connect D- to the interrupt, as
40 * it is required if you use the USB_COUNT_SOF feature. If you use D- for the
41 * interrupt, the USB interrupt will also be triggered at Start-Of-Frame
42 * markers every millisecond.]
43 */
44#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
45/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
46 * 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
47 * require no crystal, they tolerate +/- 1% deviation from the nominal
48 * frequency. All other rates require a precision of 2000 ppm and thus a
49 * crystal!
50 * Since F_CPU should be defined to your actual clock rate anyway, you should
51 * not need to modify this setting.
52 */
53#define USB_CFG_CHECK_CRC 0
54/* Define this to 1 if you want that the driver checks integrity of incoming
55 * data packets (CRC checks). CRC checks cost quite a bit of code size and are
56 * currently only available for 18 MHz crystal clock. You must choose
57 * USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
58 */
59
60/* ----------------------- Optional Hardware Config ------------------------ */
61
62/* #define USB_CFG_PULLUP_IOPORTNAME D */
63/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
64 * V+, you can connect and disconnect the device from firmware by calling
65 * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
66 * This constant defines the port on which the pullup resistor is connected.
67 */
68/* #define USB_CFG_PULLUP_BIT 4 */
69/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
70 * above) where the 1.5k pullup resistor is connected. See description
71 * above for details.
72 */
73
74/* --------------------------- Functional Range ---------------------------- */
75
76#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
77/* Define this to 1 if you want to compile a version with two endpoints: The
78 * default control endpoint 0 and an interrupt-in endpoint (any other endpoint
79 * number).
80 */
81#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
82/* Define this to 1 if you want to compile a version with three endpoints: The
83 * default control endpoint 0, an interrupt-in endpoint 3 (or the number
84 * configured below) and a catch-all default interrupt-in endpoint as above.
85 * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
86 */
87#define USB_CFG_EP3_NUMBER 3
88/* If the so-called endpoint 3 is used, it can now be configured to any other
89 * endpoint number (except 0) with this macro. Default if undefined is 3.
90 */
91/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
92/* The above macro defines the startup condition for data toggling on the
93 * interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
94 * Since the token is toggled BEFORE sending any data, the first packet is
95 * sent with the oposite value of this configuration!
96 */
97#define USB_CFG_IMPLEMENT_HALT 0
98/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
99 * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
100 * it is required by the standard. We have made it a config option because it
101 * bloats the code considerably.
102 */
103#define USB_CFG_SUPPRESS_INTR_CODE 0
104/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
105 * want to send any data over them. If this macro is defined to 1, functions
106 * usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
107 * you need the interrupt-in endpoints in order to comply to an interface
108 * (e.g. HID), but never want to send any data. This option saves a couple
109 * of bytes in flash memory and the transmit buffers in RAM.
110 */
111#define USB_CFG_INTR_POLL_INTERVAL 10
112/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
113 * interval. The value is in milliseconds and must not be less than 10 ms for
114 * low speed devices.
115 */
116#define USB_CFG_IS_SELF_POWERED 0
117/* Define this to 1 if the device has its own power supply. Set it to 0 if the
118 * device is powered from the USB bus.
119 */
120#define USB_CFG_MAX_BUS_POWER 100
121/* Set this variable to the maximum USB bus power consumption of your device.
122 * The value is in milliamperes. [It will be divided by two since USB
123 * communicates power requirements in units of 2 mA.]
124 */
125#define USB_CFG_IMPLEMENT_FN_WRITE 1
126/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
127 * transfers. Set it to 0 if you don't need it and want to save a couple of
128 * bytes.
129 */
130#define USB_CFG_IMPLEMENT_FN_READ 0
131/* Set this to 1 if you need to send control replies which are generated
132 * "on the fly" when usbFunctionRead() is called. If you only want to send
133 * data from a static buffer, set it to 0 and return the data from
134 * usbFunctionSetup(). This saves a couple of bytes.
135 */
136#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
137/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
138 * You must implement the function usbFunctionWriteOut() which receives all
139 * interrupt/bulk data sent to any endpoint other than 0. The endpoint number
140 * can be found in 'usbRxToken'.
141 */
142#define USB_CFG_HAVE_FLOWCONTROL 0
143/* Define this to 1 if you want flowcontrol over USB data. See the definition
144 * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
145 * usbdrv.h.
146 */
147#define USB_CFG_DRIVER_FLASH_PAGE 0
148/* If the device has more than 64 kBytes of flash, define this to the 64 k page
149 * where the driver's constants (descriptors) are located. Or in other words:
150 * Define this to 1 for boot loaders on the ATMega128.
151 */
152#define USB_CFG_LONG_TRANSFERS 0
153/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
154 * in a single control-in or control-out transfer. Note that the capability
155 * for long transfers increases the driver size.
156 */
157/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
158/* This macro is a hook if you want to do unconventional things. If it is
159 * defined, it's inserted at the beginning of received message processing.
160 * If you eat the received message and don't want default processing to
161 * proceed, do a return after doing your things. One possible application
162 * (besides debugging) is to flash a status LED on each packet.
163 */
164/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
165/* This macro is a hook if you need to know when an USB RESET occurs. It has
166 * one parameter which distinguishes between the start of RESET state and its
167 * end.
168 */
169/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
170/* This macro (if defined) is executed when a USB SET_ADDRESS request was
171 * received.
172 */
173#define USB_COUNT_SOF 0
174/* define this macro to 1 if you need the global variable "usbSofCount" which
175 * counts SOF packets. This feature requires that the hardware interrupt is
176 * connected to D- instead of D+.
177 */
178/* #ifdef __ASSEMBLER__
179 * macro myAssemblerMacro
180 * in YL, TCNT0
181 * sts timer0Snapshot, YL
182 * endm
183 * #endif
184 * #define USB_SOF_HOOK myAssemblerMacro
185 * This macro (if defined) is executed in the assembler module when a
186 * Start Of Frame condition is detected. It is recommended to define it to
187 * the name of an assembler macro which is defined here as well so that more
188 * than one assembler instruction can be used. The macro may use the register
189 * YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
190 * immediately after an SOF pulse may be lost and must be retried by the host.
191 * What can you do with this hook? Since the SOF signal occurs exactly every
192 * 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
193 * designs running on the internal RC oscillator.
194 * Please note that Start Of Frame detection works only if D- is wired to the
195 * interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
196 */
197#define USB_CFG_CHECK_DATA_TOGGLING 0
198/* define this macro to 1 if you want to filter out duplicate data packets
199 * sent by the host. Duplicates occur only as a consequence of communication
200 * errors, when the host does not receive an ACK. Please note that you need to
201 * implement the filtering yourself in usbFunctionWriteOut() and
202 * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
203 * for each control- and out-endpoint to check for duplicate packets.
204 */
205#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
206/* define this macro to 1 if you want the function usbMeasureFrameLength()
207 * compiled in. This function can be used to calibrate the AVR's RC oscillator.
208 */
209#define USB_USE_FAST_CRC 0
210/* The assembler module has two implementations for the CRC algorithm. One is
211 * faster, the other is smaller. This CRC routine is only used for transmitted
212 * messages where timing is not critical. The faster routine needs 31 cycles
213 * per byte while the smaller one needs 61 to 69 cycles. The faster routine
214 * may be worth the 32 bytes bigger code size if you transmit lots of data and
215 * run the AVR close to its limit.
216 */
217
218/* -------------------------- Device Description --------------------------- */
219
220#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
221/* USB vendor ID for the device, low byte first. If you have registered your
222 * own Vendor ID, define it here. Otherwise you may use one of obdev's free
223 * shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
224 * *** IMPORTANT NOTE ***
225 * This template uses obdev's shared VID/PID pair for Vendor Class devices
226 * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
227 * the implications!
228 */
229#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
230/* This is the ID of the product, low byte first. It is interpreted in the
231 * scope of the vendor ID. If you have registered your own VID with usb.org
232 * or if you have licensed a PID from somebody else, define it here. Otherwise
233 * you may use one of obdev's free shared VID/PID pairs. See the file
234 * USB-IDs-for-free.txt for details!
235 * *** IMPORTANT NOTE ***
236 * This template uses obdev's shared VID/PID pair for Vendor Class devices
237 * with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
238 * the implications!
239 */
240#define USB_CFG_DEVICE_VERSION 0x00, 0x01
241/* Version number of the device: Minor number first, then major number.
242 */
243#define USB_CFG_VENDOR_NAME 't', '.', 'm', '.', 'k', '.'
244#define USB_CFG_VENDOR_NAME_LEN 6
245/* These two values define the vendor name returned by the USB device. The name
246 * must be given as a list of characters under single quotes. The characters
247 * are interpreted as Unicode (UTF-16) entities.
248 * If you don't want a vendor name string, undefine these macros.
249 * ALWAYS define a vendor name containing your Internet domain name if you use
250 * obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
251 * details.
252 */
253#define USB_CFG_DEVICE_NAME 'P', 'S', '/', '2', ' ', 'k', 'e', 'y', 'b', 'o', 'a', 'r', 'd', ' ', 'c', 'o', 'n', 'v', 'e', 'r', 't', 'e', 'r'
254#define USB_CFG_DEVICE_NAME_LEN 23
255/* Same as above for the device name. If you don't want a device name, undefine
256 * the macros. See the file USB-IDs-for-free.txt before you assign a name if
257 * you use a shared VID/PID.
258 */
259/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
260/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
261/* Same as above for the serial number. If you don't want a serial number,
262 * undefine the macros.
263 * It may be useful to provide the serial number through other means than at
264 * compile time. See the section about descriptor properties below for how
265 * to fine tune control over USB descriptors such as the string descriptor
266 * for the serial number.
267 */
268#define USB_CFG_DEVICE_CLASS 0
269#define USB_CFG_DEVICE_SUBCLASS 0
270/* See USB specification if you want to conform to an existing device class.
271 * Class 0xff is "vendor specific".
272 */
273#define USB_CFG_INTERFACE_CLASS 3 /* HID */
274#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
275#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
276/* See USB specification if you want to conform to an existing device class or
277 * protocol. The following classes must be set at interface level:
278 * HID class is 3, no subclass and protocol required (but may be useful!)
279 * CDC class is 2, use subclass 2 and protocol 1 for ACM
280 */
281#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
282/* Define this to the length of the HID report descriptor, if you implement
283 * an HID device. Otherwise don't define it or define it to 0.
284 * If you use this define, you must add a PROGMEM character array named
285 * "usbHidReportDescriptor" to your code which contains the report descriptor.
286 * Don't forget to keep the array and this define in sync!
287 */
288
289/* #define USB_PUBLIC static */
290/* Use the define above if you #include usbdrv.c instead of linking against it.
291 * This technique saves a couple of bytes in flash memory.
292 */
293
294/* ------------------- Fine Control over USB Descriptors ------------------- */
295/* If you don't want to use the driver's default USB descriptors, you can
296 * provide our own. These can be provided as (1) fixed length static data in
297 * flash memory, (2) fixed length static data in RAM or (3) dynamically at
298 * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
299 * information about this function.
300 * Descriptor handling is configured through the descriptor's properties. If
301 * no properties are defined or if they are 0, the default descriptor is used.
302 * Possible properties are:
303 * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
304 * at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
305 * used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
306 * you want RAM pointers.
307 * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
308 * in static memory is in RAM, not in flash memory.
309 * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
310 * the driver must know the descriptor's length. The descriptor itself is
311 * found at the address of a well known identifier (see below).
312 * List of static descriptor names (must be declared PROGMEM if in flash):
313 * char usbDescriptorDevice[];
314 * char usbDescriptorConfiguration[];
315 * char usbDescriptorHidReport[];
316 * char usbDescriptorString0[];
317 * int usbDescriptorStringVendor[];
318 * int usbDescriptorStringDevice[];
319 * int usbDescriptorStringSerialNumber[];
320 * Other descriptors can't be provided statically, they must be provided
321 * dynamically at runtime.
322 *
323 * Descriptor properties are or-ed or added together, e.g.:
324 * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
325 *
326 * The following descriptors are defined:
327 * USB_CFG_DESCR_PROPS_DEVICE
328 * USB_CFG_DESCR_PROPS_CONFIGURATION
329 * USB_CFG_DESCR_PROPS_STRINGS
330 * USB_CFG_DESCR_PROPS_STRING_0
331 * USB_CFG_DESCR_PROPS_STRING_VENDOR
332 * USB_CFG_DESCR_PROPS_STRING_PRODUCT
333 * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
334 * USB_CFG_DESCR_PROPS_HID
335 * USB_CFG_DESCR_PROPS_HID_REPORT
336 * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
337 *
338 * Note about string descriptors: String descriptors are not just strings, they
339 * are Unicode strings prefixed with a 2 byte header. Example:
340 * int serialNumberDescriptor[] = {
341 * USB_STRING_DESCRIPTOR_HEADER(6),
342 * 'S', 'e', 'r', 'i', 'a', 'l'
343 * };
344 */
345
346#define USB_CFG_DESCR_PROPS_DEVICE 0
347#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
348//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
349#define USB_CFG_DESCR_PROPS_STRINGS 0
350#define USB_CFG_DESCR_PROPS_STRING_0 0
351#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
352#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
353#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
354//#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
355#define USB_CFG_DESCR_PROPS_HID 0
356#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
357//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
358#define USB_CFG_DESCR_PROPS_UNKNOWN 0
359
360/* ----------------------- Optional MCU Description ------------------------ */
361
362/* The following configurations have working defaults in usbdrv.h. You
363 * usually don't need to set them explicitly. Only if you want to run
364 * the driver on a device which is not yet supported or with a compiler
365 * which is not fully supported (such as IAR C) or if you use a differnt
366 * interrupt than INT0, you may have to define some of these.
367 */
368/* #define USB_INTR_CFG MCUCR */
369/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
370/* #define USB_INTR_CFG_CLR 0 */
371/* #define USB_INTR_ENABLE GIMSK */
372/* #define USB_INTR_ENABLE_BIT INT0 */
373/* #define USB_INTR_PENDING GIFR */
374/* #define USB_INTR_PENDING_BIT INTF0 */
375/* #define USB_INTR_VECTOR INT0_vect */
376
377#endif /* __usbconfig_h_included__ */
diff --git a/converter/serialmouse_usb/Makefile b/converter/serialmouse_usb/Makefile
deleted file mode 100644
index 34f550b31..000000000
--- a/converter/serialmouse_usb/Makefile
+++ /dev/null
@@ -1,106 +0,0 @@
1#
2# Makefile for Teensy
3#
4# Target file name (without extension).
5TARGET = serialmouse_usb
6
7# Directory common source filess exist
8TMK_DIR = ../../tmk_core
9
10# Directory keyboard dependent files exist
11TARGET_DIR = .
12
13# project specific files
14SRC = keymap.c \
15 matrix.c \
16 led.c
17
18CONFIG_H = config.h
19
20
21# MCU name
22#MCU = at90usb1287
23MCU = atmega32u4
24
25# Processor frequency.
26# This will define a symbol, F_CPU, in all source code files equal to the
27# processor frequency in Hz. You can then use this symbol in your source code to
28# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
29# automatically to create a 32-bit value in your source code.
30#
31# This will be an integer division of F_USB below, as it is sourced by
32# F_USB after it has run through any CPU prescalers. Note that this value
33# does not *change* the processor frequency - it should merely be updated to
34# reflect the processor speed set externally so that the code can use accurate
35# software delays.
36F_CPU = 16000000
37
38
39#
40# LUFA specific
41#
42# Target architecture (see library "Board Types" documentation).
43ARCH = AVR8
44
45# Input clock frequency.
46# This will define a symbol, F_USB, in all source code files equal to the
47# input clock frequency (before any prescaling is performed) in Hz. This value may
48# differ from F_CPU if prescaling is used on the latter, and is required as the
49# raw input clock is fed directly to the PLL sections of the AVR for high speed
50# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
51# at the end, this will be done automatically to create a 32-bit value in your
52# source code.
53#
54# If no clock division is performed on the input clock inside the AVR (via the
55# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
56F_USB = $(F_CPU)
57
58# Interrupt driven control endpoint task(+60)
59#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
60
61
62# Boot Section Size in *bytes*
63# Teensy halfKay 512
64# Teensy++ halfKay 1024
65# Atmel DFU loader 4096
66# LUFA bootloader 4096
67# USBaspLoader 2048
68OPT_DEFS += -DBOOTLOADER_SIZE=512
69
70
71# Build Options
72# comment out to disable the options.
73#
74#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
75#MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
76#EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
77CONSOLE_ENABLE = yes # Console for debug(+400)
78#COMMAND_ENABLE = yes # Commands for debug and configuration
79#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
80
81
82# Serial Mouse Options
83# You can choose a mouse protocol and the implementation of
84# the underlying serial connection.
85#
86SERIAL_MOUSE_MICROSOFT_ENABLE = yes # Enable support for Microsoft-compatible mice
87#SERIAL_MOUSE_MOUSESYSTEMS_ENABLE = yes # Enable support for Mousesystems-compatible mice
88#SERIAL_MOUSE_USE_UART = yes # use hardware UART for serial connection
89SERIAL_MOUSE_USE_SOFT = yes # use software serial implementation
90
91# Optional serial mouse driver features
92# Support scrolling while holding the middle mouse button
93# (currently only supported for Mousesystems mice):
94#OPT_DEFS += -DSERIAL_MOUSE_CENTER_SCROLL
95
96# Optimize size but this may cause error "relocation truncated to fit"
97#EXTRALDFLAGS = -Wl,--relax
98
99# Search Path
100VPATH += $(TARGET_DIR)
101VPATH += $(TMK_DIR)
102
103include $(TMK_DIR)/protocol.mk
104include $(TMK_DIR)/protocol/lufa.mk
105include $(TMK_DIR)/common.mk
106include $(TMK_DIR)/rules.mk
diff --git a/converter/serialmouse_usb/README.md b/converter/serialmouse_usb/README.md
deleted file mode 100644
index ef8a00671..000000000
--- a/converter/serialmouse_usb/README.md
+++ /dev/null
@@ -1,11 +0,0 @@
1Serial mouse converter
2======================
3See https://github.com/tmk/tmk_keyboard/pull/131
4
5
6Supported protocols
7-------------------
8### Microsoft
9Not tested.
10
11### Mousesystems
diff --git a/converter/serialmouse_usb/config.h b/converter/serialmouse_usb/config.h
deleted file mode 100644
index b257d997c..000000000
--- a/converter/serialmouse_usb/config.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include <avr/interrupt.h>
22
23#define VENDOR_ID 0xFEED
24#define PRODUCT_ID 0x2222
25#define DEVICE_VER 0x0001
26#define MANUFACTURER t.m.k.
27#define PRODUCT serial mouse converter
28#define DESCRIPTION convert serial mouse into USB
29
30
31/* matrix size */
32#define MATRIX_ROWS 0
33#define MATRIX_COLS 0
34
35
36/* key combination for command */
37#define IS_COMMAND() false
38
39
40
41#ifdef SERIAL_MOUSE_MICROSOFT
42 /*
43 * Serial(USART) configuration (for Microsoft serial mice)
44 * asynchronous, positive logic, 1200baud, bit order: LSB first
45 * 1-start bit, 7-data bit, no parity, 1-stop bit
46 */
47 #define SERIAL_UART_BAUD 1200
48 #define SERIAL_UART_DATA UDR1
49 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
50 #define SERIAL_UART_RXD_VECT USART1_RX_vect
51 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
52 #define SERIAL_UART_INIT() do { \
53 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
54 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
55 UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
56 UCSR1C = (1<<UCSZ11) | (0<<UCSZ10); /* no parity, 1 stop bit, 7-bit characters */ \
57 sei(); \
58 } while(0)
59
60 // for Microsoft mouse protocol
61 /* Serial(USART) configuration
62 * asynchronous, negative logic, 1200baud, no flow control
63 * 1-start bit, 7-data bit, non parity, 1-stop bit
64 */
65 #define SERIAL_SOFT_BAUD 1200
66 #define SERIAL_SOFT_DATA_7BIT
67 #define SERIAL_SOFT_PARITY_NONE
68 #define SERIAL_SOFT_BIT_ORDER_LSB
69 #define SERIAL_SOFT_LOGIC_NEGATIVE
70 /* RXD Port */
71 #define SERIAL_SOFT_RXD_DDR DDRD
72 #define SERIAL_SOFT_RXD_PORT PORTD
73 #define SERIAL_SOFT_RXD_PIN PIND
74 #define SERIAL_SOFT_RXD_BIT 2
75 #define SERIAL_SOFT_RXD_VECT INT2_vect
76 /* RXD Interupt */
77 #define SERIAL_SOFT_RXD_INIT() do { \
78 /* pin configuration: input with pull-up */ \
79 SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
80 SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
81 /* enable interrupt: INT2(rising edge) */ \
82 EICRA |= ((1<<ISC21)|(1<<ISC20)); \
83 EIMSK |= (1<<INT2); \
84 sei(); \
85 } while (0)
86 #define SERIAL_SOFT_RXD_INT_ENTER()
87 #define SERIAL_SOFT_RXD_INT_EXIT() do { \
88 /* clear interrupt flag */ \
89 EIFR = (1<<INTF2); \
90 } while (0)
91 #define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
92 /* TXD Port */
93 #define SERIAL_SOFT_TXD_HI()
94 #define SERIAL_SOFT_TXD_LO()
95 #define SERIAL_SOFT_TXD_INIT()
96#elif defined(SERIAL_MOUSE_MOUSESYSTEMS)
97 /*
98 * Serial(USART) configuration (for Mousesystems serial mice)
99 * asynchronous, positive logic, 1200baud, bit order: LSB first
100 * 1-start bit, 8-data bit, no parity, 1-stop bit
101 */
102 #define SERIAL_UART_BAUD 1200
103 #define SERIAL_UART_DATA UDR1
104 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
105 #define SERIAL_UART_RXD_VECT USART1_RX_vect
106 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
107 #define SERIAL_UART_INIT() do { \
108 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
109 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
110 UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
111 UCSR1C = (1<<UCSZ11) | (1<<UCSZ10); /* no parity, 1 stop bit, 8-bit characters */ \
112 sei(); \
113 } while(0)
114#endif
115
116
117
118
119#endif
diff --git a/converter/serialmouse_usb/keymap.c b/converter/serialmouse_usb/keymap.c
deleted file mode 100644
index cb78b4d19..000000000
--- a/converter/serialmouse_usb/keymap.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "keymap.h"
20
21
22/* translates key to keycode */
23uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
24{
25 return KC_NO;
26}
27
28/* translates Fn keycode to action */
29action_t keymap_fn_to_action(uint8_t keycode)
30{
31 return (action_t){};
32}
33
diff --git a/converter/serialmouse_usb/keymap_common.c b/converter/serialmouse_usb/keymap_common.c
deleted file mode 100644
index 55a13793c..000000000
--- a/converter/serialmouse_usb/keymap_common.c
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include "keymap_common.h"
18
19
20/* translates key to keycode */
21uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
22{
23 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
24}
25
26/* translates Fn keycode to action */
27action_t keymap_fn_to_action(uint8_t keycode)
28{
29 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
30}
diff --git a/converter/serialmouse_usb/keymap_common.h b/converter/serialmouse_usb/keymap_common.h
deleted file mode 100644
index 216a8dc02..000000000
--- a/converter/serialmouse_usb/keymap_common.h
+++ /dev/null
@@ -1,174 +0,0 @@
1/*
2Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#ifndef KEYMAP_COMMON_H
18#define KEYMAP_COMMON_H
19
20#include <stdint.h>
21#include <stdbool.h>
22#include <avr/pgmspace.h>
23#include "keycode.h"
24#include "action.h"
25#include "action_macro.h"
26#include "report.h"
27#include "print.h"
28#include "debug.h"
29#include "keymap.h"
30
31
32// 32*8(256) byte array which converts PS/2 code into USB code
33extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
34extern const uint16_t fn_actions[];
35
36
37/* All keys */
38#define KEYMAP_ALL( \
39 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
40 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
41 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
42 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
43 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
44 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
45 \
46 K61, /* for European ISO */ \
47 K51, K13, K6A, K64, K67, /* for Japanese JIS */ \
48 K08, K10, K18, K20, K28, K30, K38, K40, K48, K50, K57, K5F, /* F13-24 */ \
49 KB7, KBF, KDE, /* System Power, Sleep, Wake */ \
50 KA3, KB2, KA1, /* Mute, Volume Up, Volume Down */ \
51 KCD, K95, KBB, KB4, KD0, /* Next, Previous, Stop, Pause, Media Select */ \
52 KC8, KAB, KC0, /* Mail, Calculator, My Computer */ \
53 K90, KBA, KB8, KB0, /* WWW Search, Home, Back, Forward */ \
54 KA8, KA0, K98 /* WWW Stop, Refresh, Favorites */ \
55) { \
56 { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
57 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_NO }, \
58 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO }, \
59 { KC_##K18, KC_NO, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO }, \
60 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
61 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_NO }, \
62 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_NO }, \
63 { KC_##K38, KC_NO, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
64 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
65 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
66 { KC_##K50, KC_##K51, KC_##K52, KC_NO, KC_##K54, KC_##K55, KC_NO, KC_##K57 }, \
67 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_##K5D, KC_NO, KC_##K5F }, \
68 { KC_NO, KC_##K61, KC_NO, KC_NO, KC_##K64, KC_NO, KC_##K66, KC_##K67 }, \
69 { KC_NO, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_NO, KC_NO, KC_NO }, \
70 { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
71 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \
72 { KC_NO, KC_NO, KC_NO, KC_##K83, KC_NO, KC_NO, KC_NO, KC_NO }, \
73 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
74 { KC_##K90, KC_##K91, KC_NO, KC_NO, KC_##K94, KC_##K95, KC_NO, KC_NO }, \
75 { KC_##K98, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K9F }, \
76 { KC_##KA0, KC_##KA1, KC_NO, KC_##KA3, KC_NO, KC_NO, KC_NO, KC_##KA7 }, \
77 { KC_##KA8, KC_NO, KC_NO, KC_##KAB, KC_NO, KC_NO, KC_NO, KC_##KAF }, \
78 { KC_##KB0, KC_NO, KC_##KB2, KC_NO, KC_##KB4, KC_NO, KC_NO, KC_##KB7 }, \
79 { KC_##KB8, KC_NO, KC_##KBA, KC_##KBB, KC_NO, KC_NO, KC_NO, KC_##KBF }, \
80 { KC_##KC0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
81 { KC_##KC8, KC_NO, KC_##KCA, KC_NO, KC_NO, KC_##KCD, KC_NO, KC_NO }, \
82 { KC_##KD0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
83 { KC_NO, KC_NO, KC_##KDA, KC_NO, KC_NO, KC_NO, KC_##KDE, KC_NO }, \
84 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
85 { KC_NO, KC_##KE9, KC_NO, KC_##KEB, KC_##KEC, KC_NO, KC_NO, KC_NO }, \
86 { KC_##KF0, KC_##KF1, KC_##KF2, KC_NO, KC_##KF4, KC_##KF5, KC_NO, KC_NO }, \
87 { KC_NO, KC_NO, KC_##KFA, KC_NO, KC_##KFC, KC_##KFD, KC_##KFE, KC_NO }, \
88}
89
90/* US layout */
91#define KEYMAP( \
92 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
93 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
94 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
95 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
96 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
97 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
98) \
99KEYMAP_ALL( \
100 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
101 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
102 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
103 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
104 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
105 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
106 \
107 NUBS, \
108 RO, KANA, JYEN, HENK, MHEN, \
109 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
110 SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
111 AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
112 MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
113 MAIL, CALCULATOR, MY_COMPUTER, \
114 WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
115 WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
116)
117
118/* ISO layout */
119#define KEYMAP_ISO( \
120 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
121 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
122 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
123 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D,K5A, K6B,K73,K74,K79, \
124 K12,K61,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
125 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
126) \
127KEYMAP_ALL( \
128 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
129 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
130 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
131 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
132 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
133 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
134 \
135 K61, \
136 RO, KANA, JYEN, HENK, MHEN, \
137 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
138 SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
139 AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
140 MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
141 MAIL, CALCULATOR, MY_COMPUTER, \
142 WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
143 WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
144)
145
146/* JIS layout */
147#define KEYMAP_JIS( \
148 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
149 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K6A,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
150 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
151 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D, K5A, K6B,K73,K74,K79, \
152 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K51, K59, KF5, K69,K72,K7A, \
153 K14,K9F,K11, K67,K29,K64,K13, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
154) \
155KEYMAP_ALL( \
156 K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
157 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
158 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
159 K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
160 K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
161 K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
162 \
163 NUBS, \
164 K51, K13, K6A, K64, K67, \
165 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
166 SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
167 AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
168 MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
169 MAIL, CALCULATOR, MY_COMPUTER, \
170 WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
171 WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
172)
173
174#endif
diff --git a/converter/serialmouse_usb/led.c b/converter/serialmouse_usb/led.c
deleted file mode 100644
index f76545f0b..000000000
--- a/converter/serialmouse_usb/led.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "stdint.h"
19#include "led.h"
20
21
22void led_set(uint8_t usb_led)
23{
24}
diff --git a/converter/serialmouse_usb/matrix.c b/converter/serialmouse_usb/matrix.c
deleted file mode 100644
index 0e0d87f80..000000000
--- a/converter/serialmouse_usb/matrix.c
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/io.h>
21#include <util/delay.h>
22#include "action.h"
23#include "print.h"
24#include "util.h"
25#include "debug.h"
26#include "matrix.h"
27
28
29inline
30uint8_t matrix_rows(void)
31{
32 return MATRIX_ROWS;
33}
34
35inline
36uint8_t matrix_cols(void)
37{
38 return MATRIX_COLS;
39}
40
41void matrix_init(void)
42{
43 debug_enable = true;
44 debug_mouse=true;
45 return;
46}
47
48uint8_t matrix_scan(void)
49{
50 return 0;
51}
52
53bool matrix_is_modified(void)
54{
55 return false;
56}
57
58inline
59bool matrix_has_ghost(void)
60{
61 return false;
62}
63
64inline
65bool matrix_is_on(uint8_t row, uint8_t col)
66{
67 return false;
68}
69
70inline
71uint8_t matrix_get_row(uint8_t row)
72{
73 return 0;
74}
75
76void matrix_print(void)
77{
78}
79
80uint8_t matrix_key_count(void)
81{
82 return 0;
83}
diff --git a/converter/sun_usb/Makefile b/converter/sun_usb/Makefile
deleted file mode 100644
index f046bfdd3..000000000
--- a/converter/sun_usb/Makefile
+++ /dev/null
@@ -1,85 +0,0 @@
1# Target file name (without extension).
2TARGET = sun_usb
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap.c \
12 matrix.c \
13 led.c \
14 command_extra.c \
15 protocol/serial_soft.c
16
17CONFIG_H = config.h
18
19
20# MCU name, you MUST set this to match the board you are using
21# type "make clean" after changing this, so all files will be rebuilt
22#MCU = at90usb162 # Teensy 1.0
23#MCU = atmega32u4 # Teensy 2.0
24#MCU = at90usb646 # Teensy++ 1.0
25#MCU = at90usb1286 # Teensy++ 2.0
26MCU = atmega32u2
27
28
29# Processor frequency.
30# Normally the first thing your program should do is set the clock prescaler,
31# so your program will run at the correct speed. You should also set this
32# variable to same clock speed. The _delay_ms() macro uses this, and many
33# examples use this variable to calculate timings. Do not add a "UL" here.
34F_CPU = 16000000
35
36
37#
38# LUFA specific
39#
40# Target architecture (see library "Board Types" documentation).
41ARCH = AVR8
42
43# Input clock frequency.
44# This will define a symbol, F_USB, in all source code files equal to the
45# input clock frequency (before any prescaling is performed) in Hz. This value may
46# differ from F_CPU if prescaling is used on the latter, and is required as the
47# raw input clock is fed directly to the PLL sections of the AVR for high speed
48# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
49# at the end, this will be done automatically to create a 32-bit value in your
50# source code.
51#
52# If no clock division is performed on the input clock inside the AVR (via the
53# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
54F_USB = $(F_CPU)
55
56# Interrupt driven control endpoint task
57OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
58
59
60# Build Options
61# *Comment out* to disable the options.
62#
63MOUSEKEY_ENABLE = yes # Mouse keys
64EXTRAKEY_ENABLE = yes # Audio control and System control
65CONSOLE_ENABLE = yes # Console for debug
66COMMAND_ENABLE = yes # Commands for debug and configuration
67#NKRO_ENABLE = yes # USB Nkey Rollover
68
69
70# Boot Section Size in bytes
71# Teensy halfKay 512
72# Atmel DFU loader 4096
73# LUFA bootloader 4096
74OPT_DEFS += -DBOOTLOADER_SIZE=4096
75
76
77# Search Path
78VPATH += $(TARGET_DIR)
79VPATH += $(TMK_DIR)
80
81
82include $(TMK_DIR)/protocol/lufa.mk
83include $(TMK_DIR)/protocol.mk
84include $(TMK_DIR)/common.mk
85include $(TMK_DIR)/rules.mk
diff --git a/converter/sun_usb/README b/converter/sun_usb/README
deleted file mode 100644
index 98340dd31..000000000
--- a/converter/sun_usb/README
+++ /dev/null
@@ -1,106 +0,0 @@
1Sun to USB keyboard protocol converter
2======================================
3Target MCU is ATMega32u4 but other USB capable AVR will also work.
4
5This converter will work with Sun Type 2-5 Keyboards.
6
7
8Tested on:
9Sun Type 3 Keyboard: http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html
10CTCSP SHORT TYPE KEYBOARD(Type 5): http://imgur.com/a/QIv6p
11
12
13Keymap of Type 3(keymap_sun3.c) were impoted from dastels's repository.
14https://github.com/dastels/tmk_keyboard/tree/master/converter/sun3_usb
15
16
17
18Connector
19---------
20 8Pin mini DIN
21 ___ ___
22 / |_| \
23 / 8 7 6 \
24 | 5 4 3 |
25 \_ 2 1 _/
26 \_____/
27 (receptacle)
28
29 Wiring:
30 Pin mini DIN MCU
31 ----------------------------------
32 1 GND GND
33 2 GND GND
34 3 5V
35 4 RX/TX(Mouse)
36 5 RX PD3
37 6 TX PD2
38 7 GND GND
39 8 5V VCC
40
41
42Protocol
43--------
44Signal: Asynchronous, Negative logic, 1200baud, No Flow control
45Frame format: 1-Start bit, 8-Data bits, No-Parity, 1-Stop bit
46
47 AVR USART engine expects positive logic while Sun keyboard signal is negative.
48 To use AVR UART engine you need external inverter in front of RX and TX pin.
49 Otherwise you can software serial routine to communicate the keyboard.
50
51This converter uses software method, you doesn't need any inverter part.
52
53
54Commands From System To Keyboard
55 0x01 Reset
56 Keyboard responds with following byte sequence:
57 Success: 0xFF 0x04 0x7F
58 Fail: 0x7E 0x01 0x7F
59 0x02 Bell On
60 0x03 Bell Off
61 0x0A Click On
62 0x0B Click Off
63 0x0E LED
64 followed by LED status byte:
65 bit: 3 2 1 0
66 LED: CapsLk ScrLk Compose NumLk
67 0x0F Layout
68 Keyboard responds with 'Layout Response' 0xFE 0xXX
69
70Commands From Keyboard To System
71 0x7F Idle
72 means no keys pressed.
73 0xFE Layout Response
74 0xFF Reset Response(followed by 0x04)
75
76Reference
77 http://kentie.net/article/sunkbd/page2.htm
78 http://kentie.net/article/sunkbd/KBD.pdf
79
80
81Build Firmware
82--------------
83Just use 'make'
84 $ cd sun_usb
85 $ make
86Then, load the binary to MCU with your favorite programmer.
87
88
89Sun commands
90------------
91You can send Sun protocol commands with TMK `Magic` key combo. By default `Magic` key is `LShift` + `RShift`, `LAlt` + `RAlt' or `LMeta` + `RMeta`.
92https://github.com/tmk/tmk_keyboard#magic-commands
93
94Following Sun specific commands are available. For example, to send 'Bell On' you can press `LShift` + `RShift` + `Up` keys simultaneously.
95
96```
97----- Sun converter Help -----
98Up: Bell On
99Down: Bell Off
100Left: Click On
101Right: Click Off
102PgUp: LED all On
103PgDown: LED all On
104Insert: Layout
105Delete: Reset
106```
diff --git a/converter/sun_usb/command_extra.c b/converter/sun_usb/command_extra.c
deleted file mode 100644
index aba3fe6da..000000000
--- a/converter/sun_usb/command_extra.c
+++ /dev/null
@@ -1,61 +0,0 @@
1#include "stdbool.h"
2#include "stdint.h"
3#include "keycode.h"
4#include "serial.h"
5#include "print.h"
6#include "command.h"
7
8bool command_extra(uint8_t code)
9{
10 switch (code) {
11 case KC_H:
12 case KC_SLASH: /* ? */
13 print("\n\n----- Sun converter Help -----\n");
14 print("Up: Bell On\n");
15 print("Down: Bell Off\n");
16 print("Left: Click On\n");
17 print("Right: Click Off\n");
18 print("PgUp: LED all On\n");
19 print("PgDown: LED all On\n");
20 print("Insert: Layout\n");
21 print("Delete: Reset\n");
22 return false;
23 case KC_DEL:
24 print("Reset\n");
25 serial_send(0x01);
26 break;
27 case KC_UP:
28 print("Bell On\n");
29 serial_send(0x02);
30 break;
31 case KC_DOWN:
32 print("Bell Off\n");
33 serial_send(0x03);
34 break;
35 case KC_LEFT:
36 print("Click On\n");
37 serial_send(0x0A);
38 break;
39 case KC_RIGHT:
40 print("Click Off\n");
41 serial_send(0x0B);
42 break;
43 case KC_PGUP:
44 print("LED all on\n");
45 serial_send(0x0E);
46 serial_send(0xFF);
47 break;
48 case KC_PGDOWN:
49 print("LED all off\n");
50 serial_send(0x0E);
51 serial_send(0x00);
52 break;
53 case KC_INSERT:
54 print("layout\n");
55 serial_send(0x0F);
56 break;
57 default:
58 return false;
59 }
60 return true;
61}
diff --git a/converter/sun_usb/config.h b/converter/sun_usb/config.h
deleted file mode 100644
index 66036da93..000000000
--- a/converter/sun_usb/config.h
+++ /dev/null
@@ -1,95 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#define VENDOR_ID 0xFEED
22#define PRODUCT_ID 0x3333
23#define DEVICE_VER 0x0100
24#define MANUFACTURER t.m.k.
25#define PRODUCT Sun keyboard converter
26#define DESCRIPTION converts Sun keyboard protocol into USB
27
28/* matrix size */
29#define MATRIX_ROWS 16
30#define MATRIX_COLS 8
31
32/* key combination for command */
33#define IS_COMMAND() ( \
34 keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
35 keyboard_report->mods == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
36 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
37)
38
39/* legacy keymap support */
40#define USE_LEGACY_KEYMAP
41
42
43/* Serial(USART) configuration
44 * asynchronous, negative logic, 1200baud, no flow control
45 * 1-start bit, 8-data bit, non parity, 1-stop bit
46 */
47#define SERIAL_SOFT_BAUD 1200
48#define SERIAL_SOFT_PARITY_NONE
49#define SERIAL_SOFT_BIT_ORDER_LSB
50#define SERIAL_SOFT_LOGIC_NEGATIVE
51/* RXD Port */
52#define SERIAL_SOFT_RXD_ENABLE
53#define SERIAL_SOFT_RXD_DDR DDRD
54#define SERIAL_SOFT_RXD_PORT PORTD
55#define SERIAL_SOFT_RXD_PIN PIND
56#define SERIAL_SOFT_RXD_BIT 2
57#define SERIAL_SOFT_RXD_VECT INT2_vect
58/* RXD Interupt */
59#ifdef SERIAL_SOFT_LOGIC_NEGATIVE
60/* enable interrupt: INT2(rising edge) */
61#define INTR_TRIG_EDGE ((1<<ISC21)|(1<<ISC20))
62#else
63/* enable interrupt: INT2(falling edge) */
64#define INTR_TRIG_EDGE ((1<<ISC21)|(0<<ISC20))
65#endif
66#define SERIAL_SOFT_RXD_INIT() do { \
67 /* pin configuration: input with pull-up */ \
68 SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
69 SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
70 EICRA |= INTR_TRIG_EDGE; \
71 EIMSK |= (1<<INT2); \
72 sei(); \
73} while (0)
74#define SERIAL_SOFT_RXD_INT_ENTER()
75#define SERIAL_SOFT_RXD_INT_EXIT() do { \
76 /* clear interrupt flag */ \
77 EIFR = (1<<INTF2); \
78} while (0)
79#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
80/* TXD Port */
81#define SERIAL_SOFT_TXD_ENABLE
82#define SERIAL_SOFT_TXD_DDR DDRD
83#define SERIAL_SOFT_TXD_PORT PORTD
84#define SERIAL_SOFT_TXD_PIN PIND
85#define SERIAL_SOFT_TXD_BIT 3
86#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
87#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
88#define SERIAL_SOFT_TXD_INIT() do { \
89 /* pin configuration: output */ \
90 SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
91 /* idle */ \
92 SERIAL_SOFT_TXD_ON(); \
93} while (0)
94
95#endif
diff --git a/converter/sun_usb/keymap.c b/converter/sun_usb/keymap.c
deleted file mode 100644
index 3d724a520..000000000
--- a/converter/sun_usb/keymap.c
+++ /dev/null
@@ -1,192 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/pgmspace.h>
21#include "keycode.h"
22#include "util.h"
23#include "keymap.h"
24
25
26
27
28/* Sun type 5 keyboard
29,-------. ,---, ,---------------. ,---------------. ,---------------. ,-----------. ,---------------.
30| 76 | | | | 05| 06| 08| 0A| | 0C| 0E| 10| 11| | 12| 07| 09| 0B| | 16| 17| 15| | 2D| 02| 04| 30|
31`-------' `---' `---------------' `---------------' `---------------' `-----------' `---------------'
32,-------. ,-----------------------------------------------------------. ,-----------. ,---------------.
33| 01| 03| | 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 58| 2A| | 2C| 34| 60| | 62| 2E| 2F| 47|
34|-------| |-----------------------------------------------------------| |------------ |---------------|
35| 19| 1A| | 35 | 36| 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 2B | | 42| 4A| 7B| | 44| 45| 46| |
36|-------| |-----------------------------------------------------------| `-----------' |-----------| 7D|
37| 31| 33| | 4C | 4D| 4E| 4F| 50| 51| 52| 53| 54| 55| 56| 57| 59 | | 5B| 5C| 5D| |
38|-------| |-----------------------------------------------------------| ,---. |-----------|---|
39| 48| 49| | 63 | 64| 65| 66| 67| 68| 69| 6A| 6B| 6C| 6D| 6E | | 14| | 70| 71| 72| |
40|-------| |-----------------------------------------------------------| .-----------. |-----------| 5A|
41| 5F| 61| | 77 | 13| 78 |*73 | 79 |*74 |*75| 7A | 43| 0D| | 18| 1B| 1C| | 5E | 32| |
42`-------' `-----------------------------------------------------------' `-----------' `---------------'
43*/
44#define KEYMAP( \
45 K76, K05,K06,K08,K0A, K0C,K0E,K10,K11, K12,K07,K09,K0B, K16,K17,K15, K2D,K02,K04,K30, \
46 K01,K03, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2C,K34,K60, K62,K2E,K2F,K47, \
47 K19,K1A, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K2B, K42,K4A,K7B, K44,K45,K46,K7D, \
48 K31,K33, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \
49 K48,K49, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E, K14, K70,K71,K72,K5A, \
50 K5F,K61, K77,K13, K78, K73, K79, K74, K75, K7A, K43, K0D, K18,K1B,K1C, K5E, K32 \
51) { \
52 { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
53 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_NO, }, \
54 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
55 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
56 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
57 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
58 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
59 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
60 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
61 { KC_##K48, KC_##K49, KC_##K4A, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
62 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
63 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \
64 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
65 { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_NO }, \
66 { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
67 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_NO, KC_##K7D, KC_NO, KC_NO } \
68}
69
70/* CTCSP SHORT TYPE KEYBOARD */
71#define SHORT_TYPE( \
72 K01, K05,K06,K08,K0A,K0C,K0E, K61,K49,K33, K30, K2C,K34,K60, \
73 K10,K11,K12,K07,K09,K0B, K42,K4A,K7B, \
74 K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, \
75 K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K2B, \
76 K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, \
77 K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K0D,K14,K6E, \
78 K77,K13, K78, K79, K7A,K43,K62,K18,K1B,K1C \
79) KEYMAP( \
80 HELP, K05,K06,K08,K0A, K0C,K0E,K10,K11, K12,K07,K09,K0B, PSCR,SLCK,PAUS, MUTE,VOLD,VOLU,K30, \
81 K01, AGAIN, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2C, K34, K60, K62, PSLS,PAST,PMNS, \
82 MENU, UNDO, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K2B, K42, K4A, K7B, P7, P8, P9, PPLS, \
83 SELECT, K33, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, P4, P5, P6, \
84 EXECUTE,K49, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E, K14, P1, P2, P3, PENT, \
85 FIND, K61, K77,K13, K78, HENK, K79, MHEN, KANA, K7A,K43,K0D, K18, K1B, K1C, P0, PDOT \
86)
87
88
89// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
90static const uint8_t PROGMEM fn_layer[] = {
91 2, // Fn0
92 3, // Fn1
93 4, // Fn2
94 0, // Fn3
95 0, // Fn4
96 0, // Fn5
97 0, // Fn6
98 0 // Fn7
99};
100
101// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
102// See layer.c for details.
103static const uint8_t PROGMEM fn_keycode[] = {
104 KC_NO, // Fn0
105 KC_SCLN, // Fn1
106 KC_SLSH, // Fn2
107 KC_NO, // Fn3
108 KC_NO, // Fn4
109 KC_NO, // Fn5
110 KC_NO, // Fn6
111 KC_NO // Fn7
112};
113
114
115static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
116/*
117 KEYMAP(
118 HELP, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,F11,F12, PSCR,SLCK,PAUS, MUTE,VOLD,VOLU,PWR,
119 STOP, AGAIN, ESC,1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
120 MENU, UNDO, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC, DEL, END, PGDN, P7, P8, P9, PPLS,
121 SELECT, COPY, LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6,
122 EXECUTE,PASTE, LSFT, Z, X, C, V, B, N, M, COMM,DOT,SLSH, RSFT, UP, P1, P2, P3, PENT,
123 FIND, CUT, CAPS, LALT, LGUI,HENK, SPC, MHEN,KANA,RGUI,APP, RALT, LEFT,DOWN,RGHT, P0, PDOT
124 ),
125*/
126 // 0: default
127 SHORT_TYPE(
128 STOP, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
129 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
130 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV,
131 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC,
132 LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT,
133 LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RALT,UP, RSFT,
134 CAPS,LALT,LGUI, SPC, RGUI,APP, NLCK,LEFT,DOWN,RGHT
135 ),
136 // 1: with layer keys
137 SHORT_TYPE(
138 ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
139 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
140 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV,
141 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC,
142 LCTL, A, S, D, F, G, H, J, K, L, FN1, QUOT, ENT,
143 LSFT, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,UP, FN0,
144 CAPS,LALT,LGUI, SPC, RGUI,RALT,FN0, LEFT,DOWN,RGHT
145 ),
146 // 2: HHKB
147 SHORT_TYPE(
148 ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
149 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
150 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL,
151 CAPS, NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, BSPC,
152 LCTL, VOLD,VOLU,MUTE,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT,
153 LSFT, Z, X, C, V, B, NO, NO, END, PGDN,DOWN, RSFT,PGUP,FN0,
154 CAPS,LALT,LGUI, SPC, RGUI,RALT,FN0, HOME,PGDN,END
155 ),
156 // 3: Mousekey
157 SHORT_TYPE(
158 ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
159 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
160 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL,
161 CAPS, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSPC,
162 LCTL, NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,FN1, NO, ENT,
163 LSFT, NO, NO, NO, NO, BTN3,BTN2,BTN1,NO, NO, NO, RSFT,UP, NO,
164 CAPS,LALT,LGUI, BTN1, RGUI,RALT,NO, LEFT,DOWN,RGHT
165 ),
166 // 4: Cursor
167 SHORT_TYPE(
168 ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
169 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
170 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL,
171 CAPS, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC,
172 LCTL, NO, NO, NO, NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT,
173 LSFT, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT,UP, NO,
174 CAPS,LALT,LGUI, BTN1, RGUI,RALT,NO, LEFT,DOWN,RGHT
175 ),
176};
177
178
179uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
180{
181 return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
182}
183
184uint8_t keymap_fn_layer(uint8_t index)
185{
186 return pgm_read_byte(&fn_layer[index]);
187}
188
189uint8_t keymap_fn_keycode(uint8_t index)
190{
191 return pgm_read_byte(&fn_keycode[index]);
192}
diff --git a/converter/sun_usb/keymap_sun3.c b/converter/sun_usb/keymap_sun3.c
deleted file mode 100644
index 273cd9442..000000000
--- a/converter/sun_usb/keymap_sun3.c
+++ /dev/null
@@ -1,173 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/pgmspace.h>
21#include "keycode.h"
22#include "util.h"
23#include "keymap.h"
24
25
26/* Sun type 3 keyboard
27,-------. ,-----------------------------------------------------------. ,-----------.
28| 01| 03| | 05| 06| 08| 0A| 0C| 0E| 10| 11| 12| 2B| | 15| 16| 17|
29|-------| |-----------------------------------------------------------| |-----------|
30| 19| 1A| | 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 58| 2A| | 2D| 2E| 2F|
31|-------| |-----------------------------------------------------------| |-----------|
32| 31| 33| | 35 | 36| 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 42 | | 44| 45| 46|
33|-------| |-----------------------------------------------------------| |-----------|
34| 48| 49| | 4C | 4D| 4E| 4F| 50| 51| 52| 53| 54| 55| 56| 57| 59 | | 5B| 5C| 5D|
35|-------| |-----------------------------------------------------------| |-----------|
36| 5F| 61| | 63 | 64| 65| 66| 67| 68| 69| 6A| 6B| 6C| 6D| 6E| 6F| | 70| 71| 72|
37`-------' |-----------------------------------------------------------| `-----------'
38 | 77 | 78 | 79 | 7A | 13 |
39 `-----------------------------------------------------------'
40*/
41
42
43#define KEYMAP( \
44 K01,K03, K05,K06, K08, K0A, K0C, K0E, K10,K11,K12,K2B, K15,K16,K17, \
45 K19,K1A, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2D,K2E,K2F, \
46 K31,K33, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K42, K44,K45,K46, \
47 K48,K49, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \
48 K5F,K61, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E,K6F, K70,K71,K72, \
49 K77,K78, K79, K7A,K13 \
50) { \
51 { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_NO, KC_##K05, KC_##K06, KC_NO }, \
52 { KC_##K08, KC_NO, KC_##K0A, KC_NO, KC_##K0C, KC_NO, KC_##K0E, KC_NO }, \
53 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_NO, KC_##K15, KC_##K16, KC_##K17 }, \
54 { KC_NO, KC_##K19, KC_##K1A, KC_NO, KC_NO, KC_##K1D, KC_##K1E, KC_##K1F }, \
55 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
56 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_NO, KC_##K2D, KC_##K2E, KC_##K2F }, \
57 { KC_NO, KC_##K31, KC_NO, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \
58 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
59 { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
60 { KC_##K48, KC_##K49, KC_NO, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
61 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
62 { KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_##K5D, KC_NO, KC_##K5F }, \
63 { KC_NO, KC_##K61, KC_NO, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
64 { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
65 { KC_##K70, KC_##K71, KC_##K72, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K77 }, \
66 { KC_##K78, KC_##K79, KC_##K7A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
67}
68
69// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
70static const uint8_t PROGMEM fn_layer[] = {
71 2, // Fn0
72 3, // Fn1
73 4, // Fn2
74 0, // Fn3
75 0, // Fn4
76 0, // Fn5
77 0, // Fn6
78 0 // Fn7
79};
80
81// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
82// See layer.c for details.
83static const uint8_t PROGMEM fn_keycode[] = {
84 KC_NO, // Fn0
85 KC_SCLN, // Fn1
86 KC_SLSH, // Fn2
87 KC_NO, // Fn3
88 KC_NO, // Fn4
89 KC_NO, // Fn5
90 KC_NO, // Fn6
91 KC_NO // Fn7
92};
93
94
95static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
96
97 KEYMAP(
98 F10, F11, F1, F2, F3, F4, F5, F6, F7, F8, F9, BSPC, VOLD, MUTE, VOLU,
99 F12, F13, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,MINS, EQL, BSLS, GRV, MPRV, MPLY, MNXT,
100 F14, F15, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, HOME, UP, PGUP,
101 F16, F17, LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, LEFT, INSERT, RIGHT,
102 F18, F19, LSFT, Z, X, C, V, B, N, M, COMM,DOT,SLSH, RSFT,RCTL, END, DOWN, PGDOWN,
103 LGUI, LALT, SPC, RALT,RGUI
104 ),
105 /*
106 // 0: default
107 SHORT_TYPE(
108 STOP, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
109 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
110 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV,
111 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC,
112 LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT,
113 LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RALT,UP, RSFT,
114 CAPS,LALT,LGUI, SPC, RGUI,APP, NLCK,LEFT,DOWN,RGHT
115 ),
116 // 1: with layer keys
117 SHORT_TYPE(
118 ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
119 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
120 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV,
121 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC,
122 LCTL, A, S, D, F, G, H, J, K, L, FN1, QUOT, ENT,
123 LSFT, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,UP, FN0,
124 CAPS,LALT,LGUI, SPC, RGUI,RALT,FN0, LEFT,DOWN,RGHT
125 ),
126 // 2: HHKB
127 SHORT_TYPE(
128 ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
129 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
130 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL,
131 CAPS, NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, BSPC,
132 LCTL, VOLD,VOLU,MUTE,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT,
133 LSFT, Z, X, C, V, B, NO, NO, END, PGDN,DOWN, RSFT,PGUP,FN0,
134 CAPS,LALT,LGUI, SPC, RGUI,RALT,FN0, HOME,PGDN,END
135 ),
136 // 3: Mousekey
137 SHORT_TYPE(
138 ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
139 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
140 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL,
141 CAPS, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSPC,
142 LCTL, NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,FN1, NO, ENT,
143 LSFT, NO, NO, NO, NO, BTN3,BTN2,BTN1,NO, NO, NO, RSFT,UP, NO,
144 CAPS,LALT,LGUI, BTN1, RGUI,RALT,NO, LEFT,DOWN,RGHT
145 ),
146 // 4: Cursor
147 SHORT_TYPE(
148 ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP,
149 F7,F8,F9,F10,F11,F12, DEL, END, PGDN,
150 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL,
151 CAPS, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC,
152 LCTL, NO, NO, NO, NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT,
153 LSFT, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT,UP, NO,
154 CAPS,LALT,LGUI, BTN1, RGUI,RALT,NO, LEFT,DOWN,RGHT
155 ),
156 */
157};
158
159
160uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
161{
162 return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
163}
164
165uint8_t keymap_fn_layer(uint8_t index)
166{
167 return pgm_read_byte(&fn_layer[index]);
168}
169
170uint8_t keymap_fn_keycode(uint8_t index)
171{
172 return pgm_read_byte(&fn_keycode[index]);
173}
diff --git a/converter/sun_usb/led.c b/converter/sun_usb/led.c
deleted file mode 100644
index 809398faa..000000000
--- a/converter/sun_usb/led.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "stdint.h"
19#include "serial.h"
20#include "led.h"
21#include "debug.h"
22
23
24void led_set(uint8_t usb_led)
25{
26 uint8_t sun_led = 0;
27 if (usb_led & (1<<USB_LED_NUM_LOCK)) sun_led |= (1<<0);
28 if (usb_led & (1<<USB_LED_COMPOSE)) sun_led |= (1<<1);
29 if (usb_led & (1<<USB_LED_SCROLL_LOCK)) sun_led |= (1<<2);
30 if (usb_led & (1<<USB_LED_CAPS_LOCK)) sun_led |= (1<<3);
31 xprintf("LED: %02X\n", usb_led);
32
33 serial_send(0x0E);
34 serial_send(sun_led);
35}
diff --git a/converter/sun_usb/matrix.c b/converter/sun_usb/matrix.c
deleted file mode 100644
index 3126bd33c..000000000
--- a/converter/sun_usb/matrix.c
+++ /dev/null
@@ -1,186 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/io.h>
21#include <util/delay.h>
22#include "print.h"
23#include "util.h"
24#include "matrix.h"
25#include "debug.h"
26#include "protocol/serial.h"
27
28
29/*
30 * Matrix Array usage:
31 *
32 * ROW: 16(4bits)
33 * COL: 8(3bits)
34 *
35 * 8bit wide
36 * +---------+
37 * 0|00 ... 07|
38 * 1|08 ... 0F|
39 * :| ... |
40 * :| ... |
41 * E|70 ... 77|
42 * F|78 ... 7F|
43 * +---------+
44 */
45static uint8_t matrix[MATRIX_ROWS];
46#define ROW(code) ((code>>3)&0xF)
47#define COL(code) (code&0x07)
48
49static bool is_modified = false;
50
51
52inline
53uint8_t matrix_rows(void)
54{
55 return MATRIX_ROWS;
56}
57
58inline
59uint8_t matrix_cols(void)
60{
61 return MATRIX_COLS;
62}
63
64void matrix_init(void)
65{
66 DDRD |= (1<<6);
67 PORTD |= (1<<6);
68 //debug_enable = true;
69
70 serial_init();
71
72 // initialize matrix state: all keys off
73 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
74
75 // wait for keyboard coming up
76 // otherwise LED status update fails
77 print("Reseting ");
78 while (1) {
79 print(".");
80 while (serial_recv());
81 serial_send(0x01);
82 _delay_ms(500);
83 if (serial_recv() == 0xFF) {
84 _delay_ms(500);
85 if (serial_recv() == 0x04)
86 break;
87 }
88 }
89 print(" Done\n");
90 return;
91}
92
93uint8_t matrix_scan(void)
94{
95 is_modified = false;
96
97 uint8_t code;
98 code = serial_recv();
99 if (!code) return 0;
100
101 debug_hex(code); debug(" ");
102
103 switch (code) {
104 case 0xFF: // reset success: FF 04
105 print("reset: ");
106 _delay_ms(500);
107 code = serial_recv();
108 xprintf("%02X\n", code);
109 if (code == 0x04) {
110 // LED status
111 led_set(host_keyboard_leds());
112 }
113 return 0;
114 case 0xFE: // layout: FE <layout>
115 print("layout: ");
116 _delay_ms(500);
117 xprintf("%02X\n", serial_recv());
118 return 0;
119 case 0x7E: // reset fail: 7E 01
120 print("reset fail: ");
121 _delay_ms(500);
122 xprintf("%02X\n", serial_recv());
123 return 0;
124 case 0x7F:
125 // all keys up
126 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
127 return 0;
128 }
129
130 if (code&0x80) {
131 // break code
132 if (matrix_is_on(ROW(code), COL(code))) {
133 matrix[ROW(code)] &= ~(1<<COL(code));
134 is_modified = true;
135 }
136 } else {
137 // make code
138 if (!matrix_is_on(ROW(code), COL(code))) {
139 matrix[ROW(code)] |= (1<<COL(code));
140 is_modified = true;
141 }
142 }
143 return code;
144}
145
146bool matrix_is_modified(void)
147{
148 return is_modified;
149}
150
151inline
152bool matrix_has_ghost(void)
153{
154 return false;
155}
156
157inline
158bool matrix_is_on(uint8_t row, uint8_t col)
159{
160 return (matrix[row] & (1<<col));
161}
162
163inline
164uint8_t matrix_get_row(uint8_t row)
165{
166 return matrix[row];
167}
168
169void matrix_print(void)
170{
171 print("\nr/c 01234567\n");
172 for (uint8_t row = 0; row < matrix_rows(); row++) {
173 phex(row); print(": ");
174 pbin_reverse(matrix_get_row(row));
175 print("\n");
176 }
177}
178
179uint8_t matrix_key_count(void)
180{
181 uint8_t count = 0;
182 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
183 count += bitpop(matrix[i]);
184 }
185 return count;
186}
diff --git a/converter/terminal_bluefruit/Makefile b/converter/terminal_bluefruit/Makefile
deleted file mode 100644
index dec9233ec..000000000
--- a/converter/terminal_bluefruit/Makefile
+++ /dev/null
@@ -1,99 +0,0 @@
1# Target file name (without extension).
2TARGET = terminal_bluefruit
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap.c \
12 matrix.c \
13 led.c
14
15CONFIG_H = config.h
16
17BLUEFRUIT_TRACE_SERIAL=true
18
19# MCU name, you MUST set this to match the board you are using
20# type "make clean" after changing this, so all files will be rebuilt
21#MCU = at90usb162 # Teensy 1.0
22MCU = atmega32u4 # Teensy 2.0
23#MCU = at90usb646 # Teensy++ 1.0
24#MCU = at90usb1286 # Teensy++ 2.0
25
26
27# Processor frequency.
28# Normally the first thing your program should do is set the clock prescaler,
29# so your program will run at the correct speed. You should also set this
30# variable to same clock speed. The _delay_ms() macro uses this, and many
31# examples use this variable to calculate timings. Do not add a "UL" here.
32F_CPU = 16000000
33
34
35#
36# LUFA specific
37#
38# Target architecture (see library "Board Types" documentation).
39ARCH = AVR8
40
41# Input clock frequency.
42# This will define a symbol, F_USB, in all source code files equal to the
43# input clock frequency (before any prescaling is performed) in Hz. This value may
44# differ from F_CPU if prescaling is used on the latter, and is required as the
45# raw input clock is fed directly to the PLL sections of the AVR for high speed
46# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
47# at the end, this will be done automatically to create a 32-bit value in your
48# source code.
49#
50# If no clock division is performed on the input clock inside the AVR (via the
51# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
52F_USB = $(F_CPU)
53
54# Interrupt driven control endpoint task
55OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
56
57
58# Boot Section Size in bytes
59# Teensy halfKay 512
60# Atmel DFU loader 4096
61# LUFA bootloader 4096
62OPT_DEFS += -DBOOTLOADER_SIZE=4096
63
64
65# Build Options
66# comment out to disable the options.
67#
68BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
69MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
70EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
71CONSOLE_ENABLE = yes # Console for debug(+400)
72COMMAND_ENABLE = yes # Commands for debug and configuration
73#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
74#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
75
76
77#
78# PS/2 protocol implementations
79# USART is recommended if it is available, others are for reference purpose.
80# INT implementation will drop simultaneous key strokes.
81#
82#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
83PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
84#PS2_USE_BUSYWAIT = yes # uses primitive reference code
85
86#---------------- Programming Options --------------------------
87PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
88
89
90# Search Path
91VPATH += $(TARGET_DIR)
92VPATH += $(TMK_DIR)
93
94
95include $(TMK_DIR)/protocol.mk
96include $(TMK_DIR)/protocol/bluefruit.mk
97include $(TMK_DIR)/protocol.mk
98include $(TMK_DIR)/common.mk
99include $(TMK_DIR)/rules.mk
diff --git a/converter/terminal_bluefruit/README b/converter/terminal_bluefruit/README
deleted file mode 100644
index 6ff1bc92f..000000000
--- a/converter/terminal_bluefruit/README
+++ /dev/null
@@ -1,37 +0,0 @@
1Keyboard converter for IBM terminal keyboard
2============================================
3It supports PS/2 Scan Code Set 3 and runs on USB AVR chips such like PJRC Teensy.
4I tested the converter on ATMega32U4 with 1392595(102keys) and 6110345(122keys).
5
6Source code: https://github.com/tmk/tmk_keyboard
7Article: http://geekhack.org/index.php?topic=27272.0
8
9
10CONNECTION
11----------
12Keyboard ATMega32U4
13----------------------
14Data: PD2
15Clock: PD5
16
17And VCC and GND, of course. See RESOURCE for keyboard connector pin assign.
18
19
20BUILD
21-----
22$ git clone https://github.com/tmk/tmk_keyboard.git
23$ cd converter/terminal_usb
24$ make
25
26
27RESOURCE
28--------
29Soarer's Converter: http://geekhack.org/index.php?topic=17458.0
30102keys(1392595): http://geekhack.org/index.php?topic=10737.0
31122keys(1390876): http://www.seasip.info/VintagePC/ibm_1390876.html
32KbdBabel: http://www.kbdbabel.org/
33RJ45 Connector: http://www.kbdbabel.org/conn/kbd_connector_ibmterm.png
34DIN Connector: http://www.kbdbabel.org/conn/kbd_connector_ibm3179_318x_319x.png
35WinAVR: http://winavr.sourceforge.net/
36
37EOF
diff --git a/converter/terminal_bluefruit/config.h b/converter/terminal_bluefruit/config.h
deleted file mode 100644
index 8bf139d35..000000000
--- a/converter/terminal_bluefruit/config.h
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2Converter for 70% IBM Terminal Keyboard
3Author: Benjamin Gould, 2013
4Based on code Copyright 2011 Jun Wako <wakojun@gmail.com>
5
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef CONFIG_H
21#define CONFIG_H
22
23
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x6535
26#define DEVICE_VER 0x0100
27#define MANUFACTURER t.m.k.
28#define PRODUCT 70% IBM Terminal Keyboard Converter w/ Bluetooth
29#define DESCRIPTION USB converter for IBM Terminal Keyboard w/ Bluetooth
30
31
32/* matrix size */
33#define MATRIX_ROWS 17 // keycode bit: 3-0
34#define MATRIX_COLS 8 // keycode bit: 6-4
35
36
37/* legacy keymap support */
38// #define USE_LEGACY_KEYMAP
39
40
41/* key combination for command */
42#define IS_COMMAND() ( \
43 (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \
44 (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL))) \
45)
46
47/* USART configuration
48 * asynchronous, 9600baud, 8-data bit, non parity, 1-stop bit, no flow control
49 */
50#ifdef __AVR_ATmega32U4__
51 #define SERIAL_UART_BAUD 9600
52 #define SERIAL_UART_DATA UDR1
53 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
54 #define SERIAL_UART_RXD_VECT USART1_RX_vect
55 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
56 #define SERIAL_UART_INIT() do { \
57 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
58 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
59 UCSR1B = (1<<TXEN1); /* TX: enable */ \
60 UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
61 (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
62 sei(); \
63 } while(0)
64#else
65# error "USART configuration is needed."
66#endif
67
68/*
69 * PS/2 Interrupt configuration
70 */
71#ifdef PS2_USE_INT
72/* uses INT1 for clock line(ATMega32U4) */
73#define PS2_CLOCK_PORT PORTD
74#define PS2_CLOCK_PIN PIND
75#define PS2_CLOCK_DDR DDRD
76#define PS2_CLOCK_BIT 1
77
78#define PS2_DATA_PORT PORTD
79#define PS2_DATA_PIN PIND
80#define PS2_DATA_DDR DDRD
81#define PS2_DATA_BIT 0
82
83#define PS2_INT_INIT() do { \
84 EICRA |= ((1<<ISC11) | \
85 (0<<ISC10)); \
86} while (0)
87#define PS2_INT_ON() do { \
88 EIMSK |= (1<<INT1); \
89} while (0)
90#define PS2_INT_OFF() do { \
91 EIMSK &= ~(1<<INT1); \
92} while (0)
93#define PS2_INT_VECT INT1_vect
94#endif
95
96
97/*
98 * PS/2 Busywait configuration
99 */
100#ifdef PS2_USE_BUSYWAIT
101#define PS2_CLOCK_PORT PORTD
102#define PS2_CLOCK_PIN PIND
103#define PS2_CLOCK_DDR DDRD
104#define PS2_CLOCK_BIT 1
105
106#define PS2_DATA_PORT PORTD
107#define PS2_DATA_PIN PIND
108#define PS2_DATA_DDR DDRD
109#define PS2_DATA_BIT 0
110#endif
111
112#endif
diff --git a/converter/terminal_bluefruit/keymap.c b/converter/terminal_bluefruit/keymap.c
deleted file mode 100644
index 8acd8cfb3..000000000
--- a/converter/terminal_bluefruit/keymap.c
+++ /dev/null
@@ -1,227 +0,0 @@
1/*
2Converter for 70% IBM Terminal Keyboard
3Author: Benjamin Gould, 2013
4Based on code Copyright 2011 Jun Wako <wakojun@gmail.com>
5
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include <stdint.h>
21#include <stdbool.h>
22#include <avr/pgmspace.h>
23#include "keycode.h"
24#include "print.h"
25#include "debug.h"
26#include "util.h"
27#include "keymap.h"
28
29
30
31
32/*
33 * IBM Terminal keyboard 6110345(122keys)/1392595(102keys)
34 * http://geekhack.org/showthread.php?10737-What-Can-I-Do-With-a-Terminal-Model-M
35 * http://www.seasip.info/VintagePC/ibm_1391406.html
36 *
37 * Keymap array:
38 * 8 bytes
39 * +---------+
40 * 0| |
41 * :| | 0x00-0x87
42 * ;| |
43 * 17| |
44 * +---------+
45 */
46#define KEYMAP( \
47 K08,K10,K18,K20,K28,K30,K38,K40,K48,K50,K57,K5F, \
48 K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, \
49 \
50 K05,K06, K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K5D,K66, K67,K6E,K6F, K76,K77,K7E,K84, \
51 K04,K0C, K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, K5C, K64,K65,K6D, K6C,K75,K7D,K7C, \
52 K03,K0B, K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K53,K5A, K63, K6B,K73,K74,K7B, \
53 K83,K0A, K12,K13,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K51,K59, K61,K62,K6A, K69,K72,K7A,K79, \
54 K01,K09, K11, K19, K29, K39, K58, K60, K68,K70,K71,K78 \
55) { \
56 { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
57 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
58 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
59 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
60 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
61 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
62 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
63 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
64 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
65 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
66 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
67 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \
68 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
69 { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
70 { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
71 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \
72 { KC_NO, KC_NO, KC_NO, KC_##K83, KC_##K84, KC_NO, KC_NO, KC_NO, }, \
73}
74
75static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
76 /* 0: default
77 * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
78 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
79 * `---' `---------------' `---------------' `---------------' `-----------'
80 * ,-----------------------------------------------------------. ,-----------. ,---------------.
81 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \|BS | |Ins|Hom|PgU| |NmL| /| *| -|
82 * |-----------------------------------------------------------| |-----------| |---------------|
83 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
84 * |-----------------------------------------------------------| `-----------' |-----------| +|
85 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #|Retu| | 4| 5| 6| |
86 * |-----------------------------------------------------------| ,---. |---------------|
87 * |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
88 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
89 * |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| |
90 * `----' `---------------------------------------' `----' `-----------' `---------------'
91 */
92/*
93 KEYMAP(
94 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
95 F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
96
97 PSCR,ESC, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
98 SLCK,INT4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS,
99 PAUS,INT5, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, UP, P4, P5, P6, PCMM,
100 APP, INT6, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT,
101 RGUI,LGUI, LCTL, LALT, SPC, RALT, RCTL, DOWN, NO, P0, PDOT,NO
102 ),
103*/
104 /*
105 KEYMAP(
106 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
107 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
108
109 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
110 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
111 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,
112 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
113 TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,TRNS
114 ),
115 */
116 // pseudo ANSI
117
118 KEYMAP(
119 FN0, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO,
120 PSCR,PAUS,PGUP,PGDN,HOME,END, INS, DEL, LEFT,DOWN,UP, RGHT,
121
122 NO, NO, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, GRV, BSPC, NO, NO, NO, NO, NO, NO, NO,
123 NO, NO, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, NO, NO, NO, NO, NO, NO, NO,
124 NO, NO, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, BSLS,ENT, NO, NO, NO, NO, NO,
125 NO, NO, LSFT,FN1 ,Z, X, C, V, B, N, M, COMM,DOT, SLSH, FN1, RSFT, NO, NO, NO, NO, NO, NO, NO,
126 NO, NO, LCTL, LALT, SPC, LGUI, APP, NO, NO, NO, NO, NO
127 ),
128
129 // Momentary Function Layer
130 KEYMAP(
131 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
132 TRNS,MUTE,VOLD,VOLU,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
133
134 TRNS,TRNS, TRNS,F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
135 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,HOME,UP ,END, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
136 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MS_L,MS_D,MS_U,MS_R,LEFT,DOWN, RGHT,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,
137 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,PGDN,TRNS, TRNS,RSFT, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
138 TRNS,TRNS, BTN2, TRNS, BTN1, RALT, RCTL, TRNS, TRNS,TRNS,TRNS,TRNS
139 ),
140
141 // Mouse Layer
142 KEYMAP(
143 FN0, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
144 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
145
146 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,NO, TRNS, NO, NO, NO, NO, NO, NO, NO,
147 TRNS,TRNS, TRNS,NO, NO, MS_U,NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, TRNS, NO, NO, NO, NO, NO, NO, NO,
148 TRNS,TRNS, BTN2,BTN1,MS_L,MS_D,MS_R,NO, MS_L,MS_D,MS_U,MS_R,NO, NO, NO, ENT, NO, NO, NO, NO, NO,
149 TRNS,TRNS, TRNS,TRNS,NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, RSFT, NO, NO, NO, NO, NO, NO, NO,
150 TRNS,TRNS, TRNS, TRNS, BTN1, BTN2, TRNS, NO, NO, NO, NO, NO
151 ),
152
153 // vi Layer
154 KEYMAP(
155 FN0, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
156 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
157
158 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,NO, TRNS, NO, NO, NO, NO, NO, NO, NO,
159 TRNS,TRNS, TRNS,HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, TRNS, NO, NO, NO, NO, NO, NO, NO,
160 TRNS,TRNS, TRNS,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, ENT, NO, NO, NO, NO, NO,
161 TRNS,TRNS, TRNS,TRNS,NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, RSFT, NO, NO, NO, NO, NO, NO, NO,
162 TRNS,TRNS, TRNS, TRNS, SPC, RALT, RCTL, NO, NO, NO, NO, NO
163 ),
164
165 // num lock layer
166 KEYMAP(
167 FN0, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
168 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
169
170 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
171 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
172 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,
173 TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,
174 TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,TRNS
175 ),
176
177};
178
179
180static const uint16_t fn_actions[] PROGMEM = {
181 [0] = ACTION_DEFAULT_LAYER_SET(0),
182 [1] = ACTION_LAYER_MOMENTARY(1),
183 [2] = ACTION_LAYER_MOMENTARY(2), //ACTION_LAYER_ON(2, ON_RELEASE),
184 [3] = KC_NO, //ACTION_LAYER_ON(3, ON_RELEASE),
185 [4] = KC_NO, //ACTION_LAYER_ON(4, ON_RELEASE),
186 [5] = KC_NO,
187 [6] = KC_NO,
188 [7] = KC_NO,
189};
190
191/*
192enum macro_id {
193 MS_UL,
194 MS_UR,
195 MS_DL,
196 MS_DR,
197};
198
199const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
200{
201 keyevent_t event = record->event;
202
203 switch (id) {
204 case MS_UL:
205 return (event.pressed ? MACRO( D(MS_L), D(MS_U), END ) : MACRO( U(MS_L), U(MS_U), END ) );
206 case MS_UR:
207 return (event.pressed ? MACRO( D(MS_R), D(MS_U), END ) : MACRO( U(MS_L), U(MS_U), END ) );
208 case MS_DL:
209 return (event.pressed ? MACRO( D(MS_L), D(MS_D), END ) : MACRO( U(MS_L), U(MS_U), END ) );
210 case MS_DR:
211 return (event.pressed ? MACRO( D(MS_R), D(MS_D), END ) : MACRO( U(MS_L), U(MS_U), END ) );
212 }
213 return MACRO_NONE;
214}
215*/
216
217uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
218{
219 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
220}
221
222action_t keymap_fn_to_action(uint8_t keycode)
223{
224 action_t action;
225 action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
226 return action;
227}
diff --git a/converter/terminal_bluefruit/led.c b/converter/terminal_bluefruit/led.c
deleted file mode 100644
index e5bf41d4a..000000000
--- a/converter/terminal_bluefruit/led.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2Converter for 70% IBM Terminal Keyboard
3Author: Benjamin Gould, 2013
4Based on code Copyright 2011 Jun Wako <wakojun@gmail.com>
5
6This program is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include "stdint.h"
21#include "ps2.h"
22#include "led.h"
23
24
25void led_set(uint8_t usb_led)
26{
27 uint8_t ps2_led = 0;
28 if (usb_led & (1<<USB_LED_SCROLL_LOCK))
29 ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
30 if (usb_led & (1<<USB_LED_NUM_LOCK))
31 ps2_led |= (1<<PS2_LED_NUM_LOCK);
32 if (usb_led & (1<<USB_LED_CAPS_LOCK))
33 ps2_led |= (1<<PS2_LED_CAPS_LOCK);
34 ps2_host_set_led(ps2_led);
35}
diff --git a/converter/terminal_bluefruit/matrix.c b/converter/terminal_bluefruit/matrix.c
deleted file mode 100644
index 36901536f..000000000
--- a/converter/terminal_bluefruit/matrix.c
+++ /dev/null
@@ -1,262 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/io.h>
21#include <util/delay.h>
22#include "print.h"
23#include "util.h"
24#include "debug.h"
25#include "ps2.h"
26#include "matrix.h"
27
28
29static void matrix_make(uint8_t code);
30static void matrix_break(uint8_t code);
31#ifdef MATRIX_HAS_GHOST
32static bool matrix_has_ghost_in_row(uint8_t row);
33#endif
34
35
36/*
37 * Matrix Array usage:
38 * 'Scan Code Set 3' is assigned into 17x8 cell matrix.
39 *
40 * 8bit wide
41 * +---------+
42 * 0| |
43 * :| | 0x00-0x87
44 * ;| |
45 * 17| |
46 * +---------+
47 */
48static uint8_t matrix[MATRIX_ROWS];
49#define ROW(code) (code>>3)
50#define COL(code) (code&0x07)
51
52static bool is_modified = false;
53
54
55inline
56uint8_t matrix_rows(void)
57{
58 return MATRIX_ROWS;
59}
60
61inline
62uint8_t matrix_cols(void)
63{
64 return MATRIX_COLS;
65}
66
67void matrix_init(void)
68{
69 debug_enable = true;
70 //debug_matrix = true;
71 //debug_keyboard = true;
72 //debug_mouse = false;
73
74 ps2_host_init();
75
76 // initialize matrix state: all keys off
77 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
78
79 return;
80}
81
82uint8_t matrix_scan(void)
83{
84
85 // scan code reading states
86 static enum {
87 RESET,
88 RESET_RESPONSE,
89 KBD_ID0,
90 KBD_ID1,
91 CONFIG,
92 READY,
93 F0,
94 } state = RESET;
95
96 is_modified = false;
97
98 uint8_t code;
99 if ((code = ps2_host_recv())) {
100 debug("r"); debug_hex(code); debug(" ");
101 }
102
103 switch (state) {
104 case RESET:
105 debug("wFF ");
106 if (ps2_host_send(0xFF) == 0xFA) {
107 debug("[ack]\nRESET_RESPONSE: ");
108 state = RESET_RESPONSE;
109 }
110 break;
111 case RESET_RESPONSE:
112 if (code == 0xAA) {
113 debug("[ok]\nKBD_ID: ");
114 state = KBD_ID0;
115 } else if (code) {
116 debug("err\nRESET: ");
117 state = RESET;
118 }
119 break;
120 // after reset receive keyboad ID(2 bytes)
121 case KBD_ID0:
122 if (code) {
123 state = KBD_ID1;
124 }
125 break;
126 case KBD_ID1:
127 if (code) {
128 debug("\nCONFIG: ");
129 state = CONFIG;
130 }
131 break;
132 case CONFIG:
133 debug("wF8 ");
134 if (ps2_host_send(0xF8) == 0xFA) {
135 debug("[ack]\nREADY\n");
136 state = READY;
137 }
138 break;
139 case READY:
140 switch (code) {
141 case 0x00:
142 break;
143 case 0xF0:
144 state = F0;
145 debug(" ");
146 break;
147 default: // normal key make
148 if (code < 0x88) {
149 matrix_make(code);
150 } else {
151 debug("unexpected scan code at READY: "); debug_hex(code); debug("\n");
152 }
153 state = READY;
154 debug("\n");
155 }
156 break;
157 case F0: // Break code
158 switch (code) {
159 case 0x00:
160 break;
161 default:
162 if (code < 0x88) {
163 matrix_break(code);
164 } else {
165 debug("unexpected scan code at F0: "); debug_hex(code); debug("\n");
166 }
167 state = READY;
168 debug("\n");
169 }
170 break;
171 }
172 return 1;
173}
174
175bool matrix_is_modified(void)
176{
177 return is_modified;
178}
179
180inline
181bool matrix_has_ghost(void)
182{
183#ifdef MATRIX_HAS_GHOST
184 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
185 if (matrix_has_ghost_in_row(i))
186 return true;
187 }
188#endif
189 return false;
190}
191
192inline
193bool matrix_is_on(uint8_t row, uint8_t col)
194{
195 return (matrix[row] & (1<<col));
196}
197
198inline
199uint8_t matrix_get_row(uint8_t row)
200{
201 return matrix[row];
202}
203
204void matrix_print(void)
205{
206 print("\nr/c 01234567\n");
207 for (uint8_t row = 0; row < matrix_rows(); row++) {
208 phex(row); print(": ");
209 pbin_reverse(matrix_get_row(row));
210#ifdef MATRIX_HAS_GHOST
211 if (matrix_has_ghost_in_row(row)) {
212 print(" <ghost");
213 }
214#endif
215 print("\n");
216 }
217}
218
219uint8_t matrix_key_count(void)
220{
221 uint8_t count = 0;
222 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
223 count += bitpop(matrix[i]);
224 }
225 return count;
226}
227
228#ifdef MATRIX_HAS_GHOST
229inline
230static bool matrix_has_ghost_in_row(uint8_t row)
231{
232 // no ghost exists in case less than 2 keys on
233 if (((matrix[row] - 1) & matrix[row]) == 0)
234 return false;
235
236 // ghost exists in case same state as other row
237 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
238 if (i != row && (matrix[i] & matrix[row]) == matrix[row])
239 return true;
240 }
241 return false;
242}
243#endif
244
245
246inline
247static void matrix_make(uint8_t code)
248{
249 if (!matrix_is_on(ROW(code), COL(code))) {
250 matrix[ROW(code)] |= 1<<COL(code);
251 is_modified = true;
252 }
253}
254
255inline
256static void matrix_break(uint8_t code)
257{
258 if (matrix_is_on(ROW(code), COL(code))) {
259 matrix[ROW(code)] &= ~(1<<COL(code));
260 is_modified = true;
261 }
262}
diff --git a/converter/terminal_usb/Makefile b/converter/terminal_usb/Makefile
deleted file mode 100644
index 42184521d..000000000
--- a/converter/terminal_usb/Makefile
+++ /dev/null
@@ -1,98 +0,0 @@
1# Target file name (without extension).
2TARGET = terminal_lufa
3
4# Directory common source filess exist
5TMK_DIR = ../../tmk_core
6
7# Directory keyboard dependent files exist
8TARGET_DIR = .
9
10# keyboard dependent files
11SRC = keymap.c \
12 matrix.c \
13 led.c
14
15CONFIG_H = config.h
16
17
18# MCU name, you MUST set this to match the board you are using
19# type "make clean" after changing this, so all files will be rebuilt
20#MCU = at90usb162 # Teensy 1.0
21MCU = atmega32u4 # Teensy 2.0
22#MCU = at90usb646 # Teensy++ 1.0
23#MCU = at90usb1286 # Teensy++ 2.0
24
25
26# Processor frequency.
27# Normally the first thing your program should do is set the clock prescaler,
28# so your program will run at the correct speed. You should also set this
29# variable to same clock speed. The _delay_ms() macro uses this, and many
30# examples use this variable to calculate timings. Do not add a "UL" here.
31F_CPU = 16000000
32
33
34#
35# LUFA specific
36#
37# Target architecture (see library "Board Types" documentation).
38ARCH = AVR8
39
40# Input clock frequency.
41# This will define a symbol, F_USB, in all source code files equal to the
42# input clock frequency (before any prescaling is performed) in Hz. This value may
43# differ from F_CPU if prescaling is used on the latter, and is required as the
44# raw input clock is fed directly to the PLL sections of the AVR for high speed
45# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
46# at the end, this will be done automatically to create a 32-bit value in your
47# source code.
48#
49# If no clock division is performed on the input clock inside the AVR (via the
50# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
51F_USB = $(F_CPU)
52
53# Interrupt driven control endpoint task
54OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
55
56
57# Boot Section Size in bytes
58# Teensy halfKay 512
59# Atmel DFU loader 4096
60# LUFA bootloader 4096
61OPT_DEFS += -DBOOTLOADER_SIZE=4096
62
63
64# Build Options
65# comment out to disable the options.
66#
67#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
68#MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
69#EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
70CONSOLE_ENABLE = yes # Console for debug(+400)
71COMMAND_ENABLE = yes # Commands for debug and configuration
72#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
73#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
74
75
76#
77# PS/2 protocol implementations
78# USART is recommended if it is available, others are for reference purpose.
79# INT implementation will drop simultaneous key strokes.
80#
81PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
82#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
83#PS2_USE_BUSYWAIT = yes # uses primitive reference code
84
85
86#---------------- Programming Options --------------------------
87PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
88
89
90# Search Path
91VPATH += $(TARGET_DIR)
92VPATH += $(TMK_DIR)
93
94
95include $(TMK_DIR)/protocol/lufa.mk
96include $(TMK_DIR)/protocol.mk
97include $(TMK_DIR)/common.mk
98include $(TMK_DIR)/rules.mk
diff --git a/converter/terminal_usb/README b/converter/terminal_usb/README
deleted file mode 100644
index 6ff1bc92f..000000000
--- a/converter/terminal_usb/README
+++ /dev/null
@@ -1,37 +0,0 @@
1Keyboard converter for IBM terminal keyboard
2============================================
3It supports PS/2 Scan Code Set 3 and runs on USB AVR chips such like PJRC Teensy.
4I tested the converter on ATMega32U4 with 1392595(102keys) and 6110345(122keys).
5
6Source code: https://github.com/tmk/tmk_keyboard
7Article: http://geekhack.org/index.php?topic=27272.0
8
9
10CONNECTION
11----------
12Keyboard ATMega32U4
13----------------------
14Data: PD2
15Clock: PD5
16
17And VCC and GND, of course. See RESOURCE for keyboard connector pin assign.
18
19
20BUILD
21-----
22$ git clone https://github.com/tmk/tmk_keyboard.git
23$ cd converter/terminal_usb
24$ make
25
26
27RESOURCE
28--------
29Soarer's Converter: http://geekhack.org/index.php?topic=17458.0
30102keys(1392595): http://geekhack.org/index.php?topic=10737.0
31122keys(1390876): http://www.seasip.info/VintagePC/ibm_1390876.html
32KbdBabel: http://www.kbdbabel.org/
33RJ45 Connector: http://www.kbdbabel.org/conn/kbd_connector_ibmterm.png
34DIN Connector: http://www.kbdbabel.org/conn/kbd_connector_ibm3179_318x_319x.png
35WinAVR: http://winavr.sourceforge.net/
36
37EOF
diff --git a/converter/terminal_usb/config.h b/converter/terminal_usb/config.h
deleted file mode 100644
index ea5ce62ca..000000000
--- a/converter/terminal_usb/config.h
+++ /dev/null
@@ -1,138 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21
22#define VENDOR_ID 0xFEED
23#define PRODUCT_ID 0x6535
24#define DEVICE_VER 0x0100
25#define MANUFACTURER t.m.k.
26#define PRODUCT PS/2(Set3)-USB Keyboard converter(IBM 122keys)
27#define DESCRIPTION USB converter for IBM Terminal Keyboard 122keys
28
29
30/* matrix size */
31#define MATRIX_ROWS 17 // keycode bit: 3-0
32#define MATRIX_COLS 8 // keycode bit: 6-4
33
34
35/* legacy keymap support */
36#define USE_LEGACY_KEYMAP
37
38
39/* key combination for command */
40#define IS_COMMAND() ( \
41 (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \
42 (keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL))) \
43)
44
45
46/*
47 * PS/2 USART configuration for ATMega32U4
48 */
49#ifdef PS2_USE_USART
50/* XCK for clock line */
51#define PS2_CLOCK_PORT PORTD
52#define PS2_CLOCK_PIN PIND
53#define PS2_CLOCK_DDR DDRD
54#define PS2_CLOCK_BIT 5
55/* RXD for data line */
56#define PS2_DATA_PORT PORTD
57#define PS2_DATA_PIN PIND
58#define PS2_DATA_DDR DDRD
59#define PS2_DATA_BIT 2
60
61/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
62/* set DDR of CLOCK as input to be slave */
63#define PS2_USART_INIT() do { \
64 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
65 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
66 UCSR1C = ((1 << UMSEL10) | \
67 (3 << UPM10) | \
68 (0 << USBS1) | \
69 (3 << UCSZ10) | \
70 (0 << UCPOL1)); \
71 UCSR1A = 0; \
72 UBRR1H = 0; \
73 UBRR1L = 0; \
74} while (0)
75#define PS2_USART_RX_INT_ON() do { \
76 UCSR1B = ((1 << RXCIE1) | \
77 (1 << RXEN1)); \
78} while (0)
79#define PS2_USART_RX_POLL_ON() do { \
80 UCSR1B = (1 << RXEN1); \
81} while (0)
82#define PS2_USART_OFF() do { \
83 UCSR1C = 0; \
84 UCSR1B &= ~((1 << RXEN1) | \
85 (1 << TXEN1)); \
86} while (0)
87#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
88#define PS2_USART_RX_DATA UDR1
89#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
90#define PS2_USART_RX_VECT USART1_RX_vect
91#endif
92
93
94/*
95 * PS/2 Interrupt configuration
96 */
97#ifdef PS2_USE_INT
98/* uses INT1 for clock line(ATMega32U4) */
99#define PS2_CLOCK_PORT PORTD
100#define PS2_CLOCK_PIN PIND
101#define PS2_CLOCK_DDR DDRD
102#define PS2_CLOCK_BIT 1
103
104#define PS2_DATA_PORT PORTD
105#define PS2_DATA_PIN PIND
106#define PS2_DATA_DDR DDRD
107#define PS2_DATA_BIT 0
108
109#define PS2_INT_INIT() do { \
110 EICRA |= ((1<<ISC11) | \
111 (0<<ISC10)); \
112} while (0)
113#define PS2_INT_ON() do { \
114 EIMSK |= (1<<INT1); \
115} while (0)
116#define PS2_INT_OFF() do { \
117 EIMSK &= ~(1<<INT1); \
118} while (0)
119#define PS2_INT_VECT INT1_vect
120#endif
121
122
123/*
124 * PS/2 Busywait configuration
125 */
126#ifdef PS2_USE_BUSYWAIT
127#define PS2_CLOCK_PORT PORTD
128#define PS2_CLOCK_PIN PIND
129#define PS2_CLOCK_DDR DDRD
130#define PS2_CLOCK_BIT 1
131
132#define PS2_DATA_PORT PORTD
133#define PS2_DATA_PIN PIND
134#define PS2_DATA_DDR DDRD
135#define PS2_DATA_BIT 0
136#endif
137
138#endif
diff --git a/converter/terminal_usb/keymap.c b/converter/terminal_usb/keymap.c
deleted file mode 100644
index 8ca66b5e6..000000000
--- a/converter/terminal_usb/keymap.c
+++ /dev/null
@@ -1,216 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/pgmspace.h>
21#include "keycode.h"
22#include "print.h"
23#include "debug.h"
24#include "util.h"
25#include "keymap.h"
26
27
28
29
30/*
31 * IBM Terminal keyboard 6110345(122keys)/1392595(102keys)
32 * http://geekhack.org/showthread.php?10737-What-Can-I-Do-With-a-Terminal-Model-M
33 * http://www.seasip.info/VintagePC/ibm_1391406.html
34 *
35 * Keymap array:
36 * 8 bytes
37 * +---------+
38 * 0| |
39 * :| | 0x00-0x87
40 * ;| |
41 * 17| |
42 * +---------+
43 */
44#define KEYMAP( \
45 K08,K10,K18,K20,K28,K30,K38,K40,K48,K50,K57,K5F, \
46 K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, \
47 \
48 K05,K06, K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K5D,K66, K67,K6E,K6F, K76,K77,K7E,K84, \
49 K04,K0C, K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, K5C, K64,K65,K6D, K6C,K75,K7D,K7C, \
50 K03,K0B, K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K53,K5A, K63, K6B,K73,K74,K7B, \
51 K83,K0A, K12,K13,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K51,K59, K61,K62,K6A, K69,K72,K7A,K79, \
52 K01,K09, K11, K19, K29, K39, K58, K60, K68,K70,K71,K78 \
53) { \
54 { KC_NO, KC_##K01, KC_NO, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
55 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
56 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
57 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
58 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
59 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
60 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
61 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
62 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
63 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
64 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
65 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \
66 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
67 { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
68 { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
69 { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \
70 { KC_NO, KC_NO, KC_NO, KC_##K83, KC_##K84, KC_NO, KC_NO, KC_NO, }, \
71}
72
73/*
74 * IBM Terminal keyboard 1399625, 101-key
75 */
76#define KEYMAP_101( \
77 K08, K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, K57,K5F,K62, \
78 \
79 K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, K67,K6E,K6F, K76,K77,K7E,K84, \
80 K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5C, K64,K65,K6D, K6C,K75,K7D, \
81 K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K7C, \
82 K12, K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, K63, K69,K72,K7A, \
83 K11, K19, K29, K39, K58, K61,K60,K6A, K70, K71,K79 \
84) { \
85 { KC_NO, KC_NO , KC_NO, KC_NO , KC_NO , KC_NO , KC_NO , KC_##K07 }, \
86 { KC_##K08, KC_NO , KC_NO , KC_NO , KC_NO , KC_##K0D, KC_##K0E, KC_##K0F }, \
87 { KC_NO , KC_##K11, KC_##K12, KC_NO , KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
88 { KC_NO , KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
89 { KC_NO , KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
90 { KC_NO , KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
91 { KC_NO , KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
92 { KC_NO , KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
93 { KC_NO , KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
94 { KC_NO , KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
95 { KC_NO , KC_NO , KC_##K52, KC_NO , KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
96 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_NO , KC_##K5E, KC_##K5F }, \
97 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
98 { KC_NO , KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
99 { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
100 { KC_NO , KC_##K79, KC_##K7A, KC_NO , KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \
101 { KC_NO, KC_NO, KC_NO, KC_NO , KC_##K84, KC_NO, KC_NO, KC_NO, }, \
102}
103
104// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
105static const uint8_t PROGMEM fn_layer[] = {
106 0, // Fn0
107 0, // Fn1
108 0, // Fn2
109 0, // Fn3
110 0, // Fn4
111 0, // Fn5
112 0, // Fn6
113 0 // Fn7
114};
115
116// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
117// See layer.c for details.
118static const uint8_t PROGMEM fn_keycode[] = {
119 KC_NO, // Fn0
120 KC_NO, // Fn1
121 KC_NO, // Fn2
122 KC_NO, // Fn3
123 KC_NO, // Fn4
124 KC_NO, // Fn5
125 KC_NO, // Fn6
126 KC_NO // Fn7
127};
128
129
130static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
131 /* 0: default
132 * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
133 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
134 * `---' `---------------' `---------------' `---------------' `-----------'
135 * ,-----------------------------------------------------------. ,-----------. ,---------------.
136 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \|BS | |Ins|Hom|PgU| |NmL| /| *| -|
137 * |-----------------------------------------------------------| |-----------| |---------------|
138 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
139 * |-----------------------------------------------------------| `-----------' |-----------| +|
140 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #|Retu| | 4| 5| 6| |
141 * |-----------------------------------------------------------| ,---. |---------------|
142 * |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
143 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
144 * |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| |
145 * `----' `---------------------------------------' `----' `-----------' `---------------'
146 */
147/*
148 KEYMAP(
149 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
150 F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
151
152 PSCR,ESC, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
153 SLCK,INT4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS,
154 PAUS,INT5, CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, UP, P4, P5, P6, PCMM,
155 APP, INT6, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT,
156 RGUI,LGUI, LCTL, LALT, SPC, RALT, RCTL, DOWN, NO, P0, PDOT,NO
157 ),
158*/
159 // pseudo ANSI
160 KEYMAP(
161 F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
162 F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
163
164 PSCR,ESC, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NO, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
165 SLCK,INT4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, NO, DEL, END, PGDN, P7, P8, P9, PPLS,
166 PAUS,INT5, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, BSLS,ENT, UP, P4, P5, P6, PCMM,
167 APP, INT6, LSFT,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, NO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT,
168 RGUI,LGUI, LCTL, LALT, SPC, LGUI, GRV, DOWN, NO, P0, PDOT,NO
169 ),
170
171/* 101-key keymaps
172 */
173 /* 0: default
174 * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
175 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
176 * `---' `---------------' `---------------' `---------------' `-----------'
177 * ,-----------------------------------------------------------. ,-----------. ,---------------.
178 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
179 * |-----------------------------------------------------------| |-----------| |---------------|
180 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
181 * |-----------------------------------------------------------| `-----------' |-----------| +|
182 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
183 * |-----------------------------------------------------------| ,---. |---------------|
184 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
185 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
186 * |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| |
187 * `----' `---------------------------------------' `----' `-----------' `---------------'
188 */
189/*
190 KEYMAP_101(
191 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK, BRK,
192
193 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,MINS, EQL,BSPC, INS,HOME,PGUP, NLCK,PSLS,PAST,PMNS,
194 TAB, Q, W, E, R, T, Y, U, I, O, P,LBRC,RBRC,BSLS, DEL, END,PGDN, P7, P8, P9,
195 CAPS, A, S, D, F, G, H, J, K, L,SCLN,QUOT, ENT, P4, P5, P6,PPLS,
196 LSFT, Z, X, C, V, B, N, M,COMM, DOT,SLSH, RSFT, UP, P1, P2, P3,
197 LCTL, LALT, SPC, RALT, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
198 ),
199*/
200};
201
202
203uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
204{
205 return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
206}
207
208uint8_t keymap_fn_layer(uint8_t index)
209{
210 return pgm_read_byte(&fn_layer[index]);
211}
212
213uint8_t keymap_fn_keycode(uint8_t index)
214{
215 return pgm_read_byte(&fn_keycode[index]);
216}
diff --git a/converter/terminal_usb/led.c b/converter/terminal_usb/led.c
deleted file mode 100644
index e448e84ec..000000000
--- a/converter/terminal_usb/led.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "stdint.h"
19#include "ps2.h"
20#include "led.h"
21
22
23void led_set(uint8_t usb_led)
24{
25 uint8_t ps2_led = 0;
26 if (usb_led & (1<<USB_LED_SCROLL_LOCK))
27 ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
28 if (usb_led & (1<<USB_LED_NUM_LOCK))
29 ps2_led |= (1<<PS2_LED_NUM_LOCK);
30 if (usb_led & (1<<USB_LED_CAPS_LOCK))
31 ps2_led |= (1<<PS2_LED_CAPS_LOCK);
32 ps2_host_set_led(ps2_led);
33}
diff --git a/converter/terminal_usb/matrix.c b/converter/terminal_usb/matrix.c
deleted file mode 100644
index 36901536f..000000000
--- a/converter/terminal_usb/matrix.c
+++ /dev/null
@@ -1,262 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/io.h>
21#include <util/delay.h>
22#include "print.h"
23#include "util.h"
24#include "debug.h"
25#include "ps2.h"
26#include "matrix.h"
27
28
29static void matrix_make(uint8_t code);
30static void matrix_break(uint8_t code);
31#ifdef MATRIX_HAS_GHOST
32static bool matrix_has_ghost_in_row(uint8_t row);
33#endif
34
35
36/*
37 * Matrix Array usage:
38 * 'Scan Code Set 3' is assigned into 17x8 cell matrix.
39 *
40 * 8bit wide
41 * +---------+
42 * 0| |
43 * :| | 0x00-0x87
44 * ;| |
45 * 17| |
46 * +---------+
47 */
48static uint8_t matrix[MATRIX_ROWS];
49#define ROW(code) (code>>3)
50#define COL(code) (code&0x07)
51
52static bool is_modified = false;
53
54
55inline
56uint8_t matrix_rows(void)
57{
58 return MATRIX_ROWS;
59}
60
61inline
62uint8_t matrix_cols(void)
63{
64 return MATRIX_COLS;
65}
66
67void matrix_init(void)
68{
69 debug_enable = true;
70 //debug_matrix = true;
71 //debug_keyboard = true;
72 //debug_mouse = false;
73
74 ps2_host_init();
75
76 // initialize matrix state: all keys off
77 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
78
79 return;
80}
81
82uint8_t matrix_scan(void)
83{
84
85 // scan code reading states
86 static enum {
87 RESET,
88 RESET_RESPONSE,
89 KBD_ID0,
90 KBD_ID1,
91 CONFIG,
92 READY,
93 F0,
94 } state = RESET;
95
96 is_modified = false;
97
98 uint8_t code;
99 if ((code = ps2_host_recv())) {
100 debug("r"); debug_hex(code); debug(" ");
101 }
102
103 switch (state) {
104 case RESET:
105 debug("wFF ");
106 if (ps2_host_send(0xFF) == 0xFA) {
107 debug("[ack]\nRESET_RESPONSE: ");
108 state = RESET_RESPONSE;
109 }
110 break;
111 case RESET_RESPONSE:
112 if (code == 0xAA) {
113 debug("[ok]\nKBD_ID: ");
114 state = KBD_ID0;
115 } else if (code) {
116 debug("err\nRESET: ");
117 state = RESET;
118 }
119 break;
120 // after reset receive keyboad ID(2 bytes)
121 case KBD_ID0:
122 if (code) {
123 state = KBD_ID1;
124 }
125 break;
126 case KBD_ID1:
127 if (code) {
128 debug("\nCONFIG: ");
129 state = CONFIG;
130 }
131 break;
132 case CONFIG:
133 debug("wF8 ");
134 if (ps2_host_send(0xF8) == 0xFA) {
135 debug("[ack]\nREADY\n");
136 state = READY;
137 }
138 break;
139 case READY:
140 switch (code) {
141 case 0x00:
142 break;
143 case 0xF0:
144 state = F0;
145 debug(" ");
146 break;
147 default: // normal key make
148 if (code < 0x88) {
149 matrix_make(code);
150 } else {
151 debug("unexpected scan code at READY: "); debug_hex(code); debug("\n");
152 }
153 state = READY;
154 debug("\n");
155 }
156 break;
157 case F0: // Break code
158 switch (code) {
159 case 0x00:
160 break;
161 default:
162 if (code < 0x88) {
163 matrix_break(code);
164 } else {
165 debug("unexpected scan code at F0: "); debug_hex(code); debug("\n");
166 }
167 state = READY;
168 debug("\n");
169 }
170 break;
171 }
172 return 1;
173}
174
175bool matrix_is_modified(void)
176{
177 return is_modified;
178}
179
180inline
181bool matrix_has_ghost(void)
182{
183#ifdef MATRIX_HAS_GHOST
184 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
185 if (matrix_has_ghost_in_row(i))
186 return true;
187 }
188#endif
189 return false;
190}
191
192inline
193bool matrix_is_on(uint8_t row, uint8_t col)
194{
195 return (matrix[row] & (1<<col));
196}
197
198inline
199uint8_t matrix_get_row(uint8_t row)
200{
201 return matrix[row];
202}
203
204void matrix_print(void)
205{
206 print("\nr/c 01234567\n");
207 for (uint8_t row = 0; row < matrix_rows(); row++) {
208 phex(row); print(": ");
209 pbin_reverse(matrix_get_row(row));
210#ifdef MATRIX_HAS_GHOST
211 if (matrix_has_ghost_in_row(row)) {
212 print(" <ghost");
213 }
214#endif
215 print("\n");
216 }
217}
218
219uint8_t matrix_key_count(void)
220{
221 uint8_t count = 0;
222 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
223 count += bitpop(matrix[i]);
224 }
225 return count;
226}
227
228#ifdef MATRIX_HAS_GHOST
229inline
230static bool matrix_has_ghost_in_row(uint8_t row)
231{
232 // no ghost exists in case less than 2 keys on
233 if (((matrix[row] - 1) & matrix[row]) == 0)
234 return false;
235
236 // ghost exists in case same state as other row
237 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
238 if (i != row && (matrix[i] & matrix[row]) == matrix[row])
239 return true;
240 }
241 return false;
242}
243#endif
244
245
246inline
247static void matrix_make(uint8_t code)
248{
249 if (!matrix_is_on(ROW(code), COL(code))) {
250 matrix[ROW(code)] |= 1<<COL(code);
251 is_modified = true;
252 }
253}
254
255inline
256static void matrix_break(uint8_t code)
257{
258 if (matrix_is_on(ROW(code), COL(code))) {
259 matrix[ROW(code)] &= ~(1<<COL(code));
260 is_modified = true;
261 }
262}
diff --git a/converter/usb_usb/Makefile b/converter/usb_usb/Makefile
deleted file mode 100644
index 0f25232b2..000000000
--- a/converter/usb_usb/Makefile
+++ /dev/null
@@ -1,140 +0,0 @@
1#----------------------------------------------------------------------------
2# On command line:
3#
4# make all = Make software.
5#
6# make clean = Clean out built project files.
7#
8# make coff = Convert ELF to AVR COFF.
9#
10# make extcoff = Convert ELF to AVR Extended COFF.
11#
12# make program = Download the hex file to the device.
13# Please customize your programmer settings(PROGRAM_CMD)
14#
15# make teensy = Download the hex file to the device, using teensy_loader_cli.
16# (must have teensy_loader_cli installed).
17#
18# make dfu = Download the hex file to the device, using dfu-programmer (must
19# have dfu-programmer installed).
20#
21# make flip = Download the hex file to the device, using Atmel FLIP (must
22# have Atmel FLIP installed).
23#
24# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
25# (must have dfu-programmer installed).
26#
27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
28# (must have Atmel FLIP installed).
29#
30# make debug = Start either simulavr or avarice as specified for debugging,
31# with avr-gdb or avr-insight as the front end for debugging.
32#
33# make filename.s = Just compile filename.c into the assembler code only.
34#
35# make filename.i = Create a preprocessed source file for use in submitting
36# bug reports to the GCC project.
37#
38# To rebuild project do "make clean" then "make all".
39#----------------------------------------------------------------------------
40
41# Target file name (without extension).
42TARGET = usb_usb
43
44TMK_DIR = ../../tmk_core
45
46# Directory keyboard dependent files exist
47TARGET_DIR = .
48
49# MCU name
50MCU = atmega32u4
51
52
53# Processor frequency.
54# This will define a symbol, F_CPU, in all source code files equal to the
55# processor frequency in Hz. You can then use this symbol in your source code to
56# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
57# automatically to create a 32-bit value in your source code.
58#
59# This will be an integer division of F_USB below, as it is sourced by
60# F_USB after it has run through any CPU prescalers. Note that this value
61# does not *change* the processor frequency - it should merely be updated to
62# reflect the processor speed set externally so that the code can use accurate
63# software delays.
64F_CPU = 16000000
65
66
67
68#
69# LUFA specific
70#
71# Target architecture (see library "Board Types" documentation).
72ARCH = AVR8
73# Input clock frequency.
74# This will define a symbol, F_USB, in all source code files equal to the
75# input clock frequency (before any prescaling is performed) in Hz. This value may
76# differ from F_CPU if prescaling is used on the latter, and is required as the
77# raw input clock is fed directly to the PLL sections of the AVR for high speed
78# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
79# at the end, this will be done automatically to create a 32-bit value in your
80# source code.
81#
82# If no clock division is performed on the input clock inside the AVR (via the
83# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
84F_USB = $(F_CPU)
85# Interrupt driven control endpoint task
86OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
87
88
89
90# Build Options
91# comment out to disable the options.
92#
93MOUSEKEY_ENABLE = yes # Mouse keys
94EXTRAKEY_ENABLE = yes # Media control and System control
95CONSOLE_ENABLE = yes # Console for debug
96#COMMAND_ENABLE = yes # Commands for debug and configuration
97#NKRO_ENABLE = yes # USB Nkey Rollover
98
99# Boot Section Size in bytes
100# Teensy halfKay 512
101# Atmel DFU loader 4096
102# LUFA bootloader 4096
103OPT_DEFS += -DBOOTLOADER_SIZE=4096
104
105#LDFLAGS += -Wl,--relax
106
107#OPT_DEFS += -DNO_ACTION_TAPPING
108#OPT_DEFS += -DNO_ACTION_LAYER
109#OPT_DEFS += -DNO_ACTION_MACRO
110
111SRC = \
112 keymap_common.c \
113 matrix.c \
114 main.cpp
115
116ifdef KEYMAP
117 SRC := keymap_$(KEYMAP).c $(SRC)
118else
119 SRC := keymap.c $(SRC)
120endif
121
122CONFIG_H = config.h
123
124
125
126# Search Path
127VPATH += $(TARGET_DIR)
128VPATH += $(TMK_DIR)
129
130
131
132# program Leonardo
133PROGRAM_CMD = avrdude -p$(MCU) -cavr109 -b57600 -Uflash:w:$(TARGET).hex -P$(DEV)
134
135
136
137include $(TMK_DIR)/protocol/usb_hid.mk
138include $(TMK_DIR)/protocol/lufa.mk
139include $(TMK_DIR)/common.mk
140include $(TMK_DIR)/rules.mk
diff --git a/converter/usb_usb/README b/converter/usb_usb/README
deleted file mode 100644
index 30d5deb1e..000000000
--- a/converter/usb_usb/README
+++ /dev/null
@@ -1,74 +0,0 @@
1USB to USB keyboard protocol converter
2======================================
3
4Hardware requirement
5--------------------
6Arduino Leonardo
7 http://arduino.cc/en/Main/ArduinoBoardLeonardo
8
9Circuit@Home USB Host Shield 2.0
10 https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/
11
12Buying Arduino Leonardo and USB Host Shield 2.0(from Circuit@home) will be the easiest way, you won't need even soldering iron.
13Arduino's Shield will also work well but I think Sparkfun's needs to be modified.
14
15 http://arduino.cc/en/Main/ArduinoUSBHostShield
16 https://www.sparkfun.com/products/9947
17
18Also Pro Micro 3.3V(not Mini) or Teensy with mini host shield will work with some fixes on signal/power routing.
19 https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini
20 https://www.sparkfun.com/products/12587
21 https://www.pjrc.com/teensy/td_libs_USBHostShield.html
22
23
24
25Build firmware
26--------------
27 $ git clone git://github.com/tmk/tmk_keyboard.git
28 $ cd tmk_keyboard
29 $ git submodule init
30 $ git submodule update
31 $ cd converter/usb_usb
32 $ make
33
34Program converter. Push reset button on Leonardo before run this command. Serial port name(COM17) depends your system. On Linux I got /dev/ttyACM0.
35
36 $ DEV=COM17 make program
37 or
38 $ avrdude -patmega32u4 -cavr109 -b57600 -Uflash:w:usb_usb.hex -PCOM17
39
40
41
42Limitation
43----------
44Only supports 'HID Boot protocol'.
45Not support keyboard LED yet.
46
47Note that the converter can host only USB "boot protocol" keyboard(6KRO) and not NKRO, it is possible to support NKRO keyboard but you will need to write HID report parser for that. Every NKRO keyboard can have different HID report and it is difficult to support all kind of NKRO keyboards in the market.
48
49
50
51Update
52------
532014/12/11 Added Hub support(confirmed with HHKB pro2)
54
55
56
57Resource
58--------
59USB Host Sheild 2.0
60 https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino
61 https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini
62USB Host Sheild 2.0 source
63 https://github.com/felis/USB_Host_Shield_2.0
64Arduino USB Host Shield(with bootst converter)
65 http://arduino.cc/en/Main/ArduinoUSBHostShield
66Arduino source
67 https://github.com/arduino/Arduino/hardware/arduino/{cores,variants}
68Initial release of TMK USB-USB converter
69 https://geekhack.org/index.php?topic=33057.msg653549#msg653549
70 http://deskthority.net/workshop-f7/is-remapping-a-usb-keyboard-using-teensy-possible-t2841-30.html#p74854
71Arduino-based hardware keyboard remapper - Colemak forum
72 http://forum.colemak.com/viewtopic.php?id=1561
73Teensy + Host Shield
74 http://www.pjrc.com/teensy/td_libs_USBHostShield.html
diff --git a/converter/usb_usb/config.h b/converter/usb_usb/config.h
deleted file mode 100644
index c99245676..000000000
--- a/converter/usb_usb/config.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21
22#define VENDOR_ID 0xFEED
23#define PRODUCT_ID 0x005B
24#define DEVICE_VER 0x0814
25#define MANUFACTURER t.m.k.
26#define PRODUCT USB to USB keyboard converter
27
28
29#define DESCRIPTION Product from t.m.k. keyboard firmware project
30
31
32/* matrix size */
33#define MATRIX_ROWS 32
34#define MATRIX_COLS 8
35
36/* key combination for command */
37#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
38
39#endif
diff --git a/converter/usb_usb/keymap.c b/converter/usb_usb/keymap.c
deleted file mode 100644
index 5397de519..000000000
--- a/converter/usb_usb/keymap.c
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "keymap_common.h"
19
20
21const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
22 /* 0: plain Qwerty without layer switching
23 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
24 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
25 * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
26 * ,-----------------------------------------------------------. ,-----------. ,---------------.
27 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
28 * |-----------------------------------------------------------| |-----------| |---------------|
29 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
30 * |-----------------------------------------------------------| `-----------' |-----------| +|
31 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
32 * |-----------------------------------------------------------| ,---. |---------------|
33 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
34 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
35 * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
36 * `-----------------------------------------------------------' `-----------' `---------------'
37 */
38 KEYMAP(
39 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
40 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
41 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
42 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
43 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
44 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
45 ),
46
47 /* 1: Colemak http://colemak.com
48 * ,-----------------------------------------------------------.
49 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa|
50 * |-----------------------------------------------------------|
51 * |Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \|
52 * |-----------------------------------------------------------|
53 * |BackSp| A| R| S| T| D| H| N| E| I| O| '|Return |
54 * |-----------------------------------------------------------|
55 * |Shift | Z| X| C| V| B| K| M| ,| ,| /|Shift |
56 * |-----------------------------------------------------------|
57 * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
58 * `----------------------------------------------------------'
59 */
60 KEYMAP(
61 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
62 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
63 TAB, Q, W, F, P, G, J, L, U, Y, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
64 BSPC,A, R, S, T, D, H, N, E, I, O, QUOT, ENT, P4, P5, P6, PPLS,
65 LSFT,Z, X, C, V, B, K, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
66 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
67 ),
68
69 /* 2: Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard
70 * ,-----------------------------------------------------------.
71 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa|
72 * |-----------------------------------------------------------|
73 * |Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| \|
74 * |-----------------------------------------------------------|
75 * |BackSp| A| O| E| U| I| D| H| T| N| S| -|Return |
76 * |-----------------------------------------------------------|
77 * |Shift | ;| Q| J| K| X| B| M| Wl V| Z|Shift |
78 * |-----------------------------------------------------------|
79 * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
80 * `-----------------------------------------------------------'
81 */
82 KEYMAP(
83 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
84 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC,RBRC,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
85 TAB, QUOT,COMM,DOT, P, Y, F, G, C, R, L, SLSH,EQL, BSLS, DEL, END, PGDN, P7, P8, P9,
86 CAPS,A, O, E, U, I, D, H, T, N, S, MINS, ENT, P4, P5, P6, PPLS,
87 LSFT,SCLN,Q, J, K, X, B, M, W, V, Z, RSFT, UP, P1, P2, P3,
88 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
89 ),
90
91 /* 3: Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/
92 * ,-----------------------------------------------------------.
93 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa|
94 * |-----------------------------------------------------------|
95 * |Tab | Q| D| R| W| B| J| F| U| P| ;| [| ]| \|
96 * |-----------------------------------------------------------|
97 * |CapsLo| A| S| H| T| G| Y| N| E| O| I| '|Return |
98 * |-----------------------------------------------------------|
99 * |Shift | Z| X| M| C| V| K| L| ,| ,| /|Shift |
100 * |-----------------------------------------------------------|
101 * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
102 * `-----------------------------------------------------------'
103 */
104 KEYMAP(
105 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS,
106 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
107 TAB, Q, D, R, W, B, J, F, U, P, SCLN,LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
108 BSPC,A, S, H, T, G, Y, N, E, O, I, QUOT, ENT, P4, P5, P6, PPLS,
109 LSFT,Z, X, M, C, V, K, L, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
110 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
111 ),
112};
113
114const uint16_t PROGMEM fn_actions[] = {
115};
diff --git a/converter/usb_usb/keymap_common.c b/converter/usb_usb/keymap_common.c
deleted file mode 100644
index 8ab5ba923..000000000
--- a/converter/usb_usb/keymap_common.c
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2Copyright 2014 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include "keymap_common.h"
18#include "progmem.h"
19
20
21/* translates key to keycode */
22uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
23{
24 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
25}
26
27/* translates Fn keycode to action */
28action_t keymap_fn_to_action(uint8_t keycode)
29{
30 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
31}
diff --git a/converter/usb_usb/keymap_common.h b/converter/usb_usb/keymap_common.h
deleted file mode 100644
index 435d83fdc..000000000
--- a/converter/usb_usb/keymap_common.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2Copyright 2014 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#ifndef KEYMAP_COMMON_H
18#define KEYMAP_COMMON_H
19
20#include <stdint.h>
21#include <stdbool.h>
22#include "keycode.h"
23#include "action.h"
24#include "action_macro.h"
25#include "report.h"
26#include "print.h"
27#include "debug.h"
28#include "keymap.h"
29
30
31extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
32extern const uint16_t fn_actions[];
33
34
35#define KEYMAP( \
36 K29,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41,K42,K43,K44,K45, K46,K47,K48, \
37 K35,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K2D,K2E,K2A, K49,K4A,K4B, K53,K54,K55,K56, \
38 K2B,K14,K1A,K08,K15,K17,K1C,K18,K0C,K12,K13,K2F,K30,K31, K4C,K4D,K4E, K5F,K60,K61, \
39 K39,K04,K16,K07,K09,K0A,K0B,K0D,K0E,K0F,K33,K34, K28, K5C,K5D,K5E,K57, \
40 KE1,K1D,K1B,K06,K19,K05,K11,K10,K36,K37,K38, KE5, K52, K59,K5A,K5B, \
41 KE0,KE3,KE2, K2C, KE6,KE7,K65,KE4, K50,K51,K4F, K62, K63,K58 \
42) { \
43 { KC_NO, KC_NO, KC_NO, KC_NO, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, /* 00-07 */ \
44 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, /* 08-0F */ \
45 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, /* 10-17 */ \
46 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, /* 18-1F */ \
47 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, /* 20-27 */ \
48 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, /* 28-2F */ \
49 { KC_##K30, KC_##K31, KC_NO, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, /* 30-37 */ \
50 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, /* 38-3F */ \
51 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, /* 40-47 */ \
52 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, /* 48-4F */ \
53 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, /* 50-57 */ \
54 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, /* 58-5F */ \
55 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_NO, KC_##K65, KC_NO, KC_NO }, /* 60-67 */ \
56 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 68-6F */ \
57 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 70-77 */ \
58 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 78-7F */ \
59 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 80-87 */ \
60 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 88-8F */ \
61 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 90-97 */ \
62 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* 98-9F */ \
63 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A0-A7 */ \
64 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* A8-AF */ \
65 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B0-B7 */ \
66 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* B8-BF */ \
67 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C0-C7 */ \
68 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* C8-CF */ \
69 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D0-D7 */ \
70 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* D8-DF */ \
71 { KC_##KE0, KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7 }, /* E0-E7 */ \
72 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* E8-EF */ \
73 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F0-F7 */ \
74 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, /* F8-FF */ \
75}
76
77#endif
diff --git a/converter/usb_usb/keymap_hasu.c b/converter/usb_usb/keymap_hasu.c
deleted file mode 100644
index de19e2307..000000000
--- a/converter/usb_usb/keymap_hasu.c
+++ /dev/null
@@ -1,158 +0,0 @@
1#include "keymap_common.h"
2
3const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
4 /* Layer 0: Default Layer
5 * ,-----------------------------------------------------------.
6 * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
7 * |-----------------------------------------------------------|
8 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs|
9 * |-----------------------------------------------------------|
10 * |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Fn6 |
11 * |-----------------------------------------------------------|
12 * |Fn7 | Z| X| C| V| B| N| M| ,| .|Fn2|Shift |Fn1|
13 * `-----------------------------------------------------------'
14 * |Gui|Alt | Fn4 |Fn5 |Gui|
15 * `-------------------------------------------'
16 */
17 [0] = \
18 KEYMAP(
19 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
20 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
21 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
22 LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT, FN6, P4, P5, P6, PPLS,
23 FN7, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT, UP, P1, P2, P3,
24 LCTL,LGUI,LALT, FN4, RALT,FN5, FN5, FN1, LEFT,DOWN,RGHT, P0, PDOT,PENT
25 ),
26
27 /* Layer 1: HHKB mode[HHKB Fn]
28 * ,-----------------------------------------------------------.
29 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
30 * |-----------------------------------------------------------|
31 * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
32 * |-----------------------------------------------------------|
33 * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
34 * |-----------------------------------------------------------|
35 * |Shift | | | | | | +| -|End|PgD|Dow|Shift | |
36 * `-----------------------------------------------------------'
37 * |Gui|Alt | Space |Alt |Gui|
38 * `-------------------------------------------'
39 */
40 [1] = \
41 KEYMAP(
42 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
43 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
44 CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSLS, DEL, END, PGDN, P7, P8, P9,
45 LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT, ENT, P4, P5, P6, PPLS,
46 LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN, RSFT, UP, P1, P2, P3,
47 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
48 ),
49
50 /* Layer 2: Vi mode[Slash]
51 * ,-----------------------------------------------------------.
52 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
53 * |-----------------------------------------------------------|
54 * |Tab |Hom|PgD|Up |PgU|End|Hom|PgD|PgUlEnd| | | |Backs|
55 * |-----------------------------------------------------------|
56 * |Contro| |Lef|Dow|Rig| |Lef|Dow|Up |Rig| | |Return |
57 * |-----------------------------------------------------------|
58 * |Shift | | | | | |Hom|PgD|PgUlEnd|Fn0|Shift | |
59 * `-----------------------------------------------------------'
60 * |Gui|Alt | Space |Alt |Gui|
61 * `-------------------------------------------'
62 */
63 [2] = \
64 KEYMAP(
65 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
66 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
67 TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSLS, DEL, END, PGDN, P7, P8, P9,
68 LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS,
69 LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS, RSFT, UP, P1, P2, P3,
70 LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
71 ),
72
73 /* Layer 3: Mouse mode(IJKL)[Semicolon]
74 * ,-----------------------------------------------------------.
75 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
76 * |-----------------------------------------------------------|
77 * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
78 * |-----------------------------------------------------------|
79 * |Contro| | | | | |Mb2|McL|McD|McR|Fn | |Return |
80 * |-----------------------------------------------------------|
81 * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
82 * `-----------------------------------------------------------'
83 * |Gui |Alt | Mb1 |Fn |Fn |
84 * `--------------------------------------------'
85 * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel8
86 */
87 [3] = \
88 KEYMAP(
89 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
90 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, FN8, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
91 FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD,FN8, DEL, END, PGDN, P7, P8, P9,
92 LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,TRNS,NO, ENT, P4, P5, P6, PPLS,
93 LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, RSFT, UP, P1, P2, P3,
94 LCTL,LGUI,LALT, BTN1, RALT,TRNS,TRNS,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
95 ),
96
97 /* Layer 5: Mouse mode(IJKL)[Space]
98 * ,-----------------------------------------------------------.
99 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
100 * |-----------------------------------------------------------|
101 * |Tab | | | | | |MwL|MwD|McU|MwU|MwR|Wbk|Wfr|Alt-T|
102 * |-----------------------------------------------------------|
103 * |Contro| | | | | |Mb2|McL|McD|McR|Mb1| |Return |
104 * |-----------------------------------------------------------|
105 * |Shift | | | | |Mb3|Mb2|Mb1|Mb4|Mb5| |Shift | |
106 * `-----------------------------------------------------------'
107 * |Gui |Alt | Mb1 |Fn |Fn |
108 * `--------------------------------------------'
109 * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel8
110 */
111 [4] = \
112 KEYMAP(
113 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
114 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, FN8, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
115 FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD,FN8, DEL, END, PGDN, P7, P8, P9,
116 LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, P4, P5, P6, PPLS,
117 LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, RSFT, UP, P1, P2, P3,
118 LCTL,LGUI,LALT, TRNS, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
119 ),
120};
121
122
123/*
124 * Macro definition
125 */
126enum macro_id {
127 ALT_TAB,
128};
129const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
130{
131 switch (id) {
132 case ALT_TAB:
133 return (record->event.pressed ?
134 MACRO( D(LALT), D(TAB), END ) :
135 MACRO( U(TAB), END ));
136 }
137 return MACRO_NONE;
138}
139
140
141/*
142 * Fn action definition
143 */
144#ifdef KEYMAP_SECTION_ENABLE
145const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
146#else
147const uint16_t fn_actions[] PROGMEM = {
148#endif
149 [0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used)
150 [1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps)
151 [2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash*
152 [3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon*
153 [4] = ACTION_LAYER_TAP_KEY(4, KC_SPC), // Mousekey layer with Space
154 [5] = ACTION_LAYER_MOMENTARY(3), // Mousekey layer
155 [6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT), // RControl with tap Enter
156 [7] = ACTION_MODS_ONESHOT(MOD_LSFT), // Oneshot Shift
157 [8] = ACTION_MACRO(ALT_TAB), // Application switching
158};
diff --git a/converter/usb_usb/keymap_spacefn.c b/converter/usb_usb/keymap_spacefn.c
deleted file mode 100644
index bffd2bc60..000000000
--- a/converter/usb_usb/keymap_spacefn.c
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * SpaceFN layout
3 * http://geekhack.org/index.php?topic=51069.0
4 */
5#include "keymap_common.h"
6
7
8const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
9 /* 0: default
10 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
11 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
12 * `---' `---------------' `---------------' `---------------' `-----------' `-----------'
13 * ,-----------------------------------------------------------. ,-----------. ,---------------.
14 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
15 * |-----------------------------------------------------------| |-----------| |---------------|
16 * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
17 * |-----------------------------------------------------------| `-----------' |-----------| +|
18 * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
19 * |-----------------------------------------------------------| ,---. |---------------|
20 * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
21 * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
22 * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
23 * `-----------------------------------------------------------' `-----------' `---------------'
24 */
25 KEYMAP(
26 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
27 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
28 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
29 CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
30 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
31 LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
32 ),
33
34 /* 1: SpaceFN
35 * ,-----------------------------------------------------------.
36 * |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
37 * |-----------------------------------------------------------|
38 * | | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins |
39 * |-----------------------------------------------------------|
40 * | | | | | | |PgU|Lef|Dow|Rig| | | |
41 * |-----------------------------------------------------------|
42 * | | | | | |Spc|PgD|` |~ | |Men| |
43 * |-----------------------------------------------------------|
44 * | | | | | | | | |
45 * `-----------------------------------------------------------'
46 */
47 KEYMAP(
48 ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
49 GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
50 TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9,
51 TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
52 TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS, UP, P1, P2, P3,
53 TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
54 ),
55};
56
57const uint16_t PROGMEM fn_actions[] = {
58 [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
59 [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
60};
61
diff --git a/converter/usb_usb/main.cpp b/converter/usb_usb/main.cpp
deleted file mode 100644
index 652c80573..000000000
--- a/converter/usb_usb/main.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
1#include <avr/io.h>
2#include <avr/wdt.h>
3#include <avr/power.h>
4#include <util/delay.h>
5
6// USB HID host
7#include "Usb.h"
8#include "usbhub.h"
9#include "hid.h"
10#include "hidboot.h"
11#include "parser.h"
12
13// LUFA
14#include "lufa.h"
15
16#include "timer.h"
17#include "sendchar.h"
18#include "debug.h"
19#include "keyboard.h"
20#include "led.h"
21
22
23/* LED ping configuration */
24#define TMK_LED
25//#define LEONARDO_LED
26#if defined(TMK_LED)
27// For TMK converter and Teensy
28#define LED_TX_INIT (DDRD |= (1<<6))
29#define LED_TX_ON (PORTD |= (1<<6))
30#define LED_TX_OFF (PORTD &= ~(1<<6))
31#define LED_TX_TOGGLE (PORTD ^= (1<<6))
32#elif defined(LEONARDO_LED)
33// For Leonardo(TX LED)
34#define LED_TX_INIT (DDRD |= (1<<5))
35#define LED_TX_ON (PORTD &= ~(1<<5))
36#define LED_TX_OFF (PORTD |= (1<<5))
37#define LED_TX_TOGGLE (PORTD ^= (1<<5))
38#else
39#define LED_TX_INIT
40#define LED_TX_ON
41#define LED_TX_OFF
42#define LED_TX_TOGGLE
43#endif
44
45
46static void LUFA_setup(void)
47{
48 /* Disable watchdog if enabled by bootloader/fuses */
49 MCUSR &= ~(1 << WDRF);
50 wdt_disable();
51
52 /* Disable clock division */
53 clock_prescale_set(clock_div_1);
54
55 // Leonardo needs. Without this USB device is not recognized.
56 USB_Disable();
57
58 USB_Init();
59
60 // for Console_Task
61 USB_Device_EnableSOFEvents();
62 print_set_sendchar(sendchar);
63}
64
65
66
67/*
68 * USB Host Shield HID keyboard
69 */
70USB usb_host;
71USBHub hub1(&usb_host);
72HIDBoot<HID_PROTOCOL_KEYBOARD> kbd(&usb_host);
73KBDReportParser kbd_parser;
74
75
76void led_set(uint8_t usb_led)
77{
78 kbd.SetReport(0, 0, 2, 0, 1, &usb_led);
79}
80
81
82
83int main(void)
84{
85 // LED for debug
86 LED_TX_INIT;
87 LED_TX_ON;
88
89 debug_enable = true;
90 debug_keyboard = true;
91
92 host_set_driver(&lufa_driver);
93 keyboard_init();
94
95 LUFA_setup();
96
97 // USB Host Shield setup
98 usb_host.Init();
99 kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser);
100
101 /* NOTE: Don't insert time consuming job here.
102 * It'll cause unclear initialization failure when DFU reset(worm start).
103 */
104 sei();
105
106 // wait for startup of sendchar routine
107 while (USB_DeviceState != DEVICE_STATE_Configured) ;
108 if (debug_enable) {
109 _delay_ms(1000);
110 }
111
112 debug("init: done\n");
113
114uint16_t timer;
115 for (;;) {
116 keyboard_task();
117
118timer = timer_read();
119 usb_host.Task();
120timer = timer_elapsed(timer);
121if (timer > 100) {
122 debug("host.Task: "); debug_hex16(timer); debug("\n");
123}
124
125#if !defined(INTERRUPT_CONTROL_ENDPOINT)
126 // LUFA Task for control request
127 USB_USBTask();
128#endif
129 }
130
131 return 0;
132}
diff --git a/converter/usb_usb/matrix.c b/converter/usb_usb/matrix.c
deleted file mode 100644
index 83d5ab6c8..000000000
--- a/converter/usb_usb/matrix.c
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include "usb_hid.h"
21#include "keycode.h"
22#include "util.h"
23#include "print.h"
24#include "debug.h"
25#include "matrix.h"
26
27/* KEY CODE to Matrix
28 *
29 * HID keycode(1 byte):
30 * Higher 5 bits indicates ROW and lower 3 bits COL.
31 *
32 * 7 6 5 4 3 2 1 0
33 * +---------------+
34 * | ROW | COL |
35 * +---------------+
36 *
37 * Matrix space(32 * 8):
38 * 01234567
39 * 0 +--------+
40 * : | |
41 * : | |
42 * 31 +--------+
43 */
44#define ROW_MASK 0xF8
45#define COL_MASK 0x07
46#define CODE(row, col) (((row) << 3) | (col))
47#define ROW(code) (((code) & ROW_MASK) >> 3)
48#define COL(code) ((code) & COL_MASK)
49#define ROW_BITS(code) (1 << COL(code))
50
51
52uint8_t matrix_rows(void) { return MATRIX_ROWS; }
53uint8_t matrix_cols(void) { return MATRIX_COLS; }
54void matrix_init(void) {}
55bool matrix_has_ghost(void) { return false; }
56
57static bool matrix_is_mod =false;
58
59uint8_t matrix_scan(void) {
60 static uint16_t last_time_stamp = 0;
61
62 if (last_time_stamp != usb_hid_time_stamp) {
63 last_time_stamp = usb_hid_time_stamp;
64 matrix_is_mod = true;
65 } else {
66 matrix_is_mod = false;
67 }
68 return 1;
69}
70
71bool matrix_is_modified(void) {
72
73 return matrix_is_mod;
74}
75
76bool matrix_is_on(uint8_t row, uint8_t col) {
77 uint8_t code = CODE(row, col);
78
79 if (IS_MOD(code)) {
80 if (usb_hid_keyboard_report.mods & ROW_BITS(code)) {
81 return true;
82 }
83 }
84 for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
85 if (usb_hid_keyboard_report.keys[i] == code) {
86 return true;
87 }
88 }
89 return false;
90}
91
92uint8_t matrix_get_row(uint8_t row) {
93 uint8_t row_bits = 0;
94
95 if (IS_MOD(CODE(row, 0)) && usb_hid_keyboard_report.mods) {
96 row_bits |= usb_hid_keyboard_report.mods;
97 }
98
99 for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
100 if (IS_ANY(usb_hid_keyboard_report.keys[i])) {
101 if (row == ROW(usb_hid_keyboard_report.keys[i])) {
102 row_bits |= ROW_BITS(usb_hid_keyboard_report.keys[i]);
103 }
104 }
105 }
106 return row_bits;
107}
108
109uint8_t matrix_key_count(void) {
110 uint8_t count = 0;
111
112 count += bitpop(usb_hid_keyboard_report.mods);
113 for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
114 if (IS_ANY(usb_hid_keyboard_report.keys[i])) {
115 count++;
116 }
117 }
118 return count;
119}
120
121void matrix_print(void) {
122 print("\nr/c 01234567\n");
123 for (uint8_t row = 0; row < matrix_rows(); row++) {
124 phex(row); print(": ");
125 pbin_reverse(matrix_get_row(row));
126#ifdef MATRIX_HAS_GHOST
127 if (matrix_has_ghost_in_row(row)) {
128 print(" <ghost");
129 }
130#endif
131 print("\n");
132 }
133}
diff --git a/converter/x68k_usb/Makefile b/converter/x68k_usb/Makefile
deleted file mode 100644
index 60e9a5746..000000000
--- a/converter/x68k_usb/Makefile
+++ /dev/null
@@ -1,101 +0,0 @@
1#
2# Makefile for PJRC Teensy
3#
4
5
6# Target file name (without extension).
7TARGET = x68k_usb_pjrc
8
9# Directory common source filess exist
10TMK_DIR = ../../tmk_core
11
12# Directory keyboard dependent files exist
13TARGET_DIR = .
14
15# keyboard dependent files
16SRC = keymap.c \
17 matrix.c \
18 led.c \
19 protocol/serial_uart.c
20
21CONFIG_H = config_pjrc.h
22
23
24# MCU name, you MUST set this to match the board you are using
25# type "make clean" after changing this, so all files will be rebuilt
26#MCU = at90usb162 # Teensy 1.0
27MCU = atmega32u4 # Teensy 2.0
28#MCU = at90usb646 # Teensy++ 1.0
29#MCU = at90usb1286 # Teensy++ 2.0
30
31
32# Processor frequency.
33# Normally the first thing your program should do is set the clock prescaler,
34# so your program will run at the correct speed. You should also set this
35# variable to same clock speed. The _delay_ms() macro uses this, and many
36# examples use this variable to calculate timings. Do not add a "UL" here.
37F_CPU = 16000000
38
39
40# Boot Section Size in bytes
41# Teensy halfKay 512
42# Atmel DFU loader 4096
43# LUFA bootloader 4096
44OPT_DEFS += -DBOOTLOADER_SIZE=4096
45
46
47# Build Options
48# *Comment out* to disable the options.
49#
50BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
51MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
52EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
53CONSOLE_ENABLE = yes # Console for debug(+400)
54COMMAND_ENABLE = yes # Commands for debug and configuration
55#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
56#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
57
58
59
60#---------------- Programming Options --------------------------
61AVRDUDE = avrdude
62# Type: avrdude -c ? to get a full listing.
63AVRDUDE_PROGRAMMER = avr109
64AVRDUDE_PORT = /dev/ttyACM0
65AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
66#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
67
68# Uncomment the following if you want avrdude's erase cycle counter.
69# Note that this counter needs to be initialized first using -Yn,
70# see avrdude manual.
71#AVRDUDE_ERASE_COUNTER = -y
72
73# Uncomment the following if you do /not/ wish a verification to be
74# performed after programming the device.
75#AVRDUDE_NO_VERIFY = -V
76
77# Increase verbosity level. Please use this when submitting bug
78# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
79# to submit bug reports.
80#AVRDUDE_VERBOSE = -v -v
81
82AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
83#AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
84AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
85AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
86AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
87
88#PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
89#PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
90PROGRAM_CMD = dfu-programmer atmega32u4 flash $(TARGET).hex
91
92
93# Search Path
94VPATH += $(TARGET_DIR)
95VPATH += $(TMK_DIR)
96
97
98include $(TMK_DIR)/protocol/pjrc.mk
99include $(TMK_DIR)/protocol.mk
100include $(TMK_DIR)/common.mk
101include $(TMK_DIR)/rules.mk
diff --git a/converter/x68k_usb/README b/converter/x68k_usb/README
deleted file mode 100644
index 516fcd249..000000000
--- a/converter/x68k_usb/README
+++ /dev/null
@@ -1,151 +0,0 @@
1X68000 to USB keyboard protocol converter
2=========================================
3SHARP X68000 is a hobby computer released in Japan.(1987-93)
4http://en.wikipedia.org/wiki/Sharp_X68000
5
6X68000 keyboard has ALPS linear switches.
7- DSETK0016CE01 green linear
8- DSETK0022CE02 yellow linear
9- DSETK0023CE03 yellow linear
10
11
12Hardware
13--------
14Target MCU is ATMega32u4 but other USB capable AVR will also work.
15You can use PJRC Teensy as development board.
16 http://www.pjrc.com/teensy/
17
18Wiring:
19 Mini-DIN Teensy
20 -----------------------------------------------------
21 pin1 +5V VCC
22 pin2 MOUSE -
23 pin3 RXD PD2(RXD)
24 pin4 TXD PD3(TXD) NOTE: Not supported yet.
25 pin5 READY -
26 pin6 REMOTE -
27 pin7 GND GND
28
29
30Firmware
31--------
32Build:
33 $ cd x68k_usb
34 $ make
35
36And load the binary to MCU with your favorite programmer.
37If you use Teensy you can load with PJRC Teensy Loader tool.
38 http://www.pjrc.com/teensy/loader.html
39
40
41* * * * * * * * * * * * * * * * * *
42
43
44X68000 Keyboard Protocol
45========================
46http://kyoutan.jpn.org/uts/pc/pic/x68key/
47
48
49Connector
50---------
51Mini DIN 7pin(female connector on computer side)
52 7 6 5
53 o o o
54 4 o = o 3
55 o o
56 2 1
57
58 Mini-DIN
59 -------------
60 pin1 +5V
61 pin2 MOUSE
62 pin3 RXD
63 pin4 TXD
64 pin5 READY
65 pin6 REMOTE
66 pin7 GND
67
68
69Signaling
70---------
71- TXD,RXD
72 Asynchronous, 2400baud, 1-startbit(L), 8-databit, 1-stopbit(H)
73
74- READY
75 ready/not ready(1/0)
76
77
78Data from keyboard
79------------------
80bit 7 make/break flag(0/1)
81bit 6-0 following scan code
82
83
84Data from computer
85------------------
86- LED control ON/OFF(0/1)
87 bit 7 1(fixed)
88 bit 6 全角
89 bit 5 ひらがな
90 bit 4 INS
91 bit 3 CAPS
92 bit 2 コード入力
93 bit 1 ローマ字
94 bit 0 かな
95
96- Repeat delay
97 bit 7 0(fixed)
98 bit 6 1(fixed)
99 bit 5 1(fixed)
100 bit 4 0(fixed)
101 bit 3-0 delay
102 REPEAT_DELAY = 200+delay*100 ms
103 default: 500ms
104
105- Repeat time
106 bit 7 0(fixed)
107 bit 6 1(fixed)
108 bit 5 1(fixed)
109 bit 4 1(fixed)
110 bit 3-0 time
111 REPEAT_TIME = 30+time^2*5 ms
112 default: 110ms
113
114
115Scan Codes
116----------
117,---. ,---. ,-------------------, ,-------------------. ,-----------. ,---------------.
118| 61| | 62| | 63| 64| 65| 66| 67| | 68| 69| 6A| 6B| 6C| | 5A| 5B| 5C| | 5D| 52| 53| 54|
119`---' `---' `-------------------' `-------------------' `-----------' `---------------'
120,-----------------------------------------------------------. ,-----------. ,---------------.
121| 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E| 0F| | 36| 5E| 37| | 3F| 40| 41| 42|
122|-----------------------------------------------------------| |------------ |---------------|
123| 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| 1C| | | 38| 39| 3A| | 43| 44| 45| 46|
124|------------------------------------------------------. 1D | `---=====---' |---------------|
125| 71 | 1E| 1F| 20| 21| 2l| 23| 24| 25| 26| 27| 28| 29| | ___| 3C|___ | 47| 48| 49| 4A|
126|-----------------------------------------------------------| | 3B|---| 3D| |-----------|---|
127| 70 | 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 70 | `---| 3E|---' | 4B| 4C| 4D| |
128`-----------------------------------------------------------| .---=====---. |-----------| 4E|
129 | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| |
130 `---------------------------------------------' `-----------' `---------------'
131
132
133
134LED Special Functions
135---------------------
136http://homepage2.nifty.com/m_kamada/docs/unlistedx68k.htm#keyboard
137
1381. Random Illumination
139 Plug in with pressing F1, F2 and F3.
140
1412. Sequential Illumination
142 Plug in with pressing 記号入力(52), 登録(53) and HELP.
143
1443. Scan code Display
145 Plug in with pressing かな(5A), ローマ字(5B) and コード入力(5C).
146 You can see its scan code on LEDs by pressing a key.
147 +---------------------------------------------------+
148 |bit|6 |5 |4 |3 |2 |1 |0 |
149 |---+----+--------+---+----+----------+--------+----|
150 |LED|全角|ひらがな|INS|CAPS|コード入力|ローマ字|かな|
151 +---------------------------------------------------+
diff --git a/converter/x68k_usb/config_pjrc.h b/converter/x68k_usb/config_pjrc.h
deleted file mode 100644
index c49b4a73e..000000000
--- a/converter/x68k_usb/config_pjrc.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21
22#define VENDOR_ID 0xFEED
23#define PRODUCT_ID 0x6800
24#define MANUFACTURER t.m.k.
25#define PRODUCT SHARP X68000 keyboard converter
26#define DESCRIPTION converts SHARP X68000 keyboard protocol into USB
27
28
29/* matrix size */
30#define MATRIX_ROWS 16
31#define MATRIX_COLS 8
32
33
34/* key combination for command */
35#define IS_COMMAND() ( \
36 keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
37 keyboard_report->mods == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
38 keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) \
39)
40
41/* legacy keymap support */
42#define USE_LEGACY_KEYMAP
43
44
45/* USART configuration
46 * asynchronous, 2400baud, 8-data bit, non parity, 1-stop bit, no flow control
47 */
48#ifdef __AVR_ATmega32U4__
49 #define SERIAL_UART_BAUD 2400
50 #define SERIAL_UART_DATA UDR1
51 #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
52 #define SERIAL_UART_RXD_VECT USART1_RX_vect
53 #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
54 #define SERIAL_UART_INIT() do { \
55 UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
56 UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
57 UCSR1B = (1<<RXCIE1) | (1<<RXEN1) | /* RX: interrupt, RX: enable */ \
58 (1<<TXEN1); /* TX: enable */ \
59 UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
60 (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
61 sei(); \
62 } while(0)
63#else
64# error "USART configuration is needed."
65#endif
66
67#endif
diff --git a/converter/x68k_usb/keymap.c b/converter/x68k_usb/keymap.c
deleted file mode 100644
index 5e09f55d2..000000000
--- a/converter/x68k_usb/keymap.c
+++ /dev/null
@@ -1,150 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/pgmspace.h>
21#include "keycode.h"
22#include "util.h"
23#include "keymap.h"
24
25
26
27
28// Following macros help you to define a keymap with the form of actual keyboard layout.
29
30/* X68000 Keyboard Scan codes
31 ,---. ,---. ,-------------------, ,-------------------. ,-----------. ,---------------.
32 | 61| | 62| | 63| 64| 65| 66| 67| | 68| 69| 6A| 6B| 6C| | 5A| 5B| 5C| | 5D| 52| 53| 54|
33 `---' `---' `-------------------' `-------------------' `-----------' `---------------'
34 ,-----------------------------------------------------------. ,-----------. ,---------------.
35 | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E| 0F| | 36| 5E| 37| | 3F| 40| 41| 42|
36 |-----------------------------------------------------------| |------------ |---------------|
37 | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| 1C| | | 38| 39| 3A| | 43| 44| 45| 46|
38 |------------------------------------------------------. 1D | `---=====---' |---------------|
39 | 71 | 1E| 1F| 20| 21| 2l| 23| 24| 25| 26| 27| 28| 29| | ___| 3C|___ | 47| 48| 49| 4A|
40 |-----------------------------------------------------------| | 3B|---| 3D| |-----------|---|
41 | 70 | 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 70 | `---| 3E|---' | 4B| 4C| 4D| |
42 `-----------------------------------------------------------| .---=====---. |-----------| 4E|
43 | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| |
44 `---------------------------------------------' `-----------' `---------------'
45*/
46#define KEYMAP( \
47 K61,K62, K63,K64,K65,K66,K67, K68,K69,K6A,K6B,K6C, K5A,K5B,K5C, K5D,K52,K53,K54, \
48 K01,K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D,K0E,K0F, K36,K5E,K37, K3F,K40,K41,K42, \
49 K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K1A,K1B,K1C, K1D, K38,K39,K3A, K43,K44,K45,K46, \
50 K71,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29, K3C, K47,K48,K49,K4A, \
51 K70,K2A,K2B,K2C,K2D,K2E,K2F,K30,K31,K32,K33,K34, K3B,K3E,K3D, K4B,K4C,K4D,K4E, \
52 K5F,K55,K56, K35, K57,K58,K59,K60, K72, K73, K4F,K50,K51 \
53) { \
54 { KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
55 { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
56 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
57 { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
58 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
59 { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
60 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
61 { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
62 { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
63 { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
64 { KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
65 { KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F }, \
66 { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
67 { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_NO, KC_NO, KC_NO }, \
68 { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_NO, KC_NO, KC_NO, KC_NO, }, \
69 { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
70}
71
72
73// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
74static const uint8_t PROGMEM fn_layer[] = {
75 0, // Fn0
76 0, // Fn1
77 0, // Fn2
78 0, // Fn3
79 0, // Fn4
80 0, // Fn5
81 0, // Fn6
82 0 // Fn7
83};
84
85// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
86// See layer.c for details.
87static const uint8_t PROGMEM fn_keycode[] = {
88 KC_NO, // Fn0
89 KC_NO, // Fn1
90 KC_NO, // Fn2
91 KC_NO, // Fn3
92 KC_NO, // Fn4
93 KC_NO, // Fn5
94 KC_NO, // Fn6
95 KC_NO // Fn7
96};
97
98
99static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
100/* X68000 Keyboard Scan codes
101 ,---. ,---. ,-------------------, ,-------------------. ,-----------. ,---------------.
102 | 61| | 62| | 63| 64| 65| 66| 67| | 68| 69| 6A| 6B| 6C| | 5A| 5B| 5C| | 5D| 52| 53| 54|
103 `---' `---' `-------------------' `-------------------' `-----------' `---------------'
104 ,-----------------------------------------------------------. ,-----------. ,---------------.
105 | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E| 0F| | 36| 5E| 37| | 3F| 40| 41| 42|
106 |-----------------------------------------------------------| |------------ |---------------|
107 | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B| 1C| | | 38| 39| 3A| | 43| 44| 45| 46|
108 |------------------------------------------------------. 1D | `---=====---' |---------------|
109 | 71 | 1E| 1F| 20| 21| 2l| 23| 24| 25| 26| 27| 28| 29| | ___| 3C|___ | 47| 48| 49| 4A|
110 |-----------------------------------------------------------| | 3B|---| 3D| |-----------|---|
111 | 70 | 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 34| 70 | `---| 3E|---' | 4B| 4C| 4D| |
112 `-----------------------------------------------------------| .---=====---. |-----------| 4E|
113 | 5F| 55 | 56 | 35 | 57 | 58 | 59 | 60| | 72 | 73 | | 4F| 50| 51| |
114 `---------------------------------------------' `-----------' `---------------'
115*/
116 /* ANSI */
117 KEYMAP(
118 F16, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13,
119 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, HOME,INS, DEL, NLCK,PSLS,PAST,PMNS,
120 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, PGDN,PGUP,END, P7, P8, P9, PPLS,
121 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,F18, UP, P4, P5, P6, PEQL,
122 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,GRV, LEFT,DOWN,RGHT, P1, P2, P3, PENT,
123 F19, LGUI,LALT, SPC, RALT,RGUI,RCTL,APP, F14, F15, P0, PCMM,PDOT
124 ),
125 /* JIS */
126 KEYMAP(
127 F16, F17, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, PSCR,SLCK,PAUS, CAPS,F11, F12, F13,
128 ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, HOME,INS, DEL, NLCK,PSLS,PAST,PMNS,
129 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, ENT, PGDN,PGUP,END, P7, P8, P9, PPLS,
130 LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, UP, P4, P5, P6, PEQL,
131 LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, LEFT,DOWN,RGHT, P1, P2, P3, PENT,
132 LGUI,LALT,MHEN, SPC, HENK,KANA,APP, ZKHK, F14, F15, P0, PCMM,PDOT
133 ),
134};
135
136
137uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
138{
139 return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
140}
141
142uint8_t keymap_fn_layer(uint8_t index)
143{
144 return pgm_read_byte(&fn_layer[index]);
145}
146
147uint8_t keymap_fn_keycode(uint8_t index)
148{
149 return pgm_read_byte(&fn_keycode[index]);
150}
diff --git a/converter/x68k_usb/led.c b/converter/x68k_usb/led.c
deleted file mode 100644
index ccc38699c..000000000
--- a/converter/x68k_usb/led.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "stdint.h"
19#include "serial.h"
20#include "led.h"
21#include "debug.h"
22
23
24void led_set(uint8_t usb_led)
25{
26 /* X68000 LED bits 0: on, 1: off
27 * bit 7 1(fixed)
28 * bit 6 全角
29 * bit 5 ひらがな
30 * bit 4 INS
31 * bit 3 CAPS
32 * bit 2 コード入力
33 * bit 1 ローマ字
34 * bit 0 かな
35 */
36 uint8_t led = 0xFF;
37 if (usb_led&(1<<USB_LED_NUM_LOCK)) led &= ~(1<<2);
38 if (usb_led&(1<<USB_LED_CAPS_LOCK)) led &= ~(1<<3);
39 if (usb_led&(1<<USB_LED_SCROLL_LOCK)) led &= ~(1<<1);
40 if (usb_led&(1<<USB_LED_COMPOSE)) led &= ~(1<<4);
41 if (usb_led&(1<<USB_LED_KANA)) led &= ~(1<<0);
42 serial_send(led);
43}
diff --git a/converter/x68k_usb/matrix.c b/converter/x68k_usb/matrix.c
deleted file mode 100644
index 2d5a1e116..000000000
--- a/converter/x68k_usb/matrix.c
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <avr/io.h>
21#include <util/delay.h>
22#include "print.h"
23#include "util.h"
24#include "serial.h"
25#include "matrix.h"
26#include "debug.h"
27
28
29/*
30 * Matrix Array usage:
31 *
32 * ROW: 16(4bits)
33 * COL: 8(3bits)
34 *
35 * 8bit wide
36 * +---------+
37 * 0|00 ... 07|
38 * 1|08 ... 0F|
39 * :| ... |
40 * :| ... |
41 * E|70 ... 77|
42 * F|78 ... 7F|
43 * +---------+
44 *
45 */
46static uint8_t matrix[MATRIX_ROWS];
47#define ROW(code) ((code>>3)&0xF)
48#define COL(code) (code&0x07)
49
50static bool is_modified = false;
51
52
53inline
54uint8_t matrix_rows(void)
55{
56 return MATRIX_ROWS;
57}
58
59inline
60uint8_t matrix_cols(void)
61{
62 return MATRIX_COLS;
63}
64
65void matrix_init(void)
66{
67 serial_init();
68
69 // initialize matrix state: all keys off
70 for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
71
72 return;
73}
74
75uint8_t matrix_scan(void)
76{
77 is_modified = false;
78
79 uint16_t code;
80 code = serial_recv2();
81 if (code == -1) {
82 return 0;
83 }
84
85 dprintf("%02X\n", code);
86 if (code&0x80) {
87 // break code
88 if (matrix_is_on(ROW(code), COL(code))) {
89 matrix[ROW(code)] &= ~(1<<COL(code));
90 is_modified = true;
91 }
92 } else {
93 // make code
94 if (!matrix_is_on(ROW(code), COL(code))) {
95 matrix[ROW(code)] |= (1<<COL(code));
96 is_modified = true;
97 }
98 }
99 return code;
100}
101
102bool matrix_is_modified(void)
103{
104 return is_modified;
105}
106
107inline
108bool matrix_has_ghost(void)
109{
110 return false;
111}
112
113inline
114bool matrix_is_on(uint8_t row, uint8_t col)
115{
116 return (matrix[row] & (1<<col));
117}
118
119inline
120uint8_t matrix_get_row(uint8_t row)
121{
122 return matrix[row];
123}
124
125void matrix_print(void)
126{
127 print("\nr/c 01234567\n");
128 for (uint8_t row = 0; row < matrix_rows(); row++) {
129 phex(row); print(": ");
130 pbin_reverse(matrix_get_row(row));
131 print("\n");
132 }
133}
134
135uint8_t matrix_key_count(void)
136{
137 uint8_t count = 0;
138 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
139 count += bitpop(matrix[i]);
140 }
141 return count;
142}
diff --git a/BUILD_GUIDE.md b/doc/BUILD_GUIDE.md
index 089d63834..089d63834 100644
--- a/BUILD_GUIDE.md
+++ b/doc/BUILD_GUIDE.md
diff --git a/tmk_core/doc/COPYING.GPLv2 b/doc/COPYING.GPLv2
index d159169d1..d159169d1 100644
--- a/tmk_core/doc/COPYING.GPLv2
+++ b/doc/COPYING.GPLv2
diff --git a/tmk_core/doc/COPYING.GPLv3 b/doc/COPYING.GPLv3
index 94a9ed024..94a9ed024 100644
--- a/tmk_core/doc/COPYING.GPLv3
+++ b/doc/COPYING.GPLv3
diff --git a/keyboard/planck/CYGWIN_GUIDE.md b/doc/CYGWIN_GUIDE.md
index ac13e745d..ac13e745d 100755
--- a/keyboard/planck/CYGWIN_GUIDE.md
+++ b/doc/CYGWIN_GUIDE.md
diff --git a/tmk_core/doc/FUSE.txt b/doc/FUSE.txt
index 40055e5ab..40055e5ab 100644
--- a/tmk_core/doc/FUSE.txt
+++ b/doc/FUSE.txt
diff --git a/HAND_WIRE.md b/doc/HAND_WIRE.md
index 0b7367eda..0b7367eda 100644
--- a/HAND_WIRE.md
+++ b/doc/HAND_WIRE.md
diff --git a/keyboard/planck/PCB_GUIDE.md b/doc/PCB_GUIDE.md
index b36d8fb64..b36d8fb64 100644
--- a/keyboard/planck/PCB_GUIDE.md
+++ b/doc/PCB_GUIDE.md
diff --git a/tmk_core/doc/POWER.txt b/doc/POWER.txt
index 0abbbe48e..0abbbe48e 100644
--- a/tmk_core/doc/POWER.txt
+++ b/doc/POWER.txt
diff --git a/TMK_README.md b/doc/TMK_README.md
index 36ef84ac6..36ef84ac6 100644
--- a/TMK_README.md
+++ b/doc/TMK_README.md
diff --git a/tmk_core/doc/USB_NKRO.txt b/doc/USB_NKRO.txt
index d9f1d1229..d9f1d1229 100644
--- a/tmk_core/doc/USB_NKRO.txt
+++ b/doc/USB_NKRO.txt
diff --git a/VAGRANT_GUIDE.md b/doc/VAGRANT_GUIDE.md
index 922848fd7..2127347d9 100644
--- a/VAGRANT_GUIDE.md
+++ b/doc/VAGRANT_GUIDE.md
@@ -4,7 +4,7 @@ This project includes a Vagrantfile that will allow you to build a new firmware
4 4
5## Requirements 5## Requirements
6 6
7Using the Vagrantfile in this repository requires you have [Vagrant](http://www.vagrantup.com/) as well as [VirtualBox](https://www.virtualbox.org/) (or [VMware Workstation](https://www.vmware.com/products/workstation) and [Vagrant VMware plugin](http://www.vagrantup.com/vmware) but the (paid) VMware plugin requires a licensed copy of VMware Workstation/Fusion). 7Using the `/util/Vagrantfile` in this repository requires you have [Vagrant](http://www.vagrantup.com/) as well as [VirtualBox](https://www.virtualbox.org/) (or [VMware Workstation](https://www.vmware.com/products/workstation) and [Vagrant VMware plugin](http://www.vagrantup.com/vmware) but the (paid) VMware plugin requires a licensed copy of VMware Workstation/Fusion).
8 8
9*COMPATIBILITY NOTICE* Certain versions of Virtualbox 5 appear to have an incompatibility with the Virtualbox extensions installed in the boxes in this Vagrantfile. If you encounter any issues with the /vagrant mount not succeeding, please upgrade your version of Virtualbox to at least 5.0.12. 9*COMPATIBILITY NOTICE* Certain versions of Virtualbox 5 appear to have an incompatibility with the Virtualbox extensions installed in the boxes in this Vagrantfile. If you encounter any issues with the /vagrant mount not succeeding, please upgrade your version of Virtualbox to at least 5.0.12.
10 10
@@ -12,15 +12,15 @@ Other than having Vagrant and Virtualbox installed and possibly a restart of you
12 12
13Build Firmware and Program Controller 13Build Firmware and Program Controller
14------------------------------------- 14-------------------------------------
15See [doc/build.md](tmk_core/doc/build.md), or the README in the particular keyboard/* folder. 15See [/doc/BUIDE_GUIDE.md](/doc/BUILD_GUIDE.md), or the README in the particular keyboard/* folder.
16 16
17Change your keymap 17Change your keymap
18------------------ 18------------------
19See [doc/keymap.md](tmk_core/doc/keymap.md). 19See [/doc/keymap.md](/doc/keymap.md).
20 20
21## Flashing the firmware 21## Flashing the firmware
22 22
23The "easy" way to flash the firmware is using a tool from your host OS like the Teensy programming app. [ErgoDox EZ](keyboard/ergodox_ez/readme.md) gives a great example. 23The "easy" way to flash the firmware is using a tool from your host OS like the Teensy programming app. [ErgoDox EZ](/keyboard/ergodox_ez/readme.md) gives a great example.
24 24
25If you want to program via the command line you can uncomment the ['modifyvm'] lines in the Vagrantfile to enable the USB passthrough into Linux and then program using the command line tools like dfu-util/dfu-programmer or you can install the Teensy CLI version. 25If you want to program via the command line you can uncomment the ['modifyvm'] lines in the Vagrantfile to enable the USB passthrough into Linux and then program using the command line tools like dfu-util/dfu-programmer or you can install the Teensy CLI version.
26 \ No newline at end of file 26 \ No newline at end of file
diff --git a/tmk_core/doc/build.md b/doc/build_old.md
index 2846f1d0f..5c2d57d02 100644
--- a/tmk_core/doc/build.md
+++ b/doc/build_old.md
@@ -1,6 +1,7 @@
1Build Firmware and Program Controller 1Build Firmware and Program Controller
2===================================== 2=====================================
3 3
4## This guide may be out-dated - use doc/BUILD_GUIDE.md instead
4 5
5Download and Install 6Download and Install
6-------------------- 7--------------------
diff --git a/tmk_core/doc/keycode.txt b/doc/keycode.txt
index 44d7e27cd..44d7e27cd 100644
--- a/tmk_core/doc/keycode.txt
+++ b/doc/keycode.txt
diff --git a/tmk_core/doc/keymap.md b/doc/keymap.md
index 4d42fbe5c..4d42fbe5c 100644
--- a/tmk_core/doc/keymap.md
+++ b/doc/keymap.md
diff --git a/tmk_core/doc/other_projects.md b/doc/other_projects.md
index bf980b0a9..bf980b0a9 100644
--- a/tmk_core/doc/other_projects.md
+++ b/doc/other_projects.md
diff --git a/keyboard/atomic/flash-pcb.sh b/keyboard/atomic/flash-pcb.sh
deleted file mode 100755
index 46abc6982..000000000
--- a/keyboard/atomic/flash-pcb.sh
+++ /dev/null
@@ -1,3 +0,0 @@
1dfu-programmer atmega32u4 erase --force
2dfu-programmer atmega32u4 flash atomic_pcb.hex
3dfu-programmer atmega32u4 reset \ No newline at end of file
diff --git a/keyboard/ergodox_ez/readme.md b/keyboard/ergodox_ez/readme.md
index 59130129c..78b825aaa 100644
--- a/keyboard/ergodox_ez/readme.md
+++ b/keyboard/ergodox_ez/readme.md
@@ -15,7 +15,7 @@ This requires a little bit of familiarity with coding.
15 15
161. Go to https://github.com/jackhumbert/qmk_firmware and read the Readme at the base of this repository, top to bottom. Then come back here :) 161. Go to https://github.com/jackhumbert/qmk_firmware and read the Readme at the base of this repository, top to bottom. Then come back here :)
172. Clone the repository (download it) 172. Clone the repository (download it)
183. Set up a build environment as per [the build guide](/BUILD_GUIDE.md) 183. Set up a build environment as per [the build guide](/doc/BUILD_GUIDE.md)
19 - Using a Mac and have homebrew? just run `brew tap osx-cross/avr && brew install avr-libc` 19 - Using a Mac and have homebrew? just run `brew tap osx-cross/avr && brew install avr-libc`
204. Copy `keyboard/ergodox_ez/keymaps/default/keymap.c` into `keymaps/your_name/keymap.c` (for example, `keymaps/german/keymap.c`) 204. Copy `keyboard/ergodox_ez/keymaps/default/keymap.c` into `keymaps/your_name/keymap.c` (for example, `keymaps/german/keymap.c`)
215. Edit this file, changing keycodes to your liking (see "Finding the keycodes you need" below). Try to edit the comments as well, so the "text graphics" represent your layout correctly. See below for more tips on sharing your work. 215. Edit this file, changing keycodes to your liking (see "Finding the keycodes you need" below). Try to edit the comments as well, so the "text graphics" represent your layout correctly. See below for more tips on sharing your work.
diff --git a/keyboard/planck/flash-pcb.sh b/keyboard/planck/flash-pcb.sh
deleted file mode 100755
index 2ae15458c..000000000
--- a/keyboard/planck/flash-pcb.sh
+++ /dev/null
@@ -1,3 +0,0 @@
1dfu-programmer atmega32u4 erase --force
2dfu-programmer atmega32u4 flash planck_pcb.hex
3dfu-programmer atmega32u4 reset \ No newline at end of file
diff --git a/keyboard/preonic/flash-pcb.sh b/keyboard/preonic/flash-pcb.sh
deleted file mode 100755
index 8b59b83f5..000000000
--- a/keyboard/preonic/flash-pcb.sh
+++ /dev/null
@@ -1,3 +0,0 @@
1dfu-programmer atmega32u4 erase --force
2dfu-programmer atmega32u4 flash preonic_pcb.hex
3dfu-programmer atmega32u4 reset \ No newline at end of file
diff --git a/1-setup-path-win.bat b/util/1-setup-path-win.bat
index 92e91be3e..92e91be3e 100644
--- a/1-setup-path-win.bat
+++ b/util/1-setup-path-win.bat
diff --git a/2-setup-environment-win.bat b/util/2-setup-environment-win.bat
index 905338087..905338087 100644
--- a/2-setup-environment-win.bat
+++ b/util/2-setup-environment-win.bat
diff --git a/Vagrantfile b/util/Vagrantfile
index 1abe8ff3b..1abe8ff3b 100644
--- a/Vagrantfile
+++ b/util/Vagrantfile
diff --git a/avr_setup.sh b/util/avr_setup.sh
index 34a8a3281..34a8a3281 100644
--- a/avr_setup.sh
+++ b/util/avr_setup.sh
diff --git a/new_project.sh b/util/new_project.sh
index 7def54318..7def54318 100755
--- a/new_project.sh
+++ b/util/new_project.sh