{"action":"created","issue":{"url":"https://api.github.com/repos/arduino/Arduino/issues/3304","labels_url":"https://api.github.com/repos/arduino/Arduino/issues/3304/labels{/name}","comments_url":"https://api.github.com/repos/arduino/Arduino/issues/3304/comments","events_url":"https://api.github.com/repos/arduino/Arduino/issues/3304/events","html_url":"https://github.com/arduino/Arduino/pull/3304","id":86241541,"number":3304,"title":"[RFC] Pluggable USB core for AVR","user":{"login":"facchinm","id":8843437,"avatar_url":"https://avatars.githubusercontent.com/u/8843437?v=3","gravatar_id":"","url":"https://api.github.com/users/facchinm","html_url":"https://github.com/facchinm","followers_url":"https://api.github.com/users/facchinm/followers","following_url":"https://api.github.com/users/facchinm/following{/other_user}","gists_url":"https://api.github.com/users/facchinm/gists{/gist_id}","starred_url":"https://api.github.com/users/facchinm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facchinm/subscriptions","organizations_url":"https://api.github.com/users/facchinm/orgs","repos_url":"https://api.github.com/users/facchinm/repos","events_url":"https://api.github.com/users/facchinm/events{/privacy}","received_events_url":"https://api.github.com/users/facchinm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/arduino/Arduino/labels/Component:%20USB%20Device","name":"Component: USB Device","color":"009800"},{"url":"https://api.github.com/repos/arduino/Arduino/labels/Type:%20Improvement","name":"Type: Improvement","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"facchinm","id":8843437,"avatar_url":"https://avatars.githubusercontent.com/u/8843437?v=3","gravatar_id":"","url":"https://api.github.com/users/facchinm","html_url":"https://github.com/facchinm","followers_url":"https://api.github.com/users/facchinm/followers","following_url":"https://api.github.com/users/facchinm/following{/other_user}","gists_url":"https://api.github.com/users/facchinm/gists{/gist_id}","starred_url":"https://api.github.com/users/facchinm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facchinm/subscriptions","organizations_url":"https://api.github.com/users/facchinm/orgs","repos_url":"https://api.github.com/users/facchinm/repos","events_url":"https://api.github.com/users/facchinm/events{/privacy}","received_events_url":"https://api.github.com/users/facchinm/received_events","type":"User","site_admin":false},"milestone":null,"comments":20,"created_at":"2015-06-08T16:19:18Z","updated_at":"2015-07-15T15:21:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/arduino/Arduino/pulls/3304","html_url":"https://github.com/arduino/Arduino/pull/3304","diff_url":"https://github.com/arduino/Arduino/pull/3304.diff","patch_url":"https://github.com/arduino/Arduino/pull/3304.patch"},"body":"This PR introduces the concept of Pluggable USB modules to help getting the best from our tiny ATmega32u4 without overhauling the core library with functions that could be useful for no more than 10% of the users.\r\n\r\nUsing this method we can _plug_ a library using the USB core by simply including its header in the sketch, and if not used it will not occupy additional resources.\r\n\r\nIt is of course a work in progress (thus tagged as RFC), still not ported to DUE core, and VERY probably bug-prone. Also, the memory footprint is not minimized.\r\n\r\n_Useful infos_\r\n* the CDC module is now non-removable (commit 43701fd)\r\n* the Pluggable USB module inherits most of the code from old HID and replaces its functions with hooks\r\n* max additional endpoints is arbitrarily set to 3\r\n* HID, Mouse, Keyboard and MouseAndKeyboard libraries are \"generated\" from `master` code (so all code from #1803 can be merged in a second time)\r\n* a MIDIUSB library based on PluggableUSB has been added (it is a very raw porting of #2943) only to demonstrate how to plug multiple modules\r\n* ~~`setupUSB() ` weak function has been added to `main.c` , so it will execute before `setup()` if `USBCON` is defined.~~\r\n\r\n_Known issues_\r\n* I'll add them here as soon as they get discovered (no doubt this list will grow soon :smile: )\r\n\r\n_How to try it_\r\nI decided not to change any provided example . If you wish to test the core, download the @ArduinoBot generated packages and modify the examples in this way:\r\n\r\nOn the top of the file:\r\n\r\n* Mouse only examples: add \r\n```C\r\n#include \"Mouse.h\"\r\n#include \"HID.h\"\r\n``` \r\n* Keyboard only examples: add \r\n```C\r\n#include \"Keyboard.h\"\r\n#include \"HID.h\"\r\n``` \r\n* Mouse and Keyboard examples: add \r\n```C\r\n#include \"MouseAndKeyboard.h\"\r\n#include \"HID.h\"\r\n``` \r\n* HID and MIDIUSB example: \r\n```arduino\r\n#include \"MIDIUSB.h\"\r\n#include \"HID.h\"\r\n#include \"Mouse.h\"\r\n```"},"comment":{"url":"https://api.github.com/repos/arduino/Arduino/issues/comments/121650426","html_url":"https://github.com/arduino/Arduino/pull/3304#issuecomment-121650426","issue_url":"https://api.github.com/repos/arduino/Arduino/issues/3304","id":121650426,"user":{"login":"ArduinoBot","id":4233897,"avatar_url":"https://avatars.githubusercontent.com/u/4233897?v=3","gravatar_id":"","url":"https://api.github.com/users/ArduinoBot","html_url":"https://github.com/ArduinoBot","followers_url":"https://api.github.com/users/ArduinoBot/followers","following_url":"https://api.github.com/users/ArduinoBot/following{/other_user}","gists_url":"https://api.github.com/users/ArduinoBot/gists{/gist_id}","starred_url":"https://api.github.com/users/ArduinoBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArduinoBot/subscriptions","organizations_url":"https://api.github.com/users/ArduinoBot/orgs","repos_url":"https://api.github.com/users/ArduinoBot/repos","events_url":"https://api.github.com/users/ArduinoBot/events{/privacy}","received_events_url":"https://api.github.com/users/ArduinoBot/received_events","type":"User","site_admin":false},"created_at":"2015-07-15T15:21:25Z","updated_at":"2015-07-15T15:21:25Z","body":"Build successful. Please test this code using one of the following:\nhttp://downloads.arduino.cc/javaide/pull_requests/arduino-PR-3304-BUILD-362-linux32.tar.xz\nhttp://downloads.arduino.cc/javaide/pull_requests/arduino-PR-3304-BUILD-362-linux64.tar.xz\nhttp://downloads.arduino.cc/javaide/pull_requests/arduino-PR-3304-BUILD-362-windows.zip\nhttp://downloads.arduino.cc/javaide/pull_requests/arduino-PR-3304-BUILD-362-macosx.zip"}}