summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap_extras/keymap_jp.h62
-rw-r--r--quantum/matrix.c2
-rw-r--r--quantum/quantum.c11
3 files changed, 72 insertions, 3 deletions
diff --git a/quantum/keymap_extras/keymap_jp.h b/quantum/keymap_extras/keymap_jp.h
new file mode 100644
index 000000000..e81b5952e
--- /dev/null
+++ b/quantum/keymap_extras/keymap_jp.h
@@ -0,0 +1,62 @@
+/* JP106-layout (Japanese Standard)
+ *
+ * For more information, see
+ * http://www2d.biglobe.ne.jp/~msyk/keyboard/layout/usbkeycode.html
+ * note: This website is written in Japanese.
+ */
+
+
+#ifndef KEYMAP_JP_H
+#define KEYMAP_JP_H
+
+
+#include "keymap.h"
+
+
+#define JP_ZHTG KC_GRV // hankaku/zenkaku|kanzi
+#define JP_YEN KC_INT3 // yen, |
+#define JP_CIRC KC_EQL // ^, ~
+#define JP_AT KC_LBRC // @, `
+#define JP_LBRC KC_RBRC // [, {
+#define JP_COLN KC_QUOT // :, *
+#define JP_RBRC KC_NUHS // ], }
+#define JP_BSLS KC_INT1 // \, _
+#define JP_MHEN KC_INT5 // muhenkan
+#define JP_HENK KC_INT4 // henkan
+#define JP_KANA KC_INT2 // katakana/hiragana|ro-mazi
+
+
+//Aliases for shifted symbols
+#define JP_DQT LSFT(KC_2) // "
+#define JP_AMPR LSFT(KC_6) // &
+#define JP_QUOT LSFT(KC_7) // '
+#define JP_LPRN LSFT(KC_8) // (
+#define JP_RPRN LSFT(KC_9) // )
+#define JP_EQL LSFT(KC_MINS) // =
+#define JP_TILD LSFT(JP_CIRC) // ~
+#define JP_PIPE LSFT(JP_YEN) // |
+#define JP_GRV LSFT(JP_AT) // `
+#define JP_LCBR LSFT(JP_LBRC) // {
+#define JP_PLUS LSFT(KC_SCLN) // +
+#define JP_ASTR LSFT(JP_COLN) // *
+#define JP_RCBR LSFT(JP_RBRC) // }
+#define JP_UNDS LSFT(JP_BSLS) // _
+
+
+// These symbols are correspond to US101-layout.
+#define JP_MINS KC_MINS // -
+#define JP_SCLN KC_SCLN // ;
+#define JP_COMM KC_COMM // ,
+#define JP_DOT KC_DOT // .
+#define JP_SLSH KC_SLSH // /
+// shifted
+#define JP_EXLM KC_EXLM // !
+#define JP_HASH KC_HASH // #
+#define JP_DLR KC_DLR // $
+#define JP_PERC KC_PERC // %
+#define JP_LT KC_LT // <
+#define JP_GT KC_GT // >
+#define JP_QUES KC_QUES // ?
+
+
+#endif
diff --git a/quantum/matrix.c b/quantum/matrix.c
index 3c488b417..07eb87bc3 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -310,7 +310,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
// Unselect row
unselect_row(current_row);
- return (last_row_value == current_matrix[current_row]);
+ return (last_row_value != current_matrix[current_row]);
}
static void select_row(uint8_t row)
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 098312e6e..b5e2d60b9 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -1,5 +1,9 @@
#include "quantum.h"
+#ifndef TAPPING_TERM
+#define TAPPING_TERM 200
+#endif
+
static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
switch (code) {
case QK_MODS ... QK_MODS_MAX:
@@ -75,6 +79,7 @@ void reset_keyboard(void) {
#endif
static bool shift_interrupted[2] = {0, 0};
+static uint16_t scs_timer = 0;
bool process_record_quantum(keyrecord_t *record) {
@@ -283,6 +288,7 @@ bool process_record_quantum(keyrecord_t *record) {
case KC_LSPO: {
if (record->event.pressed) {
shift_interrupted[0] = false;
+ scs_timer = timer_read ();
register_mods(MOD_BIT(KC_LSFT));
}
else {
@@ -292,7 +298,7 @@ bool process_record_quantum(keyrecord_t *record) {
shift_interrupted[1] = true;
}
#endif
- if (!shift_interrupted[0]) {
+ if (!shift_interrupted[0] && timer_elapsed(scs_timer) < TAPPING_TERM) {
register_code(LSPO_KEY);
unregister_code(LSPO_KEY);
}
@@ -305,6 +311,7 @@ bool process_record_quantum(keyrecord_t *record) {
case KC_RSPC: {
if (record->event.pressed) {
shift_interrupted[1] = false;
+ scs_timer = timer_read ();
register_mods(MOD_BIT(KC_RSFT));
}
else {
@@ -314,7 +321,7 @@ bool process_record_quantum(keyrecord_t *record) {
shift_interrupted[1] = true;
}
#endif
- if (!shift_interrupted[1]) {
+ if (!shift_interrupted[1] && timer_elapsed(scs_timer) < TAPPING_TERM) {
register_code(RSPC_KEY);
unregister_code(RSPC_KEY);
}