cleans up folder structure
* consolidates docs * deletes converter/ * updates .md references (most)
This commit is contained in:
parent
189a3b02fb
commit
b36e532b5e
151 changed files with 12 additions and 12799 deletions
12
README.md
12
README.md
|
|
@ -14,18 +14,18 @@ The OLKB product firmwares are maintained by Jack, the Ergodox EZ by Erez, and t
|
|||
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](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 [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.
|
||||
* [tmk_core/doc/keycode.txt](tmk_core/doc/keycode.txt) - an explanation of those same keycodes.
|
||||
* [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](tmk_core/doc). QMK is based on TMK, and this explains how it works internally.
|
||||
* The [TMK documentation](doc/TMK_README.md). QMK is based on TMK, and this explains how it works internally.
|
||||
|
||||
## 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 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
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ rounded up (5 bits per key). For example on Planck (48 keys) it uses
|
|||
|
||||
### 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.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,141 +0,0 @@
|
|||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make coff = Convert ELF to AVR COFF.
|
||||
#
|
||||
# make extcoff = Convert ELF to AVR Extended COFF.
|
||||
#
|
||||
# make program = Download the hex file to the device.
|
||||
# Please customize your programmer settings(PROGRAM_CMD)
|
||||
#
|
||||
# make teensy = Download the hex file to the device, using teensy_loader_cli.
|
||||
# (must have teensy_loader_cli installed).
|
||||
#
|
||||
# make dfu = Download the hex file to the device, using dfu-programmer (must
|
||||
# have dfu-programmer installed).
|
||||
#
|
||||
# make flip = Download the hex file to the device, using Atmel FLIP (must
|
||||
# have Atmel FLIP installed).
|
||||
#
|
||||
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
|
||||
# (must have dfu-programmer installed).
|
||||
#
|
||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
|
||||
# (must have Atmel FLIP installed).
|
||||
#
|
||||
# make debug = Start either simulavr or avarice as specified for debugging,
|
||||
# with avr-gdb or avr-insight as the front end for debugging.
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = adb_usb_lufa
|
||||
|
||||
# Directory common source filess exist
|
||||
TMK_DIR = ../../tmk_core
|
||||
|
||||
# Directory keyboard dependent files exist
|
||||
TARGET_DIR = .
|
||||
|
||||
# project specific files
|
||||
SRC = keymap_common.c \
|
||||
matrix.c \
|
||||
led.c \
|
||||
adb.c
|
||||
|
||||
ifdef KEYMAP
|
||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
||||
else
|
||||
SRC := keymap_ansi.c $(SRC)
|
||||
endif
|
||||
|
||||
CONFIG_H = config.h
|
||||
|
||||
|
||||
# MCU name
|
||||
#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
|
||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
ADB_MOUSE_ENABLE = yes
|
||||
|
||||
# ADB Mice need acceleration for todays much bigger screens.
|
||||
OPT_DEFS += -DADB_MOUSE_MAXACC=8
|
||||
|
||||
|
||||
# Optimize size but this may cause error "relocation truncated to fit"
|
||||
#EXTRALDFLAGS = -Wl,--relax
|
||||
|
||||
# Search Path
|
||||
VPATH += $(TARGET_DIR)
|
||||
VPATH += $(TMK_DIR)
|
||||
|
||||
include $(TMK_DIR)/protocol/lufa.mk
|
||||
include $(TMK_DIR)/protocol.mk
|
||||
include $(TMK_DIR)/common.mk
|
||||
include $(TMK_DIR)/rules.mk
|
||||
|
|
@ -1,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.
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue