Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code for handling both keyboard AND mouse ? #17

Open
Pigeo opened this issue Jul 20, 2017 · 1 comment
Open

Example code for handling both keyboard AND mouse ? #17

Pigeo opened this issue Jul 20, 2017 · 1 comment
Labels
topic: documentation Related to documentation for the project type: enhancement Proposed improvement

Comments

@Pigeo
Copy link

Pigeo commented Jul 20, 2017

I tried to merge the keyboard and mouse examples into one single example that would allow me to plug-in either a keyboard OR a mouse, without having to recompile each time I want to change between mouse and keyboard.

I tried the following, without success :

// Initialize USB Controller
USBHost usb;
// Attach mouse controller to USB
MouseController mouse(usb);
// Attach keyboard controller to USB
KeyboardController keyboard(usb);

=> It seems this library doesn't support having two controllers on the same USBHost instance. Could you confirm that ?

Then I tried the following, which also didn't work :

// Initialize USB Controller
USBHost usb1;
USBHost usb2;
// Attach mouse controller to USB
MouseController mouse(usb2);
// Attach keyboard controller to USB
KeyboardController keyboard(usb1);

=> Could you tell me which one of these two approaches should be the good one ? And then I suggest to add in the source code some assertions to avoid users making forbidden things (putting two controllers on the same USBHost instance and/or creating two USBHost instances at same time, etc.)

The idea behind that request, is I want to be able to use a mouse connected to my DUE, and sometimes, but rarely, I want to be able to disconnect the mouse, put a keyboard instead, type some phrase on it, and then remove it and plug-in the mouse again.
Thanks

@Lucius0806

This comment was marked as off-topic.

@per1234 per1234 added type: enhancement Proposed improvement topic: documentation Related to documentation for the project labels Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: documentation Related to documentation for the project type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

3 participants