1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-21 15:54:39 +01:00

rework HID class functions scopes

This commit is contained in:
Martino Facchin 2015-07-01 16:58:26 +02:00 committed by Cristian Maglie
parent 97a3771772
commit 5defaeaa97
6 changed files with 6 additions and 9 deletions

View File

@ -66,7 +66,7 @@ int HID_GetDescriptor(int8_t t)
} }
} }
void HID_SendReport(u8 id, const void* data, int len) void HID_::SendReport(u8 id, const void* data, int len)
{ {
USB_Send(HID_TX, &id, 1); USB_Send(HID_TX, &id, 1);
USB_Send(HID_TX | TRANSFER_RELEASE,data,len); USB_Send(HID_TX | TRANSFER_RELEASE,data,len);

View File

@ -47,14 +47,9 @@ class HID_
public: public:
HID_(void); HID_(void);
int begin(void); int begin(void);
void SendReport(uint8_t id, const void* data, int len);
}; };
int8_t HID_Plug(void);
int HID_GetInterface(u8* interfaceNum);
int HID_GetDescriptor(int8_t t);
bool HID_Setup(Setup& setup, u8 i);
void HID_SendReport(uint8_t id, const void* data, int len);
extern HID_ HID; extern HID_ HID;
typedef struct typedef struct

View File

@ -44,7 +44,7 @@ void Keyboard_::end(void)
void Keyboard_::sendReport(KeyReport* keys) void Keyboard_::sendReport(KeyReport* keys)
{ {
HID_SendReport(2,keys,sizeof(KeyReport)); HID.SendReport(2,keys,sizeof(KeyReport));
} }
const u8 _hidReportDescriptor[] PROGMEM = { const u8 _hidReportDescriptor[] PROGMEM = {

View File

@ -96,5 +96,6 @@ public:
virtual void releaseAll(void); virtual void releaseAll(void);
}; };
extern Keyboard_ Keyboard; extern Keyboard_ Keyboard;
extern HID_ HID;
#endif #endif

View File

@ -93,7 +93,7 @@ void Mouse_::move(signed char x, signed char y, signed char wheel)
m[1] = x; m[1] = x;
m[2] = y; m[2] = y;
m[3] = wheel; m[3] = wheel;
HID_SendReport(1,m,4); HID.SendReport(1,m,4);
} }
void Mouse_::buttons(uint8_t b) void Mouse_::buttons(uint8_t b)

View File

@ -56,6 +56,7 @@ public:
bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default
}; };
extern Mouse_ Mouse; extern Mouse_ Mouse;
extern HID_ HID;
#endif #endif
#endif #endif