aboutsummaryrefslogtreecommitdiffstats
path: root/converter/adb_usb
diff options
context:
space:
mode:
Diffstat (limited to 'converter/adb_usb')
-rw-r--r--converter/adb_usb/Makefile141
-rw-r--r--converter/adb_usb/Makefile.pjrc73
-rw-r--r--converter/adb_usb/README.md103
-rw-r--r--converter/adb_usb/config.h63
-rw-r--r--converter/adb_usb/keymap_ansi.c16
-rw-r--r--converter/adb_usb/keymap_common.c30
-rw-r--r--converter/adb_usb/keymap_common.h212
-rw-r--r--converter/adb_usb/keymap_hasu.c58
-rw-r--r--converter/adb_usb/keymap_iso.c16
-rw-r--r--converter/adb_usb/led.c27
-rw-r--r--converter/adb_usb/matrix.c296
11 files changed, 0 insertions, 1035 deletions
diff --git a/converter/adb_usb/Makefile b/converter/adb_usb/Makefile
deleted file mode 100644
index 2369ee70a..000000000
--- a/converter/adb_usb/Makefile
+++ /dev/null
@@ -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
diff --git a/converter/adb_usb/Makefile.pjrc b/converter/adb_usb/Makefile.pjrc
deleted file mode 100644
index c320c09d2..000000000
--- a/converter/adb_usb/Makefile.pjrc
+++ /dev/null
@@ -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
diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md
deleted file mode 100644
index 46082ff67..000000000
--- a/converter/adb_usb/README.md
+++ /dev/null
@@ -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
diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h
deleted file mode 100644
index 5ce5c2215..000000000
--- a/converter/adb_usb/config.h
+++ /dev/null
@@ -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
diff --git a/converter/adb_usb/keymap_ansi.c b/converter/adb_usb/keymap_ansi.c
deleted file mode 100644
index 4ea601be0..000000000
--- a/converter/adb_usb/keymap_ansi.c
+++ /dev/null
@@ -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[] = {
-};
diff --git a/converter/adb_usb/keymap_common.c b/converter/adb_usb/keymap_common.c
deleted file mode 100644
index 55a13793c..000000000
--- a/converter/adb_usb/keymap_common.c
+++ /dev/null
@@ -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)]) };
-}
diff --git a/converter/adb_usb/keymap_common.h b/converter/adb_usb/keymap_common.h
deleted file mode 100644
index bdca38e12..000000000
--- a/converter/adb_usb/keymap_common.h
+++ /dev/null
@@ -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
- */
diff --git a/converter/adb_usb/keymap_hasu.c b/converter/adb_usb/keymap_hasu.c
deleted file mode 100644
index a0b3f1fc6..000000000
--- a/converter/adb_usb/keymap_hasu.c
+++ /dev/null
@@ -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),
-};
diff --git a/converter/adb_usb/keymap_iso.c b/converter/adb_usb/keymap_iso.c
deleted file mode 100644
index a1b1a5ebd..000000000
--- a/converter/adb_usb/keymap_iso.c
+++ /dev/null
@@ -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[] = {
-};
diff --git a/converter/adb_usb/led.c b/converter/adb_usb/led.c
deleted file mode 100644
index 3ee64a8e7..000000000
--- a/converter/adb_usb/led.c
+++ /dev/null
@@ -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);
-}
diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c
deleted file mode 100644
index 6220ee6e1..000000000
--- a/converter/adb_usb/matrix.c
+++ /dev/null
@@ -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;
-}