summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortmk <hasu@tmk-kbd.com>2015-01-16 11:51:34 +0900
committertmk <hasu@tmk-kbd.com>2015-01-16 11:51:34 +0900
commitc610bae63197482bf323fbd63475dd4dba71ed46 (patch)
tree3624044b5dede28f377e262f66d4f90963e0870d
parent3e88e8b761f8f8d8c5155fed3f064cc1bf207dab (diff)
parent099701dd3130d433244b3a4102f36f547aec25ae (diff)
Merge branch 'rn42_integrate'
-rw-r--r--keyboard/hhkb/Makefile.nodebug141
-rw-r--r--keyboard/hhkb/Makefile.rn42 (renamed from keyboard/hhkb_rn42/Makefile)22
-rw-r--r--keyboard/hhkb/README.md17
-rw-r--r--keyboard/hhkb/config_rn42.h (renamed from keyboard/hhkb_rn42/config.h)0
-rw-r--r--keyboard/hhkb/hhkb_avr.h28
-rw-r--r--keyboard/hhkb/matrix.c27
-rw-r--r--keyboard/hhkb/not_supported/Makefile.iwrap (renamed from keyboard/hhkb/Makefile.iwrap)0
-rw-r--r--keyboard/hhkb/not_supported/Makefile.vusb (renamed from keyboard/hhkb/Makefile.vusb)0
-rw-r--r--keyboard/hhkb/not_supported/config_iwrap.h (renamed from keyboard/hhkb/config_iwrap.h)0
-rw-r--r--keyboard/hhkb/not_supported/config_vusb.h (renamed from keyboard/hhkb/config_vusb.h)0
-rw-r--r--keyboard/hhkb/not_supported/iwrap.txt (renamed from keyboard/hhkb/iwrap.txt)0
-rw-r--r--keyboard/hhkb/not_supported/usbconfig.h (renamed from keyboard/hhkb/usbconfig.h)0
-rw-r--r--keyboard/hhkb/rn42.mk (renamed from keyboard/hhkb_rn42/rn42.mk)0
-rw-r--r--keyboard/hhkb/rn42/MEMO.txt (renamed from keyboard/hhkb_rn42/rn42/MEMO.txt)0
-rw-r--r--keyboard/hhkb/rn42/PowerSave.txt (renamed from keyboard/hhkb_rn42/PowerSave.txt)47
-rw-r--r--keyboard/hhkb/rn42/RN42.txt (renamed from keyboard/hhkb_rn42/rn42/RN42.txt)0
-rw-r--r--keyboard/hhkb/rn42/battery.c (renamed from keyboard/hhkb_rn42/rn42/battery.c)0
-rw-r--r--keyboard/hhkb/rn42/battery.h (renamed from keyboard/hhkb_rn42/rn42/battery.h)0
-rw-r--r--keyboard/hhkb/rn42/main.c (renamed from keyboard/hhkb_rn42/rn42/main.c)0
-rw-r--r--keyboard/hhkb/rn42/rn42.c (renamed from keyboard/hhkb_rn42/rn42/rn42.c)0
-rw-r--r--keyboard/hhkb/rn42/rn42.h (renamed from keyboard/hhkb_rn42/rn42/rn42.h)0
-rw-r--r--keyboard/hhkb/rn42/rn42_task.c (renamed from keyboard/hhkb_rn42/rn42/rn42_task.c)0
-rw-r--r--keyboard/hhkb/rn42/rn42_task.h (renamed from keyboard/hhkb_rn42/rn42/rn42_task.h)0
-rw-r--r--keyboard/hhkb/rn42/suart.S (renamed from keyboard/hhkb_rn42/rn42/suart.S)0
-rw-r--r--keyboard/hhkb/rn42/suart.h (renamed from keyboard/hhkb_rn42/rn42/suart.h)0
-rw-r--r--keyboard/hhkb_rn42/hhkb_avr.h166
-rw-r--r--keyboard/hhkb_rn42/keymap_common.c33
-rw-r--r--keyboard/hhkb_rn42/keymap_common.h84
-rw-r--r--keyboard/hhkb_rn42/keymap_hasu.c282
-rw-r--r--keyboard/hhkb_rn42/keymap_jp.c50
-rw-r--r--keyboard/hhkb_rn42/led.c33
-rw-r--r--keyboard/hhkb_rn42/matrix.c190
32 files changed, 73 insertions, 1047 deletions
diff --git a/keyboard/hhkb/Makefile.nodebug b/keyboard/hhkb/Makefile.nodebug
deleted file mode 100644
index 578ba70c45..0000000000
--- a/keyboard/hhkb/Makefile.nodebug
+++ /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 = hhkb_lufa
-
-# Directory common source filess exist
-TOP_DIR = ../..
-
-# Directory keyboard dependent files exist
-TARGET_DIR = .
-
-
-# List C source files here. (C dependencies are automatically generated.)
-SRC += keymap_common.c \
- matrix.c \
- led.c
-
-ifdef KEYMAP
- SRC := keymap_$(KEYMAP).c $(SRC)
-else
- SRC := keymap_hasu.c $(SRC)
-endif
-
-CONFIG_H = config.h
-
-
-# MCU name
-# PJRC Teensy++ 2.0
-#MCU = at90usb1286
-# TMK Alt Controller or PJRC Teensy 2.0
-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
-#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
-
-
-# Boot Section Size in *bytes*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096 (TMK Alt Controller)
-# 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
-MOUSEKEY_ENABLE = yes # Mouse keys
-EXTRAKEY_ENABLE = yes # Audio control and System control
-#CONSOLE_ENABLE = yes # Console for debug
-COMMAND_ENABLE = yes # Commands for debug and configuration
-NKRO_ENABLE = yes # USB Nkey Rollover
-KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
-
-
-# Search Path
-VPATH += $(TARGET_DIR)
-VPATH += $(TOP_DIR)
-
-include $(TOP_DIR)/protocol/lufa.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
-
-debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION
-debug-on: all
-
-debug-off: EXTRAFLAGS += -DNO_DEBUG -DNO_PRINT
-debug-off: all
diff --git a/keyboard/hhkb_rn42/Makefile b/keyboard/hhkb/Makefile.rn42
index 3d9a602a58..b1eacd070f 100644
--- a/keyboard/hhkb_rn42/Makefile
+++ b/keyboard/hhkb/Makefile.rn42
@@ -39,7 +39,7 @@
#----------------------------------------------------------------------------
# Target file name (without extension).
-TARGET = hhkb_lufa
+TARGET = hhkb_rn42
# Directory common source filess exist
TOP_DIR = ../..
@@ -53,13 +53,10 @@ SRC += keymap_common.c \
matrix.c \
led.c
-CONFIG_H = config.h
+CONFIG_H = config_rn42.h
# MCU name
-# PJRC Teensy++ 2.0
-#MCU = at90usb1286
-# TMK Alt Controller or PJRC Teensy 2.0
MCU = atmega32u4
# Processor frequency.
@@ -121,11 +118,6 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
#HHKB_JP = yes # HHKB JP support
-ifdef HHKB_JP
- OPT_DEFS += -DHHKB_JP
-endif
-
-
#
# Keymap file
#
@@ -134,12 +126,17 @@ ifdef KEYMAP
else
ifdef HHKB_JP
SRC := keymap_jp.c $(SRC)
- else
- SRC := keymap_hasu.c $(SRC)
+ else
+ SRC := keymap_hhkb.c $(SRC)
endif
endif
+ifneq (, $(or $(findstring keymap_jp.c, $(SRC)), $(findstring yes, $(HHKB_JP))))
+ OPT_DEFS += -DHHKB_JP
+endif
+
+
# Search Path
VPATH += $(TARGET_DIR)
VPATH += $(TOP_DIR)
@@ -154,4 +151,5 @@ debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION
debug-on: all
debug-off: EXTRAFLAGS += -DNO_DEBUG -DNO_PRINT
+debug-off: OPT_DEFS := $(filter-out -DCONSOLE_ENABLE,$(OPT_DEFS))
debug-off: all
diff --git a/keyboard/hhkb/README.md b/keyboard/hhkb/README.md
index f9fd165076..fcd72e1941 100644
--- a/keyboard/hhkb/README.md
+++ b/keyboard/hhkb/README.md
@@ -10,11 +10,17 @@ See [this thread][AltController] in geekhack.org.
[AltController]: http://geekhack.org/index.php?topic=12047.0
+## Update
+* Bluetooth module RN-42 is supported.(2015/01)
+* V-USB and iWRAP are no longer supported now, but still it'll works with a little fix. See not_supported directory.(2015/01)
+
+
##Features
* Customizable keymap
* More keymap layers(more Fn keys)
* Mouse keys
* USB NKRO
+* Bluetooth(RN-42)
See README of [tmk_keyboard] for more.
@@ -50,8 +56,9 @@ If you use other than **TMK Alt Controller Board** set proper `MCU`, `BOOTLOADER
### Build
Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. Just `make` with `KEYMAP` option like:
- $ make KEYMAP=[hasu|hhkb|spacefn|<name>]
- $ make -f Makefile.jp KEYMAP=[jp|<name>] # for HHKB JP
+ $ make -f Makefile.<jp|pjrc|rn42> KEYMAP=(hasu|hhkb|spacefn|<name>)
+
+You can omit `-f` option when you use `Makefile`. `Makefile` is used for **Pro2 and Pro**, `Makefile.jp` fits for **JP** model and `Makefile.rn42` supports Bluetooth module **RN-42**. `Makefile.pjrc` uses **PJRC** as output protocol instead of **LUFA**.
### Program
@@ -59,13 +66,11 @@ First, push reset button on board to start bootloader.
This command programs the controller with [dfu-programmer] if the tool is installed and configured properly.
- $ make dfu
- $ make -f Makefile.jp dfu # for HHKB JP
+ $ make -f Makefile.<variant> KEYMAP=<name> dfu
Or you can also use [FLIP] command to program. Also the tool should be installed and configured properly. FLIP GUI application is also available.
- $ make flip
- $ make -f Makefile.jp flip # for HHKB JP
+ $ make -f Makefile.<variant> KEYMAP=<name> flip
Use [Teensy Loader] if your controller is Teensy/Teensy++.
diff --git a/keyboard/hhkb_rn42/config.h b/keyboard/hhkb/config_rn42.h
index 21e73f1c53..21e73f1c53 100644
--- a/keyboard/hhkb_rn42/config.h
+++ b/keyboard/hhkb/config_rn42.h
diff --git a/keyboard/hhkb/hhkb_avr.h b/keyboard/hhkb/hhkb_avr.h
index b7bd507b5d..7ea6322c73 100644
--- a/keyboard/hhkb/hhkb_avr.h
+++ b/keyboard/hhkb/hhkb_avr.h
@@ -41,17 +41,32 @@ static inline void KEY_UNABLE(void) { (PORTB |= (1<<6)); }
static inline bool KEY_STATE(void) { return (PIND & (1<<7)); }
static inline void KEY_PREV_ON(void) { (PORTB |= (1<<7)); }
static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); }
+#ifdef HHKB_POWER_SAVING
+static inline void KEY_POWER_ON(void) {
+ DDRB = 0xFF; PORTB = 0x40; // change pins output
+ DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on
+ /* Without this wait you will miss or get false key events. */
+ _delay_ms(5); // wait for powering up
+}
+static inline void KEY_POWER_OFF(void) {
+ /* input with pull-up consumes less than without it when pin is open. */
+ DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up
+ DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off
+}
+static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); }
+#else
static inline void KEY_POWER_ON(void) {}
static inline void KEY_POWER_OFF(void) {}
+static inline bool KEY_POWER_STATE(void) { return true; }
+#endif
static inline void KEY_INIT(void)
{
+ /* row,col,prev: output */
DDRB = 0xFF;
- PORTB = 0x00;
+ PORTB = 0x40; // unable
+ /* key: input with pull-up */
DDRD &= ~0x80;
- PORTD |= 0x80;
- /* keyswitch board power on */
- DDRD |= (1<<4);
- PORTD |= (1<<4);
+ PORTD |= 0x80;
#ifdef HHKB_JP
/* row extention for HHKB JP */
DDRC |= (1<<6|1<<7);
@@ -59,6 +74,8 @@ static inline void KEY_INIT(void)
#endif
KEY_UNABLE();
KEY_PREV_OFF();
+
+ KEY_POWER_OFF();
}
static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
{
@@ -98,6 +115,7 @@ static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
#define KEY_PREV_OFF() (PORTE &= ~(1<<7))
#define KEY_POWER_ON()
#define KEY_POWER_OFF()
+#define KEY_POWER_STATE() true
#else
diff --git a/keyboard/hhkb/matrix.c b/keyboard/hhkb/matrix.c
index b0af4baa52..fb96997944 100644
--- a/keyboard/hhkb/matrix.c
+++ b/keyboard/hhkb/matrix.c
@@ -27,8 +27,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "timer.h"
#include "matrix.h"
#include "hhkb_avr.h"
+#include <avr/wdt.h>
+#include "suspend.h"
+#include "lufa.h"
+// matrix power saving
+#define MATRIX_POWER_SAVE 10000
+static uint32_t matrix_last_modified = 0;
+
// matrix state buffer(1:on, 0:off)
static matrix_row_t *matrix;
static matrix_row_t *matrix_prev;
@@ -72,7 +79,8 @@ uint8_t matrix_scan(void)
matrix_prev = matrix;
matrix = tmp;
- KEY_POWER_ON();
+ // power on
+ if (!KEY_POWER_STATE()) KEY_POWER_ON();
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
KEY_SELECT(row, col);
@@ -126,8 +134,16 @@ uint8_t matrix_scan(void)
// This takes 25us or more to make sure KEY_STATE returns to idle state.
_delay_us(75);
}
+ if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32();
+ }
+ // power off
+ if (KEY_POWER_STATE() &&
+ (USB_DeviceState == DEVICE_STATE_Suspended ||
+ USB_DeviceState == DEVICE_STATE_Unattached ) &&
+ timer_elapsed32(matrix_last_modified) > MATRIX_POWER_SAVE) {
+ KEY_POWER_OFF();
+ suspend_power_down();
}
- KEY_POWER_OFF();
return 1;
}
@@ -165,3 +181,10 @@ void matrix_print(void)
xprintf("%02X: %08b\n", row, bitrev(matrix_get_row(row)));
}
}
+
+void matrix_power_up(void) {
+ KEY_POWER_ON();
+}
+void matrix_power_down(void) {
+ KEY_POWER_OFF();
+}
diff --git a/keyboard/hhkb/Makefile.iwrap b/keyboard/hhkb/not_supported/Makefile.iwrap
index 2d9d82c481..2d9d82c481 100644
--- a/keyboard/hhkb/Makefile.iwrap
+++ b/keyboard/hhkb/not_supported/Makefile.iwrap
diff --git a/keyboard/hhkb/Makefile.vusb b/keyboard/hhkb/not_supported/Makefile.vusb
index 4343b210d9..4343b210d9 100644
--- a/keyboard/hhkb/Makefile.vusb
+++ b/keyboard/hhkb/not_supported/Makefile.vusb
diff --git a/keyboard/hhkb/config_iwrap.h b/keyboard/hhkb/not_supported/config_iwrap.h
index 747c755132..747c755132 100644
--- a/keyboard/hhkb/config_iwrap.h
+++ b/keyboard/hhkb/not_supported/config_iwrap.h
diff --git a/keyboard/hhkb/config_vusb.h b/keyboard/hhkb/not_supported/config_vusb.h
index 44f7acd6cd..44f7acd6cd 100644
--- a/keyboard/hhkb/config_vusb.h
+++ b/keyboard/hhkb/not_supported/config_vusb.h
diff --git a/keyboard/hhkb/iwrap.txt b/keyboard/hhkb/not_supported/iwrap.txt
index 20a2420a0b..20a2420a0b 100644
--- a/keyboard/hhkb/iwrap.txt
+++ b/keyboard/hhkb/not_supported/iwrap.txt
diff --git a/keyboard/hhkb/usbconfig.h b/keyboard/hhkb/not_supported/usbconfig.h
index c3aad34bef..c3aad34bef 100644
--- a/keyboard/hhkb/usbconfig.h
+++ b/keyboard/hhkb/not_supported/usbconfig.h
diff --git a/keyboard/hhkb_rn42/rn42.mk b/keyboard/hhkb/rn42.mk
index fd6f7db1a8..fd6f7db1a8 100644
--- a/keyboard/hhkb_rn42/rn42.mk
+++ b/keyboard/hhkb/rn42.mk
diff --git a/keyboard/hhkb_rn42/rn42/MEMO.txt b/keyboard/hhkb/rn42/MEMO.txt
index f772c4cb53..f772c4cb53 100644
--- a/keyboard/hhkb_rn42/rn42/MEMO.txt
+++ b/keyboard/hhkb/rn42/MEMO.txt
diff --git a/keyboard/hhkb_rn42/PowerSave.txt b/keyboard/hhkb/rn42/PowerSave.txt
index 9aa89f4416..8aea1c6dd2 100644
--- a/keyboard/hhkb_rn42/PowerSave.txt
+++ b/keyboard/hhkb/rn42/PowerSave.txt
@@ -1,11 +1,9 @@
-RN-42
-=====
+Power Saving
+============
-12/11
-Power Comsumption
-MCU+HHKB
---------
+MCU+HHKB Power Comsumption
+--------------------------
Battery drive:
idle 18.9mA
active 35.8mA
@@ -76,40 +74,3 @@ S%,1000 status led and connection control don't work
GPIO5: status LED
GPIO6: Connection control
GPIO2: linked status
-
-
-
-
-
-Ver 6.15 04/26/2013
-(c) Roving Networks
-***Settings***
-BTA=00066667BBE9
-BTName=tmkBT-BBE9
-Baudrt(SW4)=115K
-Mode =DTR
-Authen=1
-Bonded=0
-Rem=001BDC06415B
-***ADVANCED Settings***
-SrvName= keyboard/mouse
-SrvClass=0000
-DevClass=1F00
-InqWindw=0012
-PagWindw=0012
-CfgTimer=255
-StatuStr=NULL
-HidFlags=3c
-DTRtimer=8
-KeySwapr=0
-***OTHER Settings***
-Profile= HID
-CfgChar= $
-SniffEna=8010
-LowPower=0 S|,
-TX Power=fff4 SY,
-IOPorts= 0
-IOValues=0
-Sleeptmr=0
-DebugMod=0
-RoleSwch=0
diff --git a/keyboard/hhkb_rn42/rn42/RN42.txt b/keyboard/hhkb/rn42/RN42.txt
index ace30da4ed..ace30da4ed 100644
--- a/keyboard/hhkb_rn42/rn42/RN42.txt
+++ b/keyboard/hhkb/rn42/RN42.txt
diff --git a/keyboard/hhkb_rn42/rn42/battery.c b/keyboard/hhkb/rn42/battery.c
index 7e868c9646..7e868c9646 100644
--- a/keyboard/hhkb_rn42/rn42/battery.c
+++ b/keyboard/hhkb/rn42/battery.c
diff --git a/keyboard/hhkb_rn42/rn42/battery.h b/keyboard/hhkb/rn42/battery.h
index 180d4dcfaa..180d4dcfaa 100644
--- a/keyboard/hhkb_rn42/rn42/battery.h
+++ b/keyboard/hhkb/rn42/battery.h
diff --git a/keyboard/hhkb_rn42/rn42/main.c b/keyboard/hhkb/rn42/main.c
index 83d9950388..83d9950388 100644
--- a/keyboard/hhkb_rn42/rn42/main.c
+++ b/keyboard/hhkb/rn42/main.c
diff --git a/keyboard/hhkb_rn42/rn42/rn42.c b/keyboard/hhkb/rn42/rn42.c
index 756285d7bb..756285d7bb 100644
--- a/keyboard/hhkb_rn42/rn42/rn42.c
+++ b/keyboard/hhkb/rn42/rn42.c
diff --git a/keyboard/hhkb_rn42/rn42/rn42.h b/keyboard/hhkb/rn42/rn42.h
index db6916fe86..db6916fe86 100644
--- a/keyboard/hhkb_rn42/rn42/rn42.h
+++ b/keyboard/hhkb/rn42/rn42.h
diff --git a/keyboard/hhkb_rn42/rn42/rn42_task.c b/keyboard/hhkb/rn42/rn42_task.c
index 5107fef483..5107fef483 100644
--- a/keyboard/hhkb_rn42/rn42/rn42_task.c
+++ b/keyboard/hhkb/rn42/rn42_task.c
diff --git a/keyboard/hhkb_rn42/rn42/rn42_task.h b/keyboard/hhkb/rn42/rn42_task.h
index 8f6c3ab64d..8f6c3ab64d 100644
--- a/keyboard/hhkb_rn42/rn42/rn42_task.h
+++ b/keyboard/hhkb/rn42/rn42_task.h
diff --git a/keyboard/hhkb_rn42/rn42/suart.S b/keyboard/hhkb/rn42/suart.S
index 9fa5452928..9fa5452928 100644
--- a/keyboard/hhkb_rn42/rn42/suart.S
+++ b/keyboard/hhkb/rn42/suart.S
diff --git a/keyboard/hhkb_rn42/rn42/suart.h b/keyboard/hhkb/rn42/suart.h
index 72725b998f..72725b998f 100644
--- a/keyboard/hhkb_rn42/rn42/suart.h
+++ b/keyboard/hhkb/rn42/suart.h
diff --git a/keyboard/hhkb_rn42/hhkb_avr.h b/keyboard/hhkb_rn42/hhkb_avr.h
deleted file mode 100644
index 0321977d11..0000000000
--- a/keyboard/hhkb_rn42/hhkb_avr.h
+++ /dev/null
@@ -1,166 +0,0 @@
-#ifndef HHKB_AVR_H
-#define HHKB_AVR_H
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <avr/io.h>
-#include <avr/interrupt.h>
-#include <util/delay.h>
-
-
-// Timer resolution check
-#if (1000000/TIMER_RAW_FREQ > 20)
-# error "Timer resolution(>20us) is not enough for HHKB matrix scan tweak on V-USB."
-#endif
-
-
-/*
- * HHKB Matrix I/O
- *
- * row: HC4051[A,B,C] selects scan row0-7
- * row-ext: [En0,En1] row extention for JP
- * col: LS145[A,B,C,D] selects scan col0-7 and enable(D)
- * key: on: 0/off: 1
- * prev: hysteresis control: assert(1) when previous key state is on
- */
-
-
-#if defined(__AVR_ATmega32U4__)
-/*
- * For TMK HHKB alt controller(ATMega32U4)
- *
- * row: PB0-2
- * col: PB3-5,6
- * key: PD7(pull-uped)
- * prev: PB7
- * power: PD4(L:off/H:on)
- * row-ext: PC6,7 for HHKB JP(active low)
- */
-static inline void KEY_ENABLE(void) { (PORTB &= ~(1<<6)); }
-static inline void KEY_UNABLE(void) { (PORTB |= (1<<6)); }
-static inline bool KEY_STATE(void) { return (PIND & (1<<7)); }
-static inline void KEY_PREV_ON(void) { (PORTB |= (1<<7)); }
-static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); }
-#ifdef HHKB_POWER_SAVING
-static inline void KEY_POWER_ON(void) {
- DDRB = 0xFF; PORTB = 0x40; // change pins output
- DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on
- /* Without this wait you will miss or get false key events. */
- _delay_ms(5); // wait for powering up
-}
-static inline void KEY_POWER_OFF(void) {
- /* input with pull-up consumes less than without it when pin is open. */
- DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up
- DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off
-}
-static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); }
-#else
-static inline void KEY_POWER_ON(void) {}
-static inline void KEY_POWER_OFF(void) {}
-static inline bool KEY_POWER_STATE(void) { return true; }
-#endif
-static inline void KEY_INIT(void)
-{
- /* row,col,prev: output */
- DDRB = 0xFF;
- PORTB = 0x40; // unable
- /* key: input with pull-up */
- DDRD &= ~0x80;
- PORTD |= 0x80;
-#ifdef HHKB_JP
- /* row extention for HHKB JP */
- DDRC |= (1<<6|1<<7);
- PORTC |= (1<<6|1<<7);
-#endif
- KEY_UNABLE();
- KEY_PREV_OFF();
-
- KEY_POWER_OFF();
-}
-static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
-{
- PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07);
-#ifdef HHKB_JP
- if ((ROW) & 0x08) PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<6);
- else PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<7);
-#endif
-}
-
-
-#elif defined(__AVR_AT90USB1286__)
-/*
- * For Teensy++(AT90USB1286)
- *
- * HHKB pro HHKB pro2
- * row: PB0-2 (6-8) (5-7)
- * col: PB3-5,6 (9-12) (8-11)
- * key: PE6(pull-uped) (4) (3)
- * prev: PE7 (5) (4)
- *
- * TODO: convert into 'staitc inline' function
- */
-#define KEY_INIT() do { \
- DDRB |= 0x7F; \
- DDRE |= (1<<7); \
- DDRE &= ~(1<<6); \
- PORTE |= (1<<6); \
-} while (0)
-#define KEY_SELECT(ROW, COL) (PORTB = (PORTB & 0xC0) | \
- (((COL) & 0x07)<<3) | \
- ((ROW) & 0x07))
-#define KEY_ENABLE() (PORTB &= ~(1<<6))
-#define KEY_UNABLE() (PORTB |= (1<<6))
-#define KEY_STATE() (PINE & (1<<6))
-#define KEY_PREV_ON() (PORTE |= (1<<7))
-#define KEY_PREV_OFF() (PORTE &= ~(1<<7))
-#define KEY_POWER_ON()
-#define KEY_POWER_OFF()
-
-
-#else
-# error "define code for matrix scan"
-#endif
-
-
-#if 0
-// For ATMega328P with V-USB
-//
-// #elif defined(__AVR_ATmega328P__)
-// Ports for V-USB
-// key: PB0(pull-uped)
-// prev: PB1
-// row: PB2-4
-// col: PC0-2,3
-// power: PB5(Low:on/Hi-z:off)
-#define KEY_INIT() do { \
- DDRB |= 0x3E; \
- DDRB &= ~(1<<0); \
- PORTB |= 1<<0; \
- DDRC |= 0x0F; \
- KEY_UNABLE(); \
- KEY_PREV_OFF(); \
-} while (0)
-#define KEY_SELECT(ROW, COL) do { \
- PORTB = (PORTB & 0xE3) | ((ROW) & 0x07)<<2; \
- PORTC = (PORTC & 0xF8) | ((COL) & 0x07); \
-} while (0)
-#define KEY_ENABLE() (PORTC &= ~(1<<3))
-#define KEY_UNABLE() (PORTC |= (1<<3))
-#define KEY_STATE() (PINB & (1<<0))
-#define KEY_PREV_ON() (PORTB |= (1<<1))
-#define KEY_PREV_OFF() (PORTB &= ~(1<<1))
-// Power supply switching
-#define KEY_POWER_ON() do { \
- KEY_INIT(); \
- PORTB &= ~(1<<5); \
- _delay_ms(1); \
-} while (0)
-#define KEY_POWER_OFF() do { \
- DDRB &= ~0x3F; \
- PORTB &= ~0x3F; \
- DDRC &= ~0x0F; \
- PORTC &= ~0x0F; \
-} while (0)
-#endif
-
-#endif
diff --git a/keyboard/hhkb_rn42/keymap_common.c b/keyboard/hhkb_rn42/keymap_common.c
deleted file mode 100644
index e938fb6270..0000000000
--- a/keyboard/hhkb_rn42/keymap_common.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-#include <stdint.h>
-#include "action.h"
-#include <avr/pgmspace.h>
-#include "keymap_common.h"
-
-
-/* translates key to keycode */
-uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
-{
- return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
-}
-
-/* translates Fn 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/keyboard/hhkb_rn42/keymap_common.h b/keyboard/hhkb_rn42/key