More keyboard trouble

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.
Post Reply
vbbrett

More keyboard trouble

Post by vbbrett »

Hello all,
Help is needed in getting this code to work. I have tried for about a week at debugging. So, now it's your turn to play with it.
Whenever I type using this code (I've tried this on 3 different computers) it always comes out with 2 or 3 of the same letter. Striking the key VERY quickly produces 1 letter on the screen. Why is this happenning and how can I resolve this issue?

This is very messy. I now. Work with me please. Any pointers would be nice.

Brett

[attachment deleted by admin]
Curufir

Re:More keyboard trouble

Post by Curufir »

Code: Select all

if (intnumber = 0x51) { keyhandler(); }
if (intnumber = 0x50) { ticks++; }
Both of these evaluate to true, so you call the keyhandler() function every tick.

Side-Note: Your code style is very difficult to read. I'd seriously advise you to tidy it up before the source grows much further (Unless the formatting somehow got removed on posting).
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:More keyboard trouble

Post by Pype.Clicker »

case 'a': kprintf("a", xpos, ypos); pdat=1; break;
case 'b': kprintf("b", xpos, ypos); pdat=1; break;
case 'c': kprintf("c", xpos, ypos); pdat=1; break;
case 'd': kprintf("d", xpos, ypos); pdat=1; break;
aargh! :O

Code: Select all

if (intnumber = 0x51) { keyhandler(); }
if (intnumber = 0x50) { ticks++; }
these should be 'intnumber == 0x51' ... typical mistake for someone who comes into C :) and for someone who wrote C code all the night :-p

I'm not sure a "if (...) call_sub_handler()" is the nicest way to deal with interrupts at all ...
Post Reply