mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Autoformat USBHIDMultimediaKbd example
No code change
This commit is contained in:
parent
5faa2435c1
commit
854fb80e08
1 changed files with 11 additions and 13 deletions
|
@ -11,17 +11,17 @@
|
||||||
class HIDSelector : public HIDComposite
|
class HIDSelector : public HIDComposite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HIDSelector(USB *p) : HIDComposite(p) {};
|
HIDSelector(USB *p) : HIDComposite(p) {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ParseHIDData(USBHID *hid, uint8_t ep, bool is_rpt_id, uint8_t len, uint8_t *buf); // Called by the HIDComposite library
|
void ParseHIDData(USBHID *hid, uint8_t ep, bool is_rpt_id, uint8_t len, uint8_t *buf); // Called by the HIDComposite library
|
||||||
bool SelectInterface(uint8_t iface, uint8_t proto);
|
bool SelectInterface(uint8_t iface, uint8_t proto);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return true for the interface we want to hook into
|
// Return true for the interface we want to hook into
|
||||||
bool HIDSelector::SelectInterface(uint8_t iface, uint8_t proto)
|
bool HIDSelector::SelectInterface(uint8_t iface, uint8_t proto)
|
||||||
{
|
{
|
||||||
if(proto != 0)
|
if (proto != 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -30,22 +30,20 @@ bool HIDSelector::SelectInterface(uint8_t iface, uint8_t proto)
|
||||||
// Will be called for all HID data received from the USB interface
|
// Will be called for all HID data received from the USB interface
|
||||||
void HIDSelector::ParseHIDData(USBHID *hid, uint8_t ep, bool is_rpt_id, uint8_t len, uint8_t *buf) {
|
void HIDSelector::ParseHIDData(USBHID *hid, uint8_t ep, bool is_rpt_id, uint8_t len, uint8_t *buf) {
|
||||||
#if 1
|
#if 1
|
||||||
if (len && buf) {
|
if (len && buf) {
|
||||||
Notify(PSTR("\r\n"), 0x80);
|
Notify(PSTR("\r\n"), 0x80);
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
for (uint8_t i = 0; i < len; i++) {
|
||||||
D_PrintHex<uint8_t > (buf[i], 0x80);
|
D_PrintHex<uint8_t > (buf[i], 0x80);
|
||||||
Notify(PSTR(" "), 0x80);
|
Notify(PSTR(" "), 0x80);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&Usb);
|
||||||
HIDSelector hidSelector(&Usb);
|
HIDSelector hidSelector(&Usb);
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
|
|
Loading…
Reference in a new issue