# | |||||
# Makefile for Teensy | |||||
# | |||||
# Target file name (without extension). | # Target file name (without extension). | ||||
TARGET = ps2_usb_lufa | |||||
TARGET ?= ps2_usb | |||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TMK_DIR = ../../tmk_core | |||||
TMK_DIR ?= ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | |||||
TARGET_DIR ?= . | |||||
# project specific files | # project specific files | ||||
SRC = matrix.c \ | |||||
SRC ?= matrix.c \ | |||||
led.c | led.c | ||||
# | |||||
# Keymap file | |||||
# | |||||
ifdef UNIMAP_ENABLE | |||||
KEYMAP_FILE = unimap | |||||
else | |||||
ifdef ACTIONMAP_ENABLE | |||||
KEYMAP_FILE = actionmap | |||||
else | |||||
KEYMAP_FILE = keymap | |||||
endif | |||||
endif | |||||
ifdef KEYMAP | ifdef KEYMAP | ||||
SRC := keymap_$(KEYMAP).c $(SRC) | |||||
SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC) | |||||
else | else | ||||
SRC := keymap_plain.c $(SRC) | |||||
SRC := $(KEYMAP_FILE)_plain.c $(SRC) | |||||
endif | endif | ||||
CONFIG_H = config.h | |||||
CONFIG_H ?= config.h | |||||
# MCU name | # MCU name | ||||
#MCU = at90usb1287 | |||||
MCU = atmega32u4 | |||||
MCU ?= atmega32u2 | |||||
# Processor frequency. | # Processor frequency. | ||||
# This will define a symbol, F_CPU, in all source code files equal to the | # This will define a symbol, F_CPU, in all source code files equal to the | ||||
# does not *change* the processor frequency - it should merely be updated to | # 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 | # reflect the processor speed set externally so that the code can use accurate | ||||
# software delays. | # software delays. | ||||
F_CPU = 16000000 | |||||
F_CPU ?= 16000000 | |||||
# | # | ||||
# LUFA specific | # LUFA specific | ||||
# | # | ||||
# Target architecture (see library "Board Types" documentation). | # Target architecture (see library "Board Types" documentation). | ||||
ARCH = AVR8 | |||||
ARCH ?= AVR8 | |||||
# Input clock frequency. | # Input clock frequency. | ||||
# This will define a symbol, F_USB, in all source code files equal to the | # This will define a symbol, F_USB, in all source code files equal to the | ||||
# | # | ||||
# If no clock division is performed on the input clock inside the AVR (via the | # 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. | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||||
F_USB = $(F_CPU) | |||||
F_USB ?= $(F_CPU) | |||||
# Interrupt driven control endpoint task(+60) | # Interrupt driven control endpoint task(+60) | ||||
#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | #OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||||
# Atmel DFU loader 4096 | # Atmel DFU loader 4096 | ||||
# LUFA bootloader 4096 | # LUFA bootloader 4096 | ||||
# USBaspLoader 2048 | # USBaspLoader 2048 | ||||
OPT_DEFS += -DBOOTLOADER_SIZE=512 | |||||
BOOTLOADER_SIZE ?= 4096 | |||||
OPT_DEFS += -DBOOTLOADER_SIZE=$(BOOTLOADER_SIZE) | |||||
# Build Options | # Build Options | ||||
# comment out to disable the 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 | |||||
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | |||||
MOUSEKEY_ENABLE ?= no # 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 | # 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 | |||||
#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" | # Optimize size but this may cause error "relocation truncated to fit" |
# 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 = 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 |
TARGET ?= ps2_usb_rev1 | |||||
MCU = atmega32u4 | |||||
CONFIG_H = config_rev1.h | |||||
BOOTLOADER_SIZE = 4096 | |||||
BOOTMAGIC_ENABLE ?= no | |||||
MOUSEKEY_ENABLE ?= yes | |||||
EXTRAKEY_ENABLE ?= yes | |||||
CONSOLE_ENABLE ?= yes | |||||
COMMAND_ENABLE ?= yes | |||||
NKRO_ENABLE ?= yes | |||||
PS2_USE_USART = yes | |||||
PS2_USE_INT = no | |||||
PS2_USE_BUSYWAIT = no | |||||
include Makefile |
TARGET ?= ps2_usb_rev2 | |||||
MCU = atmega32u2 | |||||
CONFIG_H = config_rev2.h | |||||
BOOTLOADER_SIZE = 4096 | |||||
BOOTMAGIC_ENABLE ?= no | |||||
MOUSEKEY_ENABLE ?= no | |||||
EXTRAKEY_ENABLE ?= yes | |||||
CONSOLE_ENABLE ?= yes | |||||
COMMAND_ENABLE ?= yes | |||||
NKRO_ENABLE ?= yes | |||||
PS2_USE_USART = no | |||||
PS2_USE_INT = yes | |||||
PS2_USE_BUSYWAIT = no | |||||
include Makefile |
# | |||||
# 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 = 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 |
# | |||||
# 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 = 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 |
TARGET = ps2_usb_rev1_unimap | |||||
UNIMAP_ENABLE = yes | |||||
KEYMAP_SECTION_ENABLE = yes | |||||
include Makefile.rev1 |
TARGET = ps2_usb_rev2_unimap | |||||
UNIMAP_ENABLE = yes | |||||
KEYMAP_SECTION_ENABLE = yes | |||||
include Makefile.rev2 |
Connect Wires | Connect Wires | ||||
------------- | ------------- | ||||
In case of Teensy2.0(ATMega32U4): | |||||
1. Connect **Vcc** and **GND**. | 1. Connect **Vcc** and **GND**. | ||||
2. Connect **Clock** and **Data** line. | 2. Connect **Clock** and **Data** line. | ||||
- **Interrupt**: **Clock** is on `PD1` and **Data** on `PD0`.(Recommended. Soarer's converter compatible) | - **Interrupt**: **Clock** is on `PD1` and **Data** on `PD0`.(Recommended. Soarer's converter compatible) | ||||
- **Busywait**: **Clock** is on `PD1` and **Data** on `PD0`. | - **Busywait**: **Clock** is on `PD1` and **Data** on `PD0`. | ||||
- **USART**: **Clock** is on `PD5` and **Data** on `PD2`. | - **USART**: **Clock** is on `PD5` and **Data** on `PD2`. | ||||
3. Optionally you need pull-up resistor. 1K-10K Ohm is OK. | |||||
3. You need pull-up resistors. 1K-10K Ohm would be fine. | |||||
To change pin configuration edit **config.h** and **Makefile**. | To change pin configuration edit **config.h** and **Makefile**. | ||||
Build Firmware | Build Firmware | ||||
-------------- | -------------- | ||||
For **PJRC Teensy** just run `make`: | |||||
$ make clean | |||||
$ make | |||||
To select keymap: | |||||
For **TMK converter Rev.2**: | |||||
$ make clean | |||||
$ make KEYMAP=[plain|jis|spacefn|...] | |||||
$ make -f Makefile.rev2 clean | |||||
$ make -f Makefile.rev2 KEYMAP=plain | |||||
After that you will find HEX file `ps2_usb_lufa.hex` in current directory. | |||||
To program firmware push the button on converter and run: | |||||
$ make -f Makefile.rev2 KEYMAP=plain dfu | |||||
- 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`. | |||||
- For **TMK converter Rev.1** use `make -f Makefile.rev1` instead. | |||||
- To select keymap use `jis`, `spacefn` or your own in place of `plain`. | |||||
Keymap | Keymap |
/* | |||||
Copyright 2016 Jun Wako <[email protected]> | |||||
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 "unimap_trans.h" | |||||
#define AC_FN0 ACTION_LAYER_MOMENTARY(1) | |||||
#ifdef KEYMAP_SECTION_ENABLE | |||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = { | |||||
#else | |||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = { | |||||
#endif | |||||
UNIMAP( | |||||
F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE, | |||||
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, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, | |||||
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NO, ENT, P4, P5, P6, PCMM, | |||||
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, | |||||
LCTL,LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,RGUI,FN0, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | |||||
), | |||||
UNIMAP( | |||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, | |||||
GRV, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, INS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,TRNS,HOME,PGUP,LEFT,RGHT, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,END, PGDN,DOWN, TRNS,TRNS, PGUP, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, HOME,PGDN,END, TRNS, TRNS,TRNS | |||||
), | |||||
}; |
/* | |||||
Copyright 2016 Jun Wako <[email protected]> | |||||
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 UNIMAP_TRNAS_H | |||||
#define UNIMAP_TRNAS_H | |||||
#include <stdint.h> | |||||
#include <avr/pgmspace.h> | |||||
#include "unimap.h" | |||||
/* Mapping to Universal keyboard layout | |||||
* | |||||
* Universal keyboard layout | |||||
* ,-----------------------------------------------. | |||||
* |F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24| | |||||
* ,---. |-----------------------------------------------| ,-----------. ,-----------. | |||||
* |Esc| |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut| | |||||
* `---' `-----------------------------------------------' `-----------' `-----------' | |||||
* ,-----------------------------------------------------------. ,-----------. ,---------------. | |||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| | |||||
* |-----------------------------------------------------------| |-----------| |---------------| | |||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| | |||||
* |-----------------------------------------------------------| `-----------' |---------------| | |||||
* |CapsL | A| S| D| F| G| H| J| K| L| ;| '| #|Retn| | 4| 5| 6|KP,| | |||||
* |-----------------------------------------------------------| ,---. |---------------| | |||||
* |Shft| <| Z| X| C| V| B| N| M| ,| .| /| RO|Shift | |Up | | 1| 2| 3|KP=| | |||||
* |-----------------------------------------------------------| ,-----------. |---------------| | |||||
* |Ctl|Gui|Alt|MHEN| Space |HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| | |||||
* `-----------------------------------------------------------' `-----------' `---------------' | |||||
* | |||||
* PS/2 scan codes | |||||
* http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf | |||||
* ,-----------------------------------------------. | |||||
* | 08| 10| 18| 20| 28| 30| 38| 40| 48| 50| 57| 5F| | |||||
* ,---. |-----------------------------------------------| ,-----------. ,-----------. | |||||
* | 76| | 05| 06| 04| 0C| 03| 0B| 83| 0A| 01| 09| 78| 07| | FC| 7E| FE| | A1| B2| A3| | |||||
* `---' `-----------------------------------------------' `-----------' `-----------' | |||||
* ,-----------------------------------------------------------. ,-----------. ,---------------. | |||||
* | 0E| 16| 1E| 26| 25| 2E| 36| 3D| 3E| 46| 45| 4E| 55| 6A| 66| | F0| EC| FD| | 77| CA| 7C| 7B| | |||||
* |-----------------------------------------------------------| |-----------| |---------------| | |||||
* | 0D | 15| 1D| 24| 2D| 2C| 35| 3C| 43| 44| 4D| 54| 5B| 5D | | F1| E9| FA| | 6C| 75| 7D| 79| | |||||
* |-----------------------------------------------------------| `-----------' |---------------| | |||||
* | 58 | 1C| 1B| 23| 2B| 34| 33| 3B| 42| 4B| 4C| 52| --| 5A | | 6B| 73| 74| 6D| | |||||
* |-----------------------------------------------------------| ,---. |---------------| | |||||
* | 12 | 61| 1A| 22| 21| 2A| 32| 31| 3A| 41| 49| 4A| 51| 59 | | F5| | 69| 72| 7A| 0F| | |||||
* |-----------------------------------------------------------| ,-----------. |---------------| | |||||
* | 14| 9F| 11| 67 | 29 | 64 | 13 | 91| A7| AF| 94| | EB| F2| F4| | 70 | 71| DA| | |||||
* `-----------------------------------------------------------' `-----------' `---------------' | |||||
*/ | |||||
const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = { | |||||
{ UNIMAP_NO, UNIMAP_F9, UNIMAP_NO, UNIMAP_F5, UNIMAP_F3, UNIMAP_F1, UNIMAP_F2, UNIMAP_F12 }, /* 00-07 */ | |||||
{ UNIMAP_F13, UNIMAP_F10, UNIMAP_F8, UNIMAP_F6, UNIMAP_F4, UNIMAP_TAB, UNIMAP_GRV, UNIMAP_PEQL }, /* 08-0F */ | |||||
{ UNIMAP_F14, UNIMAP_LALT, UNIMAP_LSHIFT,UNIMAP_KANA, UNIMAP_LCTL, UNIMAP_Q, UNIMAP_1, UNIMAP_NO }, /* 10-17 */ | |||||
{ UNIMAP_F15, UNIMAP_NO, UNIMAP_Z, UNIMAP_S, UNIMAP_A, UNIMAP_W, UNIMAP_2, UNIMAP_NO }, /* 18-1F */ | |||||
{ UNIMAP_F16, UNIMAP_C, UNIMAP_X, UNIMAP_D, UNIMAP_E, UNIMAP_4, UNIMAP_3, UNIMAP_NO }, /* 20-27 */ | |||||
{ UNIMAP_F17, UNIMAP_SPACE, UNIMAP_V, UNIMAP_F, UNIMAP_T, UNIMAP_R, UNIMAP_5, UNIMAP_NO }, /* 28-2F */ | |||||
{ UNIMAP_F18, UNIMAP_N, UNIMAP_B, UNIMAP_H, UNIMAP_G, UNIMAP_Y, UNIMAP_6, UNIMAP_NO }, /* 30-37 */ | |||||
{ UNIMAP_F19, UNIMAP_NO, UNIMAP_M, UNIMAP_J, UNIMAP_U, UNIMAP_7, UNIMAP_8, UNIMAP_NO }, /* 38-3F */ | |||||
{ UNIMAP_F20, UNIMAP_COMMA, UNIMAP_K, UNIMAP_I, UNIMAP_O, UNIMAP_0, UNIMAP_9, UNIMAP_NO }, /* 40-47 */ | |||||
{ UNIMAP_F21, UNIMAP_DOT, UNIMAP_SLASH, UNIMAP_L, UNIMAP_SCOLON,UNIMAP_P, UNIMAP_MINUS, UNIMAP_NO }, /* 48-4F */ | |||||
{ UNIMAP_F22, UNIMAP_RO, UNIMAP_QUOTE, UNIMAP_NO, UNIMAP_LBRC, UNIMAP_EQUAL, UNIMAP_NO, UNIMAP_F23 }, /* 50-57 */ | |||||
{ UNIMAP_CAPS, UNIMAP_RSHIFT,UNIMAP_ENTER, UNIMAP_RBRC, UNIMAP_NO, UNIMAP_BSLASH,UNIMAP_NO, UNIMAP_F24 }, /* 58-5F */ | |||||
{ UNIMAP_NO, UNIMAP_NUBS, UNIMAP_NO, UNIMAP_NO, UNIMAP_HENK, UNIMAP_NO, UNIMAP_BSPACE,UNIMAP_MHEN }, /* 60-67 */ | |||||
{ UNIMAP_NO, UNIMAP_P1, UNIMAP_JYEN, UNIMAP_P4, UNIMAP_P7, UNIMAP_PCMM, UNIMAP_NO, UNIMAP_NO }, /* 68-6F */ | |||||
{ UNIMAP_P0, UNIMAP_PDOT, UNIMAP_P2, UNIMAP_P5, UNIMAP_P6, UNIMAP_P8, UNIMAP_ESC, UNIMAP_NLCK }, /* 70-77 */ | |||||
{ UNIMAP_F11, UNIMAP_PPLS, UNIMAP_P3, UNIMAP_PMNS, UNIMAP_PAST, UNIMAP_P9, UNIMAP_SLCK, UNIMAP_NO }, /* 78-7F */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_F7, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* 80-87 */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* 88-8F */ | |||||
{ UNIMAP_NO, UNIMAP_RALT, UNIMAP_NO, UNIMAP_NO, UNIMAP_RCTRL, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* 90-97 */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_LGUI }, /* 98-9F */ | |||||
{ UNIMAP_NO, UNIMAP_VOLD, UNIMAP_NO, UNIMAP_MUTE, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_RGUI }, /* A0-A7 */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_APP }, /* A8-AF */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_VOLU, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* B0-B7 */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* B8-BF */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* C0-C7 */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_PSLS, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* C8-CF */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* D0-D7 */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_PENT, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* D8-DF */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* E0-E7 */ | |||||
{ UNIMAP_NO, UNIMAP_END, UNIMAP_NO, UNIMAP_LEFT, UNIMAP_HOME, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* E8-EF */ | |||||
{ UNIMAP_INS, UNIMAP_DEL, UNIMAP_DOWN, UNIMAP_NO, UNIMAP_RIGHT, UNIMAP_UP, UNIMAP_NO, UNIMAP_NO }, /* F0-F7 */ | |||||
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_PGDOWN,UNIMAP_NO, UNIMAP_PSCR, UNIMAP_PGUP, UNIMAP_PAUSE, UNIMAP_NO }, /* F8-FF */ | |||||
}; | |||||
#endif | |||||
PROTOCOL_DIR = protocol | PROTOCOL_DIR = protocol | ||||
ifdef PS2_MOUSE_ENABLE | |||||
ifeq (yes,$(strip $(PS2_MOUSE_ENABLE))) | |||||
SRC += $(PROTOCOL_DIR)/ps2_mouse.c | SRC += $(PROTOCOL_DIR)/ps2_mouse.c | ||||
OPT_DEFS += -DPS2_MOUSE_ENABLE | OPT_DEFS += -DPS2_MOUSE_ENABLE | ||||
OPT_DEFS += -DMOUSE_ENABLE | OPT_DEFS += -DMOUSE_ENABLE | ||||
endif | endif | ||||
ifdef PS2_USE_BUSYWAIT | |||||
ifeq (yes,$(strip $(PS2_USE_BUSYWAIT))) | |||||
SRC += protocol/ps2_busywait.c | SRC += protocol/ps2_busywait.c | ||||
SRC += protocol/ps2_io_avr.c | SRC += protocol/ps2_io_avr.c | ||||
OPT_DEFS += -DPS2_USE_BUSYWAIT | OPT_DEFS += -DPS2_USE_BUSYWAIT | ||||
endif | endif | ||||
ifdef PS2_USE_INT | |||||
ifeq (yes,$(strip $(PS2_USE_INT))) | |||||
SRC += protocol/ps2_interrupt.c | SRC += protocol/ps2_interrupt.c | ||||
SRC += protocol/ps2_io_avr.c | SRC += protocol/ps2_io_avr.c | ||||
OPT_DEFS += -DPS2_USE_INT | OPT_DEFS += -DPS2_USE_INT | ||||
endif | endif | ||||
ifdef PS2_USE_USART | |||||
ifeq (yes,$(strip $(PS2_USE_USART))) | |||||
SRC += protocol/ps2_usart.c | SRC += protocol/ps2_usart.c | ||||
SRC += protocol/ps2_io_avr.c | SRC += protocol/ps2_io_avr.c | ||||
OPT_DEFS += -DPS2_USE_USART | OPT_DEFS += -DPS2_USE_USART | ||||
endif | endif | ||||
ifdef XT_USE_INT | |||||
ifeq (yes,$(strip $(XT_USE_INT))) | |||||
SRC += protocol/xt_interrupt.c | SRC += protocol/xt_interrupt.c | ||||
SRC += protocol/xt_io_avr.c | SRC += protocol/xt_io_avr.c | ||||
OPT_DEFS += -DXT_USE_INT | OPT_DEFS += -DXT_USE_INT | ||||
endif | endif | ||||
ifdef SERIAL_MOUSE_MICROSOFT_ENABLE | |||||
ifeq (yes,$(strip $(SERIAL_MOUSE_MICROSOFT_ENABLE))) | |||||
SRC += $(PROTOCOL_DIR)/serial_mouse_microsoft.c | SRC += $(PROTOCOL_DIR)/serial_mouse_microsoft.c | ||||
OPT_DEFS += -DSERIAL_MOUSE_ENABLE -DSERIAL_MOUSE_MICROSOFT \ | OPT_DEFS += -DSERIAL_MOUSE_ENABLE -DSERIAL_MOUSE_MICROSOFT \ | ||||
-DMOUSE_ENABLE | -DMOUSE_ENABLE | ||||
endif | endif | ||||
ifdef SERIAL_MOUSE_MOUSESYSTEMS_ENABLE | |||||
ifeq (yes,$(strip $(SERIAL_MOUSE_MOUSESYSTEMS_ENABLE))) | |||||
SRC += $(PROTOCOL_DIR)/serial_mouse_mousesystems.c | SRC += $(PROTOCOL_DIR)/serial_mouse_mousesystems.c | ||||
OPT_DEFS += -DSERIAL_MOUSE_ENABLE -DSERIAL_MOUSE_MOUSESYSTEMS \ | OPT_DEFS += -DSERIAL_MOUSE_ENABLE -DSERIAL_MOUSE_MOUSESYSTEMS \ | ||||
-DMOUSE_ENABLE | -DMOUSE_ENABLE | ||||
endif | endif | ||||
ifdef SERIAL_MOUSE_USE_SOFT | |||||
ifeq (yes,$(strip $(SERIAL_MOUSE_USE_SOFT))) | |||||
SRC += $(PROTOCOL_DIR)/serial_soft.c | SRC += $(PROTOCOL_DIR)/serial_soft.c | ||||
endif | endif | ||||
ifdef SERIAL_MOUSE_USE_UART | |||||
ifeq (yes,$(strip $(SERIAL_MOUSE_USE_UART))) | |||||
SRC += $(PROTOCOL_DIR)/serial_uart.c | SRC += $(PROTOCOL_DIR)/serial_uart.c | ||||
endif | endif | ||||
ifdef ADB_MOUSE_ENABLE | |||||
ifeq (yes,$(strip $(ADB_MOUSE_ENABLE))) | |||||
OPT_DEFS += -DADB_MOUSE_ENABLE -DMOUSE_ENABLE | OPT_DEFS += -DADB_MOUSE_ENABLE -DMOUSE_ENABLE | ||||
endif | endif | ||||