Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
55c3937ca0
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ tags
|
||||
*~
|
||||
build/
|
||||
*.bak
|
||||
.DS_Store
|
||||
|
15
README.md
15
README.md
@ -7,6 +7,9 @@ Source code is available here: <http://github.com/tmk/tmk_keyboard>
|
||||
|
||||
Updates
|
||||
-------
|
||||
#### 2016/02/10
|
||||
core: flabbergast's Chibios protocol was merged from <https://github.com/flabbergast/tmk_keyboard/tree/chibios> (@72b1668). See [tmk_core/protocol/chibios/README.md](tmk_core/protocol/chibios/README.md). Chibios protocol supports Cortex-M such as STM32 and Kinetis.
|
||||
|
||||
#### 2015/04/22
|
||||
Core library was separated to other branch `core`. <https://github.com/tmk/tmk_keyboard/tree/core>
|
||||
|
||||
@ -71,7 +74,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di
|
||||
* [Lightpad](keyboard/lightpad) - Korean custom keypad
|
||||
* [ghost_squid](keyboard/ghost_squid/) - [The Ghost Squid][ghost_squid] controller for [Cooler Master QuickFire XT][cmxt]
|
||||
|
||||
### Extenal projects using tmk_keyboard
|
||||
### External projects using tmk_keyboard
|
||||
* [ErgoDox_cub-uanic][cub-uanic] - Split Ergonomic Keyboard [ErgoDox][ergodox_org]
|
||||
* [mcdox][mcdox_tmk] - [mcdox][mcdox]
|
||||
|
||||
@ -114,13 +117,13 @@ Third party libraries like LUFA, PJRC and V-USB have their own license respectiv
|
||||
|
||||
Build Firmware and Program Controller
|
||||
-------------------------------------
|
||||
See [doc/build.md](doc/build.md).
|
||||
See [tmk_core/doc/build.md](tmk_core/doc/build.md).
|
||||
|
||||
|
||||
|
||||
Change your keymap
|
||||
------------------
|
||||
See [doc/keymap.md](doc/keymap.md).
|
||||
See [tmk_core/doc/keymap.md](tmk_core/doc/keymap.md).
|
||||
|
||||
|
||||
|
||||
@ -226,10 +229,10 @@ You can use xprintf() to display debug info on `hid_listen`, see `tmk_core/commo
|
||||
Files and Directories
|
||||
-------------------
|
||||
### Top
|
||||
* tmk_core/ - core library
|
||||
* keyboard/ - keyboard projects
|
||||
* converter/ - protocol converter projects
|
||||
* doc/ - documents
|
||||
* tmk_core/ - core library
|
||||
* tmk_core/doc/ - documents
|
||||
|
||||
|
||||
|
||||
@ -241,4 +244,4 @@ Coding Style
|
||||
|
||||
Other Keyboard Firmware Projects
|
||||
------------------
|
||||
You can learn a lot about keyboard firmware from these. See [doc/other_projects.md](doc/other_projects.md).
|
||||
You can learn a lot about keyboard firmware from these. See [Other Projects](https://github.com/tmk/tmk_keyboard/wiki/Other-Projects) other than TMK.
|
||||
|
27
converter/adb_usb/MEMO.txt
Normal file
27
converter/adb_usb/MEMO.txt
Normal file
@ -0,0 +1,27 @@
|
||||
ADB keyboard handle id
|
||||
======================
|
||||
0x01 Apple Standard keyboard M0116 ANSI
|
||||
0x01 Apple Desktop Bus keyboard 658-4081 ANSI
|
||||
0x02 Apple Extended Keyboard M0115 ANSI
|
||||
0x02 Apple Extended Keyboard II M3501 ANSI
|
||||
0x03 Logical id for Extended Protocol
|
||||
0x10 Apple Adjustable keyboard M1242 ANSI
|
||||
|
||||
|
||||
Adjustable Keyboard media key
|
||||
=============================
|
||||
Media key part has different address than the main keyboard(0x02).
|
||||
|
||||
Device Address: 0x07(Appliances/Misc devices)
|
||||
Handler ID: 0x02
|
||||
|
||||
Scan Codes
|
||||
----------
|
||||
Media key ADB Code Code in Matix
|
||||
-----------------------------------------
|
||||
Volume Up: 0x03 0x48
|
||||
Volume Down: 0x02 0x49
|
||||
Mute: 0x01 0x4a
|
||||
Mic: 0x00 0x42
|
||||
|
||||
As for these keys raw ADB codes are translate into logical codes in matrix.
|
@ -56,15 +56,17 @@ SRC = keymap_common.c \
|
||||
ifdef KEYMAP
|
||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
||||
else
|
||||
SRC := keymap_ansi.c $(SRC)
|
||||
SRC := keymap_plain.c $(SRC)
|
||||
endif
|
||||
|
||||
CONFIG_H = config.h
|
||||
|
||||
|
||||
# MCU name
|
||||
#MCU = at90usb1287
|
||||
MCU = atmega32u4
|
||||
# atmega32u4 Teensy2.0
|
||||
# atemga32u4 TMK Converter rev.1
|
||||
# atemga32u2 TMK Converter rev.2
|
||||
MCU = atmega32u2
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
@ -106,7 +108,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096
|
||||
# Atmel DFU loader 4096 for TMK Converter rev.1/rev.2
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
@ -1,73 +0,0 @@
|
||||
# Target file name (without extension).
|
||||
TARGET = adb_usb_pjrc
|
||||
|
||||
# Directory common source filess exist
|
||||
TMK_DIR = ../../tmk_core
|
||||
|
||||
# Directory keyboard dependent files exist
|
||||
TARGET_DIR = .
|
||||
|
||||
# keyboard dependent files
|
||||
SRC = keymap_common.c \
|
||||
matrix.c \
|
||||
led.c \
|
||||
adb.c
|
||||
|
||||
ifdef KEYMAP
|
||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
||||
else
|
||||
SRC := keymap_ansi.c $(SRC)
|
||||
endif
|
||||
|
||||
CONFIG_H = config.h
|
||||
|
||||
|
||||
# MCU name, you MUST set this to match the board you are using
|
||||
# type "make clean" after changing this, so all files will be rebuilt
|
||||
#MCU = at90usb162 # Teensy 1.0
|
||||
MCU = atmega32u4 # Teensy 2.0
|
||||
#MCU = at90usb646 # Teensy++ 1.0
|
||||
#MCU = at90usb1286 # Teensy++ 2.0
|
||||
|
||||
|
||||
# Processor frequency.
|
||||
# Normally the first thing your program should do is set the clock prescaler,
|
||||
# so your program will run at the correct speed. You should also set this
|
||||
# variable to same clock speed. The _delay_ms() macro uses this, and many
|
||||
# examples use this variable to calculate timings. Do not add a "UL" here.
|
||||
F_CPU = 16000000
|
||||
|
||||
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
|
||||
CONSOLE_ENABLE = yes # Console for debug
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover(+500)
|
||||
ADB_MOUSE_ENABLE = yes
|
||||
|
||||
# ADB Mice need acceleration for todays much bigger screens.
|
||||
OPT_DEFS += -DADB_MOUSE_MAXACC=8
|
||||
|
||||
|
||||
# Search Path
|
||||
VPATH += $(TARGET_DIR)
|
||||
VPATH += $(TMK_DIR)
|
||||
|
||||
include $(TMK_DIR)/protocol/pjrc.mk
|
||||
include $(TMK_DIR)/protocol.mk
|
||||
include $(TMK_DIR)/common.mk
|
||||
include $(TMK_DIR)/rules.mk
|
143
converter/adb_usb/Makefile.rev1
Normal file
143
converter/adb_usb/Makefile.rev1
Normal file
@ -0,0 +1,143 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make coff = Convert ELF to AVR COFF.
|
||||
#
|
||||
# make extcoff = Convert ELF to AVR Extended COFF.
|
||||
#
|
||||
# make program = Download the hex file to the device.
|
||||
# Please customize your programmer settings(PROGRAM_CMD)
|
||||
#
|
||||
# make teensy = Download the hex file to the device, using teensy_loader_cli.
|
||||
# (must have teensy_loader_cli installed).
|
||||
#
|
||||
# make dfu = Download the hex file to the device, using dfu-programmer (must
|
||||
# have dfu-programmer installed).
|
||||
#
|
||||
# make flip = Download the hex file to the device, using Atmel FLIP (must
|
||||
# have Atmel FLIP installed).
|
||||
#
|
||||
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
|
||||
# (must have dfu-programmer installed).
|
||||
#
|
||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
|
||||
# (must have Atmel FLIP installed).
|
||||
#
|
||||
# make debug = Start either simulavr or avarice as specified for debugging,
|
||||
# with avr-gdb or avr-insight as the front end for debugging.
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = adb_usb_lufa
|
||||
|
||||
# Directory common source filess exist
|
||||
TMK_DIR = ../../tmk_core
|
||||
|
||||
# Directory keyboard dependent files exist
|
||||
TARGET_DIR = .
|
||||
|
||||
# project specific files
|
||||
SRC = keymap_common.c \
|
||||
matrix.c \
|
||||
led.c \
|
||||
adb.c
|
||||
|
||||
ifdef KEYMAP
|
||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
||||
else
|
||||
SRC := keymap_ansi.c $(SRC)
|
||||
endif
|
||||
|
||||
CONFIG_H = config.h
|
||||
|
||||
|
||||
# MCU name
|
||||
# atmega32u4 Teensy2.0
|
||||
# atemga32u4 TMK Converter rev.1
|
||||
# atemga32u2 TMK Converter rev.2
|
||||
MCU = atmega32u4
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This will be an integer division of F_USB below, as it is sourced by
|
||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||
# does not *change* the processor frequency - it should merely be updated to
|
||||
# reflect the processor speed set externally so that the code can use accurate
|
||||
# software delays.
|
||||
F_CPU = 16000000
|
||||
|
||||
|
||||
#
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH = AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||
# at the end, this will be done automatically to create a 32-bit value in your
|
||||
# source code.
|
||||
#
|
||||
# If no clock division is performed on the input clock inside the AVR (via the
|
||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||
F_USB = $(F_CPU)
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096 for TMK Converter rev.1/rev.2
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
ADB_MOUSE_ENABLE = yes
|
||||
|
||||
# ADB Mice need acceleration for todays much bigger screens.
|
||||
OPT_DEFS += -DADB_MOUSE_MAXACC=8
|
||||
|
||||
|
||||
# Optimize size but this may cause error "relocation truncated to fit"
|
||||
#EXTRALDFLAGS = -Wl,--relax
|
||||
|
||||
# Search Path
|
||||
VPATH += $(TARGET_DIR)
|
||||
VPATH += $(TMK_DIR)
|
||||
|
||||
include $(TMK_DIR)/protocol/lufa.mk
|
||||
include $(TMK_DIR)/protocol.mk
|
||||
include $(TMK_DIR)/common.mk
|
||||
include $(TMK_DIR)/rules.mk
|
143
converter/adb_usb/Makefile.teensy
Normal file
143
converter/adb_usb/Makefile.teensy
Normal file
@ -0,0 +1,143 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make coff = Convert ELF to AVR COFF.
|
||||
#
|
||||
# make extcoff = Convert ELF to AVR Extended COFF.
|
||||
#
|
||||
# make program = Download the hex file to the device.
|
||||
# Please customize your programmer settings(PROGRAM_CMD)
|
||||
#
|
||||
# make teensy = Download the hex file to the device, using teensy_loader_cli.
|
||||
# (must have teensy_loader_cli installed).
|
||||
#
|
||||
# make dfu = Download the hex file to the device, using dfu-programmer (must
|
||||
# have dfu-programmer installed).
|
||||
#
|
||||
# make flip = Download the hex file to the device, using Atmel FLIP (must
|
||||
# have Atmel FLIP installed).
|
||||
#
|
||||
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
|
||||
# (must have dfu-programmer installed).
|
||||
#
|
||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
|
||||
# (must have Atmel FLIP installed).
|
||||
#
|
||||
# make debug = Start either simulavr or avarice as specified for debugging,
|
||||
# with avr-gdb or avr-insight as the front end for debugging.
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = adb_usb_lufa
|
||||
|
||||
# Directory common source filess exist
|
||||
TMK_DIR = ../../tmk_core
|
||||
|
||||
# Directory keyboard dependent files exist
|
||||
TARGET_DIR = .
|
||||
|
||||
# project specific files
|
||||
SRC = keymap_common.c \
|
||||
matrix.c \
|
||||
led.c \
|
||||
adb.c
|
||||
|
||||
ifdef KEYMAP
|
||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
||||
else
|
||||
SRC := keymap_ansi.c $(SRC)
|
||||
endif
|
||||
|
||||
CONFIG_H = config.h
|
||||
|
||||
|
||||
# MCU name
|
||||
# atmega32u4 Teensy2.0
|
||||
# atemga32u4 TMK Converter rev.1
|
||||
# atemga32u2 TMK Converter rev.2
|
||||
MCU = atmega32u4
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This will be an integer division of F_USB below, as it is sourced by
|
||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||
# does not *change* the processor frequency - it should merely be updated to
|
||||
# reflect the processor speed set externally so that the code can use accurate
|
||||
# software delays.
|
||||
F_CPU = 16000000
|
||||
|
||||
|
||||
#
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH = AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||
# at the end, this will be done automatically to create a 32-bit value in your
|
||||
# source code.
|
||||
#
|
||||
# If no clock division is performed on the input clock inside the AVR (via the
|
||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||
F_USB = $(F_CPU)
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096 for TMK Converter rev.1/rev.2
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=512
|
||||
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
ADB_MOUSE_ENABLE = yes
|
||||
|
||||
# ADB Mice need acceleration for todays much bigger screens.
|
||||
OPT_DEFS += -DADB_MOUSE_MAXACC=8
|
||||
|
||||
|
||||
# Optimize size but this may cause error "relocation truncated to fit"
|
||||
#EXTRALDFLAGS = -Wl,--relax
|
||||
|
||||
# Search Path
|
||||
VPATH += $(TARGET_DIR)
|
||||
VPATH += $(TMK_DIR)
|
||||
|
||||
include $(TMK_DIR)/protocol/lufa.mk
|
||||
include $(TMK_DIR)/protocol.mk
|
||||
include $(TMK_DIR)/common.mk
|
||||
include $(TMK_DIR)/rules.mk
|
@ -1,11 +1,11 @@
|
||||
ADB to USB keyboard converter
|
||||
=============================
|
||||
This firmware converts ADB keyboard protocol to USB.
|
||||
You can use PJRC Teensy for this converter, though, other USB AVR(ATMega32U4, AT90USB64/128 or etc) should work.
|
||||
But binary size is about 10KB or more it doesn't fit into 8K flash like ATMega8U2.
|
||||
This firmware converts Apple ADB keyboard protocol to USB. You can use TMK Converter, PJRC Teensy2.0 and other USB AVR MCU(ATMega32U4, AT90USB64/128 or etc) for this. But binary size is probably more than 10KB and it won't fit into 8K flash.
|
||||
|
||||
Discuss: http://geekhack.org/showwiki.php?title=Island:14290
|
||||
|
||||
TMK Converter: https://geekhack.org/index.php?topic=72052.0
|
||||
|
||||
|
||||
|
||||
README FIRST
|
||||
@ -54,22 +54,30 @@ Define following macros for ADB connection in config.h if you use other than por
|
||||
ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT
|
||||
|
||||
|
||||
Build
|
||||
-----
|
||||
See doc/build.md. In short,
|
||||
Build firmware and Program microcontroller
|
||||
------------------------------------------
|
||||
See [doc/build.md](../../tmk_core/doc/build.md).
|
||||
|
||||
$ make clean
|
||||
$ make
|
||||
To build firmware and program TMK Converter run these commands:
|
||||
|
||||
You can select keymap(ansi is default) like this:
|
||||
$ make -f Makefile clean
|
||||
$ make -f Makefile [KEYMAP=(plain|ansi|iso|hasu)]
|
||||
$ make -f Makefile [KEYMAP=(plain|ansi|iso|hasu)] dfu
|
||||
|
||||
You can select keymap with optional `KEYMAP=` (plain is default). Push button on the converter before running `dfu` target.
|
||||
|
||||
Use **Makefile.rev1** for old TMK Converter rev.1 and **Makefile.teensy** for Teensy2.0 instead of **Makefile**. For TMK Converter rev.2 just use **Makefile**.
|
||||
|
||||
To program Teensy you can use `teensy` target:
|
||||
|
||||
$ make -f Makefile.teensy [KEYMAP=(plain|ansi|iso|hasu)] teensy
|
||||
|
||||
$ make KEYMAP=[ansi|iso|hasu]
|
||||
|
||||
|
||||
Keymap
|
||||
------
|
||||
You can change a keymap by editing code of keymap_[ansi|iso|hasu|yours].c.
|
||||
How to define the keymap is probably obvious. You can find key symbols in common/keycode.h. And see doc/keymap.md for more detail.
|
||||
You can change a keymap by editing code of keymap_[plain|ansi|iso|hasu|yours].c.
|
||||
How to define the keymap is probably obvious. You can find key symbols in common/keycode.h. And see [doc/keymap.md](../../tmk_core/doc/keymap.md) for more detail.
|
||||
|
||||
|
||||
Magic command
|
||||
@ -85,6 +93,12 @@ https://github.com/tmk/tmk_keyboard/blob/master/README.md#mechanical-locking-sup
|
||||
Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch.
|
||||
|
||||
|
||||
Mouse support
|
||||
-------------
|
||||
ADB mouse support was added by @mek-apelsin on Apr,2015. It supports only one button as of now.
|
||||
https://github.com/tmk/tmk_keyboard/pull/207
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
Not-extended ADB keyboards have no discrimination between right modifier and left one,
|
||||
@ -95,8 +109,7 @@ modifiers except for GUI key(Windows/Command).
|
||||
And most ADB keyboard has no diodes in its matrix so they are not NKRO,
|
||||
though ADB protocol itself supports it. See protocol/adb.c for more info.
|
||||
|
||||
If keyboard has ISO layout you need to use ISO keymap with `make KEYMAP=iso`. With ANSI
|
||||
keymap you will suffer from swapped keys problem.
|
||||
If keyboard has ISO layout you may have swapped keys problem, see this for the detail.
|
||||
|
||||
https://github.com/tmk/tmk_keyboard/issues/35
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KEYMAP_EXT_ANSI(
|
||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO,
|
||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
|
||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST,
|
||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS,
|
||||
LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
|
||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
|
||||
|
@ -33,6 +33,49 @@ extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
||||
extern const uint16_t fn_actions[];
|
||||
|
||||
|
||||
/* Common layout: ANSI+ISO
|
||||
* ,---. .---------------. ,---------------. ,---------------. ,-----------. ,---------------.
|
||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr|
|
||||
* `---' `---------------' `---------------' `---------------' `-----------' `---------------'
|
||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
|
||||
* |-----------------------------------------------------------| |-----------| |---------------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -|
|
||||
* |-----------------------------------------------------------| `-----------' |---------------|
|
||||
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
|
||||
* |-----------------------------------------------------------| ,---. |---------------|
|
||||
* |Shif|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
|
||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
||||
* |Ctrl |Opt |Cmd | Space |App |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| |
|
||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
||||
*/
|
||||
#define KEYMAP( \
|
||||
K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K49,K48,K4A,K7F, \
|
||||
K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \
|
||||
K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \
|
||||
K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \
|
||||
K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \
|
||||
K36,K3A,K37, K31, K42,K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \
|
||||
) { \
|
||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
|
||||
{ KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
|
||||
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
|
||||
{ KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
|
||||
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
|
||||
{ KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
|
||||
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_PENT, KC_##K35, KC_##K36, KC_##K37 }, \
|
||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
|
||||
{ KC_F17, KC_##K41, KC_##K42, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \
|
||||
{ KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_F18 }, \
|
||||
{ KC_F19, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
|
||||
{ KC_##K58, KC_##K59, KC_F20, KC_##K5B, KC_##K5C, KC_JYEN, KC_RO, KC_PCMM }, \
|
||||
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_HANJ, KC_##K67 }, \
|
||||
{ KC_HAEN, KC_##K69, KC_F16, KC_##K6B, KC_NO, KC_##K6D, KC_APP, KC_##K6F }, \
|
||||
{ KC_NO, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
|
||||
{ KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_NO, KC_##K7F } \
|
||||
}
|
||||
|
||||
|
||||
/* M0115 Apple Extended Keyboard ANSI
|
||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
|
||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
|
||||
@ -121,21 +164,21 @@ extern const uint16_t fn_actions[];
|
||||
|
||||
|
||||
/* M0116 Apple Standard Keyboard ANSI
|
||||
* +-------+
|
||||
* | power |
|
||||
* +-------+
|
||||
* +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
|
||||
* |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
|
||||
* +---------------------------------------------------------+ +---+---+---+---+
|
||||
* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | | | 7 | 8 | 9 | + |
|
||||
* +-----------------------------------------------------+ | +---+---+---+---+
|
||||
* | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
|
||||
* +---------------------------------------------------------+ +---+---+---+---+
|
||||
* | shift | z | x | c | v | b | n | m | , | . | / | shift | | 1 | 2 | 3 | |
|
||||
* +---------------------------------------------------------+ +-------+---|ent|
|
||||
* |cap|opt|comnd| ` | | \ |lef|rig|dwn|up | | 0 | . | |
|
||||
* +---------------------------------------------------------+ +-------+---+---+
|
||||
*/
|
||||
* +-------+
|
||||
* | power |
|
||||
* +-------+
|
||||
* +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
|
||||
* |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
|
||||
* +---------------------------------------------------------+ +---+---+---+---+
|
||||
* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | | | 7 | 8 | 9 | + |
|
||||
* +-----------------------------------------------------+ | +---+---+---+---+
|
||||
* | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
|
||||
* +---------------------------------------------------------+ +---+---+---+---+
|
||||
* | shift | z | x | c | v | b | n | m | , | . | / | shift | | 1 | 2 | 3 | |
|
||||
* +---------------------------------------------------------+ +-------+---|ent|
|
||||
* |cap|opt|comnd| ` | | \ |lef|rig|dwn|up | | 0 | . | |
|
||||
* +---------------------------------------------------------+ +-------+---+---+
|
||||
*/
|
||||
#define KEYMAP_M0116_ANSI( \
|
||||
K7F, \
|
||||
K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \
|
||||
@ -162,6 +205,48 @@ extern const uint16_t fn_actions[];
|
||||
{ KC_NO , KC_NO, KC_NO , KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \
|
||||
}
|
||||
|
||||
/* M0118 Apple Standard Keyboard ISO
|
||||
* +-------+
|
||||
* | power |
|
||||
* +-------+
|
||||
* +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
|
||||
* |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
|
||||
* +---------------------------------------------------------+ +---+---+---+---+
|
||||
* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |Ret| | 7 | 8 | 9 | + |
|
||||
* +-----------------------------------------------------` | +---+---+---+---+
|
||||
* | caps | a | s | d | f | g | h | j | k | l | ; | ' | # | | | 4 | 5 | 6 | - |
|
||||
* +---------------------------------------------------------+ +---+---+---+---+
|
||||
* |shif| \ | z | x | c | v | b | n | m | , | . | / |Shif| up| | 1 | 2 | 3 | |
|
||||
* +---------------------------------------------------------+ +-------+---|ent|
|
||||
* |ctrl|opt |comnd| |comnd |lef|rig|dwn| | 0 | . | |
|
||||
* +---------------------------------------------------------+ +-------+---+---+
|
||||
*/
|
||||
#define KEYMAP_M0118_ISO( \
|
||||
K7F, \
|
||||
K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \
|
||||
K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K45, \
|
||||
K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A,K24, K56,K57,K58,K4E, \
|
||||
K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K7B,K3E, K53,K54,K55, \
|
||||
K36,K3A,K37, K31, K3B,K3C,K3D, K52, K41,K4C \
|
||||
) { \
|
||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
|
||||
{ KC_##K08, KC_##K09, KC_##K0A KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
|
||||
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
|
||||
{ KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
|
||||
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
|
||||
{ KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
|
||||
{ KC_##K30, KC_##K31, KC_NO, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \
|
||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
|
||||
{ KC_NO, KC_##K41, KC_NO, KC_##K43, KC_NO, KC_##K45, KC_NO, KC_##K47 }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_##K4B, KC_##K4C, KC_NO, KC_##K4E, KC_NO }, \
|
||||
{ KC_NO, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
|
||||
{ KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_NO, KC_NO, KC_NO }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO , KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
{ KC_NO , KC_NO, KC_NO , KC_##K7B, KC_NO, KC_NO, KC_NO, KC_##K7F } \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KEYMAP_EXT_ISO(
|
||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO,
|
||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
|
||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST,
|
||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, DEL, END, PGDN, P7, P8, P9, PMNS,
|
||||
LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, PPLS,
|
||||
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
|
||||
|
42
converter/adb_usb/keymap_plain.c
Normal file
42
converter/adb_usb/keymap_plain.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include "keymap_common.h"
|
||||
|
||||
|
||||
/*
|
||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
|
||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|
|
||||
* `---' `---------------' `---------------' `---------------' `-----------' `---'
|
||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *|
|
||||
* |-----------------------------------------------------------| |-----------| |---------------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -|
|
||||
* |-----------------------------------------------------------| `-----------' |---------------|
|
||||
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
|
||||
* |-----------------------------------------------------------| ,---. |---------------|
|
||||
* |Shif|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
|
||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
||||
* |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| |
|
||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
||||
*/
|
||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = KEYMAP(
|
||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,NO,
|
||||
FN0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST,
|
||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,FN1, DEL, END, PGDN, P7, P8, P9, PMNS,
|
||||
LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS,
|
||||
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3,
|
||||
LCTL,LALT,LGUI, SPC, APP, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
||||
),
|
||||
[1] = KEYMAP(
|
||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, VOLD,VOLU,MUTE,NO,
|
||||
FN0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,BTN1,BTN2,BTN3,
|
||||
TAB, Q, W, E, R, T, Y, U, PSCR,SLCK,PAUS,UP, INS, FN1, DEL, END, PGDN, WH_D,MS_U,WH_U,WH_D,
|
||||
LCAP,VOLD,VOLU,MUTE,F, G, H, J, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_U,
|
||||
LSFT,NUBS,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R,
|
||||
LCTL,LALT,LGUI, SPC, APP, RALT,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3
|
||||
),
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM fn_actions[] = {
|
||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_GRV),
|
||||
[1] = ACTION_LAYER_TAP_KEY(1, KC_BSLS),
|
||||
};
|
@ -23,5 +23,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
void led_set(uint8_t usb_led)
|
||||
{
|
||||
adb_host_kbd_led(~usb_led);
|
||||
adb_host_kbd_led(ADB_ADDR_KEYBOARD, ~usb_led);
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endif
|
||||
|
||||
|
||||
static bool has_media_keys = false;
|
||||
static bool is_iso_layout = false;
|
||||
static bool is_modified = false;
|
||||
static report_mouse_t mouse_report = {};
|
||||
|
||||
@ -69,14 +71,58 @@ uint8_t matrix_cols(void)
|
||||
|
||||
void matrix_init(void)
|
||||
{
|
||||
// LED on
|
||||
DDRD |= (1<<6); PORTD |= (1<<6);
|
||||
|
||||
adb_host_init();
|
||||
// wait for keyboard to boot up and receive command
|
||||
_delay_ms(1000);
|
||||
_delay_ms(2000);
|
||||
|
||||
// device scan
|
||||
xprintf("Before init:\n");
|
||||
for (uint8_t addr = 1; addr < 16; addr++) {
|
||||
uint16_t reg3 = adb_host_talk(addr, ADB_REG_3);
|
||||
if (reg3) {
|
||||
xprintf("Scan: addr:%d, reg3:%04X\n", addr, reg3);
|
||||
}
|
||||
_delay_ms(20);
|
||||
}
|
||||
|
||||
// Determine ISO keyboard by handler id
|
||||
// http://lxr.free-electrons.com/source/drivers/macintosh/adbhid.c?v=4.4#L815
|
||||
uint16_t handler_id = adb_host_talk(ADB_ADDR_KEYBOARD, ADB_REG_3);
|
||||
switch (handler_id) {
|
||||
case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D:
|
||||
case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1:
|
||||
case 0xC4: case 0xC7:
|
||||
is_iso_layout = true;
|
||||
break;
|
||||
default:
|
||||
is_iso_layout = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// Adjustable keyboard media keys: address=0x07 and handlerID=0x02
|
||||
has_media_keys = (0x02 == (adb_host_talk(ADB_ADDR_APPLIANCE, ADB_REG_3) & 0xff));
|
||||
if (has_media_keys) {
|
||||
xprintf("Found: media keys\n");
|
||||
}
|
||||
|
||||
// Enable keyboard left/right modifier distinction
|
||||
// Addr:Keyboard(0010), Cmd:Listen(10), Register3(11)
|
||||
// upper byte: reserved bits 0000, device address 0010
|
||||
// lower byte: device handler 00000011
|
||||
adb_host_listen(0x2B,0x02,0x03);
|
||||
// Listen Register3
|
||||
// upper byte: reserved bits 0000, keyboard address 0010
|
||||
// lower byte: device handler 00000011
|
||||
adb_host_listen(ADB_ADDR_KEYBOARD, ADB_REG_3, ADB_ADDR_KEYBOARD, ADB_HANDLER_EXTENDED_PROTOCOL);
|
||||
|
||||
// device scan
|
||||
xprintf("After init:\n");
|
||||
for (uint8_t addr = 1; addr < 16; addr++) {
|
||||
uint16_t reg3 = adb_host_talk(addr, ADB_REG_3);
|
||||
if (reg3) {
|
||||
xprintf("Scan: addr:%d, reg3:%04X\n", addr, reg3);
|
||||
}
|
||||
_delay_ms(20);
|
||||
}
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
||||
@ -86,6 +132,9 @@ void matrix_init(void)
|
||||
//debug_keyboard = true;
|
||||
//debug_mouse = true;
|
||||
print("debug enabled.\n");
|
||||
|
||||
// LED off
|
||||
DDRD |= (1<<6); PORTD &= ~(1<<6);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -100,10 +149,10 @@ void adb_mouse_task(void)
|
||||
{
|
||||
uint16_t codes;
|
||||
int16_t x, y;
|
||||
static int8_t mouseacc;
|
||||
static int8_t mouseacc;
|
||||
_delay_ms(12); // delay for preventing overload of poor ADB keyboard controller
|
||||
codes = adb_host_mouse_recv();
|
||||
// If nothing received reset mouse acceleration, and quit.
|
||||
// If nothing received reset mouse acceleration, and quit.
|
||||
if (!codes) {
|
||||
mouseacc = 1;
|
||||
return;
|
||||
@ -113,12 +162,12 @@ void adb_mouse_task(void)
|
||||
mouse_report.buttons |= MOUSE_BTN1;
|
||||
if (codes & (1 << 15))
|
||||
mouse_report.buttons &= ~MOUSE_BTN1;
|
||||
// lower seven bits are movement, as signed int_7.
|
||||
// low byte is X-axis, high byte is Y.
|
||||
// lower seven bits are movement, as signed int_7.
|
||||
// low byte is X-axis, high byte is Y.
|
||||
y = (codes>>8 & 0x3F);
|
||||
x = (codes>>0 & 0x3F);
|
||||
// bit seven and fifteen is negative
|
||||
// usb does not use int_8, but int_7 (measuring distance) with sign-bit.
|
||||
// usb does not use int_8, but int_7 (measuring distance) with sign-bit.
|
||||
if (codes & (1 << 6))
|
||||
x = (x-0x40);
|
||||
if (codes & (1 << 14))
|
||||
@ -126,7 +175,7 @@ void adb_mouse_task(void)
|
||||
// Accelerate mouse. (They weren't meant to be used on screens larger than 320x200).
|
||||
x *= mouseacc;
|
||||
y *= mouseacc;
|
||||
// Cap our two bytes per axis to one byte.
|
||||
// Cap our two bytes per axis to one byte.
|
||||
// Easier with a MIN-function, but since -MAX(-a,-b) = MIN(a,b)...
|
||||
// I.E. MIN(MAX(x,-127),127) = -MAX(-MAX(x, -127), -127) = MIN(-MIN(-x,127),127)
|
||||
mouse_report.x = -MAX(-MAX(x, -127), -127);
|
||||
@ -139,7 +188,7 @@ void adb_mouse_task(void)
|
||||
print_decs(mouse_report.x); print(" ");
|
||||
print_decs(mouse_report.y); print("]\n");
|
||||
}
|
||||
// Send result by usb.
|
||||
// Send result by usb.
|
||||
host_mouse_send(&mouse_report);
|
||||
// increase acceleration of mouse
|
||||
mouseacc += ( mouseacc < ADB_MOUSE_MAXACC ? 1 : 0 );
|
||||
@ -167,7 +216,50 @@ uint8_t matrix_scan(void)
|
||||
if ( codes == 0xFFFF )
|
||||
{
|
||||
_delay_ms(12); // delay for preventing overload of poor ADB keyboard controller
|
||||
codes = adb_host_kbd_recv();
|
||||
codes = adb_host_kbd_recv(ADB_ADDR_KEYBOARD);
|
||||
|
||||
// Adjustable keybaord media keys
|
||||
if (codes == 0 && has_media_keys &&
|
||||
(codes = adb_host_kbd_recv(ADB_ADDR_APPLIANCE))) {
|
||||
// key1
|
||||
switch (codes & 0x7f ) {
|
||||
case 0x00: // Mic
|
||||
codes = (codes & ~0x007f) | 0x42;
|
||||
break;
|
||||
case 0x01: // Mute
|
||||
codes = (codes & ~0x007f) | 0x4a;
|
||||
break;
|
||||
case 0x02: // Volume down
|
||||
codes = (codes & ~0x007f) | 0x49;
|
||||
break;
|
||||
case 0x03: // Volume Up
|
||||
codes = (codes & ~0x007f) | 0x48;
|
||||
break;
|
||||
case 0x7F: // no code
|
||||
break;
|
||||
default:
|
||||
xprintf("ERROR: media key1\n");
|
||||
return 0x11;
|
||||
}
|
||||
// key0
|
||||
switch ((codes >> 8) & 0x7f ) {
|
||||
case 0x00: // Mic
|
||||
codes = (codes & ~0x7f00) | (0x42 << 8);
|
||||
break;
|
||||
case 0x01: // Mute
|
||||
codes = (codes & ~0x7f00) | (0x4a << 8);
|
||||
break;
|
||||
case 0x02: // Volume down
|
||||
codes = (codes & ~0x7f00) | (0x49 << 8);
|
||||
break;
|
||||
case 0x03: // Volume Up
|
||||
codes = (codes & ~0x7f00) | (0x48 << 8);
|
||||
break;
|
||||
default:
|
||||
xprintf("ERROR: media key0\n");
|
||||
return 0x10;
|
||||
}
|
||||
}
|
||||
}
|
||||
key0 = codes>>8;
|
||||
key1 = codes&0xFF;
|
||||
@ -184,8 +276,50 @@ uint8_t matrix_scan(void)
|
||||
register_key(0xFF);
|
||||
} else if (key0 == 0xFF) { // error
|
||||
xprintf("adb_host_kbd_recv: ERROR(%d)\n", codes);
|
||||
// something wrong or plug-in
|
||||
matrix_init();
|
||||
return key1;
|
||||
} else {
|
||||
/* Swap codes for ISO keyboard
|
||||
* https://github.com/tmk/tmk_keyboard/issues/35
|
||||
*
|
||||
* ANSI
|
||||
* ,----------- ----------.
|
||||
* | *a| 1| 2 =|Backspa|
|
||||
* |----------- ----------|
|
||||
* |Tab | Q| | ]| *c|
|
||||
* |----------- ----------|
|
||||
* |CapsLo| A| '|Return |
|
||||
* |----------- ----------|
|
||||
* |Shift | Shift |
|
||||
* `----------- ----------'
|
||||
*
|
||||
* ISO
|
||||
* ,----------- ----------.
|
||||
* | *a| 1| 2 =|Backspa|
|
||||
* |----------- ----------|
|
||||
* |Tab | Q| | ]|Retur|
|
||||
* |----------- -----` |
|
||||
* |CapsLo| A| '| *c| |
|
||||
* |----------- ----------|
|
||||
* |Shif| *b| Shift |
|
||||
* `----------- ----------'
|
||||
*
|
||||
* ADB scan code USB usage
|
||||
* ------------- ---------
|
||||
* Key ANSI ISO ANSI ISO
|
||||
* ---------------------------------------------
|
||||
* *a 0x32 0x0A 0x35 0x35
|
||||
* *b ---- 0x32 ---- 0x64
|
||||
* *c 0x2A 0x2A 0x31 0x31(or 0x32)
|
||||
*/
|
||||
if (is_iso_layout) {
|
||||
if ((key0 & 0x7F) == 0x32) {
|
||||
key0 = (key0 & 0x80) | 0x0A;
|
||||
} else if ((key0 & 0x7F) == 0x0A) {
|
||||
key0 = (key0 & 0x80) | 0x32;
|
||||
}
|
||||
}
|
||||
register_key(key0);
|
||||
if (key1 != 0xFF) // key1 is 0xFF when no second key.
|
||||
extra_key = key1<<8 | 0xFF; // process in a separate call
|
||||
|
@ -23,8 +23,8 @@ CONFIG_H = config.h
|
||||
|
||||
|
||||
# MCU name
|
||||
#MCU = at90usb1287
|
||||
MCU = atmega32u4
|
||||
# TMK Converter rev.2
|
||||
MCU ?= atmega32u2
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
|
5
converter/ibm4704_usb/Makefile.tmk_rev1
Normal file
5
converter/ibm4704_usb/Makefile.tmk_rev1
Normal file
@ -0,0 +1,5 @@
|
||||
# TMK Converter rev.1
|
||||
# which looks like this:
|
||||
# https://github.com/tmk/keyboard_converter#pcb-rev1
|
||||
MCU = atmega32u4
|
||||
include Makefile
|
6
converter/ibm4704_usb/Makefile.tmk_rev2
Normal file
6
converter/ibm4704_usb/Makefile.tmk_rev2
Normal file
@ -0,0 +1,6 @@
|
||||
# TMK Converter rev.2
|
||||
# which looks like this:
|
||||
# https://github.com/tmk/keyboard_converter#pcb-rev2
|
||||
MCU = atmega32u2
|
||||
include Makefile
|
||||
|
@ -7,8 +7,9 @@ Keyboard initialization process takes a few seconds at start up. During that you
|
||||
|
||||
Update
|
||||
------
|
||||
2015/05/05 Added keymaps for 107-key, 77-key and 50-key. Thanks, orihalcon @ geekhack!
|
||||
2015/05/19 Fixed a protocol handling bug.
|
||||
- 2015/09/07 Added keymap for Alps 102-key. Thanks, tai @ geekhack!
|
||||
- 2015/05/05 Added keymaps for 107-key, 77-key and 50-key. Thanks, orihalcon @ geekhack!
|
||||
- 2015/05/19 Fixed a protocol handling bug.
|
||||
|
||||
|
||||
|
||||
@ -46,24 +47,39 @@ Keyboard Plug from front:
|
||||
|
||||
Connection
|
||||
----------
|
||||
In case of using ATMega32U4(Teensy2.0):
|
||||
In case of using ATMega32U4/U2
|
||||
|
||||
1. Supply power with VCC and GND.
|
||||
2. Connect CLOCK to PD1 and DATA to PD0. You can change pin with config.h.
|
||||
3. Optionally you may need pull-up register. 1KOhm probably work.
|
||||
|
||||
TMK Converter can supports IBM 4704.
|
||||
https://github.com/tmk/keyboard_converter
|
||||
|
||||
|
||||
Build Firmware
|
||||
--------------
|
||||
Just run `make`:
|
||||
|
||||
$ make
|
||||
$ make -f <makefile>
|
||||
|
||||
For TMK Converter rev.1 use `Makefile.tmk_rev1` as makefile:
|
||||
|
||||
$ make -f Makefile.tmk_rev1
|
||||
|
||||
For TMK Converter rev.2 use `Makefile.tmk_rev2` as makefile:
|
||||
|
||||
$ make -f Makefile.tmk_rev2
|
||||
|
||||
To select keymap:
|
||||
|
||||
$ make KEYMAP=[plain|...]
|
||||
$ make -f <makefile> KEYMAP=[plain|...]
|
||||
|
||||
To indentify your TMK Converter revision see [this](https://github.com/tmk/keyboard_converter#pcb-revisions).
|
||||
|
||||
|
||||
Keymap
|
||||
------
|
||||
Several 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.
|
||||
|
||||
Use `KEYMAP_ALPS102()` to define your keymap for Alps models.
|
||||
|
@ -152,12 +152,16 @@ Keyobard sends these bytes to host.
|
||||
FD Command out of bound 00d8h
|
||||
Key out of bound
|
||||
7E Read/Parity error in receive from host 00bch
|
||||
80-FB? scan code(make)
|
||||
00-7B? scan code(break)
|
||||
note: Alps model spits scan code 7B(FB) at least.
|
||||
|
||||
|
||||
Set Key Flag command(FC)
|
||||
------------------------
|
||||
After 'Power on Reset' firmware enters this command mode and waits for data from host,
|
||||
so that you don't need to send 'FC' and it doesn't send any scancode until you send 'FF'.
|
||||
With Alps models you need to send 'FC' command to enter this mode.
|
||||
|
||||
Data sent from host:
|
||||
|
||||
@ -166,8 +170,8 @@ Data sent from host:
|
||||
| `-----`--- scan code
|
||||
`------------- enable bit(0: enable repeat, 1: enable break)
|
||||
|
||||
00-79 Enable repeat
|
||||
80-F9 Enable break(FA-FF are used as other commands, see above.)
|
||||
00-7B? Enable repeat
|
||||
80-FB? Enable break
|
||||
FE Resend(011ah) no need to use
|
||||
FF End(0114h) exits FC command mode.
|
||||
|
||||
@ -178,5 +182,5 @@ Response from keyboard:
|
||||
Examples:
|
||||
To enable break code of all keys.
|
||||
|
||||
FC 80 81 ... F7 FF
|
||||
FC 80 81 ... FB FF
|
||||
|
||||
|
50
converter/ibm4704_usb/keymap_alps102key.c
Normal file
50
converter/ibm4704_usb/keymap_alps102key.c
Normal file
@ -0,0 +1,50 @@
|
||||
#include "keymap_common.h"
|
||||
|
||||
|
||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Layer 0:
|
||||
* ,---------------------------------------------------------------. ,-----------. ,---------------.
|
||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BS |BS |F21| |PSC|SLK|PAU| |F1 |F2 |F3 |F4 |
|
||||
* |---------------------------------------------------------------| |-----------| |---------------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|F22| |Ins|Hom|PgU| |F5 |F6 |F7 |F8 |
|
||||
* |---------------------------------------------------------------| |-----------| |---------------|
|
||||
* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Ret|Ret |F23| |Del|End|PgD| |F9 |F10|F11|F12|
|
||||
* |---------------------------------------------------------------| |-----------| |---------------|
|
||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shf|Shift |F24| | |Up | | |F13|F14|F15|F16|
|
||||
* |---------------------------------------------------------------| |-----------| |---------------|
|
||||
* |Fn0 |Gui|Alt | Space |Alt* |Gui|Fn0 | |Lef|Dow|Rig| |F17|F18|F19|F20|
|
||||
* `---------------------------------------------------------------' `-----------' `---------------'
|
||||
*/
|
||||
KEYMAP_ALPS102(
|
||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,BSPC,F21, PSCR,SLCK,PAUS, F1, F2, F3, F4, \
|
||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, F22, INS, HOME,PGUP, F5, F6, F7, F8, \
|
||||
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, F23, DEL, END, PGDN, F9, F10, F11, F12, \
|
||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,RSFT, F24, NO, UP, NO, F13, F14, F15, F16, \
|
||||
FN0, LGUI,LALT, SPC, RALT,RGUI, FN0, LEFT,DOWN,RGHT, F17, F18, F19, F20 \
|
||||
),
|
||||
|
||||
/* Layer 1:
|
||||
* ,---------------------------------------------------------------. ,-----------. ,---------------.
|
||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BS |BS |F21| |VoD|VoU|Mut| |F1 |F2 |F3 |F4 |
|
||||
* |---------------------------------------------------------------| |-----------| |---------------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|F22| |Ins|Hom|PgU| |F5 |F6 |F7 |F8 |
|
||||
* |---------------------------------------------------------------| |-----------| |---------------|
|
||||
* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Ret|Ret |F23| |Del|End|PgD| |F9 |F10|F11|F12|
|
||||
* |---------------------------------------------------------------| |-----------| |---------------|
|
||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shf|Shift |F24| | |PgU| | |F13|F14|F15|F16|
|
||||
* |---------------------------------------------------------------| |-----------| |---------------|
|
||||
* |Fn0 |Gui|Alt | Space |Alt* |Gui|Fn0 | |Hom|PgD|End| |F17|F18|F19|F20|
|
||||
* `----------------- |