Free a cog: Single cog keyboard + mouse object
GdSis
Posts: 12
Hello all,
As learning exercise, I merged the Parallax keyboard and mouse objects on a single object.
It is working, but I couldn't found why·it sometimes freezes by a moment, at random intervals.
The same·also happens with the original objects, at least on my demoboard, but this "effect"
seems incrased on this version.
I also added a new method for lock settings·at runtime.
Plese consider to report any other glitches as it is very beta version that can be improved
considerably.
Thank you all, I found this forum very instructive.
Gus
·Edit: Please see usage inside.
As learning exercise, I merged the Parallax keyboard and mouse objects on a single object.
It is working, but I couldn't found why·it sometimes freezes by a moment, at random intervals.
The same·also happens with the original objects, at least on my demoboard, but this "effect"
seems incrased on this version.
I also added a new method for lock settings·at runtime.
Plese consider to report any other glitches as it is very beta version that can be improved
considerably.
Thank you all, I found this forum very instructive.
Gus
·Edit: Please see usage inside.
Comments
Graham
Neither the mouse or keyboard are detected on my system and they are detected with the standard drivers.
I debugged it a bit and can see several problems. I have started again from the original drivers but wondered whether anyone got it working before I go too far?
I may have found the cause of the intermittent problem with this code after spending some time with a scope and tracking this down today. Combining the PS/2 keyboard and mouse driver is really great to save a COG but it was driving me crazy with occasional keyboard and mouse resets when typing and moving the mouse a lot.
With the scope and a pin output showing the sampling time relative to the PS/2 clock signal I was seeing bad data pin sampling time periods from time to time and tracked it down to the delay code causing parity errors.
I've made a couple of changes and now haven't seen the reset glitches that were happening before. I believe this code below that was doing the counter polling was problematic as it was modifying the "t" timestamp variable being compared to the cnt register within the loop itself which I don't believe was the original intention.
Original code: New code with fixes in red:
The two additional instructions I added to this code filled the COG so I didn't have space for the temporary result I required and I had to steal the phbs register, but it was not being used so it should be safe to use.
Enjoy,
Roger.
Just so you know. I made a much better version of this driver...
http://obex.parallax.com/objects/654/
Way more features.
I hope to hear from people who have tested this type driver...