diff --git a/Readme.md b/Readme.md index 465ba74..1ca38f8 100644 --- a/Readme.md +++ b/Readme.md @@ -37,6 +37,7 @@ Installation ============ For Arduino Uno/Mega first install [HoodLoader2](https://github.com/NicoHood/HoodLoader2) on your 16u2 + the needed software files. +Make sure your HoodLoader2 software is up to date when you also update the HID-Project files. [HoodLoader1](https://github.com/NicoHood/HoodLoader) is only supported for legacy but will get a new use soon! For Arduino Micro/Leonardo ignore this step. @@ -57,30 +58,33 @@ 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. + +![Board Selection Picture](board.png) + +**2. Select the USB-Core you want to use. You have 5 options here:** + +* Extended (Keyboard+Leds, Mouse+Absolute, Consumer, System) +* Gamepad (Keyboard+Leds, Mouse, Gamepad) +* Custom (Your custom configuration, see below) +* Default Core (Standard Arduino Core) +* No USB Core (No USB functions available, saves ram + flash) + +![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*. +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. -Have a closer look at these lines: -``` cpp -// use this to enable the Keyboard Led functions -#define HID_KEYBOARD_LEDS_ENABLED -// add your custom HID Report Descriptor here. -// you can use the pre defined reports as well -//#define EXTERN_HID_REPORT DEFAULT_HID_REPORT -#define EXTERN_HID_REPORT EXTENDED_HID_REPORT -//#define EXTERN_HID_REPORT GAMEPAD_HID_REPORT -``` - -You can also add your own descriptor with your own APIs. -Use the void HID_SendReport(uint8_t id, const void* data, int len); function to send hid reports. - -**Select your Arduino board under *Tools->Board->Arduino Leonardo/Micro Custom HID* to use the new HID-Core. -If you select the normal Leonardo/Micro entry you will automatically use the standard Arduino Core.** - -**Try the Basic HID examples for each HID device. They are pretty much self explaining. +**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.** See *Project/USB-Serial* for a fully usable USB-Serial bridge and how to use the new Serial functions. @@ -215,6 +219,7 @@ Version History * Separated USB-Core in its own folder * Added HID Tables * USB-Serial now fully reprogrammable +* Easy USB-Core selection via Tools->USB-Core 2.0 Release (29.11.2014) * Added HoodLoader2 @@ -345,11 +350,10 @@ Include schematic - Arduino.h - USBAPI.h -> Arduino.h, USBDESC.h, USBCore.h - CDC.h -> Arduino.h, USBDESC.h, USBCore.h - - HID.h -> Arduino.h, USBDESC.h, USBCore.h, HID-API - - HID-API -> Keyboard.h, Mouse.h - - Keyboard.h -> Arduino.h - - Mouse.h -> Arduino.h - - [Other APIs].h -> Arduino.h + - HID.h -> Arduino.h, USBDESC.h, USBCore.h, HID-APIs(Keyboard.h, Mouse.h, etc) + - Keyboard.h -> Arduino.h + - Mouse.h -> Arduino.h + - [Other APIs].h -> Arduino.h - HIDTables.h HID.h contains all HID configuration. diff --git a/avr/boards.txt b/avr/boards.txt index ff9f9f9..d03c595 100644 --- a/avr/boards.txt +++ b/avr/boards.txt @@ -1,65 +1,103 @@ -############################################################## +#HID Project board definition file -leonardo_extended.name=Arduino Leonardo Custom HID -leonardo_extended.vid.0=0x2341 -leonardo_extended.pid.0=0x0036 -leonardo_extended.vid.1=0x2341 -leonardo_extended.pid.1=0x8036 -leonardo_extended.upload.tool=arduino:avrdude -leonardo_extended.upload.protocol=avr109 -leonardo_extended.upload.maximum_size=28672 -leonardo_extended.upload.maximum_data_size=2560 -leonardo_extended.upload.speed=57600 -leonardo_extended.upload.disable_flushing=true -leonardo_extended.upload.use_1200bps_touch=true -leonardo_extended.upload.wait_for_upload_port=true - -leonardo_extended.bootloader.tool=arduino:avrdude -leonardo_extended.bootloader.low_fuses=0xff -leonardo_extended.bootloader.high_fuses=0xd8 -leonardo_extended.bootloader.extended_fuses=0xcb -leonardo_extended.bootloader.file=arduino:caterina/Caterina-leonardo_extended.hex -leonardo_extended.bootloader.unlock_bits=0x3F -leonardo_extended.bootloader.lock_bits=0x2F - -leonardo_extended.build.mcu=atmega32u4 -leonardo_extended.build.f_cpu=16000000L -leonardo_extended.build.vid=0x2341 -leonardo_extended.build.pid=0x8036 -leonardo_extended.build.usb_product="Arduino Leonardo" -leonardo_extended.build.board=AVR_LEONARDO -leonardo_extended.build.core=arduino:hid -leonardo_extended.build.variant=leonardo_hid -leonardo_extended.build.extra_flags={build.usb_flags} +menu.usbcore=USB Core ############################################################## -micro.name=Arduino Micro Custom HID -micro.upload.tool=arduino:avrdude -micro.upload.protocol=avr109 -micro.upload.maximum_size=28672 -micro.upload.maximum_data_size=2560 -micro.upload.speed=57600 -micro.upload.disable_flushing=true -micro.upload.use_1200bps_touch=true -micro.upload.wait_for_upload_port=true +leonardoExtended.name=Arduino Leonardo HID-Project +leonardoExtended.vid.0=0x2341 +leonardoExtended.pid.0=0x0036 +leonardoExtended.vid.1=0x2341 +leonardoExtended.pid.1=0x8036 +leonardoExtended.upload.tool=arduino:avrdude +leonardoExtended.upload.protocol=avr109 +leonardoExtended.upload.maximum_size=28672 +leonardoExtended.upload.maximum_data_size=2560 +leonardoExtended.upload.speed=57600 +leonardoExtended.upload.disable_flushing=true +leonardoExtended.upload.use_1200bps_touch=true +leonardoExtended.upload.wait_for_upload_port=true -micro.bootloader.tool=arduino:avrdude -micro.bootloader.low_fuses=0xff -micro.bootloader.high_fuses=0xd8 -micro.bootloader.extended_fuses=0xcb -micro.bootloader.file=arduino:caterina/Caterina-Micro.hex -micro.bootloader.unlock_bits=0x3F -micro.bootloader.lock_bits=0x2F +leonardoExtended.bootloader.tool=arduino:avrdude +leonardoExtended.bootloader.low_fuses=0xff +leonardoExtended.bootloader.high_fuses=0xd8 +leonardoExtended.bootloader.extended_fuses=0xcb +leonardoExtended.bootloader.file=arduino:caterina/Caterina-leonardo.hex +leonardoExtended.bootloader.unlock_bits=0x3F +leonardoExtended.bootloader.lock_bits=0x2F -micro.build.mcu=atmega32u4 -micro.build.f_cpu=16000000L -micro.build.vid=0x2341 -micro.build.pid=0x8037 -micro.build.usb_product="Arduino Micro" -micro.build.board=AVR_MICRO -micro.build.core=arduino:hid -micro.build.variant=micro_hid -micro.build.extra_flags={build.usb_flags} +leonardoExtended.build.mcu=atmega32u4 +leonardoExtended.build.f_cpu=16000000L +leonardoExtended.build.vid=0x2341 +leonardoExtended.build.pid=0x8036 +leonardoExtended.build.usb_product="Arduino Leonardo" +leonardoExtended.build.board=AVR_LEONARDO +leonardoExtended.build.extra_flags={build.usb_flags} + +#USB core selection +#HID Project needs to be installed https://github.com/NicoHood/HID +#TODO change to HID:hid +leonardoExtended.menu.usbcore.hid=Serial + Extended HID +leonardoExtended.menu.usbcore.hid.build.variant=leonardo_hid +leonardoExtended.menu.usbcore.hid.build.core=arduino:hid +leonardoExtended.menu.usbcore.gamepad=Serial + Gamepad HID +leonardoExtended.menu.usbcore.gamepad.build.variant=leonardo_gamepad +leonardoExtended.menu.usbcore.gamepad.build.core=arduino:hid +leonardoExtended.menu.usbcore.custom=Serial + Custom HID +leonardoExtended.menu.usbcore.custom.build.variant=leonardo_custom +leonardoExtended.menu.usbcore.custom.build.core=arduino:hid +leonardoExtended.menu.usbcore.USB_CORE=Default Core +leonardoExtended.menu.usbcore.USB_CORE.build.variant=arduino:leonardo +leonardoExtended.menu.usbcore.USB_CORE.build.core=arduino:arduino +leonardoExtended.menu.usbcore.NO_USB=No USB functions +leonardoExtended.menu.usbcore.NO_USB.build.variant=leonardo_no_usb +leonardoExtended.menu.usbcore.NO_USB.build.core=arduino:hid + +############################################################## + +microExtended.name=Arduino Micro HID-Project +microExtended.upload.tool=arduino:avrdude +microExtended.upload.protocol=avr109 +microExtended.upload.maximum_size=28672 +microExtended.upload.maximum_data_size=2560 +microExtended.upload.speed=57600 +microExtended.upload.disable_flushing=true +microExtended.upload.use_1200bps_touch=true +microExtended.upload.wait_for_upload_port=true + +microExtended.bootloader.tool=arduino:avrdude +microExtended.bootloader.low_fuses=0xff +microExtended.bootloader.high_fuses=0xd8 +microExtended.bootloader.extended_fuses=0xcb +microExtended.bootloader.file=arduino:caterina/Caterina-Micro.hex +microExtended.bootloader.unlock_bits=0x3F +microExtended.bootloader.lock_bits=0x2F + +microExtended.build.mcu=atmega32u4 +microExtended.build.f_cpu=16000000L +microExtended.build.vid=0x2341 +microExtended.build.pid=0x8037 +microExtended.build.usb_product="Arduino Micro" +microExtended.build.board=AVR_MICRO +microExtended.build.extra_flags={build.usb_flags} + +#USB core selection +#HID Project needs to be installed https://github.com/NicoHood/HID +#TODO change to HID:hid +microExtended.menu.usbcore.hid=Serial + Extended HID +microExtended.menu.usbcore.hid.build.variant=micro_hid +microExtended.menu.usbcore.hid.build.core=arduino:hid +microExtended.menu.usbcore.gamepad=Serial + Gamepad HID +microExtended.menu.usbcore.gamepad.build.variant=micro_gamepad +microExtended.menu.usbcore.gamepad.build.core=arduino:hid +microExtended.menu.usbcore.custom=Serial + Custom HID +microExtended.menu.usbcore.custom.build.variant=micro_custom +microExtended.menu.usbcore.custom.build.core=arduino:hid +microExtended.menu.usbcore.USB_CORE=Default Core +microExtended.menu.usbcore.USB_CORE.build.variant=arduino:micro +microExtended.menu.usbcore.USB_CORE.build.core=arduino:arduino +microExtended.menu.usbcore.NO_USB=No USB functions +microExtended.menu.usbcore.NO_USB.build.variant=micro_no_usb +microExtended.menu.usbcore.NO_USB.build.core=arduino:hid ############################################################## \ No newline at end of file diff --git a/avr/cores/hid/USB-Core/HID.h b/avr/cores/hid/USB-Core/HID.h index 238ac79..2606e5a 100644 --- a/avr/cores/hid/USB-Core/HID.h +++ b/avr/cores/hid/USB-Core/HID.h @@ -45,8 +45,8 @@ THE SOFTWARE. #include "Arduino.h" -// for the extern HID descriptors -#include "pins_Arduino.h" +// for the extern HID descriptors + settings +#include "pins_arduino.h" // extern accessible led out report #if defined(HID_KEYBOARD_LEDS_ENABLED) @@ -80,6 +80,49 @@ 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 @@ -347,9 +390,6 @@ HID_REPORT_MOUSE(HID_REPORTID_MOUSE) #include "USBDesc.h" #include "USBCore.h" -// only include HIDAPI if we have an USB AVR MCU. -// The use can overwrite HID_SendReport() and manually include the APIs. -#include "HIDAPI.h" //================================================================================ //================================================================================ diff --git a/avr/platform.txt b/avr/platform.txt index 8887bd7..c1dae04 100644 --- a/avr/platform.txt +++ b/avr/platform.txt @@ -7,5 +7,6 @@ # https://github.com/arduino/Arduino/wiki/Arduino-Hardware-Cores-migration-guide-from-1.0-to-1.6 # https://github.com/NicoHood -name=Arduino Custom HID-Core + +name=HID Project USB-Core version=2.1 diff --git a/avr/variants/hid_descriptors/hid_descriptors.h b/avr/variants/leonardo_custom/pins_arduino.h similarity index 64% rename from avr/variants/hid_descriptors/hid_descriptors.h rename to avr/variants/leonardo_custom/pins_arduino.h index 72809e5..5fed3ae 100644 --- a/avr/variants/hid_descriptors/hid_descriptors.h +++ b/avr/variants/leonardo_custom/pins_arduino.h @@ -21,38 +21,38 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define EXTENDED_HID_REPORT \ -HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), \ -HID_REPORT_MOUSE(HID_REPORTID_MOUSE), \ -HID_REPORT_MOUSE_ABSOLUTE(HID_REPORTID_MOUSE_ABSOLUTE), \ -HID_REPORT_CONSUMERCONTROL(HID_REPORTID_CONSUMERCONTROL), \ -HID_REPORT_SYSTEMCONTROL(HID_REPORTID_SYSTEMCONTROL) - -#define GAMEPAD_HID_REPORT \ -HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), \ -HID_REPORT_MOUSE(HID_REPORTID_MOUSE), \ -HID_REPORT_GAMEPAD(HID_REPORTID_GAMEPAD) +// include the standard leonardo board definition file +#include <../../variants/leonardo/pins_arduino.h> //================================================================================ -// Settings +// HID Settings //================================================================================ // use this to enable the Keyboard Led functions #define HID_KEYBOARD_LEDS_ENABLED -// add your custom HID Report Descriptor here. -// you can use the pre defined reports as well -//#define EXTERN_HID_REPORT DEFAULT_HID_REPORT -#define EXTERN_HID_REPORT EXTENDED_HID_REPORT -//#define EXTERN_HID_REPORT GAMEPAD_HID_REPORT +// add your custom report here: +#define EXTERN_HID_REPORT \ +HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), \ +HID_REPORT_MOUSE(HID_REPORTID_MOUSE) +// activate your custom HID-APIs here: +#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 -// Keep in mind that changing the ids or reports might confuse your OS -// Then you might need to reinstall all drivers or change the USB PID -// Mouse Abs only works with a System report and without Gamepad -// Gamepads can causes some recognition Problems with some OS -// RAW HID seems to not works properly in a multireport -// Currently available pre defined reports: +/* +You can use the pre defined reports as well. +Keep in mind that changing the ids or reports might confuse your OS. +Then you might need to reinstall all drivers or change the USB PID. +Mouse Abs only works with a System report together. +Gamepad and Mouse Abs dont work together. +Gamepads can causes some recognition problems with some OS. +RAW HID seems to not works properly in a multireport. +Currently available pre defined reports : +*/ //HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), //HID_REPORT_KEYBOARD_KEYS(HID_REPORTID_KEYBOARD), diff --git a/avr/variants/leonardo_gamepad/pins_arduino.h b/avr/variants/leonardo_gamepad/pins_arduino.h new file mode 100644 index 0000000..738c80e --- /dev/null +++ b/avr/variants/leonardo_gamepad/pins_arduino.h @@ -0,0 +1,45 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// include the standard leonardo board definition file +#include <../../variants/leonardo/pins_arduino.h> + +//================================================================================ +// HID Settings +//================================================================================ + +// use this to enable the Keyboard Led functions +#define HID_KEYBOARD_LEDS_ENABLED + +#define GAMEPAD_HID_REPORT \ +HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), \ +HID_REPORT_MOUSE(HID_REPORTID_MOUSE), \ +HID_REPORT_GAMEPAD(HID_REPORTID_GAMEPAD) + +// add your custom report here: +#define EXTERN_HID_REPORT GAMEPAD_HID_REPORT + +// activate your custom HID-APIs here: +#define HID_MOUSE_API_ENABLE +#define HID_KEYBOARD_API_ENABLE +#define HID_GAMEPAD_API_ENABLE \ No newline at end of file diff --git a/avr/variants/leonardo_hid/pins_arduino.h b/avr/variants/leonardo_hid/pins_arduino.h index adf6c2a..4d8fbc4 100644 --- a/avr/variants/leonardo_hid/pins_arduino.h +++ b/avr/variants/leonardo_hid/pins_arduino.h @@ -21,5 +21,28 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +// include the standard leonardo board definition file #include <../../variants/leonardo/pins_arduino.h> -#include "../hid_descriptors/hid_descriptors.h" \ No newline at end of file + +//================================================================================ +// HID Settings +//================================================================================ + +// use this to enable the Keyboard Led functions +#define HID_KEYBOARD_LEDS_ENABLED + +#define EXTENDED_HID_REPORT \ +HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), \ +HID_REPORT_MOUSE(HID_REPORTID_MOUSE), \ +HID_REPORT_MOUSE_ABSOLUTE(HID_REPORTID_MOUSE_ABSOLUTE), \ +HID_REPORT_CONSUMERCONTROL(HID_REPORTID_CONSUMERCONTROL), \ +HID_REPORT_SYSTEMCONTROL(HID_REPORTID_SYSTEMCONTROL) + +// add your custom report here: +#define EXTERN_HID_REPORT EXTENDED_HID_REPORT + +// activate your custom HID-APIs here: +#define HID_MOUSE_API_ENABLE +#define HID_KEYBOARD_API_ENABLE +#define HID_CONSUMER_API_ENABLE +#define HID_SYSTEM_API_ENABLE diff --git a/avr/variants/leonardo_no_usb/pins_arduino.h b/avr/variants/leonardo_no_usb/pins_arduino.h new file mode 100644 index 0000000..53dfb82 --- /dev/null +++ b/avr/variants/leonardo_no_usb/pins_arduino.h @@ -0,0 +1,28 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// include the standard leonardo board definition file +#include <../../variants/leonardo/pins_arduino.h> + +// deactivate usb functions +#undef USBCON diff --git a/avr/variants/micro_custom/pins_arduino.h b/avr/variants/micro_custom/pins_arduino.h new file mode 100644 index 0000000..4e7ff4c --- /dev/null +++ b/avr/variants/micro_custom/pins_arduino.h @@ -0,0 +1,64 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// include the standard micro board definition file +#include <../../variants/micro/pins_arduino.h> + +//================================================================================ +// HID Settings +//================================================================================ + +// use this to enable the Keyboard Led functions +#define HID_KEYBOARD_LEDS_ENABLED + +// add your custom report here: +#define EXTERN_HID_REPORT \ +HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), \ +HID_REPORT_MOUSE(HID_REPORTID_MOUSE) + +// activate your custom HID-APIs here: +#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 + +/* +You can use the pre defined reports as well. +Keep in mind that changing the ids or reports might confuse your OS. +Then you might need to reinstall all drivers or change the USB PID. +Mouse Abs only works with a System report together. +Gamepad and Mouse Abs dont work together. +Gamepads can causes some recognition problems with some OS. +RAW HID seems to not works properly in a multireport. +Currently available pre defined reports : +*/ + +//HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), +//HID_REPORT_KEYBOARD_KEYS(HID_REPORTID_KEYBOARD), +//HID_REPORT_MOUSE(HID_REPORTID_MOUSE), +//HID_REPORT_MOUSE_ABSOLUTE(HID_REPORTID_MOUSE_ABSOLUTE), +////HID_REPORT_RAWHID(HID_REPORTID_RAWHID), // not working at the moment +//HID_REPORT_CONSUMERCONTROL(HID_REPORTID_CONSUMERCONTROL), +//HID_REPORT_SYSTEMCONTROL(HID_REPORTID_SYSTEMCONTROL), +//HID_REPORT_GAMEPAD(HID_REPORTID_GAMEPAD), \ No newline at end of file diff --git a/avr/variants/micro_gamepad/pins_arduino.h b/avr/variants/micro_gamepad/pins_arduino.h new file mode 100644 index 0000000..54a65b7 --- /dev/null +++ b/avr/variants/micro_gamepad/pins_arduino.h @@ -0,0 +1,45 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// include the standard micro board definition file +#include <../../variants/micro/pins_arduino.h> + +//================================================================================ +// HID Settings +//================================================================================ + +// use this to enable the Keyboard Led functions +#define HID_KEYBOARD_LEDS_ENABLED + +#define GAMEPAD_HID_REPORT \ +HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), \ +HID_REPORT_MOUSE(HID_REPORTID_MOUSE), \ +HID_REPORT_GAMEPAD(HID_REPORTID_GAMEPAD) + +// add your custom report here: +#define EXTERN_HID_REPORT GAMEPAD_HID_REPORT + +// activate your custom HID-APIs here: +#define HID_MOUSE_API_ENABLE +#define HID_KEYBOARD_API_ENABLE +#define HID_GAMEPAD_API_ENABLE \ No newline at end of file diff --git a/avr/variants/micro_hid/pins_arduino.h b/avr/variants/micro_hid/pins_arduino.h index eecbe30..b687abd 100644 --- a/avr/variants/micro_hid/pins_arduino.h +++ b/avr/variants/micro_hid/pins_arduino.h @@ -21,5 +21,28 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +// include the standard micro board definition file #include <../../variants/micro/pins_arduino.h> -#include "../hid_descriptors/hid_descriptors.h" \ No newline at end of file + +//================================================================================ +// HID Settings +//================================================================================ + +// use this to enable the Keyboard Led functions +#define HID_KEYBOARD_LEDS_ENABLED + +#define EXTENDED_HID_REPORT \ +HID_REPORT_KEYBOARD_LEDS(HID_REPORTID_KEYBOARD), \ +HID_REPORT_MOUSE(HID_REPORTID_MOUSE), \ +HID_REPORT_MOUSE_ABSOLUTE(HID_REPORTID_MOUSE_ABSOLUTE), \ +HID_REPORT_CONSUMERCONTROL(HID_REPORTID_CONSUMERCONTROL), \ +HID_REPORT_SYSTEMCONTROL(HID_REPORTID_SYSTEMCONTROL) + +// add your custom report here: +#define EXTERN_HID_REPORT EXTENDED_HID_REPORT + +// activate your custom HID-APIs here: +#define HID_MOUSE_API_ENABLE +#define HID_KEYBOARD_API_ENABLE +#define HID_CONSUMER_API_ENABLE +#define HID_SYSTEM_API_ENABLE \ No newline at end of file diff --git a/avr/variants/micro_no_usb/pins_arduino.h b/avr/variants/micro_no_usb/pins_arduino.h new file mode 100644 index 0000000..43f444c --- /dev/null +++ b/avr/variants/micro_no_usb/pins_arduino.h @@ -0,0 +1,28 @@ +/* +Copyright (c) 2014 NicoHood +See the readme for credit to other people. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// include the standard micro board definition file +#include <../../variants/micro/pins_arduino.h> + +// deactivate usb functions +#undef USBCON diff --git a/board.png b/board.png new file mode 100644 index 0000000..7ceebc0 Binary files /dev/null and b/board.png differ diff --git a/usb-core.png b/usb-core.png new file mode 100644 index 0000000..6cf0c59 Binary files /dev/null and b/usb-core.png differ