diff options
| -rw-r--r-- | keyboard/IIgs_Standard/config.h | 2 | ||||
| -rw-r--r-- | keyboard/IIgs_Standard/matrix.c | 17 |
2 files changed, 12 insertions, 7 deletions
diff --git a/keyboard/IIgs_Standard/config.h b/keyboard/IIgs_Standard/config.h index 447c9eadd..38ac21df6 100644 --- a/keyboard/IIgs_Standard/config.h +++ b/keyboard/IIgs_Standard/config.h | |||
| @@ -44,7 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 44 | /* define if matrix has ghost */ | 44 | /* define if matrix has ghost */ |
| 45 | #define MATRIX_HAS_GHOST | 45 | #define MATRIX_HAS_GHOST |
| 46 | /* Set 0 if need no debouncing */ | 46 | /* Set 0 if need no debouncing */ |
| 47 | #define DEBOUNCE 0 | 47 | #define DEBOUNCE 5 |
| 48 | 48 | ||
| 49 | 49 | ||
| 50 | /* key combination for command */ | 50 | /* key combination for command */ |
diff --git a/keyboard/IIgs_Standard/matrix.c b/keyboard/IIgs_Standard/matrix.c index 6cd806e2d..6ca55b7ea 100644 --- a/keyboard/IIgs_Standard/matrix.c +++ b/keyboard/IIgs_Standard/matrix.c | |||
| @@ -130,17 +130,23 @@ uint8_t matrix_scan(void) | |||
| 130 | matrix[i] = ~read_col(i) | 0b00010000; // send fake caps lock down | 130 | matrix[i] = ~read_col(i) | 0b00010000; // send fake caps lock down |
| 131 | } | 131 | } |
| 132 | } else { // CAPS LOCK is OFF on HOST | 132 | } else { // CAPS LOCK is OFF on HOST |
| 133 | matrix[i] = ~read_col(i); | 133 | if (matrix[i] != (uint8_t)~read_col(i)) { |
| 134 | matrix[i] = (uint8_t)~read_col(i); | ||
| 135 | if (debouncing) { | ||
| 136 | debug("bounce!: "); debug_hex(debouncing); print("\n"); | ||
| 137 | } | ||
| 138 | debouncing = DEBOUNCE; | ||
| 139 | } | ||
| 134 | } | 140 | } |
| 135 | } else { | 141 | } else { |
| 136 | if (matrix[i] != (uint8_t)~read_col(i)) { | 142 | if (matrix[i] != (uint8_t)~read_col(i)) { |
| 137 | matrix[i] = (uint8_t)~read_col(i); | 143 | matrix[i] = (uint8_t)~read_col(i); |
| 144 | if (debouncing) { | ||
| 145 | debug("bounce!: "); debug_hex(debouncing); print("\n"); | ||
| 146 | } | ||
| 147 | debouncing = DEBOUNCE; | ||
| 138 | } | 148 | } |
| 139 | } | 149 | } |
| 140 | if (debouncing) { | ||
| 141 | debug("bounce!: "); debug_hex(debouncing); print("\n"); | ||
| 142 | } | ||
| 143 | debouncing = DEBOUNCE; | ||
| 144 | } | 150 | } |
| 145 | unselect_rows(); | 151 | unselect_rows(); |
| 146 | 152 | ||
| @@ -264,7 +270,6 @@ static uint8_t read_col(uint8_t row) | |||
| 264 | tmp |= (PINF >> 1 ) & 0b00001000; // LEFT GUI is 3bit in modifier (HID Spec) | 270 | tmp |= (PINF >> 1 ) & 0b00001000; // LEFT GUI is 3bit in modifier (HID Spec) |
| 265 | tmp |= (PINA << 4 ) & 0b00010000; // CAPSLOCK | 271 | tmp |= (PINA << 4 ) & 0b00010000; // CAPSLOCK |
| 266 | tmp |= (PINB << 3 ) & 0b00100000; // POWER | 272 | tmp |= (PINB << 3 ) & 0b00100000; // POWER |
| 267 | //tmp |= (PINE << 1 ) & 0b00010000; // Caps Lock(Should not be in modifier | ||
| 268 | } else { | 273 | } else { |
| 269 | tmp = 0x00; | 274 | tmp = 0x00; |
| 270 | tmp = (PINE >> 1)&0b00000001; | 275 | tmp = (PINE >> 1)&0b00000001; |
