Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
//NOTE: KEY_ESC and that stuff has been defined above
unsigned char keys[173]; //line 182
keys[KEY_ESC]=KEY_ESC;
keys[KEY_1]='1';
keys[KEY_2]='2';
keys[KEY_3]='3';
/*more here*/
Now, when I try to compile it I get a bunch of errors saying
keyboard.h:182: error: previous declaration of ‘keys’ was here
keyboard.h:237: error: invalid initializer
keyboard.h:238: warning: data definition has no type or storage class
keyboard.h:238: error: conflicting types for ‘keys’
You cant declare an array in a header file that is going to be included in more than one source file. You should declare the array in a source file and add an extern unsigned char keys[173]; to the header file.
Yeah, but I just scraped it and used the one from Brian's kernel tutorial. And while we're on the topic of keyboard drives I need help with the one I have now
keyboard.h
as you can see I try to detect if a key has been press in getch, but that method doesn't work, does anybody have another way to detect if a key has been pressed?
Use the keyboard IRQ. Then get the scancode (or convert to character), put it into a global variable, and then have getch return its contents (or wait, if the global is 0).
pcmattman wrote:Use the keyboard IRQ. Then get the scancode (or convert to character), put it into a global variable, and then have getch return its contents (or wait, if the global is 0).
Better still, put it into a circular queue. (IRQ1 = int 9 unless you reprogram the PIC).