USB Host Shield 2.0
Loading...
Searching...
No Matches
hiduniversal.h
Go to the documentation of this file.
1
/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2
3
This software may be distributed and modified under the terms of the GNU
4
General Public License version 2 (GPL2) as published by the Free Software
5
Foundation and appearing in the file GPL2.TXT included in the packaging of
6
this file. Please note that GPL2 Section 2[b] requires that all works based
7
on this software must also be made publicly available under the terms of
8
the GPL2 ("Copyleft").
9
10
Contact information
11
-------------------
12
13
Circuits At Home, LTD
14
Web : http://www.circuitsathome.com
15
e-mail : support@circuitsathome.com
16
*/
17
18
#if !defined(__HIDUNIVERSAL_H__)
19
#define __HIDUNIVERSAL_H__
20
21
#include "
hidcomposite.h
"
22
23
class
HIDUniversal
:
public
HIDComposite
{
24
25
bool
SelectInterface(
uint8_t
iface
__attribute__
((unused)),
uint8_t
proto
__attribute__
((unused)))
final
{
26
// the original HIDUniversal didn't have this at all so make it a no-op
27
// (and made it final so users don't override this - if they want to use
28
// SelectInterface() they should be deriving from HIDComposite directly)
29
return
true
;
30
}
31
32
void
ParseHIDData(
USBHID
*
hid
,
uint8_t
ep
__attribute__
((unused)),
bool
is_rpt_id
,
uint8_t
len
,
uint8_t
*
buf
)
final
{
33
// override the HIDComposite version of this method to call the HIDUniversal version
34
// (which doesn't use the endpoint), made it final to make sure users
35
// of HIDUniversal override the right version of ParseHIDData() (the other one, below)
36
ParseHIDData(
hid
,
is_rpt_id
,
len
,
buf
);
37
}
38
39
protected
:
40
virtual
void
ParseHIDData
(
USBHID
*
hid
__attribute__
((unused)),
bool
is_rpt_id
__attribute__
((unused)),
uint8_t
len
__attribute__
((unused)),
uint8_t
*
buf
__attribute__
((unused))) {
41
return
;
42
}
43
44
public
:
45
HIDUniversal
(
USB
*
p
) :
HIDComposite
(
p
) {}
46
47
uint8_t
Poll
()
override
;
48
49
// UsbConfigXtracter implementation
50
void
EndpointXtract
(
uint8_t
conf
,
uint8_t
iface
,
uint8_t
alt
,
uint8_t
proto
,
const
USB_ENDPOINT_DESCRIPTOR
*
ep
)
override
51
{
52
// If the first configuration satisfies, the others are not considered.
53
if
(
bNumEP
> 1 &&
conf
!=
bConfNum
)
54
return
;
55
// otherwise HIDComposite does what HIDUniversal needs
56
HIDComposite::EndpointXtract
(
conf
,
iface
,
alt
,
proto
,
ep
);
57
}
58
};
59
60
#endif
// __HIDUNIVERSAL_H__
ConfigDescParser
Definition
confdescparser.h:47
HIDComposite
Definition
hidcomposite.h:24
HIDComposite::bConfNum
uint8_t bConfNum
Definition
hidcomposite.h:48
HIDComposite::EndpointXtract
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition
hidcomposite.cpp:297
HIDComposite::bNumEP
uint8_t bNumEP
Definition
hidcomposite.h:50
HIDUniversal
Definition
hiduniversal.h:23
HIDUniversal::EndpointXtract
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep) override
Definition
hiduniversal.h:50
HIDUniversal::ParseHIDData
virtual void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition
hiduniversal.h:40
HIDUniversal::Poll
uint8_t Poll() override
Definition
hiduniversal.cpp:20
HIDUniversal::HIDUniversal
HIDUniversal(USB *p)
Definition
hiduniversal.h:45
USBHID
Definition
usbhid.h:143
USB
Definition
UsbCore.h:220
hidcomposite.h
USB_ENDPOINT_DESCRIPTOR
Definition
usb_ch9.h:148
Generated by
1.9.8