Added Bulegiga iWRAP support into HHKB.(Bluetooth)
@ -1,11 +0,0 @@
|
||||
OPT_DEFS += -DHOST_VUSB
|
||||
|
||||
SRC = usbdrv.c \
|
||||
usbdrvasm.S \
|
||||
oddebug.c \
|
||||
sendchar_usart.c
|
||||
SRC += $(TARGET_SRC)
|
||||
|
||||
|
||||
# C source file search path
|
||||
VPATH = $(TARGET_DIR):$(COMMON_DIR):$(COMMON_DIR)/vusb:$(COMMON_DIR)/vusb/usbdrv
|
62
POWER.txt
Normal file
@ -0,0 +1,62 @@
|
||||
Time to Sleep
|
||||
=============
|
||||
USB suspend no activity on USB line for 3ms
|
||||
No Interaction no user interaction
|
||||
matrix has no change
|
||||
matrix has no switch on
|
||||
|
||||
|
||||
AVR Power Management
|
||||
====================
|
||||
|
||||
V-USB suspend
|
||||
USB suspend
|
||||
http://vusb.wikidot.com/examples
|
||||
|
||||
MCUSR MCU Status Register
|
||||
WDRF Watchdog Reset Flag
|
||||
BORF
|
||||
EXTRF
|
||||
PORF Power-on Reset Flag
|
||||
|
||||
SMCR Sleep Mode Control Register
|
||||
SE Sleep Enable
|
||||
SM2:0
|
||||
#define set_sleep_mode(mode) \
|
||||
#define SLEEP_MODE_IDLE (0)
|
||||
#define SLEEP_MODE_ADC _BV(SM0)
|
||||
#define SLEEP_MODE_PWR_DOWN _BV(SM1)
|
||||
#define SLEEP_MODE_PWR_SAVE (_BV(SM0) | _BV(SM1))
|
||||
#define SLEEP_MODE_STANDBY (_BV(SM1) | _BV(SM2))
|
||||
#define SLEEP_MODE_EXT_STANDBY (_BV(SM0) | _BV(SM1) | _BV(SM2))
|
||||
|
||||
|
||||
ACSR Analog Comparator Control and Status Register
|
||||
To disable Analog Comparator
|
||||
ACSR = 0x80;
|
||||
or
|
||||
ACSR &= ~_BV(ACIE);
|
||||
ACSR |= _BV(ACD);
|
||||
|
||||
ACD: Analog Comparator Disable
|
||||
When this bit is written logic one, the power to the Analog Comparator is
|
||||
switched off. This bit can be set at any time to turn off the Analog
|
||||
Comparator. This will reduce power consumption in Active and Idle mode.
|
||||
When changing the ACD bit, the Analog Comparator Interrupt must be disabled
|
||||
by clearing the ACIE bit in ACSR. Otherwise an interrupt can occur when
|
||||
the bit is changed.
|
||||
|
||||
DIDR1 Digital Input Disable Register 1
|
||||
AIN1D
|
||||
AIN0D
|
||||
When this bit is written logic one, the digital input buffer on the AIN1/0 pin is disabled. The corresponding PIN Register bit will always read as zero when this bit is set. When an analog signal is applied to the AIN1/0 pin and the digital input from this pin is not needed, this bit should be written logic one to reduce power consumption in the digital input buffer.
|
||||
|
||||
|
||||
PRR Power Reduction Register
|
||||
PRTWI
|
||||
PRTIM2
|
||||
PRTIM0
|
||||
PRTIM1
|
||||
PRSPI
|
||||
PRUSART0
|
||||
PRADC
|
4
README
@ -96,8 +96,8 @@ Build Options
|
||||
3. Choose optional modules as needed. Comment out to disable optional modules.
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||
USB_EXTRA_ENABLE = yes # Enhanced feature for Windows(Audio control and System control)
|
||||
USB_NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
EXTRAKEY_ENABLE = yes # Enhanced feature for Windows(Audio control and System control)
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
|
||||
<target>/config.h:
|
||||
1. USB vendor/product ID and device description
|
||||
|
@ -8,7 +8,7 @@ COMMON_DIR = ..
|
||||
TARGET_DIR = .
|
||||
|
||||
# keyboard dependent files
|
||||
TARGET_SRC = main_pjrc.c \
|
||||
SRC = main.c \
|
||||
keymap.c \
|
||||
matrix.c \
|
||||
led.c \
|
||||
@ -36,10 +36,10 @@ F_CPU = 16000000
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
#MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||
USB_EXTRA_ENABLE = yes # Audio control and System control
|
||||
#USB_NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
#EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
|
||||
|
||||
|
||||
@ -48,5 +48,5 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
|
||||
|
||||
|
||||
|
||||
include $(COMMON_DIR)/Makefile.pjrc
|
||||
include $(COMMON_DIR)/Makefile.common
|
||||
include $(COMMON_DIR)/pjrc.mk
|
||||
include $(COMMON_DIR)/common.mk
|
||||
|
@ -59,4 +59,12 @@ effort at this time.
|
||||
),
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
Many ADB keyboards has 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 are the examples.
|
||||
Though ADB protocol itsef has the ability of distinction between right and left.
|
||||
And most ADB keyboard has no NKRO functionality, though ADB protocol itsef has that.
|
||||
|
||||
EOF
|
||||
|
@ -37,8 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (BIT_LSHIFT | BIT_LCTRL | BIT_LALT | BIT_LGUI) || \
|
||||
keyboard_report->mods == (BIT_LSHIFT | BIT_RSHIFT) \
|
||||
keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_LCTRL) | MOD_BIT(KB_LALT) | MOD_BIT(KB_LGUI)) || \
|
||||
keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT)) \
|
||||
)
|
||||
|
||||
|
||||
|
56
command.c
@ -30,24 +30,49 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#ifdef HOST_PJRC
|
||||
# include "jump_bootloader.h"
|
||||
# include "usb_keyboard.h"
|
||||
# ifdef USB_EXTRA_ENABLE
|
||||
# ifdef EXTRAKEY_ENABLE
|
||||
# include "usb_extra.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HOST_VUSB
|
||||
# include "usbdrv.h"
|
||||
#endif
|
||||
|
||||
|
||||
static uint8_t command_common(void);
|
||||
static void help(void);
|
||||
static void switch_layer(uint8_t layer);
|
||||
|
||||
static bool last_print_enable;
|
||||
|
||||
uint8_t command_proc(void)
|
||||
{
|
||||
uint8_t processed = 0;
|
||||
last_print_enable = print_enable;
|
||||
|
||||
if (!IS_COMMAND())
|
||||
return 0;
|
||||
|
||||
uint8_t processed = 1;
|
||||
bool last_print_enable = print_enable;
|
||||
print_enable = true;
|
||||
if (command_extra() || command_common()) {
|
||||
processed = 1;
|
||||
_delay_ms(500);
|
||||
}
|
||||
print_enable = last_print_enable;
|
||||
return processed;
|
||||
}
|
||||
|
||||
/* This allows to define extra commands. return 0 when not processed. */
|
||||
uint8_t command_extra(void) __attribute__ ((weak));
|
||||
uint8_t command_extra(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t command_common(void)
|
||||
{
|
||||
switch (host_get_first_key()) {
|
||||
case KB_H:
|
||||
help();
|
||||
@ -122,21 +147,27 @@ uint8_t command_proc(void)
|
||||
print("usb_keyboard_protocol: "); phex(usb_keyboard_protocol); print("\n");
|
||||
print("usb_keyboard_idle_config:"); phex(usb_keyboard_idle_config); print("\n");
|
||||
print("usb_keyboard_idle_count:"); phex(usb_keyboard_idle_count); print("\n");
|
||||
#endif
|
||||
|
||||
#ifdef HOST_VUSB
|
||||
# if USB_COUNT_SOF
|
||||
print("usbSofCount: "); phex(usbSofCount); print("\n");
|
||||
# endif
|
||||
#endif
|
||||
break;
|
||||
#ifdef USB_NKRO_ENABLE
|
||||
#ifdef NKRO_ENABLE
|
||||
case KB_N:
|
||||
// send empty report before change
|
||||
host_clear_keyboard_report();
|
||||
host_send_keyboard_report();
|
||||
keyboard_nkro = !keyboard_nkro;
|
||||
if (keyboard_nkro)
|
||||
print("USB_NKRO: enabled\n");
|
||||
print("NKRO: enabled\n");
|
||||
else
|
||||
print("USB_NKRO: disabled\n");
|
||||
print("NKRO: disabled\n");
|
||||
break;
|
||||
#endif
|
||||
#ifdef USB_EXTRA_ENABLE
|
||||
#ifdef EXTRAKEY_ENABLE
|
||||
case KB_ESC:
|
||||
host_clear_keyboard_report();
|
||||
host_send_keyboard_report();
|
||||
@ -175,12 +206,9 @@ uint8_t command_proc(void)
|
||||
switch_layer(4);
|
||||
break;
|
||||
default:
|
||||
processed = 0;
|
||||
return 0;
|
||||
}
|
||||
if (processed)
|
||||
_delay_ms(500);
|
||||
print_enable = last_print_enable;
|
||||
return processed;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void help(void)
|
||||
@ -194,8 +222,8 @@ static void help(void)
|
||||
print("v: print version\n");
|
||||
print("t: print timer count\n");
|
||||
print("s: print status\n");
|
||||
#ifdef USB_NKRO_ENABLE
|
||||
print("n: toggle USB_NKRO\n");
|
||||
#ifdef NKRO_ENABLE
|
||||
print("n: toggle NKRO\n");
|
||||
#endif
|
||||
print("Backspace: clear matrix\n");
|
||||
print("ESC: power down/wake up\n");
|
||||
|
@ -19,5 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define COMMAND
|
||||
|
||||
uint8_t command_proc(void);
|
||||
/* This allows to extend commands. Return 0 when command is not processed. */
|
||||
uint8_t command_extra(void);
|
||||
|
||||
#endif
|
||||
|
@ -19,17 +19,20 @@ ifdef PS2_MOUSE_ENABLE
|
||||
OPT_DEFS += -DPS2_MOUSE_ENABLE
|
||||
endif
|
||||
|
||||
ifdef USB_EXTRA_ENABLE
|
||||
OPT_DEFS += -DUSB_EXTRA_ENABLE
|
||||
ifdef EXTRAKEY_ENABLE
|
||||
OPT_DEFS += -DEXTRAKEY_ENABLE
|
||||
endif
|
||||
|
||||
ifdef USB_NKRO_ENABLE
|
||||
OPT_DEFS += -DUSB_NKRO_ENABLE
|
||||
ifdef NKRO_ENABLE
|
||||
OPT_DEFS += -DNKRO_ENABLE
|
||||
endif
|
||||
|
||||
ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE)
|
||||
OPT_DEFS += -DUSB_MOUSE_ENABLE
|
||||
OPT_DEFS += -DMOUSE_ENABLE
|
||||
endif
|
||||
|
||||
# Search Path
|
||||
VPATH += $(COMMON_DIR)
|
||||
|
||||
include $(COMMON_DIR)/Makefile.rules
|
||||
|
||||
include $(COMMON_DIR)/rules.mk
|
40
hhkb/FUSE.txt
Normal file
@ -0,0 +1,40 @@
|
||||
ATMega168P Fuse/Lock Bits
|
||||
=========================
|
||||
This configuration is from usbasploader's Makefile.
|
||||
|
||||
HFUSE 0xD6
|
||||
LFUSE 0xDF
|
||||
EFUSE 0x00
|
||||
LOCK 0x3F(intact)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# ATMega168P
|
||||
#---------------------------------------------------------------------
|
||||
# Fuse extended byte:
|
||||
# 0x00 = 0 0 0 0 0 0 0 0 <-- BOOTRST (boot reset vector at 0x1800)
|
||||
# \+/
|
||||
# +------- BOOTSZ (00 = 2k bytes)
|
||||
# Fuse high byte:
|
||||
# 0xd6 = 1 1 0 1 0 1 1 0
|
||||
# ^ ^ ^ ^ ^ \-+-/
|
||||
# | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V)
|
||||
# | | | | + --------- EESAVE (preserve EEPROM over chip erase)
|
||||
# | | | +-------------- WDTON (if 0: watchdog always on)
|
||||
# | | +---------------- SPIEN (allow serial programming)
|
||||
# | +------------------ DWEN (debug wire enable)
|
||||
# +-------------------- RSTDISBL (reset pin is enabled)
|
||||
# Fuse low byte:
|
||||
# 0xdf = 1 1 0 1 1 1 1 1
|
||||
# ^ ^ \ / \--+--/
|
||||
# | | | +------- CKSEL 3..0 (external >8M crystal)
|
||||
# | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
|
||||
# | +------------------ CKOUT (if 0: Clock output enabled)
|
||||
# +-------------------- CKDIV8 (if 0: divide by 8)
|
||||
|
||||
|
||||
# Lock Bits
|
||||
# 0x3f = - - 1 1 1 1 1 1
|
||||
# \ / \-/ \-/
|
||||
# | | +----- LB 2..1 (No memory lock features enabled)
|
||||
# | +--------- BLB0 2..1 (No restrictions for SPM or LPM accessing the Application section)
|
||||
# +--------------- BLB1 2..1 (No restrictions for SPM or LPM accessing the Boot Loader section)
|
91
hhkb/Makefile.iwrap
Normal file
@ -0,0 +1,91 @@
|
||||
#
|
||||
# Makefile for iWRAP
|
||||
#
|
||||
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = hhkb_iwrap
|
||||
|
||||
# Directory common source filess exist
|
||||
COMMON_DIR = ..
|
||||
|
||||
# Directory keyboard dependent files exist
|
||||
TARGET_DIR = .
|
||||
|
||||
# keyboard dependent files
|
||||
SRC = main.c \
|
||||
keymap.c \
|
||||
matrix.c \
|
||||
led.c
|
||||
|
||||
CONFIG_H = config_iwrap.h
|
||||
|
||||
|
||||
# V-USB debug level: To use ps2_usart.c level must be 0
|
||||
# ps2_usart.c requires USART to receive PS/2 signal.
|
||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||
|
||||
|
||||
# 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 = atmega168p
|
||||
# avrdude doesn't know atmega168p
|
||||
AVRDUDE_MCU = atmega168
|
||||
|
||||
|
||||
# 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 = 12000000
|
||||
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
|
||||
|
||||
|
||||
#---------------- Programming Options --------------------------
|
||||
AVRDUDE = avrdude
|
||||
# Type: avrdude -c ? to get a full listing.
|
||||
AVRDUDE_PROGRAMMER = usbasp
|
||||
AVRDUDE_PORT =
|
||||
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
||||
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
|
||||
|
||||
# Uncomment the following if you want avrdude's erase cycle counter.
|
||||
# Note that this counter needs to be initialized first using -Yn,
|
||||
# see avrdude manual.
|
||||
#AVRDUDE_ERASE_COUNTER = -y
|
||||
|
||||
# Uncomment the following if you do /not/ wish a verification to be
|
||||
# performed after programming the device.
|
||||
#AVRDUDE_NO_VERIFY = -V
|
||||
|
||||
# Increase verbosity level. Please use this when submitting bug
|
||||
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
|
||||
# to submit bug reports.
|
||||
#AVRDUDE_VERBOSE = -v -v
|
||||
|
||||
#AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
|
||||
AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -c $(AVRDUDE_PROGRAMMER)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
|
||||
|
||||
PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||
|
||||
|
||||
|
||||
# Search Path
|
||||
VPATH = $(TARGET_DIR)
|
||||
|
||||
include $(COMMON_DIR)/iwrap.mk
|
||||
# To be swatchable btween Bluetooth and USB. Comment out if you don't need USB.
|
||||
include $(COMMON_DIR)/vusb.mk
|
||||
include $(COMMON_DIR)/common.mk
|
@ -13,7 +13,7 @@ COMMON_DIR = ..
|
||||
TARGET_DIR = .
|
||||
|
||||
# keyboard dependent files
|
||||
TARGET_SRC = main_pjrc.c \
|
||||
SRC = main.c \
|
||||
keymap.c \
|
||||
matrix.c \
|
||||
led.c
|
||||
@ -41,8 +41,8 @@ F_CPU = 16000000
|
||||
# comment out to disable the options.
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||
USB_EXTRA_ENABLE = yes # Audio control and System control
|
||||
USB_NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
|
||||
|
||||
|
||||
@ -51,5 +51,8 @@ PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
|
||||
|
||||
|
||||
|
||||
include $(COMMON_DIR)/Makefile.pjrc
|
||||
include $(COMMON_DIR)/Makefile.common
|
||||
# Search Path
|
||||
VPATH = $(TARGET_DIR)
|
||||
|
||||
include $(COMMON_DIR)/pjrc.mk
|
||||
include $(COMMON_DIR)/common.mk
|
@ -13,7 +13,7 @@ COMMON_DIR = ..
|
||||
TARGET_DIR = .
|
||||
|
||||
# keyboard dependent files
|
||||
TARGET_SRC = main_vusb.c \
|
||||
SRC = main.c \
|
||||
keymap.c \
|
||||
matrix.c \
|
||||
led.c
|
||||
@ -28,7 +28,9 @@ OPT_DEFS = -DDEBUG_LEVEL=0
|
||||
|
||||
# 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 = atmega168
|
||||
MCU = atmega168p
|
||||
# avrdude doesn't know atmega168p
|
||||
AVRDUDE_MCU = atmega168
|
||||
|
||||
|
||||
# Processor frequency.
|
||||
@ -36,15 +38,15 @@ MCU = atmega168
|
||||
# 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 = 20000000
|
||||
F_CPU = 12000000
|
||||
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
USB_EXTRA_ENABLE = yes # Audio control and System control
|
||||
#USB_NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
|
||||
|
||||
|
||||
@ -70,8 +72,8 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
|
||||
# to submit bug reports.
|
||||
#AVRDUDE_VERBOSE = -v -v
|
||||
|
||||
#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
|
||||
AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
|
||||
#AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
|
||||
AVRDUDE_FLAGS = -p $(AVRDUDE_MCU) -c $(AVRDUDE_PROGRAMMER)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
|
||||
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
|
||||
@ -80,5 +82,8 @@ PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE
|
||||
|
||||
|
||||
|
||||
include $(COMMON_DIR)/Makefile.vusb
|
||||
include $(COMMON_DIR)/Makefile.common
|
||||
# Search Path
|
||||
VPATH = $(TARGET_DIR)
|
||||
|
||||
include $(COMMON_DIR)/vusb.mk
|
||||
include $(COMMON_DIR)/common.mk
|
||||
|
113
hhkb/README
@ -4,7 +4,7 @@ Alternative Controller for HHKB
|
||||
Feature
|
||||
-------
|
||||
- Mouse Keys
|
||||
- NKRO on USB
|
||||
- NKRO on USB(PJRC Tennsy only)
|
||||
- Keymap Layers
|
||||
|
||||
|
||||
@ -13,8 +13,11 @@ Customize Keymap
|
||||
see keymap.c.
|
||||
|
||||
|
||||
Build for Teensy
|
||||
----------------
|
||||
|
||||
Build
|
||||
=====
|
||||
PJRC Teensy
|
||||
-----------
|
||||
0. Edit matrix.c.
|
||||
adjust scan code to your pin configuration.(see doc/HHKB.txt for pinouts)
|
||||
1. Define macros in config_pjrc.h.(Optional)
|
||||
@ -22,15 +25,15 @@ Build for Teensy
|
||||
IS_COMMAND
|
||||
2. Edit Makefile for MCU setting and build options.
|
||||
MCU, F_CPU
|
||||
MOUSEKEY_ENABLE, USB_EXTRA_ENABLE, USB_NKRO_ENABLE
|
||||
MOUSEKEY_ENABLE, EXTRAKEY_ENABLE, NKRO_ENABLE
|
||||
3. Build hex file.
|
||||
$ make
|
||||
$ make -f Makefile.pjrc
|
||||
4. Program MCU.
|
||||
$ make program
|
||||
$ make -f Makefile.pjrc program
|
||||
|
||||
|
||||
Build for V-USB
|
||||
---------------
|
||||
V-USB
|
||||
-----
|
||||
0. Edit matrix.c and usbconfig.h.
|
||||
adjust scan code to your pin configuration.(see doc/HHKB.txt for pinouts)
|
||||
define macros for V-USB in usbconfig.h.
|
||||
@ -38,7 +41,7 @@ Build for V-USB
|
||||
IS_COMMAND
|
||||
2. Edit Makefile.vusb for MCU setting and build options.
|
||||
MCU, F_CPU
|
||||
MOUSEKEY_ENABLE, USB_EXTRA_ENABLE, USB_NKRO_ENABLE
|
||||
MOUSEKEY_ENABLE, EXTRAKEY_ENABLE
|
||||
3. Build hex file.
|
||||
$ make -f Makefile.vusb
|
||||
4. Program MCU.
|
||||
@ -52,21 +55,59 @@ Build for V-USB
|
||||
http://www.obdev.at/products/vusb/usbasploader.html
|
||||
|
||||
|
||||
V-USB Circuit
|
||||
-------------
|
||||
iWRAP
|
||||
-----
|
||||
0. Edit matrix.c and usbconfig.h.
|
||||
adjust scan code to your pin configuration.(see doc/HHKB.txt for pinouts)
|
||||
define macros for V-USB in usbconfig.h.
|
||||
1. Define macros in config_iwrap.h.(Optional)
|
||||
IS_COMMAND
|
||||
2. Edit Makefile.iwrap for MCU setting and build options.
|
||||
MCU, F_CPU
|
||||
MOUSEKEY_ENABLE, EXTRAKEY_ENABLE
|
||||
3. Build hex file.
|
||||
$ make -f Makefile.iwrap
|
||||
4. Program MCU.
|
||||
$ make -f Makefile.iwrap program
|
||||
|
||||
|
||||
|
||||
Hardware
|
||||
========
|
||||
PJRC Teensy
|
||||
-----------
|
||||
+---------------+
|
||||
| Teensy++ |
|
||||
| |
|
||||
| | HHKB
|
||||
| | ~~~~
|
||||
| PB0-2|------->ROW(6-8)
|
||||
| PB3-5|------->COL(9-11)
|
||||
| PB6|------->ENABLE(12)
|
||||
| PE6|<-------KEY(4)
|
||||
| PE7|------->PREV(5)
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
+---------------+
|
||||
|
||||
|
||||
V-USB
|
||||
-----
|
||||
+---+ +---------------+
|
||||
USB GND | | ATmega168 |
|
||||
=== C3 | |
|
||||
~~~ C3 | |
|
||||
5V <-------+--------+---|Vcc,AVCC | HHKB
|
||||
R1 | | ====
|
||||
D- <----+--+-----R2-----|INT1 PB0-2|------->ROW
|
||||
D+ <----|---+----R3-----|INT0 PB3-5|------->COL
|
||||
Z1 Z2 | PB6|------->ENABLE
|
||||
GND<----+---+--+--+-----|GND PE6|------->KEY
|
||||
| | | PE7|------->PREV
|
||||
| C2-+--|XTAL1 | (see doc/HHKB.txt for pinouts)
|
||||
| X1 | |
|
||||
+--C3-+--|XTAL2 RST|---SW--+GND
|
||||
R1 | | ~~~~
|
||||
D- <----+--+-----R2-----|INT1 PB2-4|------->ROW(6-8)
|
||||
D+ <----|---+----R3-----|INT0 PC0-2|------->COL(9-11)
|
||||
Z1 Z2 | PC3|------->ENABLE(12)
|
||||
GND<----+---+-----------|GND PB0|<-------KEY(4)
|
||||
| PB1|------->PREV(5)
|
||||
| |
|
||||
GND+-C2--+--|XTAL1 RXD|------->Debug Console
|
||||
X1 | TXD|<-------Debug Console
|
||||
GND+-C3--+--|XTAL2 RST|---SW--+GND
|
||||
+---------------+
|
||||
R1: 1.5K Ohm
|
||||
R2,R3: 68 Ohm
|
||||
@ -77,4 +118,34 @@ X1: Crystal 20MHz(16MHz/12MHz)
|
||||
SW: Push Switch(Optional for bootloader)
|
||||
|
||||
|
||||
iWRAP
|
||||
-----
|
||||
+---------------+ WT12
|
||||
5V | ATmega168 | 5V/3.3V~~~~
|
||||
+-----+---|Vcc,AVCC PC4|---/--->iWRAP(RxD)
|
||||
USB | C3 | PC5|<--/----iWRAP(TxD)
|
||||
~~~ | + | |
|
||||
5V <--BATT + GND | | HHKB
|
||||
R1 | | ~~~~
|
||||
D- <----+-----+--R2-----|INT1 PB2-4|------->ROW(6-8)
|
||||
D+ <----|---+----R3-----|INT0 PC0-2|------->COL(9-11)
|
||||
Z1 Z2 | PC3|------->ENABLE(12)
|
||||
GND<----+---+-----------|GND PB0|<-------KEY(4)
|
||||
| PB1|------->PREV(5)
|
||||
| |
|
||||
GND+-C2--+--|XTAL1 RXD|------->Debug Console
|
||||
X1 | TXD|<-------Debug Console
|
||||
GND+-C3--+--|XTAL2 RST|---SW--+GND
|
||||
+---------------+
|
||||
|
||||
R1: 1.5K Ohm
|
||||
R2,R3: 68 Ohm
|
||||
Z1,Z2: Zener 3.6V
|
||||
C1,C2: 22pF
|
||||
C3: 0.1uF
|
||||
X1: Crystal 12MHz
|
||||
SW: Push Switch(Optional)
|
||||
BATT: Li-Po Battery, Battery Charger and Voltage Regulator(5V and 3.3V).
|
||||
|
||||
|
||||
EOF
|
||||
|
55
hhkb/config_iwrap.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
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 0xBEEA
|
||||
// TODO: share these strings with usbconfig.h
|
||||
// Edit usbconfig.h to change these.
|
||||
#define MANUFACTURER t.m.k.
|
||||
#define PRODUCT HHKB mod
|
||||
#define DESCRIPTION t.m.k. keyboard firmware for HHKB mod
|
||||
|
||||
|
||||
/* matrix size */
|
||||
#define MATRIX_ROWS 8
|
||||
#define MATRIX_COLS 8
|
||||
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT)))
|
||||
|
||||
/* mouse keys */
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
# define MOUSEKEY_DELAY_TIME 255
|
||||
#endif
|
||||
|
||||
/* pins for Software UART */
|
||||
#define SUART_IN_PIN PINC
|
||||
#define SUART_IN_BIT 5
|
||||
#define SUART_OUT_PORT PORTC
|
||||
#define SUART_OUT_BIT 4
|
||||
|
||||
|
||||
#define DEBUG_LED 1
|
||||
#define DEBUG_LED_CONFIG (DDRD |= (1<<4))
|
||||
#define DEBUG_LED_OFF (PORTD |= (1<<4))
|
||||
#define DEBUG_LED_ON (PORTD &= ~(1<<4))
|
||||
|
||||
#endif
|
@ -36,11 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (BIT_LSHIFT | BIT_RSHIFT) || \
|
||||
keyboard_report->mods == (BIT_LCTRL | BIT_RSHIFT) \
|
||||
)
|
||||
|
||||
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT)))
|
||||
|
||||
/* mouse keys */
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
|
@ -18,7 +18,6 @@ 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 0xC0FE
|
||||
// TODO: share these strings with usbconfig.h
|
||||
@ -34,11 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (BIT_LSHIFT | BIT_RSHIFT) || \
|
||||
keyboard_report->mods == (BIT_LCTRL | BIT_RSHIFT) \
|
||||
)
|
||||
|
||||
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT)))
|
||||
|
||||
/* mouse keys */
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
@ -46,4 +41,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endif
|
||||
|
||||
|
||||
#define DEBUG_LED 1
|
||||
#define DEBUG_LED_CONFIG (DDRD |= (1<<4))
|
||||
#define DEBUG_LED_OFF (PORTD |= (1<<4))
|
||||
#define DEBUG_LED_ON (PORTD &= ~(1<<4))
|
||||
|
||||
#endif
|
||||
|
4
hhkb/doc/Bluetooth.txt
Normal file
@ -0,0 +1,4 @@
|
||||
HHKB Bluetooth mod
|
||||
==================
|
||||
See this article:
|
||||
http://geekhack.org/showwiki.php?title=Island:20851
|
2
hhkb/doc/Bluetooth_img/.picasa.ini
Executable file
@ -0,0 +1,2 @@
|
||||
[Picasa]
|
||||
name=Bluetooth_img
|
BIN
hhkb/doc/Bluetooth_img/BT_circuit.jpg
Executable file
After Width: | Height: | Size: 490 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 152 KiB |
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 189 KiB |
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 168 KiB |
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 188 KiB |
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 166 KiB |
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 204 KiB |
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 133 KiB |