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

Add enable/disable interrupt helper functions #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jamesmunns
Copy link
Member

As mentioned on matrix, I wanted to switch from regular polling to interrupt driving of the USB handler.

This interface is awkward, because Usbd returns a BusAllocator, which really gives no way (I can see?) to take access to the relevant USBD peripheral.

Additionally, we probably should only enable endpoint interrupts (endepin* and endepout*) that we are actually using (so enable them on allocation), but I would hope they wouldn't fire if the endpoint isn't being used?

Feel free to reject this if it's too "funky", but I ended up writing these for my own project, and they seem to work well.

@jonas-schievink
Copy link
Contributor

Sorry, only saw this today since I wasn't watching the repo. Not sure if you still need this, but some thoughts:

It looks like our Usbd type never actually returns itself. Maybe that should be changed and the caller should instead call UsbBusAllocator::new with the returned value? The way it is right now the API is fairly awkward.

bors bot added a commit that referenced this pull request Sep 27, 2022
12: Return `Self` from `Usbd::new` r=jonas-schievink a=jonas-schievink

This makes the `device_address` method usable, and allows adding more methods in the future (although they'll only work before the bus is initialized).

Also build/check the example by default.

cc #8

Co-authored-by: Jonas Schievink <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants