Teensy 2.0 USB Keyboard+Mouse in C?

Status
Not open for further replies.

pmcmorris

New member
Hello, this is likely a duplicate post but I've just spent the last couple hours searching with no luck.

I'm trying to work the usb_keyboard, usb_mouse, and uart examples into one so that when I plug the teensy in, two devices appear and I can control both over serial from another machine. So far I've gotten the mouse and uart projects merged and can control those just fine. But natrually the mouse/kbd projects don't merge nicely as there is a lot of duplicate code and some conflicts that are unclear (to me) how to sort out. In particular, I don't know enough about USB yet to know how to modify the static data to specify multiple endpoints etc.

This looks a lot simpler with the teensyduino path but I'm trying to do this using straight C. Is there an example out there somewhere that does mouse+keyboard at the same time for Teensy 2.0? If not, where is the best place to go to learn about how I might understand the USB stuff so that I know what changes are needed? Or if this is answered already can someone please post a link to the other threads?


Patrick
 
Is there an example out there somewhere that does mouse+keyboard at the same time for Teensy 2.0?

Yes, it's build into Teensyduino.

Even if you never intend to really use Arduino, at the very least give it a quick try. Look at the examples in File > Examples > Teensy > USB_Keyboard and USB_Mouse.

The actual USB code can be found in hardware/teensy/avr/cores/usb_hid. If using a Mac, control-click Ardiuno and "Show Package Contents" to access the folders inside Arduino. You'll see it's a newer version of those old C-only examples. The low-level USB code answers you seek are there in those files.

But before you dig into all that, why not just quickly run some of those Arduino examples. It's so incredibly easy. Even if you never use Arduino again, having a working sample for comparison might really help?
 
Status
Not open for further replies.
Back
Top