Minor fixes

This commit is contained in:
NicoHood 2015-09-19 12:45:43 +02:00
parent f34df6edef
commit 36fdbb4987
6 changed files with 30 additions and 12 deletions

View file

@ -15,7 +15,8 @@ The idea is to enable enhanced USB functions to almost all 'standard' Arduino bo
* Any other 8u2/16u/at90usb162/32u2/32u4 compatible board
**Supported HID devices:**
* Keyboard ~~with Leds out (modifiers + 6 keys pressed at the same time)~~
* Keyboard with Leds out (modifiers + 6 keys pressed at the same time)
* NKRO Keyboard with Leds out (press up to 113 keys at the same time)
* Mouse (5 buttons, move, wheel)
* Absolute Mouse
* Consumer/Media Keys (4 keys for music player, web browser and more)
@ -78,8 +79,15 @@ Version History
```
2.4 Release (xx.xx.2015)
* Added Arduino IDE 1.6.6 compatibility with Pluggable HID
* Improved Pluggable HID (have its own modifed copy now)
* Changed USB-Core into a simple library, only possible with Pluggable HID
* Removed HID presets (like mouse + keyboard + consumer + system)
* Removed HID presets in boards menu (like mouse + keyboard + consumer + system)
* Added Teensy Keyboard
* Added NKRO Keyboard
* Added Led report for Keyboard
* Added HID out report in general (RAW HID preparation)
* Added a few key definitions
* Uses .alinkage custom IDE option
2.3 Release (never released)
* Updated Libraries

View file

@ -33,6 +33,8 @@ THE SOFTWARE.
#error "This is not an USB AVR or you use an old version of the IDE."
#endif
#define HID_KEYBOARD_LEDS_ENABLED
//#define LAYOUT_US_ENGLISH
//#define LAYOUT_CANADIAN_FRENCH
//#define LAYOUT_CANADIAN_MULTILINGUAL
@ -104,8 +106,6 @@ THE SOFTWARE.
#include "HID.h"
extern HID_ HID;
#include "HID-Tables.h"
// Include all HID libraries (.a linkage required to work) properly

View file

@ -51,6 +51,8 @@ static const u8 _hidReportDescriptor[] PROGMEM = {
0x75, 0x08, /* REPORT_SIZE (8) */
0x81, 0x03, /* INPUT (Cnst,Var,Abs) */
#if defined(HID_KEYBOARD_LEDS_ENABLED)
//TODO remove reserved bytes to add 3 more custom data bits for advanced users?
/* 5 LEDs for num lock etc */
0x05, 0x08, /* USAGE_PAGE (LEDs) */
0x19, 0x01, /* USAGE_MINIMUM (Num Lock) */
@ -62,6 +64,7 @@ static const u8 _hidReportDescriptor[] PROGMEM = {
0x95, 0x01, /* REPORT_COUNT (1) */
0x75, 0x03, /* REPORT_SIZE (3) */
0x91, 0x03, /* OUTPUT (Cnst,Var,Abs) */
#endif
/* 6 Keyboard keys */
0x95, 0x06, /* REPORT_COUNT (6) */
@ -78,8 +81,10 @@ static const u8 _hidReportDescriptor[] PROGMEM = {
};
Keyboard_::Keyboard_(void) :
HIDDevice((uint8_t*)_hidReportDescriptor, sizeof(_hidReportDescriptor), HID_REPORTID_KEYBOARD),
leds(0)
HIDDevice((uint8_t*)_hidReportDescriptor, sizeof(_hidReportDescriptor), HID_REPORTID_KEYBOARD)
#if defined(HID_KEYBOARD_LEDS_ENABLED)
,leds(0)
#endif
{
// HID Descriptor is appended via the inherited HIDDevice class
}
@ -99,6 +104,7 @@ void Keyboard_::sendReport(HID_KeyboardReport_Data_t* keys)
SendReport(keys,sizeof(HID_KeyboardReport_Data_t));
}
#if defined(HID_KEYBOARD_LEDS_ENABLED)
void Keyboard_::setReportData(const void* data, int len){
// Save led state
if(len == 1)
@ -108,6 +114,7 @@ void Keyboard_::setReportData(const void* data, int len){
uint8_t Keyboard_::getLeds(void){
return leds;
}
#endif
// press() adds the specified key (printing, non-printing, or modifier)

View file

@ -57,8 +57,10 @@ class Keyboard_ : public Print, public HIDDevice
private:
HID_KeyboardReport_Data_t _keyReport;
void sendReport(HID_KeyboardReport_Data_t* keys);
#if defined(HID_KEYBOARD_LEDS_ENABLED)
virtual void setReportData(const void* data, int len);
uint8_t leds;
#endif
public:
Keyboard_(void);
void begin(void);
@ -74,7 +76,9 @@ public:
size_t addKeycodeToReport(uint8_t k);
size_t removeKeycodeFromReport(uint8_t k);
#if defined(HID_KEYBOARD_LEDS_ENABLED)
uint8_t getLeds(void);
#endif
};
extern Keyboard_ Keyboard;

View file

@ -23,7 +23,6 @@
#define HID_h
#include <stdint.h>
#include <Arduino.h>
#if defined(USBCON)

View file

@ -50,8 +50,8 @@ public:
virtual void setReportData(const void* data, int len);
protected:
// TODO make this public for custom, professional usage?
// Public for custom, professional usage, like raw Keyboard
//protected:
void SendReport(const void* data, int len);
};