]> git.donarmstrong.com Git - tmk_firmware.git/commitdiff
Debounce bug fixed
authorJeffrey Sung <nattyman@gmail.com>
Mon, 8 Oct 2012 15:28:33 +0000 (00:28 +0900)
committerJeffrey Sung <nattyman@gmail.com>
Mon, 8 Oct 2012 15:28:33 +0000 (00:28 +0900)
keyboard/IIgs_Standard/config.h
keyboard/IIgs_Standard/matrix.c

index 447c9eadd38841f75ea66b392f772b5e28584e4f..38ac21df664c5ebaab4fedb4079eddaa56daa8ad 100644 (file)
@@ -44,7 +44,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* define if matrix has ghost */\r
 #define MATRIX_HAS_GHOST\r
 /* Set 0 if need no debouncing */\r
-#define DEBOUNCE    0\r
+#define DEBOUNCE    5\r
 \r
 \r
 /* key combination for command */\r
index 6cd806e2d8afdd69af38383b0b351e43e8f94168..6ca55b7ea24d3bf9f9e97dcbc0545a2ca5fc7aac 100644 (file)
@@ -130,17 +130,23 @@ uint8_t matrix_scan(void)
                                        matrix[i] = ~read_col(i) | 0b00010000;                                          // send fake caps lock down
                                }
                        } else {                                                                                                        // CAPS LOCK is OFF on HOST
-                               matrix[i] = ~read_col(i);                                                               
+                       if (matrix[i] != (uint8_t)~read_col(i)) {
+                               matrix[i] = (uint8_t)~read_col(i);
+                               if (debouncing) {
+                                       debug("bounce!: "); debug_hex(debouncing); print("\n");
+                                       }
+                                       debouncing = DEBOUNCE;
+                               }
                        }
                } else {
                if (matrix[i] != (uint8_t)~read_col(i)) {
                        matrix[i] = (uint8_t)~read_col(i);
+                       if (debouncing) {
+                               debug("bounce!: "); debug_hex(debouncing); print("\n");
+                               }
+                               debouncing = DEBOUNCE;
                        }
                }
-        if (debouncing) {
-               debug("bounce!: "); debug_hex(debouncing); print("\n");
-               }
-               debouncing = DEBOUNCE;
        }
     unselect_rows();
 
@@ -264,7 +270,6 @@ static uint8_t read_col(uint8_t row)
                tmp |= (PINF >> 1 ) & 0b00001000;       // LEFT GUI   is 3bit in modifier (HID Spec)
                tmp |= (PINA << 4 ) & 0b00010000;       // CAPSLOCK
                tmp |= (PINB << 3 ) & 0b00100000;       // POWER         
-               //tmp |= (PINE << 1 ) & 0b00010000;     // Caps Lock(Should not be in modifier
        } else {
                tmp = 0x00;
                tmp = (PINE >> 1)&0b00000001;