Project

General

Profile

Revision 49

minor changes

View differences:

lab3/kbc_func.c
16 16

  
17 17
uint8_t scancode[2];
18 18
int got_error = 0;
19
int done = 0;
19
int done = 1;
20 20
int sz = 1;
21 21

  
22 22
void (kbc_ih)(void) {
23

  
24
    if(done) sz = 1;
25
    else     sz++;
26

  
23 27
    uint8_t status = 0;
24 28
    got_error = 0;
25 29

  
......
40 44
        return;
41 45
    }
42 46

  
43
    if (sz == 2 && done == 0) {
44
        scancode[1] = byte;
45
        done = 1;
46
    } else {
47
        scancode[0] = byte;
48
        if (byte == TWO_BYTE_CODE) {
49
            sz = 2;
50
            done = 0;
51
        } else {
52
            sz = 1;
53
            done = 1;
54
        }
55
    }
47
    scancode[sz-1] = byte;
48
    done = !(TWO_BYTE_CODE == byte);
56 49

  
57 50
}
58 51

  

Also available in: Unified diff