Преглед на файлове

usb_usb: Add unimap

master
tmk преди 7 години
родител
ревизия
fef48a3da5

+ 28
- 16
converter/usb_usb/Makefile Целия файл

@@ -39,15 +39,15 @@
#----------------------------------------------------------------------------

# Target file name (without extension).
TARGET = usb_usb
TARGET ?= usb_usb

TMK_DIR = ../../tmk_core
TMK_DIR ?= ../../tmk_core

# Directory keyboard dependent files exist
TARGET_DIR = .
TARGET_DIR ?= .

# MCU name
MCU = atmega32u4
MCU ?= atmega32u4


# Processor frequency.
@@ -61,7 +61,7 @@ MCU = atmega32u4
# 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
F_CPU ?= 16000000



@@ -69,7 +69,7 @@ F_CPU = 16000000
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
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
@@ -81,7 +81,7 @@ ARCH = AVR8
#
# 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)
F_USB ?= $(F_CPU)
# Interrupt driven control endpoint task
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT

@@ -90,11 +90,11 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Build Options
# comment out to disable the options.
#
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Media control and System control
CONSOLE_ENABLE = yes # Console for debug
#COMMAND_ENABLE = yes # Commands for debug and configuration
#NKRO_ENABLE = yes # USB Nkey Rollover
MOUSEKEY_ENABLE ?= yes # Mouse keys
EXTRAKEY_ENABLE ?= yes # Media 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
@@ -108,16 +108,28 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
#OPT_DEFS += -DNO_ACTION_LAYER
#OPT_DEFS += -DNO_ACTION_MACRO

SRC = usb_usb.cpp \
SRC ?= usb_usb.cpp \
main.cpp

#
# Keymap file
#
ifeq (yes,$(strip $(UNIMAP_ENABLE)))
KEYMAP_FILE = unimap
else
ifeq (yes,$(strip $(ACTIONMAP_ENABLE)))
KEYMAP_FILE = actionmap
else
KEYMAP_FILE = keymap
endif
endif
ifdef KEYMAP
SRC := keymap_$(KEYMAP).c $(SRC)
SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC)
else
SRC := keymap.c $(SRC)
SRC := $(KEYMAP_FILE).c $(SRC)
endif

CONFIG_H = config.h
CONFIG_H ?= config.h




converter/usb_usb/Makefile.keymap_editor → converter/usb_usb/Makefile.editor Целия файл

@@ -1,5 +1,4 @@
# build firmware for keymap editor
#
TARGET = usb_usb_editor
KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
KEYMAP = editor
include Makefile

+ 4
- 0
converter/usb_usb/Makefile.unimap Целия файл

@@ -0,0 +1,4 @@
TARGET = usb_usb_unimap
UNIMAP_ENABLE = yes
KEYMAP_SECTION_ENABLE = yes
include Makefile

+ 23
- 6
converter/usb_usb/README Целия файл

@@ -1,21 +1,31 @@
USB to USB keyboard protocol converter
======================================
See for detail and discussion.
https://geekhack.org/index.php?topic=69169.0


Hardware requirement
--------------------
Arduino Leonardo
http://arduino.cc/en/Main/ArduinoBoardLeonardo
There are two options.

### TMK USB-USB Converter
You can buy a fully assembled converter from me here.

Circuit@Home USB Host Shield 2.0
https://geekhack.org/index.php?topic=69169.0

### Arduino Leonardo + Circuit@Home USB Host Shield 2.0
Buying Arduino Leonardo and USB Host Shield 2.0(from Circuit@home) will be better, you won't need even soldering iron.

http://arduino.cc/en/Main/ArduinoBoardLeonardo
https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/

Buying Arduino Leonardo and USB Host Shield 2.0(from Circuit@home) will be the easiest way, you won't need even soldering iron.
Arduino's Shield will also work well but I think Sparkfun's needs to be modified.
Other compatible boards like Arduino's Shield will also work well but I think Sparkfun's needs to be modified.

http://arduino.cc/en/Main/ArduinoUSBHostShield
https://www.sparkfun.com/products/9947

Also Pro Micro 3.3V(not Mini) or Teensy with mini host shield will work with some fixes on signal/power routing.

https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini
https://www.sparkfun.com/products/12587
https://www.pjrc.com/teensy/td_libs_USBHostShield.html
@@ -24,6 +34,8 @@ Also Pro Micro 3.3V(not Mini) or Teensy with mini host shield will work with som

Build firmware
--------------
Build.

$ git clone git://github.com/tmk/tmk_keyboard.git
$ cd tmk_keyboard
$ git submodule init
@@ -31,7 +43,12 @@ Build firmware
$ cd converter/usb_usb
$ make

Program converter. Push reset button on Leonardo before run this command. Serial port name(COM17) depends your system. On Linux I got /dev/ttyACM0.
And Program converter. Push button on TMK converter and just run this.

$ make dfu


In case of Leonardo push reset button then run command. Serial port name(COM17) depends your system. On Linux I got /dev/ttyACM0.

$ DEV=COM17 make program
or

+ 1615
- 0
converter/usb_usb/binary/usb_usb_unimap.hex
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 45
- 0
converter/usb_usb/unimap.c Целия файл

@@ -0,0 +1,45 @@
/*
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, NUHS,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,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT
),
UNIMAP(
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,F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,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,FN0, TRNS, HOME,PGDN,END, TRNS, TRNS,TRNS
),
};

+ 99
- 0
converter/usb_usb/unimap_trans.h Целия файл

@@ -0,0 +1,99 @@
/*
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_COMMON_H
#define UNIMAP_COMMON_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|
* `-----------------------------------------------------------' `-----------' `---------------'
*/

/* USB 16x16
* ,---------------. ,---------------. ,---------------.
* |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|Pwr| | Help |
* `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------'
* ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------.
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn|
* |-----------------------------------------------------------| |-----------| |---------------| |-------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und|
* |-----------------------------------------------------------| `-----------' |---------------| |-------|
* |CapsL | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy|
* |-----------------------------------------------------------| ,---. |---------------| |-------|
* |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst|
* |-----------------------------------------------------------| ,-----------. |---------------| |-------|
* |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut|
* `-----------------------------------------------------------' `-----------' `---------------' `-------'
*/
const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
{ UNIMAP_KANA, UNIMAP_VOLUME_DOWN, UNIMAP_VOLUME_UP, UNIMAP_VOLUME_MUTE, UNIMAP_A, UNIMAP_B, UNIMAP_C, UNIMAP_D,
UNIMAP_E, UNIMAP_F, UNIMAP_G, UNIMAP_H, UNIMAP_I, UNIMAP_J, UNIMAP_K, UNIMAP_L },
{ UNIMAP_M, UNIMAP_N, UNIMAP_O, UNIMAP_P, UNIMAP_Q, UNIMAP_R, UNIMAP_S, UNIMAP_T,
UNIMAP_U, UNIMAP_V, UNIMAP_W, UNIMAP_X, UNIMAP_Y, UNIMAP_Z, UNIMAP_1, UNIMAP_2 },
{ UNIMAP_3, UNIMAP_4, UNIMAP_5, UNIMAP_6, UNIMAP_7, UNIMAP_8, UNIMAP_9, UNIMAP_0,
UNIMAP_ENTER, UNIMAP_ESCAPE,UNIMAP_BSPACE,UNIMAP_TAB, UNIMAP_SPACE, UNIMAP_MINUS, UNIMAP_EQUAL, UNIMAP_LBRACKET },
{ UNIMAP_RBRACKET,UNIMAP_BSLASH,UNIMAP_NONUS_HASH, UNIMAP_SCOLON, UNIMAP_QUOTE, UNIMAP_GRAVE, UNIMAP_COMMA, UNIMAP_DOT,
UNIMAP_SLASH, UNIMAP_CAPSLOCK,UNIMAP_F1, UNIMAP_F2, UNIMAP_F3, UNIMAP_F4, UNIMAP_F5, UNIMAP_F6 },
{ UNIMAP_F7, UNIMAP_F8, UNIMAP_F9, UNIMAP_F10, UNIMAP_F11, UNIMAP_F12, UNIMAP_PSCREEN,UNIMAP_SCROLLLOCK,
UNIMAP_PAUSE, UNIMAP_INSERT,UNIMAP_HOME, UNIMAP_PGUP, UNIMAP_DELETE,UNIMAP_END, UNIMAP_PGDOWN, UNIMAP_RIGHT },
{ UNIMAP_LEFT, UNIMAP_DOWN, UNIMAP_UP, UNIMAP_NUMLOCK, UNIMAP_KP_SLASH, UNIMAP_KP_ASTERISK, UNIMAP_KP_MINUS, UNIMAP_KP_PLUS,
UNIMAP_KP_ENTER,UNIMAP_KP_1,UNIMAP_KP_2, UNIMAP_KP_3, UNIMAP_KP_4, UNIMAP_KP_5, UNIMAP_KP_6, UNIMAP_KP_7 },
{ UNIMAP_KP_8, UNIMAP_KP_9, UNIMAP_KP_0, UNIMAP_KP_DOT,UNIMAP_NONUS_BSLASH,UNIMAP_APPLICATION,UNIMAP_KP_COMMA,UNIMAP_KP_EQUAL,
UNIMAP_F13, UNIMAP_F14, UNIMAP_F15, UNIMAP_F16, UNIMAP_F17, UNIMAP_F18, UNIMAP_F19, UNIMAP_F20 },
{ UNIMAP_F21, UNIMAP_F22, UNIMAP_F23, UNIMAP_F24, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO,
UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* 78-7F */ \
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_RO, /* 80-87 */ \
UNIMAP_NO, UNIMAP_JYEN, UNIMAP_HENK, UNIMAP_MHEN, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* 88-8F */ \
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, /* 90-97 */ \
UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* 98-9F */ \
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, /* A0-A7 */ \
UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* A8-AF */ \
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, 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_NO, 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_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* D8-DF */ \
{ UNIMAP_LCTRL, UNIMAP_LSHIFT,UNIMAP_LALT, UNIMAP_LGUI, UNIMAP_RCTRL, UNIMAP_RSHIFT,UNIMAP_RALT, UNIMAP_RGUI, /* E0-E7 */ \
UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* E8-EF */ \
{ UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, /* F0-F7 */ \
UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO, UNIMAP_NO }, /* F8-FF */ \
};

#endif

Loading…
Отказ
Запис