aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboard/hid_liber/config.h2
-rw-r--r--keyboard/hid_liber/keymap.c25
-rw-r--r--keyboard/hid_liber/matrix.c7
3 files changed, 23 insertions, 11 deletions
diff --git a/keyboard/hid_liber/config.h b/keyboard/hid_liber/config.h
index 792727165..a9b77c7dc 100644
--- a/keyboard/hid_liber/config.h
+++ b/keyboard/hid_liber/config.h
@@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
39//#define MATRIX_HAS_GHOST 39//#define MATRIX_HAS_GHOST
40 40
41/* Set 0 if need no debouncing */ 41/* Set 0 if need no debouncing */
42#define DEBOUNCE 7 42#define DEBOUNCE 8
43 43
44 44
45/* key combination for command */ 45/* key combination for command */
diff --git a/keyboard/hid_liber/keymap.c b/keyboard/hid_liber/keymap.c
index ecfa5cbe6..55fe87232 100644
--- a/keyboard/hid_liber/keymap.c
+++ b/keyboard/hid_liber/keymap.c
@@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
35 KG7, KG5, KH5, KJ5, KI5, KI7, KK7, KK5, KL5, KA5, KC5, KC7, KL7, KD6, KQ7, KN7, KM7, \ 35 KG7, KG5, KH5, KJ5, KI5, KI7, KK7, KK5, KL5, KA5, KC5, KC7, KL7, KD6, KQ7, KN7, KM7, \
36 KG6, KG3, KH3, KJ3, KI3, KI6, KK6, KK3, KL3, KA3, KC3, KC6, KL6, KD4, KP7, KN5, KM5, \ 36 KG6, KG3, KH3, KJ3, KI3, KI6, KK6, KK3, KL3, KA3, KC3, KC6, KL6, KD4, KP7, KN5, KM5, \
37 KH6, KG4, KH4, KJ4, KI4, KI1, KK1, KK4, KL4, KA4, KC4, KC1, KD0, \ 37 KH6, KG4, KH4, KJ4, KI4, KI1, KK1, KK4, KL4, KA4, KC4, KC1, KD0, \
38 KF6, KQ0, KG0, KH0, KJ0, KI0, KI2, KK2, KK0, KL0, KA0, KC2, KF4, KN1, \ 38 KF6, KH1, KG0, KH0, KJ0, KI0, KI2, KK2, KK0, KL0, KA0, KC2, KF4, KN1, \
39 KO7, KE6, KB1, KP1, KB2, KR4, KA2, KO0, KN2, KP2, KQ2 \ 39 KO7, KE6, KB1, KP1, KB2, KR4, KA2, KO0, KN2, KP2, KQ2 \
40) { \ 40) { \
41/* 0 1 2 3 4 5 6 7 */ \ 41/* 0 1 2 3 4 5 6 7 */ \
@@ -45,8 +45,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
45/* D */ { KC_##KD0, KC_##KD1, KC_##KD2, KC_NO , KC_##KD4, KC_##KD5, KC_##KD6, KC_##KD7 }, \ 45/* D */ { KC_##KD0, KC_##KD1, KC_##KD2, KC_NO , KC_##KD4, KC_##KD5, KC_##KD6, KC_##KD7 }, \
46/* E */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_##KE6, KC_NO }, \ 46/* E */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_##KE6, KC_NO }, \
47/* F */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_##KF4, KC_NO , KC_##KF6, KC_NO }, \ 47/* F */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_##KF4, KC_NO , KC_##KF6, KC_NO }, \
48/* G */ { KC_##KG0, KC_##KG1, KC_NO , KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7 }, \ 48/* G */ { KC_##KG0, KC_##KG1, KC_NO , KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7 }, \
49/* H */ { KC_##KH0, KC_NO , KC_NO , KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7 }, \ 49/* H */ { KC_##KH0, KC_##KH1, KC_NO , KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7 }, \
50/* I */ { KC_##KI0, KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7 }, \ 50/* I */ { KC_##KI0, KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7 }, \
51/* J */ { KC_##KJ0, KC_##KJ1, KC_NO , KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7 }, \ 51/* J */ { KC_##KJ0, KC_##KJ1, KC_NO , KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7 }, \
52/* K */ { KC_##KK0, KC_##KK1, KC_##KK2, KC_##KK3, KC_##KK4, KC_##KK5, KC_##KK6, KC_##KK7 }, \ 52/* K */ { KC_##KK0, KC_##KK1, KC_##KK2, KC_##KK3, KC_##KK4, KC_##KK5, KC_##KK6, KC_##KK7 }, \
@@ -88,9 +88,10 @@ static const uint8_t PROGMEM fn_keycode[] = {
88}; 88};
89 89
90/* 90/*
91 * Tenkeyless keyboard default layout, ISO & ANSI (ISO is next to right shift, 91 * Tenkeyless keyboard default layout, ISO & ANSI (ISO is between Left Shift
92 * not present on ANSI, other ISO switches move from ANSI layout but are same 92 * and Z, and the ANSI \ key above Return/Enter is used for the additional ISO
93 * switch 93 * switch in the ASD row next to enter. Use NUBS as keycode for the first and
94 * NUHS as the keycode for the second.
94 * 95 *
95 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. 96 * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
96 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| 97 * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
@@ -135,9 +136,19 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
135 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, INS, HOME, PGUP, \ 136 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, INS, HOME, PGUP, \
136 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, DEL, END, PGDN, \ 137 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, DEL, END, PGDN, \
137 FN1, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \ 138 FN1, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \
138 LSFT, 0, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \ 139 LSFT, NO, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \
139 LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT), 140 LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT),
140 141
142/* EXAMPLE ISO keymap, see the NUBS and NUHS keycodes
143 * KEYMAP(\
144 * ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, BRK, \
145 * GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, INS, HOME, PGUP, \
146 * TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, NUHS, DEL, END, PGDN, \
147 * CAPS, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \
148 * LSFT, NUBS, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \
149 * LCTL, FN1, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT),
150 */
151
141 152
142/* 153/*
143 * ,---. ,---------------. ,---------------. ,---------------. ,-----------. 154 * ,---. ,---------------. ,---------------. ,---------------. ,-----------.
diff --git a/keyboard/hid_liber/matrix.c b/keyboard/hid_liber/matrix.c
index 6798b36d7..2d939ef63 100644
--- a/keyboard/hid_liber/matrix.c
+++ b/keyboard/hid_liber/matrix.c
@@ -19,7 +19,7 @@
19 19
20 20
21#ifndef DEBOUNCE 21#ifndef DEBOUNCE
22# define DEBOUNCE 0 22# define DEBOUNCE 0
23#endif 23#endif
24static uint8_t debouncing = DEBOUNCE; 24static uint8_t debouncing = DEBOUNCE;
25 25
@@ -142,7 +142,7 @@ void matrix_init(void)
142 // To use PORTF disable JTAG with writing JTD bit twice within four cycles. 142 // To use PORTF disable JTAG with writing JTD bit twice within four cycles.
143 MCUCR |= (1<<JTD); 143 MCUCR |= (1<<JTD);
144 MCUCR |= (1<<JTD); 144 MCUCR |= (1<<JTD);
145 145
146 // initialize row and col 146 // initialize row and col
147 setup_io_pins(); 147 setup_io_pins();
148 setup_leds(); 148 setup_leds();
@@ -164,7 +164,7 @@ uint8_t matrix_scan(void)
164 164
165 for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-7 165 for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-7
166 pull_column(col); // output hi on theline 166 pull_column(col); // output hi on theline
167 _delay_us(3); // without this wait it won't read stable value. 167 _delay_us(5); // without this wait it won't read stable value.
168 for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-17 168 for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-17
169 bool prev_bit = matrix[row] & (1<<col); 169 bool prev_bit = matrix[row] & (1<<col);
170 bool curr_bit = *row_pin[row] & row_bit[row]; 170 bool curr_bit = *row_pin[row] & row_bit[row];
@@ -173,6 +173,7 @@ uint8_t matrix_scan(void)
173 if (debouncing) { 173 if (debouncing) {
174 debug("bounce!: "); debug_hex(debouncing); print("\n"); 174 debug("bounce!: "); debug_hex(debouncing); print("\n");
175 } 175 }
176 _delay_ms(1); // improved affect on bouncing
176 debouncing = DEBOUNCE; 177 debouncing = DEBOUNCE;
177 } 178 }
178 } 179 }