Palatis / Arduino-Lufa

LUFA (Lightweight USB For AVRs) on the Arduino!
MIT License
100 stars 26 forks source link

Add LUFA boards to Tools>Board menu #21

Closed CrazyRedMachine closed 3 years ago

CrazyRedMachine commented 3 years ago

I've been using LUFA a lot in various arduino projects, but am still using non-LUFA code as well, and switching was a bit tedious sometimes so I made it so that enabling/disabling LUFA is as easy as selecting the correct board type in the arduino IDE.

I've tested it on windows as well as ubuntu (I've also checked that activate/deactivate still work as intended).

image

CrazyRedMachine commented 3 years ago

Thanks! I'm very glad you like this PR :) Yes I did try my best to integrate the changes seamlessly into the current codebase. I've done most of the requested changes but still have a question about one of them so I'm answering above.

Indeed having LUFA ship directly into the arduino board manager would be awesome, we'll have to see how to do that :)

iFreilicht commented 3 years ago

Alright, looks good to me!

I think we can pretty much remove most boards except for those that use an Atmega32u4 or other MCU with its own USB-interface. See https://en.wikipedia.org/wiki/List_of_Arduino_boards_and_compatible_systems

I had a look in the boards.txt, and it seems the only boards compatible are:

The simplest is probably to search for .build.mcu=atmega32u4 in the boards block, and remove the board if it doesn't contain that.

CrazyRedMachine commented 3 years ago

ok I followed your suggestion and am now commenting out all boards which don't hve atmega32u4. Changed the readme to reflect this as well.

btw in the mean time I also researched info on how to add these directly to the board manager so that we don't even have to use a python script at all.

with external boards URL

We need to create a "release" from the repo so that there's a zipfile with the boards files prepackaged, and create a json with some headers to point to that github hosted zip.

Then we can instruct the user to add the URL to the json in the "additional custom boards URL" list, and from there they should be able to see LUFA boards in the manager and install from there.

directly in the main boards

Then we can create a PR on the arduino repo to add these boards to the existing manager, but for it I think we should also have the library added as a lib in the library manager. Which will require to add a couple new definition files, but also requires us not to use submodules, so we'd have to break the link to the LUFA repo and put their files directly on this repo.

I think having a "install lufa from library manager, then install lufa boards from board manager" would be awesome.

iFreilicht commented 3 years ago

@Palatis, this can be merged now! Code quality is great and everything works as expected!

@CrazyRedMachine Thank you once more for this contribution, awesome stuff! I think there's some potential in looking at the board+library manager further, would you like to open a new issue for that? I'll gladly help with research and testing.