Fixed Consumer/System-Control names
Also added Absolute Mouse Report
This commit is contained in:
parent
889623a83b
commit
bc952e0bc0
10 changed files with 45 additions and 34 deletions
|
|
@ -64,7 +64,7 @@ typedef union{
|
|||
uint16_t key3;
|
||||
uint16_t key4;
|
||||
};
|
||||
} HID_ConsumerReport_Data_t;
|
||||
} HID_ConsumerControlReport_Data_t;
|
||||
|
||||
class Consumer_{
|
||||
public:
|
||||
|
|
@ -85,7 +85,7 @@ public:
|
|||
}
|
||||
inline void press(uint16_t m){
|
||||
// search for a free spot
|
||||
for (int i = 0; i < sizeof(HID_ConsumerReport_Data_t) / 2; i++) {
|
||||
for (int i = 0; i < sizeof(HID_ConsumerControlReport_Data_t) / 2; i++) {
|
||||
if (_report.whole16[i] == 0x00) {
|
||||
_report.whole16[i] = m;
|
||||
break;
|
||||
|
|
@ -95,7 +95,7 @@ public:
|
|||
}
|
||||
inline void release(uint16_t m){
|
||||
// search and release the keypress
|
||||
for (int i = 0; i < sizeof(HID_ConsumerReport_Data_t) / 2; i++) {
|
||||
for (int i = 0; i < sizeof(HID_ConsumerControlReport_Data_t) / 2; i++) {
|
||||
if (_report.whole16[i] == m) {
|
||||
_report.whole16[i] = 0x00;
|
||||
// no break to delete multiple keys
|
||||
|
|
@ -107,7 +107,7 @@ public:
|
|||
begin();
|
||||
}
|
||||
private:
|
||||
HID_ConsumerReport_Data_t _report;
|
||||
HID_ConsumerControlReport_Data_t _report;
|
||||
};
|
||||
extern Consumer_ Consumer;
|
||||
|
||||
|
|
|
|||
|
|
@ -70,11 +70,11 @@ THE SOFTWARE.
|
|||
#ifdef HID_RAWHID_ENABLE
|
||||
#define HID_RAWHID_API_ENABLE
|
||||
#endif
|
||||
#ifdef HID_CONSUMER_ENABLE
|
||||
#define HID_CONSUMER_API_ENABLE
|
||||
#ifdef HID_CONSUMERCONTROL_ENABLE
|
||||
#define HID_CONSUMERCONTROL_API_ENABLE
|
||||
#endif
|
||||
#ifdef HID_SYSTEM_ENABLE
|
||||
#define HID_SYSTEM_API_ENABLE
|
||||
#ifdef HID_SYSTEMCONTROL_ENABLE
|
||||
#define HID_SYSTEMCONTROL_API_ENABLE
|
||||
#endif
|
||||
#ifdef HID_GAMEPAD_ENABLE
|
||||
#define HID_GAMEPAD_API_ENABLE
|
||||
|
|
@ -404,8 +404,8 @@ void HID_SendReport(uint8_t id, const void* data, int len);
|
|||
#define HID_MOUSE_API_ENABLE
|
||||
#define HID_KEYBOARD_API_ENABLE
|
||||
#define HID_RAWHID_API_ENABLE
|
||||
#define HID_CONSUMER_API_ENABLE
|
||||
#define HID_SYSTEM_API_ENABLE
|
||||
#define HID_CONSUMERCONTROL_API_ENABLE
|
||||
#define HID_SYSTEMCONTROL_API_ENABLE
|
||||
#define HID_GAMEPAD_API_ENABLE
|
||||
#endif
|
||||
|
||||
|
|
@ -423,11 +423,11 @@ void HID_SendReport(uint8_t id, const void* data, int len);
|
|||
#include "RawHID.h"
|
||||
#endif
|
||||
|
||||
#ifdef HID_CONSUMER_API_ENABLE
|
||||
#ifdef HID_CONSUMERCONTROL_API_ENABLE
|
||||
#include "Consumer.h"
|
||||
#endif
|
||||
|
||||
#ifdef HID_SYSTEM_API_ENABLE
|
||||
#ifdef HID_SYSTEMCONTROL_API_ENABLE
|
||||
#include "System.h"
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,17 @@ typedef union{
|
|||
};
|
||||
} HID_MouseReport_Data_t;
|
||||
|
||||
typedef union{
|
||||
// mouse absolute report: 2 absolute axis
|
||||
uint8_t whole8[4];
|
||||
uint16_t whole16[4 / 2];
|
||||
uint32_t whole32[4 / 4];
|
||||
struct{
|
||||
int16_t xAxis;
|
||||
int16_t yAxis;
|
||||
};
|
||||
} HID_MouseAbsoluteReport_Data_t;
|
||||
|
||||
class Mouse_
|
||||
{
|
||||
private:
|
||||
|
|
@ -128,7 +139,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
inline void moveTo(uint16_t x, uint16_t y){
|
||||
inline void moveTo(int16_t x, int16_t y){
|
||||
// uses different report ID and different HID mouse device!
|
||||
uint32_t pos = ((uint32_t)y << 16) | x;
|
||||
HID_SendReport(HID_REPORTID_MOUSE_ABSOLUTE, &pos, sizeof(pos));
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ typedef union{
|
|||
// every usable system control key possible
|
||||
uint8_t whole8[1];
|
||||
uint8_t key;
|
||||
} HID_SystemReport_Data_t;
|
||||
} HID_SystemControlReport_Data_t;
|
||||
|
||||
class System_{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ You have to enable the specific hid apis on your own then, also the keyboard led
|
|||
#define HID_KEYBOARD_LEDS_ENABLE // leds OR keys
|
||||
//#define HID_KEYBOARD_KEYS_ENABLE
|
||||
//#define HID_RAWHID_ENABLE // currently not working
|
||||
//#define HID_CONSUMER_ENABLE
|
||||
//#define HID_SYSTEM_ENABLE
|
||||
//#define HID_CONSUMERCONTROL_ENABLE
|
||||
//#define HID_SYSTEMCONTROL_ENABLE
|
||||
//#define HID_GAMEPAD_ENABLE // only works without mouse absolute
|
||||
|
||||
//================================================================================
|
||||
|
|
@ -78,8 +78,8 @@ HID_REPORT_MOUSE(HID_REPORTID_MOUSE)
|
|||
#define HID_MOUSE_API_ENABLE
|
||||
#define HID_KEYBOARD_API_ENABLE
|
||||
//#define HID_RAWHID_API_ENABLE
|
||||
//#define HID_CONSUMER_API_ENABLE
|
||||
//#define HID_SYSTEM_API_ENABLE
|
||||
//#define HID_CONSUMERCONTROL_API_ENABLE
|
||||
//#define HID_SYSTEMCONTROL_API_ENABLE
|
||||
//#define HID_GAMEPAD_API_ENABLE
|
||||
//#define HID_ENABLE_ALL_APIS // enables all of the ones above
|
||||
|
||||
|
|
@ -124,8 +124,8 @@ HID_REPORT_MOUSE(HID_REPORTID_MOUSE)
|
|||
////#define HID_MOUSE_API_ENABLE
|
||||
////#define HID_KEYBOARD_API_ENABLE
|
||||
////#define HID_RAWHID_API_ENABLE
|
||||
////#define HID_CONSUMER_API_ENABLE
|
||||
////#define HID_SYSTEM_API_ENABLE
|
||||
////#define HID_CONSUMERCONTROL_API_ENABLE
|
||||
////#define HID_SYSTEMCONTROL_API_ENABLE
|
||||
////#define HID_GAMEPAD_API_ENABLE
|
||||
////#define HID_ENABLE_ALL_APIS // enables all of the ones above
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@ THE SOFTWARE.
|
|||
#define HID_KEYBOARD_LEDS_ENABLE // leds OR keys
|
||||
//#define HID_KEYBOARD_KEYS_ENABLE
|
||||
//#define HID_RAWHID_ENABLE // currently not working
|
||||
//#define HID_CONSUMER_ENABLE
|
||||
//#define HID_SYSTEM_ENABLE
|
||||
//#define HID_CONSUMERCONTROL_ENABLE
|
||||
//#define HID_SYSTEMCONTROL_ENABLE
|
||||
#define HID_GAMEPAD_ENABLE // only works without mouse absolute
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@ THE SOFTWARE.
|
|||
#define HID_KEYBOARD_LEDS_ENABLE // leds OR keys
|
||||
//#define HID_KEYBOARD_KEYS_ENABLE
|
||||
//#define HID_RAWHID_ENABLE // currently not working
|
||||
#define HID_CONSUMER_ENABLE
|
||||
#define HID_SYSTEM_ENABLE
|
||||
#define HID_CONSUMERCONTROL_ENABLE
|
||||
#define HID_SYSTEMCONTROL_ENABLE
|
||||
//#define HID_GAMEPAD_ENABLE // only works without mouse absolute
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ You have to enable the specific hid apis on your own then, also the keyboard led
|
|||
#define HID_KEYBOARD_LEDS_ENABLE // leds OR keys
|
||||
//#define HID_KEYBOARD_KEYS_ENABLE
|
||||
//#define HID_RAWHID_ENABLE // currently not working
|
||||
//#define HID_CONSUMER_ENABLE
|
||||
//#define HID_SYSTEM_ENABLE
|
||||
//#define HID_CONSUMERCONTROL_ENABLE
|
||||
//#define HID_SYSTEMCONTROL_ENABLE
|
||||
//#define HID_GAMEPAD_ENABLE // only works without mouse absolute
|
||||
|
||||
//================================================================================
|
||||
|
|
@ -78,8 +78,8 @@ HID_REPORT_MOUSE(HID_REPORTID_MOUSE)
|
|||
#define HID_MOUSE_API_ENABLE
|
||||
#define HID_KEYBOARD_API_ENABLE
|
||||
//#define HID_RAWHID_API_ENABLE
|
||||
//#define HID_CONSUMER_API_ENABLE
|
||||
//#define HID_SYSTEM_API_ENABLE
|
||||
//#define HID_CONSUMERCONTROL_API_ENABLE
|
||||
//#define HID_SYSTEMCONTROL_API_ENABLE
|
||||
//#define HID_GAMEPAD_API_ENABLE
|
||||
//#define HID_ENABLE_ALL_APIS // enables all of the ones above
|
||||
|
||||
|
|
@ -124,8 +124,8 @@ HID_REPORT_MOUSE(HID_REPORTID_MOUSE)
|
|||
////#define HID_MOUSE_API_ENABLE
|
||||
////#define HID_KEYBOARD_API_ENABLE
|
||||
////#define HID_RAWHID_API_ENABLE
|
||||
////#define HID_CONSUMER_API_ENABLE
|
||||
////#define HID_SYSTEM_API_ENABLE
|
||||
////#define HID_CONSUMERCONTROL_API_ENABLE
|
||||
////#define HID_SYSTEMCONTROL_API_ENABLE
|
||||
////#define HID_GAMEPAD_API_ENABLE
|
||||
////#define HID_ENABLE_ALL_APIS // enables all of the ones above
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@ THE SOFTWARE.
|
|||
#define HID_KEYBOARD_LEDS_ENABLE // leds OR keys
|
||||
//#define HID_KEYBOARD_KEYS_ENABLE
|
||||
//#define HID_RAWHID_ENABLE // currently not working
|
||||
//#define HID_CONSUMER_ENABLE
|
||||
//#define HID_SYSTEM_ENABLE
|
||||
//#define HID_CONSUMERCONTROL_ENABLE
|
||||
//#define HID_SYSTEMCONTROL_ENABLE
|
||||
#define HID_GAMEPAD_ENABLE // only works without mouse absolute
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@ THE SOFTWARE.
|
|||
#define HID_KEYBOARD_LEDS_ENABLE // leds OR keys
|
||||
//#define HID_KEYBOARD_KEYS_ENABLE
|
||||
//#define HID_RAWHID_ENABLE // currently not working
|
||||
#define HID_CONSUMER_ENABLE
|
||||
#define HID_SYSTEM_ENABLE
|
||||
#define HID_CONSUMERCONTROL_ENABLE
|
||||
#define HID_SYSTEMCONTROL_ENABLE
|
||||
//#define HID_GAMEPAD_ENABLE // only works without mouse absolute
|
||||
|
|
|
|||
Loading…
Reference in a new issue