diff --git a/Readme.md b/Readme.md index 1ca38f8..005e36d 100644 --- a/Readme.md +++ b/Readme.md @@ -59,7 +59,7 @@ How to use ### Micro/Leonardo + HoodLoader2 **1. Select the new board via *Tools->Board->Arduino Leonardo HID-Project* for example.** -For HoodLoader2 select the HoodLoader 16u2 MCU. Ensure HoodLoader2 Software is up to date. +For HoodLoader2 select the 16u2 MCU. Ensure HoodLoader2 board definition files are up to date. ![Board Selection Picture](board.png) @@ -73,17 +73,10 @@ For HoodLoader2 select the HoodLoader 16u2 MCU. Ensure HoodLoader2 Software is u ![USB-Core Selection Picture](usb-core.png) -To create a custom HID report descriptor you can edit the file in *avr/variants/leonardo_custom/pins_arduino.h*. +To create a **custom HID report descriptor** you can edit the file in *avr/variants/leonardo_custom/pins_arduino.h*. Same for Micro and HoodLoader2. Not all HID reports are playing well together on all OS so I made these pre selections. With the custom report you can try it out yourself. Everything you need should be in the pins_arduino.h file. -**You can compile all HID APIs but this doesn't mean that you can use them if no hid descriptor is set correctly.** -Edit the *sketchbook/hardware/HID/avr/variants/hid_descriptors/hid_descriptors.h* to use the extended HID core. -At the moment you have 3 options: Default, Gamepad or Extended. Extended should work for anything expect Gamepads. -See the bug section below to find out more about working hid reports. Not all of them are playing well together. -Use the void HID_SendReport(uint8_t id, const void* data, int len); function to send hid reports with your custom HID-APIs. - - **3. Try the Basic HID examples for each HID device. They are pretty much self explaining. You can also see the *Projects/HID_Test* for an all in one example.** @@ -168,6 +161,7 @@ Generalize HID key definitions via HIDTables for example? update Burning via ISP (advanced) Test with Android phone (HL1) "Emulate" HL1 protocol +test no usb function with leonardo (usb workaround?) ``` @@ -176,7 +170,6 @@ Known Bugs * See Hoodloader1+2 repositories for HoodLoader1+2 related Bugs/Issues. * Mouse Abs only works with system report under special circumstances. * Gamepad + Mouse Abs doesnt work together -* Fix HID_SendReport() prototype workaround in HID-APIs * Core selection in boards.txt is not working * Do not name the Arduino Sketch 'Mouse.ino' or 'Keyboard.ino' etc. Your Arduino IDE will output errors then if you double click the file and try to compile. diff --git a/avr/cores/hid/USB-Core/Consumer.h b/avr/cores/hid/USB-Core/Consumer.h index 22617ab..1cc9dae 100644 --- a/avr/cores/hid/USB-Core/Consumer.h +++ b/avr/cores/hid/USB-Core/Consumer.h @@ -27,9 +27,6 @@ THE SOFTWARE. // to access the HID_SendReport via USBAPI.h and report number #include "Arduino.h" -//TODO workaround to access the weak sending function -void HID_SendReport(uint8_t id, const void* data, int len); - //================================================================================ // Consumer //================================================================================ diff --git a/avr/cores/hid/USB-Core/Gamepad.h b/avr/cores/hid/USB-Core/Gamepad.h index 03f9c08..3bd4b5d 100644 --- a/avr/cores/hid/USB-Core/Gamepad.h +++ b/avr/cores/hid/USB-Core/Gamepad.h @@ -27,9 +27,6 @@ THE SOFTWARE. // to access the HID_SendReport via USBAPI.h and report number #include "Arduino.h" -//TODO workaround to access the weak sending function -void HID_SendReport(uint8_t id, const void* data, int len); - //================================================================================ // Gamepad //================================================================================ diff --git a/avr/cores/hid/USB-Core/HID.h b/avr/cores/hid/USB-Core/HID.h index 2606e5a..79a3fbe 100644 --- a/avr/cores/hid/USB-Core/HID.h +++ b/avr/cores/hid/USB-Core/HID.h @@ -80,49 +80,6 @@ extern uint8_t hid_keyboard_leds; #define HID_REPORTID_MOUSE_ABSOLUTE 7 #endif -// only include HIDAPIs if we have an USB AVR MCU. -// only enable specific APIs to throw an error if the hid report wasn't set -// The user can overwrite HID_SendReport() and manually include the APIs for a non USB AVR -// the include has to be done after the report IDs! - -#ifdef HID_ENABLE_ALL_APIS -// include all HID APIs -#define HID_MOUSE_API_ENABLE -#define HID_KEYBOARD_API_ENABLE -#define HID_CONSUMER_API_ENABLE -#define HID_SYSTEM_API_ENABLE -#define HID_GAMEPAD_API_ENABLE - -#elif !defined(EXTERN_HID_REPORT) -// by default enable mouse + keyboard api -#define HID_MOUSE_API_ENABLE -#define HID_KEYBOARD_API_ENABLE -#endif - -#ifdef USBCON - -#ifdef HID_MOUSE_API_ENABLE -#include "Mouse.h" -#endif - -#ifdef HID_KEYBOARD_API_ENABLE -#include "Keyboard.h" -#endif - -#ifdef HID_CONSUMER_API_ENABLE -#include "Consumer.h" -#endif - -#ifdef HID_SYSTEM_API_ENABLE -#include "System.h" -#endif - -#ifdef HID_GAMEPAD_API_ENABLE -#include "Gamepad.h" -#endif - -#endif - // HID reports // Report IDs and the report itself can be overwritten by the pins_arduino.h @@ -408,4 +365,48 @@ void HID_SendReport(uint8_t id, const void* data, int len); #endif /* if defined(USBCON) */ + +// only include HIDAPIs if we have an USB AVR MCU. +// only enable specific APIs to throw an error if the hid report wasn't set +// The user can overwrite HID_SendReport() and manually include the APIs for a non USB AVR +// the include has to be done at the end so that the HID-APIs see the report ids and the send prototype. + +#ifdef HID_ENABLE_ALL_APIS +// include all HID APIs +#define HID_MOUSE_API_ENABLE +#define HID_KEYBOARD_API_ENABLE +#define HID_CONSUMER_API_ENABLE +#define HID_SYSTEM_API_ENABLE +#define HID_GAMEPAD_API_ENABLE + +#elif !defined(EXTERN_HID_REPORT) +// by default enable mouse + keyboard api +#define HID_MOUSE_API_ENABLE +#define HID_KEYBOARD_API_ENABLE +#endif + +#ifdef USBCON + +#ifdef HID_MOUSE_API_ENABLE +#include "Mouse.h" +#endif + +#ifdef HID_KEYBOARD_API_ENABLE +#include "Keyboard.h" +#endif + +#ifdef HID_CONSUMER_API_ENABLE +#include "Consumer.h" +#endif + +#ifdef HID_SYSTEM_API_ENABLE +#include "System.h" +#endif + +#ifdef HID_GAMEPAD_API_ENABLE +#include "Gamepad.h" +#endif + +#endif + #endif \ No newline at end of file diff --git a/avr/cores/hid/USB-Core/Keyboard.h b/avr/cores/hid/USB-Core/Keyboard.h index 11ab19f..5f405a5 100644 --- a/avr/cores/hid/USB-Core/Keyboard.h +++ b/avr/cores/hid/USB-Core/Keyboard.h @@ -46,9 +46,6 @@ THE SOFTWARE. // to access the HID_SendReport via USBAPI.h, report number and the Print class #include "Arduino.h" -//TODO workaround to access the weak sending function -void HID_SendReport(uint8_t id, const void* data, int len); - //================================================================================ //================================================================================ // Keyboard diff --git a/avr/cores/hid/USB-Core/Mouse.h b/avr/cores/hid/USB-Core/Mouse.h index 8fabdca..05e48c9 100644 --- a/avr/cores/hid/USB-Core/Mouse.h +++ b/avr/cores/hid/USB-Core/Mouse.h @@ -46,9 +46,6 @@ THE SOFTWARE. // to access the HID_SendReport via USBAPI.h and report number #include "Arduino.h" -//TODO workaround to access the weak sending function -void HID_SendReport(uint8_t id, const void* data, int len); - //================================================================================ //================================================================================ // Mouse diff --git a/avr/cores/hid/USB-Core/System.h b/avr/cores/hid/USB-Core/System.h index fd1b7dd..b47f148 100644 --- a/avr/cores/hid/USB-Core/System.h +++ b/avr/cores/hid/USB-Core/System.h @@ -27,9 +27,6 @@ THE SOFTWARE. // to access the HID_SendReport via USBAPI.h and report number #include "Arduino.h" -//TODO workaround to access the weak sending function -void HID_SendReport(uint8_t id, const void* data, int len); - //================================================================================ // System //================================================================================