summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Roversi <diegor@tiscali.it>2017-11-18 17:07:55 +0100
committerDiego Roversi <diegor@tiscali.it>2017-11-18 17:07:55 +0100
commit198142e115461bf3aab5b024bed997443450db16 (patch)
tree1b19cc86334bc2ef6ba6d6a645683b04c074d8f4
parent06d5200c445ac0372d6ad1ddc4cc6420de8e3400 (diff)
Before crazy changes...
-rw-r--r--TERES-HID/KeyboardMouse.c30
1 files changed, 15 insertions, 15 deletions
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];