summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--common.mk12
-rw-r--r--common/action.c2
-rw-r--r--common/action.h13
-rw-r--r--common/action_layer.c2
-rw-r--r--common/action_layer.h2
-rw-r--r--common/action_macro.c8
-rw-r--r--common/action_macro.h8
-rw-r--r--common/action_util.c20
-rw-r--r--common/action_util.h9
-rw-r--r--common/avr/bootloader.c (renamed from common/bootloader.c)0
-rw-r--r--common/avr/eeconfig.c (renamed from common/eeconfig.c)0
-rw-r--r--common/avr/suspend.c117
-rw-r--r--common/avr/suspend_avr.h27
-rw-r--r--common/avr/timer.c (renamed from common/timer.c)1
-rw-r--r--common/avr/timer_avr.h42
-rw-r--r--common/avr/xprintf.S (renamed from common/xprintf.S)0
-rw-r--r--common/avr/xprintf.h (renamed from common/xprintf.h)0
-rw-r--r--common/bootmagic.c2
-rw-r--r--common/command.c28
-rw-r--r--common/command.h10
-rw-r--r--common/debug.h112
-rw-r--r--common/host.c4
-rw-r--r--common/keyboard.c3
-rw-r--r--common/keyboard.h11
-rw-r--r--common/keymap.c5
-rw-r--r--common/keymap.h2
-rw-r--r--common/matrix.h5
-rw-r--r--common/mbed/bootloader.c4
-rw-r--r--common/mbed/suspend.c6
-rw-r--r--common/mbed/timer.c41
-rw-r--r--common/mbed/xprintf.cpp46
-rw-r--r--common/mbed/xprintf.h17
-rw-r--r--common/mousekey.c1
-rw-r--r--common/mousekey.h20
-rw-r--r--common/nodebug.h30
-rw-r--r--common/print.c22
-rw-r--r--common/print.h144
-rw-r--r--common/progmem.h12
-rw-r--r--common/report.h22
-rw-r--r--common/suspend.c76
-rw-r--r--common/suspend.h23
-rw-r--r--common/timer.h18
-rw-r--r--common/wait.h20
-rw-r--r--converter/ps2_usb/Makefile.mbed44
-rw-r--r--converter/ps2_usb/config_mbed.h60
-rw-r--r--converter/ps2_usb/keymap_common.c3
-rw-r--r--converter/ps2_usb/keymap_common.h1
-rw-r--r--converter/ps2_usb/main.cpp46
-rw-r--r--converter/ps2_usb/matrix.c3
-rw-r--r--keyboard/hhkb/keymap_common.c2
-rw-r--r--keyboard/hhkb_rn42/MEMO.txt523
-rw-r--r--keyboard/hhkb_rn42/Makefile157
-rw-r--r--keyboard/hhkb_rn42/PowerSave.txt102
-rw-r--r--keyboard/hhkb_rn42/config.h112
-rw-r--r--keyboard/hhkb_rn42/hhkb_avr.h164
-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.c191
-rw-r--r--keyboard/hhkb_rn42/rn42.mk12
-rw-r--r--keyboard/hhkb_rn42/rn42/battery.c136
-rw-r--r--keyboard/hhkb_rn42/rn42/battery.h35
-rw-r--r--keyboard/hhkb_rn42/rn42/main.c102
-rw-r--r--keyboard/hhkb_rn42/rn42/rn42.c208
-rw-r--r--keyboard/hhkb_rn42/rn42/rn42.h20
-rw-r--r--keyboard/hhkb_rn42/rn42/rn42_task.c294
-rw-r--r--keyboard/hhkb_rn42/rn42/rn42_task.h10
-rw-r--r--keyboard/hhkb_rn42/rn42/suart.S156
-rw-r--r--keyboard/hhkb_rn42/rn42/suart.h8
-rw-r--r--keyboard/mbed_onekey/Makefile33
-rw-r--r--keyboard/mbed_onekey/config.h7
-rw-r--r--keyboard/mbed_onekey/main.cpp33
-rw-r--r--protocol.mk1
-rw-r--r--protocol/lufa/lufa.c15
-rw-r--r--protocol/mbed/HIDKeyboard.cpp271
-rw-r--r--protocol/mbed/HIDKeyboard.h31
-rw-r--r--protocol/mbed/mbed_driver.cpp41
-rw-r--r--protocol/mbed/mbed_driver.h3
-rw-r--r--protocol/ps2.h65
-rw-r--r--protocol/ps2_busywait.c16
-rw-r--r--protocol/ps2_io.h15
-rw-r--r--protocol/ps2_io_avr.c74
-rw-r--r--protocol/ps2_io_mbed.c60
-rw-r--r--protocol/serial_uart.c21
-rw-r--r--rules.mk1
-rw-r--r--tool/mbed/common.mk79
-rw-r--r--tool/mbed/gcc.mk80
-rw-r--r--tool/mbed/lpc-vector-checksum.c99
-rw-r--r--tool/mbed/mbed.mk99
92 files changed, 4462 insertions, 402 deletions
diff --git a/.gitignore b/.gitignore
index 0fd85b5314..f3f46872a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,5 @@
*.sym
tags
*~
+build/
+*.bak
diff --git a/common.mk b/common.mk
index 1cffc3cc22..b854f09cdb 100644
--- a/common.mk
+++ b/common.mk
@@ -7,19 +7,19 @@ SRC += $(COMMON_DIR)/host.c \
$(COMMON_DIR)/action_layer.c \
$(COMMON_DIR)/action_util.c \
$(COMMON_DIR)/keymap.c \
- $(COMMON_DIR)/timer.c \
$(COMMON_DIR)/print.c \
$(COMMON_DIR)/debug.c \
- $(COMMON_DIR)/bootloader.c \
- $(COMMON_DIR)/suspend.c \
- $(COMMON_DIR)/xprintf.S \
- $(COMMON_DIR)/util.c
+ $(COMMON_DIR)/util.c \
+ $(COMMON_DIR)/avr/suspend.c \
+ $(COMMON_DIR)/avr/xprintf.S \
+ $(COMMON_DIR)/avr/timer.c \
+ $(COMMON_DIR)/avr/bootloader.c
# Option modules
ifdef BOOTMAGIC_ENABLE
SRC += $(COMMON_DIR)/bootmagic.c
- SRC += $(COMMON_DIR)/eeconfig.c
+ SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBOOTMAGIC_ENABLE
endif
diff --git a/common/action.c b/common/action.c
index 83bc8a6187..ec8eeae7bc 100644
--- a/common/action.c
+++ b/common/action.c
@@ -509,7 +509,7 @@ void clear_keyboard_but_mods(void)
#endif
}
-bool is_tap_key(key_t key)
+bool is_tap_key(keypos_t key)
{
action_t action = layer_switch_get_action(key);
diff --git a/common/action.h b/common/action.h
index 077711c231..8a4736d7bc 100644
--- a/common/action.h
+++ b/common/action.h
@@ -25,6 +25,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_macro.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* tapping count and state */
typedef struct {
bool interrupted :1;
@@ -42,12 +46,11 @@ typedef struct {
#endif
} keyrecord_t;
-
/* Execute action per keyevent */
void action_exec(keyevent_t event);
/* action for key */
-action_t action_for_key(uint8_t layer, key_t key);
+action_t action_for_key(uint8_t layer, keypos_t key);
/* macro */
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
@@ -65,11 +68,15 @@ void unregister_mods(uint8_t mods);
void clear_keyboard(void);
void clear_keyboard_but_mods(void);
void layer_switch(uint8_t new_layer);
-bool is_tap_key(key_t key);
+bool is_tap_key(keypos_t key);
/* debug */
void debug_event(keyevent_t event);
void debug_record(keyrecord_t record);
void debug_action(action_t action);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ACTION_H */
diff --git a/common/action_layer.c b/common/action_layer.c
index 526e24d539..c535615f44 100644
--- a/common/action_layer.c
+++ b/common/action_layer.c
@@ -112,7 +112,7 @@ void layer_debug(void)
-action_t layer_switch_get_action(key_t key)
+action_t layer_switch_get_action(keypos_t key)
{
action_t action;
action.code = ACTION_TRANSPARENT;
diff --git a/common/action_layer.h b/common/action_layer.h
index 034e00027b..b6da353cfd 100644
--- a/common/action_layer.h
+++ b/common/action_layer.h
@@ -72,6 +72,6 @@ void layer_xor(uint32_t state);
/* return action depending on current layer status */
-action_t layer_switch_get_action(key_t key);
+action_t layer_switch_get_action(keypos_t key);
#endif
diff --git a/common/action_macro.c b/common/action_macro.c
index d85aee3796..ba93fc8b23 100644
--- a/common/action_macro.c
+++ b/common/action_macro.c
@@ -14,10 +14,10 @@ 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 <util/delay.h>
#include "action.h"
#include "action_util.h"
#include "action_macro.h"
+#include "wait.h"
#ifdef DEBUG_ACTION
#include "debug.h"
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NO_ACTION_MACRO
-#define MACRO_READ() (macro = pgm_read_byte(macro_p++))
+#define MACRO_READ() (macro = MACRO_GET(macro_p++))
void action_macro_play(const macro_t *macro_p)
{
macro_t macro = END;
@@ -58,7 +58,7 @@ void action_macro_play(const macro_t *macro_p)
case WAIT:
MACRO_READ();
dprintf("WAIT(%u)\n", macro);
- { uint8_t ms = macro; while (ms--) _delay_ms(1); }
+ { uint8_t ms = macro; while (ms--) wait_ms(1); }
break;
case INTERVAL:
interval = MACRO_READ();
@@ -77,7 +77,7 @@ void action_macro_play(const macro_t *macro_p)
return;
}
// interval
- { uint8_t ms = interval; while (ms--) _delay_ms(1); }
+ { uint8_t ms = interval; while (ms--) wait_ms(1); }
}
}
#endif
diff --git a/common/action_macro.h b/common/action_macro.h
index 6218263088..aedc32ec6b 100644
--- a/common/action_macro.h
+++ b/common/action_macro.h
@@ -17,12 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef ACTION_MACRO_H
#define ACTION_MACRO_H
#include <stdint.h>
-#include <avr/pgmspace.h>
+#include "progmem.h"
-#define MACRO_NONE 0
-#define MACRO(...) ({ static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; })
-
+#define MACRO_NONE 0
+#define MACRO(...) ({ static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; })
+#define MACRO_GET(p) pgm_read_byte(p)
typedef uint8_t macro_t;
diff --git a/common/action_util.c b/common/action_util.c
index 5f44b3812c..dbee630d18 100644
--- a/common/action_util.c
+++ b/common/action_util.c
@@ -31,8 +31,8 @@ static uint8_t real_mods = 0;
static uint8_t weak_mods = 0;
#ifdef USB_6KRO_ENABLE
-#define RO_ADD(a, b) ((a + b) % REPORT_KEYS)
-#define RO_SUB(a, b) ((a - b + REPORT_KEYS) % REPORT_KEYS)
+#define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS)
+#define RO_SUB(a, b) ((a - b + KEYBOARD_REPORT_KEYS) % KEYBOARD_REPORT_KEYS)
#define RO_INC(a) RO_ADD(a, 1)
#define RO_DEC(a) RO_SUB(a, 1)
static int8_t cb_head = 0;
@@ -98,7 +98,7 @@ void del_key(uint8_t key)
void clear_keys(void)
{
// not clear mods
- for (int8_t i = 1; i < REPORT_SIZE; i++) {
+ for (int8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) {
keyboard_report->raw[i] = 0;
}
}
@@ -145,7 +145,7 @@ void clear_oneshot_mods(void)
uint8_t has_anykey(void)
{
uint8_t cnt = 0;
- for (uint8_t i = 1; i < REPORT_SIZE; i++) {
+ for (uint8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) {
if (keyboard_report->raw[i])
cnt++;
}
@@ -162,7 +162,7 @@ uint8_t get_first_key(void)
#ifdef NKRO_ENABLE
if (keyboard_nkro) {
uint8_t i = 0;
- for (; i < REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
+ for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
;
return i<<3 | biton(keyboard_report->nkro.bits[i]);
}
@@ -234,7 +234,7 @@ static inline void add_key_byte(uint8_t code)
#else
int8_t i = 0;
int8_t empty = -1;
- for (; i < REPORT_KEYS; i++) {
+ for (; i < KEYBOARD_REPORT_KEYS; i++) {
if (keyboard_report->keys[i] == code) {
break;
}
@@ -242,7 +242,7 @@ static inline void add_key_byte(uint8_t code)
empty = i;
}
}
- if (i == REPORT_KEYS) {
+ if (i == KEYBOARD_REPORT_KEYS) {
if (empty != -1) {
keyboard_report->keys[empty] = code;
}
@@ -278,7 +278,7 @@ static inline void del_key_byte(uint8_t code)
} while (i != cb_tail);
}
#else
- for (uint8_t i = 0; i < REPORT_KEYS; i++) {
+ for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
if (keyboard_report->keys[i] == code) {
keyboard_report->keys[i] = 0;
}
@@ -289,7 +289,7 @@ static inline void del_key_byte(uint8_t code)
#ifdef NKRO_ENABLE
static inline void add_key_bit(uint8_t code)
{
- if ((code>>3) < REPORT_BITS) {
+ if ((code>>3) < KEYBOARD_REPORT_BITS) {
keyboard_report->nkro.bits[code>>3] |= 1<<(code&7);
} else {
dprintf("add_key_bit: can't add: %02X\n", code);
@@ -298,7 +298,7 @@ static inline void add_key_bit(uint8_t code)
static inline void del_key_bit(uint8_t code)
{
- if ((code>>3) < REPORT_BITS) {
+ if ((code>>3) < KEYBOARD_REPORT_BITS) {
keyboard_report->nkro.bits[code>>3] &= ~(1<<(code&7));
} else {
dprintf("del_key_bit: can't del: %02X\n", code);
diff --git a/common/action_util.h b/common/action_util.h
index f9d3161a80..a955638b46 100644
--- a/common/action_util.h
+++ b/common/action_util.h
@@ -20,6 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdint.h>
#include "report.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern report_keyboard_t *keyboard_report;
void send_keyboard_report(void);
@@ -54,4 +58,9 @@ void oneshot_disable(void);
uint8_t has_anykey(void);
uint8_t has_anymod(void);
uint8_t get_first_key(void);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/common/bootloader.c b/common/avr/bootloader.c
index cda295b181..cda295b181 100644
--- a/common/bootloader.c
+++ b/