-
Notifications
You must be signed in to change notification settings - Fork 223
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
USB support for Leonardo #572
base: main
Are you sure you want to change the base?
Conversation
I won't have access to my leonardo for a few weeks and haven't been able to test these changes which is why I marked as draft. If someone can confirm they work which I don't see why they wouldn't then I'll open for review. |
I can confirm that this seems to be working as expected. I built avr-hal against his PR and used his keyboard example on an ItsyBitsy 32u4, pretending it's a Leonardo. After flashing with ravedude, a new USB HID keyboard device showed up. setting
|
I have take the code which was written by @agausmann here and turned it into this PR with a number of modifications so that it is hopefully useful to programmers working at every level of this repository.
At the generic level I have added a new macro (v2) to make a
AvrGenericUsbBus
struct which implements UsbDevicesUsbBus
trait. Then at the mcu hal I have called this macro and then also provided it with aSuspendNotifier
struct and implemented a new traitClearInterrupts
for necessary interrupt registers. I also define mcu specific constants here as well. At the arduino hal level I import all the important parts from the mcu hal level and then also supply two convenience macros for creating parts of the USB setup. Finally I have added the code for a new example which uses all of this code and follows the demo keyboard as set out in the original atmega-usbd.This addresses #40.
I have also included some code for the atmega8u2 in anticipation of #568.