]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - ps2_usb/matrix.c
fix for ps2_usb Makefile and circuit
[max/tmk_keyboard.git] / ps2_usb / matrix.c
index aaf89719efb942bab9dff61050bc69fca8deda4a..52479d9752825382b46bec6bc9456f3af2c6f902 100644 (file)
@@ -9,8 +9,7 @@
 #include "util.h"
 #include "debug.h"
 #include "ps2.h"
-#include "usb_keyboard.h"
-#include "matrix_skel.h"
+#include "matrix.h"
 
 
 #if (MATRIX_COLS > 16)
@@ -60,8 +59,6 @@ static bool matrix_has_ghost_in_row(uint8_t row);
 #endif
 static void matrix_make(uint8_t code);
 static void matrix_break(uint8_t code);
-static void ps2_reset(void);
-static void ps2_set_leds(uint8_t leds);
 
 
 inline
@@ -78,20 +75,8 @@ uint8_t matrix_cols(void)
 
 void matrix_init(void)
 {
-    print_enable = true;
     ps2_host_init();
 
-    ps2_reset();
-
-    // flush LEDs
-    ps2_set_leds(1<<PS2_LED_NUM_LOCK);
-    _delay_ms(100);
-    ps2_set_leds(1<<PS2_LED_NUM_LOCK|1<<PS2_LED_CAPS_LOCK);
-    _delay_ms(100);
-    ps2_set_leds(1<<PS2_LED_NUM_LOCK|1<<PS2_LED_CAPS_LOCK|1<<PS2_LED_SCROLL_LOCK);
-    _delay_ms(300);
-    ps2_set_leds(0x00);
-    
     // initialize matrix state: all keys off
     for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
 
@@ -191,7 +176,6 @@ uint8_t matrix_scan(void)
 
     uint8_t code;
     while ((code = ps2_host_recv())) {
-debug_hex(code); debug(" ");
         switch (state) {
             case INIT:
                 switch (code) {
@@ -349,22 +333,6 @@ debug_hex(code); debug(" ");
                 state = INIT;
         }
     }
-
-    // handle LED indicators
-    static uint8_t prev_leds = 0;
-    if (prev_leds != usb_keyboard_leds) {
-        uint8_t leds = 0;
-        if (usb_keyboard_leds&(1<<USB_LED_SCROLL_LOCK))
-            leds |= (1<<PS2_LED_SCROLL_LOCK);
-        if (usb_keyboard_leds&(1<<USB_LED_NUM_LOCK))
-            leds |= (1<<PS2_LED_NUM_LOCK);
-        if (usb_keyboard_leds&(1<<USB_LED_CAPS_LOCK))
-            leds |= (1<<PS2_LED_CAPS_LOCK);
-
-        ps2_set_leds(leds);
-        prev_leds = usb_keyboard_leds;
-    }
-
     return 1;
 }
 
@@ -472,19 +440,3 @@ static void matrix_break(uint8_t code)
         is_modified = true;
     }
 }
-
-static void ps2_reset(void)
-{
-    ps2_host_send(0xFF);
-    ps2_host_recv(); // 0xFA
-    ps2_host_recv(); // 0xAA
-    _delay_ms(1000);
-}
-
-static void ps2_set_leds(uint8_t leds)
-{
-        ps2_host_send(0xED);
-        ps2_host_recv();        // 0xFA
-        ps2_host_send(leds);
-        ps2_host_recv();        // 0xFA
-}