Merge pull request #79 from NicoHood/dev

Release 2.4.4
This commit is contained in:
Nico 2017-01-27 12:26:34 +01:00 committed by GitHub
commit a5e20e94d2
15 changed files with 80 additions and 68 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "HID.wiki"]
path = HID.wiki
url = https://github.com/NicoHood/HID.wiki.git

1
HID.wiki Submodule

@ -0,0 +1 @@
Subproject commit a1a0b086985dec037d7e7d86c6b2d5816207f202

View file

@ -1,4 +1,4 @@
Arduino HID Project 2.4.3
Arduino HID Project 2.4.4
=========================
![Header Picture](header.jpg)
@ -41,14 +41,16 @@ An offline snapshot is available in [releases](https://github.com/NicoHood/HID/r
Contact
=======
You can contact me on my wordpress blog in the contact section.
www.nicohood.de
Version History
===============
```
2.4.4 Release (27.01.2017)
* Added releaseAll() to Mouse API
* Fix flexible array errors
2.4.3 Release (02.03.2016)
* Fixed NKRO Keyboard modifier add() #76

View file

@ -1,5 +1,5 @@
name=HID-Project
version=2.4.3
version=2.4.4
author=NicoHood
maintainer=NicoHood <blog@NicoHood.de>
sentence=Extended HID Functions for Arduino

View file

@ -39,9 +39,9 @@ THE SOFTWARE.
typedef union{
// Absolute mouse report: 8 buttons, 2 absolute axis, wheel
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
uint8_t whole8[0];
uint16_t whole16[0];
uint32_t whole32[0];
struct{
uint8_t buttons;
int16_t xAxis;
@ -71,6 +71,7 @@ public:
inline void move(int x, int y, signed char wheel = 0);
inline void press(uint8_t b = MOUSE_LEFT);
inline void release(uint8_t b = MOUSE_LEFT);
inline void releaseAll(void);
inline bool isPressed(uint8_t b = MOUSE_LEFT);
// Sending is public in the base class for advanced users.
@ -79,4 +80,3 @@ public:
// Implementation is inline
#include "AbsoluteMouseAPI.hpp"

View file

@ -98,6 +98,11 @@ void AbsoluteMouseAPI::release(uint8_t b){
buttons(_buttons & ~b);
}
void AbsoluteMouseAPI::releaseAll(void){
_buttons = 0;
moveTo(xAxis, yAxis, 0);
}
bool AbsoluteMouseAPI::isPressed(uint8_t b){
// check LEFT by default
if ((b & _buttons) > 0)

View file

@ -450,9 +450,9 @@ enum ConsumerKeycode : uint16_t {
typedef union {
// Every usable Consumer key possible, up to 4 keys presses possible
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
uint8_t whole8[0];
uint16_t whole16[0];
uint32_t whole32[0];
ConsumerKeycode keys[4];
struct {
ConsumerKeycode key1;
@ -482,4 +482,3 @@ protected:
// Implementation is inline
#include "ConsumerAPI.hpp"

View file

@ -29,9 +29,9 @@ THE SOFTWARE.
typedef union{
// Low level key report: up to 6 keys and shift, ctrl etc at once
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
uint8_t whole8[0];
uint16_t whole16[0];
uint32_t whole32[0];
struct{
uint8_t modifiers;
uint8_t reserved;
@ -74,4 +74,3 @@ private:
// Implementation is inline
#include "DefaultKeyboardAPI.hpp"

View file

@ -41,9 +41,9 @@ THE SOFTWARE.
typedef union {
// 32 Buttons, 6 Axis, 2 D-Pads
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
uint8_t whole8[0];
uint16_t whole16[0];
uint32_t whole32[0];
uint32_t buttons;
struct{
@ -127,4 +127,3 @@ protected:
// Implementation is inline
#include "GamepadAPI.hpp"

View file

@ -39,9 +39,9 @@ THE SOFTWARE.
typedef union{
// Mouse report: 8 buttons, position, wheel
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
uint8_t whole8[0];
uint16_t whole16[0];
uint32_t whole32[0];
struct{
uint8_t buttons;
int8_t xAxis;
@ -53,9 +53,9 @@ typedef union{
typedef union{
// BootMouse report: 3 buttons, position
// Wheel is not supported by boot protocol
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
uint8_t whole8[0];
uint16_t whole16[0];
uint32_t whole32[0];
struct{
uint8_t buttons;
int8_t xAxis;
@ -73,6 +73,7 @@ public:
inline void move(signed char x, signed char y, signed char wheel = 0);
inline void press(uint8_t b = MOUSE_LEFT); // press LEFT by default
inline void release(uint8_t b = MOUSE_LEFT); // release LEFT by default
inline void releaseAll(void);
inline bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default
// Sending is public in the base class for advanced users.

View file

@ -77,10 +77,15 @@ void MouseAPI::release(uint8_t b)
buttons(_buttons & ~b);
}
void MouseAPI::releaseAll(void)
{
_buttons = 0;
move(0,0,0);
}
bool MouseAPI::isPressed(uint8_t b)
{
if ((b & _buttons) > 0)
return true;
return false;
}

View file

@ -32,9 +32,9 @@ THE SOFTWARE.
typedef union{
// Modifier + keymap + 1 custom key
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
uint8_t whole8[0];
uint16_t whole16[0];
uint32_t whole32[0];
struct{
uint8_t modifiers;
uint8_t keys[NKRO_KEY_COUNT / 8];
@ -62,4 +62,3 @@ private:
// Implementation is inline
#include "NKROKeyboardAPI.hpp"

View file

@ -76,7 +76,7 @@ enum SystemKeycode : uint8_t {
typedef union{
// Every usable system control key possible
uint8_t whole8[];
uint8_t whole8[0];
uint8_t key;
} HID_SystemControlReport_Data_t;

View file

@ -25,7 +25,7 @@ THE SOFTWARE.
#pragma once
// Software version
#define HID_PROJECT_VERSION 243
#define HID_PROJECT_VERSION 244
#if ARDUINO < 10607
#error HID Project requires Arduino IDE 1.6.7 or greater. Please update your IDE.

View file

@ -54,17 +54,17 @@ THE SOFTWARE.
typedef union{
// a RAWHID_TX_SIZE byte buffer for tx
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
uint8_t whole8[0];
uint16_t whole16[0];
uint32_t whole32[0];
uint8_t buff[RAWHID_TX_SIZE];
} HID_RawKeyboardTXReport_Data_t;
typedef union{
// a RAWHID_TX_SIZE byte buffer for rx
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
uint8_t whole8[0];
uint16_t whole16[0];
uint32_t whole32[0];
uint8_t buff[RAWHID_RX_SIZE];
} HID_RawKeyboardRXReport_Data_t;
@ -177,4 +177,3 @@ protected:
int featureLength;
};
extern RawHID_ RawHID;