Fixed HID_SendReport() prototype workaround
This commit is contained in:
parent
e5d28296d2
commit
b90fb505f0
7 changed files with 47 additions and 68 deletions
13
Readme.md
13
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.
|
||||
|
||||

|
||||
|
||||
|
|
@ -73,17 +73,10 @@ For HoodLoader2 select the HoodLoader 16u2 MCU. Ensure HoodLoader2 Software is u
|
|||
|
||||

|
||||
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
//================================================================================
|
||||
|
|
|
|||
|
|
@ -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
|
||||
//================================================================================
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
//================================================================================
|
||||
|
|
|
|||
Loading…
Reference in a new issue