pea
developer
Hi all,
I want to set up an interrupt to handle the mouse routines on GPDesktop for two reasons:
1) The mouse needs to move the same speed no matter which clock speed is used
2) The mouse still needs to move if something is using a lot of processing time (i.e. I can't just have a while() loop to wait x time).
How do interrupts work? Are they based on CPU cycles (e.g. fire every 1000 cycles) or LCD vsyncs (e.g. fire when LCD gets to line 200) or real time (e.g. fire every 20 ms) or something else?
AND.. does an interrupt just run a function I specify?
I want to do something like this e.g.:
Is my thinking sort of right, or am i way off the mark? Where can I see a good working example of this?
p.s. I can link it to the RTC for timing if necessary. tsk tsk Mr.Mirko, whhy would you use a global variable called 'in_use'. Not very specific is it
I want to set up an interrupt to handle the mouse routines on GPDesktop for two reasons:
1) The mouse needs to move the same speed no matter which clock speed is used
2) The mouse still needs to move if something is using a lot of processing time (i.e. I can't just have a while() loop to wait x time).
How do interrupts work? Are they based on CPU cycles (e.g. fire every 1000 cycles) or LCD vsyncs (e.g. fire when LCD gets to line 200) or real time (e.g. fire every 20 ms) or something else?
AND.. does an interrupt just run a function I specify?
I want to do something like this e.g.:
Code:
function handleInput(){
pauseInterrupts();
exit_if_not_enough_time_has_passed();
do_mouse_stuff();
continueInterrupts();
}
disable_interrupts();
insert_my_interrupt( handleInput );
enableInterrupts();
Is my thinking sort of right, or am i way off the mark? Where can I see a good working example of this?
p.s. I can link it to the RTC for timing if necessary. tsk tsk Mr.Mirko, whhy would you use a global variable called 'in_use'. Not very specific is it