I'm currently reading values from a PS/2 mouse, which is working perfectly! - I'm trying only to read from the mouse, when the mouse sends a clock signal (falling edge), so i'm trying to use a interrupt. This is some of my code so far:
Interrupt handler:
extern struct mouse mouseData;
CY_ISR(PS2_interrupt) {
ISR_getMouseData(&mouseData);
}
This interrupt is giving me the follwing result, which is perfect:
I'm moving the mouse to the right, and it's outputting the right thing, i can't however do anything in the main for loop. If i for instance print something on the display in the main loop, nothing happends, but it can still read data from the mouse, whenever the mouse is sending..
I found out that you should clear the interrupt using this function:
isr_PS2_clock_ClearPending()
When i write this function in the interrupt handler i'll get this:
This is the same movement at before, but as you can see, the data i corrupted. I can however execute things in the main loop, whenever the intterrupt is not called.
What am i doing wrong in terms of handling the interrupts?