17 #if !defined(__HIDBOOT_H__)
21 #include <avr/pgmspace.h>
29 #if defined(ARDUINO) && ARDUINO >=100
41 #define KEY_SPACE 0x2c
43 #define KEY_ZERO2 0x62
44 #define KEY_ENTER 0x28
45 #define KEY_PERIOD 0x63
67 virtual void Parse(
HID *hid,
bool is_rpt_id, uint8_t len, uint8_t *buf);
129 #define KEY_NUM_LOCK 0x53
130 #define KEY_CAPS_LOCK 0x39
131 #define KEY_SCROLL_LOCK 0x47
134 static const uint8_t numKeys[];
135 static const uint8_t symKeysUp[];
136 static const uint8_t symKeysLo[];
137 static const uint8_t padKeys[];
159 virtual void Parse(
HID *hid,
bool is_rpt_id, uint8_t len, uint8_t *buf);
170 virtual void OnKeyUp(uint8_t mod, uint8_t key) {
174 #define totalEndpoints 2
176 #define HID_MAX_HID_CLASS_DESCRIPTORS 5
178 template <const u
int8_t BOOT_PROTOCOL>
189 uint32_t qNextPollTime;
207 virtual uint8_t
Init(uint8_t parent, uint8_t port,
bool lowspeed);
209 virtual uint8_t
Poll();
219 template <const u
int8_t BOOT_PROTOCOL>
231 template <const u
int8_t BOOT_PROTOCOL>
234 epInfo[i].epAddr = 0;
235 epInfo[i].maxPktSize = (i) ? 0 : 8;
236 epInfo[i].epAttribs = 0;
244 template <const u
int8_t BOOT_PROTOCOL>
248 uint8_t buf[constBufSize];
285 rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*) buf);
288 len = (buf[0] > constBufSize) ? constBufSize : buf[0];
294 goto FailGetDevDescr;
310 rcode = pUsb->setAddr(0, 0, bAddress);
332 rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*) buf);
335 goto FailGetDevDescr;
340 rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
343 goto FailSetDevTblEntry;
347 for(uint8_t i = 0; i < num_of_conf; i++) {
354 rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
367 rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
372 rcode = pUsb->setConf(bAddress, 0, bConfNum);
375 goto FailSetConfDescr;
382 goto FailSetProtocol;
384 if(BOOT_PROTOCOL == 1) {
385 rcode = SetIdle(bIfaceNum, 0, 0);
396 #ifdef DEBUG_USB_HOST
402 #ifdef DEBUG_USB_HOST
408 #ifdef DEBUG_USB_HOST
414 #ifdef DEBUG_USB_HOST
420 #ifdef DEBUG_USB_HOST
426 #ifdef DEBUG_USB_HOST
431 #ifdef DEBUG_USB_HOST
438 template <const u
int8_t BOOT_PROTOCOL>
441 if(bNumEP > 1 && conf != bConfNum)
450 index = epInterruptInIndex;
455 epInfo[index].epAttribs = 0;
462 template <const u
int8_t BOOT_PROTOCOL>
464 pUsb->GetAddressPool().FreeAddress(bAddress);
475 template <const u
int8_t BOOT_PROTOCOL>
482 if(qNextPollTime <= millis()) {
483 qNextPollTime = millis() + 10;
485 const uint8_t const_buff_len = 16;
486 uint8_t buf[const_buff_len];
488 uint16_t read = (uint16_t) epInfo[epInterruptInIndex].maxPktSize;
490 uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[epInterruptInIndex].epAddr, &read, buf);
503 pRptParser->Parse((
HID*)
this, 0, (uint8_t) read, buf);
509 #endif // __HIDBOOTMOUSE_H__