mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-24 20:32:58 +00:00
Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware
This commit is contained in:
commit
dc9bf78f2b
9
.gitignore
vendored
9
.gitignore
vendored
@ -3,7 +3,11 @@ keyboard/planck/dfu-programmer.exe
|
|||||||
*.o
|
*.o
|
||||||
*.eep
|
*.eep
|
||||||
*.elf
|
*.elf
|
||||||
*.hex
|
/*.hex
|
||||||
|
/keyboard/**/*.hex
|
||||||
|
/keyboard/**/keymaps/**/*.hex
|
||||||
|
!/keyboard/**/keymaps/**/compiled.hex
|
||||||
|
*.log
|
||||||
*.lss
|
*.lss
|
||||||
*.lst
|
*.lst
|
||||||
*.map
|
*.map
|
||||||
@ -12,8 +16,11 @@ keyboard/planck/dfu-programmer.exe
|
|||||||
tags
|
tags
|
||||||
*~
|
*~
|
||||||
build/
|
build/
|
||||||
|
.build/
|
||||||
*.bak
|
*.bak
|
||||||
.vagrant/
|
.vagrant/
|
||||||
|
.idea/
|
||||||
|
CMakeLists.txt
|
||||||
.DS_STORE
|
.DS_STORE
|
||||||
|
|
||||||
# Eclipse/PyCharm/Other IDE Settings
|
# Eclipse/PyCharm/Other IDE Settings
|
||||||
|
37
.travis.yml
Normal file
37
.travis.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
os:
|
||||||
|
- linux
|
||||||
|
|
||||||
|
language:
|
||||||
|
- c
|
||||||
|
|
||||||
|
compiler:
|
||||||
|
- avr-gcc
|
||||||
|
|
||||||
|
env:
|
||||||
|
- KEYBOARD=alps64
|
||||||
|
- KEYBOARD=arrow_pad
|
||||||
|
- KEYBOARD=atomic
|
||||||
|
- KEYBOARD=atreus
|
||||||
|
- KEYBOARD=bantam44
|
||||||
|
- KEYBOARD=clueboard1
|
||||||
|
- KEYBOARD=clueboard2
|
||||||
|
- KEYBOARD=cluepad
|
||||||
|
- KEYBOARD=ergodox_ez
|
||||||
|
- KEYBOARD=gh60
|
||||||
|
- KEYBOARD=hhkb
|
||||||
|
- KEYBOARD=jd45
|
||||||
|
- KEYBOARD=kc60
|
||||||
|
- KEYBOARD=planck
|
||||||
|
- KEYBOARD=preonic
|
||||||
|
- KEYBOARD=retro_refit
|
||||||
|
- KEYBOARD=sixkeyboard
|
||||||
|
|
||||||
|
script:
|
||||||
|
- cd keyboard/$KEYBOARD && make all-keymaps
|
||||||
|
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- avr-libc
|
||||||
|
- gcc-avr
|
||||||
|
- dfu-programmer
|
@ -1,77 +0,0 @@
|
|||||||
@SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
|
|
||||||
@ECHO OFF
|
|
||||||
SET CMDLINERUNSTR=%SystemRoot%\system32\cmd.exe
|
|
||||||
|
|
||||||
SET NEWPATH1="C:\MinGW\msys\1.0\bin"
|
|
||||||
SET NEWPATH2="C:\MinGW\bin"
|
|
||||||
|
|
||||||
:: Make sure we're running with administrator privileges
|
|
||||||
NET SESSION >nul 2>&1
|
|
||||||
IF ERRORLEVEL 1 (
|
|
||||||
ECHO FAILED. Run this script with administrator privileges.
|
|
||||||
GOTO ExitBatch
|
|
||||||
)
|
|
||||||
|
|
||||||
:: Make sure the second path exists. The first path won't be created until the second script is run
|
|
||||||
IF NOT EXIST !NEWPATH2! (ECHO Path not found: %NEWPATH2% && GOTO ExitBatch)
|
|
||||||
|
|
||||||
:: Add paths
|
|
||||||
CALL :AddPath %NEWPATH1%
|
|
||||||
CALL :AddPath %NEWPATH2%
|
|
||||||
|
|
||||||
:: Branch to UpdateEnv if we need to update
|
|
||||||
IF DEFINED UPDATE (GOTO UpdateEnv)
|
|
||||||
|
|
||||||
GOTO ExitBatch
|
|
||||||
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
:UpdateEnv
|
|
||||||
ECHO Making updated PATH go live . . .
|
|
||||||
REG delete HKCU\Environment /F /V TEMPVAR > nul 2>&1
|
|
||||||
setx TEMPVAR 1 > nul 2>&1
|
|
||||||
REG delete HKCU\Environment /F /V TEMPVAR > nul 2>&1
|
|
||||||
IF NOT !cmdcmdline! == !CMDLINERUNSTR! (CALL :KillExplorer)
|
|
||||||
GOTO ExitBatch
|
|
||||||
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
:ExitBatch
|
|
||||||
ENDLOCAL
|
|
||||||
PAUSE
|
|
||||||
EXIT /b
|
|
||||||
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
:AddPath <pathToAdd>
|
|
||||||
ECHO %PATH% | FINDSTR /C:"%~1" > nul
|
|
||||||
IF ERRORLEVEL 1 (
|
|
||||||
REG add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v PATH /t REG_SZ /d "%PATH%;%~1" > nul 2>&1
|
|
||||||
IF ERRORLEVEL 0 (
|
|
||||||
ECHO Adding %1 . . . Success!
|
|
||||||
SET "PATH=%PATH%;%~1"
|
|
||||||
SET UPDATE=1
|
|
||||||
) ELSE (
|
|
||||||
ECHO Adding %1 . . . FAILED. Run this script with administrator privileges.
|
|
||||||
)
|
|
||||||
) ELSE (
|
|
||||||
ECHO Skipping %1 - Already in PATH
|
|
||||||
)
|
|
||||||
EXIT /b
|
|
||||||
|
|
||||||
:: -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
:KillExplorer
|
|
||||||
|
|
||||||
ECHO Your desktop is being restarted, please wait. . .
|
|
||||||
ping -n 5 127.0.0.1 > NUL 2>&1
|
|
||||||
ECHO Killing process Explorer.exe. . .
|
|
||||||
taskkill /f /im explorer.exe
|
|
||||||
ECHO.
|
|
||||||
ECHO Your desktop is now loading. . .
|
|
||||||
ping -n 5 127.0.0.1 > NUL 2>&1
|
|
||||||
ECHO.
|
|
||||||
ping -n 5 127.0.0.1 > NUL 2>&1
|
|
||||||
START explorer.exe
|
|
||||||
START explorer.exe %CD%
|
|
||||||
EXIT /b
|
|
@ -1,60 +0,0 @@
|
|||||||
# Build Guide
|
|
||||||
|
|
||||||
## Build Environment Setup
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
1. If you have ever installed WinAVR, uninstall it.
|
|
||||||
2. Install [MHV AVR Tools](https://infernoembedded.com/sites/default/files/project/MHV_AVR_Tools_20131101.exe). Disable smatch, but **be sure to leave the option to add the tools to the PATH checked**.
|
|
||||||
3. Install [MinGW](https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download). During installation, uncheck the option to install a graphical user interface. **DO NOT change the default installation folder.** The scripts depend on the default location.
|
|
||||||
4. Clone this repository. [This link will download it as a zip file, which you'll need to extract.](https://github.com/jackhumbert/qmk_firmware/archive/master.zip) Open the extracted folder in Windows Explorer.
|
|
||||||
5. Right-click on the 1-setup-path-win batch script, select "Run as administrator", and accept the User Account Control prompt. Press the spacebar to dismiss the success message in the command prompt that pops up.
|
|
||||||
6. Right-click on the 2-setup-environment-win batch script, select "Run as administrator", and accept the User Account Control prompt. This part may take a couple of minutes, and you'll need to approve a driver installation, but once it finishes, your environment is complete!
|
|
||||||
7. Future build commands should be run from the standard Windows command prompt, which you can find by searching for "command prompt" from the start menu or start screen. Ignore the "MHV AVR Shell".
|
|
||||||
|
|
||||||
### Mac
|
|
||||||
If you're using [homebrew,](http://brew.sh/) you can use the following commands:
|
|
||||||
|
|
||||||
brew tap osx-cross/avr
|
|
||||||
brew install avr-libc
|
|
||||||
brew install dfu-programmer
|
|
||||||
|
|
||||||
This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line.
|
|
||||||
|
|
||||||
You can also try these instructions:
|
|
||||||
|
|
||||||
1. Install Xcode from the App Store.
|
|
||||||
2. Install the Command Line Tools from `Xcode->Preferences->Downloads`.
|
|
||||||
3. Install [DFU-Programmer][dfu-prog].
|
|
||||||
|
|
||||||
### Linux
|
|
||||||
Install AVR GCC, AVR libc, and dfu-progammer with your favorite package manager.
|
|
||||||
|
|
||||||
Debian/Ubuntu example:
|
|
||||||
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install gcc-avr avr-libc dfu-programmer
|
|
||||||
|
|
||||||
### Vagrant
|
|
||||||
If you have any problems building the firmware, you can try using a tool called Vagrant. It will set up a virtual computer with a known configuration that's ready-to-go for firmware building. OLKB does NOT host the files for this virtual computer. Details on how to set up Vagrant are in the [VAGRANT_GUIDE file](VAGRANT_GUIDE.md).
|
|
||||||
|
|
||||||
## Verify Your Installation
|
|
||||||
1. If you haven't already, obtain this repository ([https://github.com/jackhumbert/qmk_firmware](https://github.com/jackhumbert/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application.
|
|
||||||
2. Open up a terminal or command prompt and navigate to the qmk_firmware folder using the `cd` command. The command prompt will typically open to your home directory. If, for example, you cloned the repository to your Documents folder, then you would type `cd Documents/qmk_firmware`. If you extracted the file from a zip, then it may be named `qmk_firmware-master` instead.
|
|
||||||
3. To confirm that you're in the correct location, you can display the contents of your current folder using the `dir` command on Windows, or the `ls` command on Linux or Mac. You should see several files, including `README.md` and a `quantum` folder. From here, you need to navigate to the appropriate folder under `keyboard/`. For example, if you're building for a Planck, run `cd keyboard/planck`.
|
|
||||||
4. Once you're in the correct keyboard-specific folder, run the `make` command. This should output a lot of information about the build process.
|
|
||||||
|
|
||||||
## Customizing, Building, and Deploying Your Firmware
|
|
||||||
|
|
||||||
Note: Some keyboard folders have non-standard organizations, and may not even support specifying alternate keymaps. Until these get reorganized, you will need to edit their default keymaps directly.
|
|
||||||
|
|
||||||
1. Running the `make` command from your keyboard's folder will generate a .hex file based on the default keymap. All keymaps for a particular keyboard live in the `keymaps` folder in that keyboard's folder. To create your own keymap, duplicate the folder `keymaps/default`, and rename it with your name, for example `jack`. Or, if you don't care about the ability to share your keymap with the community via GitHub, you can just modify the default keymap itself. Details on how to program keymap files can be found in other guides.
|
|
||||||
2. To build a keymap other than the default, type `KEYMAP=<name>` after `make`. So if I've named my keymap `jack`, the full command would be `make KEYMAP=jack`.
|
|
||||||
3. How you deploy the firmware will depend on whether you are using a PCB or a Teensy. In both cases, you'll need to put the keyboard in bootloader mode, either by pressing a button on the PCB/Teensy or pressing the key with the `RESET` keycode. Then, if you're using a PCB, just run `make KEYMAP=<name> dfu` to both build and deploy the firmware. If you're using a Teensy, you'll probably need to take the <keyboardname>.hex file that make produces in the keyboard's folder, and deploy it using the [Teensy Loader.](https://www.pjrc.com/teensy/loader.html)
|
|
||||||
|
|
||||||
## Helpful Tips
|
|
||||||
1. On Linux or OS X, you can run `sleep 5; make KEYMAP=<name> dfu` to delay building/deploying the firmware until for 5 seconds, giving you a chance to put the firmware into bootloader mode. You can change the 5 to any number of seconds.
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
1. Try running `make clean` if the make command fails.
|
|
||||||
|
|
||||||
WIP
|
|
115
Makefile
Normal file
115
Makefile
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
ifndef VERBOSE
|
||||||
|
.SILENT:
|
||||||
|
endif
|
||||||
|
|
||||||
|
starting_makefile := $(abspath $(firstword $(MAKEFILE_LIST)))
|
||||||
|
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
abs_tmk_root := $(patsubst %/,%,$(dir $(mkfile_path)))
|
||||||
|
|
||||||
|
ifneq (,$(findstring /keyboard/,$(starting_makefile)))
|
||||||
|
possible_keyboard:=$(patsubst %/,%,$(dir $(patsubst $(abs_tmk_root)/keyboard/%,%,$(starting_makefile))))
|
||||||
|
ifneq (,$(findstring /keymaps/,$(possible_keyboard)))
|
||||||
|
KEYBOARD_DIR:=$(firstword $(subst /keymaps/, ,$(possible_keyboard)))
|
||||||
|
KEYMAP_DIR:=$(lastword $(subst /keymaps/, ,$(possible_keyboard)))
|
||||||
|
tmk_root = ../../../..
|
||||||
|
else
|
||||||
|
KEYBOARD_DIR:=$(possible_keyboard)
|
||||||
|
KEYMAP_DIR:=default
|
||||||
|
tmk_root = ../..
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
tmk_root = .
|
||||||
|
endif
|
||||||
|
# $(info $(KEYBOARD_DIR))
|
||||||
|
# $(info $(KEYMAP_DIR))
|
||||||
|
|
||||||
|
# Directory common source filess exist
|
||||||
|
TOP_DIR = $(tmk_root)
|
||||||
|
TMK_DIR = tmk_core
|
||||||
|
TMK_PATH = $(TOP_DIR)/$(TMK_DIR)
|
||||||
|
|
||||||
|
QUANTUM_DIR = quantum
|
||||||
|
QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
|
||||||
|
|
||||||
|
ifdef keyboard
|
||||||
|
KEYBOARD ?= $(keyboard)
|
||||||
|
endif
|
||||||
|
ifdef KEYBOARD_DIR
|
||||||
|
KEYBOARD ?= $(KEYBOARD_DIR)
|
||||||
|
endif
|
||||||
|
ifndef KEYBOARD
|
||||||
|
KEYBOARD=planck
|
||||||
|
endif
|
||||||
|
KEYBOARD_PATH = $(TOP_DIR)/keyboard/$(KEYBOARD)
|
||||||
|
ifneq ("$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)","")
|
||||||
|
KEYBOARD_FILE = keyboard/$(KEYBOARD)/$(KEYBOARD).c
|
||||||
|
ifndef ARCH
|
||||||
|
include $(KEYBOARD_PATH)/Makefile
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
$(error "$(KEYBOARD_PATH)/$(KEYBOARD).c" does not exist)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef keymap
|
||||||
|
KEYMAP ?= $(keymap)
|
||||||
|
endif
|
||||||
|
ifdef KEYMAP_DIR
|
||||||
|
KEYMAP ?= $(KEYMAP_DIR)
|
||||||
|
endif
|
||||||
|
ifndef KEYMAP
|
||||||
|
KEYMAP = default
|
||||||
|
endif
|
||||||
|
KEYMAP_PATH = $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
|
||||||
|
ifneq ("$(wildcard $(KEYMAP_PATH)/keymap.c)","")
|
||||||
|
KEYMAP_FILE = keyboard/$(KEYBOARD)/keymaps/$(KEYMAP)/keymap.c
|
||||||
|
-include $(KEYMAP_PATH)/Makefile
|
||||||
|
else
|
||||||
|
$(error "$(KEYMAP_PATH)/keymap.c" does not exist)
|
||||||
|
endif
|
||||||
|
|
||||||
|
TARGET = $(KEYBOARD)_$(KEYMAP)
|
||||||
|
|
||||||
|
ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
|
||||||
|
CONFIG_H = $(KEYMAP_PATH)/config.h
|
||||||
|
else
|
||||||
|
CONFIG_H = $(KEYBOARD_PATH)/config.h
|
||||||
|
endif
|
||||||
|
|
||||||
|
# # project specific files
|
||||||
|
SRC += $(KEYBOARD_FILE) \
|
||||||
|
$(KEYMAP_FILE) \
|
||||||
|
$(QUANTUM_DIR)/quantum.c \
|
||||||
|
$(QUANTUM_DIR)/keymap_common.c \
|
||||||
|
$(QUANTUM_DIR)/led.c
|
||||||
|
|
||||||
|
ifndef CUSTOM_MATRIX
|
||||||
|
SRC += $(QUANTUM_DIR)/matrix.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(AUDIO_ENABLE)), yes)
|
||||||
|
SRC += $(QUANTUM_DIR)/audio/audio.c
|
||||||
|
SRC += $(QUANTUM_DIR)/audio/voices.c
|
||||||
|
SRC += $(QUANTUM_DIR)/audio/luts.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
||||||
|
SRC += $(QUANTUM_DIR)/light_ws2812.c
|
||||||
|
SRC += $(QUANTUM_DIR)/rgblight.c
|
||||||
|
OPT_DEFS += -DRGBLIGHT_ENABLE
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Optimize size but this may cause error "relocation truncated to fit"
|
||||||
|
#EXTRALDFLAGS = -Wl,--relax
|
||||||
|
|
||||||
|
# Search Path
|
||||||
|
VPATH += $(KEYMAP_PATH)
|
||||||
|
VPATH += $(KEYBOARD_PATH)
|
||||||
|
VPATH += $(TOP_DIR)
|
||||||
|
VPATH += $(TMK_PATH)
|
||||||
|
VPATH += $(QUANTUM_PATH)
|
||||||
|
VPATH += $(QUANTUM_PATH)/keymap_extras
|
||||||
|
VPATH += $(QUANTUM_PATH)/audio
|
||||||
|
|
||||||
|
include $(TMK_PATH)/protocol/lufa.mk
|
||||||
|
include $(TMK_PATH)/common.mk
|
||||||
|
include $(TMK_PATH)/rules.mk
|
21
README.md
21
README.md
@ -1,3 +1,4 @@
|
|||||||
|
[![Build Status](https://travis-ci.org/jackhumbert/qmk_firmware.svg?branch=master)](https://travis-ci.org/jackhumbert/qmk_firmware)
|
||||||
# Quantum Mechanical Keyboard Firmware
|
# Quantum Mechanical Keyboard Firmware
|
||||||
|
|
||||||
This is a keyboard firmware based on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.co), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/).
|
This is a keyboard firmware based on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.co), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/).
|
||||||
@ -8,15 +9,23 @@ This documentation is edited and maintained by Erez Zukerman of ErgoDox EZ. If y
|
|||||||
|
|
||||||
The OLKB product firmwares are maintained by Jack, the Ergodox EZ by Erez, and the Clueboard by [Zach White](https://github.com/skullydazed).
|
The OLKB product firmwares are maintained by Jack, the Ergodox EZ by Erez, and the Clueboard by [Zach White](https://github.com/skullydazed).
|
||||||
|
|
||||||
## Important background info: TMK documentation
|
## Documentation roadmap
|
||||||
|
|
||||||
The documentation below explains QMK customizations and elaborates on some of the more useful features of TMK. To understand the base firmware, and especially what *layers* are and how they work, please see [TMK_README.md](/TMK_README.md).
|
This 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:
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
* 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.
|
||||||
|
* The list of possible keycodes you can use in your keymap is actually spread out in a few different places:
|
||||||
|
* [tmk_core/common/keycode.h](tmk_core/common/keycode.h) - the base TMK keycodes. This is the actual source file.
|
||||||
|
* [doc/keycode.txt](doc/keycode.txt) - an explanation of those same keycodes.
|
||||||
|
* [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.
|
||||||
|
* The [TMK documentation](doc/TMK_README.md). QMK is based on TMK, and this explains how it works internally.
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
* [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/`.
|
* [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/`.
|
||||||
* 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.
|
* 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.
|
||||||
* 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.
|
* 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.
|
||||||
|
|
||||||
### Makefile Options
|
### Makefile Options
|
||||||
|
|
||||||
@ -167,7 +176,7 @@ void matrix_scan_user(void) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_.EYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.
|
As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_KEYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.
|
||||||
|
|
||||||
### Temporarily setting the default layer
|
### Temporarily setting the default layer
|
||||||
|
|
||||||
@ -196,7 +205,7 @@ rounded up (5 bits per key). For example on Planck (48 keys) it uses
|
|||||||
|
|
||||||
### Remember: These are just aliases
|
### Remember: These are just aliases
|
||||||
|
|
||||||
These 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).
|
These 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).
|
||||||
|
|
||||||
Instead 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.
|
Instead 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.
|
||||||
|
|
||||||
|
186
Vagrantfile
vendored
186
Vagrantfile
vendored
@ -1,88 +1,98 @@
|
|||||||
# -*- mode: ruby -*-
|
# -*- mode: ruby -*-
|
||||||
# vi: set ft=ruby :
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
Vagrant.configure(2) do |config|
|
Vagrant.configure(2) do |config|
|
||||||
# You can only have one config.vm.box uncommented at a time
|
# You can only have one config.vm.box uncommented at a time
|
||||||
|
|
||||||
# Comment this and uncomment another if you don't want to use the minimal Arch box
|
# Comment this and uncomment another if you don't want to use the minimal Arch box
|
||||||
config.vm.box = "dragon788/arch-ala-elasticdog"
|
config.vm.box = "dragon788/arch-ala-elasticdog"
|
||||||
|
|
||||||
# VMware/Virtualbox 64 bit
|
# VMware/Virtualbox 64 bit
|
||||||
# config.vm.box = "phusion/ubuntu-14.04-amd64"
|
# config.vm.box = "phusion/ubuntu-14.04-amd64"
|
||||||
#
|
#
|
||||||
# VMware/Virtualbox 64 bit
|
# VMware/Virtualbox 64 bit
|
||||||
#config.vm.box = "puphpet/centos65-x64"
|
#config.vm.box = "puphpet/centos65-x64"
|
||||||
#
|
#
|
||||||
# The opensuse boxes don't have dfu-util in their default repositories
|
# The opensuse boxes don't have dfu-util in their default repositories
|
||||||
#
|
#
|
||||||
# The virtualbox version has tools issues
|
# The virtualbox version has tools issues
|
||||||
# VMware/Virtualbox 64 bit
|
# VMware/Virtualbox 64 bit
|
||||||
#config.vm.box = "bento/opensuse-13.2-x86_64"
|
#config.vm.box = "bento/opensuse-13.2-x86_64"
|
||||||
#
|
#
|
||||||
# Virtualbox only
|
# Virtualbox only
|
||||||
#config.vm.box = "bento/opensuse-13.2-i386"
|
#config.vm.box = "bento/opensuse-13.2-i386"
|
||||||
# config.vm.box = ""
|
# config.vm.box = ""
|
||||||
# config.vm.box = ""
|
# config.vm.box = ""
|
||||||
|
|
||||||
# This section allows you to customize the Virtualbox VM
|
# This section allows you to customize the Virtualbox VM
|
||||||
# settings, ie showing the GUI or upping the memory
|
# settings, ie showing the GUI or upping the memory
|
||||||
# or cores if desired
|
# or cores if desired
|
||||||
config.vm.provider "virtualbox" do |vb|
|
config.vm.provider "virtualbox" do |vb|
|
||||||
# Hide the VirtualBox GUI when booting the machine
|
# Hide the VirtualBox GUI when booting the machine
|
||||||
vb.gui = false
|
vb.gui = false
|
||||||
# Uncomment the below lines if you want to program
|
# Uncomment the below lines if you want to program
|
||||||
# your Teensy via the VM rather than your host OS
|
# your Teensy via the VM rather than your host OS
|
||||||
#vb.customize ['modifyvm', :id, '--usb', 'on']
|
#vb.customize ['modifyvm', :id, '--usb', 'on']
|
||||||
#vb.customize ['usbfilter', 'add', '0',
|
#vb.customize ['usbfilter', 'add', '0',
|
||||||
# '--target', :id,
|
# '--target', :id,
|
||||||
# '--name', 'teensy',
|
# '--name', 'teensy',
|
||||||
# '--vendorid', '0x16c0',
|
# '--vendorid', '0x16c0',
|
||||||
# '--productid','0x0478'
|
# '--productid','0x0478'
|
||||||
# ]
|
# ]
|
||||||
# Customize the amount of memory on the VM:
|
# Customize the amount of memory on the VM:
|
||||||
vb.memory = "512"
|
vb.memory = "512"
|
||||||
end
|
end
|
||||||
|
|
||||||
# This section allows you to customize the VMware VM
|
# This section allows you to customize the VMware VM
|
||||||
# settings, ie showing the GUI or upping the memory
|
# settings, ie showing the GUI or upping the memory
|
||||||
# or cores if desired
|
# or cores if desired
|
||||||
config.vm.provider "vmware_workstation" do |vmw|
|
config.vm.provider "vmware_workstation" do |vmw|
|
||||||
# Hide the VMware GUI when booting the machine
|
# Hide the VMware GUI when booting the machine
|
||||||
vmw.gui = false
|
vmw.gui = false
|
||||||
|
|
||||||
# Customize the amount of memory on the VM:
|
# Customize the amount of memory on the VM:
|
||||||
vmw.memory = "512"
|
vmw.memory = "512"
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.provider "vmware_fusion" do |vmf|
|
config.vm.provider "vmware_fusion" do |vmf|
|
||||||
# Hide the vmfare GUI when booting the machine
|
# Hide the vmfare GUI when booting the machine
|
||||||
vmf.gui = false
|
vmf.gui = false
|
||||||
|
|
||||||
# Customize the amount of memory on the VM:
|
# Customize the amount of memory on the VM:
|
||||||
vmf.memory = "512"
|
vmf.memory = "512"
|
||||||
end
|
end
|
||||||
|
|
||||||
# This script ensures the required packages for AVR programming are installed
|
# Docker provider pulls from hub.docker.com respecting docker.image if
|
||||||
# It also ensures the system always gets the latest updates when powered on
|
# config.vm.box is nil. Note that this bind-mounts from the current dir to
|
||||||
# If this causes issues you can run a 'vagrant destroy' and then
|
# /vagrant in the guest, so unless your UID is 1000 to match vagrant in the
|
||||||
# add a # before ,args: and run 'vagrant up' to get a working
|
# image, you'll need to: chmod -R a+rw .
|
||||||
# non-updated box and then attempt to troubleshoot or open a Github issue
|
config.vm.provider "docker" do |docker, override|
|
||||||
|
override.vm.box = nil
|
||||||
config.vm.provision "shell", run: "always", path: "avr_setup.sh", args: "-update"
|
docker.image = "jesselang/debian-vagrant:jessie"
|
||||||
|
docker.has_ssh = true
|
||||||
config.vm.post_up_message = """
|
end
|
||||||
Log into the VM using 'vagrant ssh' on OSX or from Git Bash (Win)
|
|
||||||
or 'vagrant ssh-config' and Putty or Bitvise SSH or another SSH tool
|
# This script ensures the required packages for AVR programming are installed
|
||||||
|
# It also ensures the system always gets the latest updates when powered on
|
||||||
Change directory (cd) to the keyboard you wish to program
|
# If this causes issues you can run a 'vagrant destroy' and then
|
||||||
(Optionally) modify your layout,
|
# add a # before ,args: and run 'vagrant up' to get a working
|
||||||
then run 'make clean'
|
# non-updated box and then attempt to troubleshoot or open a Github issue
|
||||||
and then 'make' to compile the .eep and .hex files.
|
|
||||||
|
config.vm.provision "shell", run: "always", path: "./util/avr_setup.sh", args: "-update"
|
||||||
Or you can copy and paste the example line below.
|
|
||||||
|
config.vm.post_up_message = <<-EOT
|
||||||
cd /vagrant; cd keyboard; cd ergodox_ez; make clean; make
|
Log into the VM using 'vagrant ssh' on OSX or from Git Bash (Win)
|
||||||
|
or 'vagrant ssh-config' and Putty or Bitvise SSH or another SSH tool
|
||||||
|
|
||||||
"""
|
Change directory (cd) to the keyboard you wish to program
|
||||||
end
|
(Optionally) modify your layout,
|
||||||
|
then run 'make clean'
|
||||||
|
and then 'make' to compile the .eep and .hex files.
|
||||||
|
|
||||||
|
Or you can copy and paste the example line below.
|
||||||
|
|
||||||
|
cd /vagrant; cd keyboard; cd ergodox_ez; make clean; make
|
||||||
|
|
||||||
|
|
||||||
|
EOT
|
||||||
|
end
|
||||||
|
@ -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
|
|
@ -1,103 +0,0 @@
|
|||||||
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.
|
|
||||||
|
|
||||||
Discuss: http://geekhack.org/showwiki.php?title=Island:14290
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
README FIRST
|
|
||||||
------------
|
|
||||||
https://github.com/tmk/tmk_keyboard
|
|
||||||
https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb
|
|
||||||
|
|
||||||
Also check these when you are in trouble.
|
|
||||||
|
|
||||||
https://github.com/tmk/tmk_keyboard/wiki
|
|
||||||
https://github.com/tmk/tmk_keyboard/labels/NOTE
|
|
||||||
|
|
||||||
|
|
||||||
Wiring
|
|
||||||
------
|
|
||||||
Connect ADB pins to controller just by 3 lines(Vcc, GND, Data). By default Data line uses port PD0.
|
|
||||||
|
|
||||||
ADB female socket from the front:
|
|
||||||
|
|
||||||
,--_--.
|
|
||||||
/ o4 3o \ 1: DATA
|
|
||||||
| o2 1o | 2: Power SW
|
|
||||||
- === - 3: VCC
|
|
||||||
`-___-' 4: GND
|
|
||||||
|
|
||||||
This 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!)
|
|
||||||
https://github.com/tmk/tmk_keyboard/wiki/FAQ#pull-up-resistor
|
|
||||||
|
|
||||||
Pull-up resister:
|
|
||||||
|
|
||||||
Keyboard Conveter
|
|
||||||
,------.
|
|
||||||
5V------+------|VCC |
|
|
||||||
| | |
|
|
||||||
[R] | |
|
|
||||||
| | |
|
|
||||||
Signal--+------|PD0 |
|
|
||||||
| |
|
|
||||||
GND------------|GND |
|
|
||||||
`------'
|
|
||||||
R: 1K Ohm resistor
|
|
||||||
|
|
||||||
|
|
||||||
Define following macros for ADB connection in config.h if you use other than port PD0.
|
|
||||||
|
|
||||||
ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT
|
|
||||||
|
|
||||||
|
|
||||||
Build
|
|
||||||
-----
|
|
||||||
See doc/build.md. In short,
|
|
||||||
|
|
||||||
$ make clean
|
|
||||||
$ make
|
|
||||||
|
|
||||||
You can select keymap(ansi is default) like this:
|
|
||||||
|
|
||||||
$ 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.
|
|
||||||
|
|
||||||
|
|
||||||
Magic command
|
|
||||||
-------------
|
|
||||||
To get help press `h` holding Magic key. Magic key is `Power key`.
|
|
||||||
|
|
||||||
|
|
||||||
Locking CapsLock
|
|
||||||
----------------
|
|
||||||
Many 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.
|
|
||||||
https://github.com/tmk/tmk_keyboard/blob/master/README.md#mechanical-locking-support
|
|
||||||
|
|
||||||
Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch.
|
|
||||||
|
|
||||||
|
|
||||||
Notes
|
|
||||||
-----
|
|
||||||
Not-extended ADB keyboards have no discrimination between right modifier and left one,
|
|
||||||
you will always see left control even if you press right control key.
|
|
||||||
Apple Extended Keyboard and Apple Extended Keyboard II can discriminate both side
|
|
||||||
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.
|
|
||||||
|
|
||||||
https://github.com/tmk/tmk_keyboard/issues/35
|
|
||||||
|
|
||||||
EOF
|
|
@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x0ADB
|
|
||||||
#define DEVICE_VER 0x0101
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT ADB keyboard converter
|
|
||||||
#define DESCRIPTION convert ADB keyboard to USB
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 16 // keycode bit: 3-0
|
|
||||||
#define MATRIX_COLS 8 // keycode bit: 6-4
|
|
||||||
|
|
||||||
#define MATRIX_ROW(code) ((code)>>3&0x0F)
|
|
||||||
#define MATRIX_COL(code) ((code)&0x07)
|
|
||||||
|
|
||||||
|
|
||||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
|
||||||
#define LOCKING_SUPPORT_ENABLE
|
|
||||||
/* Locking resynchronize hack */
|
|
||||||
#define LOCKING_RESYNC_ENABLE
|
|
||||||
|
|
||||||
|
|
||||||
/* legacy keymap support */
|
|
||||||
#define USE_LEGACY_KEYMAP
|
|
||||||
|
|
||||||
|
|
||||||
/* ADB port setting */
|
|
||||||
#define ADB_PORT PORTD
|
|
||||||
#define ADB_PIN PIND
|
|
||||||
#define ADB_DDR DDRD
|
|
||||||
#define ADB_DATA_BIT 0
|
|
||||||
//#define ADB_PSW_BIT 1 // optional
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#ifndef __ASSEMBLER__
|
|
||||||
#include "adb.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
matrix_is_on(MATRIX_ROW(ADB_POWER), MATRIX_COL(ADB_POWER)) \
|
|
||||||
)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,16 +0,0 @@
|
|||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
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,
|
|
||||||
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,
|
|
||||||
LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
};
|
|
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translates Fn keycode to action */
|
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
|
||||||
{
|
|
||||||
return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
|
|
||||||
}
|
|
@ -1,212 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef KEYMAP_COMMON_H
|
|
||||||
#define KEYMAP_COMMON_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "action_macro.h"
|
|
||||||
#include "report.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
|
||||||
extern const uint16_t fn_actions[];
|
|
||||||
|
|
||||||
|
|
||||||
/* M0115 Apple Extended Keyboard ANSI
|
|
||||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
|
|
||||||
* |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| +|
|
|
||||||
* |-----------------------------------------------------------| ,---. |---------------|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
|
|
||||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
|
||||||
* |Ctrl |Opt |Cmd | Space | |Opt |Ctrl | |Lef|Dow|Rig| | 0| .| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
#define KEYMAP_EXT_ANSI( \
|
|
||||||
K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \
|
|
||||||
K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \
|
|
||||||
K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79, K59,K5B,K5C,K4E, \
|
|
||||||
K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K45, \
|
|
||||||
K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K3E, K53,K54,K55, \
|
|
||||||
K36,K3A,K37, K31, K7C,K7D, K3B,K3D,K3C, K52, K41,K4C \
|
|
||||||
) { \
|
|
||||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
|
|
||||||
{ KC_##K08, KC_##K09, KC_NUBS, 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_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, 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_INT3, KC_INT1, KC_PCMM }, \
|
|
||||||
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \
|
|
||||||
{ KC_LANG1, 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 ISO
|
|
||||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
|
|
||||||
* |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| [| ]|Retur| |Del|End|PgD| | 7| 8| 9| -|
|
|
||||||
* |------------------------------------------------------` | `-----------' |---------------|
|
|
||||||
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| '| #| | | 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| .| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
#define KEYMAP_EXT_ISO( \
|
|
||||||
K35, K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71, K7F, \
|
|
||||||
K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74, K47,K51,K4B,K43, \
|
|
||||||
K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K24, K75,K77,K79, K59,K5B,K5C,K4E, \
|
|
||||||
K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A, 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, 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_NO, KC_##K43, KC_F18, KC_##K45, KC_NO, KC_##K47 }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, 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_INT3, KC_INT1, KC_PCMM }, \
|
|
||||||
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_LANG2, KC_##K67 }, \
|
|
||||||
{ KC_LANG1, 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 } \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 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 | . | |
|
|
||||||
* +---------------------------------------------------------+ +-------+---+---+
|
|
||||||
*/
|
|
||||||
#define KEYMAP_M0116_ANSI( \
|
|
||||||
K7F, \
|
|
||||||
K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \
|
|
||||||
K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K45, \
|
|
||||||
K36,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K4E, \
|
|
||||||
K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K7B, K53,K54,K55, \
|
|
||||||
K39,K3A,K37,K32, K31, K2A,K3B,K3C,K3D,K3E, K52, K41,K4C \
|
|
||||||
) { \
|
|
||||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
|
|
||||||
{ KC_##K08, KC_##K09, KC_NO, 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_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
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
ADB ANSI/ISO Keymapping Note
|
|
||||||
============================
|
|
||||||
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 Keyboard scan code:
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
TMK ADB-USB mapping:
|
|
||||||
ADB USB(ANSI) USB(ISO)
|
|
||||||
---------------------------------
|
|
||||||
0x32 0x35 0x64
|
|
||||||
0x0A ---- 0x35
|
|
||||||
0x2A 0x31 0x31(or 0x32)
|
|
||||||
|
|
||||||
Note that mappings of ADB code 0x32 are diffrent between ANSI and ISO keyboard.
|
|
||||||
https://github.com/tmk/tmk_keyboard/issues/35
|
|
||||||
*/
|
|
@ -1,58 +0,0 @@
|
|||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* Default Layer: plain keymap
|
|
||||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
|
|
||||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | |
|
|
||||||
* `---' `---------------' `---------------' `---------------' `-----------' `---'
|
|
||||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
|
||||||
* | `| 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| [| ]| Fn0| |Del|End|PgD| | 7| 8| 9| -|
|
|
||||||
* |-----------------------------------------------------------| `-----------' |---------------|
|
|
||||||
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +|
|
|
||||||
* |-----------------------------------------------------------| ,---. |---------------|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
|
|
||||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
|
||||||
* |Ctrl |Gui |Alt | Space |Alt |Gui |Ctrl | |Lef|Dow|Rig| | 0| .| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
KEYMAP_EXT_ANSI(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO,
|
|
||||||
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,FN0, 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,
|
|
||||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
|
||||||
),
|
|
||||||
|
|
||||||
/* Default Layer: plain keymap
|
|
||||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---.
|
|
||||||
* |` | |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | |
|
|
||||||
* `---' `---------------' `---------------' `---------------' `-----------' `---'
|
|
||||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
|
||||||
* |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Delete | |Ins|Hom|PgU| |NmL|Mb1|Mb2|Mb3|
|
|
||||||
* |-----------------------------------------------------------| |-----------| |---------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U|PrS|ScL|Pau|Up |Ins| Fn0| |Del|End|PgD| |MwD|McU|MwU|MwD|
|
|
||||||
* |-----------------------------------------------------------| `-----------' |---------------|
|
|
||||||
* |CapsLo|VoD|VoU|Mut| F| G| H| J|Hom|PgU|Lef|Rig|Return | |McL|McD|McR|MwU|
|
|
||||||
* |-----------------------------------------------------------| ,---. |---------------|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M|End|PgD|Dow|Shift | |PgU| |MwL|McD|MwR| |
|
|
||||||
* |-----------------------------------------------------------| ,-----------. |-----------|Mb3|
|
|
||||||
* |Ctrl |Gui |Alt | Space |Alt |Gui |Ctrl | |Hom|PgD|End| | Mb1|Mb2| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
KEYMAP_EXT_ANSI(
|
|
||||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO,
|
|
||||||
ESC, 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, FN0, 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,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R,
|
|
||||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_BSLS),
|
|
||||||
};
|
|
@ -1,16 +0,0 @@
|
|||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
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,
|
|
||||||
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,
|
|
||||||
LCTL,LALT,LGUI, SPC, RALT,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
};
|
|
@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
#include "adb.h"
|
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
|
||||||
{
|
|
||||||
adb_host_kbd_led(~usb_led);
|
|
||||||
}
|
|
@ -1,296 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* scan matrix
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
#include "print.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "adb.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
#include "report.h"
|
|
||||||
#include "host.h"
|
|
||||||
|
|
||||||
|
|
||||||
#if (MATRIX_COLS > 16)
|
|
||||||
# error "MATRIX_COLS must not exceed 16"
|
|
||||||
#endif
|
|
||||||
#if (MATRIX_ROWS > 255)
|
|
||||||
# error "MATRIX_ROWS must not exceed 255"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static bool is_modified = false;
|
|
||||||
static report_mouse_t mouse_report = {};
|
|
||||||
|
|
||||||
// matrix state buffer(1:on, 0:off)
|
|
||||||
#if (MATRIX_COLS <= 8)
|
|
||||||
static uint8_t matrix[MATRIX_ROWS];
|
|
||||||
#else
|
|
||||||
static uint16_t matrix[MATRIX_ROWS];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MATRIX_HAS_GHOST
|
|
||||||
static bool matrix_has_ghost_in_row(uint8_t row);
|
|
||||||
#endif
|
|
||||||
static void register_key(uint8_t key);
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_rows(void)
|
|
||||||
{
|
|
||||||
return MATRIX_ROWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_cols(void)
|
|
||||||
{
|
|
||||||
return MATRIX_COLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init(void)
|
|
||||||
{
|
|
||||||
adb_host_init();
|
|
||||||
// wait for keyboard to boot up and receive command
|
|
||||||
_delay_ms(1000);
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
// initialize matrix state: all keys off
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
|
||||||
|
|
||||||
debug_enable = true;
|
|
||||||
//debug_matrix = true;
|
|
||||||
//debug_keyboard = true;
|
|
||||||
//debug_mouse = true;
|
|
||||||
print("debug enabled.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ADB_MOUSE_ENABLE
|
|
||||||
|
|
||||||
#ifdef MAX
|
|
||||||
#undef MAX
|
|
||||||
#endif
|
|
||||||
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
|
|
||||||
|
|
||||||
void adb_mouse_task(void)
|
|
||||||
{
|
|
||||||
uint16_t codes;
|
|
||||||
int16_t x, y;
|
|
||||||
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 (!codes) {
|
|
||||||
mouseacc = 1;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
// Bit sixteen is button.
|
|
||||||
if (~codes & (1 << 15))
|
|
||||||
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.
|
|
||||||
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.
|
|
||||||
if (codes & (1 << 6))
|
|
||||||
x = (x-0x40);
|
|
||||||
if (codes & (1 << 14))
|
|
||||||
y = (y-0x40);
|
|
||||||
// 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.
|
|
||||||
// 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);
|
|
||||||
mouse_report.y = -MAX(-MAX(y, -127), -127);
|
|
||||||
if (debug_mouse) {
|
|
||||||
print("adb_host_mouse_recv: "); print_bin16(codes); print("\n");
|
|
||||||
print("adb_mouse raw: [");
|
|
||||||
phex(mouseacc); print(" ");
|
|
||||||
phex(mouse_report.buttons); print("|");
|
|
||||||
print_decs(mouse_report.x); print(" ");
|
|
||||||
print_decs(mouse_report.y); print("]\n");
|
|
||||||
}
|
|
||||||
// Send result by usb.
|
|
||||||
host_mouse_send(&mouse_report);
|
|
||||||
// increase acceleration of mouse
|
|
||||||
mouseacc += ( mouseacc < ADB_MOUSE_MAXACC ? 1 : 0 );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
|
||||||
{
|
|
||||||
/* extra_key is volatile and more convoluted than necessary because gcc refused
|
|
||||||
to generate valid code otherwise. Making extra_key uint8_t and constructing codes
|
|
||||||
here via codes = extra_key<<8 | 0xFF; would consistently fail to even LOAD
|
|
||||||
extra_key from memory, and leave garbage in the high byte of codes. I tried
|
|
||||||
dozens of code variations and it kept generating broken assembly output. So
|
|
||||||
beware if attempting to make extra_key code more logical and efficient. */
|
|
||||||
static volatile uint16_t extra_key = 0xFFFF;
|
|
||||||
uint16_t codes;
|
|
||||||
uint8_t key0, key1;
|
|
||||||
|
|
||||||
is_modified = false;
|
|
||||||
|
|
||||||
codes = extra_key;
|
|
||||||
extra_key = 0xFFFF;
|
|
||||||
|
|
||||||
if ( codes == 0xFFFF )
|
|
||||||
{
|
|
||||||
_delay_ms(12); // delay for preventing overload of poor ADB keyboard controller
|
|
||||||
codes = adb_host_kbd_recv();
|
|
||||||
}
|
|
||||||
key0 = codes>>8;
|
|
||||||
key1 = codes&0xFF;
|
|
||||||
|
|
||||||
if (debug_matrix && codes) {
|
|
||||||
print("adb_host_kbd_recv: "); phex16(codes); print("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (codes == 0) { // no keys
|
|
||||||
return 0;
|
|
||||||
} else if (codes == 0x7F7F) { // power key press
|
|
||||||
register_key(0x7F);
|
|
||||||
} else if (codes == 0xFFFF) { // power key release
|
|
||||||
register_key(0xFF);
|
|
||||||
} else if (key0 == 0xFF) { // error
|
|
||||||
xprintf("adb_host_kbd_recv: ERROR(%d)\n", codes);
|
|
||||||
return key1;
|
|
||||||
} else {
|
|
||||||
register_key(key0);
|
|
||||||
if (key1 != 0xFF) // key1 is 0xFF when no second key.
|
|
||||||
extra_key = key1<<8 | 0xFF; // process in a separate call
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool matrix_is_modified(void)
|
|
||||||
{
|
|
||||||
return is_modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_has_ghost(void)
|
|
||||||
{
|
|
||||||
#ifdef MATRIX_HAS_GHOST
|
|
||||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
||||||
if (matrix_has_ghost_in_row(i))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return (matrix[row] & (1<<col));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
#if (MATRIX_COLS <= 8)
|
|
||||||
uint8_t matrix_get_row(uint8_t row)
|
|
||||||
#else
|
|
||||||
uint16_t matrix_get_row(uint8_t row)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
return matrix[row];
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_print(void)
|
|
||||||
{
|
|
||||||
if (!debug_matrix) return;
|
|
||||||
#if (MATRIX_COLS <= 8)
|
|
||||||
print("r/c 01234567\n");
|
|
||||||
#else
|
|
||||||
print("r/c 0123456789ABCDEF\n");
|
|
||||||
#endif
|
|
||||||
for (uint8_t row = 0; row < matrix_rows(); row++) {
|
|
||||||
phex(row); print(": ");
|
|
||||||
#if (MATRIX_COLS <= 8)
|
|
||||||
pbin_reverse(matrix_get_row(row));
|
|
||||||
#else
|
|
||||||
pbin_reverse16(matrix_get_row(row));
|
|
||||||
#endif
|
|
||||||
#ifdef MATRIX_HAS_GHOST
|
|
||||||
if (matrix_has_ghost_in_row(row)) {
|
|
||||||
print(" <ghost");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_key_count(void)
|
|
||||||
{
|
|
||||||
uint8_t count = 0;
|
|
||||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
||||||
#if (MATRIX_COLS <= 8)
|
|
||||||
count += bitpop(matrix[i]);
|
|
||||||
#else
|
|
||||||
count += bitpop16(matrix[i]);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef MATRIX_HAS_GHOST
|
|
||||||
inline
|
|
||||||
static bool matrix_has_ghost_in_row(uint8_t row)
|
|
||||||
{
|
|
||||||
// no ghost exists in case less than 2 keys on
|
|
||||||
if (((matrix[row] - 1) & matrix[row]) == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// ghost exists in case same state as other row
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
|
||||||
if (i != row && (matrix[i] & matrix[row]) == matrix[row])
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void register_key(uint8_t key)
|
|
||||||
{
|
|
||||||
uint8_t col, row;
|
|
||||||
col = key&0x07;
|
|
||||||
row = (key>>3)&0x0F;
|
|
||||||
if (key&0x80) {
|
|
||||||
matrix[row] &= ~(1<<col);
|
|
||||||
} else {
|
|
||||||
matrix[row] |= (1<<col);
|
|
||||||
}
|
|
||||||
is_modified = true;
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = ascii_usb
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = keymap.c \
|
|
||||||
matrix.c \
|
|
||||||
led.c \
|
|
||||||
protocol/serial_uart.c
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|
||||||
|
|
||||||
|
|
||||||
# Build Options
|
|
||||||
# *Comment out* to disable the options.
|
|
||||||
#
|
|
||||||
#MOUSEKEY_ENABLE = yes # Mouse keys
|
|
||||||
#EXTRAKEY_ENABLE = yes # Audio control and System control
|
|
||||||
CONSOLE_ENABLE = yes # Console for debug
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in bytes
|
|
||||||
# Teensy halfKay 512
|
|
||||||
# Atmel DFU loader 4096
|
|
||||||
# LUFA bootloader 4096
|
|
||||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
|
||||||
|
|
||||||
|
|
||||||
# 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,38 +0,0 @@
|
|||||||
ASCII to USB keyboard protocol converter
|
|
||||||
========================================
|
|
||||||
This converts serial console terminal into USB keyboard, tested with TRS-80 model 100 TELCOM application.
|
|
||||||
Target MCU is ATMega32u4 but other USB capable AVR will also work.
|
|
||||||
|
|
||||||
|
|
||||||
Hardware
|
|
||||||
--------
|
|
||||||
Connect 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Build Firmware
|
|
||||||
--------------
|
|
||||||
Configure UART setting and Just use 'make'
|
|
||||||
|
|
||||||
$ cd ascii_usb
|
|
||||||
$ make
|
|
||||||
|
|
||||||
Then, load the binary to MCU with your favorite programmer.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Limitation
|
|
||||||
----------
|
|
||||||
- This cannot see key up event, you cannot hold a key.
|
|
||||||
- Alt, Gui(Win/Mac) modifier key are not available.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TRS-80 model 100
|
|
||||||
----------------
|
|
||||||
Use TELCOM program with setting: 19200bps/8bit/odd parity/1stop bit
|
|
||||||
To set this configuration push Stat(F3) and input '9801D,10'. Then push Term(F4) to connect.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x5C01
|
|
||||||
#define DEVICE_VER 0x0100
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT ASCII keyboard converter
|
|
||||||
#define DESCRIPTION converts Serial Console Terminal into USB keyboard
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 16
|
|
||||||
#define MATRIX_COLS 16
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
host_get_first_key() == KC_BRK \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Serial(USART) configuration
|
|
||||||
* asynchronous, positive logic, 19200baud, bit order: LSB first
|
|
||||||
* 1-start bit, 8-data bit, odd parity, 1-stop bit
|
|
||||||
*/
|
|
||||||
#ifdef __AVR_ATmega32U4__
|
|
||||||
#define SERIAL_UART_BAUD 19200
|
|
||||||
#define SERIAL_UART_DATA UDR1
|
|
||||||
#define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
|
|
||||||
#define SERIAL_UART_RXD_VECT USART1_RX_vect
|
|
||||||
#define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
|
|
||||||
#define SERIAL_UART_INIT() do { \
|
|
||||||
UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
|
|
||||||
UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
|
|
||||||
UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
|
|
||||||
UCSR1B |= (0<<TXCIE1) | (1<<TXEN1); /* TX interrupt, TX: enable */ \
|
|
||||||
UCSR1C |= (1<<UPM11) | (1<<UPM10); /* parity: none(00), even(01), odd(11) */ \
|
|
||||||
sei(); \
|
|
||||||
} while(0)
|
|
||||||
#else
|
|
||||||
#error "USART configuration is needed."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* disable action features */
|
|
||||||
#define NO_ACTION_LAYER
|
|
||||||
#define NO_ACTION_TAPPING
|
|
||||||
#define NO_ACTION_ONESHOT
|
|
||||||
#define NO_ACTION_MACRO
|
|
||||||
#define NO_ACTION_FUNCTION
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "action_macro.h"
|
|
||||||
#include "action_util.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Keymap is not used. See matrix.c.
|
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
return KC_NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translates Fn keycode to action */
|
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
|
||||||
{
|
|
||||||
return (action_t) { .code = ACTION_NO };
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
#include "serial.h"
|
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,195 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
#include "print.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "action_util.h"
|
|
||||||
#include "protocol/serial.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Not use Matrix.
|
|
||||||
*
|
|
||||||
* ROW: 16(4bits)
|
|
||||||
* COL: 16(4bits)
|
|
||||||
*
|
|
||||||
* 8bit wide
|
|
||||||
* +---------+
|
|
||||||
* 0|00 ... 0F|
|
|
||||||
* 1|08 ... 1F|
|
|
||||||
* :| ... |
|
|
||||||
* :| ... |
|
|
||||||
* E|E0 ... EF|
|
|
||||||
* F|F0 ... FF|
|
|
||||||
* +---------+
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_rows(void)
|
|
||||||
{
|
|
||||||
return MATRIX_ROWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_cols(void)
|
|
||||||
{
|
|
||||||
return MATRIX_COLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init(void)
|
|
||||||
{
|
|
||||||
debug_matrix = true;
|
|
||||||
serial_init();
|
|
||||||
|
|
||||||
debug("init\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void type_key(uint16_t keycode)
|
|
||||||
{
|
|
||||||
if (keycode == 0) return;
|
|
||||||
|
|
||||||
uint8_t mods = keycode>>8;
|
|
||||||
uint8_t key = keycode&0xFF;
|
|
||||||
if (mods) {
|
|
||||||
add_mods(mods);
|
|
||||||
send_keyboard_report();
|
|
||||||
}
|
|
||||||
|
|
||||||
add_key(key);
|
|
||||||
send_keyboard_report();
|
|
||||||
|
|
||||||
del_key(key);
|
|
||||||
send_keyboard_report();
|
|
||||||
|
|
||||||
if (mods) {
|
|
||||||
del_mods(mods);
|
|
||||||
send_keyboard_report();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static uint16_t code2key(uint8_t code)
|
|
||||||
{
|
|
||||||
// ASCII to key combination in US laout
|
|
||||||
switch (code) {
|
|
||||||
case 0x01 ... 0x08: // Ctrl-[a-z]
|
|
||||||
return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01));
|
|
||||||
case 0x09: return KC_TAB; // TAB(Ctrl-i)
|
|
||||||
case 0x0A ... 0x0C: // Ctrl-[a-z]
|
|
||||||
return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01));
|
|
||||||
case 0x0D: return KC_ENTER; // Enter(Ctrl-m)
|
|
||||||
case 0x0E ... 0x1A: // Ctrl-[a-z]
|
|
||||||
return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01));
|
|
||||||
case 0x1B: return KC_ESC;
|
|
||||||
case 0x1C: return KC_RIGHT;
|
|
||||||
case 0x1D: return KC_LEFT;
|
|
||||||
case 0x1E: return KC_UP;
|
|
||||||
case 0x1F: return KC_DOWN;
|
|
||||||
case 0x20: return KC_SPACE;
|
|
||||||
case 0x21: return MOD_BIT(KC_LSHIFT)<<8 | KC_1; // !
|
|
||||||
case 0x22: return MOD_BIT(KC_LSHIFT)<<8 | KC_QUOTE; // "
|
|
||||||
case 0x23: return MOD_BIT(KC_LSHIFT)<<8 | KC_3; // #
|
|
||||||
case 0x24: return MOD_BIT(KC_LSHIFT)<<8 | KC_4; // $
|
|
||||||
case 0x25: return MOD_BIT(KC_LSHIFT)<<8 | KC_5; // %
|
|
||||||
case 0x26: return MOD_BIT(KC_LSHIFT)<<8 | KC_7; // &
|
|
||||||
case 0x27: return KC_QUOTE; // '
|
|
||||||
case 0x28: return MOD_BIT(KC_LSHIFT)<<8 | KC_9; // (
|
|
||||||
case 0x29: return MOD_BIT(KC_LSHIFT)<<8 | KC_0; // )
|
|
||||||
case 0x2A: return MOD_BIT(KC_LSHIFT)<<8 | KC_8; // *
|
|
||||||
case 0x2B: return MOD_BIT(KC_LSHIFT)<<8 | KC_EQUAL; // +
|
|
||||||
case 0x2C: return KC_COMMA; // ,
|
|
||||||
case 0x2D: return KC_MINUS; // -
|
|
||||||
case 0x2E: return KC_DOT; // .
|
|
||||||
case 0x2F: return KC_SLASH; // /
|
|
||||||
case 0x30: return KC_0;
|
|
||||||
case 0x31 ... 0x39: // 1-9
|
|
||||||
return KC_1 + (code-0x31);
|
|
||||||
case 0x3A: return MOD_BIT(KC_LSHIFT)<<8 | KC_SCLN; // :
|
|
||||||
case 0x3B: return KC_SCLN; // ;
|
|
||||||
case 0x3C: return MOD_BIT(KC_LSHIFT)<<8 | KC_COMMA; // <
|
|
||||||
case 0x3D: return KC_EQUAL; // =
|
|
||||||
case 0x3E: return MOD_BIT(KC_LSHIFT)<<8 | KC_DOT; // >
|
|
||||||
case 0x3F: return MOD_BIT(KC_LSHIFT)<<8 | KC_SLASH; // ?
|
|
||||||
case 0x40: return MOD_BIT(KC_LSHIFT)<<8 | KC_2; // @
|
|
||||||
case 0x41 ... 0x5A: // A-Z
|
|
||||||
return MOD_BIT(KC_LSHIFT)<<8 | (KC_A + (code-0x41));
|
|
||||||
case 0x5B: return KC_LBRACKET; // [
|
|
||||||
case 0x5C: return KC_BSLASH; //
|
|
||||||
case 0x5D: return KC_RBRACKET; // ]
|
|
||||||
case 0x5E: return MOD_BIT(KC_LSHIFT)<<8 | KC_6; // ^
|
|
||||||
case 0x5F: return MOD_BIT(KC_LSHIFT)<<8 | KC_MINUS; // _
|
|
||||||
case 0x61 ... 0x7A: // a-z
|
|
||||||
return KC_A + (code-0x61);
|
|
||||||
case 0x7B: return MOD_BIT(KC_LSHIFT)<<8 | KC_LBRACKET; // {
|
|
||||||
case 0x7C: return MOD_BIT(KC_LSHIFT)<<8 | KC_BSLASH; // |
|
|
||||||
case 0x7D: return MOD_BIT(KC_LSHIFT)<<8 | KC_RBRACKET; // }
|
|
||||||
case 0x7E: return MOD_BIT(KC_LSHIFT)<<8 | KC_GRAVE; // }
|
|
||||||
case 0x7F: return KC_DELETE; //
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
|
||||||
{
|
|
||||||
uint16_t code = serial_recv2();
|
|
||||||
if (code == -1) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
print_hex8(code); print(" ");
|
|
||||||
|
|
||||||
// echo back
|
|
||||||
serial_send(code);
|
|
||||||
type_key(code2key(code));
|
|
||||||
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_has_ghost(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
matrix_row_t matrix_get_row(uint8_t row)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_print(void)
|
|
||||||
{
|
|
||||||
print("\nr/c 0123456789ABCDEF\n");
|
|
||||||
for (uint8_t row = 0; row < matrix_rows(); row++) {
|
|
||||||
phex(row); print(": ");
|
|
||||||
pbin_reverse(matrix_get_row(row));
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = ibm4704_usb
|
|
||||||
|
|
||||||
# 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 \
|
|
||||||
protocol/ibm4704.c
|
|
||||||
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
|
||||||
else
|
|
||||||
SRC := keymap_plain.c $(SRC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CONFIG_H = config.h
|
|
||||||
|
|
||||||
|
|
||||||
# MCU name
|
|
||||||
#MCU = at90usb1287
|
|
||||||
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
|
|
||||||
# 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
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
|
||||||
|
|
||||||
|
|
||||||
# Search Path
|
|
||||||
VPATH += $(TARGET_DIR)
|
|
||||||
VPATH += $(TMK_DIR)
|
|
||||||
|
|
||||||
include $(TMK_DIR)/protocol.mk
|
|
||||||
include $(TMK_DIR)/protocol/lufa.mk
|
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
@ -1,72 +0,0 @@
|
|||||||
IBM 4704 to USB keyboard converter
|
|
||||||
==================================
|
|
||||||
This firmware converts IBM 4704 keyboard protocol to USB HID.
|
|
||||||
|
|
||||||
Keyboard 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.**
|
|
||||||
|
|
||||||
|
|
||||||
Update
|
|
||||||
------
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Supported Keyboard
|
|
||||||
------------------
|
|
||||||
### IBM capacitive switch models:
|
|
||||||
- 6019273 Model 100 50-key (grid layout) http://kishy.ca/?p=894
|
|
||||||
- 6019284 Model 200 62-key Alpha(60% layout) http://kishy.ca/?p=894
|
|
||||||
- 6019303 Model 300 77-key Expanded Alpha http://deskthority.net/photos-f62/ibm-6019303-t8502.html
|
|
||||||
- 6020218 Model 400 107-key Full key http://kishy.ca/?p=894
|
|
||||||
|
|
||||||
### Alps switch(vintage Green) models:
|
|
||||||
|
|
||||||
- 5954339 Japanese 102-key http://deskthority.net/post87127.html#p87127
|
|
||||||
- 6112883 Japanese 102-key http://geekhack.org/index.php?topic=52888.msg1194489#msg1194489
|
|
||||||
- 6112884 Japanese 102-key http://geekhack.org/index.php?topic=50437.msg1193047#msg1193047
|
|
||||||
- 6341739 Chinese 102-key http://geekhack.org/index.php?topic=52888.msg1176566#msg1176566
|
|
||||||
|
|
||||||
|
|
||||||
Connector
|
|
||||||
---------
|
|
||||||
Keyboard Plug from front:
|
|
||||||
|
|
||||||
DSUB-9
|
|
||||||
-------------
|
|
||||||
\ N 2 3 4 5 /
|
|
||||||
\ N N N N /
|
|
||||||
---------
|
|
||||||
2 GND
|
|
||||||
3 VCC 5V
|
|
||||||
4 DATA
|
|
||||||
5 CLOCK
|
|
||||||
N No connection/No pin.
|
|
||||||
|
|
||||||
|
|
||||||
Connection
|
|
||||||
----------
|
|
||||||
In case of using ATMega32U4(Teensy2.0):
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
Build Firmware
|
|
||||||
--------------
|
|
||||||
Just run `make`:
|
|
||||||
|
|
||||||
$ make
|
|
||||||
|
|
||||||
To select keymap:
|
|
||||||
|
|
||||||
$ make KEYMAP=[plain|...]
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x4707
|
|
||||||
#define DEVICE_VER 0x0001
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT IBM 4704 keyboard converter
|
|
||||||
#define DESCRIPTION convert IBM 4704 keyboard to USB
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 16 // keycode bit3-6
|
|
||||||
#define MATRIX_COLS 8 // keycode bit0-2
|
|
||||||
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) || \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Pin configuration */
|
|
||||||
#define IBM4704_CLOCK_PORT PORTD
|
|
||||||
#define IBM4704_CLOCK_PIN PIND
|
|
||||||
#define IBM4704_CLOCK_DDR DDRD
|
|
||||||
#define IBM4704_CLOCK_BIT 1
|
|
||||||
#define IBM4704_DATA_PORT PORTD
|
|
||||||
#define IBM4704_DATA_PIN PIND
|
|
||||||
#define IBM4704_DATA_DDR DDRD
|
|
||||||
#define IBM4704_DATA_BIT 0
|
|
||||||
|
|
||||||
/* Pin interrupt on rising edge of clock */
|
|
||||||
#define IBM4704_INT_INIT() do { EICRA |= ((1<<ISC11)|(1<<ISC10)); } while (0)
|
|
||||||
#define IBM4704_INT_ON() do { EIFR |= (1<<INTF1); EIMSK |= (1<<INT1); } while (0)
|
|
||||||
#define IBM4704_INT_OFF() do { EIMSK &= ~(1<<INT1); } while (0)
|
|
||||||
#define IBM4704_INT_VECT INT1_vect
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,182 +0,0 @@
|
|||||||
IBM 4704 Keyboard
|
|
||||||
=================
|
|
||||||
IBM capacitive switch models:
|
|
||||||
6019273 Model 100 50-key (grid layout) http://kishy.ca/?p=894
|
|
||||||
6019284 Model 200 62-key Alpha(60% layout) http://kishy.ca/?p=894
|
|
||||||
6019303 Model 300 77-key Expanded Alpha http://deskthority.net/photos-f62/ibm-6019303-t8502.html
|
|
||||||
6020218 Model 400 107-key Full key http://kishy.ca/?p=894
|
|
||||||
|
|
||||||
Alps switch(vintage Green) models:
|
|
||||||
5954339 Japanese 102-key http://deskthority.net/post87127.html#p87127
|
|
||||||
6112883 Japanese 102-key http://geekhack.org/index.php?topic=52888.msg1194489#msg1194489
|
|
||||||
6112884 Japanese 102-key http://geekhack.org/index.php?topic=50437.msg1193047#msg1193047
|
|
||||||
6341739 Chinese 102-key http://geekhack.org/index.php?topic=52888.msg1176566#msg1176566
|
|
||||||
|
|
||||||
Resourse
|
|
||||||
--------
|
|
||||||
The IBM 4704: lots of pictures and info
|
|
||||||
http://kishy.dyndns.org/?p=648#more-648
|
|
||||||
|
|
||||||
Brochure:
|
|
||||||
http://ed-thelen.org/comp-hist/IBM-ProdAnn/4700.pdf
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IBM 4704 Keyboard Protocol
|
|
||||||
==========================
|
|
||||||
On powering up keyboard sends keyboard ID; A3h for 6019284(62-key), for example.
|
|
||||||
After that the keyboard enters FC command mode and waits for parameter data from host
|
|
||||||
so that it doesn't send any scancode until you send 'FF'(End of FC command mode).
|
|
||||||
|
|
||||||
Keyboard ID
|
|
||||||
-------------------------------
|
|
||||||
Model 100 50-key A2h
|
|
||||||
Model 200 62-key A3h
|
|
||||||
Model 300 77-key A4h
|
|
||||||
Model 400 107-key A5h
|
|
||||||
Japanese/Chinese 102-key A6h
|
|
||||||
|
|
||||||
|
|
||||||
Connector
|
|
||||||
---------
|
|
||||||
Keyboard Plug from front
|
|
||||||
|
|
||||||
DSUB-9
|
|
||||||
-------------
|
|
||||||
\ N 2 3 4 5 /
|
|
||||||
\ N N N N /
|
|
||||||
---------
|
|
||||||
2 GND
|
|
||||||
3 VCC 5V
|
|
||||||
4 DATA
|
|
||||||
5 CLOCK
|
|
||||||
N No connection/No pin.
|
|
||||||
|
|
||||||
|
|
||||||
Keyboard to Host
|
|
||||||
----------------
|
|
||||||
Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part.
|
|
||||||
|
|
||||||
____ __ __ __ __ __ __ __ __ __ _______
|
|
||||||
Clock \_____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
|
|
||||||
____ ____ ____ ____ ____ ____ ____ ____ ____ ____
|
|
||||||
Data ____/ X____X____X____X____X____X____X____X____X____X________
|
|
||||||
Start 0 1 2 3 4 5 6 7 P Stop
|
|
||||||
|
|
||||||
Start bit: can be long as 300-350us.
|
|
||||||
Inhibit: Pull Data line down to inhibit keyboard to send.
|
|
||||||
Timing: Host reads bit while Clock is hi.(rising edge)
|
|
||||||
Stop bit: Keyboard pulls down Data line to lo after 9th clock.
|
|
||||||
|
|
||||||
|
|
||||||
Host to Keyboard
|
|
||||||
----------------
|
|
||||||
Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part.
|
|
||||||
|
|
||||||
____ __ __ __ __ __ __ __ __ __ ________
|
|
||||||
Clock \______/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
|
|
||||||
^ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___
|
|
||||||
Data ____|__/ X____X____X____X____X____X____X____X____X____X \___
|
|
||||||
| Start 0 1 2 3 4 5 6 7 P Stop
|
|
||||||
Request by host
|
|
||||||
|
|
||||||
Start bit: can be long as 300-350us.
|
|
||||||
Request: Host pulls Clock line down to request to send a command.
|
|
||||||
Timing: After Request keyboard pull up Data and down Clock line to low for start bit.
|
|
||||||
After request host release Clock line once Data line becomes hi.
|
|
||||||
Host wirtes a bit while Clock is hi and Keyboard reads while low.
|
|
||||||
Stop bit: Host releases or pulls up Data line to hi after 9th clock and waits for keybaord pull down the line to lo.
|
|
||||||
|
|
||||||
|
|
||||||
Scancodes
|
|
||||||
---------
|
|
||||||
Keyboard doesn't send Break code for all keys except for Alt by default.
|
|
||||||
|
|
||||||
6019284 62-key:
|
|
||||||
,-----------------------------------------------------------.
|
|
||||||
| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS |
|
|
||||||
|-----------------------------------------------------------|
|
|
||||||
|Tab | Q| W| E| R| T| Y| U| I| O| P| ¢| \| PD2|
|
|
||||||
|-----------------------------------------------------------|
|
|
||||||
|Ctrl | A| S| D| F| G| H| J| K| L| ;| '| {}| PD3|
|
|
||||||
|-----------------------------------------------------------|
|
|
||||||
|Shif| <>| Z| X| C| V| B| N| M| ,| ,| /|???|Shift |
|
|
||||||
|-----------------------------------------------------------|
|
|
||||||
|Reset|blk|Alt | Space |Alt |blk|Enter|
|
|
||||||
`-----------------------------------------------------------'
|
|
||||||
+----------+---------------------+----------+----------+
|
|
||||||
|` 00|PD1 04|Caps 20|LShift 30|Reset 31|
|
|
||||||
|1 18|q 05|a 21|<> 3E|Rblank 41|
|
|
||||||
|2 19|w 06|s 22|z 32|Alt 3F|
|
|
||||||
|3 1A|e 13|d 23|x 33|Space 40|
|
|
||||||
|4 10|r 14|f 24|c 34|Alt 3F|
|
|
||||||
|5 11|t 15|g 25|v 35|Lblank 42|
|
|
||||||
|6 12|y 16|h 26|b 36|Enter 2F|
|
|
||||||
|7 08|u 17|j 27|n 37| |
|
|
||||||
|8 09|i 01|k 28|m 38| |
|
|
||||||
|9 0A|o 02|l 29|, 39| |
|
|
||||||
|0 0F|p 03|; 2A|. 3A| |
|
|
||||||
|- 1F|¢ 1B|' 2B|/ 3B| |
|
|
||||||
|= 0D|\ 1C|{} 2C|??? 3C| |
|
|
||||||
|??? 0C|PD2 1D|PD3 2D|RShift 3D| |
|
|
||||||
|BS 0E| | | | |
|
|
||||||
+----------+---------------------+----------+----------+
|
|
||||||
Bit7 is 'press flag' which set 1 on press and 0 on release when break code is enabled.
|
|
||||||
|
|
||||||
NOTE: When break code is enabled the key sends scancode with setting 7th bit on press
|
|
||||||
and without it on release. That is, '`' sends 80h on press and 00h on release.
|
|
||||||
|
|
||||||
|
|
||||||
Keyboard command
|
|
||||||
----------------
|
|
||||||
Keyboard accepts these commands from host.
|
|
||||||
|
|
||||||
Description Entry point
|
|
||||||
-----------------------------------------------------------
|
|
||||||
FF Soft Reset 0008h
|
|
||||||
FE Resend 00e8h
|
|
||||||
FD Buzzer(emits a short beep) 00edh
|
|
||||||
FC Set Key Flag 00f6h
|
|
||||||
FB Soft Reset 0008h
|
|
||||||
FA Reset 0000h
|
|
||||||
|
|
||||||
|
|
||||||
Keyboard response
|
|
||||||
-----------------
|
|
||||||
Keyobard sends these bytes to host.
|
|
||||||
|
|
||||||
Description Entry point
|
|
||||||
-----------------------------------------------------------
|
|
||||||
FE Overflow(key event/receive data) 00c5h, 0346h
|
|
||||||
Memory test error 0224h
|
|
||||||
FD Command out of bound 00d8h
|
|
||||||
Key out of bound
|
|
||||||
7E Read/Parity error in receive from host 00bch
|
|
||||||
|
|
||||||
|
|
||||||
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'.
|
|
||||||
|
|
||||||
Data sent from host:
|
|
||||||
|
|
||||||
bit: 7 6 ... 0
|
|
||||||
en | |
|
|
||||||
| `-----`--- 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.)
|
|
||||||
FE Resend(011ah) no need to use
|
|
||||||
FF End(0114h) exits FC command mode.
|
|
||||||
|
|
||||||
Response from keyboard:
|
|
||||||
FD Out of bound - Invalid scancode
|
|
||||||
-- OK - No response means that command is accepted.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
To enable break code of all keys.
|
|
||||||
|
|
||||||
FC 80 81 ... F7 FF
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
KEYMAP_50(
|
|
||||||
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, \
|
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, \
|
|
||||||
Q, W, E, R, T, Y, U, I, O, P, \
|
|
||||||
A, S, D, F, G, H, J, K, L, SCLN, \
|
|
||||||
Z, X, C, V, B, N, M, COMM,DOT, SLSH \
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
#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|
|
|
||||||
* `---------------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
KEYMAP_ALPS102(
|
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, VOLD,VOLU,MUTE, TRNS,TRNS,TRNS,TRNS, \
|
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, \
|
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, \
|
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,PGUP,TRNS, TRNS,TRNS,TRNS,TRNS, \
|
|
||||||
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS, HOME,PGDN,END, TRNS,TRNS,TRNS,TRNS \
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
[0] = ACTION_LAYER_MOMENTARY(1),
|
|
||||||
};
|
|
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translates Fn keycode to action */
|
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
|
||||||
{
|
|
||||||
return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
|
|
||||||
}
|
|
@ -1,146 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef KEYMAP_COMMON_H
|
|
||||||
#define KEYMAP_COMMON_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "action_macro.h"
|
|
||||||
#include "report.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
// 32*8(256) byte array which converts PS/2 code into USB code
|
|
||||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
|
||||||
extern const uint16_t fn_actions[];
|
|
||||||
|
|
||||||
|
|
||||||
/* 107-key */
|
|
||||||
#define KEYMAP( \
|
|
||||||
K46,K64, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, K47,K48,K49,K4A, \
|
|
||||||
K56,K66, K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, K6D,K6E,K6F, K4B,K4C,K4D,K4E, \
|
|
||||||
K71,K77, K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K70,K65,K72, K50,K51,K52,K53, \
|
|
||||||
K44,K45, K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, K74,K75,K76, K5E,K58,K59,K5A, \
|
|
||||||
K54,K55, K31,K41,K3F, K40, K42,K2F, K78,K67,K79, K5B,K5C,K5D,K57 \
|
|
||||||
) { \
|
|
||||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO }, \
|
|
||||||
{ KC_##K08, KC_##K09, KC_##K0A, KC_NO, 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_NO, 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_NO, KC_##K2F }, \
|
|
||||||
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
|
|
||||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
|
|
||||||
{ KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
|
|
||||||
{ KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
|
|
||||||
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
|
|
||||||
{ KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
|
|
||||||
{ KC_NO, KC_NO, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
|
|
||||||
{ KC_##K70, KC_##K71, KC_##K72, KC_NO, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
|
|
||||||
{ KC_##K78, KC_##K79, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 77-key */
|
|
||||||
#define KEYMAP_77( \
|
|
||||||
K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, \
|
|
||||||
K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, K6D,K6E,K6F, \
|
|
||||||
K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K70,K65,K72, \
|
|
||||||
K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, K74,K75,K76, \
|
|
||||||
K31,K41,K3F, K40, K42,K2F, K78,K67,K79 \
|
|
||||||
) KEYMAP( \
|
|
||||||
F1, F2, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, NLCK,PSLS,PAST,PMNS, \
|
|
||||||
F3, F4, K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, K6D,K6E,K6F, P7, P8, P9, PPLS, \
|
|
||||||
F5, F6, K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K70,K65,K72, P4, P5, P6, PPLS, \
|
|
||||||
F7, F8, K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, K74,K75,K76, P1, P2, P3, PENT, \
|
|
||||||
F9, F10, K31,K41,K3F, K40, K42,K2F, K78,K67,K79 P0, P0, PDOT,PENT \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* 62-key */
|
|
||||||
#define KEYMAP_62( \
|
|
||||||
K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, \
|
|
||||||
K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, \
|
|
||||||
K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, \
|
|
||||||
K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, \
|
|
||||||
K31,K41,K3F, K40, K42,K2F \
|
|
||||||
) KEYMAP( \
|
|
||||||
F1, F2, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \
|
|
||||||
F3, F4, K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, DEL, END, PGDN, P7, P8, P9, PPLS, \
|
|
||||||
F5, F6, K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, PSCR,SLCK,PAUS, P4, P5, P6, PPLS, \
|
|
||||||
F7, F8, K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, F11, UP, F12, P1, P2, P3, PENT, \
|
|
||||||
F9, F10, K31,K41,K3F, K40, K42,K2F, LEFT,DOWN,RGHT, P0, P0, PDOT,PENT \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* 50-key */
|
|
||||||
#define KEYMAP_50( \
|
|
||||||
K00,K01,K02, K03,K04,K05, K20,K21,K22,K23, \
|
|
||||||
K08,K09,K0A, K0B,K0C,K0D, K28,K29,K2A,K35, \
|
|
||||||
K10,K11,K12, K13,K14,K15, K30,K31,K32,K36, \
|
|
||||||
K18,K19,K1A, K1B,K1C,K1D, K38,K39,K3A,K37, \
|
|
||||||
K16,K1E,K0E, K0F,K1F,K17, K33,K3B,K2B,K3F \
|
|
||||||
) { \
|
|
||||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_NO, KC_NO, }, \
|
|
||||||
{ 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_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \
|
|
||||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_NO, KC_NO, KC_NO, KC_##K3F }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, 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, } \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Alps 102-key */
|
|
||||||
#define KEYMAP_ALPS102( \
|
|
||||||
K00, K0F, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K44, K45, K46, K43, K41, K42, K4A, \
|
|
||||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K54, K55, K56, K50, K51, K52, K5A, \
|
|
||||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, K64, K65, K66, K60, K61, K62, K6B, \
|
|
||||||
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K74, K75, K76, K70, K71, K72, K7B, \
|
|
||||||
K31, K47, K3F, K40, K4F, K48, K2F, K77, K67, K57, K73, K63, K53, K4E \
|
|
||||||
) { \
|
|
||||||
{ 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_NO, }, \
|
|
||||||
{ 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_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
|
|
||||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
|
|
||||||
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
|
|
||||||
{ KC_##K48, KC_NO, KC_##K4A, KC_NO, KC_NO, KC_NO, KC_##K4E, KC_##K4F }, \
|
|
||||||
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
|
|
||||||
{ KC_NO, KC_NO, KC_##K5A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_##K6B, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_##K7B, KC_NO, KC_NO, KC_NO, KC_NO, } \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,85 +0,0 @@
|
|||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* 0: default
|
|
||||||
* ,-----------------------------------------------------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|xxx|Ret |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Shif|xxx| Z| X| C| V| B| N| M| ,| ,| /|xxx|Shift |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Ctrl |Gui|Alt | Space |Alt |Gui|Ctrl |
|
|
||||||
* `-----------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
KEYMAP_62(
|
|
||||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
|
|
||||||
LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,NO, ENT, \
|
|
||||||
LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, FN2, NO, FN0, \
|
|
||||||
LCTL,LGUI,LALT, FN3, RGUI,RCTL \
|
|
||||||
),
|
|
||||||
|
|
||||||
KEYMAP_62(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
|
|
||||||
CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSPC, \
|
|
||||||
LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO, ENT, \
|
|
||||||
LSFT,NO, NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,NO, TRNS, \
|
|
||||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL \
|
|
||||||
),
|
|
||||||
|
|
||||||
KEYMAP_62(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
|
|
||||||
TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,WSTP,WBAK,WFWD,BSPC, \
|
|
||||||
LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,NO, NO, ENT, \
|
|
||||||
LSFT,NO, NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, NO, RSFT,\
|
|
||||||
LCTL,LGUI,LALT, BTN1, RGUI,RCTL \
|
|
||||||
),
|
|
||||||
|
|
||||||
KEYMAP_62(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
|
|
||||||
TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \
|
|
||||||
LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, ENT, \
|
|
||||||
LSFT,NO, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS,NO, RSFT, \
|
|
||||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL \
|
|
||||||
),
|
|
||||||
|
|
||||||
KEYMAP_62(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
|
|
||||||
TAB, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN4, \
|
|
||||||
LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,BTN1,NO, NO, ENT, \
|
|
||||||
LSFT,NO, NO, NO, NO, NO, BTN3,BTN2,BTN1,BTN4,BTN5,NO, NO, NO, \
|
|
||||||
LCTL,LGUI,LALT, TRNS, RGUI,RCTL \
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
enum macro_id {
|
|
||||||
ALT_TAB,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
[0] = ACTION_LAYER_MOMENTARY(1),
|
|
||||||
[1] = ACTION_LAYER_TAP_KEY(2, KC_SCLN),
|
|
||||||
[2] = ACTION_LAYER_TAP_KEY(3, KC_SLASH),
|
|
||||||
[3] = ACTION_LAYER_TAP_KEY(4, KC_SPC),
|
|
||||||
[4] = ACTION_MACRO(ALT_TAB),
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Macro definition
|
|
||||||
*/
|
|
||||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|
||||||
{
|
|
||||||
keyevent_t event = record->event;
|
|
||||||
|
|
||||||
switch (id) {
|
|
||||||
case ALT_TAB:
|
|
||||||
return (event.pressed ?
|
|
||||||
MACRO( D(LALT), D(TAB), END ) :
|
|
||||||
MACRO( U(TAB), END ));
|
|
||||||
}
|
|
||||||
return MACRO_NONE;
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* 0: default
|
|
||||||
* ,-----------------------------------------------------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|???|BS |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Ret|Ret |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Shif|Shf| Z| X| C| V| B| N| M| ,| ,| /|???|Shift |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Ctrl |Gui|Alt | Space |Alt* |Gui|Fn |
|
|
||||||
* `-----------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
KEYMAP(
|
|
||||||
F1, F2, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NO, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \
|
|
||||||
F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, \
|
|
||||||
F5, F6, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, ENT, PSCR,SLCK,PAUS, P4, P5, P6, PPLS, \
|
|
||||||
F7, F8, LSFT,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, F11, UP, F12, P1, P2, P3, PENT, \
|
|
||||||
F9, F10, LCTL,LGUI,LALT, SPC, RGUI,FN0, LEFT,DOWN,RGHT, P0, P0, PDOT,PENT \
|
|
||||||
),
|
|
||||||
|
|
||||||
/* 1: HHKB
|
|
||||||
* ,-----------------------------------------------------------.
|
|
||||||
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|???|Del|
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Caps | | | | | | | |Psc|Slk|Pau| Up| | Ins|
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Ctrl |VoD|VoU|VoM| | | *| /|Hom|PgU|Lef|Rig|Ret|Ret |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Shif|Shi| | | | | | +| -|End|PgD|Dow|???|Shift |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* |Ctrl |Gui|Alt | Space |Alt* |Gui|Fn |
|
|
||||||
* `-----------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
KEYMAP(
|
|
||||||
F1, F2, ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, NO, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \
|
|
||||||
F3, F4, CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, INS, DEL, END, PGDN, P7, P8, P9, PPLS, \
|
|
||||||
F5, F6, TRNS,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, ENT, PSCR,SLCK,PAUS, P4, P5, P6, PPLS, \
|
|
||||||
F7, F8, TRNS,TRNS,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,NO, TRNS, F11, UP, F12, P1, P2, P3, PENT, \
|
|
||||||
F9, F10, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, LEFT,DOWN,RGHT, P0, P0, PDOT,PENT \
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
[0] = ACTION_LAYER_MOMENTARY(1),
|
|
||||||
};
|
|
@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,162 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
#include "action.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "ibm4704.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
|
|
||||||
|
|
||||||
static void matrix_make(uint8_t code);
|
|
||||||
static void matrix_break(uint8_t code);
|
|
||||||
static void matrix_clear(void);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Matrix Array usage:
|
|
||||||
* IBM 4704 scan codes are assigned into 128(16x8)-cell matrix.
|
|
||||||
*
|
|
||||||
* 8bit wide
|
|
||||||
* +---------+
|
|
||||||
* 0| |
|
|
||||||
* :| XX | 00-7F
|
|
||||||
* f| |
|
|
||||||
* +---------+
|
|
||||||
*
|
|
||||||
* Exceptions:
|
|
||||||
*/
|
|
||||||
static uint8_t matrix[MATRIX_ROWS];
|
|
||||||
|
|
||||||
// scan code bits 7654 3210
|
|
||||||
// R:row/C:column -RRR RCCC
|
|
||||||
#define ROW(code) ((code>>3)&0x0f)
|
|
||||||
#define COL(code) (code&0x07)
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_rows(void)
|
|
||||||
{
|
|
||||||
return MATRIX_ROWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_cols(void)
|
|
||||||
{
|
|
||||||
return MATRIX_COLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void enable_break(void)
|
|
||||||
{
|
|
||||||
print("Enable break: ");
|
|
||||||
while (ibm4704_send(0xFC)) { _delay_ms(10); }
|
|
||||||
// valid scancode: 00-79h
|
|
||||||
for (uint8_t code = 0; code < 0x7F; code++) {
|
|
||||||
while (ibm4704_send(0x80|code)) _delay_ms(10);
|
|
||||||
_delay_ms(5); // wait for response
|
|
||||||
// No response(FF) when ok, FD when out of bound
|
|
||||||
xprintf("s%02X:r%02X ", code, ibm4704_recv());
|
|
||||||
}
|
|
||||||
while (ibm4704_send(0xFF)) { _delay_ms(10); } // End
|
|
||||||
print("End\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void matrix_setup(void)
|
|
||||||
{
|
|
||||||
ibm4704_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init(void)
|
|
||||||
{
|
|
||||||
debug_enable = true;
|
|
||||||
|
|
||||||
print("IBM 4704 converter\n");
|
|
||||||
matrix_clear();
|
|
||||||
_delay_ms(2000); // wait for keyboard starting up
|
|
||||||
xprintf("Keyboard ID: %02X\n", ibm4704_recv());
|
|
||||||
enable_break();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* IBM 4704 Scan Code
|
|
||||||
*/
|
|
||||||
uint8_t matrix_scan(void)
|
|
||||||
{
|
|
||||||
uint8_t code = ibm4704_recv();
|
|
||||||
if (code==0xFF) {
|
|
||||||
// Not receivd
|
|
||||||
return 0;
|
|
||||||
} else if ((code&0x7F) >= 0x7A) {
|
|
||||||
// 0xFF-FA and 0x7F-7A is not scancode
|
|
||||||
xprintf("Error: %02X\n", code);
|
|
||||||
matrix_clear();
|
|
||||||
return 0;
|
|
||||||
} else if (code&0x80) {
|
|
||||||
dprintf("%02X\n", code);
|
|
||||||
matrix_make(code);
|
|
||||||
} else {
|
|
||||||
dprintf("%02X\n", code);
|
|
||||||
matrix_break(code);
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return (matrix[row] & (1<<col));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_get_row(uint8_t row)
|
|
||||||
{
|
|
||||||
return matrix[row];
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_print(void)
|
|
||||||
{
|
|
||||||
print("\nr/c 01234567\n");
|
|
||||||
for (uint8_t row = 0; row < matrix_rows(); row++) {
|
|
||||||
xprintf("%02X: %08b\n", row, bitrev(matrix_get_row(row)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void matrix_make(uint8_t code)
|
|
||||||
{
|
|
||||||
matrix[ROW(code)] |= 1<<COL(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void matrix_break(uint8_t code)
|
|
||||||
{
|
|
||||||
matrix[ROW(code)] &= ~(1<<COL(code));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void matrix_clear(void)
|
|
||||||
{
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = m0110_lufa
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = matrix.c \
|
|
||||||
led.c \
|
|
||||||
keymap_common.c \
|
|
||||||
m0110.c
|
|
||||||
|
|
||||||
# To use own keymap file run make like: make keymap=hasu
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC += keymap_$(KEYMAP).c
|
|
||||||
else
|
|
||||||
SRC += keymap_default.c
|
|
||||||
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 = atmega32u2 # TMK converter rev2
|
|
||||||
#MCU = atmega32u4 # TMK converter rev1
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in bytes
|
|
||||||
# Teensy halfKay 512
|
|
||||||
# Atmel DFU loader 4096
|
|
||||||
# LUFA bootloader 4096
|
|
||||||
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 - not yet supported in LUFA
|
|
||||||
#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------- Programming Options --------------------------
|
|
||||||
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
|
|
||||||
|
|
||||||
|
|
||||||
# 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,98 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = m0110_lufa
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = matrix.c \
|
|
||||||
led.c \
|
|
||||||
keymap_common.c \
|
|
||||||
m0110.c
|
|
||||||
|
|
||||||
# To use own keymap file run make like: make keymap=hasu
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC += keymap_$(KEYMAP).c
|
|
||||||
else
|
|
||||||
SRC += keymap_default.c
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in bytes
|
|
||||||
# Teensy halfKay 512
|
|
||||||
# Atmel DFU loader 4096
|
|
||||||
# LUFA bootloader 4096
|
|
||||||
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 - not yet supported in LUFA
|
|
||||||
#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------- Programming Options --------------------------
|
|
||||||
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
|
|
||||||
|
|
||||||
|
|
||||||
# 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,96 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = m0110_lufa
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = matrix.c \
|
|
||||||
led.c \
|
|
||||||
keymap_common.c \
|
|
||||||
m0110.c
|
|
||||||
|
|
||||||
# To use own keymap file run make like: make keymap=hasu
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC += keymap_$(KEYMAP).c
|
|
||||||
else
|
|
||||||
SRC += keymap_default.c
|
|
||||||
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 = atmega32u2 # TMK converter rev2
|
|
||||||
MCU = atmega32u4 # TMK converter rev1
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in bytes
|
|
||||||
# Teensy halfKay 512
|
|
||||||
# Atmel DFU loader 4096
|
|
||||||
# LUFA bootloader 4096
|
|
||||||
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 - not yet supported in LUFA
|
|
||||||
#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------- Programming Options --------------------------
|
|
||||||
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
|
|
||||||
|
|
||||||
|
|
||||||
# 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,96 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = m0110_lufa
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = matrix.c \
|
|
||||||
led.c \
|
|
||||||
keymap_common.c \
|
|
||||||
m0110.c
|
|
||||||
|
|
||||||
# To use own keymap file run make like: make keymap=hasu
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC += keymap_$(KEYMAP).c
|
|
||||||
else
|
|
||||||
SRC += keymap_default.c
|
|
||||||
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 = atmega32u2 # TMK converter rev2
|
|
||||||
#MCU = atmega32u4 # TMK converter rev1
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in bytes
|
|
||||||
# Teensy halfKay 512
|
|
||||||
# Atmel DFU loader 4096
|
|
||||||
# LUFA bootloader 4096
|
|
||||||
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 - not yet supported in LUFA
|
|
||||||
#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------- Programming Options --------------------------
|
|
||||||
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
|
|
||||||
|
|
||||||
|
|
||||||
# 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,79 +0,0 @@
|
|||||||
M0110/M0110A to USB keyboard converter
|
|
||||||
======================================
|
|
||||||
This 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.
|
|
||||||
|
|
||||||
Read README of top directory too.
|
|
||||||
|
|
||||||
Pictures of **M0110 + M0120** and **M0110A**.
|
|
||||||
|
|
||||||
![M0110+M0120](http://i.imgur.com/dyvXb2Tm.jpg)
|
|
||||||
![M0110A](http://i.imgur.com/HuHOEoHm.jpg)
|
|
||||||
|
|
||||||
|
|
||||||
- M0110A support was contributed by [skagon@github](https://github.com/skagon).
|
|
||||||
- M0120 also is supported. keys(+ * / and ,) on M0120 are recognized as cursor keys.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Update
|
|
||||||
------
|
|
||||||
- 2013/08: Change port for signals `PF` to `PD`
|
|
||||||
- 2013/09: Change port again, it uses inversely `PD0` for data and `PD1` for clock line now.
|
|
||||||
- 2014/06: Change keymaps
|
|
||||||
- 2015/03: Add support for "International"(ISO) keyboard(keymap_intl.c)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Building Hardware
|
|
||||||
-----------------
|
|
||||||
You 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`.
|
|
||||||
|
|
||||||
[![M0110 Converter](http://i.imgur.com/4G2ZOegm.jpg)](http://i.imgur.com/4G2ZOeg.jpg)
|
|
||||||
|
|
||||||
### 4P4C phone handset cable
|
|
||||||
Note that original cable used with Mac is **straight** while phone handset cable is **crossover**.
|
|
||||||
|
|
||||||
<http://en.wikipedia.org/wiki/Modular_connector#4P4C>
|
|
||||||
|
|
||||||
Close-up picture of handset cable. You can see one end of plug has reverse color codes against the other. Click to enlarge.
|
|
||||||
[![4P4C cable](http://i.imgur.com/3S9P1mYm.jpg?1)](http://i.imgur.com/3S9P1mY.jpg?1)
|
|
||||||
|
|
||||||
[Teensy]: http://www.pjrc.com/teensy/
|
|
||||||
[TMK converter]: https://github.com/tmk/keyboard_converter
|
|
||||||
|
|
||||||
|
|
||||||
### Socket Pinout
|
|
||||||
- <http://pinouts.ru/Inputs/MacKeyboard_pinout.shtml>
|
|
||||||
|
|
||||||
![Jack fig](http://www.kbdbabel.org/conn/kbd_connector_macplus.png)
|
|
||||||
|
|
||||||
|
|
||||||
### Pull-up Resistor
|
|
||||||
You 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Building Firmware
|
|
||||||
-----------------
|
|
||||||
To 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.
|
|
||||||
|
|
||||||
$ git clone git://github.com/tmk/tmk_keyboard.git (or download source)
|
|
||||||
$ cd m0110_usb
|
|
||||||
$ make -f Makefile.rev2 clean
|
|
||||||
$ make -f Makefile.rev2 [KEYMAP={default|intl|spacefn|hasu}]
|
|
||||||
|
|
||||||
Use `Maefile.tmk_rev1` for TMK converter Rev.1, `Makefile.teensy` for Teensy instead.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Keymap
|
|
||||||
------
|
|
||||||
To create your own keymap copy existent keymap file to `keymap_name.c` and edit it.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Debug
|
|
||||||
-----
|
|
||||||
You 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.
|
|
||||||
|
|
||||||
- Magic combo: `Shift+Option+⌘` or `Shift+Option+Ctrl`(`Shift+Alt+Gui` or `Shift+Alt+Control`)
|
|
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x0110
|
|
||||||
#define DEVICE_VER 0x0101
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT M0110 keyboard converter
|
|
||||||
#define DESCRIPTION convert M0110 keyboard to USB
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 14
|
|
||||||
#define MATRIX_COLS 8
|
|
||||||
|
|
||||||
|
|
||||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
|
||||||
#define LOCKING_SUPPORT_ENABLE
|
|
||||||
/* Locking resynchronize hack */
|
|
||||||
#define LOCKING_RESYNC_ENABLE
|
|
||||||
|
|
||||||
|
|
||||||
/* magic key */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) || \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LCTL)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* boot magic key */
|
|
||||||
#define BOOTMAGIC_KEY_SALT KC_FN0
|
|
||||||
#define BOOTMAGIC_KEY_CAPSLOCK_TO_CONTROL KC_LCAP
|
|
||||||
|
|
||||||
|
|
||||||
/* ports */
|
|
||||||
#define M0110_CLOCK_PORT PORTD
|
|
||||||
#define M0110_CLOCK_PIN PIND
|
|
||||||
#define M0110_CLOCK_DDR DDRD
|
|
||||||
#define M0110_CLOCK_BIT 1
|
|
||||||
#define M0110_DATA_PORT PORTD
|
|
||||||
#define M0110_DATA_PIN PIND
|
|
||||||
#define M0110_DATA_DDR DDRD
|
|
||||||
#define M0110_DATA_BIT 0
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2014 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "action.h"
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translates Fn index to action */
|
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
|
||||||
{
|
|
||||||
action_t action;
|
|
||||||
action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
|
|
||||||
return action;
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2014,2015 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
|
||||||
extern const uint16_t fn_actions[];
|
|
||||||
|
|
||||||
|
|
||||||
/* Common layout for M0110 and M0110A
|
|
||||||
* This keymap works with both keyboards. As you can see, the M0110A is
|
|
||||||
* a superset of M0110 keyboard, only one exception is 'Enter'(34) of M0110
|
|
||||||
* does not exist on the M0110A.
|
|
||||||
*
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Clr| =| /| *|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
|
|
||||||
* |-----------------------------------------------------' | |---------------|
|
|
||||||
* |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
|
|
||||||
* |---------------------------------------------------------| |-----------|Ent|
|
|
||||||
* |Opt |Mac | Space |Ent| \|Lft|Rgt|Dn | | 0| .| |
|
|
||||||
* `---------------------------------------------------------' `---------------'
|
|
||||||
*
|
|
||||||
* M0110A scan codes
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| | | 59| 5B| 5C| 4E|
|
|
||||||
* |-----------------------------------------------------' | |---------------|
|
|
||||||
* | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 66|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| 4D| | 53| 54| 55| |
|
|
||||||
* `---------------------------------------------------------' |-----------| 4C|
|
|
||||||
* | 3A| 37| 31 | 2A| 46| 42| 48| | 52| 41| |
|
|
||||||
* `---------------------------------------------------------' `---------------'
|
|
||||||
*
|
|
||||||
* M0110 + M0120 scan codes
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4E|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | 56| 57| 58| 66|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 38| | 53| 54| 55| |
|
|
||||||
* `---------------------------------------------------------' |-----------| 4C|
|
|
||||||
* | 3A| 37| 31 | 34| 3A| | 52| 41| |
|
|
||||||
* `------------------------------------------------' `---------------'
|
|
||||||
* Two right and left keys of 38 and 3A are identical, you cannot discriminate those two.
|
|
||||||
*/
|
|
||||||
#define KEYMAP( \
|
|
||||||
K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \
|
|
||||||
K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E, K59,K5B,K5C,K4E, \
|
|
||||||
K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27, K24, K56,K57,K58,K66, \
|
|
||||||
K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C, K4D, K53,K54,K55,K4C, \
|
|
||||||
K3A,K37, K31, K34,K2A,K46,K42,K48, K52, K41 \
|
|
||||||
) { \
|
|
||||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
|
|
||||||
{ KC_##K08, KC_##K09, KC_NO, 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_##K34, KC_NO, KC_NO, KC_##K37 }, \
|
|
||||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_NO, KC_##K46, KC_##K47 }, \
|
|
||||||
{ KC_##K48, KC_NO, KC_NO, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, 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_##K62, KC_NO, KC_NO, KC_NO, KC_##K66, KC_NO }, \
|
|
||||||
{ KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* International keyboard layout for M0110 + M0120
|
|
||||||
* https://en.wikipedia.org/wiki/File:Apple_Macintosh_Plus_Keyboard.jpg
|
|
||||||
* Probably International keyboard layout of M0110A doesn't exist.
|
|
||||||
*
|
|
||||||
* M0110 + M0120 scan codes
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* | 32| 12| 13| 14| 15| 17| 16| 1A| 1C| 19| 1D| 1B| 18| 33| | 47| 68| 6D| 62|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* | 30| 0C| 0D| 0E| 0F| 10| 11| 20| 22| 1F| 23| 21| 1E| 2A| | 59| 5B| 5C| 4E|
|
|
||||||
* |------------------------------------------------------, | |---------------|
|
|
||||||
* | 39| 00| 01| 02| 03| 05| 04| 26| 28| 25| 29| 27| 24| | | 56| 57| 58| 66|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* | 38| 06| 07| 08| 09| 0B| 2D| 2E| 2B| 2F| 2C| 0A| 38| | 53| 54| 55| |
|
|
||||||
* `---------------------------------------------------------' |-----------| 4C|
|
|
||||||
* | 3A| 37| 34 | 31| 3A| | 52| 41| |
|
|
||||||
* `------------------------------------------------' `---------------'
|
|
||||||
* Two right and left keys of 38 and 3A are identical, you cannot discriminate those two.
|
|
||||||
*/
|
|
||||||
#define KEYMAP_INTL( \
|
|
||||||
K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K68,K6D,K62, \
|
|
||||||
K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K59,K5B,K5C,K4E, \
|
|
||||||
K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K24, K56,K57,K58,K66, \
|
|
||||||
K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,K0A, K53,K54,K55,K4C, \
|
|
||||||
K3A,K37, K34, K31, K52, K41 \
|
|
||||||
) { \
|
|
||||||
{ 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_##K34, KC_NO, KC_NO, KC_##K37 }, \
|
|
||||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_##K41, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K47 }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_##K4C, KC_NO, KC_##K4E, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, 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_##K62, KC_NO, KC_NO, KC_NO, KC_##K66, KC_NO }, \
|
|
||||||
{ KC_##K68, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K6D, KC_NO, KC_NO }, \
|
|
||||||
}
|
|
@ -1,137 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2015 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef KEYMAP_SECTION_ENABLE
|
|
||||||
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
|
|
||||||
#else
|
|
||||||
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
|
||||||
#endif
|
|
||||||
/* Default:
|
|
||||||
* M0110 M0120
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| =| /| *|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |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|
|
|
||||||
* |Opt|Mac | Space |Fn |Opt| | 0| .| |
|
|
||||||
* `-----------------------------------------------' `---------------'
|
|
||||||
* M0110A
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| =| /| *|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |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| ,| ,| /|Shft|Up | | 1| 2| 3| |
|
|
||||||
* |---------------------------------------------------------| |-----------|Ent|
|
|
||||||
* |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| |
|
|
||||||
* `---------------------------------------------------------' `---------------'
|
|
||||||
*/
|
|
||||||
[0] = KEYMAP(
|
|
||||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST,
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
|
|
||||||
LCTL,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, UP, P1, P2, P3, PENT,
|
|
||||||
LALT,LGUI, SPC, FN0, FN13,LEFT,RGHT,DOWN, P0, PDOT
|
|
||||||
),
|
|
||||||
/* Cursor Layer:
|
|
||||||
* M0110 M0120
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |INS| | | 7| 8| 9| -|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| +|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Shift |End| |PgD| | | | |End|PgD|Dow|Shift | | 1| 2| 3| |
|
|
||||||
* `---------------------------------------------------------' |-----------|Ent|
|
|
||||||
* |Opt|Mac | Space |Fn |Opt| | 0| .| |
|
|
||||||
* `-----------------------------------------------' `---------------'
|
|
||||||
* M0110A
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |INS| | | 7| 8| 9| -|
|
|
||||||
* |-----------------------------------------------------' | |---------------|
|
|
||||||
* |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| +|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Shift |End| |PgD| | | | |End|PgD|Dow|Shft|PgU| | 1| 2| 3| |
|
|
||||||
* |---------------------------------------------------------| |-----------|Ent|
|
|
||||||
* |Opt |Mac | Space | \|Hom|End|PgD| | 0| .| |
|
|
||||||
* `---------------------------------------------------------' `---------------'
|
|
||||||
*/
|
|
||||||
[1] = KEYMAP(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
|
|
||||||
CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, INS, P7, P8, P9, PMNS,
|
|
||||||
LCTL,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT, P4, P5, P6, PPLS,
|
|
||||||
LSFT,END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, PGUP, P1, P2, P3, PENT,
|
|
||||||
LALT,LGUI, SPC, FN0, FN13,HOME,END, PGDN, P0, PDOT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fn action definition
|
|
||||||
*/
|
|
||||||
#ifdef KEYMAP_SECTION_ENABLE
|
|
||||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
|
|
||||||
#else
|
|
||||||
const uint16_t fn_actions[] PROGMEM = {
|
|
||||||
#endif
|
|
||||||
[0] = ACTION_LAYER_MOMENTARY(1),
|
|
||||||
[1] = ACTION_LAYER_MOMENTARY(2),
|
|
||||||
[2] = ACTION_LAYER_MOMENTARY(3),
|
|
||||||
[3] = ACTION_LAYER_MOMENTARY(4),
|
|
||||||
[4] = ACTION_LAYER_MOMENTARY(5),
|
|
||||||
[5] = ACTION_LAYER_MOMENTARY(6),
|
|
||||||
[6] = ACTION_LAYER_MOMENTARY(7),
|
|
||||||
[7] = ACTION_LAYER_TOGGLE(1),
|
|
||||||
[8] = ACTION_LAYER_TOGGLE(2),
|
|
||||||
[9] = ACTION_LAYER_TOGGLE(3),
|
|
||||||
[10] = ACTION_LAYER_TAP_TOGGLE(1),
|
|
||||||
[11] = ACTION_LAYER_TAP_TOGGLE(2),
|
|
||||||
[12] = ACTION_LAYER_TAP_TOGGLE(3),
|
|
||||||
[13] = ACTION_LAYER_TAP_KEY(1, KC_BSLASH),
|
|
||||||
[14] = ACTION_LAYER_TAP_KEY(2, KC_TAB),
|
|
||||||
[15] = ACTION_LAYER_TAP_KEY(3, KC_ENTER),
|
|
||||||
[16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE),
|
|
||||||
[17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON),
|
|
||||||
[18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE),
|
|
||||||
[19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH),
|
|
||||||
[20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE),
|
|
||||||
[21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE),
|
|
||||||
[22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE),
|
|
||||||
[23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER),
|
|
||||||
[24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC),
|
|
||||||
[25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE),
|
|
||||||
[26] = ACTION_MODS_ONESHOT(MOD_LCTL),
|
|
||||||
[27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC),
|
|
||||||
[28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE),
|
|
||||||
[29] = ACTION_MODS_ONESHOT(MOD_LSFT),
|
|
||||||
[30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRAVE),
|
|
||||||
[31] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_BSLASH),
|
|
||||||
};
|
|
@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* Default:
|
|
||||||
* M0110
|
|
||||||
* ,---------------------------------------------------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs|
|
|
||||||
* |---------------------------------------------------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
|
|
||||||
* |---------------------------------------------------------|
|
|
||||||
* |Ctrl | A| S| D| F| G| H| J| K| L| Fn| '|Return|
|
|
||||||
* |---------------------------------------------------------|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| Fn|Shift |
|
|
||||||
* `---------------------------------------------------------'
|
|
||||||
* |Fn |alt | Fn |Gui |Fn |
|
|
||||||
* `-----------------------------------------------'
|
|
||||||
*/
|
|
||||||
[0] = KEYMAP(
|
|
||||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST,
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
|
|
||||||
LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT, ENT, P4, P5, P6, PPLS,
|
|
||||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN1, UP, P1, P2, P3, PENT,
|
|
||||||
FN0, LALT, FN2, LGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT
|
|
||||||
),
|
|
||||||
// IJKL cursor
|
|
||||||
[1] = KEYMAP(
|
|
||||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
|
|
||||||
CAPS,NO, NO, NO, NO, NO, HOME,PGDN,UP, PGUP,END, NO, NO, P7, P8, P9, PMNS,
|
|
||||||
LCTL,VOLD,VOLU,MUTE,NO, NO, HOME,LEFT,DOWN,RGHT,END, NO, ENT, P4, P5, P6, PPLS,
|
|
||||||
LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, PGUP, P1, P2, P3, PENT,
|
|
||||||
TRNS,LALT, SPC, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
|
|
||||||
),
|
|
||||||
// HJKL cursor
|
|
||||||
[2] = KEYMAP(
|
|
||||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
|
|
||||||
CAPS,NO, NO, NO, NO, NO, HOME,PGDN,UP, PGUP,END, NO, NO, P7, P8, P9, PMNS,
|
|
||||||
LCTL,VOLD,VOLU,MUTE,NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS,
|
|
||||||
LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, TRNS, PGUP, P1, P2, P3, PENT,
|
|
||||||
TRNS,LALT, SPC, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
|
|
||||||
),
|
|
||||||
// Mousekey
|
|
||||||
[3] = KEYMAP(
|
|
||||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
|
|
||||||
CAPS,Q, W, E, R, T, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD, P7, P8, P9, PMNS,
|
|
||||||
LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,BTN1,NO, ENT, P4, P5, P6, PPLS,
|
|
||||||
LSFT,Z, X, C, V, B, BTN2,BTN1,BTN4,BTN5,NO, PGUP, P1, P2, P3, PENT,
|
|
||||||
NO, LALT, TRNS, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
|
|
||||||
),
|
|
||||||
// Mousekey
|
|
||||||
[4] = KEYMAP(
|
|
||||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
|
|
||||||
CAPS,Q, W, E, R, T, WH_L,WH_D,MS_U,WH_U,WH_R,WBAK,WFWD, P7, P8, P9, PMNS,
|
|
||||||
LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,TRNS,NO, ENT, P4, P5, P6, PPLS,
|
|
||||||
LSFT,Z, X, C, V, B, BTN2,BTN1,BTN4,BTN5,NO, PGUP, P1, P2, P3, PENT,
|
|
||||||
NO, LALT, BTN1, LGUI,BSLS,HOME,END, PGDN, P0, PDOT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fn action definition
|
|
||||||
*/
|
|
||||||
const uint16_t fn_actions[] PROGMEM = {
|
|
||||||
[0] = ACTION_LAYER_MOMENTARY(1),
|
|
||||||
[1] = ACTION_LAYER_TAP_KEY(2, KC_SLASH),
|
|
||||||
[2] = ACTION_LAYER_TAP_KEY(3, KC_SPACE),
|
|
||||||
[3] = ACTION_LAYER_TAP_KEY(4, KC_SCOLON),
|
|
||||||
};
|
|
@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2015 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
|
||||||
/* International keyboard
|
|
||||||
* M0110 M0120
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Ret| | 7| 8| 9| /|
|
|
||||||
* |------------------------------------------------------, | |---------------|
|
|
||||||
* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| \| | | 4| 5| 6| ,|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Shif| <| Z| X| C| V| B| N| M| ,| ,| /| | | 1| 2| 3| |
|
|
||||||
* `---------------------------------------------------------' |-----------|Ent|
|
|
||||||
* |Opt|Mac | Space |Fn | | | 0| .| |
|
|
||||||
* `-----------------------------------------------' `---------------'
|
|
||||||
*/
|
|
||||||
[0] = KEYMAP_INTL(
|
|
||||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,EQL, PSLS,PAST,
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, P7, P8, P9, PMNS,
|
|
||||||
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, P4, P5, P6, PPLS,
|
|
||||||
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, P1, P2, P3, PENT,
|
|
||||||
LALT,LGUI, SPC, FN0, P0, PDOT
|
|
||||||
),
|
|
||||||
/* Cursor Layer
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| -| +| *|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up | |Ret| | 7| 8| 9| /|
|
|
||||||
* |------------------------------------------------------, | |---------------|
|
|
||||||
* |Ctrl |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Ins| | | 4| 5| 6| ,|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Shif| <|End| |PgD| | | | |End|PgD|Dow| | | 1| 2| 3| |
|
|
||||||
* `---------------------------------------------------------' |-----------|Ent|
|
|
||||||
* |Opt|Mac | Space |Fn | | | 0| .| |
|
|
||||||
* `-----------------------------------------------' `---------------'
|
|
||||||
*/
|
|
||||||
[1] = KEYMAP_INTL(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
|
|
||||||
CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, ENT, P7, P8, P9, PMNS,
|
|
||||||
LCTL,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT,INS, P4, P5, P6, PPLS,
|
|
||||||
LSFT,NO, END, NO, PGDN,NO, NO, NO, NO, END, PGDN,DOWN, P1, P2, P3, PENT,
|
|
||||||
LALT,LGUI, SPC, FN0, P0, PDOT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fn action definition
|
|
||||||
*/
|
|
||||||
const uint16_t fn_actions[] PROGMEM = {
|
|
||||||
[0] = ACTION_LAYER_MOMENTARY(1),
|
|
||||||
};
|
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2014 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* Default:
|
|
||||||
* M0110 M0120
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backs| |Nlk| -| +| *|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |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|
|
|
||||||
* |Opt|Mac | Space |Mac |Opt| | 0| .| |
|
|
||||||
* `-----------------------------------------------' `---------------'
|
|
||||||
* M0110A
|
|
||||||
* ,---------------------------------------------------------. ,---------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bcksp| |Nlk| =| /| *|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7| 8| 9| -|
|
|
||||||
* |-----------------------------------------------------' | |---------------|
|
|
||||||
* |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return| | 4| 5| 6| +|
|
|
||||||
* |---------------------------------------------------------| |---------------|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shft|Up | | 1| 2| 3| |
|
|
||||||
* |---------------------------------------------------------' |-----------|Ent|
|
|
||||||
* |Opt |Mac | Space | \|Lft|Rgt|Dn | | 0| .| |
|
|
||||||
* `---------------------------------------------------------' `---------------'
|
|
||||||
*/
|
|
||||||
[0] = KEYMAP(
|
|
||||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, NLCK,PEQL,PSLS,PAST,
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS,
|
|
||||||
LCTL,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, UP, P1, P2, P3, PENT,
|
|
||||||
LALT,LGUI, FN0, RGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT
|
|
||||||
),
|
|
||||||
[1] = KEYMAP(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST,
|
|
||||||
TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS, P7, P8, P9, PMNS,
|
|
||||||
LCTL,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
|
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, PGUP, P1, P2, P3, PENT,
|
|
||||||
TRNS,TRNS, TRNS, TRNS,INS, HOME,END, PGDN, P0, PDOT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fn action definition
|
|
||||||
*/
|
|
||||||
const uint16_t fn_actions[] PROGMEM = {
|
|
||||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
|
|
||||||
[1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
|
|
||||||
};
|
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
|
||||||
{
|
|
||||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
|
|
||||||
DDRD |= (1<<6);
|
|
||||||
PORTD |= (1<<6);
|
|
||||||
} else {
|
|
||||||
DDRD |= (1<<6);
|
|
||||||
PORTD &= ~(1<<6);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,142 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* scan matrix
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
#include "print.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "host.h"
|
|
||||||
#include "led.h"
|
|
||||||
#include "m0110.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define CAPS 0x39
|
|
||||||
#define CAPS_BREAK (CAPS | 0x80)
|
|
||||||
#define ROW(key) ((key)>>3&0x0F)
|
|
||||||
#define COL(key) ((key)&0x07)
|
|
||||||
|
|
||||||
|
|
||||||
static bool is_modified = false;
|
|
||||||
|
|
||||||
// matrix state buffer(1:on, 0:off)
|
|
||||||
static uint8_t *matrix;
|
|
||||||
static uint8_t _matrix0[MATRIX_ROWS];
|
|
||||||
|
|
||||||
static void register_key(uint8_t key);
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_rows(void)
|
|
||||||
{
|
|
||||||
return MATRIX_ROWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_cols(void)
|
|
||||||
{
|
|
||||||
return MATRIX_COLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init(void)
|
|
||||||
{
|
|
||||||
m0110_init();
|
|
||||||
// initialize matrix state: all keys off
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00;
|
|
||||||
matrix = _matrix0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
|
||||||
{
|
|
||||||
uint8_t key;
|
|
||||||
|
|
||||||
is_modified = false;
|
|
||||||
key = m0110_recv_key();
|
|
||||||
|
|
||||||
if (key == M0110_NULL) {
|
|
||||||
return 0;
|
|
||||||
} else if (key == M0110_ERROR) {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
is_modified = true;
|
|
||||||
register_key(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debug_enable) {
|
|
||||||
print("["); phex(key); print("]\n");
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool matrix_is_modified(void)
|
|
||||||
{
|
|
||||||
return is_modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_has_ghost(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return (matrix[row] & (1<<col));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_get_row(uint8_t row)
|
|
||||||
{
|
|
||||||
return matrix[row];
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_print(void)
|
|
||||||
{
|
|
||||||
print("\nr/c 01234567\n");
|
|
||||||
for (uint8_t row = 0; row < matrix_rows(); row++) {
|
|
||||||
phex(row); print(": ");
|
|
||||||
pbin_reverse(matrix_get_row(row));
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_key_count(void)
|
|
||||||
{
|
|
||||||
uint8_t count = 0;
|
|
||||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
||||||
count += bitpop(matrix[i]);
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void register_key(uint8_t key)
|
|
||||||
{
|
|
||||||
if (key&0x80) {
|
|
||||||
matrix[ROW(key)] &= ~(1<<COL(key));
|
|
||||||
} else {
|
|
||||||
matrix[ROW(key)] |= (1<<COL(key));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile for PJRC Teensy
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
# Target file name (without extension).
|
|
||||||
TARGET = news_usb_pjrc
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = keymap.c \
|
|
||||||
matrix.c \
|
|
||||||
led.c \
|
|
||||||
news.c
|
|
||||||
|
|
||||||
CONFIG_H = config_pjrc.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)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------- Programming Options --------------------------
|
|
||||||
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x5021
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT SONY NEWS keyboard converter
|
|
||||||
#define DESCRIPTION converts SONY NEWS protocol into USB
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 16 // keycode bit: 3-0
|
|
||||||
#define MATRIX_COLS 8 // keycode bit: 6-4
|
|
||||||
|
|
||||||
|
|
||||||
/* legacy keymap support */
|
|
||||||
#define USE_LEGACY_KEYMAP
|
|
||||||
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
/* Asynchronous USART
|
|
||||||
* 8-data bit, non parity, 1-stop bit, no flow control
|
|
||||||
*/
|
|
||||||
#ifdef __AVR_ATmega32U4__
|
|
||||||
# define NEWS_KBD_RX_VECT USART1_RX_vect
|
|
||||||
# define NEWS_KBD_RX_DATA UDR1
|
|
||||||
# define NEWS_KBD_RX_BAUD 9600
|
|
||||||
# define NEWS_KBD_RX_UBBR ((F_CPU/(16UL*NEWS_KBD_RX_BAUD))-1)
|
|
||||||
# define NEWS_KBD_RX_INIT() do { \
|
|
||||||
UBRR1L = (uint8_t) NEWS_KBD_RX_UBBR; \
|
|
||||||
UBRR1H = (uint8_t) (NEWS_KBD_RX_UBBR>>8); \
|
|
||||||
UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); \
|
|
||||||
} while(0)
|
|
||||||
#else
|
|
||||||
# error "USART configuration is needed."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,125 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Following macros help you to define a keymap with the form of actual keyboard layout.
|
|
||||||
|
|
||||||
/* SONY NEWS NWP-5461 */
|
|
||||||
#define KEYMAP( \
|
|
||||||
K7A, K01,K02,K03,K04,K05, K06,K07,K08,K09,K0A, K68,K69, K64,K65,K52, \
|
|
||||||
K0B,K0C,K0D,K0E,K0F,K10,K11,K12,K13,K14,K15,K16,K17,K18,K19, K6A, K4B,K4C,K4D,K4E, \
|
|
||||||
K1A,K1B,K1C,K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27, K6B, K4F,K50,K51,K56, \
|
|
||||||
K28,K29,K2A,K2B,K2C,K2D,K2E,K2F,K30,K31,K32,K33,K34, K35, K6C, K53,K54,K55,K5A, \
|
|
||||||
K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K42, K6D, K57,K59,K58, \
|
|
||||||
K43,K44,K45, K46, K47, K48,K49,K4A, K6E, K66,K5B,K5C,K5D \
|
|
||||||
) { \
|
|
||||||
{ KC_NO, 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_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
|
|
||||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
|
|
||||||
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
|
|
||||||
{ KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
|
|
||||||
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
|
|
||||||
{ KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_##K64, KC_##K65, KC_##K66, KC_NO }, \
|
|
||||||
{ KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
{ KC_NO, KC_NO, KC_##K7A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
|
|
||||||
static const uint8_t PROGMEM fn_layer[] = {
|
|
||||||
0, // Fn0
|
|
||||||
0, // Fn1
|
|
||||||
0, // Fn2
|
|
||||||
0, // Fn3
|
|
||||||
0, // Fn4
|
|
||||||
0, // Fn5
|
|
||||||
0, // Fn6
|
|
||||||
0 // Fn7
|
|
||||||
};
|
|
||||||
|
|
||||||
// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
|
|
||||||
// See layer.c for details.
|
|
||||||
static const uint8_t PROGMEM fn_keycode[] = {
|
|
||||||
KC_NO, // Fn0
|
|
||||||
KC_NO, // Fn1
|
|
||||||
KC_NO, // Fn2
|
|
||||||
KC_NO, // Fn3
|
|
||||||
KC_NO, // Fn4
|
|
||||||
KC_NO, // Fn5
|
|
||||||
KC_NO, // Fn6
|
|
||||||
KC_NO // Fn7
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* 0: default
|
|
||||||
* ,---. ,------------------------, ,------------------------. ,---------.
|
|
||||||
* |Pow| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| ,-----------.
|
|
||||||
* `---' `------------------------' `------------------------' `---------' | *| /| +|
|
|
||||||
* ,-------------------------------------------------------------. ,---. ,---------------|
|
|
||||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| BS | |Hlp| | 7| 8| 9| -|
|
|
||||||
* |-------------------------------------------------------------| |---| |---------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Del| | |Ins| | 4| 5| 6| ,|
|
|
||||||
* |---------------------------------------------------------' | |---| |---------------|
|
|
||||||
* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| `|Return| |Clr| | 1| 2| 3| |
|
|
||||||
* |-------------------------------------------------------------| |---| |-----------|Ent|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /| |Shift | |PgU| | 0| .| Up| |
|
|
||||||
* |-------------------------------------------------------------| |---| |---------------|
|
|
||||||
* |Alt |Gui |Alt | Space | |Gui|App|Ctrl | |PgD| |Tab|Lef|Dow|Rig|
|
|
||||||
* `-------------------------------------------------------------' `---' `---------------'
|
|
||||||
*/
|
|
||||||
KEYMAP(
|
|
||||||
PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PAST,PSLS,PPLS,
|
|
||||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, HELP, P7, P8, P9, PMNS,
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,DEL, INS, P4, P5, P6, PCMM,
|
|
||||||
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,GRV, ENT, CLR, P1, P2, P3, PENT,
|
|
||||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, RSFT, PGUP, P0, PDOT,UP,
|
|
||||||
LALT,CAPS,LALT, SPC, ERAS, RALT,RGUI,RCTL, PGDN, TAB, LEFT,DOWN,RGHT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&keymaps[(layer)][(row)][(col)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t keymap_fn_layer(uint8_t index)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&fn_layer[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t keymap_fn_keycode(uint8_t index)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&fn_keycode[index]);
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
#include "news.h"
|
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
|
||||||
{
|
|
||||||
// not supported now
|
|
||||||
}
|
|
@ -1,142 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
#include "print.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "news.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
#include "debug.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Matrix Array usage:
|
|
||||||
*
|
|
||||||
* ROW: 16
|
|
||||||
* COL:8
|
|
||||||
*
|
|
||||||
* 8bit wide
|
|
||||||
* +---------+
|
|
||||||
* 0|00 ... 07|
|
|
||||||
* 1|08 ... 0F|
|
|
||||||
* :| ... |
|
|
||||||
* :| ... |
|
|
||||||
* E|70 ... 77|
|
|
||||||
* F|78 ... 7F|
|
|
||||||
* +---------+
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static uint8_t matrix[MATRIX_ROWS];
|
|
||||||
#define ROW(code) ((code>>3)&0xF)
|
|
||||||
#define COL(code) (code&0x07)
|
|
||||||
|
|
||||||
static bool is_modified = false;
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_rows(void)
|
|
||||||
{
|
|
||||||
return MATRIX_ROWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_cols(void)
|
|
||||||
{
|
|
||||||
return MATRIX_COLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init(void)
|
|
||||||
{
|
|
||||||
news_init();
|
|
||||||
|
|
||||||
// initialize matrix state: all keys off
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
|
||||||
{
|
|
||||||
is_modified = false;
|
|
||||||
|
|
||||||
uint8_t code;
|
|
||||||
code = news_recv();
|
|
||||||
if (code == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
phex(code); print(" ");
|
|
||||||
if (code&0x80) {
|
|
||||||
// break code
|
|
||||||
if (matrix_is_on(ROW(code), COL(code))) {
|
|
||||||
matrix[ROW(code)] &= ~(1<<COL(code));
|
|
||||||
is_modified = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// make code
|
|
||||||
if (!matrix_is_on(ROW(code), COL(code))) {
|
|
||||||
matrix[ROW(code)] |= (1<<COL(code));
|
|
||||||
is_modified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool matrix_is_modified(void)
|
|
||||||
{
|
|
||||||
return is_modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_has_ghost(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return (matrix[row] & (1<<col));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_get_row(uint8_t row)
|
|
||||||
{
|
|
||||||
return matrix[row];
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_print(void)
|
|
||||||
{
|
|
||||||
print("\nr/c 01234567\n");
|
|
||||||
for (uint8_t row = 0; row < matrix_rows(); row++) {
|
|
||||||
phex(row); print(": ");
|
|
||||||
pbin_reverse(matrix_get_row(row));
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_key_count(void)
|
|
||||||
{
|
|
||||||
uint8_t count = 0;
|
|
||||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
||||||
count += bitpop(matrix[i]);
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
@ -1,87 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = next_usb
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = keymap.c \
|
|
||||||
matrix.c \
|
|
||||||
led.c
|
|
||||||
|
|
||||||
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
|
|
||||||
MCU = atmega32u2 # TMK converter
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# 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
|
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
|
||||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
|
||||||
|
|
||||||
SRC += next_kbd.c
|
|
||||||
|
|
||||||
|
|
||||||
# Search Path
|
|
||||||
VPATH += $(TARGET_DIR)
|
|
||||||
VPATH += $(TMK_DIR)
|
|
||||||
|
|
||||||
|
|
||||||
include $(TMK_DIR)/protocol.mk
|
|
||||||
include $(TMK_DIR)/protocol/lufa.mk
|
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
@ -1,63 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = next_usb
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = keymap.c \
|
|
||||||
matrix.c \
|
|
||||||
led.c
|
|
||||||
|
|
||||||
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
|
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
|
||||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
|
||||||
|
|
||||||
SRC += next_kbd.c
|
|
||||||
|
|
||||||
|
|
||||||
# Search Path
|
|
||||||
VPATH += $(TARGET_DIR)
|
|
||||||
VPATH += $(TMK_DIR)
|
|
||||||
|
|
||||||
|
|
||||||
include $(TMK_DIR)/protocol.mk
|
|
||||||
include $(TMK_DIR)/protocol/pjrc.mk
|
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
@ -1,45 +0,0 @@
|
|||||||
NeXT non-ADB Keyboard Converter
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
Cable connector inside keyboard case:
|
|
||||||
+-----+
|
|
||||||
|Black|\
|
|
||||||
|Green|-\
|
|
||||||
|Yello|--\-------- to computer via Mini-Din 5a Connector
|
|
||||||
|Orang|--/--------
|
|
||||||
|Red |-/
|
|
||||||
|Brown|/
|
|
||||||
+-----+
|
|
||||||
|
|
||||||
Black - Ground to outer metal part of Mini Din 5a connector (not used)
|
|
||||||
Green - Ground
|
|
||||||
Yellow - Power button signal
|
|
||||||
Orange - Keyboard Out
|
|
||||||
Red - Keyboard In
|
|
||||||
Brown - Vcc
|
|
||||||
|
|
||||||
ATmega32u4 connections (pinout provided for Arduino Pro Micro):
|
|
||||||
|
|
||||||
Keyboard out (orange) : PD0 (pin 3)
|
|
||||||
Keyboard in (red) : PD1 (pin 2)
|
|
||||||
Power Button (yellow) : PD4 (pin 4)
|
|
||||||
Ground (black) : GND
|
|
||||||
Vcc (brown) : VCC
|
|
||||||
|
|
||||||
See attached next_timings.jpg file for a detailed illustration of NeXT keyboard protocol timings.
|
|
||||||
|
|
||||||
Power 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.
|
|
||||||
|
|
||||||
Converter 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.
|
|
||||||
|
|
||||||
TODO:
|
|
||||||
-----
|
|
||||||
|
|
||||||
I 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
|
|
||||||
|
|
||||||
Utilize second LED as status indicator for good initialization; also try to make hot plugging much more robust.
|
|
||||||
|
|
||||||
Figure 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
|
|
||||||
|
|
||||||
Figure 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
|
|
||||||
|
|
@ -1,190 +0,0 @@
|
|||||||
/*
|
|
||||||
NeXT non-ADB Keyboard USB Converter
|
|
||||||
|
|
||||||
Copyright 2013, Benjamin Gould (bgould@github.com)
|
|
||||||
|
|
||||||
Based on:
|
|
||||||
TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
|
|
||||||
Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
|
|
||||||
|
|
||||||
Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
|
|
||||||
Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
|
|
||||||
Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
|
|
||||||
|
|
||||||
This software is licensed with a Modified BSD License.
|
|
||||||
All of this is supposed to be Free Software, Open Source, DFSG-free,
|
|
||||||
GPL-compatible, and OK to use in both free and proprietary applications.
|
|
||||||
Additions and corrections to this file are welcome.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in
|
|
||||||
the documentation and/or other materials provided with the
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
* Neither the name of the copyright holders nor the names of
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0xBCBC
|
|
||||||
#define DEVICE_VER 0x0500
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT NeXT Keyboard to USB converter
|
|
||||||
#define DESCRIPTION USB converter for NeXT non-ADB Keyboard
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 12 // keycode bit: 3-0
|
|
||||||
#define MATRIX_COLS 8 // keycode bit: 6-4
|
|
||||||
|
|
||||||
#define DEBUG_ON_INIT 1
|
|
||||||
|
|
||||||
//#define TEENSY_CONFIG 1
|
|
||||||
//#define PRO_MICRO_CONFIG 1
|
|
||||||
#define TMK_CONFIG 1
|
|
||||||
|
|
||||||
// comment out if you don't want the keyboard's LEDs to flash upon initialization or pressing shift
|
|
||||||
//#define NEXT_KBD_INIT_FLASH_LEDS
|
|
||||||
//#define NEXT_KBD_SHIFT_FLASH_LEDS
|
|
||||||
|
|
||||||
//============= Start of Arduino Pro Micro Configuration ==============
|
|
||||||
#ifdef PRO_MICRO_CONFIG
|
|
||||||
|
|
||||||
// this is the debugging LED that flashes when a key is being pressed
|
|
||||||
// comment out in order to disable debugging LED
|
|
||||||
#define NEXT_KBD_LED1_PORT PORTD
|
|
||||||
#define NEXT_KBD_LED1_PIN PIND
|
|
||||||
#define NEXT_KBD_LED1_DDR DDRD
|
|
||||||
#define NEXT_KBD_LED1_BIT 5
|
|
||||||
|
|
||||||
#define NEXT_KBD_LED1_ON NEXT_KBD_LED1_PORT &= ~(1<<NEXT_KBD_LED1_BIT);
|
|
||||||
#define NEXT_KBD_LED1_OFF NEXT_KBD_LED1_PORT |= (1<<NEXT_KBD_LED1_BIT);
|
|
||||||
|
|
||||||
// reserved for future use
|
|
||||||
#define NEXT_KBD_LED2_PORT PORTB
|
|
||||||
#define NEXT_KBD_LED2_PIN PINB
|
|
||||||
#define NEXT_KBD_LED2_DDR DDRB
|
|
||||||
#define NEXT_KBD_LED2_BIT 6
|
|
||||||
|
|
||||||
#define NEXT_KBD_LED2_ON NEXT_KBD_LED2_PORT &= ~(1<<NEXT_KBD_LED2_BIT);
|
|
||||||
#define NEXT_KBD_LED2_OFF NEXT_KBD_LED2_PORT |= (1<<NEXT_KBD_LED2_BIT);
|
|
||||||
|
|
||||||
// corresponds to the Keyboard In wire on the NeXT connector
|
|
||||||
// (red wire in NeXT connector) - pin 2 on the Pro Micro
|
|
||||||
#define NEXT_KBD_OUT_PORT PORTD
|
|
||||||
#define NEXT_KBD_OUT_PIN PIND
|
|
||||||
#define NEXT_KBD_OUT_DDR DDRD
|
|
||||||
#define NEXT_KBD_OUT_BIT 1
|
|
||||||
|
|
||||||
// corresponds to the Keyboard Out wire on the NeXT connector
|
|
||||||
// (orange wire in NeXT connector) - pin 3 on the Pro Micro
|
|
||||||
#define NEXT_KBD_IN_PORT PORTD
|
|
||||||
#define NEXT_KBD_IN_PIN PIND
|
|
||||||
#define NEXT_KBD_IN_DDR DDRD
|
|
||||||
#define NEXT_KBD_IN_BIT 0
|
|
||||||
|
|
||||||
// this pin is an input for the power key on the NeXT keyboard
|
|
||||||
// as the keyboard is powered on this should be normally high;
|
|
||||||
// if it is pulled low it means the power button is being preseed
|
|
||||||
// (yellow wire in NeXT connector) - pin 4 on the Pro Micro
|
|
||||||
#define NEXT_KBD_PWR_PORT PORTD
|
|
||||||
#define NEXT_KBD_PWR_PIN PIND
|
|
||||||
#define NEXT_KBD_PWR_DDR DDRD
|
|
||||||
#define NEXT_KBD_PWR_BIT 4
|
|
||||||
|
|
||||||
#endif
|
|
||||||
//============== End of Arduino Pro Micro Configuration ===============
|
|
||||||
|
|
||||||
|
|
||||||
//================ Start of Teensy 2.0 Configuration =================
|
|
||||||
#ifdef TEENSY_CONFIG
|
|
||||||
|
|
||||||
// this is the debugging LED that flashes when a key is being pressed
|
|
||||||
// comment out in order to disable debugging LED
|
|
||||||
#define NEXT_KBD_LED_PORT PORTD
|
|
||||||
#define NEXT_KBD_LED_PIN PIND
|
|
||||||
#define NEXT_KBD_LED_DDR DDRD
|
|
||||||
#define NEXT_KBD_LED_BIT 6
|
|
||||||
|
|
||||||
#define NEXT_KBD_LED_ON NEXT_KBD_LED_PORT |= (1<<NEXT_KBD_LED_BIT);
|
|
||||||
#define NEXT_KBD_LED_OFF NEXT_KBD_LED_PORT &= ~(1<<NEXT_KBD_LED_BIT);
|
|
||||||
|
|
||||||
// corresponds to the Keyboard In wire on the NeXT connector
|
|
||||||
// (red wire in NeXT connector)
|
|
||||||
#define NEXT_KBD_OUT_PORT PORTB
|
|
||||||
#define NEXT_KBD_OUT_PIN PINB
|
|
||||||
#define NEXT_KBD_OUT_DDR DDRB
|
|
||||||
#define NEXT_KBD_OUT_BIT 1
|
|
||||||
|
|
||||||
// corresponds to the Keyboard Out wire on the NeXT connector
|
|
||||||
// (orange wire in NeXT connector)
|
|
||||||
#define NEXT_KBD_IN_PORT PORTB
|
|
||||||
#define NEXT_KBD_IN_PIN PINB
|
|
||||||
#define NEXT_KBD_IN_DDR DDRB
|
|
||||||
#define NEXT_KBD_IN_BIT 0
|
|
||||||
|
|
||||||
#endif
|
|
||||||
//================= End of Teensy 2.0 Configuration ==================
|
|
||||||
|
|
||||||
|
|
||||||
//================ Start of TMK converter Configuration =================
|
|
||||||
#ifdef TMK_CONFIG
|
|
||||||
|
|
||||||
// this is the debugging LED that flashes when a key is being pressed
|
|
||||||
// comment out in order to disable debugging LED
|
|
||||||
#define NEXT_KBD_LED1_PORT PORTD
|
|
||||||
#define NEXT_KBD_LED1_PIN PIND
|
|
||||||
#define NEXT_KBD_LED1_DDR DDRD
|
|
||||||
#define NEXT_KBD_LED1_BIT 6
|
|
||||||
|
|
||||||
#define NEXT_KBD_LED1_ON NEXT_KBD_LED1_PORT |= (1<<NEXT_KBD_LED1_BIT);
|
|
||||||
#define NEXT_KBD_LED1_OFF NEXT_KBD_LED1_PORT &= ~(1<<NEXT_KBD_LED1_BIT);
|
|
||||||
|
|
||||||
// corresponds to the Keyboard In wire on the NeXT connector
|
|
||||||
#define NEXT_KBD_OUT_PORT PORTD
|
|
||||||
#define NEXT_KBD_OUT_PIN PIND
|
|
||||||
#define NEXT_KBD_OUT_DDR DDRD
|
|
||||||
#define NEXT_KBD_OUT_BIT 1
|
|
||||||
|
|
||||||
// corresponds to the Keyboard Out wire on the NeXT connector
|
|
||||||
#define NEXT_KBD_IN_PORT PORTD
|
|
||||||
#define NEXT_KBD_IN_PIN PIND
|
|
||||||
#define NEXT_KBD_IN_DDR DDRD
|
|
||||||
#define NEXT_KBD_IN_BIT 0
|
|
||||||
|
|
||||||
// this pin is an input for the power key on the NeXT keyboard
|
|
||||||
// as the keyboard is powered on this should be normally high;
|
|
||||||
// if it is pulled low it means the power button is being preseed
|
|
||||||
#define NEXT_KBD_PWR_PORT PORTD
|
|
||||||
#define NEXT_KBD_PWR_PIN PIND
|
|
||||||
#define NEXT_KBD_PWR_DDR DDRD
|
|
||||||
#define NEXT_KBD_PWR_BIT 4
|
|
||||||
|
|
||||||
#endif
|
|
||||||
//================= End of TMK converter Configuration ==================
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
(keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) || \
|
|
||||||
(keyboard_report->mods == (MOD_BIT(KC_RALT) | MOD_BIT(KC_RALT))) || \
|
|
||||||
(keyboard_report->mods == (MOD_BIT(KC_RGUI) | MOD_BIT(KC_RGUI))) \
|
|
||||||
)
|
|
@ -1,177 +0,0 @@
|
|||||||
/*
|
|
||||||
NeXT non-ADB Keyboard USB Converter
|
|
||||||
|
|
||||||
Copyright 2013, Benjamin Gould (bgould@github.com)
|
|
||||||
|
|
||||||
Based on:
|
|
||||||
---------
|
|
||||||
* TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
|
|
||||||
* Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/) \
|
|
||||||
released under BSD license \
|
|
||||||
https://github.com/adafruit/USB-NeXT-Keyboard
|
|
||||||
|
|
||||||
Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
|
|
||||||
Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
|
|
||||||
Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
|
|
||||||
|
|
||||||
This software is licensed with a Modified BSD License.
|
|
||||||
All of this is supposed to be Free Software, Open Source, DFSG-free,
|
|
||||||
GPL-compatible, and OK to use in both free and proprietary applications.
|
|
||||||
Additions and corrections to this file are welcome.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in
|
|
||||||
the documentation and/or other materials provided with the
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
* Neither the name of the copyright holders nor the names of
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
#include "keycode.h"
|
|
||||||
|
|
||||||
// 32*8(256) byte array which converts PS/2 code into USB code
|
|
||||||
static const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
ACTION_LAYER_MOMENTARY(1), // FN0 - left command key
|
|
||||||
ACTION_LAYER_MOMENTARY(1), // FN1 - right command key
|
|
||||||
ACTION_KEY(KC_BSLS), // FN2 - number pad slash & backslash
|
|
||||||
ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), // FN3 - number pad equals & pipe
|
|
||||||
ACTION_MODS_KEY(MOD_LCTL, KC_Z), // FN4 - cmd+undo on layer 1
|
|
||||||
ACTION_MODS_KEY(MOD_LCTL, KC_X), // FN5 - cmd+cut on layer 1
|
|
||||||
ACTION_MODS_KEY(MOD_LCTL, KC_C), // FN6 - cmd+copy on layer 1
|
|
||||||
ACTION_MODS_KEY(MOD_LCTL, KC_V), // FN7 - cmd+paste on layer 1
|
|
||||||
};
|
|
||||||
|
|
||||||
/* This is the physical layout that I am starting with:
|
|
||||||
* Note: there is some strangeness on the number pad;
|
|
||||||
* the equal sign shifts to pipe and forward slash shifts to backslash
|
|
||||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
|
||||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS | |VUp|Pwr|BrU| |` | =| /| *|
|
|
||||||
* |-----------------------------------------------------------| |-----------| |---------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |VDn| |BrD| | 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 | |Up | | 1| 2| 3| |
|
|
||||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
|
||||||
* |Alt |Cmd | Space |Cmd |Alt | |Lef|Dow|Rig| | 0| .| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*
|
|
||||||
* Keymap array:
|
|
||||||
* 8 bytes
|
|
||||||
* +---------+
|
|
||||||
* 0| |
|
|
||||||
* :| | 0x00-0x87
|
|
||||||
* ;| |
|
|
||||||
* 11| |
|
|
||||||
* +---------+
|
|
||||||
*/
|
|
||||||
#define KEYMAP( \
|
|
||||||
K49,K4A,K4B,K4C,K4D,K50,K4F,K4E,K1E,K1F,K20,K1D,K1C,K1B, K1A,K58,K19, K26,K27,K28,K25, \
|
|
||||||
K41,K42,K43,K44,K45,K48,K47,K46,K06,K07,K08,K05,K04,K03, K02, K01, K21,K22,K23,K24, \
|
|
||||||
K57,K39,K3A,K3B,K3C,K3D,K40,K3F,K3E,K2D,K2C,K2B, K2A, K12,K18,K13,K15, \
|
|
||||||
K56, K31,K32,K33,K34,K35,K37,K36,K2E,K2F,K30, K55, K16, K11,K17,K14, \
|
|
||||||
K52,K54, K38, K53,K51, K09,K0F,K10, K0B, K0C,K0D \
|
|
||||||
) { \
|
|
||||||
{ KC_NO, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
|
|
||||||
{ KC_##K08, KC_##K09, KC_##K10, KC_##K0B, KC_##K0C, KC_##K0D, KC_NO, 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_NO, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
|
|
||||||
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
|
|
||||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
|
|
||||||
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
|
|
||||||
{ KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
|
|
||||||
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
|
|
||||||
{ KC_##K58, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
|
|
||||||
/* Layer 0: default
|
|
||||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
|
||||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| BS | |Ins|Ref|Hom| |` | =| /| *|
|
|
||||||
* |-----------------------------------------------------------| |-----------| |---------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |Del| |End| | 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 | |Up | | 1| 2| 3| |
|
|
||||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
|
||||||
* |Fn0 |Alt | Space |LGui |Fn1 | |Lef|Dow|Rig| | 0| .| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
KEYMAP(
|
|
||||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, WREF,HOME, GRV, FN3, FN2, PAST,
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,NO, DEL, END, P7, P8, P9, PMNS,
|
|
||||||
LCTL,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,
|
|
||||||
FN0, LALT, SPC, LGUI,FN1, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
|
||||||
|
|
||||||
),
|
|
||||||
|
|
||||||
/* Layer 1: extra keys
|
|
||||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
|
||||||
* |Grv| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| BS | |VUp|VMu|PgU| |` | =| /| *|
|
|
||||||
* |-----------------------------------------------------------| |-----------| |---------------|
|
|
||||||
* |Tab |Pau| W| E| R| T| Y| U| I| O|PSc| \| ]| | |VDn| |PgD| | 7| 8| 9| -|
|
|
||||||
* |-----------------------------------------------------' | `---' `---' |-----------|---|
|
|
||||||
* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +|
|
|
||||||
* |-----------------------------------------------------------| ,---. |---------------|
|
|
||||||
* |Shift |UND|CUT|COP|PST| B| N| M| ,| .| /|Shift | |Up | | 1| 2| 3| |
|
|
||||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
|
||||||
* |Fn0 |Alt | Space |RGui |Fn1 | |Lef|Dow|Rig| | 0| .| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
KEYMAP(
|
|
||||||
|
|
||||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, VOLU,MUTE,PGUP, TRNS,TRNS,TRNS,TRNS,
|
|
||||||
TRNS,PAUS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,FN3, BSLS,TRNS, VOLD, PGDN, BTN1,MS_U,BTN2,WH_U,
|
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, MS_L,MS_D,MS_R,WH_D,
|
|
||||||
TRNS, FN4, FN5, FN6, FN7, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,
|
|
||||||
TRNS,TRNS, TRNS, TRNS,TRNS, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS
|
|
||||||
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translates Fn keycode to action */
|
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
|
||||||
{
|
|
||||||
return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
NeXT non-ADB Keyboard USB Converter
|
|
||||||
|
|
||||||
Copyright 2013, Benjamin Gould (bgould@github.com)
|
|
||||||
|
|
||||||
Based on:
|
|
||||||
TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
|
|
||||||
Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
|
|
||||||
|
|
||||||
Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
|
|
||||||
Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
|
|
||||||
Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
|
|
||||||
|
|
||||||
This software is licensed with a Modified BSD License.
|
|
||||||
All of this is supposed to be Free Software, Open Source, DFSG-free,
|
|
||||||
GPL-compatible, and OK to use in both free and proprietary applications.
|
|
||||||
Additions and corrections to this file are welcome.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in
|
|
||||||
the documentation and/or other materials provided with the
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
* Neither the name of the copyright holders nor the names of
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
#include "led.h"
|
|
||||||
#include "next_kbd.h"
|
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
|
||||||
{
|
|
||||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
|
|
||||||
next_kbd_set_leds(true, true);
|
|
||||||
} else {
|
|
||||||
next_kbd_set_leds(false, false);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,271 +0,0 @@
|
|||||||
/*
|
|
||||||
NeXT non-ADB Keyboard USB Converter
|
|
||||||
|
|
||||||
Copyright 2013, Benjamin Gould (bgould@github.com)
|
|
||||||
|
|
||||||
Based on:
|
|
||||||
TMK firmware code Copyright 2011,2012 Jun WAKO <wakojun@gmail.com>
|
|
||||||
Arduino code by "Ladyada" Limor Fried (http://ladyada.net/, http://adafruit.com/), released under BSD license
|
|
||||||
|
|
||||||
Timing reference thanks to http://m0115.web.fc2.com/ (dead link), http://cfile7.uf.tistory.com/image/14448E464F410BF22380BB
|
|
||||||
Pinouts thanks to http://www.68k.org/~degs/nextkeyboard.html
|
|
||||||
Keycodes from http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/sys/arch/next68k/dev/
|
|
||||||
|
|
||||||
This software is licensed with a Modified BSD License.
|
|
||||||
All of this is supposed to be Free Software, Open Source, DFSG-free,
|
|
||||||
GPL-compatible, and OK to use in both free and proprietary applications.
|
|
||||||
Additions and corrections to this file are welcome.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in
|
|
||||||
the documentation and/or other materials provided with the
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
* Neither the name of the copyright holders nor the names of
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
#include "print.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "serial.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
#include "next_kbd.h"
|
|
||||||
|
|
||||||
static void matrix_make(uint8_t code);
|
|
||||||
static void matrix_break(uint8_t code);
|
|
||||||
|
|
||||||
static uint8_t matrix[MATRIX_ROWS];
|
|
||||||
#define ROW(code) ((code>>3)&0xF)
|
|
||||||
#define COL(code) (code&0x07)
|
|
||||||
|
|
||||||
static bool is_modified = false;
|
|
||||||
|
|
||||||
/* number of matrix rows */
|
|
||||||
inline
|
|
||||||
uint8_t matrix_rows(void)
|
|
||||||
{
|
|
||||||
return MATRIX_ROWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* number of matrix columns */
|
|
||||||
inline
|
|
||||||
uint8_t matrix_cols(void)
|
|
||||||
{
|
|
||||||
return MATRIX_COLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NEXT_KBD_LED1_ON
|
|
||||||
#define NEXT_KBD_LED1_ON
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NEXT_KBD_LED1_OFF
|
|
||||||
#define NEXT_KBD_LED1_OFF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NEXT_KBD_PWR_READ (NEXT_KBD_PWR_PIN&(1<<NEXT_KBD_PWR_BIT))
|
|
||||||
|
|
||||||
static bool power_state = false;
|
|
||||||
|
|
||||||
/* intialize matrix for scanning. should be called once. */
|
|
||||||
void matrix_init(void)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_ON_INIT
|
|
||||||
debug_enable = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// I've found that the matrix likes a little while for things to
|
|
||||||
// settle down before it gets started. Not sure why :)
|
|
||||||
_delay_ms(250);
|
|
||||||
|
|
||||||
dprintf("[ Intializing NeXT keyboard ]\n");
|
|
||||||
NEXT_KBD_LED1_DDR |= (1<<NEXT_KBD_LED1_BIT); // LED pin to output
|
|
||||||
NEXT_KBD_LED1_ON;
|
|
||||||
|
|
||||||
NEXT_KBD_PWR_DDR &= ~(1<<NEXT_KBD_PWR_BIT); // Power Button pin to input
|
|
||||||
NEXT_KBD_PWR_PIN |= (1<<NEXT_KBD_PWR_BIT); // KBD_PWR pull up
|
|
||||||
|
|
||||||
power_state = NEXT_KBD_PWR_READ ? false : true;
|
|
||||||
dprintf("Initial power button state: %b\n", power_state);
|
|
||||||
|
|
||||||
next_kbd_init();
|
|
||||||
|
|
||||||
// initialize matrix state: all keys off
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
|
||||||
|
|
||||||
#ifdef NEXT_KBD_INIT_FLASH_LEDS
|
|
||||||
dprintf("flashing LEDs:");
|
|
||||||
// flash the LEDs after initialization
|
|
||||||
bool leds_on = true;
|
|
||||||
for (uint8_t i = 0; i <= 6; i++)
|
|
||||||
{
|
|
||||||
leds_on = leds_on ? false : true;
|
|
||||||
dprintf(" %b", leds_on);
|
|
||||||
next_kbd_set_leds(leds_on, leds_on);
|
|
||||||
_delay_ms(250);
|
|
||||||
}
|
|
||||||
dprintf("\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
dprintf("[ NeXT keyboard initialized ]\n");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NEXT_KBD_KEYCODE(response) (uint8_t)((response&0xFF)>>1)
|
|
||||||
#define NEXT_KBD_PRESSED_KEYCODE(response) (uint8_t)(((response)&0xF00)==0x400)
|
|
||||||
#define NEXT_KBD_PRESSED(response, mask) (uint8_t)(((response)&mask)>0)
|
|
||||||
#define NEXT_KBD_PRESSED_CONTROL(response) NEXT_KBD_PRESSED(response,0x01000)
|
|
||||||
#define NEXT_KBD_PRESSED_SHIFT_LEFT(response) NEXT_KBD_PRESSED(response,0x02000)
|
|
||||||
#define NEXT_KBD_PRESSED_SHIFT_RGHT(response) NEXT_KBD_PRESSED(response,0x04000)
|
|
||||||
#define NEXT_KBD_PRESSED_CMD_LEFT(response) NEXT_KBD_PRESSED(response,0x08000)
|
|
||||||
#define NEXT_KBD_PRESSED_CMD_RGHT(response) NEXT_KBD_PRESSED(response,0x10000)
|
|
||||||
#define NEXT_KBD_PRESSED_ALT_LEFT(response) NEXT_KBD_PRESSED(response,0x20000)
|
|
||||||
#define NEXT_KBD_PRESSED_ALT_RGHT(response) NEXT_KBD_PRESSED(response,0x40000)
|
|
||||||
#define NEXT_KBD_MAKE_OR_BREAK(key, code) \
|
|
||||||
do { \
|
|
||||||
if (NEXT_KBD_PRESSED_##key(resp) > 0) \
|
|
||||||
matrix_make(code); \
|
|
||||||
else \
|
|
||||||
matrix_break(code); \
|
|
||||||
} while (0);
|
|
||||||
|
|
||||||
#define NEXT_KBD_PWR_KEYCODE 0x58
|
|
||||||
|
|
||||||
/* scan all key states on matrix */
|
|
||||||
uint8_t matrix_scan(void)
|
|
||||||
{
|
|
||||||
_delay_ms(5);
|
|
||||||
|
|
||||||
//next_kbd_set_leds(false, false);
|
|
||||||
NEXT_KBD_LED1_OFF;
|
|
||||||
|
|
||||||
is_modified = false;
|
|
||||||
|
|
||||||
if (!NEXT_KBD_PWR_READ) {
|
|
||||||
matrix_make(NEXT_KBD_PWR_KEYCODE);
|
|
||||||
power_state = 1;
|
|
||||||
if (is_modified)
|
|
||||||
{
|
|
||||||
dprintf("Power state 1\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
matrix_break(NEXT_KBD_PWR_KEYCODE);
|
|
||||||
power_state = 0;
|
|
||||||
if (is_modified)
|
|
||||||
{
|
|
||||||
dprintf("Power state 0\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t resp = (next_kbd_recv());
|
|
||||||
|
|
||||||
if (resp == NEXT_KBD_KMBUS_IDLE)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
NEXT_KBD_LED1_ON;
|
|
||||||
|
|
||||||
#ifdef NEXT_KBD_SHIFT_FLASH_LEDS
|
|
||||||
next_kbd_set_leds(
|
|
||||||
NEXT_KBD_PRESSED_SHIFT_LEFT(resp) ? true : false,
|
|
||||||
NEXT_KBD_PRESSED_SHIFT_RGHT(resp) ? true : false
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
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", \
|
|
||||||
resp, \
|
|
||||||
NEXT_KBD_KEYCODE(resp), \
|
|
||||||
NEXT_KBD_PRESSED_KEYCODE(resp), \
|
|
||||||
NEXT_KBD_PRESSED_CONTROL(resp), \
|
|
||||||
NEXT_KBD_PRESSED_SHIFT_LEFT(resp), \
|
|
||||||
NEXT_KBD_PRESSED_SHIFT_RGHT(resp), \
|
|
||||||
NEXT_KBD_PRESSED_CMD_LEFT(resp), \
|
|
||||||
NEXT_KBD_PRESSED_CMD_RGHT(resp), \
|
|
||||||
NEXT_KBD_PRESSED_ALT_LEFT(resp), \
|
|
||||||
NEXT_KBD_PRESSED_ALT_RGHT(resp) \
|
|
||||||
);
|
|
||||||
|
|
||||||
// Modifier keys don't return keycode; have to check the upper bits
|
|
||||||
NEXT_KBD_MAKE_OR_BREAK(ALT_RGHT, 0x51);
|
|
||||||
NEXT_KBD_MAKE_OR_BREAK(ALT_LEFT, 0x52);
|
|
||||||
NEXT_KBD_MAKE_OR_BREAK(CMD_RGHT, 0x53);
|
|
||||||
NEXT_KBD_MAKE_OR_BREAK(CMD_LEFT, 0x54);
|
|
||||||
NEXT_KBD_MAKE_OR_BREAK(SHIFT_RGHT, 0x55);
|
|
||||||
NEXT_KBD_MAKE_OR_BREAK(SHIFT_LEFT, 0x56);
|
|
||||||
NEXT_KBD_MAKE_OR_BREAK(CONTROL, 0x57);
|
|
||||||
NEXT_KBD_MAKE_OR_BREAK(KEYCODE, NEXT_KBD_KEYCODE(resp));
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* whether modified from previous scan. used after matrix_scan. */
|
|
||||||
bool matrix_is_modified()
|
|
||||||
{
|
|
||||||
return is_modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* whether a switch is on */
|
|
||||||
inline
|
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return (matrix[row] & (1<<col));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* matrix state on row */
|
|
||||||
inline
|
|
||||||
uint8_t matrix_get_row(uint8_t row)
|
|
||||||
{
|
|
||||||
return matrix[row];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* print matrix for debug */
|
|
||||||
void matrix_print(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void matrix_make(uint8_t code)
|
|
||||||
{
|
|
||||||
if (!matrix_is_on(ROW(code), COL(code))) {
|
|
||||||
matrix[ROW(code)] |= 1<<COL(code);
|
|
||||||
is_modified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void matrix_break(uint8_t code)
|
|
||||||
{
|
|
||||||
if (matrix_is_on(ROW(code), COL(code))) {
|
|
||||||
matrix[ROW(code)] &= ~(1<<COL(code));
|
|
||||||
is_modified = true;
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 398 KiB |
@ -1,83 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = pc98_usb
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = keymap.c \
|
|
||||||
matrix.c \
|
|
||||||
led.c \
|
|
||||||
protocol/serial_uart.c
|
|
||||||
# protocol/serial_soft.c
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|
||||||
|
|
||||||
|
|
||||||
# Build Options
|
|
||||||
# *Comment out* to disable the options.
|
|
||||||
#
|
|
||||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
|
||||||
CONSOLE_ENABLE = yes # Console for debug
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in bytes
|
|
||||||
# Teensy halfKay 512
|
|
||||||
# Atmel DFU loader 4096
|
|
||||||
# LUFA bootloader 4096
|
|
||||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
|
||||||
|
|
||||||
|
|
||||||
# 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,67 +0,0 @@
|
|||||||
PC98 to USB keyboard protocol converter
|
|
||||||
=======================================
|
|
||||||
Target MCU is ATMega32u4 but other USB capable AVR will also work.
|
|
||||||
|
|
||||||
|
|
||||||
Connector
|
|
||||||
---------
|
|
||||||
|
|
||||||
8Pin mini DIN
|
|
||||||
___ ___
|
|
||||||
/ |_| \
|
|
||||||
/ 8 7 6 \
|
|
||||||
| 5 4 3 |
|
|
||||||
\_ 2 1 _/
|
|
||||||
\_____/
|
|
||||||
(receptacle)
|
|
||||||
|
|
||||||
|
|
||||||
Wiring: You can change this with editing config.h.
|
|
||||||
|
|
||||||
Pin mini DIN MCU
|
|
||||||
----------------------------------
|
|
||||||
1 ~RST(TXD) PD3
|
|
||||||
2 GND GND
|
|
||||||
3 ~RDY PD4
|
|
||||||
4 RXD PD2
|
|
||||||
5 ~RTY PD5
|
|
||||||
6 NC
|
|
||||||
7 NC
|
|
||||||
8 5V VCC
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Protocol
|
|
||||||
--------
|
|
||||||
Signal: Asynchronous, Positive logic, 19200baud, Least bit first
|
|
||||||
Frame format: 1-Start bit(Lo), 8-Data bits, Odd-Parity, 1-Stop bit
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Build Firmware
|
|
||||||
--------------
|
|
||||||
Just use 'make'
|
|
||||||
|
|
||||||
$ cd pc98_usb
|
|
||||||
$ make
|
|
||||||
|
|
||||||
Then, load the binary to MCU with your favorite programmer.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Other PC98 converter projects and resource
|
|
||||||
------------------------------------------
|
|
||||||
PC98 to USB
|
|
||||||
http://davy.nyacom.net/kbd98usb/
|
|
||||||
|
|
||||||
PC98 to PS/2
|
|
||||||
http://www.tsp.ne.jp/~sawada/mago/c_gka98at.htm
|
|
||||||
http://www.tsp.ne.jp/~sawada/mago/src/gka98at.asm
|
|
||||||
|
|
||||||
PC98 keyboard commands
|
|
||||||
http://www.webtech.co.jp/company/doc/undocumented_mem/io_kb.txt
|
|
||||||
|
|
||||||
|
|
||||||
Inhibit repeating key:
|
|
||||||
0x9C, 0x70
|
|
@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x9898
|
|
||||||
#define DEVICE_VER 0x0100
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT PC98 keyboard converter
|
|
||||||
#define DESCRIPTION converts PC98 keyboard protocol into USB
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 16
|
|
||||||
#define MATRIX_COLS 8
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
host_get_first_key() == KC_CANCEL \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
/* PC98 Reset Port shared with TXD */
|
|
||||||
#define PC98_RST_DDR DDRD
|
|
||||||
#define PC98_RST_PORT PORTD
|
|
||||||
#define PC98_RST_BIT 3
|
|
||||||
/* PC98 Ready Port */
|
|
||||||
#define PC98_RDY_DDR DDRD
|
|
||||||
#define PC98_RDY_PORT PORTD
|
|
||||||
#define PC98_RDY_BIT 4
|
|
||||||
/* PC98 Retry Port */
|
|
||||||
#define PC98_RTY_DDR DDRD
|
|
||||||
#define PC98_RTY_PORT PORTD
|
|
||||||
#define PC98_RTY_BIT 5
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PC98 Serial(USART) configuration
|
|
||||||
* asynchronous, positive logic, 19200baud, bit order: LSB first
|
|
||||||
* 1-start bit, 8-data bit, odd parity, 1-stop bit
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Software Serial
|
|
||||||
*/
|
|
||||||
#define SERIAL_SOFT_BAUD 19200
|
|
||||||
#define SERIAL_SOFT_PARITY_ODD
|
|
||||||
#define SERIAL_SOFT_BIT_ORDER_LSB
|
|
||||||
#define SERIAL_SOFT_LOGIC_POSITIVE
|
|
||||||
/* RXD Port */
|
|
||||||
#define SERIAL_SOFT_RXD_DDR DDRD
|
|
||||||
#define SERIAL_SOFT_RXD_PORT PORTD
|
|
||||||
#define SERIAL_SOFT_RXD_PIN PIND
|
|
||||||
#define SERIAL_SOFT_RXD_BIT 2
|
|
||||||
#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
|
|
||||||
/* RXD Interupt */
|
|
||||||
#define SERIAL_SOFT_RXD_VECT INT2_vect
|
|
||||||
#define SERIAL_SOFT_RXD_INIT() do { \
|
|
||||||
/* pin configuration: input with pull-up */ \
|
|
||||||
SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
|
|
||||||
SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
|
|
||||||
/* enable interrupt: INT2(falling edge) */ \
|
|
||||||
EICRA |= ((1<<ISC21)|(0<<ISC20)); \
|
|
||||||
EIMSK |= (1<<INT2); \
|
|
||||||
sei(); \
|
|
||||||
} while (0)
|
|
||||||
#define SERIAL_SOFT_RXD_INT_ENTER()
|
|
||||||
#define SERIAL_SOFT_RXD_INT_EXIT() do { \
|
|
||||||
/* clear interrupt flag */ \
|
|
||||||
EIFR = (1<<INTF2); \
|
|
||||||
} while (0)
|
|
||||||
/* TXD Port */
|
|
||||||
#define SERIAL_SOFT_TXD_DDR DDRD
|
|
||||||
#define SERIAL_SOFT_TXD_PORT PORTD
|
|
||||||
#define SERIAL_SOFT_TXD_PIN PIND
|
|
||||||
#define SERIAL_SOFT_TXD_BIT 3
|
|
||||||
#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
|
|
||||||
#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
|
|
||||||
#define SERIAL_SOFT_TXD_INIT() do { \
|
|
||||||
/* pin configuration: output */ \
|
|
||||||
SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
|
|
||||||
/* idle */ \
|
|
||||||
SERIAL_SOFT_TXD_ON(); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Hardware Serial(UART)
|
|
||||||
*/
|
|
||||||
#ifdef __AVR_ATmega32U4__
|
|
||||||
#define SERIAL_UART_BAUD 19200
|
|
||||||
#define SERIAL_UART_DATA UDR1
|
|
||||||
#define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
|
|
||||||
#define SERIAL_UART_RXD_VECT USART1_RX_vect
|
|
||||||
#define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
|
|
||||||
#define SERIAL_UART_INIT() do { \
|
|
||||||
UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
|
|
||||||
UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
|
|
||||||
UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
|
|
||||||
UCSR1B |= (0<<TXCIE1) | (1<<TXEN1); /* TX interrupt, TX: enable */ \
|
|
||||||
UCSR1C |= (1<<UPM11) | (1<<UPM10); /* parity: none(00), even(01), odd(11) */ \
|
|
||||||
sei(); \
|
|
||||||
} while(0)
|
|
||||||
#else
|
|
||||||
#error "USART configuration is needed."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,208 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "action_macro.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* PC-9801-98-S02 Raku Raku keyboard(Luckyboard) Normal Mode
|
|
||||||
,---------------------------------------------------------------.
|
|
||||||
| 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 36| 37| 3F| 3E|
|
|
||||||
`---------------------------------------------------------------'
|
|
||||||
,---------------------------------------------------------------.
|
|
||||||
| 00| 01| 02| 03| 04| 05| 58| 71| 06| 07| 08| 09| 0A| 0E|
|
|
||||||
|---------------------------------------------------------------|
|
|
||||||
| 0F| 10| 11| 12| 13| 14| 3A | 15| 16| 17| 18| 19| 1C|
|
|
||||||
|---------------------------------------------------------'. |
|
|
||||||
| 74| 20| 21| 22| 23| 24| 3B | 3C | 25| 26| 27| 28| 29| |
|
|
||||||
|---------------------------------------------------------------|
|
|
||||||
| 70| 2A| 2B| 2C| 2D| 2E| 38| 3D | 39| 2F| 30| 31| 32| 33| 70|
|
|
||||||
`---------------------------------------------------------------'
|
|
||||||
| 73| 51| 5B| 59| 34| 5A| 35| xx|
|
|
||||||
`-----------------------------------------------'
|
|
||||||
xx: 74 35 F4 B5
|
|
||||||
*/
|
|
||||||
#define KEYMAP( \
|
|
||||||
K60, K61, K62, K63, K64, K65, K66, K67, K68, K69, K6A, K6B, K36, K37, K3F, K3E, \
|
|
||||||
K00, K01, K02, K03, K04, K05, K58, K71, K06, K07, K08, K09, K0A, K0E, \
|
|
||||||
K0F, K10, K11, K12, K13, K14, K3A, K15, K16, K17, K18, K19, K1C, \
|
|
||||||
K74, K20, K21, K22, K23, K24, K3B, K3C, K25, K26, K27, K28, K29, \
|
|
||||||
K70,K2A, K2B, K2C, K2D, K2E, K38, K3D, K39, K2F, K30, K31, K32, K33, \
|
|
||||||
K73, K51, K5B, K59, K34, K5A, K35 \
|
|
||||||
) { \
|
|
||||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
|
|
||||||
{ KC_##K08, KC_##K09, KC_##K0A, KC_NO, KC_NO, KC_NO, 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_NO, KC_NO, KC_##K1C, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ 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_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
|
|
||||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
|
|
||||||
{ 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_##K51, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
|
|
||||||
{ KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##K70, KC_##K71, KC_NO, KC_##K73, KC_##K74, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/*
|
|
||||||
,---------------------------------------------------------------.
|
|
||||||
| 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 36| 37| 3F| 3E|
|
|
||||||
`---------------------------------------------------------------'
|
|
||||||
,---------------------------------------------------------------.
|
|
||||||
| 00| 01| 02| 03| 04| 05| 58| 71| 06| 07| 08| 09| 0A| 0E|
|
|
||||||
|---------------------------------------------------------------|
|
|
||||||
| 0F| 10| 11| 12| 13| 14| 3A | 15| 16| 17| 18| 19| 1C|
|
|
||||||
|---------------------------------------------------------------|
|
|
||||||
| 74| 20| 21| 22| 23| 24| MINS| EQL| 25| 26| 27| 28| 29| |
|
|
||||||
|---------------------------------------------------------------|
|
|
||||||
| 70| 2A| 2B| 2C| 2D| 2E| 38| 3D | 39| 2F| 30| 31| 32| 33| 70|
|
|
||||||
`---------------------------------------------------------------'
|
|
||||||
| 73| 51| 5B| 59| 34| 5A| 35| xx|
|
|
||||||
`-----------------------------------------------'
|
|
||||||
*/
|
|
||||||
KEYMAP(
|
|
||||||
CANCEL,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, FN6,
|
|
||||||
ESC, 1, 2, 3, 4, 5, FN4, FN5, 6, 7, 8, 9, 0, BSPC,
|
|
||||||
TAB, Q, W, E, R, T, UP, Y, U, I, O, P, ENT,
|
|
||||||
LCTL, A, S, D, F, G, MINS, EQL, H, J, K, L, FN2,
|
|
||||||
LSFT, Z, X, C, V, B, GRV, BSLS, QUOT, N, M,COMM, DOT, FN1,
|
|
||||||
LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
|
|
||||||
),
|
|
||||||
KEYMAP(
|
|
||||||
PAUS,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14,
|
|
||||||
GRV, F1, F2, F3, F4, F5, NO, NO, F6, F7, F8, F9, F10, DEL,
|
|
||||||
TAB, Q, W, E, R, T, UP, HOME,PGDN,PGUP, END, P, ENT,
|
|
||||||
LCTL, A, S, D, F, G, MINS, EQL, LEFT,DOWN, UP,RGHT,SCLN,
|
|
||||||
LSFT, Z, X, C, V, B, INS, DOWN, DEL,HOME,PGDN,PGUP, END,TRNS,
|
|
||||||
LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
|
|
||||||
),
|
|
||||||
KEYMAP(
|
|
||||||
PAUS,COPY, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14,
|
|
||||||
GRV, F1, F2, F3, F4, F5, NO, NO, F6, F7, F8, F9, F10, DEL,
|
|
||||||
TAB, Q, W, E, R, T, UP, WH_L,WH_D,WH_U,WH_R, P, ENT,
|
|
||||||
LCTL, A, S, D, F, G, MINS, EQL, MS_L,MS_D,MS_U,MS_R,TRNS,
|
|
||||||
LSFT, Z, X, C, V, B, INS, DOWN, BTN3,BTN2,BTN1,BTN4,BTN5,TRNS,
|
|
||||||
LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Macro definition
|
|
||||||
*/
|
|
||||||
enum macro_id {
|
|
||||||
LBRACKET,
|
|
||||||
RBRACKET,
|
|
||||||
DUMMY,
|
|
||||||
};
|
|
||||||
|
|
||||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|
||||||
{
|
|
||||||
keyevent_t event = record->event;
|
|
||||||
//uint8_t tap_count = record->tap_count;
|
|
||||||
|
|
||||||
switch (id) {
|
|
||||||
case LBRACKET:
|
|
||||||
return (event.pressed ?
|
|
||||||
MACRO( T(LBRC), END ) :
|
|
||||||
MACRO( T(LBRC), END ) );
|
|
||||||
case RBRACKET:
|
|
||||||
return (event.pressed ?
|
|
||||||
MACRO( T(RBRC), END ) :
|
|
||||||
MACRO( T(RBRC), END ) );
|
|
||||||
}
|
|
||||||
return MACRO_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Action function
|
|
||||||
*/
|
|
||||||
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
keyevent_t event = record->event;
|
|
||||||
uint8_t tap_count = record->tap_count;
|
|
||||||
switch (id) {
|
|
||||||
case 0xFF:
|
|
||||||
action_macro_play(get_macro(opt, event.pressed));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fn actions
|
|
||||||
*/
|
|
||||||
static const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
ACTION_LAYER_TAP_TOGGLE(0), // FN0
|
|
||||||
ACTION_LAYER_TAP_KEY(1, KC_SLASH), // FN1
|
|
||||||
ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN2
|
|
||||||
ACTION_LAYER_MOMENTARY(2), // FN3
|
|
||||||
ACTION_MACRO(LBRACKET), // FN4
|
|
||||||
ACTION_MACRO(RBRACKET), // FN5
|
|
||||||
ACTION_MACRO(DUMMY), // FN6
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* No need to edit.
|
|
||||||
*/
|
|
||||||
#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
|
|
||||||
#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
|
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
if (layer < KEYMAPS_SIZE) {
|
|
||||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
|
||||||
} else {
|
|
||||||
// fall back to layer 0
|
|
||||||
return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translates Fn keycode to action */
|
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
|
||||||
{
|
|
||||||
action_t action;
|
|
||||||
if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
|
|
||||||
action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
|
|
||||||
} else {
|
|
||||||
action.code = ACTION_NO;
|
|
||||||
}
|
|
||||||
return action;
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
#include "serial.h"
|
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
|
||||||
{
|
|
||||||
uint8_t sun_led = 0;
|
|
||||||
if (usb_led & (1<<USB_LED_NUM_LOCK)) sun_led |= (1<<0);
|
|
||||||
if (usb_led & (1<<USB_LED_COMPOSE)) sun_led |= (1<<1);
|
|
||||||
if (usb_led & (1<<USB_LED_SCROLL_LOCK)) sun_led |= (1<<2);
|
|
||||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)) sun_led |= (1<<3);
|
|
||||||
|
|
||||||
serial_send(0x0E);
|
|
||||||
serial_send(sun_led);
|
|
||||||
}
|
|
@ -1,211 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
#include "print.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "protocol/serial.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Matrix Array usage:
|
|
||||||
*
|
|
||||||
* ROW: 16(4bits)
|
|
||||||
* COL: 8(3bits)
|
|
||||||
*
|
|
||||||
* 8bit wide
|
|
||||||
* +---------+
|
|
||||||
* 0|00 ... 07|
|
|
||||||
* 1|08 ... 0F|
|
|
||||||
* :| ... |
|
|
||||||
* :| ... |
|
|
||||||
* E|70 ... 77|
|
|
||||||
* F|78 ... 7F|
|
|
||||||
* +---------+
|
|
||||||
*/
|
|
||||||
static uint8_t matrix[MATRIX_ROWS];
|
|
||||||
#define ROW(code) ((code>>3)&0xF)
|
|
||||||
#define COL(code) (code&0x07)
|
|
||||||
|
|
||||||
static bool is_modified = false;
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_rows(void)
|
|
||||||
{
|
|
||||||
return MATRIX_ROWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_cols(void)
|
|
||||||
{
|
|
||||||
return MATRIX_COLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pc98_inhibit_repeat(void)
|
|
||||||
{
|
|
||||||
uint8_t code;
|
|
||||||
|
|
||||||
while (serial_recv()) ;
|
|
||||||
RETRY:
|
|
||||||
PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
|
|
||||||
_delay_ms(500);
|
|
||||||
serial_send(0x9C);
|
|
||||||
|
|
||||||
PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
|
|
||||||
_delay_ms(100);
|
|
||||||
while (!(code = serial_recv())) ;
|
|
||||||
print("PC98: send 9C: "); print_hex8(code); print("\n");
|
|
||||||
if (code != 0xFA) goto RETRY;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
|
|
||||||
_delay_ms(100);
|
|
||||||
serial_send(0x70);
|
|
||||||
|
|
||||||
PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
|
|
||||||
_delay_ms(100);
|
|
||||||
//code = serial_recv();
|
|
||||||
while (!(code = serial_recv())) ;
|
|
||||||
print("PC98: send 70: "); print_hex8(code); print("\n");
|
|
||||||
if (code != 0xFA) goto RETRY;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init(void)
|
|
||||||
{
|
|
||||||
PC98_RST_DDR |= (1<<PC98_RST_BIT);
|
|
||||||
PC98_RDY_DDR |= (1<<PC98_RDY_BIT);
|
|
||||||
PC98_RTY_DDR |= (1<<PC98_RTY_BIT);
|
|
||||||
PC98_RST_PORT |= (1<<PC98_RST_BIT);
|
|
||||||
PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
|
|
||||||
PC98_RTY_PORT |= (1<<PC98_RTY_BIT);
|
|
||||||
|
|
||||||
|
|
||||||
serial_init();
|
|
||||||
|
|
||||||
// PC98 reset
|
|
||||||
/*
|
|
||||||
PC98_RST_PORT &= ~(1<<PC98_RST_BIT);
|
|
||||||
_delay_us(15);
|
|
||||||
PC98_RST_PORT |= (1<<PC98_RST_BIT);
|
|
||||||
_delay_us(13);
|
|
||||||
PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
|
|
||||||
*/
|
|
||||||
|
|
||||||
_delay_ms(500);
|
|
||||||
pc98_inhibit_repeat();
|
|
||||||
|
|
||||||
|
|
||||||
// PC98 ready
|
|
||||||
PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
|
|
||||||
|
|
||||||
// initialize matrix state: all keys off
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
|
||||||
|
|
||||||
debug("init\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
|
||||||
{
|
|
||||||
is_modified = false;
|
|
||||||
|
|
||||||
uint16_t code;
|
|
||||||
PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
|
|
||||||
_delay_us(30);
|
|
||||||
code = serial_recv2();
|
|
||||||
PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
|
|
||||||
if (code == -1) return 0;
|
|
||||||
|
|
||||||
if (code == 0x60) {
|
|
||||||
pc98_inhibit_repeat();
|
|
||||||
|
|
||||||
/*
|
|
||||||
PC98_RDY_PORT |= (1<<PC98_RDY_BIT);
|
|
||||||
_delay_ms(100);
|
|
||||||
serial_send(0x96);
|
|
||||||
PC98_RDY_PORT &= ~(1<<PC98_RDY_BIT);
|
|
||||||
*/
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
print_hex8(code); print(" ");
|
|
||||||
|
|
||||||
if (code&0x80) {
|
|
||||||
// break code
|
|
||||||
if (matrix_is_on(ROW(code), COL(code))) {
|
|
||||||
matrix[ROW(code)] &= ~(1<<COL(code));
|
|
||||||
is_modified = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// make code
|
|
||||||
if (!matrix_is_on(ROW(code), COL(code))) {
|
|
||||||
matrix[ROW(code)] |= (1<<COL(code));
|
|
||||||
is_modified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool matrix_is_modified(void)
|
|
||||||
{
|
|
||||||
return is_modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_has_ghost(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return (matrix[row] & (1<<col));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_get_row(uint8_t row)
|
|
||||||
{
|
|
||||||
return matrix[row];
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_print(void)
|
|
||||||
{
|
|
||||||
print("\nr/c 01234567\n");
|
|
||||||
for (uint8_t row = 0; row < matrix_rows(); row++) {
|
|
||||||
phex(row); print(": ");
|
|
||||||
pbin_reverse(matrix_get_row(row));
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_key_count(void)
|
|
||||||
{
|
|
||||||
uint8_t count = 0;
|
|
||||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
||||||
count += bitpop(matrix[i]);
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile for Teensy
|
|
||||||
#
|
|
||||||
# Target file name (without extension).
|
|
||||||
TARGET = ps2_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
|
|
||||||
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
|
||||||
else
|
|
||||||
SRC := keymap_plain.c $(SRC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CONFIG_H = config.h
|
|
||||||
|
|
||||||
|
|
||||||
# MCU name
|
|
||||||
#MCU = at90usb1287
|
|
||||||
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
|
|
||||||
# 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
|
|
||||||
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
|
||||||
|
|
||||||
|
|
||||||
# PS/2 Options
|
|
||||||
#
|
|
||||||
#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
|
|
||||||
PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
|
|
||||||
#PS2_USE_BUSYWAIT = yes # uses primitive reference code
|
|
||||||
|
|
||||||
|
|
||||||
# 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.mk
|
|
||||||
include $(TMK_DIR)/protocol/lufa.mk
|
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
@ -1,46 +0,0 @@
|
|||||||
PROJECT = ps2_usb
|
|
||||||
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
MBED_DIR = $(TMK_DIR)/tool/mbed/mbed-sdk
|
|
||||||
|
|
||||||
#VPATH += $(MBED_DIR):$(TMK_DIR)
|
|
||||||
vpath %.s .:$(MBED_DIR):$(TMK_DIR)
|
|
||||||
vpath %.c .:$(MBED_DIR):$(TMK_DIR)
|
|
||||||
vpath %.cpp .:$(MBED_DIR):$(TMK_DIR)
|
|
||||||
|
|
||||||
OBJDIR = ./build
|
|
||||||
|
|
||||||
OBJECTS = \
|
|
||||||
$(OBJDIR)/protocol/ps2_busywait.o \
|
|
||||||
$(OBJDIR)/protocol/ps2_io_mbed.o \
|
|
||||||
$(OBJDIR)/./keymap_common.o \
|
|
||||||
$(OBJDIR)/./matrix.o \
|
|
||||||
$(OBJDIR)/./led.o \
|
|
||||||
$(OBJDIR)/./main.o
|
|
||||||
|
|
||||||
ifdef KEYMAP
|
|
||||||
OBJECTS := $(OBJDIR)/keymap_$(KEYMAP).o $(OBJECTS)
|
|
||||||
else
|
|
||||||
OBJECTS := $(OBJDIR)/keymap_plain.o $(OBJECTS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CONFIG_H = config_mbed.h
|
|
||||||
|
|
||||||
SYS_OBJECTS =
|
|
||||||
|
|
||||||
INCLUDE_PATHS = -I.
|
|
||||||
|
|
||||||
LIBRARY_PATHS =
|
|
||||||
LIBRARIES =
|
|
||||||
|
|
||||||
# Build Options
|
|
||||||
# Comment out to disable
|
|
||||||
#BOOTMAGIC_ENABLE = yes
|
|
||||||
MOUSEKEY_ENABLE = yes
|
|
||||||
|
|
||||||
|
|
||||||
#include $(TMK_DIR)/tool/mbed/mk20d50m.mk
|
|
||||||
include $(TMK_DIR)/tool/mbed/lpc11u35_501.mk
|
|
||||||
include $(TMK_DIR)/tool/mbed/mbed.mk
|
|
||||||
include $(TMK_DIR)/tool/mbed/common.mk
|
|
||||||
include $(TMK_DIR)/tool/mbed/gcc.mk
|
|
@ -1,75 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = ps2_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
|
|
||||||
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
|
||||||
else
|
|
||||||
SRC := keymap_plain.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
|
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
|
||||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
|
||||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
|
||||||
|
|
||||||
|
|
||||||
# PS/2 Options
|
|
||||||
#
|
|
||||||
#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
|
|
||||||
#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
|
|
||||||
PS2_USE_BUSYWAIT = yes # uses primitive reference code
|
|
||||||
|
|
||||||
|
|
||||||
# Search Path
|
|
||||||
VPATH += $(TARGET_DIR)
|
|
||||||
VPATH += $(TMK_DIR)
|
|
||||||
|
|
||||||
|
|
||||||
include $(TMK_DIR)/protocol.mk
|
|
||||||
include $(TMK_DIR)/protocol/pjrc.mk
|
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
@ -1,98 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile for TMK keyboard converter rev2
|
|
||||||
# https://github.com/tmk/keyboard_converter#pcb-rev1
|
|
||||||
#
|
|
||||||
# Target file name (without extension).
|
|
||||||
TARGET = ps2_usb_tmk_rev1
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
|
||||||
else
|
|
||||||
SRC := keymap_plain.c $(SRC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CONFIG_H = config_tmk_rev1.h
|
|
||||||
|
|
||||||
|
|
||||||
# MCU name
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
# 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(+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
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
|
||||||
|
|
||||||
|
|
||||||
# PS/2 Options
|
|
||||||
#
|
|
||||||
PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened)
|
|
||||||
#PS2_USE_BUSYWAIT = yes # uses primitive reference code
|
|
||||||
|
|
||||||
|
|
||||||
# Search Path
|
|
||||||
VPATH += $(TARGET_DIR)
|
|
||||||
VPATH += $(TMK_DIR)
|
|
||||||
|
|
||||||
include $(TMK_DIR)/protocol.mk
|
|
||||||
include $(TMK_DIR)/protocol/lufa.mk
|
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
@ -1,98 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile for TMK keyboard converter rev2
|
|
||||||
# https://github.com/tmk/keyboard_converter#pcb-rev2
|
|
||||||
#
|
|
||||||
# Target file name (without extension).
|
|
||||||
TARGET = ps2_usb_tmk_rev2
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
|
||||||
else
|
|
||||||
SRC := keymap_plain.c $(SRC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CONFIG_H = config_tmk_rev2.h
|
|
||||||
|
|
||||||
|
|
||||||
# MCU name
|
|
||||||
MCU = atmega32u2
|
|
||||||
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
|
|
||||||
# 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(+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
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
|
||||||
|
|
||||||
|
|
||||||
# PS/2 Options
|
|
||||||
#
|
|
||||||
PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
|
|
||||||
#PS2_USE_BUSYWAIT = yes # uses primitive reference code
|
|
||||||
|
|
||||||
|
|
||||||
# Search Path
|
|
||||||
VPATH += $(TARGET_DIR)
|
|
||||||
VPATH += $(TMK_DIR)
|
|
||||||
|
|
||||||
include $(TMK_DIR)/protocol.mk
|
|
||||||
include $(TMK_DIR)/protocol/lufa.mk
|
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
@ -1,107 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = ps2_usb_vusb
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
ifdef KEYMAP
|
|
||||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
|
||||||
else
|
|
||||||
SRC := keymap_plain.c $(SRC)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CONFIG_H = config.h
|
|
||||||
|
|
||||||
|
|
||||||
# Use USART for PS/2. With V-USB INT and BUSYWAIT code is not useful.
|
|
||||||
PS2_USE_USART = yes
|
|
||||||
|
|
||||||
|
|
||||||
# V-USB debug level: To use ps2_usart.c level must be 0
|
|
||||||
# ps2_usart.c requires USART to receive PS/2 signal.
|
|
||||||
OPT_DEFS += -DDEBUG_LEVEL=0
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
||||||
MCU = atmega168
|
|
||||||
|
|
||||||
|
|
||||||
# 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 = 20000000
|
|
||||||
|
|
||||||
|
|
||||||
# Build Options
|
|
||||||
# comment out to disable the options.
|
|
||||||
#
|
|
||||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
|
||||||
NO_UART = yes # UART is unavailable
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------- Programming Options --------------------------
|
|
||||||
AVRDUDE = avrdude
|
|
||||||
# Type: avrdude -c ? to get a full listing.
|
|
||||||
AVRDUDE_PROGRAMMER = usbasp
|
|
||||||
AVRDUDE_PORT =
|
|
||||||
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
|
||||||
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
|
|
||||||
|
|
||||||
# Uncomment the following if you want avrdude's erase cycle counter.
|
|
||||||
# Note that this counter needs to be initialized first using -Yn,
|
|
||||||
# see avrdude manual.
|
|
||||||
#AVRDUDE_ERASE_COUNTER = -y
|
|
||||||
|
|
||||||
# Uncomment the following if you do /not/ wish a verification to be
|
|
||||||
# performed after programming the device.
|
|
||||||
#AVRDUDE_NO_VERIFY = -V
|
|
||||||
|
|
||||||
# Increase verbosity level. Please use this when submitting bug
|
|
||||||
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
|
|
||||||
# to submit bug reports.
|
|
||||||
#AVRDUDE_VERBOSE = -v -v
|
|
||||||
|
|
||||||
#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
|
|
||||||
AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
|
|
||||||
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
|
|
||||||
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
|
|
||||||
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
|
|
||||||
|
|
||||||
PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in bytes
|
|
||||||
# Teensy halfKay 512
|
|
||||||
# Atmel DFU loader 4096
|
|
||||||
# LUFA bootloader 4096
|
|
||||||
# USBasp 2048
|
|
||||||
OPT_DEFS += -DBOOTLOADER_SIZE=2048
|
|
||||||
|
|
||||||
|
|
||||||
# Search Path
|
|
||||||
VPATH += $(TARGET_DIR)
|
|
||||||
VPATH += $(TMK_DIR)
|
|
||||||
|
|
||||||
|
|
||||||
include $(TMK_DIR)/protocol.mk
|
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/protocol/vusb.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
@ -1,84 +0,0 @@
|
|||||||
PS/2 to USB keyboard converter
|
|
||||||
==============================
|
|
||||||
This firmware converts PS/2 keyboard protocol to USB.(It supports Scan Code Set 2.)
|
|
||||||
|
|
||||||
|
|
||||||
Connect Wires
|
|
||||||
-------------
|
|
||||||
In case of Teensy2.0(ATMega32U4):
|
|
||||||
|
|
||||||
1. Connect **Vcc** and **GND**.
|
|
||||||
2. Connect **Clock** and **Data** line.
|
|
||||||
- **Interrupt**: **Clock** is on `PD1` and **Data** on `PD0`.(Recommended. Soarer's converter compatible)
|
|
||||||
- **Busywait**: **Clock** is on `PD1` and **Data** on `PD0`.
|
|
||||||
- **USART**: **Clock** is on `PD5` and **Data** on `PD2`.
|
|
||||||
3. Optionally you need pull-up resistor. 1K-10K Ohm is OK.
|
|
||||||
|
|
||||||
To change pin configuration edit **config.h** and **Makefile**.
|
|
||||||
|
|
||||||
|
|
||||||
Build Firmware
|
|
||||||
--------------
|
|
||||||
For **PJRC Teensy** just run `make`:
|
|
||||||
|
|
||||||
$ make clean
|
|
||||||
$ make
|
|
||||||
|
|
||||||
To select keymap:
|
|
||||||
|
|
||||||
$ make clean
|
|
||||||
$ make KEYMAP=[plain|jis|spacefn|...]
|
|
||||||
|
|
||||||
After that you will find HEX file `ps2_usb_lufa.hex` in current directory.
|
|
||||||
|
|
||||||
|
|
||||||
- For **TMK converter Rev.1** use `make -f Makefile.tmk_rev1` instead of `make` and HEX file is `ps2_usb_tmk_rev1.hex`.
|
|
||||||
|
|
||||||
- For **TMK converter Rev.2** use `make -f Makefile.tmk_rev2` instead of `make` and HEX file is `ps2_usb_tmk_rev2.hex`.
|
|
||||||
|
|
||||||
|
|
||||||
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 README.md of top directory) and existent keymap files.
|
|
||||||
|
|
||||||
|
|
||||||
PS/2 signal handling implementations
|
|
||||||
------------------------------------
|
|
||||||
Following three methods can be used to implement PS/2 signal handling.
|
|
||||||
|
|
||||||
### Simple and stupid busy-wait(ps2_busywait.c)
|
|
||||||
This is expected to implemented with portable C code for reference.
|
|
||||||
### Interrupt driven(ps2_interrupt.c)
|
|
||||||
Uses pin interrupt to detect falling edge of clock line.
|
|
||||||
### USART hardware module(ps2_usart.c)
|
|
||||||
Uses AVR USART engine to receive PS/2 signal.
|
|
||||||
|
|
||||||
To select method edit Makefile.
|
|
||||||
|
|
||||||
|
|
||||||
V-USB Support
|
|
||||||
-------------
|
|
||||||
With V-USB you can use this converter on ATmega(168/328) but it doesn't support NKRO at this time.
|
|
||||||
|
|
||||||
Circuit:
|
|
||||||
|
|
||||||
+---+ +---------------+
|
|
||||||
USB GND | | ATmega168 |
|
|
||||||
=== C3 | |
|
|
||||||
5V <-------+--------+---|Vcc,AVCC | PS/2
|
|
||||||
R1 | | ====
|
|
||||||
D- <----+--+-----R2-----|INT1 RXD|------->DATA
|
|
||||||
D+ <----|---+----R3-----|INT0 XCK|------->CLOCK
|
|
||||||
Z1 Z2 | | ->5V
|
|
||||||
GND<----+---+--+--+-----|GND | ->GND
|
|
||||||
| | | |
|
|
||||||
| C2-+--|XTAL1 |
|
|
||||||
| X1 | |
|
|
||||||
+--C3-+--|XTAL2 |
|
|
||||||
+---------------+
|
|
||||||
R1: 1.5K Ohm
|
|
||||||
R2,R3: 68 Ohm
|
|
||||||
Z1,Z2: Zenner 3.6V
|
|
||||||
C1,C2: 22pF
|
|
||||||
C3: 0.1uF
|
|
||||||
X1: Crystal 20MHz(16MHz/12MHz)
|
|
@ -1,173 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x6512
|
|
||||||
#define DEVICE_VER 0x0001
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT PS/2 keyboard converter
|
|
||||||
#define DESCRIPTION convert PS/2 keyboard to USB
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 32 // keycode bit: 3-0
|
|
||||||
#define MATRIX_COLS 8 // keycode bit: 6-4
|
|
||||||
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
//#define NO_SUSPEND_POWER_DOWN
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PS/2 Busywait
|
|
||||||
*/
|
|
||||||
#ifdef PS2_USE_BUSYWAIT
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
|
||||||
#define PS2_CLOCK_PIN PIND
|
|
||||||
#define PS2_CLOCK_DDR DDRD
|
|
||||||
#define PS2_CLOCK_BIT 1
|
|
||||||
#define PS2_DATA_PORT PORTD
|
|
||||||
#define PS2_DATA_PIN PIND
|
|
||||||
#define PS2_DATA_DDR DDRD
|
|
||||||
#define PS2_DATA_BIT 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PS/2 Pin interrupt
|
|
||||||
*/
|
|
||||||
#ifdef PS2_USE_INT
|
|
||||||
/* uses INT1 for clock line(ATMega32U4) */
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
|
||||||
#define PS2_CLOCK_PIN PIND
|
|
||||||
#define PS2_CLOCK_DDR DDRD
|
|
||||||
#define PS2_CLOCK_BIT 1
|
|
||||||
#define PS2_DATA_PORT PORTD
|
|
||||||
#define PS2_DATA_PIN PIND
|
|
||||||
#define PS2_DATA_DDR DDRD
|
|
||||||
#define PS2_DATA_BIT 0
|
|
||||||
#define PS2_INT_INIT() do { \
|
|
||||||
EICRA |= ((1<<ISC11) | \
|
|
||||||
(0<<ISC10)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_INT_ON() do { \
|
|
||||||
EIMSK |= (1<<INT1); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_INT_OFF() do { \
|
|
||||||
EIMSK &= ~(1<<INT1); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_INT_VECT INT1_vect
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PS/2 USART
|
|
||||||
*/
|
|
||||||
#ifdef PS2_USE_USART
|
|
||||||
#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
|
|
||||||
/* XCK for clock line and RXD for data line */
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
|
||||||
#define PS2_CLOCK_PIN PIND
|
|
||||||
#define PS2_CLOCK_DDR DDRD
|
|
||||||
#define PS2_CLOCK_BIT 5
|
|
||||||
#define PS2_DATA_PORT PORTD
|
|
||||||
#define PS2_DATA_PIN PIND
|
|
||||||
#define PS2_DATA_DDR DDRD
|
|
||||||
#define PS2_DATA_BIT 2
|
|
||||||
/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
|
|
||||||
/* set DDR of CLOCK as input to be slave */
|
|
||||||
#define PS2_USART_INIT() do { \
|
|
||||||
PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
|
|
||||||
PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
|
|
||||||
UCSR1C = ((1 << UMSEL10) | \
|
|
||||||
(3 << UPM10) | \
|
|
||||||
(0 << USBS1) | \
|
|
||||||
(3 << UCSZ10) | \
|
|
||||||
(0 << UCPOL1)); \
|
|
||||||
UCSR1A = 0; \
|
|
||||||
UBRR1H = 0; \
|
|
||||||
UBRR1L = 0; \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_INT_ON() do { \
|
|
||||||
UCSR1B = ((1 << RXCIE1) | \
|
|
||||||
(1 << RXEN1)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_POLL_ON() do { \
|
|
||||||
UCSR1B = (1 << RXEN1); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_OFF() do { \
|
|
||||||
UCSR1C = 0; \
|
|
||||||
UCSR1B &= ~((1 << RXEN1) | \
|
|
||||||
(1 << TXEN1)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
|
|
||||||
#define PS2_USART_RX_DATA UDR1
|
|
||||||
#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
|
|
||||||
#define PS2_USART_RX_VECT USART1_RX_vect
|
|
||||||
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
|
|
||||||
/* XCK for clock line and RXD for data line */
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
|
||||||
#define PS2_CLOCK_PIN PIND
|
|
||||||
#define PS2_CLOCK_DDR DDRD
|
|
||||||
#define PS2_CLOCK_BIT 4
|
|
||||||
#define PS2_DATA_PORT PORTD
|
|
||||||
#define PS2_DATA_PIN PIND
|
|
||||||
#define PS2_DATA_DDR DDRD
|
|
||||||
#define PS2_DATA_BIT 0
|
|
||||||
/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
|
|
||||||
/* set DDR of CLOCK as input to be slave */
|
|
||||||
#define PS2_USART_INIT() do { \
|
|
||||||
PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
|
|
||||||
PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
|
|
||||||
UCSR0C = ((1 << UMSEL00) | \
|
|
||||||
(3 << UPM00) | \
|
|
||||||
(0 << USBS0) | \
|
|
||||||
(3 << UCSZ00) | \
|
|
||||||
(0 << UCPOL0)); \
|
|
||||||
UCSR0A = 0; \
|
|
||||||
UBRR0H = 0; \
|
|
||||||
UBRR0L = 0; \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_INT_ON() do { \
|
|
||||||
UCSR0B = ((1 << RXCIE0) | \
|
|
||||||
(1 << RXEN0)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_POLL_ON() do { \
|
|
||||||
UCSR0B = (1 << RXEN0); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_OFF() do { \
|
|
||||||
UCSR0C = 0; \
|
|
||||||
UCSR0B &= ~((1 << RXEN0) | \
|
|
||||||
(1 << TXEN0)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_READY (UCSR0A & (1<<RXC0))
|
|
||||||
#define PS2_USART_RX_DATA UDR0
|
|
||||||
#define PS2_USART_ERROR (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
|
|
||||||
#define PS2_USART_RX_VECT USART_RX_vect
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_MBED_H
|
|
||||||
#define CONFIG_MBED_H
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// duplicated name against mbed USBDeivce
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x6512
|
|
||||||
#endif
|
|
||||||
#define DEVICE_VER 0x0001
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT PS/2 keyboard converter
|
|
||||||
#define DESCRIPTION convert PS/2 keyboard to USB
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 32 // keycode bit: 3-0
|
|
||||||
#define MATRIX_COLS 8 // keycode bit: 6-4
|
|
||||||
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PS/2 Busywait
|
|
||||||
*/
|
|
||||||
#ifdef PS2_USE_BUSYWAIT
|
|
||||||
# define PS2_CLOCK_PORT PORTD
|
|
||||||
# define PS2_CLOCK_PIN PIND
|
|
||||||
# define PS2_CLOCK_DDR DDRD
|
|
||||||
# define PS2_CLOCK_BIT 5
|
|
||||||
# define PS2_DATA_PORT PORTD
|
|
||||||
# define PS2_DATA_PIN PIND
|
|
||||||
# define PS2_DATA_DDR DDRD
|
|
||||||
# define PS2_DATA_BIT 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,147 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x6512
|
|
||||||
#define DEVICE_VER 0x0001
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT PS/2 keyboard converter
|
|
||||||
#define DESCRIPTION convert PS/2 keyboard to USB
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 32 // keycode bit: 3-0
|
|
||||||
#define MATRIX_COLS 8 // keycode bit: 6-4
|
|
||||||
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) || \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RSHIFT)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
//#define NO_SUSPEND_POWER_DOWN
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PS/2 Busywait
|
|
||||||
*/
|
|
||||||
#ifdef PS2_USE_BUSYWAIT
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
|
||||||
#define PS2_CLOCK_PIN PIND
|
|
||||||
#define PS2_CLOCK_DDR DDRD
|
|
||||||
#define PS2_CLOCK_BIT 5
|
|
||||||
#define PS2_DATA_PORT PORTD
|
|
||||||
#define PS2_DATA_PIN PIND
|
|
||||||
#define PS2_DATA_DDR DDRD
|
|
||||||
#define PS2_DATA_BIT 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PS/2 USART
|
|
||||||
*/
|
|
||||||
#ifdef PS2_USE_USART
|
|
||||||
#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
|
|
||||||
/* XCK for clock line and RXD for data line */
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
|
||||||
#define PS2_CLOCK_PIN PIND
|
|
||||||
#define PS2_CLOCK_DDR DDRD
|
|
||||||
#define PS2_CLOCK_BIT 5
|
|
||||||
#define PS2_DATA_PORT PORTD
|
|
||||||
#define PS2_DATA_PIN PIND
|
|
||||||
#define PS2_DATA_DDR DDRD
|
|
||||||
#define PS2_DATA_BIT 2
|
|
||||||
/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
|
|
||||||
/* set DDR of CLOCK as input to be slave */
|
|
||||||
#define PS2_USART_INIT() do { \
|
|
||||||
PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
|
|
||||||
PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
|
|
||||||
UCSR1C = ((1 << UMSEL10) | \
|
|
||||||
(3 << UPM10) | \
|
|
||||||
(0 << USBS1) | \
|
|
||||||
(3 << UCSZ10) | \
|
|
||||||
(0 << UCPOL1)); \
|
|
||||||
UCSR1A = 0; \
|
|
||||||
UBRR1H = 0; \
|
|
||||||
UBRR1L = 0; \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_INT_ON() do { \
|
|
||||||
UCSR1B = ((1 << RXCIE1) | \
|
|
||||||
(1 << RXEN1)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_POLL_ON() do { \
|
|
||||||
UCSR1B = (1 << RXEN1); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_OFF() do { \
|
|
||||||
UCSR1C = 0; \
|
|
||||||
UCSR1B &= ~((1 << RXEN1) | \
|
|
||||||
(1 << TXEN1)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
|
|
||||||
#define PS2_USART_RX_DATA UDR1
|
|
||||||
#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
|
|
||||||
#define PS2_USART_RX_VECT USART1_RX_vect
|
|
||||||
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
|
|
||||||
/* XCK for clock line and RXD for data line */
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
|
||||||
#define PS2_CLOCK_PIN PIND
|
|
||||||
#define PS2_CLOCK_DDR DDRD
|
|
||||||
#define PS2_CLOCK_BIT 4
|
|
||||||
#define PS2_DATA_PORT PORTD
|
|
||||||
#define PS2_DATA_PIN PIND
|
|
||||||
#define PS2_DATA_DDR DDRD
|
|
||||||
#define PS2_DATA_BIT 0
|
|
||||||
/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
|
|
||||||
/* set DDR of CLOCK as input to be slave */
|
|
||||||
#define PS2_USART_INIT() do { \
|
|
||||||
PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
|
|
||||||
PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
|
|
||||||
UCSR0C = ((1 << UMSEL00) | \
|
|
||||||
(3 << UPM00) | \
|
|
||||||
(0 << USBS0) | \
|
|
||||||
(3 << UCSZ00) | \
|
|
||||||
(0 << UCPOL0)); \
|
|
||||||
UCSR0A = 0; \
|
|
||||||
UBRR0H = 0; \
|
|
||||||
UBRR0L = 0; \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_INT_ON() do { \
|
|
||||||
UCSR0B = ((1 << RXCIE0) | \
|
|
||||||
(1 << RXEN0)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_POLL_ON() do { \
|
|
||||||
UCSR0B = (1 << RXEN0); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_OFF() do { \
|
|
||||||
UCSR0C = 0; \
|
|
||||||
UCSR0B &= ~((1 << RXEN0) | \
|
|
||||||
(1 << TXEN0)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_USART_RX_READY (UCSR0A & (1<<RXC0))
|
|
||||||
#define PS2_USART_RX_DATA UDR0
|
|
||||||
#define PS2_USART_ERROR (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
|
|
||||||
#define PS2_USART_RX_VECT USART_RX_vect
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x6512
|
|
||||||
#define DEVICE_VER 0x0001
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT PS/2 keyboard converter
|
|
||||||
#define DESCRIPTION convert PS/2 keyboard to USB
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 32 // keycode bit: 3-0
|
|
||||||
#define MATRIX_COLS 8 // keycode bit: 6-4
|
|
||||||
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
//#define NO_SUSPEND_POWER_DOWN
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PS/2 Busywait
|
|
||||||
*/
|
|
||||||
#ifdef PS2_USE_BUSYWAIT
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
|
||||||
#define PS2_CLOCK_PIN PIND
|
|
||||||
#define PS2_CLOCK_DDR DDRD
|
|
||||||
#define PS2_CLOCK_BIT 1
|
|
||||||
#define PS2_DATA_PORT PORTD
|
|
||||||
#define PS2_DATA_PIN PIND
|
|
||||||
#define PS2_DATA_DDR DDRD
|
|
||||||
#define PS2_DATA_BIT 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PS/2 Pin interrupt
|
|
||||||
*/
|
|
||||||
#ifdef PS2_USE_INT
|
|
||||||
/* uses INT1 for clock line(ATMega32U4) */
|
|
||||||
#define PS2_CLOCK_PORT PORTD
|
|
||||||
#define PS2_CLOCK_PIN PIND
|
|
||||||
#define PS2_CLOCK_DDR DDRD
|
|
||||||
#define PS2_CLOCK_BIT 1
|
|
||||||
#define PS2_DATA_PORT PORTD
|
|
||||||
#define PS2_DATA_PIN PIND
|
|
||||||
#define PS2_DATA_DDR DDRD
|
|
||||||
#define PS2_DATA_BIT 0
|
|
||||||
#define PS2_INT_INIT() do { \
|
|
||||||
EICRA |= ((1<<ISC11) | \
|
|
||||||
(0<<ISC10)); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_INT_ON() do { \
|
|
||||||
EIMSK |= (1<<INT1); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_INT_OFF() do { \
|
|
||||||
EIMSK &= ~(1<<INT1); \
|
|
||||||
} while (0)
|
|
||||||
#define PS2_INT_VECT INT1_vect
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include "keymap_common.h"
|
|
||||||
#include "progmem.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translates Fn keycode to action */
|
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
|
||||||
{
|
|
||||||
return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
|
|
||||||
}
|
|
@ -1,173 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef KEYMAP_COMMON_H
|
|
||||||
#define KEYMAP_COMMON_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "action_macro.h"
|
|
||||||
#include "report.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
// 32*8(256) byte array which converts PS/2 code into USB code
|
|
||||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
|
||||||
extern const uint16_t fn_actions[];
|
|
||||||
|
|
||||||
|
|
||||||
/* All keys */
|
|
||||||
#define KEYMAP_ALL( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
|
|
||||||
\
|
|
||||||
K61, /* for European ISO */ \
|
|
||||||
K51, K13, K6A, K64, K67, /* for Japanese JIS */ \
|
|
||||||
K08, K10, K18, K20, K28, K30, K38, K40, K48, K50, K57, K5F, /* F13-24 */ \
|
|
||||||
KB7, KBF, KDE, /* System Power, Sleep, Wake */ \
|
|
||||||
KA3, KB2, KA1, /* Mute, Volume Up, Volume Down */ \
|
|
||||||
KCD, K95, KBB, KB4, KD0, /* Next, Previous, Stop, Pause, Media Select */ \
|
|
||||||
KC8, KAB, KC0, /* Mail, Calculator, My Computer */ \
|
|
||||||
K90, KBA, KB8, KB0, /* WWW Search, Home, Back, Forward */ \
|
|
||||||
KA8, KA0, K98 /* WWW Stop, Refresh, Favorites */ \
|
|
||||||
) { \
|
|
||||||
{ KC_NO, KC_##K01, KC_NO, 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_NO }, \
|
|
||||||
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO }, \
|
|
||||||
{ KC_##K18, KC_NO, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO }, \
|
|
||||||
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
|
|
||||||
{ KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_NO }, \
|
|
||||||
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_NO }, \
|
|
||||||
{ KC_##K38, KC_NO, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
|
|
||||||
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
|
|
||||||
{ KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
|
|
||||||
{ KC_##K50, KC_##K51, KC_##K52, KC_NO, KC_##K54, KC_##K55, KC_NO, KC_##K57 }, \
|
|
||||||
{ KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_##K5D, KC_NO, KC_##K5F }, \
|
|
||||||
{ KC_NO, KC_##K61, KC_NO, KC_NO, KC_##K64, KC_NO, KC_##K66, KC_##K67 }, \
|
|
||||||
{ KC_NO, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##K70, 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_##K7E, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_##K83, 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_##K90, KC_##K91, KC_NO, KC_NO, KC_##K94, KC_##K95, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##K98, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K9F }, \
|
|
||||||
{ KC_##KA0, KC_##KA1, KC_NO, KC_##KA3, KC_NO, KC_NO, KC_NO, KC_##KA7 }, \
|
|
||||||
{ KC_##KA8, KC_NO, KC_NO, KC_##KAB, KC_NO, KC_NO, KC_NO, KC_##KAF }, \
|
|
||||||
{ KC_##KB0, KC_NO, KC_##KB2, KC_NO, KC_##KB4, KC_NO, KC_NO, KC_##KB7 }, \
|
|
||||||
{ KC_##KB8, KC_NO, KC_##KBA, KC_##KBB, KC_NO, KC_NO, KC_NO, KC_##KBF }, \
|
|
||||||
{ KC_##KC0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##KC8, KC_NO, KC_##KCA, KC_NO, KC_NO, KC_##KCD, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##KD0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_##KDA, KC_NO, KC_NO, KC_NO, KC_##KDE, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_##KE9, KC_NO, KC_##KEB, KC_##KEC, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##KF0, KC_##KF1, KC_##KF2, KC_NO, KC_##KF4, KC_##KF5, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_##KFA, KC_NO, KC_##KFC, KC_##KFD, KC_##KFE, KC_NO }, \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* US layout */
|
|
||||||
#define KEYMAP( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
|
|
||||||
) \
|
|
||||||
KEYMAP_ALL( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
|
|
||||||
\
|
|
||||||
NUBS, \
|
|
||||||
RO, KANA, JYEN, HENK, MHEN, \
|
|
||||||
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
|
|
||||||
SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
|
|
||||||
AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
|
|
||||||
MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
|
|
||||||
MAIL, CALCULATOR, MY_COMPUTER, \
|
|
||||||
WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
|
|
||||||
WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* ISO layout */
|
|
||||||
#define KEYMAP_ISO( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D,K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K61,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
|
|
||||||
) \
|
|
||||||
KEYMAP_ALL( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
|
|
||||||
\
|
|
||||||
K61, \
|
|
||||||
RO, KANA, JYEN, HENK, MHEN, \
|
|
||||||
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
|
|
||||||
SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
|
|
||||||
AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
|
|
||||||
MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
|
|
||||||
MAIL, CALCULATOR, MY_COMPUTER, \
|
|
||||||
WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
|
|
||||||
WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* JIS layout */
|
|
||||||
#define KEYMAP_JIS( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K6A,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K51, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K67,K29,K64,K13, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
|
|
||||||
) \
|
|
||||||
KEYMAP_ALL( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
|
|
||||||
\
|
|
||||||
NUBS, \
|
|
||||||
K51, K13, K6A, K64, K67, \
|
|
||||||
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
|
|
||||||
SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
|
|
||||||
AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
|
|
||||||
MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
|
|
||||||
MAIL, CALCULATOR, MY_COMPUTER, \
|
|
||||||
WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
|
|
||||||
WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
|
|
||||||
)
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* JIS layout Japanese keyboard
|
|
||||||
*/
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* 0: JIS LAYOUT
|
|
||||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
|
|
||||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
|
|
||||||
* `---' `---------------' `---------------' `---------------' `-----------' `-----------'
|
|
||||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
|
||||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| JY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -|
|
|
||||||
* |-----------------------------------------------------------| |-----------| |---------------|
|
|
||||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Ret | |Del|End|PgD| | 7| 8| 9| |
|
|
||||||
* |------------------------------------------------------` | `-----------' |-----------| +|
|
|
||||||
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| :| \| | | 4| 5| 6| |
|
|
||||||
* |-----------------------------------------------------------| ,---. |---------------|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3| |
|
|
||||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
|
||||||
* |Ctrl |Gui |Alt |MHEN| Space |HENK|KANA|Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
KEYMAP_JIS(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
|
|
||||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, END, PGDN, P7, P8, P9,
|
|
||||||
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, ENT, P4, P5, P6, PPLS,
|
|
||||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RO, RSFT, UP, P1, P2, P3,
|
|
||||||
LCTL,LGUI,LALT, MHEN,SPC, HENK,KANA, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
};
|
|
@ -1,32 +0,0 @@
|
|||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* 0: default
|
|
||||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
|
|
||||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
|
|
||||||
* `---' `---------------' `---------------' `---------------' `-----------' `-----------'
|
|
||||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
|
||||||
* | `| 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| |
|
|
||||||
* |-----------------------------------------------------------| ,---. |---------------|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
|
|
||||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
|
||||||
* |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
KEYMAP(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
|
|
||||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
|
|
||||||
CAPS,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,
|
|
||||||
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
};
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* SpaceFN layout
|
|
||||||
* http://geekhack.org/index.php?topic=51069.0
|
|
||||||
*/
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* 0: default
|
|
||||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------.
|
|
||||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak|
|
|
||||||
* `---' `---------------' `---------------' `---------------' `-----------' `-----------'
|
|
||||||
* ,-----------------------------------------------------------. ,-----------. ,---------------.
|
|
||||||
* | `| 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| |
|
|
||||||
* |-----------------------------------------------------------| ,---. |---------------|
|
|
||||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
|
|
||||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
|
|
||||||
* |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 0| .| |
|
|
||||||
* `-----------------------------------------------------------' `-----------' `---------------'
|
|
||||||
*/
|
|
||||||
KEYMAP(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
|
|
||||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9,
|
|
||||||
CAPS,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,
|
|
||||||
LCTL,LGUI,LALT, FN0, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
|
||||||
),
|
|
||||||
|
|
||||||
/* 1: SpaceFN
|
|
||||||
* ,-----------------------------------------------------------.
|
|
||||||
* |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* | | | |Esc| | | |Hom|Up |End|Psc|Slk|Pau|Ins |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* | | | | | | |PgU|Lef|Dow|Rig| | | |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* | | | | | |Spc|PgD|` |~ | |Men| |
|
|
||||||
* |-----------------------------------------------------------|
|
|
||||||
* | | | | | | | | |
|
|
||||||
* `-----------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
KEYMAP(
|
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
|
|
||||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS,
|
|
||||||
TRNS,TRNS,TRNS,ESC, TRNS,TRNS,TRNS,HOME,UP, END, PSCR,SLCK,PAUS,INS, DEL, END, PGDN, P7, P8, P9,
|
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PGUP,LEFT,DOWN,RGHT,TRNS,TRNS, TRNS, P4, P5, P6, PPLS,
|
|
||||||
TRNS,TRNS,TRNS,TRNS,TRNS,SPC, PGDN,GRV, FN1, TRNS,APP, TRNS, UP, P1, P2, P3,
|
|
||||||
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, LEFT,DOWN,RGHT, P0, PDOT,PENT
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
|
||||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
|
|
||||||
[1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
|
|
||||||
};
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
#include "ps2.h"
|
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
|
||||||
{
|
|
||||||
uint8_t ps2_led = 0;
|
|
||||||
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
|
|
||||||
ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
|
|
||||||
if (usb_led & (1<<USB_LED_NUM_LOCK))
|
|
||||||
ps2_led |= (1<<PS2_LED_NUM_LOCK);
|
|
||||||
if (usb_led & (1<<USB_LED_CAPS_LOCK))
|
|
||||||
ps2_led |= (1<<PS2_LED_CAPS_LOCK);
|
|
||||||
ps2_host_set_led(ps2_led);
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
#include "mbed.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "timer.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "host.h"
|
|
||||||
#include "host_driver.h"
|
|
||||||
#include "mbed_driver.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Button and LEDs of LPC11U35 board
|
|
||||||
DigitalIn isp(P0_1); // ISP button
|
|
||||||
DigitalOut led_red(P0_20);
|
|
||||||
DigitalOut led_green(P0_21);
|
|
||||||
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
isp.mode(PullUp);
|
|
||||||
led_red = 1;
|
|
||||||
led_green = 0;
|
|
||||||
|
|
||||||
timer_init();
|
|
||||||
host_set_driver(&mbed_driver);
|
|
||||||
keyboard_init();
|
|
||||||
|
|
||||||
//debug_enable = true;
|
|
||||||
xprintf("mbed_onekey ver.eee:\r\n");
|
|
||||||
|
|
||||||
|
|
||||||
bool last_isp = isp;
|
|
||||||
while (1) {
|
|
||||||
keyboard_task();
|
|
||||||
|
|
||||||
//led_green = !led_green;
|
|
||||||
if (last_isp == isp) continue;
|
|
||||||
last_isp = isp;
|
|
||||||
if (last_isp == 0) {
|
|
||||||
led_red = 0; // on
|
|
||||||
dprintf("timer: %i\r\n", timer_read());
|
|
||||||
//register_code(KC_A);
|
|
||||||
} else {
|
|
||||||
led_red = 1; // off
|
|
||||||
//unregister_code(KC_A);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,486 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include "action.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "ps2.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
|
|
||||||
|
|
||||||
static void matrix_make(uint8_t code);
|
|
||||||
static void matrix_break(uint8_t code);
|
|
||||||
static void matrix_clear(void);
|
|
||||||
#ifdef MATRIX_HAS_GHOST
|
|
||||||
static bool matrix_has_ghost_in_row(uint8_t row);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Matrix Array usage:
|
|
||||||
* 'Scan Code Set 2' is assigned into 256(32x8)cell matrix.
|
|
||||||
* Hmm, it is very sparse and not efficient :(
|
|
||||||
*
|
|
||||||
* Notes:
|
|
||||||
* Both 'Hanguel/English'(F1) and 'Hanja'(F2) collide with 'Delete'(E0 71) and 'Down'(E0 72).
|
|
||||||
* These two Korean keys need exceptional handling and are not supported for now. Sorry.
|
|
||||||
*
|
|
||||||
* 8bit wide
|
|
||||||
* +---------+
|
|
||||||
* 0| |
|
|
||||||
* :| XX | 00-7F for normal codes(without E0-prefix)
|
|
||||||
* f|_________|
|
|
||||||
* 10| |
|
|
||||||
* :| E0 YY | 80-FF for E0-prefixed codes
|
|
||||||
* 1f| | (<YY>|0x80) is used as matrix position.
|
|
||||||
* +---------+
|
|
||||||
*
|
|
||||||
* Exceptions:
|
|
||||||
* 0x83: F7(0x83) This is a normal code but beyond 0x7F.
|
|
||||||
* 0xFC: PrintScreen
|
|
||||||
* 0xFE: Pause
|
|
||||||
*/
|
|
||||||
static uint8_t matrix[MATRIX_ROWS];
|
|
||||||
#define ROW(code) (code>>3)
|
|
||||||
#define COL(code) (code&0x07)
|
|
||||||
|
|
||||||
// matrix positions for exceptional keys
|
|
||||||
#define F7 (0x83)
|
|
||||||
#define PRINT_SCREEN (0xFC)
|
|
||||||
#define PAUSE (0xFE)
|
|
||||||
|
|
||||||
static bool is_modified = false;
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_rows(void)
|
|
||||||
{
|
|
||||||
return MATRIX_ROWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_cols(void)
|
|
||||||
{
|
|
||||||
return MATRIX_COLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init(void)
|
|
||||||
{
|
|
||||||
debug_enable = true;
|
|
||||||
ps2_host_init();
|
|
||||||
|
|
||||||
// initialize matrix state: all keys off
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PS/2 Scan Code Set 2: Exceptional Handling
|
|
||||||
*
|
|
||||||
* There are several keys to be handled exceptionally.
|
|
||||||
* The scan code for these keys are varied or prefix/postfix'd
|
|
||||||
* depending on modifier key state.
|
|
||||||
*
|
|
||||||
* Keyboard Scan Code Specification:
|
|
||||||
* http://www.microsoft.com/whdc/archive/scancode.mspx
|
|
||||||
* http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/scancode.doc
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* 1) Insert, Delete, Home, End, PageUp, PageDown, Up, Down, Right, Left
|
|
||||||
* a) when Num Lock is off
|
|
||||||
* modifiers | make | break
|
|
||||||
* ----------+---------------------------+----------------------
|
|
||||||
* Ohter | <make> | <break>
|
|
||||||
* LShift | E0 F0 12 <make> | <break> E0 12
|
|
||||||
* RShift | E0 F0 59 <make> | <break> E0 59
|
|
||||||
* L+RShift | E0 F0 12 E0 F0 59 <make> | <break> E0 59 E0 12
|
|
||||||
*
|
|
||||||
* b) when Num Lock is on
|
|
||||||
* modifiers | make | break
|
|
||||||
* ----------+---------------------------+----------------------
|
|
||||||
* Other | E0 12 <make> | <break> E0 F0 12
|
|
||||||
* Shift'd | <make> | <break>
|
|
||||||
*
|
|
||||||
* Handling: These prefix/postfix codes are ignored.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* 2) Keypad /
|
|
||||||
* modifiers | make | break
|
|
||||||
* ----------+---------------------------+----------------------
|
|
||||||
* Ohter | <make> | <break>
|
|
||||||
* LShift | E0 F0 12 <make> | <break> E0 12
|
|
||||||
* RShift | E0 F0 59 <make> | <break> E0 59
|
|
||||||
* L+RShift | E0 F0 12 E0 F0 59 <make> | <break> E0 59 E0 12
|
|
||||||
*
|
|
||||||
* Handling: These prefix/postfix codes are ignored.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* 3) PrintScreen
|
|
||||||
* modifiers | make | break
|
|
||||||
* ----------+--------------+-----------------------------------
|
|
||||||
* Other | E0 12 E0 7C | E0 F0 7C E0 F0 12
|
|
||||||
* Shift'd | E0 7C | E0 F0 7C
|
|
||||||
* Control'd | E0 7C | E0 F0 7C
|
|
||||||
* Alt'd | 84 | F0 84
|
|
||||||
*
|
|
||||||
* Handling: These prefix/postfix codes are ignored, and both scan codes
|
|
||||||
* 'E0 7C' and 84 are seen as PrintScreen.
|
|
||||||
*
|
|
||||||
* 4) Pause
|
|
||||||
* modifiers | make(no break code)
|
|
||||||
* ----------+--------------------------------------------------
|
|
||||||
* Other | E1 14 77 E1 F0 14 F0 77
|
|
||||||
* Control'd | E0 7E E0 F0 7E
|
|
||||||
*
|
|
||||||
* Handling: Both code sequences are treated as a whole.
|
|
||||||
* And we need a ad hoc 'pseudo break code' hack to get the key off
|
|
||||||
* because it has no break code.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
uint8_t matrix_scan(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
// scan code reading states
|
|
||||||
static enum {
|
|
||||||
INIT,
|
|
||||||
F0,
|
|
||||||
E0,
|
|
||||||
E0_F0,
|
|
||||||
// Pause
|
|
||||||
E1,
|
|
||||||
E1_14,
|
|
||||||
E1_14_77,
|
|
||||||
E1_14_77_E1,
|
|
||||||
E1_14_77_E1_F0,
|
|
||||||
E1_14_77_E1_F0_14,
|
|
||||||
E1_14_77_E1_F0_14_F0,
|
|
||||||
// Control'd Pause
|
|
||||||
E0_7E,
|
|
||||||
E0_7E_E0,
|
|
||||||
E0_7E_E0_F0,
|
|
||||||
} state = INIT;
|
|
||||||
|
|
||||||
|
|
||||||
is_modified = false;
|
|
||||||
|
|
||||||
// 'pseudo break code' hack
|
|
||||||
if (matrix_is_on(ROW(PAUSE), COL(PAUSE))) {
|
|
||||||
matrix_break(PAUSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t code = ps2_host_recv();
|
|
||||||
if (code) xprintf("%i\r\n", code);
|
|
||||||
if (!ps2_error) {
|
|
||||||
switch (state) {
|
|
||||||
case INIT:
|
|
||||||
switch (code) {
|
|
||||||
case 0xE0:
|
|
||||||
state = E0;
|
|
||||||
break;
|
|
||||||
case 0xF0:
|
|
||||||
state = F0;
|
|
||||||
break;
|
|
||||||
case 0xE1:
|
|
||||||
state = E1;
|
|
||||||
break;
|
|
||||||
case 0x83: // F7
|
|
||||||
matrix_make(F7);
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
case 0x84: // Alt'd PrintScreen
|
|
||||||
matrix_make(PRINT_SCREEN);
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
case 0x00: // Overrun [3]p.25
|
|
||||||
matrix_clear();
|
|
||||||
clear_keyboard();
|
|
||||||
print("Overrun\n");
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
default: // normal key make
|
|
||||||
if (code < 0x80) {
|
|
||||||
matrix_make(code);
|
|
||||||
} else {
|
|
||||||
matrix_clear();
|
|
||||||
clear_keyboard();
|
|
||||||
xprintf("unexpected scan code at INIT: %02X\n", code);
|
|
||||||
}
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E0: // E0-Prefixed
|
|
||||||
switch (code) {
|
|
||||||
case 0x12: // to be ignored
|
|
||||||
case 0x59: // to be ignored
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
case 0x7E: // Control'd Pause
|
|
||||||
state = E0_7E;
|
|
||||||
break;
|
|
||||||
case 0xF0:
|
|
||||||
state = E0_F0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (code < 0x80) {
|
|
||||||
matrix_make(code|0x80);
|
|
||||||
} else {
|
|
||||||
matrix_clear();
|
|
||||||
clear_keyboard();
|
|
||||||
xprintf("unexpected scan code at E0: %02X\n", code);
|
|
||||||
}
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case F0: // Break code
|
|
||||||
switch (code) {
|
|
||||||
case 0x83: // F7
|
|
||||||
matrix_break(F7);
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
case 0x84: // Alt'd PrintScreen
|
|
||||||
matrix_break(PRINT_SCREEN);
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
case 0xF0:
|
|
||||||
matrix_clear();
|
|
||||||
clear_keyboard();
|
|
||||||
xprintf("unexpected scan code at F0: F0(clear and cont.)\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (code < 0x80) {
|
|
||||||
matrix_break(code);
|
|
||||||
} else {
|
|
||||||
matrix_clear();
|
|
||||||
clear_keyboard();
|
|
||||||
xprintf("unexpected scan code at F0: %02X\n", code);
|
|
||||||
}
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E0_F0: // Break code of E0-prefixed
|
|
||||||
switch (code) {
|
|
||||||
case 0x12: // to be ignored
|
|
||||||
case 0x59: // to be ignored
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (code < 0x80) {
|
|
||||||
matrix_break(code|0x80);
|
|
||||||
} else {
|
|
||||||
matrix_clear();
|
|
||||||
clear_keyboard();
|
|
||||||
xprintf("unexpected scan code at E0_F0: %02X\n", code);
|
|
||||||
}
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// following are states of Pause
|
|
||||||
case E1:
|
|
||||||
switch (code) {
|
|
||||||
case 0x14:
|
|
||||||
state = E1_14;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E1_14:
|
|
||||||
switch (code) {
|
|
||||||
case 0x77:
|
|
||||||
state = E1_14_77;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E1_14_77:
|
|
||||||
switch (code) {
|
|
||||||
case 0xE1:
|
|
||||||
state = E1_14_77_E1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E1_14_77_E1:
|
|
||||||
switch (code) {
|
|
||||||
case 0xF0:
|
|
||||||
state = E1_14_77_E1_F0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E1_14_77_E1_F0:
|
|
||||||
switch (code) {
|
|
||||||
case 0x14:
|
|
||||||
state = E1_14_77_E1_F0_14;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E1_14_77_E1_F0_14:
|
|
||||||
switch (code) {
|
|
||||||
case 0xF0:
|
|
||||||
state = E1_14_77_E1_F0_14_F0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case E1_14_77_E1_F0_14_F0:
|
|
||||||
switch (code) {
|
|
||||||
case 0x77:
|
|
||||||
matrix_make(PAUSE);
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// Following are states of Control'd Pause
|
|
||||||
case E0_7E:
|
|
||||||
if (code == 0xE0)
|
|
||||||
state = E0_7E_E0;
|
|
||||||
else
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
case E0_7E_E0:
|
|
||||||
if (code == 0xF0)
|
|
||||||
state = E0_7E_E0_F0;
|
|
||||||
else
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
case E0_7E_E0_F0:
|
|
||||||
if (code == 0x7E)
|
|
||||||
matrix_make(PAUSE);
|
|
||||||
state = INIT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
state = INIT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: request RESEND when error occurs?
|
|
||||||
/*
|
|
||||||
if (PS2_IS_FAILED(ps2_error)) {
|
|
||||||
uint8_t ret = ps2_host_send(PS2_RESEND);
|
|
||||||
xprintf("Resend: %02X\n", ret);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool matrix_is_modified(void)
|
|
||||||
{
|
|
||||||
return is_modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_has_ghost(void)
|
|
||||||
{
|
|
||||||
#ifdef MATRIX_HAS_GHOST
|
|
||||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
||||||
if (matrix_has_ghost_in_row(i))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return (matrix[row] & (1<<col));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_get_row(uint8_t row)
|
|
||||||
{
|
|
||||||
return matrix[row];
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_print(void)
|
|
||||||
{
|
|
||||||
print("\nr/c 01234567\n");
|
|
||||||
for (uint8_t row = 0; row < matrix_rows(); row++) {
|
|
||||||
phex(row); print(": ");
|
|
||||||
pbin_reverse(matrix_get_row(row));
|
|
||||||
#ifdef MATRIX_HAS_GHOST
|
|
||||||
if (matrix_has_ghost_in_row(row)) {
|
|
||||||
print(" <ghost");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_key_count(void)
|
|
||||||
{
|
|
||||||
uint8_t count = 0;
|
|
||||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
|
||||||
count += bitpop(matrix[i]);
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef MATRIX_HAS_GHOST
|
|
||||||
inline
|
|
||||||
static bool matrix_has_ghost_in_row(uint8_t row)
|
|
||||||
{
|
|
||||||
// no ghost exists in case less than 2 keys on
|
|
||||||
if (((matrix[row] - 1) & matrix[row]) == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// ghost exists in case same state as other row
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
|
||||||
if (i != row && (matrix[i] & matrix[row]) == matrix[row])
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void matrix_make(uint8_t code)
|
|
||||||
{
|
|
||||||
if (!matrix_is_on(ROW(code), COL(code))) {
|
|
||||||
matrix[ROW(code)] |= 1<<COL(code);
|
|
||||||
is_modified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void matrix_break(uint8_t code)
|
|
||||||
{
|
|
||||||
if (matrix_is_on(ROW(code), COL(code))) {
|
|
||||||
matrix[ROW(code)] &= ~(1<<COL(code));
|
|
||||||
is_modified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
static void matrix_clear(void)
|
|
||||||
{
|
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
|
|
||||||
}
|
|
@ -1,377 +0,0 @@
|
|||||||
/* Name: usbconfig.h
|
|
||||||
* Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
|
|
||||||
* Author: Christian Starkjohann
|
|
||||||
* Creation Date: 2005-04-01
|
|
||||||
* Tabsize: 4
|
|
||||||
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
|
|
||||||
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
|
|
||||||
* This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __usbconfig_h_included__
|
|
||||||
#define __usbconfig_h_included__
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
General Description:
|
|
||||||
This file is an example configuration (with inline documentation) for the USB
|
|
||||||
driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
|
|
||||||
also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
|
|
||||||
wire the lines to any other port, as long as D+ is also wired to INT0 (or any
|
|
||||||
other hardware interrupt, as long as it is the highest level interrupt, see
|
|
||||||
section at the end of this file).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ---------------------------- Hardware Config ---------------------------- */
|
|
||||||
|
|
||||||
#define USB_CFG_IOPORTNAME D
|
|
||||||
/* This is the port where the USB bus is connected. When you configure it to
|
|
||||||
* "B", the registers PORTB, PINB and DDRB will be used.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_DMINUS_BIT 3
|
|
||||||
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
|
|
||||||
* This may be any bit in the port.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_DPLUS_BIT 2
|
|
||||||
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
|
|
||||||
* This may be any bit in the port. Please note that D+ must also be connected
|
|
||||||
* to interrupt pin INT0! [You can also use other interrupts, see section
|
|
||||||
* "Optional MCU Description" below, or you can connect D- to the interrupt, as
|
|
||||||
* it is required if you use the USB_COUNT_SOF feature. If you use D- for the
|
|
||||||
* interrupt, the USB interrupt will also be triggered at Start-Of-Frame
|
|
||||||
* markers every millisecond.]
|
|
||||||
*/
|
|
||||||
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
|
|
||||||
/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
|
|
||||||
* 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
|
|
||||||
* require no crystal, they tolerate +/- 1% deviation from the nominal
|
|
||||||
* frequency. All other rates require a precision of 2000 ppm and thus a
|
|
||||||
* crystal!
|
|
||||||
* Since F_CPU should be defined to your actual clock rate anyway, you should
|
|
||||||
* not need to modify this setting.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_CHECK_CRC 0
|
|
||||||
/* Define this to 1 if you want that the driver checks integrity of incoming
|
|
||||||
* data packets (CRC checks). CRC checks cost quite a bit of code size and are
|
|
||||||
* currently only available for 18 MHz crystal clock. You must choose
|
|
||||||
* USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ----------------------- Optional Hardware Config ------------------------ */
|
|
||||||
|
|
||||||
/* #define USB_CFG_PULLUP_IOPORTNAME D */
|
|
||||||
/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
|
|
||||||
* V+, you can connect and disconnect the device from firmware by calling
|
|
||||||
* the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
|
|
||||||
* This constant defines the port on which the pullup resistor is connected.
|
|
||||||
*/
|
|
||||||
/* #define USB_CFG_PULLUP_BIT 4 */
|
|
||||||
/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
|
|
||||||
* above) where the 1.5k pullup resistor is connected. See description
|
|
||||||
* above for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* --------------------------- Functional Range ---------------------------- */
|
|
||||||
|
|
||||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
|
|
||||||
/* Define this to 1 if you want to compile a version with two endpoints: The
|
|
||||||
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
|
|
||||||
* number).
|
|
||||||
*/
|
|
||||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
|
|
||||||
/* Define this to 1 if you want to compile a version with three endpoints: The
|
|
||||||
* default control endpoint 0, an interrupt-in endpoint 3 (or the number
|
|
||||||
* configured below) and a catch-all default interrupt-in endpoint as above.
|
|
||||||
* You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_EP3_NUMBER 3
|
|
||||||
/* If the so-called endpoint 3 is used, it can now be configured to any other
|
|
||||||
* endpoint number (except 0) with this macro. Default if undefined is 3.
|
|
||||||
*/
|
|
||||||
/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
|
|
||||||
/* The above macro defines the startup condition for data toggling on the
|
|
||||||
* interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
|
|
||||||
* Since the token is toggled BEFORE sending any data, the first packet is
|
|
||||||
* sent with the oposite value of this configuration!
|
|
||||||
*/
|
|
||||||
#define USB_CFG_IMPLEMENT_HALT 0
|
|
||||||
/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
|
||||||
* for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
|
||||||
* it is required by the standard. We have made it a config option because it
|
|
||||||
* bloats the code considerably.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_SUPPRESS_INTR_CODE 0
|
|
||||||
/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
|
|
||||||
* want to send any data over them. If this macro is defined to 1, functions
|
|
||||||
* usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
|
|
||||||
* you need the interrupt-in endpoints in order to comply to an interface
|
|
||||||
* (e.g. HID), but never want to send any data. This option saves a couple
|
|
||||||
* of bytes in flash memory and the transmit buffers in RAM.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_INTR_POLL_INTERVAL 10
|
|
||||||
/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
|
||||||
* interval. The value is in milliseconds and must not be less than 10 ms for
|
|
||||||
* low speed devices.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_IS_SELF_POWERED 0
|
|
||||||
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
|
|
||||||
* device is powered from the USB bus.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_MAX_BUS_POWER 100
|
|
||||||
/* Set this variable to the maximum USB bus power consumption of your device.
|
|
||||||
* The value is in milliamperes. [It will be divided by two since USB
|
|
||||||
* communicates power requirements in units of 2 mA.]
|
|
||||||
*/
|
|
||||||
#define USB_CFG_IMPLEMENT_FN_WRITE 1
|
|
||||||
/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
|
||||||
* transfers. Set it to 0 if you don't need it and want to save a couple of
|
|
||||||
* bytes.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_IMPLEMENT_FN_READ 0
|
|
||||||
/* Set this to 1 if you need to send control replies which are generated
|
|
||||||
* "on the fly" when usbFunctionRead() is called. If you only want to send
|
|
||||||
* data from a static buffer, set it to 0 and return the data from
|
|
||||||
* usbFunctionSetup(). This saves a couple of bytes.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
|
||||||
/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
|
|
||||||
* You must implement the function usbFunctionWriteOut() which receives all
|
|
||||||
* interrupt/bulk data sent to any endpoint other than 0. The endpoint number
|
|
||||||
* can be found in 'usbRxToken'.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_HAVE_FLOWCONTROL 0
|
|
||||||
/* Define this to 1 if you want flowcontrol over USB data. See the definition
|
|
||||||
* of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
|
||||||
* usbdrv.h.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_DRIVER_FLASH_PAGE 0
|
|
||||||
/* If the device has more than 64 kBytes of flash, define this to the 64 k page
|
|
||||||
* where the driver's constants (descriptors) are located. Or in other words:
|
|
||||||
* Define this to 1 for boot loaders on the ATMega128.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_LONG_TRANSFERS 0
|
|
||||||
/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
|
|
||||||
* in a single control-in or control-out transfer. Note that the capability
|
|
||||||
* for long transfers increases the driver size.
|
|
||||||
*/
|
|
||||||
/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
|
|
||||||
/* This macro is a hook if you want to do unconventional things. If it is
|
|
||||||
* defined, it's inserted at the beginning of received message processing.
|
|
||||||
* If you eat the received message and don't want default processing to
|
|
||||||
* proceed, do a return after doing your things. One possible application
|
|
||||||
* (besides debugging) is to flash a status LED on each packet.
|
|
||||||
*/
|
|
||||||
/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
|
|
||||||
/* This macro is a hook if you need to know when an USB RESET occurs. It has
|
|
||||||
* one parameter which distinguishes between the start of RESET state and its
|
|
||||||
* end.
|
|
||||||
*/
|
|
||||||
/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
|
|
||||||
/* This macro (if defined) is executed when a USB SET_ADDRESS request was
|
|
||||||
* received.
|
|
||||||
*/
|
|
||||||
#define USB_COUNT_SOF 0
|
|
||||||
/* define this macro to 1 if you need the global variable "usbSofCount" which
|
|
||||||
* counts SOF packets. This feature requires that the hardware interrupt is
|
|
||||||
* connected to D- instead of D+.
|
|
||||||
*/
|
|
||||||
/* #ifdef __ASSEMBLER__
|
|
||||||
* macro myAssemblerMacro
|
|
||||||
* in YL, TCNT0
|
|
||||||
* sts timer0Snapshot, YL
|
|
||||||
* endm
|
|
||||||
* #endif
|
|
||||||
* #define USB_SOF_HOOK myAssemblerMacro
|
|
||||||
* This macro (if defined) is executed in the assembler module when a
|
|
||||||
* Start Of Frame condition is detected. It is recommended to define it to
|
|
||||||
* the name of an assembler macro which is defined here as well so that more
|
|
||||||
* than one assembler instruction can be used. The macro may use the register
|
|
||||||
* YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
|
|
||||||
* immediately after an SOF pulse may be lost and must be retried by the host.
|
|
||||||
* What can you do with this hook? Since the SOF signal occurs exactly every
|
|
||||||
* 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
|
|
||||||
* designs running on the internal RC oscillator.
|
|
||||||
* Please note that Start Of Frame detection works only if D- is wired to the
|
|
||||||
* interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
|
|
||||||
*/
|
|
||||||
#define USB_CFG_CHECK_DATA_TOGGLING 0
|
|
||||||
/* define this macro to 1 if you want to filter out duplicate data packets
|
|
||||||
* sent by the host. Duplicates occur only as a consequence of communication
|
|
||||||
* errors, when the host does not receive an ACK. Please note that you need to
|
|
||||||
* implement the filtering yourself in usbFunctionWriteOut() and
|
|
||||||
* usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
|
|
||||||
* for each control- and out-endpoint to check for duplicate packets.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
|
|
||||||
/* define this macro to 1 if you want the function usbMeasureFrameLength()
|
|
||||||
* compiled in. This function can be used to calibrate the AVR's RC oscillator.
|
|
||||||
*/
|
|
||||||
#define USB_USE_FAST_CRC 0
|
|
||||||
/* The assembler module has two implementations for the CRC algorithm. One is
|
|
||||||
* faster, the other is smaller. This CRC routine is only used for transmitted
|
|
||||||
* messages where timing is not critical. The faster routine needs 31 cycles
|
|
||||||
* per byte while the smaller one needs 61 to 69 cycles. The faster routine
|
|
||||||
* may be worth the 32 bytes bigger code size if you transmit lots of data and
|
|
||||||
* run the AVR close to its limit.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* -------------------------- Device Description --------------------------- */
|
|
||||||
|
|
||||||
#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
|
|
||||||
/* USB vendor ID for the device, low byte first. If you have registered your
|
|
||||||
* own Vendor ID, define it here. Otherwise you may use one of obdev's free
|
|
||||||
* shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
|
|
||||||
* *** IMPORTANT NOTE ***
|
|
||||||
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
|
||||||
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
|
||||||
* the implications!
|
|
||||||
*/
|
|
||||||
#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
|
|
||||||
/* This is the ID of the product, low byte first. It is interpreted in the
|
|
||||||
* scope of the vendor ID. If you have registered your own VID with usb.org
|
|
||||||
* or if you have licensed a PID from somebody else, define it here. Otherwise
|
|
||||||
* you may use one of obdev's free shared VID/PID pairs. See the file
|
|
||||||
* USB-IDs-for-free.txt for details!
|
|
||||||
* *** IMPORTANT NOTE ***
|
|
||||||
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
|
||||||
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
|
||||||
* the implications!
|
|
||||||
*/
|
|
||||||
#define USB_CFG_DEVICE_VERSION 0x00, 0x01
|
|
||||||
/* Version number of the device: Minor number first, then major number.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_VENDOR_NAME 't', '.', 'm', '.', 'k', '.'
|
|
||||||
#define USB_CFG_VENDOR_NAME_LEN 6
|
|
||||||
/* These two values define the vendor name returned by the USB device. The name
|
|
||||||
* must be given as a list of characters under single quotes. The characters
|
|
||||||
* are interpreted as Unicode (UTF-16) entities.
|
|
||||||
* If you don't want a vendor name string, undefine these macros.
|
|
||||||
* ALWAYS define a vendor name containing your Internet domain name if you use
|
|
||||||
* obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
|
|
||||||
* details.
|
|
||||||
*/
|
|
||||||
#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'
|
|
||||||
#define USB_CFG_DEVICE_NAME_LEN 23
|
|
||||||
/* Same as above for the device name. If you don't want a device name, undefine
|
|
||||||
* the macros. See the file USB-IDs-for-free.txt before you assign a name if
|
|
||||||
* you use a shared VID/PID.
|
|
||||||
*/
|
|
||||||
/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
|
|
||||||
/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
|
|
||||||
/* Same as above for the serial number. If you don't want a serial number,
|
|
||||||
* undefine the macros.
|
|
||||||
* It may be useful to provide the serial number through other means than at
|
|
||||||
* compile time. See the section about descriptor properties below for how
|
|
||||||
* to fine tune control over USB descriptors such as the string descriptor
|
|
||||||
* for the serial number.
|
|
||||||
*/
|
|
||||||
#define USB_CFG_DEVICE_CLASS 0
|
|
||||||
#define USB_CFG_DEVICE_SUBCLASS 0
|
|
||||||
/* See USB specification if you want to conform to an existing device class.
|
|
||||||
* Class 0xff is "vendor specific".
|
|
||||||
*/
|
|
||||||
#define USB_CFG_INTERFACE_CLASS 3 /* HID */
|
|
||||||
#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
|
|
||||||
#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
|
|
||||||
/* See USB specification if you want to conform to an existing device class or
|
|
||||||
* protocol. The following classes must be set at interface level:
|
|
||||||
* HID class is 3, no subclass and protocol required (but may be useful!)
|
|
||||||
* CDC class is 2, use subclass 2 and protocol 1 for ACM
|
|
||||||
*/
|
|
||||||
#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
|
|
||||||
/* Define this to the length of the HID report descriptor, if you implement
|
|
||||||
* an HID device. Otherwise don't define it or define it to 0.
|
|
||||||
* If you use this define, you must add a PROGMEM character array named
|
|
||||||
* "usbHidReportDescriptor" to your code which contains the report descriptor.
|
|
||||||
* Don't forget to keep the array and this define in sync!
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* #define USB_PUBLIC static */
|
|
||||||
/* Use the define above if you #include usbdrv.c instead of linking against it.
|
|
||||||
* This technique saves a couple of bytes in flash memory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ------------------- Fine Control over USB Descriptors ------------------- */
|
|
||||||
/* If you don't want to use the driver's default USB descriptors, you can
|
|
||||||
* provide our own. These can be provided as (1) fixed length static data in
|
|
||||||
* flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
|
||||||
* runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
|
||||||
* information about this function.
|
|
||||||
* Descriptor handling is configured through the descriptor's properties. If
|
|
||||||
* no properties are defined or if they are 0, the default descriptor is used.
|
|
||||||
* Possible properties are:
|
|
||||||
* + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
|
||||||
* at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
|
|
||||||
* used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
|
|
||||||
* you want RAM pointers.
|
|
||||||
* + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
|
||||||
* in static memory is in RAM, not in flash memory.
|
|
||||||
* + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
|
||||||
* the driver must know the descriptor's length. The descriptor itself is
|
|
||||||
* found at the address of a well known identifier (see below).
|
|
||||||
* List of static descriptor names (must be declared PROGMEM if in flash):
|
|
||||||
* char usbDescriptorDevice[];
|
|
||||||
* char usbDescriptorConfiguration[];
|
|
||||||
* char usbDescriptorHidReport[];
|
|
||||||
* char usbDescriptorString0[];
|
|
||||||
* int usbDescriptorStringVendor[];
|
|
||||||
* int usbDescriptorStringDevice[];
|
|
||||||
* int usbDescriptorStringSerialNumber[];
|
|
||||||
* Other descriptors can't be provided statically, they must be provided
|
|
||||||
* dynamically at runtime.
|
|
||||||
*
|
|
||||||
* Descriptor properties are or-ed or added together, e.g.:
|
|
||||||
* #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
|
||||||
*
|
|
||||||
* The following descriptors are defined:
|
|
||||||
* USB_CFG_DESCR_PROPS_DEVICE
|
|
||||||
* USB_CFG_DESCR_PROPS_CONFIGURATION
|
|
||||||
* USB_CFG_DESCR_PROPS_STRINGS
|
|
||||||
* USB_CFG_DESCR_PROPS_STRING_0
|
|
||||||
* USB_CFG_DESCR_PROPS_STRING_VENDOR
|
|
||||||
* USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
|
||||||
* USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
|
||||||
* USB_CFG_DESCR_PROPS_HID
|
|
||||||
* USB_CFG_DESCR_PROPS_HID_REPORT
|
|
||||||
* USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
|
||||||
*
|
|
||||||
* Note about string descriptors: String descriptors are not just strings, they
|
|
||||||
* are Unicode strings prefixed with a 2 byte header. Example:
|
|
||||||
* int serialNumberDescriptor[] = {
|
|
||||||
* USB_STRING_DESCRIPTOR_HEADER(6),
|
|
||||||
* 'S', 'e', 'r', 'i', 'a', 'l'
|
|
||||||
* };
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define USB_CFG_DESCR_PROPS_DEVICE 0
|
|
||||||
#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
|
|
||||||
//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
|
||||||
#define USB_CFG_DESCR_PROPS_STRINGS 0
|
|
||||||
#define USB_CFG_DESCR_PROPS_STRING_0 0
|
|
||||||
#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
|
||||||
#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
|
||||||
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
|
||||||
//#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
|
|
||||||
#define USB_CFG_DESCR_PROPS_HID 0
|
|
||||||
#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
|
|
||||||
//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
|
||||||
#define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
|
||||||
|
|
||||||
/* ----------------------- Optional MCU Description ------------------------ */
|
|
||||||
|
|
||||||
/* The following configurations have working defaults in usbdrv.h. You
|
|
||||||
* usually don't need to set them explicitly. Only if you want to run
|
|
||||||
* the driver on a device which is not yet supported or with a compiler
|
|
||||||
* which is not fully supported (such as IAR C) or if you use a differnt
|
|
||||||
* interrupt than INT0, you may have to define some of these.
|
|
||||||
*/
|
|
||||||
/* #define USB_INTR_CFG MCUCR */
|
|
||||||
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
|
|
||||||
/* #define USB_INTR_CFG_CLR 0 */
|
|
||||||
/* #define USB_INTR_ENABLE GIMSK */
|
|
||||||
/* #define USB_INTR_ENABLE_BIT INT0 */
|
|
||||||
/* #define USB_INTR_PENDING GIFR */
|
|
||||||
/* #define USB_INTR_PENDING_BIT INTF0 */
|
|
||||||
/* #define USB_INTR_VECTOR INT0_vect */
|
|
||||||
|
|
||||||
#endif /* __usbconfig_h_included__ */
|
|
@ -1,106 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile for Teensy
|
|
||||||
#
|
|
||||||
# Target file name (without extension).
|
|
||||||
TARGET = serialmouse_usb
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# project specific files
|
|
||||||
SRC = keymap.c \
|
|
||||||
matrix.c \
|
|
||||||
led.c
|
|
||||||
|
|
||||||
CONFIG_H = config.h
|
|
||||||
|
|
||||||
|
|
||||||
# MCU name
|
|
||||||
#MCU = at90usb1287
|
|
||||||
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
|
|
||||||
# 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
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
|
||||||
|
|
||||||
|
|
||||||
# Serial Mouse Options
|
|
||||||
# You can choose a mouse protocol and the implementation of
|
|
||||||
# the underlying serial connection.
|
|
||||||
#
|
|
||||||
SERIAL_MOUSE_MICROSOFT_ENABLE = yes # Enable support for Microsoft-compatible mice
|
|
||||||
#SERIAL_MOUSE_MOUSESYSTEMS_ENABLE = yes # Enable support for Mousesystems-compatible mice
|
|
||||||
#SERIAL_MOUSE_USE_UART = yes # use hardware UART for serial connection
|
|
||||||
SERIAL_MOUSE_USE_SOFT = yes # use software serial implementation
|
|
||||||
|
|
||||||
# Optional serial mouse driver features
|
|
||||||
# Support scrolling while holding the middle mouse button
|
|
||||||
# (currently only supported for Mousesystems mice):
|
|
||||||
#OPT_DEFS += -DSERIAL_MOUSE_CENTER_SCROLL
|
|
||||||
|
|
||||||
# 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.mk
|
|
||||||
include $(TMK_DIR)/protocol/lufa.mk
|
|
||||||
include $(TMK_DIR)/common.mk
|
|
||||||
include $(TMK_DIR)/rules.mk
|
|
@ -1,11 +0,0 @@
|
|||||||
Serial mouse converter
|
|
||||||
======================
|
|
||||||
See https://github.com/tmk/tmk_keyboard/pull/131
|
|
||||||
|
|
||||||
|
|
||||||
Supported protocols
|
|
||||||
-------------------
|
|
||||||
### Microsoft
|
|
||||||
Not tested.
|
|
||||||
|
|
||||||
### Mousesystems
|
|
@ -1,119 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x2222
|
|
||||||
#define DEVICE_VER 0x0001
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT serial mouse converter
|
|
||||||
#define DESCRIPTION convert serial mouse into USB
|
|
||||||
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 0
|
|
||||||
#define MATRIX_COLS 0
|
|
||||||
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() false
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SERIAL_MOUSE_MICROSOFT
|
|
||||||
/*
|
|
||||||
* Serial(USART) configuration (for Microsoft serial mice)
|
|
||||||
* asynchronous, positive logic, 1200baud, bit order: LSB first
|
|
||||||
* 1-start bit, 7-data bit, no parity, 1-stop bit
|
|
||||||
*/
|
|
||||||
#define SERIAL_UART_BAUD 1200
|
|
||||||
#define SERIAL_UART_DATA UDR1
|
|
||||||
#define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
|
|
||||||
#define SERIAL_UART_RXD_VECT USART1_RX_vect
|
|
||||||
#define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
|
|
||||||
#define SERIAL_UART_INIT() do { \
|
|
||||||
UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
|
|
||||||
UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
|
|
||||||
UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
|
|
||||||
UCSR1C = (1<<UCSZ11) | (0<<UCSZ10); /* no parity, 1 stop bit, 7-bit characters */ \
|
|
||||||
sei(); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
// for Microsoft mouse protocol
|
|
||||||
/* Serial(USART) configuration
|
|
||||||
* asynchronous, negative logic, 1200baud, no flow control
|
|
||||||
* 1-start bit, 7-data bit, non parity, 1-stop bit
|
|
||||||
*/
|
|
||||||
#define SERIAL_SOFT_BAUD 1200
|
|
||||||
#define SERIAL_SOFT_DATA_7BIT
|
|
||||||
#define SERIAL_SOFT_PARITY_NONE
|
|
||||||
#define SERIAL_SOFT_BIT_ORDER_LSB
|
|
||||||
#define SERIAL_SOFT_LOGIC_NEGATIVE
|
|
||||||
/* RXD Port */
|
|
||||||
#define SERIAL_SOFT_RXD_DDR DDRD
|
|
||||||
#define SERIAL_SOFT_RXD_PORT PORTD
|
|
||||||
#define SERIAL_SOFT_RXD_PIN PIND
|
|
||||||
#define SERIAL_SOFT_RXD_BIT 2
|
|
||||||
#define SERIAL_SOFT_RXD_VECT INT2_vect
|
|
||||||
/* RXD Interupt */
|
|
||||||
#define SERIAL_SOFT_RXD_INIT() do { \
|
|
||||||
/* pin configuration: input with pull-up */ \
|
|
||||||
SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
|
|
||||||
SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
|
|
||||||
/* enable interrupt: INT2(rising edge) */ \
|
|
||||||
EICRA |= ((1<<ISC21)|(1<<ISC20)); \
|
|
||||||
EIMSK |= (1<<INT2); \
|
|
||||||
sei(); \
|
|
||||||
} while (0)
|
|
||||||
#define SERIAL_SOFT_RXD_INT_ENTER()
|
|
||||||
#define SERIAL_SOFT_RXD_INT_EXIT() do { \
|
|
||||||
/* clear interrupt flag */ \
|
|
||||||
EIFR = (1<<INTF2); \
|
|
||||||
} while (0)
|
|
||||||
#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
|
|
||||||
/* TXD Port */
|
|
||||||
#define SERIAL_SOFT_TXD_HI()
|
|
||||||
#define SERIAL_SOFT_TXD_LO()
|
|
||||||
#define SERIAL_SOFT_TXD_INIT()
|
|
||||||
#elif defined(SERIAL_MOUSE_MOUSESYSTEMS)
|
|
||||||
/*
|
|
||||||
* Serial(USART) configuration (for Mousesystems serial mice)
|
|
||||||
* asynchronous, positive logic, 1200baud, bit order: LSB first
|
|
||||||
* 1-start bit, 8-data bit, no parity, 1-stop bit
|
|
||||||
*/
|
|
||||||
#define SERIAL_UART_BAUD 1200
|
|
||||||
#define SERIAL_UART_DATA UDR1
|
|
||||||
#define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
|
|
||||||
#define SERIAL_UART_RXD_VECT USART1_RX_vect
|
|
||||||
#define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
|
|
||||||
#define SERIAL_UART_INIT() do { \
|
|
||||||
UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
|
|
||||||
UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
|
|
||||||
UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \
|
|
||||||
UCSR1C = (1<<UCSZ11) | (1<<UCSZ10); /* no parity, 1 stop bit, 8-bit characters */ \
|
|
||||||
sei(); \
|
|
||||||
} while(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
return KC_NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translates Fn keycode to action */
|
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
|
||||||
{
|
|
||||||
return (action_t){};
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include "keymap_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* translates key to keycode */
|
|
||||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|
||||||
{
|
|
||||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translates Fn keycode to action */
|
|
||||||
action_t keymap_fn_to_action(uint8_t keycode)
|
|
||||||
{
|
|
||||||
return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
|
|
||||||
}
|
|
@ -1,174 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011,2012,2013 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef KEYMAP_COMMON_H
|
|
||||||
#define KEYMAP_COMMON_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "action_macro.h"
|
|
||||||
#include "report.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "keymap.h"
|
|
||||||
|
|
||||||
|
|
||||||
// 32*8(256) byte array which converts PS/2 code into USB code
|
|
||||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
|
||||||
extern const uint16_t fn_actions[];
|
|
||||||
|
|
||||||
|
|
||||||
/* All keys */
|
|
||||||
#define KEYMAP_ALL( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
|
|
||||||
\
|
|
||||||
K61, /* for European ISO */ \
|
|
||||||
K51, K13, K6A, K64, K67, /* for Japanese JIS */ \
|
|
||||||
K08, K10, K18, K20, K28, K30, K38, K40, K48, K50, K57, K5F, /* F13-24 */ \
|
|
||||||
KB7, KBF, KDE, /* System Power, Sleep, Wake */ \
|
|
||||||
KA3, KB2, KA1, /* Mute, Volume Up, Volume Down */ \
|
|
||||||
KCD, K95, KBB, KB4, KD0, /* Next, Previous, Stop, Pause, Media Select */ \
|
|
||||||
KC8, KAB, KC0, /* Mail, Calculator, My Computer */ \
|
|
||||||
K90, KBA, KB8, KB0, /* WWW Search, Home, Back, Forward */ \
|
|
||||||
KA8, KA0, K98 /* WWW Stop, Refresh, Favorites */ \
|
|
||||||
) { \
|
|
||||||
{ KC_NO, KC_##K01, KC_NO, 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_NO }, \
|
|
||||||
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO }, \
|
|
||||||
{ KC_##K18, KC_NO, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_NO }, \
|
|
||||||
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO }, \
|
|
||||||
{ KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_NO }, \
|
|
||||||
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_NO }, \
|
|
||||||
{ KC_##K38, KC_NO, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO }, \
|
|
||||||
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \
|
|
||||||
{ KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \
|
|
||||||
{ KC_##K50, KC_##K51, KC_##K52, KC_NO, KC_##K54, KC_##K55, KC_NO, KC_##K57 }, \
|
|
||||||
{ KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_NO, KC_##K5D, KC_NO, KC_##K5F }, \
|
|
||||||
{ KC_NO, KC_##K61, KC_NO, KC_NO, KC_##K64, KC_NO, KC_##K66, KC_##K67 }, \
|
|
||||||
{ KC_NO, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##K70, 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_##K7E, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_##K83, 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_##K90, KC_##K91, KC_NO, KC_NO, KC_##K94, KC_##K95, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##K98, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K9F }, \
|
|
||||||
{ KC_##KA0, KC_##KA1, KC_NO, KC_##KA3, KC_NO, KC_NO, KC_NO, KC_##KA7 }, \
|
|
||||||
{ KC_##KA8, KC_NO, KC_NO, KC_##KAB, KC_NO, KC_NO, KC_NO, KC_##KAF }, \
|
|
||||||
{ KC_##KB0, KC_NO, KC_##KB2, KC_NO, KC_##KB4, KC_NO, KC_NO, KC_##KB7 }, \
|
|
||||||
{ KC_##KB8, KC_NO, KC_##KBA, KC_##KBB, KC_NO, KC_NO, KC_NO, KC_##KBF }, \
|
|
||||||
{ KC_##KC0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##KC8, KC_NO, KC_##KCA, KC_NO, KC_NO, KC_##KCD, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##KD0, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_##KDA, KC_NO, KC_NO, KC_NO, KC_##KDE, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_##KE9, KC_NO, KC_##KEB, KC_##KEC, KC_NO, KC_NO, KC_NO }, \
|
|
||||||
{ KC_##KF0, KC_##KF1, KC_##KF2, KC_NO, KC_##KF4, KC_##KF5, KC_NO, KC_NO }, \
|
|
||||||
{ KC_NO, KC_NO, KC_##KFA, KC_NO, KC_##KFC, KC_##KFD, KC_##KFE, KC_NO }, \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* US layout */
|
|
||||||
#define KEYMAP( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
|
|
||||||
) \
|
|
||||||
KEYMAP_ALL( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
|
|
||||||
\
|
|
||||||
NUBS, \
|
|
||||||
RO, KANA, JYEN, HENK, MHEN, \
|
|
||||||
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
|
|
||||||
SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
|
|
||||||
AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
|
|
||||||
MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
|
|
||||||
MAIL, CALCULATOR, MY_COMPUTER, \
|
|
||||||
WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
|
|
||||||
WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* ISO layout */
|
|
||||||
#define KEYMAP_ISO( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D,K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K61,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
|
|
||||||
) \
|
|
||||||
KEYMAP_ALL( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
|
|
||||||
\
|
|
||||||
K61, \
|
|
||||||
RO, KANA, JYEN, HENK, MHEN, \
|
|
||||||
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
|
|
||||||
SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
|
|
||||||
AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
|
|
||||||
MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
|
|
||||||
MAIL, CALCULATOR, MY_COMPUTER, \
|
|
||||||
WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
|
|
||||||
WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* JIS layout */
|
|
||||||
#define KEYMAP_JIS( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K6A,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52,K5D, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A,K51, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K67,K29,K64,K13, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA \
|
|
||||||
) \
|
|
||||||
KEYMAP_ALL( \
|
|
||||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
|
||||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, K77,KCA,K7C,K7B, \
|
|
||||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, K6C,K75,K7D, \
|
|
||||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K79, \
|
|
||||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, K69,K72,K7A, \
|
|
||||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KF4, K70, K71,KDA, \
|
|
||||||
\
|
|
||||||
NUBS, \
|
|
||||||
K51, K13, K6A, K64, K67, \
|
|
||||||
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, \
|
|
||||||
SYSTEM_POWER, SYSTEM_SLEEP, SYSTEM_WAKE, \
|
|
||||||
AUDIO_MUTE, AUDIO_VOL_UP, AUDIO_VOL_DOWN, \
|
|
||||||
MEDIA_NEXT_TRACK, MEDIA_PREV_TRACK, MEDIA_STOP, MEDIA_PLAY_PAUSE, MEDIA_SELECT, \
|
|
||||||
MAIL, CALCULATOR, MY_COMPUTER, \
|
|
||||||
WWW_SEARCH, WWW_HOME, WWW_BACK, WWW_FORWARD, \
|
|
||||||
WWW_STOP, WWW_REFRESH, WWW_FAVORITES \
|
|
||||||
)
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
void led_set(uint8_t usb_led)
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2011 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
#include "action.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "matrix.h"
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_rows(void)
|
|
||||||
{
|
|
||||||
return MATRIX_ROWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_cols(void)
|
|
||||||
{
|
|
||||||
return MATRIX_COLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init(void)
|
|
||||||
{
|
|
||||||
debug_enable = true;
|
|
||||||
debug_mouse=true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_scan(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool matrix_is_modified(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_has_ghost(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
uint8_t matrix_get_row(uint8_t row)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_print(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t matrix_key_count(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
# Target file name (without extension).
|
|
||||||
TARGET = sun_usb
|
|
||||||
|
|
||||||
# Directory common source filess exist
|
|
||||||
TMK_DIR = ../../tmk_core
|
|
||||||
|
|
||||||
# Directory keyboard dependent files exist
|
|
||||||
TARGET_DIR = .
|
|
||||||
|
|
||||||
# keyboard dependent files
|
|
||||||
SRC = keymap.c \
|
|
||||||
matrix.c \
|
|
||||||
led.c \
|
|
||||||
command_extra.c \
|
|
||||||
protocol/serial_soft.c
|
|
||||||
|
|
||||||
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
|
|
||||||
MCU = atmega32u2
|
|
||||||
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|
||||||
|
|
||||||
|
|
||||||
# Build Options
|
|
||||||
# *Comment out* to disable the options.
|
|
||||||
#
|
|
||||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
|
||||||
CONSOLE_ENABLE = yes # Console for debug
|
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in bytes
|
|
||||||
# Teensy halfKay 512
|
|
||||||
# Atmel DFU loader 4096
|
|
||||||
# LUFA bootloader 4096
|
|
||||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
|
||||||
|
|
||||||
|
|
||||||
# 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,106 +0,0 @@
|
|||||||
Sun to USB keyboard protocol converter
|
|
||||||
======================================
|
|
||||||
Target MCU is ATMega32u4 but other USB capable AVR will also work.
|
|
||||||
|
|
||||||
This converter will work with Sun Type 2-5 Keyboards.
|
|
||||||
|
|
||||||
|
|
||||||
Tested on:
|
|
||||||
Sun Type 3 Keyboard: http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html
|
|
||||||
CTCSP SHORT TYPE KEYBOARD(Type 5): http://imgur.com/a/QIv6p
|
|
||||||
|
|
||||||
|
|
||||||
Keymap of Type 3(keymap_sun3.c) were impoted from dastels's repository.
|
|
||||||
https://github.com/dastels/tmk_keyboard/tree/master/converter/sun3_usb
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Connector
|
|
||||||
---------
|
|
||||||
8Pin mini DIN
|
|
||||||
___ ___
|
|
||||||
/ |_| \
|
|
||||||
/ 8 7 6 \
|
|
||||||
| 5 4 3 |
|
|
||||||
\_ 2 1 _/
|
|
||||||
\_____/
|
|
||||||
(receptacle)
|
|
||||||
|
|
||||||
Wiring:
|
|
||||||
Pin mini DIN MCU
|
|
||||||
----------------------------------
|
|
||||||
1 GND GND
|
|
||||||
2 GND GND
|
|
||||||
3 5V
|
|
||||||
4 RX/TX(Mouse)
|
|
||||||
5 RX PD3
|
|
||||||
6 TX PD2
|
|
||||||
7 GND GND
|
|
||||||
8 5V VCC
|
|
||||||
|
|
||||||
|
|
||||||
Protocol
|
|
||||||
--------
|
|
||||||
Signal: Asynchronous, Negative logic, 1200baud, No Flow control
|
|
||||||
Frame format: 1-Start bit, 8-Data bits, No-Parity, 1-Stop bit
|
|
||||||
|
|
||||||
AVR USART engine expects positive logic while Sun keyboard signal is negative.
|
|
||||||
To use AVR UART engine you need external inverter in front of RX and TX pin.
|
|
||||||
Otherwise you can software serial routine to communicate the keyboard.
|
|
||||||
|
|
||||||
This converter uses software method, you doesn't need any inverter part.
|
|
||||||
|
|
||||||
|
|
||||||
Commands From System To Keyboard
|
|
||||||
0x01 Reset
|
|
||||||
Keyboard responds with following byte sequence:
|
|
||||||
Success: 0xFF 0x04 0x7F
|
|
||||||
Fail: 0x7E 0x01 0x7F
|
|
||||||
0x02 Bell On
|
|
||||||
0x03 Bell Off
|
|
||||||
0x0A Click On
|
|
||||||
0x0B Click Off
|
|
||||||
0x0E LED
|
|
||||||
followed by LED status byte:
|
|
||||||
bit: 3 2 1 0
|
|
||||||
LED: CapsLk ScrLk Compose NumLk
|
|
||||||
0x0F Layout
|
|
||||||
Keyboard responds with 'Layout Response' 0xFE 0xXX
|
|
||||||
|
|
||||||
Commands From Keyboard To System
|
|
||||||
0x7F Idle
|
|
||||||
means no keys pressed.
|
|
||||||
0xFE Layout Response
|
|
||||||
0xFF Reset Response(followed by 0x04)
|
|
||||||
|
|
||||||
Reference
|
|
||||||
http://kentie.net/article/sunkbd/page2.htm
|
|
||||||
http://kentie.net/article/sunkbd/KBD.pdf
|
|
||||||
|
|
||||||
|
|
||||||
Build Firmware
|
|
||||||
--------------
|
|
||||||
Just use 'make'
|
|
||||||
$ cd sun_usb
|
|
||||||
$ make
|
|
||||||
Then, load the binary to MCU with your favorite programmer.
|
|
||||||
|
|
||||||
|
|
||||||
Sun commands
|
|
||||||
------------
|
|
||||||
You can send Sun protocol commands with TMK `Magic` key combo. By default `Magic` key is `LShift` + `RShift`, `LAlt` + `RAlt' or `LMeta` + `RMeta`.
|
|
||||||
https://github.com/tmk/tmk_keyboard#magic-commands
|
|
||||||
|
|
||||||
Following Sun specific commands are available. For example, to send 'Bell On' you can press `LShift` + `RShift` + `Up` keys simultaneously.
|
|
||||||
|
|
||||||
```
|
|
||||||
----- Sun converter Help -----
|
|
||||||
Up: Bell On
|
|
||||||
Down: Bell Off
|
|
||||||
Left: Click On
|
|
||||||
Right: Click Off
|
|
||||||
PgUp: LED all On
|
|
||||||
PgDown: LED all On
|
|
||||||
Insert: Layout
|
|
||||||
Delete: Reset
|
|
||||||
```
|
|
@ -1,61 +0,0 @@
|
|||||||
#include "stdbool.h"
|
|
||||||
#include "stdint.h"
|
|
||||||
#include "keycode.h"
|
|
||||||
#include "serial.h"
|
|
||||||
#include "print.h"
|
|
||||||
#include "command.h"
|
|
||||||
|
|
||||||
bool command_extra(uint8_t code)
|
|
||||||
{
|
|
||||||
switch (code) {
|
|
||||||
case KC_H:
|
|
||||||
case KC_SLASH: /* ? */
|
|
||||||
print("\n\n----- Sun converter Help -----\n");
|
|
||||||
print("Up: Bell On\n");
|
|
||||||
print("Down: Bell Off\n");
|
|
||||||
print("Left: Click On\n");
|
|
||||||
print("Right: Click Off\n");
|
|
||||||
print("PgUp: LED all On\n");
|
|
||||||
print("PgDown: LED all On\n");
|
|
||||||
print("Insert: Layout\n");
|
|
||||||
print("Delete: Reset\n");
|
|
||||||
return false;
|
|
||||||
case KC_DEL:
|
|
||||||
print("Reset\n");
|
|
||||||
serial_send(0x01);
|
|
||||||
break;
|
|
||||||
case KC_UP:
|
|
||||||
print("Bell On\n");
|
|
||||||
serial_send(0x02);
|
|
||||||
break;
|
|
||||||
case KC_DOWN:
|
|
||||||
print("Bell Off\n");
|
|
||||||
serial_send(0x03);
|
|
||||||
break;
|
|
||||||
case KC_LEFT:
|
|
||||||
print("Click On\n");
|
|
||||||
serial_send(0x0A);
|
|
||||||
break;
|
|
||||||
case KC_RIGHT:
|
|
||||||
print("Click Off\n");
|
|
||||||
serial_send(0x0B);
|
|
||||||
break;
|
|
||||||
case KC_PGUP:
|
|
||||||
print("LED all on\n");
|
|
||||||
serial_send(0x0E);
|
|
||||||
serial_send(0xFF);
|
|
||||||
break;
|
|
||||||
case KC_PGDOWN:
|
|
||||||
print("LED all off\n");
|
|
||||||
serial_send(0x0E);
|
|
||||||
serial_send(0x00);
|
|
||||||
break;
|
|
||||||
case KC_INSERT:
|
|
||||||
print("layout\n");
|
|
||||||
serial_send(0x0F);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,95 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x3333
|
|
||||||
#define DEVICE_VER 0x0100
|
|
||||||
#define MANUFACTURER t.m.k.
|
|
||||||
#define PRODUCT Sun keyboard converter
|
|
||||||
#define DESCRIPTION converts Sun keyboard protocol into USB
|
|
||||||
|
|
||||||
/* matrix size */
|
|
||||||
#define MATRIX_ROWS 16
|
|
||||||
#define MATRIX_COLS 8
|
|
||||||
|
|
||||||
/* key combination for command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT)) || \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) || \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* legacy keymap support */
|
|
||||||
#define USE_LEGACY_KEYMAP
|
|
||||||
|
|
||||||
|
|
||||||
/* Serial(USART) configuration
|
|
||||||
* asynchronous, negative logic, 1200baud, no flow control
|
|
||||||
* 1-start bit, 8-data bit, non parity, 1-stop bit
|
|
||||||
*/
|
|
||||||
#define SERIAL_SOFT_BAUD 1200
|
|
||||||
#define SERIAL_SOFT_PARITY_NONE
|
|
||||||
#define SERIAL_SOFT_BIT_ORDER_LSB
|
|
||||||
#define SERIAL_SOFT_LOGIC_NEGATIVE
|
|
||||||
/* RXD Port */
|
|
||||||
#define SERIAL_SOFT_RXD_ENABLE
|
|
||||||
#define SERIAL_SOFT_RXD_DDR DDRD
|
|
||||||
#define SERIAL_SOFT_RXD_PORT PORTD
|
|
||||||
#define SERIAL_SOFT_RXD_PIN PIND
|
|
||||||
#define SERIAL_SOFT_RXD_BIT 2
|
|
||||||
#define SERIAL_SOFT_RXD_VECT INT2_vect
|
|
||||||
/* RXD Interupt */
|
|
||||||
#ifdef SERIAL_SOFT_LOGIC_NEGATIVE
|
|
||||||
/* enable interrupt: INT2(rising edge) */
|
|
||||||
#define INTR_TRIG_EDGE ((1<<ISC21)|(1<<ISC20))
|
|
||||||
#else
|
|
||||||
/* enable interrupt: INT2(falling edge) */
|
|
||||||
#define INTR_TRIG_EDGE ((1<<ISC21)|(0<<ISC20))
|
|
||||||
#endif
|
|
||||||
#define SERIAL_SOFT_RXD_INIT() do { \
|
|
||||||
/* pin configuration: input with pull-up */ \
|
|
||||||
SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
|
|
||||||
SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
|
|
||||||
EICRA |= INTR_TRIG_EDGE; \
|
|
||||||
EIMSK |= (1<<INT2); \
|
|
||||||
sei(); \
|
|
||||||
} while (0)
|
|
||||||
#define SERIAL_SOFT_RXD_INT_ENTER()
|
|
||||||
#define SERIAL_SOFT_RXD_INT_EXIT() do { \
|
|
||||||
/* clear interrupt flag */ \
|
|
||||||
EIFR = (1<<INTF2); \
|
|
||||||
} while (0)
|
|
||||||
#define SERIAL_SOFT_RXD_READ() (SERIAL_SOFT_RXD_PIN&(1<<SERIAL_SOFT_RXD_BIT))
|
|
||||||
/* TXD Port */
|
|
||||||
#define SERIAL_SOFT_TXD_ENABLE
|
|
||||||
#define SERIAL_SOFT_TXD_DDR DDRD
|
|
||||||
#define SERIAL_SOFT_TXD_PORT PORTD
|
|
||||||
#define SERIAL_SOFT_TXD_PIN PIND
|
|
||||||
#define SERIAL_SOFT_TXD_BIT 3
|
|
||||||
#define SERIAL_SOFT_TXD_HI() do { SERIAL_SOFT_TXD_PORT |= (1<<SERIAL_SOFT_TXD_BIT); } while (0)
|
|
||||||
#define SERIAL_SOFT_TXD_LO() do { SERIAL_SOFT_TXD_PORT &= ~(1<<SERIAL_SOFT_TXD_BIT); } while (0)
|
|
||||||
#define SERIAL_SOFT_TXD_INIT() do { \
|
|
||||||
/* pin configuration: output */ \
|
|
||||||
SERIAL_SOFT_TXD_DDR |= (1<<SERIAL_SOFT_TXD_BIT); \
|
|
||||||
/* idle */ \
|
|
||||||
SERIAL_SOFT_TXD_ON(); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#endif
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user