summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2012-06-30 14:56:24 +0900
committertmk <nobody@nowhere>2012-06-30 14:56:24 +0900
commitfca518f90dfc7f72132ff7950b000cfbd5709807 (patch)
tree1c61e7b91f1f4986232a1fdca421b3346f8a9431
parent76033dcd892a115240c5a990e5643cd53acbca87 (diff)
parent2769f09d11a4c45362f2e6137f2469d057d8757e (diff)
Merge branch 'lufa'
-rw-r--r--common.mk23
-rw-r--r--common/bootloader.c97
-rw-r--r--common/command.c1
-rw-r--r--common/host.c5
-rw-r--r--common/keyboard.c17
-rw-r--r--common/mousekey.c4
-rw-r--r--common/report.h5
-rw-r--r--converter/adb_usb/Makefile14
-rw-r--r--converter/m0110_usb/Makefile7
-rw-r--r--converter/news_usb/Makefile.pjrc7
-rw-r--r--converter/ps2_usb/Makefile7
-rw-r--r--converter/ps2_usb/Makefile.pjrc_usart7
-rw-r--r--converter/ps2_usb/Makefile.vusb15
-rw-r--r--converter/terminal_usb/Makefile.102_pjrc7
-rw-r--r--converter/terminal_usb/Makefile.122_pjrc7
-rw-r--r--converter/x68k_usb/Makefile7
l---------[-rw-r--r--]keyboard/hbkb/Makefile57
-rw-r--r--keyboard/hbkb/Makefile.lufa119
-rw-r--r--keyboard/hbkb/Makefile.pjrc (renamed from keyboard/macway/Makefile)7
-rw-r--r--keyboard/hbkb/config.h3
-rw-r--r--keyboard/hhkb/Makefile.lufa119
-rw-r--r--keyboard/hhkb/Makefile.pjrc7
-rw-r--r--keyboard/hhkb/config.h (renamed from keyboard/hhkb/config_pjrc.h)5
-rw-r--r--keyboard/hhkb/keymap.c2
-rw-r--r--keyboard/hhkb/matrix.c10
-rw-r--r--keyboard/macway/Makefile.lufa119
-rw-r--r--keyboard/macway/Makefile.pjrc95
-rw-r--r--keyboard/macway/config.h6
-rw-r--r--keyboard/macway/keymap.c10
-rw-r--r--protocol/lufa.mk34
-rw-r--r--protocol/lufa/descriptor.c558
-rw-r--r--protocol/lufa/descriptor.h122
-rw-r--r--protocol/lufa/lufa.c408
-rw-r--r--protocol/lufa/lufa.h58
-rw-r--r--protocol/pjrc.mk24
-rw-r--r--protocol/pjrc/bootloader_teensy.c40
-rw-r--r--protocol/vusb.mk12
-rw-r--r--protocol/vusb/bootloader_usbasp.c47
-rw-r--r--protocol/vusb/main.c11
-rw-r--r--protocol/vusb/vusb.c38
-rw-r--r--rules.mk62
41 files changed, 1937 insertions, 266 deletions
diff --git a/common.mk b/common.mk
index d0e04df862..9bf34f2b8e 100644
--- a/common.mk
+++ b/common.mk
@@ -1,22 +1,23 @@
-SRC += host.c \
- keyboard.c \
- command.c \
- layer.c \
- timer.c \
- print.c \
- bootloader.c \
- util.c
+COMMON_DIR = common
+SRC += $(COMMON_DIR)/host.c \
+ $(COMMON_DIR)/keyboard.c \
+ $(COMMON_DIR)/command.c \
+ $(COMMON_DIR)/layer.c \
+ $(COMMON_DIR)/timer.c \
+ $(COMMON_DIR)/print.c \
+ $(COMMON_DIR)/bootloader.c \
+ $(COMMON_DIR)/util.c
# Option modules
ifdef MOUSEKEY_ENABLE
- SRC += mousekey.c
+ SRC += $(COMMON_DIR)/mousekey.c
OPT_DEFS += -DMOUSEKEY_ENABLE
endif
ifdef PS2_MOUSE_ENABLE
- SRC += ps2.c \
- ps2_mouse.c
+ SRC += $(COMMON_DIR)/ps2.c \
+ $(COMMON_DIR)/ps2_mouse.c
OPT_DEFS += -DPS2_MOUSE_ENABLE
endif
diff --git a/common/bootloader.c b/common/bootloader.c
index 5cbfc72e5b..612b949648 100644
--- a/common/bootloader.c
+++ b/common/bootloader.c
@@ -1,22 +1,87 @@
-/*
-Copyright 2011 Jun Wako <wakojun@gmail.com>
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include "bootloader.h"
-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.
+/* Start Bootloader from Application
+ * See
+ * http://www.pjrc.com/teensy/jump_to_bootloader.html
+ * http://www.fourwalledcubicle.com/files/LUFA/Doc/120219/html/_page__software_bootloader_start.html
+ */
-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.
+// TODO: support usbasp
+/* Boot Section Size in bytes
+ * Teensy halfKay 512
+ * Atmel DFU loader 4096
+ * LUFA bootloader 4096
+ */
+#ifndef BOOT_SIZE
+#define BOOT_SIZE 512
+#endif
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+#define FLASH_SIZE (FLASHEND + 1)
+#define BOOTLOADER_START (FLASHEND - BOOT_SIZE)
-#include "bootloader.h"
+void bootloader_jump(void) {
+ cli();
+
+ //
+ //Teensy
+ //
+#if defined(__AVR_AT90USB162__) || defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
+ // disable watchdog, if enabled
+ // disable all peripherals
+ UDCON = 1;
+ USBCON = (1<<FRZCLK); // disable USB
+ UCSR1B = 0;
+ _delay_ms(5);
+#else
+ // This makes custom USBasploader come up.
+ MCUSR = 0;
+#endif
+
+#if defined(__AVR_AT90USB162__)
+ EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0;
+ TIMSK0 = 0; TIMSK1 = 0; UCSR1B = 0;
+ DDRB = 0; DDRC = 0; DDRD = 0;
+ PORTB = 0; PORTC = 0; PORTD = 0;
+#elif defined(__AVR_ATmega32U4__)
+ EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
+ TIMSK0 = 0; TIMSK1 = 0; TIMSK3 = 0; TIMSK4 = 0; UCSR1B = 0; TWCR = 0;
+ DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0; TWCR = 0;
+ PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
+#elif defined(__AVR_AT90USB646__)
+ EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
+ TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
+ DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
+ PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
+#elif defined(__AVR_AT90USB1286__)
+ EIMSK = 0; PCICR = 0; SPCR = 0; ACSR = 0; EECR = 0; ADCSRA = 0;
+ TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0; TIMSK3 = 0; UCSR1B = 0; TWCR = 0;
+ DDRA = 0; DDRB = 0; DDRC = 0; DDRD = 0; DDRE = 0; DDRF = 0;
+ PORTA = 0; PORTB = 0; PORTC = 0; PORTD = 0; PORTE = 0; PORTF = 0;
+#endif
+
+
+ //
+ //USBasp
+ //
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P)
+ // This makes custom USBasploader come up.
+ MCUSR = 0;
+
+ // initialize ports
+ PORTB = 0; PORTC= 0; PORTD = 0;
+ DDRB = 0; DDRC= 0; DDRD = 0;
+
+ // disable interrupts
+ EIMSK = 0; EECR = 0; SPCR = 0;
+ ACSR = 0; SPMCSR = 0; WDTCSR = 0; PCICR = 0;
+ TIMSK0 = 0; TIMSK1 = 0; TIMSK2 = 0;
+ ADCSRA = 0; TWCR = 0; UCSR0B = 0;
+#endif
-void bootloader_jump(void) __attribute__ ((weak));
-void bootloader_jump(void) {}
+ // start Bootloader
+ ((void (*)(void))BOOTLOADER_START)();
+}
diff --git a/common/command.c b/common/command.c
index e325a5d847..13d37242d9 100644
--- a/common/command.c
+++ b/common/command.c
@@ -138,6 +138,7 @@ static uint8_t command_common(void)
}
break;
case KB_S:
+ print("host_keyboard_leds:"); phex(host_keyboard_leds()); print("\n");
#ifdef HOST_PJRC
print("UDCON: "); phex(UDCON); print("\n");
print("UDIEN: "); phex(UDIEN); print("\n");
diff --git a/common/host.c b/common/host.c
index cc26d55c22..8dd2abbee8 100644
--- a/common/host.c
+++ b/common/host.c
@@ -168,13 +168,16 @@ void host_mouse_send(report_mouse_t *report)
void host_system_send(uint16_t data)
{
+ static uint16_t last_data = 0;
+ if (data == last_data) return;
+ last_data = data;
+
if (!driver) return;
(*driver->send_system)(data);
}
void host_consumer_send(uint16_t data)
{
- // TODO: this is needed?
static uint16_t last_data = 0;
if (data == last_data) return;
last_data = data;
diff --git a/common/keyboard.c b/common/keyboard.c
index 5c2643c951..25f32eb02f 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -49,6 +49,7 @@ void keyboard_proc(void)
uint8_t fn_bits = 0;
#ifdef EXTRAKEY_ENABLE
uint16_t consumer_code = 0;
+ uint16_t system_code = 0;
#endif
matrix_scan();
@@ -89,22 +90,13 @@ void keyboard_proc(void)
#ifdef HOST_PJRC
if (suspend && remote_wakeup) {
usb_remote_wakeup();
- } else {
- host_system_send(SYSTEM_POWER_DOWN);
}
-#else
- host_system_send(SYSTEM_POWER_DOWN);
#endif
- host_system_send(0);
- _delay_ms(500);
+ system_code = SYSTEM_POWER_DOWN;
} else if (code == KB_SYSTEM_SLEEP) {
- host_system_send(SYSTEM_SLEEP);
- host_system_send(0);
- _delay_ms(500);
+ system_code = SYSTEM_SLEEP;
} else if (code == KB_SYSTEM_WAKE) {
- host_system_send(SYSTEM_WAKE_UP);
- host_system_send(0);
- _delay_ms(500);
+ system_code = SYSTEM_WAKE_UP;
}
// Consumer Page
else if (code == KB_AUDIO_MUTE) {
@@ -173,6 +165,7 @@ void keyboard_proc(void)
host_send_keyboard_report();
#ifdef EXTRAKEY_ENABLE
host_consumer_send(consumer_code);
+ host_system_send(system_code);
#endif
#ifdef DEBUG_LED
// LED flash for debug
diff --git a/common/mousekey.c b/common/mousekey.c
index 76bd0fd363..1d35355b49 100644
--- a/common/mousekey.c
+++ b/common/mousekey.c
@@ -121,12 +121,12 @@ void mousekey_clear_report(void)
static void mousekey_debug(void)
{
if (!debug_mouse) return;
- print("mousekey[btn|x y v h]: ");
+ print("mousekey [btn|x y v h]rep: [");
phex(report.buttons); print("|");
phex(report.x); print(" ");
phex(report.y); print(" ");
phex(report.v); print(" ");
- phex(report.h);
+ phex(report.h); print("]");
phex(mousekey_repeat);
print("\n");
}
diff --git a/common/report.h b/common/report.h
index b85b86c5f8..45f5c0b881 100644
--- a/common/report.h
+++ b/common/report.h
@@ -82,15 +82,14 @@ typedef struct {
uint8_t mods;
uint8_t rserved;
uint8_t keys[REPORT_KEYS];
-} report_keyboard_t;
+} __attribute__ ((packed)) report_keyboard_t;
typedef struct {
- uint8_t report_id;
uint8_t buttons;
int8_t x;
int8_t y;
int8_t v;
int8_t h;
-} report_mouse_t;
+} __attribute__ ((packed)) report_mouse_t;
#endif
diff --git a/converter/adb_usb/Makefile b/converter/adb_usb/Makefile
index 248261df0b..e9a90695b1 100644
--- a/converter/adb_usb/Makefile
+++ b/converter/adb_usb/Makefile
@@ -8,8 +8,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# keyboard dependent files
-SRC = main.c \
- keymap.c \
+SRC = keymap.c \
matrix.c \
led.c \
adb.c
@@ -42,16 +41,11 @@ EXTRAKEY_ENABLE = yes # Audio control and System control
#NKRO_ENABLE = yes # USB Nkey Rollover
-
-#---------------- Programming Options --------------------------
-PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
-
-
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/protocol.mk
include $(TOP_DIR)/common.mk
include $(TOP_DIR)/rules.mk
-
-dfu: PROGRAM_CMD = dfu-programmer atmega32u4 flash $(TARGET).hex
-dfu: program
diff --git a/converter/m0110_usb/Makefile b/converter/m0110_usb/Makefile
index 4a687b9333..1fee258a6f 100644
--- a/converter/m0110_usb/Makefile
+++ b/converter/m0110_usb/Makefile
@@ -8,8 +8,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# keyboard dependent files
-SRC = main.c \
- keymap.c \
+SRC = keymap.c \
matrix.c \
led.c \
m0110.c
@@ -47,6 +46,10 @@ EXTRAKEY_ENABLE = yes # Audio control and System control
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/protocol.mk
diff --git a/converter/news_usb/Makefile.pjrc b/converter/news_usb/Makefile.pjrc
index 376133ad5e..3233463d58 100644
--- a/converter/news_usb/Makefile.pjrc
+++ b/converter/news_usb/Makefile.pjrc
@@ -13,8 +13,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# keyboard dependent files
-SRC = main.c \
- keymap.c \
+SRC = keymap.c \
matrix.c \
led.c \
news.c
@@ -51,6 +50,10 @@ NKRO_ENABLE = yes # USB Nkey Rollover
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/protocol.mk
diff --git a/converter/ps2_usb/Makefile b/converter/ps2_usb/Makefile
index 0bba191a38..1278a74be7 100644
--- a/converter/ps2_usb/Makefile
+++ b/converter/ps2_usb/Makefile
@@ -13,8 +13,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# keyboard dependent files
-SRC = main.c \
- keymap.c \
+SRC = keymap.c \
matrix.c \
led.c \
ps2.c
@@ -51,6 +50,10 @@ NKRO_ENABLE = yes # USB Nkey Rollover
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/protocol.mk
diff --git a/converter/ps2_usb/Makefile.pjrc_usart b/converter/ps2_usb/Makefile.pjrc_usart
index 3dad7e2f8c..dd74712e48 100644
--- a/converter/ps2_usb/Makefile.pjrc_usart
+++ b/converter/ps2_usb/Makefile.pjrc_usart
@@ -13,8 +13,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# keyboard dependent files
-SRC = main.c \
- keymap.c \
+SRC = keymap.c \
matrix.c \
led.c \
ps2_usart.c
@@ -51,6 +50,10 @@ NKRO_ENABLE = yes # USB Nkey Rollover
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/protocol.mk
diff --git a/converter/ps2_usb/Makefile.vusb b/converter/ps2_usb/Makefile.vusb
index 4d5240c309..b08d30d574 100644
--- a/converter/ps2_usb/Makefile.vusb
+++ b/converter/ps2_usb/Makefile.vusb
@@ -13,8 +13,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# keyboard dependent files
-SRC = main.c \
- keymap.c \
+SRC = keymap.c \
matrix.c \
led.c \
ps2_usart.c
@@ -85,6 +84,18 @@ AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
PROGRAM_CMD = $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+# USBasp 2048
+OPT_DEFS += -DBOOT_SIZE=2048
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+
include $(TOP_DIR)/protocol/vusb.mk
include $(TOP_DIR)/protocol.mk
diff --git a/converter/terminal_usb/Makefile.102_pjrc b/converter/terminal_usb/Makefile.102_pjrc
index e9d14e7a05..e2d1a00a5b 100644
--- a/converter/terminal_usb/Makefile.102_pjrc
+++ b/converter/terminal_usb/Makefile.102_pjrc
@@ -13,8 +13,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# keyboard dependent files
-SRC = main.c \
- keymap_102.c \
+SRC = keymap_102.c \
matrix.c \
led.c \
ps2.c
@@ -51,6 +50,10 @@ NKRO_ENABLE = yes # USB Nkey Rollover
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/protocol.mk
diff --git a/converter/terminal_usb/Makefile.122_pjrc b/converter/terminal_usb/Makefile.122_pjrc
index bec00510e5..ee42dd7436 100644
--- a/converter/terminal_usb/Makefile.122_pjrc
+++ b/converter/terminal_usb/Makefile.122_pjrc
@@ -13,8 +13,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# keyboard dependent files
-SRC = main.c \
- keymap_122.c \
+SRC = keymap_122.c \
matrix.c \
led.c \
ps2.c
@@ -51,6 +50,10 @@ F_CPU = 16000000
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/protocol.mk
diff --git a/converter/x68k_usb/Makefile b/converter/x68k_usb/Makefile
index c3b5fa29f3..62b976c56f 100644
--- a/converter/x68k_usb/Makefile
+++ b/converter/x68k_usb/Makefile
@@ -13,8 +13,7 @@ TOP_DIR = ../..
TARGET_DIR = .
# keyboard dependent files
-SRC = main.c \
- keymap.c \
+SRC = keymap.c \
matrix.c \
led.c \
x68k.c
@@ -80,6 +79,10 @@ AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
PROGRAM_CMD = dfu-programmer atmega32u4 flash $(TARGET).hex
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/protocol.mk
diff --git a/keyboard/hbkb/Makefile b/keyboard/hbkb/Makefile
index 26be322e01..f00d036da3 100644..120000
--- a/keyboard/hbkb/Makefile
+++ b/keyboard/hbkb/Makefile
@@ -1,56 +1 @@
-# Target file name (without extension).
-TARGET = hbk
-
-# Directory common source filess exist
-TOP_DIR = ../..
-
-# Directory keyboard dependent files exist
-TARGET_DIR = .
-
-# keyboard dependent files
-SRC = main.c \
- keymap.c \
- matrix.c \
- led.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
-
-
-# Build Options
-# comment out to disable the options.
-#
-MOUSEKEY_ENABLE = yes # Mouse keys
-#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
-EXTRAKEY_ENABLE = yes # Audio control and System control
-#NKRO_ENABLE = yes # USB Nkey Rollover
-
-
-
-#---------------- Programming Options --------------------------
-#PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
-PROGRAM_CMD = /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) erase && \
- /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) flash $(TARGET).hex && \
- /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) start
-
-
-
-include $(TOP_DIR)/protocol/pjrc.mk
-include $(TOP_DIR)/protocol.mk
-include $(TOP_DIR)/common.mk
-include $(TOP_DIR)/rules.mk
+Makefile.lufa \ No newline at end of file
diff --git a/keyboard/hbkb/Makefile.lufa b/keyboard/hbkb/Makefile.lufa
new file mode 100644
index 0000000000..c73a0ca7d1
--- /dev/null
+++ b/keyboard/hbkb/Makefile.lufa
@@ -0,0 +1,119 @@
+#----------------------------------------------------------------------------
+# 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 = hbkb_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.c \
+ matrix.c \
+ led.c
+
+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)
+
+
+# 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
+#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+
+
+# Boot Section Size in bytes
+# Teensy halfKay 512
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+OPT_DEFS += -DBOOT_SIZE=4096
+
+
+# Search Path
+VPATH += $(TARGET_DIR)
+VPATH += $(TOP_DIR)
+
+include $(TOP_DIR)/protocol/lufa.mk
+include $(TOP_DIR)/common.mk
+include $(TOP_DIR)/rules.mk
diff --git a/keyboard/macway/Makefile b/keyboard/hbkb/Makefile.pjrc
index afee38b120..159f56b44b 100644
--- a/keyboard/macway/Makefile
+++ b/keyboard/hbkb/Makefile.pjrc
@@ -1,5 +1,5 @@
# Target file name (without extension).
-TARGET = macway
+TARGET = hbkb
# Directory common source filess exist
TOP_DIR = ../..
@@ -43,7 +43,10 @@ EXTRAKEY_ENABLE = yes # Audio control and System control
#---------------- Programming Options --------------------------
-PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+#PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
+PROGRAM_CMD = /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) erase && \
+ /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) flash $(TARGET).hex && \
+ /opt/dfu-programmer-0.5.2/bin/dfu-programmer $(MCU) start
diff --git a/keyboard/hbkb/config.h b/keyboard/hbkb/config.h
index 5262399dc3..deaabb2495 100644
--- a/keyboard/hbkb/config.h
+++ b/keyboard/hbkb/config.h
@@ -24,7 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0xBB00
#define MANUFACTURER t.m.k.
+#define DEVICE_VER 0x0100
#define PRODUCT Happy Buckling Keyboard
+
+
#define DESCRIPTION mod version of IBM Model M keyboard
diff --git a/keyboard/hhkb/Makefile.lufa b/keyboard/hhkb/Makefile.lufa
new file mode 100644
index 0000000000..cdd68f40ab
--- /dev/null
+++ b/keyboard/hhkb/Makefile.lufa
@@ -0,0 +1,119 @@
+#----------------------------------------------------------------------------
+# 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.