From 198142e115461bf3aab5b024bed997443450db16 Mon Sep 17 00:00:00 2001 From: Diego Roversi Date: Sat, 18 Nov 2017 17:07:55 +0100 Subject: Before crazy changes... --- TERES-HID/KeyboardMouse.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'TERES-HID/KeyboardMouse.c') diff --git a/TERES-HID/KeyboardMouse.c b/TERES-HID/KeyboardMouse.c index aec2e21..1634a9d 100644 --- a/TERES-HID/KeyboardMouse.c +++ b/TERES-HID/KeyboardMouse.c @@ -350,20 +350,22 @@ CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t * DDRB = 0xff; - for (colmn = 0; colmn < 8; colmn++) { + for (colmn = 0; colmn < 8; colmn++) { // y ? uint8_t keynow = 0; - + + // that's crazy... here we set d4=1 (x14-15) and then read from port B (y0..y7) + // even if we are supposed to set Y0 and then read along X if (colmn == 0) { cli(); - DDRB = 0x00; - PORTB = 0x00; - DDRD = (1 << 4); - PORTD = (1 << 4); + DDRB = 0x00; // all input + PORTB = 0x00; // pull up off + DDRD = (1 << 4); // d4 output + PORTD = (1 << 4); // d4 = 1 -> x14-15 Delay_MS(2); - if (PINB & 0x40) { + if (PINB & 0x40) { //b6(y6) == 1 -> Fn Key fn = 112; // tp_guarder(); if (PINB & 0x01) { @@ -403,10 +405,10 @@ CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t * } // x0 - DDRD = (1 << 6); - PORTD = (1 << 6); - DDRB = 0x00; - PORTB = 0x00; + DDRD = (1 << 6); // d6 output (x0) + PORTD = (1 << 6);// d6 =1 + DDRB = 0x00; // input + PORTB = 0x00; // no pullup Delay_MS(2); if (PINB & 0x10) { @@ -432,13 +434,12 @@ CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t * PORTD = 0xfc; Delay_MS(3); sei(); - } + } // if colmn==0 PORTB = rowY[colmn]; while (PINB != rowY[colmn]); - x = 1; - + x = 1; // 1 if ((PINC & (1 << 7)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; @@ -453,7 +454,6 @@ CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t * add_key(KeyboardReport,keynow); } x++; // 3 - // Delay_MS(5); if ((PIND & (1 << 7)) == 0) { // tp_guarder(); keynow = keys[colmn * 14 + x + fn]; -- cgit v1.2.3