diff --git a/_b_t_d_8cpp.html b/_b_t_d_8cpp.html index a24b5dcf..56d722da 100644 --- a/_b_t_d_8cpp.html +++ b/_b_t_d_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: BTD.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
diff --git a/_b_t_d_8cpp__incl.md5 b/_b_t_d_8cpp__incl.md5 index a355a3b6..34060dfc 100644 --- a/_b_t_d_8cpp__incl.md5 +++ b/_b_t_d_8cpp__incl.md5 @@ -1 +1 @@ -958bad8ed4b3f7ba0b3843a14e09d10f \ No newline at end of file +7f7897af29f53461811904a15cf045bb \ No newline at end of file diff --git a/_b_t_d_8cpp__incl.png b/_b_t_d_8cpp__incl.png index 1f71fe54..ef48eb78 100644 Binary files a/_b_t_d_8cpp__incl.png and b/_b_t_d_8cpp__incl.png differ diff --git a/_b_t_d_8cpp_source.html b/_b_t_d_8cpp_source.html index 7ff3bc1b..a55c604d 100644 --- a/_b_t_d_8cpp_source.html +++ b/_b_t_d_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: BTD.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
BTD.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "BTD.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 
22 const uint8_t BTD::BTD_CONTROL_PIPE = 0;
23 const uint8_t BTD::BTD_EVENT_PIPE = 1;
24 const uint8_t BTD::BTD_DATAIN_PIPE = 2;
25 const uint8_t BTD::BTD_DATAOUT_PIPE = 3;
26 
28 connectToWii(false),
29 pairWithWii(false),
30 connectToHIDDevice(false),
31 pairWithHIDDevice(false),
32 pUsb(p), // Pointer to USB class instance - mandatory
33 bAddress(0), // Device address - mandatory
34 bNumEP(1), // If config descriptor needs to be parsed
35 qNextPollTime(0), // Reset NextPollTime
36 pollInterval(0),
37 bPollEnable(false) // Don't start polling before dongle is connected
38 {
39  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++)
40  btService[i] = NULL;
41 
42  Initialize(); // Set all variables, endpoint structs etc. to default values
43 
44  if(pUsb) // Register in USB subsystem
45  pUsb->RegisterDeviceClass(this); // Set devConfig[] entry
46 }
47 
48 uint8_t BTD::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
49  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
50  uint8_t buf[constBufSize];
51  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
52  uint8_t rcode;
53  UsbDevice *p = NULL;
54  EpInfo *oldep_ptr = NULL;
55 
56  Initialize(); // Set all variables, endpoint structs etc. to default values
57 
58  AddressPool &addrPool = pUsb->GetAddressPool(); // Get memory address of USB device address pool
59 #ifdef EXTRADEBUG
60  Notify(PSTR("\r\nBTD ConfigureDevice"), 0x80);
61 #endif
62 
63  if(bAddress) { // Check if address has already been assigned to an instance
64 #ifdef DEBUG_USB_HOST
65  Notify(PSTR("\r\nAddress in use"), 0x80);
66 #endif
68  }
69 
70  p = addrPool.GetUsbDevicePtr(0); // Get pointer to pseudo device with address 0 assigned
71  if(!p) {
72 #ifdef DEBUG_USB_HOST
73  Notify(PSTR("\r\nAddress not found"), 0x80);
74 #endif
76  }
77 
78  if(!p->epinfo) {
79 #ifdef DEBUG_USB_HOST
80  Notify(PSTR("\r\nepinfo is null"), 0x80);
81 #endif
83  }
84 
85  oldep_ptr = p->epinfo; // Save old pointer to EP_RECORD of address 0
86  p->epinfo = epInfo; // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
87  p->lowspeed = lowspeed;
88  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
89 
90  p->epinfo = oldep_ptr; // Restore p->epinfo
91 
92  if(rcode)
93  goto FailGetDevDescr;
94 
95  bAddress = addrPool.AllocAddress(parent, false, port); // Allocate new address according to device class
96 
97  if(!bAddress) {
98 #ifdef DEBUG_USB_HOST
99  Notify(PSTR("\r\nOut of address space"), 0x80);
100 #endif
102  }
103 
104  if (udd->bDeviceClass == 0x09) // Some dongles have an USB hub inside
105  goto FailHub;
106 
107  epInfo[0].maxPktSize = udd->bMaxPacketSize0; // Extract Max Packet Size from device descriptor
108  epInfo[1].epAddr = udd->bNumConfigurations; // Steal and abuse from epInfo structure to save memory
109 
110  VID = udd->idVendor;
111  PID = udd->idProduct;
112 
114 
115 FailHub:
116 #ifdef DEBUG_USB_HOST
117  Notify(PSTR("\r\nPlease create a hub instance in your code: \"USBHub Hub1(&Usb);\""), 0x80);
118 #endif
119  pUsb->setAddr(bAddress, 0, 0); // Reset address
121  Release();
122  return rcode;
123 
124 FailGetDevDescr:
125 #ifdef DEBUG_USB_HOST
126  NotifyFailGetDevDescr(rcode);
127 #endif
128  if(rcode != hrJERR)
130  Release();
131  return rcode;
132 };
133 
134 uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
135  uint8_t rcode;
136  uint8_t num_of_conf = epInfo[1].epAddr; // Number of configurations
137  epInfo[1].epAddr = 0;
138 
139  AddressPool &addrPool = pUsb->GetAddressPool();
140 #ifdef EXTRADEBUG
141  Notify(PSTR("\r\nBTD Init"), 0x80);
142 #endif
143  UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
144 
145  if(!p) {
146 #ifdef DEBUG_USB_HOST
147  Notify(PSTR("\r\nAddress not found"), 0x80);
148 #endif
150  }
151 
152  delay(300); // Assign new address to the device
153 
154  rcode = pUsb->setAddr(0, 0, bAddress); // Assign new address to the device
155  if(rcode) {
156 #ifdef DEBUG_USB_HOST
157  Notify(PSTR("\r\nsetAddr: "), 0x80);
158  D_PrintHex<uint8_t > (rcode, 0x80);
159 #endif
160  p->lowspeed = false;
161  goto Fail;
162  }
163 #ifdef EXTRADEBUG
164  Notify(PSTR("\r\nAddr: "), 0x80);
165  D_PrintHex<uint8_t > (bAddress, 0x80);
166 #endif
167 
168  p->lowspeed = false;
169 
170  p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
171  if(!p) {
172 #ifdef DEBUG_USB_HOST
173  Notify(PSTR("\r\nAddress not found"), 0x80);
174 #endif
176  }
177 
178  p->lowspeed = lowspeed;
179 
180  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo); // Assign epInfo to epinfo pointer - only EP0 is known
181  if(rcode)
182  goto FailSetDevTblEntry;
183 
184  if(VID == PS3_VID && (PID == PS3_PID || PID == PS3NAVIGATION_PID || PID == PS3MOVE_PID)) {
185  delay(100);
186  rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 1); // We only need the Control endpoint, so we don't have to initialize the other endpoints of device
187  if(rcode)
188  goto FailSetConfDescr;
189 
190 #ifdef DEBUG_USB_HOST
191  if(PID == PS3_PID || PID == PS3NAVIGATION_PID) {
192  if(PID == PS3_PID)
193  Notify(PSTR("\r\nDualshock 3 Controller Connected"), 0x80);
194  else // It must be a navigation controller
195  Notify(PSTR("\r\nNavigation Controller Connected"), 0x80);
196  } else // It must be a Motion controller
197  Notify(PSTR("\r\nMotion Controller Connected"), 0x80);
198 #endif
199 
200  if(my_bdaddr[0] == 0x00 && my_bdaddr[1] == 0x00 && my_bdaddr[2] == 0x00 && my_bdaddr[3] == 0x00 && my_bdaddr[4] == 0x00 && my_bdaddr[5] == 0x00) {
201 #ifdef DEBUG_USB_HOST
202  Notify(PSTR("\r\nPlease plug in the dongle before trying to pair with the PS3 Controller\r\nor set the Bluetooth address in the constructor of the PS3BT class"), 0x80);
203 #endif
204  } else {
205  if(PID == PS3_PID || PID == PS3NAVIGATION_PID)
206  setBdaddr(my_bdaddr); // Set internal Bluetooth address
207  else
208  setMoveBdaddr(my_bdaddr); // Set internal Bluetooth address
209 #ifdef DEBUG_USB_HOST
210  Notify(PSTR("\r\nBluetooth Address was set to: "), 0x80);
211  for(int8_t i = 5; i > 0; i--) {
212  D_PrintHex<uint8_t > (my_bdaddr[i], 0x80);
213  Notify(PSTR(":"), 0x80);
214  }
215  D_PrintHex<uint8_t > (my_bdaddr[0], 0x80);
216 #endif
217  }
218 
219  pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 0); // Reset configuration value
220  pUsb->setAddr(bAddress, 0, 0); // Reset address
221  Release(); // Release device
223  } else {
224  // Check if attached device is a Bluetooth dongle and fill endpoint data structure
225  // First interface in the configuration must have Bluetooth assigned Class/Subclass/Protocol
226  // And 3 endpoints - interrupt-IN, bulk-IN, bulk-OUT, not necessarily in this order
227  for(uint8_t i = 0; i < num_of_conf; i++) {
228  if(VID == IOGEAR_GBU521_VID && PID == IOGEAR_GBU521_PID) {
230  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
231  } else {
233  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
234  }
235  if(rcode) // Check error code
236  goto FailGetConfDescr;
237  if(bNumEP >= BTD_MAX_ENDPOINTS) // All endpoints extracted
238  break;
239  }
240 
242  goto FailUnknownDevice;
243 
244  // Assign epInfo to epinfo pointer - this time all 3 endpoins
245  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
246  if(rcode)
247  goto FailSetDevTblEntry;
248 
249  // Set Configuration Value
250  rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum);
251  if(rcode)
252  goto FailSetConfDescr;
253 
254  hci_num_reset_loops = 100; // only loop 100 times before trying to send the hci reset command
255  hci_counter = 0;
256  hci_state = HCI_INIT_STATE;
257  watingForConnection = false;
258  bPollEnable = true;
259 
260 #ifdef DEBUG_USB_HOST
261  Notify(PSTR("\r\nBluetooth Dongle Initialized"), 0x80);
262 #endif
263  }
264  return 0; // Successful configuration
265 
266  /* Diagnostic messages */
267 FailSetDevTblEntry:
268 #ifdef DEBUG_USB_HOST
270  goto Fail;
271 #endif
272 
273 FailGetConfDescr:
274 #ifdef DEBUG_USB_HOST
276  goto Fail;
277 #endif
278 
279 FailSetConfDescr:
280 #ifdef DEBUG_USB_HOST
282 #endif
283  goto Fail;
284 
285 FailUnknownDevice:
286 #ifdef DEBUG_USB_HOST
287  NotifyFailUnknownDevice(VID, PID);
288 #endif
289  pUsb->setAddr(bAddress, 0, 0); // Reset address
291 Fail:
292 #ifdef DEBUG_USB_HOST
293  Notify(PSTR("\r\nBTD Init Failed, error code: "), 0x80);
294  NotifyFail(rcode);
295 #endif
296  Release();
297  return rcode;
298 }
299 
300 void BTD::Initialize() {
301  uint8_t i;
302  for(i = 0; i < BTD_MAX_ENDPOINTS; i++) {
303  epInfo[i].epAddr = 0;
304  epInfo[i].maxPktSize = (i) ? 0 : 8;
305  epInfo[i].bmSndToggle = 0;
306  epInfo[i].bmRcvToggle = 0;
308  }
309  for(i = 0; i < BTD_NUM_SERVICES; i++) {
310  if(btService[i])
311  btService[i]->Reset(); // Reset all Bluetooth services
312  }
313 
314  connectToWii = false;
315  incomingWii = false;
316  connectToHIDDevice = false;
317  incomingHIDDevice = false;
318  incomingPS4 = false;
319  bAddress = 0; // Clear device address
320  bNumEP = 1; // Must have to be reset to 1
321  qNextPollTime = 0; // Reset next poll time
322  pollInterval = 0;
323  bPollEnable = false; // Don't start polling before dongle is connected
324 }
325 
326 /* Extracts interrupt-IN, bulk-IN, bulk-OUT endpoint information from config descriptor */
327 void BTD::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
328  //ErrorMessage<uint8_t>(PSTR("Conf.Val"),conf);
329  //ErrorMessage<uint8_t>(PSTR("Iface Num"),iface);
330  //ErrorMessage<uint8_t>(PSTR("Alt.Set"),alt);
331 
332  if(alt) // Wrong interface - by BT spec, no alt setting
333  return;
334 
335  bConfNum = conf;
336  uint8_t index;
337 
338  if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) { // Interrupt In endpoint found
339  index = BTD_EVENT_PIPE;
341  } else {
342  if((pep->bmAttributes & 0x02) == 2) // Bulk endpoint found
343  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? BTD_DATAIN_PIPE : BTD_DATAOUT_PIPE;
344  else
345  return;
346  }
347 
348  // Fill the rest of endpoint data structure
349  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
350  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
351 #ifdef EXTRADEBUG
353 #endif
354  if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
355  pollInterval = pep->bInterval;
356  bNumEP++;
357 }
358 
360 #ifdef EXTRADEBUG
361  Notify(PSTR("\r\nEndpoint descriptor:"), 0x80);
362  Notify(PSTR("\r\nLength:\t\t"), 0x80);
363  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
364  Notify(PSTR("\r\nType:\t\t"), 0x80);
365  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
366  Notify(PSTR("\r\nAddress:\t"), 0x80);
367  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
368  Notify(PSTR("\r\nAttributes:\t"), 0x80);
369  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
370  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
371  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
372  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
373  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
374 #endif
375 }
376 
377 /* Performs a cleanup after failed Init() attempt */
378 uint8_t BTD::Release() {
379  Initialize(); // Set all variables, endpoint structs etc. to default values
381  return 0;
382 }
383 
384 uint8_t BTD::Poll() {
385  if(!bPollEnable)
386  return 0;
387  if((long)(millis() - qNextPollTime) >= 0L) { // Don't poll if shorter than polling interval
388  qNextPollTime = millis() + pollInterval; // Set new poll time
389  HCI_event_task(); // Poll the HCI event pipe
390  HCI_task(); // HCI state machine
391  ACL_event_task(); // Poll the ACL input pipe too
392  }
393  return 0;
394 }
395 
397  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++)
398  if(btService[i])
399  btService[i]->disconnect();
400 };
401 
402 void BTD::HCI_event_task() {
403  uint16_t length = BULK_MAXPKTSIZE; // Request more than 16 bytes anyway, the inTransfer routine will take care of this
404  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_EVENT_PIPE ].epAddr, &length, hcibuf, pollInterval); // Input on endpoint 1
405 
406  if(!rcode || rcode == hrNAK) { // Check for errors
407  switch(hcibuf[0]) { // Switch on event type
408  case EV_COMMAND_COMPLETE:
409  if(!hcibuf[5]) { // Check if command succeeded
410  hci_set_flag(HCI_FLAG_CMD_COMPLETE); // Set command complete flag
411  if((hcibuf[3] == 0x01) && (hcibuf[4] == 0x10)) { // Parameters from read local version information
412  hci_version = hcibuf[6]; // Used to check if it supports 2.0+EDR - see http://www.bluetooth.org/Technical/AssignedNumbers/hci.htm
414  } else if((hcibuf[3] == 0x09) && (hcibuf[4] == 0x10)) { // Parameters from read local bluetooth address
415  for(uint8_t i = 0; i < 6; i++)
416  my_bdaddr[i] = hcibuf[6 + i];
418  }
419  }
420  break;
421 
422  case EV_COMMAND_STATUS:
423  if(hcibuf[2]) { // Show status on serial if not OK
424 #ifdef DEBUG_USB_HOST
425  Notify(PSTR("\r\nHCI Command Failed: "), 0x80);
426  D_PrintHex<uint8_t > (hcibuf[2], 0x80);
427 #endif
428  }
429  break;
430 
431  case EV_INQUIRY_COMPLETE:
432  if(inquiry_counter >= 5 && (pairWithWii || pairWithHIDDevice)) {
433  inquiry_counter = 0;
434 #ifdef DEBUG_USB_HOST
435  if(pairWithWii)
436  Notify(PSTR("\r\nCouldn't find Wiimote"), 0x80);
437  else
438  Notify(PSTR("\r\nCouldn't find HID device"), 0x80);
439 #endif
440  connectToWii = false;
441  pairWithWii = false;
442  connectToHIDDevice = false;
443  pairWithHIDDevice = false;
444  hci_state = HCI_SCANNING_STATE;
445  }
446  inquiry_counter++;
447  break;
448 
449  case EV_INQUIRY_RESULT:
450  if(hcibuf[2]) { // Check that there is more than zero responses
451 #ifdef EXTRADEBUG
452  Notify(PSTR("\r\nNumber of responses: "), 0x80);
453  Notify(hcibuf[2], 0x80);
454 #endif
455  for(uint8_t i = 0; i < hcibuf[2]; i++) {
456  uint8_t offset = 8 * hcibuf[2] + 3 * i;
457 
458  for(uint8_t j = 0; j < 3; j++)
459  classOfDevice[j] = hcibuf[j + 4 + offset];
460 
461 #ifdef EXTRADEBUG
462  Notify(PSTR("\r\nClass of device: "), 0x80);
463  D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
464  Notify(PSTR(" "), 0x80);
465  D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
466  Notify(PSTR(" "), 0x80);
467  D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
468 #endif
469 
470  if(pairWithWii && classOfDevice[2] == 0x00 && (classOfDevice[1] & 0x05) && (classOfDevice[0] & 0x0C)) { // See http://wiibrew.org/wiki/Wiimote#SDP_information
471  checkRemoteName = true; // Check remote name to distinguish between the different controllers
472 
473  for(uint8_t j = 0; j < 6; j++)
474  disc_bdaddr[j] = hcibuf[j + 3 + 6 * i];
475 
477  break;
478  } else if(pairWithHIDDevice && (classOfDevice[1] & 0x05) && (classOfDevice[0] & 0xC8)) { // Check if it is a mouse, keyboard or a gamepad - see: http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html
479 #ifdef DEBUG_USB_HOST
480  if(classOfDevice[0] & 0x80)
481  Notify(PSTR("\r\nMouse found"), 0x80);
482  if(classOfDevice[0] & 0x40)
483  Notify(PSTR("\r\nKeyboard found"), 0x80);
484  if(classOfDevice[0] & 0x08)
485  Notify(PSTR("\r\nGamepad found"), 0x80);
486 #endif
487 
488  for(uint8_t j = 0; j < 6; j++)
489  disc_bdaddr[j] = hcibuf[j + 3 + 6 * i];
490 
492  break;
493  }
494  }
495  }
496  break;
497 
498  case EV_CONNECT_COMPLETE:
500  if(!hcibuf[2]) { // Check if connected OK
501 #ifdef EXTRADEBUG
502  Notify(PSTR("\r\nConnection established"), 0x80);
503 #endif
504  hci_handle = hcibuf[3] | ((hcibuf[4] & 0x0F) << 8); // Store the handle for the ACL connection
505  hci_set_flag(HCI_FLAG_CONNECT_COMPLETE); // Set connection complete flag
506  } else {
507  hci_state = HCI_CHECK_DEVICE_SERVICE;
508 #ifdef DEBUG_USB_HOST
509  Notify(PSTR("\r\nConnection Failed: "), 0x80);
510  D_PrintHex<uint8_t > (hcibuf[2], 0x80);
511 #endif
512  }
513  break;
514 
516  if(!hcibuf[2]) { // Check if disconnected OK
517  hci_set_flag(HCI_FLAG_DISCONNECT_COMPLETE); // Set disconnect command complete flag
518  hci_clear_flag(HCI_FLAG_CONNECT_COMPLETE); // Clear connection complete flag
519  }
520  break;
521 
523  if(!hcibuf[2]) { // Check if reading is OK
524  for(uint8_t i = 0; i < min(sizeof (remote_name), sizeof (hcibuf) - 9); i++) {
525  remote_name[i] = hcibuf[9 + i];
526  if(remote_name[i] == '\0') // End of string
527  break;
528  }
529  // TODO: Altid sæt '\0' i remote name!
531  }
532  break;
533 
534  case EV_INCOMING_CONNECT:
535  for(uint8_t i = 0; i < 6; i++)
536  disc_bdaddr[i] = hcibuf[i + 2];
537 
538  for(uint8_t i = 0; i < 3; i++)
539  classOfDevice[i] = hcibuf[i + 8];
540 
541  if((classOfDevice[1] & 0x05) && (classOfDevice[0] & 0xC8)) { // Check if it is a mouse, keyboard or a gamepad
542 #ifdef DEBUG_USB_HOST
543  if(classOfDevice[0] & 0x80)
544  Notify(PSTR("\r\nMouse is connecting"), 0x80);
545  if(classOfDevice[0] & 0x40)
546  Notify(PSTR("\r\nKeyboard is connecting"), 0x80);
547  if(classOfDevice[0] & 0x08)
548  Notify(PSTR("\r\nGamepad is connecting"), 0x80);
549 #endif
550  incomingHIDDevice = true;
551  }
552 
553 #ifdef EXTRADEBUG
554  Notify(PSTR("\r\nClass of device: "), 0x80);
555  D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
556  Notify(PSTR(" "), 0x80);
557  D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
558  Notify(PSTR(" "), 0x80);
559  D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
560 #endif
562  break;
563 
564  case EV_PIN_CODE_REQUEST:
565  if(pairWithWii) {
566 #ifdef DEBUG_USB_HOST
567  Notify(PSTR("\r\nPairing with Wiimote"), 0x80);
568 #endif
570  } else if(btdPin != NULL) {
571 #ifdef DEBUG_USB_HOST
572  Notify(PSTR("\r\nBluetooth pin is set too: "), 0x80);
573  NotifyStr(btdPin, 0x80);
574 #endif
576  } else {
577 #ifdef DEBUG_USB_HOST
578  Notify(PSTR("\r\nNo pin was set"), 0x80);
579 #endif
581  }
582  break;
583 
584  case EV_LINK_KEY_REQUEST:
585 #ifdef DEBUG_USB_HOST
586  Notify(PSTR("\r\nReceived Key Request"), 0x80);
587 #endif
589  break;
590 
592  if(!hcibuf[2]) { // Check if pairing was successful
593  if(pairWithWii && !connectToWii) {
594 #ifdef DEBUG_USB_HOST
595  Notify(PSTR("\r\nPairing successful with Wiimote"), 0x80);
596 #endif
597  connectToWii = true; // Used to indicate to the Wii service, that it should connect to this device
598  } else if(pairWithHIDDevice && !connectToHIDDevice) {
599 #ifdef DEBUG_USB_HOST
600  Notify(PSTR("\r\nPairing successful with HID device"), 0x80);
601 #endif
602  connectToHIDDevice = true; // Used to indicate to the BTHID service, that it should connect to this device
603  }
604  } else {
605 #ifdef DEBUG_USB_HOST
606  Notify(PSTR("\r\nPairing Failed: "), 0x80);
607  D_PrintHex<uint8_t > (hcibuf[2], 0x80);
608 #endif
610  hci_state = HCI_DISCONNECT_STATE;
611  }
612  break;
613  /* We will just ignore the following events */
614  case EV_NUM_COMPLETE_PKT:
615  case EV_ROLE_CHANGED:
617  case EV_LOOPBACK_COMMAND:
620  case EV_MAX_SLOTS_CHANGE:
625  break;
626 #ifdef EXTRADEBUG
627  default:
628  if(hcibuf[0] != 0x00) {
629  Notify(PSTR("\r\nUnmanaged HCI Event: "), 0x80);
630  D_PrintHex<uint8_t > (hcibuf[0], 0x80);
631  }
632  break;
633 #endif
634  } // Switch
635  }
636 #ifdef EXTRADEBUG
637  else {
638  Notify(PSTR("\r\nHCI event error: "), 0x80);
639  D_PrintHex<uint8_t > (rcode, 0x80);
640  }
641 #endif
642 }
643 
644 /* Poll Bluetooth and print result */
645 void BTD::HCI_task() {
646  switch(hci_state) {
647  case HCI_INIT_STATE:
648  hci_counter++;
649  if(hci_counter > hci_num_reset_loops) { // wait until we have looped x times to clear any old events
650  hci_reset();
651  hci_state = HCI_RESET_STATE;
652  hci_counter = 0;
653  }
654  break;
655 
656  case HCI_RESET_STATE:
657  hci_counter++;
659  hci_counter = 0;
660 #ifdef DEBUG_USB_HOST
661  Notify(PSTR("\r\nHCI Reset complete"), 0x80);
662 #endif
663  hci_state = HCI_CLASS_STATE;
665  } else if(hci_counter > hci_num_reset_loops) {
666  hci_num_reset_loops *= 10;
667  if(hci_num_reset_loops > 2000)
668  hci_num_reset_loops = 2000;
669 #ifdef DEBUG_USB_HOST
670  Notify(PSTR("\r\nNo response to HCI Reset"), 0x80);
671 #endif
672  hci_state = HCI_INIT_STATE;
673  hci_counter = 0;
674  }
675  break;
676 
677  case HCI_CLASS_STATE:
679 #ifdef DEBUG_USB_HOST
680  Notify(PSTR("\r\nWrite class of device"), 0x80);
681 #endif
682  hci_state = HCI_BDADDR_STATE;
683  hci_read_bdaddr();
684  }
685  break;
686 
687  case HCI_BDADDR_STATE:
689 #ifdef DEBUG_USB_HOST
690  Notify(PSTR("\r\nLocal Bluetooth Address: "), 0x80);
691  for(int8_t i = 5; i > 0; i--) {
692  D_PrintHex<uint8_t > (my_bdaddr[i], 0x80);
693  Notify(PSTR(":"), 0x80);
694  }
695  D_PrintHex<uint8_t > (my_bdaddr[0], 0x80);
696 #endif
698  hci_state = HCI_LOCAL_VERSION_STATE;
699  }
700  break;
701 
702  case HCI_LOCAL_VERSION_STATE: // The local version is used by the PS3BT class
704  if(btdName != NULL) {
706  hci_state = HCI_SET_NAME_STATE;
707  } else
708  hci_state = HCI_CHECK_DEVICE_SERVICE;
709  }
710  break;
711 
712  case HCI_SET_NAME_STATE:
714 #ifdef DEBUG_USB_HOST
715  Notify(PSTR("\r\nThe name is set to: "), 0x80);
716  NotifyStr(btdName, 0x80);
717 #endif
718  hci_state = HCI_CHECK_DEVICE_SERVICE;
719  }
720  break;
721 
723  if(pairWithHIDDevice || pairWithWii) { // Check if it should try to connect to a Wiimote
724 #ifdef DEBUG_USB_HOST
725  if(pairWithWii)
726  Notify(PSTR("\r\nStarting inquiry\r\nPress 1 & 2 on the Wiimote\r\nOr press the SYNC button if you are using a Wii U Pro Controller or a Wii Balance Board"), 0x80);
727  else
728  Notify(PSTR("\r\nPlease enable discovery of your device"), 0x80);
729 #endif
730  hci_inquiry();
731  hci_state = HCI_INQUIRY_STATE;
732  } else
733  hci_state = HCI_SCANNING_STATE; // Don't try to connect to a Wiimote
734  break;
735 
736  case HCI_INQUIRY_STATE:
738  hci_inquiry_cancel(); // Stop inquiry
739 #ifdef DEBUG_USB_HOST
740  if(pairWithWii)
741  Notify(PSTR("\r\nWiimote found"), 0x80);
742  else
743  Notify(PSTR("\r\nHID device found"), 0x80);
744 
745  Notify(PSTR("\r\nNow just create the instance like so:"), 0x80);
746  if(pairWithWii)
747  Notify(PSTR("\r\nWII Wii(&Btd);"), 0x80);
748  else
749  Notify(PSTR("\r\nBTHID bthid(&Btd);"), 0x80);
750 
751  Notify(PSTR("\r\nAnd then press any button on the "), 0x80);
752  if(pairWithWii)
753  Notify(PSTR("Wiimote"), 0x80);
754  else
755  Notify(PSTR("device"), 0x80);
756 #endif
757  if(checkRemoteName) {
758  hci_remote_name(); // We need to know the name to distinguish between the Wiimote, the new Wiimote with Motion Plus inside, a Wii U Pro Controller and a Wii Balance Board
759  hci_state = HCI_REMOTE_NAME_STATE;
760  } else
761  hci_state = HCI_CONNECT_DEVICE_STATE;
762  }
763  break;
764 
767 #ifdef DEBUG_USB_HOST
768  if(pairWithWii)
769  Notify(PSTR("\r\nConnecting to Wiimote"), 0x80);
770  else
771  Notify(PSTR("\r\nConnecting to HID device"), 0x80);
772 #endif
773  checkRemoteName = false;
774  hci_connect();
775  hci_state = HCI_CONNECTED_DEVICE_STATE;
776  }
777  break;
778 
782 #ifdef DEBUG_USB_HOST
783  if(pairWithWii)
784  Notify(PSTR("\r\nConnected to Wiimote"), 0x80);
785  else
786  Notify(PSTR("\r\nConnected to HID device"), 0x80);
787 #endif
788  hci_authentication_request(); // This will start the pairing with the Wiimote
789  hci_state = HCI_SCANNING_STATE;
790  } else {
791 #ifdef DEBUG_USB_HOST
792  Notify(PSTR("\r\nTrying to connect one more time..."), 0x80);
793 #endif
794  hci_connect(); // Try to connect one more time
795  }
796  }
797  break;
798 
799  case HCI_SCANNING_STATE:
801 #ifdef DEBUG_USB_HOST
802  Notify(PSTR("\r\nWait For Incoming Connection Request"), 0x80);
803 #endif
805  watingForConnection = true;
806  hci_state = HCI_CONNECT_IN_STATE;
807  }
808  break;
809 
812  watingForConnection = false;
813 #ifdef DEBUG_USB_HOST
814  Notify(PSTR("\r\nIncoming Connection Request"), 0x80);
815 #endif
816  hci_remote_name();
817  hci_state = HCI_REMOTE_NAME_STATE;
819  hci_state = HCI_DISCONNECT_STATE;
820  break;
821 
824 #ifdef DEBUG_USB_HOST
825  Notify(PSTR("\r\nRemote Name: "), 0x80);
826  for(uint8_t i = 0; i < strlen(remote_name); i++)
827  Notifyc(remote_name[i], 0x80);
828 #endif
829  if(strncmp((const char*)remote_name, "Nintendo", 8) == 0) {
830  incomingWii = true;
831  motionPlusInside = false;
832  wiiUProController = false;
833  pairWiiUsingSync = false;
834 #ifdef DEBUG_USB_HOST
835  Notify(PSTR("\r\nWiimote is connecting"), 0x80);
836 #endif
837  if(strncmp((const char*)remote_name, "Nintendo RVL-CNT-01-TR", 22) == 0) {
838 #ifdef DEBUG_USB_HOST
839  Notify(PSTR(" with Motion Plus Inside"), 0x80);
840 #endif
841  motionPlusInside = true;
842  } else if(strncmp((const char*)remote_name, "Nintendo RVL-CNT-01-UC", 22) == 0) {
843 #ifdef DEBUG_USB_HOST
844  Notify(PSTR(" - Wii U Pro Controller"), 0x80);
845 #endif
846  wiiUProController = motionPlusInside = pairWiiUsingSync = true;
847  } else if(strncmp((const char*)remote_name, "Nintendo RVL-WBC-01", 19) == 0) {
848 #ifdef DEBUG_USB_HOST
849  Notify(PSTR(" - Wii Balance Board"), 0x80);
850 #endif
851  pairWiiUsingSync = true;
852  }
853  }
854  if(classOfDevice[2] == 0 && classOfDevice[1] == 0x25 && classOfDevice[0] == 0x08 && strncmp((const char*)remote_name, "Wireless Controller", 19) == 0) {
855 #ifdef DEBUG_USB_HOST
856  Notify(PSTR("\r\nPS4 controller is connecting"), 0x80);
857 #endif
858  incomingPS4 = true;
859  }
860  if(pairWithWii && checkRemoteName)
861  hci_state = HCI_CONNECT_DEVICE_STATE;
862  else {
864  hci_state = HCI_CONNECTED_STATE;
865  }
866  }
867  break;
868 
869  case HCI_CONNECTED_STATE:
871 #ifdef DEBUG_USB_HOST
872  Notify(PSTR("\r\nConnected to Device: "), 0x80);
873  for(int8_t i = 5; i > 0; i--) {
874  D_PrintHex<uint8_t > (disc_bdaddr[i], 0x80);
875  Notify(PSTR(":"), 0x80);
876  }
877  D_PrintHex<uint8_t > (disc_bdaddr[0], 0x80);
878 #endif
879  if(incomingPS4)
880  connectToHIDDevice = true; // We should always connect to the PS4 controller
881 
882  // Clear these flags for a new connection
883  l2capConnectionClaimed = false;
884  sdpConnectionClaimed = false;
885  rfcommConnectionClaimed = false;
886 
887  hci_event_flag = 0;
888  hci_state = HCI_DONE_STATE;
889  }
890  break;
891 
892  case HCI_DONE_STATE:
893  hci_counter++;
894  if(hci_counter > 1000) { // Wait until we have looped 1000 times to make sure that the L2CAP connection has been started
895  hci_counter = 0;
896  hci_state = HCI_SCANNING_STATE;
897  }
898  break;
899 
902 #ifdef DEBUG_USB_HOST
903  Notify(PSTR("\r\nHCI Disconnected from Device"), 0x80);
904 #endif
905  hci_event_flag = 0; // Clear all flags
906 
907  // Reset all buffers
908  memset(hcibuf, 0, BULK_MAXPKTSIZE);
909  memset(l2capinbuf, 0, BULK_MAXPKTSIZE);
910 
912  connectToHIDDevice = incomingHIDDevice = pairWithHIDDevice = checkRemoteName = false;
913  incomingPS4 = false;
914 
915  hci_state = HCI_SCANNING_STATE;
916  }
917  break;
918  default:
919  break;
920  }
921 }
922 
923 void BTD::ACL_event_task() {
924  uint16_t length = BULK_MAXPKTSIZE;
925  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_DATAIN_PIPE ].epAddr, &length, l2capinbuf, pollInterval); // Input on endpoint 2
926 
927  if(!rcode) { // Check for errors
928  if(length > 0) { // Check if any data was read
929  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++) {
930  if(btService[i])
931  btService[i]->ACLData(l2capinbuf);
932  }
933  }
934  }
935 #ifdef EXTRADEBUG
936  else if(rcode != hrNAK) {
937  Notify(PSTR("\r\nACL data in error: "), 0x80);
938  D_PrintHex<uint8_t > (rcode, 0x80);
939  }
940 #endif
941  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++)
942  if(btService[i])
943  btService[i]->Run();
944 }
945 
946 /************************************************************/
947 /* HCI Commands */
948 
949 /************************************************************/
950 void BTD::HCI_Command(uint8_t* data, uint16_t nbytes) {
952  pUsb->ctrlReq(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bmREQ_HCI_OUT, 0x00, 0x00, 0x00, 0x00, nbytes, nbytes, data, NULL);
953 }
954 
956  hci_event_flag = 0; // Clear all the flags
957  hcibuf[0] = 0x03; // HCI OCF = 3
958  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
959  hcibuf[2] = 0x00;
960 
961  HCI_Command(hcibuf, 3);
962 }
963 
966  hcibuf[0] = 0x1A; // HCI OCF = 1A
967  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
968  hcibuf[2] = 0x01; // parameter length = 1
969  if(btdName != NULL)
970  hcibuf[3] = 0x03; // Inquiry Scan enabled. Page Scan enabled.
971  else
972  hcibuf[3] = 0x02; // Inquiry Scan disabled. Page Scan enabled.
973 
974  HCI_Command(hcibuf, 4);
975 }
976 
978  hcibuf[0] = 0x1A; // HCI OCF = 1A
979  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
980  hcibuf[2] = 0x01; // parameter length = 1
981  hcibuf[3] = 0x00; // Inquiry Scan disabled. Page Scan disabled.
982 
983  HCI_Command(hcibuf, 4);
984 }
985 
988  hcibuf[0] = 0x09; // HCI OCF = 9
989  hcibuf[1] = 0x04 << 2; // HCI OGF = 4
990  hcibuf[2] = 0x00;
991 
992  HCI_Command(hcibuf, 3);
993 }
994 
997  hcibuf[0] = 0x01; // HCI OCF = 1
998  hcibuf[1] = 0x04 << 2; // HCI OGF = 4
999  hcibuf[2] = 0x00;
1000 
1001  HCI_Command(hcibuf, 3);
1002 }
1003 
1006  hcibuf[0] = 0x09; // HCI OCF = 9
1007  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1008  hcibuf[2] = 0x07; // parameter length 7
1009  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1010  hcibuf[4] = disc_bdaddr[1];
1011  hcibuf[5] = disc_bdaddr[2];
1012  hcibuf[6] = disc_bdaddr[3];
1013  hcibuf[7] = disc_bdaddr[4];
1014  hcibuf[8] = disc_bdaddr[5];
1015  hcibuf[9] = 0x00; // Switch role to master
1016 
1017  HCI_Command(hcibuf, 10);
1018 }
1019 
1022  hcibuf[0] = 0x19; // HCI OCF = 19
1023  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1024  hcibuf[2] = 0x0A; // parameter length = 10
1025  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1026  hcibuf[4] = disc_bdaddr[1];
1027  hcibuf[5] = disc_bdaddr[2];
1028  hcibuf[6] = disc_bdaddr[3];
1029  hcibuf[7] = disc_bdaddr[4];
1030  hcibuf[8] = disc_bdaddr[5];
1031  hcibuf[9] = 0x01; // Page Scan Repetition Mode
1032  hcibuf[10] = 0x00; // Reserved
1033  hcibuf[11] = 0x00; // Clock offset - low byte
1034  hcibuf[12] = 0x00; // Clock offset - high byte
1035 
1036  HCI_Command(hcibuf, 13);
1037 }
1038 
1039 void BTD::hci_set_local_name(const char* name) {
1040  hcibuf[0] = 0x13; // HCI OCF = 13
1041  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
1042  hcibuf[2] = strlen(name) + 1; // parameter length = the length of the string + end byte
1043  uint8_t i;
1044  for(i = 0; i < strlen(name); i++)
1045  hcibuf[i + 3] = name[i];
1046  hcibuf[i + 3] = 0x00; // End of string
1047 
1048  HCI_Command(hcibuf, 4 + strlen(name));
1049 }
1050 
1053  hcibuf[0] = 0x01;
1054  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1055  hcibuf[2] = 0x05; // Parameter Total Length = 5
1056  hcibuf[3] = 0x33; // LAP: Genera/Unlimited Inquiry Access Code (GIAC = 0x9E8B33) - see https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
1057  hcibuf[4] = 0x8B;
1058  hcibuf[5] = 0x9E;
1059  hcibuf[6] = 0x30; // Inquiry time = 61.44 sec (maximum)
1060  hcibuf[7] = 0x0A; // 10 number of responses
1061 
1062  HCI_Command(hcibuf, 8);
1063 }
1064 
1066  hcibuf[0] = 0x02;
1067  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1068  hcibuf[2] = 0x00; // Parameter Total Length = 0
1069 
1070  HCI_Command(hcibuf, 3);
1071 }
1072 
1074  hci_connect(disc_bdaddr); // Use last discovered device
1075 }
1076 
1077 void BTD::hci_connect(uint8_t *bdaddr) {
1079  hcibuf[0] = 0x05;
1080  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1081  hcibuf[2] = 0x0D; // parameter Total Length = 13
1082  hcibuf[3] = bdaddr[0]; // 6 octet bdaddr (LSB)
1083  hcibuf[4] = bdaddr[1];
1084  hcibuf[5] = bdaddr[2];
1085  hcibuf[6] = bdaddr[3];
1086  hcibuf[7] = bdaddr[4];
1087  hcibuf[8] = bdaddr[5];
1088  hcibuf[9] = 0x18; // DM1 or DH1 may be used
1089  hcibuf[10] = 0xCC; // DM3, DH3, DM5, DH5 may be used
1090  hcibuf[11] = 0x01; // Page repetition mode R1
1091  hcibuf[12] = 0x00; // Reserved
1092  hcibuf[13] = 0x00; // Clock offset
1093  hcibuf[14] = 0x00; // Invalid clock offset
1094  hcibuf[15] = 0x00; // Do not allow role switch
1095 
1096  HCI_Command(hcibuf, 16);
1097 }
1098 
1100  hcibuf[0] = 0x0D; // HCI OCF = 0D
1101  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1102  hcibuf[2] = 0x17; // parameter length 23
1103  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1104  hcibuf[4] = disc_bdaddr[1];
1105  hcibuf[5] = disc_bdaddr[2];
1106  hcibuf[6] = disc_bdaddr[3];
1107  hcibuf[7] = disc_bdaddr[4];
1108  hcibuf[8] = disc_bdaddr[5];
1109  if(pairWithWii) {
1110  hcibuf[9] = 6; // Pin length is the length of the Bluetooth address
1111  if(pairWiiUsingSync) {
1112 #ifdef DEBUG_USB_HOST
1113  Notify(PSTR("\r\nPairing with Wii controller via SYNC"), 0x80);
1114 #endif
1115  for(uint8_t i = 0; i < 6; i++)
1116  hcibuf[10 + i] = my_bdaddr[i]; // The pin is the Bluetooth dongles Bluetooth address backwards
1117  } else {
1118  for(uint8_t i = 0; i < 6; i++)
1119  hcibuf[10 + i] = disc_bdaddr[i]; // The pin is the Wiimote's Bluetooth address backwards
1120  }
1121  for(uint8_t i = 16; i < 26; i++)
1122  hcibuf[i] = 0x00; // The rest should be 0
1123  } else {
1124  hcibuf[9] = strlen(btdPin); // Length of pin
1125  uint8_t i;
1126  for(i = 0; i < strlen(btdPin); i++) // The maximum size of the pin is 16
1127  hcibuf[i + 10] = btdPin[i];
1128  for(; i < 16; i++)
1129  hcibuf[i + 10] = 0x00; // The rest should be 0
1130  }
1131 
1132  HCI_Command(hcibuf, 26);
1133 }
1134 
1136  hcibuf[0] = 0x0E; // HCI OCF = 0E
1137  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1138  hcibuf[2] = 0x06; // parameter length 6
1139  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1140  hcibuf[4] = disc_bdaddr[1];
1141  hcibuf[5] = disc_bdaddr[2];
1142  hcibuf[6] = disc_bdaddr[3];
1143  hcibuf[7] = disc_bdaddr[4];
1144  hcibuf[8] = disc_bdaddr[5];
1145 
1146  HCI_Command(hcibuf, 9);
1147 }
1148 
1150  hcibuf[0] = 0x0C; // HCI OCF = 0C
1151  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1152  hcibuf[2] = 0x06; // parameter length 6
1153  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1154  hcibuf[4] = disc_bdaddr[1];
1155  hcibuf[5] = disc_bdaddr[2];
1156  hcibuf[6] = disc_bdaddr[3];
1157  hcibuf[7] = disc_bdaddr[4];
1158  hcibuf[8] = disc_bdaddr[5];
1159 
1160  HCI_Command(hcibuf, 9);
1161 }
1162 
1164  hcibuf[0] = 0x11; // HCI OCF = 11
1165  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1166  hcibuf[2] = 0x02; // parameter length = 2
1167  hcibuf[3] = (uint8_t)(hci_handle & 0xFF); //connection handle - low byte
1168  hcibuf[4] = (uint8_t)((hci_handle >> 8) & 0x0F); //connection handle - high byte
1169 
1170  HCI_Command(hcibuf, 5);
1171 }
1172 
1173 void BTD::hci_disconnect(uint16_t handle) { // This is called by the different services
1175  hcibuf[0] = 0x06; // HCI OCF = 6
1176  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1177  hcibuf[2] = 0x03; // parameter length = 3
1178  hcibuf[3] = (uint8_t)(handle & 0xFF); //connection handle - low byte
1179  hcibuf[4] = (uint8_t)((handle >> 8) & 0x0F); //connection handle - high byte
1180  hcibuf[5] = 0x13; // reason
1181 
1182  HCI_Command(hcibuf, 6);
1183 }
1184 
1185 void BTD::hci_write_class_of_device() { // See http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html
1186  hcibuf[0] = 0x24; // HCI OCF = 24
1187  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
1188  hcibuf[2] = 0x03; // parameter length = 3
1189  hcibuf[3] = 0x04; // Robot
1190  hcibuf[4] = 0x08; // Toy
1191  hcibuf[5] = 0x00;
1192 
1193  HCI_Command(hcibuf, 6);
1194 }
1195 /*******************************************************************
1196  * *
1197  * HCI ACL Data Packet *
1198  * *
1199  * buf[0] buf[1] buf[2] buf[3]
1200  * 0 4 8 11 12 16 24 31 MSB
1201  * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1202  * | HCI Handle |PB |BC | Data Total Length | HCI ACL Data Packet
1203  * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1204  *
1205  * buf[4] buf[5] buf[6] buf[7]
1206  * 0 8 16 31 MSB
1207  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1208  * | Length | Channel ID | Basic L2CAP header
1209  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1210  *
1211  * buf[8] buf[9] buf[10] buf[11]
1212  * 0 8 16 31 MSB
1213  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1214  * | Code | Identifier | Length | Control frame (C-frame)
1215  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. (signaling packet format)
1216  */
1217 /************************************************************/
1218 /* L2CAP Commands */
1219 
1220 /************************************************************/
1221 void BTD::L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow, uint8_t channelHigh) {
1222  uint8_t buf[8 + nbytes];
1223  buf[0] = (uint8_t)(handle & 0xff); // HCI handle with PB,BC flag
1224  buf[1] = (uint8_t)(((handle >> 8) & 0x0f) | 0x20);
1225  buf[2] = (uint8_t)((4 + nbytes) & 0xff); // HCI ACL total data length
1226  buf[3] = (uint8_t)((4 + nbytes) >> 8);
1227  buf[4] = (uint8_t)(nbytes & 0xff); // L2CAP header: Length
1228  buf[5] = (uint8_t)(nbytes >> 8);
1229  buf[6] = channelLow;
1230  buf[7] = channelHigh;
1231 
1232  for(uint16_t i = 0; i < nbytes; i++) // L2CAP C-frame
1233  buf[8 + i] = data[i];
1234 
1235  uint8_t rcode = pUsb->outTransfer(bAddress, epInfo[ BTD_DATAOUT_PIPE ].epAddr, (8 + nbytes), buf);
1236  if(rcode) {
1237  delay(100); // This small delay prevents it from overflowing if it fails
1238 #ifdef DEBUG_USB_HOST
1239  Notify(PSTR("\r\nError sending L2CAP message: 0x"), 0x80);
1240  D_PrintHex<uint8_t > (rcode, 0x80);
1241  Notify(PSTR(" - Channel ID: "), 0x80);
1242  D_PrintHex<uint8_t > (channelHigh, 0x80);
1243  Notify(PSTR(" "), 0x80);
1244  D_PrintHex<uint8_t > (channelLow, 0x80);
1245 #endif
1246  }
1247 }
1248 
1249 void BTD::l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t* scid, uint16_t psm) {
1250  l2capoutbuf[0] = L2CAP_CMD_CONNECTION_REQUEST; // Code
1251  l2capoutbuf[1] = rxid; // Identifier
1252  l2capoutbuf[2] = 0x04; // Length
1253  l2capoutbuf[3] = 0x00;
1254  l2capoutbuf[4] = (uint8_t)(psm & 0xff); // PSM
1255  l2capoutbuf[5] = (uint8_t)(psm >> 8);
1256  l2capoutbuf[6] = scid[0]; // Source CID
1257  l2capoutbuf[7] = scid[1];
1258 
1259  L2CAP_Command(handle, l2capoutbuf, 8);
1260 }
1261 
1262 void BTD::l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid, uint8_t result) {
1263  l2capoutbuf[0] = L2CAP_CMD_CONNECTION_RESPONSE; // Code
1264  l2capoutbuf[1] = rxid; // Identifier
1265  l2capoutbuf[2] = 0x08; // Length
1266  l2capoutbuf[3] = 0x00;
1267  l2capoutbuf[4] = dcid[0]; // Destination CID
1268  l2capoutbuf[5] = dcid[1];
1269  l2capoutbuf[6] = scid[0]; // Source CID
1270  l2capoutbuf[7] = scid[1];
1271  l2capoutbuf[8] = result; // Result: Pending or Success
1272  l2capoutbuf[9] = 0x00;
1273  l2capoutbuf[10] = 0x00; // No further information
1274  l2capoutbuf[11] = 0x00;
1275 
1276  L2CAP_Command(handle, l2capoutbuf, 12);
1277 }
1278 
1279 void BTD::l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t* dcid) {
1280  l2capoutbuf[0] = L2CAP_CMD_CONFIG_REQUEST; // Code
1281  l2capoutbuf[1] = rxid; // Identifier
1282  l2capoutbuf[2] = 0x08; // Length
1283  l2capoutbuf[3] = 0x00;
1284  l2capoutbuf[4] = dcid[0]; // Destination CID
1285  l2capoutbuf[5] = dcid[1];
1286  l2capoutbuf[6] = 0x00; // Flags
1287  l2capoutbuf[7] = 0x00;
1288  l2capoutbuf[8] = 0x01; // Config Opt: type = MTU (Maximum Transmission Unit) - Hint
1289  l2capoutbuf[9] = 0x02; // Config Opt: length
1290  l2capoutbuf[10] = 0xFF; // MTU
1291  l2capoutbuf[11] = 0xFF;
1292 
1293  L2CAP_Command(handle, l2capoutbuf, 12);
1294 }
1295 
1296 void BTD::l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t* scid) {
1297  l2capoutbuf[0] = L2CAP_CMD_CONFIG_RESPONSE; // Code
1298  l2capoutbuf[1] = rxid; // Identifier
1299  l2capoutbuf[2] = 0x0A; // Length
1300  l2capoutbuf[3] = 0x00;
1301  l2capoutbuf[4] = scid[0]; // Source CID
1302  l2capoutbuf[5] = scid[1];
1303  l2capoutbuf[6] = 0x00; // Flag
1304  l2capoutbuf[7] = 0x00;
1305  l2capoutbuf[8] = 0x00; // Result
1306  l2capoutbuf[9] = 0x00;
1307  l2capoutbuf[10] = 0x01; // Config
1308  l2capoutbuf[11] = 0x02;
1309  l2capoutbuf[12] = 0xA0;
1310  l2capoutbuf[13] = 0x02;
1311 
1312  L2CAP_Command(handle, l2capoutbuf, 14);
1313 }
1314 
1315 void BTD::l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid) {
1316  l2capoutbuf[0] = L2CAP_CMD_DISCONNECT_REQUEST; // Code
1317  l2capoutbuf[1] = rxid; // Identifier
1318  l2capoutbuf[2] = 0x04; // Length
1319  l2capoutbuf[3] = 0x00;
1320  l2capoutbuf[4] = dcid[0];
1321  l2capoutbuf[5] = dcid[1];
1322  l2capoutbuf[6] = scid[0];
1323  l2capoutbuf[7] = scid[1];
1324 
1325  L2CAP_Command(handle, l2capoutbuf, 8);
1326 }
1327 
1328 void BTD::l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid) {
1329  l2capoutbuf[0] = L2CAP_CMD_DISCONNECT_RESPONSE; // Code
1330  l2capoutbuf[1] = rxid; // Identifier
1331  l2capoutbuf[2] = 0x04; // Length
1332  l2capoutbuf[3] = 0x00;
1333  l2capoutbuf[4] = dcid[0];
1334  l2capoutbuf[5] = dcid[1];
1335  l2capoutbuf[6] = scid[0];
1336  l2capoutbuf[7] = scid[1];
1337 
1338  L2CAP_Command(handle, l2capoutbuf, 8);
1339 }
1340 
1341 void BTD::l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh) {
1342  l2capoutbuf[0] = L2CAP_CMD_INFORMATION_RESPONSE; // Code
1343  l2capoutbuf[1] = rxid; // Identifier
1344  l2capoutbuf[2] = 0x08; // Length
1345  l2capoutbuf[3] = 0x00;
1346  l2capoutbuf[4] = infoTypeLow;
1347  l2capoutbuf[5] = infoTypeHigh;
1348  l2capoutbuf[6] = 0x00; // Result = success
1349  l2capoutbuf[7] = 0x00; // Result = success
1350  l2capoutbuf[8] = 0x00;
1351  l2capoutbuf[9] = 0x00;
1352  l2capoutbuf[10] = 0x00;
1353  l2capoutbuf[11] = 0x00;
1354 
1355  L2CAP_Command(handle, l2capoutbuf, 12);
1356 }
1357 
1358 /* PS3 Commands - only set Bluetooth address is implemented in this library */
1359 void BTD::setBdaddr(uint8_t* bdaddr) {
1360  /* Set the internal Bluetooth address */
1361  uint8_t buf[8];
1362  buf[0] = 0x01;
1363  buf[1] = 0x00;
1364 
1365  for(uint8_t i = 0; i < 6; i++)
1366  buf[i + 2] = bdaddr[5 - i]; // Copy into buffer, has to be written reversed, so it is MSB first
1367 
1368  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF5), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
1369  pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
1370 }
1371 
1372 void BTD::setMoveBdaddr(uint8_t* bdaddr) {
1373  /* Set the internal Bluetooth address */
1374  uint8_t buf[11];
1375  buf[0] = 0x05;
1376  buf[7] = 0x10;
1377  buf[8] = 0x01;
1378  buf[9] = 0x02;
1379  buf[10] = 0x12;
1380 
1381  for(uint8_t i = 0; i < 6; i++)
1382  buf[i + 1] = bdaddr[i];
1383 
1384  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x05), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
1385  pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
1386 }
static const uint8_t BTD_DATAOUT_PIPE
Definition: BTD.h:521
-
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
-
uint8_t bmRcvToggle
Definition: address.h:41
-
bool incomingWii
Definition: BTD.h:471
- -
void hci_connect()
Definition: BTD.cpp:1073
-
uint8_t bNumEP
Definition: BTD.h:510
-
EpInfo * epinfo
Definition: address.h:76
-
const char * btdName
Definition: BTD.h:444
-
void hci_reset()
Definition: BTD.cpp:955
-
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1262
-
#define HCI_SCANNING_STATE
Definition: BTD.h:52
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
Definition: BTD.cpp:1249
-
#define EV_COMMAND_STATUS
Definition: BTD.h:96
-
#define EV_REMOTE_NAME_COMPLETE
Definition: BTD.h:83
-
uint8_t bmNakPower
Definition: address.h:42
-
bool sdpConnectionClaimed
Definition: BTD.h:439
-
#define bmREQ_HCI_OUT
Definition: BTD.h:37
-
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1315
- -
bool rfcommConnectionClaimed
Definition: BTD.h:441
-
uint8_t hci_version
Definition: BTD.h:461
- -
#define EV_INQUIRY_COMPLETE
Definition: BTD.h:77
-
void hci_inquiry()
Definition: BTD.cpp:1051
-
static const uint8_t BTD_EVENT_PIPE
Definition: BTD.h:517
+Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "BTD.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 
22 const uint8_t BTD::BTD_CONTROL_PIPE = 0;
23 const uint8_t BTD::BTD_EVENT_PIPE = 1;
24 const uint8_t BTD::BTD_DATAIN_PIPE = 2;
25 const uint8_t BTD::BTD_DATAOUT_PIPE = 3;
26 
28 connectToWii(false),
29 pairWithWii(false),
30 connectToHIDDevice(false),
31 pairWithHIDDevice(false),
32 pUsb(p), // Pointer to USB class instance - mandatory
33 bAddress(0), // Device address - mandatory
34 bNumEP(1), // If config descriptor needs to be parsed
35 qNextPollTime(0), // Reset NextPollTime
36 pollInterval(0),
37 bPollEnable(false) // Don't start polling before dongle is connected
38 {
39  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++)
40  btService[i] = NULL;
41 
42  Initialize(); // Set all variables, endpoint structs etc. to default values
43 
44  if(pUsb) // Register in USB subsystem
45  pUsb->RegisterDeviceClass(this); // Set devConfig[] entry
46 }
47 
48 uint8_t BTD::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
49  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
50  uint8_t buf[constBufSize];
51  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
52  uint8_t rcode;
53  UsbDevice *p = NULL;
54  EpInfo *oldep_ptr = NULL;
55 
56  Initialize(); // Set all variables, endpoint structs etc. to default values
57 
58  AddressPool &addrPool = pUsb->GetAddressPool(); // Get memory address of USB device address pool
59 #ifdef EXTRADEBUG
60  Notify(PSTR("\r\nBTD ConfigureDevice"), 0x80);
61 #endif
62 
63  if(bAddress) { // Check if address has already been assigned to an instance
64 #ifdef DEBUG_USB_HOST
65  Notify(PSTR("\r\nAddress in use"), 0x80);
66 #endif
68  }
69 
70  p = addrPool.GetUsbDevicePtr(0); // Get pointer to pseudo device with address 0 assigned
71  if(!p) {
72 #ifdef DEBUG_USB_HOST
73  Notify(PSTR("\r\nAddress not found"), 0x80);
74 #endif
76  }
77 
78  if(!p->epinfo) {
79 #ifdef DEBUG_USB_HOST
80  Notify(PSTR("\r\nepinfo is null"), 0x80);
81 #endif
83  }
84 
85  oldep_ptr = p->epinfo; // Save old pointer to EP_RECORD of address 0
86  p->epinfo = epInfo; // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
87  p->lowspeed = lowspeed;
88  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
89 
90  p->epinfo = oldep_ptr; // Restore p->epinfo
91 
92  if(rcode)
93  goto FailGetDevDescr;
94 
95  bAddress = addrPool.AllocAddress(parent, false, port); // Allocate new address according to device class
96 
97  if(!bAddress) {
98 #ifdef DEBUG_USB_HOST
99  Notify(PSTR("\r\nOut of address space"), 0x80);
100 #endif
102  }
103 
104  if (udd->bDeviceClass == 0x09) // Some dongles have an USB hub inside
105  goto FailHub;
106 
107  epInfo[0].maxPktSize = udd->bMaxPacketSize0; // Extract Max Packet Size from device descriptor
108  epInfo[1].epAddr = udd->bNumConfigurations; // Steal and abuse from epInfo structure to save memory
109 
110  VID = udd->idVendor;
111  PID = udd->idProduct;
112 
114 
115 FailHub:
116 #ifdef DEBUG_USB_HOST
117  Notify(PSTR("\r\nPlease create a hub instance in your code: \"USBHub Hub1(&Usb);\""), 0x80);
118 #endif
119  pUsb->setAddr(bAddress, 0, 0); // Reset address
121  Release();
122  return rcode;
123 
124 FailGetDevDescr:
125 #ifdef DEBUG_USB_HOST
126  NotifyFailGetDevDescr(rcode);
127 #endif
128  if(rcode != hrJERR)
130  Release();
131  return rcode;
132 };
133 
134 uint8_t BTD::Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed) {
135  uint8_t rcode;
136  uint8_t num_of_conf = epInfo[1].epAddr; // Number of configurations
137  epInfo[1].epAddr = 0;
138 
139  AddressPool &addrPool = pUsb->GetAddressPool();
140 #ifdef EXTRADEBUG
141  Notify(PSTR("\r\nBTD Init"), 0x80);
142 #endif
143  UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
144 
145  if(!p) {
146 #ifdef DEBUG_USB_HOST
147  Notify(PSTR("\r\nAddress not found"), 0x80);
148 #endif
150  }
151 
152  delay(300); // Assign new address to the device
153 
154  rcode = pUsb->setAddr(0, 0, bAddress); // Assign new address to the device
155  if(rcode) {
156 #ifdef DEBUG_USB_HOST
157  Notify(PSTR("\r\nsetAddr: "), 0x80);
158  D_PrintHex<uint8_t > (rcode, 0x80);
159 #endif
160  p->lowspeed = false;
161  goto Fail;
162  }
163 #ifdef EXTRADEBUG
164  Notify(PSTR("\r\nAddr: "), 0x80);
165  D_PrintHex<uint8_t > (bAddress, 0x80);
166 #endif
167 
168  p->lowspeed = false;
169 
170  p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
171  if(!p) {
172 #ifdef DEBUG_USB_HOST
173  Notify(PSTR("\r\nAddress not found"), 0x80);
174 #endif
176  }
177 
178  p->lowspeed = lowspeed;
179 
180  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo); // Assign epInfo to epinfo pointer - only EP0 is known
181  if(rcode)
182  goto FailSetDevTblEntry;
183 
184  if(VID == PS3_VID && (PID == PS3_PID || PID == PS3NAVIGATION_PID || PID == PS3MOVE_PID)) {
185  delay(100);
186  rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 1); // We only need the Control endpoint, so we don't have to initialize the other endpoints of device
187  if(rcode)
188  goto FailSetConfDescr;
189 
190 #ifdef DEBUG_USB_HOST
191  if(PID == PS3_PID || PID == PS3NAVIGATION_PID) {
192  if(PID == PS3_PID)
193  Notify(PSTR("\r\nDualshock 3 Controller Connected"), 0x80);
194  else // It must be a navigation controller
195  Notify(PSTR("\r\nNavigation Controller Connected"), 0x80);
196  } else // It must be a Motion controller
197  Notify(PSTR("\r\nMotion Controller Connected"), 0x80);
198 #endif
199 
200  if(my_bdaddr[0] == 0x00 && my_bdaddr[1] == 0x00 && my_bdaddr[2] == 0x00 && my_bdaddr[3] == 0x00 && my_bdaddr[4] == 0x00 && my_bdaddr[5] == 0x00) {
201 #ifdef DEBUG_USB_HOST
202  Notify(PSTR("\r\nPlease plug in the dongle before trying to pair with the PS3 Controller\r\nor set the Bluetooth address in the constructor of the PS3BT class"), 0x80);
203 #endif
204  } else {
205  if(PID == PS3_PID || PID == PS3NAVIGATION_PID)
206  setBdaddr(my_bdaddr); // Set internal Bluetooth address
207  else
208  setMoveBdaddr(my_bdaddr); // Set internal Bluetooth address
209 #ifdef DEBUG_USB_HOST
210  Notify(PSTR("\r\nBluetooth Address was set to: "), 0x80);
211  for(int8_t i = 5; i > 0; i--) {
212  D_PrintHex<uint8_t > (my_bdaddr[i], 0x80);
213  Notify(PSTR(":"), 0x80);
214  }
215  D_PrintHex<uint8_t > (my_bdaddr[0], 0x80);
216 #endif
217  }
218 
219  pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 0); // Reset configuration value
220  pUsb->setAddr(bAddress, 0, 0); // Reset address
221  Release(); // Release device
223  } else {
224  // Check if attached device is a Bluetooth dongle and fill endpoint data structure
225  // First interface in the configuration must have Bluetooth assigned Class/Subclass/Protocol
226  // And 3 endpoints - interrupt-IN, bulk-IN, bulk-OUT, not necessarily in this order
227  for(uint8_t i = 0; i < num_of_conf; i++) {
228  if((VID == IOGEAR_GBU521_VID && PID == IOGEAR_GBU521_PID) || (VID == BELKIN_F8T065BF_VID && PID == BELKIN_F8T065BF_PID)) {
229  ConfigDescParser<USB_CLASS_VENDOR_SPECIFIC, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this); // Workaround issue with some dongles
230  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
231  } else {
232  ConfigDescParser<USB_CLASS_WIRELESS_CTRL, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this); // Set class id according to the specification
233  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
234  }
235  if(rcode) // Check error code
236  goto FailGetConfDescr;
237  if(bNumEP >= BTD_MAX_ENDPOINTS) // All endpoints extracted
238  break;
239  }
240 
242  goto FailUnknownDevice;
243 
244  // Assign epInfo to epinfo pointer - this time all 3 endpoins
246  if(rcode)
247  goto FailSetDevTblEntry;
248 
249  // Set Configuration Value
250  rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum);
251  if(rcode)
252  goto FailSetConfDescr;
253 
254  hci_num_reset_loops = 100; // only loop 100 times before trying to send the hci reset command
255  hci_counter = 0;
256  hci_state = HCI_INIT_STATE;
257  waitingForConnection = false;
258  bPollEnable = true;
259 
260 #ifdef DEBUG_USB_HOST
261  Notify(PSTR("\r\nBluetooth Dongle Initialized"), 0x80);
262 #endif
263  }
264  return 0; // Successful configuration
265 
266  /* Diagnostic messages */
267 FailSetDevTblEntry:
268 #ifdef DEBUG_USB_HOST
270  goto Fail;
271 #endif
272 
273 FailGetConfDescr:
274 #ifdef DEBUG_USB_HOST
276  goto Fail;
277 #endif
278 
279 FailSetConfDescr:
280 #ifdef DEBUG_USB_HOST
282 #endif
283  goto Fail;
284 
285 FailUnknownDevice:
286 #ifdef DEBUG_USB_HOST
287  NotifyFailUnknownDevice(VID, PID);
288 #endif
289  pUsb->setAddr(bAddress, 0, 0); // Reset address
291 Fail:
292 #ifdef DEBUG_USB_HOST
293  Notify(PSTR("\r\nBTD Init Failed, error code: "), 0x80);
294  NotifyFail(rcode);
295 #endif
296  Release();
297  return rcode;
298 }
299 
300 void BTD::Initialize() {
301  uint8_t i;
302  for(i = 0; i < BTD_MAX_ENDPOINTS; i++) {
303  epInfo[i].epAddr = 0;
304  epInfo[i].maxPktSize = (i) ? 0 : 8;
305  epInfo[i].bmSndToggle = 0;
306  epInfo[i].bmRcvToggle = 0;
308  }
309  for(i = 0; i < BTD_NUM_SERVICES; i++) {
310  if(btService[i])
311  btService[i]->Reset(); // Reset all Bluetooth services
312  }
313 
314  connectToWii = false;
315  incomingWii = false;
316  connectToHIDDevice = false;
317  incomingHIDDevice = false;
318  incomingPS4 = false;
319  bAddress = 0; // Clear device address
320  bNumEP = 1; // Must have to be reset to 1
321  qNextPollTime = 0; // Reset next poll time
322  pollInterval = 0;
323  bPollEnable = false; // Don't start polling before dongle is connected
324 }
325 
326 /* Extracts interrupt-IN, bulk-IN, bulk-OUT endpoint information from config descriptor */
327 void BTD::EndpointXtract(uint8_t conf, uint8_t iface __attribute__((unused)), uint8_t alt, uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *pep) {
328  //ErrorMessage<uint8_t>(PSTR("Conf.Val"),conf);
329  //ErrorMessage<uint8_t>(PSTR("Iface Num"),iface);
330  //ErrorMessage<uint8_t>(PSTR("Alt.Set"),alt);
331 
332  if(alt) // Wrong interface - by BT spec, no alt setting
333  return;
334 
335  bConfNum = conf;
336  uint8_t index;
337 
338  if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80) { // Interrupt In endpoint found
339  index = BTD_EVENT_PIPE;
341  } else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) // Bulk endpoint found
342  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? BTD_DATAIN_PIPE : BTD_DATAOUT_PIPE;
343  else
344  return;
345 
346  // Fill the rest of endpoint data structure
347  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
348  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
349 #ifdef EXTRADEBUG
351 #endif
352  if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
353  pollInterval = pep->bInterval;
354  bNumEP++;
355 }
356 
357 void BTD::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr __attribute__((unused))) {
358 #ifdef EXTRADEBUG
359  Notify(PSTR("\r\nEndpoint descriptor:"), 0x80);
360  Notify(PSTR("\r\nLength:\t\t"), 0x80);
361  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
362  Notify(PSTR("\r\nType:\t\t"), 0x80);
363  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
364  Notify(PSTR("\r\nAddress:\t"), 0x80);
365  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
366  Notify(PSTR("\r\nAttributes:\t"), 0x80);
367  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
368  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
369  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
370  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
371  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
372 #endif
373 }
374 
375 /* Performs a cleanup after failed Init() attempt */
376 uint8_t BTD::Release() {
377  Initialize(); // Set all variables, endpoint structs etc. to default values
379  return 0;
380 }
381 
382 uint8_t BTD::Poll() {
383  if(!bPollEnable)
384  return 0;
385  if((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L) { // Don't poll if shorter than polling interval
386  qNextPollTime = (uint32_t)millis() + pollInterval; // Set new poll time
387  HCI_event_task(); // Poll the HCI event pipe
388  HCI_task(); // HCI state machine
389  ACL_event_task(); // Poll the ACL input pipe too
390  }
391  return 0;
392 }
393 
395  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++)
396  if(btService[i])
397  btService[i]->disconnect();
398 };
399 
400 void BTD::HCI_event_task() {
401  uint16_t length = BULK_MAXPKTSIZE; // Request more than 16 bytes anyway, the inTransfer routine will take care of this
402  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_EVENT_PIPE ].epAddr, &length, hcibuf, pollInterval); // Input on endpoint 1
403 
404  if(!rcode || rcode == hrNAK) { // Check for errors
405  switch(hcibuf[0]) { // Switch on event type
406  case EV_COMMAND_COMPLETE:
407  if(!hcibuf[5]) { // Check if command succeeded
408  hci_set_flag(HCI_FLAG_CMD_COMPLETE); // Set command complete flag
409  if((hcibuf[3] == 0x01) && (hcibuf[4] == 0x10)) { // Parameters from read local version information
410  hci_version = hcibuf[6]; // Used to check if it supports 2.0+EDR - see http://www.bluetooth.org/Technical/AssignedNumbers/hci.htm
412  } else if((hcibuf[3] == 0x09) && (hcibuf[4] == 0x10)) { // Parameters from read local bluetooth address
413  for(uint8_t i = 0; i < 6; i++)
414  my_bdaddr[i] = hcibuf[6 + i];
416  }
417  }
418  break;
419 
420  case EV_COMMAND_STATUS:
421  if(hcibuf[2]) { // Show status on serial if not OK
422 #ifdef DEBUG_USB_HOST
423  Notify(PSTR("\r\nHCI Command Failed: "), 0x80);
424  D_PrintHex<uint8_t > (hcibuf[2], 0x80);
425 #endif
426  }
427  break;
428 
429  case EV_INQUIRY_COMPLETE:
430  if(inquiry_counter >= 5 && (pairWithWii || pairWithHIDDevice)) {
431  inquiry_counter = 0;
432 #ifdef DEBUG_USB_HOST
433  if(pairWithWii)
434  Notify(PSTR("\r\nCouldn't find Wiimote"), 0x80);
435  else
436  Notify(PSTR("\r\nCouldn't find HID device"), 0x80);
437 #endif
438  connectToWii = false;
439  pairWithWii = false;
440  connectToHIDDevice = false;
441  pairWithHIDDevice = false;
442  hci_state = HCI_SCANNING_STATE;
443  }
444  inquiry_counter++;
445  break;
446 
447  case EV_INQUIRY_RESULT:
448  if(hcibuf[2]) { // Check that there is more than zero responses
449 #ifdef EXTRADEBUG
450  Notify(PSTR("\r\nNumber of responses: "), 0x80);
451  Notify(hcibuf[2], 0x80);
452 #endif
453  for(uint8_t i = 0; i < hcibuf[2]; i++) {
454  uint8_t offset = 8 * hcibuf[2] + 3 * i;
455 
456  for(uint8_t j = 0; j < 3; j++)
457  classOfDevice[j] = hcibuf[j + 4 + offset];
458 
459 #ifdef EXTRADEBUG
460  Notify(PSTR("\r\nClass of device: "), 0x80);
461  D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
462  Notify(PSTR(" "), 0x80);
463  D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
464  Notify(PSTR(" "), 0x80);
465  D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
466 #endif
467 
468  if(pairWithWii && classOfDevice[2] == 0x00 && (classOfDevice[1] & 0x05) && (classOfDevice[0] & 0x0C)) { // See http://wiibrew.org/wiki/Wiimote#SDP_information
469  checkRemoteName = true; // Check remote name to distinguish between the different controllers
470 
471  for(uint8_t j = 0; j < 6; j++)
472  disc_bdaddr[j] = hcibuf[j + 3 + 6 * i];
473 
475  break;
476  } else if(pairWithHIDDevice && (classOfDevice[1] & 0x05) && (classOfDevice[0] & 0xC8)) { // Check if it is a mouse, keyboard or a gamepad - see: http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html
477 #ifdef DEBUG_USB_HOST
478  if(classOfDevice[0] & 0x80)
479  Notify(PSTR("\r\nMouse found"), 0x80);
480  if(classOfDevice[0] & 0x40)
481  Notify(PSTR("\r\nKeyboard found"), 0x80);
482  if(classOfDevice[0] & 0x08)
483  Notify(PSTR("\r\nGamepad found"), 0x80);
484 #endif
485 
486  for(uint8_t j = 0; j < 6; j++)
487  disc_bdaddr[j] = hcibuf[j + 3 + 6 * i];
488 
490  break;
491  }
492  }
493  }
494  break;
495 
496  case EV_CONNECT_COMPLETE:
498  if(!hcibuf[2]) { // Check if connected OK
499 #ifdef EXTRADEBUG
500  Notify(PSTR("\r\nConnection established"), 0x80);
501 #endif
502  hci_handle = hcibuf[3] | ((hcibuf[4] & 0x0F) << 8); // Store the handle for the ACL connection
503  hci_set_flag(HCI_FLAG_CONNECT_COMPLETE); // Set connection complete flag
504  } else {
505  hci_state = HCI_CHECK_DEVICE_SERVICE;
506 #ifdef DEBUG_USB_HOST
507  Notify(PSTR("\r\nConnection Failed: "), 0x80);
508  D_PrintHex<uint8_t > (hcibuf[2], 0x80);
509 #endif
510  }
511  break;
512 
514  if(!hcibuf[2]) { // Check if disconnected OK
515  hci_set_flag(HCI_FLAG_DISCONNECT_COMPLETE); // Set disconnect command complete flag
516  hci_clear_flag(HCI_FLAG_CONNECT_COMPLETE); // Clear connection complete flag
517  }
518  break;
519 
521  if(!hcibuf[2]) { // Check if reading is OK
522  for(uint8_t i = 0; i < min(sizeof (remote_name), sizeof (hcibuf) - 9); i++) {
523  remote_name[i] = hcibuf[9 + i];
524  if(remote_name[i] == '\0') // End of string
525  break;
526  }
527  // TODO: Altid sæt '\0' i remote name!
529  }
530  break;
531 
532  case EV_INCOMING_CONNECT:
533  for(uint8_t i = 0; i < 6; i++)
534  disc_bdaddr[i] = hcibuf[i + 2];
535 
536  for(uint8_t i = 0; i < 3; i++)
537  classOfDevice[i] = hcibuf[i + 8];
538 
539  if((classOfDevice[1] & 0x05) && (classOfDevice[0] & 0xC8)) { // Check if it is a mouse, keyboard or a gamepad
540 #ifdef DEBUG_USB_HOST
541  if(classOfDevice[0] & 0x80)
542  Notify(PSTR("\r\nMouse is connecting"), 0x80);
543  if(classOfDevice[0] & 0x40)
544  Notify(PSTR("\r\nKeyboard is connecting"), 0x80);
545  if(classOfDevice[0] & 0x08)
546  Notify(PSTR("\r\nGamepad is connecting"), 0x80);
547 #endif
548  incomingHIDDevice = true;
549  }
550 
551 #ifdef EXTRADEBUG
552  Notify(PSTR("\r\nClass of device: "), 0x80);
553  D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
554  Notify(PSTR(" "), 0x80);
555  D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
556  Notify(PSTR(" "), 0x80);
557  D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
558 #endif
560  break;
561 
562  case EV_PIN_CODE_REQUEST:
563  if(pairWithWii) {
564 #ifdef DEBUG_USB_HOST
565  Notify(PSTR("\r\nPairing with Wiimote"), 0x80);
566 #endif
568  } else if(btdPin != NULL) {
569 #ifdef DEBUG_USB_HOST
570  Notify(PSTR("\r\nBluetooth pin is set too: "), 0x80);
571  NotifyStr(btdPin, 0x80);
572 #endif
574  } else {
575 #ifdef DEBUG_USB_HOST
576  Notify(PSTR("\r\nNo pin was set"), 0x80);
577 #endif
579  }
580  break;
581 
582  case EV_LINK_KEY_REQUEST:
583 #ifdef DEBUG_USB_HOST
584  Notify(PSTR("\r\nReceived Key Request"), 0x80);
585 #endif
587  break;
588 
590  if(!hcibuf[2]) { // Check if pairing was successful
591  if(pairWithWii && !connectToWii) {
592 #ifdef DEBUG_USB_HOST
593  Notify(PSTR("\r\nPairing successful with Wiimote"), 0x80);
594 #endif
595  connectToWii = true; // Used to indicate to the Wii service, that it should connect to this device
596  } else if(pairWithHIDDevice && !connectToHIDDevice) {
597 #ifdef DEBUG_USB_HOST
598  Notify(PSTR("\r\nPairing successful with HID device"), 0x80);
599 #endif
600  connectToHIDDevice = true; // Used to indicate to the BTHID service, that it should connect to this device
601  }
602  } else {
603 #ifdef DEBUG_USB_HOST
604  Notify(PSTR("\r\nPairing Failed: "), 0x80);
605  D_PrintHex<uint8_t > (hcibuf[2], 0x80);
606 #endif
608  hci_state = HCI_DISCONNECT_STATE;
609  }
610  break;
611  /* We will just ignore the following events */
612  case EV_NUM_COMPLETE_PKT:
613  case EV_ROLE_CHANGED:
615  case EV_LOOPBACK_COMMAND:
618  case EV_MAX_SLOTS_CHANGE:
623  break;
624 #ifdef EXTRADEBUG
625  default:
626  if(hcibuf[0] != 0x00) {
627  Notify(PSTR("\r\nUnmanaged HCI Event: "), 0x80);
628  D_PrintHex<uint8_t > (hcibuf[0], 0x80);
629  }
630  break;
631 #endif
632  } // Switch
633  }
634 #ifdef EXTRADEBUG
635  else {
636  Notify(PSTR("\r\nHCI event error: "), 0x80);
637  D_PrintHex<uint8_t > (rcode, 0x80);
638  }
639 #endif
640 }
641 
642 /* Poll Bluetooth and print result */
643 void BTD::HCI_task() {
644  switch(hci_state) {
645  case HCI_INIT_STATE:
646  hci_counter++;
647  if(hci_counter > hci_num_reset_loops) { // wait until we have looped x times to clear any old events
648  hci_reset();
649  hci_state = HCI_RESET_STATE;
650  hci_counter = 0;
651  }
652  break;
653 
654  case HCI_RESET_STATE:
655  hci_counter++;
657  hci_counter = 0;
658 #ifdef DEBUG_USB_HOST
659  Notify(PSTR("\r\nHCI Reset complete"), 0x80);
660 #endif
661  hci_state = HCI_CLASS_STATE;
663  } else if(hci_counter > hci_num_reset_loops) {
664  hci_num_reset_loops *= 10;
665  if(hci_num_reset_loops > 2000)
666  hci_num_reset_loops = 2000;
667 #ifdef DEBUG_USB_HOST
668  Notify(PSTR("\r\nNo response to HCI Reset"), 0x80);
669 #endif
670  hci_state = HCI_INIT_STATE;
671  hci_counter = 0;
672  }
673  break;
674 
675  case HCI_CLASS_STATE:
677 #ifdef DEBUG_USB_HOST
678  Notify(PSTR("\r\nWrite class of device"), 0x80);
679 #endif
680  hci_state = HCI_BDADDR_STATE;
681  hci_read_bdaddr();
682  }
683  break;
684 
685  case HCI_BDADDR_STATE:
687 #ifdef DEBUG_USB_HOST
688  Notify(PSTR("\r\nLocal Bluetooth Address: "), 0x80);
689  for(int8_t i = 5; i > 0; i--) {
690  D_PrintHex<uint8_t > (my_bdaddr[i], 0x80);
691  Notify(PSTR(":"), 0x80);
692  }
693  D_PrintHex<uint8_t > (my_bdaddr[0], 0x80);
694 #endif
696  hci_state = HCI_LOCAL_VERSION_STATE;
697  }
698  break;
699 
700  case HCI_LOCAL_VERSION_STATE: // The local version is used by the PS3BT class
702  if(btdName != NULL) {
704  hci_state = HCI_SET_NAME_STATE;
705  } else
706  hci_state = HCI_CHECK_DEVICE_SERVICE;
707  }
708  break;
709 
710  case HCI_SET_NAME_STATE:
712 #ifdef DEBUG_USB_HOST
713  Notify(PSTR("\r\nThe name is set to: "), 0x80);
714  NotifyStr(btdName, 0x80);
715 #endif
716  hci_state = HCI_CHECK_DEVICE_SERVICE;
717  }
718  break;
719 
721  if(pairWithHIDDevice || pairWithWii) { // Check if it should try to connect to a Wiimote
722 #ifdef DEBUG_USB_HOST
723  if(pairWithWii)
724  Notify(PSTR("\r\nStarting inquiry\r\nPress 1 & 2 on the Wiimote\r\nOr press the SYNC button if you are using a Wii U Pro Controller or a Wii Balance Board"), 0x80);
725  else
726  Notify(PSTR("\r\nPlease enable discovery of your device"), 0x80);
727 #endif
728  hci_inquiry();
729  hci_state = HCI_INQUIRY_STATE;
730  } else
731  hci_state = HCI_SCANNING_STATE; // Don't try to connect to a Wiimote
732  break;
733 
734  case HCI_INQUIRY_STATE:
736  hci_inquiry_cancel(); // Stop inquiry
737 #ifdef DEBUG_USB_HOST
738  if(pairWithWii)
739  Notify(PSTR("\r\nWiimote found"), 0x80);
740  else
741  Notify(PSTR("\r\nHID device found"), 0x80);
742 
743  Notify(PSTR("\r\nNow just create the instance like so:"), 0x80);
744  if(pairWithWii)
745  Notify(PSTR("\r\nWII Wii(&Btd);"), 0x80);
746  else
747  Notify(PSTR("\r\nBTHID bthid(&Btd);"), 0x80);
748 
749  Notify(PSTR("\r\nAnd then press any button on the "), 0x80);
750  if(pairWithWii)
751  Notify(PSTR("Wiimote"), 0x80);
752  else
753  Notify(PSTR("device"), 0x80);
754 #endif
755  if(checkRemoteName) {
756  hci_remote_name(); // We need to know the name to distinguish between the Wiimote, the new Wiimote with Motion Plus inside, a Wii U Pro Controller and a Wii Balance Board
757  hci_state = HCI_REMOTE_NAME_STATE;
758  } else
759  hci_state = HCI_CONNECT_DEVICE_STATE;
760  }
761  break;
762 
765 #ifdef DEBUG_USB_HOST
766  if(pairWithWii)
767  Notify(PSTR("\r\nConnecting to Wiimote"), 0x80);
768  else
769  Notify(PSTR("\r\nConnecting to HID device"), 0x80);
770 #endif
771  checkRemoteName = false;
772  hci_connect();
773  hci_state = HCI_CONNECTED_DEVICE_STATE;
774  }
775  break;
776 
780 #ifdef DEBUG_USB_HOST
781  if(pairWithWii)
782  Notify(PSTR("\r\nConnected to Wiimote"), 0x80);
783  else
784  Notify(PSTR("\r\nConnected to HID device"), 0x80);
785 #endif
786  hci_authentication_request(); // This will start the pairing with the Wiimote
787  hci_state = HCI_SCANNING_STATE;
788  } else {
789 #ifdef DEBUG_USB_HOST
790  Notify(PSTR("\r\nTrying to connect one more time..."), 0x80);
791 #endif
792  hci_connect(); // Try to connect one more time
793  }
794  }
795  break;
796 
797  case HCI_SCANNING_STATE:
799 #ifdef DEBUG_USB_HOST
800  Notify(PSTR("\r\nWait For Incoming Connection Request"), 0x80);
801 #endif
803  waitingForConnection = true;
804  hci_state = HCI_CONNECT_IN_STATE;
805  }
806  break;
807 
810  waitingForConnection = false;
811 #ifdef DEBUG_USB_HOST
812  Notify(PSTR("\r\nIncoming Connection Request"), 0x80);
813 #endif
814  hci_remote_name();
815  hci_state = HCI_REMOTE_NAME_STATE;
817  hci_state = HCI_DISCONNECT_STATE;
818  break;
819 
822 #ifdef DEBUG_USB_HOST
823  Notify(PSTR("\r\nRemote Name: "), 0x80);
824  for(uint8_t i = 0; i < strlen(remote_name); i++)
825  Notifyc(remote_name[i], 0x80);
826 #endif
827  if(strncmp((const char*)remote_name, "Nintendo", 8) == 0) {
828  incomingWii = true;
829  motionPlusInside = false;
830  wiiUProController = false;
831  pairWiiUsingSync = false;
832 #ifdef DEBUG_USB_HOST
833  Notify(PSTR("\r\nWiimote is connecting"), 0x80);
834 #endif
835  if(strncmp((const char*)remote_name, "Nintendo RVL-CNT-01-TR", 22) == 0) {
836 #ifdef DEBUG_USB_HOST
837  Notify(PSTR(" with Motion Plus Inside"), 0x80);
838 #endif
839  motionPlusInside = true;
840  } else if(strncmp((const char*)remote_name, "Nintendo RVL-CNT-01-UC", 22) == 0) {
841 #ifdef DEBUG_USB_HOST
842  Notify(PSTR(" - Wii U Pro Controller"), 0x80);
843 #endif
844  wiiUProController = motionPlusInside = pairWiiUsingSync = true;
845  } else if(strncmp((const char*)remote_name, "Nintendo RVL-WBC-01", 19) == 0) {
846 #ifdef DEBUG_USB_HOST
847  Notify(PSTR(" - Wii Balance Board"), 0x80);
848 #endif
849  pairWiiUsingSync = true;
850  }
851  }
852  if(classOfDevice[2] == 0 && classOfDevice[1] == 0x25 && classOfDevice[0] == 0x08 && strncmp((const char*)remote_name, "Wireless Controller", 19) == 0) {
853 #ifdef DEBUG_USB_HOST
854  Notify(PSTR("\r\nPS4 controller is connecting"), 0x80);
855 #endif
856  incomingPS4 = true;
857  }
858  if(pairWithWii && checkRemoteName)
859  hci_state = HCI_CONNECT_DEVICE_STATE;
860  else {
862  hci_state = HCI_CONNECTED_STATE;
863  }
864  }
865  break;
866 
867  case HCI_CONNECTED_STATE:
869 #ifdef DEBUG_USB_HOST
870  Notify(PSTR("\r\nConnected to Device: "), 0x80);
871  for(int8_t i = 5; i > 0; i--) {
872  D_PrintHex<uint8_t > (disc_bdaddr[i], 0x80);
873  Notify(PSTR(":"), 0x80);
874  }
875  D_PrintHex<uint8_t > (disc_bdaddr[0], 0x80);
876 #endif
877  if(incomingPS4)
878  connectToHIDDevice = true; // We should always connect to the PS4 controller
879 
880  // Clear these flags for a new connection
881  l2capConnectionClaimed = false;
882  sdpConnectionClaimed = false;
883  rfcommConnectionClaimed = false;
884 
885  hci_event_flag = 0;
886  hci_state = HCI_DONE_STATE;
887  }
888  break;
889 
890  case HCI_DONE_STATE:
891  hci_counter++;
892  if(hci_counter > 1000) { // Wait until we have looped 1000 times to make sure that the L2CAP connection has been started
893  hci_counter = 0;
894  hci_state = HCI_SCANNING_STATE;
895  }
896  break;
897 
900 #ifdef DEBUG_USB_HOST
901  Notify(PSTR("\r\nHCI Disconnected from Device"), 0x80);
902 #endif
903  hci_event_flag = 0; // Clear all flags
904 
905  // Reset all buffers
906  memset(hcibuf, 0, BULK_MAXPKTSIZE);
907  memset(l2capinbuf, 0, BULK_MAXPKTSIZE);
908 
910  connectToHIDDevice = incomingHIDDevice = pairWithHIDDevice = checkRemoteName = false;
911  incomingPS4 = false;
912 
913  hci_state = HCI_SCANNING_STATE;
914  }
915  break;
916  default:
917  break;
918  }
919 }
920 
921 void BTD::ACL_event_task() {
922  uint16_t length = BULK_MAXPKTSIZE;
923  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_DATAIN_PIPE ].epAddr, &length, l2capinbuf, pollInterval); // Input on endpoint 2
924 
925  if(!rcode) { // Check for errors
926  if(length > 0) { // Check if any data was read
927  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++) {
928  if(btService[i])
929  btService[i]->ACLData(l2capinbuf);
930  }
931  }
932  }
933 #ifdef EXTRADEBUG
934  else if(rcode != hrNAK) {
935  Notify(PSTR("\r\nACL data in error: "), 0x80);
936  D_PrintHex<uint8_t > (rcode, 0x80);
937  }
938 #endif
939  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++)
940  if(btService[i])
941  btService[i]->Run();
942 }
943 
944 /************************************************************/
945 /* HCI Commands */
946 
947 /************************************************************/
948 void BTD::HCI_Command(uint8_t* data, uint16_t nbytes) {
950  pUsb->ctrlReq(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bmREQ_HCI_OUT, 0x00, 0x00, 0x00, 0x00, nbytes, nbytes, data, NULL);
951 }
952 
954  hci_event_flag = 0; // Clear all the flags
955  hcibuf[0] = 0x03; // HCI OCF = 3
956  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
957  hcibuf[2] = 0x00;
958 
959  HCI_Command(hcibuf, 3);
960 }
961 
964  hcibuf[0] = 0x1A; // HCI OCF = 1A
965  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
966  hcibuf[2] = 0x01; // parameter length = 1
967  if(btdName != NULL)
968  hcibuf[3] = 0x03; // Inquiry Scan enabled. Page Scan enabled.
969  else
970  hcibuf[3] = 0x02; // Inquiry Scan disabled. Page Scan enabled.
971 
972  HCI_Command(hcibuf, 4);
973 }
974 
976  hcibuf[0] = 0x1A; // HCI OCF = 1A
977  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
978  hcibuf[2] = 0x01; // parameter length = 1
979  hcibuf[3] = 0x00; // Inquiry Scan disabled. Page Scan disabled.
980 
981  HCI_Command(hcibuf, 4);
982 }
983 
986  hcibuf[0] = 0x09; // HCI OCF = 9
987  hcibuf[1] = 0x04 << 2; // HCI OGF = 4
988  hcibuf[2] = 0x00;
989 
990  HCI_Command(hcibuf, 3);
991 }
992 
995  hcibuf[0] = 0x01; // HCI OCF = 1
996  hcibuf[1] = 0x04 << 2; // HCI OGF = 4
997  hcibuf[2] = 0x00;
998 
999  HCI_Command(hcibuf, 3);
1000 }
1001 
1004  hcibuf[0] = 0x09; // HCI OCF = 9
1005  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1006  hcibuf[2] = 0x07; // parameter length 7
1007  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1008  hcibuf[4] = disc_bdaddr[1];
1009  hcibuf[5] = disc_bdaddr[2];
1010  hcibuf[6] = disc_bdaddr[3];
1011  hcibuf[7] = disc_bdaddr[4];
1012  hcibuf[8] = disc_bdaddr[5];
1013  hcibuf[9] = 0x00; // Switch role to master
1014 
1015  HCI_Command(hcibuf, 10);
1016 }
1017 
1020  hcibuf[0] = 0x19; // HCI OCF = 19
1021  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1022  hcibuf[2] = 0x0A; // parameter length = 10
1023  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1024  hcibuf[4] = disc_bdaddr[1];
1025  hcibuf[5] = disc_bdaddr[2];
1026  hcibuf[6] = disc_bdaddr[3];
1027  hcibuf[7] = disc_bdaddr[4];
1028  hcibuf[8] = disc_bdaddr[5];
1029  hcibuf[9] = 0x01; // Page Scan Repetition Mode
1030  hcibuf[10] = 0x00; // Reserved
1031  hcibuf[11] = 0x00; // Clock offset - low byte
1032  hcibuf[12] = 0x00; // Clock offset - high byte
1033 
1034  HCI_Command(hcibuf, 13);
1035 }
1036 
1037 void BTD::hci_set_local_name(const char* name) {
1038  hcibuf[0] = 0x13; // HCI OCF = 13
1039  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
1040  hcibuf[2] = strlen(name) + 1; // parameter length = the length of the string + end byte
1041  uint8_t i;
1042  for(i = 0; i < strlen(name); i++)
1043  hcibuf[i + 3] = name[i];
1044  hcibuf[i + 3] = 0x00; // End of string
1045 
1046  HCI_Command(hcibuf, 4 + strlen(name));
1047 }
1048 
1051  hcibuf[0] = 0x01;
1052  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1053  hcibuf[2] = 0x05; // Parameter Total Length = 5
1054  hcibuf[3] = 0x33; // LAP: Genera/Unlimited Inquiry Access Code (GIAC = 0x9E8B33) - see https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
1055  hcibuf[4] = 0x8B;
1056  hcibuf[5] = 0x9E;
1057  hcibuf[6] = 0x30; // Inquiry time = 61.44 sec (maximum)
1058  hcibuf[7] = 0x0A; // 10 number of responses
1059 
1060  HCI_Command(hcibuf, 8);
1061 }
1062 
1064  hcibuf[0] = 0x02;
1065  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1066  hcibuf[2] = 0x00; // Parameter Total Length = 0
1067 
1068  HCI_Command(hcibuf, 3);
1069 }
1070 
1072  hci_connect(disc_bdaddr); // Use last discovered device
1073 }
1074 
1075 void BTD::hci_connect(uint8_t *bdaddr) {
1077  hcibuf[0] = 0x05;
1078  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1079  hcibuf[2] = 0x0D; // parameter Total Length = 13
1080  hcibuf[3] = bdaddr[0]; // 6 octet bdaddr (LSB)
1081  hcibuf[4] = bdaddr[1];
1082  hcibuf[5] = bdaddr[2];
1083  hcibuf[6] = bdaddr[3];
1084  hcibuf[7] = bdaddr[4];
1085  hcibuf[8] = bdaddr[5];
1086  hcibuf[9] = 0x18; // DM1 or DH1 may be used
1087  hcibuf[10] = 0xCC; // DM3, DH3, DM5, DH5 may be used
1088  hcibuf[11] = 0x01; // Page repetition mode R1
1089  hcibuf[12] = 0x00; // Reserved
1090  hcibuf[13] = 0x00; // Clock offset
1091  hcibuf[14] = 0x00; // Invalid clock offset
1092  hcibuf[15] = 0x00; // Do not allow role switch
1093 
1094  HCI_Command(hcibuf, 16);
1095 }
1096 
1098  hcibuf[0] = 0x0D; // HCI OCF = 0D
1099  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1100  hcibuf[2] = 0x17; // parameter length 23
1101  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1102  hcibuf[4] = disc_bdaddr[1];
1103  hcibuf[5] = disc_bdaddr[2];
1104  hcibuf[6] = disc_bdaddr[3];
1105  hcibuf[7] = disc_bdaddr[4];
1106  hcibuf[8] = disc_bdaddr[5];
1107  if(pairWithWii) {
1108  hcibuf[9] = 6; // Pin length is the length of the Bluetooth address
1109  if(pairWiiUsingSync) {
1110 #ifdef DEBUG_USB_HOST
1111  Notify(PSTR("\r\nPairing with Wii controller via SYNC"), 0x80);
1112 #endif
1113  for(uint8_t i = 0; i < 6; i++)
1114  hcibuf[10 + i] = my_bdaddr[i]; // The pin is the Bluetooth dongles Bluetooth address backwards
1115  } else {
1116  for(uint8_t i = 0; i < 6; i++)
1117  hcibuf[10 + i] = disc_bdaddr[i]; // The pin is the Wiimote's Bluetooth address backwards
1118  }
1119  for(uint8_t i = 16; i < 26; i++)
1120  hcibuf[i] = 0x00; // The rest should be 0
1121  } else {
1122  hcibuf[9] = strlen(btdPin); // Length of pin
1123  uint8_t i;
1124  for(i = 0; i < strlen(btdPin); i++) // The maximum size of the pin is 16
1125  hcibuf[i + 10] = btdPin[i];
1126  for(; i < 16; i++)
1127  hcibuf[i + 10] = 0x00; // The rest should be 0
1128  }
1129 
1130  HCI_Command(hcibuf, 26);
1131 }
1132 
1134  hcibuf[0] = 0x0E; // HCI OCF = 0E
1135  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1136  hcibuf[2] = 0x06; // parameter length 6
1137  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1138  hcibuf[4] = disc_bdaddr[1];
1139  hcibuf[5] = disc_bdaddr[2];
1140  hcibuf[6] = disc_bdaddr[3];
1141  hcibuf[7] = disc_bdaddr[4];
1142  hcibuf[8] = disc_bdaddr[5];
1143 
1144  HCI_Command(hcibuf, 9);
1145 }
1146 
1148  hcibuf[0] = 0x0C; // HCI OCF = 0C
1149  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1150  hcibuf[2] = 0x06; // parameter length 6
1151  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
1152  hcibuf[4] = disc_bdaddr[1];
1153  hcibuf[5] = disc_bdaddr[2];
1154  hcibuf[6] = disc_bdaddr[3];
1155  hcibuf[7] = disc_bdaddr[4];
1156  hcibuf[8] = disc_bdaddr[5];
1157 
1158  HCI_Command(hcibuf, 9);
1159 }
1160 
1162  hcibuf[0] = 0x11; // HCI OCF = 11
1163  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1164  hcibuf[2] = 0x02; // parameter length = 2
1165  hcibuf[3] = (uint8_t)(hci_handle & 0xFF); //connection handle - low byte
1166  hcibuf[4] = (uint8_t)((hci_handle >> 8) & 0x0F); //connection handle - high byte
1167 
1168  HCI_Command(hcibuf, 5);
1169 }
1170 
1171 void BTD::hci_disconnect(uint16_t handle) { // This is called by the different services
1173  hcibuf[0] = 0x06; // HCI OCF = 6
1174  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
1175  hcibuf[2] = 0x03; // parameter length = 3
1176  hcibuf[3] = (uint8_t)(handle & 0xFF); //connection handle - low byte
1177  hcibuf[4] = (uint8_t)((handle >> 8) & 0x0F); //connection handle - high byte
1178  hcibuf[5] = 0x13; // reason
1179 
1180  HCI_Command(hcibuf, 6);
1181 }
1182 
1183 void BTD::hci_write_class_of_device() { // See http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html
1184  hcibuf[0] = 0x24; // HCI OCF = 24
1185  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
1186  hcibuf[2] = 0x03; // parameter length = 3
1187  hcibuf[3] = 0x04; // Robot
1188  hcibuf[4] = 0x08; // Toy
1189  hcibuf[5] = 0x00;
1190 
1191  HCI_Command(hcibuf, 6);
1192 }
1193 /*******************************************************************
1194  * *
1195  * HCI ACL Data Packet *
1196  * *
1197  * buf[0] buf[1] buf[2] buf[3]
1198  * 0 4 8 11 12 16 24 31 MSB
1199  * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1200  * | HCI Handle |PB |BC | Data Total Length | HCI ACL Data Packet
1201  * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1202  *
1203  * buf[4] buf[5] buf[6] buf[7]
1204  * 0 8 16 31 MSB
1205  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1206  * | Length | Channel ID | Basic L2CAP header
1207  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1208  *
1209  * buf[8] buf[9] buf[10] buf[11]
1210  * 0 8 16 31 MSB
1211  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
1212  * | Code | Identifier | Length | Control frame (C-frame)
1213  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. (signaling packet format)
1214  */
1215 /************************************************************/
1216 /* L2CAP Commands */
1217 
1218 /************************************************************/
1219 void BTD::L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow, uint8_t channelHigh) {
1220  uint8_t buf[8 + nbytes];
1221  buf[0] = (uint8_t)(handle & 0xff); // HCI handle with PB,BC flag
1222  buf[1] = (uint8_t)(((handle >> 8) & 0x0f) | 0x20);
1223  buf[2] = (uint8_t)((4 + nbytes) & 0xff); // HCI ACL total data length
1224  buf[3] = (uint8_t)((4 + nbytes) >> 8);
1225  buf[4] = (uint8_t)(nbytes & 0xff); // L2CAP header: Length
1226  buf[5] = (uint8_t)(nbytes >> 8);
1227  buf[6] = channelLow;
1228  buf[7] = channelHigh;
1229 
1230  for(uint16_t i = 0; i < nbytes; i++) // L2CAP C-frame
1231  buf[8 + i] = data[i];
1232 
1233  uint8_t rcode = pUsb->outTransfer(bAddress, epInfo[ BTD_DATAOUT_PIPE ].epAddr, (8 + nbytes), buf);
1234  if(rcode) {
1235  delay(100); // This small delay prevents it from overflowing if it fails
1236 #ifdef DEBUG_USB_HOST
1237  Notify(PSTR("\r\nError sending L2CAP message: 0x"), 0x80);
1238  D_PrintHex<uint8_t > (rcode, 0x80);
1239  Notify(PSTR(" - Channel ID: "), 0x80);
1240  D_PrintHex<uint8_t > (channelHigh, 0x80);
1241  Notify(PSTR(" "), 0x80);
1242  D_PrintHex<uint8_t > (channelLow, 0x80);
1243 #endif
1244  }
1245 }
1246 
1247 void BTD::l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t* scid, uint16_t psm) {
1248  l2capoutbuf[0] = L2CAP_CMD_CONNECTION_REQUEST; // Code
1249  l2capoutbuf[1] = rxid; // Identifier
1250  l2capoutbuf[2] = 0x04; // Length
1251  l2capoutbuf[3] = 0x00;
1252  l2capoutbuf[4] = (uint8_t)(psm & 0xff); // PSM
1253  l2capoutbuf[5] = (uint8_t)(psm >> 8);
1254  l2capoutbuf[6] = scid[0]; // Source CID
1255  l2capoutbuf[7] = scid[1];
1256 
1257  L2CAP_Command(handle, l2capoutbuf, 8);
1258 }
1259 
1260 void BTD::l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid, uint8_t result) {
1261  l2capoutbuf[0] = L2CAP_CMD_CONNECTION_RESPONSE; // Code
1262  l2capoutbuf[1] = rxid; // Identifier
1263  l2capoutbuf[2] = 0x08; // Length
1264  l2capoutbuf[3] = 0x00;
1265  l2capoutbuf[4] = dcid[0]; // Destination CID
1266  l2capoutbuf[5] = dcid[1];
1267  l2capoutbuf[6] = scid[0]; // Source CID
1268  l2capoutbuf[7] = scid[1];
1269  l2capoutbuf[8] = result; // Result: Pending or Success
1270  l2capoutbuf[9] = 0x00;
1271  l2capoutbuf[10] = 0x00; // No further information
1272  l2capoutbuf[11] = 0x00;
1273 
1274  L2CAP_Command(handle, l2capoutbuf, 12);
1275 }
1276 
1277 void BTD::l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t* dcid) {
1278  l2capoutbuf[0] = L2CAP_CMD_CONFIG_REQUEST; // Code
1279  l2capoutbuf[1] = rxid; // Identifier
1280  l2capoutbuf[2] = 0x08; // Length
1281  l2capoutbuf[3] = 0x00;
1282  l2capoutbuf[4] = dcid[0]; // Destination CID
1283  l2capoutbuf[5] = dcid[1];
1284  l2capoutbuf[6] = 0x00; // Flags
1285  l2capoutbuf[7] = 0x00;
1286  l2capoutbuf[8] = 0x01; // Config Opt: type = MTU (Maximum Transmission Unit) - Hint
1287  l2capoutbuf[9] = 0x02; // Config Opt: length
1288  l2capoutbuf[10] = 0xFF; // MTU
1289  l2capoutbuf[11] = 0xFF;
1290 
1291  L2CAP_Command(handle, l2capoutbuf, 12);
1292 }
1293 
1294 void BTD::l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t* scid) {
1295  l2capoutbuf[0] = L2CAP_CMD_CONFIG_RESPONSE; // Code
1296  l2capoutbuf[1] = rxid; // Identifier
1297  l2capoutbuf[2] = 0x0A; // Length
1298  l2capoutbuf[3] = 0x00;
1299  l2capoutbuf[4] = scid[0]; // Source CID
1300  l2capoutbuf[5] = scid[1];
1301  l2capoutbuf[6] = 0x00; // Flag
1302  l2capoutbuf[7] = 0x00;
1303  l2capoutbuf[8] = 0x00; // Result
1304  l2capoutbuf[9] = 0x00;
1305  l2capoutbuf[10] = 0x01; // Config
1306  l2capoutbuf[11] = 0x02;
1307  l2capoutbuf[12] = 0xA0;
1308  l2capoutbuf[13] = 0x02;
1309 
1310  L2CAP_Command(handle, l2capoutbuf, 14);
1311 }
1312 
1313 void BTD::l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid) {
1314  l2capoutbuf[0] = L2CAP_CMD_DISCONNECT_REQUEST; // Code
1315  l2capoutbuf[1] = rxid; // Identifier
1316  l2capoutbuf[2] = 0x04; // Length
1317  l2capoutbuf[3] = 0x00;
1318  l2capoutbuf[4] = dcid[0];
1319  l2capoutbuf[5] = dcid[1];
1320  l2capoutbuf[6] = scid[0];
1321  l2capoutbuf[7] = scid[1];
1322 
1323  L2CAP_Command(handle, l2capoutbuf, 8);
1324 }
1325 
1326 void BTD::l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid) {
1327  l2capoutbuf[0] = L2CAP_CMD_DISCONNECT_RESPONSE; // Code
1328  l2capoutbuf[1] = rxid; // Identifier
1329  l2capoutbuf[2] = 0x04; // Length
1330  l2capoutbuf[3] = 0x00;
1331  l2capoutbuf[4] = dcid[0];
1332  l2capoutbuf[5] = dcid[1];
1333  l2capoutbuf[6] = scid[0];
1334  l2capoutbuf[7] = scid[1];
1335 
1336  L2CAP_Command(handle, l2capoutbuf, 8);
1337 }
1338 
1339 void BTD::l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh) {
1340  l2capoutbuf[0] = L2CAP_CMD_INFORMATION_RESPONSE; // Code
1341  l2capoutbuf[1] = rxid; // Identifier
1342  l2capoutbuf[2] = 0x08; // Length
1343  l2capoutbuf[3] = 0x00;
1344  l2capoutbuf[4] = infoTypeLow;
1345  l2capoutbuf[5] = infoTypeHigh;
1346  l2capoutbuf[6] = 0x00; // Result = success
1347  l2capoutbuf[7] = 0x00; // Result = success
1348  l2capoutbuf[8] = 0x00;
1349  l2capoutbuf[9] = 0x00;
1350  l2capoutbuf[10] = 0x00;
1351  l2capoutbuf[11] = 0x00;
1352 
1353  L2CAP_Command(handle, l2capoutbuf, 12);
1354 }
1355 
1356 /* PS3 Commands - only set Bluetooth address is implemented in this library */
1357 void BTD::setBdaddr(uint8_t* bdaddr) {
1358  /* Set the internal Bluetooth address */
1359  uint8_t buf[8];
1360  buf[0] = 0x01;
1361  buf[1] = 0x00;
1362 
1363  for(uint8_t i = 0; i < 6; i++)
1364  buf[i + 2] = bdaddr[5 - i]; // Copy into buffer, has to be written reversed, so it is MSB first
1365 
1366  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF5), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
1367  pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
1368 }
1369 
1370 void BTD::setMoveBdaddr(uint8_t* bdaddr) {
1371  /* Set the internal Bluetooth address */
1372  uint8_t buf[11];
1373  buf[0] = 0x05;
1374  buf[7] = 0x10;
1375  buf[8] = 0x01;
1376  buf[9] = 0x02;
1377  buf[10] = 0x12;
1378 
1379  for(uint8_t i = 0; i < 6; i++)
1380  buf[i + 1] = bdaddr[i];
1381 
1382  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x05), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
1383  pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
1384 }
static const uint8_t BTD_DATAOUT_PIPE
Definition: BTD.h:525
+
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+
uint8_t bmRcvToggle
Definition: address.h:48
+
bool incomingWii
Definition: BTD.h:474
+ +
void hci_connect()
Definition: BTD.cpp:1071
+
uint8_t bNumEP
Definition: BTD.h:514
+
EpInfo * epinfo
Definition: address.h:83
+
const char * btdName
Definition: BTD.h:447
+
void hci_reset()
Definition: BTD.cpp:953
+
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1260
+
#define HCI_SCANNING_STATE
Definition: BTD.h:55
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
Definition: BTD.cpp:1247
+
#define EV_COMMAND_STATUS
Definition: BTD.h:99
+
#define EV_REMOTE_NAME_COMPLETE
Definition: BTD.h:86
+
uint8_t bmNakPower
Definition: address.h:49
+
bool sdpConnectionClaimed
Definition: BTD.h:442
+
#define bmREQ_HCI_OUT
Definition: BTD.h:40
+
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1313
+ +
bool rfcommConnectionClaimed
Definition: BTD.h:444
+
uint8_t hci_version
Definition: BTD.h:464
+
bool waitingForConnection
Definition: BTD.h:438
+ +
#define EV_INQUIRY_COMPLETE
Definition: BTD.h:80
+
void hci_inquiry()
Definition: BTD.cpp:1049
+
static const uint8_t BTD_EVENT_PIPE
Definition: BTD.h:521
#define PS3MOVE_PID
Definition: BTD.h:28
- - -
bool pairWithWii
Definition: BTD.h:473
- -
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:105
-
void hci_write_scan_disable()
Definition: BTD.cpp:977
-
#define NotifyFail(...)
Definition: message.h:55
-
#define HCI_SET_NAME_STATE
Definition: BTD.h:45
+ + +
bool pairWithWii
Definition: BTD.h:476
+
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:112
+
void hci_write_scan_disable()
Definition: BTD.cpp:975
+
#define NotifyFail(...)
Definition: message.h:62
+
#define BELKIN_F8T065BF_PID
Definition: BTD.h:34
+
#define HCI_SET_NAME_STATE
Definition: BTD.h:48
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: BTD.cpp:327
-
#define EV_LINK_KEY_REQUEST
Definition: BTD.h:89
-
#define HCI_DONE_STATE
Definition: BTD.h:57
-
#define BTD_NUM_SERVICES
Definition: BTD.h:188
-
#define EV_DATA_BUFFER_OVERFLOW
Definition: BTD.h:91
-
#define HCI_DISCONNECT_STATE
Definition: BTD.h:58
-
#define HCI_FLAG_CONNECT_COMPLETE
Definition: BTD.h:62
-
#define EV_PIN_CODE_REQUEST
Definition: BTD.h:88
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
-
const char * btdPin
Definition: BTD.h:446
-
bool motionPlusInside
Definition: BTD.h:475
-
#define EV_AUTHENTICATION_COMPLETE
Definition: BTD.h:82
-
void hci_remote_name()
Definition: BTD.cpp:1020
-
#define HCI_FLAG_CONNECT_EVENT
Definition: BTD.h:69
+
#define EV_LINK_KEY_REQUEST
Definition: BTD.h:92
+
#define HCI_DONE_STATE
Definition: BTD.h:60
+
#define BTD_NUM_SERVICES
Definition: BTD.h:191
+
#define EV_DATA_BUFFER_OVERFLOW
Definition: BTD.h:94
+
#define HCI_DISCONNECT_STATE
Definition: BTD.h:61
+
#define HCI_FLAG_CONNECT_COMPLETE
Definition: BTD.h:65
+
#define EV_PIN_CODE_REQUEST
Definition: BTD.h:91
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
const char * btdPin
Definition: BTD.h:449
+
bool motionPlusInside
Definition: BTD.h:478
+
#define EV_AUTHENTICATION_COMPLETE
Definition: BTD.h:85
+
void hci_remote_name()
Definition: BTD.cpp:1018
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
+
#define HCI_FLAG_CONNECT_EVENT
Definition: BTD.h:72
#define bmREQ_HID_OUT
Definition: usbhid.h:63
-
#define HCI_FLAG_DISCONNECT_COMPLETE
Definition: BTD.h:63
-
#define HCI_REMOTE_NAME_STATE
Definition: BTD.h:54
-
#define USB_ERROR_FailGetDevDescr
Definition: UsbCore.h:89
-
#define HCI_FLAG_CMD_COMPLETE
Definition: BTD.h:61
+
#define HCI_FLAG_DISCONNECT_COMPLETE
Definition: BTD.h:66
+
#define BELKIN_F8T065BF_VID
Definition: BTD.h:33
+
#define HCI_REMOTE_NAME_STATE
Definition: BTD.h:57
+
#define USB_ERROR_FailGetDevDescr
Definition: UsbCore.h:100
+
#define HCI_FLAG_CMD_COMPLETE
Definition: BTD.h:64
#define PS3_VID
Definition: BTD.h:25
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
BTD(USB *p)
Definition: BTD.cpp:27
-
char remote_name[30]
Definition: BTD.h:455
-
#define hrJERR
Definition: max3421e.h:220
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
+
char remote_name[30]
Definition: BTD.h:458
+
#define hrJERR
Definition: max3421e.h:227
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
virtual void Reset()=0
-
#define EV_MAX_SLOTS_CHANGE
Definition: BTD.h:92
-
static const uint8_t BTD_DATAIN_PIPE
Definition: BTD.h:519
-
void hci_set_local_name(const char *name)
Definition: BTD.cpp:1039
-
#define EV_QOS_SETUP_COMPLETE
Definition: BTD.h:94
-
void hci_write_scan_enable()
Definition: BTD.cpp:964
-
uint8_t Release()
Definition: BTD.cpp:378
+
#define EV_MAX_SLOTS_CHANGE
Definition: BTD.h:95
+
static const uint8_t BTD_DATAIN_PIPE
Definition: BTD.h:523
+
void hci_set_local_name(const char *name)
Definition: BTD.cpp:1037
+
#define EV_QOS_SETUP_COMPLETE
Definition: BTD.h:97
+
void hci_write_scan_enable()
Definition: BTD.cpp:962
+
uint8_t Release()
Definition: BTD.cpp:376
virtual void FreeAddress(uint8_t addr)=0
-
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1328
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
+
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1326
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
bool watingForConnection
Definition: BTD.h:435
-
#define HCI_BDADDR_STATE
Definition: BTD.h:43
-
#define HCI_CONNECT_DEVICE_STATE
Definition: BTD.h:49
-
#define Notify(...)
Definition: message.h:44
-
bool connectToHIDDevice
Definition: BTD.h:483
- - -
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
uint8_t bAddress
Definition: BTD.h:503
-
#define NotifyFailGetConfDescr(...)
Definition: message.h:52
-
uint8_t epAddr
Definition: address.h:33
-
bool incomingHIDDevice
Definition: BTD.h:487
-
#define NotifyFailUnknownDevice(...)
Definition: message.h:54
-
bool pairWithHIDDevice
Definition: BTD.h:489
-
uint32_t qNextPollTime
Definition: BTD.h:512
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
-
#define EV_CONNECT_COMPLETE
Definition: BTD.h:79
-
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: BTD.cpp:359
-
#define EV_DISCONNECT_COMPLETE
Definition: BTD.h:81
-
#define HCI_FLAG_READ_BDADDR
Definition: BTD.h:66
-
#define IOGEAR_GBU521_PID
Definition: BTD.h:31
-
bool connectToWii
Definition: BTD.h:467
+
#define HCI_BDADDR_STATE
Definition: BTD.h:46
+
#define HCI_CONNECT_DEVICE_STATE
Definition: BTD.h:52
+
#define Notify(...)
Definition: message.h:51
+
bool connectToHIDDevice
Definition: BTD.h:487
+ + +
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
uint8_t bAddress
Definition: BTD.h:507
+
#define NotifyFailGetConfDescr(...)
Definition: message.h:59
+
uint8_t epAddr
Definition: address.h:40
+
bool incomingHIDDevice
Definition: BTD.h:491
+
#define NotifyFailUnknownDevice(...)
Definition: message.h:61
+
bool pairWithHIDDevice
Definition: BTD.h:493
+
uint32_t qNextPollTime
Definition: BTD.h:516
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
+
#define EV_CONNECT_COMPLETE
Definition: BTD.h:82
+
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: BTD.cpp:357
+
#define EV_DISCONNECT_COMPLETE
Definition: BTD.h:84
+
#define HCI_FLAG_READ_BDADDR
Definition: BTD.h:69
+
#define IOGEAR_GBU521_PID
Definition: BTD.h:32
+
bool connectToWii
Definition: BTD.h:470
uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: BTD.cpp:48
-
#define HCI_LOCAL_VERSION_STATE
Definition: BTD.h:44
+
#define HCI_LOCAL_VERSION_STATE
Definition: BTD.h:47
virtual void disconnect()=0
-
bool wiiUProController
Definition: BTD.h:477
-
uint16_t hci_handle
Definition: BTD.h:451
+
bool wiiUProController
Definition: BTD.h:480
+
uint16_t hci_handle
Definition: BTD.h:454
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: BTD.cpp:134
-
#define Notifyc(...)
Definition: message.h:46
-
Definition: address.h:32
-
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1173
-
#define HCI_RESET_STATE
Definition: BTD.h:41
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
-
#define hrNAK
Definition: max3421e.h:211
-
void hci_read_bdaddr()
Definition: BTD.cpp:986
-
void hci_inquiry_cancel()
Definition: BTD.cpp:1065
-
#define L2CAP_CMD_INFORMATION_RESPONSE
Definition: BTD.h:171
-
uint16_t wMaxPacketSize
Definition: usb_ch9.h:146
+
#define Notifyc(...)
Definition: message.h:53
+
Definition: address.h:39
+
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1171
+
#define HCI_RESET_STATE
Definition: BTD.h:44
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
+
#define hrNAK
Definition: max3421e.h:218
+
void hci_read_bdaddr()
Definition: BTD.cpp:984
+
void hci_inquiry_cancel()
Definition: BTD.cpp:1063
+
#define L2CAP_CMD_INFORMATION_RESPONSE
Definition: BTD.h:174
+
uint16_t wMaxPacketSize
Definition: usb_ch9.h:153
+
#define bmUSB_TRANSFER_TYPE
Definition: usb_ch9.h:94
virtual void Run()=0
-
uint8_t my_bdaddr[6]
Definition: BTD.h:449
-
#define EV_INCOMING_CONNECT
Definition: BTD.h:80
-
#define HCI_CONNECT_IN_STATE
Definition: BTD.h:53
- -
#define HCI_INQUIRY_STATE
Definition: BTD.h:48
+
uint8_t my_bdaddr[6]
Definition: BTD.h:452
+
#define EV_INCOMING_CONNECT
Definition: BTD.h:83
+
#define HCI_CONNECT_IN_STATE
Definition: BTD.h:56
+ +
#define HCI_INQUIRY_STATE
Definition: BTD.h:51
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bEndpointAddress
Definition: usb_ch9.h:144
-
#define HCI_CONNECTED_STATE
Definition: BTD.h:55
-
#define EV_INQUIRY_RESULT
Definition: BTD.h:78
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:166
-
#define PSTR(str)
-
uint8_t Poll()
Definition: BTD.cpp:384
-
uint8_t bDeviceClass
Definition: usb_ch9.h:102
-
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:168
-
static const uint8_t BTD_CONTROL_PIPE
Definition: BTD.h:515
- -
#define BULK_MAXPKTSIZE
Definition: BTD.h:34
-
void disconnect()
Definition: BTD.cpp:396
-
#define HCI_FLAG_READ_VERSION
Definition: BTD.h:67
-
uint8_t disc_bdaddr[6]
Definition: BTD.h:453
-
bool l2capConnectionClaimed
Definition: BTD.h:437
-
#define USB_NAK_NOWAIT
Definition: address.h:29
-
#define HCI_FLAG_INCOMING_REQUEST
Definition: BTD.h:65
-
#define EV_NUM_COMPLETE_PKT
Definition: BTD.h:87
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
-
EpInfo epInfo[BTD_MAX_ENDPOINTS]
Definition: BTD.h:505
-
#define IOGEAR_GBU521_VID
Definition: BTD.h:30
+
uint8_t bEndpointAddress
Definition: usb_ch9.h:151
+
#define HCI_CONNECTED_STATE
Definition: BTD.h:58
+
#define EV_INQUIRY_RESULT
Definition: BTD.h:81
+
uint8_t bmSndToggle
Definition: address.h:47
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:169
+
#define PSTR(str)
+
uint8_t Poll()
Definition: BTD.cpp:382
+
uint8_t bDeviceClass
Definition: usb_ch9.h:109
+
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:171
+
static const uint8_t BTD_CONTROL_PIPE
Definition: BTD.h:519
+
#define BULK_MAXPKTSIZE
Definition: BTD.h:37
+
void disconnect()
Definition: BTD.cpp:394
+
#define HCI_FLAG_READ_VERSION
Definition: BTD.h:70
+
uint8_t disc_bdaddr[6]
Definition: BTD.h:456
+
bool l2capConnectionClaimed
Definition: BTD.h:440
+
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define HCI_FLAG_INCOMING_REQUEST
Definition: BTD.h:68
+
#define EV_NUM_COMPLETE_PKT
Definition: BTD.h:90
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
+
EpInfo epInfo[BTD_MAX_ENDPOINTS]
Definition: BTD.h:509
+
#define IOGEAR_GBU521_VID
Definition: BTD.h:31
#define PS3_PID
Definition: BTD.h:26
-
#define BTD_MAX_ENDPOINTS
Definition: BTD.h:187
+
#define BTD_MAX_ENDPOINTS
Definition: BTD.h:190
#define PS3NAVIGATION_PID
Definition: BTD.h:27
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
-
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:169
-
#define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE
Definition: BTD.h:93
-
#define EV_COMMAND_COMPLETE
Definition: BTD.h:95
-
void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)
Definition: BTD.cpp:1341
-
uint16_t idProduct
Definition: usb_ch9.h:107
-
#define L2CAP_CMD_CONNECTION_RESPONSE
Definition: BTD.h:165
-
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:167
-
#define hci_set_flag(flag)
Definition: BTD.h:73
-
void hci_write_class_of_device()
Definition: BTD.cpp:1185
-
#define HCI_CONNECTED_DEVICE_STATE
Definition: BTD.h:50
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
#define HCI_INIT_STATE
Definition: BTD.h:40
-
void hci_pin_code_negative_request_reply()
Definition: BTD.cpp:1135
-
#define EV_CHANGE_CONNECTION_LINK
Definition: BTD.h:85
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
+
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:172
+
#define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE
Definition: BTD.h:96
+
#define EV_COMMAND_COMPLETE
Definition: BTD.h:98
+
void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)
Definition: BTD.cpp:1339
+
uint16_t idProduct
Definition: usb_ch9.h:114
+
#define L2CAP_CMD_CONNECTION_RESPONSE
Definition: BTD.h:168
+
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:170
+
#define hci_set_flag(flag)
Definition: BTD.h:76
+
void hci_write_class_of_device()
Definition: BTD.cpp:1183
+
#define HCI_CONNECTED_DEVICE_STATE
Definition: BTD.h:53
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
#define HCI_INIT_STATE
Definition: BTD.h:43
+
void hci_pin_code_negative_request_reply()
Definition: BTD.cpp:1133
+
#define EV_CHANGE_CONNECTION_LINK
Definition: BTD.h:88
virtual void ACLData(uint8_t *ACLData)=0
-
uint8_t bNumConfigurations
Definition: usb_ch9.h:112
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
-
#define hci_check_flag(flag)
Definition: BTD.h:72
-
#define EV_ROLE_CHANGED
Definition: BTD.h:86
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
#define HCI_CHECK_DEVICE_SERVICE
Definition: BTD.h:46
-
Definition: UsbCore.h:197
-
uint8_t bConfNum
Definition: BTD.h:508
-
void hci_link_key_request_negative_reply()
Definition: BTD.cpp:1149
-
#define EV_LOOPBACK_COMMAND
Definition: BTD.h:97
-
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1221
-
#define EV_LINK_KEY_NOTIFICATION
Definition: BTD.h:90
-
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1296
-
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1279
-
void hci_pin_code_request_reply()
Definition: BTD.cpp:1099
+
uint8_t bNumConfigurations
Definition: usb_ch9.h:119
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
+
#define hci_check_flag(flag)
Definition: BTD.h:75
+
#define EV_ROLE_CHANGED
Definition: BTD.h:89
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
#define HCI_CHECK_DEVICE_SERVICE
Definition: BTD.h:49
+
Definition: UsbCore.h:208
+
#define USB_TRANSFER_TYPE_BULK
Definition: usb_ch9.h:92
+
uint8_t bConfNum
Definition: BTD.h:512
+
void hci_link_key_request_negative_reply()
Definition: BTD.cpp:1147
+
#define EV_LOOPBACK_COMMAND
Definition: BTD.h:100
+
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1219
+
#define EV_LINK_KEY_NOTIFICATION
Definition: BTD.h:93
+
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1294
+
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1277
+
void hci_pin_code_request_reply()
Definition: BTD.cpp:1097
#define HID_REQUEST_SET_REPORT
Definition: usbhid.h:72
-
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:164
+
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:167
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define EV_ENCRYPTION_CHANGE
Definition: BTD.h:84
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
-
#define hci_clear_flag(flag)
Definition: BTD.h:74
-
USB * pUsb
Definition: BTD.h:497
-
#define NotifyStr(...)
Definition: message.h:45
-
void hci_authentication_request()
Definition: BTD.cpp:1163
-
void hci_read_local_version_information()
Definition: BTD.cpp:995
-
#define HCI_FLAG_REMOTE_NAME_COMPLETE
Definition: BTD.h:64
-
void hci_accept_connection()
Definition: BTD.cpp:1004
-
#define EV_PAGE_SCAN_REP_MODE
Definition: BTD.h:98
-
#define HCI_FLAG_DEVICE_FOUND
Definition: BTD.h:68
-
#define HCI_CLASS_STATE
Definition: BTD.h:42
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
-
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
Definition: UsbCore.h:88
-
void HCI_Command(uint8_t *data, uint16_t nbytes)
Definition: BTD.cpp:950
- +
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define EV_ENCRYPTION_CHANGE
Definition: BTD.h:87
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
+
#define hci_clear_flag(flag)
Definition: BTD.h:77
+
USB * pUsb
Definition: BTD.h:501
+
#define NotifyStr(...)
Definition: message.h:52
+
void hci_authentication_request()
Definition: BTD.cpp:1161
+
void hci_read_local_version_information()
Definition: BTD.cpp:993
+
#define HCI_FLAG_REMOTE_NAME_COMPLETE
Definition: BTD.h:67
+
void hci_accept_connection()
Definition: BTD.cpp:1002
+
#define EV_PAGE_SCAN_REP_MODE
Definition: BTD.h:101
+
#define HCI_FLAG_DEVICE_FOUND
Definition: BTD.h:71
+
#define HCI_CLASS_STATE
Definition: BTD.h:45
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
Definition: UsbCore.h:99
+
void HCI_Command(uint8_t *data, uint16_t nbytes)
Definition: BTD.cpp:948
+
diff --git a/_b_t_d_8h.html b/_b_t_d_8h.html index aadd76d3..eec30e65 100644 --- a/_b_t_d_8h.html +++ b/_b_t_d_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: BTD.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- - + + - - + + @@ -146,6 +126,10 @@ Macros   #define IOGEAR_GBU521_PID   0x21E8   +#define BELKIN_F8T065BF_VID   0x050D +  +#define BELKIN_F8T065BF_PID   0x065A +  #define BULK_MAXPKTSIZE   64   #define bmREQ_HCI_OUT   USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE @@ -370,7 +354,9 @@ Macros  

Macro Definition Documentation

- + +

◆ PS3_VID

+
@@ -380,11 +366,13 @@ Macros
-

Definition at line 25 of file BTD.h.

+

Definition at line 25 of file BTD.h.

- + +

◆ PS3_PID

+
@@ -394,11 +382,13 @@ Macros
-

Definition at line 26 of file BTD.h.

+

Definition at line 26 of file BTD.h.

- + +

◆ PS3NAVIGATION_PID

+
@@ -408,11 +398,13 @@ Macros
-

Definition at line 27 of file BTD.h.

+

Definition at line 27 of file BTD.h.

- + +

◆ PS3MOVE_PID

+
@@ -422,11 +414,13 @@ Macros
-

Definition at line 28 of file BTD.h.

+

Definition at line 28 of file BTD.h.

- + +

◆ IOGEAR_GBU521_VID

+
@@ -436,11 +430,13 @@ Macros
-

Definition at line 30 of file BTD.h.

+

Definition at line 31 of file BTD.h.

- + +

◆ IOGEAR_GBU521_PID

+
@@ -450,11 +446,45 @@ Macros
-

Definition at line 31 of file BTD.h.

+

Definition at line 32 of file BTD.h.

- + +

◆ BELKIN_F8T065BF_VID

+ +
+
+ + + + +
#define BELKIN_F8T065BF_VID   0x050D
+
+ +

Definition at line 33 of file BTD.h.

+ +
+
+ +

◆ BELKIN_F8T065BF_PID

+ +
+
+ + + + +
#define BELKIN_F8T065BF_PID   0x065A
+
+ +

Definition at line 34 of file BTD.h.

+ +
+
+ +

◆ BULK_MAXPKTSIZE

+
@@ -464,11 +494,13 @@ Macros
-

Definition at line 34 of file BTD.h.

+

Definition at line 37 of file BTD.h.

- + +

◆ bmREQ_HCI_OUT

+
@@ -478,11 +510,13 @@ Macros
-

Definition at line 37 of file BTD.h.

+

Definition at line 40 of file BTD.h.

- + +

◆ HCI_INIT_STATE

+
@@ -492,11 +526,13 @@ Macros
-

Definition at line 40 of file BTD.h.

+

Definition at line 43 of file BTD.h.

- + +

◆ HCI_RESET_STATE

+
@@ -506,11 +542,13 @@ Macros
-

Definition at line 41 of file BTD.h.

+

Definition at line 44 of file BTD.h.

- + +

◆ HCI_CLASS_STATE

+
@@ -520,11 +558,13 @@ Macros
-

Definition at line 42 of file BTD.h.

+

Definition at line 45 of file BTD.h.

- + +

◆ HCI_BDADDR_STATE

+
@@ -534,11 +574,13 @@ Macros
-

Definition at line 43 of file BTD.h.

+

Definition at line 46 of file BTD.h.

- + +

◆ HCI_LOCAL_VERSION_STATE

+
@@ -548,11 +590,13 @@ Macros
-

Definition at line 44 of file BTD.h.

+

Definition at line 47 of file BTD.h.

- + +

◆ HCI_SET_NAME_STATE

+
@@ -562,11 +606,13 @@ Macros
-

Definition at line 45 of file BTD.h.

+

Definition at line 48 of file BTD.h.

- + +

◆ HCI_CHECK_DEVICE_SERVICE

+
@@ -576,11 +622,13 @@ Macros
-

Definition at line 46 of file BTD.h.

+

Definition at line 49 of file BTD.h.

- + +

◆ HCI_INQUIRY_STATE

+
@@ -590,11 +638,13 @@ Macros
-

Definition at line 48 of file BTD.h.

+

Definition at line 51 of file BTD.h.

- + +

◆ HCI_CONNECT_DEVICE_STATE

+
@@ -604,11 +654,13 @@ Macros
-

Definition at line 49 of file BTD.h.

+

Definition at line 52 of file BTD.h.

- + +

◆ HCI_CONNECTED_DEVICE_STATE

+
@@ -618,11 +670,13 @@ Macros
-

Definition at line 50 of file BTD.h.

+

Definition at line 53 of file BTD.h.

- + +

◆ HCI_SCANNING_STATE

+
@@ -632,11 +686,13 @@ Macros
-

Definition at line 52 of file BTD.h.

+

Definition at line 55 of file BTD.h.

- + +

◆ HCI_CONNECT_IN_STATE

+
@@ -646,11 +702,13 @@ Macros
-

Definition at line 53 of file BTD.h.

+

Definition at line 56 of file BTD.h.

- + +

◆ HCI_REMOTE_NAME_STATE

+
@@ -660,11 +718,13 @@ Macros
-

Definition at line 54 of file BTD.h.

+

Definition at line 57 of file BTD.h.

- + +

◆ HCI_CONNECTED_STATE

+
@@ -674,11 +734,13 @@ Macros
-

Definition at line 55 of file BTD.h.

+

Definition at line 58 of file BTD.h.

- + +

◆ HCI_DISABLE_SCAN_STATE

+
@@ -688,11 +750,13 @@ Macros
-

Definition at line 56 of file BTD.h.

+

Definition at line 59 of file BTD.h.

- + +

◆ HCI_DONE_STATE

+
@@ -702,11 +766,13 @@ Macros
-

Definition at line 57 of file BTD.h.

+

Definition at line 60 of file BTD.h.

- + +

◆ HCI_DISCONNECT_STATE

+
@@ -716,11 +782,13 @@ Macros
-

Definition at line 58 of file BTD.h.

+

Definition at line 61 of file BTD.h.

- + +

◆ HCI_FLAG_CMD_COMPLETE

+
@@ -730,11 +798,13 @@ Macros
-

Definition at line 61 of file BTD.h.

+

Definition at line 64 of file BTD.h.

- + +

◆ HCI_FLAG_CONNECT_COMPLETE

+
@@ -744,11 +814,13 @@ Macros
-

Definition at line 62 of file BTD.h.

+

Definition at line 65 of file BTD.h.

- + +

◆ HCI_FLAG_DISCONNECT_COMPLETE

+
@@ -758,11 +830,13 @@ Macros
-

Definition at line 63 of file BTD.h.

+

Definition at line 66 of file BTD.h.

- + +

◆ HCI_FLAG_REMOTE_NAME_COMPLETE

+
@@ -772,11 +846,13 @@ Macros
-

Definition at line 64 of file BTD.h.

+

Definition at line 67 of file BTD.h.

- + +

◆ HCI_FLAG_INCOMING_REQUEST

+
@@ -786,11 +862,13 @@ Macros
-

Definition at line 65 of file BTD.h.

+

Definition at line 68 of file BTD.h.

- + +

◆ HCI_FLAG_READ_BDADDR

+
@@ -800,11 +878,13 @@ Macros
-

Definition at line 66 of file BTD.h.

+

Definition at line 69 of file BTD.h.

- + +

◆ HCI_FLAG_READ_VERSION

+
@@ -814,11 +894,13 @@ Macros
-

Definition at line 67 of file BTD.h.

+

Definition at line 70 of file BTD.h.

- + +

◆ HCI_FLAG_DEVICE_FOUND

+
@@ -828,11 +910,13 @@ Macros
-

Definition at line 68 of file BTD.h.

+

Definition at line 71 of file BTD.h.

- + +

◆ HCI_FLAG_CONNECT_EVENT

+
@@ -842,11 +926,13 @@ Macros
-

Definition at line 69 of file BTD.h.

+

Definition at line 72 of file BTD.h.

- + +

◆ hci_check_flag

+
@@ -860,11 +946,13 @@ Macros
-

Definition at line 72 of file BTD.h.

+

Definition at line 75 of file BTD.h.

- + +

◆ hci_set_flag

+
@@ -878,11 +966,13 @@ Macros
-

Definition at line 73 of file BTD.h.

+

Definition at line 76 of file BTD.h.

- + +

◆ hci_clear_flag

+
@@ -896,11 +986,13 @@ Macros
-

Definition at line 74 of file BTD.h.

+

Definition at line 77 of file BTD.h.

- + +

◆ EV_INQUIRY_COMPLETE

+
@@ -910,11 +1002,13 @@ Macros
-

Definition at line 77 of file BTD.h.

+

Definition at line 80 of file BTD.h.

- + +

◆ EV_INQUIRY_RESULT

+
@@ -924,11 +1018,13 @@ Macros
-

Definition at line 78 of file BTD.h.

+

Definition at line 81 of file BTD.h.

- + +

◆ EV_CONNECT_COMPLETE

+
@@ -938,11 +1034,13 @@ Macros
-

Definition at line 79 of file BTD.h.

+

Definition at line 82 of file BTD.h.

- + +

◆ EV_INCOMING_CONNECT

+
@@ -952,11 +1050,13 @@ Macros
-

Definition at line 80 of file BTD.h.

+

Definition at line 83 of file BTD.h.

- + +

◆ EV_DISCONNECT_COMPLETE

+
@@ -966,11 +1066,13 @@ Macros
-

Definition at line 81 of file BTD.h.

+

Definition at line 84 of file BTD.h.

- + +

◆ EV_AUTHENTICATION_COMPLETE

+
@@ -980,11 +1082,13 @@ Macros
-

Definition at line 82 of file BTD.h.

+

Definition at line 85 of file BTD.h.

- + +

◆ EV_REMOTE_NAME_COMPLETE

+
@@ -994,11 +1098,13 @@ Macros
-

Definition at line 83 of file BTD.h.

+

Definition at line 86 of file BTD.h.

- + +

◆ EV_ENCRYPTION_CHANGE

+
@@ -1008,11 +1114,13 @@ Macros
-

Definition at line 84 of file BTD.h.

+

Definition at line 87 of file BTD.h.

- + +

◆ EV_CHANGE_CONNECTION_LINK

+
@@ -1022,11 +1130,13 @@ Macros
-

Definition at line 85 of file BTD.h.

+

Definition at line 88 of file BTD.h.

- + +

◆ EV_ROLE_CHANGED

+
@@ -1036,11 +1146,13 @@ Macros
-

Definition at line 86 of file BTD.h.

+

Definition at line 89 of file BTD.h.

- + +

◆ EV_NUM_COMPLETE_PKT

+
@@ -1050,11 +1162,13 @@ Macros
-

Definition at line 87 of file BTD.h.

+

Definition at line 90 of file BTD.h.

- + +

◆ EV_PIN_CODE_REQUEST

+
@@ -1064,11 +1178,13 @@ Macros
-

Definition at line 88 of file BTD.h.

+

Definition at line 91 of file BTD.h.

- + +

◆ EV_LINK_KEY_REQUEST

+
@@ -1078,11 +1194,13 @@ Macros
-

Definition at line 89 of file BTD.h.

+

Definition at line 92 of file BTD.h.

- + +

◆ EV_LINK_KEY_NOTIFICATION

+
@@ -1092,11 +1210,13 @@ Macros
-

Definition at line 90 of file BTD.h.

+

Definition at line 93 of file BTD.h.

- + +

◆ EV_DATA_BUFFER_OVERFLOW

+
@@ -1106,11 +1226,13 @@ Macros
-

Definition at line 91 of file BTD.h.

+

Definition at line 94 of file BTD.h.

- + +

◆ EV_MAX_SLOTS_CHANGE

+
@@ -1120,11 +1242,13 @@ Macros
-

Definition at line 92 of file BTD.h.

+

Definition at line 95 of file BTD.h.

- + +

◆ EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE

+
@@ -1134,11 +1258,13 @@ Macros
-

Definition at line 93 of file BTD.h.

+

Definition at line 96 of file BTD.h.

- + +

◆ EV_QOS_SETUP_COMPLETE

+
@@ -1148,11 +1274,13 @@ Macros
-

Definition at line 94 of file BTD.h.

+

Definition at line 97 of file BTD.h.

- + +

◆ EV_COMMAND_COMPLETE

+
@@ -1162,11 +1290,13 @@ Macros
-

Definition at line 95 of file BTD.h.

+

Definition at line 98 of file BTD.h.

- + +

◆ EV_COMMAND_STATUS

+
@@ -1176,11 +1306,13 @@ Macros
-

Definition at line 96 of file BTD.h.

+

Definition at line 99 of file BTD.h.

- + +

◆ EV_LOOPBACK_COMMAND

+
@@ -1190,11 +1322,13 @@ Macros
-

Definition at line 97 of file BTD.h.

+

Definition at line 100 of file BTD.h.

- + +

◆ EV_PAGE_SCAN_REP_MODE

+
@@ -1204,11 +1338,13 @@ Macros
-

Definition at line 98 of file BTD.h.

+

Definition at line 101 of file BTD.h.

- + +

◆ L2CAP_WAIT

+
@@ -1218,11 +1354,13 @@ Macros
-

Definition at line 101 of file BTD.h.

+

Definition at line 104 of file BTD.h.

- + +

◆ L2CAP_DONE

+
@@ -1232,11 +1370,13 @@ Macros
-

Definition at line 102 of file BTD.h.

+

Definition at line 105 of file BTD.h.

- + +

◆ L2CAP_CONTROL_CONNECT_REQUEST

+
@@ -1246,11 +1386,13 @@ Macros
-

Definition at line 105 of file BTD.h.

+

Definition at line 108 of file BTD.h.

- + +

◆ L2CAP_CONTROL_CONFIG_REQUEST

+
@@ -1260,11 +1402,13 @@ Macros
-

Definition at line 106 of file BTD.h.

+

Definition at line 109 of file BTD.h.

- + +

◆ L2CAP_CONTROL_SUCCESS

+
@@ -1274,11 +1418,13 @@ Macros
-

Definition at line 107 of file BTD.h.

+

Definition at line 110 of file BTD.h.

- + +

◆ L2CAP_CONTROL_DISCONNECT

+
@@ -1288,11 +1434,13 @@ Macros
-

Definition at line 108 of file BTD.h.

+

Definition at line 111 of file BTD.h.

- + +

◆ L2CAP_INTERRUPT_SETUP

+
@@ -1302,11 +1450,13 @@ Macros
-

Definition at line 111 of file BTD.h.

+

Definition at line 114 of file BTD.h.

- + +

◆ L2CAP_INTERRUPT_CONNECT_REQUEST

+
@@ -1316,11 +1466,13 @@ Macros
-

Definition at line 112 of file BTD.h.

+

Definition at line 115 of file BTD.h.

- + +

◆ L2CAP_INTERRUPT_CONFIG_REQUEST

+
@@ -1330,11 +1482,13 @@ Macros
-

Definition at line 113 of file BTD.h.

+

Definition at line 116 of file BTD.h.

- + +

◆ L2CAP_INTERRUPT_DISCONNECT

+
@@ -1344,11 +1498,13 @@ Macros
-

Definition at line 114 of file BTD.h.

+

Definition at line 117 of file BTD.h.

- + +

◆ L2CAP_SDP_WAIT

+
@@ -1358,11 +1514,13 @@ Macros
-

Definition at line 117 of file BTD.h.

+

Definition at line 120 of file BTD.h.

- + +

◆ L2CAP_SDP_SUCCESS

+
@@ -1372,11 +1530,13 @@ Macros
-

Definition at line 118 of file BTD.h.

+

Definition at line 121 of file BTD.h.

- + +

◆ L2CAP_RFCOMM_WAIT

+
@@ -1386,11 +1546,13 @@ Macros
-

Definition at line 121 of file BTD.h.

+

Definition at line 124 of file BTD.h.

- + +

◆ L2CAP_RFCOMM_SUCCESS

+
@@ -1400,11 +1562,13 @@ Macros
-

Definition at line 122 of file BTD.h.

+

Definition at line 125 of file BTD.h.

- + +

◆ L2CAP_DISCONNECT_RESPONSE

+
@@ -1414,11 +1578,13 @@ Macros
-

Definition at line 124 of file BTD.h.

+

Definition at line 127 of file BTD.h.

- + +

◆ TURN_ON_LED

+
@@ -1428,11 +1594,13 @@ Macros
-

Definition at line 127 of file BTD.h.

+

Definition at line 130 of file BTD.h.

- + +

◆ PS3_ENABLE_SIXAXIS

+
@@ -1442,11 +1610,13 @@ Macros
-

Definition at line 128 of file BTD.h.

+

Definition at line 131 of file BTD.h.

- + +

◆ WII_CHECK_MOTION_PLUS_STATE

+
@@ -1456,11 +1626,13 @@ Macros
-

Definition at line 129 of file BTD.h.

+

Definition at line 132 of file BTD.h.

- + +

◆ WII_CHECK_EXTENSION_STATE

+
@@ -1470,11 +1642,13 @@ Macros
-

Definition at line 130 of file BTD.h.

+

Definition at line 133 of file BTD.h.

- + +

◆ WII_INIT_MOTION_PLUS_STATE

+
@@ -1484,11 +1658,13 @@ Macros
-

Definition at line 131 of file BTD.h.

+

Definition at line 134 of file BTD.h.

- + +

◆ L2CAP_FLAG_CONNECTION_CONTROL_REQUEST

+
@@ -1498,11 +1674,13 @@ Macros
-

Definition at line 134 of file BTD.h.

+

Definition at line 137 of file BTD.h.

- + +

◆ L2CAP_FLAG_CONFIG_CONTROL_SUCCESS

+
@@ -1512,11 +1690,13 @@ Macros
-

Definition at line 135 of file BTD.h.

+

Definition at line 138 of file BTD.h.

- + +

◆ L2CAP_FLAG_CONTROL_CONNECTED

+
@@ -1526,11 +1706,13 @@ Macros
-

Definition at line 136 of file BTD.h.

+

Definition at line 139 of file BTD.h.

- + +

◆ L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE

+
@@ -1540,11 +1722,13 @@ Macros
-

Definition at line 137 of file BTD.h.

+

Definition at line 140 of file BTD.h.

- + +

◆ L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST

+
@@ -1554,11 +1738,13 @@ Macros
-

Definition at line 140 of file BTD.h.

+

Definition at line 143 of file BTD.h.

- + +

◆ L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS

+
@@ -1568,11 +1754,13 @@ Macros
-

Definition at line 141 of file BTD.h.

+

Definition at line 144 of file BTD.h.

- + +

◆ L2CAP_FLAG_INTERRUPT_CONNECTED

+
@@ -1582,11 +1770,13 @@ Macros
-

Definition at line 142 of file BTD.h.

+

Definition at line 145 of file BTD.h.

- + +

◆ L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE

+
@@ -1596,11 +1786,13 @@ Macros
-

Definition at line 143 of file BTD.h.

+

Definition at line 146 of file BTD.h.

- + +

◆ L2CAP_FLAG_CONNECTION_SDP_REQUEST

+
@@ -1610,11 +1802,13 @@ Macros
-

Definition at line 146 of file BTD.h.

+

Definition at line 149 of file BTD.h.

- + +

◆ L2CAP_FLAG_CONFIG_SDP_SUCCESS

+
@@ -1624,11 +1818,13 @@ Macros
-

Definition at line 147 of file BTD.h.

+

Definition at line 150 of file BTD.h.

- + +

◆ L2CAP_FLAG_DISCONNECT_SDP_REQUEST

+
@@ -1638,11 +1834,13 @@ Macros
-

Definition at line 148 of file BTD.h.

+

Definition at line 151 of file BTD.h.

- + +

◆ L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST

+
@@ -1652,11 +1850,13 @@ Macros
-

Definition at line 151 of file BTD.h.

+

Definition at line 154 of file BTD.h.

- + +

◆ L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS

+
@@ -1666,11 +1866,13 @@ Macros
-

Definition at line 152 of file BTD.h.

+

Definition at line 155 of file BTD.h.

- + +

◆ L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST

+
@@ -1680,11 +1882,13 @@ Macros
-

Definition at line 153 of file BTD.h.

+

Definition at line 156 of file BTD.h.

- + +

◆ L2CAP_FLAG_DISCONNECT_RESPONSE

+
@@ -1694,11 +1898,13 @@ Macros
-

Definition at line 155 of file BTD.h.

+

Definition at line 158 of file BTD.h.

- + +

◆ l2cap_check_flag

+
@@ -1712,11 +1918,13 @@ Macros
-

Definition at line 158 of file BTD.h.

+

Definition at line 161 of file BTD.h.

- + +

◆ l2cap_set_flag

+
@@ -1730,11 +1938,13 @@ Macros
-

Definition at line 159 of file BTD.h.

+

Definition at line 162 of file BTD.h.

- + +

◆ l2cap_clear_flag

+
@@ -1748,11 +1958,13 @@ Macros
-

Definition at line 160 of file BTD.h.

+

Definition at line 163 of file BTD.h.

- + +

◆ L2CAP_CMD_COMMAND_REJECT

+
@@ -1762,11 +1974,13 @@ Macros
-

Definition at line 163 of file BTD.h.

+

Definition at line 166 of file BTD.h.

- + +

◆ L2CAP_CMD_CONNECTION_REQUEST

+
@@ -1776,11 +1990,13 @@ Macros
-

Definition at line 164 of file BTD.h.

+

Definition at line 167 of file BTD.h.

- + +

◆ L2CAP_CMD_CONNECTION_RESPONSE

+
@@ -1790,11 +2006,13 @@ Macros
-

Definition at line 165 of file BTD.h.

+

Definition at line 168 of file BTD.h.

- + +

◆ L2CAP_CMD_CONFIG_REQUEST

+
@@ -1804,11 +2022,13 @@ Macros
-

Definition at line 166 of file BTD.h.

+

Definition at line 169 of file BTD.h.

- + +

◆ L2CAP_CMD_CONFIG_RESPONSE

+
@@ -1818,11 +2038,13 @@ Macros
-

Definition at line 167 of file BTD.h.

+

Definition at line 170 of file BTD.h.

- + +

◆ L2CAP_CMD_DISCONNECT_REQUEST

+
@@ -1832,11 +2054,13 @@ Macros
-

Definition at line 168 of file BTD.h.

+

Definition at line 171 of file BTD.h.

- + +

◆ L2CAP_CMD_DISCONNECT_RESPONSE

+
@@ -1846,11 +2070,13 @@ Macros
-

Definition at line 169 of file BTD.h.

+

Definition at line 172 of file BTD.h.

- + +

◆ L2CAP_CMD_INFORMATION_REQUEST

+
@@ -1860,11 +2086,13 @@ Macros
-

Definition at line 170 of file BTD.h.

+

Definition at line 173 of file BTD.h.

- + +

◆ L2CAP_CMD_INFORMATION_RESPONSE

+
@@ -1874,11 +2102,13 @@ Macros
-

Definition at line 171 of file BTD.h.

+

Definition at line 174 of file BTD.h.

- + +

◆ PENDING

+
@@ -1888,11 +2118,13 @@ Macros
-

Definition at line 174 of file BTD.h.

+

Definition at line 177 of file BTD.h.

- + +

◆ SUCCESSFUL

+
@@ -1902,11 +2134,13 @@ Macros
-

Definition at line 175 of file BTD.h.

+

Definition at line 178 of file BTD.h.

- + +

◆ SDP_PSM

+
@@ -1916,11 +2150,13 @@ Macros
-

Definition at line 178 of file BTD.h.

+

Definition at line 181 of file BTD.h.

- + +

◆ RFCOMM_PSM

+
@@ -1930,11 +2166,13 @@ Macros
-

Definition at line 179 of file BTD.h.

+

Definition at line 182 of file BTD.h.

- + +

◆ HID_CTRL_PSM

+
@@ -1944,11 +2182,13 @@ Macros
-

Definition at line 180 of file BTD.h.

+

Definition at line 183 of file BTD.h.

- + +

◆ HID_INTR_PSM

+
@@ -1958,11 +2198,13 @@ Macros
-

Definition at line 181 of file BTD.h.

+

Definition at line 184 of file BTD.h.

- + +

◆ WI_SUBCLASS_RF

+
@@ -1972,11 +2214,13 @@ Macros
-

Definition at line 184 of file BTD.h.

+

Definition at line 187 of file BTD.h.

- + +

◆ WI_PROTOCOL_BT

+
@@ -1986,11 +2230,13 @@ Macros
-

Definition at line 185 of file BTD.h.

+

Definition at line 188 of file BTD.h.

- + +

◆ BTD_MAX_ENDPOINTS

+
@@ -2000,11 +2246,13 @@ Macros
-

Definition at line 187 of file BTD.h.

+

Definition at line 190 of file BTD.h.

- + +

◆ BTD_NUM_SERVICES

+
@@ -2014,11 +2262,13 @@ Macros
-

Definition at line 188 of file BTD.h.

+

Definition at line 191 of file BTD.h.

- + +

◆ PAIR

+
@@ -2028,7 +2278,7 @@ Macros
-

Definition at line 190 of file BTD.h.

+

Definition at line 193 of file BTD.h.

@@ -2037,7 +2287,7 @@ Macros diff --git a/_b_t_d_8h__dep__incl.map b/_b_t_d_8h__dep__incl.map index a919230e..ff7d411a 100644 --- a/_b_t_d_8h__dep__incl.map +++ b/_b_t_d_8h__dep__incl.map @@ -1,9 +1,9 @@ - - + + - - + + diff --git a/_b_t_d_8h__dep__incl.md5 b/_b_t_d_8h__dep__incl.md5 index 3f896a89..a703410a 100644 --- a/_b_t_d_8h__dep__incl.md5 +++ b/_b_t_d_8h__dep__incl.md5 @@ -1 +1 @@ -1cf25c5527b32b2a9e530f3758fe7f24 \ No newline at end of file +6ddcb94ecd8f707ee805731d13407a4b \ No newline at end of file diff --git a/_b_t_d_8h__dep__incl.png b/_b_t_d_8h__dep__incl.png index 2b26b8cf..ca0b23ce 100644 Binary files a/_b_t_d_8h__dep__incl.png and b/_b_t_d_8h__dep__incl.png differ diff --git a/_b_t_d_8h__incl.md5 b/_b_t_d_8h__incl.md5 index e21490e4..251afce2 100644 --- a/_b_t_d_8h__incl.md5 +++ b/_b_t_d_8h__incl.md5 @@ -1 +1 @@ -197d6a6ff2afdc0a0703304559fc9c13 \ No newline at end of file +390162dc6dcc4addc7713fef630f65d1 \ No newline at end of file diff --git a/_b_t_d_8h__incl.png b/_b_t_d_8h__incl.png index 38484c5c..0a4ddf26 100644 Binary files a/_b_t_d_8h__incl.png and b/_b_t_d_8h__incl.png differ diff --git a/_b_t_d_8h_source.html b/_b_t_d_8h_source.html index a961ed8b..42189be1 100644 --- a/_b_t_d_8h_source.html +++ b/_b_t_d_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: BTD.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
BTD.h
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _btd_h_
19 #define _btd_h_
20 
21 #include "Usb.h"
22 #include "usbhid.h"
23 
24 //PID and VID of the Sony PS3 devices
25 #define PS3_VID 0x054C // Sony Corporation
26 #define PS3_PID 0x0268 // PS3 Controller DualShock 3
27 #define PS3NAVIGATION_PID 0x042F // Navigation controller
28 #define PS3MOVE_PID 0x03D5 // Motion controller
29 
30 #define IOGEAR_GBU521_VID 0x0A5C // The IOGEAR GBU521 dongle does not presents itself correctly, so we have to check for it manually
31 #define IOGEAR_GBU521_PID 0x21E8
32 
33 /* Bluetooth dongle data taken from descriptors */
34 #define BULK_MAXPKTSIZE 64 // Max size for ACL data
35 
36 // Used in control endpoint header for HCI Commands
37 #define bmREQ_HCI_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
38 
39 /* Bluetooth HCI states for hci_task() */
40 #define HCI_INIT_STATE 0
41 #define HCI_RESET_STATE 1
42 #define HCI_CLASS_STATE 2
43 #define HCI_BDADDR_STATE 3
44 #define HCI_LOCAL_VERSION_STATE 4
45 #define HCI_SET_NAME_STATE 5
46 #define HCI_CHECK_DEVICE_SERVICE 6
47 
48 #define HCI_INQUIRY_STATE 7 // These three states are only used if it should pair and connect to a device
49 #define HCI_CONNECT_DEVICE_STATE 8
50 #define HCI_CONNECTED_DEVICE_STATE 9
51 
52 #define HCI_SCANNING_STATE 10
53 #define HCI_CONNECT_IN_STATE 11
54 #define HCI_REMOTE_NAME_STATE 12
55 #define HCI_CONNECTED_STATE 13
56 #define HCI_DISABLE_SCAN_STATE 14
57 #define HCI_DONE_STATE 15
58 #define HCI_DISCONNECT_STATE 16
59 
60 /* HCI event flags*/
61 #define HCI_FLAG_CMD_COMPLETE (1UL << 0)
62 #define HCI_FLAG_CONNECT_COMPLETE (1UL << 1)
63 #define HCI_FLAG_DISCONNECT_COMPLETE (1UL << 2)
64 #define HCI_FLAG_REMOTE_NAME_COMPLETE (1UL << 3)
65 #define HCI_FLAG_INCOMING_REQUEST (1UL << 4)
66 #define HCI_FLAG_READ_BDADDR (1UL << 5)
67 #define HCI_FLAG_READ_VERSION (1UL << 6)
68 #define HCI_FLAG_DEVICE_FOUND (1UL << 7)
69 #define HCI_FLAG_CONNECT_EVENT (1UL << 8)
70 
71 /* Macros for HCI event flag tests */
72 #define hci_check_flag(flag) (hci_event_flag & (flag))
73 #define hci_set_flag(flag) (hci_event_flag |= (flag))
74 #define hci_clear_flag(flag) (hci_event_flag &= ~(flag))
75 
76 /* HCI Events managed */
77 #define EV_INQUIRY_COMPLETE 0x01
78 #define EV_INQUIRY_RESULT 0x02
79 #define EV_CONNECT_COMPLETE 0x03
80 #define EV_INCOMING_CONNECT 0x04
81 #define EV_DISCONNECT_COMPLETE 0x05
82 #define EV_AUTHENTICATION_COMPLETE 0x06
83 #define EV_REMOTE_NAME_COMPLETE 0x07
84 #define EV_ENCRYPTION_CHANGE 0x08
85 #define EV_CHANGE_CONNECTION_LINK 0x09
86 #define EV_ROLE_CHANGED 0x12
87 #define EV_NUM_COMPLETE_PKT 0x13
88 #define EV_PIN_CODE_REQUEST 0x16
89 #define EV_LINK_KEY_REQUEST 0x17
90 #define EV_LINK_KEY_NOTIFICATION 0x18
91 #define EV_DATA_BUFFER_OVERFLOW 0x1A
92 #define EV_MAX_SLOTS_CHANGE 0x1B
93 #define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE 0x0C
94 #define EV_QOS_SETUP_COMPLETE 0x0D
95 #define EV_COMMAND_COMPLETE 0x0E
96 #define EV_COMMAND_STATUS 0x0F
97 #define EV_LOOPBACK_COMMAND 0x19
98 #define EV_PAGE_SCAN_REP_MODE 0x20
99 
100 /* Bluetooth states for the different Bluetooth drivers */
101 #define L2CAP_WAIT 0
102 #define L2CAP_DONE 1
103 
104 /* Used for HID Control channel */
105 #define L2CAP_CONTROL_CONNECT_REQUEST 2
106 #define L2CAP_CONTROL_CONFIG_REQUEST 3
107 #define L2CAP_CONTROL_SUCCESS 4
108 #define L2CAP_CONTROL_DISCONNECT 5
109 
110 /* Used for HID Interrupt channel */
111 #define L2CAP_INTERRUPT_SETUP 6
112 #define L2CAP_INTERRUPT_CONNECT_REQUEST 7
113 #define L2CAP_INTERRUPT_CONFIG_REQUEST 8
114 #define L2CAP_INTERRUPT_DISCONNECT 9
115 
116 /* Used for SDP channel */
117 #define L2CAP_SDP_WAIT 10
118 #define L2CAP_SDP_SUCCESS 11
119 
120 /* Used for RFCOMM channel */
121 #define L2CAP_RFCOMM_WAIT 12
122 #define L2CAP_RFCOMM_SUCCESS 13
123 
124 #define L2CAP_DISCONNECT_RESPONSE 14 // Used for both SDP and RFCOMM channel
125 
126 /* Bluetooth states used by some drivers */
127 #define TURN_ON_LED 17
128 #define PS3_ENABLE_SIXAXIS 18
129 #define WII_CHECK_MOTION_PLUS_STATE 19
130 #define WII_CHECK_EXTENSION_STATE 20
131 #define WII_INIT_MOTION_PLUS_STATE 21
132 
133 /* L2CAP event flags for HID Control channel */
134 #define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST (1UL << 0)
135 #define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS (1UL << 1)
136 #define L2CAP_FLAG_CONTROL_CONNECTED (1UL << 2)
137 #define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE (1UL << 3)
138 
139 /* L2CAP event flags for HID Interrupt channel */
140 #define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST (1UL << 4)
141 #define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS (1UL << 5)
142 #define L2CAP_FLAG_INTERRUPT_CONNECTED (1UL << 6)
143 #define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE (1UL << 7)
144 
145 /* L2CAP event flags for SDP channel */
146 #define L2CAP_FLAG_CONNECTION_SDP_REQUEST (1UL << 8)
147 #define L2CAP_FLAG_CONFIG_SDP_SUCCESS (1UL << 9)
148 #define L2CAP_FLAG_DISCONNECT_SDP_REQUEST (1UL << 10)
149 
150 /* L2CAP event flags for RFCOMM channel */
151 #define L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST (1UL << 11)
152 #define L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS (1UL << 12)
153 #define L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST (1UL << 13)
154 
155 #define L2CAP_FLAG_DISCONNECT_RESPONSE (1UL << 14)
156 
157 /* Macros for L2CAP event flag tests */
158 #define l2cap_check_flag(flag) (l2cap_event_flag & (flag))
159 #define l2cap_set_flag(flag) (l2cap_event_flag |= (flag))
160 #define l2cap_clear_flag(flag) (l2cap_event_flag &= ~(flag))
161 
162 /* L2CAP signaling commands */
163 #define L2CAP_CMD_COMMAND_REJECT 0x01
164 #define L2CAP_CMD_CONNECTION_REQUEST 0x02
165 #define L2CAP_CMD_CONNECTION_RESPONSE 0x03
166 #define L2CAP_CMD_CONFIG_REQUEST 0x04
167 #define L2CAP_CMD_CONFIG_RESPONSE 0x05
168 #define L2CAP_CMD_DISCONNECT_REQUEST 0x06
169 #define L2CAP_CMD_DISCONNECT_RESPONSE 0x07
170 #define L2CAP_CMD_INFORMATION_REQUEST 0x0A
171 #define L2CAP_CMD_INFORMATION_RESPONSE 0x0B
172 
173 // Used For Connection Response - Remember to Include High Byte
174 #define PENDING 0x01
175 #define SUCCESSFUL 0x00
176 
177 /* Bluetooth L2CAP PSM - see http://www.bluetooth.org/Technical/AssignedNumbers/logical_link.htm */
178 #define SDP_PSM 0x01 // Service Discovery Protocol PSM Value
179 #define RFCOMM_PSM 0x03 // RFCOMM PSM Value
180 #define HID_CTRL_PSM 0x11 // HID_Control PSM Value
181 #define HID_INTR_PSM 0x13 // HID_Interrupt PSM Value
182 
183 // Used to determine if it is a Bluetooth dongle
184 #define WI_SUBCLASS_RF 0x01 // RF Controller
185 #define WI_PROTOCOL_BT 0x01 // Bluetooth Programming Interface
186 
187 #define BTD_MAX_ENDPOINTS 4
188 #define BTD_NUM_SERVICES 4 // Max number of Bluetooth services - if you need more than 4 simply increase this number
189 
190 #define PAIR 1
191 
192 class BluetoothService;
193 
198 class BTD : public USBDeviceConfig, public UsbConfigXtracter {
199 public:
204  BTD(USB *p);
205 
214  uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed);
222  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
227  uint8_t Release();
232  uint8_t Poll();
233 
238  virtual uint8_t GetAddress() {
239  return bAddress;
240  };
241 
246  virtual bool isReady() {
247  return bPollEnable;
248  };
249 
255  virtual bool DEVCLASSOK(uint8_t klass) {
256  return (klass == USB_CLASS_WIRELESS_CTRL);
257  };
258 
266  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
267  if(vid == IOGEAR_GBU521_VID && pid == IOGEAR_GBU521_PID)
268  return true;
269  if(my_bdaddr[0] != 0x00 || my_bdaddr[1] != 0x00 || my_bdaddr[2] != 0x00 || my_bdaddr[3] != 0x00 || my_bdaddr[4] != 0x00 || my_bdaddr[5] != 0x00) { // Check if Bluetooth address is set
270  if(vid == PS3_VID && (pid == PS3_PID || pid == PS3NAVIGATION_PID || pid == PS3MOVE_PID))
271  return true;
272  }
273  return false;
274  };
286  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
290  void disconnect();
291 
298  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++) {
299  if(!btService[i]) {
300  btService[i] = pService;
301  return i; // Return ID
302  }
303  }
304  return -1; // Error registering BluetoothService
305  };
306 
313  void HCI_Command(uint8_t* data, uint16_t nbytes);
315  void hci_reset();
317  void hci_read_bdaddr();
324  void hci_set_local_name(const char* name);
326  void hci_write_scan_enable();
328  void hci_write_scan_disable();
330  void hci_remote_name();
332  void hci_accept_connection();
337  void hci_disconnect(uint16_t handle);
354  void hci_inquiry();
356  void hci_inquiry_cancel();
358  void hci_connect();
363  void hci_connect(uint8_t *bdaddr);
377  void L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow = 0x01, uint8_t channelHigh = 0x00);
385  void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t* scid, uint16_t psm);
394  void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid, uint8_t result);
401  void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t* dcid);
408  void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t* scid);
416  void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);
424  void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);
431  void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh);
442 
444  const char* btdName;
446  const char* btdPin;
447 
449  uint8_t my_bdaddr[6];
451  uint16_t hci_handle;
453  uint8_t disc_bdaddr[6];
455  char remote_name[30];
461  uint8_t hci_version;
462 
465  pairWithWii = true;
466  hci_state = HCI_CHECK_DEVICE_SERVICE;
467  };
469  bool connectToWii;
478 
480  void pairWithHID() {
481  pairWithHIDDevice = true;
482  hci_state = HCI_CHECK_DEVICE_SERVICE;
483  };
485  bool connectToHIDDevice;
490 
495  uint8_t readPollInterval() {
496  return pollInterval;
497  };
498 
499 protected:
501  USB *pUsb;
503  uint8_t bAddress;
506 
508  uint8_t bConfNum;
510  uint8_t bNumEP;
512  uint32_t qNextPollTime;
513 
515  static const uint8_t BTD_CONTROL_PIPE;
517  static const uint8_t BTD_EVENT_PIPE;
519  static const uint8_t BTD_DATAIN_PIPE;
521  static const uint8_t BTD_DATAOUT_PIPE;
522 
528 
529 private:
530  void Initialize(); // Set all variables, endpoint structs etc. to default values
532 
533  uint16_t PID, VID; // PID and VID of device connected
534 
535  uint8_t pollInterval;
536  bool bPollEnable;
537 
538  bool pairWiiUsingSync; // True if pairing was done using the Wii SYNC button.
539  bool checkRemoteName; // Used to check remote device's name before connecting.
540  bool incomingPS4; // True if a PS4 controller is connecting
541  uint8_t classOfDevice[3]; // Class of device of last device
542 
543  /* Variables used by high level HCI task */
544  uint8_t hci_state; // Current state of Bluetooth HCI connection
545  uint16_t hci_counter; // Counter used for Bluetooth HCI reset loops
546  uint16_t hci_num_reset_loops; // This value indicate how many times it should read before trying to reset
547  uint16_t hci_event_flag; // HCI flags of received Bluetooth events
548  uint8_t inquiry_counter;
549 
550  uint8_t hcibuf[BULK_MAXPKTSIZE]; // General purpose buffer for HCI data
551  uint8_t l2capinbuf[BULK_MAXPKTSIZE]; // General purpose buffer for L2CAP in data
552  uint8_t l2capoutbuf[14]; // General purpose buffer for L2CAP out data
553 
554  /* State machines */
555  void HCI_event_task(); // Poll the HCI event pipe
556  void HCI_task(); // HCI state machine
557  void ACL_event_task(); // ACL input pipe
558 
559  /* Used to set the Bluetooth Address internally to the PS3 Controllers */
560  void setBdaddr(uint8_t* BDADDR);
561  void setMoveBdaddr(uint8_t* BDADDR);
562 };
563 
566 public:
567  BluetoothService(BTD *p) : pBtd(p) {
568  if(pBtd)
569  pBtd->registerBluetoothService(this); // Register it as a Bluetooth service
570  };
575  virtual void ACLData(uint8_t* ACLData) = 0;
577  virtual void Run() = 0;
579  virtual void Reset() = 0;
581  virtual void disconnect() = 0;
582 
587  void attachOnInit(void (*funcOnInit)(void)) {
588  pFuncOnInit = funcOnInit; // TODO: This really belong in a class of it's own as it is repeated several times
589  };
590 
591 protected:
597  virtual void onInit() = 0;
598 
600  bool checkHciHandle(uint8_t *buf, uint16_t handle) {
601  return (buf[0] == (handle & 0xFF)) && (buf[1] == ((handle >> 8) | 0x20));
602  }
603 
605  void (*pFuncOnInit)(void);
606 
609 
611  uint16_t hci_handle;
612 
615 
617  uint8_t identifier;
618 };
619 
620 #endif
static const uint8_t BTD_DATAOUT_PIPE
Definition: BTD.h:521
-
bool incomingWii
Definition: BTD.h:471
-
void hci_connect()
Definition: BTD.cpp:1073
-
uint8_t bNumEP
Definition: BTD.h:510
-
const char * btdName
Definition: BTD.h:444
-
void hci_reset()
Definition: BTD.cpp:955
-
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1262
-
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
Definition: BTD.cpp:1249
-
bool sdpConnectionClaimed
Definition: BTD.h:439
-
Definition: BTD.h:198
-
int8_t registerBluetoothService(BluetoothService *pService)
Definition: BTD.h:297
-
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1315
-
bool rfcommConnectionClaimed
Definition: BTD.h:441
-
uint8_t hci_version
Definition: BTD.h:461
-
void hci_inquiry()
Definition: BTD.cpp:1051
-
static const uint8_t BTD_EVENT_PIPE
Definition: BTD.h:517
+Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _btd_h_
19 #define _btd_h_
20 
21 #include "Usb.h"
22 #include "usbhid.h"
23 
24 //PID and VID of the Sony PS3 devices
25 #define PS3_VID 0x054C // Sony Corporation
26 #define PS3_PID 0x0268 // PS3 Controller DualShock 3
27 #define PS3NAVIGATION_PID 0x042F // Navigation controller
28 #define PS3MOVE_PID 0x03D5 // Motion controller
29 
30 // These dongles do not present themselves correctly, so we have to check for them manually
31 #define IOGEAR_GBU521_VID 0x0A5C
32 #define IOGEAR_GBU521_PID 0x21E8
33 #define BELKIN_F8T065BF_VID 0x050D
34 #define BELKIN_F8T065BF_PID 0x065A
35 
36 /* Bluetooth dongle data taken from descriptors */
37 #define BULK_MAXPKTSIZE 64 // Max size for ACL data
38 
39 // Used in control endpoint header for HCI Commands
40 #define bmREQ_HCI_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
41 
42 /* Bluetooth HCI states for hci_task() */
43 #define HCI_INIT_STATE 0
44 #define HCI_RESET_STATE 1
45 #define HCI_CLASS_STATE 2
46 #define HCI_BDADDR_STATE 3
47 #define HCI_LOCAL_VERSION_STATE 4
48 #define HCI_SET_NAME_STATE 5
49 #define HCI_CHECK_DEVICE_SERVICE 6
50 
51 #define HCI_INQUIRY_STATE 7 // These three states are only used if it should pair and connect to a device
52 #define HCI_CONNECT_DEVICE_STATE 8
53 #define HCI_CONNECTED_DEVICE_STATE 9
54 
55 #define HCI_SCANNING_STATE 10
56 #define HCI_CONNECT_IN_STATE 11
57 #define HCI_REMOTE_NAME_STATE 12
58 #define HCI_CONNECTED_STATE 13
59 #define HCI_DISABLE_SCAN_STATE 14
60 #define HCI_DONE_STATE 15
61 #define HCI_DISCONNECT_STATE 16
62 
63 /* HCI event flags*/
64 #define HCI_FLAG_CMD_COMPLETE (1UL << 0)
65 #define HCI_FLAG_CONNECT_COMPLETE (1UL << 1)
66 #define HCI_FLAG_DISCONNECT_COMPLETE (1UL << 2)
67 #define HCI_FLAG_REMOTE_NAME_COMPLETE (1UL << 3)
68 #define HCI_FLAG_INCOMING_REQUEST (1UL << 4)
69 #define HCI_FLAG_READ_BDADDR (1UL << 5)
70 #define HCI_FLAG_READ_VERSION (1UL << 6)
71 #define HCI_FLAG_DEVICE_FOUND (1UL << 7)
72 #define HCI_FLAG_CONNECT_EVENT (1UL << 8)
73 
74 /* Macros for HCI event flag tests */
75 #define hci_check_flag(flag) (hci_event_flag & (flag))
76 #define hci_set_flag(flag) (hci_event_flag |= (flag))
77 #define hci_clear_flag(flag) (hci_event_flag &= ~(flag))
78 
79 /* HCI Events managed */
80 #define EV_INQUIRY_COMPLETE 0x01
81 #define EV_INQUIRY_RESULT 0x02
82 #define EV_CONNECT_COMPLETE 0x03
83 #define EV_INCOMING_CONNECT 0x04
84 #define EV_DISCONNECT_COMPLETE 0x05
85 #define EV_AUTHENTICATION_COMPLETE 0x06
86 #define EV_REMOTE_NAME_COMPLETE 0x07
87 #define EV_ENCRYPTION_CHANGE 0x08
88 #define EV_CHANGE_CONNECTION_LINK 0x09
89 #define EV_ROLE_CHANGED 0x12
90 #define EV_NUM_COMPLETE_PKT 0x13
91 #define EV_PIN_CODE_REQUEST 0x16
92 #define EV_LINK_KEY_REQUEST 0x17
93 #define EV_LINK_KEY_NOTIFICATION 0x18
94 #define EV_DATA_BUFFER_OVERFLOW 0x1A
95 #define EV_MAX_SLOTS_CHANGE 0x1B
96 #define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE 0x0C
97 #define EV_QOS_SETUP_COMPLETE 0x0D
98 #define EV_COMMAND_COMPLETE 0x0E
99 #define EV_COMMAND_STATUS 0x0F
100 #define EV_LOOPBACK_COMMAND 0x19
101 #define EV_PAGE_SCAN_REP_MODE 0x20
102 
103 /* Bluetooth states for the different Bluetooth drivers */
104 #define L2CAP_WAIT 0
105 #define L2CAP_DONE 1
106 
107 /* Used for HID Control channel */
108 #define L2CAP_CONTROL_CONNECT_REQUEST 2
109 #define L2CAP_CONTROL_CONFIG_REQUEST 3
110 #define L2CAP_CONTROL_SUCCESS 4
111 #define L2CAP_CONTROL_DISCONNECT 5
112 
113 /* Used for HID Interrupt channel */
114 #define L2CAP_INTERRUPT_SETUP 6
115 #define L2CAP_INTERRUPT_CONNECT_REQUEST 7
116 #define L2CAP_INTERRUPT_CONFIG_REQUEST 8
117 #define L2CAP_INTERRUPT_DISCONNECT 9
118 
119 /* Used for SDP channel */
120 #define L2CAP_SDP_WAIT 10
121 #define L2CAP_SDP_SUCCESS 11
122 
123 /* Used for RFCOMM channel */
124 #define L2CAP_RFCOMM_WAIT 12
125 #define L2CAP_RFCOMM_SUCCESS 13
126 
127 #define L2CAP_DISCONNECT_RESPONSE 14 // Used for both SDP and RFCOMM channel
128 
129 /* Bluetooth states used by some drivers */
130 #define TURN_ON_LED 17
131 #define PS3_ENABLE_SIXAXIS 18
132 #define WII_CHECK_MOTION_PLUS_STATE 19
133 #define WII_CHECK_EXTENSION_STATE 20
134 #define WII_INIT_MOTION_PLUS_STATE 21
135 
136 /* L2CAP event flags for HID Control channel */
137 #define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST (1UL << 0)
138 #define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS (1UL << 1)
139 #define L2CAP_FLAG_CONTROL_CONNECTED (1UL << 2)
140 #define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE (1UL << 3)
141 
142 /* L2CAP event flags for HID Interrupt channel */
143 #define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST (1UL << 4)
144 #define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS (1UL << 5)
145 #define L2CAP_FLAG_INTERRUPT_CONNECTED (1UL << 6)
146 #define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE (1UL << 7)
147 
148 /* L2CAP event flags for SDP channel */
149 #define L2CAP_FLAG_CONNECTION_SDP_REQUEST (1UL << 8)
150 #define L2CAP_FLAG_CONFIG_SDP_SUCCESS (1UL << 9)
151 #define L2CAP_FLAG_DISCONNECT_SDP_REQUEST (1UL << 10)
152 
153 /* L2CAP event flags for RFCOMM channel */
154 #define L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST (1UL << 11)
155 #define L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS (1UL << 12)
156 #define L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST (1UL << 13)
157 
158 #define L2CAP_FLAG_DISCONNECT_RESPONSE (1UL << 14)
159 
160 /* Macros for L2CAP event flag tests */
161 #define l2cap_check_flag(flag) (l2cap_event_flag & (flag))
162 #define l2cap_set_flag(flag) (l2cap_event_flag |= (flag))
163 #define l2cap_clear_flag(flag) (l2cap_event_flag &= ~(flag))
164 
165 /* L2CAP signaling commands */
166 #define L2CAP_CMD_COMMAND_REJECT 0x01
167 #define L2CAP_CMD_CONNECTION_REQUEST 0x02
168 #define L2CAP_CMD_CONNECTION_RESPONSE 0x03
169 #define L2CAP_CMD_CONFIG_REQUEST 0x04
170 #define L2CAP_CMD_CONFIG_RESPONSE 0x05
171 #define L2CAP_CMD_DISCONNECT_REQUEST 0x06
172 #define L2CAP_CMD_DISCONNECT_RESPONSE 0x07
173 #define L2CAP_CMD_INFORMATION_REQUEST 0x0A
174 #define L2CAP_CMD_INFORMATION_RESPONSE 0x0B
175 
176 // Used For Connection Response - Remember to Include High Byte
177 #define PENDING 0x01
178 #define SUCCESSFUL 0x00
179 
180 /* Bluetooth L2CAP PSM - see http://www.bluetooth.org/Technical/AssignedNumbers/logical_link.htm */
181 #define SDP_PSM 0x01 // Service Discovery Protocol PSM Value
182 #define RFCOMM_PSM 0x03 // RFCOMM PSM Value
183 #define HID_CTRL_PSM 0x11 // HID_Control PSM Value
184 #define HID_INTR_PSM 0x13 // HID_Interrupt PSM Value
185 
186 // Used to determine if it is a Bluetooth dongle
187 #define WI_SUBCLASS_RF 0x01 // RF Controller
188 #define WI_PROTOCOL_BT 0x01 // Bluetooth Programming Interface
189 
190 #define BTD_MAX_ENDPOINTS 4
191 #define BTD_NUM_SERVICES 4 // Max number of Bluetooth services - if you need more than 4 simply increase this number
192 
193 #define PAIR 1
194 
195 class BluetoothService;
196 
201 class BTD : public USBDeviceConfig, public UsbConfigXtracter {
202 public:
207  BTD(USB *p);
208 
217  uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed);
225  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
230  uint8_t Release();
235  uint8_t Poll();
236 
241  virtual uint8_t GetAddress() {
242  return bAddress;
243  };
244 
249  virtual bool isReady() {
250  return bPollEnable;
251  };
252 
258  virtual bool DEVCLASSOK(uint8_t klass) {
259  return (klass == USB_CLASS_WIRELESS_CTRL);
260  };
261 
269  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
270  if((vid == IOGEAR_GBU521_VID && pid == IOGEAR_GBU521_PID) || (vid == BELKIN_F8T065BF_VID && pid == BELKIN_F8T065BF_PID))
271  return true;
272  if(my_bdaddr[0] != 0x00 || my_bdaddr[1] != 0x00 || my_bdaddr[2] != 0x00 || my_bdaddr[3] != 0x00 || my_bdaddr[4] != 0x00 || my_bdaddr[5] != 0x00) { // Check if Bluetooth address is set
273  if(vid == PS3_VID && (pid == PS3_PID || pid == PS3NAVIGATION_PID || pid == PS3MOVE_PID))
274  return true;
275  }
276  return false;
277  };
289  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
293  void disconnect();
294 
301  for(uint8_t i = 0; i < BTD_NUM_SERVICES; i++) {
302  if(!btService[i]) {
303  btService[i] = pService;
304  return i; // Return ID
305  }
306  }
307  return -1; // Error registering BluetoothService
308  };
309 
316  void HCI_Command(uint8_t* data, uint16_t nbytes);
318  void hci_reset();
320  void hci_read_bdaddr();
327  void hci_set_local_name(const char* name);
329  void hci_write_scan_enable();
331  void hci_write_scan_disable();
333  void hci_remote_name();
335  void hci_accept_connection();
340  void hci_disconnect(uint16_t handle);
357  void hci_inquiry();
359  void hci_inquiry_cancel();
361  void hci_connect();
366  void hci_connect(uint8_t *bdaddr);
380  void L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow = 0x01, uint8_t channelHigh = 0x00);
388  void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t* scid, uint16_t psm);
397  void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid, uint8_t result);
404  void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t* dcid);
411  void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t* scid);
419  void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);
427  void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid);
434  void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh);
445 
447  const char* btdName;
449  const char* btdPin;
450 
452  uint8_t my_bdaddr[6];
454  uint16_t hci_handle;
456  uint8_t disc_bdaddr[6];
458  char remote_name[30];
464  uint8_t hci_version;
465 
468  pairWithWii = true;
469  hci_state = HCI_CHECK_DEVICE_SERVICE;
470  };
472  bool connectToWii;
481 
483  void pairWithHID() {
484  waitingForConnection = false;
485  pairWithHIDDevice = true;
486  hci_state = HCI_CHECK_DEVICE_SERVICE;
487  };
489  bool connectToHIDDevice;
494 
499  uint8_t readPollInterval() {
500  return pollInterval;
501  };
502 
503 protected:
505  USB *pUsb;
507  uint8_t bAddress;
510 
512  uint8_t bConfNum;
514  uint8_t bNumEP;
516  uint32_t qNextPollTime;
517 
519  static const uint8_t BTD_CONTROL_PIPE;
521  static const uint8_t BTD_EVENT_PIPE;
523  static const uint8_t BTD_DATAIN_PIPE;
525  static const uint8_t BTD_DATAOUT_PIPE;
526 
532 
533 private:
534  void Initialize(); // Set all variables, endpoint structs etc. to default values
536 
537  uint16_t PID, VID; // PID and VID of device connected
538 
539  uint8_t pollInterval;
540  bool bPollEnable;
541 
542  bool pairWiiUsingSync; // True if pairing was done using the Wii SYNC button.
543  bool checkRemoteName; // Used to check remote device's name before connecting.
544  bool incomingPS4; // True if a PS4 controller is connecting
545  uint8_t classOfDevice[3]; // Class of device of last device
546 
547  /* Variables used by high level HCI task */
548  uint8_t hci_state; // Current state of Bluetooth HCI connection
549  uint16_t hci_counter; // Counter used for Bluetooth HCI reset loops
550  uint16_t hci_num_reset_loops; // This value indicate how many times it should read before trying to reset
551  uint16_t hci_event_flag; // HCI flags of received Bluetooth events
552  uint8_t inquiry_counter;
553 
554  uint8_t hcibuf[BULK_MAXPKTSIZE]; // General purpose buffer for HCI data
555  uint8_t l2capinbuf[BULK_MAXPKTSIZE]; // General purpose buffer for L2CAP in data
556  uint8_t l2capoutbuf[14]; // General purpose buffer for L2CAP out data
557 
558  /* State machines */
559  void HCI_event_task(); // Poll the HCI event pipe
560  void HCI_task(); // HCI state machine
561  void ACL_event_task(); // ACL input pipe
562 
563  /* Used to set the Bluetooth Address internally to the PS3 Controllers */
564  void setBdaddr(uint8_t* BDADDR);
565  void setMoveBdaddr(uint8_t* BDADDR);
566 };
567 
570 public:
572  if(pBtd)
573  pBtd->registerBluetoothService(this); // Register it as a Bluetooth service
574  };
579  virtual void ACLData(uint8_t* ACLData) = 0;
581  virtual void Run() = 0;
583  virtual void Reset() = 0;
585  virtual void disconnect() = 0;
586 
591  void attachOnInit(void (*funcOnInit)(void)) {
592  pFuncOnInit = funcOnInit; // TODO: This really belong in a class of it's own as it is repeated several times
593  };
594 
595 protected:
601  virtual void onInit() = 0;
602 
604  bool checkHciHandle(uint8_t *buf, uint16_t handle) {
605  return (buf[0] == (handle & 0xFF)) && (buf[1] == ((handle >> 8) | 0x20));
606  }
607 
609  void (*pFuncOnInit)(void);
610 
613 
615  uint16_t hci_handle;
616 
619 
621  uint8_t identifier;
622 };
623 
624 #endif
static const uint8_t BTD_DATAOUT_PIPE
Definition: BTD.h:525
+
bool incomingWii
Definition: BTD.h:474
+
void hci_connect()
Definition: BTD.cpp:1071
+
uint8_t bNumEP
Definition: BTD.h:514
+
const char * btdName
Definition: BTD.h:447
+
void hci_reset()
Definition: BTD.cpp:953
+
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1260
+
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
Definition: BTD.cpp:1247
+
bool sdpConnectionClaimed
Definition: BTD.h:442
+
Definition: BTD.h:201
+
int8_t registerBluetoothService(BluetoothService *pService)
Definition: BTD.h:300
+
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1313
+
bool rfcommConnectionClaimed
Definition: BTD.h:444
+
uint8_t hci_version
Definition: BTD.h:464
+
bool waitingForConnection
Definition: BTD.h:438
+
void hci_inquiry()
Definition: BTD.cpp:1049
+
static const uint8_t BTD_EVENT_PIPE
Definition: BTD.h:521
#define PS3MOVE_PID
Definition: BTD.h:28
- -
bool pairWithWii
Definition: BTD.h:473
-
uint8_t identifier
Definition: BTD.h:617
-
void hci_write_scan_disable()
Definition: BTD.cpp:977
+ +
bool pairWithWii
Definition: BTD.h:476
+
uint8_t identifier
Definition: BTD.h:621
+
void hci_write_scan_disable()
Definition: BTD.cpp:975
+
#define BELKIN_F8T065BF_PID
Definition: BTD.h:34
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: BTD.cpp:327
-
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: BTD.h:266
-
virtual uint8_t GetAddress()
Definition: BTD.h:238
-
#define BTD_NUM_SERVICES
Definition: BTD.h:188
-
const char * btdPin
Definition: BTD.h:446
-
bool motionPlusInside
Definition: BTD.h:475
-
void hci_remote_name()
Definition: BTD.cpp:1020
- +
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: BTD.h:269
+
virtual uint8_t GetAddress()
Definition: BTD.h:241
+
#define BTD_NUM_SERVICES
Definition: BTD.h:191
+
const char * btdPin
Definition: BTD.h:449
+
bool motionPlusInside
Definition: BTD.h:478
+
void hci_remote_name()
Definition: BTD.cpp:1018
+ +
#define BELKIN_F8T065BF_VID
Definition: BTD.h:33
#define PS3_VID
Definition: BTD.h:25
BTD(USB *p)
Definition: BTD.cpp:27
-
char remote_name[30]
Definition: BTD.h:455
-
uint8_t readPollInterval()
Definition: BTD.h:495
-
static const uint8_t BTD_DATAIN_PIPE
Definition: BTD.h:519
-
void hci_set_local_name(const char *name)
Definition: BTD.cpp:1039
-
void hci_write_scan_enable()
Definition: BTD.cpp:964
-
uint8_t Release()
Definition: BTD.cpp:378
-
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1328
-
#define USB_CLASS_WIRELESS_CTRL
Definition: UsbCore.h:71
-
bool watingForConnection
Definition: BTD.h:435
-
bool connectToHIDDevice
Definition: BTD.h:483
-
uint8_t bAddress
Definition: BTD.h:503
-
bool incomingHIDDevice
Definition: BTD.h:487
-
bool pairWithHIDDevice
Definition: BTD.h:489
-
uint32_t qNextPollTime
Definition: BTD.h:512
-
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: BTD.cpp:359
-
#define IOGEAR_GBU521_PID
Definition: BTD.h:31
-
bool connectToWii
Definition: BTD.h:467
+
char remote_name[30]
Definition: BTD.h:458
+
uint8_t readPollInterval()
Definition: BTD.h:499
+
virtual void Reset()=0
+
static const uint8_t BTD_DATAIN_PIPE
Definition: BTD.h:523
+
void hci_set_local_name(const char *name)
Definition: BTD.cpp:1037
+
void hci_write_scan_enable()
Definition: BTD.cpp:962
+
uint8_t Release()
Definition: BTD.cpp:376
+
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1326
+
#define USB_CLASS_WIRELESS_CTRL
Definition: UsbCore.h:82
+
bool connectToHIDDevice
Definition: BTD.h:487
+
uint8_t bAddress
Definition: BTD.h:507
+
bool incomingHIDDevice
Definition: BTD.h:491
+
bool pairWithHIDDevice
Definition: BTD.h:493
+
uint32_t qNextPollTime
Definition: BTD.h:516
+
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: BTD.cpp:357
+
#define IOGEAR_GBU521_PID
Definition: BTD.h:32
+
bool connectToWii
Definition: BTD.h:470
uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: BTD.cpp:48
-
bool wiiUProController
Definition: BTD.h:477
-
uint16_t hci_handle
Definition: BTD.h:451
+
virtual void disconnect()=0
+
bool wiiUProController
Definition: BTD.h:480
+
uint16_t hci_handle
Definition: BTD.h:454
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: BTD.cpp:134
-
Definition: address.h:32
-
void pairWithHID()
Definition: BTD.h:480
-
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1173
- -
void hci_read_bdaddr()
Definition: BTD.cpp:986
-
void hci_inquiry_cancel()
Definition: BTD.cpp:1065
-
uint8_t my_bdaddr[6]
Definition: BTD.h:449
-
void attachOnInit(void(*funcOnInit)(void))
Definition: BTD.h:587
-
uint8_t Poll()
Definition: BTD.cpp:384
-
static const uint8_t BTD_CONTROL_PIPE
Definition: BTD.h:515
- -
BTD * pBtd
Definition: BTD.h:608
-
#define BULK_MAXPKTSIZE
Definition: BTD.h:34
-
void disconnect()
Definition: BTD.cpp:396
-
uint8_t disc_bdaddr[6]
Definition: BTD.h:453
-
bool l2capConnectionClaimed
Definition: BTD.h:437
-
EpInfo epInfo[BTD_MAX_ENDPOINTS]
Definition: BTD.h:505
-
#define IOGEAR_GBU521_VID
Definition: BTD.h:30
+
Definition: address.h:39
+
void pairWithHID()
Definition: BTD.h:483
+
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1171
+ +
void hci_read_bdaddr()
Definition: BTD.cpp:984
+
void hci_inquiry_cancel()
Definition: BTD.cpp:1063
+
virtual void Run()=0
+
uint8_t my_bdaddr[6]
Definition: BTD.h:452
+
void(* pFuncOnInit)(void)
Definition: BTD.h:609
+
void attachOnInit(void(*funcOnInit)(void))
Definition: BTD.h:591
+
uint8_t Poll()
Definition: BTD.cpp:382
+
static const uint8_t BTD_CONTROL_PIPE
Definition: BTD.h:519
+ +
BTD * pBtd
Definition: BTD.h:612
+
#define BULK_MAXPKTSIZE
Definition: BTD.h:37
+
void disconnect()
Definition: BTD.cpp:394
+
uint8_t disc_bdaddr[6]
Definition: BTD.h:456
+
bool l2capConnectionClaimed
Definition: BTD.h:440
+
EpInfo epInfo[BTD_MAX_ENDPOINTS]
Definition: BTD.h:509
+
#define IOGEAR_GBU521_VID
Definition: BTD.h:31
#define PS3_PID
Definition: BTD.h:26
-
#define BTD_MAX_ENDPOINTS
Definition: BTD.h:187
+
#define BTD_MAX_ENDPOINTS
Definition: BTD.h:190
#define PS3NAVIGATION_PID
Definition: BTD.h:27
-
void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)
Definition: BTD.cpp:1341
-
BluetoothService(BTD *p)
Definition: BTD.h:567
+
void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)
Definition: BTD.cpp:1339
+
BluetoothService(BTD *p)
Definition: BTD.h:571
-
void hci_write_class_of_device()
Definition: BTD.cpp:1185
-
uint16_t hci_handle
Definition: BTD.h:611
-
void hci_pin_code_negative_request_reply()
Definition: BTD.cpp:1135
-
virtual bool DEVCLASSOK(uint8_t klass)
Definition: BTD.h:255
-
uint32_t l2cap_event_flag
Definition: BTD.h:614
-
#define HCI_CHECK_DEVICE_SERVICE
Definition: BTD.h:46
-
Definition: UsbCore.h:197
-
uint8_t bConfNum
Definition: BTD.h:508
-
void hci_link_key_request_negative_reply()
Definition: BTD.cpp:1149
-
void pairWithWiimote()
Definition: BTD.h:464
-
virtual bool isReady()
Definition: BTD.h:246
-
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1221
-
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1296
-
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1279
-
void hci_pin_code_request_reply()
Definition: BTD.cpp:1099
-
USB * pUsb
Definition: BTD.h:497
-
void hci_authentication_request()
Definition: BTD.cpp:1163
-
void hci_read_local_version_information()
Definition: BTD.cpp:995
-
void hci_accept_connection()
Definition: BTD.cpp:1004
-
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:600
-
void HCI_Command(uint8_t *data, uint16_t nbytes)
Definition: BTD.cpp:950
+
void hci_write_class_of_device()
Definition: BTD.cpp:1183
+
uint16_t hci_handle
Definition: BTD.h:615
+
void hci_pin_code_negative_request_reply()
Definition: BTD.cpp:1133
+
virtual void ACLData(uint8_t *ACLData)=0
+
virtual bool DEVCLASSOK(uint8_t klass)
Definition: BTD.h:258
+
uint32_t l2cap_event_flag
Definition: BTD.h:618
+
#define HCI_CHECK_DEVICE_SERVICE
Definition: BTD.h:49
+
Definition: UsbCore.h:208
+
uint8_t bConfNum
Definition: BTD.h:512
+
void hci_link_key_request_negative_reply()
Definition: BTD.cpp:1147
+
void pairWithWiimote()
Definition: BTD.h:467
+
virtual bool isReady()
Definition: BTD.h:249
+
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1219
+
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1294
+
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1277
+
void hci_pin_code_request_reply()
Definition: BTD.cpp:1097
+
USB * pUsb
Definition: BTD.h:501
+
void hci_authentication_request()
Definition: BTD.cpp:1161
+
void hci_read_local_version_information()
Definition: BTD.cpp:993
+
void hci_accept_connection()
Definition: BTD.cpp:1002
+
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:604
+
virtual void onInit()=0
+
void HCI_Command(uint8_t *data, uint16_t nbytes)
Definition: BTD.cpp:948
diff --git a/_b_t_h_i_d_8cpp.html b/_b_t_h_i_d_8cpp.html index b92953ce..bc4a1a41 100644 --- a/_b_t_h_i_d_8cpp.html +++ b/_b_t_h_i_d_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: BTHID.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/_b_t_h_i_d_8cpp__incl.md5 b/_b_t_h_i_d_8cpp__incl.md5 index 457a9283..0f3b1317 100644 --- a/_b_t_h_i_d_8cpp__incl.md5 +++ b/_b_t_h_i_d_8cpp__incl.md5 @@ -1 +1 @@ -2fddcbac34cc48df9a24e3c113c74570 \ No newline at end of file +b0bd84a1b94c9a61dc97b5614bffe745 \ No newline at end of file diff --git a/_b_t_h_i_d_8cpp__incl.png b/_b_t_h_i_d_8cpp__incl.png index cb5a69c4..eee07efb 100644 Binary files a/_b_t_h_i_d_8cpp__incl.png and b/_b_t_h_i_d_8cpp__incl.png differ diff --git a/_b_t_h_i_d_8cpp_source.html b/_b_t_h_i_d_8cpp_source.html index b3783034..b728d512 100644 --- a/_b_t_h_i_d_8cpp_source.html +++ b/_b_t_h_i_d_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: BTHID.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
BTHID.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "BTHID.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the HID device
22 
23 BTHID::BTHID(BTD *p, bool pair, const char *pin) :
24 BluetoothService(p), // Pointer to USB class instance - mandatory
25 protocolMode(USB_HID_BOOT_PROTOCOL) {
26  for(uint8_t i = 0; i < NUM_PARSERS; i++)
27  pRptParser[i] = NULL;
28 
30  pBtd->btdPin = pin;
31 
32  /* Set device cid for the control and intterrupt channelse - LSB */
33  control_dcid[0] = 0x70; // 0x0070
34  control_dcid[1] = 0x00;
35  interrupt_dcid[0] = 0x71; // 0x0071
36  interrupt_dcid[1] = 0x00;
37 
38  Reset();
39 }
40 
41 void BTHID::Reset() {
42  connected = false;
43  activeConnection = false;
44  l2cap_event_flag = 0; // Reset flags
45  l2cap_state = L2CAP_WAIT;
46  ResetBTHID();
47 }
48 
49 void BTHID::disconnect() { // Use this void to disconnect the device
50  // First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
52  Reset();
53  l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
54 }
55 
56 void BTHID::ACLData(uint8_t* l2capinbuf) {
57  if(!pBtd->l2capConnectionClaimed && pBtd->incomingHIDDevice && !connected && !activeConnection) {
58  if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
59  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
60  pBtd->incomingHIDDevice = false;
61  pBtd->l2capConnectionClaimed = true; // Claim that the incoming connection belongs to this service
62  activeConnection = true;
63  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
64  l2cap_state = L2CAP_WAIT;
65  }
66  }
67  }
68 
69  if(checkHciHandle(l2capinbuf, hci_handle)) { // acl_handle_ok
70  if((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001U) { // l2cap_control - Channel ID for ACL-U
71  if(l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
72 #ifdef DEBUG_USB_HOST
73  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
74  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
75  Notify(PSTR(" "), 0x80);
76  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
77  Notify(PSTR(" "), 0x80);
78  D_PrintHex<uint8_t > (l2capinbuf[17], 0x80);
79  Notify(PSTR(" "), 0x80);
80  D_PrintHex<uint8_t > (l2capinbuf[16], 0x80);
81  Notify(PSTR(" "), 0x80);
82  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
83  Notify(PSTR(" "), 0x80);
84  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
85 #endif
86  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_RESPONSE) {
87  if(((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) && ((l2capinbuf[18] | (l2capinbuf[19] << 8)) == SUCCESSFUL)) { // Success
88  if(l2capinbuf[14] == control_dcid[0] && l2capinbuf[15] == control_dcid[1]) {
89  //Notify(PSTR("\r\nHID Control Connection Complete"), 0x80);
90  identifier = l2capinbuf[9];
91  control_scid[0] = l2capinbuf[12];
92  control_scid[1] = l2capinbuf[13];
94  } else if(l2capinbuf[14] == interrupt_dcid[0] && l2capinbuf[15] == interrupt_dcid[1]) {
95  //Notify(PSTR("\r\nHID Interrupt Connection Complete"), 0x80);
96  identifier = l2capinbuf[9];
97  interrupt_scid[0] = l2capinbuf[12];
98  interrupt_scid[1] = l2capinbuf[13];
100  }
101  }
102  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
103 #ifdef EXTRADEBUG
104  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
105  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
106  Notify(PSTR(" "), 0x80);
107  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
108  Notify(PSTR(" SCID: "), 0x80);
109  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
110  Notify(PSTR(" "), 0x80);
111  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
112  Notify(PSTR(" Identifier: "), 0x80);
113  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
114 #endif
115  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
116  identifier = l2capinbuf[9];
117  control_scid[0] = l2capinbuf[14];
118  control_scid[1] = l2capinbuf[15];
120  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_INTR_PSM) {
121  identifier = l2capinbuf[9];
122  interrupt_scid[0] = l2capinbuf[14];
123  interrupt_scid[1] = l2capinbuf[15];
125  }
126  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
127  if((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
128  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
129  //Notify(PSTR("\r\nHID Control Configuration Complete"), 0x80);
130  identifier = l2capinbuf[9];
132  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
133  //Notify(PSTR("\r\nHID Interrupt Configuration Complete"), 0x80);
134  identifier = l2capinbuf[9];
136  }
137  }
138  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
139  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
140  //Notify(PSTR("\r\nHID Control Configuration Request"), 0x80);
142  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
143  //Notify(PSTR("\r\nHID Interrupt Configuration Request"), 0x80);
145  }
146  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
147  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
148 #ifdef DEBUG_USB_HOST
149  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
150 #endif
151  identifier = l2capinbuf[9];
153  Reset();
154  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
155 #ifdef DEBUG_USB_HOST
156  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
157 #endif
158  identifier = l2capinbuf[9];
160  Reset();
161  }
162  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_RESPONSE) {
163  if(l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
164  //Notify(PSTR("\r\nDisconnect Response: Control Channel"), 0x80);
165  identifier = l2capinbuf[9];
167  } else if(l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
168  //Notify(PSTR("\r\nDisconnect Response: Interrupt Channel"), 0x80);
169  identifier = l2capinbuf[9];
171  }
172  }
173 #ifdef EXTRADEBUG
174  else {
175  identifier = l2capinbuf[9];
176  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
177  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
178  }
179 #endif
180  } else if(l2capinbuf[6] == interrupt_dcid[0] && l2capinbuf[7] == interrupt_dcid[1]) { // l2cap_interrupt
181 #ifdef PRINTREPORT
182  Notify(PSTR("\r\nL2CAP Interrupt: "), 0x80);
183  for(uint16_t i = 0; i < ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]); i++) {
184  D_PrintHex<uint8_t > (l2capinbuf[i + 8], 0x80);
185  Notify(PSTR(" "), 0x80);
186  }
187 #endif
188  if(l2capinbuf[8] == 0xA1) { // HID_THDR_DATA_INPUT
189  uint16_t length = ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]);
190  ParseBTHIDData((uint8_t)(length - 1), &l2capinbuf[9]);
191 
192  switch(l2capinbuf[9]) {
193  case 0x01: // Keyboard or Joystick events
194  if(pRptParser[KEYBOARD_PARSER_ID])
195  pRptParser[KEYBOARD_PARSER_ID]->Parse(reinterpret_cast<USBHID *>(this), 0, (uint8_t)(length - 2), &l2capinbuf[10]); // Use reinterpret_cast again to extract the instance
196  break;
197 
198  case 0x02: // Mouse events
199  if(pRptParser[MOUSE_PARSER_ID])
200  pRptParser[MOUSE_PARSER_ID]->Parse(reinterpret_cast<USBHID *>(this), 0, (uint8_t)(length - 2), &l2capinbuf[10]); // Use reinterpret_cast again to extract the instance
201  break;
202 #ifdef EXTRADEBUG
203  default:
204  Notify(PSTR("\r\nUnknown Report type: "), 0x80);
205  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
206  break;
207 #endif
208  }
209  }
210  } else if(l2capinbuf[6] == control_dcid[0] && l2capinbuf[7] == control_dcid[1]) { // l2cap_control
211 #ifdef PRINTREPORT
212  Notify(PSTR("\r\nL2CAP Control: "), 0x80);
213  for(uint16_t i = 0; i < ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]); i++) {
214  D_PrintHex<uint8_t > (l2capinbuf[i + 8], 0x80);
215  Notify(PSTR(" "), 0x80);
216  }
217 #endif
218  }
219 #ifdef EXTRADEBUG
220  else {
221  Notify(PSTR("\r\nUnsupported L2CAP Data - Channel ID: "), 0x80);
222  D_PrintHex<uint8_t > (l2capinbuf[7], 0x80);
223  Notify(PSTR(" "), 0x80);
224  D_PrintHex<uint8_t > (l2capinbuf[6], 0x80);
225 
226  Notify(PSTR("\r\nData: "), 0x80);
227  Notify(PSTR("\r\n"), 0x80);
228  for(uint16_t i = 0; i < ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]); i++) {
229  D_PrintHex<uint8_t > (l2capinbuf[i + 8], 0x80);
230  Notify(PSTR(" "), 0x80);
231  }
232  }
233 #endif
234  L2CAP_task();
235  }
236 }
237 
238 void BTHID::L2CAP_task() {
239  switch(l2cap_state) {
240  /* These states are used if the HID device is the host */
243 #ifdef DEBUG_USB_HOST
244  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
245 #endif
246  setProtocol(); // Set protocol before establishing HID interrupt channel
247  l2cap_state = L2CAP_INTERRUPT_SETUP;
248  }
249  break;
250 
253 #ifdef DEBUG_USB_HOST
254  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
255 #endif
257  delay(1);
259  identifier++;
260  delay(1);
262 
263  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
264  }
265  break;
266 
267  /* These states are used if the Arduino is the host */
270 #ifdef DEBUG_USB_HOST
271  Notify(PSTR("\r\nSend HID Control Config Request"), 0x80);
272 #endif
273  identifier++;
275  l2cap_state = L2CAP_CONTROL_CONFIG_REQUEST;
276  }
277  break;
278 
281  setProtocol(); // Set protocol before establishing HID interrupt channel
282  delay(1); // Short delay between commands - just to be sure
283 #ifdef DEBUG_USB_HOST
284  Notify(PSTR("\r\nSend HID Interrupt Connection Request"), 0x80);
285 #endif
286  identifier++;
288  l2cap_state = L2CAP_INTERRUPT_CONNECT_REQUEST;
289  }
290  break;
291 
294 #ifdef DEBUG_USB_HOST
295  Notify(PSTR("\r\nSend HID Interrupt Config Request"), 0x80);
296 #endif
297  identifier++;
299  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
300  }
301  break;
302 
304  if(l2cap_check_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)) { // Now the HID channels is established
305 #ifdef DEBUG_USB_HOST
306  Notify(PSTR("\r\nHID Channels Established"), 0x80);
307 #endif
308  pBtd->connectToHIDDevice = false;
309  pBtd->pairWithHIDDevice = false;
310  connected = true;
311  onInit();
312  l2cap_state = L2CAP_DONE;
313  }
314  break;
315 
316  case L2CAP_DONE:
317  break;
318 
321 #ifdef DEBUG_USB_HOST
322  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
323 #endif
324  identifier++;
326  l2cap_state = L2CAP_CONTROL_DISCONNECT;
327  }
328  break;
329 
332 #ifdef DEBUG_USB_HOST
333  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
334 #endif
336  hci_handle = -1; // Reset handle
337  l2cap_event_flag = 0; // Reset flags
338  l2cap_state = L2CAP_WAIT;
339  }
340  break;
341  }
342 }
343 
344 void BTHID::Run() {
345  switch(l2cap_state) {
346  case L2CAP_WAIT:
347  if(pBtd->connectToHIDDevice && !pBtd->l2capConnectionClaimed && !connected && !activeConnection) {
349  activeConnection = true;
350 #ifdef DEBUG_USB_HOST
351  Notify(PSTR("\r\nSend HID Control Connection Request"), 0x80);
352 #endif
353  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
354  l2cap_event_flag = 0; // Reset flags
355  identifier = 0;
357  l2cap_state = L2CAP_CONTROL_CONNECT_REQUEST;
359 #ifdef DEBUG_USB_HOST
360  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
361 #endif
363  delay(1);
365  identifier++;
366  delay(1);
368  l2cap_state = L2CAP_CONTROL_SUCCESS;
369  }
370  break;
371  }
372 }
373 
374 /************************************************************/
375 /* HID Commands */
376 
377 /************************************************************/
378 void BTHID::setProtocol() {
379 #ifdef DEBUG_USB_HOST
380  Notify(PSTR("\r\nSet protocol mode: "), 0x80);
381  D_PrintHex<uint8_t > (protocolMode, 0x80);
382 #endif
383  if (protocolMode != USB_HID_BOOT_PROTOCOL && protocolMode != HID_RPT_PROTOCOL) {
384 #ifdef DEBUG_USB_HOST
385  Notify(PSTR("\r\nNot a valid protocol mode. Using Boot protocol instead."), 0x80);
386 #endif
387  protocolMode = USB_HID_BOOT_PROTOCOL; // Use Boot Protocol by default
388  }
389  uint8_t command = 0x70 | protocolMode; // Set Protocol, see Bluetooth HID specs page 33
390  pBtd->L2CAP_Command(hci_handle, &command, 1, control_scid[0], control_scid[1]);
391 }
392 
393 void BTHID::setLeds(uint8_t data) {
394  uint8_t buf[3];
395  buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
396  buf[1] = 0x01; // Report ID
397  buf[2] = data;
399 }
#define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE
Definition: BTD.h:137
-
#define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS
Definition: BTD.h:141
-
#define L2CAP_INTERRUPT_CONFIG_REQUEST
Definition: BTD.h:113
-
#define L2CAP_INTERRUPT_SETUP
Definition: BTD.h:111
-
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1262
-
#define SUCCESSFUL
Definition: BTD.h:175
+Go to the documentation of this file.
1 /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "BTHID.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the HID device
22 
23 BTHID::BTHID(BTD *p, bool pair, const char *pin) :
24 BluetoothService(p), // Pointer to USB class instance - mandatory
25 protocolMode(USB_HID_BOOT_PROTOCOL) {
26  for(uint8_t i = 0; i < NUM_PARSERS; i++)
27  pRptParser[i] = NULL;
28 
30  pBtd->btdPin = pin;
31 
32  /* Set device cid for the control and intterrupt channelse - LSB */
33  control_dcid[0] = 0x70; // 0x0070
34  control_dcid[1] = 0x00;
35  interrupt_dcid[0] = 0x71; // 0x0071
36  interrupt_dcid[1] = 0x00;
37 
38  Reset();
39 }
40 
41 void BTHID::Reset() {
42  connected = false;
43  activeConnection = false;
44  l2cap_event_flag = 0; // Reset flags
45  l2cap_state = L2CAP_WAIT;
46  ResetBTHID();
47 }
48 
49 void BTHID::disconnect() { // Use this void to disconnect the device
50  // First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
52  Reset();
53  l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
54 }
55 
56 void BTHID::ACLData(uint8_t* l2capinbuf) {
57  if(!pBtd->l2capConnectionClaimed && pBtd->incomingHIDDevice && !connected && !activeConnection) {
58  if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
59  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
60  pBtd->incomingHIDDevice = false;
61  pBtd->l2capConnectionClaimed = true; // Claim that the incoming connection belongs to this service
62  activeConnection = true;
63  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
64  l2cap_state = L2CAP_WAIT;
65  }
66  }
67  }
68 
69  if(checkHciHandle(l2capinbuf, hci_handle)) { // acl_handle_ok
70  if((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001U) { // l2cap_control - Channel ID for ACL-U
71  if(l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
72 #ifdef DEBUG_USB_HOST
73  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
74  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
75  Notify(PSTR(" "), 0x80);
76  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
77  Notify(PSTR(" "), 0x80);
78  D_PrintHex<uint8_t > (l2capinbuf[17], 0x80);
79  Notify(PSTR(" "), 0x80);
80  D_PrintHex<uint8_t > (l2capinbuf[16], 0x80);
81  Notify(PSTR(" "), 0x80);
82  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
83  Notify(PSTR(" "), 0x80);
84  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
85 #endif
86  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_RESPONSE) {
87  if(((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) && ((l2capinbuf[18] | (l2capinbuf[19] << 8)) == SUCCESSFUL)) { // Success
88  if(l2capinbuf[14] == control_dcid[0] && l2capinbuf[15] == control_dcid[1]) {
89  //Notify(PSTR("\r\nHID Control Connection Complete"), 0x80);
90  identifier = l2capinbuf[9];
91  control_scid[0] = l2capinbuf[12];
92  control_scid[1] = l2capinbuf[13];
94  } else if(l2capinbuf[14] == interrupt_dcid[0] && l2capinbuf[15] == interrupt_dcid[1]) {
95  //Notify(PSTR("\r\nHID Interrupt Connection Complete"), 0x80);
96  identifier = l2capinbuf[9];
97  interrupt_scid[0] = l2capinbuf[12];
98  interrupt_scid[1] = l2capinbuf[13];
100  }
101  }
102  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
103 #ifdef EXTRADEBUG
104  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
105  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
106  Notify(PSTR(" "), 0x80);
107  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
108  Notify(PSTR(" SCID: "), 0x80);
109  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
110  Notify(PSTR(" "), 0x80);
111  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
112  Notify(PSTR(" Identifier: "), 0x80);
113  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
114 #endif
115  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
116  identifier = l2capinbuf[9];
117  control_scid[0] = l2capinbuf[14];
118  control_scid[1] = l2capinbuf[15];
120  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_INTR_PSM) {
121  identifier = l2capinbuf[9];
122  interrupt_scid[0] = l2capinbuf[14];
123  interrupt_scid[1] = l2capinbuf[15];
125  }
126  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
127  if((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
128  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
129  //Notify(PSTR("\r\nHID Control Configuration Complete"), 0x80);
130  identifier = l2capinbuf[9];
132  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
133  //Notify(PSTR("\r\nHID Interrupt Configuration Complete"), 0x80);
134  identifier = l2capinbuf[9];
136  }
137  }
138  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
139  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
140  //Notify(PSTR("\r\nHID Control Configuration Request"), 0x80);
142  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
143  //Notify(PSTR("\r\nHID Interrupt Configuration Request"), 0x80);
145  }
146  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
147  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
148 #ifdef DEBUG_USB_HOST
149  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
150 #endif
151  identifier = l2capinbuf[9];
153  Reset();
154  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
155 #ifdef DEBUG_USB_HOST
156  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
157 #endif
158  identifier = l2capinbuf[9];
160  Reset();
161  }
162  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_RESPONSE) {
163  if(l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
164  //Notify(PSTR("\r\nDisconnect Response: Control Channel"), 0x80);
165  identifier = l2capinbuf[9];
167  } else if(l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
168  //Notify(PSTR("\r\nDisconnect Response: Interrupt Channel"), 0x80);
169  identifier = l2capinbuf[9];
171  }
172  }
173 #ifdef EXTRADEBUG
174  else {
175  identifier = l2capinbuf[9];
176  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
177  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
178  }
179 #endif
180  } else if(l2capinbuf[6] == interrupt_dcid[0] && l2capinbuf[7] == interrupt_dcid[1]) { // l2cap_interrupt
181 #ifdef PRINTREPORT
182  Notify(PSTR("\r\nL2CAP Interrupt: "), 0x80);
183  for(uint16_t i = 0; i < ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]); i++) {
184  D_PrintHex<uint8_t > (l2capinbuf[i + 8], 0x80);
185  Notify(PSTR(" "), 0x80);
186  }
187 #endif
188  if(l2capinbuf[8] == 0xA1) { // HID_THDR_DATA_INPUT
189  uint16_t length = ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]);
190  ParseBTHIDData((uint8_t)(length - 1), &l2capinbuf[9]);
191 
192  switch(l2capinbuf[9]) {
193  case 0x01: // Keyboard or Joystick events
194  if(pRptParser[KEYBOARD_PARSER_ID])
195  pRptParser[KEYBOARD_PARSER_ID]->Parse(reinterpret_cast<USBHID *>(this), 0, (uint8_t)(length - 2), &l2capinbuf[10]); // Use reinterpret_cast again to extract the instance
196  break;
197 
198  case 0x02: // Mouse events
199  if(pRptParser[MOUSE_PARSER_ID])
200  pRptParser[MOUSE_PARSER_ID]->Parse(reinterpret_cast<USBHID *>(this), 0, (uint8_t)(length - 2), &l2capinbuf[10]); // Use reinterpret_cast again to extract the instance
201  break;
202 #ifdef EXTRADEBUG
203  default:
204  Notify(PSTR("\r\nUnknown Report type: "), 0x80);
205  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
206  break;
207 #endif
208  }
209  }
210  } else if(l2capinbuf[6] == control_dcid[0] && l2capinbuf[7] == control_dcid[1]) { // l2cap_control
211 #ifdef PRINTREPORT
212  Notify(PSTR("\r\nL2CAP Control: "), 0x80);
213  for(uint16_t i = 0; i < ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]); i++) {
214  D_PrintHex<uint8_t > (l2capinbuf[i + 8], 0x80);
215  Notify(PSTR(" "), 0x80);
216  }
217 #endif
218  }
219 #ifdef EXTRADEBUG
220  else {
221  Notify(PSTR("\r\nUnsupported L2CAP Data - Channel ID: "), 0x80);
222  D_PrintHex<uint8_t > (l2capinbuf[7], 0x80);
223  Notify(PSTR(" "), 0x80);
224  D_PrintHex<uint8_t > (l2capinbuf[6], 0x80);
225 
226  Notify(PSTR("\r\nData: "), 0x80);
227  Notify(PSTR("\r\n"), 0x80);
228  for(uint16_t i = 0; i < ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]); i++) {
229  D_PrintHex<uint8_t > (l2capinbuf[i + 8], 0x80);
230  Notify(PSTR(" "), 0x80);
231  }
232  }
233 #endif
234  L2CAP_task();
235  }
236 }
237 
238 void BTHID::L2CAP_task() {
239  switch(l2cap_state) {
240  /* These states are used if the HID device is the host */
243 #ifdef DEBUG_USB_HOST
244  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
245 #endif
246  setProtocol(); // Set protocol before establishing HID interrupt channel
247  l2cap_state = L2CAP_INTERRUPT_SETUP;
248  }
249  break;
250 
253 #ifdef DEBUG_USB_HOST
254  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
255 #endif
257  delay(1);
259  identifier++;
260  delay(1);
262 
263  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
264  }
265  break;
266 
267  /* These states are used if the Arduino is the host */
270 #ifdef DEBUG_USB_HOST
271  Notify(PSTR("\r\nSend HID Control Config Request"), 0x80);
272 #endif
273  identifier++;
275  l2cap_state = L2CAP_CONTROL_CONFIG_REQUEST;
276  }
277  break;
278 
281  setProtocol(); // Set protocol before establishing HID interrupt channel
282  delay(1); // Short delay between commands - just to be sure
283 #ifdef DEBUG_USB_HOST
284  Notify(PSTR("\r\nSend HID Interrupt Connection Request"), 0x80);
285 #endif
286  identifier++;
288  l2cap_state = L2CAP_INTERRUPT_CONNECT_REQUEST;
289  }
290  break;
291 
294 #ifdef DEBUG_USB_HOST
295  Notify(PSTR("\r\nSend HID Interrupt Config Request"), 0x80);
296 #endif
297  identifier++;
299  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
300  }
301  break;
302 
304  if(l2cap_check_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)) { // Now the HID channels is established
305 #ifdef DEBUG_USB_HOST
306  Notify(PSTR("\r\nHID Channels Established"), 0x80);
307 #endif
308  pBtd->connectToHIDDevice = false;
309  pBtd->pairWithHIDDevice = false;
310  connected = true;
311  onInit();
312  l2cap_state = L2CAP_DONE;
313  }
314  break;
315 
316  case L2CAP_DONE:
317  break;
318 
321 #ifdef DEBUG_USB_HOST
322  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
323 #endif
324  identifier++;
326  l2cap_state = L2CAP_CONTROL_DISCONNECT;
327  }
328  break;
329 
332 #ifdef DEBUG_USB_HOST
333  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
334 #endif
336  hci_handle = -1; // Reset handle
337  l2cap_event_flag = 0; // Reset flags
338  l2cap_state = L2CAP_WAIT;
339  }
340  break;
341  }
342 }
343 
344 void BTHID::Run() {
345  switch(l2cap_state) {
346  case L2CAP_WAIT:
347  if(pBtd->connectToHIDDevice && !pBtd->l2capConnectionClaimed && !connected && !activeConnection) {
349  activeConnection = true;
350 #ifdef DEBUG_USB_HOST
351  Notify(PSTR("\r\nSend HID Control Connection Request"), 0x80);
352 #endif
353  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
354  l2cap_event_flag = 0; // Reset flags
355  identifier = 0;
357  l2cap_state = L2CAP_CONTROL_CONNECT_REQUEST;
359 #ifdef DEBUG_USB_HOST
360  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
361 #endif
363  delay(1);
365  identifier++;
366  delay(1);
368  l2cap_state = L2CAP_CONTROL_SUCCESS;
369  }
370  break;
371  }
372 }
373 
374 /************************************************************/
375 /* HID Commands */
376 
377 /************************************************************/
378 void BTHID::setProtocol() {
379 #ifdef DEBUG_USB_HOST
380  Notify(PSTR("\r\nSet protocol mode: "), 0x80);
381  D_PrintHex<uint8_t > (protocolMode, 0x80);
382 #endif
383  if (protocolMode != USB_HID_BOOT_PROTOCOL && protocolMode != HID_RPT_PROTOCOL) {
384 #ifdef DEBUG_USB_HOST
385  Notify(PSTR("\r\nNot a valid protocol mode. Using Boot protocol instead."), 0x80);
386 #endif
387  protocolMode = USB_HID_BOOT_PROTOCOL; // Use Boot Protocol by default
388  }
389  uint8_t command = 0x70 | protocolMode; // Set Protocol, see Bluetooth HID specs page 33
390  pBtd->L2CAP_Command(hci_handle, &command, 1, control_scid[0], control_scid[1]);
391 }
392 
393 void BTHID::setLeds(uint8_t data) {
394  uint8_t buf[3];
395  buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
396  buf[1] = 0x01; // Report ID
397  buf[2] = data;
399 }
#define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE
Definition: BTD.h:140
+
#define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS
Definition: BTD.h:144
+
#define L2CAP_INTERRUPT_CONFIG_REQUEST
Definition: BTD.h:116
+
#define L2CAP_INTERRUPT_SETUP
Definition: BTD.h:114
+
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1260
+
#define SUCCESSFUL
Definition: BTD.h:178
void ACLData(uint8_t *ACLData)
Definition: BTHID.cpp:56
-
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
Definition: BTD.cpp:1249
-
#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST
Definition: BTD.h:140
-
Definition: BTD.h:198
-
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1315
+
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
Definition: BTD.cpp:1247
+
#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST
Definition: BTD.h:143
+
Definition: BTD.h:201
+
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1313
uint8_t interrupt_scid[2]
Definition: BTHID.h:142
-
uint8_t identifier
Definition: BTD.h:617
+
uint8_t identifier
Definition: BTD.h:621
bool connected
Definition: BTHID.h:88
void Run()
Definition: BTHID.cpp:344
-
const char * btdPin
Definition: BTD.h:446
-
#define L2CAP_DONE
Definition: BTD.h:102
-
#define L2CAP_CONTROL_SUCCESS
Definition: BTD.h:107
-
#define L2CAP_WAIT
Definition: BTD.h:101
+
const char * btdPin
Definition: BTD.h:449
+
#define L2CAP_DONE
Definition: BTD.h:105
+
#define L2CAP_CONTROL_SUCCESS
Definition: BTD.h:110
+
#define L2CAP_WAIT
Definition: BTD.h:104
virtual void ResetBTHID()
Definition: BTHID.h:133
void Reset()
Definition: BTHID.cpp:41
-
#define L2CAP_CONTROL_CONFIG_REQUEST
Definition: BTD.h:106
-
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1328
+
#define L2CAP_CONTROL_CONFIG_REQUEST
Definition: BTD.h:109
+
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1326
uint8_t control_scid[2]
Definition: BTHID.h:139
-
#define Notify(...)
Definition: message.h:44
-
bool connectToHIDDevice
Definition: BTD.h:483
-
#define L2CAP_CONTROL_CONNECT_REQUEST
Definition: BTD.h:105
-
#define HID_CTRL_PSM
Definition: BTD.h:180
-
bool incomingHIDDevice
Definition: BTD.h:487
-
bool pairWithHIDDevice
Definition: BTD.h:489
+
#define Notify(...)
Definition: message.h:51
+
bool connectToHIDDevice
Definition: BTD.h:487
+
#define L2CAP_CONTROL_CONNECT_REQUEST
Definition: BTD.h:108
+
#define HID_CTRL_PSM
Definition: BTD.h:183
+
bool incomingHIDDevice
Definition: BTD.h:491
+
bool pairWithHIDDevice
Definition: BTD.h:493
#define MOUSE_PARSER_ID
Definition: BTHID.h:25
-
uint16_t hci_handle
Definition: BTD.h:451
+
uint16_t hci_handle
Definition: BTD.h:454
-
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1173
- -
#define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE
Definition: BTD.h:143
+
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1171
+ +
#define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE
Definition: BTD.h:146
void disconnect()
Definition: BTHID.cpp:49
virtual void ParseBTHIDData(uint8_t len, uint8_t *buf)
Definition: BTHID.h:125
-
#define l2cap_check_flag(flag)
Definition: BTD.h:158
-
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:166
-
#define L2CAP_FLAG_CONTROL_CONNECTED
Definition: BTD.h:136
-
#define PSTR(str)
-
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:168
-
#define L2CAP_CONTROL_DISCONNECT
Definition: BTD.h:108
-
#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST
Definition: BTD.h:134
-
BTD * pBtd
Definition: BTD.h:608
-
#define HID_INTR_PSM
Definition: BTD.h:181
-
bool l2capConnectionClaimed
Definition: BTD.h:437
-
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:169
-
#define L2CAP_CMD_CONNECTION_RESPONSE
Definition: BTD.h:165
-
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:167
+
#define l2cap_check_flag(flag)
Definition: BTD.h:161
+
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:169
+
#define L2CAP_FLAG_CONTROL_CONNECTED
Definition: BTD.h:139
+
#define PSTR(str)
+
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:171
+
#define L2CAP_CONTROL_DISCONNECT
Definition: BTD.h:111
+
#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST
Definition: BTD.h:137
+
BTD * pBtd
Definition: BTD.h:612
+
#define HID_INTR_PSM
Definition: BTD.h:184
+
bool l2capConnectionClaimed
Definition: BTD.h:440
+
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:172
+
#define L2CAP_CMD_CONNECTION_RESPONSE
Definition: BTD.h:168
+
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:170
void setLeds(struct KBDLEDS data)
Definition: BTHID.h:81
-
uint16_t hci_handle
Definition: BTD.h:611
+
uint16_t hci_handle
Definition: BTD.h:615
#define NUM_PARSERS
Definition: BTHID.h:26
#define KEYBOARD_PARSER_ID
Definition: BTHID.h:24
#define USB_HID_BOOT_PROTOCOL
Definition: usbhid.h:82
-
uint32_t l2cap_event_flag
Definition: BTD.h:614
+
uint32_t l2cap_event_flag
Definition: BTD.h:618
void onInit()
Definition: BTHID.h:112
-
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1221
-
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1296
-
#define PENDING
Definition: BTD.h:174
-
#define L2CAP_FLAG_INTERRUPT_CONNECTED
Definition: BTD.h:142
-
#define l2cap_set_flag(flag)
Definition: BTD.h:159
-
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1279
-
#define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS
Definition: BTD.h:135
-
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:164
+
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1219
+
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1294
+
#define PENDING
Definition: BTD.h:177
+
#define L2CAP_FLAG_INTERRUPT_CONNECTED
Definition: BTD.h:145
+
#define l2cap_set_flag(flag)
Definition: BTD.h:162
+
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1277
+
#define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS
Definition: BTD.h:138
+
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:167
virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)=0
BTHID(BTD *p, bool pair=false, const char *pin="0000")
Definition: BTHID.cpp:23
-
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:600
-
#define L2CAP_INTERRUPT_CONNECT_REQUEST
Definition: BTD.h:112
+
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:604
+
#define L2CAP_INTERRUPT_CONNECT_REQUEST
Definition: BTD.h:115
#define HID_RPT_PROTOCOL
Definition: usbhid.h:83
void pair(void)
Definition: BTHID.h:91
-
#define L2CAP_INTERRUPT_DISCONNECT
Definition: BTD.h:114
-
#define L2CAP_CMD_COMMAND_REJECT
Definition: BTD.h:163
+
#define L2CAP_INTERRUPT_DISCONNECT
Definition: BTD.h:117
+
#define L2CAP_CMD_COMMAND_REJECT
Definition: BTD.h:166
diff --git a/_b_t_h_i_d_8h.html b/_b_t_h_i_d_8h.html index 163b51bf..8773d4b9 100644 --- a/_b_t_h_i_d_8h.html +++ b/_b_t_h_i_d_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: BTHID.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ KEYBOARD_PARSER_ID

+
@@ -144,11 +126,13 @@ Macros
-

Definition at line 24 of file BTHID.h.

+

Definition at line 24 of file BTHID.h.

- + +

◆ MOUSE_PARSER_ID

+
@@ -158,11 +142,13 @@ Macros
-

Definition at line 25 of file BTHID.h.

+

Definition at line 25 of file BTHID.h.

- + +

◆ NUM_PARSERS

+
@@ -172,7 +158,7 @@ Macros
-

Definition at line 26 of file BTHID.h.

+

Definition at line 26 of file BTHID.h.

@@ -181,7 +167,7 @@ Macros diff --git a/_b_t_h_i_d_8h__dep__incl.md5 b/_b_t_h_i_d_8h__dep__incl.md5 index 053bda1f..87c17ba3 100644 --- a/_b_t_h_i_d_8h__dep__incl.md5 +++ b/_b_t_h_i_d_8h__dep__incl.md5 @@ -1 +1 @@ -0205aeed5db75f7b218ba6ecd920ddcd \ No newline at end of file +d55a0202ec74c18d421575f50280304c \ No newline at end of file diff --git a/_b_t_h_i_d_8h__dep__incl.png b/_b_t_h_i_d_8h__dep__incl.png index 9dd814d6..535e5a2c 100644 Binary files a/_b_t_h_i_d_8h__dep__incl.png and b/_b_t_h_i_d_8h__dep__incl.png differ diff --git a/_b_t_h_i_d_8h__incl.md5 b/_b_t_h_i_d_8h__incl.md5 index aefec681..d3d074cc 100644 --- a/_b_t_h_i_d_8h__incl.md5 +++ b/_b_t_h_i_d_8h__incl.md5 @@ -1 +1 @@ -d78862557f9f3bddfcdcfa91190beeac \ No newline at end of file +b3c29136fe98c9d8e7c6c6b7a9475517 \ No newline at end of file diff --git a/_b_t_h_i_d_8h__incl.png b/_b_t_h_i_d_8h__incl.png index eb4c9108..092bd7d6 100644 Binary files a/_b_t_h_i_d_8h__incl.png and b/_b_t_h_i_d_8h__incl.png differ diff --git a/_b_t_h_i_d_8h_source.html b/_b_t_h_i_d_8h_source.html index ac276c9c..b638e35b 100644 --- a/_b_t_h_i_d_8h_source.html +++ b/_b_t_h_i_d_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: BTHID.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
BTHID.h
-Go to the documentation of this file.
1 /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _bthid_h_
19 #define _bthid_h_
20 
21 #include "BTD.h"
22 #include "hidboot.h"
23 
24 #define KEYBOARD_PARSER_ID 0
25 #define MOUSE_PARSER_ID 1
26 #define NUM_PARSERS 2
27 
29 class BTHID : public BluetoothService {
30 public:
37  BTHID(BTD *p, bool pair = false, const char *pin = "0000");
38 
41  void disconnect();
50  if (id >= NUM_PARSERS)
51  return NULL;
52  return pRptParser[id];
53  };
54 
61  bool SetReportParser(uint8_t id, HIDReportParser *prs) {
62  if (id >= NUM_PARSERS)
63  return false;
64  pRptParser[id] = prs;
65  return true;
66  };
67 
72  void setProtocolMode(uint8_t mode) {
73  protocolMode = mode;
74  };
75 
81  void setLeds(struct KBDLEDS data) {
82  setLeds(*((uint8_t*)&data));
83  };
84  void setLeds(uint8_t data);
88  bool connected;
89 
91  void pair(void) {
92  if(pBtd)
93  pBtd->pairWithHID();
94  };
95 
96 protected:
102  void ACLData(uint8_t* ACLData);
104  void Run();
106  void Reset();
112  void onInit() {
113  if(pFuncOnInit)
114  pFuncOnInit(); // Call the user function
115  OnInitBTHID();
116  };
125  virtual void ParseBTHIDData(uint8_t len, uint8_t *buf) {
126  return;
127  };
129  virtual void OnInitBTHID() {
130  return;
131  };
133  virtual void ResetBTHID() {
134  return;
135  }
139  uint8_t control_scid[2];
140 
142  uint8_t interrupt_scid[2];
143 
144 private:
145  HIDReportParser *pRptParser[NUM_PARSERS]; // Pointer to HIDReportParsers.
146 
148  void setProtocol();
149  uint8_t protocolMode;
150 
151  void L2CAP_task(); // L2CAP state machine
152 
153  bool activeConnection; // Used to indicate if it already has established a connection
154 
155  /* Variables used for L2CAP communication */
156  uint8_t control_dcid[2]; // L2CAP device CID for HID_Control - Always 0x0070
157  uint8_t interrupt_dcid[2]; // L2CAP device CID for HID_Interrupt - Always 0x0071
158  uint8_t l2cap_state;
159 };
160 #endif
+Go to the documentation of this file.
1 /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _bthid_h_
19 #define _bthid_h_
20 
21 #include "BTD.h"
22 #include "hidboot.h"
23 
24 #define KEYBOARD_PARSER_ID 0
25 #define MOUSE_PARSER_ID 1
26 #define NUM_PARSERS 2
27 
29 class BTHID : public BluetoothService {
30 public:
37  BTHID(BTD *p, bool pair = false, const char *pin = "0000");
38 
41  void disconnect();
50  if (id >= NUM_PARSERS)
51  return NULL;
52  return pRptParser[id];
53  };
54 
61  bool SetReportParser(uint8_t id, HIDReportParser *prs) {
62  if (id >= NUM_PARSERS)
63  return false;
64  pRptParser[id] = prs;
65  return true;
66  };
67 
72  void setProtocolMode(uint8_t mode) {
73  protocolMode = mode;
74  };
75 
81  void setLeds(struct KBDLEDS data) {
82  setLeds(*((uint8_t*)&data));
83  };
84  void setLeds(uint8_t data);
88  bool connected;
89 
91  void pair(void) {
92  if(pBtd)
93  pBtd->pairWithHID();
94  };
95 
96 protected:
102  void ACLData(uint8_t* ACLData);
104  void Run();
106  void Reset();
112  void onInit() {
113  if(pFuncOnInit)
114  pFuncOnInit(); // Call the user function
115  OnInitBTHID();
116  };
125  virtual void ParseBTHIDData(uint8_t len __attribute__((unused)), uint8_t *buf __attribute__((unused))) {
126  return;
127  };
129  virtual void OnInitBTHID() {
130  return;
131  };
133  virtual void ResetBTHID() {
134  return;
135  }
139  uint8_t control_scid[2];
140 
142  uint8_t interrupt_scid[2];
143 
144 private:
145  HIDReportParser *pRptParser[NUM_PARSERS]; // Pointer to HIDReportParsers.
146 
148  void setProtocol();
149  uint8_t protocolMode;
150 
151  void L2CAP_task(); // L2CAP state machine
152 
153  bool activeConnection; // Used to indicate if it already has established a connection
154 
155  /* Variables used for L2CAP communication */
156  uint8_t control_dcid[2]; // L2CAP device CID for HID_Control - Always 0x0070
157  uint8_t interrupt_dcid[2]; // L2CAP device CID for HID_Interrupt - Always 0x0071
158  uint8_t l2cap_state;
159 };
160 #endif
virtual void OnInitBTHID()
Definition: BTHID.h:129
void ACLData(uint8_t *ACLData)
Definition: BTHID.cpp:56
-
Definition: BTD.h:198
+
Definition: BTD.h:201
uint8_t interrupt_scid[2]
Definition: BTHID.h:142
bool connected
Definition: BTHID.h:88
void Run()
Definition: BTHID.cpp:344
virtual void ResetBTHID()
Definition: BTHID.h:133
void Reset()
Definition: BTHID.cpp:41
uint8_t control_scid[2]
Definition: BTHID.h:139
-
void pairWithHID()
Definition: BTD.h:480
- +
void pairWithHID()
Definition: BTD.h:483
+
void disconnect()
Definition: BTHID.cpp:49
HIDReportParser * GetReportParser(uint8_t id)
Definition: BTHID.h:49
virtual void ParseBTHIDData(uint8_t len, uint8_t *buf)
Definition: BTHID.h:125
-
void(* pFuncOnInit)(void)
Definition: BTD.h:605
-
BTD * pBtd
Definition: BTD.h:608
+
void(* pFuncOnInit)(void)
Definition: BTD.h:609
+
BTD * pBtd
Definition: BTD.h:612
void setLeds(struct KBDLEDS data)
Definition: BTHID.h:81
#define NUM_PARSERS
Definition: BTHID.h:26
void onInit()
Definition: BTHID.h:112
@@ -123,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s3_b_t_8cpp.html b/_p_s3_b_t_8cpp.html index 5fc2ad94..7c91c940 100644 --- a/_p_s3_b_t_8cpp.html +++ b/_p_s3_b_t_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS3BT.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- + - + - +
@@ -112,7 +92,7 @@ Include dependency graph for PS3BT.cpp:
diff --git a/_p_s3_b_t_8cpp__incl.map b/_p_s3_b_t_8cpp__incl.map index e3f29912..6ec2377b 100644 --- a/_p_s3_b_t_8cpp__incl.map +++ b/_p_s3_b_t_8cpp__incl.map @@ -1,9 +1,9 @@ - + - + - + diff --git a/_p_s3_b_t_8cpp__incl.md5 b/_p_s3_b_t_8cpp__incl.md5 index 47f6eaf8..0d2883f6 100644 --- a/_p_s3_b_t_8cpp__incl.md5 +++ b/_p_s3_b_t_8cpp__incl.md5 @@ -1 +1 @@ -50d55f1029d7b23c50d71899212fd03f \ No newline at end of file +fcd6fdd81a5a62e824f047cf224529eb \ No newline at end of file diff --git a/_p_s3_b_t_8cpp__incl.png b/_p_s3_b_t_8cpp__incl.png index 213a6554..745d25fc 100644 Binary files a/_p_s3_b_t_8cpp__incl.png and b/_p_s3_b_t_8cpp__incl.png differ diff --git a/_p_s3_b_t_8cpp_source.html b/_p_s3_b_t_8cpp_source.html index b90b5438..8c67f1c4 100644 --- a/_p_s3_b_t_8cpp_source.html +++ b/_p_s3_b_t_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS3BT.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
PS3BT.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "PS3BT.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the PS3 Controllers
22 
23 PS3BT::PS3BT(BTD *p, uint8_t btadr5, uint8_t btadr4, uint8_t btadr3, uint8_t btadr2, uint8_t btadr1, uint8_t btadr0) :
24 BluetoothService(p) // Pointer to USB class instance - mandatory
25 {
26  pBtd->my_bdaddr[5] = btadr5; // Change to your dongle's Bluetooth address instead
27  pBtd->my_bdaddr[4] = btadr4;
28  pBtd->my_bdaddr[3] = btadr3;
29  pBtd->my_bdaddr[2] = btadr2;
30  pBtd->my_bdaddr[1] = btadr1;
31  pBtd->my_bdaddr[0] = btadr0;
32 
33  HIDBuffer[0] = 0x52; // HID BT Set_report (0x50) | Report Type (Output 0x02)
34  HIDBuffer[1] = 0x01; // Report ID
35 
36  // Needed for PS3 Move Controller commands to work via bluetooth
37  HIDMoveBuffer[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
38  HIDMoveBuffer[1] = 0x02; // Report ID
39 
40  /* Set device cid for the control and intterrupt channelse - LSB */
41  control_dcid[0] = 0x40; // 0x0040
42  control_dcid[1] = 0x00;
43  interrupt_dcid[0] = 0x41; // 0x0041
44  interrupt_dcid[1] = 0x00;
45 
46  Reset();
47 }
48 
50  return (ButtonState & pgm_read_dword(&PS3_BUTTONS[(uint8_t)b]));
51 }
52 
54  uint32_t button = pgm_read_dword(&PS3_BUTTONS[(uint8_t)b]);
55  bool click = (ButtonClickState & button);
56  ButtonClickState &= ~button; // Clear "click" event
57  return click;
58 }
59 
61  return (uint8_t)(l2capinbuf[pgm_read_byte(&PS3_ANALOG_BUTTONS[(uint8_t)a])]);
62 }
63 
65  return (uint8_t)(l2capinbuf[(uint8_t)a + 15]);
66 }
67 
69  if(PS3Connected) {
70  if(a == aX || a == aY || a == aZ || a == gZ)
71  return ((l2capinbuf[(uint16_t)a] << 8) | l2capinbuf[(uint16_t)a + 1]);
72  else
73  return 0;
74  } else if(PS3MoveConnected) {
75  if(a == mXmove || a == mYmove) // These are all 12-bits long
76  return (((l2capinbuf[(uint16_t)a] & 0x0F) << 8) | (l2capinbuf[(uint16_t)a + 1]));
77  else if(a == mZmove || a == tempMove) // The tempearature is also 12 bits long
78  return ((l2capinbuf[(uint16_t)a] << 4) | ((l2capinbuf[(uint16_t)a + 1] & 0xF0) >> 4));
79  else // aXmove, aYmove, aZmove, gXmove, gYmove and gZmove
80  return (l2capinbuf[(uint16_t)a] | (l2capinbuf[(uint16_t)a + 1] << 8));
81  } else
82  return 0;
83 }
84 
86  float accXval, accYval, accZval;
87 
88  if(PS3Connected) {
89  // Data for the Kionix KXPC4 used in the DualShock 3
90  const float zeroG = 511.5f; // 1.65/3.3*1023 (1.65V)
91  accXval = -((float)getSensor(aX) - zeroG);
92  accYval = -((float)getSensor(aY) - zeroG);
93  accZval = -((float)getSensor(aZ) - zeroG);
94  } else if(PS3MoveConnected) {
95  // It's a Kionix KXSC4 inside the Motion controller
96  const uint16_t zeroG = 0x8000;
97  accXval = -(int16_t)(getSensor(aXmove) - zeroG);
98  accYval = (int16_t)(getSensor(aYmove) - zeroG);
99  accZval = (int16_t)(getSensor(aZmove) - zeroG);
100  } else
101  return 0;
102 
103  // Convert to 360 degrees resolution
104  // atan2 outputs the value of -Ï€ to Ï€ (radians)
105  // We are then converting it to 0 to 2Ï€ and then to degrees
106  if(a == Pitch)
107  return (atan2f(accYval, accZval) + PI) * RAD_TO_DEG;
108  else
109  return (atan2f(accXval, accZval) + PI) * RAD_TO_DEG;
110 }
111 
112 float PS3BT::get9DOFValues(SensorEnum a) { // Thanks to Manfred Piendl
113  if(!PS3MoveConnected)
114  return 0;
115  int16_t value = getSensor(a);
116  if(a == mXmove || a == mYmove || a == mZmove) {
117  if(value > 2047)
118  value -= 0x1000;
119  return (float)value / 3.2f; // unit: muT = 10^(-6) Tesla
120  } else if(a == aXmove || a == aYmove || a == aZmove) {
121  if(value < 0)
122  value += 0x8000;
123  else
124  value -= 0x8000;
125  return (float)value / 442.0f; // unit: m/(s^2)
126  } else if(a == gXmove || a == gYmove || a == gZmove) {
127  if(value < 0)
128  value += 0x8000;
129  else
130  value -= 0x8000;
131  if(a == gXmove)
132  return (float)value / 11.6f; // unit: deg/s
133  else if(a == gYmove)
134  return (float)value / 11.2f; // unit: deg/s
135  else // gZmove
136  return (float)value / 9.6f; // unit: deg/s
137  } else
138  return 0;
139 }
140 
142  if(PS3MoveConnected) {
143  int16_t input = getSensor(tempMove);
144 
145  String output = String(input / 100);
146  output += ".";
147  if(input % 100 < 10)
148  output += "0";
149  output += String(input % 100);
150 
151  return output;
152  } else
153  return "Error";
154 }
155 
157  return (l2capinbuf[(uint16_t)c >> 8] == ((uint8_t)c & 0xff));
158 }
159 
161  char statusOutput[102]; // Max string length plus null character
163  strcpy_P(statusOutput, PSTR("\r\nConnectionStatus: "));
164 
165  if(getStatus(Plugged)) strcat_P(statusOutput, PSTR("Plugged"));
166  else if(getStatus(Unplugged)) strcat_P(statusOutput, PSTR("Unplugged"));
167  else strcat_P(statusOutput, PSTR("Error"));
168 
169  strcat_P(statusOutput, PSTR(" - PowerRating: "));
170 
171  if(getStatus(Charging)) strcat_P(statusOutput, PSTR("Charging"));
172  else if(getStatus(NotCharging)) strcat_P(statusOutput, PSTR("Not Charging"));
173  else if(getStatus(Shutdown)) strcat_P(statusOutput, PSTR("Shutdown"));
174  else if(getStatus(Dying)) strcat_P(statusOutput, PSTR("Dying"));
175  else if(getStatus(Low)) strcat_P(statusOutput, PSTR("Low"));
176  else if(getStatus(High)) strcat_P(statusOutput, PSTR("High"));
177  else if(getStatus(Full)) strcat_P(statusOutput, PSTR("Full"));
178  else strcat_P(statusOutput, PSTR("Error"));
179 
180  strcat_P(statusOutput, PSTR(" - WirelessStatus: "));
181 
182  if(getStatus(CableRumble)) strcat_P(statusOutput, PSTR("Cable - Rumble is on"));
183  else if(getStatus(Cable)) strcat_P(statusOutput, PSTR("Cable - Rumble is off"));
184  else if(getStatus(BluetoothRumble)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is on"));
185  else if(getStatus(Bluetooth)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is off"));
186  else strcat_P(statusOutput, PSTR("Error"));
187  } else if(PS3MoveConnected) {
188  strcpy_P(statusOutput, PSTR("\r\nPowerRating: "));
189 
190  if(getStatus(MoveCharging)) strcat_P(statusOutput, PSTR("Charging"));
191  else if(getStatus(MoveNotCharging)) strcat_P(statusOutput, PSTR("Not Charging"));
192  else if(getStatus(MoveShutdown)) strcat_P(statusOutput, PSTR("Shutdown"));
193  else if(getStatus(MoveDying)) strcat_P(statusOutput, PSTR("Dying"));
194  else if(getStatus(MoveLow)) strcat_P(statusOutput, PSTR("Low"));
195  else if(getStatus(MoveHigh)) strcat_P(statusOutput, PSTR("High"));
196  else if(getStatus(MoveFull)) strcat_P(statusOutput, PSTR("Full"));
197  else strcat_P(statusOutput, PSTR("Error"));
198  } else
199  strcpy_P(statusOutput, PSTR("\r\nError"));
200 
201  USB_HOST_SERIAL.write(statusOutput);
202 }
203 
204 void PS3BT::Reset() {
205  PS3Connected = false;
206  PS3MoveConnected = false;
207  PS3NavigationConnected = false;
208  activeConnection = false;
209  l2cap_event_flag = 0; // Reset flags
210  l2cap_state = L2CAP_WAIT;
211 
212  // Needed for PS3 Dualshock Controller commands to work via Bluetooth
213  for(uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
214  HIDBuffer[i + 2] = pgm_read_byte(&PS3_REPORT_BUFFER[i]); // First two bytes reserved for report type and ID
215 }
216 
217 void PS3BT::disconnect() { // Use this void to disconnect any of the controllers
218  // First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
219  pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
220  Reset();
221  l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
222 }
223 
224 void PS3BT::ACLData(uint8_t* ACLData) {
226  if(ACLData[8] == L2CAP_CMD_CONNECTION_REQUEST) {
227  if((ACLData[12] | (ACLData[13] << 8)) == HID_CTRL_PSM) {
228  pBtd->l2capConnectionClaimed = true; // Claim that the incoming connection belongs to this service
229  activeConnection = true;
230  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
231  l2cap_state = L2CAP_WAIT;
232  remote_name_first = pBtd->remote_name[0]; // Store the first letter in remote name for the connection
233 #ifdef DEBUG_USB_HOST
234  if(pBtd->hci_version < 3) { // Check the HCI Version of the Bluetooth dongle
235  Notify(PSTR("\r\nYour dongle may not support reading the analog buttons, sensors and status\r\nYour HCI Version is: "), 0x80);
236  Notify(pBtd->hci_version, 0x80);
237  Notify(PSTR("\r\nBut should be at least 3\r\nThis means that it doesn't support Bluetooth Version 2.0+EDR"), 0x80);
238  }
239 #endif
240  }
241  }
242  }
243 
244  if(checkHciHandle(ACLData, hci_handle)) { // acl_handle_ok
245  memcpy(l2capinbuf, ACLData, BULK_MAXPKTSIZE);
246  if((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001U) { // l2cap_control - Channel ID for ACL-U
247  if(l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
248 #ifdef DEBUG_USB_HOST
249  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
250  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
251  Notify(PSTR(" "), 0x80);
252  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
253  Notify(PSTR(" Data: "), 0x80);
254  D_PrintHex<uint8_t > (l2capinbuf[17], 0x80);
255  Notify(PSTR(" "), 0x80);
256  D_PrintHex<uint8_t > (l2capinbuf[16], 0x80);
257  Notify(PSTR(" "), 0x80);
258  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
259  Notify(PSTR(" "), 0x80);
260  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
261 #endif
262  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
263 #ifdef EXTRADEBUG
264  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
265  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
266  Notify(PSTR(" "), 0x80);
267  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
268  Notify(PSTR(" SCID: "), 0x80);
269  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
270  Notify(PSTR(" "), 0x80);
271  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
272  Notify(PSTR(" Identifier: "), 0x80);
273  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
274 #endif
275  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
276  identifier = l2capinbuf[9];
277  control_scid[0] = l2capinbuf[14];
278  control_scid[1] = l2capinbuf[15];
280  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_INTR_PSM) {
281  identifier = l2capinbuf[9];
282  interrupt_scid[0] = l2capinbuf[14];
283  interrupt_scid[1] = l2capinbuf[15];
285  }
286  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
287  if((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
288  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
289  //Notify(PSTR("\r\nHID Control Configuration Complete"), 0x80);
291  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
292  //Notify(PSTR("\r\nHID Interrupt Configuration Complete"), 0x80);
294  }
295  }
296  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
297  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
298  //Notify(PSTR("\r\nHID Control Configuration Request"), 0x80);
299  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], control_scid);
300  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
301  //Notify(PSTR("\r\nHID Interrupt Configuration Request"), 0x80);
302  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], interrupt_scid);
303  }
304  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
305  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
306 #ifdef DEBUG_USB_HOST
307  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
308 #endif
309  identifier = l2capinbuf[9];
310  pBtd->l2cap_disconnection_response(hci_handle, identifier, control_dcid, control_scid);
311  Reset();
312  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
313 #ifdef DEBUG_USB_HOST
314  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
315 #endif
316  identifier = l2capinbuf[9];
317  pBtd->l2cap_disconnection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid);
318  Reset();
319  }
320  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_RESPONSE) {
321  if(l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
322  //Notify(PSTR("\r\nDisconnect Response: Control Channel"), 0x80);
323  identifier = l2capinbuf[9];
325  } else if(l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
326  //Notify(PSTR("\r\nDisconnect Response: Interrupt Channel"), 0x80);
327  identifier = l2capinbuf[9];
329  }
330  }
331 #ifdef EXTRADEBUG
332  else {
333  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
334  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
335  }
336 #endif
337  } else if(l2capinbuf[6] == interrupt_dcid[0] && l2capinbuf[7] == interrupt_dcid[1]) { // l2cap_interrupt
338  //Notify(PSTR("\r\nL2CAP Interrupt"), 0x80);
340  /* Read Report */
341  if(l2capinbuf[8] == 0xA1) { // HID_THDR_DATA_INPUT
342  lastMessageTime = millis(); // Store the last message time
343 
345  ButtonState = (uint32_t)(l2capinbuf[11] | ((uint16_t)l2capinbuf[12] << 8) | ((uint32_t)l2capinbuf[13] << 16));
346  else if(PS3MoveConnected)
347  ButtonState = (uint32_t)(l2capinbuf[10] | ((uint16_t)l2capinbuf[11] << 8) | ((uint32_t)l2capinbuf[12] << 16));
348 
349  //Notify(PSTR("\r\nButtonState", 0x80);
350  //PrintHex<uint32_t>(ButtonState, 0x80);
351 
352  if(ButtonState != OldButtonState) {
353  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
354  OldButtonState = ButtonState;
355  }
356 
357 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
358  for(uint8_t i = 10; i < 58; i++) {
359  D_PrintHex<uint8_t > (l2capinbuf[i], 0x80);
360  Notify(PSTR(" "), 0x80);
361  }
362  Notify(PSTR("\r\n"), 0x80);
363 #endif
364  }
365  }
366  }
367  L2CAP_task();
368  }
369 }
370 
371 void PS3BT::L2CAP_task() {
372  switch(l2cap_state) {
373  case L2CAP_WAIT:
375 #ifdef DEBUG_USB_HOST
376  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
377 #endif
378  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, PENDING);
379  delay(1);
380  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, SUCCESSFUL);
381  identifier++;
382  delay(1);
384  l2cap_state = L2CAP_CONTROL_SUCCESS;
385  }
386  break;
387 
390 #ifdef DEBUG_USB_HOST
391  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
392 #endif
393  l2cap_state = L2CAP_INTERRUPT_SETUP;
394  }
395  break;
396 
399 #ifdef DEBUG_USB_HOST
400  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
401 #endif
402  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, PENDING);
403  delay(1);
404  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, SUCCESSFUL);
405  identifier++;
406  delay(1);
407  pBtd->l2cap_config_request(hci_handle, identifier, interrupt_scid);
408 
409  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
410  }
411  break;
412 
414  if(l2cap_check_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)) { // Now the HID channels is established
415 #ifdef DEBUG_USB_HOST
416  Notify(PSTR("\r\nHID Interrupt Successfully Configured"), 0x80);
417 #endif
418  if(remote_name_first == 'M') { // First letter in Motion Controller ('M')
419  memset(l2capinbuf, 0, BULK_MAXPKTSIZE); // Reset l2cap in buffer as it sometimes read it as a button has been pressed
420  l2cap_state = TURN_ON_LED;
421  } else
422  l2cap_state = PS3_ENABLE_SIXAXIS;
423  timer = millis();
424  }
425  break;
426 
427  /* These states are handled in Run() */
428 
431 #ifdef DEBUG_USB_HOST
432  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
433 #endif
434  identifier++;
435  pBtd->l2cap_disconnection_request(hci_handle, identifier, control_scid, control_dcid);
436  l2cap_state = L2CAP_CONTROL_DISCONNECT;
437  }
438  break;
439 
442 #ifdef DEBUG_USB_HOST
443  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
444 #endif
446  hci_handle = -1; // Reset handle
447  l2cap_event_flag = 0; // Reset flags
448  l2cap_state = L2CAP_WAIT;
449  }
450  break;
451  }
452 }
453 
454 void PS3BT::Run() {
455  switch(l2cap_state) {
456  case PS3_ENABLE_SIXAXIS:
457  if(millis() - timer > 1000) { // loop 1 second before sending the command
458  memset(l2capinbuf, 0, BULK_MAXPKTSIZE); // Reset l2cap in buffer as it sometimes read it as a button has been pressed
459  for(uint8_t i = 15; i < 19; i++)
460  l2capinbuf[i] = 0x7F; // Set the analog joystick values to center position
461  enable_sixaxis();
462  l2cap_state = TURN_ON_LED;
463  timer = millis();
464  }
465  break;
466 
467  case TURN_ON_LED:
468  if(millis() - timer > 1000) { // loop 1 second before sending the command
469  if(remote_name_first == 'P') { // First letter in PLAYSTATION(R)3 Controller ('P')
470 #ifdef DEBUG_USB_HOST
471  Notify(PSTR("\r\nDualshock 3 Controller Enabled\r\n"), 0x80);
472 #endif
473  PS3Connected = true;
474  } else if(remote_name_first == 'N') { // First letter in Navigation Controller ('N')
475 #ifdef DEBUG_USB_HOST
476  Notify(PSTR("\r\nNavigation Controller Enabled\r\n"), 0x80);
477 #endif
478  PS3NavigationConnected = true;
479  } else if(remote_name_first == 'M') { // First letter in Motion Controller ('M')
480  timer = millis();
481 #ifdef DEBUG_USB_HOST
482  Notify(PSTR("\r\nMotion Controller Enabled\r\n"), 0x80);
483 #endif
484  PS3MoveConnected = true;
485  }
486  ButtonState = 0; // Clear all values
487  OldButtonState = 0;
488  ButtonClickState = 0;
489 
490  onInit(); // Turn on the LED on the controller
491  l2cap_state = L2CAP_DONE;
492  }
493  break;
494 
495  case L2CAP_DONE:
496  if(PS3MoveConnected) { // The Bulb and rumble values, has to be send at approximately every 5th second for it to stay on
497  if(millis() - timer > 4000) { // Send at least every 4th second
498  HIDMove_Command(HIDMoveBuffer, HID_BUFFERSIZE); // The Bulb and rumble values, has to be written again and again, for it to stay turned on
499  timer = millis();
500  }
501  }
502  break;
503  }
504 }
505 
506 /************************************************************/
507 /* HID Commands */
508 /************************************************************/
509 
510 // Playstation Sixaxis Dualshock and Navigation Controller commands
511 
512 void PS3BT::HID_Command(uint8_t* data, uint8_t nbytes) {
513  if(millis() - timerHID <= 150) // Check if is has been more than 150ms since last command
514  delay((uint32_t)(150 - (millis() - timerHID))); // There have to be a delay between commands
515  pBtd->L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]); // Both the Navigation and Dualshock controller sends data via the control channel
516  timerHID = millis();
517 }
518 
520  HIDBuffer[3] = 0x00; // Rumble bytes
521  HIDBuffer[4] = 0x00;
522  HIDBuffer[5] = 0x00;
523  HIDBuffer[6] = 0x00;
524 
525  HIDBuffer[11] = 0x00; // LED byte
526 
527  HID_Command(HIDBuffer, HID_BUFFERSIZE);
528 }
529 
531  uint8_t rumbleBuf[HID_BUFFERSIZE];
532  memcpy(rumbleBuf, HIDBuffer, HID_BUFFERSIZE);
533  rumbleBuf[3] = 0x00;
534  rumbleBuf[4] = 0x00;
535  rumbleBuf[5] = 0x00;
536  rumbleBuf[6] = 0x00;
537  HID_Command(rumbleBuf, HID_BUFFERSIZE);
538 }
539 
541  uint8_t power[2] = {0xff, 0x00}; // Defaults to RumbleLow
542  if(mode == RumbleHigh) {
543  power[0] = 0x00;
544  power[1] = 0xff;
545  }
546  setRumbleOn(0xfe, power[0], 0xfe, power[1]);
547 }
548 
549 void PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
550  uint8_t rumbleBuf[HID_BUFFERSIZE];
551  memcpy(rumbleBuf, HIDBuffer, HID_BUFFERSIZE);
552  rumbleBuf[3] = rightDuration;
553  rumbleBuf[4] = rightPower;
554  rumbleBuf[5] = leftDuration;
555  rumbleBuf[6] = leftPower;
556  HID_Command(rumbleBuf, HID_BUFFERSIZE);
557 }
558 
559 void PS3BT::setLedRaw(uint8_t value) {
560  HIDBuffer[11] = value << 1;
561  HID_Command(HIDBuffer, HID_BUFFERSIZE);
562 }
563 
565  HIDBuffer[11] &= ~((uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1));
566  HID_Command(HIDBuffer, HID_BUFFERSIZE);
567 }
568 
570  if(a == OFF)
571  setLedRaw(0);
572  else {
573  HIDBuffer[11] |= (uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1);
574  HID_Command(HIDBuffer, HID_BUFFERSIZE);
575  }
576 }
577 
579  HIDBuffer[11] ^= (uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1);
580  HID_Command(HIDBuffer, HID_BUFFERSIZE);
581 }
582 
583 void PS3BT::enable_sixaxis() { // Command used to enable the Dualshock 3 and Navigation controller to send data via Bluetooth
584  uint8_t cmd_buf[6];
585  cmd_buf[0] = 0x53; // HID BT Set_report (0x50) | Report Type (Feature 0x03)
586  cmd_buf[1] = 0xF4; // Report ID
587  cmd_buf[2] = 0x42; // Special PS3 Controller enable commands
588  cmd_buf[3] = 0x03;
589  cmd_buf[4] = 0x00;
590  cmd_buf[5] = 0x00;
591 
592  HID_Command(cmd_buf, 6);
593 }
594 
595 // Playstation Move Controller commands
596 
597 void PS3BT::HIDMove_Command(uint8_t* data, uint8_t nbytes) {
598  if(millis() - timerHID <= 150)// Check if is has been less than 150ms since last command
599  delay((uint32_t)(150 - (millis() - timerHID))); // There have to be a delay between commands
600  pBtd->L2CAP_Command(hci_handle, data, nbytes, interrupt_scid[0], interrupt_scid[1]); // The Move controller sends it's data via the intterrupt channel
601  timerHID = millis();
602 }
603 
604 void PS3BT::moveSetBulb(uint8_t r, uint8_t g, uint8_t b) { // Use this to set the Color using RGB values
605  // Set the Bulb's values into the write buffer
606  HIDMoveBuffer[3] = r;
607  HIDMoveBuffer[4] = g;
608  HIDMoveBuffer[5] = b;
609 
610  HIDMove_Command(HIDMoveBuffer, HID_BUFFERSIZE);
611 }
612 
613 void PS3BT::moveSetBulb(ColorsEnum color) { // Use this to set the Color using the predefined colors in enum
614  moveSetBulb((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color));
615 }
616 
617 void PS3BT::moveSetRumble(uint8_t rumble) {
618 #ifdef DEBUG_USB_HOST
619  if(rumble < 64 && rumble != 0) // The rumble value has to at least 64, or approximately 25% (64/255*100)
620  Notify(PSTR("\r\nThe rumble value has to at least 64, or approximately 25%"), 0x80);
621 #endif
622  // Set the rumble value into the write buffer
623  HIDMoveBuffer[7] = rumble;
624 
625  HIDMove_Command(HIDMoveBuffer, HID_BUFFERSIZE);
626 }
627 
629  if(pFuncOnInit)
630  pFuncOnInit(); // Call the user function
631  else {
632  if(PS3MoveConnected)
633  moveSetBulb(Red);
634  else // Dualshock 3 or Navigation controller
635  setLedOn(static_cast<LEDEnum>(LED1));
636  }
637 }
#define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE
Definition: BTD.h:137
-
bool incomingWii
Definition: BTD.h:471
+Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "PS3BT.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the PS3 Controllers
22 
23 PS3BT::PS3BT(BTD *p, uint8_t btadr5, uint8_t btadr4, uint8_t btadr3, uint8_t btadr2, uint8_t btadr1, uint8_t btadr0) :
24 BluetoothService(p) // Pointer to USB class instance - mandatory
25 {
26  pBtd->my_bdaddr[5] = btadr5; // Change to your dongle's Bluetooth address instead
27  pBtd->my_bdaddr[4] = btadr4;
28  pBtd->my_bdaddr[3] = btadr3;
29  pBtd->my_bdaddr[2] = btadr2;
30  pBtd->my_bdaddr[1] = btadr1;
31  pBtd->my_bdaddr[0] = btadr0;
32 
33  HIDBuffer[0] = 0x52; // HID BT Set_report (0x50) | Report Type (Output 0x02)
34  HIDBuffer[1] = 0x01; // Report ID
35 
36  // Needed for PS3 Move Controller commands to work via bluetooth
37  HIDMoveBuffer[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
38  HIDMoveBuffer[1] = 0x02; // Report ID
39 
40  /* Set device cid for the control and intterrupt channelse - LSB */
41  control_dcid[0] = 0x40; // 0x0040
42  control_dcid[1] = 0x00;
43  interrupt_dcid[0] = 0x41; // 0x0041
44  interrupt_dcid[1] = 0x00;
45 
46  Reset();
47 }
48 
50  return (ButtonState & pgm_read_dword(&PS3_BUTTONS[(uint8_t)b]));
51 }
52 
54  uint32_t button = pgm_read_dword(&PS3_BUTTONS[(uint8_t)b]);
55  bool click = (ButtonClickState & button);
56  ButtonClickState &= ~button; // Clear "click" event
57  return click;
58 }
59 
61  return (uint8_t)(l2capinbuf[pgm_read_byte(&PS3_ANALOG_BUTTONS[(uint8_t)a])]);
62 }
63 
65  return (uint8_t)(l2capinbuf[(uint8_t)a + 15]);
66 }
67 
69  if(PS3Connected) {
70  if(a == aX || a == aY || a == aZ || a == gZ)
71  return ((l2capinbuf[(uint16_t)a] << 8) | l2capinbuf[(uint16_t)a + 1]);
72  else
73  return 0;
74  } else if(PS3MoveConnected) {
75  if(a == mXmove || a == mYmove) // These are all 12-bits long
76  return (((l2capinbuf[(uint16_t)a] & 0x0F) << 8) | (l2capinbuf[(uint16_t)a + 1]));
77  else if(a == mZmove || a == tempMove) // The tempearature is also 12 bits long
78  return ((l2capinbuf[(uint16_t)a] << 4) | ((l2capinbuf[(uint16_t)a + 1] & 0xF0) >> 4));
79  else // aXmove, aYmove, aZmove, gXmove, gYmove and gZmove
80  return (l2capinbuf[(uint16_t)a] | (l2capinbuf[(uint16_t)a + 1] << 8));
81  } else
82  return 0;
83 }
84 
86  float accXval, accYval, accZval;
87 
88  if(PS3Connected) {
89  // Data for the Kionix KXPC4 used in the DualShock 3
90  const float zeroG = 511.5f; // 1.65/3.3*1023 (1.65V)
91  accXval = -((float)getSensor(aX) - zeroG);
92  accYval = -((float)getSensor(aY) - zeroG);
93  accZval = -((float)getSensor(aZ) - zeroG);
94  } else if(PS3MoveConnected) {
95  // It's a Kionix KXSC4 inside the Motion controller
96  const uint16_t zeroG = 0x8000;
97  accXval = -(int16_t)(getSensor(aXmove) - zeroG);
98  accYval = (int16_t)(getSensor(aYmove) - zeroG);
99  accZval = (int16_t)(getSensor(aZmove) - zeroG);
100  } else
101  return 0;
102 
103  // Convert to 360 degrees resolution
104  // atan2 outputs the value of -Ï€ to Ï€ (radians)
105  // We are then converting it to 0 to 2Ï€ and then to degrees
106  if(a == Pitch)
107  return (atan2f(accYval, accZval) + PI) * RAD_TO_DEG;
108  else
109  return (atan2f(accXval, accZval) + PI) * RAD_TO_DEG;
110 }
111 
112 float PS3BT::get9DOFValues(SensorEnum a) { // Thanks to Manfred Piendl
113  if(!PS3MoveConnected)
114  return 0;
115  int16_t value = getSensor(a);
116  if(a == mXmove || a == mYmove || a == mZmove) {
117  if(value > 2047)
118  value -= 0x1000;
119  return (float)value / 3.2f; // unit: muT = 10^(-6) Tesla
120  } else if(a == aXmove || a == aYmove || a == aZmove) {
121  if(value < 0)
122  value += 0x8000;
123  else
124  value -= 0x8000;
125  return (float)value / 442.0f; // unit: m/(s^2)
126  } else if(a == gXmove || a == gYmove || a == gZmove) {
127  if(value < 0)
128  value += 0x8000;
129  else
130  value -= 0x8000;
131  if(a == gXmove)
132  return (float)value / 11.6f; // unit: deg/s
133  else if(a == gYmove)
134  return (float)value / 11.2f; // unit: deg/s
135  else // gZmove
136  return (float)value / 9.6f; // unit: deg/s
137  } else
138  return 0;
139 }
140 
142  if(PS3MoveConnected) {
143  int16_t input = getSensor(tempMove);
144 
145  String output = String(input / 100);
146  output += ".";
147  if(input % 100 < 10)
148  output += "0";
149  output += String(input % 100);
150 
151  return output;
152  } else
153  return "Error";
154 }
155 
157  return (l2capinbuf[(uint16_t)c >> 8] == ((uint8_t)c & 0xff));
158 }
159 
161  char statusOutput[102]; // Max string length plus null character
163  strcpy_P(statusOutput, PSTR("\r\nConnectionStatus: "));
164 
165  if(getStatus(Plugged)) strcat_P(statusOutput, PSTR("Plugged"));
166  else if(getStatus(Unplugged)) strcat_P(statusOutput, PSTR("Unplugged"));
167  else strcat_P(statusOutput, PSTR("Error"));
168 
169  strcat_P(statusOutput, PSTR(" - PowerRating: "));
170 
171  if(getStatus(Charging)) strcat_P(statusOutput, PSTR("Charging"));
172  else if(getStatus(NotCharging)) strcat_P(statusOutput, PSTR("Not Charging"));
173  else if(getStatus(Shutdown)) strcat_P(statusOutput, PSTR("Shutdown"));
174  else if(getStatus(Dying)) strcat_P(statusOutput, PSTR("Dying"));
175  else if(getStatus(Low)) strcat_P(statusOutput, PSTR("Low"));
176  else if(getStatus(High)) strcat_P(statusOutput, PSTR("High"));
177  else if(getStatus(Full)) strcat_P(statusOutput, PSTR("Full"));
178  else strcat_P(statusOutput, PSTR("Error"));
179 
180  strcat_P(statusOutput, PSTR(" - WirelessStatus: "));
181 
182  if(getStatus(CableRumble)) strcat_P(statusOutput, PSTR("Cable - Rumble is on"));
183  else if(getStatus(Cable)) strcat_P(statusOutput, PSTR("Cable - Rumble is off"));
184  else if(getStatus(BluetoothRumble)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is on"));
185  else if(getStatus(Bluetooth)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is off"));
186  else strcat_P(statusOutput, PSTR("Error"));
187  } else if(PS3MoveConnected) {
188  strcpy_P(statusOutput, PSTR("\r\nPowerRating: "));
189 
190  if(getStatus(MoveCharging)) strcat_P(statusOutput, PSTR("Charging"));
191  else if(getStatus(MoveNotCharging)) strcat_P(statusOutput, PSTR("Not Charging"));
192  else if(getStatus(MoveShutdown)) strcat_P(statusOutput, PSTR("Shutdown"));
193  else if(getStatus(MoveDying)) strcat_P(statusOutput, PSTR("Dying"));
194  else if(getStatus(MoveLow)) strcat_P(statusOutput, PSTR("Low"));
195  else if(getStatus(MoveHigh)) strcat_P(statusOutput, PSTR("High"));
196  else if(getStatus(MoveFull)) strcat_P(statusOutput, PSTR("Full"));
197  else strcat_P(statusOutput, PSTR("Error"));
198  } else
199  strcpy_P(statusOutput, PSTR("\r\nError"));
200 
201  USB_HOST_SERIAL.write(statusOutput);
202 }
203 
204 void PS3BT::Reset() {
205  PS3Connected = false;
206  PS3MoveConnected = false;
207  PS3NavigationConnected = false;
208  activeConnection = false;
209  l2cap_event_flag = 0; // Reset flags
210  l2cap_state = L2CAP_WAIT;
211 
212  // Needed for PS3 Dualshock Controller commands to work via Bluetooth
213  for(uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
214  HIDBuffer[i + 2] = pgm_read_byte(&PS3_REPORT_BUFFER[i]); // First two bytes reserved for report type and ID
215 }
216 
217 void PS3BT::disconnect() { // Use this void to disconnect any of the controllers
218  // First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
219  pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
220  Reset();
221  l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
222 }
223 
224 void PS3BT::ACLData(uint8_t* ACLData) {
227  if((ACLData[12] | (ACLData[13] << 8)) == HID_CTRL_PSM) {
228  pBtd->l2capConnectionClaimed = true; // Claim that the incoming connection belongs to this service
229  activeConnection = true;
230  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
231  l2cap_state = L2CAP_WAIT;
232  remote_name_first = pBtd->remote_name[0]; // Store the first letter in remote name for the connection
233 #ifdef DEBUG_USB_HOST
234  if(pBtd->hci_version < 3) { // Check the HCI Version of the Bluetooth dongle
235  Notify(PSTR("\r\nYour dongle may not support reading the analog buttons, sensors and status\r\nYour HCI Version is: "), 0x80);
236  Notify(pBtd->hci_version, 0x80);
237  Notify(PSTR("\r\nBut should be at least 3\r\nThis means that it doesn't support Bluetooth Version 2.0+EDR"), 0x80);
238  }
239 #endif
240  }
241  }
242  }
243 
244  if(checkHciHandle(ACLData, hci_handle)) { // acl_handle_ok
245  memcpy(l2capinbuf, ACLData, BULK_MAXPKTSIZE);
246  if((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001U) { // l2cap_control - Channel ID for ACL-U
247  if(l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
248 #ifdef DEBUG_USB_HOST
249  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
250  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
251  Notify(PSTR(" "), 0x80);
252  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
253  Notify(PSTR(" Data: "), 0x80);
254  D_PrintHex<uint8_t > (l2capinbuf[17], 0x80);
255  Notify(PSTR(" "), 0x80);
256  D_PrintHex<uint8_t > (l2capinbuf[16], 0x80);
257  Notify(PSTR(" "), 0x80);
258  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
259  Notify(PSTR(" "), 0x80);
260  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
261 #endif
262  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
263 #ifdef EXTRADEBUG
264  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
265  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
266  Notify(PSTR(" "), 0x80);
267  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
268  Notify(PSTR(" SCID: "), 0x80);
269  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
270  Notify(PSTR(" "), 0x80);
271  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
272  Notify(PSTR(" Identifier: "), 0x80);
273  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
274 #endif
275  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
276  identifier = l2capinbuf[9];
277  control_scid[0] = l2capinbuf[14];
278  control_scid[1] = l2capinbuf[15];
280  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_INTR_PSM) {
281  identifier = l2capinbuf[9];
282  interrupt_scid[0] = l2capinbuf[14];
283  interrupt_scid[1] = l2capinbuf[15];
285  }
286  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
287  if((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
288  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
289  //Notify(PSTR("\r\nHID Control Configuration Complete"), 0x80);
291  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
292  //Notify(PSTR("\r\nHID Interrupt Configuration Complete"), 0x80);
294  }
295  }
296  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
297  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
298  //Notify(PSTR("\r\nHID Control Configuration Request"), 0x80);
299  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], control_scid);
300  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
301  //Notify(PSTR("\r\nHID Interrupt Configuration Request"), 0x80);
302  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], interrupt_scid);
303  }
304  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
305  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
306 #ifdef DEBUG_USB_HOST
307  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
308 #endif
309  identifier = l2capinbuf[9];
310  pBtd->l2cap_disconnection_response(hci_handle, identifier, control_dcid, control_scid);
311  Reset();
312  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
313 #ifdef DEBUG_USB_HOST
314  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
315 #endif
316  identifier = l2capinbuf[9];
317  pBtd->l2cap_disconnection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid);
318  Reset();
319  }
320  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_RESPONSE) {
321  if(l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
322  //Notify(PSTR("\r\nDisconnect Response: Control Channel"), 0x80);
323  identifier = l2capinbuf[9];
325  } else if(l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
326  //Notify(PSTR("\r\nDisconnect Response: Interrupt Channel"), 0x80);
327  identifier = l2capinbuf[9];
329  }
330  }
331 #ifdef EXTRADEBUG
332  else {
333  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
334  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
335  }
336 #endif
337  } else if(l2capinbuf[6] == interrupt_dcid[0] && l2capinbuf[7] == interrupt_dcid[1]) { // l2cap_interrupt
338  //Notify(PSTR("\r\nL2CAP Interrupt"), 0x80);
340  /* Read Report */
341  if(l2capinbuf[8] == 0xA1) { // HID_THDR_DATA_INPUT
342  lastMessageTime = (uint32_t)millis(); // Store the last message time
343 
345  ButtonState = (uint32_t)(l2capinbuf[11] | ((uint16_t)l2capinbuf[12] << 8) | ((uint32_t)l2capinbuf[13] << 16));
346  else if(PS3MoveConnected)
347  ButtonState = (uint32_t)(l2capinbuf[10] | ((uint16_t)l2capinbuf[11] << 8) | ((uint32_t)l2capinbuf[12] << 16));
348 
349  //Notify(PSTR("\r\nButtonState", 0x80);
350  //PrintHex<uint32_t>(ButtonState, 0x80);
351 
352  if(ButtonState != OldButtonState) {
353  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
354  OldButtonState = ButtonState;
355  }
356 
357 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
358  for(uint8_t i = 10; i < 58; i++) {
359  D_PrintHex<uint8_t > (l2capinbuf[i], 0x80);
360  Notify(PSTR(" "), 0x80);
361  }
362  Notify(PSTR("\r\n"), 0x80);
363 #endif
364  }
365  }
366  }
367  L2CAP_task();
368  }
369 }
370 
371 void PS3BT::L2CAP_task() {
372  switch(l2cap_state) {
373  case L2CAP_WAIT:
375 #ifdef DEBUG_USB_HOST
376  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
377 #endif
378  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, PENDING);
379  delay(1);
380  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, SUCCESSFUL);
381  identifier++;
382  delay(1);
384  l2cap_state = L2CAP_CONTROL_SUCCESS;
385  }
386  break;
387 
390 #ifdef DEBUG_USB_HOST
391  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
392 #endif
393  l2cap_state = L2CAP_INTERRUPT_SETUP;
394  }
395  break;
396 
399 #ifdef DEBUG_USB_HOST
400  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
401 #endif
402  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, PENDING);
403  delay(1);
404  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, SUCCESSFUL);
405  identifier++;
406  delay(1);
407  pBtd->l2cap_config_request(hci_handle, identifier, interrupt_scid);
408 
409  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
410  }
411  break;
412 
414  if(l2cap_check_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)) { // Now the HID channels is established
415 #ifdef DEBUG_USB_HOST
416  Notify(PSTR("\r\nHID Interrupt Successfully Configured"), 0x80);
417 #endif
418  if(remote_name_first == 'M') { // First letter in Motion Controller ('M')
419  memset(l2capinbuf, 0, BULK_MAXPKTSIZE); // Reset l2cap in buffer as it sometimes read it as a button has been pressed
420  l2cap_state = TURN_ON_LED;
421  } else
422  l2cap_state = PS3_ENABLE_SIXAXIS;
423  timer = (uint32_t)millis();
424  }
425  break;
426 
427  /* These states are handled in Run() */
428 
431 #ifdef DEBUG_USB_HOST
432  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
433 #endif
434  identifier++;
435  pBtd->l2cap_disconnection_request(hci_handle, identifier, control_scid, control_dcid);
436  l2cap_state = L2CAP_CONTROL_DISCONNECT;
437  }
438  break;
439 
442 #ifdef DEBUG_USB_HOST
443  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
444 #endif
446  hci_handle = -1; // Reset handle
447  l2cap_event_flag = 0; // Reset flags
448  l2cap_state = L2CAP_WAIT;
449  }
450  break;
451  }
452 }
453 
454 void PS3BT::Run() {
455  switch(l2cap_state) {
456  case PS3_ENABLE_SIXAXIS:
457  if((int32_t)((uint32_t)millis() - timer) > 1000) { // loop 1 second before sending the command
458  memset(l2capinbuf, 0, BULK_MAXPKTSIZE); // Reset l2cap in buffer as it sometimes read it as a button has been pressed
459  for(uint8_t i = 15; i < 19; i++)
460  l2capinbuf[i] = 0x7F; // Set the analog joystick values to center position
461  enable_sixaxis();
462  l2cap_state = TURN_ON_LED;
463  timer = (uint32_t)millis();
464  }
465  break;
466 
467  case TURN_ON_LED:
468  if((int32_t)((uint32_t)millis() - timer) > 1000) { // loop 1 second before sending the command
469  if(remote_name_first == 'P') { // First letter in PLAYSTATION(R)3 Controller ('P')
470 #ifdef DEBUG_USB_HOST
471  Notify(PSTR("\r\nDualshock 3 Controller Enabled\r\n"), 0x80);
472 #endif
473  PS3Connected = true;
474  } else if(remote_name_first == 'N') { // First letter in Navigation Controller ('N')
475 #ifdef DEBUG_USB_HOST
476  Notify(PSTR("\r\nNavigation Controller Enabled\r\n"), 0x80);
477 #endif
478  PS3NavigationConnected = true;
479  } else if(remote_name_first == 'M') { // First letter in Motion Controller ('M')
480  timer = (uint32_t)millis();
481 #ifdef DEBUG_USB_HOST
482  Notify(PSTR("\r\nMotion Controller Enabled\r\n"), 0x80);
483 #endif
484  PS3MoveConnected = true;
485  }
486  ButtonState = 0; // Clear all values
487  OldButtonState = 0;
488  ButtonClickState = 0;
489 
490  onInit(); // Turn on the LED on the controller
491  l2cap_state = L2CAP_DONE;
492  }
493  break;
494 
495  case L2CAP_DONE:
496  if(PS3MoveConnected) { // The Bulb and rumble values, has to be send at approximately every 5th second for it to stay on
497  if((int32_t)((uint32_t)millis() - timer) > 4000) { // Send at least every 4th second
498  HIDMove_Command(HIDMoveBuffer, HID_BUFFERSIZE); // The Bulb and rumble values, has to be written again and again, for it to stay turned on
499  timer = (uint32_t)millis();
500  }
501  }
502  break;
503  }
504 }
505 
506 /************************************************************/
507 /* HID Commands */
508 /************************************************************/
509 
510 // Playstation Sixaxis Dualshock and Navigation Controller commands
511 
512 void PS3BT::HID_Command(uint8_t* data, uint8_t nbytes) {
513  if((int32_t)((uint32_t)millis() - timerHID) <= 150) // Check if is has been more than 150ms since last command
514  delay((uint32_t)(150 - ((uint32_t)millis() - timerHID))); // There have to be a delay between commands
515  pBtd->L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]); // Both the Navigation and Dualshock controller sends data via the control channel
516  timerHID = (uint32_t)millis();
517 }
518 
520  HIDBuffer[3] = 0x00; // Rumble bytes
521  HIDBuffer[4] = 0x00;
522  HIDBuffer[5] = 0x00;
523  HIDBuffer[6] = 0x00;
524 
525  HIDBuffer[11] = 0x00; // LED byte
526 
527  HID_Command(HIDBuffer, HID_BUFFERSIZE);
528 }
529 
531  uint8_t rumbleBuf[HID_BUFFERSIZE];
532  memcpy(rumbleBuf, HIDBuffer, HID_BUFFERSIZE);
533  rumbleBuf[3] = 0x00;
534  rumbleBuf[4] = 0x00;
535  rumbleBuf[5] = 0x00;
536  rumbleBuf[6] = 0x00;
537  HID_Command(rumbleBuf, HID_BUFFERSIZE);
538 }
539 
541  uint8_t power[2] = {0xff, 0x00}; // Defaults to RumbleLow
542  if(mode == RumbleHigh) {
543  power[0] = 0x00;
544  power[1] = 0xff;
545  }
546  setRumbleOn(0xfe, power[0], 0xfe, power[1]);
547 }
548 
549 void PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
550  uint8_t rumbleBuf[HID_BUFFERSIZE];
551  memcpy(rumbleBuf, HIDBuffer, HID_BUFFERSIZE);
552  rumbleBuf[3] = rightDuration;
553  rumbleBuf[4] = rightPower;
554  rumbleBuf[5] = leftDuration;
555  rumbleBuf[6] = leftPower;
556  HID_Command(rumbleBuf, HID_BUFFERSIZE);
557 }
558 
559 void PS3BT::setLedRaw(uint8_t value) {
560  HIDBuffer[11] = value << 1;
561  HID_Command(HIDBuffer, HID_BUFFERSIZE);
562 }
563 
565  HIDBuffer[11] &= ~((uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1));
566  HID_Command(HIDBuffer, HID_BUFFERSIZE);
567 }
568 
570  if(a == OFF)
571  setLedRaw(0);
572  else {
573  HIDBuffer[11] |= (uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1);
574  HID_Command(HIDBuffer, HID_BUFFERSIZE);
575  }
576 }
577 
579  HIDBuffer[11] ^= (uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1);
580  HID_Command(HIDBuffer, HID_BUFFERSIZE);
581 }
582 
583 void PS3BT::enable_sixaxis() { // Command used to enable the Dualshock 3 and Navigation controller to send data via Bluetooth
584  uint8_t cmd_buf[6];
585  cmd_buf[0] = 0x53; // HID BT Set_report (0x50) | Report Type (Feature 0x03)
586  cmd_buf[1] = 0xF4; // Report ID
587  cmd_buf[2] = 0x42; // Special PS3 Controller enable commands
588  cmd_buf[3] = 0x03;
589  cmd_buf[4] = 0x00;
590  cmd_buf[5] = 0x00;
591 
592  HID_Command(cmd_buf, 6);
593 }
594 
595 // Playstation Move Controller commands
596 
597 void PS3BT::HIDMove_Command(uint8_t* data, uint8_t nbytes) {
598  if((int32_t)((uint32_t)millis() - timerHID) <= 150)// Check if is has been less than 150ms since last command
599  delay((uint32_t)(150 - ((uint32_t)millis() - timerHID))); // There have to be a delay between commands
600  pBtd->L2CAP_Command(hci_handle, data, nbytes, interrupt_scid[0], interrupt_scid[1]); // The Move controller sends it's data via the intterrupt channel
601  timerHID = (uint32_t)millis();
602 }
603 
604 void PS3BT::moveSetBulb(uint8_t r, uint8_t g, uint8_t b) { // Use this to set the Color using RGB values
605  // Set the Bulb's values into the write buffer
606  HIDMoveBuffer[3] = r;
607  HIDMoveBuffer[4] = g;
608  HIDMoveBuffer[5] = b;
609 
610  HIDMove_Command(HIDMoveBuffer, HID_BUFFERSIZE);
611 }
612 
613 void PS3BT::moveSetBulb(ColorsEnum color) { // Use this to set the Color using the predefined colors in enum
614  moveSetBulb((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color));
615 }
616 
617 void PS3BT::moveSetRumble(uint8_t rumble) {
618 #ifdef DEBUG_USB_HOST
619  if(rumble < 64 && rumble != 0) // The rumble value has to at least 64, or approximately 25% (64/255*100)
620  Notify(PSTR("\r\nThe rumble value has to at least 64, or approximately 25%"), 0x80);
621 #endif
622  // Set the rumble value into the write buffer
623  HIDMoveBuffer[7] = rumble;
624 
625  HIDMove_Command(HIDMoveBuffer, HID_BUFFERSIZE);
626 }
627 
629  if(pFuncOnInit)
630  pFuncOnInit(); // Call the user function
631  else {
632  if(PS3MoveConnected)
633  moveSetBulb(Red);
634  else // Dualshock 3 or Navigation controller
635  setLedOn(static_cast<LEDEnum>(LED1));
636  }
637 }
#define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE
Definition: BTD.h:140
+
bool incomingWii
Definition: BTD.h:474
Definition: PS3Enums.h:124
-
#define pgm_read_dword(addr)
+
#define pgm_read_dword(addr)
bool PS3NavigationConnected
Definition: PS3BT.h:184
-
#define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS
Definition: BTD.h:141
-
#define L2CAP_INTERRUPT_CONFIG_REQUEST
Definition: BTD.h:113
-
#define L2CAP_INTERRUPT_SETUP
Definition: BTD.h:111
+
#define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS
Definition: BTD.h:144
+
#define L2CAP_INTERRUPT_CONFIG_REQUEST
Definition: BTD.h:116
+
#define L2CAP_INTERRUPT_SETUP
Definition: BTD.h:114
bool getStatus(StatusEnum c)
Definition: PS3BT.cpp:156
-
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1262
+
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1260
void Run()
Definition: PS3BT.cpp:454
-
#define SUCCESSFUL
Definition: BTD.h:175
-
#define strcpy_P(dest, src)
-
#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST
Definition: BTD.h:140
-
Definition: BTD.h:198
- +
#define SUCCESSFUL
Definition: BTD.h:178
+
#define strcpy_P(dest, src)
+
#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST
Definition: BTD.h:143
+
Definition: BTD.h:201
+
void setLedOn(LEDEnum a)
Definition: PS3BT.cpp:569
-
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1315
+
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1313
-
uint8_t hci_version
Definition: BTD.h:461
- - -
bool pairWithWii
Definition: BTD.h:473
-
uint8_t identifier
Definition: BTD.h:617
+
uint8_t hci_version
Definition: BTD.h:464
+ + +
bool pairWithWii
Definition: BTD.h:476
+
uint8_t identifier
Definition: BTD.h:621
String getTemperature()
Definition: PS3BT.cpp:141
-
AnalogHatEnum
+
AnalogHatEnum
void moveSetRumble(uint8_t rumble)
Definition: PS3BT.cpp:617
-
#define TURN_ON_LED
Definition: BTD.h:127
- - +
#define TURN_ON_LED
Definition: BTD.h:130
+ +
void printStatusString()
Definition: PS3BT.cpp:160
void setAllOff()
Definition: PS3BT.cpp:519
- -
#define L2CAP_DONE
Definition: BTD.h:102
+ +
#define L2CAP_DONE
Definition: BTD.h:105
-
#define L2CAP_CONTROL_SUCCESS
Definition: BTD.h:107
-
#define L2CAP_WAIT
Definition: BTD.h:101
+
#define L2CAP_CONTROL_SUCCESS
Definition: BTD.h:110
+
#define L2CAP_WAIT
Definition: BTD.h:104
StatusEnum
Definition: PS3Enums.h:113
#define HID_BUFFERSIZE
Definition: PS3BT.h:24
void Reset()
Definition: PS3BT.cpp:204
-
#define pgm_read_byte(addr)
- -
char remote_name[30]
Definition: BTD.h:455
- +
#define pgm_read_byte(addr)
+ +
char remote_name[30]
Definition: BTD.h:458
+
const uint32_t PS3_BUTTONS[]
Definition: PS3Enums.h:62
bool getButtonPress(ButtonEnum b)
Definition: PS3BT.cpp:49
-
LEDEnum
+
LEDEnum
int16_t getSensor(SensorEnum a)
Definition: PS3BT.cpp:68
-
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1328
-
#define Notify(...)
Definition: message.h:44
-
RumbleEnum
-
#define USB_HOST_SERIAL
Definition: settings.h:34
-
#define HID_CTRL_PSM
Definition: BTD.h:180
- +
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1326
+
#define Notify(...)
Definition: message.h:51
+
RumbleEnum
+
#define USB_HOST_SERIAL
Definition: settings.h:49
+
#define HID_CTRL_PSM
Definition: BTD.h:183
+
Definition: PS3Enums.h:123
- -
bool connectToWii
Definition: BTD.h:467
+ +
bool connectToWii
Definition: BTD.h:470
uint8_t getAnalogHat(AnalogHatEnum a)
Definition: PS3BT.cpp:64
-
uint16_t hci_handle
Definition: BTD.h:451
+
uint16_t hci_handle
Definition: BTD.h:454
bool PS3Connected
Definition: PS3BT.h:176
-
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1173
- -
#define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE
Definition: BTD.h:143
- -
ButtonEnum
+
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1171
+ +
#define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE
Definition: BTD.h:146
+ +
ButtonEnum
void moveSetBulb(uint8_t r, uint8_t g, uint8_t b)
Definition: PS3BT.cpp:604
bool PS3MoveConnected
Definition: PS3BT.h:182
-
uint8_t my_bdaddr[6]
Definition: BTD.h:449
- +
uint8_t my_bdaddr[6]
Definition: BTD.h:452
+
void setRumbleOn(RumbleEnum mode)
Definition: PS3BT.cpp:540
-
void(* pFuncOnInit)(void)
Definition: BTD.h:605
+
void(* pFuncOnInit)(void)
Definition: BTD.h:609
float get9DOFValues(SensorEnum a)
Definition: PS3BT.cpp:112
const uint8_t PS3_LEDS[]
Definition: PS3Enums.h:43
-
#define l2cap_check_flag(flag)
Definition: BTD.h:158
+
#define l2cap_check_flag(flag)
Definition: BTD.h:161
-
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:166
-
#define PSTR(str)
-
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:168
-
#define L2CAP_CONTROL_DISCONNECT
Definition: BTD.h:108
-
#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST
Definition: BTD.h:134
-
ColorsEnum
-
BTD * pBtd
Definition: BTD.h:608
-
#define BULK_MAXPKTSIZE
Definition: BTD.h:34
- -
#define HID_INTR_PSM
Definition: BTD.h:181
+
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:169
+
#define PSTR(str)
+
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:171
+
#define L2CAP_CONTROL_DISCONNECT
Definition: BTD.h:111
+
#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST
Definition: BTD.h:137
+
ColorsEnum
+
BTD * pBtd
Definition: BTD.h:612
+
#define BULK_MAXPKTSIZE
Definition: BTD.h:37
+ +
#define HID_INTR_PSM
Definition: BTD.h:184
const uint8_t PS3_ANALOG_BUTTONS[]
Definition: PS3Enums.h:92
- - -
bool l2capConnectionClaimed
Definition: BTD.h:437
-
AngleEnum
-
#define PS3_ENABLE_SIXAXIS
Definition: BTD.h:128
+ + +
bool l2capConnectionClaimed
Definition: BTD.h:440
+
AngleEnum
+
#define PS3_ENABLE_SIXAXIS
Definition: BTD.h:131
-
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:169
+
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:172
void ACLData(uint8_t *ACLData)
Definition: PS3BT.cpp:224
-
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:167
+
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:170
-
uint16_t hci_handle
Definition: BTD.h:611
+
uint16_t hci_handle
Definition: BTD.h:615
void setLedOff()
Definition: PS3BT.h:138
- -
#define strcat_P(dest, src)
+ +
#define strcat_P(dest, src)
void setLedToggle(LEDEnum a)
Definition: PS3BT.cpp:578
-
uint32_t l2cap_event_flag
Definition: BTD.h:614
+
uint32_t l2cap_event_flag
Definition: BTD.h:618
#define PS3_REPORT_BUFFER_SIZE
Definition: PS3Enums.h:24
void disconnect()
Definition: PS3BT.cpp:217
- -
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1221
-
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1296
-
#define PENDING
Definition: BTD.h:174
-
#define l2cap_set_flag(flag)
Definition: BTD.h:159
-
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1279
-
#define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS
Definition: BTD.h:135
-
SensorEnum
+ +
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1219
+
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1294
+
#define PENDING
Definition: BTD.h:177
+
#define l2cap_set_flag(flag)
Definition: BTD.h:162
+
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1277
+
#define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS
Definition: BTD.h:138
+
SensorEnum
-
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:164
+
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:167
uint8_t getAnalogButton(ButtonEnum a)
Definition: PS3BT.cpp:60
- +
float getAngle(AngleEnum a)
Definition: PS3BT.cpp:85
void setLedRaw(uint8_t value)
Definition: PS3BT.cpp:559
PS3BT(BTD *pBtd, uint8_t btadr5=0, uint8_t btadr4=0, uint8_t btadr3=0, uint8_t btadr2=0, uint8_t btadr1=0, uint8_t btadr0=0)
Definition: PS3BT.cpp:23
- -
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:600
+ +
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:604
void onInit()
Definition: PS3BT.cpp:628
Definition: PS3Enums.h:125
-
#define L2CAP_INTERRUPT_DISCONNECT
Definition: BTD.h:114
+
#define L2CAP_INTERRUPT_DISCONNECT
Definition: BTD.h:117
void setRumbleOff()
Definition: PS3BT.cpp:530
bool getButtonClick(ButtonEnum b)
Definition: PS3BT.cpp:53
const uint8_t PS3_REPORT_BUFFER[PS3_REPORT_BUFFER_SIZE]
Definition: PS3Enums.h:27
-
#define L2CAP_CMD_COMMAND_REJECT
Definition: BTD.h:163
+
#define L2CAP_CMD_COMMAND_REJECT
Definition: BTD.h:166
diff --git a/_p_s3_b_t_8h.html b/_p_s3_b_t_8h.html index 30a2c8f3..b36ac4d3 100644 --- a/_p_s3_b_t_8h.html +++ b/_p_s3_b_t_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS3BT.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- + - +
@@ -130,7 +110,9 @@ Macros  

Macro Definition Documentation

- + +

◆ HID_BUFFERSIZE

+
@@ -140,7 +122,7 @@ Macros
-

Definition at line 24 of file PS3BT.h.

+

Definition at line 24 of file PS3BT.h.

@@ -149,7 +131,7 @@ Macros diff --git a/_p_s3_b_t_8h__dep__incl.md5 b/_p_s3_b_t_8h__dep__incl.md5 index 80c124ec..2014c83c 100644 --- a/_p_s3_b_t_8h__dep__incl.md5 +++ b/_p_s3_b_t_8h__dep__incl.md5 @@ -1 +1 @@ -eba794dfcd5eea5cd385cf4d1f0cee96 \ No newline at end of file +ac5ec06c541321e25eb4c20223ecb1d0 \ No newline at end of file diff --git a/_p_s3_b_t_8h__dep__incl.png b/_p_s3_b_t_8h__dep__incl.png index 57d10ec1..3d898a91 100644 Binary files a/_p_s3_b_t_8h__dep__incl.png and b/_p_s3_b_t_8h__dep__incl.png differ diff --git a/_p_s3_b_t_8h__incl.map b/_p_s3_b_t_8h__incl.map index 58f4967c..e6415992 100644 --- a/_p_s3_b_t_8h__incl.map +++ b/_p_s3_b_t_8h__incl.map @@ -1,8 +1,8 @@ - + - + diff --git a/_p_s3_b_t_8h__incl.md5 b/_p_s3_b_t_8h__incl.md5 index dbb83515..4fa201c6 100644 --- a/_p_s3_b_t_8h__incl.md5 +++ b/_p_s3_b_t_8h__incl.md5 @@ -1 +1 @@ -90cb54a3b8ad4256770707efdc9f2bdc \ No newline at end of file +099874d321d87a5f12d52372f8d8ae4d \ No newline at end of file diff --git a/_p_s3_b_t_8h__incl.png b/_p_s3_b_t_8h__incl.png index d863f3ef..be1253bb 100644 Binary files a/_p_s3_b_t_8h__incl.png and b/_p_s3_b_t_8h__incl.png differ diff --git a/_p_s3_b_t_8h_source.html b/_p_s3_b_t_8h_source.html index 4ce85745..9cb6083c 100644 --- a/_p_s3_b_t_8h_source.html +++ b/_p_s3_b_t_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS3BT.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _ps3bt_h_
19 #define _ps3bt_h_
20 
21 #include "BTD.h"
22 #include "PS3Enums.h"
23 
24 #define HID_BUFFERSIZE 50 // Size of the buffer for the Playstation Motion Controller
25 
32 class PS3BT : public BluetoothService {
33 public:
41  PS3BT(BTD *pBtd, uint8_t btadr5 = 0, uint8_t btadr4 = 0, uint8_t btadr3 = 0, uint8_t btadr2 = 0, uint8_t btadr1 = 0, uint8_t btadr0 = 0);
42 
45  void disconnect();
59  bool getButtonPress(ButtonEnum b);
60  bool getButtonClick(ButtonEnum b);
71  uint8_t getAnalogButton(ButtonEnum a);
77  uint8_t getAnalogHat(AnalogHatEnum a);
86  int16_t getSensor(SensorEnum a);
92  float getAngle(AngleEnum a);
98  float get9DOFValues(SensorEnum a);
104  bool getStatus(StatusEnum c);
106  void printStatusString();
111  String getTemperature();
112 
114  void setAllOff();
116  void setRumbleOff();
121  void setRumbleOn(RumbleEnum mode);
129  void setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower);
130 
135  void setLedRaw(uint8_t value);
136 
138  void setLedOff() {
139  setLedRaw(0);
140  };
145  void setLedOff(LEDEnum a);
150  void setLedOn(LEDEnum a);
155  void setLedToggle(LEDEnum a);
156 
161  void moveSetBulb(uint8_t r, uint8_t g, uint8_t b);
166  void moveSetBulb(ColorsEnum color);
171  void moveSetRumble(uint8_t rumble);
172 
174  uint32_t getLastMessageTime() {
175  return lastMessageTime;
176  };
180  bool PS3Connected;
185 
186 protected:
192  void ACLData(uint8_t* ACLData);
194  void Run();
196  void Reset();
202  void onInit();
205 private:
206 
207  void L2CAP_task(); // L2CAP state machine
208 
209  /* Variables filled from HCI event management */
210  char remote_name_first; // First letter in remote name
211  bool activeConnection; // Used to indicate if it's already has established a connection
212 
213  /* Variables used by high level L2CAP task */
214  uint8_t l2cap_state;
215 
216  uint32_t lastMessageTime; // Variable used to store the millis value of the last message.
217 
218  uint32_t ButtonState;
219  uint32_t OldButtonState;
220  uint32_t ButtonClickState;
221 
222  uint32_t timer; // Timer used to limit time between messages and also used to continuously set PS3 Move controller Bulb and rumble values
223  uint32_t timerHID; // Timer used see if there has to be a delay before a new HID command
224 
225  uint8_t l2capinbuf[BULK_MAXPKTSIZE]; // General purpose buffer for L2CAP in data
226  uint8_t HIDBuffer[HID_BUFFERSIZE]; // Used to store HID commands
227  uint8_t HIDMoveBuffer[HID_BUFFERSIZE]; // Used to store HID commands for the Move controller
228 
229  /* L2CAP Channels */
230  uint8_t control_scid[2]; // L2CAP source CID for HID_Control
231  uint8_t control_dcid[2]; // 0x0040
232  uint8_t interrupt_scid[2]; // L2CAP source CID for HID_Interrupt
233  uint8_t interrupt_dcid[2]; // 0x0041
234 
235  /* HID Commands */
236  void HID_Command(uint8_t* data, uint8_t nbytes);
237  void HIDMove_Command(uint8_t* data, uint8_t nbytes);
238  void enable_sixaxis(); // Command used to enable the Dualshock 3 and Navigation controller to send data via Bluetooth
239 };
240 #endif
bool PS3NavigationConnected
Definition: PS3BT.h:184
bool getStatus(StatusEnum c)
Definition: PS3BT.cpp:156
void Run()
Definition: PS3BT.cpp:454
-
Definition: BTD.h:198
+
Definition: BTD.h:201
void setLedOn(LEDEnum a)
Definition: PS3BT.cpp:569
String getTemperature()
Definition: PS3BT.cpp:141
-
AnalogHatEnum
+
AnalogHatEnum
void moveSetRumble(uint8_t rumble)
Definition: PS3BT.cpp:617
void printStatusString()
Definition: PS3BT.cpp:160
void setAllOff()
Definition: PS3BT.cpp:519
@@ -104,28 +84,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
#define HID_BUFFERSIZE
Definition: PS3BT.h:24
void Reset()
Definition: PS3BT.cpp:204
bool getButtonPress(ButtonEnum b)
Definition: PS3BT.cpp:49
-
LEDEnum
+
LEDEnum
int16_t getSensor(SensorEnum a)
Definition: PS3BT.cpp:68
-
RumbleEnum
+
RumbleEnum
Definition: PS3BT.h:32
uint8_t getAnalogHat(AnalogHatEnum a)
Definition: PS3BT.cpp:64
bool PS3Connected
Definition: PS3BT.h:176
- -
ButtonEnum
+ +
ButtonEnum
void moveSetBulb(uint8_t r, uint8_t g, uint8_t b)
Definition: PS3BT.cpp:604
bool PS3MoveConnected
Definition: PS3BT.h:182
void setRumbleOn(RumbleEnum mode)
Definition: PS3BT.cpp:540
float get9DOFValues(SensorEnum a)
Definition: PS3BT.cpp:112
-
ColorsEnum
-
BTD * pBtd
Definition: BTD.h:608
-
#define BULK_MAXPKTSIZE
Definition: BTD.h:34
-
AngleEnum
+
ColorsEnum
+
BTD * pBtd
Definition: BTD.h:612
+
#define BULK_MAXPKTSIZE
Definition: BTD.h:37
+
AngleEnum
void ACLData(uint8_t *ACLData)
Definition: PS3BT.cpp:224
void setLedOff()
Definition: PS3BT.h:138
void setLedToggle(LEDEnum a)
Definition: PS3BT.cpp:578
void disconnect()
Definition: PS3BT.cpp:217
-
SensorEnum
+
SensorEnum
uint8_t getAnalogButton(ButtonEnum a)
Definition: PS3BT.cpp:60
float getAngle(AngleEnum a)
Definition: PS3BT.cpp:85
@@ -140,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s3_enums_8h.html b/_p_s3_enums_8h.html index 6bff533b..e93f0284 100644 --- a/_p_s3_enums_8h.html +++ b/_p_s3_enums_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS3Enums.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- + @@ -167,7 +147,9 @@ Variables  

Macro Definition Documentation

- + +

◆ PS3_REPORT_BUFFER_SIZE

+
@@ -178,11 +160,13 @@ Variables

Size of the output report buffer for the Dualshock and Navigation controllers

-

Definition at line 24 of file PS3Enums.h.

+

Definition at line 24 of file PS3Enums.h.

- + +

◆ MOVE_REPORT_BUFFER_SIZE

+
@@ -193,12 +177,14 @@ Variables

Size of the output report buffer for the Move Controller

-

Definition at line 40 of file PS3Enums.h.

+

Definition at line 40 of file PS3Enums.h.

Enumeration Type Documentation

- + +

◆ StatusEnum

+
@@ -208,54 +194,36 @@ Variables
- - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +
Enumerator
Plugged  -
Unplugged  -
Charging  -
NotCharging  -
Shutdown  -
Dying  -
Low  -
High  -
Full  -
MoveCharging  -
MoveNotCharging  -
MoveShutdown  -
MoveDying  -
MoveLow  -
MoveHigh  -
MoveFull  -
CableRumble  -
Cable  -
BluetoothRumble  -
Bluetooth  -
Enumerator
Plugged 
Unplugged 
Charging 
NotCharging 
Shutdown 
Dying 
Low 
High 
Full 
MoveCharging 
MoveNotCharging 
MoveShutdown 
MoveDying 
MoveLow 
MoveHigh 
MoveFull 
CableRumble 
Cable 
BluetoothRumble 
Bluetooth 
-

Definition at line 113 of file PS3Enums.h.

+

Definition at line 113 of file PS3Enums.h.

Variable Documentation

- + +

◆ PS3_REPORT_BUFFER

+
@@ -266,11 +234,13 @@ Variables
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0x27, 0x10, 0x00, 0x32,
0xff, 0x27, 0x10, 0x00, 0x32,
0xff, 0x27, 0x10, 0x00, 0x32,
0xff, 0x27, 0x10, 0x00, 0x32,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

Report buffer for all PS3 commands

-

Definition at line 27 of file PS3Enums.h.

+

Definition at line 27 of file PS3Enums.h.

- + +

◆ PS3_LEDS

+
@@ -281,11 +251,13 @@ Variables
Initial value:
= {
0x00,
0x01,
0x02,
0x04,
0x08,
0x09,
0x0A,
0x0C,
0x0D,
0x0E,
0x0F,
}

Used to set the LEDs on the controllers

-

Definition at line 43 of file PS3Enums.h.

+

Definition at line 43 of file PS3Enums.h.

- + +

◆ PS3_BUTTONS

+
@@ -296,11 +268,13 @@ Variables
Initial value:
= {
0x10,
0x20,
0x40,
0x80,
0x01,
0x08,
0x02,
0x04,
0x0100,
0x0200,
0x0400,
0x0800,
0x1000,
0x2000,
0x4000,
0x8000,
0x010000,
0x080000,
0x100000,
}

Buttons on the controllers. Note: that the location is shifted 9 when it's connected via USB.

-

Definition at line 62 of file PS3Enums.h.

+

Definition at line 62 of file PS3Enums.h.

- + +

◆ PS3_ANALOG_BUTTONS

+
@@ -311,7 +285,7 @@ Variables
Initial value:
= {
23,
24,
25,
26,
0, 0, 0, 0,
27,
28,
29,
30,
31,
32,
33,
34,
0, 0,
15,
}

Analog buttons on the controllers. Note: that the location is shifted 9 when it's connected via USB.

-

Definition at line 92 of file PS3Enums.h.

+

Definition at line 92 of file PS3Enums.h.

@@ -320,7 +294,7 @@ Variables diff --git a/_p_s3_enums_8h__dep__incl.map b/_p_s3_enums_8h__dep__incl.map index 7b47deac..9a0a8dcb 100644 --- a/_p_s3_enums_8h__dep__incl.map +++ b/_p_s3_enums_8h__dep__incl.map @@ -1,5 +1,5 @@ - + diff --git a/_p_s3_enums_8h__dep__incl.md5 b/_p_s3_enums_8h__dep__incl.md5 index 7e6c593e..d15e13ed 100644 --- a/_p_s3_enums_8h__dep__incl.md5 +++ b/_p_s3_enums_8h__dep__incl.md5 @@ -1 +1 @@ -2ee6fe4e5f4f5bb8864f711284e44ace \ No newline at end of file +c77fa45db98b8115b80889d20542091c \ No newline at end of file diff --git a/_p_s3_enums_8h__dep__incl.png b/_p_s3_enums_8h__dep__incl.png index eb68bef8..d294a169 100644 Binary files a/_p_s3_enums_8h__dep__incl.png and b/_p_s3_enums_8h__dep__incl.png differ diff --git a/_p_s3_enums_8h__incl.md5 b/_p_s3_enums_8h__incl.md5 index a2b68ead..800faca3 100644 --- a/_p_s3_enums_8h__incl.md5 +++ b/_p_s3_enums_8h__incl.md5 @@ -1 +1 @@ -1b975049347183489796e6dc1da09be9 \ No newline at end of file +366db2510595573cf7f9662dbbc66c23 \ No newline at end of file diff --git a/_p_s3_enums_8h__incl.png b/_p_s3_enums_8h__incl.png index 4238f592..8a2a0622 100644 Binary files a/_p_s3_enums_8h__incl.png and b/_p_s3_enums_8h__incl.png differ diff --git a/_p_s3_enums_8h_source.html b/_p_s3_enums_8h_source.html index b640ff35..7383baa1 100644 --- a/_p_s3_enums_8h_source.html +++ b/_p_s3_enums_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS3Enums.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + + - + - - + + + +
- + - - + + @@ -111,7 +91,7 @@ Include dependency graph for PS3USB.cpp:
diff --git a/_p_s3_u_s_b_8cpp__incl.map b/_p_s3_u_s_b_8cpp__incl.map index 33f2b9ad..ca5089dd 100644 --- a/_p_s3_u_s_b_8cpp__incl.map +++ b/_p_s3_u_s_b_8cpp__incl.map @@ -1,8 +1,8 @@ - + - - + + diff --git a/_p_s3_u_s_b_8cpp__incl.md5 b/_p_s3_u_s_b_8cpp__incl.md5 index a9693dff..b62523cb 100644 --- a/_p_s3_u_s_b_8cpp__incl.md5 +++ b/_p_s3_u_s_b_8cpp__incl.md5 @@ -1 +1 @@ -6fe7e16b5e65f19d54865f8f0649448b \ No newline at end of file +d1b34b2e5c4f9117dc52f0fee30ee629 \ No newline at end of file diff --git a/_p_s3_u_s_b_8cpp__incl.png b/_p_s3_u_s_b_8cpp__incl.png index 2d5a6d8d..762e4d00 100644 Binary files a/_p_s3_u_s_b_8cpp__incl.png and b/_p_s3_u_s_b_8cpp__incl.png differ diff --git a/_p_s3_u_s_b_8cpp_source.html b/_p_s3_u_s_b_8cpp_source.html index 46ca7c21..3e98f875 100644 --- a/_p_s3_u_s_b_8cpp_source.html +++ b/_p_s3_u_s_b_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS3USB.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
PS3USB.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "PS3USB.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the PS3 Controllers
22 
23 PS3USB::PS3USB(USB *p, uint8_t btadr5, uint8_t btadr4, uint8_t btadr3, uint8_t btadr2, uint8_t btadr1, uint8_t btadr0) :
24 pUsb(p), // pointer to USB class instance - mandatory
25 bAddress(0), // device address - mandatory
26 bPollEnable(false) // don't start polling before dongle is connected
27 {
28  for(uint8_t i = 0; i < PS3_MAX_ENDPOINTS; i++) {
29  epInfo[i].epAddr = 0;
30  epInfo[i].maxPktSize = (i) ? 0 : 8;
31  epInfo[i].bmSndToggle = 0;
32  epInfo[i].bmRcvToggle = 0;
34  }
35 
36  if(pUsb) // register in USB subsystem
37  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
38 
39  my_bdaddr[5] = btadr5; // Change to your dongle's Bluetooth address instead
40  my_bdaddr[4] = btadr4;
41  my_bdaddr[3] = btadr3;
42  my_bdaddr[2] = btadr2;
43  my_bdaddr[1] = btadr1;
44  my_bdaddr[0] = btadr0;
45 }
46 
47 uint8_t PS3USB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
48  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
49  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
50  uint8_t rcode;
51  UsbDevice *p = NULL;
52  EpInfo *oldep_ptr = NULL;
53  uint16_t PID;
54  uint16_t VID;
55 
56  // get memory address of USB device address pool
57  AddressPool &addrPool = pUsb->GetAddressPool();
58 #ifdef EXTRADEBUG
59  Notify(PSTR("\r\nPS3USB Init"), 0x80);
60 #endif
61  // check if address has already been assigned to an instance
62  if(bAddress) {
63 #ifdef DEBUG_USB_HOST
64  Notify(PSTR("\r\nAddress in use"), 0x80);
65 #endif
67  }
68 
69  // Get pointer to pseudo device with address 0 assigned
70  p = addrPool.GetUsbDevicePtr(0);
71 
72  if(!p) {
73 #ifdef DEBUG_USB_HOST
74  Notify(PSTR("\r\nAddress not found"), 0x80);
75 #endif
77  }
78 
79  if(!p->epinfo) {
80 #ifdef DEBUG_USB_HOST
81  Notify(PSTR("\r\nepinfo is null"), 0x80);
82 #endif
84  }
85 
86  // Save old pointer to EP_RECORD of address 0
87  oldep_ptr = p->epinfo;
88 
89  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
90  p->epinfo = epInfo;
91 
92  p->lowspeed = lowspeed;
93 
94  // Get device descriptor
95  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
96  // Restore p->epinfo
97  p->epinfo = oldep_ptr;
98 
99  if(rcode)
100  goto FailGetDevDescr;
101 
102  VID = udd->idVendor;
103  PID = udd->idProduct;
104 
105  if(VID != PS3_VID || (PID != PS3_PID && PID != PS3NAVIGATION_PID && PID != PS3MOVE_PID))
106  goto FailUnknownDevice;
107 
108  // Allocate new address according to device class
109  bAddress = addrPool.AllocAddress(parent, false, port);
110 
111  if(!bAddress)
113 
114  // Extract Max Packet Size from device descriptor
115  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
116 
117  // Assign new address to the device
118  rcode = pUsb->setAddr(0, 0, bAddress);
119  if(rcode) {
120  p->lowspeed = false;
121  addrPool.FreeAddress(bAddress);
122  bAddress = 0;
123 #ifdef DEBUG_USB_HOST
124  Notify(PSTR("\r\nsetAddr: "), 0x80);
125  D_PrintHex<uint8_t > (rcode, 0x80);
126 #endif
127  return rcode;
128  }
129 #ifdef EXTRADEBUG
130  Notify(PSTR("\r\nAddr: "), 0x80);
131  D_PrintHex<uint8_t > (bAddress, 0x80);
132 #endif
133  //delay(300); // Spec says you should wait at least 200ms
134 
135  p->lowspeed = false;
136 
137  //get pointer to assigned address record
138  p = addrPool.GetUsbDevicePtr(bAddress);
139  if(!p)
141 
142  p->lowspeed = lowspeed;
143 
144  // Assign epInfo to epinfo pointer - only EP0 is known
145  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
146  if(rcode)
147  goto FailSetDevTblEntry;
148 
149 
150  /* The application will work in reduced host mode, so we can save program and data
151  memory space. After verifying the PID and VID we will use known values for the
152  configuration values for device, interface, endpoints and HID for the PS3 Controllers */
153 
154  /* Initialize data structures for endpoints of device */
155  epInfo[ PS3_OUTPUT_PIPE ].epAddr = 0x02; // PS3 output endpoint
157  epInfo[ PS3_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
161  epInfo[ PS3_INPUT_PIPE ].epAddr = 0x01; // PS3 report endpoint
163  epInfo[ PS3_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
167 
168  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
169  if(rcode)
170  goto FailSetDevTblEntry;
171 
172  delay(200); //Give time for address change
173 
174  rcode = pUsb->setConf(bAddress, epInfo[ PS3_CONTROL_PIPE ].epAddr, 1);
175  if(rcode)
176  goto FailSetConfDescr;
177 
178  if(PID == PS3_PID || PID == PS3NAVIGATION_PID) {
179  if(PID == PS3_PID) {
180 #ifdef DEBUG_USB_HOST
181  Notify(PSTR("\r\nDualshock 3 Controller Connected"), 0x80);
182 #endif
183  PS3Connected = true;
184  } else { // must be a navigation controller
185 #ifdef DEBUG_USB_HOST
186  Notify(PSTR("\r\nNavigation Controller Connected"), 0x80);
187 #endif
188  PS3NavigationConnected = true;
189  }
190  enable_sixaxis(); // The PS3 controller needs a special command before it starts sending data
191 
192  // Needed for PS3 Dualshock and Navigation commands to work
193  for(uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
194  writeBuf[i] = pgm_read_byte(&PS3_REPORT_BUFFER[i]);
195 
196  for(uint8_t i = 6; i < 10; i++)
197  readBuf[i] = 0x7F; // Set the analog joystick values to center position
198  } else { // must be a Motion controller
199 #ifdef DEBUG_USB_HOST
200  Notify(PSTR("\r\nMotion Controller Connected"), 0x80);
201 #endif
202  PS3MoveConnected = true;
203  writeBuf[0] = 0x02; // Set report ID, this is needed for Move commands to work
204  }
205  if(my_bdaddr[0] != 0x00 || my_bdaddr[1] != 0x00 || my_bdaddr[2] != 0x00 || my_bdaddr[3] != 0x00 || my_bdaddr[4] != 0x00 || my_bdaddr[5] != 0x00) {
206  if(PS3MoveConnected)
207  setMoveBdaddr(my_bdaddr); // Set internal Bluetooth address
208  else
209  setBdaddr(my_bdaddr); // Set internal Bluetooth address
210 
211 #ifdef DEBUG_USB_HOST
212  Notify(PSTR("\r\nBluetooth Address was set to: "), 0x80);
213  for(int8_t i = 5; i > 0; i--) {
214  D_PrintHex<uint8_t > (my_bdaddr[i], 0x80);
215  Notify(PSTR(":"), 0x80);
216  }
217  D_PrintHex<uint8_t > (my_bdaddr[0], 0x80);
218 #endif
219  }
220  onInit();
221 
222  bPollEnable = true;
223  Notify(PSTR("\r\n"), 0x80);
224  timer = millis();
225  return 0; // Successful configuration
226 
227  /* Diagnostic messages */
228 FailGetDevDescr:
229 #ifdef DEBUG_USB_HOST
231  goto Fail;
232 #endif
233 
234 FailSetDevTblEntry:
235 #ifdef DEBUG_USB_HOST
237  goto Fail;
238 #endif
239 
240 FailSetConfDescr:
241 #ifdef DEBUG_USB_HOST
243 #endif
244  goto Fail;
245 
246 FailUnknownDevice:
247 #ifdef DEBUG_USB_HOST
248  NotifyFailUnknownDevice(VID, PID);
249 #endif
251 
252 Fail:
253 #ifdef DEBUG_USB_HOST
254  Notify(PSTR("\r\nPS3 Init Failed, error code: "), 0x80);
255  NotifyFail(rcode);
256 #endif
257  Release();
258  return rcode;
259 }
260 
261 /* Performs a cleanup after failed Init() attempt */
262 uint8_t PS3USB::Release() {
263  PS3Connected = false;
264  PS3MoveConnected = false;
265  PS3NavigationConnected = false;
267  bAddress = 0;
268  bPollEnable = false;
269  return 0;
270 }
271 
272 uint8_t PS3USB::Poll() {
273  if(!bPollEnable)
274  return 0;
275 
277  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
278  pUsb->inTransfer(bAddress, epInfo[ PS3_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
279  if(millis() - timer > 100) { // Loop 100ms before processing data
280  readReport();
281 #ifdef PRINTREPORT
282  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
283 #endif
284  }
285  } else if(PS3MoveConnected) { // One can only set the color of the bulb, set the rumble, set and get the bluetooth address and calibrate the magnetometer via USB
286  if(millis() - timer > 4000) { // Send at least every 4th second
287  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE); // The Bulb and rumble values, has to be written again and again, for it to stay turned on
288  timer = millis();
289  }
290  }
291  return 0;
292 }
293 
294 void PS3USB::readReport() {
295  ButtonState = (uint32_t)(readBuf[2] | ((uint16_t)readBuf[3] << 8) | ((uint32_t)readBuf[4] << 16));
296 
297  //Notify(PSTR("\r\nButtonState", 0x80);
298  //PrintHex<uint32_t>(ButtonState, 0x80);
299 
300  if(ButtonState != OldButtonState) {
301  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
302  OldButtonState = ButtonState;
303  }
304 }
305 
306 void PS3USB::printReport() { // Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
307 #ifdef PRINTREPORT
308  for(uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++) {
309  D_PrintHex<uint8_t > (readBuf[i], 0x80);
310  Notify(PSTR(" "), 0x80);
311  }
312  Notify(PSTR("\r\n"), 0x80);
313 #endif
314 }
315 
317  return (ButtonState & pgm_read_dword(&PS3_BUTTONS[(uint8_t)b]));
318 }
319 
321  uint32_t button = pgm_read_dword(&PS3_BUTTONS[(uint8_t)b]);
322  bool click = (ButtonClickState & button);
323  ButtonClickState &= ~button; // Clear "click" event
324  return click;
325 }
326 
328  return (uint8_t)(readBuf[(pgm_read_byte(&PS3_ANALOG_BUTTONS[(uint8_t)a])) - 9]);
329 }
330 
332  return (uint8_t)(readBuf[((uint8_t)a + 6)]);
333 }
334 
336  return ((readBuf[((uint16_t)a) - 9] << 8) | readBuf[((uint16_t)a + 1) - 9]);
337 }
338 
340  if(PS3Connected) {
341  float accXval, accYval, accZval;
342 
343  // Data for the Kionix KXPC4 used in the DualShock 3
344  const float zeroG = 511.5f; // 1.65/3.3*1023 (1,65V)
345  accXval = -((float)getSensor(aX) - zeroG);
346  accYval = -((float)getSensor(aY) - zeroG);
347  accZval = -((float)getSensor(aZ) - zeroG);
348 
349  // Convert to 360 degrees resolution
350  // atan2 outputs the value of -Ï€ to Ï€ (radians)
351  // We are then converting it to 0 to 2Ï€ and then to degrees
352  if(a == Pitch)
353  return (atan2f(accYval, accZval) + PI) * RAD_TO_DEG;
354  else
355  return (atan2f(accXval, accZval) + PI) * RAD_TO_DEG;
356  } else
357  return 0;
358 }
359 
361  return (readBuf[((uint16_t)c >> 8) - 9] == ((uint8_t)c & 0xff));
362 }
363 
365  char statusOutput[102]; // Max string length plus null character
367  strcpy_P(statusOutput, PSTR("\r\nConnectionStatus: "));
368 
369  if(getStatus(Plugged)) strcat_P(statusOutput, PSTR("Plugged"));
370  else if(getStatus(Unplugged)) strcat_P(statusOutput, PSTR("Unplugged"));
371  else strcat_P(statusOutput, PSTR("Error"));
372 
373  strcat_P(statusOutput, PSTR(" - PowerRating: "));
374 
375  if(getStatus(Charging)) strcat_P(statusOutput, PSTR("Charging"));
376  else if(getStatus(NotCharging)) strcat_P(statusOutput, PSTR("Not Charging"));
377  else if(getStatus(Shutdown)) strcat_P(statusOutput, PSTR("Shutdown"));
378  else if(getStatus(Dying)) strcat_P(statusOutput, PSTR("Dying"));
379  else if(getStatus(Low)) strcat_P(statusOutput, PSTR("Low"));
380  else if(getStatus(High)) strcat_P(statusOutput, PSTR("High"));
381  else if(getStatus(Full)) strcat_P(statusOutput, PSTR("Full"));
382  else strcat_P(statusOutput, PSTR("Error"));
383 
384  strcat_P(statusOutput, PSTR(" - WirelessStatus: "));
385 
386  if(getStatus(CableRumble)) strcat_P(statusOutput, PSTR("Cable - Rumble is on"));
387  else if(getStatus(Cable)) strcat_P(statusOutput, PSTR("Cable - Rumble is off"));
388  else if(getStatus(BluetoothRumble)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is on"));
389  else if(getStatus(Bluetooth)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is off"));
390  else strcat_P(statusOutput, PSTR("Error"));
391  } else
392  strcpy_P(statusOutput, PSTR("\r\nError"));
393 
394  USB_HOST_SERIAL.write(statusOutput);
395 }
396 
397 /* Playstation Sixaxis Dualshock and Navigation Controller commands */
398 void PS3USB::PS3_Command(uint8_t *data, uint16_t nbytes) {
399  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x01), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)
400  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x01, 0x02, 0x00, nbytes, nbytes, data, NULL);
401 }
402 
404  for(uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
405  writeBuf[i] = pgm_read_byte(&PS3_REPORT_BUFFER[i]); // Reset buffer
406 
407  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
408 }
409 
411  uint8_t rumbleBuf[EP_MAXPKTSIZE];
412  memcpy(rumbleBuf, writeBuf, EP_MAXPKTSIZE);
413  rumbleBuf[1] = 0x00;
414  rumbleBuf[2] = 0x00; // Low mode off
415  rumbleBuf[3] = 0x00;
416  rumbleBuf[4] = 0x00; // High mode off
417  PS3_Command(rumbleBuf, PS3_REPORT_BUFFER_SIZE);
418 }
419 
421  if((mode & 0x30) > 0x00) {
422  uint8_t power[2] = {0xff, 0x00}; // Defaults to RumbleLow
423  if(mode == RumbleHigh) {
424  power[0] = 0x00;
425  power[1] = 0xff;
426  }
427  setRumbleOn(0xfe, power[0], 0xfe, power[1]);
428  }
429 }
430 
431 void PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
432  uint8_t rumbleBuf[EP_MAXPKTSIZE];
433  memcpy(rumbleBuf, writeBuf, EP_MAXPKTSIZE);
434  rumbleBuf[1] = rightDuration;
435  rumbleBuf[2] = rightPower;
436  rumbleBuf[3] = leftDuration;
437  rumbleBuf[4] = leftPower;
438  PS3_Command(rumbleBuf, PS3_REPORT_BUFFER_SIZE);
439 }
440 
441 void PS3USB::setLedRaw(uint8_t value) {
442  writeBuf[9] = value << 1;
443  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
444 }
445 
447  writeBuf[9] &= ~((uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1));
448  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
449 }
450 
452  if(a == OFF)
453  setLedRaw(0);
454  else {
455  writeBuf[9] |= (uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1);
456  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
457  }
458 }
459 
461  writeBuf[9] ^= (uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1);
462  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
463 }
464 
465 void PS3USB::setBdaddr(uint8_t *bdaddr) {
466  /* Set the internal Bluetooth address */
467  uint8_t buf[8];
468  buf[0] = 0x01;
469  buf[1] = 0x00;
470 
471  for(uint8_t i = 0; i < 6; i++)
472  buf[i + 2] = bdaddr[5 - i]; // Copy into buffer, has to be written reversed, so it is MSB first
473 
474  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF5), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
475  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
476 }
477 
478 void PS3USB::getBdaddr(uint8_t *bdaddr) {
479  uint8_t buf[8];
480 
481  // bmRequest = Device to host (0x80) | Class (0x20) | Interface (0x01) = 0xA1, bRequest = Get Report (0x01), Report ID (0xF5), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
482  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_IN, HID_REQUEST_GET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
483 
484  for(uint8_t i = 0; i < 6; i++)
485  bdaddr[5 - i] = buf[i + 2]; // Copy into buffer reversed, so it is LSB first
486 }
487 
488 void PS3USB::enable_sixaxis() { // Command used to enable the Dualshock 3 and Navigation controller to send data via USB
489  uint8_t cmd_buf[4];
490  cmd_buf[0] = 0x42; // Special PS3 Controller enable commands
491  cmd_buf[1] = 0x0c;
492  cmd_buf[2] = 0x00;
493  cmd_buf[3] = 0x00;
494 
495  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF4), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data)
496  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF4, 0x03, 0x00, 4, 4, cmd_buf, NULL);
497 }
498 
499 /* Playstation Move Controller commands */
500 void PS3USB::Move_Command(uint8_t *data, uint16_t nbytes) {
501  pUsb->outTransfer(bAddress, epInfo[ PS3_OUTPUT_PIPE ].epAddr, nbytes, data);
502 }
503 
504 void PS3USB::moveSetBulb(uint8_t r, uint8_t g, uint8_t b) { // Use this to set the Color using RGB values
505  // Set the Bulb's values into the write buffer
506  writeBuf[2] = r;
507  writeBuf[3] = g;
508  writeBuf[4] = b;
509 
510  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE);
511 }
512 
513 void PS3USB::moveSetBulb(ColorsEnum color) { // Use this to set the Color using the predefined colors in "enums.h"
514  moveSetBulb((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color));
515 }
516 
517 void PS3USB::moveSetRumble(uint8_t rumble) {
518 #ifdef DEBUG_USB_HOST
519  if(rumble < 64 && rumble != 0) // The rumble value has to at least 64, or approximately 25% (64/255*100)
520  Notify(PSTR("\r\nThe rumble value has to at least 64, or approximately 25%"), 0x80);
521 #endif
522  writeBuf[6] = rumble; // Set the rumble value into the write buffer
523 
524  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE);
525 }
526 
527 void PS3USB::setMoveBdaddr(uint8_t *bdaddr) {
528  /* Set the internal Bluetooth address */
529  uint8_t buf[11];
530  buf[0] = 0x05;
531  buf[7] = 0x10;
532  buf[8] = 0x01;
533  buf[9] = 0x02;
534  buf[10] = 0x12;
535 
536  for(uint8_t i = 0; i < 6; i++)
537  buf[i + 1] = bdaddr[i];
538 
539  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x05), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
540  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
541 }
542 
543 void PS3USB::getMoveBdaddr(uint8_t *bdaddr) {
544  uint8_t buf[16];
545 
546  // bmRequest = Device to host (0x80) | Class (0x20) | Interface (0x01) = 0xA1, bRequest = Get Report (0x01), Report ID (0x04), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
547  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_IN, HID_REQUEST_GET_REPORT, 0x04, 0x03, 0x00, 16, 16, buf, NULL);
548 
549  for(uint8_t i = 0; i < 6; i++)
550  bdaddr[i] = buf[10 + i];
551 }
552 
553 void PS3USB::getMoveCalibration(uint8_t *data) {
554  uint8_t buf[49];
555 
556  for(uint8_t i = 0; i < 3; i++) {
557  // bmRequest = Device to host (0x80) | Class (0x20) | Interface (0x01) = 0xA1, bRequest = Get Report (0x01), Report ID (0x10), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
558  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_IN, HID_REQUEST_GET_REPORT, 0x10, 0x03, 0x00, 49, 49, buf, NULL);
559 
560  for(uint8_t j = 0; j < 49; j++)
561  data[49 * i + j] = buf[j];
562  }
563 }
564 
565 void PS3USB::onInit() {
566  if(pFuncOnInit)
567  pFuncOnInit(); // Call the user function
568  else {
569  if(PS3MoveConnected)
570  moveSetBulb(Red);
571  else // Dualshock 3 or Navigation controller
572  setLedOn(static_cast<LEDEnum>(LED1));
573  }
574 }
uint8_t bmRcvToggle
Definition: address.h:41
+Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "PS3USB.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the PS3 Controllers
22 
23 PS3USB::PS3USB(USB *p, uint8_t btadr5, uint8_t btadr4, uint8_t btadr3, uint8_t btadr2, uint8_t btadr1, uint8_t btadr0) :
24 pUsb(p), // pointer to USB class instance - mandatory
25 bAddress(0), // device address - mandatory
26 bPollEnable(false) // don't start polling before dongle is connected
27 {
28  for(uint8_t i = 0; i < PS3_MAX_ENDPOINTS; i++) {
29  epInfo[i].epAddr = 0;
30  epInfo[i].maxPktSize = (i) ? 0 : 8;
31  epInfo[i].bmSndToggle = 0;
32  epInfo[i].bmRcvToggle = 0;
34  }
35 
36  if(pUsb) // register in USB subsystem
37  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
38 
39  my_bdaddr[5] = btadr5; // Change to your dongle's Bluetooth address instead
40  my_bdaddr[4] = btadr4;
41  my_bdaddr[3] = btadr3;
42  my_bdaddr[2] = btadr2;
43  my_bdaddr[1] = btadr1;
44  my_bdaddr[0] = btadr0;
45 }
46 
47 uint8_t PS3USB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
48  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
49  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
50  uint8_t rcode;
51  UsbDevice *p = NULL;
52  EpInfo *oldep_ptr = NULL;
53  uint16_t PID;
54  uint16_t VID;
55 
56  // get memory address of USB device address pool
57  AddressPool &addrPool = pUsb->GetAddressPool();
58 #ifdef EXTRADEBUG
59  Notify(PSTR("\r\nPS3USB Init"), 0x80);
60 #endif
61  // check if address has already been assigned to an instance
62  if(bAddress) {
63 #ifdef DEBUG_USB_HOST
64  Notify(PSTR("\r\nAddress in use"), 0x80);
65 #endif
67  }
68 
69  // Get pointer to pseudo device with address 0 assigned
70  p = addrPool.GetUsbDevicePtr(0);
71 
72  if(!p) {
73 #ifdef DEBUG_USB_HOST
74  Notify(PSTR("\r\nAddress not found"), 0x80);
75 #endif
77  }
78 
79  if(!p->epinfo) {
80 #ifdef DEBUG_USB_HOST
81  Notify(PSTR("\r\nepinfo is null"), 0x80);
82 #endif
84  }
85 
86  // Save old pointer to EP_RECORD of address 0
87  oldep_ptr = p->epinfo;
88 
89  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
90  p->epinfo = epInfo;
91 
92  p->lowspeed = lowspeed;
93 
94  // Get device descriptor
95  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
96  // Restore p->epinfo
97  p->epinfo = oldep_ptr;
98 
99  if(rcode)
100  goto FailGetDevDescr;
101 
102  VID = udd->idVendor;
103  PID = udd->idProduct;
104 
105  if(VID != PS3_VID || (PID != PS3_PID && PID != PS3NAVIGATION_PID && PID != PS3MOVE_PID))
106  goto FailUnknownDevice;
107 
108  // Allocate new address according to device class
109  bAddress = addrPool.AllocAddress(parent, false, port);
110 
111  if(!bAddress)
113 
114  // Extract Max Packet Size from device descriptor
115  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
116 
117  // Assign new address to the device
118  rcode = pUsb->setAddr(0, 0, bAddress);
119  if(rcode) {
120  p->lowspeed = false;
121  addrPool.FreeAddress(bAddress);
122  bAddress = 0;
123 #ifdef DEBUG_USB_HOST
124  Notify(PSTR("\r\nsetAddr: "), 0x80);
125  D_PrintHex<uint8_t > (rcode, 0x80);
126 #endif
127  return rcode;
128  }
129 #ifdef EXTRADEBUG
130  Notify(PSTR("\r\nAddr: "), 0x80);
131  D_PrintHex<uint8_t > (bAddress, 0x80);
132 #endif
133  //delay(300); // Spec says you should wait at least 200ms
134 
135  p->lowspeed = false;
136 
137  //get pointer to assigned address record
138  p = addrPool.GetUsbDevicePtr(bAddress);
139  if(!p)
141 
142  p->lowspeed = lowspeed;
143 
144  // Assign epInfo to epinfo pointer - only EP0 is known
145  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
146  if(rcode)
147  goto FailSetDevTblEntry;
148 
149 
150  /* The application will work in reduced host mode, so we can save program and data
151  memory space. After verifying the PID and VID we will use known values for the
152  configuration values for device, interface, endpoints and HID for the PS3 Controllers */
153 
154  /* Initialize data structures for endpoints of device */
155  epInfo[ PS3_OUTPUT_PIPE ].epAddr = 0x02; // PS3 output endpoint
157  epInfo[ PS3_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
161  epInfo[ PS3_INPUT_PIPE ].epAddr = 0x01; // PS3 report endpoint
163  epInfo[ PS3_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
167 
168  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
169  if(rcode)
170  goto FailSetDevTblEntry;
171 
172  delay(200); //Give time for address change
173 
174  rcode = pUsb->setConf(bAddress, epInfo[ PS3_CONTROL_PIPE ].epAddr, 1);
175  if(rcode)
176  goto FailSetConfDescr;
177 
178  if(PID == PS3_PID || PID == PS3NAVIGATION_PID) {
179  if(PID == PS3_PID) {
180 #ifdef DEBUG_USB_HOST
181  Notify(PSTR("\r\nDualshock 3 Controller Connected"), 0x80);
182 #endif
183  PS3Connected = true;
184  } else { // must be a navigation controller
185 #ifdef DEBUG_USB_HOST
186  Notify(PSTR("\r\nNavigation Controller Connected"), 0x80);
187 #endif
188  PS3NavigationConnected = true;
189  }
190  enable_sixaxis(); // The PS3 controller needs a special command before it starts sending data
191 
192  // Needed for PS3 Dualshock and Navigation commands to work
193  for(uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
194  writeBuf[i] = pgm_read_byte(&PS3_REPORT_BUFFER[i]);
195 
196  for(uint8_t i = 6; i < 10; i++)
197  readBuf[i] = 0x7F; // Set the analog joystick values to center position
198  } else { // must be a Motion controller
199 #ifdef DEBUG_USB_HOST
200  Notify(PSTR("\r\nMotion Controller Connected"), 0x80);
201 #endif
202  PS3MoveConnected = true;
203  writeBuf[0] = 0x02; // Set report ID, this is needed for Move commands to work
204  }
205  if(my_bdaddr[0] != 0x00 || my_bdaddr[1] != 0x00 || my_bdaddr[2] != 0x00 || my_bdaddr[3] != 0x00 || my_bdaddr[4] != 0x00 || my_bdaddr[5] != 0x00) {
206  if(PS3MoveConnected)
207  setMoveBdaddr(my_bdaddr); // Set internal Bluetooth address
208  else
209  setBdaddr(my_bdaddr); // Set internal Bluetooth address
210 
211 #ifdef DEBUG_USB_HOST
212  Notify(PSTR("\r\nBluetooth Address was set to: "), 0x80);
213  for(int8_t i = 5; i > 0; i--) {
214  D_PrintHex<uint8_t > (my_bdaddr[i], 0x80);
215  Notify(PSTR(":"), 0x80);
216  }
217  D_PrintHex<uint8_t > (my_bdaddr[0], 0x80);
218 #endif
219  }
220  onInit();
221 
222  bPollEnable = true;
223  Notify(PSTR("\r\n"), 0x80);
224  timer = (uint32_t)millis();
225  return 0; // Successful configuration
226 
227  /* Diagnostic messages */
228 FailGetDevDescr:
229 #ifdef DEBUG_USB_HOST
231  goto Fail;
232 #endif
233 
234 FailSetDevTblEntry:
235 #ifdef DEBUG_USB_HOST
237  goto Fail;
238 #endif
239 
240 FailSetConfDescr:
241 #ifdef DEBUG_USB_HOST
243 #endif
244  goto Fail;
245 
246 FailUnknownDevice:
247 #ifdef DEBUG_USB_HOST
248  NotifyFailUnknownDevice(VID, PID);
249 #endif
251 
252 Fail:
253 #ifdef DEBUG_USB_HOST
254  Notify(PSTR("\r\nPS3 Init Failed, error code: "), 0x80);
255  NotifyFail(rcode);
256 #endif
257  Release();
258  return rcode;
259 }
260 
261 /* Performs a cleanup after failed Init() attempt */
262 uint8_t PS3USB::Release() {
263  PS3Connected = false;
264  PS3MoveConnected = false;
265  PS3NavigationConnected = false;
267  bAddress = 0;
268  bPollEnable = false;
269  return 0;
270 }
271 
272 uint8_t PS3USB::Poll() {
273  if(!bPollEnable)
274  return 0;
275 
277  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
278  pUsb->inTransfer(bAddress, epInfo[ PS3_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
279  if((int32_t)((uint32_t)millis() - timer) > 100) { // Loop 100ms before processing data
280  readReport();
281 #ifdef PRINTREPORT
282  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
283 #endif
284  }
285  } else if(PS3MoveConnected) { // One can only set the color of the bulb, set the rumble, set and get the bluetooth address and calibrate the magnetometer via USB
286  if((int32_t)((uint32_t)millis() - timer) > 4000) { // Send at least every 4th second
287  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE); // The Bulb and rumble values, has to be written again and again, for it to stay turned on
288  timer = (uint32_t)millis();
289  }
290  }
291  return 0;
292 }
293 
294 void PS3USB::readReport() {
295  ButtonState = (uint32_t)(readBuf[2] | ((uint16_t)readBuf[3] << 8) | ((uint32_t)readBuf[4] << 16));
296 
297  //Notify(PSTR("\r\nButtonState", 0x80);
298  //PrintHex<uint32_t>(ButtonState, 0x80);
299 
300  if(ButtonState != OldButtonState) {
301  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
302  OldButtonState = ButtonState;
303  }
304 }
305 
306 void PS3USB::printReport() { // Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
307 #ifdef PRINTREPORT
308  for(uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++) {
309  D_PrintHex<uint8_t > (readBuf[i], 0x80);
310  Notify(PSTR(" "), 0x80);
311  }
312  Notify(PSTR("\r\n"), 0x80);
313 #endif
314 }
315 
317  return (ButtonState & pgm_read_dword(&PS3_BUTTONS[(uint8_t)b]));
318 }
319 
321  uint32_t button = pgm_read_dword(&PS3_BUTTONS[(uint8_t)b]);
322  bool click = (ButtonClickState & button);
323  ButtonClickState &= ~button; // Clear "click" event
324  return click;
325 }
326 
328  return (uint8_t)(readBuf[(pgm_read_byte(&PS3_ANALOG_BUTTONS[(uint8_t)a])) - 9]);
329 }
330 
332  return (uint8_t)(readBuf[((uint8_t)a + 6)]);
333 }
334 
336  return ((readBuf[((uint16_t)a) - 9] << 8) | readBuf[((uint16_t)a + 1) - 9]);
337 }
338 
340  if(PS3Connected) {
341  float accXval, accYval, accZval;
342 
343  // Data for the Kionix KXPC4 used in the DualShock 3
344  const float zeroG = 511.5f; // 1.65/3.3*1023 (1,65V)
345  accXval = -((float)getSensor(aX) - zeroG);
346  accYval = -((float)getSensor(aY) - zeroG);
347  accZval = -((float)getSensor(aZ) - zeroG);
348 
349  // Convert to 360 degrees resolution
350  // atan2 outputs the value of -Ï€ to Ï€ (radians)
351  // We are then converting it to 0 to 2Ï€ and then to degrees
352  if(a == Pitch)
353  return (atan2f(accYval, accZval) + PI) * RAD_TO_DEG;
354  else
355  return (atan2f(accXval, accZval) + PI) * RAD_TO_DEG;
356  } else
357  return 0;
358 }
359 
361  return (readBuf[((uint16_t)c >> 8) - 9] == ((uint8_t)c & 0xff));
362 }
363 
365  char statusOutput[102]; // Max string length plus null character
367  strcpy_P(statusOutput, PSTR("\r\nConnectionStatus: "));
368 
369  if(getStatus(Plugged)) strcat_P(statusOutput, PSTR("Plugged"));
370  else if(getStatus(Unplugged)) strcat_P(statusOutput, PSTR("Unplugged"));
371  else strcat_P(statusOutput, PSTR("Error"));
372 
373  strcat_P(statusOutput, PSTR(" - PowerRating: "));
374 
375  if(getStatus(Charging)) strcat_P(statusOutput, PSTR("Charging"));
376  else if(getStatus(NotCharging)) strcat_P(statusOutput, PSTR("Not Charging"));
377  else if(getStatus(Shutdown)) strcat_P(statusOutput, PSTR("Shutdown"));
378  else if(getStatus(Dying)) strcat_P(statusOutput, PSTR("Dying"));
379  else if(getStatus(Low)) strcat_P(statusOutput, PSTR("Low"));
380  else if(getStatus(High)) strcat_P(statusOutput, PSTR("High"));
381  else if(getStatus(Full)) strcat_P(statusOutput, PSTR("Full"));
382  else strcat_P(statusOutput, PSTR("Error"));
383 
384  strcat_P(statusOutput, PSTR(" - WirelessStatus: "));
385 
386  if(getStatus(CableRumble)) strcat_P(statusOutput, PSTR("Cable - Rumble is on"));
387  else if(getStatus(Cable)) strcat_P(statusOutput, PSTR("Cable - Rumble is off"));
388  else if(getStatus(BluetoothRumble)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is on"));
389  else if(getStatus(Bluetooth)) strcat_P(statusOutput, PSTR("Bluetooth - Rumble is off"));
390  else strcat_P(statusOutput, PSTR("Error"));
391  } else
392  strcpy_P(statusOutput, PSTR("\r\nError"));
393 
394  USB_HOST_SERIAL.write(statusOutput);
395 }
396 
397 /* Playstation Sixaxis Dualshock and Navigation Controller commands */
398 void PS3USB::PS3_Command(uint8_t *data, uint16_t nbytes) {
399  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x01), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)
400  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x01, 0x02, 0x00, nbytes, nbytes, data, NULL);
401 }
402 
404  for(uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
405  writeBuf[i] = pgm_read_byte(&PS3_REPORT_BUFFER[i]); // Reset buffer
406 
407  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
408 }
409 
411  uint8_t rumbleBuf[EP_MAXPKTSIZE];
412  memcpy(rumbleBuf, writeBuf, EP_MAXPKTSIZE);
413  rumbleBuf[1] = 0x00;
414  rumbleBuf[2] = 0x00; // Low mode off
415  rumbleBuf[3] = 0x00;
416  rumbleBuf[4] = 0x00; // High mode off
417  PS3_Command(rumbleBuf, PS3_REPORT_BUFFER_SIZE);
418 }
419 
421  if((mode & 0x30) > 0x00) {
422  uint8_t power[2] = {0xff, 0x00}; // Defaults to RumbleLow
423  if(mode == RumbleHigh) {
424  power[0] = 0x00;
425  power[1] = 0xff;
426  }
427  setRumbleOn(0xfe, power[0], 0xfe, power[1]);
428  }
429 }
430 
431 void PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
432  uint8_t rumbleBuf[EP_MAXPKTSIZE];
433  memcpy(rumbleBuf, writeBuf, EP_MAXPKTSIZE);
434  rumbleBuf[1] = rightDuration;
435  rumbleBuf[2] = rightPower;
436  rumbleBuf[3] = leftDuration;
437  rumbleBuf[4] = leftPower;
438  PS3_Command(rumbleBuf, PS3_REPORT_BUFFER_SIZE);
439 }
440 
441 void PS3USB::setLedRaw(uint8_t value) {
442  writeBuf[9] = value << 1;
443  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
444 }
445 
447  writeBuf[9] &= ~((uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1));
448  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
449 }
450 
452  if(a == OFF)
453  setLedRaw(0);
454  else {
455  writeBuf[9] |= (uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1);
456  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
457  }
458 }
459 
461  writeBuf[9] ^= (uint8_t)((pgm_read_byte(&PS3_LEDS[(uint8_t)a]) & 0x0f) << 1);
462  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
463 }
464 
465 void PS3USB::setBdaddr(uint8_t *bdaddr) {
466  /* Set the internal Bluetooth address */
467  uint8_t buf[8];
468  buf[0] = 0x01;
469  buf[1] = 0x00;
470 
471  for(uint8_t i = 0; i < 6; i++)
472  buf[i + 2] = bdaddr[5 - i]; // Copy into buffer, has to be written reversed, so it is MSB first
473 
474  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF5), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
475  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
476 }
477 
478 void PS3USB::getBdaddr(uint8_t *bdaddr) {
479  uint8_t buf[8];
480 
481  // bmRequest = Device to host (0x80) | Class (0x20) | Interface (0x01) = 0xA1, bRequest = Get Report (0x01), Report ID (0xF5), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
482  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_IN, HID_REQUEST_GET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
483 
484  for(uint8_t i = 0; i < 6; i++)
485  bdaddr[5 - i] = buf[i + 2]; // Copy into buffer reversed, so it is LSB first
486 }
487 
488 void PS3USB::enable_sixaxis() { // Command used to enable the Dualshock 3 and Navigation controller to send data via USB
489  uint8_t cmd_buf[4];
490  cmd_buf[0] = 0x42; // Special PS3 Controller enable commands
491  cmd_buf[1] = 0x0c;
492  cmd_buf[2] = 0x00;
493  cmd_buf[3] = 0x00;
494 
495  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0xF4), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data)
496  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF4, 0x03, 0x00, 4, 4, cmd_buf, NULL);
497 }
498 
499 /* Playstation Move Controller commands */
500 void PS3USB::Move_Command(uint8_t *data, uint16_t nbytes) {
501  pUsb->outTransfer(bAddress, epInfo[ PS3_OUTPUT_PIPE ].epAddr, nbytes, data);
502 }
503 
504 void PS3USB::moveSetBulb(uint8_t r, uint8_t g, uint8_t b) { // Use this to set the Color using RGB values
505  // Set the Bulb's values into the write buffer
506  writeBuf[2] = r;
507  writeBuf[3] = g;
508  writeBuf[4] = b;
509 
510  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE);
511 }
512 
513 void PS3USB::moveSetBulb(ColorsEnum color) { // Use this to set the Color using the predefined colors in "enums.h"
514  moveSetBulb((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color));
515 }
516 
517 void PS3USB::moveSetRumble(uint8_t rumble) {
518 #ifdef DEBUG_USB_HOST
519  if(rumble < 64 && rumble != 0) // The rumble value has to at least 64, or approximately 25% (64/255*100)
520  Notify(PSTR("\r\nThe rumble value has to at least 64, or approximately 25%"), 0x80);
521 #endif
522  writeBuf[6] = rumble; // Set the rumble value into the write buffer
523 
524  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE);
525 }
526 
527 void PS3USB::setMoveBdaddr(uint8_t *bdaddr) {
528  /* Set the internal Bluetooth address */
529  uint8_t buf[11];
530  buf[0] = 0x05;
531  buf[7] = 0x10;
532  buf[8] = 0x01;
533  buf[9] = 0x02;
534  buf[10] = 0x12;
535 
536  for(uint8_t i = 0; i < 6; i++)
537  buf[i + 1] = bdaddr[i];
538 
539  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x05), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
540  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
541 }
542 
543 void PS3USB::getMoveBdaddr(uint8_t *bdaddr) {
544  uint8_t buf[16];
545 
546  // bmRequest = Device to host (0x80) | Class (0x20) | Interface (0x01) = 0xA1, bRequest = Get Report (0x01), Report ID (0x04), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
547  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_IN, HID_REQUEST_GET_REPORT, 0x04, 0x03, 0x00, 16, 16, buf, NULL);
548 
549  for(uint8_t i = 0; i < 6; i++)
550  bdaddr[i] = buf[10 + i];
551 }
552 
553 void PS3USB::getMoveCalibration(uint8_t *data) {
554  uint8_t buf[49];
555 
556  for(uint8_t i = 0; i < 3; i++) {
557  // bmRequest = Device to host (0x80) | Class (0x20) | Interface (0x01) = 0xA1, bRequest = Get Report (0x01), Report ID (0x10), Report Type (Feature 0x03), interface (0x00), datalength, datalength, data
558  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_IN, HID_REQUEST_GET_REPORT, 0x10, 0x03, 0x00, 49, 49, buf, NULL);
559 
560  for(uint8_t j = 0; j < 49; j++)
561  data[49 * i + j] = buf[j];
562  }
563 }
564 
565 void PS3USB::onInit() {
566  if(pFuncOnInit)
567  pFuncOnInit(); // Call the user function
568  else {
569  if(PS3MoveConnected)
570  moveSetBulb(Red);
571  else // Dualshock 3 or Navigation controller
572  setLedOn(static_cast<LEDEnum>(LED1));
573  }
574 }
uint8_t bmRcvToggle
Definition: address.h:48
Definition: PS3Enums.h:124
- +
void getBdaddr(uint8_t *bdaddr)
Definition: PS3USB.cpp:478
-
#define pgm_read_dword(addr)
-
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
#define strcpy_P(dest, src)
-
uint8_t bmNakPower
Definition: address.h:42
+
#define pgm_read_dword(addr)
+
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
#define strcpy_P(dest, src)
+
uint8_t bmNakPower
Definition: address.h:49
void setLedRaw(uint8_t value)
Definition: PS3USB.cpp:441
bool PS3NavigationConnected
Definition: PS3USB.h:264
void setLedOff()
Definition: PS3USB.h:215
#define PS3_INPUT_PIPE
Definition: PS3USB.h:31
- - + +
#define PS3MOVE_PID
Definition: BTD.h:28
void setBdaddr(uint8_t *bdaddr)
Definition: PS3USB.cpp:465
@@ -115,113 +95,113 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
bool getButtonPress(ButtonEnum b)
Definition: PS3USB.cpp:316
#define PS3_OUTPUT_PIPE
Definition: PS3USB.h:30
-
#define NotifyFail(...)
Definition: message.h:55
+
#define NotifyFail(...)
Definition: message.h:62
bool PS3MoveConnected
Definition: PS3USB.h:262
-
AnalogHatEnum
- -
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
+
AnalogHatEnum
+ +
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
-
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:86
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
StatusEnum
Definition: PS3Enums.h:113
void getMoveBdaddr(uint8_t *bdaddr)
Definition: PS3USB.cpp:543
#define bmREQ_HID_OUT
Definition: usbhid.h:63
#define PS3_VID
Definition: BTD.h:25
-
#define pgm_read_byte(addr)
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
+
#define pgm_read_byte(addr)
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
uint8_t getAnalogButton(ButtonEnum a)
Definition: PS3USB.cpp:327
- +
uint16_t getSensor(SensorEnum a)
Definition: PS3USB.cpp:335
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
void setRumbleOff()
Definition: PS3USB.cpp:410
const uint32_t PS3_BUTTONS[]
Definition: PS3Enums.h:62
#define EP_MAXPKTSIZE
Definition: PS3USB.h:26
bool PS3Connected
Definition: PS3USB.h:256
virtual void FreeAddress(uint8_t addr)=0
-
LEDEnum
-
uint8_t epAttribs
Definition: address.h:37
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
+
LEDEnum
+
uint8_t epAttribs
Definition: address.h:44
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
#define Notify(...)
Definition: message.h:44
+
#define Notify(...)
Definition: message.h:51
#define PS3_CONTROL_PIPE
Definition: PS3USB.h:29
-
RumbleEnum
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
#define USB_HOST_SERIAL
Definition: settings.h:34
+
RumbleEnum
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
#define USB_HOST_SERIAL
Definition: settings.h:49
void setLedToggle(LEDEnum a)
Definition: PS3USB.cpp:460
-
uint8_t epAddr
Definition: address.h:33
-
#define NotifyFailUnknownDevice(...)
Definition: message.h:54
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
+
uint8_t epAddr
Definition: address.h:40
+
#define NotifyFailUnknownDevice(...)
Definition: message.h:61
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
void moveSetBulb(uint8_t r, uint8_t g, uint8_t b)
Definition: PS3USB.cpp:504
Definition: PS3Enums.h:123
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: PS3USB.cpp:47
-
Definition: address.h:32
+
Definition: address.h:39
#define MOVE_REPORT_BUFFER_SIZE
Definition: PS3Enums.h:40
void printStatusString()
Definition: PS3USB.cpp:364
void setAllOff()
Definition: PS3USB.cpp:403
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
- -
ButtonEnum
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
+ +
ButtonEnum
const uint8_t PS3_LEDS[]
Definition: PS3Enums.h:43
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bmSndToggle
Definition: address.h:40
+
uint8_t bmSndToggle
Definition: address.h:47
uint8_t getAnalogHat(AnalogHatEnum a)
Definition: PS3USB.cpp:331
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
USB * pUsb
Definition: PS3USB.h:268
-
ColorsEnum
+
ColorsEnum
const uint8_t PS3_ANALOG_BUTTONS[]
Definition: PS3Enums.h:92
- -
#define USB_NAK_NOWAIT
Definition: address.h:29
-
AngleEnum
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
+ +
#define USB_NAK_NOWAIT
Definition: address.h:36
+
AngleEnum
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
#define PS3_PID
Definition: BTD.h:26
#define PS3NAVIGATION_PID
Definition: BTD.h:27
void moveSetRumble(uint8_t rumble)
Definition: PS3USB.cpp:517
uint8_t Poll()
Definition: PS3USB.cpp:272
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
#define PS3_MAX_ENDPOINTS
Definition: PS3USB.h:39
EpInfo epInfo[PS3_MAX_ENDPOINTS]
Definition: PS3USB.h:272
void setRumbleOn(RumbleEnum mode)
Definition: PS3USB.cpp:420
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
- +
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
+
void setLedOn(LEDEnum a)
Definition: PS3USB.cpp:451
-
#define strcat_P(dest, src)
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
+
#define strcat_P(dest, src)
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
uint8_t bAddress
Definition: PS3USB.h:270
void setMoveBdaddr(uint8_t *bdaddr)
Definition: PS3USB.cpp:527
#define PS3_REPORT_BUFFER_SIZE
Definition: PS3Enums.h:24
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
#define bmREQ_HID_IN
Definition: usbhid.h:64
float getAngle(AngleEnum a)
Definition: PS3USB.cpp:339
- -
SensorEnum
+ +
SensorEnum
#define HID_REQUEST_SET_REPORT
Definition: usbhid.h:72
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
#define HID_REQUEST_GET_REPORT
Definition: usbhid.h:69
- +
PS3USB(USB *pUsb, uint8_t btadr5=0, uint8_t btadr4=0, uint8_t btadr3=0, uint8_t btadr2=0, uint8_t btadr1=0, uint8_t btadr0=0)
Definition: PS3USB.cpp:23
void getMoveCalibration(uint8_t *data)
Definition: PS3USB.cpp:553
Definition: PS3Enums.h:125
bool getStatus(StatusEnum c)
Definition: PS3USB.cpp:360
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
const uint8_t PS3_REPORT_BUFFER[PS3_REPORT_BUFFER_SIZE]
Definition: PS3Enums.h:27
bool getButtonClick(ButtonEnum b)
Definition: PS3USB.cpp:320
- +
diff --git a/_p_s3_u_s_b_8h.html b/_p_s3_u_s_b_8h.html index c52f8a0f..93cbd3e9 100644 --- a/_p_s3_u_s_b_8h.html +++ b/_p_s3_u_s_b_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS3USB.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- - + + @@ -146,7 +126,9 @@ Macros  

Macro Definition Documentation

- + +

◆ EP_MAXPKTSIZE

+
@@ -156,11 +138,13 @@ Macros
-

Definition at line 26 of file PS3USB.h.

+

Definition at line 26 of file PS3USB.h.

- + +

◆ PS3_CONTROL_PIPE

+
@@ -170,11 +154,13 @@ Macros
-

Definition at line 29 of file PS3USB.h.

+

Definition at line 29 of file PS3USB.h.

- + +

◆ PS3_OUTPUT_PIPE

+
@@ -184,11 +170,13 @@ Macros
-

Definition at line 30 of file PS3USB.h.

+

Definition at line 30 of file PS3USB.h.

- + +

◆ PS3_INPUT_PIPE

+
@@ -198,11 +186,13 @@ Macros
-

Definition at line 31 of file PS3USB.h.

+

Definition at line 31 of file PS3USB.h.

- + +

◆ PS3_VID

+
@@ -212,11 +202,13 @@ Macros
-

Definition at line 34 of file PS3USB.h.

+

Definition at line 34 of file PS3USB.h.

- + +

◆ PS3_PID

+
@@ -226,11 +218,13 @@ Macros
-

Definition at line 35 of file PS3USB.h.

+

Definition at line 35 of file PS3USB.h.

- + +

◆ PS3NAVIGATION_PID

+
@@ -240,11 +234,13 @@ Macros
-

Definition at line 36 of file PS3USB.h.

+

Definition at line 36 of file PS3USB.h.

- + +

◆ PS3MOVE_PID

+
@@ -254,11 +250,13 @@ Macros
-

Definition at line 37 of file PS3USB.h.

+

Definition at line 37 of file PS3USB.h.

- + +

◆ PS3_MAX_ENDPOINTS

+
@@ -268,7 +266,7 @@ Macros
-

Definition at line 39 of file PS3USB.h.

+

Definition at line 39 of file PS3USB.h.

@@ -277,7 +275,7 @@ Macros diff --git a/_p_s3_u_s_b_8h__dep__incl.md5 b/_p_s3_u_s_b_8h__dep__incl.md5 index 12e5013f..a0ef30bd 100644 --- a/_p_s3_u_s_b_8h__dep__incl.md5 +++ b/_p_s3_u_s_b_8h__dep__incl.md5 @@ -1 +1 @@ -0475266e9b2a94b52ed82e482fd5e58c \ No newline at end of file +30b451c7325a69f7529dfbe204eb0dfb \ No newline at end of file diff --git a/_p_s3_u_s_b_8h__dep__incl.png b/_p_s3_u_s_b_8h__dep__incl.png index 11ba1896..3e806515 100644 Binary files a/_p_s3_u_s_b_8h__dep__incl.png and b/_p_s3_u_s_b_8h__dep__incl.png differ diff --git a/_p_s3_u_s_b_8h__incl.map b/_p_s3_u_s_b_8h__incl.map index 40249182..7f53fe41 100644 --- a/_p_s3_u_s_b_8h__incl.map +++ b/_p_s3_u_s_b_8h__incl.map @@ -1,7 +1,7 @@ - - + + diff --git a/_p_s3_u_s_b_8h__incl.md5 b/_p_s3_u_s_b_8h__incl.md5 index 8fa52d90..016045ba 100644 --- a/_p_s3_u_s_b_8h__incl.md5 +++ b/_p_s3_u_s_b_8h__incl.md5 @@ -1 +1 @@ -6e3e4f5a4587d0eabc83a6049ce6f258 \ No newline at end of file +80bc9dd64df8547bd5be104488ba1f29 \ No newline at end of file diff --git a/_p_s3_u_s_b_8h__incl.png b/_p_s3_u_s_b_8h__incl.png index 703cb46f..fe3673f6 100644 Binary files a/_p_s3_u_s_b_8h__incl.png and b/_p_s3_u_s_b_8h__incl.png differ diff --git a/_p_s3_u_s_b_8h_source.html b/_p_s3_u_s_b_8h_source.html index 56d5a903..a71a4a42 100644 --- a/_p_s3_u_s_b_8h_source.html +++ b/_p_s3_u_s_b_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS3USB.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
uint8_t Release()
Definition: PS3USB.cpp:262
bool getButtonPress(ButtonEnum b)
Definition: PS3USB.cpp:316
bool PS3MoveConnected
Definition: PS3USB.h:262
-
AnalogHatEnum
+
AnalogHatEnum
StatusEnum
Definition: PS3Enums.h:113
- +
void getMoveBdaddr(uint8_t *bdaddr)
Definition: PS3USB.cpp:543
uint8_t getAnalogButton(ButtonEnum a)
Definition: PS3USB.cpp:327
@@ -109,24 +89,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
void setRumbleOff()
Definition: PS3USB.cpp:410
#define EP_MAXPKTSIZE
Definition: PS3USB.h:26
bool PS3Connected
Definition: PS3USB.h:256
-
LEDEnum
+
LEDEnum
virtual uint8_t GetAddress()
Definition: PS3USB.h:84
-
RumbleEnum
+
RumbleEnum
void attachOnInit(void(*funcOnInit)(void))
Definition: PS3USB.h:254
void setLedToggle(LEDEnum a)
Definition: PS3USB.cpp:460
void moveSetBulb(uint8_t r, uint8_t g, uint8_t b)
Definition: PS3USB.cpp:504
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: PS3USB.cpp:47
-
Definition: address.h:32
+
Definition: address.h:39
void printStatusString()
Definition: PS3USB.cpp:364
void setAllOff()
Definition: PS3USB.cpp:403
-
ButtonEnum
+
ButtonEnum
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: PS3USB.h:102
#define PS3_PID
Definition: PS3USB.h:35
uint8_t getAnalogHat(AnalogHatEnum a)
Definition: PS3USB.cpp:331
USB * pUsb
Definition: PS3USB.h:268
-
ColorsEnum
-
AngleEnum
+
ColorsEnum
+
AngleEnum
void moveSetRumble(uint8_t rumble)
Definition: PS3USB.cpp:517
uint8_t Poll()
Definition: PS3USB.cpp:272
#define PS3MOVE_PID
Definition: PS3USB.h:37
@@ -139,9 +119,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
#define PS3_VID
Definition: PS3USB.h:34
uint8_t bAddress
Definition: PS3USB.h:270
void setMoveBdaddr(uint8_t *bdaddr)
Definition: PS3USB.cpp:527
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
float getAngle(AngleEnum a)
Definition: PS3USB.cpp:339
-
SensorEnum
+
SensorEnum
PS3USB(USB *pUsb, uint8_t btadr5=0, uint8_t btadr4=0, uint8_t btadr3=0, uint8_t btadr2=0, uint8_t btadr1=0, uint8_t btadr0=0)
Definition: PS3USB.cpp:23
void getMoveCalibration(uint8_t *data)
Definition: PS3USB.cpp:553
bool getStatus(StatusEnum c)
Definition: PS3USB.cpp:360
@@ -152,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s4_b_t_8h.html b/_p_s4_b_t_8h.html index af48fb7e..e6b55ff4 100644 --- a/_p_s4_b_t_8h.html +++ b/_p_s4_b_t_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS4BT.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/_p_s4_b_t_8h__incl.md5 b/_p_s4_b_t_8h__incl.md5 index 13fdf4c6..1116a2ed 100644 --- a/_p_s4_b_t_8h__incl.md5 +++ b/_p_s4_b_t_8h__incl.md5 @@ -1 +1 @@ -57aad865c1c7b4a544a7eac684f0ffd9 \ No newline at end of file +d83187f481bdeb098a3bb36f43274a13 \ No newline at end of file diff --git a/_p_s4_b_t_8h__incl.png b/_p_s4_b_t_8h__incl.png index b681e6fa..9d0b8474 100644 Binary files a/_p_s4_b_t_8h__incl.png and b/_p_s4_b_t_8h__incl.png differ diff --git a/_p_s4_b_t_8h_source.html b/_p_s4_b_t_8h_source.html index a921275b..af6f235e 100644 --- a/_p_s4_b_t_8h_source.html +++ b/_p_s4_b_t_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS4BT.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _ps4bt_h_
19 #define _ps4bt_h_
20 
21 #include "BTHID.h"
22 #include "PS4Parser.h"
23 
28 class PS4BT : public BTHID, public PS4Parser {
29 public:
36  PS4BT(BTD *p, bool pair = false, const char *pin = "0000") :
37  BTHID(p, pair, pin) {
39  };
40 
45  bool connected() {
46  return BTHID::connected;
47  };
48 
49 protected:
56  virtual void ParseBTHIDData(uint8_t len, uint8_t *buf) {
57  PS4Parser::Parse(len, buf);
58  };
59 
65  virtual void OnInitBTHID() {
67  enable_sixaxis(); // Make the controller send out the entire output report
68  if (pFuncOnInit)
69  pFuncOnInit(); // Call the user function
70  else
71  setLed(Blue);
72  };
73 
75  virtual void ResetBTHID() {
77  };
81  virtual void sendOutputReport(PS4Output *output) { // Source: https://github.com/chrippa/ds4drv
82  uint8_t buf[79];
83  memset(buf, 0, sizeof(buf));
84 
85  buf[0] = 0x52; // HID BT Set_report (0x50) | Report Type (Output 0x02)
86  buf[1] = 0x11; // Report ID
87  buf[2] = 0x80;
88  buf[4]= 0xFF;
89 
90  buf[7] = output->smallRumble; // Small Rumble
91  buf[8] = output->bigRumble; // Big rumble
92 
93  buf[9] = output->r; // Red
94  buf[10] = output->g; // Green
95  buf[11] = output->b; // Blue
96 
97  buf[12] = output->flashOn; // Time to flash bright (255 = 2.5 seconds)
98  buf[13] = output->flashOff; // Time to flash dark (255 = 2.5 seconds)
99 
100  output->reportChanged = false;
101 
102  // The PS4 console actually set the four last bytes to a CRC32 checksum, but it seems like it is actually not needed
103 
104  HID_Command(buf, sizeof(buf));
105  };
108 private:
109  void enable_sixaxis() { // Command used to make the PS4 controller send out the entire output report
110  uint8_t buf[2];
111  buf[0] = 0x43; // HID BT Get_report (0x40) | Report Type (Feature 0x03)
112  buf[1] = 0x02; // Report ID
113 
114  HID_Command(buf, 2);
115  };
116 
117  void HID_Command(uint8_t *data, uint8_t nbytes) {
118  pBtd->L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]);
119  };
120 };
121 #endif
void Reset()
Definition: PS4Parser.cpp:130
-
Definition: BTD.h:198
+
Definition: BTD.h:201
uint8_t b
Definition: PS4Parser.h:118
-
void setLed(uint8_t r, uint8_t g, uint8_t b)
Definition: PS4Parser.h:321
+
void setLed(uint8_t r, uint8_t g, uint8_t b)
Definition: PS4Parser.h:320
bool connected()
Definition: PS4BT.h:45
bool connected
Definition: BTHID.h:88
uint8_t flashOn
Definition: PS4Parser.h:119
@@ -107,18 +87,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
virtual void ParseBTHIDData(uint8_t len, uint8_t *buf)
Definition: PS4BT.h:56
uint8_t bigRumble
Definition: PS4Parser.h:117
uint8_t flashOff
Definition: PS4Parser.h:119
-
void(* pFuncOnInit)(void)
Definition: BTD.h:605
+
void(* pFuncOnInit)(void)
Definition: BTD.h:609
uint8_t smallRumble
Definition: PS4Parser.h:117
virtual void sendOutputReport(PS4Output *output)
Definition: PS4BT.h:81
-
BTD * pBtd
Definition: BTD.h:608
+
BTD * pBtd
Definition: BTD.h:612
virtual void ResetBTHID()
Definition: PS4BT.h:75
- +
PS4BT(BTD *p, bool pair=false, const char *pin="0000")
Definition: PS4BT.h:36
-
uint16_t hci_handle
Definition: BTD.h:611
+
uint16_t hci_handle
Definition: BTD.h:615
virtual void OnInitBTHID()
Definition: PS4BT.h:65
-
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1221
+
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1219
Definition: BTHID.h:29
void pair(void)
Definition: BTHID.h:91
Definition: PS4BT.h:28
@@ -127,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s4_parser_8cpp.html b/_p_s4_parser_8cpp.html index dce613c7..1461506e 100644 --- a/_p_s4_parser_8cpp.html +++ b/_p_s4_parser_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS4Parser.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Enumeration Type Documentation

- + +

◆ DPADEnum

+
@@ -135,27 +117,18 @@ Enumerations
- - - - - - - - - + + + + + + + + +
Enumerator
DPAD_UP  -
DPAD_UP_RIGHT  -
DPAD_RIGHT  -
DPAD_RIGHT_DOWN  -
DPAD_DOWN  -
DPAD_DOWN_LEFT  -
DPAD_LEFT  -
DPAD_LEFT_UP  -
DPAD_OFF  -
Enumerator
DPAD_UP 
DPAD_UP_RIGHT 
DPAD_RIGHT 
DPAD_RIGHT_DOWN 
DPAD_DOWN 
DPAD_DOWN_LEFT 
DPAD_LEFT 
DPAD_LEFT_UP 
DPAD_OFF 
-

Definition at line 20 of file PS4Parser.cpp.

+

Definition at line 20 of file PS4Parser.cpp.

@@ -164,7 +137,7 @@ Enumerations diff --git a/_p_s4_parser_8cpp__incl.md5 b/_p_s4_parser_8cpp__incl.md5 index 1f9ffe4e..37924f33 100644 --- a/_p_s4_parser_8cpp__incl.md5 +++ b/_p_s4_parser_8cpp__incl.md5 @@ -1 +1 @@ -03082f2d3fd4c67e7d5789f05b2dd70a \ No newline at end of file +d25b4790cd5001e08560c2238a2e6903 \ No newline at end of file diff --git a/_p_s4_parser_8cpp__incl.png b/_p_s4_parser_8cpp__incl.png index bf34613b..ec7855c6 100644 Binary files a/_p_s4_parser_8cpp__incl.png and b/_p_s4_parser_8cpp__incl.png differ diff --git a/_p_s4_parser_8cpp_source.html b/_p_s4_parser_8cpp_source.html index 317c49ca..14677d8a 100644 --- a/_p_s4_parser_8cpp_source.html +++ b/_p_s4_parser_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS4Parser.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
PS4Parser.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "PS4Parser.h"
19 
20 enum DPADEnum {
21  DPAD_UP = 0x0,
23  DPAD_RIGHT = 0x2,
25  DPAD_DOWN = 0x4,
27  DPAD_LEFT = 0x6,
28  DPAD_LEFT_UP = 0x7,
29  DPAD_OFF = 0x8,
30 };
31 
32 // To enable serial debugging see "settings.h"
33 //#define PRINTREPORT // Uncomment to print the report send by the PS4 Controller
34 
35 bool PS4Parser::checkDpad(ButtonEnum b) {
36  switch (b) {
37  case UP:
38  return ps4Data.btn.dpad == DPAD_LEFT_UP || ps4Data.btn.dpad == DPAD_UP || ps4Data.btn.dpad == DPAD_UP_RIGHT;
39  case RIGHT:
40  return ps4Data.btn.dpad == DPAD_UP_RIGHT || ps4Data.btn.dpad == DPAD_RIGHT || ps4Data.btn.dpad == DPAD_RIGHT_DOWN;
41  case DOWN:
42  return ps4Data.btn.dpad == DPAD_RIGHT_DOWN || ps4Data.btn.dpad == DPAD_DOWN || ps4Data.btn.dpad == DPAD_DOWN_LEFT;
43  case LEFT:
44  return ps4Data.btn.dpad == DPAD_DOWN_LEFT || ps4Data.btn.dpad == DPAD_LEFT || ps4Data.btn.dpad == DPAD_LEFT_UP;
45  default:
46  return false;
47  }
48 }
49 
51  if (b <= LEFT) // Dpad
52  return checkDpad(b);
53  else
54  return ps4Data.btn.val & (1UL << pgm_read_byte(&PS4_BUTTONS[(uint8_t)b]));
55 }
56 
58  uint32_t mask = 1UL << pgm_read_byte(&PS4_BUTTONS[(uint8_t)b]);
59  bool click = buttonClickState.val & mask;
60  buttonClickState.val &= ~mask; // Clear "click" event
61  return click;
62 }
63 
65  if (b == L2) // These are the only analog buttons on the controller
66  return ps4Data.trigger[0];
67  else if (b == R2)
68  return ps4Data.trigger[1];
69  return 0;
70 }
71 
73  return ps4Data.hatValue[(uint8_t)a];
74 }
75 
76 void PS4Parser::Parse(uint8_t len, uint8_t *buf) {
77  if (len > 1 && buf) {
78 #ifdef PRINTREPORT
79  Notify(PSTR("\r\n"), 0x80);
80  for (uint8_t i = 0; i < len; i++) {
81  D_PrintHex<uint8_t > (buf[i], 0x80);
82  Notify(PSTR(" "), 0x80);
83  }
84 #endif
85 
86  if (buf[0] == 0x01) // Check report ID
87  memcpy(&ps4Data, buf + 1, min((uint8_t)(len - 1), sizeof(ps4Data)));
88  else if (buf[0] == 0x11) { // This report is send via Bluetooth, it has an offset of 2 compared to the USB data
89  if (len < 4) {
90 #ifdef DEBUG_USB_HOST
91  Notify(PSTR("\r\nReport is too short: "), 0x80);
92  D_PrintHex<uint8_t > (len, 0x80);
93 #endif
94  return;
95  }
96  memcpy(&ps4Data, buf + 3, min((uint8_t)(len - 3), sizeof(ps4Data)));
97  } else {
98 #ifdef DEBUG_USB_HOST
99  Notify(PSTR("\r\nUnknown report id: "), 0x80);
100  D_PrintHex<uint8_t > (buf[0], 0x80);
101 #endif
102  return;
103  }
104 
105  if (ps4Data.btn.val != oldButtonState.val) { // Check if anything has changed
106  buttonClickState.val = ps4Data.btn.val & ~oldButtonState.val; // Update click state variable
107  oldButtonState.val = ps4Data.btn.val;
108 
109  // The DPAD buttons does not set the different bits, but set a value corresponding to the buttons pressed, we will simply set the bits ourself
110  uint8_t newDpad = 0;
111  if (checkDpad(UP))
112  newDpad |= 1 << UP;
113  if (checkDpad(RIGHT))
114  newDpad |= 1 << RIGHT;
115  if (checkDpad(DOWN))
116  newDpad |= 1 << DOWN;
117  if (checkDpad(LEFT))
118  newDpad |= 1 << LEFT;
119  if (newDpad != oldDpad) {
120  buttonClickState.dpad = newDpad & ~oldDpad; // Override values
121  oldDpad = newDpad;
122  }
123  }
124  }
125 
126  if (ps4Output.reportChanged)
127  sendOutputReport(&ps4Output); // Send output report
128 }
129 
131  uint8_t i;
132  for (i = 0; i < sizeof(ps4Data.hatValue); i++)
133  ps4Data.hatValue[i] = 127; // Center value
134  ps4Data.btn.val = 0;
135  oldButtonState.val = 0;
136  for (i = 0; i < sizeof(ps4Data.trigger); i++)
137  ps4Data.trigger[i] = 0;
138  for (i = 0; i < sizeof(ps4Data.xy)/sizeof(ps4Data.xy[0]); i++) {
139  for (uint8_t j = 0; j < sizeof(ps4Data.xy[0].finger)/sizeof(ps4Data.xy[0].finger[0]); j++)
140  ps4Data.xy[i].finger[j].touching = 1; // The bit is cleared if the finger is touching the touchpad
141  }
142 
143  ps4Data.btn.dpad = DPAD_OFF;
144  oldButtonState.dpad = DPAD_OFF;
145  buttonClickState.dpad = 0;
146  oldDpad = 0;
147 
148  ps4Output.bigRumble = ps4Output.smallRumble = 0;
149  ps4Output.r = ps4Output.g = ps4Output.b = 0;
150  ps4Output.flashOn = ps4Output.flashOff = 0;
151  ps4Output.reportChanged = false;
152 };
153 
+Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "PS4Parser.h"
19 
20 enum DPADEnum {
21  DPAD_UP = 0x0,
23  DPAD_RIGHT = 0x2,
25  DPAD_DOWN = 0x4,
27  DPAD_LEFT = 0x6,
28  DPAD_LEFT_UP = 0x7,
29  DPAD_OFF = 0x8,
30 };
31 
32 // To enable serial debugging see "settings.h"
33 //#define PRINTREPORT // Uncomment to print the report send by the PS4 Controller
34 
35 bool PS4Parser::checkDpad(ButtonEnum b) {
36  switch (b) {
37  case UP:
38  return ps4Data.btn.dpad == DPAD_LEFT_UP || ps4Data.btn.dpad == DPAD_UP || ps4Data.btn.dpad == DPAD_UP_RIGHT;
39  case RIGHT:
40  return ps4Data.btn.dpad == DPAD_UP_RIGHT || ps4Data.btn.dpad == DPAD_RIGHT || ps4Data.btn.dpad == DPAD_RIGHT_DOWN;
41  case DOWN:
42  return ps4Data.btn.dpad == DPAD_RIGHT_DOWN || ps4Data.btn.dpad == DPAD_DOWN || ps4Data.btn.dpad == DPAD_DOWN_LEFT;
43  case LEFT:
44  return ps4Data.btn.dpad == DPAD_DOWN_LEFT || ps4Data.btn.dpad == DPAD_LEFT || ps4Data.btn.dpad == DPAD_LEFT_UP;
45  default:
46  return false;
47  }
48 }
49 
51  if (b <= LEFT) // Dpad
52  return checkDpad(b);
53  else
54  return ps4Data.btn.val & (1UL << pgm_read_byte(&PS4_BUTTONS[(uint8_t)b]));
55 }
56 
58  uint32_t mask = 1UL << pgm_read_byte(&PS4_BUTTONS[(uint8_t)b]);
59  bool click = buttonClickState.val & mask;
60  buttonClickState.val &= ~mask; // Clear "click" event
61  return click;
62 }
63 
65  if (b == L2) // These are the only analog buttons on the controller
66  return ps4Data.trigger[0];
67  else if (b == R2)
68  return ps4Data.trigger[1];
69  return 0;
70 }
71 
73  return ps4Data.hatValue[(uint8_t)a];
74 }
75 
76 void PS4Parser::Parse(uint8_t len, uint8_t *buf) {
77  if (len > 1 && buf) {
78 #ifdef PRINTREPORT
79  Notify(PSTR("\r\n"), 0x80);
80  for (uint8_t i = 0; i < len; i++) {
81  D_PrintHex<uint8_t > (buf[i], 0x80);
82  Notify(PSTR(" "), 0x80);
83  }
84 #endif
85 
86  if (buf[0] == 0x01) // Check report ID
87  memcpy(&ps4Data, buf + 1, min((uint8_t)(len - 1), MFK_CASTUINT8T sizeof(ps4Data)));
88  else if (buf[0] == 0x11) { // This report is send via Bluetooth, it has an offset of 2 compared to the USB data
89  if (len < 4) {
90 #ifdef DEBUG_USB_HOST
91  Notify(PSTR("\r\nReport is too short: "), 0x80);
92  D_PrintHex<uint8_t > (len, 0x80);
93 #endif
94  return;
95  }
96  memcpy(&ps4Data, buf + 3, min((uint8_t)(len - 3), MFK_CASTUINT8T sizeof(ps4Data)));
97  } else {
98 #ifdef DEBUG_USB_HOST
99  Notify(PSTR("\r\nUnknown report id: "), 0x80);
100  D_PrintHex<uint8_t > (buf[0], 0x80);
101 #endif
102  return;
103  }
104 
105  if (ps4Data.btn.val != oldButtonState.val) { // Check if anything has changed
106  buttonClickState.val = ps4Data.btn.val & ~oldButtonState.val; // Update click state variable
107  oldButtonState.val = ps4Data.btn.val;
108 
109  // The DPAD buttons does not set the different bits, but set a value corresponding to the buttons pressed, we will simply set the bits ourself
110  uint8_t newDpad = 0;
111  if (checkDpad(UP))
112  newDpad |= 1 << UP;
113  if (checkDpad(RIGHT))
114  newDpad |= 1 << RIGHT;
115  if (checkDpad(DOWN))
116  newDpad |= 1 << DOWN;
117  if (checkDpad(LEFT))
118  newDpad |= 1 << LEFT;
119  if (newDpad != oldDpad) {
120  buttonClickState.dpad = newDpad & ~oldDpad; // Override values
121  oldDpad = newDpad;
122  }
123  }
124  }
125 
126  if (ps4Output.reportChanged)
127  sendOutputReport(&ps4Output); // Send output report
128 }
129 
131  uint8_t i;
132  for (i = 0; i < sizeof(ps4Data.hatValue); i++)
133  ps4Data.hatValue[i] = 127; // Center value
134  ps4Data.btn.val = 0;
135  oldButtonState.val = 0;
136  for (i = 0; i < sizeof(ps4Data.trigger); i++)
137  ps4Data.trigger[i] = 0;
138  for (i = 0; i < sizeof(ps4Data.xy)/sizeof(ps4Data.xy[0]); i++) {
139  for (uint8_t j = 0; j < sizeof(ps4Data.xy[0].finger)/sizeof(ps4Data.xy[0].finger[0]); j++)
140  ps4Data.xy[i].finger[j].touching = 1; // The bit is cleared if the finger is touching the touchpad
141  }
142 
143  ps4Data.btn.dpad = DPAD_OFF;
144  oldButtonState.dpad = DPAD_OFF;
145  buttonClickState.dpad = 0;
146  oldDpad = 0;
147 
148  ps4Output.bigRumble = ps4Output.smallRumble = 0;
149  ps4Output.r = ps4Output.g = ps4Output.b = 0;
150  ps4Output.flashOn = ps4Output.flashOff = 0;
151  ps4Output.reportChanged = false;
152 };
153 
void Reset()
Definition: PS4Parser.cpp:130
uint32_t val
Definition: PS4Parser.h:71
uint8_t hatValue[4]
Definition: PS4Parser.h:94
uint8_t b
Definition: PS4Parser.h:118
bool getButtonPress(ButtonEnum b)
Definition: PS4Parser.cpp:50
-
AnalogHatEnum
+
AnalogHatEnum
DPADEnum
Definition: PS4Parser.cpp:20
uint8_t touching
Definition: PS4Parser.h:78
uint8_t flashOn
Definition: PS4Parser.h:119
-
#define pgm_read_byte(addr)
- - -
#define Notify(...)
Definition: message.h:44
+
#define pgm_read_byte(addr)
+ + +
#define Notify(...)
Definition: message.h:51
uint8_t g
Definition: PS4Parser.h:118
bool reportChanged
Definition: PS4Parser.h:120
void Parse(uint8_t len, uint8_t *buf)
Definition: PS4Parser.cpp:76
uint8_t trigger[2]
Definition: PS4Parser.h:96
- +
const uint8_t PS4_BUTTONS[]
Definition: PS4Parser.h:25
-
ButtonEnum
+
ButtonEnum
uint8_t r
Definition: PS4Parser.h:118
uint8_t bigRumble
Definition: PS4Parser.h:117
virtual void sendOutputReport(PS4Output *output)=0
- +
uint8_t flashOff
Definition: PS4Parser.h:119
uint8_t smallRumble
Definition: PS4Parser.h:117
-
#define PSTR(str)
+
#define PSTR(str)
+
#define MFK_CASTUINT8T
Definition: settings.h:196
uint8_t dpad
Definition: PS4Parser.h:52
struct touchpadXY::@30 finger[2]
touchpadXY xy[3]
Definition: PS4Parser.h:108
@@ -129,19 +110,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS4Buttons btn
Definition: PS4Parser.h:95
bool getButtonClick(ButtonEnum b)
Definition: PS4Parser.cpp:57
- +
uint8_t getAnalogHat(AnalogHatEnum a)
Definition: PS4Parser.cpp:72
- +
diff --git a/_p_s4_parser_8h.html b/_p_s4_parser_8h.html index 163b91f3..e4c63be9 100644 --- a/_p_s4_parser_8h.html +++ b/_p_s4_parser_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS4Parser.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Variable Documentation

- + +

◆ PS4_BUTTONS

+
@@ -147,13 +129,13 @@ Variables
-Initial value:
= {
UP,
DOWN,
LEFT,
0x0C,
0x0D,
0x0E,
0x0F,
0x0A,
0x0B,
0x08,
0x09,
0x07,
0x06,
0x05,
0x04,
0x10,
0x11,
}
- - - +Initial value:
= {
UP,
DOWN,
LEFT,
0x0C,
0x0D,
0x0E,
0x0F,
0x0A,
0x0B,
0x08,
0x09,
0x07,
0x06,
0x05,
0x04,
0x10,
0x11,
}
+ + +

Buttons on the controller

-

Definition at line 25 of file PS4Parser.h.

+

Definition at line 25 of file PS4Parser.h.

@@ -162,7 +144,7 @@ Variables diff --git a/_p_s4_parser_8h__dep__incl.md5 b/_p_s4_parser_8h__dep__incl.md5 index 2dc29627..f0c27ce8 100644 --- a/_p_s4_parser_8h__dep__incl.md5 +++ b/_p_s4_parser_8h__dep__incl.md5 @@ -1 +1 @@ -4d5a405a295dec480becbdb408726c5e \ No newline at end of file +479deb6480f10f264b96e5acadbf5ee5 \ No newline at end of file diff --git a/_p_s4_parser_8h__dep__incl.png b/_p_s4_parser_8h__dep__incl.png index cfa5c5fd..480690ac 100644 Binary files a/_p_s4_parser_8h__dep__incl.png and b/_p_s4_parser_8h__dep__incl.png differ diff --git a/_p_s4_parser_8h__incl.md5 b/_p_s4_parser_8h__incl.md5 index a7437e13..d2017c34 100644 --- a/_p_s4_parser_8h__incl.md5 +++ b/_p_s4_parser_8h__incl.md5 @@ -1 +1 @@ -29a4989044a63001a938d41ea83d3491 \ No newline at end of file +4cb75d366ef1e7f193c5b93a0446b36b \ No newline at end of file diff --git a/_p_s4_parser_8h__incl.png b/_p_s4_parser_8h__incl.png index 394c9929..cf98b9f7 100644 Binary files a/_p_s4_parser_8h__incl.png and b/_p_s4_parser_8h__incl.png differ diff --git a/_p_s4_parser_8h_source.html b/_p_s4_parser_8h_source.html index 7397c55e..e7ac8736 100644 --- a/_p_s4_parser_8h_source.html +++ b/_p_s4_parser_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS4Parser.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
PS4Parser.h
-Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _ps4parser_h_
19 #define _ps4parser_h_
20 
21 #include "Usb.h"
22 #include "controllerEnums.h"
23 
25 const uint8_t PS4_BUTTONS[] PROGMEM = {
26  UP, // UP
27  RIGHT, // RIGHT
28  DOWN, // DOWN
29  LEFT, // LEFT
30 
31  0x0C, // SHARE
32  0x0D, // OPTIONS
33  0x0E, // L3
34  0x0F, // R3
35 
36  0x0A, // L2
37  0x0B, // R2
38  0x08, // L1
39  0x09, // R1
40 
41  0x07, // TRIANGLE
42  0x06, // CIRCLE
43  0x05, // CROSS
44  0x04, // SQUARE
45 
46  0x10, // PS
47  0x11, // TOUCHPAD
48 };
49 
50 union PS4Buttons {
51  struct {
52  uint8_t dpad : 4;
53  uint8_t square : 1;
54  uint8_t cross : 1;
55  uint8_t circle : 1;
56  uint8_t triangle : 1;
57 
58  uint8_t l1 : 1;
59  uint8_t r1 : 1;
60  uint8_t l2 : 1;
61  uint8_t r2 : 1;
62  uint8_t share : 1;
63  uint8_t options : 1;
64  uint8_t l3 : 1;
65  uint8_t r3 : 1;
66 
67  uint8_t ps : 1;
68  uint8_t touchpad : 1;
69  uint8_t reportCounter : 6;
70  } __attribute__((packed));
71  uint32_t val : 24;
72 } __attribute__((packed));
73 
74 struct touchpadXY {
75  uint8_t dummy; // I can not figure out what this data is for, it seems to change randomly, maybe a timestamp?
76  struct {
77  uint8_t counter : 7; // Increments every time a finger is touching the touchpad
78  uint8_t touching : 1; // The top bit is cleared if the finger is touching the touchpad
79  uint16_t x : 12;
80  uint16_t y : 12;
81  } __attribute__((packed)) finger[2]; // 0 = first finger, 1 = second finger
82 } __attribute__((packed));
83 
84 struct PS4Status {
85  uint8_t battery : 4;
86  uint8_t usb : 1;
87  uint8_t audio : 1;
88  uint8_t mic : 1;
89  uint8_t unknown : 1; // Extension port?
90 } __attribute__((packed));
91 
92 struct PS4Data {
93  /* Button and joystick values */
94  uint8_t hatValue[4];
96  uint8_t trigger[2];
97 
98  /* Gyro and accelerometer values */
99  uint8_t dummy[3]; // First two looks random, while the third one might be some kind of status - it increments once in a while
100  int16_t gyroY, gyroZ, gyroX;
101  int16_t accX, accZ, accY;
102 
103  uint8_t dummy2[5];
105  uint8_t dummy3[3];
106 
107  /* The rest is data for the touchpad */
108  touchpadXY xy[3]; // It looks like it sends out three coordinates each time, this might be because the microcontroller inside the PS4 controller is much faster than the Bluetooth connection.
109  // The last data is read from the last position in the array while the oldest measurement is from the first position.
110  // The first position will also keep it's value after the finger is released, while the other two will set them to zero.
111  // Note that if you read fast enough from the device, then only the first one will contain any data.
112 
113  // The last three bytes are always: 0x00, 0x80, 0x00
114 } __attribute__((packed));
115 
116 struct PS4Output {
117  uint8_t bigRumble, smallRumble; // Rumble
118  uint8_t r, g, b; // RGB
119  uint8_t flashOn, flashOff; // Time to flash bright/dark (255 = 2.5 seconds)
120  bool reportChanged; // The data is send when data is received from the controller
121 } __attribute__((packed));
122 
124 class PS4Parser {
125 public:
128  Reset();
129  };
130 
142  bool getButtonPress(ButtonEnum b);
143  bool getButtonClick(ButtonEnum b);
154  uint8_t getAnalogButton(ButtonEnum b);
155 
161  uint8_t getAnalogHat(AnalogHatEnum a);
162 
171  uint16_t getX(uint8_t finger = 0, uint8_t xyId = 0) {
172  return ps4Data.xy[xyId].finger[finger].x;
173  };
174 
183  uint16_t getY(uint8_t finger = 0, uint8_t xyId = 0) {
184  return ps4Data.xy[xyId].finger[finger].y;
185  };
186 
195  bool isTouching(uint8_t finger = 0, uint8_t xyId = 0) {
196  return !(ps4Data.xy[xyId].finger[finger].touching); // The bit is cleared when a finger is touching the touchpad
197  };
198 
207  uint8_t getTouchCounter(uint8_t finger = 0, uint8_t xyId = 0) {
208  return ps4Data.xy[xyId].finger[finger].counter;
209  };
210 
216  float getAngle(AngleEnum a) {
217  if (a == Pitch)
218  return (atan2f(ps4Data.accY, ps4Data.accZ) + PI) * RAD_TO_DEG;
219  else
220  return (atan2f(ps4Data.accX, ps4Data.accZ) + PI) * RAD_TO_DEG;
221  };
222 
228  int16_t getSensor(SensorEnum s) {
229  switch(s) {
230  case gX:
231  return ps4Data.gyroX;
232  case gY:
233  return ps4Data.gyroY;
234  case gZ:
235  return ps4Data.gyroZ;
236  case aX:
237  return ps4Data.accX;
238  case aY:
239  return ps4Data.accY;
240  case aZ:
241  return ps4Data.accZ;
242  default:
243  return 0;
244  }
245  };
246 
251  uint8_t getBatteryLevel() {
252  return ps4Data.status.battery;
253  };
254 
259  bool getUsbStatus() {
260  return ps4Data.status.usb;
261  };
262 
267  bool getAudioStatus() {
268  return ps4Data.status.audio;
269  };
270 
275  bool getMicStatus() {
276  return ps4Data.status.mic;
277  };
278 
280  void setAllOff() {
281  setRumbleOff();
282  setLedOff();
283  };
284 
286  void setRumbleOff() {
287  setRumbleOn(0, 0);
288  };
289 
294  void setRumbleOn(RumbleEnum mode) {
295  if (mode == RumbleLow)
296  setRumbleOn(0x00, 0xFF);
297  else
298  setRumbleOn(0xFF, 0x00);
299  };
300 
306  void setRumbleOn(uint8_t bigRumble, uint8_t smallRumble) {
307  ps4Output.bigRumble = bigRumble;
308  ps4Output.smallRumble = smallRumble;
309  ps4Output.reportChanged = true;
310  };
311 
313  void setLedOff() {
314  setLed(0, 0, 0);
315  };
316 
321  void setLed(uint8_t r, uint8_t g, uint8_t b) {
322  ps4Output.r = r;
323  ps4Output.g = g;
324  ps4Output.b = b;
325  ps4Output.reportChanged = true;
326  };
327 
332  void setLed(ColorsEnum color) {
333  setLed((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color));
334  };
335 
341  void setLedFlash(uint8_t flashOn, uint8_t flashOff) {
342  ps4Output.flashOn = flashOn;
343  ps4Output.flashOff = flashOff;
344  ps4Output.reportChanged = true;
345  };
348 protected:
354  void Parse(uint8_t len, uint8_t *buf);
355 
357  void Reset();
358 
363  virtual void sendOutputReport(PS4Output *output) = 0;
364 
365 private:
366  bool checkDpad(ButtonEnum b); // Used to check PS4 DPAD buttons
367 
368  PS4Data ps4Data;
369  PS4Buttons oldButtonState, buttonClickState;
370  PS4Output ps4Output;
371  uint8_t oldDpad;
372 };
373 #endif
uint8_t getBatteryLevel()
Definition: PS4Parser.h:251
+Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _ps4parser_h_
19 #define _ps4parser_h_
20 
21 #include "Usb.h"
22 #include "controllerEnums.h"
23 
25 const uint8_t PS4_BUTTONS[] PROGMEM = {
26  UP, // UP
27  RIGHT, // RIGHT
28  DOWN, // DOWN
29  LEFT, // LEFT
30 
31  0x0C, // SHARE
32  0x0D, // OPTIONS
33  0x0E, // L3
34  0x0F, // R3
35 
36  0x0A, // L2
37  0x0B, // R2
38  0x08, // L1
39  0x09, // R1
40 
41  0x07, // TRIANGLE
42  0x06, // CIRCLE
43  0x05, // CROSS
44  0x04, // SQUARE
45 
46  0x10, // PS
47  0x11, // TOUCHPAD
48 };
49 
50 union PS4Buttons {
51  struct {
52  uint8_t dpad : 4;
53  uint8_t square : 1;
54  uint8_t cross : 1;
55  uint8_t circle : 1;
56  uint8_t triangle : 1;
57 
58  uint8_t l1 : 1;
59  uint8_t r1 : 1;
60  uint8_t l2 : 1;
61  uint8_t r2 : 1;
62  uint8_t share : 1;
63  uint8_t options : 1;
64  uint8_t l3 : 1;
65  uint8_t r3 : 1;
66 
67  uint8_t ps : 1;
68  uint8_t touchpad : 1;
69  uint8_t reportCounter : 6;
70  } __attribute__((packed));
71  uint32_t val : 24;
72 } __attribute__((packed));
73 
74 struct touchpadXY {
75  uint8_t dummy; // I can not figure out what this data is for, it seems to change randomly, maybe a timestamp?
76  struct {
77  uint8_t counter : 7; // Increments every time a finger is touching the touchpad
78  uint8_t touching : 1; // The top bit is cleared if the finger is touching the touchpad
79  uint16_t x : 12;
80  uint16_t y : 12;
81  } __attribute__((packed)) finger[2]; // 0 = first finger, 1 = second finger
82 } __attribute__((packed));
83 
84 struct PS4Status {
85  uint8_t battery : 4;
86  uint8_t usb : 1;
87  uint8_t audio : 1;
88  uint8_t mic : 1;
89  uint8_t unknown : 1; // Extension port?
90 } __attribute__((packed));
91 
92 struct PS4Data {
93  /* Button and joystick values */
94  uint8_t hatValue[4];
96  uint8_t trigger[2];
97 
98  /* Gyro and accelerometer values */
99  uint8_t dummy[3]; // First two looks random, while the third one might be some kind of status - it increments once in a while
100  int16_t gyroY, gyroZ, gyroX;
101  int16_t accX, accZ, accY;
102 
103  uint8_t dummy2[5];
105  uint8_t dummy3[3];
106 
107  /* The rest is data for the touchpad */
108  touchpadXY xy[3]; // It looks like it sends out three coordinates each time, this might be because the microcontroller inside the PS4 controller is much faster than the Bluetooth connection.
109  // The last data is read from the last position in the array while the oldest measurement is from the first position.
110  // The first position will also keep it's value after the finger is released, while the other two will set them to zero.
111  // Note that if you read fast enough from the device, then only the first one will contain any data.
112 
113  // The last three bytes are always: 0x00, 0x80, 0x00
114 } __attribute__((packed));
115 
116 struct PS4Output {
117  uint8_t bigRumble, smallRumble; // Rumble
118  uint8_t r, g, b; // RGB
119  uint8_t flashOn, flashOff; // Time to flash bright/dark (255 = 2.5 seconds)
120  bool reportChanged; // The data is send when data is received from the controller
121 } __attribute__((packed));
122 
124 class PS4Parser {
125 public:
128  Reset();
129  };
130 
142  bool getButtonPress(ButtonEnum b);
143  bool getButtonClick(ButtonEnum b);
153  uint8_t getAnalogButton(ButtonEnum b);
154 
160  uint8_t getAnalogHat(AnalogHatEnum a);
161 
170  uint16_t getX(uint8_t finger = 0, uint8_t xyId = 0) {
171  return ps4Data.xy[xyId].finger[finger].x;
172  };
173 
182  uint16_t getY(uint8_t finger = 0, uint8_t xyId = 0) {
183  return ps4Data.xy[xyId].finger[finger].y;
184  };
185 
194  bool isTouching(uint8_t finger = 0, uint8_t xyId = 0) {
195  return !(ps4Data.xy[xyId].finger[finger].touching); // The bit is cleared when a finger is touching the touchpad
196  };
197 
206  uint8_t getTouchCounter(uint8_t finger = 0, uint8_t xyId = 0) {
207  return ps4Data.xy[xyId].finger[finger].counter;
208  };
209 
215  float getAngle(AngleEnum a) {
216  if (a == Pitch)
217  return (atan2f(ps4Data.accY, ps4Data.accZ) + PI) * RAD_TO_DEG;
218  else
219  return (atan2f(ps4Data.accX, ps4Data.accZ) + PI) * RAD_TO_DEG;
220  };
221 
227  int16_t getSensor(SensorEnum s) {
228  switch(s) {
229  case gX:
230  return ps4Data.gyroX;
231  case gY:
232  return ps4Data.gyroY;
233  case gZ:
234  return ps4Data.gyroZ;
235  case aX:
236  return ps4Data.accX;
237  case aY:
238  return ps4Data.accY;
239  case aZ:
240  return ps4Data.accZ;
241  default:
242  return 0;
243  }
244  };
245 
250  uint8_t getBatteryLevel() {
251  return ps4Data.status.battery;
252  };
253 
258  bool getUsbStatus() {
259  return ps4Data.status.usb;
260  };
261 
266  bool getAudioStatus() {
267  return ps4Data.status.audio;
268  };
269 
274  bool getMicStatus() {
275  return ps4Data.status.mic;
276  };
277 
279  void setAllOff() {
280  setRumbleOff();
281  setLedOff();
282  };
283 
285  void setRumbleOff() {
286  setRumbleOn(0, 0);
287  };
288 
293  void setRumbleOn(RumbleEnum mode) {
294  if (mode == RumbleLow)
295  setRumbleOn(0x00, 0xFF);
296  else
297  setRumbleOn(0xFF, 0x00);
298  };
299 
305  void setRumbleOn(uint8_t bigRumble, uint8_t smallRumble) {
306  ps4Output.bigRumble = bigRumble;
307  ps4Output.smallRumble = smallRumble;
308  ps4Output.reportChanged = true;
309  };
310 
312  void setLedOff() {
313  setLed(0, 0, 0);
314  };
315 
320  void setLed(uint8_t r, uint8_t g, uint8_t b) {
321  ps4Output.r = r;
322  ps4Output.g = g;
323  ps4Output.b = b;
324  ps4Output.reportChanged = true;
325  };
326 
331  void setLed(ColorsEnum color) {
332  setLed((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color));
333  };
334 
340  void setLedFlash(uint8_t flashOn, uint8_t flashOff) {
341  ps4Output.flashOn = flashOn;
342  ps4Output.flashOff = flashOff;
343  ps4Output.reportChanged = true;
344  };
347 protected:
353  void Parse(uint8_t len, uint8_t *buf);
354 
356  void Reset();
357 
362  virtual void sendOutputReport(PS4Output *output) = 0;
363 
364 private:
365  bool checkDpad(ButtonEnum b); // Used to check PS4 DPAD buttons
366 
367  PS4Data ps4Data;
368  PS4Buttons oldButtonState, buttonClickState;
369  PS4Output ps4Output;
370  uint8_t oldDpad;
371 };
372 #endif
uint8_t getBatteryLevel()
Definition: PS4Parser.h:250
+
void Reset()
Definition: PS4Parser.cpp:130
uint32_t val
Definition: PS4Parser.h:71
-
uint16_t getY(uint8_t finger=0, uint8_t xyId=0)
Definition: PS4Parser.h:183
- +
uint16_t getY(uint8_t finger=0, uint8_t xyId=0)
Definition: PS4Parser.h:182
+
uint8_t dummy3[3]
Definition: PS4Parser.h:105
+
uint8_t usb
Definition: PS4Parser.h:86
+ +
int16_t gyroY
Definition: PS4Parser.h:100
+
uint8_t hatValue[4]
Definition: PS4Parser.h:94
+
uint8_t dummy2[5]
Definition: PS4Parser.h:103
uint8_t r1
Definition: PS4Parser.h:59
PS4Status status
Definition: PS4Parser.h:104
-
void setLed(uint8_t r, uint8_t g, uint8_t b)
Definition: PS4Parser.h:321
-
AnalogHatEnum
+
uint8_t dummy[3]
Definition: PS4Parser.h:99
+
uint8_t b
Definition: PS4Parser.h:118
+
void setLed(uint8_t r, uint8_t g, uint8_t b)
Definition: PS4Parser.h:320
+
int16_t accX
Definition: PS4Parser.h:101
+
uint8_t mic
Definition: PS4Parser.h:88
+
bool getButtonPress(ButtonEnum b)
Definition: PS4Parser.cpp:50
+
AnalogHatEnum
uint8_t reportCounter
Definition: PS4Parser.h:69
- -
void setLed(ColorsEnum color)
Definition: PS4Parser.h:332
-
void setRumbleOn(uint8_t bigRumble, uint8_t smallRumble)
Definition: PS4Parser.h:306
+ +
void setLed(ColorsEnum color)
Definition: PS4Parser.h:331
+
uint8_t audio
Definition: PS4Parser.h:87
+
void setRumbleOn(uint8_t bigRumble, uint8_t smallRumble)
Definition: PS4Parser.h:305
+
uint8_t touching
Definition: PS4Parser.h:78
-
int16_t getSensor(SensorEnum s)
Definition: PS4Parser.h:228
+
int16_t getSensor(SensorEnum s)
Definition: PS4Parser.h:227
uint8_t flashOn
Definition: PS4Parser.h:119
- +
int16_t accY
Definition: PS4Parser.h:101
+
uint8_t share
Definition: PS4Parser.h:62
- -
void setRumbleOn(RumbleEnum mode)
Definition: PS4Parser.h:294
+ +
uint8_t unknown
Definition: PS4Parser.h:89
+
void setRumbleOn(RumbleEnum mode)
Definition: PS4Parser.h:293
uint8_t dummy
Definition: PS4Parser.h:75
- +
int16_t gyroX
Definition: PS4Parser.h:100
+
uint8_t cross
Definition: PS4Parser.h:54
-
void setAllOff()
Definition: PS4Parser.h:280
+
void setAllOff()
Definition: PS4Parser.h:279
uint8_t l2
Definition: PS4Parser.h:60
-
RumbleEnum
+
RumbleEnum
+
uint8_t g
Definition: PS4Parser.h:118
uint8_t square
Definition: PS4Parser.h:53
bool reportChanged
Definition: PS4Parser.h:120
uint8_t ps
Definition: PS4Parser.h:67
-
bool isTouching(uint8_t finger=0, uint8_t xyId=0)
Definition: PS4Parser.h:195
- - +
void Parse(uint8_t len, uint8_t *buf)
Definition: PS4Parser.cpp:76
+
bool isTouching(uint8_t finger=0, uint8_t xyId=0)
Definition: PS4Parser.h:194
+
uint8_t counter
Definition: PS4Parser.h:77
+
uint16_t y
Definition: PS4Parser.h:80
+
uint8_t trigger[2]
Definition: PS4Parser.h:96
+
const uint8_t PS4_BUTTONS[]
Definition: PS4Parser.h:25
- -
ButtonEnum
+ +
ButtonEnum
uint8_t r
Definition: PS4Parser.h:118
-
void setRumbleOff()
Definition: PS4Parser.h:286
+
uint8_t bigRumble
Definition: PS4Parser.h:117
+
virtual void sendOutputReport(PS4Output *output)=0
+
uint8_t flashOff
Definition: PS4Parser.h:119
+
void setRumbleOff()
Definition: PS4Parser.h:285
uint8_t l1
Definition: PS4Parser.h:58
uint8_t smallRumble
Definition: PS4Parser.h:117
uint8_t r3
Definition: PS4Parser.h:65
-
void setLedOff()
Definition: PS4Parser.h:313
+
void setLedOff()
Definition: PS4Parser.h:312
uint8_t dpad
Definition: PS4Parser.h:52
-
ColorsEnum
+
struct touchpadXY::@30 finger[2]
+
touchpadXY xy[3]
Definition: PS4Parser.h:108
+
ColorsEnum
int16_t gyroZ
Definition: PS4Parser.h:100
- -
AngleEnum
+ +
AngleEnum
-
uint16_t getX(uint8_t finger=0, uint8_t xyId=0)
Definition: PS4Parser.h:171
+
uint16_t getX(uint8_t finger=0, uint8_t xyId=0)
Definition: PS4Parser.h:170
uint8_t triangle
Definition: PS4Parser.h:56
uint8_t r2
Definition: PS4Parser.h:61
-
float getAngle(AngleEnum a)
Definition: PS4Parser.h:216
-
uint8_t getTouchCounter(uint8_t finger=0, uint8_t xyId=0)
Definition: PS4Parser.h:207
+
float getAngle(AngleEnum a)
Definition: PS4Parser.h:215
+
uint8_t getTouchCounter(uint8_t finger=0, uint8_t xyId=0)
Definition: PS4Parser.h:206
uint8_t options
Definition: PS4Parser.h:63
-
bool getMicStatus()
Definition: PS4Parser.h:275
+
bool getMicStatus()
Definition: PS4Parser.h:274
uint8_t touchpad
Definition: PS4Parser.h:68
+
uint8_t getAnalogButton(ButtonEnum b)
Definition: PS4Parser.cpp:64
+
uint8_t battery
Definition: PS4Parser.h:85
uint8_t l3
Definition: PS4Parser.h:64
PS4Buttons btn
Definition: PS4Parser.h:95
-
SensorEnum
+
bool getButtonClick(ButtonEnum b)
Definition: PS4Parser.cpp:57
+
SensorEnum
uint8_t circle
Definition: PS4Parser.h:55
+
uint16_t x
Definition: PS4Parser.h:79
int16_t accZ
Definition: PS4Parser.h:101
- -
void setLedFlash(uint8_t flashOn, uint8_t flashOff)
Definition: PS4Parser.h:341
- -
bool getUsbStatus()
Definition: PS4Parser.h:259
-
bool getAudioStatus()
Definition: PS4Parser.h:267
- - + +
void setLedFlash(uint8_t flashOn, uint8_t flashOff)
Definition: PS4Parser.h:340
+
uint8_t getAnalogHat(AnalogHatEnum a)
Definition: PS4Parser.cpp:72
+ +
bool getUsbStatus()
Definition: PS4Parser.h:258
+
bool getAudioStatus()
Definition: PS4Parser.h:266
+ +
diff --git a/_p_s4_u_s_b_8h.html b/_p_s4_u_s_b_8h.html index 3b544656..e60f6d8e 100644 --- a/_p_s4_u_s_b_8h.html +++ b/_p_s4_u_s_b_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS4USB.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- - - + + +
@@ -122,9 +102,13 @@ Macros   #define PS4_PID   0x05C4   +#define PS4_PID_SLIM   0x09CC + 

Macro Definition Documentation

- + +

◆ PS4_VID

+
@@ -134,11 +118,13 @@ Macros
-

Definition at line 24 of file PS4USB.h.

+

Definition at line 24 of file PS4USB.h.

- + +

◆ PS4_PID

+
@@ -148,7 +134,23 @@ Macros
-

Definition at line 25 of file PS4USB.h.

+

Definition at line 25 of file PS4USB.h.

+ +
+
+ +

◆ PS4_PID_SLIM

+ +
+
+ + + + +
#define PS4_PID_SLIM   0x09CC
+
+ +

Definition at line 26 of file PS4USB.h.

@@ -157,7 +159,7 @@ Macros diff --git a/_p_s4_u_s_b_8h__incl.map b/_p_s4_u_s_b_8h__incl.map index 70551cf9..31784600 100644 --- a/_p_s4_u_s_b_8h__incl.map +++ b/_p_s4_u_s_b_8h__incl.map @@ -2,7 +2,7 @@ - - - + + + diff --git a/_p_s4_u_s_b_8h__incl.md5 b/_p_s4_u_s_b_8h__incl.md5 index 9a8140ab..76233869 100644 --- a/_p_s4_u_s_b_8h__incl.md5 +++ b/_p_s4_u_s_b_8h__incl.md5 @@ -1 +1 @@ -3d9cec3e6d601d983fe2992427af4c58 \ No newline at end of file +d2a18154f1cb36761bff05421187bd1f \ No newline at end of file diff --git a/_p_s4_u_s_b_8h__incl.png b/_p_s4_u_s_b_8h__incl.png index 2a69bcab..d1e8c024 100644 Binary files a/_p_s4_u_s_b_8h__incl.png and b/_p_s4_u_s_b_8h__incl.png differ diff --git a/_p_s4_u_s_b_8h_source.html b/_p_s4_u_s_b_8h_source.html index 72a1730d..5ece9ee8 100644 --- a/_p_s4_u_s_b_8h_source.html +++ b/_p_s4_u_s_b_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PS4USB.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
PS4USB.h
-Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _ps4usb_h_
19 #define _ps4usb_h_
20 
21 #include "hiduniversal.h"
22 #include "PS4Parser.h"
23 
24 #define PS4_VID 0x054C // Sony Corporation
25 #define PS4_PID 0x05C4 // PS4 Controller
26 
31 class PS4USB : public HIDUniversal, public PS4Parser {
32 public:
37  PS4USB(USB *p) :
38  HIDUniversal(p) {
40  };
41 
46  bool connected() {
48  };
49 
54  void attachOnInit(void (*funcOnInit)(void)) {
55  pFuncOnInit = funcOnInit;
56  };
57 
58 protected:
67  virtual void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
69  PS4Parser::Parse(len, buf);
70  };
71 
77  virtual uint8_t OnInitSuccessful() {
80  if (pFuncOnInit)
81  pFuncOnInit(); // Call the user function
82  else
83  setLed(Blue);
84  };
85  return 0;
86  };
90  virtual void sendOutputReport(PS4Output *output) { // Source: https://github.com/chrippa/ds4drv
91  uint8_t buf[32];
92  memset(buf, 0, sizeof(buf));
93 
94  buf[0] = 0x05; // Report ID
95  buf[1]= 0xFF;
96 
97  buf[4] = output->smallRumble; // Small Rumble
98  buf[5] = output->bigRumble; // Big rumble
99 
100  buf[6] = output->r; // Red
101  buf[7] = output->g; // Green
102  buf[8] = output->b; // Blue
103 
104  buf[9] = output->flashOn; // Time to flash bright (255 = 2.5 seconds)
105  buf[10] = output->flashOff; // Time to flash dark (255 = 2.5 seconds)
106 
107  output->reportChanged = false;
108 
109  // The PS4 console actually set the four last bytes to a CRC32 checksum, but it seems like it is actually not needed
110 
111  pUsb->outTransfer(bAddress, epInfo[ hidInterfaces[0].epIndex[epInterruptOutIndex] ].epAddr, sizeof(buf), buf);
112  };
122  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
123  return (vid == PS4_VID && pid == PS4_PID);
124  };
127 private:
128  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
129 };
130 #endif
uint16_t PID
Definition: hiduniversal.h:69
-
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: PS4USB.h:122
+Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _ps4usb_h_
19 #define _ps4usb_h_
20 
21 #include "hiduniversal.h"
22 #include "PS4Parser.h"
23 
24 #define PS4_VID 0x054C // Sony Corporation
25 #define PS4_PID 0x05C4 // PS4 Controller
26 #define PS4_PID_SLIM 0x09CC // PS4 Slim Controller
27 
32 class PS4USB : public HIDUniversal, public PS4Parser {
33 public:
38  PS4USB(USB *p) :
39  HIDUniversal(p) {
41  };
42 
47  bool connected() {
49  };
50 
55  void attachOnInit(void (*funcOnInit)(void)) {
56  pFuncOnInit = funcOnInit;
57  };
58 
59 protected:
68  virtual void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
70  PS4Parser::Parse(len, buf);
71  };
72 
78  virtual uint8_t OnInitSuccessful() {
81  if (pFuncOnInit)
82  pFuncOnInit(); // Call the user function
83  else
84  setLed(Blue);
85  };
86  return 0;
87  };
91  virtual void sendOutputReport(PS4Output *output) { // Source: https://github.com/chrippa/ds4drv
92  uint8_t buf[32];
93  memset(buf, 0, sizeof(buf));
94 
95  buf[0] = 0x05; // Report ID
96  buf[1]= 0xFF;
97 
98  buf[4] = output->smallRumble; // Small Rumble
99  buf[5] = output->bigRumble; // Big rumble
100 
101  buf[6] = output->r; // Red
102  buf[7] = output->g; // Green
103  buf[8] = output->b; // Blue
104 
105  buf[9] = output->flashOn; // Time to flash bright (255 = 2.5 seconds)
106  buf[10] = output->flashOff; // Time to flash dark (255 = 2.5 seconds)
107 
108  output->reportChanged = false;
109 
110  // The PS4 console actually set the four last bytes to a CRC32 checksum, but it seems like it is actually not needed
111 
112  pUsb->outTransfer(bAddress, epInfo[ hidInterfaces[0].epIndex[epInterruptOutIndex] ].epAddr, sizeof(buf), buf);
113  };
123  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
124  return (vid == PS4_VID && (pid == PS4_PID || HIDUniversal::PID == PS4_PID_SLIM));
125  };
128 private:
129  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
130 };
131 #endif
uint16_t PID
Definition: hiduniversal.h:69
+
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: PS4USB.h:123
Definition: usbhid.h:143
void Reset()
Definition: PS4Parser.cpp:130
USB * pUsb
Definition: usbhid.h:145
-
void attachOnInit(void(*funcOnInit)(void))
Definition: PS4USB.h:54
+
void attachOnInit(void(*funcOnInit)(void))
Definition: PS4USB.h:55
virtual bool isReady()
Definition: hiduniversal.h:97
-
virtual uint8_t OnInitSuccessful()
Definition: PS4USB.h:77
+
virtual uint8_t OnInitSuccessful()
Definition: PS4USB.h:78
uint8_t b
Definition: PS4Parser.h:118
-
void setLed(uint8_t r, uint8_t g, uint8_t b)
Definition: PS4Parser.h:321
-
Definition: PS4USB.h:31
+
void setLed(uint8_t r, uint8_t g, uint8_t b)
Definition: PS4Parser.h:320
+
Definition: PS4USB.h:32
uint8_t flashOn
Definition: PS4Parser.h:119
HIDInterface hidInterfaces[maxHidInterfaces]
Definition: hiduniversal.h:65
@@ -108,32 +88,33 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
uint8_t g
Definition: PS4Parser.h:118
bool reportChanged
Definition: PS4Parser.h:120
void Parse(uint8_t len, uint8_t *buf)
Definition: PS4Parser.cpp:76
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
static const uint8_t epInterruptOutIndex
Definition: usbhid.h:150
uint8_t bAddress
Definition: usbhid.h:146
uint8_t r
Definition: PS4Parser.h:118
uint8_t bigRumble
Definition: PS4Parser.h:117
-
bool connected()
Definition: PS4USB.h:46
+
bool connected()
Definition: PS4USB.h:47
uint8_t flashOff
Definition: PS4Parser.h:119
uint8_t smallRumble
Definition: PS4Parser.h:117
#define PS4_VID
Definition: PS4USB.h:24
- +
#define PS4_PID_SLIM
Definition: PS4USB.h:26
+
#define PS4_PID
Definition: PS4USB.h:25
-
virtual void sendOutputReport(PS4Output *output)
Definition: PS4USB.h:90
-
PS4USB(USB *p)
Definition: PS4USB.h:37
-
Definition: UsbCore.h:197
+
virtual void sendOutputReport(PS4Output *output)
Definition: PS4USB.h:91
+
PS4USB(USB *p)
Definition: PS4USB.h:38
+
Definition: UsbCore.h:208
EpInfo epInfo[totalEndpoints]
Definition: hiduniversal.h:64
-
virtual void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: PS4USB.h:67
+
virtual void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: PS4USB.h:68
diff --git a/_p_s_buzz_8cpp.html b/_p_s_buzz_8cpp.html index cce31532..591a59e0 100644 --- a/_p_s_buzz_8cpp.html +++ b/_p_s_buzz_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PSBuzz.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/_p_s_buzz_8cpp__incl.md5 b/_p_s_buzz_8cpp__incl.md5 index b600c9e8..254fa80c 100644 --- a/_p_s_buzz_8cpp__incl.md5 +++ b/_p_s_buzz_8cpp__incl.md5 @@ -1 +1 @@ -4060fd39043c7564a19c22e4b422acd8 \ No newline at end of file +5a74379adade31d51d1b0ef98c2b52fe \ No newline at end of file diff --git a/_p_s_buzz_8cpp__incl.png b/_p_s_buzz_8cpp__incl.png index 058e4079..459ab3d3 100644 Binary files a/_p_s_buzz_8cpp__incl.png and b/_p_s_buzz_8cpp__incl.png differ diff --git a/_p_s_buzz_8cpp_source.html b/_p_s_buzz_8cpp_source.html index dc830257..37aec3ec 100644 --- a/_p_s_buzz_8cpp_source.html +++ b/_p_s_buzz_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PSBuzz.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
PSBuzz.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "PSBuzz.h"
19 
20 // To enable serial debugging see "settings.h"
21 //#define PRINTREPORT // Uncomment to print the report send by the PS Buzz Controllers
22 
23 void PSBuzz::ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
24  if (HIDUniversal::VID == PSBUZZ_VID && HIDUniversal::PID == PSBUZZ_PID && len > 2 && buf) {
25 #ifdef PRINTREPORT
26  Notify(PSTR("\r\n"), 0x80);
27  for (uint8_t i = 0; i < len; i++) {
28  D_PrintHex<uint8_t > (buf[i], 0x80);
29  Notify(PSTR(" "), 0x80);
30  }
31 #endif
32  memcpy(&psbuzzButtons, buf + 2, min((uint8_t)(len - 2), sizeof(psbuzzButtons)));
33 
34  if (psbuzzButtons.val != oldButtonState.val) { // Check if anything has changed
35  buttonClickState.val = psbuzzButtons.val & ~oldButtonState.val; // Update click state variable
36  oldButtonState.val = psbuzzButtons.val;
37  }
38  }
39 };
40 
43  Reset();
44  if (pFuncOnInit)
45  pFuncOnInit(); // Call the user function
46  else
47  setLedOnAll(); // Turn the LED on, on all four controllers
48  };
49  return 0;
50 };
51 
52 bool PSBuzz::getButtonPress(ButtonEnum b, uint8_t controller) {
53  return psbuzzButtons.val & (1UL << (b + 5 * controller)); // Each controller uses 5 bits, so the value is shifted 5 for each controller
54 };
55 
56 bool PSBuzz::getButtonClick(ButtonEnum b, uint8_t controller) {
57  uint32_t mask = (1UL << (b + 5 * controller)); // Each controller uses 5 bits, so the value is shifted 5 for each controller
58  bool click = buttonClickState.val & mask;
59  buttonClickState.val &= ~mask; // Clear "click" event
60  return click;
61 };
62 
63 // Source: http://www.developerfusion.com/article/84338/making-usb-c-friendly/ and https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c
64 void PSBuzz::setLedRaw(bool value, uint8_t controller) {
65  ledState[controller] = value; // Save value for next time it is called
66 
67  uint8_t buf[7];
68  buf[0] = 0x00;
69  buf[1] = ledState[0] ? 0xFF : 0x00;
70  buf[2] = ledState[1] ? 0xFF : 0x00;
71  buf[3] = ledState[2] ? 0xFF : 0x00;
72  buf[4] = ledState[3] ? 0xFF : 0x00;
73  buf[5] = 0x00;
74  buf[6] = 0x00;
75 
76  PSBuzz_Command(buf, sizeof(buf));
77 };
78 
79 void PSBuzz::PSBuzz_Command(uint8_t *data, uint16_t nbytes) {
80  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x00), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)
81  pUsb->ctrlReq(bAddress, epInfo[0].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);
82 };
uint16_t PID
Definition: hiduniversal.h:69
+Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "PSBuzz.h"
19 
20 // To enable serial debugging see "settings.h"
21 //#define PRINTREPORT // Uncomment to print the report send by the PS Buzz Controllers
22 
23 void PSBuzz::ParseHIDData(USBHID *hid __attribute__((unused)), bool is_rpt_id __attribute__((unused)), uint8_t len, uint8_t *buf) {
24  if (HIDUniversal::VID == PSBUZZ_VID && HIDUniversal::PID == PSBUZZ_PID && len > 2 && buf) {
25 #ifdef PRINTREPORT
26  Notify(PSTR("\r\n"), 0x80);
27  for (uint8_t i = 0; i < len; i++) {
28  D_PrintHex<uint8_t > (buf[i], 0x80);
29  Notify(PSTR(" "), 0x80);
30  }
31 #endif
32  memcpy(&psbuzzButtons, buf + 2, min((uint8_t)(len - 2), MFK_CASTUINT8T sizeof(psbuzzButtons)));
33 
34  if (psbuzzButtons.val != oldButtonState.val) { // Check if anything has changed
35  buttonClickState.val = psbuzzButtons.val & ~oldButtonState.val; // Update click state variable
36  oldButtonState.val = psbuzzButtons.val;
37  }
38  }
39 };
40 
43  Reset();
44  if (pFuncOnInit)
45  pFuncOnInit(); // Call the user function
46  else
47  setLedOnAll(); // Turn the LED on, on all four controllers
48  };
49  return 0;
50 };
51 
52 bool PSBuzz::getButtonPress(ButtonEnum b, uint8_t controller) {
53  return psbuzzButtons.val & (1UL << (b + 5 * controller)); // Each controller uses 5 bits, so the value is shifted 5 for each controller
54 };
55 
56 bool PSBuzz::getButtonClick(ButtonEnum b, uint8_t controller) {
57  uint32_t mask = (1UL << (b + 5 * controller)); // Each controller uses 5 bits, so the value is shifted 5 for each controller
58  bool click = buttonClickState.val & mask;
59  buttonClickState.val &= ~mask; // Clear "click" event
60  return click;
61 };
62 
63 // Source: http://www.developerfusion.com/article/84338/making-usb-c-friendly/ and https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c
64 void PSBuzz::setLedRaw(bool value, uint8_t controller) {
65  ledState[controller] = value; // Save value for next time it is called
66 
67  uint8_t buf[7];
68  buf[0] = 0x00;
69  buf[1] = ledState[0] ? 0xFF : 0x00;
70  buf[2] = ledState[1] ? 0xFF : 0x00;
71  buf[3] = ledState[2] ? 0xFF : 0x00;
72  buf[4] = ledState[3] ? 0xFF : 0x00;
73  buf[5] = 0x00;
74  buf[6] = 0x00;
75 
76  PSBuzz_Command(buf, sizeof(buf));
77 };
78 
79 void PSBuzz::PSBuzz_Command(uint8_t *data, uint16_t nbytes) {
80  // bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x00), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)
81  pUsb->ctrlReq(bAddress, epInfo[0].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);
82 };
uint16_t PID
Definition: hiduniversal.h:69
Definition: usbhid.h:143
USB * pUsb
Definition: usbhid.h:145
void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: PSBuzz.cpp:23
@@ -98,16 +78,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
bool getButtonClick(ButtonEnum b, uint8_t controller=0)
Definition: PSBuzz.cpp:56
#define bmREQ_HID_OUT
Definition: usbhid.h:63
uint16_t VID
Definition: hiduniversal.h:69
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
-
#define Notify(...)
Definition: message.h:44
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
+
#define Notify(...)
Definition: message.h:51
bool getButtonPress(ButtonEnum b, uint8_t controller=0)
Definition: PSBuzz.cpp:52
#define PSBUZZ_VID
Definition: PSBuzz.h:24
-
ButtonEnum
+
ButtonEnum
#define PSBUZZ_PID
Definition: PSBuzz.h:25
uint8_t bAddress
Definition: usbhid.h:146
void setLedRaw(bool value, uint8_t controller=0)
Definition: PSBuzz.cpp:64
-
#define PSTR(str)
+
#define PSTR(str)
+
#define MFK_CASTUINT8T
Definition: settings.h:196
uint8_t OnInitSuccessful()
Definition: PSBuzz.cpp:41
void setLedOnAll()
Definition: PSBuzz.h:114
#define HID_REQUEST_SET_REPORT
Definition: usbhid.h:72
@@ -118,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s_buzz_8h.html b/_p_s_buzz_8h.html index f5a70b48..6d05a4bf 100644 --- a/_p_s_buzz_8h.html +++ b/_p_s_buzz_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PSBuzz.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ PSBUZZ_VID

+
@@ -143,11 +125,13 @@ Macros
-

Definition at line 24 of file PSBuzz.h.

+

Definition at line 24 of file PSBuzz.h.

- + +

◆ PSBUZZ_PID

+
@@ -157,7 +141,7 @@ Macros
-

Definition at line 25 of file PSBuzz.h.

+

Definition at line 25 of file PSBuzz.h.

@@ -166,7 +150,7 @@ Macros diff --git a/_p_s_buzz_8h__dep__incl.md5 b/_p_s_buzz_8h__dep__incl.md5 index 5caa0d46..0d832b03 100644 --- a/_p_s_buzz_8h__dep__incl.md5 +++ b/_p_s_buzz_8h__dep__incl.md5 @@ -1 +1 @@ -88928a152c2f379aa7b4a52bc6f3da10 \ No newline at end of file +89fdce8c433f9f3ff883c438cb91a471 \ No newline at end of file diff --git a/_p_s_buzz_8h__dep__incl.png b/_p_s_buzz_8h__dep__incl.png index 94e565dc..626e62c7 100644 Binary files a/_p_s_buzz_8h__dep__incl.png and b/_p_s_buzz_8h__dep__incl.png differ diff --git a/_p_s_buzz_8h__incl.md5 b/_p_s_buzz_8h__incl.md5 index 801930e6..063dac97 100644 --- a/_p_s_buzz_8h__incl.md5 +++ b/_p_s_buzz_8h__incl.md5 @@ -1 +1 @@ -460aa9dc1a3fdb1c5075c5daa680120f \ No newline at end of file +e9865eba6bb7dc48f5f354e4dc3ccb30 \ No newline at end of file diff --git a/_p_s_buzz_8h__incl.png b/_p_s_buzz_8h__incl.png index cdce103d..428a2f35 100644 Binary files a/_p_s_buzz_8h__incl.png and b/_p_s_buzz_8h__incl.png differ diff --git a/_p_s_buzz_8h_source.html b/_p_s_buzz_8h_source.html index 200e0a6b..404204b6 100644 --- a/_p_s_buzz_8h_source.html +++ b/_p_s_buzz_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PSBuzz.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
PSBuzz.h
-Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _psbuzz_h_
19 #define _psbuzz_h_
20 
21 #include "hiduniversal.h"
22 #include "controllerEnums.h"
23 
24 #define PSBUZZ_VID 0x054C // Sony Corporation
25 #define PSBUZZ_PID 0x1000 // PS Buzz Controller
26 
29  struct {
30  uint8_t red : 1;
31  uint8_t yellow : 1;
32  uint8_t green : 1;
33  uint8_t orange : 1;
34  uint8_t blue : 1;
35  } __attribute__((packed)) btn[4];
36  uint32_t val : 20;
37 } __attribute__((packed));
38 
43 class PSBuzz : public HIDUniversal {
44 public:
49  PSBuzz(USB *p) :
50  HIDUniversal(p) {
51  Reset();
52  };
53 
58  bool connected() {
60  };
61 
66  void attachOnInit(void (*funcOnInit)(void)) {
67  pFuncOnInit = funcOnInit;
68  };
69 
82  bool getButtonPress(ButtonEnum b, uint8_t controller = 0);
83  bool getButtonClick(ButtonEnum b, uint8_t controller = 0);
95  void setLedRaw(bool value, uint8_t controller = 0);
96 
98  void setLedOffAll() {
99  for (uint8_t i = 1; i < 4; i++) // Skip first as it will be set in setLedRaw
100  ledState[i] = false; // Just an easy way to set all four off at the same time
101  setLedRaw(false); // Turn the LED off, on all four controllers
102  };
103 
108  void setLedOff(uint8_t controller = 0) {
109  setLedRaw(false, controller);
110  };
111 
112 
114  void setLedOnAll() {
115  for (uint8_t i = 1; i < 4; i++) // Skip first as it will be set in setLedRaw
116  ledState[i] = true; // Just an easy way to set all four off at the same time
117  setLedRaw(true); // Turn the LED on, on all four controllers
118  };
119 
124  void setLedOn(uint8_t controller = 0) {
125  setLedRaw(true, controller);
126  };
127 
132  void setLedToggle(uint8_t controller = 0) {
133  setLedRaw(!ledState[controller], controller);
134  };
137 protected:
146  void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
147 
153  uint8_t OnInitSuccessful();
157  void Reset() {
158  psbuzzButtons.val = 0;
159  oldButtonState.val = 0;
160  buttonClickState.val = 0;
161  for (uint8_t i = 0; i < sizeof(ledState); i++)
162  ledState[i] = 0;
163  };
164 
172  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
173  return (vid == PSBUZZ_VID && pid == PSBUZZ_PID);
174  };
177 private:
178  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
179 
180  void PSBuzz_Command(uint8_t *data, uint16_t nbytes);
181 
182  PSBUZZButtons psbuzzButtons, oldButtonState, buttonClickState;
183  bool ledState[4];
184 };
185 #endif
uint16_t PID
Definition: hiduniversal.h:69
+Go to the documentation of this file.
1 /* Copyright (C) 2014 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _psbuzz_h_
19 #define _psbuzz_h_
20 
21 #include "hiduniversal.h"
22 #include "controllerEnums.h"
23 
24 #define PSBUZZ_VID 0x054C // Sony Corporation
25 #define PSBUZZ_PID 0x1000 // PS Buzz Controller
26 
29  struct {
30  uint8_t red : 1;
31  uint8_t yellow : 1;
32  uint8_t green : 1;
33  uint8_t orange : 1;
34  uint8_t blue : 1;
35  } __attribute__((packed)) btn[4];
36  uint32_t val : 20;
37 } __attribute__((packed));
38 
43 class PSBuzz : public HIDUniversal {
44 public:
49  PSBuzz(USB *p) :
50  HIDUniversal(p) {
51  Reset();
52  };
53 
58  bool connected() {
60  };
61 
66  void attachOnInit(void (*funcOnInit)(void)) {
67  pFuncOnInit = funcOnInit;
68  };
69 
82  bool getButtonPress(ButtonEnum b, uint8_t controller = 0);
83  bool getButtonClick(ButtonEnum b, uint8_t controller = 0);
95  void setLedRaw(bool value, uint8_t controller = 0);
96 
98  void setLedOffAll() {
99  for (uint8_t i = 1; i < 4; i++) // Skip first as it will be set in setLedRaw
100  ledState[i] = false; // Just an easy way to set all four off at the same time
101  setLedRaw(false); // Turn the LED off, on all four controllers
102  };
103 
108  void setLedOff(uint8_t controller = 0) {
109  setLedRaw(false, controller);
110  };
111 
112 
114  void setLedOnAll() {
115  for (uint8_t i = 1; i < 4; i++) // Skip first as it will be set in setLedRaw
116  ledState[i] = true; // Just an easy way to set all four off at the same time
117  setLedRaw(true); // Turn the LED on, on all four controllers
118  };
119 
124  void setLedOn(uint8_t controller = 0) {
125  setLedRaw(true, controller);
126  };
127 
132  void setLedToggle(uint8_t controller = 0) {
133  setLedRaw(!ledState[controller], controller);
134  };
137 protected:
146  void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
147 
153  uint8_t OnInitSuccessful();
157  void Reset() {
158  psbuzzButtons.val = 0;
159  oldButtonState.val = 0;
160  buttonClickState.val = 0;
161  for (uint8_t i = 0; i < sizeof(ledState); i++)
162  ledState[i] = 0;
163  };
164 
172  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
173  return (vid == PSBUZZ_VID && pid == PSBUZZ_PID);
174  };
177 private:
178  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
179 
180  void PSBuzz_Command(uint8_t *data, uint16_t nbytes);
181 
182  PSBUZZButtons psbuzzButtons, oldButtonState, buttonClickState;
183  bool ledState[4];
184 };
185 #endif
uint16_t PID
Definition: hiduniversal.h:69
Definition: usbhid.h:143
uint8_t red
Definition: PSBuzz.h:30
+
void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: PSBuzz.cpp:23
void setLedToggle(uint8_t controller=0)
Definition: PSBuzz.h:132
void attachOnInit(void(*funcOnInit)(void))
Definition: PSBuzz.h:66
virtual bool isReady()
Definition: hiduniversal.h:97
void Reset()
Definition: PSBuzz.h:157
+
bool getButtonClick(ButtonEnum b, uint8_t controller=0)
Definition: PSBuzz.cpp:56
bool connected()
Definition: PSBuzz.h:58
uint8_t blue
Definition: PSBuzz.h:34
uint16_t VID
Definition: hiduniversal.h:69
uint8_t green
Definition: PSBuzz.h:32
+
bool getButtonPress(ButtonEnum b, uint8_t controller=0)
Definition: PSBuzz.cpp:52
Definition: PSBuzz.h:43
#define PSBUZZ_VID
Definition: PSBuzz.h:24
-
ButtonEnum
+
ButtonEnum
#define PSBUZZ_PID
Definition: PSBuzz.h:25
uint8_t yellow
Definition: PSBuzz.h:31
+
void setLedRaw(bool value, uint8_t controller=0)
Definition: PSBuzz.cpp:64
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: PSBuzz.h:172
void setLedOff(uint8_t controller=0)
Definition: PSBuzz.h:108
struct PSBUZZButtons::@31 btn[4]
PSBuzz(USB *p)
Definition: PSBuzz.h:49
+
uint8_t OnInitSuccessful()
Definition: PSBuzz.cpp:41
void setLedOnAll()
Definition: PSBuzz.h:114
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
void setLedOn(uint8_t controller=0)
Definition: PSBuzz.h:124
uint32_t val
Definition: PSBuzz.h:36
uint8_t orange
Definition: PSBuzz.h:33
@@ -125,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_r_e_a_d_m_e_8md.html b/_r_e_a_d_m_e_8md.html index a5b29531..7600810e 100644 --- a/_r_e_a_d_m_e_8md.html +++ b/_r_e_a_d_m_e_8md.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: README.md File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + + - + - - + + + +
README.md
-Go to the documentation of this file.
1 # USB Host Library Rev.2.0
2 
3 The code is released under the GNU General Public License.
4 __________
5 [![Build Status](https://travis-ci.org/felis/USB_Host_Shield_2.0.svg)](https://travis-ci.org/felis/USB_Host_Shield_2.0)
6 
7 # Summary
8 This is Revision 2.0 of MAX3421E-based USB Host Shield Library for AVR's.
9 
10 Project main web site is: <http://www.circuitsathome.com>.
11 
12 Some information can also be found at: <http://blog.tkjelectronics.dk/>.
13 
14 The shield can be purchased at the main site: <http://www.circuitsathome.com/products-page/arduino-shields> or from [TKJ Electronics](http://tkjelectronics.com/): <http://shop.tkjelectronics.dk/product_info.php?products_id=43>.
15 
16 ![USB Host Shield](http://shop.tkjelectronics.dk/images/USB_Host_Shield1.jpg)
17 
18 For more information about the hardware see the [Hardware Manual](http://www.circuitsathome.com/usb-host-shield-hardware-manual).
19 
20 # Developed By
21 
22 * __Oleg Mazurov, Circuits\@Home__ - <mazurov@circuitsathome.com>
23 * __Alexei Glushchenko, Circuits\@Home__ - <alex-gl@mail.ru>
24  * Developers of the USB Core, HID, FTDI, ADK, ACM, and PL2303 libraries
25 * __Kristian Lauszus, TKJ Electronics__ - <kristianl@tkjelectronics.com>
26  * Developer of the [BTD](#bluetooth-libraries), [BTHID](#bthid-library), [SPP](#spp-library), [PS4](#ps4-library), [PS3](#ps3-library), [Wii](#wii-library), [Xbox](#xbox-library), and [PSBuzz](#ps-buzz-library) libraries
27 * __Andrew Kroll__ - <xxxajk@gmail.com>
28  * Major contributor to mass storage code
29 * __guruthree__
30  * [Xbox ONE](#xbox-one-library) controller support
31 * __Yuuichi Akagawa__ - [\@YuuichiAkagawa](https://twitter.com/yuuichiakagawa)
32  * Developer of the [MIDI](#midi-library) library
33 
34 # Donate
35 
36 Help yourself by helping us support you! Many thousands of hours have been spent developing the USB Host Shield library. Since you find it useful, please consider donating via the button below. Donations will allow us to support you by ensuring hardware that you have can be acquired in order to add support for your microcontroller board.
37 
38 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=donate@circuitsathome.com&amp;lc=US&amp;item_name=Donate%20to%20the%20USB%20Host%20Library%20project&amp;no_note=0&amp;currency_code=USD&amp;bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHostedGuest"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" alt="PayPal - The safer, easier way to pay online!" /></a>
39 
40 # Table of Contents
41 
42 * [How to include the library](#how-to-include-the-library)
43  * [Arduino Library Manager](#arduino-library-manager)
44  * [Manual installation](#manual-installation)
45 * [How to use the library](#how-to-use-the-library)
46  * [Documentation](#documentation)
47  * [Enable debugging](#enable-debugging)
48  * [Boards](#boards)
49  * [Bluetooth libraries](#bluetooth-libraries)
50  * [BTHID library](#bthid-library)
51  * [SPP library](#spp-library)
52  * [PS4 Library](#ps4-library)
53  * [PS3 Library](#ps3-library)
54  * [Xbox Libraries](#xbox-libraries)
55  * [Xbox library](#xbox-library)
56  * [Xbox 360 Library](#xbox-360-library)
57  * [Xbox ONE Library](#xbox-one-library)
58  * [Wii library](#wii-library)
59  * [PS Buzz Library](#ps-buzz-library)
60  * [HID Libraries](#hid-libraries)
61  * [MIDI Library](#midi-library)
62 * [Interface modifications](#interface-modifications)
63 * [FAQ](#faq)
64 
65 # How to include the library
66 
67 ### Arduino Library Manager
68 
69 First install Arduino IDE version 1.6.2 or newer, then simply use the Arduino Library Manager to install the library.
70 
71 Please see the following page for instructions: <http://www.arduino.cc/en/Guide/Libraries#toc3>.
72 
73 ### Manual installation
74 
75 First download the library by clicking on the following link: <https://github.com/felis/USB_Host_Shield_2.0/archive/master.zip>.
76 
77 Then uncompress the zip folder and rename the directory to "USB\_Host\_Shield\_20", as any special characters are not supported by the Arduino IDE.
78 
79 Now open up the Arduino IDE and open "File>Preferences". There you will see the location of your sketchbook. Open that directory and create a directory called "libraries" inside that directory.
80 Now move the "USB\_Host\_Shield\_20" directory to the "libraries" directory.
81 
82 The final structure should look like this:
83 
84 * Arduino/
85  * libraries/
86  * USB\_Host\_Shield\_20/
87 
88 Now quit the Arduino IDE and reopen it.
89 
90 Now you should be able to go open all the examples codes by navigating to "File>Examples>USB\_Host\_Shield\_20" and then select the example you will like to open.
91 
92 For more information visit the following sites: <http://arduino.cc/en/Guide/Libraries> and <https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use>.
93 
94 # How to use the library
95 
96 ### Documentation
97 
98 Documentation for the library can be found at the following link: <http://felis.github.com/USB_Host_Shield_2.0/>.
99 
100 ### Enable debugging
101 
102 By default serial debugging is disabled. To turn it on simply change ```ENABLE_UHS_DEBUGGING``` to 1 in [settings.h](settings.h) like so:
103 
104 ```C++
105 #define ENABLE_UHS_DEBUGGING 1
106 ```
107 
108 ### Boards
109 
110 Currently the following boards are supported by the library:
111 
112 * All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.)
113 * Arduino Due, Intel Galileo, Intel Galileo 2, and Intel Edison
114  * Note that the Intel Galileo uses pin 2 and 3 as INT and SS pin respectively by default, so some modifications to the shield are needed. See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information.
115  * Note native USB host is not supported on any of these platforms. You will have to use the shield for now.
116 * Teensy (Teensy++ 1.0, Teensy 2.0, Teensy++ 2.0, Teensy 3.x, and Teensy LC)
117  * Note if you are using the Teensy 3.x you should download this SPI library as well: <https://github.com/xxxajk/spi4teensy3>. You should then add ```#include <spi4teensy3.h>``` to your .ino file.
118 * Balanduino
119 * Sanguino
120 * Black Widdow
121 * RedBearLab nRF51822
122 * Digilent chipKIT
123  * Please see: <http://www.circuitsathome.com/mcu/usb/running-usb-host-code-on-digilent-chipkit-board>.
124 * STM32F4
125  * Currently the [NUCLEO-F446RE](http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF262063) is supported featuring the STM32F446. Take a look at the following example code: <https://github.com/Lauszus/Nucleo_F446RE_USBHost>.
126 
127 The following boards need to be activated manually in [settings.h](settings.h):
128 
129 * Arduino Mega ADK
130  * If you are using Arduino 1.5.5 or newer there is no need to activate the Arduino Mega ADK manually
131 * Black Widdow
132 
133 Simply set the corresponding value to 1 instead of 0.
134 
135 ### [Bluetooth libraries](BTD.cpp)
136 
137 The [BTD library](BTD.cpp) is a general purpose library for an ordinary Bluetooth dongle.
138 This library make it easy to add support for different Bluetooth services like a PS3 or a Wii controller or SPP which is a virtual serial port via Bluetooth.
139 Some different examples can be found in the [example directory](examples/Bluetooth).
140 
141 The BTD library also makes it possible to use multiple services at once, the following example sketch is an example of this:
142 [PS3SPP.ino](examples/Bluetooth/PS3SPP/PS3SPP.ino).
143 
144 ### [BTHID library](BTHID.cpp)
145 
146 The [Bluetooth HID library](BTHID.cpp) allows you to connect HID devices via Bluetooth to the USB Host Shield.
147 
148 Currently HID mice and keyboards are supported.
149 
150 It uses the standard Boot protocol by default, but it is also able to use the Report protocol as well. You would simply have to call ```setProtocolMode()``` and then parse ```HID_RPT_PROTOCOL``` as an argument. You will then have to modify the parser for your device. See the example: [BTHID.ino](examples/Bluetooth/BTHID/BTHID.ino) for more information.
151 
152 The [PS4 library](#ps4-library) also uses this class to handle all Bluetooth communication.
153 
154 For information see the following blog post: <http://blog.tkjelectronics.dk/2013/12/bluetooth-hid-devices-now-supported-by-the-usb-host-library/>.
155 
156 ### [SPP library](SPP.cpp)
157 
158 SPP stands for "Serial Port Profile" and is a Bluetooth protocol that implements a virtual comport which allows you to send data back and forth from your computer/phone to your Arduino via Bluetooth.
159 It has been tested successfully on Windows, Mac OS X, Linux, and Android.
160 
161 Take a look at the [SPP.ino](examples/Bluetooth/SPP/SPP.ino) example for more information.
162 
163 More information can be found at these blog posts:
164 
165 * <http://www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released>
166 * <http://blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/>
167 
168 To implement the SPP protocol I used a Bluetooth sniffing tool called [PacketLogger](http://www.tkjelectronics.com/uploads/PacketLogger.zip) developed by Apple.
169 It enables me to see the Bluetooth communication between my Mac and any device.
170 
171 ### PS4 Library
172 
173 The PS4BT library is split up into the [PS4BT](PS4BT.h) and the [PS4USB](PS4USB.h) library. These allow you to use the Sony PS4 controller via Bluetooth and USB.
174 
175 The [PS4BT.ino](examples/Bluetooth/PS4BT/PS4BT.ino) and [PS4USB.ino](examples/PS4USB/PS4USB.ino) examples shows how to easily read the buttons, joysticks, touchpad and IMU on the controller via Bluetooth and USB respectively. It is also possible to control the rumble and light on the controller and get the battery level.
176 
177 Before you can use the PS4 controller via Bluetooth you will need to pair with it.
178 
179 Simply create the PS4BT instance like so: ```PS4BT PS4(&Btd, PAIR);``` and then hold down the Share button and then hold down the PS without releasing the Share button. The PS4 controller will then start to blink rapidly indicating that it is in pairing mode.
180 
181 It should then automatically pair the dongle with your controller. This only have to be done once.
182 
183 For information see the following blog post: <http://blog.tkjelectronics.dk/2014/01/ps4-controller-now-supported-by-the-usb-host-library/>.
184 
185 Also check out this excellent Wiki by Frank Zhao about the PS4 controller: <http://eleccelerator.com/wiki/index.php?title=DualShock_4> and this Linux driver: <https://github.com/chrippa/ds4drv>.
186 
187 ### PS3 Library
188 
189 These libraries consist of the [PS3BT](PS3BT.cpp) and [PS3USB](PS3USB.cpp). These libraries allows you to use a Dualshock 3, Navigation or a Motion controller with the USB Host Shield both via Bluetooth and USB.
190 
191 In order to use your Playstation controller via Bluetooth you have to set the Bluetooth address of the dongle internally to your PS3 Controller. This can be achieved by first plugging in the Bluetooth dongle and wait a few seconds. Now plug in the controller via USB and wait until the LEDs start to flash. The library has now written the Bluetooth address of the dongle to the PS3 controller.
192 
193 Finally simply plug in the Bluetooth dongle again and press PS on the PS3 controller. After a few seconds it should be connected to the dongle and ready to use.
194 
195 __Note:__ You will have to plug in the Bluetooth dongle before connecting the controller, as the library needs to read the address of the dongle. Alternatively you could set it in code like so: [PS3BT.ino#L20](examples/Bluetooth/PS3BT/PS3BT.ino#L20).
196 
197 For more information about the PS3 protocol see the official wiki: <https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information>.
198 
199 Also take a look at the blog posts:
200 
201 * <http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/>
202 * <http://www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library>
203 * <http://www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb>
204 
205 A special thanks go to the following people:
206 
207 1. _Richard Ibbotson_ who made this excellent guide: <http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part>
208 2. _Tomoyuki Tanaka_ for releasing his code for the Arduino USB Host shield connected to the wiimote: <http://www.circuitsathome.com/mcu/rc-car-controlled-by-wii-remote-on-arduino>
209 
210 Also a big thanks all the people behind these sites about the Motion controller:
211 
212 * <http://thp.io/2010/psmove/>
213 * <http://www.copenhagengamecollective.org/unimove/>
214 * <https://github.com/thp/psmoveapi>
215 * <http://code.google.com/p/moveonpc/>
216 
217 ### Xbox Libraries
218 
219 The library supports both the original Xbox controller via USB and the Xbox 360 controller both via USB and wirelessly.
220 
221 #### Xbox library
222 
223 The [XBOXOLD](XBOXOLD.cpp) class implements support for the original Xbox controller via USB.
224 
225 All the information are from the following sites:
226 
227 * <https://github.com/torvalds/linux/blob/master/Documentation/input/xpad.txt>
228 * <https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c>
229 * <http://euc.jp/periphs/xbox-controller.ja.html>
230 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL#L15>
231 
232 #### Xbox 360 Library
233 
234 The library support one Xbox 360 via USB or up to four Xbox 360 controllers wirelessly by using a [Xbox 360 wireless receiver](http://blog.tkjelectronics.dk/wp-content/uploads/xbox360-wireless-receiver.jpg).
235 
236 To use it via USB use the [XBOXUSB](XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](XBOXRECV.cpp) library.
237 
238 __Note that a Wireless controller can NOT be used via USB!__
239 
240 Examples code can be found in the [examples directory](examples/Xbox).
241 
242 Also see the following blog posts:
243 
244 * <http://www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library>
245 * <http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/>
246 * <http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/>
247 
248 All the information regarding the Xbox 360 controller protocol are form these sites:
249 
250 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo>
251 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo>
252 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL>
253 
254 #### Xbox ONE Library
255 
256 An Xbox ONE controller is supported via USB in the [XBOXONE](XBOXONE.cpp) class. It is heavily based on the 360 library above. In addition to cross referencing the above, information on the protocol was found at:
257 
258 * <https://github.com/quantus/xbox-one-controller-protocol>
259 * <https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c>
260 * <https://github.com/kylelemons/xbox/blob/master/xbox.go>
261 
262 ### [Wii library](Wii.cpp)
263 
264 The [Wii](Wii.cpp) library support the Wiimote, but also the Nunchuch and Motion Plus extensions via Bluetooth. The Wii U Pro Controller and Wii Balance Board are also supported via Bluetooth.
265 
266 First you have to pair with the controller, this is done automatically by the library if you create the instance like so:
267 
268 ```C++
269 WII Wii(&Btd, PAIR);
270 ```
271 
272 And then press 1 & 2 at once on the Wiimote or the SYNC buttons if you are using a Wii U Pro Controller or a Wii Balance Board.
273 
274 After that you can simply create the instance like so:
275 
276 ```C++
277 WII Wii(&Btd);
278 ```
279 
280 Then just press any button on the Wiimote and it will then connect to the dongle.
281 
282 Take a look at the example for more information: [Wii.ino](examples/Bluetooth/Wii/Wii.ino).
283 
284 Also take a look at the blog post:
285 
286 * <http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/>
287 
288 The Wii IR camera can also be used, but you will have to activate the code for it manually as it is quite large. Simply set ```ENABLE_WII_IR_CAMERA``` to 1 in [settings.h](settings.h).
289 
290 The [WiiIRCamera.ino](examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino) example shows how it can be used.
291 
292 All the information about the Wii controllers are from these sites:
293 
294 * <http://wiibrew.org/wiki/Wiimote>
295 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers>
296 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck>
297 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus>
298 * <http://wiibrew.org/wiki/Wii_Balance_Board>
299 * The old library created by _Tomoyuki Tanaka_: <https://github.com/moyuchin/WiiRemote_on_Arduino> also helped a lot.
300 
301 ### [PS Buzz Library](PSBuzz.cpp)
302 
303 This library implements support for the Playstation Buzz controllers via USB.
304 
305 It is essentially just a wrapper around the [HIDUniversal](hiduniversal.cpp) which takes care of the initializing and reading of the controllers. The [PSBuzz](PSBuzz.cpp) class simply inherits this and parses the data, so it is easy for users to read the buttons and turn the big red button on the controllers on and off.
306 
307 The example [PSBuzz.ino](examples/PSBuzz/PSBuzz.ino) shows how one can do this with just a few lines of code.
308 
309 More information about the controller can be found at the following sites:
310 
311 * http://www.developerfusion.com/article/84338/making-usb-c-friendly/
312 * https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c
313 
314 ### HID Libraries
315 
316 HID devices are also supported by the library. However these require you to write your own driver. A few example are provided in the [examples/HID](examples/HID) directory. Including an example for the [SteelSeries SRW-S1 Steering Wheel](examples/HID/SRWS1/SRWS1.ino).
317 
318 ### [MIDI Library](usbh_midi.cpp)
319 
320 The library support MIDI devices.
321 You can convert USB MIDI keyboard to legacy serial MIDI.
322 
323 * [USB_MIDI_converter.ino](USBH_MIDI/USB_MIDI_converter)
324 * [USB_MIDI_converter_multi.ino](USBH_MIDI/USB_MIDI_converter_multi)
325 
326 For information see the following page: <http://yuuichiakagawa.github.io/USBH_MIDI/>.
327 
328 # Interface modifications
329 
330 The shield is using SPI for communicating with the MAX3421E USB host controller. It uses the SCK, MISO and MOSI pins via the ICSP on your board.
331 
332 Note this means that it uses pin 13, 12, 11 on an Arduino Uno, so these pins can not be used for anything else than SPI communication!
333 
334 Furthermore it uses one pin as SS and one INT pin. These are by default located on pin 10 and 9 respectively. They can easily be reconfigured in case you need to use them for something else by cutting the jumper on the shield and then solder a wire from the pad to the new pin.
335 
336 After that you need modify the following entry in [UsbCore.h](UsbCore.h):
337 
338 ```C++
339 typedef MAX3421e<P10, P9> MAX3421E;
340 ```
341 
342 For instance if you have rerouted SS to pin 7 it should read:
343 
344 ```C++
345 typedef MAX3421e<P7, P9> MAX3421E;
346 ```
347 
348 See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information.
349 
350 # FAQ
351 
352 > When I plug my device into the USB connector nothing happens?
353 
354 * Try to connect a external power supply to the Arduino - this solves the problem in most cases.
355 * You can also use a powered hub between the device and the USB Host Shield. You should then include the USB hub library: ```#include <usbhub.h>``` and create the instance like so: ```USBHub Hub1(&Usb);```.
356 
357 > When I connecting my PS3 controller I get a output like this:
358 
359 ```
360 Dualshock 3 Controller Enabled
361 
362 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
363 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
364 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
365 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
366 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
367 ```
368 
369 * This means that your dongle does not support 2.0+EDR, so you will need another dongle. Please see the following [list](https://github.com/felis/USB_Host_Shield_2.0/wiki/Bluetooth-dongles) for tested working dongles.
370 
371 > When compiling I am getting the following error: "fatal error: SPI.h: No such file or directory".
372 
373 * Please make sure to include the SPI library like so: ```#include <SPI.h>``` in your .ino file.
+Go to the documentation of this file.
1 # USB Host Library Rev.2.0
2 
3 The code is released under the GNU General Public License.
4 __________
5 [![Build Status](https://travis-ci.org/felis/USB_Host_Shield_2.0.svg?branch=master)](https://travis-ci.org/felis/USB_Host_Shield_2.0)
6 
7 # Summary
8 This is Revision 2.0 of MAX3421E-based USB Host Shield Library for AVR's.
9 
10 Project main web site is: <http://www.circuitsathome.com>.
11 
12 Some information can also be found at: <http://blog.tkjelectronics.dk/>.
13 
14 The shield can be purchased at the main site: <http://www.circuitsathome.com/products-page/arduino-shields> or from [TKJ Electronics](http://tkjelectronics.com/): <http://shop.tkjelectronics.dk/product_info.php?products_id=43>.
15 
16 ![USB Host Shield](http://shop.tkjelectronics.dk/images/USB_Host_Shield1.jpg)
17 
18 For more information about the hardware see the [Hardware Manual](http://www.circuitsathome.com/usb-host-shield-hardware-manual).
19 
20 # Developed By
21 
22 * __Oleg Mazurov, Circuits@Home__ - <mazurov@circuitsathome.com>
23 * __Alexei Glushchenko, Circuits@Home__ - <alex-gl@mail.ru>
24  * Developers of the USB Core, HID, FTDI, ADK, ACM, and PL2303 libraries
25 * __Kristian Lauszus, TKJ Electronics__ - <kristianl@tkjelectronics.com>
26  * Developer of the [BTD](#bluetooth-libraries), [BTHID](#bthid-library), [SPP](#spp-library), [PS4](#ps4-library), [PS3](#ps3-library), [Wii](#wii-library), [Xbox](#xbox-library), and [PSBuzz](#ps-buzz-library) libraries
27 * __Andrew Kroll__ - <xxxajk@gmail.com>
28  * Major contributor to mass storage code
29 * __guruthree__
30  * [Xbox ONE](#xbox-one-library) controller support
31 * __Yuuichi Akagawa__ - [@YuuichiAkagawa](https://twitter.com/yuuichiakagawa)
32  * Developer of the [MIDI](#midi-library) library
33 
34 # Donate
35 
36 Help yourself by helping us support you! Many thousands of hours have been spent developing the USB Host Shield library. Since you find it useful, please consider donating via the button below. Donations will allow us to support you by ensuring hardware that you have can be acquired in order to add support for your microcontroller board.
37 
38 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=donate@circuitsathome.com&amp;lc=US&amp;item_name=Donate%20to%20the%20USB%20Host%20Library%20project&amp;no_note=0&amp;currency_code=USD&amp;bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHostedGuest"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" alt="PayPal - The safer, easier way to pay online!" /></a>
39 
40 # Table of Contents
41 
42 * [How to include the library](#how-to-include-the-library)
43  * [Arduino Library Manager](#arduino-library-manager)
44  * [Manual installation](#manual-installation)
45 * [How to use the library](#how-to-use-the-library)
46  * [Documentation](#documentation)
47  * [Enable debugging](#enable-debugging)
48  * [Boards](#boards)
49  * [Bluetooth libraries](#bluetooth-libraries)
50  * [BTHID library](#bthid-library)
51  * [SPP library](#spp-library)
52  * [PS4 Library](#ps4-library)
53  * [PS3 Library](#ps3-library)
54  * [Xbox Libraries](#xbox-libraries)
55  * [Xbox library](#xbox-library)
56  * [Xbox 360 Library](#xbox-360-library)
57  * [Xbox ONE Library](#xbox-one-library)
58  * [Wii library](#wii-library)
59  * [PS Buzz Library](#ps-buzz-library)
60  * [HID Libraries](#hid-libraries)
61  * [MIDI Library](#midi-library)
62 * [Interface modifications](#interface-modifications)
63 * [FAQ](#faq)
64 
65 # How to include the library
66 
67 ### Arduino Library Manager
68 
69 First install Arduino IDE version 1.6.2 or newer, then simply use the Arduino Library Manager to install the library.
70 
71 Please see the following page for instructions: <http://www.arduino.cc/en/Guide/Libraries#toc3>.
72 
73 ### Manual installation
74 
75 First download the library by clicking on the following link: <https://github.com/felis/USB_Host_Shield_2.0/archive/master.zip>.
76 
77 Then uncompress the zip folder and rename the directory to "USB\_Host\_Shield\_20", as any special characters are not supported by the Arduino IDE.
78 
79 Now open up the Arduino IDE and open "File>Preferences". There you will see the location of your sketchbook. Open that directory and create a directory called "libraries" inside that directory.
80 Now move the "USB\_Host\_Shield\_20" directory to the "libraries" directory.
81 
82 The final structure should look like this:
83 
84 * Arduino/
85  * libraries/
86  * USB\_Host\_Shield\_20/
87 
88 Now quit the Arduino IDE and reopen it.
89 
90 Now you should be able to go open all the examples codes by navigating to "File>Examples>USB\_Host\_Shield\_20" and then select the example you will like to open.
91 
92 For more information visit the following sites: <http://arduino.cc/en/Guide/Libraries> and <https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use>.
93 
94 # How to use the library
95 
96 ### Documentation
97 
98 Documentation for the library can be found at the following link: <http://felis.github.com/USB_Host_Shield_2.0/>.
99 
100 ### Enable debugging
101 
102 By default serial debugging is disabled. To turn it on simply change ```ENABLE_UHS_DEBUGGING``` to 1 in [settings.h](settings.h) like so:
103 
104 ```C++
105 #define ENABLE_UHS_DEBUGGING 1
106 ```
107 
108 ### Boards
109 
110 Currently the following boards are supported by the library:
111 
112 * All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.)
113 * Arduino Due, Intel Galileo, Intel Galileo 2, and Intel Edison
114  * Note that the Intel Galileo uses pin 2 and 3 as INT and SS pin respectively by default, so some modifications to the shield are needed. See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information.
115  * Note native USB host is not supported on any of these platforms. You will have to use the shield for now.
116 * Teensy (Teensy++ 1.0, Teensy 2.0, Teensy++ 2.0, Teensy 3.x, and Teensy LC)
117  * Note if you are using the Teensy 3.x you should download this SPI library as well: <https://github.com/xxxajk/spi4teensy3>. You should then add ```#include <spi4teensy3.h>``` to your .ino file.
118 * Balanduino
119 * Sanguino
120 * Black Widdow
121 * RedBearLab nRF51822
122 * Digilent chipKIT
123  * Please see: <http://www.circuitsathome.com/mcu/usb/running-usb-host-code-on-digilent-chipkit-board>.
124 * STM32F4
125  * Currently the [NUCLEO-F446RE](http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF262063) is supported featuring the STM32F446. Take a look at the following example code: <https://github.com/Lauszus/Nucleo_F446RE_USBHost>.
126 * ESP8266 is supported using the [ESP8266 Arduino core](https://github.com/esp8266/Arduino)
127  * Note it uses pin 15 and 5 for SS and INT respectively
128  * Also please be aware that:
129  * GPIO16 is **NOT** usable, as it will be used for some other purposes. For example, reset the SoC itself from sleep mode.
130  * GPIO6 to 11 is also **NOT** usable, as they are used to connect SPI flash chip and it is used for storing the executable binary content.
131 * ESP32 is supported using the [arduino-esp32](https://github.com/espressif/arduino-esp32/)
132  * GPIO5 : SS, GPIO17 : INT, GPIO18 : SCK, GPIO19 : MISO, GPIO23 : MOSI
133 
134 The following boards need to be activated manually in [settings.h](settings.h):
135 
136 * Arduino Mega ADK
137  * If you are using Arduino 1.5.5 or newer there is no need to activate the Arduino Mega ADK manually
138 * Black Widdow
139 
140 Simply set the corresponding value to 1 instead of 0.
141 
142 ### [Bluetooth libraries](BTD.cpp)
143 
144 The [BTD library](BTD.cpp) is a general purpose library for an ordinary Bluetooth dongle.
145 This library make it easy to add support for different Bluetooth services like a PS3 or a Wii controller or SPP which is a virtual serial port via Bluetooth.
146 Some different examples can be found in the [example directory](examples/Bluetooth).
147 
148 The BTD library also makes it possible to use multiple services at once, the following example sketch is an example of this:
149 [PS3SPP.ino](examples/Bluetooth/PS3SPP/PS3SPP.ino).
150 
151 ### [BTHID library](BTHID.cpp)
152 
153 The [Bluetooth HID library](BTHID.cpp) allows you to connect HID devices via Bluetooth to the USB Host Shield.
154 
155 Currently HID mice and keyboards are supported.
156 
157 It uses the standard Boot protocol by default, but it is also able to use the Report protocol as well. You would simply have to call ```setProtocolMode()``` and then parse ```HID_RPT_PROTOCOL``` as an argument. You will then have to modify the parser for your device. See the example: [BTHID.ino](examples/Bluetooth/BTHID/BTHID.ino) for more information.
158 
159 The [PS4 library](#ps4-library) also uses this class to handle all Bluetooth communication.
160 
161 For information see the following blog post: <http://blog.tkjelectronics.dk/2013/12/bluetooth-hid-devices-now-supported-by-the-usb-host-library/>.
162 
163 ### [SPP library](SPP.cpp)
164 
165 SPP stands for "Serial Port Profile" and is a Bluetooth protocol that implements a virtual comport which allows you to send data back and forth from your computer/phone to your Arduino via Bluetooth.
166 It has been tested successfully on Windows, Mac OS X, Linux, and Android.
167 
168 Take a look at the [SPP.ino](examples/Bluetooth/SPP/SPP.ino) example for more information.
169 
170 More information can be found at these blog posts:
171 
172 * <http://www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released>
173 * <http://blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/>
174 
175 To implement the SPP protocol I used a Bluetooth sniffing tool called [PacketLogger](http://www.tkjelectronics.com/uploads/PacketLogger.zip) developed by Apple.
176 It enables me to see the Bluetooth communication between my Mac and any device.
177 
178 ### PS4 Library
179 
180 The PS4BT library is split up into the [PS4BT](PS4BT.h) and the [PS4USB](PS4USB.h) library. These allow you to use the Sony PS4 controller via Bluetooth and USB.
181 
182 The [PS4BT.ino](examples/Bluetooth/PS4BT/PS4BT.ino) and [PS4USB.ino](examples/PS4USB/PS4USB.ino) examples shows how to easily read the buttons, joysticks, touchpad and IMU on the controller via Bluetooth and USB respectively. It is also possible to control the rumble and light on the controller and get the battery level.
183 
184 Before you can use the PS4 controller via Bluetooth you will need to pair with it.
185 
186 Simply create the PS4BT instance like so: ```PS4BT PS4(&Btd, PAIR);``` and then hold down the Share button and then hold down the PS without releasing the Share button. The PS4 controller will then start to blink rapidly indicating that it is in pairing mode.
187 
188 It should then automatically pair the dongle with your controller. This only have to be done once.
189 
190 For information see the following blog post: <http://blog.tkjelectronics.dk/2014/01/ps4-controller-now-supported-by-the-usb-host-library/>.
191 
192 Also check out this excellent Wiki by Frank Zhao about the PS4 controller: <http://eleccelerator.com/wiki/index.php?title=DualShock_4> and this Linux driver: <https://github.com/chrippa/ds4drv>.
193 
194 ### PS3 Library
195 
196 These libraries consist of the [PS3BT](PS3BT.cpp) and [PS3USB](PS3USB.cpp). These libraries allows you to use a Dualshock 3, Navigation or a Motion controller with the USB Host Shield both via Bluetooth and USB.
197 
198 In order to use your Playstation controller via Bluetooth you have to set the Bluetooth address of the dongle internally to your PS3 Controller. This can be achieved by first plugging in the Bluetooth dongle and wait a few seconds. Now plug in the controller via USB and wait until the LEDs start to flash. The library has now written the Bluetooth address of the dongle to the PS3 controller.
199 
200 Finally simply plug in the Bluetooth dongle again and press PS on the PS3 controller. After a few seconds it should be connected to the dongle and ready to use.
201 
202 __Note:__ You will have to plug in the Bluetooth dongle before connecting the controller, as the library needs to read the address of the dongle. Alternatively you could set it in code like so: [PS3BT.ino#L20](examples/Bluetooth/PS3BT/PS3BT.ino#L20).
203 
204 For more information about the PS3 protocol see the official wiki: <https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information>.
205 
206 Also take a look at the blog posts:
207 
208 * <http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/>
209 * <http://www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library>
210 * <http://www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb>
211 
212 A special thanks go to the following people:
213 
214 1. _Richard Ibbotson_ who made this excellent guide: <http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part>
215 2. _Tomoyuki Tanaka_ for releasing his code for the Arduino USB Host shield connected to the wiimote: <http://www.circuitsathome.com/mcu/rc-car-controlled-by-wii-remote-on-arduino>
216 
217 Also a big thanks all the people behind these sites about the Motion controller:
218 
219 * <http://thp.io/2010/psmove/>
220 * <http://www.copenhagengamecollective.org/unimove/>
221 * <https://github.com/thp/psmoveapi>
222 * <http://code.google.com/p/moveonpc/>
223 
224 ### Xbox Libraries
225 
226 The library supports both the original Xbox controller via USB and the Xbox 360 controller both via USB and wirelessly.
227 
228 #### Xbox library
229 
230 The [XBOXOLD](XBOXOLD.cpp) class implements support for the original Xbox controller via USB.
231 
232 All the information are from the following sites:
233 
234 * <https://github.com/torvalds/linux/blob/master/Documentation/input/xpad.txt>
235 * <https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c>
236 * <http://euc.jp/periphs/xbox-controller.ja.html>
237 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL#L15>
238 
239 #### Xbox 360 Library
240 
241 The library support one Xbox 360 via USB or up to four Xbox 360 controllers wirelessly by using a [Xbox 360 wireless receiver](http://blog.tkjelectronics.dk/wp-content/uploads/xbox360-wireless-receiver.jpg).
242 
243 To use it via USB use the [XBOXUSB](XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](XBOXRECV.cpp) library.
244 
245 __Note that a Wireless controller can NOT be used via USB!__
246 
247 Examples code can be found in the [examples directory](examples/Xbox).
248 
249 Also see the following blog posts:
250 
251 * <http://www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library>
252 * <http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/>
253 * <http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/>
254 
255 All the information regarding the Xbox 360 controller protocol are form these sites:
256 
257 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo>
258 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo>
259 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL>
260 
261 #### Xbox ONE Library
262 
263 An Xbox ONE controller is supported via USB in the [XBOXONE](XBOXONE.cpp) class. It is heavily based on the 360 library above. In addition to cross referencing the above, information on the protocol was found at:
264 
265 * <https://github.com/quantus/xbox-one-controller-protocol>
266 * <https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c>
267 * <https://github.com/kylelemons/xbox/blob/master/xbox.go>
268 
269 ### [Wii library](Wii.cpp)
270 
271 The [Wii](Wii.cpp) library support the Wiimote, but also the Nunchuch and Motion Plus extensions via Bluetooth. The Wii U Pro Controller and Wii Balance Board are also supported via Bluetooth.
272 
273 First you have to pair with the controller, this is done automatically by the library if you create the instance like so:
274 
275 ```C++
276 WII Wii(&Btd, PAIR);
277 ```
278 
279 And then press 1 & 2 at once on the Wiimote or the SYNC buttons if you are using a Wii U Pro Controller or a Wii Balance Board.
280 
281 After that you can simply create the instance like so:
282 
283 ```C++
284 WII Wii(&Btd);
285 ```
286 
287 Then just press any button on the Wiimote and it will then connect to the dongle.
288 
289 Take a look at the example for more information: [Wii.ino](examples/Bluetooth/Wii/Wii.ino).
290 
291 Also take a look at the blog post:
292 
293 * <http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/>
294 
295 The Wii IR camera can also be used, but you will have to activate the code for it manually as it is quite large. Simply set ```ENABLE_WII_IR_CAMERA``` to 1 in [settings.h](settings.h).
296 
297 The [WiiIRCamera.ino](examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino) example shows how it can be used.
298 
299 All the information about the Wii controllers are from these sites:
300 
301 * <http://wiibrew.org/wiki/Wiimote>
302 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers>
303 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck>
304 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus>
305 * <http://wiibrew.org/wiki/Wii_Balance_Board>
306 * The old library created by _Tomoyuki Tanaka_: <https://github.com/moyuchin/WiiRemote_on_Arduino> also helped a lot.
307 
308 ### [PS Buzz Library](PSBuzz.cpp)
309 
310 This library implements support for the Playstation Buzz controllers via USB.
311 
312 It is essentially just a wrapper around the [HIDUniversal](hiduniversal.cpp) which takes care of the initializing and reading of the controllers. The [PSBuzz](PSBuzz.cpp) class simply inherits this and parses the data, so it is easy for users to read the buttons and turn the big red button on the controllers on and off.
313 
314 The example [PSBuzz.ino](examples/PSBuzz/PSBuzz.ino) shows how one can do this with just a few lines of code.
315 
316 More information about the controller can be found at the following sites:
317 
318 * http://www.developerfusion.com/article/84338/making-usb-c-friendly/
319 * https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c
320 
321 ### HID Libraries
322 
323 HID devices are also supported by the library. However these require you to write your own driver. A few example are provided in the [examples/HID](examples/HID) directory. Including an example for the [SteelSeries SRW-S1 Steering Wheel](examples/HID/SRWS1/SRWS1.ino).
324 
325 ### [MIDI Library](usbh_midi.cpp)
326 
327 The library support MIDI devices.
328 You can convert USB MIDI keyboard to legacy serial MIDI.
329 
330 * [USB_MIDI_converter.ino](examples/USBH_MIDI/USB_MIDI_converter/USB_MIDI_converter.ino)
331 * [USB_MIDI_converter_multi.ino](examples/USBH_MIDI/USB_MIDI_converter_multi/USB_MIDI_converter_multi.ino)
332 
333 For information see the following page: <http://yuuichiakagawa.github.io/USBH_MIDI/>.
334 
335 # Interface modifications
336 
337 The shield is using SPI for communicating with the MAX3421E USB host controller. It uses the SCK, MISO and MOSI pins via the ICSP on your board.
338 
339 Note this means that it uses pin 13, 12, 11 on an Arduino Uno, so these pins can not be used for anything else than SPI communication!
340 
341 Furthermore it uses one pin as SS and one INT pin. These are by default located on pin 10 and 9 respectively. They can easily be reconfigured in case you need to use them for something else by cutting the jumper on the shield and then solder a wire from the pad to the new pin.
342 
343 After that you need modify the following entry in [UsbCore.h](UsbCore.h):
344 
345 ```C++
346 typedef MAX3421e<P10, P9> MAX3421E;
347 ```
348 
349 For instance if you have rerouted SS to pin 7 it should read:
350 
351 ```C++
352 typedef MAX3421e<P7, P9> MAX3421E;
353 ```
354 
355 See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information.
356 
357 # FAQ
358 
359 > When I plug my device into the USB connector nothing happens?
360 
361 * Try to connect a external power supply to the Arduino - this solves the problem in most cases.
362 * You can also use a powered hub between the device and the USB Host Shield. You should then include the USB hub library: ```#include <usbhub.h>``` and create the instance like so: ```USBHub Hub1(&Usb);```.
363 
364 > When I connecting my PS3 controller I get a output like this:
365 
366 ```
367 Dualshock 3 Controller Enabled
368 
369 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
370 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
371 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
372 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
373 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
374 ```
375 
376 * This means that your dongle does not support 2.0+EDR, so you will need another dongle. Please see the following [list](https://github.com/felis/USB_Host_Shield_2.0/wiki/Bluetooth-dongles) for tested working dongles.
377 
378 > When compiling I am getting the following error: "fatal error: SPI.h: No such file or directory".
379 
380 * Please make sure to include the SPI library like so: ```#include <SPI.h>``` in your .ino file.
diff --git a/_s_p_p_8cpp.html b/_s_p_p_8cpp.html index 9e3f6c63..4c79b845 100644 --- a/_s_p_p_8cpp.html +++ b/_s_p_p_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: SPP.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
 

Variable Documentation

- + +

◆ rfcomm_crc_table

+
@@ -124,7 +106,7 @@ Variables
Initial value:
= {
0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B,
0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84, 0xF6, 0x67,
0x38, 0xA9, 0xDB, 0x4A, 0x3F, 0xAE, 0xDC, 0x4D, 0x36, 0xA7, 0xD5, 0x44, 0x31, 0xA0, 0xD2, 0x43,
0x24, 0xB5, 0xC7, 0x56, 0x23, 0xB2, 0xC0, 0x51, 0x2A, 0xBB, 0xC9, 0x58, 0x2D, 0xBC, 0xCE, 0x5F,
0x70, 0xE1, 0x93, 0x02, 0x77, 0xE6, 0x94, 0x05, 0x7E, 0xEF, 0x9D, 0x0C, 0x79, 0xE8, 0x9A, 0x0B,
0x6C, 0xFD, 0x8F, 0x1E, 0x6B, 0xFA, 0x88, 0x19, 0x62, 0xF3, 0x81, 0x10, 0x65, 0xF4, 0x86, 0x17,
0x48, 0xD9, 0xAB, 0x3A, 0x4F, 0xDE, 0xAC, 0x3D, 0x46, 0xD7, 0xA5, 0x34, 0x41, 0xD0, 0xA2, 0x33,
0x54, 0xC5, 0xB7, 0x26, 0x53, 0xC2, 0xB0, 0x21, 0x5A, 0xCB, 0xB9, 0x28, 0x5D, 0xCC, 0xBE, 0x2F,
0xE0, 0x71, 0x03, 0x92, 0xE7, 0x76, 0x04, 0x95, 0xEE, 0x7F, 0x0D, 0x9C, 0xE9, 0x78, 0x0A, 0x9B,
0xFC, 0x6D, 0x1F, 0x8E, 0xFB, 0x6A, 0x18, 0x89, 0xF2, 0x63, 0x11, 0x80, 0xF5, 0x64, 0x16, 0x87,
0xD8, 0x49, 0x3B, 0xAA, 0xDF, 0x4E, 0x3C, 0xAD, 0xD6, 0x47, 0x35, 0xA4, 0xD1, 0x40, 0x32, 0xA3,
0xC4, 0x55, 0x27, 0xB6, 0xC3, 0x52, 0x20, 0xB1, 0xCA, 0x5B, 0x29, 0xB8, 0xCD, 0x5C, 0x2E, 0xBF,
0x90, 0x01, 0x73, 0xE2, 0x97, 0x06, 0x74, 0xE5, 0x9E, 0x0F, 0x7D, 0xEC, 0x99, 0x08, 0x7A, 0xEB,
0x8C, 0x1D, 0x6F, 0xFE, 0x8B, 0x1A, 0x68, 0xF9, 0x82, 0x13, 0x61, 0xF0, 0x85, 0x14, 0x66, 0xF7,
0xA8, 0x39, 0x4B, 0xDA, 0xAF, 0x3E, 0x4C, 0xDD, 0xA6, 0x37, 0x45, 0xD4, 0xA1, 0x30, 0x42, 0xD3,
0xB4, 0x25, 0x57, 0xC6, 0xB3, 0x22, 0x50, 0xC1, 0xBA, 0x2B, 0x59, 0xC8, 0xBD, 0x2C, 0x5E, 0xCF
}
-

Definition at line 26 of file SPP.cpp.

+

Definition at line 26 of file SPP.cpp.

@@ -133,7 +115,7 @@ Variables diff --git a/_s_p_p_8cpp__incl.md5 b/_s_p_p_8cpp__incl.md5 index 2e490ec2..48f872c1 100644 --- a/_s_p_p_8cpp__incl.md5 +++ b/_s_p_p_8cpp__incl.md5 @@ -1 +1 @@ -13ec96c550e18a5b87013a932cc6a9c2 \ No newline at end of file +b9aa79f21f664e4fd1d522234b09e828 \ No newline at end of file diff --git a/_s_p_p_8cpp__incl.png b/_s_p_p_8cpp__incl.png index d9bb31f2..edb7b346 100644 Binary files a/_s_p_p_8cpp__incl.png and b/_s_p_p_8cpp__incl.png differ diff --git a/_s_p_p_8cpp_source.html b/_s_p_p_8cpp_source.html index e44c9806..76cd2647 100644 --- a/_s_p_p_8cpp_source.html +++ b/_s_p_p_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: SPP.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
SPP.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "SPP.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report sent to the Arduino
22 
23 /*
24  * CRC (reversed crc) lookup table as calculated by the table generator in ETSI TS 101 369 V6.3.0.
25  */
26 const uint8_t rfcomm_crc_table[256] PROGMEM = {/* reversed, 8-bit, poly=0x07 */
27  0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B,
28  0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84, 0xF6, 0x67,
29  0x38, 0xA9, 0xDB, 0x4A, 0x3F, 0xAE, 0xDC, 0x4D, 0x36, 0xA7, 0xD5, 0x44, 0x31, 0xA0, 0xD2, 0x43,
30  0x24, 0xB5, 0xC7, 0x56, 0x23, 0xB2, 0xC0, 0x51, 0x2A, 0xBB, 0xC9, 0x58, 0x2D, 0xBC, 0xCE, 0x5F,
31  0x70, 0xE1, 0x93, 0x02, 0x77, 0xE6, 0x94, 0x05, 0x7E, 0xEF, 0x9D, 0x0C, 0x79, 0xE8, 0x9A, 0x0B,
32  0x6C, 0xFD, 0x8F, 0x1E, 0x6B, 0xFA, 0x88, 0x19, 0x62, 0xF3, 0x81, 0x10, 0x65, 0xF4, 0x86, 0x17,
33  0x48, 0xD9, 0xAB, 0x3A, 0x4F, 0xDE, 0xAC, 0x3D, 0x46, 0xD7, 0xA5, 0x34, 0x41, 0xD0, 0xA2, 0x33,
34  0x54, 0xC5, 0xB7, 0x26, 0x53, 0xC2, 0xB0, 0x21, 0x5A, 0xCB, 0xB9, 0x28, 0x5D, 0xCC, 0xBE, 0x2F,
35  0xE0, 0x71, 0x03, 0x92, 0xE7, 0x76, 0x04, 0x95, 0xEE, 0x7F, 0x0D, 0x9C, 0xE9, 0x78, 0x0A, 0x9B,
36  0xFC, 0x6D, 0x1F, 0x8E, 0xFB, 0x6A, 0x18, 0x89, 0xF2, 0x63, 0x11, 0x80, 0xF5, 0x64, 0x16, 0x87,
37  0xD8, 0x49, 0x3B, 0xAA, 0xDF, 0x4E, 0x3C, 0xAD, 0xD6, 0x47, 0x35, 0xA4, 0xD1, 0x40, 0x32, 0xA3,
38  0xC4, 0x55, 0x27, 0xB6, 0xC3, 0x52, 0x20, 0xB1, 0xCA, 0x5B, 0x29, 0xB8, 0xCD, 0x5C, 0x2E, 0xBF,
39  0x90, 0x01, 0x73, 0xE2, 0x97, 0x06, 0x74, 0xE5, 0x9E, 0x0F, 0x7D, 0xEC, 0x99, 0x08, 0x7A, 0xEB,
40  0x8C, 0x1D, 0x6F, 0xFE, 0x8B, 0x1A, 0x68, 0xF9, 0x82, 0x13, 0x61, 0xF0, 0x85, 0x14, 0x66, 0xF7,
41  0xA8, 0x39, 0x4B, 0xDA, 0xAF, 0x3E, 0x4C, 0xDD, 0xA6, 0x37, 0x45, 0xD4, 0xA1, 0x30, 0x42, 0xD3,
42  0xB4, 0x25, 0x57, 0xC6, 0xB3, 0x22, 0x50, 0xC1, 0xBA, 0x2B, 0x59, 0xC8, 0xBD, 0x2C, 0x5E, 0xCF
43 };
44 
45 SPP::SPP(BTD *p, const char* name, const char* pin) :
46 BluetoothService(p) // Pointer to BTD class instance - mandatory
47 {
48  pBtd->btdName = name;
49  pBtd->btdPin = pin;
50 
51  /* Set device cid for the SDP and RFCOMM channelse */
52  sdp_dcid[0] = 0x50; // 0x0050
53  sdp_dcid[1] = 0x00;
54  rfcomm_dcid[0] = 0x51; // 0x0051
55  rfcomm_dcid[1] = 0x00;
56 
57  Reset();
58 }
59 
60 void SPP::Reset() {
61  connected = false;
62  RFCOMMConnected = false;
63  SDPConnected = false;
64  waitForLastCommand = false;
65  l2cap_sdp_state = L2CAP_SDP_WAIT;
66  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
67  l2cap_event_flag = 0;
68  sppIndex = 0;
69  creditSent = false;
70 }
71 
73  connected = false;
74  // First the two L2CAP channels has to be disconnected and then the HCI connection
75  if(RFCOMMConnected)
76  pBtd->l2cap_disconnection_request(hci_handle, ++identifier, rfcomm_scid, rfcomm_dcid);
77  if(RFCOMMConnected && SDPConnected)
78  delay(1); // Add delay between commands
79  if(SDPConnected)
80  pBtd->l2cap_disconnection_request(hci_handle, ++identifier, sdp_scid, sdp_dcid);
81  l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE;
82 }
83 
84 void SPP::ACLData(uint8_t* l2capinbuf) {
85  if(!connected) {
86  if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
87  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == SDP_PSM && !pBtd->sdpConnectionClaimed) {
88  pBtd->sdpConnectionClaimed = true;
89  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
90  l2cap_sdp_state = L2CAP_SDP_WAIT; // Reset state
91  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == RFCOMM_PSM && !pBtd->rfcommConnectionClaimed) {
93  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
94  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT; // Reset state
95  }
96  }
97  }
98 
99  if(checkHciHandle(l2capinbuf, hci_handle)) { // acl_handle_ok
100  if((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001U) { // l2cap_control - Channel ID for ACL-U
101  if(l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
102 #ifdef DEBUG_USB_HOST
103  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
104  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
105  Notify(PSTR(" "), 0x80);
106  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
107  Notify(PSTR(" Data: "), 0x80);
108  D_PrintHex<uint8_t > (l2capinbuf[17], 0x80);
109  Notify(PSTR(" "), 0x80);
110  D_PrintHex<uint8_t > (l2capinbuf[16], 0x80);
111  Notify(PSTR(" "), 0x80);
112  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
113  Notify(PSTR(" "), 0x80);
114  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
115 #endif
116  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
117 #ifdef EXTRADEBUG
118  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
119  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
120  Notify(PSTR(" "), 0x80);
121  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
122  Notify(PSTR(" SCID: "), 0x80);
123  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
124  Notify(PSTR(" "), 0x80);
125  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
126  Notify(PSTR(" Identifier: "), 0x80);
127  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
128 #endif
129  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == SDP_PSM) { // It doesn't matter if it receives another reqeust, since it waits for the channel to disconnect in the L2CAP_SDP_DONE state, and the l2cap_event_flag will be cleared if so
130  identifier = l2capinbuf[9];
131  sdp_scid[0] = l2capinbuf[14];
132  sdp_scid[1] = l2capinbuf[15];
134  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == RFCOMM_PSM) { // ----- || -----
135  identifier = l2capinbuf[9];
136  rfcomm_scid[0] = l2capinbuf[14];
137  rfcomm_scid[1] = l2capinbuf[15];
139  }
140  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
141  if((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
142  if(l2capinbuf[12] == sdp_dcid[0] && l2capinbuf[13] == sdp_dcid[1]) {
143  //Notify(PSTR("\r\nSDP Configuration Complete"), 0x80);
145  } else if(l2capinbuf[12] == rfcomm_dcid[0] && l2capinbuf[13] == rfcomm_dcid[1]) {
146  //Notify(PSTR("\r\nRFCOMM Configuration Complete"), 0x80);
148  }
149  }
150  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
151  if(l2capinbuf[12] == sdp_dcid[0] && l2capinbuf[13] == sdp_dcid[1]) {
152  //Notify(PSTR("\r\nSDP Configuration Request"), 0x80);
153  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], sdp_scid);
154  } else if(l2capinbuf[12] == rfcomm_dcid[0] && l2capinbuf[13] == rfcomm_dcid[1]) {
155  //Notify(PSTR("\r\nRFCOMM Configuration Request"), 0x80);
156  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], rfcomm_scid);
157  }
158  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
159  if(l2capinbuf[12] == sdp_dcid[0] && l2capinbuf[13] == sdp_dcid[1]) {
160  //Notify(PSTR("\r\nDisconnect Request: SDP Channel"), 0x80);
161  identifier = l2capinbuf[9];
163  } else if(l2capinbuf[12] == rfcomm_dcid[0] && l2capinbuf[13] == rfcomm_dcid[1]) {
164  //Notify(PSTR("\r\nDisconnect Request: RFCOMM Channel"), 0x80);
165  identifier = l2capinbuf[9];
167  }
168  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_RESPONSE) {
169  if(l2capinbuf[12] == sdp_scid[0] && l2capinbuf[13] == sdp_scid[1]) {
170  //Notify(PSTR("\r\nDisconnect Response: SDP Channel"), 0x80);
171  identifier = l2capinbuf[9];
173  } else if(l2capinbuf[12] == rfcomm_scid[0] && l2capinbuf[13] == rfcomm_scid[1]) {
174  //Notify(PSTR("\r\nDisconnect Response: RFCOMM Channel"), 0x80);
175  identifier = l2capinbuf[9];
177  }
178  } else if(l2capinbuf[8] == L2CAP_CMD_INFORMATION_REQUEST) {
179 #ifdef DEBUG_USB_HOST
180  Notify(PSTR("\r\nInformation request"), 0x80);
181 #endif
182  identifier = l2capinbuf[9];
183  pBtd->l2cap_information_response(hci_handle, identifier, l2capinbuf[12], l2capinbuf[13]);
184  }
185 #ifdef EXTRADEBUG
186  else {
187  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
188  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
189  }
190 #endif
191  } else if(l2capinbuf[6] == sdp_dcid[0] && l2capinbuf[7] == sdp_dcid[1]) { // SDP
192  if(l2capinbuf[8] == SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST_PDU) {
193  if(((l2capinbuf[16] << 8 | l2capinbuf[17]) == SERIALPORT_UUID) || ((l2capinbuf[16] << 8 | l2capinbuf[17]) == 0x0000 && (l2capinbuf[18] << 8 | l2capinbuf[19]) == SERIALPORT_UUID)) { // Check if it's sending the full UUID, see: https://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm, we will just check the first four bytes
194  if(firstMessage) {
195  serialPortResponse1(l2capinbuf[9], l2capinbuf[10]);
196  firstMessage = false;
197  } else {
198  serialPortResponse2(l2capinbuf[9], l2capinbuf[10]); // Serialport continuation state
199  firstMessage = true;
200  }
201  } else if(((l2capinbuf[16] << 8 | l2capinbuf[17]) == L2CAP_UUID) || ((l2capinbuf[16] << 8 | l2capinbuf[17]) == 0x0000 && (l2capinbuf[18] << 8 | l2capinbuf[19]) == L2CAP_UUID)) {
202  if(firstMessage) {
203  l2capResponse1(l2capinbuf[9], l2capinbuf[10]);
204  firstMessage = false;
205  } else {
206  l2capResponse2(l2capinbuf[9], l2capinbuf[10]); // L2CAP continuation state
207  firstMessage = true;
208  }
209  } else
210  serviceNotSupported(l2capinbuf[9], l2capinbuf[10]); // The service is not supported
211 #ifdef EXTRADEBUG
212  Notify(PSTR("\r\nUUID: "), 0x80);
213  uint16_t uuid;
214  if((l2capinbuf[16] << 8 | l2capinbuf[17]) == 0x0000) // Check if it's sending the UUID as a 128-bit UUID
215  uuid = (l2capinbuf[18] << 8 | l2capinbuf[19]);
216  else // Short UUID
217  uuid = (l2capinbuf[16] << 8 | l2capinbuf[17]);
218  D_PrintHex<uint16_t > (uuid, 0x80);
219 
220  Notify(PSTR("\r\nLength: "), 0x80);
221  uint16_t length = l2capinbuf[11] << 8 | l2capinbuf[12];
222  D_PrintHex<uint16_t > (length, 0x80);
223  Notify(PSTR("\r\nData: "), 0x80);
224  for(uint8_t i = 0; i < length; i++) {
225  D_PrintHex<uint8_t > (l2capinbuf[13 + i], 0x80);
226  Notify(PSTR(" "), 0x80);
227  }
228 #endif
229  }
230 #ifdef EXTRADEBUG
231  else {
232  Notify(PSTR("\r\nUnknown PDU: "), 0x80);
233  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
234  }
235 #endif
236  } else if(l2capinbuf[6] == rfcomm_dcid[0] && l2capinbuf[7] == rfcomm_dcid[1]) { // RFCOMM
237  rfcommChannel = l2capinbuf[8] & 0xF8;
238  rfcommDirection = l2capinbuf[8] & 0x04;
239  rfcommCommandResponse = l2capinbuf[8] & 0x02;
240  rfcommChannelType = l2capinbuf[9] & 0xEF;
241  rfcommPfBit = l2capinbuf[9] & 0x10;
242 
243  if(rfcommChannel >> 3 != 0x00)
244  rfcommChannelConnection = rfcommChannel;
245 
246 #ifdef EXTRADEBUG
247  Notify(PSTR("\r\nRFCOMM Channel: "), 0x80);
248  D_PrintHex<uint8_t > (rfcommChannel >> 3, 0x80);
249  Notify(PSTR(" Direction: "), 0x80);
250  D_PrintHex<uint8_t > (rfcommDirection >> 2, 0x80);
251  Notify(PSTR(" CommandResponse: "), 0x80);
252  D_PrintHex<uint8_t > (rfcommCommandResponse >> 1, 0x80);
253  Notify(PSTR(" ChannelType: "), 0x80);
254  D_PrintHex<uint8_t > (rfcommChannelType, 0x80);
255  Notify(PSTR(" PF_BIT: "), 0x80);
256  D_PrintHex<uint8_t > (rfcommPfBit, 0x80);
257 #endif
258  if(rfcommChannelType == RFCOMM_DISC) {
259 #ifdef DEBUG_USB_HOST
260  Notify(PSTR("\r\nReceived Disconnect RFCOMM Command on channel: "), 0x80);
261  D_PrintHex<uint8_t > (rfcommChannel >> 3, 0x80);
262 #endif
263  connected = false;
264  sendRfcomm(rfcommChannel, rfcommDirection, rfcommCommandResponse, RFCOMM_UA, rfcommPfBit, rfcommbuf, 0x00); // UA Command
265  }
266  if(connected) {
267  /* Read the incoming message */
268  if(rfcommChannelType == RFCOMM_UIH && rfcommChannel == rfcommChannelConnection) {
269  uint8_t length = l2capinbuf[10] >> 1; // Get length
270  uint8_t offset = l2capinbuf[4] - length - 4; // Check if there is credit
271  if(checkFcs(&l2capinbuf[8], l2capinbuf[11 + length + offset])) {
272  uint8_t i = 0;
273  for(; i < length; i++) {
274  if(rfcommAvailable + i >= sizeof (rfcommDataBuffer)) {
275 #ifdef DEBUG_USB_HOST
276  Notify(PSTR("\r\nWarning: Buffer is full!"), 0x80);
277 #endif
278  break;
279  }
280  rfcommDataBuffer[rfcommAvailable + i] = l2capinbuf[11 + i + offset];
281  }
282  rfcommAvailable += i;
283 #ifdef EXTRADEBUG
284  Notify(PSTR("\r\nRFCOMM Data Available: "), 0x80);
285  Notify(rfcommAvailable, 0x80);
286  if(offset) {
287  Notify(PSTR(" - Credit: 0x"), 0x80);
288  D_PrintHex<uint8_t > (l2capinbuf[11], 0x80);
289  }
290 #endif
291  }
292 #ifdef DEBUG_USB_HOST
293  else
294  Notify(PSTR("\r\nError in FCS checksum!"), 0x80);
295 #endif
296 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send to the Arduino via Bluetooth
297  for(uint8_t i = 0; i < length; i++)
298  Notifyc(l2capinbuf[i + 11 + offset], 0x80);
299 #endif
300  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_RPN_CMD) { // UIH Remote Port Negotiation Command
301 #ifdef DEBUG_USB_HOST
302  Notify(PSTR("\r\nReceived UIH Remote Port Negotiation Command"), 0x80);
303 #endif
304  rfcommbuf[0] = BT_RFCOMM_RPN_RSP; // Command
305  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
306  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
307  rfcommbuf[3] = l2capinbuf[14]; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
308  rfcommbuf[4] = l2capinbuf[15]; // Priority
309  rfcommbuf[5] = l2capinbuf[16]; // Timer
310  rfcommbuf[6] = l2capinbuf[17]; // Max Fram Size LSB
311  rfcommbuf[7] = l2capinbuf[18]; // Max Fram Size MSB
312  rfcommbuf[8] = l2capinbuf[19]; // MaxRatransm.
313  rfcommbuf[9] = l2capinbuf[20]; // Number of Frames
314  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A); // UIH Remote Port Negotiation Response
315  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_CMD) { // UIH Modem Status Command
316 #ifdef DEBUG_USB_HOST
317  Notify(PSTR("\r\nSend UIH Modem Status Response"), 0x80);
318 #endif
319  rfcommbuf[0] = BT_RFCOMM_MSC_RSP; // UIH Modem Status Response
320  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
321  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
322  rfcommbuf[3] = l2capinbuf[14];
323  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
324  }
325  } else {
326  if(rfcommChannelType == RFCOMM_SABM) { // SABM Command - this is sent twice: once for channel 0 and then for the channel to establish
327 #ifdef DEBUG_USB_HOST
328  Notify(PSTR("\r\nReceived SABM Command"), 0x80);
329 #endif
330  sendRfcomm(rfcommChannel, rfcommDirection, rfcommCommandResponse, RFCOMM_UA, rfcommPfBit, rfcommbuf, 0x00); // UA Command
331  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_PN_CMD) { // UIH Parameter Negotiation Command
332 #ifdef DEBUG_USB_HOST
333  Notify(PSTR("\r\nReceived UIH Parameter Negotiation Command"), 0x80);
334 #endif
335  rfcommbuf[0] = BT_RFCOMM_PN_RSP; // UIH Parameter Negotiation Response
336  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
337  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
338  rfcommbuf[3] = 0xE0; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
339  rfcommbuf[4] = 0x00; // Priority
340  rfcommbuf[5] = 0x00; // Timer
341  rfcommbuf[6] = BULK_MAXPKTSIZE - 14; // Max Fram Size LSB - set to the size of received data (50)
342  rfcommbuf[7] = 0x00; // Max Fram Size MSB
343  rfcommbuf[8] = 0x00; // MaxRatransm.
344  rfcommbuf[9] = 0x00; // Number of Frames
345  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A);
346  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_CMD) { // UIH Modem Status Command
347 #ifdef DEBUG_USB_HOST
348  Notify(PSTR("\r\nSend UIH Modem Status Response"), 0x80);
349 #endif
350  rfcommbuf[0] = BT_RFCOMM_MSC_RSP; // UIH Modem Status Response
351  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
352  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
353  rfcommbuf[3] = l2capinbuf[14];
354  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
355 
356  delay(1);
357 #ifdef DEBUG_USB_HOST
358  Notify(PSTR("\r\nSend UIH Modem Status Command"), 0x80);
359 #endif
360  rfcommbuf[0] = BT_RFCOMM_MSC_CMD; // UIH Modem Status Command
361  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
362  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
363  rfcommbuf[3] = 0x8D; // Can receive frames (YES), Ready to Communicate (YES), Ready to Receive (YES), Incomig Call (NO), Data is Value (YES)
364 
365  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
366  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_RSP) { // UIH Modem Status Response
367  if(!creditSent) {
368 #ifdef DEBUG_USB_HOST
369  Notify(PSTR("\r\nSend UIH Command with credit"), 0x80);
370 #endif
371  sendRfcommCredit(rfcommChannelConnection, rfcommDirection, 0, RFCOMM_UIH, 0x10, sizeof (rfcommDataBuffer)); // Send credit
372  creditSent = true;
373  timer = millis();
374  waitForLastCommand = true;
375  }
376  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[10] == 0x01) { // UIH Command with credit
377 #ifdef DEBUG_USB_HOST
378  Notify(PSTR("\r\nReceived UIH Command with credit"), 0x80);
379 #endif
380  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_RPN_CMD) { // UIH Remote Port Negotiation Command
381 #ifdef DEBUG_USB_HOST
382  Notify(PSTR("\r\nReceived UIH Remote Port Negotiation Command"), 0x80);
383 #endif
384  rfcommbuf[0] = BT_RFCOMM_RPN_RSP; // Command
385  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
386  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
387  rfcommbuf[3] = l2capinbuf[14]; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
388  rfcommbuf[4] = l2capinbuf[15]; // Priority
389  rfcommbuf[5] = l2capinbuf[16]; // Timer
390  rfcommbuf[6] = l2capinbuf[17]; // Max Fram Size LSB
391  rfcommbuf[7] = l2capinbuf[18]; // Max Fram Size MSB
392  rfcommbuf[8] = l2capinbuf[19]; // MaxRatransm.
393  rfcommbuf[9] = l2capinbuf[20]; // Number of Frames
394  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A); // UIH Remote Port Negotiation Response
395 #ifdef DEBUG_USB_HOST
396  Notify(PSTR("\r\nRFCOMM Connection is now established\r\n"), 0x80);
397 #endif
398  onInit();
399  }
400 #ifdef EXTRADEBUG
401  else if(rfcommChannelType != RFCOMM_DISC) {
402  Notify(PSTR("\r\nUnsupported RFCOMM Data - ChannelType: "), 0x80);
403  D_PrintHex<uint8_t > (rfcommChannelType, 0x80);
404  Notify(PSTR(" Command: "), 0x80);
405  D_PrintHex<uint8_t > (l2capinbuf[11], 0x80);
406  }
407 #endif
408  }
409  }
410 #ifdef EXTRADEBUG
411  else {
412  Notify(PSTR("\r\nUnsupported L2CAP Data - Channel ID: "), 0x80);
413  D_PrintHex<uint8_t > (l2capinbuf[7], 0x80);
414  Notify(PSTR(" "), 0x80);
415  D_PrintHex<uint8_t > (l2capinbuf[6], 0x80);
416  }
417 #endif
418  SDP_task();
419  RFCOMM_task();
420  }
421 }
422 
423 void SPP::Run() {
424  if(waitForLastCommand && (millis() - timer) > 100) { // We will only wait 100ms and see if the UIH Remote Port Negotiation Command is send, as some deviced don't send it
425 #ifdef DEBUG_USB_HOST
426  Notify(PSTR("\r\nRFCOMM Connection is now established - Automatic\r\n"), 0x80);
427 #endif
428  onInit();
429  }
430  send(); // Send all bytes currently in the buffer
431 }
432 
433 void SPP::onInit() {
434  creditSent = false;
435  waitForLastCommand = false;
436  connected = true; // The RFCOMM channel is now established
437  sppIndex = 0;
438  if(pFuncOnInit)
439  pFuncOnInit(); // Call the user function
440 };
441 
442 void SPP::SDP_task() {
443  switch(l2cap_sdp_state) {
444  case L2CAP_SDP_WAIT:
447 #ifdef DEBUG_USB_HOST
448  Notify(PSTR("\r\nSDP Incoming Connection Request"), 0x80);
449 #endif
451  delay(1);
453  identifier++;
454  delay(1);
456  l2cap_sdp_state = L2CAP_SDP_SUCCESS;
459  SDPConnected = false;
460 #ifdef DEBUG_USB_HOST
461  Notify(PSTR("\r\nDisconnected SDP Channel"), 0x80);
462 #endif
464  }
465  break;
466  case L2CAP_SDP_SUCCESS:
469 #ifdef DEBUG_USB_HOST
470  Notify(PSTR("\r\nSDP Successfully Configured"), 0x80);
471 #endif
472  firstMessage = true; // Reset bool
473  SDPConnected = true;
474  l2cap_sdp_state = L2CAP_SDP_WAIT;
475  }
476  break;
477 
478  case L2CAP_DISCONNECT_RESPONSE: // This is for both disconnection response from the RFCOMM and SDP channel if they were connected
480 #ifdef DEBUG_USB_HOST
481  Notify(PSTR("\r\nDisconnected L2CAP Connection"), 0x80);
482 #endif
484  hci_handle = -1; // Reset handle
485  Reset();
486  }
487  break;
488  }
489 }
490 
491 void SPP::RFCOMM_task() {
492  switch(l2cap_rfcomm_state) {
493  case L2CAP_RFCOMM_WAIT:
496 #ifdef DEBUG_USB_HOST
497  Notify(PSTR("\r\nRFCOMM Incoming Connection Request"), 0x80);
498 #endif
499  pBtd->l2cap_connection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid, PENDING);
500  delay(1);
501  pBtd->l2cap_connection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid, SUCCESSFUL);
502  identifier++;
503  delay(1);
505  l2cap_rfcomm_state = L2CAP_RFCOMM_SUCCESS;
508  RFCOMMConnected = false;
509  connected = false;
510 #ifdef DEBUG_USB_HOST
511  Notify(PSTR("\r\nDisconnected RFCOMM Channel"), 0x80);
512 #endif
513  pBtd->l2cap_disconnection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid);
514  }
515  break;
519 #ifdef DEBUG_USB_HOST
520  Notify(PSTR("\r\nRFCOMM Successfully Configured"), 0x80);
521 #endif
522  rfcommAvailable = 0; // Reset number of bytes available
523  bytesRead = 0; // Reset number of bytes received
524  RFCOMMConnected = true;
525  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
526  }
527  break;
528  }
529 }
530 /************************************************************/
531 /* SDP Commands */
532 
533 /************************************************************/
534 void SPP::SDP_Command(uint8_t* data, uint8_t nbytes) { // See page 223 in the Bluetooth specs
535  pBtd->L2CAP_Command(hci_handle, data, nbytes, sdp_scid[0], sdp_scid[1]);
536 }
537 
538 void SPP::serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow) { // See page 235 in the Bluetooth specs
540  l2capoutbuf[1] = transactionIDHigh;
541  l2capoutbuf[2] = transactionIDLow;
542  l2capoutbuf[3] = 0x00; // MSB Parameter Length
543  l2capoutbuf[4] = 0x05; // LSB Parameter Length = 5
544  l2capoutbuf[5] = 0x00; // MSB AttributeListsByteCount
545  l2capoutbuf[6] = 0x02; // LSB AttributeListsByteCount = 2
546 
547  /* Attribute ID/Value Sequence: */
548  l2capoutbuf[7] = 0x35; // Data element sequence - length in next byte
549  l2capoutbuf[8] = 0x00; // Length = 0
550  l2capoutbuf[9] = 0x00; // No continuation state
551 
552  SDP_Command(l2capoutbuf, 10);
553 }
554 
555 void SPP::serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
557  l2capoutbuf[1] = transactionIDHigh;
558  l2capoutbuf[2] = transactionIDLow;
559  l2capoutbuf[3] = 0x00; // MSB Parameter Length
560  l2capoutbuf[4] = 0x2B; // LSB Parameter Length = 43
561  l2capoutbuf[5] = 0x00; // MSB AttributeListsByteCount
562  l2capoutbuf[6] = 0x26; // LSB AttributeListsByteCount = 38
563 
564  /* Attribute ID/Value Sequence: */
565  l2capoutbuf[7] = 0x36; // Data element sequence - length in next two bytes
566  l2capoutbuf[8] = 0x00; // MSB Length
567  l2capoutbuf[9] = 0x3C; // LSB Length = 60
568 
569  l2capoutbuf[10] = 0x36; // Data element sequence - length in next two bytes
570  l2capoutbuf[11] = 0x00; // MSB Length
571  l2capoutbuf[12] = 0x39; // LSB Length = 57
572 
573  l2capoutbuf[13] = 0x09; // Unsigned Integer - length 2 bytes
574  l2capoutbuf[14] = 0x00; // MSB ServiceRecordHandle
575  l2capoutbuf[15] = 0x00; // LSB ServiceRecordHandle
576  l2capoutbuf[16] = 0x0A; // Unsigned int - length 4 bytes
577  l2capoutbuf[17] = 0x00; // ServiceRecordHandle value - TODO: Is this related to HCI_Handle?
578  l2capoutbuf[18] = 0x01;
579  l2capoutbuf[19] = 0x00;
580  l2capoutbuf[20] = 0x06;
581 
582  l2capoutbuf[21] = 0x09; // Unsigned Integer - length 2 bytes
583  l2capoutbuf[22] = 0x00; // MSB ServiceClassIDList
584  l2capoutbuf[23] = 0x01; // LSB ServiceClassIDList
585  l2capoutbuf[24] = 0x35; // Data element sequence - length in next byte
586  l2capoutbuf[25] = 0x03; // Length = 3
587  l2capoutbuf[26] = 0x19; // UUID (universally unique identifier) - length = 2 bytes
588  l2capoutbuf[27] = 0x11; // MSB SerialPort
589  l2capoutbuf[28] = 0x01; // LSB SerialPort
590 
591  l2capoutbuf[29] = 0x09; // Unsigned Integer - length 2 bytes
592  l2capoutbuf[30] = 0x00; // MSB ProtocolDescriptorList
593  l2capoutbuf[31] = 0x04; // LSB ProtocolDescriptorList
594  l2capoutbuf[32] = 0x35; // Data element sequence - length in next byte
595  l2capoutbuf[33] = 0x0C; // Length = 12
596 
597  l2capoutbuf[34] = 0x35; // Data element sequence - length in next byte
598  l2capoutbuf[35] = 0x03; // Length = 3
599  l2capoutbuf[36] = 0x19; // UUID (universally unique identifier) - length = 2 bytes
600  l2capoutbuf[37] = 0x01; // MSB L2CAP
601  l2capoutbuf[38] = 0x00; // LSB L2CAP
602 
603  l2capoutbuf[39] = 0x35; // Data element sequence - length in next byte
604  l2capoutbuf[40] = 0x05; // Length = 5
605  l2capoutbuf[41] = 0x19; // UUID (universally unique identifier) - length = 2 bytes
606  l2capoutbuf[42] = 0x00; // MSB RFCOMM
607  l2capoutbuf[43] = 0x03; // LSB RFCOMM
608  l2capoutbuf[44] = 0x08; // Unsigned Integer - length 1 byte
609 
610  l2capoutbuf[45] = 0x02; // ContinuationState - Two more bytes
611  l2capoutbuf[46] = 0x00; // MSB length
612  l2capoutbuf[47] = 0x19; // LSB length = 25 more bytes to come
613 
614  SDP_Command(l2capoutbuf, 48);
615 }
616 
617 void SPP::serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
619  l2capoutbuf[1] = transactionIDHigh;
620  l2capoutbuf[2] = transactionIDLow;
621  l2capoutbuf[3] = 0x00; // MSB Parameter Length
622  l2capoutbuf[4] = 0x1C; // LSB Parameter Length = 28
623  l2capoutbuf[5] = 0x00; // MSB AttributeListsByteCount
624  l2capoutbuf[6] = 0x19; // LSB AttributeListsByteCount = 25
625 
626  /* Attribute ID/Value Sequence: */
627  l2capoutbuf[7] = 0x01; // Channel 1 - TODO: Try different values, so multiple servers can be used at once
628 
629  l2capoutbuf[8] = 0x09; // Unsigned Integer - length 2 bytes
630  l2capoutbuf[9] = 0x00; // MSB LanguageBaseAttributeIDList
631  l2capoutbuf[10] = 0x06; // LSB LanguageBaseAttributeIDList
632  l2capoutbuf[11] = 0x35; // Data element sequence - length in next byte
633  l2capoutbuf[12] = 0x09; // Length = 9
634 
635  // Identifier representing the natural language = en = English - see: "ISO 639:1988"
636  l2capoutbuf[13] = 0x09; // Unsigned Integer - length 2 bytes
637  l2capoutbuf[14] = 0x65; // 'e'
638  l2capoutbuf[15] = 0x6E; // 'n'
639 
640  // "The second element of each triplet contains an identifier that specifies a character encoding used for the language"
641  // Encoding is set to 106 (UTF-8) - see: http://www.iana.org/assignments/character-sets/character-sets.xhtml
642  l2capoutbuf[16] = 0x09; // Unsigned Integer - length 2 bytes
643  l2capoutbuf[17] = 0x00; // MSB of character encoding
644  l2capoutbuf[18] = 0x6A; // LSB of character encoding (106)
645 
646  // Attribute ID that serves as the base attribute ID for the natural language in the service record
647  // "To facilitate the retrieval of human-readable universal attributes in a principal language, the base attribute ID value for the primary language supported by a service record shall be 0x0100"
648  l2capoutbuf[19] = 0x09; // Unsigned Integer - length 2 bytes
649  l2capoutbuf[20] = 0x01;
650  l2capoutbuf[21] = 0x00;
651 
652  l2capoutbuf[22] = 0x09; // Unsigned Integer - length 2 bytes
653  l2capoutbuf[23] = 0x01; // MSB ServiceDescription
654  l2capoutbuf[24] = 0x00; // LSB ServiceDescription
655 
656  l2capoutbuf[25] = 0x25; // Text string - length in next byte
657  l2capoutbuf[26] = 0x05; // Name length
658  l2capoutbuf[27] = 'T';
659  l2capoutbuf[28] = 'K';
660  l2capoutbuf[29] = 'J';
661  l2capoutbuf[30] = 'S';
662  l2capoutbuf[31] = 'P';
663  l2capoutbuf[32] = 0x00; // No continuation state
664 
665  SDP_Command(l2capoutbuf, 33);
666 }
667 
668 void SPP::l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
669  serialPortResponse1(transactionIDHigh, transactionIDLow); // These has to send all the supported functions, since it only supports virtual serialport it just sends the message again
670 }
671 
672 void SPP::l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
673  serialPortResponse2(transactionIDHigh, transactionIDLow); // Same data as serialPortResponse2
674 }
675 /************************************************************/
676 /* RFCOMM Commands */
677 
678 /************************************************************/
679 void SPP::RFCOMM_Command(uint8_t* data, uint8_t nbytes) {
680  pBtd->L2CAP_Command(hci_handle, data, nbytes, rfcomm_scid[0], rfcomm_scid[1]);
681 }
682 
683 void SPP::sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t* data, uint8_t length) {
684  l2capoutbuf[0] = channel | direction | CR | extendAddress; // RFCOMM Address
685  l2capoutbuf[1] = channelType | pfBit; // RFCOMM Control
686  l2capoutbuf[2] = length << 1 | 0x01; // Length and format (always 0x01 bytes format)
687  uint8_t i = 0;
688  for(; i < length; i++)
689  l2capoutbuf[i + 3] = data[i];
690  l2capoutbuf[i + 3] = calcFcs(l2capoutbuf);
691 #ifdef EXTRADEBUG
692  Notify(PSTR(" - RFCOMM Data: "), 0x80);
693  for(i = 0; i < length + 4; i++) {
694  D_PrintHex<uint8_t > (l2capoutbuf[i], 0x80);
695  Notify(PSTR(" "), 0x80);
696  }
697 #endif
698  RFCOMM_Command(l2capoutbuf, length + 4);
699 }
700 
701 void SPP::sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit) {
702  l2capoutbuf[0] = channel | direction | CR | extendAddress; // RFCOMM Address
703  l2capoutbuf[1] = channelType | pfBit; // RFCOMM Control
704  l2capoutbuf[2] = 0x01; // Length = 0
705  l2capoutbuf[3] = credit; // Credit
706  l2capoutbuf[4] = calcFcs(l2capoutbuf);
707 #ifdef EXTRADEBUG
708  Notify(PSTR(" - RFCOMM Credit Data: "), 0x80);
709  for(uint8_t i = 0; i < 5; i++) {
710  D_PrintHex<uint8_t > (l2capoutbuf[i], 0x80);
711  Notify(PSTR(" "), 0x80);
712  }
713 #endif
714  RFCOMM_Command(l2capoutbuf, 5);
715 }
716 
717 /* CRC on 2 bytes */
718 uint8_t SPP::crc(uint8_t *data) {
719  return (pgm_read_byte(&rfcomm_crc_table[pgm_read_byte(&rfcomm_crc_table[0xFF ^ data[0]]) ^ data[1]]));
720 }
721 
722 /* Calculate FCS */
723 uint8_t SPP::calcFcs(uint8_t *data) {
724  uint8_t temp = crc(data);
725  if((data[1] & 0xEF) == RFCOMM_UIH)
726  return (0xFF - temp); // FCS on 2 bytes
727  else
728  return (0xFF - pgm_read_byte(&rfcomm_crc_table[temp ^ data[2]])); // FCS on 3 bytes
729 }
730 
731 /* Check FCS */
732 bool SPP::checkFcs(uint8_t *data, uint8_t fcs) {
733  uint8_t temp = crc(data);
734  if((data[1] & 0xEF) != RFCOMM_UIH)
735  temp = pgm_read_byte(&rfcomm_crc_table[temp ^ data[2]]); // FCS on 3 bytes
736  return (pgm_read_byte(&rfcomm_crc_table[temp ^ fcs]) == 0xCF);
737 }
738 
739 /* Serial commands */
740 #if defined(ARDUINO) && ARDUINO >=100
741 
742 size_t SPP::write(uint8_t data) {
743  return write(&data, 1);
744 }
745 #else
746 
747 void SPP::write(uint8_t data) {
748  write(&data, 1);
749 }
750 #endif
751 
752 #if defined(ARDUINO) && ARDUINO >=100
753 
754 size_t SPP::write(const uint8_t *data, size_t size) {
755 #else
756 
757 void SPP::write(const uint8_t *data, size_t size) {
758 #endif
759  for(uint8_t i = 0; i < size; i++) {
760  if(sppIndex >= sizeof (sppOutputBuffer) / sizeof (sppOutputBuffer[0]))
761  send(); // Send the current data in the buffer
762  sppOutputBuffer[sppIndex++] = data[i]; // All the bytes are put into a buffer and then send using the send() function
763  }
764 #if defined(ARDUINO) && ARDUINO >=100
765  return size;
766 #endif
767 }
768 
769 void SPP::send() {
770  if(!connected || !sppIndex)
771  return;
772  uint8_t length; // This is the length of the string we are sending
773  uint8_t offset = 0; // This is used to keep track of where we are in the string
774 
775  l2capoutbuf[0] = rfcommChannelConnection | 0 | 0 | extendAddress; // RFCOMM Address
776  l2capoutbuf[1] = RFCOMM_UIH; // RFCOMM Control
777 
778  while(sppIndex) { // We will run this while loop until this variable is 0
779  if(sppIndex > (sizeof (l2capoutbuf) - 4)) // Check if the string is larger than the outgoing buffer
780  length = sizeof (l2capoutbuf) - 4;
781  else
782  length = sppIndex;
783 
784  l2capoutbuf[2] = length << 1 | 1; // Length
785  uint8_t i = 0;
786  for(; i < length; i++)
787  l2capoutbuf[i + 3] = sppOutputBuffer[i + offset];
788  l2capoutbuf[i + 3] = calcFcs(l2capoutbuf); // Calculate checksum
789 
790  RFCOMM_Command(l2capoutbuf, length + 4);
791 
792  sppIndex -= length;
793  offset += length; // Increment the offset
794  }
795 }
796 
797 int SPP::available(void) {
798  return rfcommAvailable;
799 };
800 
801 void SPP::discard(void) {
802  rfcommAvailable = 0;
803 }
804 
805 int SPP::peek(void) {
806  if(rfcommAvailable == 0) // Don't read if there is nothing in the buffer
807  return -1;
808  return rfcommDataBuffer[0];
809 }
810 
811 int SPP::read(void) {
812  if(rfcommAvailable == 0) // Don't read if there is nothing in the buffer
813  return -1;
814  uint8_t output = rfcommDataBuffer[0];
815  for(uint8_t i = 1; i < rfcommAvailable; i++)
816  rfcommDataBuffer[i - 1] = rfcommDataBuffer[i]; // Shift the buffer one left
817  rfcommAvailable--;
818  bytesRead++;
819  if(bytesRead > (sizeof (rfcommDataBuffer) - 5)) { // We will send the command just before it runs out of credit
820  bytesRead = 0;
821  sendRfcommCredit(rfcommChannelConnection, rfcommDirection, 0, RFCOMM_UIH, 0x10, sizeof (rfcommDataBuffer)); // Send more credit
822 #ifdef EXTRADEBUG
823  Notify(PSTR("\r\nSent "), 0x80);
824  Notify((uint8_t)sizeof (rfcommDataBuffer), 0x80);
825  Notify(PSTR(" more credit"), 0x80);
826 #endif
827  }
828  return output;
829 }
size_t write(uint8_t data)
Definition: SPP.cpp:742
+Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "SPP.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report sent to the Arduino
22 
23 /*
24  * CRC (reversed crc) lookup table as calculated by the table generator in ETSI TS 101 369 V6.3.0.
25  */
26 const uint8_t rfcomm_crc_table[256] PROGMEM = {/* reversed, 8-bit, poly=0x07 */
27  0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B,
28  0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84, 0xF6, 0x67,
29  0x38, 0xA9, 0xDB, 0x4A, 0x3F, 0xAE, 0xDC, 0x4D, 0x36, 0xA7, 0xD5, 0x44, 0x31, 0xA0, 0xD2, 0x43,
30  0x24, 0xB5, 0xC7, 0x56, 0x23, 0xB2, 0xC0, 0x51, 0x2A, 0xBB, 0xC9, 0x58, 0x2D, 0xBC, 0xCE, 0x5F,
31  0x70, 0xE1, 0x93, 0x02, 0x77, 0xE6, 0x94, 0x05, 0x7E, 0xEF, 0x9D, 0x0C, 0x79, 0xE8, 0x9A, 0x0B,
32  0x6C, 0xFD, 0x8F, 0x1E, 0x6B, 0xFA, 0x88, 0x19, 0x62, 0xF3, 0x81, 0x10, 0x65, 0xF4, 0x86, 0x17,
33  0x48, 0xD9, 0xAB, 0x3A, 0x4F, 0xDE, 0xAC, 0x3D, 0x46, 0xD7, 0xA5, 0x34, 0x41, 0xD0, 0xA2, 0x33,
34  0x54, 0xC5, 0xB7, 0x26, 0x53, 0xC2, 0xB0, 0x21, 0x5A, 0xCB, 0xB9, 0x28, 0x5D, 0xCC, 0xBE, 0x2F,
35  0xE0, 0x71, 0x03, 0x92, 0xE7, 0x76, 0x04, 0x95, 0xEE, 0x7F, 0x0D, 0x9C, 0xE9, 0x78, 0x0A, 0x9B,
36  0xFC, 0x6D, 0x1F, 0x8E, 0xFB, 0x6A, 0x18, 0x89, 0xF2, 0x63, 0x11, 0x80, 0xF5, 0x64, 0x16, 0x87,
37  0xD8, 0x49, 0x3B, 0xAA, 0xDF, 0x4E, 0x3C, 0xAD, 0xD6, 0x47, 0x35, 0xA4, 0xD1, 0x40, 0x32, 0xA3,
38  0xC4, 0x55, 0x27, 0xB6, 0xC3, 0x52, 0x20, 0xB1, 0xCA, 0x5B, 0x29, 0xB8, 0xCD, 0x5C, 0x2E, 0xBF,
39  0x90, 0x01, 0x73, 0xE2, 0x97, 0x06, 0x74, 0xE5, 0x9E, 0x0F, 0x7D, 0xEC, 0x99, 0x08, 0x7A, 0xEB,
40  0x8C, 0x1D, 0x6F, 0xFE, 0x8B, 0x1A, 0x68, 0xF9, 0x82, 0x13, 0x61, 0xF0, 0x85, 0x14, 0x66, 0xF7,
41  0xA8, 0x39, 0x4B, 0xDA, 0xAF, 0x3E, 0x4C, 0xDD, 0xA6, 0x37, 0x45, 0xD4, 0xA1, 0x30, 0x42, 0xD3,
42  0xB4, 0x25, 0x57, 0xC6, 0xB3, 0x22, 0x50, 0xC1, 0xBA, 0x2B, 0x59, 0xC8, 0xBD, 0x2C, 0x5E, 0xCF
43 };
44 
45 SPP::SPP(BTD *p, const char* name, const char* pin) :
46 BluetoothService(p) // Pointer to BTD class instance - mandatory
47 {
48  pBtd->btdName = name;
49  pBtd->btdPin = pin;
50 
51  /* Set device cid for the SDP and RFCOMM channelse */
52  sdp_dcid[0] = 0x50; // 0x0050
53  sdp_dcid[1] = 0x00;
54  rfcomm_dcid[0] = 0x51; // 0x0051
55  rfcomm_dcid[1] = 0x00;
56 
57  Reset();
58 }
59 
60 void SPP::Reset() {
61  connected = false;
62  RFCOMMConnected = false;
63  SDPConnected = false;
64  waitForLastCommand = false;
65  l2cap_sdp_state = L2CAP_SDP_WAIT;
66  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
67  l2cap_event_flag = 0;
68  sppIndex = 0;
69  creditSent = false;
70 }
71 
73  connected = false;
74  // First the two L2CAP channels has to be disconnected and then the HCI connection
75  if(RFCOMMConnected)
76  pBtd->l2cap_disconnection_request(hci_handle, ++identifier, rfcomm_scid, rfcomm_dcid);
77  if(RFCOMMConnected && SDPConnected)
78  delay(1); // Add delay between commands
79  if(SDPConnected)
80  pBtd->l2cap_disconnection_request(hci_handle, ++identifier, sdp_scid, sdp_dcid);
81  l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE;
82 }
83 
84 void SPP::ACLData(uint8_t* l2capinbuf) {
85  if(!connected) {
86  if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
87  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == SDP_PSM && !pBtd->sdpConnectionClaimed) {
88  pBtd->sdpConnectionClaimed = true;
89  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
90  l2cap_sdp_state = L2CAP_SDP_WAIT; // Reset state
91  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == RFCOMM_PSM && !pBtd->rfcommConnectionClaimed) {
93  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
94  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT; // Reset state
95  }
96  }
97  }
98 
99  if(checkHciHandle(l2capinbuf, hci_handle)) { // acl_handle_ok
100  if((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001U) { // l2cap_control - Channel ID for ACL-U
101  if(l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
102 #ifdef DEBUG_USB_HOST
103  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
104  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
105  Notify(PSTR(" "), 0x80);
106  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
107  Notify(PSTR(" Data: "), 0x80);
108  D_PrintHex<uint8_t > (l2capinbuf[17], 0x80);
109  Notify(PSTR(" "), 0x80);
110  D_PrintHex<uint8_t > (l2capinbuf[16], 0x80);
111  Notify(PSTR(" "), 0x80);
112  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
113  Notify(PSTR(" "), 0x80);
114  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
115 #endif
116  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
117 #ifdef EXTRADEBUG
118  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
119  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
120  Notify(PSTR(" "), 0x80);
121  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
122  Notify(PSTR(" SCID: "), 0x80);
123  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
124  Notify(PSTR(" "), 0x80);
125  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
126  Notify(PSTR(" Identifier: "), 0x80);
127  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
128 #endif
129  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == SDP_PSM) { // It doesn't matter if it receives another reqeust, since it waits for the channel to disconnect in the L2CAP_SDP_DONE state, and the l2cap_event_flag will be cleared if so
130  identifier = l2capinbuf[9];
131  sdp_scid[0] = l2capinbuf[14];
132  sdp_scid[1] = l2capinbuf[15];
134  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == RFCOMM_PSM) { // ----- || -----
135  identifier = l2capinbuf[9];
136  rfcomm_scid[0] = l2capinbuf[14];
137  rfcomm_scid[1] = l2capinbuf[15];
139  }
140  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
141  if((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
142  if(l2capinbuf[12] == sdp_dcid[0] && l2capinbuf[13] == sdp_dcid[1]) {
143  //Notify(PSTR("\r\nSDP Configuration Complete"), 0x80);
145  } else if(l2capinbuf[12] == rfcomm_dcid[0] && l2capinbuf[13] == rfcomm_dcid[1]) {
146  //Notify(PSTR("\r\nRFCOMM Configuration Complete"), 0x80);
148  }
149  }
150  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
151  if(l2capinbuf[12] == sdp_dcid[0] && l2capinbuf[13] == sdp_dcid[1]) {
152  //Notify(PSTR("\r\nSDP Configuration Request"), 0x80);
153  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], sdp_scid);
154  } else if(l2capinbuf[12] == rfcomm_dcid[0] && l2capinbuf[13] == rfcomm_dcid[1]) {
155  //Notify(PSTR("\r\nRFCOMM Configuration Request"), 0x80);
156  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], rfcomm_scid);
157  }
158  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
159  if(l2capinbuf[12] == sdp_dcid[0] && l2capinbuf[13] == sdp_dcid[1]) {
160  //Notify(PSTR("\r\nDisconnect Request: SDP Channel"), 0x80);
161  identifier = l2capinbuf[9];
163  } else if(l2capinbuf[12] == rfcomm_dcid[0] && l2capinbuf[13] == rfcomm_dcid[1]) {
164  //Notify(PSTR("\r\nDisconnect Request: RFCOMM Channel"), 0x80);
165  identifier = l2capinbuf[9];
167  }
168  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_RESPONSE) {
169  if(l2capinbuf[12] == sdp_scid[0] && l2capinbuf[13] == sdp_scid[1]) {
170  //Notify(PSTR("\r\nDisconnect Response: SDP Channel"), 0x80);
171  identifier = l2capinbuf[9];
173  } else if(l2capinbuf[12] == rfcomm_scid[0] && l2capinbuf[13] == rfcomm_scid[1]) {
174  //Notify(PSTR("\r\nDisconnect Response: RFCOMM Channel"), 0x80);
175  identifier = l2capinbuf[9];
177  }
178  } else if(l2capinbuf[8] == L2CAP_CMD_INFORMATION_REQUEST) {
179 #ifdef DEBUG_USB_HOST
180  Notify(PSTR("\r\nInformation request"), 0x80);
181 #endif
182  identifier = l2capinbuf[9];
183  pBtd->l2cap_information_response(hci_handle, identifier, l2capinbuf[12], l2capinbuf[13]);
184  }
185 #ifdef EXTRADEBUG
186  else {
187  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
188  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
189  }
190 #endif
191  } else if(l2capinbuf[6] == sdp_dcid[0] && l2capinbuf[7] == sdp_dcid[1]) { // SDP
192  if(l2capinbuf[8] == SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST_PDU) {
193  if(((l2capinbuf[16] << 8 | l2capinbuf[17]) == SERIALPORT_UUID) || ((l2capinbuf[16] << 8 | l2capinbuf[17]) == 0x0000 && (l2capinbuf[18] << 8 | l2capinbuf[19]) == SERIALPORT_UUID)) { // Check if it's sending the full UUID, see: https://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm, we will just check the first four bytes
194  if(firstMessage) {
195  serialPortResponse1(l2capinbuf[9], l2capinbuf[10]);
196  firstMessage = false;
197  } else {
198  serialPortResponse2(l2capinbuf[9], l2capinbuf[10]); // Serialport continuation state
199  firstMessage = true;
200  }
201  } else if(((l2capinbuf[16] << 8 | l2capinbuf[17]) == L2CAP_UUID) || ((l2capinbuf[16] << 8 | l2capinbuf[17]) == 0x0000 && (l2capinbuf[18] << 8 | l2capinbuf[19]) == L2CAP_UUID)) {
202  if(firstMessage) {
203  l2capResponse1(l2capinbuf[9], l2capinbuf[10]);
204  firstMessage = false;
205  } else {
206  l2capResponse2(l2capinbuf[9], l2capinbuf[10]); // L2CAP continuation state
207  firstMessage = true;
208  }
209  } else
210  serviceNotSupported(l2capinbuf[9], l2capinbuf[10]); // The service is not supported
211 #ifdef EXTRADEBUG
212  Notify(PSTR("\r\nUUID: "), 0x80);
213  uint16_t uuid;
214  if((l2capinbuf[16] << 8 | l2capinbuf[17]) == 0x0000) // Check if it's sending the UUID as a 128-bit UUID
215  uuid = (l2capinbuf[18] << 8 | l2capinbuf[19]);
216  else // Short UUID
217  uuid = (l2capinbuf[16] << 8 | l2capinbuf[17]);
218  D_PrintHex<uint16_t > (uuid, 0x80);
219 
220  Notify(PSTR("\r\nLength: "), 0x80);
221  uint16_t length = l2capinbuf[11] << 8 | l2capinbuf[12];
222  D_PrintHex<uint16_t > (length, 0x80);
223  Notify(PSTR("\r\nData: "), 0x80);
224  for(uint8_t i = 0; i < length; i++) {
225  D_PrintHex<uint8_t > (l2capinbuf[13 + i], 0x80);
226  Notify(PSTR(" "), 0x80);
227  }
228 #endif
229  }
230 #ifdef EXTRADEBUG
231  else {
232  Notify(PSTR("\r\nUnknown PDU: "), 0x80);
233  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
234  }
235 #endif
236  } else if(l2capinbuf[6] == rfcomm_dcid[0] && l2capinbuf[7] == rfcomm_dcid[1]) { // RFCOMM
237  rfcommChannel = l2capinbuf[8] & 0xF8;
238  rfcommDirection = l2capinbuf[8] & 0x04;
239  rfcommCommandResponse = l2capinbuf[8] & 0x02;
240  rfcommChannelType = l2capinbuf[9] & 0xEF;
241  rfcommPfBit = l2capinbuf[9] & 0x10;
242 
243  if(rfcommChannel >> 3 != 0x00)
244  rfcommChannelConnection = rfcommChannel;
245 
246 #ifdef EXTRADEBUG
247  Notify(PSTR("\r\nRFCOMM Channel: "), 0x80);
248  D_PrintHex<uint8_t > (rfcommChannel >> 3, 0x80);
249  Notify(PSTR(" Direction: "), 0x80);
250  D_PrintHex<uint8_t > (rfcommDirection >> 2, 0x80);
251  Notify(PSTR(" CommandResponse: "), 0x80);
252  D_PrintHex<uint8_t > (rfcommCommandResponse >> 1, 0x80);
253  Notify(PSTR(" ChannelType: "), 0x80);
254  D_PrintHex<uint8_t > (rfcommChannelType, 0x80);
255  Notify(PSTR(" PF_BIT: "), 0x80);
256  D_PrintHex<uint8_t > (rfcommPfBit, 0x80);
257 #endif
258  if(rfcommChannelType == RFCOMM_DISC) {
259 #ifdef DEBUG_USB_HOST
260  Notify(PSTR("\r\nReceived Disconnect RFCOMM Command on channel: "), 0x80);
261  D_PrintHex<uint8_t > (rfcommChannel >> 3, 0x80);
262 #endif
263  connected = false;
264  sendRfcomm(rfcommChannel, rfcommDirection, rfcommCommandResponse, RFCOMM_UA, rfcommPfBit, rfcommbuf, 0x00); // UA Command
265  }
266  if(connected) {
267  /* Read the incoming message */
268  if(rfcommChannelType == RFCOMM_UIH && rfcommChannel == rfcommChannelConnection) {
269  uint8_t length = l2capinbuf[10] >> 1; // Get length
270  uint8_t offset = l2capinbuf[4] - length - 4; // Check if there is credit
271  if(checkFcs(&l2capinbuf[8], l2capinbuf[11 + length + offset])) {
272  uint8_t i = 0;
273  for(; i < length; i++) {
274  if(rfcommAvailable + i >= sizeof (rfcommDataBuffer)) {
275 #ifdef DEBUG_USB_HOST
276  Notify(PSTR("\r\nWarning: Buffer is full!"), 0x80);
277 #endif
278  break;
279  }
280  rfcommDataBuffer[rfcommAvailable + i] = l2capinbuf[11 + i + offset];
281  }
282  rfcommAvailable += i;
283 #ifdef EXTRADEBUG
284  Notify(PSTR("\r\nRFCOMM Data Available: "), 0x80);
285  Notify(rfcommAvailable, 0x80);
286  if(offset) {
287  Notify(PSTR(" - Credit: 0x"), 0x80);
288  D_PrintHex<uint8_t > (l2capinbuf[11], 0x80);
289  }
290 #endif
291  }
292 #ifdef DEBUG_USB_HOST
293  else
294  Notify(PSTR("\r\nError in FCS checksum!"), 0x80);
295 #endif
296 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send to the Arduino via Bluetooth
297  for(uint8_t i = 0; i < length; i++)
298  Notifyc(l2capinbuf[i + 11 + offset], 0x80);
299 #endif
300  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_RPN_CMD) { // UIH Remote Port Negotiation Command
301 #ifdef DEBUG_USB_HOST
302  Notify(PSTR("\r\nReceived UIH Remote Port Negotiation Command"), 0x80);
303 #endif
304  rfcommbuf[0] = BT_RFCOMM_RPN_RSP; // Command
305  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
306  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
307  rfcommbuf[3] = l2capinbuf[14]; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
308  rfcommbuf[4] = l2capinbuf[15]; // Priority
309  rfcommbuf[5] = l2capinbuf[16]; // Timer
310  rfcommbuf[6] = l2capinbuf[17]; // Max Fram Size LSB
311  rfcommbuf[7] = l2capinbuf[18]; // Max Fram Size MSB
312  rfcommbuf[8] = l2capinbuf[19]; // MaxRatransm.
313  rfcommbuf[9] = l2capinbuf[20]; // Number of Frames
314  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A); // UIH Remote Port Negotiation Response
315  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_CMD) { // UIH Modem Status Command
316 #ifdef DEBUG_USB_HOST
317  Notify(PSTR("\r\nSend UIH Modem Status Response"), 0x80);
318 #endif
319  rfcommbuf[0] = BT_RFCOMM_MSC_RSP; // UIH Modem Status Response
320  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
321  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
322  rfcommbuf[3] = l2capinbuf[14];
323  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
324  }
325  } else {
326  if(rfcommChannelType == RFCOMM_SABM) { // SABM Command - this is sent twice: once for channel 0 and then for the channel to establish
327 #ifdef DEBUG_USB_HOST
328  Notify(PSTR("\r\nReceived SABM Command"), 0x80);
329 #endif
330  sendRfcomm(rfcommChannel, rfcommDirection, rfcommCommandResponse, RFCOMM_UA, rfcommPfBit, rfcommbuf, 0x00); // UA Command
331  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_PN_CMD) { // UIH Parameter Negotiation Command
332 #ifdef DEBUG_USB_HOST
333  Notify(PSTR("\r\nReceived UIH Parameter Negotiation Command"), 0x80);
334 #endif
335  rfcommbuf[0] = BT_RFCOMM_PN_RSP; // UIH Parameter Negotiation Response
336  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
337  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
338  rfcommbuf[3] = 0xE0; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
339  rfcommbuf[4] = 0x00; // Priority
340  rfcommbuf[5] = 0x00; // Timer
341  rfcommbuf[6] = BULK_MAXPKTSIZE - 14; // Max Fram Size LSB - set to the size of received data (50)
342  rfcommbuf[7] = 0x00; // Max Fram Size MSB
343  rfcommbuf[8] = 0x00; // MaxRatransm.
344  rfcommbuf[9] = 0x00; // Number of Frames
345  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A);
346  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_CMD) { // UIH Modem Status Command
347 #ifdef DEBUG_USB_HOST
348  Notify(PSTR("\r\nSend UIH Modem Status Response"), 0x80);
349 #endif
350  rfcommbuf[0] = BT_RFCOMM_MSC_RSP; // UIH Modem Status Response
351  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
352  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
353  rfcommbuf[3] = l2capinbuf[14];
354  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
355 
356  delay(1);
357 #ifdef DEBUG_USB_HOST
358  Notify(PSTR("\r\nSend UIH Modem Status Command"), 0x80);
359 #endif
360  rfcommbuf[0] = BT_RFCOMM_MSC_CMD; // UIH Modem Status Command
361  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
362  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
363  rfcommbuf[3] = 0x8D; // Can receive frames (YES), Ready to Communicate (YES), Ready to Receive (YES), Incomig Call (NO), Data is Value (YES)
364 
365  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
366  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_RSP) { // UIH Modem Status Response
367  if(!creditSent) {
368 #ifdef DEBUG_USB_HOST
369  Notify(PSTR("\r\nSend UIH Command with credit"), 0x80);
370 #endif
371  sendRfcommCredit(rfcommChannelConnection, rfcommDirection, 0, RFCOMM_UIH, 0x10, sizeof (rfcommDataBuffer)); // Send credit
372  creditSent = true;
373  timer = (uint32_t)millis();
374  waitForLastCommand = true;
375  }
376  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[10] == 0x01) { // UIH Command with credit
377 #ifdef DEBUG_USB_HOST
378  Notify(PSTR("\r\nReceived UIH Command with credit"), 0x80);
379 #endif
380  } else if(rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_RPN_CMD) { // UIH Remote Port Negotiation Command
381 #ifdef DEBUG_USB_HOST
382  Notify(PSTR("\r\nReceived UIH Remote Port Negotiation Command"), 0x80);
383 #endif
384  rfcommbuf[0] = BT_RFCOMM_RPN_RSP; // Command
385  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
386  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
387  rfcommbuf[3] = l2capinbuf[14]; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
388  rfcommbuf[4] = l2capinbuf[15]; // Priority
389  rfcommbuf[5] = l2capinbuf[16]; // Timer
390  rfcommbuf[6] = l2capinbuf[17]; // Max Fram Size LSB
391  rfcommbuf[7] = l2capinbuf[18]; // Max Fram Size MSB
392  rfcommbuf[8] = l2capinbuf[19]; // MaxRatransm.
393  rfcommbuf[9] = l2capinbuf[20]; // Number of Frames
394  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A); // UIH Remote Port Negotiation Response
395 #ifdef DEBUG_USB_HOST
396  Notify(PSTR("\r\nRFCOMM Connection is now established\r\n"), 0x80);
397 #endif
398  onInit();
399  }
400 #ifdef EXTRADEBUG
401  else if(rfcommChannelType != RFCOMM_DISC) {
402  Notify(PSTR("\r\nUnsupported RFCOMM Data - ChannelType: "), 0x80);
403  D_PrintHex<uint8_t > (rfcommChannelType, 0x80);
404  Notify(PSTR(" Command: "), 0x80);
405  D_PrintHex<uint8_t > (l2capinbuf[11], 0x80);
406  }
407 #endif
408  }
409  }
410 #ifdef EXTRADEBUG
411  else {
412  Notify(PSTR("\r\nUnsupported L2CAP Data - Channel ID: "), 0x80);
413  D_PrintHex<uint8_t > (l2capinbuf[7], 0x80);
414  Notify(PSTR(" "), 0x80);
415  D_PrintHex<uint8_t > (l2capinbuf[6], 0x80);
416  }
417 #endif
418  SDP_task();
419  RFCOMM_task();
420  }
421 }
422 
423 void SPP::Run() {
424  if(waitForLastCommand && (int32_t)((uint32_t)millis() - timer) > 100) { // We will only wait 100ms and see if the UIH Remote Port Negotiation Command is send, as some deviced don't send it
425 #ifdef DEBUG_USB_HOST
426  Notify(PSTR("\r\nRFCOMM Connection is now established - Automatic\r\n"), 0x80);
427 #endif
428  onInit();
429  }
430  send(); // Send all bytes currently in the buffer
431 }
432 
433 void SPP::onInit() {
434  creditSent = false;
435  waitForLastCommand = false;
436  connected = true; // The RFCOMM channel is now established
437  sppIndex = 0;
438  if(pFuncOnInit)
439  pFuncOnInit(); // Call the user function
440 };
441 
442 void SPP::SDP_task() {
443  switch(l2cap_sdp_state) {
444  case L2CAP_SDP_WAIT:
447 #ifdef DEBUG_USB_HOST
448  Notify(PSTR("\r\nSDP Incoming Connection Request"), 0x80);
449 #endif
451  delay(1);
453  identifier++;
454  delay(1);
456  l2cap_sdp_state = L2CAP_SDP_SUCCESS;
459  SDPConnected = false;
460 #ifdef DEBUG_USB_HOST
461  Notify(PSTR("\r\nDisconnected SDP Channel"), 0x80);
462 #endif
464  }
465  break;
466  case L2CAP_SDP_SUCCESS:
469 #ifdef DEBUG_USB_HOST
470  Notify(PSTR("\r\nSDP Successfully Configured"), 0x80);
471 #endif
472  firstMessage = true; // Reset bool
473  SDPConnected = true;
474  l2cap_sdp_state = L2CAP_SDP_WAIT;
475  }
476  break;
477 
478  case L2CAP_DISCONNECT_RESPONSE: // This is for both disconnection response from the RFCOMM and SDP channel if they were connected
480 #ifdef DEBUG_USB_HOST
481  Notify(PSTR("\r\nDisconnected L2CAP Connection"), 0x80);
482 #endif
484  hci_handle = -1; // Reset handle
485  Reset();
486  }
487  break;
488  }
489 }
490 
491 void SPP::RFCOMM_task() {
492  switch(l2cap_rfcomm_state) {
493  case L2CAP_RFCOMM_WAIT:
496 #ifdef DEBUG_USB_HOST
497  Notify(PSTR("\r\nRFCOMM Incoming Connection Request"), 0x80);
498 #endif
499  pBtd->l2cap_connection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid, PENDING);
500  delay(1);
501  pBtd->l2cap_connection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid, SUCCESSFUL);
502  identifier++;
503  delay(1);
505  l2cap_rfcomm_state = L2CAP_RFCOMM_SUCCESS;
508  RFCOMMConnected = false;
509  connected = false;
510 #ifdef DEBUG_USB_HOST
511  Notify(PSTR("\r\nDisconnected RFCOMM Channel"), 0x80);
512 #endif
513  pBtd->l2cap_disconnection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid);
514  }
515  break;
519 #ifdef DEBUG_USB_HOST
520  Notify(PSTR("\r\nRFCOMM Successfully Configured"), 0x80);
521 #endif
522  rfcommAvailable = 0; // Reset number of bytes available
523  bytesRead = 0; // Reset number of bytes received
524  RFCOMMConnected = true;
525  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
526  }
527  break;
528  }
529 }
530 /************************************************************/
531 /* SDP Commands */
532 
533 /************************************************************/
534 void SPP::SDP_Command(uint8_t* data, uint8_t nbytes) { // See page 223 in the Bluetooth specs
535  pBtd->L2CAP_Command(hci_handle, data, nbytes, sdp_scid[0], sdp_scid[1]);
536 }
537 
538 void SPP::serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow) { // See page 235 in the Bluetooth specs
540  l2capoutbuf[1] = transactionIDHigh;
541  l2capoutbuf[2] = transactionIDLow;
542  l2capoutbuf[3] = 0x00; // MSB Parameter Length
543  l2capoutbuf[4] = 0x05; // LSB Parameter Length = 5
544  l2capoutbuf[5] = 0x00; // MSB AttributeListsByteCount
545  l2capoutbuf[6] = 0x02; // LSB AttributeListsByteCount = 2
546 
547  /* Attribute ID/Value Sequence: */
548  l2capoutbuf[7] = 0x35; // Data element sequence - length in next byte
549  l2capoutbuf[8] = 0x00; // Length = 0
550  l2capoutbuf[9] = 0x00; // No continuation state
551 
552  SDP_Command(l2capoutbuf, 10);
553 }
554 
555 void SPP::serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
557  l2capoutbuf[1] = transactionIDHigh;
558  l2capoutbuf[2] = transactionIDLow;
559  l2capoutbuf[3] = 0x00; // MSB Parameter Length
560  l2capoutbuf[4] = 0x2B; // LSB Parameter Length = 43
561  l2capoutbuf[5] = 0x00; // MSB AttributeListsByteCount
562  l2capoutbuf[6] = 0x26; // LSB AttributeListsByteCount = 38
563 
564  /* Attribute ID/Value Sequence: */
565  l2capoutbuf[7] = 0x36; // Data element sequence - length in next two bytes
566  l2capoutbuf[8] = 0x00; // MSB Length
567  l2capoutbuf[9] = 0x3C; // LSB Length = 60
568 
569  l2capoutbuf[10] = 0x36; // Data element sequence - length in next two bytes
570  l2capoutbuf[11] = 0x00; // MSB Length
571  l2capoutbuf[12] = 0x39; // LSB Length = 57
572 
573  l2capoutbuf[13] = 0x09; // Unsigned Integer - length 2 bytes
574  l2capoutbuf[14] = 0x00; // MSB ServiceRecordHandle
575  l2capoutbuf[15] = 0x00; // LSB ServiceRecordHandle
576  l2capoutbuf[16] = 0x0A; // Unsigned int - length 4 bytes
577  l2capoutbuf[17] = 0x00; // ServiceRecordHandle value - TODO: Is this related to HCI_Handle?
578  l2capoutbuf[18] = 0x01;
579  l2capoutbuf[19] = 0x00;
580  l2capoutbuf[20] = 0x06;
581 
582  l2capoutbuf[21] = 0x09; // Unsigned Integer - length 2 bytes
583  l2capoutbuf[22] = 0x00; // MSB ServiceClassIDList
584  l2capoutbuf[23] = 0x01; // LSB ServiceClassIDList
585  l2capoutbuf[24] = 0x35; // Data element sequence - length in next byte
586  l2capoutbuf[25] = 0x03; // Length = 3
587  l2capoutbuf[26] = 0x19; // UUID (universally unique identifier) - length = 2 bytes
588  l2capoutbuf[27] = 0x11; // MSB SerialPort
589  l2capoutbuf[28] = 0x01; // LSB SerialPort
590 
591  l2capoutbuf[29] = 0x09; // Unsigned Integer - length 2 bytes
592  l2capoutbuf[30] = 0x00; // MSB ProtocolDescriptorList
593  l2capoutbuf[31] = 0x04; // LSB ProtocolDescriptorList
594  l2capoutbuf[32] = 0x35; // Data element sequence - length in next byte
595  l2capoutbuf[33] = 0x0C; // Length = 12
596 
597  l2capoutbuf[34] = 0x35; // Data element sequence - length in next byte
598  l2capoutbuf[35] = 0x03; // Length = 3
599  l2capoutbuf[36] = 0x19; // UUID (universally unique identifier) - length = 2 bytes
600  l2capoutbuf[37] = 0x01; // MSB L2CAP
601  l2capoutbuf[38] = 0x00; // LSB L2CAP
602 
603  l2capoutbuf[39] = 0x35; // Data element sequence - length in next byte
604  l2capoutbuf[40] = 0x05; // Length = 5
605  l2capoutbuf[41] = 0x19; // UUID (universally unique identifier) - length = 2 bytes
606  l2capoutbuf[42] = 0x00; // MSB RFCOMM
607  l2capoutbuf[43] = 0x03; // LSB RFCOMM
608  l2capoutbuf[44] = 0x08; // Unsigned Integer - length 1 byte
609 
610  l2capoutbuf[45] = 0x02; // ContinuationState - Two more bytes
611  l2capoutbuf[46] = 0x00; // MSB length
612  l2capoutbuf[47] = 0x19; // LSB length = 25 more bytes to come
613 
614  SDP_Command(l2capoutbuf, 48);
615 }
616 
617 void SPP::serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
619  l2capoutbuf[1] = transactionIDHigh;
620  l2capoutbuf[2] = transactionIDLow;
621  l2capoutbuf[3] = 0x00; // MSB Parameter Length
622  l2capoutbuf[4] = 0x1C; // LSB Parameter Length = 28
623  l2capoutbuf[5] = 0x00; // MSB AttributeListsByteCount
624  l2capoutbuf[6] = 0x19; // LSB AttributeListsByteCount = 25
625 
626  /* Attribute ID/Value Sequence: */
627  l2capoutbuf[7] = 0x01; // Channel 1 - TODO: Try different values, so multiple servers can be used at once
628 
629  l2capoutbuf[8] = 0x09; // Unsigned Integer - length 2 bytes
630  l2capoutbuf[9] = 0x00; // MSB LanguageBaseAttributeIDList
631  l2capoutbuf[10] = 0x06; // LSB LanguageBaseAttributeIDList
632  l2capoutbuf[11] = 0x35; // Data element sequence - length in next byte
633  l2capoutbuf[12] = 0x09; // Length = 9
634 
635  // Identifier representing the natural language = en = English - see: "ISO 639:1988"
636  l2capoutbuf[13] = 0x09; // Unsigned Integer - length 2 bytes
637  l2capoutbuf[14] = 0x65; // 'e'
638  l2capoutbuf[15] = 0x6E; // 'n'
639 
640  // "The second element of each triplet contains an identifier that specifies a character encoding used for the language"
641  // Encoding is set to 106 (UTF-8) - see: http://www.iana.org/assignments/character-sets/character-sets.xhtml
642  l2capoutbuf[16] = 0x09; // Unsigned Integer - length 2 bytes
643  l2capoutbuf[17] = 0x00; // MSB of character encoding
644  l2capoutbuf[18] = 0x6A; // LSB of character encoding (106)
645 
646  // Attribute ID that serves as the base attribute ID for the natural language in the service record
647  // "To facilitate the retrieval of human-readable universal attributes in a principal language, the base attribute ID value for the primary language supported by a service record shall be 0x0100"
648  l2capoutbuf[19] = 0x09; // Unsigned Integer - length 2 bytes
649  l2capoutbuf[20] = 0x01;
650  l2capoutbuf[21] = 0x00;
651 
652  l2capoutbuf[22] = 0x09; // Unsigned Integer - length 2 bytes
653  l2capoutbuf[23] = 0x01; // MSB ServiceDescription
654  l2capoutbuf[24] = 0x00; // LSB ServiceDescription
655 
656  l2capoutbuf[25] = 0x25; // Text string - length in next byte
657  l2capoutbuf[26] = 0x05; // Name length
658  l2capoutbuf[27] = 'T';
659  l2capoutbuf[28] = 'K';
660  l2capoutbuf[29] = 'J';
661  l2capoutbuf[30] = 'S';
662  l2capoutbuf[31] = 'P';
663  l2capoutbuf[32] = 0x00; // No continuation state
664 
665  SDP_Command(l2capoutbuf, 33);
666 }
667 
668 void SPP::l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
669  serialPortResponse1(transactionIDHigh, transactionIDLow); // These has to send all the supported functions, since it only supports virtual serialport it just sends the message again
670 }
671 
672 void SPP::l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
673  serialPortResponse2(transactionIDHigh, transactionIDLow); // Same data as serialPortResponse2
674 }
675 /************************************************************/
676 /* RFCOMM Commands */
677 
678 /************************************************************/
679 void SPP::RFCOMM_Command(uint8_t* data, uint8_t nbytes) {
680  pBtd->L2CAP_Command(hci_handle, data, nbytes, rfcomm_scid[0], rfcomm_scid[1]);
681 }
682 
683 void SPP::sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t* data, uint8_t length) {
684  l2capoutbuf[0] = channel | direction | CR | extendAddress; // RFCOMM Address
685  l2capoutbuf[1] = channelType | pfBit; // RFCOMM Control
686  l2capoutbuf[2] = length << 1 | 0x01; // Length and format (always 0x01 bytes format)
687  uint8_t i = 0;
688  for(; i < length; i++)
689  l2capoutbuf[i + 3] = data[i];
690  l2capoutbuf[i + 3] = calcFcs(l2capoutbuf);
691 #ifdef EXTRADEBUG
692  Notify(PSTR(" - RFCOMM Data: "), 0x80);
693  for(i = 0; i < length + 4; i++) {
694  D_PrintHex<uint8_t > (l2capoutbuf[i], 0x80);
695  Notify(PSTR(" "), 0x80);
696  }
697 #endif
698  RFCOMM_Command(l2capoutbuf, length + 4);
699 }
700 
701 void SPP::sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit) {
702  l2capoutbuf[0] = channel | direction | CR | extendAddress; // RFCOMM Address
703  l2capoutbuf[1] = channelType | pfBit; // RFCOMM Control
704  l2capoutbuf[2] = 0x01; // Length = 0
705  l2capoutbuf[3] = credit; // Credit
706  l2capoutbuf[4] = calcFcs(l2capoutbuf);
707 #ifdef EXTRADEBUG
708  Notify(PSTR(" - RFCOMM Credit Data: "), 0x80);
709  for(uint8_t i = 0; i < 5; i++) {
710  D_PrintHex<uint8_t > (l2capoutbuf[i], 0x80);
711  Notify(PSTR(" "), 0x80);
712  }
713 #endif
714  RFCOMM_Command(l2capoutbuf, 5);
715 }
716 
717 /* CRC on 2 bytes */
718 uint8_t SPP::crc(uint8_t *data) {
719  return (pgm_read_byte(&rfcomm_crc_table[pgm_read_byte(&rfcomm_crc_table[0xFF ^ data[0]]) ^ data[1]]));
720 }
721 
722 /* Calculate FCS */
723 uint8_t SPP::calcFcs(uint8_t *data) {
724  uint8_t temp = crc(data);
725  if((data[1] & 0xEF) == RFCOMM_UIH)
726  return (0xFF - temp); // FCS on 2 bytes
727  else
728  return (0xFF - pgm_read_byte(&rfcomm_crc_table[temp ^ data[2]])); // FCS on 3 bytes
729 }
730 
731 /* Check FCS */
732 bool SPP::checkFcs(uint8_t *data, uint8_t fcs) {
733  uint8_t temp = crc(data);
734  if((data[1] & 0xEF) != RFCOMM_UIH)
735  temp = pgm_read_byte(&rfcomm_crc_table[temp ^ data[2]]); // FCS on 3 bytes
736  return (pgm_read_byte(&rfcomm_crc_table[temp ^ fcs]) == 0xCF);
737 }
738 
739 /* Serial commands */
740 #if defined(ARDUINO) && ARDUINO >=100
741 
742 size_t SPP::write(uint8_t data) {
743  return write(&data, 1);
744 }
745 #else
746 
747 void SPP::write(uint8_t data) {
748  write(&data, 1);
749 }
750 #endif
751 
752 #if defined(ARDUINO) && ARDUINO >=100
753 
754 size_t SPP::write(const uint8_t *data, size_t size) {
755 #else
756 
757 void SPP::write(const uint8_t *data, size_t size) {
758 #endif
759  for(uint8_t i = 0; i < size; i++) {
760  if(sppIndex >= sizeof (sppOutputBuffer) / sizeof (sppOutputBuffer[0]))
761  send(); // Send the current data in the buffer
762  sppOutputBuffer[sppIndex++] = data[i]; // All the bytes are put into a buffer and then send using the send() function
763  }
764 #if defined(ARDUINO) && ARDUINO >=100
765  return size;
766 #endif
767 }
768 
769 void SPP::send() {
770  if(!connected || !sppIndex)
771  return;
772  uint8_t length; // This is the length of the string we are sending
773  uint8_t offset = 0; // This is used to keep track of where we are in the string
774 
775  l2capoutbuf[0] = rfcommChannelConnection | 0 | 0 | extendAddress; // RFCOMM Address
776  l2capoutbuf[1] = RFCOMM_UIH; // RFCOMM Control
777 
778  while(sppIndex) { // We will run this while loop until this variable is 0
779  if(sppIndex > (sizeof (l2capoutbuf) - 4)) // Check if the string is larger than the outgoing buffer
780  length = sizeof (l2capoutbuf) - 4;
781  else
782  length = sppIndex;
783 
784  l2capoutbuf[2] = length << 1 | 1; // Length
785  uint8_t i = 0;
786  for(; i < length; i++)
787  l2capoutbuf[i + 3] = sppOutputBuffer[i + offset];
788  l2capoutbuf[i + 3] = calcFcs(l2capoutbuf); // Calculate checksum
789 
790  RFCOMM_Command(l2capoutbuf, length + 4);
791 
792  sppIndex -= length;
793  offset += length; // Increment the offset
794  }
795 }
796 
797 int SPP::available(void) {
798  return rfcommAvailable;
799 };
800 
801 void SPP::discard(void) {
802  rfcommAvailable = 0;
803 }
804 
805 int SPP::peek(void) {
806  if(rfcommAvailable == 0) // Don't read if there is nothing in the buffer
807  return -1;
808  return rfcommDataBuffer[0];
809 }
810 
811 int SPP::read(void) {
812  if(rfcommAvailable == 0) // Don't read if there is nothing in the buffer
813  return -1;
814  uint8_t output = rfcommDataBuffer[0];
815  for(uint8_t i = 1; i < rfcommAvailable; i++)
816  rfcommDataBuffer[i - 1] = rfcommDataBuffer[i]; // Shift the buffer one left
817  rfcommAvailable--;
818  bytesRead++;
819  if(bytesRead > (sizeof (rfcommDataBuffer) - 5)) { // We will send the command just before it runs out of credit
820  bytesRead = 0;
821  sendRfcommCredit(rfcommChannelConnection, rfcommDirection, 0, RFCOMM_UIH, 0x10, sizeof (rfcommDataBuffer)); // Send more credit
822 #ifdef EXTRADEBUG
823  Notify(PSTR("\r\nSent "), 0x80);
824  Notify((uint8_t)sizeof (rfcommDataBuffer), 0x80);
825  Notify(PSTR(" more credit"), 0x80);
826 #endif
827  }
828  return output;
829 }
size_t write(uint8_t data)
Definition: SPP.cpp:742
void onInit()
Definition: SPP.cpp:433
-
const char * btdName
Definition: BTD.h:444
+
const char * btdName
Definition: BTD.h:447
#define BT_RFCOMM_RPN_RSP
Definition: SPP.h:44
-
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1262
-
#define SUCCESSFUL
Definition: BTD.h:175
-
bool sdpConnectionClaimed
Definition: BTD.h:439
-
#define RFCOMM_PSM
Definition: BTD.h:179
+
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1260
+
#define SUCCESSFUL
Definition: BTD.h:178
+
bool sdpConnectionClaimed
Definition: BTD.h:442
+
#define RFCOMM_PSM
Definition: BTD.h:182
SPP(BTD *p, const char *name="Arduino", const char *pin="0000")
Definition: SPP.cpp:45
-
Definition: BTD.h:198
-
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1315
+
Definition: BTD.h:201
+
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1313
#define RFCOMM_SABM
Definition: SPP.h:30
#define L2CAP_UUID
Definition: SPP.h:27
const uint8_t rfcomm_crc_table[256]
Definition: SPP.cpp:26
-
bool rfcommConnectionClaimed
Definition: BTD.h:441
+
bool rfcommConnectionClaimed
Definition: BTD.h:444
#define SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU
Definition: SPP.h:25
-
uint8_t identifier
Definition: BTD.h:617
-
#define L2CAP_FLAG_CONFIG_SDP_SUCCESS
Definition: BTD.h:147
+
uint8_t identifier
Definition: BTD.h:621
+
#define L2CAP_FLAG_CONFIG_SDP_SUCCESS
Definition: BTD.h:150
#define RFCOMM_DISC
Definition: SPP.h:34
#define SERIALPORT_UUID
Definition: SPP.h:26
-
#define L2CAP_SDP_SUCCESS
Definition: BTD.h:118
-
const char * btdPin
Definition: BTD.h:446
+
#define L2CAP_SDP_SUCCESS
Definition: BTD.h:121
+
const char * btdPin
Definition: BTD.h:449
bool connected
Definition: SPP.h:84
-
#define pgm_read_byte(addr)
-
#define L2CAP_CMD_INFORMATION_REQUEST
Definition: BTD.h:170
-
#define SDP_PSM
Definition: BTD.h:178
+
#define pgm_read_byte(addr)
+
#define L2CAP_CMD_INFORMATION_REQUEST
Definition: BTD.h:173
+
#define SDP_PSM
Definition: BTD.h:181
int read(void)
Definition: SPP.cpp:811
-
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1328
+
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1326
#define extendAddress
Definition: SPP.h:36
-
#define L2CAP_RFCOMM_WAIT
Definition: BTD.h:121
-
#define Notify(...)
Definition: message.h:44
+
#define L2CAP_RFCOMM_WAIT
Definition: BTD.h:124
+
#define Notify(...)
Definition: message.h:51
void Run()
Definition: SPP.cpp:423
-
#define L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST
Definition: BTD.h:151
-
uint16_t hci_handle
Definition: BTD.h:451
-
#define Notifyc(...)
Definition: message.h:46
-
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1173
- +
#define L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST
Definition: BTD.h:154
+
uint16_t hci_handle
Definition: BTD.h:454
+
#define Notifyc(...)
Definition: message.h:53
+
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1171
+
void Reset()
Definition: SPP.cpp:60
-
void(* pFuncOnInit)(void)
Definition: BTD.h:605
-
#define L2CAP_FLAG_DISCONNECT_SDP_REQUEST
Definition: BTD.h:148
+
void(* pFuncOnInit)(void)
Definition: BTD.h:609
+
#define L2CAP_FLAG_DISCONNECT_SDP_REQUEST
Definition: BTD.h:151
#define RFCOMM_UIH
Definition: SPP.h:32
int available(void)
Definition: SPP.cpp:797
-
#define l2cap_check_flag(flag)
Definition: BTD.h:158
-
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:166
-
#define PSTR(str)
-
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:168
+
#define l2cap_check_flag(flag)
Definition: BTD.h:161
+
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:169
+
#define PSTR(str)
+
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:171
void discard(void)
Definition: SPP.cpp:801
-
#define L2CAP_SDP_WAIT
Definition: BTD.h:117
-
BTD * pBtd
Definition: BTD.h:608
-
#define BULK_MAXPKTSIZE
Definition: BTD.h:34
-
#define L2CAP_RFCOMM_SUCCESS
Definition: BTD.h:122
+
#define L2CAP_SDP_WAIT
Definition: BTD.h:120
+
BTD * pBtd
Definition: BTD.h:612
+
#define BULK_MAXPKTSIZE
Definition: BTD.h:37
+
#define L2CAP_RFCOMM_SUCCESS
Definition: BTD.h:125
#define BT_RFCOMM_RPN_CMD
Definition: SPP.h:43
-
#define L2CAP_FLAG_DISCONNECT_RESPONSE
Definition: BTD.h:155
-
#define L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS
Definition: BTD.h:152
+
#define L2CAP_FLAG_DISCONNECT_RESPONSE
Definition: BTD.h:158
+
#define L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS
Definition: BTD.h:155
void disconnect()
Definition: SPP.cpp:72
#define BT_RFCOMM_MSC_CMD
Definition: SPP.h:41
#define SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST_PDU
Definition: SPP.h:24
-
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:169
+
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:172
#define RFCOMM_UA
Definition: SPP.h:31
-
void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)
Definition: BTD.cpp:1341
-
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:167
-
uint16_t hci_handle
Definition: BTD.h:611
+
void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)
Definition: BTD.cpp:1339
+
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:170
+
uint16_t hci_handle
Definition: BTD.h:615
#define BT_RFCOMM_PN_CMD
Definition: SPP.h:39
#define BT_RFCOMM_MSC_RSP
Definition: SPP.h:42
-
#define L2CAP_FLAG_CONNECTION_SDP_REQUEST
Definition: BTD.h:146
-
uint32_t l2cap_event_flag
Definition: BTD.h:614
-
#define l2cap_clear_flag(flag)
Definition: BTD.h:160
-
#define L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST
Definition: BTD.h:153
-
#define L2CAP_DISCONNECT_RESPONSE
Definition: BTD.h:124
+
#define L2CAP_FLAG_CONNECTION_SDP_REQUEST
Definition: BTD.h:149
+
uint32_t l2cap_event_flag
Definition: BTD.h:618
+
#define l2cap_clear_flag(flag)
Definition: BTD.h:163
+
#define L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST
Definition: BTD.h:156
+
#define L2CAP_DISCONNECT_RESPONSE
Definition: BTD.h:127
void send(void)
Definition: SPP.cpp:769
-
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1221
-
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1296
-
#define PENDING
Definition: BTD.h:174
-
#define l2cap_set_flag(flag)
Definition: BTD.h:159
-
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1279
-
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:164
+
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1219
+
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1294
+
#define PENDING
Definition: BTD.h:177
+
#define l2cap_set_flag(flag)
Definition: BTD.h:162
+
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1277
+
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:167
#define BT_RFCOMM_PN_RSP
Definition: SPP.h:40
-
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:600
+
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:604
void ACLData(uint8_t *ACLData)
Definition: SPP.cpp:84
int peek(void)
Definition: SPP.cpp:805
-
#define L2CAP_CMD_COMMAND_REJECT
Definition: BTD.h:163
+
#define L2CAP_CMD_COMMAND_REJECT
Definition: BTD.h:166
diff --git a/_s_p_p_8h.html b/_s_p_p_8h.html index 2437697e..96185b96 100644 --- a/_s_p_p_8h.html +++ b/_s_p_p_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: SPP.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST_PDU

+
@@ -165,11 +147,13 @@ Macros
-

Definition at line 24 of file SPP.h.

+

Definition at line 24 of file SPP.h.

- + +

◆ SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU

+
@@ -179,11 +163,13 @@ Macros
-

Definition at line 25 of file SPP.h.

+

Definition at line 25 of file SPP.h.

- + +

◆ SERIALPORT_UUID

+
@@ -193,11 +179,13 @@ Macros
-

Definition at line 26 of file SPP.h.

+

Definition at line 26 of file SPP.h.

- + +

◆ L2CAP_UUID

+
@@ -207,11 +195,13 @@ Macros
-

Definition at line 27 of file SPP.h.

+

Definition at line 27 of file SPP.h.

- + +

◆ RFCOMM_SABM

+
@@ -221,11 +211,13 @@ Macros
-

Definition at line 30 of file SPP.h.

+

Definition at line 30 of file SPP.h.

- + +

◆ RFCOMM_UA

+
@@ -235,11 +227,13 @@ Macros
-

Definition at line 31 of file SPP.h.

+

Definition at line 31 of file SPP.h.

- + +

◆ RFCOMM_UIH

+
@@ -249,11 +243,13 @@ Macros
-

Definition at line 32 of file SPP.h.

+

Definition at line 32 of file SPP.h.

- + +

◆ RFCOMM_DISC

+
@@ -263,11 +259,13 @@ Macros
-

Definition at line 34 of file SPP.h.

+

Definition at line 34 of file SPP.h.

- + +

◆ extendAddress

+
@@ -277,11 +275,13 @@ Macros
-

Definition at line 36 of file SPP.h.

+

Definition at line 36 of file SPP.h.

- + +

◆ BT_RFCOMM_PN_CMD

+
@@ -291,11 +291,13 @@ Macros
-

Definition at line 39 of file SPP.h.

+

Definition at line 39 of file SPP.h.

- + +

◆ BT_RFCOMM_PN_RSP

+
@@ -305,11 +307,13 @@ Macros
-

Definition at line 40 of file SPP.h.

+

Definition at line 40 of file SPP.h.

- + +

◆ BT_RFCOMM_MSC_CMD

+
@@ -319,11 +323,13 @@ Macros
-

Definition at line 41 of file SPP.h.

+

Definition at line 41 of file SPP.h.

- + +

◆ BT_RFCOMM_MSC_RSP

+
@@ -333,11 +339,13 @@ Macros
-

Definition at line 42 of file SPP.h.

+

Definition at line 42 of file SPP.h.

- + +

◆ BT_RFCOMM_RPN_CMD

+
@@ -347,11 +355,13 @@ Macros
-

Definition at line 43 of file SPP.h.

+

Definition at line 43 of file SPP.h.

- + +

◆ BT_RFCOMM_RPN_RSP

+
@@ -361,7 +371,7 @@ Macros
-

Definition at line 44 of file SPP.h.

+

Definition at line 44 of file SPP.h.

@@ -370,7 +380,7 @@ Macros diff --git a/_s_p_p_8h__dep__incl.md5 b/_s_p_p_8h__dep__incl.md5 index c4196b87..026dbd27 100644 --- a/_s_p_p_8h__dep__incl.md5 +++ b/_s_p_p_8h__dep__incl.md5 @@ -1 +1 @@ -8fa503e9bcede23521cf22418b0e794e \ No newline at end of file +f36e77e58f6fed5fcd04ea59c72b0abb \ No newline at end of file diff --git a/_s_p_p_8h__dep__incl.png b/_s_p_p_8h__dep__incl.png index 55aae5b1..d5bb2950 100644 Binary files a/_s_p_p_8h__dep__incl.png and b/_s_p_p_8h__dep__incl.png differ diff --git a/_s_p_p_8h__incl.md5 b/_s_p_p_8h__incl.md5 index f139a88d..39ec78f3 100644 --- a/_s_p_p_8h__incl.md5 +++ b/_s_p_p_8h__incl.md5 @@ -1 +1 @@ -ebaf4a19e87d528fa81f6393cdd2bc87 \ No newline at end of file +a91a331bec3537c7a4cb45239da270de \ No newline at end of file diff --git a/_s_p_p_8h__incl.png b/_s_p_p_8h__incl.png index 1814c567..ab21d263 100644 Binary files a/_s_p_p_8h__incl.png and b/_s_p_p_8h__incl.png differ diff --git a/_s_p_p_8h_source.html b/_s_p_p_8h_source.html index d1ea629b..fd51ef77 100644 --- a/_s_p_p_8h_source.html +++ b/_s_p_p_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: SPP.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _spp_h_
19 #define _spp_h_
20 
21 #include "BTD.h"
22 
23 /* Used for SDP */
24 #define SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST_PDU 0x06 // See the RFCOMM specs
25 #define SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU 0x07 // See the RFCOMM specs
26 #define SERIALPORT_UUID 0x1101 // See http://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm
27 #define L2CAP_UUID 0x0100
28 
29 /* Used for RFCOMM */
30 #define RFCOMM_SABM 0x2F
31 #define RFCOMM_UA 0x63
32 #define RFCOMM_UIH 0xEF
33 //#define RFCOMM_DM 0x0F
34 #define RFCOMM_DISC 0x43
35 
36 #define extendAddress 0x01 // Always 1
37 
38 // Multiplexer message types
39 #define BT_RFCOMM_PN_CMD 0x83
40 #define BT_RFCOMM_PN_RSP 0x81
41 #define BT_RFCOMM_MSC_CMD 0xE3
42 #define BT_RFCOMM_MSC_RSP 0xE1
43 #define BT_RFCOMM_RPN_CMD 0x93
44 #define BT_RFCOMM_RPN_RSP 0x91
45 /*
46 #define BT_RFCOMM_TEST_CMD 0x23
47 #define BT_RFCOMM_TEST_RSP 0x21
48 #define BT_RFCOMM_FCON_CMD 0xA3
49 #define BT_RFCOMM_FCON_RSP 0xA1
50 #define BT_RFCOMM_FCOFF_CMD 0x63
51 #define BT_RFCOMM_FCOFF_RSP 0x61
52 #define BT_RFCOMM_RLS_CMD 0x53
53 #define BT_RFCOMM_RLS_RSP 0x51
54 #define BT_RFCOMM_NSC_RSP 0x11
55  */
56 
61 class SPP : public BluetoothService, public Stream {
62 public:
69  SPP(BTD *p, const char *name = "Arduino", const char *pin = "0000");
70 
73  void disconnect();
80  operator bool() {
81  return connected;
82  }
84  bool connected;
85 
91  int available(void);
92 
94  void flush(void) {
95  send();
96  };
101  int peek(void);
106  int read(void);
107 
108 #if defined(ARDUINO) && ARDUINO >=100
109 
114  size_t write(uint8_t data);
121  size_t write(const uint8_t* data, size_t size);
123 #if !defined(RBL_NRF51822)
124  using Print::write;
125 #endif
126 #else
127 
131  void write(uint8_t data);
137  void write(const uint8_t* data, size_t size);
138 #endif
139 
141  void discard(void);
147  void send(void);
150 protected:
156  void ACLData(uint8_t* ACLData);
158  void Run();
160  void Reset();
166  void onInit();
169 private:
170  /* Set true when a channel is created */
171  bool SDPConnected;
172  bool RFCOMMConnected;
173 
174  /* Variables used by L2CAP state machines */
175  uint8_t l2cap_sdp_state;
176  uint8_t l2cap_rfcomm_state;
177 
178  uint8_t l2capoutbuf[BULK_MAXPKTSIZE]; // General purpose buffer for l2cap out data
179  uint8_t rfcommbuf[10]; // Buffer for RFCOMM Commands
180 
181  /* L2CAP Channels */
182  uint8_t sdp_scid[2]; // L2CAP source CID for SDP
183  uint8_t sdp_dcid[2]; // 0x0050
184  uint8_t rfcomm_scid[2]; // L2CAP source CID for RFCOMM
185  uint8_t rfcomm_dcid[2]; // 0x0051
186 
187  /* RFCOMM Variables */
188  uint8_t rfcommChannel;
189  uint8_t rfcommChannelConnection; // This is the channel the SPP channel will be running at
190  uint8_t rfcommDirection;
191  uint8_t rfcommCommandResponse;
192  uint8_t rfcommChannelType;
193  uint8_t rfcommPfBit;
194 
195  uint32_t timer;
196  bool waitForLastCommand;
197  bool creditSent;
198 
199  uint8_t rfcommDataBuffer[100]; // Create a 100 sized buffer for incoming data
200  uint8_t sppOutputBuffer[100]; // Create a 100 sized buffer for outgoing SPP data
201  uint8_t sppIndex;
202  uint8_t rfcommAvailable;
203 
204  bool firstMessage; // Used to see if it's the first SDP request received
205  uint8_t bytesRead; // Counter to see when it's time to send more credit
206 
207  /* State machines */
208  void SDP_task(); // SDP state machine
209  void RFCOMM_task(); // RFCOMM state machine
210 
211  /* SDP Commands */
212  void SDP_Command(uint8_t *data, uint8_t nbytes);
213  void serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow);
214  void serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);
215  void serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);
216  void l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);
217  void l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);
218 
219  /* RFCOMM Commands */
220  void RFCOMM_Command(uint8_t *data, uint8_t nbytes);
221  void sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t *data, uint8_t length);
222  void sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit);
223  uint8_t calcFcs(uint8_t *data);
224  bool checkFcs(uint8_t *data, uint8_t fcs);
225  uint8_t crc(uint8_t *data);
226 };
227 #endif
size_t write(uint8_t data)
Definition: SPP.cpp:742
void onInit()
Definition: SPP.cpp:433
SPP(BTD *p, const char *name="Arduino", const char *pin="0000")
Definition: SPP.cpp:45
-
Definition: BTD.h:198
+
Definition: BTD.h:201
void flush(void)
Definition: SPP.h:94
bool connected
Definition: SPP.h:84
int read(void)
Definition: SPP.cpp:811
void Run()
Definition: SPP.cpp:423
- +
void Reset()
Definition: SPP.cpp:60
int available(void)
Definition: SPP.cpp:797
void discard(void)
Definition: SPP.cpp:801
-
#define BULK_MAXPKTSIZE
Definition: BTD.h:34
+
#define BULK_MAXPKTSIZE
Definition: BTD.h:37
void disconnect()
Definition: SPP.cpp:72
Definition: SPP.h:61
void send(void)
Definition: SPP.cpp:769
@@ -114,7 +94,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_usb_8cpp.html b/_usb_8cpp.html index 8dc43187..f621de40 100644 --- a/_usb_8cpp.html +++ b/_usb_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Usb.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/_usb_8cpp__incl.md5 b/_usb_8cpp__incl.md5 index f71e6530..08cf02a4 100644 --- a/_usb_8cpp__incl.md5 +++ b/_usb_8cpp__incl.md5 @@ -1 +1 @@ -983a9d4c5eeb9a3736dcb2d9192937eb \ No newline at end of file +c0083b07bac0c537372ef8120287eeb6 \ No newline at end of file diff --git a/_usb_8cpp__incl.png b/_usb_8cpp__incl.png index 3e3251d9..20416d37 100644 Binary files a/_usb_8cpp__incl.png and b/_usb_8cpp__incl.png differ diff --git a/_usb_8cpp_source.html b/_usb_8cpp_source.html index 1c54b9e0..f8967fdd 100644 --- a/_usb_8cpp_source.html +++ b/_usb_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Usb.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
Usb.cpp
-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 /* USB functions */
18 
19 #include "Usb.h"
20 
21 static uint8_t usb_error = 0;
22 static uint8_t usb_task_state;
23 
24 /* constructor */
25 USB::USB() : bmHubPre(0) {
26  usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; //set up state machine
27  init();
28 }
29 
30 /* Initialize data structures */
31 void USB::init() {
32  //devConfigIndex = 0;
33  bmHubPre = 0;
34 }
35 
36 uint8_t USB::getUsbTaskState(void) {
37  return ( usb_task_state);
38 }
39 
40 void USB::setUsbTaskState(uint8_t state) {
41  usb_task_state = state;
42 }
43 
44 EpInfo* USB::getEpInfoEntry(uint8_t addr, uint8_t ep) {
45  UsbDevice *p = addrPool.GetUsbDevicePtr(addr);
46 
47  if(!p || !p->epinfo)
48  return NULL;
49 
50  EpInfo *pep = p->epinfo;
51 
52  for(uint8_t i = 0; i < p->epcount; i++) {
53  if((pep)->epAddr == ep)
54  return pep;
55 
56  pep++;
57  }
58  return NULL;
59 }
60 
61 /* set device table entry */
62 
63 /* each device is different and has different number of endpoints. This function plugs endpoint record structure, defined in application, to devtable */
64 uint8_t USB::setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr) {
65  if(!eprecord_ptr)
67 
68  UsbDevice *p = addrPool.GetUsbDevicePtr(addr);
69 
70  if(!p)
72 
73  p->address.devAddress = addr;
74  p->epinfo = eprecord_ptr;
75  p->epcount = epcount;
76 
77  return 0;
78 }
79 
80 uint8_t USB::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit) {
81  UsbDevice *p = addrPool.GetUsbDevicePtr(addr);
82 
83  if(!p)
85 
86  if(!p->epinfo)
88 
89  *ppep = getEpInfoEntry(addr, ep);
90 
91  if(!*ppep)
93 
94  *nak_limit = (0x0001UL << (((*ppep)->bmNakPower > USB_NAK_MAX_POWER) ? USB_NAK_MAX_POWER : (*ppep)->bmNakPower));
95  (*nak_limit)--;
96  /*
97  USBTRACE2("\r\nAddress: ", addr);
98  USBTRACE2(" EP: ", ep);
99  USBTRACE2(" NAK Power: ",(*ppep)->bmNakPower);
100  USBTRACE2(" NAK Limit: ", nak_limit);
101  USBTRACE("\r\n");
102  */
103  regWr(rPERADDR, addr); //set peripheral address
104 
105  uint8_t mode = regRd(rMODE);
106 
107  //Serial.print("\r\nMode: ");
108  //Serial.println( mode, HEX);
109  //Serial.print("\r\nLS: ");
110  //Serial.println(p->lowspeed, HEX);
111 
112 
113 
114  // Set bmLOWSPEED and bmHUBPRE in case of low-speed device, reset them otherwise
115  regWr(rMODE, (p->lowspeed) ? mode | bmLOWSPEED | bmHubPre : mode & ~(bmHUBPRE | bmLOWSPEED));
116 
117  return 0;
118 }
119 
120 /* Control transfer. Sets address, endpoint, fills control packet with necessary data, dispatches control packet, and initiates bulk IN transfer, */
121 /* depending on request. Actual requests are defined as inlines */
122 /* return codes: */
123 /* 00 = success */
124 
125 /* 01-0f = non-zero HRSLT */
126 uint8_t USB::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
127  uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p) {
128  bool direction = false; //request direction, IN or OUT
129  uint8_t rcode;
130  SETUP_PKT setup_pkt;
131 
132  EpInfo *pep = NULL;
133  uint16_t nak_limit = 0;
134 
135  rcode = SetAddress(addr, ep, &pep, &nak_limit);
136 
137  if(rcode)
138  return rcode;
139 
140  direction = ((bmReqType & 0x80) > 0);
141 
142  /* fill in setup packet */
143  setup_pkt.ReqType_u.bmRequestType = bmReqType;
144  setup_pkt.bRequest = bRequest;
145  setup_pkt.wVal_u.wValueLo = wValLo;
146  setup_pkt.wVal_u.wValueHi = wValHi;
147  setup_pkt.wIndex = wInd;
148  setup_pkt.wLength = total;
149 
150  bytesWr(rSUDFIFO, 8, (uint8_t*) & setup_pkt); //transfer to setup packet FIFO
151 
152  rcode = dispatchPkt(tokSETUP, ep, nak_limit); //dispatch packet
153 
154  if(rcode) //return HRSLT if not zero
155  return ( rcode);
156 
157  if(dataptr != NULL) //data stage, if present
158  {
159  if(direction) //IN transfer
160  {
161  uint16_t left = total;
162 
163  pep->bmRcvToggle = 1; //bmRCVTOG1;
164 
165  while(left) {
166  // Bytes read into buffer
167  uint16_t read = nbytes;
168  //uint16_t read = (left<nbytes) ? left : nbytes;
169 
170  rcode = InTransfer(pep, nak_limit, &read, dataptr);
171  if(rcode == hrTOGERR) {
172  // yes, we flip it wrong here so that next time it is actually correct!
173  pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
174  continue;
175  }
176 
177  if(rcode)
178  return rcode;
179 
180  // Invoke callback function if inTransfer completed successfully and callback function pointer is specified
181  if(!rcode && p)
182  ((USBReadParser*)p)->Parse(read, dataptr, total - left);
183 
184  left -= read;
185 
186  if(read < nbytes)
187  break;
188  }
189  } else //OUT transfer
190  {
191  pep->bmSndToggle = 1; //bmSNDTOG1;
192  rcode = OutTransfer(pep, nak_limit, nbytes, dataptr);
193  }
194  if(rcode) //return error
195  return ( rcode);
196  }
197  // Status stage
198  return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction
199 }
200 
201 /* IN transfer to arbitrary endpoint. Assumes PERADDR is set. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
202 /* Keep sending INs and writes data to memory area pointed by 'data' */
203 
204 /* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error,
205  fe USB xfer timeout */
206 uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
207  EpInfo *pep = NULL;
208  uint16_t nak_limit = 0;
209 
210  uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit);
211 
212  if(rcode) {
213  USBTRACE3("(USB::InTransfer) SetAddress Failed ", rcode, 0x81);
214  USBTRACE3("(USB::InTransfer) addr requested ", addr, 0x81);
215  USBTRACE3("(USB::InTransfer) ep requested ", ep, 0x81);
216  return rcode;
217  }
218  return InTransfer(pep, nak_limit, nbytesptr, data, bInterval);
219 }
220 
221 uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
222  uint8_t rcode = 0;
223  uint8_t pktsize;
224 
225  uint16_t nbytes = *nbytesptr;
226  //printf("Requesting %i bytes ", nbytes);
227  uint8_t maxpktsize = pep->maxPktSize;
228 
229  *nbytesptr = 0;
230  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
231 
232  // use a 'break' to exit this loop
233  while(1) {
234  rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS.
235  if(rcode == hrTOGERR) {
236  // yes, we flip it wrong here so that next time it is actually correct!
237  pep->bmRcvToggle = (regRd(rHRSL) & bmRCVTOGRD) ? 0 : 1;
238  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
239  continue;
240  }
241  if(rcode) {
242  //printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
243  break; //should be 0, indicating ACK. Else return error code.
244  }
245  /* check for RCVDAVIRQ and generate error if not present */
246  /* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */
247  if((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) {
248  //printf(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n");
249  rcode = 0xf0; //receive error
250  break;
251  }
252  pktsize = regRd(rRCVBC); //number of received bytes
253  //printf("Got %i bytes \r\n", pktsize);
254  // This would be OK, but...
255  //assert(pktsize <= nbytes);
256  if(pktsize > nbytes) {
257  // This can happen. Use of assert on Arduino locks up the Arduino.
258  // So I will trim the value, and hope for the best.
259  //printf(">>>>>>>> Problem! Wanted %i bytes but got %i.\r\n", nbytes, pktsize);
260  pktsize = nbytes;
261  }
262 
263  int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr);
264 
265  if(mem_left < 0)
266  mem_left = 0;
267 
268  data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data);
269 
270  regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer
271  *nbytesptr += pktsize; // add this packet's byte count to total transfer length
272 
273  /* The transfer is complete under two conditions: */
274  /* 1. The device sent a short packet (L.T. maxPacketSize) */
275  /* 2. 'nbytes' have been transferred. */
276  if((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes?
277  {
278  // Save toggle value
279  pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0;
280  //printf("\r\n");
281  rcode = 0;
282  break;
283  } else if(bInterval > 0)
284  delay(bInterval); // Delay according to polling interval
285  } //while( 1 )
286  return ( rcode);
287 }
288 
289 /* OUT transfer to arbitrary endpoint. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
290 /* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer */
291 
292 /* rcode 0 if no errors. rcode 01-0f is relayed from HRSL */
293 uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
294  EpInfo *pep = NULL;
295  uint16_t nak_limit = 0;
296 
297  uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit);
298 
299  if(rcode)
300  return rcode;
301 
302  return OutTransfer(pep, nak_limit, nbytes, data);
303 }
304 
305 uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) {
306  uint8_t rcode = hrSUCCESS, retry_count;
307  uint8_t *data_p = data; //local copy of the data pointer
308  uint16_t bytes_tosend, nak_count;
309  uint16_t bytes_left = nbytes;
310 
311  uint8_t maxpktsize = pep->maxPktSize;
312 
313  if(maxpktsize < 1 || maxpktsize > 64)
315 
316  unsigned long timeout = millis() + USB_XFER_TIMEOUT;
317 
318  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
319 
320  while(bytes_left) {
321  retry_count = 0;
322  nak_count = 0;
323  bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left;
324  bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO
325  regWr(rSNDBC, bytes_tosend); //set number of bytes
326  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
327  while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ
328  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
329  rcode = (regRd(rHRSL) & 0x0f);
330 
331  while(rcode && ((long)(millis() - timeout) < 0L)) {
332  switch(rcode) {
333  case hrNAK:
334  nak_count++;
335  if(nak_limit && (nak_count == nak_limit))
336  goto breakout;
337  //return ( rcode);
338  break;
339  case hrTIMEOUT:
340  retry_count++;
341  if(retry_count == USB_RETRY_LIMIT)
342  goto breakout;
343  //return ( rcode);
344  break;
345  case hrTOGERR:
346  // yes, we flip it wrong here so that next time it is actually correct!
347  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
348  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
349  break;
350  default:
351  goto breakout;
352  }//switch( rcode
353 
354  /* process NAK according to Host out NAK bug */
355  regWr(rSNDBC, 0);
356  regWr(rSNDFIFO, *data_p);
357  regWr(rSNDBC, bytes_tosend);
358  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
359  while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ
360  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
361  rcode = (regRd(rHRSL) & 0x0f);
362  }//while( rcode && ....
363  bytes_left -= bytes_tosend;
364  data_p += bytes_tosend;
365  }//while( bytes_left...
366 breakout:
367 
368  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle
369  return ( rcode); //should be 0 in all cases
370 }
371 /* dispatch USB packet. Assumes peripheral address is set and relevant buffer is loaded/empty */
372 /* If NAK, tries to re-send up to nak_limit times */
373 /* If nak_limit == 0, do not count NAKs, exit after timeout */
374 /* If bus timeout, re-sends up to USB_RETRY_LIMIT times */
375 
376 /* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout */
377 uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
378  unsigned long timeout = millis() + USB_XFER_TIMEOUT;
379  uint8_t tmpdata;
380  uint8_t rcode = hrSUCCESS;
381  uint8_t retry_count = 0;
382  uint16_t nak_count = 0;
383 
384  while((long)(millis() - timeout) < 0L) {
385  regWr(rHXFR, (token | ep)); //launch the transfer
387 
388  while((long)(millis() - timeout) < 0L) //wait for transfer completion
389  {
390  tmpdata = regRd(rHIRQ);
391 
392  if(tmpdata & bmHXFRDNIRQ) {
393  regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt
394  rcode = 0x00;
395  break;
396  }//if( tmpdata & bmHXFRDNIRQ
397 
398  }//while ( millis() < timeout
399 
400  //if (rcode != 0x00) //exit if timeout
401  // return ( rcode);
402 
403  rcode = (regRd(rHRSL) & 0x0f); //analyze transfer result
404 
405  switch(rcode) {
406  case hrNAK:
407  nak_count++;
408  if(nak_limit && (nak_count == nak_limit))
409  return (rcode);
410  break;
411  case hrTIMEOUT:
412  retry_count++;
413  if(retry_count == USB_RETRY_LIMIT)
414  return (rcode);
415  break;
416  default:
417  return (rcode);
418  }//switch( rcode
419 
420  }//while( timeout > millis()
421  return ( rcode);
422 }
423 
424 /* USB main task. Performs enumeration/cleanup */
425 void USB::Task(void) //USB state machine
426 {
427  uint8_t rcode;
428  uint8_t tmpdata;
429  static unsigned long delay = 0;
430  //USB_DEVICE_DESCRIPTOR buf;
431  bool lowspeed = false;
432 
433  MAX3421E::Task();
434 
435  tmpdata = getVbusState();
436 
437  /* modify USB task state if Vbus changed */
438  switch(tmpdata) {
439  case SE1: //illegal state
440  usb_task_state = USB_DETACHED_SUBSTATE_ILLEGAL;
441  lowspeed = false;
442  break;
443  case SE0: //disconnected
444  if((usb_task_state & USB_STATE_MASK) != USB_STATE_DETACHED)
445  usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE;
446  lowspeed = false;
447  break;
448  case LSHOST:
449 
450  lowspeed = true;
451  //intentional fallthrough
452  case FSHOST: //attached
453  if((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
454  delay = millis() + USB_SETTLE_DELAY;
455  usb_task_state = USB_ATTACHED_SUBSTATE_SETTLE;
456  }
457  break;
458  }// switch( tmpdata
459 
460  for(uint8_t i = 0; i < USB_NUMDEVICES; i++)
461  if(devConfig[i])
462  rcode = devConfig[i]->Poll();
463 
464  switch(usb_task_state) {
466  init();
467 
468  for(uint8_t i = 0; i < USB_NUMDEVICES; i++)
469  if(devConfig[i])
470  rcode = devConfig[i]->Release();
471 
472  usb_task_state = USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE;
473  break;
474  case USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE: //just sit here
475  break;
476  case USB_DETACHED_SUBSTATE_ILLEGAL: //just sit here
477  break;
478  case USB_ATTACHED_SUBSTATE_SETTLE: //settle time for just attached device
479  if((long)(millis() - delay) >= 0L)
480  usb_task_state = USB_ATTACHED_SUBSTATE_RESET_DEVICE;
481  else break; // don't fall through
483  regWr(rHCTL, bmBUSRST); //issue bus reset
485  break;
487  if((regRd(rHCTL) & bmBUSRST) == 0) {
488  tmpdata = regRd(rMODE) | bmSOFKAENAB; //start SOF generation
489  regWr(rMODE, tmpdata);
490  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_SOF;
491  //delay = millis() + 20; //20ms wait after reset per USB spec
492  }
493  break;
494  case USB_ATTACHED_SUBSTATE_WAIT_SOF: //todo: change check order
495  if(regRd(rHIRQ) & bmFRAMEIRQ) {
496  //when first SOF received _and_ 20ms has passed we can continue
497  /*
498  if (delay < millis()) //20ms passed
499  usb_task_state = USB_STATE_CONFIGURING;
500  */
501  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET;
502  delay = millis() + 20;
503  }
504  break;
506  if((long)(millis() - delay) >= 0L) usb_task_state = USB_STATE_CONFIGURING;
507  else break; // don't fall through
509 
510  //Serial.print("\r\nConf.LS: ");
511  //Serial.println(lowspeed, HEX);
512 
513  rcode = Configuring(0, 0, lowspeed);
514 
515  if(rcode) {
517  usb_error = rcode;
518  usb_task_state = USB_STATE_ERROR;
519  }
520  } else
521  usb_task_state = USB_STATE_RUNNING;
522  break;
523  case USB_STATE_RUNNING:
524  break;
525  case USB_STATE_ERROR:
526  //MAX3421E::Init();
527  break;
528  } // switch( usb_task_state )
529 }
530 
531 uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
532  //uint8_t buf[12];
533  uint8_t rcode;
534  UsbDevice *p0 = NULL, *p = NULL;
535 
536  // Get pointer to pseudo device with address 0 assigned
537  p0 = addrPool.GetUsbDevicePtr(0);
538 
539  if(!p0)
541 
542  if(!p0->epinfo)
544 
545  p0->lowspeed = (lowspeed) ? true : false;
546 
547  // Allocate new address according to device class
548  uint8_t bAddress = addrPool.AllocAddress(parent, false, port);
549 
550  if(!bAddress)
552 
553  p = addrPool.GetUsbDevicePtr(bAddress);
554 
555  if(!p)
557 
558  p->lowspeed = lowspeed;
559 
560  // Assign new address to the device
561  rcode = setAddr(0, 0, bAddress);
562 
563  if(rcode) {
564  addrPool.FreeAddress(bAddress);
565  bAddress = 0;
566  return rcode;
567  }
568  return 0;
569 };
570 
571 uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed) {
572  //printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port);
573  uint8_t retries = 0;
574 
575 again:
576  uint8_t rcode = devConfig[driver]->ConfigureDevice(parent, port, lowspeed);
578  if(parent == 0) {
579  // Send a bus reset on the root interface.
580  regWr(rHCTL, bmBUSRST); //issue bus reset
581  delay(102); // delay 102ms, compensate for clock inaccuracy.
582  } else {
583  // reset parent port
584  devConfig[parent]->ResetHubPort(port);
585  }
586  } else if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works
587  delay(100);
588  retries++;
589  goto again;
590  } else if(rcode)
591  return rcode;
592 
593  rcode = devConfig[driver]->Init(parent, port, lowspeed);
594  if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works
595  delay(100);
596  retries++;
597  goto again;
598  }
599  if(rcode) {
600  // Issue a bus reset, because the device may be in a limbo state
601  if(parent == 0) {
602  // Send a bus reset on the root interface.
603  regWr(rHCTL, bmBUSRST); //issue bus reset
604  delay(102); // delay 102ms, compensate for clock inaccuracy.
605  } else {
606  // reset parent port
607  devConfig[parent]->ResetHubPort(port);
608  }
609  }
610  return rcode;
611 }
612 
613 /*
614  * This is broken. We need to enumerate differently.
615  * It causes major problems with several devices if detected in an unexpected order.
616  *
617  *
618  * Oleg - I wouldn't do anything before the newly connected device is considered sane.
619  * i.e.(delays are not indicated for brevity):
620  * 1. reset
621  * 2. GetDevDescr();
622  * 3a. If ACK, continue with allocating address, addressing, etc.
623  * 3b. Else reset again, count resets, stop at some number (5?).
624  * 4. When max.number of resets is reached, toggle power/fail
625  * If desired, this could be modified by performing two resets with GetDevDescr() in the middle - however, from my experience, if a device answers to GDD()
626  * it doesn't need to be reset again
627  * New steps proposal:
628  * 1: get address pool instance. exit on fail
629  * 2: pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf). exit on fail.
630  * 3: bus reset, 100ms delay
631  * 4: set address
632  * 5: pUsb->setEpInfoEntry(bAddress, 1, epInfo), exit on fail
633  * 6: while (configurations) {
634  * for(each configuration) {
635  * for (each driver) {
636  * 6a: Ask device if it likes configuration. Returns 0 on OK.
637  * If successful, the driver configured device.
638  * The driver now owns the endpoints, and takes over managing them.
639  * The following will need codes:
640  * Everything went well, instance consumed, exit with success.
641  * Instance already in use, ignore it, try next driver.
642  * Not a supported device, ignore it, try next driver.
643  * Not a supported configuration for this device, ignore it, try next driver.
644  * Could not configure device, fatal, exit with fail.
645  * }
646  * }
647  * }
648  * 7: for(each driver) {
649  * 7a: Ask device if it knows this VID/PID. Acts exactly like 6a, but using VID/PID
650  * 8: if we get here, no driver likes the device plugged in, so exit failure.
651  *
652  */
653 uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
654  //uint8_t bAddress = 0;
655  //printf("Configuring: parent = %i, port = %i\r\n", parent, port);
656  uint8_t devConfigIndex;
657  uint8_t rcode = 0;
658  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
659  USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
660  UsbDevice *p = NULL;
661  EpInfo *oldep_ptr = NULL;
662  EpInfo epInfo;
663 
664  epInfo.epAddr = 0;
665  epInfo.maxPktSize = 8;
666  epInfo.bmSndToggle = 0;
667  epInfo.bmRcvToggle = 0;
668  epInfo.bmNakPower = USB_NAK_MAX_POWER;
669 
670  //delay(2000);
671  AddressPool &addrPool = GetAddressPool();
672  // Get pointer to pseudo device with address 0 assigned
673  p = addrPool.GetUsbDevicePtr(0);
674  if(!p) {
675  //printf("Configuring error: USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL\r\n");
677  }
678 
679  // Save old pointer to EP_RECORD of address 0
680  oldep_ptr = p->epinfo;
681 
682  // Temporary assign new pointer to epInfo to p->epinfo in order to
683  // avoid toggle inconsistence
684 
685  p->epinfo = &epInfo;
686 
687  p->lowspeed = lowspeed;
688  // Get device descriptor
689  rcode = getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
690 
691  // Restore p->epinfo
692  p->epinfo = oldep_ptr;
693 
694  if(rcode) {
695  //printf("Configuring error: Can't get USB_DEVICE_DESCRIPTOR\r\n");
696  return rcode;
697  }
698 
699  // to-do?
700  // Allocate new address according to device class
701  //bAddress = addrPool.AllocAddress(parent, false, port);
702 
703  uint16_t vid = udd->idVendor;
704  uint16_t pid = udd->idProduct;
705  uint8_t klass = udd->bDeviceClass;
706  uint8_t subklass = udd->bDeviceSubClass;
707  // Attempt to configure if VID/PID or device class matches with a driver
708  // Qualify with subclass too.
709  //
710  // VID/PID & class tests default to false for drivers not yet ported
711  // subclass defaults to true, so you don't have to define it if you don't have to.
712  //
713  for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
714  if(!devConfig[devConfigIndex]) continue; // no driver
715  if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
716  if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) {
717  rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
719  break;
720  }
721  }
722 
723  if(devConfigIndex < USB_NUMDEVICES) {
724  return rcode;
725  }
726 
727 
728  // blindly attempt to configure
729  for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
730  if(!devConfig[devConfigIndex]) continue;
731  if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
732  if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) continue; // If this is true it means it must have returned USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED above
733  rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
734 
735  //printf("ERROR ENUMERATING %2.2x\r\n", rcode);
737  // in case of an error dev_index should be reset to 0
738  // in order to start from the very beginning the
739  // next time the program gets here
740  //if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE)
741  // devConfigIndex = 0;
742  return rcode;
743  }
744  }
745  // if we get here that means that the device class is not supported by any of registered classes
746  rcode = DefaultAddressing(parent, port, lowspeed);
747 
748  return rcode;
749 }
750 
751 uint8_t USB::ReleaseDevice(uint8_t addr) {
752  if(!addr)
753  return 0;
754 
755  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
756  if(!devConfig[i]) continue;
757  if(devConfig[i]->GetAddress() == addr)
758  return devConfig[i]->Release();
759  }
760  return 0;
761 }
762 
763 #if 1
764 //get device descriptor
765 
766 uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
767  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL));
768 }
769 //get configuration descriptor
770 
771 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
772  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL));
773 }
774 
775 /* Requests Configuration Descriptor. Sends two Get Conf Descr requests. The first one gets the total length of all descriptors, then the second one requests this
776  total length. The length of the first request can be shorter ( 4 bytes ), however, there are devices which won't work unless this length is set to 9 */
777 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
778  const uint8_t bufSize = 64;
779  uint8_t buf[bufSize];
780  USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
781 
782  uint8_t ret = getConfDescr(addr, ep, 9, conf, buf);
783 
784  if(ret)
785  return ret;
786 
787  uint16_t total = ucd->wTotalLength;
788 
789  //USBTRACE2("\r\ntotal conf.size:", total);
790 
791  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, total, bufSize, buf, p));
792 }
793 
794 //get string descriptor
795 
796 uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
797  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL));
798 }
799 //set address
800 
801 uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
802  uint8_t rcode = ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL);
803  //delay(2); //per USB 2.0 sect.9.2.6.3
804  delay(300); // Older spec says you should wait at least 200ms
805  return rcode;
806  //return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
807 }
808 //set configuration
809 
810 uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
811  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
812 }
813 
814 #endif // defined(USB_METHODS_INLINE)
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
-
uint8_t bmRcvToggle
Definition: address.h:41
- -
virtual uint8_t Poll()
Definition: UsbCore.h:136
-
#define USB_ERROR_EP_NOT_FOUND_IN_TBL
Definition: UsbCore.h:87
-
#define bmHUBPRE
Definition: max3421e.h:165
-
#define USB_ATTACHED_SUBSTATE_WAIT_RESET
Definition: UsbCore.h:114
-
#define FSHOST
Definition: max3421e.h:30
-
#define rHCTL
Definition: max3421e.h:174
-
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
uint8_t bmNakPower
Definition: address.h:42
- -
EpInfo * getEpInfoEntry(uint8_t addr, uint8_t ep)
Definition: Usb.cpp:44
- -
#define bmSOFKAENAB
Definition: max3421e.h:166
-
#define USB_DESCRIPTOR_STRING
Definition: usb_ch9.h:65
-
uint16_t wLength
Definition: UsbCore.h:185
-
#define USB_SETTLE_DELAY
Definition: UsbCore.h:97
-
#define USB_ATTACHED_SUBSTATE_SETTLE
Definition: UsbCore.h:110
-
uint8_t getVbusState(void)
Definition: usbhost.h:128
-
#define bmRCVTOGRD
Definition: max3421e.h:199
-
#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE
Definition: UsbCore.h:78
-
#define USB_RETRY_LIMIT
Definition: UsbCore.h:96
-
#define USB_REQUEST_GET_DESCRIPTOR
Definition: usb_ch9.h:37
-
#define USB_DESCRIPTOR_DEVICE
Definition: usb_ch9.h:63
-
#define bmRCVTOG1
Definition: max3421e.h:181
-
#define USB_ERROR_INVALID_MAX_PKT_SIZE
Definition: UsbCore.h:86
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
-
#define USB_STATE_DETACHED
Definition: UsbCore.h:106
-
#define USB_NUMDEVICES
Definition: UsbCore.h:99
+Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 Contact information
18 -------------------
19 
20 Circuits At Home, LTD
21 Web : http://www.circuitsathome.com
22 e-mail : support@circuitsathome.com
23  */
24 /* USB functions */
25 
26 #include "Usb.h"
27 
28 static uint8_t usb_error = 0;
29 static uint8_t usb_task_state;
30 
31 /* constructor */
32 USB::USB() : bmHubPre(0) {
33  usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; //set up state machine
34  init();
35 }
36 
37 /* Initialize data structures */
38 void USB::init() {
39  //devConfigIndex = 0;
40  bmHubPre = 0;
41 }
42 
43 uint8_t USB::getUsbTaskState(void) {
44  return ( usb_task_state);
45 }
46 
47 void USB::setUsbTaskState(uint8_t state) {
48  usb_task_state = state;
49 }
50 
51 EpInfo* USB::getEpInfoEntry(uint8_t addr, uint8_t ep) {
52  UsbDevice *p = addrPool.GetUsbDevicePtr(addr);
53 
54  if(!p || !p->epinfo)
55  return NULL;
56 
57  EpInfo *pep = p->epinfo;
58 
59  for(uint8_t i = 0; i < p->epcount; i++) {
60  if((pep)->epAddr == ep)
61  return pep;
62 
63  pep++;
64  }
65  return NULL;
66 }
67 
68 /* set device table entry */
69 
70 /* each device is different and has different number of endpoints. This function plugs endpoint record structure, defined in application, to devtable */
71 uint8_t USB::setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr) {
72  if(!eprecord_ptr)
74 
75  UsbDevice *p = addrPool.GetUsbDevicePtr(addr);
76 
77  if(!p)
79 
80  p->address.devAddress = addr;
81  p->epinfo = eprecord_ptr;
82  p->epcount = epcount;
83 
84  return 0;
85 }
86 
87 uint8_t USB::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit) {
88  UsbDevice *p = addrPool.GetUsbDevicePtr(addr);
89 
90  if(!p)
92 
93  if(!p->epinfo)
95 
96  *ppep = getEpInfoEntry(addr, ep);
97 
98  if(!*ppep)
100 
101  *nak_limit = (0x0001UL << (((*ppep)->bmNakPower > USB_NAK_MAX_POWER) ? USB_NAK_MAX_POWER : (*ppep)->bmNakPower));
102  (*nak_limit)--;
103  /*
104  USBTRACE2("\r\nAddress: ", addr);
105  USBTRACE2(" EP: ", ep);
106  USBTRACE2(" NAK Power: ",(*ppep)->bmNakPower);
107  USBTRACE2(" NAK Limit: ", nak_limit);
108  USBTRACE("\r\n");
109  */
110  regWr(rPERADDR, addr); //set peripheral address
111 
112  uint8_t mode = regRd(rMODE);
113 
114  //Serial.print("\r\nMode: ");
115  //Serial.println( mode, HEX);
116  //Serial.print("\r\nLS: ");
117  //Serial.println(p->lowspeed, HEX);
118 
119 
120 
121  // Set bmLOWSPEED and bmHUBPRE in case of low-speed device, reset them otherwise
122  regWr(rMODE, (p->lowspeed) ? mode | bmLOWSPEED | bmHubPre : mode & ~(bmHUBPRE | bmLOWSPEED));
123 
124  return 0;
125 }
126 
127 /* Control transfer. Sets address, endpoint, fills control packet with necessary data, dispatches control packet, and initiates bulk IN transfer, */
128 /* depending on request. Actual requests are defined as inlines */
129 /* return codes: */
130 /* 00 = success */
131 
132 /* 01-0f = non-zero HRSLT */
133 uint8_t USB::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
134  uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p) {
135  bool direction = false; //request direction, IN or OUT
136  uint8_t rcode;
137  SETUP_PKT setup_pkt;
138 
139  EpInfo *pep = NULL;
140  uint16_t nak_limit = 0;
141 
142  rcode = SetAddress(addr, ep, &pep, &nak_limit);
143 
144  if(rcode)
145  return rcode;
146 
147  direction = ((bmReqType & 0x80) > 0);
148 
149  /* fill in setup packet */
150  setup_pkt.ReqType_u.bmRequestType = bmReqType;
151  setup_pkt.bRequest = bRequest;
152  setup_pkt.wVal_u.wValueLo = wValLo;
153  setup_pkt.wVal_u.wValueHi = wValHi;
154  setup_pkt.wIndex = wInd;
155  setup_pkt.wLength = total;
156 
157  bytesWr(rSUDFIFO, 8, (uint8_t*) & setup_pkt); //transfer to setup packet FIFO
158 
159  rcode = dispatchPkt(tokSETUP, ep, nak_limit); //dispatch packet
160 
161  if(rcode) //return HRSLT if not zero
162  return ( rcode);
163 
164  if(dataptr != NULL) //data stage, if present
165  {
166  if(direction) //IN transfer
167  {
168  uint16_t left = total;
169 
170  pep->bmRcvToggle = 1; //bmRCVTOG1;
171 
172  while(left) {
173  // Bytes read into buffer
174  uint16_t read = nbytes;
175  //uint16_t read = (left<nbytes) ? left : nbytes;
176 
177  rcode = InTransfer(pep, nak_limit, &read, dataptr);
178  if(rcode == hrTOGERR) {
179  // yes, we flip it wrong here so that next time it is actually correct!
180  pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
181  continue;
182  }
183 
184  if(rcode)
185  return rcode;
186 
187  // Invoke callback function if inTransfer completed successfully and callback function pointer is specified
188  if(!rcode && p)
189  ((USBReadParser*)p)->Parse(read, dataptr, total - left);
190 
191  left -= read;
192 
193  if(read < nbytes)
194  break;
195  }
196  } else //OUT transfer
197  {
198  pep->bmSndToggle = 1; //bmSNDTOG1;
199  rcode = OutTransfer(pep, nak_limit, nbytes, dataptr);
200  }
201  if(rcode) //return error
202  return ( rcode);
203  }
204  // Status stage
205  return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction
206 }
207 
208 /* IN transfer to arbitrary endpoint. Assumes PERADDR is set. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
209 /* Keep sending INs and writes data to memory area pointed by 'data' */
210 
211 /* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error,
212  fe USB xfer timeout */
213 uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
214  EpInfo *pep = NULL;
215  uint16_t nak_limit = 0;
216 
217  uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit);
218 
219  if(rcode) {
220  USBTRACE3("(USB::InTransfer) SetAddress Failed ", rcode, 0x81);
221  USBTRACE3("(USB::InTransfer) addr requested ", addr, 0x81);
222  USBTRACE3("(USB::InTransfer) ep requested ", ep, 0x81);
223  return rcode;
224  }
225  return InTransfer(pep, nak_limit, nbytesptr, data, bInterval);
226 }
227 
228 uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
229  uint8_t rcode = 0;
230  uint8_t pktsize;
231 
232  uint16_t nbytes = *nbytesptr;
233  //printf("Requesting %i bytes ", nbytes);
234  uint8_t maxpktsize = pep->maxPktSize;
235 
236  *nbytesptr = 0;
237  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
238 
239  // use a 'break' to exit this loop
240  while(1) {
241  rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS.
242  if(rcode == hrTOGERR) {
243  // yes, we flip it wrong here so that next time it is actually correct!
244  pep->bmRcvToggle = (regRd(rHRSL) & bmRCVTOGRD) ? 0 : 1;
245  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
246  continue;
247  }
248  if(rcode) {
249  //printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
250  break; //should be 0, indicating ACK. Else return error code.
251  }
252  /* check for RCVDAVIRQ and generate error if not present */
253  /* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */
254  if((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) {
255  //printf(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n");
256  rcode = 0xf0; //receive error
257  break;
258  }
259  pktsize = regRd(rRCVBC); //number of received bytes
260  //printf("Got %i bytes \r\n", pktsize);
261  // This would be OK, but...
262  //assert(pktsize <= nbytes);
263  if(pktsize > nbytes) {
264  // This can happen. Use of assert on Arduino locks up the Arduino.
265  // So I will trim the value, and hope for the best.
266  //printf(">>>>>>>> Problem! Wanted %i bytes but got %i.\r\n", nbytes, pktsize);
267  pktsize = nbytes;
268  }
269 
270  int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr);
271 
272  if(mem_left < 0)
273  mem_left = 0;
274 
275  data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data);
276 
277  regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer
278  *nbytesptr += pktsize; // add this packet's byte count to total transfer length
279 
280  /* The transfer is complete under two conditions: */
281  /* 1. The device sent a short packet (L.T. maxPacketSize) */
282  /* 2. 'nbytes' have been transferred. */
283  if((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes?
284  {
285  // Save toggle value
286  pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0;
287  //printf("\r\n");
288  rcode = 0;
289  break;
290  } else if(bInterval > 0)
291  delay(bInterval); // Delay according to polling interval
292  } //while( 1 )
293  return ( rcode);
294 }
295 
296 /* OUT transfer to arbitrary endpoint. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
297 /* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer */
298 
299 /* rcode 0 if no errors. rcode 01-0f is relayed from HRSL */
300 uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
301  EpInfo *pep = NULL;
302  uint16_t nak_limit = 0;
303 
304  uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit);
305 
306  if(rcode)
307  return rcode;
308 
309  return OutTransfer(pep, nak_limit, nbytes, data);
310 }
311 
312 uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) {
313  uint8_t rcode = hrSUCCESS, retry_count;
314  uint8_t *data_p = data; //local copy of the data pointer
315  uint16_t bytes_tosend, nak_count;
316  uint16_t bytes_left = nbytes;
317 
318  uint8_t maxpktsize = pep->maxPktSize;
319 
320  if(maxpktsize < 1 || maxpktsize > 64)
322 
323  uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT;
324 
325  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
326 
327  while(bytes_left) {
328  retry_count = 0;
329  nak_count = 0;
330  bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left;
331  bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO
332  regWr(rSNDBC, bytes_tosend); //set number of bytes
333  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
334  while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ
335  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
336  rcode = (regRd(rHRSL) & 0x0f);
337 
338  while(rcode && ((int32_t)((uint32_t)millis() - timeout) < 0L)) {
339  switch(rcode) {
340  case hrNAK:
341  nak_count++;
342  if(nak_limit && (nak_count == nak_limit))
343  goto breakout;
344  //return ( rcode);
345  break;
346  case hrTIMEOUT:
347  retry_count++;
348  if(retry_count == USB_RETRY_LIMIT)
349  goto breakout;
350  //return ( rcode);
351  break;
352  case hrTOGERR:
353  // yes, we flip it wrong here so that next time it is actually correct!
354  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
355  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
356  break;
357  default:
358  goto breakout;
359  }//switch( rcode
360 
361  /* process NAK according to Host out NAK bug */
362  regWr(rSNDBC, 0);
363  regWr(rSNDFIFO, *data_p);
364  regWr(rSNDBC, bytes_tosend);
365  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
366  while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ
367  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
368  rcode = (regRd(rHRSL) & 0x0f);
369  }//while( rcode && ....
370  bytes_left -= bytes_tosend;
371  data_p += bytes_tosend;
372  }//while( bytes_left...
373 breakout:
374 
375  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle
376  return ( rcode); //should be 0 in all cases
377 }
378 /* dispatch USB packet. Assumes peripheral address is set and relevant buffer is loaded/empty */
379 /* If NAK, tries to re-send up to nak_limit times */
380 /* If nak_limit == 0, do not count NAKs, exit after timeout */
381 /* If bus timeout, re-sends up to USB_RETRY_LIMIT times */
382 
383 /* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout */
384 uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
385  uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT;
386  uint8_t tmpdata;
387  uint8_t rcode = hrSUCCESS;
388  uint8_t retry_count = 0;
389  uint16_t nak_count = 0;
390 
391  while((int32_t)((uint32_t)millis() - timeout) < 0L) {
392 #if defined(ESP8266) || defined(ESP32)
393  yield(); // needed in order to reset the watchdog timer on the ESP8266
394 #endif
395  regWr(rHXFR, (token | ep)); //launch the transfer
397 
398  while((int32_t)((uint32_t)millis() - timeout) < 0L) //wait for transfer completion
399  {
400 #if defined(ESP8266) || defined(ESP32)
401  yield(); // needed in order to reset the watchdog timer on the ESP8266
402 #endif
403  tmpdata = regRd(rHIRQ);
404 
405  if(tmpdata & bmHXFRDNIRQ) {
406  regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt
407  rcode = 0x00;
408  break;
409  }//if( tmpdata & bmHXFRDNIRQ
410 
411  }//while ( millis() < timeout
412 
413  //if (rcode != 0x00) //exit if timeout
414  // return ( rcode);
415 
416  rcode = (regRd(rHRSL) & 0x0f); //analyze transfer result
417 
418  switch(rcode) {
419  case hrNAK:
420  nak_count++;
421  if(nak_limit && (nak_count == nak_limit))
422  return (rcode);
423  break;
424  case hrTIMEOUT:
425  retry_count++;
426  if(retry_count == USB_RETRY_LIMIT)
427  return (rcode);
428  break;
429  default:
430  return (rcode);
431  }//switch( rcode
432 
433  }//while( timeout > millis()
434  return ( rcode);
435 }
436 
437 /* USB main task. Performs enumeration/cleanup */
438 void USB::Task(void) //USB state machine
439 {
440  uint8_t rcode;
441  uint8_t tmpdata;
442  static uint32_t delay = 0;
443  //USB_DEVICE_DESCRIPTOR buf;
444  bool lowspeed = false;
445 
446  MAX3421E::Task();
447 
448  tmpdata = getVbusState();
449 
450  /* modify USB task state if Vbus changed */
451  switch(tmpdata) {
452  case SE1: //illegal state
453  usb_task_state = USB_DETACHED_SUBSTATE_ILLEGAL;
454  lowspeed = false;
455  break;
456  case SE0: //disconnected
457  if((usb_task_state & USB_STATE_MASK) != USB_STATE_DETACHED)
458  usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE;
459  lowspeed = false;
460  break;
461  case LSHOST:
462 
463  lowspeed = true;
464  //intentional fallthrough
465  case FSHOST: //attached
466  if((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
467  delay = (uint32_t)millis() + USB_SETTLE_DELAY;
468  usb_task_state = USB_ATTACHED_SUBSTATE_SETTLE;
469  }
470  break;
471  }// switch( tmpdata
472 
473  for(uint8_t i = 0; i < USB_NUMDEVICES; i++)
474  if(devConfig[i])
475  rcode = devConfig[i]->Poll();
476 
477  switch(usb_task_state) {
479  init();
480 
481  for(uint8_t i = 0; i < USB_NUMDEVICES; i++)
482  if(devConfig[i])
483  rcode = devConfig[i]->Release();
484 
485  usb_task_state = USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE;
486  break;
487  case USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE: //just sit here
488  break;
489  case USB_DETACHED_SUBSTATE_ILLEGAL: //just sit here
490  break;
491  case USB_ATTACHED_SUBSTATE_SETTLE: //settle time for just attached device
492  if((int32_t)((uint32_t)millis() - delay) >= 0L)
493  usb_task_state = USB_ATTACHED_SUBSTATE_RESET_DEVICE;
494  else break; // don't fall through
496  regWr(rHCTL, bmBUSRST); //issue bus reset
498  break;
500  if((regRd(rHCTL) & bmBUSRST) == 0) {
501  tmpdata = regRd(rMODE) | bmSOFKAENAB; //start SOF generation
502  regWr(rMODE, tmpdata);
503  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_SOF;
504  //delay = (uint32_t)millis() + 20; //20ms wait after reset per USB spec
505  }
506  break;
507  case USB_ATTACHED_SUBSTATE_WAIT_SOF: //todo: change check order
508  if(regRd(rHIRQ) & bmFRAMEIRQ) {
509  //when first SOF received _and_ 20ms has passed we can continue
510  /*
511  if (delay < (uint32_t)millis()) //20ms passed
512  usb_task_state = USB_STATE_CONFIGURING;
513  */
514  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET;
515  delay = (uint32_t)millis() + 20;
516  }
517  break;
519  if((int32_t)((uint32_t)millis() - delay) >= 0L) usb_task_state = USB_STATE_CONFIGURING;
520  else break; // don't fall through
522 
523  //Serial.print("\r\nConf.LS: ");
524  //Serial.println(lowspeed, HEX);
525 
526  rcode = Configuring(0, 0, lowspeed);
527 
528  if(rcode) {
530  usb_error = rcode;
531  usb_task_state = USB_STATE_ERROR;
532  }
533  } else
534  usb_task_state = USB_STATE_RUNNING;
535  break;
536  case USB_STATE_RUNNING:
537  break;
538  case USB_STATE_ERROR:
539  //MAX3421E::Init();
540  break;
541  } // switch( usb_task_state )
542 }
543 
544 uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
545  //uint8_t buf[12];
546  uint8_t rcode;
547  UsbDevice *p0 = NULL, *p = NULL;
548 
549  // Get pointer to pseudo device with address 0 assigned
550  p0 = addrPool.GetUsbDevicePtr(0);
551 
552  if(!p0)
554 
555  if(!p0->epinfo)
557 
558  p0->lowspeed = (lowspeed) ? true : false;
559 
560  // Allocate new address according to device class
561  uint8_t bAddress = addrPool.AllocAddress(parent, false, port);
562 
563  if(!bAddress)
565 
566  p = addrPool.GetUsbDevicePtr(bAddress);
567 
568  if(!p)
570 
571  p->lowspeed = lowspeed;
572 
573  // Assign new address to the device
574  rcode = setAddr(0, 0, bAddress);
575 
576  if(rcode) {
577  addrPool.FreeAddress(bAddress);
578  bAddress = 0;
579  return rcode;
580  }
581  return 0;
582 };
583 
584 uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed) {
585  //printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port);
586  uint8_t retries = 0;
587 
588 again:
589  uint8_t rcode = devConfig[driver]->ConfigureDevice(parent, port, lowspeed);
591  if(parent == 0) {
592  // Send a bus reset on the root interface.
593  regWr(rHCTL, bmBUSRST); //issue bus reset
594  delay(102); // delay 102ms, compensate for clock inaccuracy.
595  } else {
596  // reset parent port
597  devConfig[parent]->ResetHubPort(port);
598  }
599  } else if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works
600  delay(100);
601  retries++;
602  goto again;
603  } else if(rcode)
604  return rcode;
605 
606  rcode = devConfig[driver]->Init(parent, port, lowspeed);
607  if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works
608  delay(100);
609  retries++;
610  goto again;
611  }
612  if(rcode) {
613  // Issue a bus reset, because the device may be in a limbo state
614  if(parent == 0) {
615  // Send a bus reset on the root interface.
616  regWr(rHCTL, bmBUSRST); //issue bus reset
617  delay(102); // delay 102ms, compensate for clock inaccuracy.
618  } else {
619  // reset parent port
620  devConfig[parent]->ResetHubPort(port);
621  }
622  }
623  return rcode;
624 }
625 
626 /*
627  * This is broken. We need to enumerate differently.
628  * It causes major problems with several devices if detected in an unexpected order.
629  *
630  *
631  * Oleg - I wouldn't do anything before the newly connected device is considered sane.
632  * i.e.(delays are not indicated for brevity):
633  * 1. reset
634  * 2. GetDevDescr();
635  * 3a. If ACK, continue with allocating address, addressing, etc.
636  * 3b. Else reset again, count resets, stop at some number (5?).
637  * 4. When max.number of resets is reached, toggle power/fail
638  * If desired, this could be modified by performing two resets with GetDevDescr() in the middle - however, from my experience, if a device answers to GDD()
639  * it doesn't need to be reset again
640  * New steps proposal:
641  * 1: get address pool instance. exit on fail
642  * 2: pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf). exit on fail.
643  * 3: bus reset, 100ms delay
644  * 4: set address
645  * 5: pUsb->setEpInfoEntry(bAddress, 1, epInfo), exit on fail
646  * 6: while (configurations) {
647  * for(each configuration) {
648  * for (each driver) {
649  * 6a: Ask device if it likes configuration. Returns 0 on OK.
650  * If successful, the driver configured device.
651  * The driver now owns the endpoints, and takes over managing them.
652  * The following will need codes:
653  * Everything went well, instance consumed, exit with success.
654  * Instance already in use, ignore it, try next driver.
655  * Not a supported device, ignore it, try next driver.
656  * Not a supported configuration for this device, ignore it, try next driver.
657  * Could not configure device, fatal, exit with fail.
658  * }
659  * }
660  * }
661  * 7: for(each driver) {
662  * 7a: Ask device if it knows this VID/PID. Acts exactly like 6a, but using VID/PID
663  * 8: if we get here, no driver likes the device plugged in, so exit failure.
664  *
665  */
666 uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
667  //uint8_t bAddress = 0;
668  //printf("Configuring: parent = %i, port = %i\r\n", parent, port);
669  uint8_t devConfigIndex;
670  uint8_t rcode = 0;
671  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
672  USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
673  UsbDevice *p = NULL;
674  EpInfo *oldep_ptr = NULL;
675  EpInfo epInfo;
676 
677  epInfo.epAddr = 0;
678  epInfo.maxPktSize = 8;
679  epInfo.bmSndToggle = 0;
680  epInfo.bmRcvToggle = 0;
681  epInfo.bmNakPower = USB_NAK_MAX_POWER;
682 
683  //delay(2000);
684  AddressPool &addrPool = GetAddressPool();
685  // Get pointer to pseudo device with address 0 assigned
686  p = addrPool.GetUsbDevicePtr(0);
687  if(!p) {
688  //printf("Configuring error: USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL\r\n");
690  }
691 
692  // Save old pointer to EP_RECORD of address 0
693  oldep_ptr = p->epinfo;
694 
695  // Temporary assign new pointer to epInfo to p->epinfo in order to
696  // avoid toggle inconsistence
697 
698  p->epinfo = &epInfo;
699 
700  p->lowspeed = lowspeed;
701  // Get device descriptor
702  rcode = getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
703 
704  // Restore p->epinfo
705  p->epinfo = oldep_ptr;
706 
707  if(rcode) {
708  //printf("Configuring error: Can't get USB_DEVICE_DESCRIPTOR\r\n");
709  return rcode;
710  }
711 
712  // to-do?
713  // Allocate new address according to device class
714  //bAddress = addrPool.AllocAddress(parent, false, port);
715 
716  uint16_t vid = udd->idVendor;
717  uint16_t pid = udd->idProduct;
718  uint8_t klass = udd->bDeviceClass;
719  uint8_t subklass = udd->bDeviceSubClass;
720  // Attempt to configure if VID/PID or device class matches with a driver
721  // Qualify with subclass too.
722  //
723  // VID/PID & class tests default to false for drivers not yet ported
724  // subclass defaults to true, so you don't have to define it if you don't have to.
725  //
726  for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
727  if(!devConfig[devConfigIndex]) continue; // no driver
728  if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
729  if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) {
730  rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
732  break;
733  }
734  }
735 
736  if(devConfigIndex < USB_NUMDEVICES) {
737  return rcode;
738  }
739 
740 
741  // blindly attempt to configure
742  for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
743  if(!devConfig[devConfigIndex]) continue;
744  if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
745  if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) continue; // If this is true it means it must have returned USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED above
746  rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
747 
748  //printf("ERROR ENUMERATING %2.2x\r\n", rcode);
750  // in case of an error dev_index should be reset to 0
751  // in order to start from the very beginning the
752  // next time the program gets here
753  //if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE)
754  // devConfigIndex = 0;
755  return rcode;
756  }
757  }
758  // if we get here that means that the device class is not supported by any of registered classes
759  rcode = DefaultAddressing(parent, port, lowspeed);
760 
761  return rcode;
762 }
763 
764 uint8_t USB::ReleaseDevice(uint8_t addr) {
765  if(!addr)
766  return 0;
767 
768  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
769  if(!devConfig[i]) continue;
770  if(devConfig[i]->GetAddress() == addr)
771  return devConfig[i]->Release();
772  }
773  return 0;
774 }
775 
776 #if 1
777 //get device descriptor
778 
779 uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
780  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL));
781 }
782 //get configuration descriptor
783 
784 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
785  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL));
786 }
787 
788 /* Requests Configuration Descriptor. Sends two Get Conf Descr requests. The first one gets the total length of all descriptors, then the second one requests this
789  total length. The length of the first request can be shorter ( 4 bytes ), however, there are devices which won't work unless this length is set to 9 */
790 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
791  const uint8_t bufSize = 64;
792  uint8_t buf[bufSize];
793  USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
794 
795  uint8_t ret = getConfDescr(addr, ep, 9, conf, buf);
796 
797  if(ret)
798  return ret;
799 
800  uint16_t total = ucd->wTotalLength;
801 
802  //USBTRACE2("\r\ntotal conf.size:", total);
803 
804  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, total, bufSize, buf, p));
805 }
806 
807 //get string descriptor
808 
809 uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
810  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL));
811 }
812 //set address
813 
814 uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
815  uint8_t rcode = ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL);
816  //delay(2); //per USB 2.0 sect.9.2.6.3
817  delay(300); // Older spec says you should wait at least 200ms
818  return rcode;
819  //return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
820 }
821 //set configuration
822 
823 uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
824  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
825 }
826 
827 #endif // defined(USB_METHODS_INLINE)
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+
uint8_t bmRcvToggle
Definition: address.h:48
+ +
virtual uint8_t Poll()
Definition: UsbCore.h:147
+
#define USB_ERROR_EP_NOT_FOUND_IN_TBL
Definition: UsbCore.h:98
+
#define bmHUBPRE
Definition: max3421e.h:172
+
#define USB_ATTACHED_SUBSTATE_WAIT_RESET
Definition: UsbCore.h:125
+
#define FSHOST
Definition: max3421e.h:37
+
#define rHCTL
Definition: max3421e.h:181
+
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
uint8_t bmNakPower
Definition: address.h:49
+ +
EpInfo * getEpInfoEntry(uint8_t addr, uint8_t ep)
Definition: Usb.cpp:51
+ +
#define bmSOFKAENAB
Definition: max3421e.h:173
+
#define USB_DESCRIPTOR_STRING
Definition: usb_ch9.h:72
+
uint16_t wLength
Definition: UsbCore.h:196
+
#define USB_SETTLE_DELAY
Definition: UsbCore.h:108
+
#define USB_ATTACHED_SUBSTATE_SETTLE
Definition: UsbCore.h:121
+
uint8_t getVbusState(void)
Definition: usbhost.h:151
+
#define bmRCVTOGRD
Definition: max3421e.h:206
+
#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE
Definition: UsbCore.h:89
+
#define USB_RETRY_LIMIT
Definition: UsbCore.h:107
+
#define USB_REQUEST_GET_DESCRIPTOR
Definition: usb_ch9.h:44
+
#define USB_DESCRIPTOR_DEVICE
Definition: usb_ch9.h:70
+
#define bmRCVTOG1
Definition: max3421e.h:188
+
#define USB_ERROR_INVALID_MAX_PKT_SIZE
Definition: UsbCore.h:97
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
#define USB_STATE_DETACHED
Definition: UsbCore.h:117
+
#define USB_NUMDEVICES
Definition: UsbCore.h:110
-
#define rRCVBC
Definition: max3421e.h:40
-
#define hrJERR
Definition: max3421e.h:220
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
-
virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:128
-
uint8_t Task()
Definition: usbhost.h:502
-
#define hrSUCCESS
Definition: max3421e.h:207
-
#define USB_STATE_ERROR
Definition: UsbCore.h:119
-
uint8_t bmRequestType
Definition: UsbCore.h:166
-
#define bmSNDTOGRD
Definition: max3421e.h:200
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
-
#define USB_DESCRIPTOR_CONFIGURATION
Definition: usb_ch9.h:64
+
#define rRCVBC
Definition: max3421e.h:47
+
#define hrJERR
Definition: max3421e.h:227
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
+
virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:139
+
uint8_t Task()
Definition: usbhost.h:525
+
#define hrSUCCESS
Definition: max3421e.h:214
+
#define USB_STATE_ERROR
Definition: UsbCore.h:130
+
uint8_t bmRequestType
Definition: UsbCore.h:177
+
#define bmSNDTOGRD
Definition: max3421e.h:207
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
+
#define USB_DESCRIPTOR_CONFIGURATION
Definition: usb_ch9.h:71
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
#define bmHXFRDNIRQ
Definition: max3421e.h:146
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
USB(void)
Definition: Usb.cpp:25
-
#define USB_STATE_RUNNING
Definition: UsbCore.h:118
- -
uint8_t epAddr
Definition: address.h:33
-
#define rRCVFIFO
Definition: max3421e.h:37
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
-
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)
Definition: address.h:181
-
uint16_t wIndex
Definition: UsbCore.h:184
-
#define bmBUSRST
Definition: max3421e.h:176
-
#define tokOUT
Definition: max3421e.h:190
-
#define tokIN
Definition: max3421e.h:189
-
#define LSHOST
Definition: max3421e.h:31
-
#define USB_XFER_TIMEOUT
Definition: UsbCore.h:94
+
#define bmHXFRDNIRQ
Definition: max3421e.h:153
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
USB(void)
Definition: Usb.cpp:32
+
#define USB_STATE_RUNNING
Definition: UsbCore.h:129
+ +
uint8_t epAddr
Definition: address.h:40
+
#define rRCVFIFO
Definition: max3421e.h:44
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
+
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)
Definition: address.h:188
+
uint16_t wIndex
Definition: UsbCore.h:195
+
#define bmBUSRST
Definition: max3421e.h:183
+
#define tokOUT
Definition: max3421e.h:197
+
#define tokIN
Definition: max3421e.h:196
+
#define LSHOST
Definition: max3421e.h:38
+
#define USB_XFER_TIMEOUT
Definition: UsbCore.h:105
union SETUP_PKT::@33 wVal_u
-
Definition: address.h:32
-
#define rMODE
Definition: max3421e.h:160
-
void setUsbTaskState(uint8_t state)
Definition: Usb.cpp:40
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
-
#define hrNAK
Definition: max3421e.h:211
-
#define bmREQ_GET_DESCR
Definition: UsbCore.h:47
-
#define rSNDBC
Definition: max3421e.h:41
-
#define rHRSL
Definition: max3421e.h:196
-
#define USB_ATTACHED_SUBSTATE_RESET_DEVICE
Definition: UsbCore.h:111
-
uint8_t * bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
Definition: usbhost.h:298
-
#define tokINHS
Definition: max3421e.h:191
-
#define bmLOWSPEED
Definition: max3421e.h:164
-
virtual void ResetHubPort(uint8_t port)
Definition: UsbCore.h:144
-
uint8_t * bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
Definition: usbhost.h:196
-
uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t *dataptr)
Definition: Usb.cpp:796
- -
#define USB_REQUEST_SET_ADDRESS
Definition: usb_ch9.h:36
-
#define tokSETUP
Definition: max3421e.h:188
-
#define rHXFR
Definition: max3421e.h:185
-
#define rHIRQ
Definition: max3421e.h:137
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define rSNDFIFO
Definition: max3421e.h:38
- -
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
uint8_t devAddress
Definition: address.h:67
- -
#define tokOUTHS
Definition: max3421e.h:192
-
uint8_t getUsbTaskState(void)
Definition: Usb.cpp:36
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
-
#define USB_STATE_MASK
Definition: UsbCore.h:104
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
-
void Task(void)
Definition: Usb.cpp:425
-
#define USB_DETACHED_SUBSTATE_ILLEGAL
Definition: UsbCore.h:109
-
#define hrTIMEOUT
Definition: max3421e.h:221
-
#define rPERADDR
Definition: max3421e.h:172
-
#define bmRCVDAVIRQ
Definition: max3421e.h:141
-
#define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE
Definition: UsbCore.h:112
-
void regWr(uint8_t reg, uint8_t data)
Definition: usbhost.h:153
-
#define bmRCVTOG0
Definition: max3421e.h:180
-
uint8_t epcount
Definition: address.h:78
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
-
#define USB_STATE_CONFIGURING
Definition: UsbCore.h:117
-
uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit)
Definition: Usb.cpp:377
-
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:124
-
#define bmSNDTOG0
Definition: max3421e.h:182
-
uint8_t regRd(uint8_t reg)
Definition: usbhost.h:259
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
#define USB_ERROR_INVALID_ARGUMENT
Definition: UsbCore.h:84
-
uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed)
Definition: Usb.cpp:653
+
Definition: address.h:39
+
#define rMODE
Definition: max3421e.h:167
+
void setUsbTaskState(uint8_t state)
Definition: Usb.cpp:47
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
+
#define hrNAK
Definition: max3421e.h:218
+
#define bmREQ_GET_DESCR
Definition: UsbCore.h:58
+
#define rSNDBC
Definition: max3421e.h:48
+
#define rHRSL
Definition: max3421e.h:203
+
#define USB_ATTACHED_SUBSTATE_RESET_DEVICE
Definition: UsbCore.h:122
+
uint8_t * bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
Definition: usbhost.h:321
+
#define tokINHS
Definition: max3421e.h:198
+
#define bmLOWSPEED
Definition: max3421e.h:171
+
virtual void ResetHubPort(uint8_t port)
Definition: UsbCore.h:155
+
uint8_t * bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
Definition: usbhost.h:219
+
uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t *dataptr)
Definition: Usb.cpp:809
+ +
#define USB_REQUEST_SET_ADDRESS
Definition: usb_ch9.h:43
+
#define tokSETUP
Definition: max3421e.h:195
+
#define rHXFR
Definition: max3421e.h:192
+
#define rHIRQ
Definition: max3421e.h:144
+
uint8_t bmSndToggle
Definition: address.h:47
+
#define rSNDFIFO
Definition: max3421e.h:45
+ +
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
uint8_t devAddress
Definition: address.h:74
+ +
#define tokOUTHS
Definition: max3421e.h:199
+
uint8_t getUsbTaskState(void)
Definition: Usb.cpp:43
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
+
#define USB_STATE_MASK
Definition: UsbCore.h:115
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
+
void Task(void)
Definition: Usb.cpp:438
+
#define USB_DETACHED_SUBSTATE_ILLEGAL
Definition: UsbCore.h:120
+
#define hrTIMEOUT
Definition: max3421e.h:228
+
#define rPERADDR
Definition: max3421e.h:179
+
#define bmRCVDAVIRQ
Definition: max3421e.h:148
+
#define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE
Definition: UsbCore.h:123
+
void regWr(uint8_t reg, uint8_t data)
Definition: usbhost.h:176
+
#define bmRCVTOG0
Definition: max3421e.h:187
+
uint8_t epcount
Definition: address.h:85
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
+
#define USB_STATE_CONFIGURING
Definition: UsbCore.h:128
+
uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit)
Definition: Usb.cpp:384
+
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:135
+
#define bmSNDTOG0
Definition: max3421e.h:189
+
uint8_t regRd(uint8_t reg)
Definition: usbhost.h:282
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
#define USB_ERROR_INVALID_ARGUMENT
Definition: UsbCore.h:95
+
uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed)
Definition: Usb.cpp:666
union SETUP_PKT::@32 ReqType_u
-
#define USBTRACE3(s, r, l)
Definition: macros.h:78
-
uint8_t bRequest
Definition: UsbCore.h:174
-
#define SE0
Definition: max3421e.h:28
-
virtual void FreeAddress(uint8_t addr)
Definition: address.h:255
-
virtual uint8_t Release()
Definition: UsbCore.h:132
-
#define bmFRAMEIRQ
Definition: max3421e.h:145
-
#define hrTOGERR
Definition: max3421e.h:213
-
#define SE1
Definition: max3421e.h:29
-
#define rSUDFIFO
Definition: max3421e.h:39
-
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)
Definition: address.h:203
-
#define bmREQ_SET
Definition: UsbCore.h:48
-
UsbDeviceAddress address
Definition: address.h:77
-
#define USB_REQUEST_SET_CONFIGURATION
Definition: usb_ch9.h:40
-
#define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE
Definition: UsbCore.h:108
-
uint8_t wValueHi
Definition: UsbCore.h:181
-
uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed)
Definition: Usb.cpp:531
-
#define USB_DETACHED_SUBSTATE_INITIALIZE
Definition: UsbCore.h:107
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define USB_ATTACHED_SUBSTATE_WAIT_SOF
Definition: UsbCore.h:113
-
uint8_t wValueLo
Definition: UsbCore.h:180
-
#define bmSNDTOG1
Definition: max3421e.h:183
-
uint8_t ReleaseDevice(uint8_t addr)
Definition: Usb.cpp:751
-
#define USB_ERROR_TRANSFER_TIMEOUT
Definition: UsbCore.h:92
-
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
Definition: UsbCore.h:88
- +
#define USBTRACE3(s, r, l)
Definition: macros.h:85
+
uint8_t bRequest
Definition: UsbCore.h:185
+
#define SE0
Definition: max3421e.h:35
+
virtual void FreeAddress(uint8_t addr)
Definition: address.h:262
+
virtual uint8_t Release()
Definition: UsbCore.h:143
+
#define bmFRAMEIRQ
Definition: max3421e.h:152
+
#define hrTOGERR
Definition: max3421e.h:220
+
#define SE1
Definition: max3421e.h:36
+
#define rSUDFIFO
Definition: max3421e.h:46
+
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)
Definition: address.h:210
+
#define bmREQ_SET
Definition: UsbCore.h:59
+
UsbDeviceAddress address
Definition: address.h:84
+
#define USB_REQUEST_SET_CONFIGURATION
Definition: usb_ch9.h:47
+
#define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE
Definition: UsbCore.h:119
+
uint8_t wValueHi
Definition: UsbCore.h:192
+
uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed)
Definition: Usb.cpp:544
+
#define USB_DETACHED_SUBSTATE_INITIALIZE
Definition: UsbCore.h:118
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define USB_ATTACHED_SUBSTATE_WAIT_SOF
Definition: UsbCore.h:124
+
uint8_t wValueLo
Definition: UsbCore.h:191
+
#define bmSNDTOG1
Definition: max3421e.h:190
+
uint8_t ReleaseDevice(uint8_t addr)
Definition: Usb.cpp:764
+
#define USB_ERROR_TRANSFER_TIMEOUT
Definition: UsbCore.h:103
+
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
Definition: UsbCore.h:99
+
diff --git a/_usb_8h.html b/_usb_8h.html index 1b198c20..5087c235 100644 --- a/_usb_8h.html +++ b/_usb_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Usb.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- + @@ -153,7 +133,7 @@ This graph shows which files directly or indirectly include this file:
diff --git a/_usb_8h__dep__incl.map b/_usb_8h__dep__incl.map index 2953461a..9057c61b 100644 --- a/_usb_8h__dep__incl.map +++ b/_usb_8h__dep__incl.map @@ -17,7 +17,7 @@ - + diff --git a/_usb_8h__dep__incl.md5 b/_usb_8h__dep__incl.md5 index 5590cd87..e1d7ac1c 100644 --- a/_usb_8h__dep__incl.md5 +++ b/_usb_8h__dep__incl.md5 @@ -1 +1 @@ -cbd29ebc2b06737d0300e8c7453ef569 \ No newline at end of file +6b21142e913bd435243a744ada379d21 \ No newline at end of file diff --git a/_usb_8h__dep__incl.png b/_usb_8h__dep__incl.png index 8e292d1e..90150ef7 100644 Binary files a/_usb_8h__dep__incl.png and b/_usb_8h__dep__incl.png differ diff --git a/_usb_8h_source.html b/_usb_8h_source.html index ee76a791..98c818e2 100644 --- a/_usb_8h_source.html +++ b/_usb_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Usb.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
Usb.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 /* USB functions */
18 #ifndef _usb_h_
19 #define _usb_h_
20 
21 // WARNING: Do not change the order of includes, or stuff will break!
22 #include <inttypes.h>
23 #include <stddef.h>
24 #include <stdio.h>
25 
26 // None of these should ever be included by a driver, or a user's sketch.
27 #include "settings.h"
28 #include "printhex.h"
29 #include "message.h"
30 #include "hexdump.h"
31 #include "sink_parser.h"
32 #include "max3421e.h"
33 #include "address.h"
34 #include "avrpins.h"
35 #include "usb_ch9.h"
36 #include "usbhost.h"
37 #include "UsbCore.h"
38 #include "parsetools.h"
39 #include "confdescparser.h"
40 
41 #endif //_usb_h_
+Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 Contact information
18 -------------------
19 
20 Circuits At Home, LTD
21 Web : http://www.circuitsathome.com
22 e-mail : support@circuitsathome.com
23  */
24 /* USB functions */
25 #ifndef _usb_h_
26 #define _usb_h_
27 
28 // WARNING: Do not change the order of includes, or stuff will break!
29 #include <inttypes.h>
30 #include <stddef.h>
31 #include <stdio.h>
32 
33 // None of these should ever be included by a driver, or a user's sketch.
34 #include "settings.h"
35 #include "printhex.h"
36 #include "message.h"
37 #include "hexdump.h"
38 #include "sink_parser.h"
39 #include "max3421e.h"
40 #include "address.h"
41 #include "avrpins.h"
42 #include "usb_ch9.h"
43 #include "usbhost.h"
44 #include "UsbCore.h"
45 #include "parsetools.h"
46 #include "confdescparser.h"
47 
48 #endif //_usb_h_
@@ -108,7 +88,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_usb_core_8h.html b/_usb_core_8h.html index d13f686e..a8ea182e 100644 --- a/_usb_core_8h.html +++ b/_usb_core_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: UsbCore.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ bmREQ_GET_DESCR

+
@@ -245,11 +227,13 @@ Typedefs
-

Definition at line 47 of file UsbCore.h.

+

Definition at line 58 of file UsbCore.h.

- + +

◆ bmREQ_SET

+
@@ -259,11 +243,13 @@ Typedefs
-

Definition at line 48 of file UsbCore.h.

+

Definition at line 59 of file UsbCore.h.

- + +

◆ bmREQ_CL_GET_INTF

+
@@ -273,11 +259,13 @@ Typedefs
-

Definition at line 49 of file UsbCore.h.

+

Definition at line 60 of file UsbCore.h.

- + +

◆ USB_CLASS_USE_CLASS_INFO

+
@@ -287,11 +275,13 @@ Typedefs
-

Definition at line 56 of file UsbCore.h.

+

Definition at line 67 of file UsbCore.h.

- + +

◆ USB_CLASS_AUDIO

+
@@ -301,11 +291,13 @@ Typedefs
-

Definition at line 57 of file UsbCore.h.

+

Definition at line 68 of file UsbCore.h.

- + +

◆ USB_CLASS_COM_AND_CDC_CTRL

+
@@ -315,11 +307,13 @@ Typedefs
-

Definition at line 58 of file UsbCore.h.

+

Definition at line 69 of file UsbCore.h.

- + +

◆ USB_CLASS_HID

+
@@ -329,11 +323,13 @@ Typedefs
-

Definition at line 59 of file UsbCore.h.

+

Definition at line 70 of file UsbCore.h.

- + +

◆ USB_CLASS_PHYSICAL

+
@@ -343,11 +339,13 @@ Typedefs
-

Definition at line 60 of file UsbCore.h.

+

Definition at line 71 of file UsbCore.h.

- + +

◆ USB_CLASS_IMAGE

+
@@ -357,11 +355,13 @@ Typedefs
-

Definition at line 61 of file UsbCore.h.

+

Definition at line 72 of file UsbCore.h.

- + +

◆ USB_CLASS_PRINTER

+
@@ -371,11 +371,13 @@ Typedefs
-

Definition at line 62 of file UsbCore.h.

+

Definition at line 73 of file UsbCore.h.

- + +

◆ USB_CLASS_MASS_STORAGE

+
@@ -385,11 +387,13 @@ Typedefs
-

Definition at line 63 of file UsbCore.h.

+

Definition at line 74 of file UsbCore.h.

- + +

◆ USB_CLASS_HUB

+
@@ -399,11 +403,13 @@ Typedefs
-

Definition at line 64 of file UsbCore.h.

+

Definition at line 75 of file UsbCore.h.

- + +

◆ USB_CLASS_CDC_DATA

+
@@ -413,11 +419,13 @@ Typedefs
-

Definition at line 65 of file UsbCore.h.

+

Definition at line 76 of file UsbCore.h.

- + +

◆ USB_CLASS_SMART_CARD

+
@@ -427,11 +435,13 @@ Typedefs
-

Definition at line 66 of file UsbCore.h.

+

Definition at line 77 of file UsbCore.h.

- + +

◆ USB_CLASS_CONTENT_SECURITY

+
@@ -441,11 +451,13 @@ Typedefs
-

Definition at line 67 of file UsbCore.h.

+

Definition at line 78 of file UsbCore.h.

- + +

◆ USB_CLASS_VIDEO

+
@@ -455,11 +467,13 @@ Typedefs
-

Definition at line 68 of file UsbCore.h.

+

Definition at line 79 of file UsbCore.h.

- + +

◆ USB_CLASS_PERSONAL_HEALTH

+
@@ -469,11 +483,13 @@ Typedefs
-

Definition at line 69 of file UsbCore.h.

+

Definition at line 80 of file UsbCore.h.

- + +

◆ USB_CLASS_DIAGNOSTIC_DEVICE

+
@@ -483,11 +499,13 @@ Typedefs
-

Definition at line 70 of file UsbCore.h.

+

Definition at line 81 of file UsbCore.h.

- + +

◆ USB_CLASS_WIRELESS_CTRL

+
@@ -497,11 +515,13 @@ Typedefs
-

Definition at line 71 of file UsbCore.h.

+

Definition at line 82 of file UsbCore.h.

- + +

◆ USB_CLASS_MISC

+
@@ -511,11 +531,13 @@ Typedefs
-

Definition at line 72 of file UsbCore.h.

+

Definition at line 83 of file UsbCore.h.

- + +

◆ USB_CLASS_APP_SPECIFIC

+
@@ -525,11 +547,13 @@ Typedefs
-

Definition at line 73 of file UsbCore.h.

+

Definition at line 84 of file UsbCore.h.

- + +

◆ USB_CLASS_VENDOR_SPECIFIC

+
@@ -539,11 +563,13 @@ Typedefs
-

Definition at line 74 of file UsbCore.h.

+

Definition at line 85 of file UsbCore.h.

- + +

◆ USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED

+
@@ -553,11 +579,13 @@ Typedefs
-

Definition at line 77 of file UsbCore.h.

+

Definition at line 88 of file UsbCore.h.

- + +

◆ USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE

+
@@ -567,11 +595,13 @@ Typedefs
-

Definition at line 78 of file UsbCore.h.

+

Definition at line 89 of file UsbCore.h.

- + +

◆ USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS

+
@@ -581,11 +611,13 @@ Typedefs
-

Definition at line 79 of file UsbCore.h.

+

Definition at line 90 of file UsbCore.h.

- + +

◆ USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL

+
@@ -595,11 +627,13 @@ Typedefs
-

Definition at line 80 of file UsbCore.h.

+

Definition at line 91 of file UsbCore.h.

- + +

◆ USB_ERROR_HUB_ADDRESS_OVERFLOW

+
@@ -609,11 +643,13 @@ Typedefs
-

Definition at line 81 of file UsbCore.h.

+

Definition at line 92 of file UsbCore.h.

- + +

◆ USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL

+
@@ -623,11 +659,13 @@ Typedefs
-

Definition at line 82 of file UsbCore.h.

+

Definition at line 93 of file UsbCore.h.

- + +

◆ USB_ERROR_EPINFO_IS_NULL

+
@@ -637,11 +675,13 @@ Typedefs
-

Definition at line 83 of file UsbCore.h.

+

Definition at line 94 of file UsbCore.h.

- + +

◆ USB_ERROR_INVALID_ARGUMENT

+
@@ -651,11 +691,13 @@ Typedefs
-

Definition at line 84 of file UsbCore.h.

+

Definition at line 95 of file UsbCore.h.

- + +

◆ USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE

+
@@ -665,11 +707,13 @@ Typedefs
-

Definition at line 85 of file UsbCore.h.

+

Definition at line 96 of file UsbCore.h.

- + +

◆ USB_ERROR_INVALID_MAX_PKT_SIZE

+
@@ -679,11 +723,13 @@ Typedefs
-

Definition at line 86 of file UsbCore.h.

+

Definition at line 97 of file UsbCore.h.

- + +

◆ USB_ERROR_EP_NOT_FOUND_IN_TBL

+
@@ -693,11 +739,13 @@ Typedefs
-

Definition at line 87 of file UsbCore.h.

+

Definition at line 98 of file UsbCore.h.

- + +

◆ USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET

+
@@ -707,11 +755,13 @@ Typedefs
-

Definition at line 88 of file UsbCore.h.

+

Definition at line 99 of file UsbCore.h.

- + +

◆ USB_ERROR_FailGetDevDescr

+
@@ -721,11 +771,13 @@ Typedefs
-

Definition at line 89 of file UsbCore.h.

+

Definition at line 100 of file UsbCore.h.

- + +

◆ USB_ERROR_FailSetDevTblEntry

+
@@ -735,11 +787,13 @@ Typedefs
-

Definition at line 90 of file UsbCore.h.

+

Definition at line 101 of file UsbCore.h.

- + +

◆ USB_ERROR_FailGetConfDescr

+
@@ -749,11 +803,13 @@ Typedefs
-

Definition at line 91 of file UsbCore.h.

+

Definition at line 102 of file UsbCore.h.

- + +

◆ USB_ERROR_TRANSFER_TIMEOUT

+
@@ -763,11 +819,13 @@ Typedefs
-

Definition at line 92 of file UsbCore.h.

+

Definition at line 103 of file UsbCore.h.

- + +

◆ USB_XFER_TIMEOUT

+
@@ -777,11 +835,13 @@ Typedefs
-

Definition at line 94 of file UsbCore.h.

+

Definition at line 105 of file UsbCore.h.

- + +

◆ USB_RETRY_LIMIT

+
@@ -791,11 +851,13 @@ Typedefs
-

Definition at line 96 of file UsbCore.h.

+

Definition at line 107 of file UsbCore.h.

- + +

◆ USB_SETTLE_DELAY

+
@@ -805,11 +867,13 @@ Typedefs
-

Definition at line 97 of file UsbCore.h.

+

Definition at line 108 of file UsbCore.h.

- + +

◆ USB_NUMDEVICES

+
@@ -819,11 +883,13 @@ Typedefs
-

Definition at line 99 of file UsbCore.h.

+

Definition at line 110 of file UsbCore.h.

- + +

◆ HUB_PORT_RESET_DELAY

+
@@ -833,11 +899,13 @@ Typedefs
-

Definition at line 101 of file UsbCore.h.

+

Definition at line 112 of file UsbCore.h.

- + +

◆ USB_STATE_MASK

+
@@ -847,11 +915,13 @@ Typedefs
-

Definition at line 104 of file UsbCore.h.

+

Definition at line 115 of file UsbCore.h.

- + +

◆ USB_STATE_DETACHED

+
@@ -861,11 +931,13 @@ Typedefs
-

Definition at line 106 of file UsbCore.h.

+

Definition at line 117 of file UsbCore.h.

- + +

◆ USB_DETACHED_SUBSTATE_INITIALIZE

+
@@ -875,11 +947,13 @@ Typedefs
-

Definition at line 107 of file UsbCore.h.

+

Definition at line 118 of file UsbCore.h.

- + +

◆ USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE

+
@@ -889,11 +963,13 @@ Typedefs
-

Definition at line 108 of file UsbCore.h.

+

Definition at line 119 of file UsbCore.h.

- + +

◆ USB_DETACHED_SUBSTATE_ILLEGAL

+
@@ -903,11 +979,13 @@ Typedefs
-

Definition at line 109 of file UsbCore.h.

+

Definition at line 120 of file UsbCore.h.

- + +

◆ USB_ATTACHED_SUBSTATE_SETTLE

+
@@ -917,11 +995,13 @@ Typedefs
-

Definition at line 110 of file UsbCore.h.

+

Definition at line 121 of file UsbCore.h.

- + +

◆ USB_ATTACHED_SUBSTATE_RESET_DEVICE

+
@@ -931,11 +1011,13 @@ Typedefs
-

Definition at line 111 of file UsbCore.h.

+

Definition at line 122 of file UsbCore.h.

- + +

◆ USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE

+
@@ -945,11 +1027,13 @@ Typedefs
-

Definition at line 112 of file UsbCore.h.

+

Definition at line 123 of file UsbCore.h.

- + +

◆ USB_ATTACHED_SUBSTATE_WAIT_SOF

+
@@ -959,11 +1043,13 @@ Typedefs
-

Definition at line 113 of file UsbCore.h.

+

Definition at line 124 of file UsbCore.h.

- + +

◆ USB_ATTACHED_SUBSTATE_WAIT_RESET

+
@@ -973,11 +1059,13 @@ Typedefs
-

Definition at line 114 of file UsbCore.h.

+

Definition at line 125 of file UsbCore.h.

- + +

◆ USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE

+
@@ -987,11 +1075,13 @@ Typedefs
-

Definition at line 115 of file UsbCore.h.

+

Definition at line 126 of file UsbCore.h.

- + +

◆ USB_STATE_ADDRESSING

+
@@ -1001,11 +1091,13 @@ Typedefs
-

Definition at line 116 of file UsbCore.h.

+

Definition at line 127 of file UsbCore.h.

- + +

◆ USB_STATE_CONFIGURING

+
@@ -1015,11 +1107,13 @@ Typedefs
-

Definition at line 117 of file UsbCore.h.

+

Definition at line 128 of file UsbCore.h.

- + +

◆ USB_STATE_RUNNING

+
@@ -1029,11 +1123,13 @@ Typedefs
-

Definition at line 118 of file UsbCore.h.

+

Definition at line 129 of file UsbCore.h.

- + +

◆ USB_STATE_ERROR

+
@@ -1043,12 +1139,14 @@ Typedefs
-

Definition at line 119 of file UsbCore.h.

+

Definition at line 130 of file UsbCore.h.

Typedef Documentation

- + +

◆ MAX3421E

+
@@ -1058,11 +1156,13 @@ Typedefs
-

Definition at line 43 of file UsbCore.h.

+

Definition at line 54 of file UsbCore.h.

- + +

◆ PSETUP_PKT

+
@@ -1079,7 +1179,7 @@ Typedefs diff --git a/_usb_core_8h_source.html b/_usb_core_8h_source.html index 27e91655..694e771c 100644 --- a/_usb_core_8h_source.html +++ b/_usb_core_8h_source.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: UsbCore.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
UsbCore.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(_usb_h_) || defined(USBCORE_H)
19 #error "Never include UsbCore.h directly; include Usb.h instead"
20 #else
21 #define USBCORE_H
22 
23 // Not used anymore? If anyone uses this, please let us know so that this may be
24 // moved to the proper place, settings.h.
25 //#define USB_METHODS_INLINE
26 
27 /* shield pins. First parameter - SS pin, second parameter - INT pin */
28 #ifdef BOARD_BLACK_WIDDOW
29 typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
30 #elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
31 #if EXT_RAM
32 typedef MAX3421e<P20, P7> MAX3421E; // Teensy++ 2.0 with XMEM2
33 #else
34 typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 1.0 and 2.0
35 #endif
36 #elif defined(BOARD_MEGA_ADK)
37 typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
38 #elif defined(ARDUINO_AVR_BALANDUINO)
39 typedef MAX3421e<P20, P19> MAX3421E; // Balanduino
40 #elif defined(__ARDUINO_X86__) && PLATFORM_ID == 0x06
41 typedef MAX3421e<P3, P2> MAX3421E; // The Intel Galileo supports much faster read and write speed at pin 2 and 3
42 #else
43 typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo, Due etc.), Intel Edison, Intel Galileo 2 or Teensy 2.0 and 3.0
44 #endif
45 
46 /* Common setup data constant combinations */
47 #define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type
48 #define bmREQ_SET USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //set request type for all but 'set feature' and 'set interface'
49 #define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type
50 
51 // D7 data transfer direction (0 - host-to-device, 1 - device-to-host)
52 // D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)
53 // D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)
54 
55 // USB Device Classes
56 #define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors
57 #define USB_CLASS_AUDIO 0x01 // Audio
58 #define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control
59 #define USB_CLASS_HID 0x03 // HID
60 #define USB_CLASS_PHYSICAL 0x05 // Physical
61 #define USB_CLASS_IMAGE 0x06 // Image
62 #define USB_CLASS_PRINTER 0x07 // Printer
63 #define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage
64 #define USB_CLASS_HUB 0x09 // Hub
65 #define USB_CLASS_CDC_DATA 0x0a // CDC-Data
66 #define USB_CLASS_SMART_CARD 0x0b // Smart-Card
67 #define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security
68 #define USB_CLASS_VIDEO 0x0e // Video
69 #define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare
70 #define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device
71 #define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller
72 #define USB_CLASS_MISC 0xef // Miscellaneous
73 #define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific
74 #define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific
75 
76 // Additional Error Codes
77 #define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1
78 #define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
79 #define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
80 #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
81 #define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5
82 #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6
83 #define USB_ERROR_EPINFO_IS_NULL 0xD7
84 #define USB_ERROR_INVALID_ARGUMENT 0xD8
85 #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9
86 #define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA
87 #define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB
88 #define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET 0xE0
89 #define USB_ERROR_FailGetDevDescr 0xE1
90 #define USB_ERROR_FailSetDevTblEntry 0xE2
91 #define USB_ERROR_FailGetConfDescr 0xE3
92 #define USB_ERROR_TRANSFER_TIMEOUT 0xFF
93 
94 #define USB_XFER_TIMEOUT 5000 // (5000) USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec
95 //#define USB_NAK_LIMIT 32000 // NAK limit for a transfer. 0 means NAKs are not counted
96 #define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer
97 #define USB_SETTLE_DELAY 200 // settle delay in milliseconds
98 
99 #define USB_NUMDEVICES 16 //number of USB devices
100 //#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
101 #define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
102 
103 /* USB state machine states */
104 #define USB_STATE_MASK 0xf0
105 
106 #define USB_STATE_DETACHED 0x10
107 #define USB_DETACHED_SUBSTATE_INITIALIZE 0x11
108 #define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12
109 #define USB_DETACHED_SUBSTATE_ILLEGAL 0x13
110 #define USB_ATTACHED_SUBSTATE_SETTLE 0x20
111 #define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30
112 #define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40
113 #define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50
114 #define USB_ATTACHED_SUBSTATE_WAIT_RESET 0x51
115 #define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60
116 #define USB_STATE_ADDRESSING 0x70
117 #define USB_STATE_CONFIGURING 0x80
118 #define USB_STATE_RUNNING 0x90
119 #define USB_STATE_ERROR 0xa0
120 
122 public:
123 
124  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed) {
125  return 0;
126  }
127 
128  virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
129  return 0;
130  }
131 
132  virtual uint8_t Release() {
133  return 0;
134  }
135 
136  virtual uint8_t Poll() {
137  return 0;
138  }
139 
140  virtual uint8_t GetAddress() {
141  return 0;
142  }
143 
144  virtual void ResetHubPort(uint8_t port) {
145  return;
146  } // Note used for hubs only!
147 
148  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
149  return false;
150  }
151 
152  virtual bool DEVCLASSOK(uint8_t klass) {
153  return false;
154  }
155 
156  virtual bool DEVSUBCLASSOK(uint8_t subklass) {
157  return true;
158  }
159 
160 };
161 
162 /* USB Setup Packet Structure */
163 typedef struct {
164 
165  union { // offset description
166  uint8_t bmRequestType; // 0 Bit-map of request type
167 
168  struct {
169  uint8_t recipient : 5; // Recipient of the request
170  uint8_t type : 2; // Type of request
171  uint8_t direction : 1; // Direction of data X-fer
172  } __attribute__((packed));
173  } ReqType_u;
174  uint8_t bRequest; // 1 Request
175 
176  union {
177  uint16_t wValue; // 2 Depends on bRequest
178 
179  struct {
180  uint8_t wValueLo;
181  uint8_t wValueHi;
182  } __attribute__((packed));
183  } wVal_u;
184  uint16_t wIndex; // 4 Depends on bRequest
185  uint16_t wLength; // 6 Depends on bRequest
186 } __attribute__((packed)) SETUP_PKT, *PSETUP_PKT;
187 
188 
189 
190 // Base class for incoming data parser
191 
193 public:
194  virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) = 0;
195 };
196 
197 class USB : public MAX3421E {
199  USBDeviceConfig* devConfig[USB_NUMDEVICES];
200  uint8_t bmHubPre;
201 
202 public:
203  USB(void);
204 
205  void SetHubPreMask() {
206  bmHubPre |= bmHUBPRE;
207  };
208 
210  bmHubPre &= (~bmHUBPRE);
211  };
212 
214  return (AddressPool&)addrPool;
215  };
216 
218  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
219  if(!devConfig[i]) {
220  devConfig[i] = pdev;
221  return 0;
222  }
223  }
225  };
226 
228  addrPool.ForEachUsbDevice(pfunc);
229  };
230  uint8_t getUsbTaskState(void);
231  void setUsbTaskState(uint8_t state);
232 
233  EpInfo* getEpInfoEntry(uint8_t addr, uint8_t ep);
234  uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr);
235 
236  /* Control requests */
237  uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr);
238  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr);
239 
240  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p);
241 
242  uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr);
243  uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr);
244  uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value);
245 
246  uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, bool direction);
247  uint8_t ctrlStatus(uint8_t ep, bool direction, uint16_t nak_limit);
248  uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval = 0);
249  uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
250  uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit);
251 
252  void Task(void);
253 
254  uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed);
255  uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed);
256  uint8_t ReleaseDevice(uint8_t addr);
257 
258  uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
259  uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p);
260 
261 private:
262  void init();
263  uint8_t SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit);
264  uint8_t OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data);
265  uint8_t InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval = 0);
266  uint8_t AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed);
267 };
268 
269 #if 0 //defined(USB_METHODS_INLINE)
270 //get device descriptor
271 
272 inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
273  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, dataptr));
274 }
275 //get configuration descriptor
276 
277 inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
278  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, dataptr));
279 }
280 //get string descriptor
281 
282 inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {
283  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, nuint8_ts, dataptr));
284 }
285 //set address
286 
287 inline uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
288  return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, NULL));
289 }
290 //set configuration
291 
292 inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
293  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, NULL));
294 }
295 
296 #endif // defined(USB_METHODS_INLINE)
297 
298 #endif /* USBCORE_H */
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
- -
uint16_t wValue
Definition: UsbCore.h:177
-
virtual uint8_t Poll()
Definition: UsbCore.h:136
-
#define bmHUBPRE
Definition: max3421e.h:165
-
virtual uint8_t GetAddress()
Definition: UsbCore.h:140
-
#define USB_DESCRIPTOR_STRING
Definition: usb_ch9.h:65
-
uint16_t wLength
Definition: UsbCore.h:185
- -
#define USB_REQUEST_GET_DESCRIPTOR
Definition: usb_ch9.h:37
-
#define USB_DESCRIPTOR_DEVICE
Definition: usb_ch9.h:63
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
-
#define USB_NUMDEVICES
Definition: UsbCore.h:99
- -
virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:128
-
uint8_t bmRequestType
Definition: UsbCore.h:166
-
#define USB_DESCRIPTOR_CONFIGURATION
Definition: usb_ch9.h:64
-
void ResetHubPreMask()
Definition: UsbCore.h:209
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
uint16_t wIndex
Definition: UsbCore.h:184
-
void SetHubPreMask()
Definition: UsbCore.h:205
-
Definition: address.h:32
-
#define bmREQ_GET_DESCR
Definition: UsbCore.h:47
-
virtual void ResetHubPort(uint8_t port)
Definition: UsbCore.h:144
-
#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS
Definition: UsbCore.h:79
-
uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t *dataptr)
Definition: Usb.cpp:796
-
#define USB_REQUEST_SET_ADDRESS
Definition: usb_ch9.h:36
-
MAX3421e< P10, P9 > MAX3421E
Definition: UsbCore.h:43
- - -
virtual bool DEVSUBCLASSOK(uint8_t subklass)
Definition: UsbCore.h:156
+Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 Contact information
18 -------------------
19 
20 Circuits At Home, LTD
21 Web : http://www.circuitsathome.com
22 e-mail : support@circuitsathome.com
23  */
24 
25 #if !defined(_usb_h_) || defined(USBCORE_H)
26 #error "Never include UsbCore.h directly; include Usb.h instead"
27 #else
28 #define USBCORE_H
29 
30 // Not used anymore? If anyone uses this, please let us know so that this may be
31 // moved to the proper place, settings.h.
32 //#define USB_METHODS_INLINE
33 
34 /* shield pins. First parameter - SS pin, second parameter - INT pin */
35 #ifdef BOARD_BLACK_WIDDOW
36 typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
37 #elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
38 #if EXT_RAM
39 typedef MAX3421e<P20, P7> MAX3421E; // Teensy++ 2.0 with XMEM2
40 #else
41 typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 1.0 and 2.0
42 #endif
43 #elif defined(BOARD_MEGA_ADK)
44 typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
45 #elif defined(ARDUINO_AVR_BALANDUINO)
46 typedef MAX3421e<P20, P19> MAX3421E; // Balanduino
47 #elif defined(__ARDUINO_X86__) && PLATFORM_ID == 0x06
48 typedef MAX3421e<P3, P2> MAX3421E; // The Intel Galileo supports much faster read and write speed at pin 2 and 3
49 #elif defined(ESP8266)
50 typedef MAX3421e<P15, P5> MAX3421E; // ESP8266 boards
51 #elif defined(ESP32)
52 typedef MAX3421e<P5, P17> MAX3421E; // ESP32 boards
53 #else
54 typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo, Due etc.), Intel Edison, Intel Galileo 2 or Teensy 2.0 and 3.x
55 #endif
56 
57 /* Common setup data constant combinations */
58 #define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type
59 #define bmREQ_SET USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //set request type for all but 'set feature' and 'set interface'
60 #define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type
61 
62 // D7 data transfer direction (0 - host-to-device, 1 - device-to-host)
63 // D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)
64 // D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)
65 
66 // USB Device Classes
67 #define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors
68 #define USB_CLASS_AUDIO 0x01 // Audio
69 #define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control
70 #define USB_CLASS_HID 0x03 // HID
71 #define USB_CLASS_PHYSICAL 0x05 // Physical
72 #define USB_CLASS_IMAGE 0x06 // Image
73 #define USB_CLASS_PRINTER 0x07 // Printer
74 #define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage
75 #define USB_CLASS_HUB 0x09 // Hub
76 #define USB_CLASS_CDC_DATA 0x0a // CDC-Data
77 #define USB_CLASS_SMART_CARD 0x0b // Smart-Card
78 #define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security
79 #define USB_CLASS_VIDEO 0x0e // Video
80 #define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare
81 #define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device
82 #define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller
83 #define USB_CLASS_MISC 0xef // Miscellaneous
84 #define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific
85 #define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific
86 
87 // Additional Error Codes
88 #define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1
89 #define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
90 #define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
91 #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
92 #define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5
93 #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6
94 #define USB_ERROR_EPINFO_IS_NULL 0xD7
95 #define USB_ERROR_INVALID_ARGUMENT 0xD8
96 #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9
97 #define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA
98 #define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB
99 #define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET 0xE0
100 #define USB_ERROR_FailGetDevDescr 0xE1
101 #define USB_ERROR_FailSetDevTblEntry 0xE2
102 #define USB_ERROR_FailGetConfDescr 0xE3
103 #define USB_ERROR_TRANSFER_TIMEOUT 0xFF
104 
105 #define USB_XFER_TIMEOUT 5000 // (5000) USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec
106 //#define USB_NAK_LIMIT 32000 // NAK limit for a transfer. 0 means NAKs are not counted
107 #define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer
108 #define USB_SETTLE_DELAY 200 // settle delay in milliseconds
109 
110 #define USB_NUMDEVICES 16 //number of USB devices
111 //#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
112 #define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
113 
114 /* USB state machine states */
115 #define USB_STATE_MASK 0xf0
116 
117 #define USB_STATE_DETACHED 0x10
118 #define USB_DETACHED_SUBSTATE_INITIALIZE 0x11
119 #define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12
120 #define USB_DETACHED_SUBSTATE_ILLEGAL 0x13
121 #define USB_ATTACHED_SUBSTATE_SETTLE 0x20
122 #define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30
123 #define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40
124 #define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50
125 #define USB_ATTACHED_SUBSTATE_WAIT_RESET 0x51
126 #define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60
127 #define USB_STATE_ADDRESSING 0x70
128 #define USB_STATE_CONFIGURING 0x80
129 #define USB_STATE_RUNNING 0x90
130 #define USB_STATE_ERROR 0xa0
131 
133 public:
134 
135  virtual uint8_t Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed __attribute__((unused))) {
136  return 0;
137  }
138 
139  virtual uint8_t ConfigureDevice(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed __attribute__((unused))) {
140  return 0;
141  }
142 
143  virtual uint8_t Release() {
144  return 0;
145  }
146 
147  virtual uint8_t Poll() {
148  return 0;
149  }
150 
151  virtual uint8_t GetAddress() {
152  return 0;
153  }
154 
155  virtual void ResetHubPort(uint8_t port __attribute__((unused))) {
156  return;
157  } // Note used for hubs only!
158 
159  virtual bool VIDPIDOK(uint16_t vid __attribute__((unused)), uint16_t pid __attribute__((unused))) {
160  return false;
161  }
162 
163  virtual bool DEVCLASSOK(uint8_t klass __attribute__((unused))) {
164  return false;
165  }
166 
167  virtual bool DEVSUBCLASSOK(uint8_t subklass __attribute__((unused))) {
168  return true;
169  }
170 
171 };
172 
173 /* USB Setup Packet Structure */
174 typedef struct {
175 
176  union { // offset description
177  uint8_t bmRequestType; // 0 Bit-map of request type
178 
179  struct {
180  uint8_t recipient : 5; // Recipient of the request
181  uint8_t type : 2; // Type of request
182  uint8_t direction : 1; // Direction of data X-fer
183  } __attribute__((packed));
184  } ReqType_u;
185  uint8_t bRequest; // 1 Request
186 
187  union {
188  uint16_t wValue; // 2 Depends on bRequest
189 
190  struct {
191  uint8_t wValueLo;
192  uint8_t wValueHi;
193  } __attribute__((packed));
194  } wVal_u;
195  uint16_t wIndex; // 4 Depends on bRequest
196  uint16_t wLength; // 6 Depends on bRequest
197 } __attribute__((packed)) SETUP_PKT, *PSETUP_PKT;
198 
199 
200 
201 // Base class for incoming data parser
202 
204 public:
205  virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) = 0;
206 };
207 
208 class USB : public MAX3421E {
210  USBDeviceConfig* devConfig[USB_NUMDEVICES];
211  uint8_t bmHubPre;
212 
213 public:
214  USB(void);
215 
216  void SetHubPreMask() {
217  bmHubPre |= bmHUBPRE;
218  };
219 
221  bmHubPre &= (~bmHUBPRE);
222  };
223 
225  return (AddressPool&)addrPool;
226  };
227 
229  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
230  if(!devConfig[i]) {
231  devConfig[i] = pdev;
232  return 0;
233  }
234  }
236  };
237 
239  addrPool.ForEachUsbDevice(pfunc);
240  };
241  uint8_t getUsbTaskState(void);
242  void setUsbTaskState(uint8_t state);
243 
244  EpInfo* getEpInfoEntry(uint8_t addr, uint8_t ep);
245  uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr);
246 
247  /* Control requests */
248  uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr);
249  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr);
250 
251  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p);
252 
253  uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr);
254  uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr);
255  uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value);
256 
257  uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, bool direction);
258  uint8_t ctrlStatus(uint8_t ep, bool direction, uint16_t nak_limit);
259  uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval = 0);
260  uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
261  uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit);
262 
263  void Task(void);
264 
265  uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed);
266  uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed);
267  uint8_t ReleaseDevice(uint8_t addr);
268 
269  uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
270  uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p);
271 
272 private:
273  void init();
274  uint8_t SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit);
275  uint8_t OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data);
276  uint8_t InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval = 0);
277  uint8_t AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed);
278 };
279 
280 #if 0 //defined(USB_METHODS_INLINE)
281 //get device descriptor
282 
283 inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
284  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, dataptr));
285 }
286 //get configuration descriptor
287 
288 inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
289  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, dataptr));
290 }
291 //get string descriptor
292 
293 inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {
294  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, nuint8_ts, dataptr));
295 }
296 //set address
297 
298 inline uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
299  return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, NULL));
300 }
301 //set configuration
302 
303 inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
304  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, NULL));
305 }
306 
307 #endif // defined(USB_METHODS_INLINE)
308 
309 #endif /* USBCORE_H */
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+ +
uint16_t wValue
Definition: UsbCore.h:188
+
virtual uint8_t Poll()
Definition: UsbCore.h:147
+
#define bmHUBPRE
Definition: max3421e.h:172
+
virtual uint8_t GetAddress()
Definition: UsbCore.h:151
+
EpInfo * getEpInfoEntry(uint8_t addr, uint8_t ep)
Definition: Usb.cpp:51
+
#define USB_DESCRIPTOR_STRING
Definition: usb_ch9.h:72
+
uint16_t wLength
Definition: UsbCore.h:196
+
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset)=0
+ +
#define USB_REQUEST_GET_DESCRIPTOR
Definition: usb_ch9.h:44
+
#define USB_DESCRIPTOR_DEVICE
Definition: usb_ch9.h:70
+
uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr, bool direction)
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
#define USB_NUMDEVICES
Definition: UsbCore.h:110
+ +
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
+
virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:139
+
uint8_t bmRequestType
Definition: UsbCore.h:177
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
+
#define USB_DESCRIPTOR_CONFIGURATION
Definition: usb_ch9.h:71
+
void ResetHubPreMask()
Definition: UsbCore.h:220
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
USB(void)
Definition: Usb.cpp:32
+
uint16_t wIndex
Definition: UsbCore.h:195
+
void SetHubPreMask()
Definition: UsbCore.h:216
+
Definition: address.h:39
+
void setUsbTaskState(uint8_t state)
Definition: Usb.cpp:47
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
+
#define bmREQ_GET_DESCR
Definition: UsbCore.h:58
+
uint8_t direction
Definition: UsbCore.h:182
+
virtual void ResetHubPort(uint8_t port)
Definition: UsbCore.h:155
+
#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS
Definition: UsbCore.h:90
+
uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t *dataptr)
Definition: Usb.cpp:809
+
uint8_t type
Definition: UsbCore.h:181
+
#define USB_REQUEST_SET_ADDRESS
Definition: usb_ch9.h:43
+
uint8_t ctrlStatus(uint8_t ep, bool direction, uint16_t nak_limit)
+
MAX3421e< P10, P9 > MAX3421E
Definition: UsbCore.h:54
+ + +
uint8_t getUsbTaskState(void)
Definition: Usb.cpp:43
+
void Task(void)
Definition: Usb.cpp:438
+
virtual bool DEVSUBCLASSOK(uint8_t subklass)
Definition: UsbCore.h:167
-
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc)
Definition: address.h:192
-
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:124
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: UsbCore.h:148
-
Definition: UsbCore.h:197
-
uint8_t bRequest
Definition: UsbCore.h:174
-
virtual uint8_t Release()
Definition: UsbCore.h:132
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define bmREQ_SET
Definition: UsbCore.h:48
-
virtual bool DEVCLASSOK(uint8_t klass)
Definition: UsbCore.h:152
-
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc)
Definition: UsbCore.h:227
-
#define USB_REQUEST_SET_CONFIGURATION
Definition: usb_ch9.h:40
-
uint8_t wValueHi
Definition: UsbCore.h:181
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
uint8_t wValueLo
Definition: UsbCore.h:180
-
void(* UsbDeviceHandleFunc)(UsbDevice *pdev)
Definition: address.h:90
+
struct SETUP_PKT * PSETUP_PKT
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc)
Definition: address.h:199
+
uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit)
Definition: Usb.cpp:384
+
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:135
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: UsbCore.h:159
+
uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed)
Definition: Usb.cpp:666
+
Definition: UsbCore.h:208
+
uint8_t bRequest
Definition: UsbCore.h:185
+
virtual uint8_t Release()
Definition: UsbCore.h:143
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define bmREQ_SET
Definition: UsbCore.h:59
+
virtual bool DEVCLASSOK(uint8_t klass)
Definition: UsbCore.h:163
+
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc)
Definition: UsbCore.h:238
+
#define USB_REQUEST_SET_CONFIGURATION
Definition: usb_ch9.h:47
+
uint8_t recipient
Definition: UsbCore.h:180
+
uint8_t wValueHi
Definition: UsbCore.h:192
+
uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed)
Definition: Usb.cpp:544
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
uint8_t wValueLo
Definition: UsbCore.h:191
+
void(* UsbDeviceHandleFunc)(UsbDevice *pdev)
Definition: address.h:97
+
uint8_t ReleaseDevice(uint8_t addr)
Definition: Usb.cpp:764
diff --git a/_wii_8cpp.html b/_wii_8cpp.html index 11db60e2..17830163 100644 --- a/_wii_8cpp.html +++ b/_wii_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Wii.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Variable Documentation

- + +

◆ WII_LEDS

+
@@ -129,11 +111,13 @@ Variables
Initial value:
= {
0x00,
0x10,
0x20,
0x40,
0x80,
0x90,
0xA0,
0xC0,
0xD0,
0xE0,
0xF0,
}
-

Definition at line 25 of file Wii.cpp.

+

Definition at line 25 of file Wii.cpp.

- + +

◆ WII_BUTTONS

+
@@ -143,11 +127,13 @@ Variables
Initial value:
= {
0x00008,
0x00002,
0x00004,
0x00001,
0,
0x00010,
0x00100,
0x00200,
0x01000,
0x08000,
0x10000,
0x20000,
0x00400,
0x00800,
}
-

Definition at line 40 of file Wii.cpp.

+

Definition at line 40 of file Wii.cpp.

- + +

◆ WII_PROCONTROLLER_BUTTONS

+
@@ -157,7 +143,7 @@ Variables
Initial value:
= {
0x00100,
0x00080,
0x00040,
0x00200,
0,
0x00004,
0x20000,
0x10000,
0x00010,
0x00008,
0, 0,
0x04000,
0x01000,
0x00800,
0x02000,
0x00020,
0x00002,
0x08000,
0x00400,
}
-

Definition at line 59 of file Wii.cpp.

+

Definition at line 59 of file Wii.cpp.

@@ -166,7 +152,7 @@ Variables diff --git a/_wii_8cpp__incl.md5 b/_wii_8cpp__incl.md5 index 90a48635..16fb198e 100644 --- a/_wii_8cpp__incl.md5 +++ b/_wii_8cpp__incl.md5 @@ -1 +1 @@ -38127c822874d8407cb01375c5f2f11b \ No newline at end of file +230d657150b96397e6c72f7fb46df52c \ No newline at end of file diff --git a/_wii_8cpp__incl.png b/_wii_8cpp__incl.png index dd421431..bf5f565b 100644 Binary files a/_wii_8cpp__incl.png and b/_wii_8cpp__incl.png differ diff --git a/_wii_8cpp_source.html b/_wii_8cpp_source.html index fd29ecf6..d757b976 100644 --- a/_wii_8cpp_source.html +++ b/_wii_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Wii.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
Wii.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16 
17  IR camera support added by Allan Glover (adglover9.81@gmail.com) and Kristian Lauszus
18  */
19 
20 #include "Wii.h"
21 // To enable serial debugging see "settings.h"
22 //#define EXTRADEBUG // Uncomment to get even more debugging data
23 //#define PRINTREPORT // Uncomment to print the report send by the Wii controllers
24 
25 const uint8_t WII_LEDS[] PROGMEM = {
26  0x00, // OFF
27  0x10, // LED1
28  0x20, // LED2
29  0x40, // LED3
30  0x80, // LED4
31 
32  0x90, // LED5
33  0xA0, // LED6
34  0xC0, // LED7
35  0xD0, // LED8
36  0xE0, // LED9
37  0xF0, // LED10
38 };
39 
40 const uint32_t WII_BUTTONS[] PROGMEM = {
41  0x00008, // UP
42  0x00002, // RIGHT
43  0x00004, // DOWN
44  0x00001, // LEFT
45 
46  0, // Skip
47  0x00010, // PLUS
48  0x00100, // TWO
49  0x00200, // ONE
50 
51  0x01000, // MINUS
52  0x08000, // HOME
53  0x10000, // Z
54  0x20000, // C
55 
56  0x00400, // B
57  0x00800, // A
58 };
59 const uint32_t WII_PROCONTROLLER_BUTTONS[] PROGMEM = {
60  0x00100, // UP
61  0x00080, // RIGHT
62  0x00040, // DOWN
63  0x00200, // LEFT
64 
65  0, // Skip
66  0x00004, // PLUS
67  0x20000, // L3
68  0x10000, // R3
69 
70  0x00010, // MINUS
71  0x00008, // HOME
72  0, 0, // Skip
73 
74  0x04000, // B
75  0x01000, // A
76  0x00800, // X
77  0x02000, // Y
78 
79  0x00020, // L
80  0x00002, // R
81  0x08000, // ZL
82  0x00400, // ZR
83 };
84 
85 WII::WII(BTD *p, bool pair) :
86 BluetoothService(p) // Pointer to USB class instance - mandatory
87 {
89 
90  HIDBuffer[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
91 
92  /* Set device cid for the control and intterrupt channelse - LSB */
93  control_dcid[0] = 0x60; // 0x0060
94  control_dcid[1] = 0x00;
95  interrupt_dcid[0] = 0x61; // 0x0061
96  interrupt_dcid[1] = 0x00;
97 
98  Reset();
99 }
100 
101 void WII::Reset() {
102  wiimoteConnected = false;
103  nunchuckConnected = false;
104  motionPlusConnected = false;
105  activateNunchuck = false;
106  motionValuesReset = false;
107  activeConnection = false;
108  motionPlusInside = false;
109  pBtd->wiiUProController = false;
111  wiiBalanceBoardConnected = false;
112  l2cap_event_flag = 0; // Reset flags
113  l2cap_state = L2CAP_WAIT;
114 }
115 
116 void WII::disconnect() { // Use this void to disconnect any of the controllers
117  if(!motionPlusInside) { // The old Wiimote needs a delay after the first command or it will automatically reconnect
118  if(motionPlusConnected) {
119 #ifdef DEBUG_USB_HOST
120  Notify(PSTR("\r\nDeactivating Motion Plus"), 0x80);
121 #endif
122  initExtension1(); // This will disable the Motion Plus extension
123  }
124  timer = millis() + 1000; // We have to wait for the message before the rest of the channels can be deactivated
125  } else
126  timer = millis(); // Don't wait
127  // First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
128  pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
129  Reset();
130  l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
131 }
132 
133 void WII::ACLData(uint8_t* l2capinbuf) {
134  if(!pBtd->l2capConnectionClaimed && pBtd->incomingWii && !wiimoteConnected && !activeConnection) {
135  if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
136  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
137  motionPlusInside = pBtd->motionPlusInside;
138  pBtd->incomingWii = false;
139  pBtd->l2capConnectionClaimed = true; // Claim that the incoming connection belongs to this service
140  activeConnection = true;
141  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
142  l2cap_state = L2CAP_WAIT;
143  }
144  }
145  }
146 
147  if(checkHciHandle(l2capinbuf, hci_handle)) { // acl_handle_ok
148  if((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001U) { // l2cap_control - Channel ID for ACL-U
149  if(l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
150 #ifdef DEBUG_USB_HOST
151  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
152  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
153  Notify(PSTR(" "), 0x80);
154  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
155  Notify(PSTR(" "), 0x80);
156  D_PrintHex<uint8_t > (l2capinbuf[17], 0x80);
157  Notify(PSTR(" "), 0x80);
158  D_PrintHex<uint8_t > (l2capinbuf[16], 0x80);
159  Notify(PSTR(" "), 0x80);
160  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
161  Notify(PSTR(" "), 0x80);
162  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
163 #endif
164  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_RESPONSE) {
165  if(((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) && ((l2capinbuf[18] | (l2capinbuf[19] << 8)) == SUCCESSFUL)) { // Success
166  if(l2capinbuf[14] == control_dcid[0] && l2capinbuf[15] == control_dcid[1]) {
167  //Notify(PSTR("\r\nHID Control Connection Complete"), 0x80);
168  identifier = l2capinbuf[9];
169  control_scid[0] = l2capinbuf[12];
170  control_scid[1] = l2capinbuf[13];
172  } else if(l2capinbuf[14] == interrupt_dcid[0] && l2capinbuf[15] == interrupt_dcid[1]) {
173  //Notify(PSTR("\r\nHID Interrupt Connection Complete"), 0x80);
174  identifier = l2capinbuf[9];
175  interrupt_scid[0] = l2capinbuf[12];
176  interrupt_scid[1] = l2capinbuf[13];
178  }
179  }
180  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
181 #ifdef EXTRADEBUG
182  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
183  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
184  Notify(PSTR(" "), 0x80);
185  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
186  Notify(PSTR(" SCID: "), 0x80);
187  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
188  Notify(PSTR(" "), 0x80);
189  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
190  Notify(PSTR(" Identifier: "), 0x80);
191  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
192 #endif
193  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
194  identifier = l2capinbuf[9];
195  control_scid[0] = l2capinbuf[14];
196  control_scid[1] = l2capinbuf[15];
198  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_INTR_PSM) {
199  identifier = l2capinbuf[9];
200  interrupt_scid[0] = l2capinbuf[14];
201  interrupt_scid[1] = l2capinbuf[15];
203  }
204  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
205  if((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
206  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
207  //Notify(PSTR("\r\nHID Control Configuration Complete"), 0x80);
208  identifier = l2capinbuf[9];
210  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
211  //Notify(PSTR("\r\nHID Interrupt Configuration Complete"), 0x80);
212  identifier = l2capinbuf[9];
214  }
215  }
216  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
217  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
218  //Notify(PSTR("\r\nHID Control Configuration Request"), 0x80);
219  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], control_scid);
220  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
221  //Notify(PSTR("\r\nHID Interrupt Configuration Request"), 0x80);
222  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], interrupt_scid);
223  }
224  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
225  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
226 #ifdef DEBUG_USB_HOST
227  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
228 #endif
229  identifier = l2capinbuf[9];
230  pBtd->l2cap_disconnection_response(hci_handle, identifier, control_dcid, control_scid);
231  Reset();
232  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
233 #ifdef DEBUG_USB_HOST
234  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
235 #endif
236  identifier = l2capinbuf[9];
237  pBtd->l2cap_disconnection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid);
238  Reset();
239  }
240  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_RESPONSE) {
241  if(l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
242  //Notify(PSTR("\r\nDisconnect Response: Control Channel"), 0x80);
243  identifier = l2capinbuf[9];
245  } else if(l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
246  //Notify(PSTR("\r\nDisconnect Response: Interrupt Channel"), 0x80);
247  identifier = l2capinbuf[9];
249  }
250  }
251 #ifdef EXTRADEBUG
252  else {
253  identifier = l2capinbuf[9];
254  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
255  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
256  }
257 #endif
258  } else if(l2capinbuf[6] == interrupt_dcid[0] && l2capinbuf[7] == interrupt_dcid[1]) { // l2cap_interrupt
259  //Notify(PSTR("\r\nL2CAP Interrupt"), 0x80);
260  if(l2capinbuf[8] == 0xA1) { // HID_THDR_DATA_INPUT
261  if((l2capinbuf[9] >= 0x20 && l2capinbuf[9] <= 0x22) || (l2capinbuf[9] >= 0x30 && l2capinbuf[9] <= 0x37) || l2capinbuf[9] == 0x3e || l2capinbuf[9] == 0x3f) { // These reports include the buttons
262  if((l2capinbuf[9] >= 0x20 && l2capinbuf[9] <= 0x22) || l2capinbuf[9] == 0x31 || l2capinbuf[9] == 0x33) // These reports have no extensions bytes
263  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8));
265  ButtonState = (uint32_t)(((~l2capinbuf[23]) & 0xFE) | ((uint16_t)(~l2capinbuf[24]) << 8) | ((uint32_t)((~l2capinbuf[25]) & 0x03) << 16));
266  else if(motionPlusConnected) {
267  if(l2capinbuf[20] & 0x02) // Only update the Wiimote buttons, since the extension bytes are from the Motion Plus
268  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)(ButtonState & 0xFFFF0000)));
269  else if(nunchuckConnected) // Update if it's a report from the Nunchuck
270  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)((~l2capinbuf[20]) & 0x0C) << 14));
271  //else if(classicControllerConnected) // Update if it's a report from the Classic Controller
272  } else if(nunchuckConnected) // The Nunchuck is directly connected
273  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)((~l2capinbuf[20]) & 0x03) << 16));
274  //else if(classicControllerConnected) // The Classic Controller is directly connected
275  else if(!unknownExtensionConnected)
276  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8));
277 #ifdef PRINTREPORT
278  Notify(PSTR("ButtonState: "), 0x80);
279  D_PrintHex<uint32_t > (ButtonState, 0x80);
280  Notify(PSTR("\r\n"), 0x80);
281 #endif
282  if(ButtonState != OldButtonState) {
283  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
284  OldButtonState = ButtonState;
285  }
286  }
287  if(l2capinbuf[9] == 0x31 || l2capinbuf[9] == 0x33 || l2capinbuf[9] == 0x35 || l2capinbuf[9] == 0x37) { // Read the accelerometer
288  accXwiimote = ((l2capinbuf[12] << 2) | (l2capinbuf[10] & 0x60 >> 5)) - 500;
289  accYwiimote = ((l2capinbuf[13] << 2) | (l2capinbuf[11] & 0x20 >> 4)) - 500;
290  accZwiimote = ((l2capinbuf[14] << 2) | (l2capinbuf[11] & 0x40 >> 5)) - 500;
291  }
292  switch(l2capinbuf[9]) {
293  case 0x20: // Status Information - (a1) 20 BB BB LF 00 00 VV
294 #ifdef EXTRADEBUG
295  Notify(PSTR("\r\nStatus report was received"), 0x80);
296 #endif
297  wiiState = l2capinbuf[12]; // (0x01: Battery is nearly empty), (0x02: An Extension Controller is connected), (0x04: Speaker enabled), (0x08: IR enabled), (0x10: LED1, 0x20: LED2, 0x40: LED3, 0x80: LED4)
298  batteryLevel = l2capinbuf[15]; // Update battery level
299 
300  if(!checkBatteryLevel) { // If this is true it means that the user must have called getBatteryLevel()
301  if(l2capinbuf[12] & 0x02) { // Check if a extension is connected
302 #ifdef DEBUG_USB_HOST
303  if(!unknownExtensionConnected)
304  Notify(PSTR("\r\nExtension connected"), 0x80);
305 #endif
306  unknownExtensionConnected = true;
307 #ifdef WIICAMERA
308  if(!isIRCameraEnabled()) // Don't activate the Motion Plus if we are trying to initialize the IR camera
309 #endif
310  setReportMode(false, 0x35); // Also read the extension
311  } else {
312 #ifdef DEBUG_USB_HOST
313  Notify(PSTR("\r\nExtension disconnected"), 0x80);
314 #endif
315  if(motionPlusConnected) {
316 #ifdef DEBUG_USB_HOST
317  Notify(PSTR(" - from Motion Plus"), 0x80);
318 #endif
320  if(!activateNunchuck) // If it's already trying to initialize the Nunchuck don't set it to false
321  nunchuckConnected = false;
322  //else if(classicControllerConnected)
323  } else if(nunchuckConnected) {
324 #ifdef DEBUG_USB_HOST
325  Notify(PSTR(" - Nunchuck"), 0x80);
326 #endif
327  nunchuckConnected = false; // It must be the Nunchuck controller then
329  onInit();
330  setReportMode(false, 0x31); // If there is no extension connected we will read the buttons and accelerometer
331  } else
332  setReportMode(false, 0x31); // If there is no extension connected we will read the buttons and accelerometer
333  }
334  }
335  else {
336 #ifdef EXTRADEBUG
337  Notify(PSTR("\r\nChecking battery level"), 0x80);
338 #endif
339  checkBatteryLevel = false; // Check for extensions by default
340  }
341 #ifdef DEBUG_USB_HOST
342  if(l2capinbuf[12] & 0x01)
343  Notify(PSTR("\r\nWARNING: Battery is nearly empty"), 0x80);
344 #endif
345 
346  break;
347  case 0x21: // Read Memory Data
348  if((l2capinbuf[12] & 0x0F) == 0) { // No error
349  uint8_t reportLength = (l2capinbuf[12] >> 4) + 1; // // Bit 4-7 is the length - 1
350  // See: http://wiibrew.org/wiki/Wiimote/Extension_Controllers
351  if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x00 && l2capinbuf[20] == 0x00) {
352 #ifdef DEBUG_USB_HOST
353  Notify(PSTR("\r\nNunchuck connected"), 0x80);
354 #endif
356  } else if(l2capinbuf[16] == 0x00 && (l2capinbuf[17] == 0xA6 || l2capinbuf[17] == 0xA4) && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x00 && l2capinbuf[20] == 0x05) {
357 #ifdef DEBUG_USB_HOST
358  Notify(PSTR("\r\nMotion Plus connected"), 0x80);
359 #endif
361  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x04 && l2capinbuf[20] == 0x05) {
362 #ifdef DEBUG_USB_HOST
363  Notify(PSTR("\r\nMotion Plus activated in normal mode"), 0x80);
364 #endif
365  motionPlusConnected = true;
366 #ifdef WIICAMERA
367  if(!isIRCameraEnabled()) // Don't activate the Motion Plus if we are trying to initialize the IR camera
368 #endif
369  setReportMode(false, 0x35); // Also read the extension
370  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x05 && l2capinbuf[20] == 0x05) {
371 #ifdef DEBUG_USB_HOST
372  Notify(PSTR("\r\nMotion Plus activated in Nunchuck pass-through mode"), 0x80);
373 #endif
374  activateNunchuck = false;
375  motionPlusConnected = true;
376  nunchuckConnected = true;
377 #ifdef WIICAMERA
378  if(!isIRCameraEnabled()) // Don't activate the Motion Plus if we are trying to initialize the IR camera
379 #endif
380  setReportMode(false, 0x35); // Also read the extension
381  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA6 && l2capinbuf[18] == 0x20 && (l2capinbuf[19] == 0x00 || l2capinbuf[19] == 0x04 || l2capinbuf[19] == 0x05 || l2capinbuf[19] == 0x07) && l2capinbuf[20] == 0x05) {
382 #ifdef DEBUG_USB_HOST
383  Notify(PSTR("\r\nInactive Wii Motion Plus"), 0x80);
384  Notify(PSTR("\r\nPlease unplug the Motion Plus, disconnect the Wiimote and then replug the Motion Plus Extension"), 0x80);
385 #endif
386  stateCounter = 300; // Skip the rest in "WII_CHECK_MOTION_PLUS_STATE"
387  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x01 && l2capinbuf[20] == 0x20) {
388 #ifdef DEBUG_USB_HOST
389  Notify(PSTR("\r\nWii U Pro Controller connected"), 0x80);
390 #endif
392  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x04 && l2capinbuf[20] == 0x02) {
393 #ifdef DEBUG_USB_HOST
394  Notify(PSTR("\r\nWii Balance Board connected"), 0x80);
395 #endif
396  setReportMode(false, 0x32); // Read the Wii Balance Board extension
398  }
399  // Wii Balance Board calibration reports (24 bits in total)
400  else if(l2capinbuf[13] == 0x00 && l2capinbuf[14] == 0x24 && reportLength == 16) { // First 16-bit
401  for(uint8_t i = 0; i < 2; i++) {
402  for(uint8_t j = 0; j < 4; j++)
403  wiiBalanceBoardCal[i][j] = l2capinbuf[16 + 8 * i + 2 * j] | l2capinbuf[15 + 8 * i + 2 * j] << 8;
404  }
405  } else if(l2capinbuf[13] == 0x00 && l2capinbuf[14] == 0x34 && reportLength == 8) { // Last 8-bit
406  for(uint8_t j = 0; j < 4; j++)
407  wiiBalanceBoardCal[2][j] = l2capinbuf[16 + 2 * j] | l2capinbuf[15 + 2 * j] << 8;
408 #ifdef DEBUG_USB_HOST
409  Notify(PSTR("\r\nWii Balance Board calibration values read successfully"), 0x80);
410 #endif
413  }
414 #ifdef DEBUG_USB_HOST
415  else {
416  Notify(PSTR("\r\nUnknown Device: "), 0x80);
417  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
418  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
419  Notify(PSTR("\r\nData: "), 0x80);
420  for(uint8_t i = 0; i < reportLength; i++) {
421  D_PrintHex<uint8_t > (l2capinbuf[15 + i], 0x80);
422  Notify(PSTR(" "), 0x80);
423  }
424  }
425 #endif
426  }
427 #ifdef EXTRADEBUG
428  else {
429  Notify(PSTR("\r\nReport Error: "), 0x80);
430  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
431  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
432  }
433 #endif
434  break;
435  case 0x22: // Acknowledge output report, return function result
436 #ifdef DEBUG_USB_HOST
437  if(l2capinbuf[13] != 0x00) { // Check if there is an error
438  Notify(PSTR("\r\nCommand failed: "), 0x80);
439  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
440  }
441 #endif
442  break;
443  case 0x30: // Core buttons - (a1) 30 BB BB
444  break;
445  case 0x31: // Core Buttons and Accelerometer - (a1) 31 BB BB AA AA AA
446  break;
447  case 0x32: // Core Buttons with 8 Extension bytes - (a1) 32 BB BB EE EE EE EE EE EE EE EE
448  // See: http://wiibrew.org/wiki/Wii_Balance_Board#Data_Format
449  wiiBalanceBoardRaw[TopRight] = l2capinbuf[13] | l2capinbuf[12] << 8; // Top right
450  wiiBalanceBoardRaw[BotRight] = l2capinbuf[15] | l2capinbuf[14] << 8; // Bottom right
451  wiiBalanceBoardRaw[TopLeft] = l2capinbuf[17] | l2capinbuf[16] << 8; // Top left
452  wiiBalanceBoardRaw[BotLeft] = l2capinbuf[19] | l2capinbuf[18] << 8; // Bottom left
453  break;
454  case 0x33: // Core Buttons with Accelerometer and 12 IR bytes - (a1) 33 BB BB AA AA AA II II II II II II II II II II II II
455 #ifdef WIICAMERA
456  // Read the IR data
457  IR_object_x1 = (l2capinbuf[15] | ((uint16_t)(l2capinbuf[17] & 0x30) << 4)); // x position
458  IR_object_y1 = (l2capinbuf[16] | ((uint16_t)(l2capinbuf[17] & 0xC0) << 2)); // y position
459  IR_object_s1 = (l2capinbuf[17] & 0x0F); // Size value, 0-15
460 
461  IR_object_x2 = (l2capinbuf[18] | ((uint16_t)(l2capinbuf[20] & 0x30) << 4));
462  IR_object_y2 = (l2capinbuf[19] | ((uint16_t)(l2capinbuf[20] & 0xC0) << 2));
463  IR_object_s2 = (l2capinbuf[20] & 0x0F);
464 
465  IR_object_x3 = (l2capinbuf[21] | ((uint16_t)(l2capinbuf[23] & 0x30) << 4));
466  IR_object_y3 = (l2capinbuf[22] | ((uint16_t)(l2capinbuf[23] & 0xC0) << 2));
467  IR_object_s3 = (l2capinbuf[23] & 0x0F);
468 
469  IR_object_x4 = (l2capinbuf[24] | ((uint16_t)(l2capinbuf[26] & 0x30) << 4));
470  IR_object_y4 = (l2capinbuf[25] | ((uint16_t)(l2capinbuf[26] & 0xC0) << 2));
471  IR_object_s4 = (l2capinbuf[26] & 0x0F);
472 #endif
473  break;
474  case 0x34: // Core Buttons with 19 Extension bytes - (a1) 34 BB BB EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE
475  break;
476  /* 0x3e and 0x3f both give unknown report types when report mode is 0x3e or 0x3f with mode number 0x05 */
477  case 0x3E: // Core Buttons with Accelerometer and 32 IR bytes
478  // (a1) 31 BB BB AA AA AA II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II
479  // corresponds to output report mode 0x3e
480 
481  /**** for reading in full mode: DOES NOT WORK YET ****/
482  /* When it works it will also have intensity and bounding box data */
483  /*
484  IR_object_x1 = (l2capinbuf[13] | ((uint16_t)(l2capinbuf[15] & 0x30) << 4));
485  IR_object_y1 = (l2capinbuf[14] | ((uint16_t)(l2capinbuf[15] & 0xC0) << 2));
486  IR_object_s1 = (l2capinbuf[15] & 0x0F);
487  */
488  break;
489  case 0x3F:
490  /*
491  IR_object_x1 = (l2capinbuf[13] | ((uint16_t)(l2capinbuf[15] & 0x30) << 4));
492  IR_object_y1 = (l2capinbuf[14] | ((uint16_t)(l2capinbuf[15] & 0xC0) << 2));
493  IR_object_s1 = (l2capinbuf[15] & 0x0F);
494  */
495  break;
496  case 0x35: // Core Buttons and Accelerometer with 16 Extension Bytes
497  // (a1) 35 BB BB AA AA AA EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE
498 #if 1 // Set this to 0 if you don't want to use an extension, this reduceds the size of the library a lot!
499  if(motionPlusConnected) {
500  if(l2capinbuf[20] & 0x02) { // Check if it's a report from the Motion controller or the extension
501  if(motionValuesReset) { // We will only use the values when the gyro value has been set
502  gyroYawRaw = ((l2capinbuf[15] | ((l2capinbuf[18] & 0xFC) << 6)) - gyroYawZero);
503  gyroRollRaw = ((l2capinbuf[16] | ((l2capinbuf[19] & 0xFC) << 6)) - gyroRollZero);
504  gyroPitchRaw = ((l2capinbuf[17] | ((l2capinbuf[20] & 0xFC) << 6)) - gyroPitchZero);
505 
506  yawGyroSpeed = (float)gyroYawRaw / ((float)gyroYawZero / yawGyroScale);
507  rollGyroSpeed = -(float)gyroRollRaw / ((float)gyroRollZero / rollGyroScale); // We invert these values so they will fit the acc values
509 
510  /* The onboard gyro has two ranges for slow and fast mode */
511  if(!(l2capinbuf[18] & 0x02)) // Check if fast mode is used
512  yawGyroSpeed *= 4.545;
513  if(!(l2capinbuf[18] & 0x01)) // Check if fast mode is used
514  pitchGyroSpeed *= 4.545;
515  if(!(l2capinbuf[19] & 0x02)) // Check if fast mode is used
516  rollGyroSpeed *= 4.545;
517 
518  compPitch = (0.93f * (compPitch + (pitchGyroSpeed * (float)(micros() - timer) / 1000000.0f)))+(0.07f * getWiimotePitch()); // Use a complimentary filter to calculate the angle
519  compRoll = (0.93f * (compRoll + (rollGyroSpeed * (float)(micros() - timer) / 1000000.0f)))+(0.07f * getWiimoteRoll());
520 
521  gyroYaw += (yawGyroSpeed * ((float)(micros() - timer) / 1000000.0f));
522  gyroRoll += (rollGyroSpeed * ((float)(micros() - timer) / 1000000.0f));
523  gyroPitch += (pitchGyroSpeed * ((float)(micros() - timer) / 1000000.0f));
524  timer = micros();
525  /*
526  // Uncomment these lines to tune the gyro scale variabels
527  Notify(PSTR("\r\ngyroYaw: "), 0x80);
528  Notify(gyroYaw, 0x80);
529  Notify(PSTR("\tgyroRoll: "), 0x80);
530  Notify(gyroRoll, 0x80);
531  Notify(PSTR("\tgyroPitch: "), 0x80);
532  Notify(gyroPitch, 0x80);
533  */
534  /*
535  Notify(PSTR("\twiimoteRoll: "), 0x80);
536  Notify(wiimoteRoll, 0x80);
537  Notify(PSTR("\twiimotePitch: "), 0x80);
538  Notify(wiimotePitch, 0x80);
539  */
540  } else {
541  if((micros() - timer) > 1000000) { // Loop for 1 sec before resetting the values
542 #ifdef DEBUG_USB_HOST
543  Notify(PSTR("\r\nThe gyro values has been reset"), 0x80);
544 #endif
545  gyroYawZero = (l2capinbuf[15] | ((l2capinbuf[18] & 0xFC) << 6));
546  gyroRollZero = (l2capinbuf[16] | ((l2capinbuf[19] & 0xFC) << 6));
547  gyroPitchZero = (l2capinbuf[17] | ((l2capinbuf[20] & 0xFC) << 6));
548 
549  rollGyroScale = 500; // You might need to adjust these
550  pitchGyroScale = 400;
551  yawGyroScale = 415;
552 
553  gyroYaw = 0;
554  gyroRoll = 0;
555  gyroPitch = 0;
556 
557  motionValuesReset = true;
558  timer = micros();
559  }
560  }
561  } else {
562  if(nunchuckConnected) {
563  hatValues[HatX] = l2capinbuf[15];
564  hatValues[HatY] = l2capinbuf[16];
565  accXnunchuck = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x10 >> 3)) - 416;
566  accYnunchuck = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x20 >> 4)) - 416;
567  accZnunchuck = (((l2capinbuf[19] & 0xFE) << 2) | (l2capinbuf[20] & 0xC0 >> 5)) - 416;
568  }
569  //else if(classicControllerConnected) { }
570  }
571  if(l2capinbuf[19] & 0x01) {
572  if(!extensionConnected) {
573  extensionConnected = true;
574  unknownExtensionConnected = true;
575 #ifdef DEBUG_USB_HOST
576  Notify(PSTR("\r\nExtension connected to Motion Plus"), 0x80);
577 #endif
578  }
579  } else {
580  if(extensionConnected && !unknownExtensionConnected) {
581  extensionConnected = false;
582  unknownExtensionConnected = true;
583 #ifdef DEBUG_USB_HOST
584  Notify(PSTR("\r\nExtension disconnected from Motion Plus"), 0x80);
585 #endif
586  nunchuckConnected = false; // There is no extension connected to the Motion Plus if this report is sent
587  }
588  }
589 
590  } else if(nunchuckConnected) {
591  hatValues[HatX] = l2capinbuf[15];
592  hatValues[HatY] = l2capinbuf[16];
593  accXnunchuck = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x0C >> 2)) - 416;
594  accYnunchuck = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x30 >> 4)) - 416;
595  accZnunchuck = ((l2capinbuf[19] << 2) | (l2capinbuf[20] & 0xC0 >> 6)) - 416;
596  } else if(wiiUProControllerConnected) {
597  hatValues[LeftHatX] = (l2capinbuf[15] | l2capinbuf[16] << 8);
598  hatValues[RightHatX] = (l2capinbuf[17] | l2capinbuf[18] << 8);
599  hatValues[LeftHatY] = (l2capinbuf[19] | l2capinbuf[20] << 8);
600  hatValues[RightHatY] = (l2capinbuf[21] | l2capinbuf[22] << 8);
601  }
602 #endif
603  break;
604 #ifdef DEBUG_USB_HOST
605  default:
606  Notify(PSTR("\r\nUnknown Report type: "), 0x80);
607  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
608  break;
609 #endif
610  }
611  }
612  }
613  L2CAP_task();
614  }
615 }
616 
617 void WII::L2CAP_task() {
618  switch(l2cap_state) {
619  /* These states are used if the Wiimote is the host */
622 #ifdef DEBUG_USB_HOST
623  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
624 #endif
625  l2cap_state = L2CAP_INTERRUPT_SETUP;
626  }
627  break;
628 
631 #ifdef DEBUG_USB_HOST
632  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
633 #endif
634  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, PENDING);
635  delay(1);
636  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, SUCCESSFUL);
637  identifier++;
638  delay(1);
639  pBtd->l2cap_config_request(hci_handle, identifier, interrupt_scid);
640 
641  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
642  }
643  break;
644 
645  /* These states are used if the Arduino is the host */
648 #ifdef DEBUG_USB_HOST
649  Notify(PSTR("\r\nSend HID Control Config Request"), 0x80);
650 #endif
651  identifier++;
653  l2cap_state = L2CAP_CONTROL_CONFIG_REQUEST;
654  }
655  break;
656 
659 #ifdef DEBUG_USB_HOST
660  Notify(PSTR("\r\nSend HID Interrupt Connection Request"), 0x80);
661 #endif
662  identifier++;
664  l2cap_state = L2CAP_INTERRUPT_CONNECT_REQUEST;
665  }
666  break;
667 
670 #ifdef DEBUG_USB_HOST
671  Notify(PSTR("\r\nSend HID Interrupt Config Request"), 0x80);
672 #endif
673  identifier++;
674  pBtd->l2cap_config_request(hci_handle, identifier, interrupt_scid);
675  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
676  }
677  break;
678 
680  if(l2cap_check_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)) { // Now the HID channels is established
681 #ifdef DEBUG_USB_HOST
682  Notify(PSTR("\r\nHID Channels Established"), 0x80);
683 #endif
684  pBtd->connectToWii = false;
685  pBtd->pairWithWii = false;
686  stateCounter = 0;
687  l2cap_state = WII_CHECK_MOTION_PLUS_STATE;
688  }
689  break;
690 
691  /* The next states are in run() */
692 
694  if(l2cap_check_flag(L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE) && ((long)(millis() - timer) >= 0L)) {
695 #ifdef DEBUG_USB_HOST
696  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
697 #endif
698  identifier++;
699  pBtd->l2cap_disconnection_request(hci_handle, identifier, control_scid, control_dcid);
700  l2cap_state = L2CAP_CONTROL_DISCONNECT;
701  }
702  break;
703 
706 #ifdef DEBUG_USB_HOST
707  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
708 #endif
710  hci_handle = -1; // Reset handle
711  l2cap_event_flag = 0; // Reset flags
712  l2cap_state = L2CAP_WAIT;
713  }
714  break;
715  }
716 }
717 
718 void WII::Run() {
719  if(l2cap_state == L2CAP_INTERRUPT_DISCONNECT && ((long)(millis() - timer) >= 0L))
720  L2CAP_task(); // Call the rest of the disconnection routine after we have waited long enough
721 
722  switch(l2cap_state) {
723  case L2CAP_WAIT:
724  if(pBtd->connectToWii && !pBtd->l2capConnectionClaimed && !wiimoteConnected && !activeConnection) {
726  activeConnection = true;
727  motionPlusInside = pBtd->motionPlusInside;
728 #ifdef DEBUG_USB_HOST
729  Notify(PSTR("\r\nSend HID Control Connection Request"), 0x80);
730 #endif
731  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
732  l2cap_event_flag = 0; // Reset flags
733  identifier = 0;
735  l2cap_state = L2CAP_CONTROL_CONNECT_REQUEST;
737 #ifdef DEBUG_USB_HOST
738  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
739 #endif
740  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, PENDING);
741  delay(1);
742  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, SUCCESSFUL);
743  identifier++;
744  delay(1);
746  l2cap_state = L2CAP_CONTROL_SUCCESS;
747  }
748  break;
749 
751 #ifdef DEBUG_USB_HOST
752  if(stateCounter == 0) // Only print onnce
753  Notify(PSTR("\r\nChecking if a Motion Plus is connected"), 0x80);
754 #endif
755  stateCounter++;
756  if(stateCounter % 200 == 0)
757  checkMotionPresent(); // Check if there is a motion plus connected
759  stateCounter = 0;
760  l2cap_state = WII_INIT_MOTION_PLUS_STATE;
761  timer = micros();
762 
763  if(unknownExtensionConnected) {
764 #ifdef DEBUG_USB_HOST
765  Notify(PSTR("\r\nA extension is also connected"), 0x80);
766 #endif
767  activateNunchuck = true; // For we will just set this to true as this the only extension supported so far
768  }
769 
770  } else if(stateCounter == 601) { // We will try three times to check for the motion plus
771 #ifdef DEBUG_USB_HOST
772  Notify(PSTR("\r\nNo Motion Plus was detected"), 0x80);
773 #endif
774  stateCounter = 0;
775  l2cap_state = WII_CHECK_EXTENSION_STATE;
776  }
777  break;
778 
779  case WII_CHECK_EXTENSION_STATE: // This is used to check if there is anything plugged in to the extension port
780 #ifdef DEBUG_USB_HOST
781  if(stateCounter == 0) // Only print onnce
782  Notify(PSTR("\r\nChecking if there is any extension connected"), 0x80);
783 #endif
784  stateCounter++; // We use this counter as there has to be a short delay between the commands
785  if(stateCounter == 1)
786  statusRequest(); // See if a new device has connected
787  if(stateCounter == 100) {
788  if(unknownExtensionConnected) // Check if there is a extension is connected to the port
789  initExtension1();
790  else
791  stateCounter = 499;
792  } else if(stateCounter == 200)
793  initExtension2();
794  else if(stateCounter == 300) {
795  readExtensionType();
796  unknownExtensionConnected = false;
797  } else if(stateCounter == 400) {
799 #ifdef DEBUG_USB_HOST
800  Notify(PSTR("\r\nReading Wii Balance Board calibration values"), 0x80);
801 #endif
802  readWiiBalanceBoardCalibration();
803  } else
804  stateCounter = 499;
805  } else if(stateCounter == 500) {
806  stateCounter = 0;
807  l2cap_state = TURN_ON_LED;
808  }
809  break;
810 
812  stateCounter++;
813  if(stateCounter == 1)
814  initMotionPlus();
815  else if(stateCounter == 100)
816  activateMotionPlus();
817  else if(stateCounter == 200)
818  readExtensionType(); // Check if it has been activated
819  else if(stateCounter == 300) {
820  stateCounter = 0;
821  unknownExtensionConnected = false; // The motion plus will send a status report when it's activated, we will set this to false so it doesn't reinitialize the Motion Plus
822  l2cap_state = TURN_ON_LED;
823  }
824  break;
825 
826  case TURN_ON_LED:
828  nunchuckConnected = true;
829  wiimoteConnected = true;
830  onInit();
831  l2cap_state = L2CAP_DONE;
832  break;
833 
834  case L2CAP_DONE:
835  if(unknownExtensionConnected) {
836 #ifdef DEBUG_USB_HOST
837  if(stateCounter == 0) // Only print once
838  Notify(PSTR("\r\nChecking extension port"), 0x80);
839 #endif
840  stateCounter++; // We will use this counter as there has to be a short delay between the commands
841  if(stateCounter == 50)
842  statusRequest();
843  else if(stateCounter == 100)
844  initExtension1();
845  else if(stateCounter == 150)
846  if((extensionConnected && motionPlusConnected) || (unknownExtensionConnected && !motionPlusConnected))
847  initExtension2();
848  else
849  stateCounter = 299; // There is no extension connected
850  else if(stateCounter == 200)
851  readExtensionType();
852  else if(stateCounter == 250) {
854 #ifdef DEBUG_USB_HOST
855  Notify(PSTR("\r\nNunchuck was reconnected"), 0x80);
856 #endif
857  activateNunchuck = true;
858  nunchuckConnected = true;
859  }
861  stateCounter = 449;
862  } else if(stateCounter == 300) {
863  if(motionPlusConnected) {
864 #ifdef DEBUG_USB_HOST
865  Notify(PSTR("\r\nReactivating the Motion Plus"), 0x80);
866 #endif
867  initMotionPlus();
868  } else
869  stateCounter = 449;
870  } else if(stateCounter == 350)
871  activateMotionPlus();
872  else if(stateCounter == 400)
873  readExtensionType(); // Check if it has been activated
874  else if(stateCounter == 450) {
875  onInit();
876  stateCounter = 0;
877  unknownExtensionConnected = false;
878  }
879  } else
880  stateCounter = 0;
881  break;
882  }
883 }
884 
885 /************************************************************/
886 /* HID Commands */
887 /************************************************************/
888 
889 void WII::HID_Command(uint8_t* data, uint8_t nbytes) {
890  if(motionPlusInside)
891  pBtd->L2CAP_Command(hci_handle, data, nbytes, interrupt_scid[0], interrupt_scid[1]); // It's the new Wiimote with the Motion Plus Inside or Wii U Pro controller
892  else
893  pBtd->L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]);
894 }
895 
897  HIDBuffer[1] = 0x11;
898  HIDBuffer[2] = 0x00;
899  HID_Command(HIDBuffer, 3);
900 }
901 
903  HIDBuffer[1] = 0x11;
904  HIDBuffer[2] &= ~0x01; // Bit 0 control the rumble
905  HID_Command(HIDBuffer, 3);
906 }
907 
909  HIDBuffer[1] = 0x11;
910  HIDBuffer[2] |= 0x01; // Bit 0 control the rumble
911  HID_Command(HIDBuffer, 3);
912 }
913 
915  HIDBuffer[1] = 0x11;
916  HIDBuffer[2] ^= 0x01; // Bit 0 control the rumble
917  HID_Command(HIDBuffer, 3);
918 }
919 
920 void WII::setLedRaw(uint8_t value) {
921  HIDBuffer[1] = 0x11;
922  HIDBuffer[2] = value | (HIDBuffer[2] & 0x01); // Keep the rumble bit
923  HID_Command(HIDBuffer, 3);
924 }
925 
927  HIDBuffer[1] = 0x11;
928  HIDBuffer[2] &= ~(pgm_read_byte(&WII_LEDS[(uint8_t)a]));
929  HID_Command(HIDBuffer, 3);
930 }
931 
933  if(a == OFF)
934  setLedRaw(0);
935  else {
936  HIDBuffer[1] = 0x11;
937  HIDBuffer[2] |= pgm_read_byte(&WII_LEDS[(uint8_t)a]);
938  HID_Command(HIDBuffer, 3);
939  }
940 }
941 
943  HIDBuffer[1] = 0x11;
944  HIDBuffer[2] ^= pgm_read_byte(&WII_LEDS[(uint8_t)a]);
945  HID_Command(HIDBuffer, 3);
946 }
947 
949  HIDBuffer[1] = 0x11;
950  HIDBuffer[2] = (HIDBuffer[2] & 0x01); // Keep the rumble bit
951  if(wiimoteConnected)
952  HIDBuffer[2] |= 0x10; // If it's connected LED1 will light up
954  HIDBuffer[2] |= 0x20; // If it's connected LED2 will light up
956  HIDBuffer[2] |= 0x40; // If it's connected LED3 will light up
957 
958  HID_Command(HIDBuffer, 3);
959 }
960 
962  checkBatteryLevel = true; // This is needed so the library knows that the status response is a response to this function
963  statusRequest(); // This will update the battery level
964  return batteryLevel;
965 };
966 
967 void WII::setReportMode(bool continuous, uint8_t mode) {
968  uint8_t cmd_buf[4];
969  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
970  cmd_buf[1] = 0x12;
971  if(continuous)
972  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Keep the rumble bit
973  else
974  cmd_buf[2] = 0x00 | (HIDBuffer[2] & 0x01); // Keep the rumble bit
975  cmd_buf[3] = mode;
976  HID_Command(cmd_buf, 4);
977 }
978 
979 void WII::statusRequest() {
980  uint8_t cmd_buf[3];
981  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
982  cmd_buf[1] = 0x15;
983  cmd_buf[2] = (HIDBuffer[2] & 0x01); // Keep the rumble bit
984  HID_Command(cmd_buf, 3);
985 }
986 
987 /************************************************************/
988 /* Memmory Commands */
989 /************************************************************/
990 
991 void WII::writeData(uint32_t offset, uint8_t size, uint8_t* data) {
992  uint8_t cmd_buf[23];
993  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
994  cmd_buf[1] = 0x16; // Write data
995  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Write to memory, clear bit 2 to write to EEPROM
996  cmd_buf[3] = (uint8_t)((offset & 0xFF0000) >> 16);
997  cmd_buf[4] = (uint8_t)((offset & 0xFF00) >> 8);
998  cmd_buf[5] = (uint8_t)(offset & 0xFF);
999  cmd_buf[6] = size;
1000  uint8_t i = 0;
1001  for(; i < size; i++)
1002  cmd_buf[7 + i] = data[i];
1003  for(; i < 16; i++) // Set the rest to zero
1004  cmd_buf[7 + i] = 0x00;
1005  HID_Command(cmd_buf, 23);
1006 }
1007 
1008 void WII::initExtension1() {
1009  uint8_t buf[1];
1010  buf[0] = 0x55;
1011  writeData(0xA400F0, 1, buf);
1012 }
1013 
1014 void WII::initExtension2() {
1015  uint8_t buf[1];
1016  buf[0] = 0x00;
1017  writeData(0xA400FB, 1, buf);
1018 }
1019 
1020 void WII::initMotionPlus() {
1021  uint8_t buf[1];
1022  buf[0] = 0x55;
1023  writeData(0xA600F0, 1, buf);
1024 }
1025 
1026 void WII::activateMotionPlus() {
1027  uint8_t buf[1];
1028  if(pBtd->wiiUProController) {
1029 #ifdef DEBUG_USB_HOST
1030  Notify(PSTR("\r\nActivating Wii U Pro Controller"), 0x80);
1031 #endif
1032  buf[0] = 0x00; // It seems like you can send anything but 0x04, 0x05, and 0x07
1033  } else if(activateNunchuck) {
1034 #ifdef DEBUG_USB_HOST
1035  Notify(PSTR("\r\nActivating Motion Plus in pass-through mode"), 0x80);
1036 #endif
1037  buf[0] = 0x05; // Activate nunchuck pass-through mode
1038  }//else if(classicControllerConnected && extensionConnected)
1039  //buf[0] = 0x07;
1040  else {
1041 #ifdef DEBUG_USB_HOST
1042  Notify(PSTR("\r\nActivating Motion Plus in normal mode"), 0x80);
1043 #endif
1044  buf[0] = 0x04; // Don't use any extension
1045  }
1046  writeData(0xA600FE, 1, buf);
1047 }
1048 
1049 void WII::readData(uint32_t offset, uint16_t size, bool EEPROM) {
1050  uint8_t cmd_buf[8];
1051  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
1052  cmd_buf[1] = 0x17; // Read data
1053  if(EEPROM)
1054  cmd_buf[2] = 0x00 | (HIDBuffer[2] & 0x01); // Read from EEPROM
1055  else
1056  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Read from memory
1057  cmd_buf[3] = (uint8_t)((offset & 0xFF0000) >> 16);
1058  cmd_buf[4] = (uint8_t)((offset & 0xFF00) >> 8);
1059  cmd_buf[5] = (uint8_t)(offset & 0xFF);
1060  cmd_buf[6] = (uint8_t)((size & 0xFF00) >> 8);
1061  cmd_buf[7] = (uint8_t)(size & 0xFF);
1062 
1063  HID_Command(cmd_buf, 8);
1064 }
1065 
1066 void WII::readExtensionType() {
1067  readData(0xA400FA, 6, false);
1068 }
1069 
1070 void WII::readCalData() {
1071  readData(0x0016, 8, true);
1072 }
1073 
1074 void WII::checkMotionPresent() {
1075  readData(0xA600FA, 6, false);
1076 }
1077 
1078 void WII::readWiiBalanceBoardCalibration() {
1079  readData(0xA40024, 24, false);
1080 }
1081 
1082 /************************************************************/
1083 /* WII Commands */
1084 /************************************************************/
1085 
1086 bool WII::getButtonPress(ButtonEnum b) { // Return true when a button is pressed
1088  return (ButtonState & pgm_read_dword(&WII_PROCONTROLLER_BUTTONS[(uint8_t)b]));
1089  else
1090  return (ButtonState & pgm_read_dword(&WII_BUTTONS[(uint8_t)b]));
1091 }
1092 
1093 bool WII::getButtonClick(ButtonEnum b) { // Only return true when a button is clicked
1094  uint32_t button;
1096  button = pgm_read_dword(&WII_PROCONTROLLER_BUTTONS[(uint8_t)b]);
1097  else
1098  button = pgm_read_dword(&WII_BUTTONS[(uint8_t)b]);
1099  bool click = (ButtonClickState & button);
1100  ButtonClickState &= ~button; // clear "click" event
1101  return click;
1102 }
1103 
1105  if(!nunchuckConnected)
1106  return 127; // Return center position
1107  else {
1108  uint8_t output = hatValues[(uint8_t)a];
1109  if(output == 0xFF || output == 0x00) // The joystick will only read 255 or 0 when the cable is unplugged or initializing, so we will just return the center position
1110  return 127;
1111  else
1112  return output;
1113  }
1114 }
1115 
1118  return 2000;
1119  else {
1120  uint16_t output = hatValues[(uint8_t)a];
1121  if(output == 0x00) // The joystick will only read 0 when it is first initializing, so we will just return the center position
1122  return 2000;
1123  else
1124  return output;
1125  }
1126 }
1127 
1128 void WII::onInit() {
1129  if(pFuncOnInit)
1130  pFuncOnInit(); // Call the user function
1131  else
1132  setLedStatus();
1133 }
1134 
1135 /************************************************************/
1136 /* Wii Balance Board Commands */
1137 /************************************************************/
1138 
1140  // Use interpolating between two points - based on: https://github.com/skorokithakis/gr8w8upd8m8/blob/master/gr8w8upd8m8.py
1141  // wiiBalanceBoardCal[pos][0] is calibration values for 0 kg
1142  // wiiBalanceBoardCal[pos][1] is calibration values for 17 kg
1143  // wiiBalanceBoardCal[pos][2] is calibration values for 34 kg
1144  if(wiiBalanceBoardRaw[pos] < wiiBalanceBoardCal[0][pos])
1145  return 0.0f; // Below 0 kg
1146  else if(wiiBalanceBoardRaw[pos] < wiiBalanceBoardCal[1][pos]) // Between 0 and 17 kg
1147  return 17.0f * (float)(wiiBalanceBoardRaw[pos] - wiiBalanceBoardCal[0][pos]) / (float)(wiiBalanceBoardCal[1][pos] - wiiBalanceBoardCal[0][pos]);
1148  else // More than 17 kg
1149  return 17.0f + 17.0f * (float)(wiiBalanceBoardRaw[pos] - wiiBalanceBoardCal[1][pos]) / (float)(wiiBalanceBoardCal[2][pos] - wiiBalanceBoardCal[1][pos]);
1150 };
1151 
1154 };
1155 
1156 /************************************************************/
1157 /* The following functions are for the IR camera */
1158 /************************************************************/
1159 
1160 #ifdef WIICAMERA
1161 
1162 void WII::IRinitialize() { // Turns on and initialises the IR camera
1163 
1164  enableIRCamera1();
1165 #ifdef DEBUG_USB_HOST
1166  Notify(PSTR("\r\nEnable IR Camera1 Complete"), 0x80);
1167 #endif
1168  delay(80);
1169 
1170  enableIRCamera2();
1171 #ifdef DEBUG_USB_HOST
1172  Notify(PSTR("\r\nEnable IR Camera2 Complete"), 0x80);
1173 #endif
1174  delay(80);
1175 
1176  write0x08Value();
1177 #ifdef DEBUG_USB_HOST
1178  Notify(PSTR("\r\nWrote hex number 0x08"), 0x80);
1179 #endif
1180  delay(80);
1181 
1182  writeSensitivityBlock1();
1183 #ifdef DEBUG_USB_HOST
1184  Notify(PSTR("\r\nWrote Sensitivity Block 1"), 0x80);
1185 #endif
1186  delay(80);
1187 
1188  writeSensitivityBlock2();
1189 #ifdef DEBUG_USB_HOST
1190  Notify(PSTR("\r\nWrote Sensitivity Block 2"), 0x80);
1191 #endif
1192  delay(80);
1193 
1194  uint8_t mode_num = 0x03;
1195  setWiiModeNumber(mode_num); // Change input for whatever mode you want i.e. 0x01, 0x03, or 0x05
1196 #ifdef DEBUG_USB_HOST
1197  Notify(PSTR("\r\nSet Wii Mode Number To 0x"), 0x80);
1198  D_PrintHex<uint8_t > (mode_num, 0x80);
1199 #endif
1200  delay(80);
1201 
1202  write0x08Value();
1203 #ifdef DEBUG_USB_HOST
1204  Notify(PSTR("\r\nWrote Hex Number 0x08"), 0x80);
1205 #endif
1206  delay(80);
1207 
1208  setReportMode(false, 0x33);
1209  //setReportMode(false, 0x3f); // For full reporting mode, doesn't work yet
1210 #ifdef DEBUG_USB_HOST
1211  Notify(PSTR("\r\nSet Report Mode to 0x33"), 0x80);
1212 #endif
1213  delay(80);
1214 
1215  statusRequest(); // Used to update wiiState - call isIRCameraEnabled() afterwards to check if it actually worked
1216 #ifdef DEBUG_USB_HOST
1217  Notify(PSTR("\r\nIR Initialized"), 0x80);
1218 #endif
1219 }
1220 
1221 void WII::enableIRCamera1() {
1222  uint8_t cmd_buf[3];
1223  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
1224  cmd_buf[1] = 0x13; // Output report 13
1225  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Keep the rumble bit and sets bit 2
1226  HID_Command(cmd_buf, 3);
1227 }
1228 
1229 void WII::enableIRCamera2() {
1230  uint8_t cmd_buf[3];
1231  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
1232  cmd_buf[1] = 0x1A; // Output report 1A
1233  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Keep the rumble bit and sets bit 2
1234  HID_Command(cmd_buf, 3);
1235 }
1236 
1237 void WII::writeSensitivityBlock1() {
1238  uint8_t buf[9];
1239  buf[0] = 0x00;
1240  buf[1] = 0x00;
1241  buf[2] = 0x00;
1242  buf[3] = 0x00;
1243  buf[4] = 0x00;
1244  buf[5] = 0x00;
1245  buf[6] = 0x90;
1246  buf[7] = 0x00;
1247  buf[8] = 0x41;
1248 
1249  writeData(0xB00000, 9, buf);
1250 }
1251 
1252 void WII::writeSensitivityBlock2() {
1253  uint8_t buf[2];
1254  buf[0] = 0x40;
1255  buf[1] = 0x00;
1256 
1257  writeData(0xB0001A, 2, buf);
1258 }
1259 
1260 void WII::write0x08Value() {
1261  uint8_t cmd = 0x08;
1262  writeData(0xb00030, 1, &cmd);
1263 }
1264 
1265 void WII::setWiiModeNumber(uint8_t mode_number) { // mode_number in hex i.e. 0x03 for extended mode
1266  writeData(0xb00033, 1, &mode_number);
1267 }
1268 #endif
bool wiimoteConnected
Definition: Wii.h:191
-
#define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE
Definition: BTD.h:137
-
bool incomingWii
Definition: BTD.h:471
-
void onInit()
Definition: Wii.cpp:1128
- +Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16 
17  IR camera support added by Allan Glover (adglover9.81@gmail.com) and Kristian Lauszus
18  */
19 
20 #include "Wii.h"
21 // To enable serial debugging see "settings.h"
22 //#define EXTRADEBUG // Uncomment to get even more debugging data
23 //#define PRINTREPORT // Uncomment to print the report send by the Wii controllers
24 
25 const uint8_t WII_LEDS[] PROGMEM = {
26  0x00, // OFF
27  0x10, // LED1
28  0x20, // LED2
29  0x40, // LED3
30  0x80, // LED4
31 
32  0x90, // LED5
33  0xA0, // LED6
34  0xC0, // LED7
35  0xD0, // LED8
36  0xE0, // LED9
37  0xF0, // LED10
38 };
39 
40 const uint32_t WII_BUTTONS[] PROGMEM = {
41  0x00008, // UP
42  0x00002, // RIGHT
43  0x00004, // DOWN
44  0x00001, // LEFT
45 
46  0, // Skip
47  0x00010, // PLUS
48  0x00100, // TWO
49  0x00200, // ONE
50 
51  0x01000, // MINUS
52  0x08000, // HOME
53  0x10000, // Z
54  0x20000, // C
55 
56  0x00400, // B
57  0x00800, // A
58 };
59 const uint32_t WII_PROCONTROLLER_BUTTONS[] PROGMEM = {
60  0x00100, // UP
61  0x00080, // RIGHT
62  0x00040, // DOWN
63  0x00200, // LEFT
64 
65  0, // Skip
66  0x00004, // PLUS
67  0x20000, // L3
68  0x10000, // R3
69 
70  0x00010, // MINUS
71  0x00008, // HOME
72  0, 0, // Skip
73 
74  0x04000, // B
75  0x01000, // A
76  0x00800, // X
77  0x02000, // Y
78 
79  0x00020, // L
80  0x00002, // R
81  0x08000, // ZL
82  0x00400, // ZR
83 };
84 
85 WII::WII(BTD *p, bool pair) :
86 BluetoothService(p) // Pointer to USB class instance - mandatory
87 {
89 
90  HIDBuffer[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
91 
92  /* Set device cid for the control and intterrupt channelse - LSB */
93  control_dcid[0] = 0x60; // 0x0060
94  control_dcid[1] = 0x00;
95  interrupt_dcid[0] = 0x61; // 0x0061
96  interrupt_dcid[1] = 0x00;
97 
98  Reset();
99 }
100 
101 void WII::Reset() {
102  wiimoteConnected = false;
103  nunchuckConnected = false;
104  motionPlusConnected = false;
105  activateNunchuck = false;
106  motionValuesReset = false;
107  activeConnection = false;
108  motionPlusInside = false;
109  pBtd->wiiUProController = false;
111  wiiBalanceBoardConnected = false;
112  l2cap_event_flag = 0; // Reset flags
113  l2cap_state = L2CAP_WAIT;
114 }
115 
116 void WII::disconnect() { // Use this void to disconnect any of the controllers
117  if(!motionPlusInside) { // The old Wiimote needs a delay after the first command or it will automatically reconnect
118  if(motionPlusConnected) {
119 #ifdef DEBUG_USB_HOST
120  Notify(PSTR("\r\nDeactivating Motion Plus"), 0x80);
121 #endif
122  initExtension1(); // This will disable the Motion Plus extension
123  }
124  timer = (uint32_t)millis() + 1000; // We have to wait for the message before the rest of the channels can be deactivated
125  } else
126  timer = (uint32_t)millis(); // Don't wait
127  // First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
128  pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
129  Reset();
130  l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
131 }
132 
133 void WII::ACLData(uint8_t* l2capinbuf) {
134  if(!pBtd->l2capConnectionClaimed && pBtd->incomingWii && !wiimoteConnected && !activeConnection) {
135  if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
136  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
137  motionPlusInside = pBtd->motionPlusInside;
138  pBtd->incomingWii = false;
139  pBtd->l2capConnectionClaimed = true; // Claim that the incoming connection belongs to this service
140  activeConnection = true;
141  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
142  l2cap_state = L2CAP_WAIT;
143  }
144  }
145  }
146 
147  if(checkHciHandle(l2capinbuf, hci_handle)) { // acl_handle_ok
148  if((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001U) { // l2cap_control - Channel ID for ACL-U
149  if(l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
150 #ifdef DEBUG_USB_HOST
151  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
152  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
153  Notify(PSTR(" "), 0x80);
154  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
155  Notify(PSTR(" "), 0x80);
156  D_PrintHex<uint8_t > (l2capinbuf[17], 0x80);
157  Notify(PSTR(" "), 0x80);
158  D_PrintHex<uint8_t > (l2capinbuf[16], 0x80);
159  Notify(PSTR(" "), 0x80);
160  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
161  Notify(PSTR(" "), 0x80);
162  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
163 #endif
164  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_RESPONSE) {
165  if(((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) && ((l2capinbuf[18] | (l2capinbuf[19] << 8)) == SUCCESSFUL)) { // Success
166  if(l2capinbuf[14] == control_dcid[0] && l2capinbuf[15] == control_dcid[1]) {
167  //Notify(PSTR("\r\nHID Control Connection Complete"), 0x80);
168  identifier = l2capinbuf[9];
169  control_scid[0] = l2capinbuf[12];
170  control_scid[1] = l2capinbuf[13];
172  } else if(l2capinbuf[14] == interrupt_dcid[0] && l2capinbuf[15] == interrupt_dcid[1]) {
173  //Notify(PSTR("\r\nHID Interrupt Connection Complete"), 0x80);
174  identifier = l2capinbuf[9];
175  interrupt_scid[0] = l2capinbuf[12];
176  interrupt_scid[1] = l2capinbuf[13];
178  }
179  }
180  } else if(l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
181 #ifdef EXTRADEBUG
182  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
183  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
184  Notify(PSTR(" "), 0x80);
185  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
186  Notify(PSTR(" SCID: "), 0x80);
187  D_PrintHex<uint8_t > (l2capinbuf[15], 0x80);
188  Notify(PSTR(" "), 0x80);
189  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
190  Notify(PSTR(" Identifier: "), 0x80);
191  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
192 #endif
193  if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
194  identifier = l2capinbuf[9];
195  control_scid[0] = l2capinbuf[14];
196  control_scid[1] = l2capinbuf[15];
198  } else if((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_INTR_PSM) {
199  identifier = l2capinbuf[9];
200  interrupt_scid[0] = l2capinbuf[14];
201  interrupt_scid[1] = l2capinbuf[15];
203  }
204  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_RESPONSE) {
205  if((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) { // Success
206  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
207  //Notify(PSTR("\r\nHID Control Configuration Complete"), 0x80);
208  identifier = l2capinbuf[9];
210  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
211  //Notify(PSTR("\r\nHID Interrupt Configuration Complete"), 0x80);
212  identifier = l2capinbuf[9];
214  }
215  }
216  } else if(l2capinbuf[8] == L2CAP_CMD_CONFIG_REQUEST) {
217  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
218  //Notify(PSTR("\r\nHID Control Configuration Request"), 0x80);
219  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], control_scid);
220  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
221  //Notify(PSTR("\r\nHID Interrupt Configuration Request"), 0x80);
222  pBtd->l2cap_config_response(hci_handle, l2capinbuf[9], interrupt_scid);
223  }
224  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
225  if(l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
226 #ifdef DEBUG_USB_HOST
227  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
228 #endif
229  identifier = l2capinbuf[9];
230  pBtd->l2cap_disconnection_response(hci_handle, identifier, control_dcid, control_scid);
231  Reset();
232  } else if(l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
233 #ifdef DEBUG_USB_HOST
234  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
235 #endif
236  identifier = l2capinbuf[9];
237  pBtd->l2cap_disconnection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid);
238  Reset();
239  }
240  } else if(l2capinbuf[8] == L2CAP_CMD_DISCONNECT_RESPONSE) {
241  if(l2capinbuf[12] == control_scid[0] && l2capinbuf[13] == control_scid[1]) {
242  //Notify(PSTR("\r\nDisconnect Response: Control Channel"), 0x80);
243  identifier = l2capinbuf[9];
245  } else if(l2capinbuf[12] == interrupt_scid[0] && l2capinbuf[13] == interrupt_scid[1]) {
246  //Notify(PSTR("\r\nDisconnect Response: Interrupt Channel"), 0x80);
247  identifier = l2capinbuf[9];
249  }
250  }
251 #ifdef EXTRADEBUG
252  else {
253  identifier = l2capinbuf[9];
254  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
255  D_PrintHex<uint8_t > (l2capinbuf[8], 0x80);
256  }
257 #endif
258  } else if(l2capinbuf[6] == interrupt_dcid[0] && l2capinbuf[7] == interrupt_dcid[1]) { // l2cap_interrupt
259  //Notify(PSTR("\r\nL2CAP Interrupt"), 0x80);
260  if(l2capinbuf[8] == 0xA1) { // HID_THDR_DATA_INPUT
261  if((l2capinbuf[9] >= 0x20 && l2capinbuf[9] <= 0x22) || (l2capinbuf[9] >= 0x30 && l2capinbuf[9] <= 0x37) || l2capinbuf[9] == 0x3e || l2capinbuf[9] == 0x3f) { // These reports include the buttons
262  if((l2capinbuf[9] >= 0x20 && l2capinbuf[9] <= 0x22) || l2capinbuf[9] == 0x31 || l2capinbuf[9] == 0x33) // These reports have no extensions bytes
263  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8));
265  ButtonState = (uint32_t)(((~l2capinbuf[23]) & 0xFE) | ((uint16_t)(~l2capinbuf[24]) << 8) | ((uint32_t)((~l2capinbuf[25]) & 0x03) << 16));
266  else if(motionPlusConnected) {
267  if(l2capinbuf[20] & 0x02) // Only update the Wiimote buttons, since the extension bytes are from the Motion Plus
268  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)(ButtonState & 0xFFFF0000)));
269  else if(nunchuckConnected) // Update if it's a report from the Nunchuck
270  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)((~l2capinbuf[20]) & 0x0C) << 14));
271  //else if(classicControllerConnected) // Update if it's a report from the Classic Controller
272  } else if(nunchuckConnected) // The Nunchuck is directly connected
273  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)((~l2capinbuf[20]) & 0x03) << 16));
274  //else if(classicControllerConnected) // The Classic Controller is directly connected
275  else if(!unknownExtensionConnected)
276  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8));
277 #ifdef PRINTREPORT
278  Notify(PSTR("ButtonState: "), 0x80);
279  D_PrintHex<uint32_t > (ButtonState, 0x80);
280  Notify(PSTR("\r\n"), 0x80);
281 #endif
282  if(ButtonState != OldButtonState) {
283  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
284  OldButtonState = ButtonState;
285  }
286  }
287  if(l2capinbuf[9] == 0x31 || l2capinbuf[9] == 0x33 || l2capinbuf[9] == 0x35 || l2capinbuf[9] == 0x37) { // Read the accelerometer
288  accXwiimote = ((l2capinbuf[12] << 2) | (l2capinbuf[10] & 0x60 >> 5)) - 500;
289  accYwiimote = ((l2capinbuf[13] << 2) | (l2capinbuf[11] & 0x20 >> 4)) - 500;
290  accZwiimote = ((l2capinbuf[14] << 2) | (l2capinbuf[11] & 0x40 >> 5)) - 500;
291  }
292  switch(l2capinbuf[9]) {
293  case 0x20: // Status Information - (a1) 20 BB BB LF 00 00 VV
294 #ifdef EXTRADEBUG
295  Notify(PSTR("\r\nStatus report was received"), 0x80);
296 #endif
297  wiiState = l2capinbuf[12]; // (0x01: Battery is nearly empty), (0x02: An Extension Controller is connected), (0x04: Speaker enabled), (0x08: IR enabled), (0x10: LED1, 0x20: LED2, 0x40: LED3, 0x80: LED4)
298  batteryLevel = l2capinbuf[15]; // Update battery level
299 
300  if(!checkBatteryLevel) { // If this is true it means that the user must have called getBatteryLevel()
301  if(l2capinbuf[12] & 0x02) { // Check if a extension is connected
302 #ifdef DEBUG_USB_HOST
303  if(!unknownExtensionConnected)
304  Notify(PSTR("\r\nExtension connected"), 0x80);
305 #endif
306  unknownExtensionConnected = true;
307 #ifdef WIICAMERA
308  if(!isIRCameraEnabled()) // Don't activate the Motion Plus if we are trying to initialize the IR camera
309 #endif
310  setReportMode(false, 0x35); // Also read the extension
311  } else {
312 #ifdef DEBUG_USB_HOST
313  Notify(PSTR("\r\nExtension disconnected"), 0x80);
314 #endif
315  if(motionPlusConnected) {
316 #ifdef DEBUG_USB_HOST
317  Notify(PSTR(" - from Motion Plus"), 0x80);
318 #endif
320  if(!activateNunchuck) // If it's already trying to initialize the Nunchuck don't set it to false
321  nunchuckConnected = false;
322  //else if(classicControllerConnected)
323  } else if(nunchuckConnected) {
324 #ifdef DEBUG_USB_HOST
325  Notify(PSTR(" - Nunchuck"), 0x80);
326 #endif
327  nunchuckConnected = false; // It must be the Nunchuck controller then
329  onInit();
330 #ifdef WIICAMERA
331  if(!isIRCameraEnabled()) // We still want to read from the IR camera, so do not change the report mode
332 #endif
333  setReportMode(false, 0x31); // If there is no extension connected we will read the buttons and accelerometer
334  } else {
335 #ifdef WIICAMERA
336  if(!isIRCameraEnabled()) // We still want to read from the IR camera, so do not change the report mode
337 #endif
338  setReportMode(false, 0x31); // If there is no extension connected we will read the buttons and accelerometer
339  }
340  }
341  }
342  else {
343 #ifdef EXTRADEBUG
344  Notify(PSTR("\r\nChecking battery level"), 0x80);
345 #endif
346  checkBatteryLevel = false; // Check for extensions by default
347  }
348 #ifdef DEBUG_USB_HOST
349  if(l2capinbuf[12] & 0x01)
350  Notify(PSTR("\r\nWARNING: Battery is nearly empty"), 0x80);
351 #endif
352 
353  break;
354  case 0x21: // Read Memory Data
355  if((l2capinbuf[12] & 0x0F) == 0) { // No error
356  uint8_t reportLength = (l2capinbuf[12] >> 4) + 1; // // Bit 4-7 is the length - 1
357  // See: http://wiibrew.org/wiki/Wiimote/Extension_Controllers
358  if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x00 && l2capinbuf[20] == 0x00) {
359 #ifdef DEBUG_USB_HOST
360  Notify(PSTR("\r\nNunchuck connected"), 0x80);
361 #endif
363  } else if(l2capinbuf[16] == 0x00 && (l2capinbuf[17] == 0xA6 || l2capinbuf[17] == 0xA4) && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x00 && l2capinbuf[20] == 0x05) {
364 #ifdef DEBUG_USB_HOST
365  Notify(PSTR("\r\nMotion Plus connected"), 0x80);
366 #endif
368  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x04 && l2capinbuf[20] == 0x05) {
369 #ifdef DEBUG_USB_HOST
370  Notify(PSTR("\r\nMotion Plus activated in normal mode"), 0x80);
371 #endif
372  motionPlusConnected = true;
373 #ifdef WIICAMERA
374  if(!isIRCameraEnabled()) // Don't activate the Motion Plus if we are trying to initialize the IR camera
375 #endif
376  setReportMode(false, 0x35); // Also read the extension
377  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x05 && l2capinbuf[20] == 0x05) {
378 #ifdef DEBUG_USB_HOST
379  Notify(PSTR("\r\nMotion Plus activated in Nunchuck pass-through mode"), 0x80);
380 #endif
381  activateNunchuck = false;
382  motionPlusConnected = true;
383  nunchuckConnected = true;
384 #ifdef WIICAMERA
385  if(!isIRCameraEnabled()) // Don't activate the Motion Plus if we are trying to initialize the IR camera
386 #endif
387  setReportMode(false, 0x35); // Also read the extension
388  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA6 && l2capinbuf[18] == 0x20 && (l2capinbuf[19] == 0x00 || l2capinbuf[19] == 0x04 || l2capinbuf[19] == 0x05 || l2capinbuf[19] == 0x07) && l2capinbuf[20] == 0x05) {
389 #ifdef DEBUG_USB_HOST
390  Notify(PSTR("\r\nInactive Wii Motion Plus"), 0x80);
391  Notify(PSTR("\r\nPlease unplug the Motion Plus, disconnect the Wiimote and then replug the Motion Plus Extension"), 0x80);
392 #endif
393  stateCounter = 300; // Skip the rest in "WII_CHECK_MOTION_PLUS_STATE"
394  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x01 && l2capinbuf[20] == 0x20) {
395 #ifdef DEBUG_USB_HOST
396  Notify(PSTR("\r\nWii U Pro Controller connected"), 0x80);
397 #endif
399  } else if(l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x04 && l2capinbuf[20] == 0x02) {
400 #ifdef DEBUG_USB_HOST
401  Notify(PSTR("\r\nWii Balance Board connected"), 0x80);
402 #endif
403  setReportMode(false, 0x32); // Read the Wii Balance Board extension
405  }
406  // Wii Balance Board calibration reports (24 bits in total)
407  else if(l2capinbuf[13] == 0x00 && l2capinbuf[14] == 0x24 && reportLength == 16) { // First 16-bit
408  for(uint8_t i = 0; i < 2; i++) {
409  for(uint8_t j = 0; j < 4; j++)
410  wiiBalanceBoardCal[i][j] = l2capinbuf[16 + 8 * i + 2 * j] | l2capinbuf[15 + 8 * i + 2 * j] << 8;
411  }
412  } else if(l2capinbuf[13] == 0x00 && l2capinbuf[14] == 0x34 && reportLength == 8) { // Last 8-bit
413  for(uint8_t j = 0; j < 4; j++)
414  wiiBalanceBoardCal[2][j] = l2capinbuf[16 + 2 * j] | l2capinbuf[15 + 2 * j] << 8;
415 #ifdef DEBUG_USB_HOST
416  Notify(PSTR("\r\nWii Balance Board calibration values read successfully"), 0x80);
417 #endif
420  }
421 #ifdef DEBUG_USB_HOST
422  else {
423  Notify(PSTR("\r\nUnknown Device: "), 0x80);
424  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
425  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
426  Notify(PSTR("\r\nData: "), 0x80);
427  for(uint8_t i = 0; i < reportLength; i++) {
428  D_PrintHex<uint8_t > (l2capinbuf[15 + i], 0x80);
429  Notify(PSTR(" "), 0x80);
430  }
431  }
432 #endif
433  }
434 #ifdef EXTRADEBUG
435  else {
436  Notify(PSTR("\r\nReport Error: "), 0x80);
437  D_PrintHex<uint8_t > (l2capinbuf[13], 0x80);
438  D_PrintHex<uint8_t > (l2capinbuf[14], 0x80);
439  }
440 #endif
441  break;
442  case 0x22: // Acknowledge output report, return function result
443 #ifdef DEBUG_USB_HOST
444  if(l2capinbuf[13] != 0x00) { // Check if there is an error
445  Notify(PSTR("\r\nCommand failed: "), 0x80);
446  D_PrintHex<uint8_t > (l2capinbuf[12], 0x80);
447  }
448 #endif
449  break;
450  case 0x30: // Core buttons - (a1) 30 BB BB
451  break;
452  case 0x31: // Core Buttons and Accelerometer - (a1) 31 BB BB AA AA AA
453  break;
454  case 0x32: // Core Buttons with 8 Extension bytes - (a1) 32 BB BB EE EE EE EE EE EE EE EE
455  // See: http://wiibrew.org/wiki/Wii_Balance_Board#Data_Format
456  wiiBalanceBoardRaw[TopRight] = l2capinbuf[13] | l2capinbuf[12] << 8; // Top right
457  wiiBalanceBoardRaw[BotRight] = l2capinbuf[15] | l2capinbuf[14] << 8; // Bottom right
458  wiiBalanceBoardRaw[TopLeft] = l2capinbuf[17] | l2capinbuf[16] << 8; // Top left
459  wiiBalanceBoardRaw[BotLeft] = l2capinbuf[19] | l2capinbuf[18] << 8; // Bottom left
460  break;
461  case 0x33: // Core Buttons with Accelerometer and 12 IR bytes - (a1) 33 BB BB AA AA AA II II II II II II II II II II II II
462 #ifdef WIICAMERA
463  // Read the IR data
464  IR_object_x1 = (l2capinbuf[15] | ((uint16_t)(l2capinbuf[17] & 0x30) << 4)); // x position
465  IR_object_y1 = (l2capinbuf[16] | ((uint16_t)(l2capinbuf[17] & 0xC0) << 2)); // y position
466  IR_object_s1 = (l2capinbuf[17] & 0x0F); // Size value, 0-15
467 
468  IR_object_x2 = (l2capinbuf[18] | ((uint16_t)(l2capinbuf[20] & 0x30) << 4));
469  IR_object_y2 = (l2capinbuf[19] | ((uint16_t)(l2capinbuf[20] & 0xC0) << 2));
470  IR_object_s2 = (l2capinbuf[20] & 0x0F);
471 
472  IR_object_x3 = (l2capinbuf[21] | ((uint16_t)(l2capinbuf[23] & 0x30) << 4));
473  IR_object_y3 = (l2capinbuf[22] | ((uint16_t)(l2capinbuf[23] & 0xC0) << 2));
474  IR_object_s3 = (l2capinbuf[23] & 0x0F);
475 
476  IR_object_x4 = (l2capinbuf[24] | ((uint16_t)(l2capinbuf[26] & 0x30) << 4));
477  IR_object_y4 = (l2capinbuf[25] | ((uint16_t)(l2capinbuf[26] & 0xC0) << 2));
478  IR_object_s4 = (l2capinbuf[26] & 0x0F);
479 #endif
480  break;
481  case 0x34: // Core Buttons with 19 Extension bytes - (a1) 34 BB BB EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE
482  break;
483  /* 0x3e and 0x3f both give unknown report types when report mode is 0x3e or 0x3f with mode number 0x05 */
484  case 0x3E: // Core Buttons with Accelerometer and 32 IR bytes
485  // (a1) 31 BB BB AA AA AA II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II
486  // corresponds to output report mode 0x3e
487 
488  /**** for reading in full mode: DOES NOT WORK YET ****/
489  /* When it works it will also have intensity and bounding box data */
490  /*
491  IR_object_x1 = (l2capinbuf[13] | ((uint16_t)(l2capinbuf[15] & 0x30) << 4));
492  IR_object_y1 = (l2capinbuf[14] | ((uint16_t)(l2capinbuf[15] & 0xC0) << 2));
493  IR_object_s1 = (l2capinbuf[15] & 0x0F);
494  */
495  break;
496  case 0x3F:
497  /*
498  IR_object_x1 = (l2capinbuf[13] | ((uint16_t)(l2capinbuf[15] & 0x30) << 4));
499  IR_object_y1 = (l2capinbuf[14] | ((uint16_t)(l2capinbuf[15] & 0xC0) << 2));
500  IR_object_s1 = (l2capinbuf[15] & 0x0F);
501  */
502  break;
503  case 0x35: // Core Buttons and Accelerometer with 16 Extension Bytes
504  // (a1) 35 BB BB AA AA AA EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE EE
505 #if 1 // Set this to 0 if you don't want to use an extension, this reduceds the size of the library a lot!
506  if(motionPlusConnected) {
507  if(l2capinbuf[20] & 0x02) { // Check if it's a report from the Motion controller or the extension
508  if(motionValuesReset) { // We will only use the values when the gyro value has been set
509  gyroYawRaw = ((l2capinbuf[15] | ((l2capinbuf[18] & 0xFC) << 6)) - gyroYawZero);
510  gyroRollRaw = ((l2capinbuf[16] | ((l2capinbuf[19] & 0xFC) << 6)) - gyroRollZero);
511  gyroPitchRaw = ((l2capinbuf[17] | ((l2capinbuf[20] & 0xFC) << 6)) - gyroPitchZero);
512 
513  yawGyroSpeed = (float)gyroYawRaw / ((float)gyroYawZero / yawGyroScale);
514  rollGyroSpeed = -(float)gyroRollRaw / ((float)gyroRollZero / rollGyroScale); // We invert these values so they will fit the acc values
516 
517  /* The onboard gyro has two ranges for slow and fast mode */
518  if(!(l2capinbuf[18] & 0x02)) // Check if fast mode is used
519  yawGyroSpeed *= 4.545;
520  if(!(l2capinbuf[18] & 0x01)) // Check if fast mode is used
521  pitchGyroSpeed *= 4.545;
522  if(!(l2capinbuf[19] & 0x02)) // Check if fast mode is used
523  rollGyroSpeed *= 4.545;
524 
525  compPitch = (0.93f * (compPitch + (pitchGyroSpeed * (float)((uint32_t)micros() - timer) / 1000000.0f)))+(0.07f * getWiimotePitch()); // Use a complimentary filter to calculate the angle
526  compRoll = (0.93f * (compRoll + (rollGyroSpeed * (float)((uint32_t)micros() - timer) / 1000000.0f)))+(0.07f * getWiimoteRoll());
527 
528  gyroYaw += (yawGyroSpeed * ((float)((uint32_t)micros() - timer) / 1000000.0f));
529  gyroRoll += (rollGyroSpeed * ((float)((uint32_t)micros() - timer) / 1000000.0f));
530  gyroPitch += (pitchGyroSpeed * ((float)((uint32_t)micros() - timer) / 1000000.0f));
531  timer = (uint32_t)micros();
532  /*
533  // Uncomment these lines to tune the gyro scale variabels
534  Notify(PSTR("\r\ngyroYaw: "), 0x80);
535  Notify(gyroYaw, 0x80);
536  Notify(PSTR("\tgyroRoll: "), 0x80);
537  Notify(gyroRoll, 0x80);
538  Notify(PSTR("\tgyroPitch: "), 0x80);
539  Notify(gyroPitch, 0x80);
540  */
541  /*
542  Notify(PSTR("\twiimoteRoll: "), 0x80);
543  Notify(wiimoteRoll, 0x80);
544  Notify(PSTR("\twiimotePitch: "), 0x80);
545  Notify(wiimotePitch, 0x80);
546  */
547  } else {
548  if((int32_t)((uint32_t)micros() - timer) > 1000000) { // Loop for 1 sec before resetting the values
549 #ifdef DEBUG_USB_HOST
550  Notify(PSTR("\r\nThe gyro values has been reset"), 0x80);
551 #endif
552  gyroYawZero = (l2capinbuf[15] | ((l2capinbuf[18] & 0xFC) << 6));
553  gyroRollZero = (l2capinbuf[16] | ((l2capinbuf[19] & 0xFC) << 6));
554  gyroPitchZero = (l2capinbuf[17] | ((l2capinbuf[20] & 0xFC) << 6));
555 
556  rollGyroScale = 500; // You might need to adjust these
557  pitchGyroScale = 400;
558  yawGyroScale = 415;
559 
560  gyroYaw = 0;
561  gyroRoll = 0;
562  gyroPitch = 0;
563 
564  motionValuesReset = true;
565  timer = (uint32_t)micros();
566  }
567  }
568  } else {
569  if(nunchuckConnected) {
570  hatValues[HatX] = l2capinbuf[15];
571  hatValues[HatY] = l2capinbuf[16];
572  accXnunchuck = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x10 >> 3)) - 416;
573  accYnunchuck = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x20 >> 4)) - 416;
574  accZnunchuck = (((l2capinbuf[19] & 0xFE) << 2) | (l2capinbuf[20] & 0xC0 >> 5)) - 416;
575  }
576  //else if(classicControllerConnected) { }
577  }
578  if(l2capinbuf[19] & 0x01) {
579  if(!extensionConnected) {
580  extensionConnected = true;
581  unknownExtensionConnected = true;
582 #ifdef DEBUG_USB_HOST
583  Notify(PSTR("\r\nExtension connected to Motion Plus"), 0x80);
584 #endif
585  }
586  } else {
587  if(extensionConnected && !unknownExtensionConnected) {
588  extensionConnected = false;
589  unknownExtensionConnected = true;
590 #ifdef DEBUG_USB_HOST
591  Notify(PSTR("\r\nExtension disconnected from Motion Plus"), 0x80);
592 #endif
593  nunchuckConnected = false; // There is no extension connected to the Motion Plus if this report is sent
594  }
595  }
596 
597  } else if(nunchuckConnected) {
598  hatValues[HatX] = l2capinbuf[15];
599  hatValues[HatY] = l2capinbuf[16];
600  accXnunchuck = ((l2capinbuf[17] << 2) | (l2capinbuf[20] & 0x0C >> 2)) - 416;
601  accYnunchuck = ((l2capinbuf[18] << 2) | (l2capinbuf[20] & 0x30 >> 4)) - 416;
602  accZnunchuck = ((l2capinbuf[19] << 2) | (l2capinbuf[20] & 0xC0 >> 6)) - 416;
603  } else if(wiiUProControllerConnected) {
604  hatValues[LeftHatX] = (l2capinbuf[15] | l2capinbuf[16] << 8);
605  hatValues[RightHatX] = (l2capinbuf[17] | l2capinbuf[18] << 8);
606  hatValues[LeftHatY] = (l2capinbuf[19] | l2capinbuf[20] << 8);
607  hatValues[RightHatY] = (l2capinbuf[21] | l2capinbuf[22] << 8);
608  }
609 #endif
610  break;
611 #ifdef DEBUG_USB_HOST
612  default:
613  Notify(PSTR("\r\nUnknown Report type: "), 0x80);
614  D_PrintHex<uint8_t > (l2capinbuf[9], 0x80);
615  break;
616 #endif
617  }
618  }
619  }
620  L2CAP_task();
621  }
622 }
623 
624 void WII::L2CAP_task() {
625  switch(l2cap_state) {
626  /* These states are used if the Wiimote is the host */
629 #ifdef DEBUG_USB_HOST
630  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
631 #endif
632  l2cap_state = L2CAP_INTERRUPT_SETUP;
633  }
634  break;
635 
638 #ifdef DEBUG_USB_HOST
639  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
640 #endif
641  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, PENDING);
642  delay(1);
643  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, SUCCESSFUL);
644  identifier++;
645  delay(1);
646  pBtd->l2cap_config_request(hci_handle, identifier, interrupt_scid);
647 
648  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
649  }
650  break;
651 
652  /* These states are used if the Arduino is the host */
655 #ifdef DEBUG_USB_HOST
656  Notify(PSTR("\r\nSend HID Control Config Request"), 0x80);
657 #endif
658  identifier++;
660  l2cap_state = L2CAP_CONTROL_CONFIG_REQUEST;
661  }
662  break;
663 
666 #ifdef DEBUG_USB_HOST
667  Notify(PSTR("\r\nSend HID Interrupt Connection Request"), 0x80);
668 #endif
669  identifier++;
671  l2cap_state = L2CAP_INTERRUPT_CONNECT_REQUEST;
672  }
673  break;
674 
677 #ifdef DEBUG_USB_HOST
678  Notify(PSTR("\r\nSend HID Interrupt Config Request"), 0x80);
679 #endif
680  identifier++;
681  pBtd->l2cap_config_request(hci_handle, identifier, interrupt_scid);
682  l2cap_state = L2CAP_INTERRUPT_CONFIG_REQUEST;
683  }
684  break;
685 
687  if(l2cap_check_flag(L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)) { // Now the HID channels is established
688 #ifdef DEBUG_USB_HOST
689  Notify(PSTR("\r\nHID Channels Established"), 0x80);
690 #endif
691  pBtd->connectToWii = false;
692  pBtd->pairWithWii = false;
693  stateCounter = 0;
694  l2cap_state = WII_CHECK_MOTION_PLUS_STATE;
695  }
696  break;
697 
698  /* The next states are in run() */
699 
701  if(l2cap_check_flag(L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE) && ((int32_t)((uint32_t)millis() - timer) >= 0L)) {
702 #ifdef DEBUG_USB_HOST
703  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
704 #endif
705  identifier++;
706  pBtd->l2cap_disconnection_request(hci_handle, identifier, control_scid, control_dcid);
707  l2cap_state = L2CAP_CONTROL_DISCONNECT;
708  }
709  break;
710 
713 #ifdef DEBUG_USB_HOST
714  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
715 #endif
717  hci_handle = -1; // Reset handle
718  l2cap_event_flag = 0; // Reset flags
719  l2cap_state = L2CAP_WAIT;
720  }
721  break;
722  }
723 }
724 
725 void WII::Run() {
726  if(l2cap_state == L2CAP_INTERRUPT_DISCONNECT && ((int32_t)((uint32_t)millis() - timer) >= 0L))
727  L2CAP_task(); // Call the rest of the disconnection routine after we have waited long enough
728 
729  switch(l2cap_state) {
730  case L2CAP_WAIT:
731  if(pBtd->connectToWii && !pBtd->l2capConnectionClaimed && !wiimoteConnected && !activeConnection) {
733  activeConnection = true;
734  motionPlusInside = pBtd->motionPlusInside;
735 #ifdef DEBUG_USB_HOST
736  Notify(PSTR("\r\nSend HID Control Connection Request"), 0x80);
737 #endif
738  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
739  l2cap_event_flag = 0; // Reset flags
740  identifier = 0;
742  l2cap_state = L2CAP_CONTROL_CONNECT_REQUEST;
744 #ifdef DEBUG_USB_HOST
745  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
746 #endif
747  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, PENDING);
748  delay(1);
749  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, SUCCESSFUL);
750  identifier++;
751  delay(1);
753  l2cap_state = L2CAP_CONTROL_SUCCESS;
754  }
755  break;
756 
758 #ifdef DEBUG_USB_HOST
759  if(stateCounter == 0) // Only print onnce
760  Notify(PSTR("\r\nChecking if a Motion Plus is connected"), 0x80);
761 #endif
762  stateCounter++;
763  if(stateCounter % 200 == 0)
764  checkMotionPresent(); // Check if there is a motion plus connected
766  stateCounter = 0;
767  l2cap_state = WII_INIT_MOTION_PLUS_STATE;
768  timer = (uint32_t)micros();
769 
770  if(unknownExtensionConnected) {
771 #ifdef DEBUG_USB_HOST
772  Notify(PSTR("\r\nA extension is also connected"), 0x80);
773 #endif
774  activateNunchuck = true; // For we will just set this to true as this the only extension supported so far
775  }
776 
777  } else if(stateCounter == 601) { // We will try three times to check for the motion plus
778 #ifdef DEBUG_USB_HOST
779  Notify(PSTR("\r\nNo Motion Plus was detected"), 0x80);
780 #endif
781  stateCounter = 0;
782  l2cap_state = WII_CHECK_EXTENSION_STATE;
783  }
784  break;
785 
786  case WII_CHECK_EXTENSION_STATE: // This is used to check if there is anything plugged in to the extension port
787 #ifdef DEBUG_USB_HOST
788  if(stateCounter == 0) // Only print onnce
789  Notify(PSTR("\r\nChecking if there is any extension connected"), 0x80);
790 #endif
791  stateCounter++; // We use this counter as there has to be a short delay between the commands
792  if(stateCounter == 1)
793  statusRequest(); // See if a new device has connected
794  if(stateCounter == 100) {
795  if(unknownExtensionConnected) // Check if there is a extension is connected to the port
796  initExtension1();
797  else
798  stateCounter = 499;
799  } else if(stateCounter == 200)
800  initExtension2();
801  else if(stateCounter == 300) {
802  readExtensionType();
803  unknownExtensionConnected = false;
804  } else if(stateCounter == 400) {
806 #ifdef DEBUG_USB_HOST
807  Notify(PSTR("\r\nReading Wii Balance Board calibration values"), 0x80);
808 #endif
809  readWiiBalanceBoardCalibration();
810  } else
811  stateCounter = 499;
812  } else if(stateCounter == 500) {
813  stateCounter = 0;
814  l2cap_state = TURN_ON_LED;
815  }
816  break;
817 
819  stateCounter++;
820  if(stateCounter == 1)
821  initMotionPlus();
822  else if(stateCounter == 100)
823  activateMotionPlus();
824  else if(stateCounter == 200)
825  readExtensionType(); // Check if it has been activated
826  else if(stateCounter == 300) {
827  stateCounter = 0;
828  unknownExtensionConnected = false; // The motion plus will send a status report when it's activated, we will set this to false so it doesn't reinitialize the Motion Plus
829  l2cap_state = TURN_ON_LED;
830  }
831  break;
832 
833  case TURN_ON_LED:
835  nunchuckConnected = true;
836  wiimoteConnected = true;
837  onInit();
838  l2cap_state = L2CAP_DONE;
839  break;
840 
841  case L2CAP_DONE:
842  if(unknownExtensionConnected) {
843 #ifdef DEBUG_USB_HOST
844  if(stateCounter == 0) // Only print once
845  Notify(PSTR("\r\nChecking extension port"), 0x80);
846 #endif
847  stateCounter++; // We will use this counter as there has to be a short delay between the commands
848  if(stateCounter == 50)
849  statusRequest();
850  else if(stateCounter == 100)
851  initExtension1();
852  else if(stateCounter == 150)
853  if((extensionConnected && motionPlusConnected) || (unknownExtensionConnected && !motionPlusConnected))
854  initExtension2();
855  else
856  stateCounter = 299; // There is no extension connected
857  else if(stateCounter == 200)
858  readExtensionType();
859  else if(stateCounter == 250) {
861 #ifdef DEBUG_USB_HOST
862  Notify(PSTR("\r\nNunchuck was reconnected"), 0x80);
863 #endif
864  activateNunchuck = true;
865  nunchuckConnected = true;
866  }
868  stateCounter = 449;
869  } else if(stateCounter == 300) {
870  if(motionPlusConnected) {
871 #ifdef DEBUG_USB_HOST
872  Notify(PSTR("\r\nReactivating the Motion Plus"), 0x80);
873 #endif
874  initMotionPlus();
875  } else
876  stateCounter = 449;
877  } else if(stateCounter == 350)
878  activateMotionPlus();
879  else if(stateCounter == 400)
880  readExtensionType(); // Check if it has been activated
881  else if(stateCounter == 450) {
882  onInit();
883  stateCounter = 0;
884  unknownExtensionConnected = false;
885  }
886  } else
887  stateCounter = 0;
888  break;
889  }
890 }
891 
892 /************************************************************/
893 /* HID Commands */
894 /************************************************************/
895 
896 void WII::HID_Command(uint8_t* data, uint8_t nbytes) {
897  if(motionPlusInside)
898  pBtd->L2CAP_Command(hci_handle, data, nbytes, interrupt_scid[0], interrupt_scid[1]); // It's the new Wiimote with the Motion Plus Inside or Wii U Pro controller
899  else
900  pBtd->L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]);
901 }
902 
904  HIDBuffer[1] = 0x11;
905  HIDBuffer[2] = 0x00;
906  HID_Command(HIDBuffer, 3);
907 }
908 
910  HIDBuffer[1] = 0x11;
911  HIDBuffer[2] &= ~0x01; // Bit 0 control the rumble
912  HID_Command(HIDBuffer, 3);
913 }
914 
916  HIDBuffer[1] = 0x11;
917  HIDBuffer[2] |= 0x01; // Bit 0 control the rumble
918  HID_Command(HIDBuffer, 3);
919 }
920 
922  HIDBuffer[1] = 0x11;
923  HIDBuffer[2] ^= 0x01; // Bit 0 control the rumble
924  HID_Command(HIDBuffer, 3);
925 }
926 
927 void WII::setLedRaw(uint8_t value) {
928  HIDBuffer[1] = 0x11;
929  HIDBuffer[2] = value | (HIDBuffer[2] & 0x01); // Keep the rumble bit
930  HID_Command(HIDBuffer, 3);
931 }
932 
934  HIDBuffer[1] = 0x11;
935  HIDBuffer[2] &= ~(pgm_read_byte(&WII_LEDS[(uint8_t)a]));
936  HID_Command(HIDBuffer, 3);
937 }
938 
940  if(a == OFF)
941  setLedRaw(0);
942  else {
943  HIDBuffer[1] = 0x11;
944  HIDBuffer[2] |= pgm_read_byte(&WII_LEDS[(uint8_t)a]);
945  HID_Command(HIDBuffer, 3);
946  }
947 }
948 
950  HIDBuffer[1] = 0x11;
951  HIDBuffer[2] ^= pgm_read_byte(&WII_LEDS[(uint8_t)a]);
952  HID_Command(HIDBuffer, 3);
953 }
954 
956  HIDBuffer[1] = 0x11;
957  HIDBuffer[2] = (HIDBuffer[2] & 0x01); // Keep the rumble bit
958  if(wiimoteConnected)
959  HIDBuffer[2] |= 0x10; // If it's connected LED1 will light up
961  HIDBuffer[2] |= 0x20; // If it's connected LED2 will light up
963  HIDBuffer[2] |= 0x40; // If it's connected LED3 will light up
964 
965  HID_Command(HIDBuffer, 3);
966 }
967 
969  checkBatteryLevel = true; // This is needed so the library knows that the status response is a response to this function
970  statusRequest(); // This will update the battery level
971  return batteryLevel;
972 };
973 
974 void WII::setReportMode(bool continuous, uint8_t mode) {
975 #ifdef EXTRADEBUG
976  Notify(PSTR("\r\nReport mode was changed to: "), 0x80);
977  D_PrintHex<uint8_t > (mode, 0x80);
978 #endif
979  uint8_t cmd_buf[4];
980  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
981  cmd_buf[1] = 0x12;
982  if(continuous)
983  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Keep the rumble bit
984  else
985  cmd_buf[2] = 0x00 | (HIDBuffer[2] & 0x01); // Keep the rumble bit
986  cmd_buf[3] = mode;
987  HID_Command(cmd_buf, 4);
988 }
989 
990 void WII::statusRequest() {
991  uint8_t cmd_buf[3];
992  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
993  cmd_buf[1] = 0x15;
994  cmd_buf[2] = (HIDBuffer[2] & 0x01); // Keep the rumble bit
995  HID_Command(cmd_buf, 3);
996 }
997 
998 /************************************************************/
999 /* Memmory Commands */
1000 /************************************************************/
1001 
1002 void WII::writeData(uint32_t offset, uint8_t size, uint8_t* data) {
1003  uint8_t cmd_buf[23];
1004  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
1005  cmd_buf[1] = 0x16; // Write data
1006  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Write to memory, clear bit 2 to write to EEPROM
1007  cmd_buf[3] = (uint8_t)((offset & 0xFF0000) >> 16);
1008  cmd_buf[4] = (uint8_t)((offset & 0xFF00) >> 8);
1009  cmd_buf[5] = (uint8_t)(offset & 0xFF);
1010  cmd_buf[6] = size;
1011  uint8_t i = 0;
1012  for(; i < size; i++)
1013  cmd_buf[7 + i] = data[i];
1014  for(; i < 16; i++) // Set the rest to zero
1015  cmd_buf[7 + i] = 0x00;
1016  HID_Command(cmd_buf, 23);
1017 }
1018 
1019 void WII::initExtension1() {
1020  uint8_t buf[1];
1021  buf[0] = 0x55;
1022  writeData(0xA400F0, 1, buf);
1023 }
1024 
1025 void WII::initExtension2() {
1026  uint8_t buf[1];
1027  buf[0] = 0x00;
1028  writeData(0xA400FB, 1, buf);
1029 }
1030 
1031 void WII::initMotionPlus() {
1032  uint8_t buf[1];
1033  buf[0] = 0x55;
1034  writeData(0xA600F0, 1, buf);
1035 }
1036 
1037 void WII::activateMotionPlus() {
1038  uint8_t buf[1];
1039  if(pBtd->wiiUProController) {
1040 #ifdef DEBUG_USB_HOST
1041  Notify(PSTR("\r\nActivating Wii U Pro Controller"), 0x80);
1042 #endif
1043  buf[0] = 0x00; // It seems like you can send anything but 0x04, 0x05, and 0x07
1044  } else if(activateNunchuck) {
1045 #ifdef DEBUG_USB_HOST
1046  Notify(PSTR("\r\nActivating Motion Plus in pass-through mode"), 0x80);
1047 #endif
1048  buf[0] = 0x05; // Activate nunchuck pass-through mode
1049  }//else if(classicControllerConnected && extensionConnected)
1050  //buf[0] = 0x07;
1051  else {
1052 #ifdef DEBUG_USB_HOST
1053  Notify(PSTR("\r\nActivating Motion Plus in normal mode"), 0x80);
1054 #endif
1055  buf[0] = 0x04; // Don't use any extension
1056  }
1057  writeData(0xA600FE, 1, buf);
1058 }
1059 
1060 void WII::readData(uint32_t offset, uint16_t size, bool EEPROM) {
1061  uint8_t cmd_buf[8];
1062  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
1063  cmd_buf[1] = 0x17; // Read data
1064  if(EEPROM)
1065  cmd_buf[2] = 0x00 | (HIDBuffer[2] & 0x01); // Read from EEPROM
1066  else
1067  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Read from memory
1068  cmd_buf[3] = (uint8_t)((offset & 0xFF0000) >> 16);
1069  cmd_buf[4] = (uint8_t)((offset & 0xFF00) >> 8);
1070  cmd_buf[5] = (uint8_t)(offset & 0xFF);
1071  cmd_buf[6] = (uint8_t)((size & 0xFF00) >> 8);
1072  cmd_buf[7] = (uint8_t)(size & 0xFF);
1073 
1074  HID_Command(cmd_buf, 8);
1075 }
1076 
1077 void WII::readExtensionType() {
1078  readData(0xA400FA, 6, false);
1079 }
1080 
1081 void WII::readCalData() {
1082  readData(0x0016, 8, true);
1083 }
1084 
1085 void WII::checkMotionPresent() {
1086  readData(0xA600FA, 6, false);
1087 }
1088 
1089 void WII::readWiiBalanceBoardCalibration() {
1090  readData(0xA40024, 24, false);
1091 }
1092 
1093 /************************************************************/
1094 /* WII Commands */
1095 /************************************************************/
1096 
1097 bool WII::getButtonPress(ButtonEnum b) { // Return true when a button is pressed
1099  return (ButtonState & pgm_read_dword(&WII_PROCONTROLLER_BUTTONS[(uint8_t)b]));
1100  else
1101  return (ButtonState & pgm_read_dword(&WII_BUTTONS[(uint8_t)b]));
1102 }
1103 
1104 bool WII::getButtonClick(ButtonEnum b) { // Only return true when a button is clicked
1105  uint32_t button;
1107  button = pgm_read_dword(&WII_PROCONTROLLER_BUTTONS[(uint8_t)b]);
1108  else
1109  button = pgm_read_dword(&WII_BUTTONS[(uint8_t)b]);
1110  bool click = (ButtonClickState & button);
1111  ButtonClickState &= ~button; // clear "click" event
1112  return click;
1113 }
1114 
1116  if(!nunchuckConnected)
1117  return 127; // Return center position
1118  else {
1119  uint8_t output = hatValues[(uint8_t)a];
1120  if(output == 0xFF || output == 0x00) // The joystick will only read 255 or 0 when the cable is unplugged or initializing, so we will just return the center position
1121  return 127;
1122  else
1123  return output;
1124  }
1125 }
1126 
1129  return 2000;
1130  else {
1131  uint16_t output = hatValues[(uint8_t)a];
1132  if(output == 0x00) // The joystick will only read 0 when it is first initializing, so we will just return the center position
1133  return 2000;
1134  else
1135  return output;
1136  }
1137 }
1138 
1139 void WII::onInit() {
1140  if(pFuncOnInit)
1141  pFuncOnInit(); // Call the user function
1142  else
1143  setLedStatus();
1144 }
1145 
1146 /************************************************************/
1147 /* Wii Balance Board Commands */
1148 /************************************************************/
1149 
1151  // Use interpolating between two points - based on: https://github.com/skorokithakis/gr8w8upd8m8/blob/master/gr8w8upd8m8.py
1152  // wiiBalanceBoardCal[pos][0] is calibration values for 0 kg
1153  // wiiBalanceBoardCal[pos][1] is calibration values for 17 kg
1154  // wiiBalanceBoardCal[pos][2] is calibration values for 34 kg
1155  if(wiiBalanceBoardRaw[pos] < wiiBalanceBoardCal[0][pos])
1156  return 0.0f; // Below 0 kg
1157  else if(wiiBalanceBoardRaw[pos] < wiiBalanceBoardCal[1][pos]) // Between 0 and 17 kg
1158  return 17.0f * (float)(wiiBalanceBoardRaw[pos] - wiiBalanceBoardCal[0][pos]) / (float)(wiiBalanceBoardCal[1][pos] - wiiBalanceBoardCal[0][pos]);
1159  else // More than 17 kg
1160  return 17.0f + 17.0f * (float)(wiiBalanceBoardRaw[pos] - wiiBalanceBoardCal[1][pos]) / (float)(wiiBalanceBoardCal[2][pos] - wiiBalanceBoardCal[1][pos]);
1161 };
1162 
1165 };
1166 
1167 /************************************************************/
1168 /* The following functions are for the IR camera */
1169 /************************************************************/
1170 
1171 #ifdef WIICAMERA
1172 
1173 void WII::IRinitialize() { // Turns on and initialises the IR camera
1174 
1175  enableIRCamera1();
1176 #ifdef DEBUG_USB_HOST
1177  Notify(PSTR("\r\nEnable IR Camera1 Complete"), 0x80);
1178 #endif
1179  delay(80);
1180 
1181  enableIRCamera2();
1182 #ifdef DEBUG_USB_HOST
1183  Notify(PSTR("\r\nEnable IR Camera2 Complete"), 0x80);
1184 #endif
1185  delay(80);
1186 
1187  write0x08Value();
1188 #ifdef DEBUG_USB_HOST
1189  Notify(PSTR("\r\nWrote hex number 0x08"), 0x80);
1190 #endif
1191  delay(80);
1192 
1193  writeSensitivityBlock1();
1194 #ifdef DEBUG_USB_HOST
1195  Notify(PSTR("\r\nWrote Sensitivity Block 1"), 0x80);
1196 #endif
1197  delay(80);
1198 
1199  writeSensitivityBlock2();
1200 #ifdef DEBUG_USB_HOST
1201  Notify(PSTR("\r\nWrote Sensitivity Block 2"), 0x80);
1202 #endif
1203  delay(80);
1204 
1205  uint8_t mode_num = 0x03;
1206  setWiiModeNumber(mode_num); // Change input for whatever mode you want i.e. 0x01, 0x03, or 0x05
1207 #ifdef DEBUG_USB_HOST
1208  Notify(PSTR("\r\nSet Wii Mode Number To 0x"), 0x80);
1209  D_PrintHex<uint8_t > (mode_num, 0x80);
1210 #endif
1211  delay(80);
1212 
1213  write0x08Value();
1214 #ifdef DEBUG_USB_HOST
1215  Notify(PSTR("\r\nWrote Hex Number 0x08"), 0x80);
1216 #endif
1217  delay(80);
1218 
1219  setReportMode(false, 0x33);
1220  //setReportMode(false, 0x3f); // For full reporting mode, doesn't work yet
1221 #ifdef DEBUG_USB_HOST
1222  Notify(PSTR("\r\nSet Report Mode to 0x33"), 0x80);
1223 #endif
1224  delay(80);
1225 
1226  statusRequest(); // Used to update wiiState - call isIRCameraEnabled() afterwards to check if it actually worked
1227 #ifdef DEBUG_USB_HOST
1228  Notify(PSTR("\r\nIR Initialized"), 0x80);
1229 #endif
1230 }
1231 
1232 void WII::enableIRCamera1() {
1233  uint8_t cmd_buf[3];
1234  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
1235  cmd_buf[1] = 0x13; // Output report 13
1236  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Keep the rumble bit and sets bit 2
1237  HID_Command(cmd_buf, 3);
1238 }
1239 
1240 void WII::enableIRCamera2() {
1241  uint8_t cmd_buf[3];
1242  cmd_buf[0] = 0xA2; // HID BT DATA_request (0xA0) | Report Type (Output 0x02)
1243  cmd_buf[1] = 0x1A; // Output report 1A
1244  cmd_buf[2] = 0x04 | (HIDBuffer[2] & 0x01); // Keep the rumble bit and sets bit 2
1245  HID_Command(cmd_buf, 3);
1246 }
1247 
1248 void WII::writeSensitivityBlock1() {
1249  uint8_t buf[9];
1250  buf[0] = 0x00;
1251  buf[1] = 0x00;
1252  buf[2] = 0x00;
1253  buf[3] = 0x00;
1254  buf[4] = 0x00;
1255  buf[5] = 0x00;
1256  buf[6] = 0x90;
1257  buf[7] = 0x00;
1258  buf[8] = 0x41;
1259 
1260  writeData(0xB00000, 9, buf);
1261 }
1262 
1263 void WII::writeSensitivityBlock2() {
1264  uint8_t buf[2];
1265  buf[0] = 0x40;
1266  buf[1] = 0x00;
1267 
1268  writeData(0xB0001A, 2, buf);
1269 }
1270 
1271 void WII::write0x08Value() {
1272  uint8_t cmd = 0x08;
1273  writeData(0xb00030, 1, &cmd);
1274 }
1275 
1276 void WII::setWiiModeNumber(uint8_t mode_number) { // mode_number in hex i.e. 0x03 for extended mode
1277  writeData(0xb00033, 1, &mode_number);
1278 }
1279 #endif
bool wiimoteConnected
Definition: Wii.h:191
+
#define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE
Definition: BTD.h:140
+
bool incomingWii
Definition: BTD.h:474
+
void onInit()
Definition: Wii.cpp:1139
+
int16_t gyroPitchRaw
Definition: Wii.h:265
-
#define pgm_read_dword(addr)
+
#define pgm_read_dword(addr)
#define wii_clear_flag(flag)
Definition: Wii.h:33
-
#define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS
Definition: BTD.h:141
-
#define L2CAP_INTERRUPT_CONFIG_REQUEST
Definition: BTD.h:113
-
#define L2CAP_INTERRUPT_SETUP
Definition: BTD.h:111
+
#define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS
Definition: BTD.h:144
+
#define L2CAP_INTERRUPT_CONFIG_REQUEST
Definition: BTD.h:116
+
#define L2CAP_INTERRUPT_SETUP
Definition: BTD.h:114
uint16_t rollGyroScale
Definition: Wii.h:257
-
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1262
-
#define SUCCESSFUL
Definition: BTD.h:175
-
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
Definition: BTD.cpp:1249
-
#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST
Definition: BTD.h:140
-
void setLedToggle(LEDEnum a)
Definition: Wii.cpp:942
-
void setLedRaw(uint8_t value)
Definition: Wii.cpp:920
-
uint8_t getAnalogHat(HatEnum a)
Definition: Wii.cpp:1104
+
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
Definition: BTD.cpp:1260
+
#define SUCCESSFUL
Definition: BTD.h:178
+
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
Definition: BTD.cpp:1247
+
#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST
Definition: BTD.h:143
+
void setLedToggle(LEDEnum a)
Definition: Wii.cpp:949
+
void setLedRaw(uint8_t value)
Definition: Wii.cpp:927
+
uint8_t getAnalogHat(HatEnum a)
Definition: Wii.cpp:1115
uint16_t yawGyroScale
Definition: Wii.h:258
Definition: Wii.h:40
-
Definition: BTD.h:198
+
Definition: BTD.h:201
#define WII_FLAG_NUNCHUCK_CONNECTED
Definition: Wii.h:28
-
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1315
+
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1313
void ACLData(uint8_t *ACLData)
Definition: Wii.cpp:133
-
bool pairWithWii
Definition: BTD.h:473
-
uint8_t identifier
Definition: BTD.h:617
+
bool pairWithWii
Definition: BTD.h:476
+
uint8_t identifier
Definition: BTD.h:621
float pitchGyroSpeed
Definition: Wii.h:249
-
void setRumbleOn()
Definition: Wii.cpp:908
+
void setRumbleOn()
Definition: Wii.cpp:915
void Reset()
Definition: Wii.cpp:101
-
AnalogHatEnum
-
#define TURN_ON_LED
Definition: BTD.h:127
+
AnalogHatEnum
+
#define TURN_ON_LED
Definition: BTD.h:130
int16_t accZnunchuck
Definition: Wii.h:236
Definition: Wii.h:48
-
uint8_t getBatteryLevel()
Definition: Wii.cpp:961
+
uint8_t getBatteryLevel()
Definition: Wii.cpp:968
void disconnect()
Definition: Wii.cpp:116
-
bool motionPlusInside
Definition: BTD.h:475
-
#define L2CAP_DONE
Definition: BTD.h:102
+
bool motionPlusInside
Definition: BTD.h:478
+
#define L2CAP_DONE
Definition: BTD.h:105
#define wii_set_flag(flag)
Definition: Wii.h:32
-
#define L2CAP_CONTROL_SUCCESS
Definition: BTD.h:107
-
#define L2CAP_WAIT
Definition: BTD.h:101
+
#define L2CAP_CONTROL_SUCCESS
Definition: BTD.h:110
+
#define L2CAP_WAIT
Definition: BTD.h:104
Definition: Wii.h:47
int16_t accXnunchuck
Definition: Wii.h:236
-
#define pgm_read_byte(addr)
-
#define L2CAP_CONTROL_CONFIG_REQUEST
Definition: BTD.h:106
+
#define pgm_read_byte(addr)
+
#define L2CAP_CONTROL_CONFIG_REQUEST
Definition: BTD.h:109
int16_t gyroRollRaw
Definition: Wii.h:264
-
LEDEnum
+
LEDEnum
-
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1328
-
void IRinitialize()
Definition: Wii.cpp:1162
+
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
Definition: BTD.cpp:1326
+
void IRinitialize()
Definition: Wii.cpp:1173
Definition: Wii.h:38
-
#define Notify(...)
Definition: message.h:44
-
void setRumbleToggle()
Definition: Wii.cpp:914
+
#define Notify(...)
Definition: message.h:51
+
void setRumbleToggle()
Definition: Wii.cpp:921
int16_t gyroPitchZero
Definition: Wii.h:272
uint16_t pitchGyroScale
Definition: Wii.h:256
-
#define L2CAP_CONTROL_CONNECT_REQUEST
Definition: BTD.h:105
-
#define HID_CTRL_PSM
Definition: BTD.h:180
+
#define L2CAP_CONTROL_CONNECT_REQUEST
Definition: BTD.h:108
+
#define HID_CTRL_PSM
Definition: BTD.h:183
WII(BTD *p, bool pair=false)
Definition: Wii.cpp:85
-
#define WII_CHECK_EXTENSION_STATE
Definition: BTD.h:130
- +
#define WII_CHECK_EXTENSION_STATE
Definition: BTD.h:133
+
float rollGyroSpeed
Definition: Wii.h:250
-
bool connectToWii
Definition: BTD.h:467
-
bool wiiUProController
Definition: BTD.h:477
-
uint16_t hci_handle
Definition: BTD.h:451
-
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1173
- -
void setLedStatus()
Definition: Wii.cpp:948
-
#define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE
Definition: BTD.h:143
+
bool connectToWii
Definition: BTD.h:470
+
bool wiiUProController
Definition: BTD.h:480
+
uint16_t hci_handle
Definition: BTD.h:454
+
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1171
+ +
void setLedStatus()
Definition: Wii.cpp:955
+
#define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE
Definition: BTD.h:146
BalanceBoardEnum
Definition: Wii.h:44
#define WII_FLAG_MOTION_PLUS_CONNECTED
Definition: Wii.h:27
const uint8_t WII_LEDS[]
Definition: Wii.cpp:25
-
ButtonEnum
-
bool getButtonClick(ButtonEnum b)
Definition: Wii.cpp:1093
+
ButtonEnum
+
bool getButtonClick(ButtonEnum b)
Definition: Wii.cpp:1104
int16_t accYwiimote
Definition: Wii.h:230
bool wiiUProControllerConnected
Definition: Wii.h:202
-
void(* pFuncOnInit)(void)
Definition: BTD.h:605
- +
void(* pFuncOnInit)(void)
Definition: BTD.h:609
+
#define WII_FLAG_CALIBRATE_BALANCE_BOARD
Definition: Wii.h:29
-
#define l2cap_check_flag(flag)
Definition: BTD.h:158
-
void setRumbleOff()
Definition: Wii.cpp:902
+
#define l2cap_check_flag(flag)
Definition: BTD.h:161
+
void setRumbleOff()
Definition: Wii.cpp:909
bool wiiBalanceBoardConnected
Definition: Wii.h:204
-
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:166
-
#define L2CAP_FLAG_CONTROL_CONNECTED
Definition: BTD.h:136
-
#define PSTR(str)
-
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:168
+
#define L2CAP_CMD_CONFIG_REQUEST
Definition: BTD.h:169
+
#define L2CAP_FLAG_CONTROL_CONNECTED
Definition: BTD.h:139
+
#define PSTR(str)
+
#define L2CAP_CMD_DISCONNECT_REQUEST
Definition: BTD.h:171
float gyroRoll
Definition: Wii.h:243
-
void setAllOff()
Definition: Wii.cpp:896
-
#define L2CAP_CONTROL_DISCONNECT
Definition: BTD.h:108
+
void setAllOff()
Definition: Wii.cpp:903
+
#define L2CAP_CONTROL_DISCONNECT
Definition: BTD.h:111
const uint32_t WII_BUTTONS[]
Definition: Wii.cpp:40
-
#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST
Definition: BTD.h:134
+
#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST
Definition: BTD.h:137
void setLedOff()
Definition: Wii.h:152
float getWiimoteRoll()
Definition: Wii.h:216
-
#define WII_CHECK_MOTION_PLUS_STATE
Definition: BTD.h:129
-
BTD * pBtd
Definition: BTD.h:608
-
#define HID_INTR_PSM
Definition: BTD.h:181
+
#define WII_CHECK_MOTION_PLUS_STATE
Definition: BTD.h:132
+
BTD * pBtd
Definition: BTD.h:612
+
#define HID_INTR_PSM
Definition: BTD.h:184
bool nunchuckConnected
Definition: Wii.h:198
- -
bool l2capConnectionClaimed
Definition: BTD.h:437
+ +
bool l2capConnectionClaimed
Definition: BTD.h:440
float gyroPitch
Definition: Wii.h:241
Definition: Wii.h:45
int16_t gyroYawRaw
Definition: Wii.h:263
@@ -195,48 +175,48 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
bool isIRCameraEnabled()
Definition: Wii.h:408
const uint32_t WII_PROCONTROLLER_BUTTONS[]
Definition: Wii.cpp:59
float yawGyroSpeed
Definition: Wii.h:251
-
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:169
-
#define L2CAP_CMD_CONNECTION_RESPONSE
Definition: BTD.h:165
-
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:167
+
#define L2CAP_CMD_DISCONNECT_RESPONSE
Definition: BTD.h:172
+
#define L2CAP_CMD_CONNECTION_RESPONSE
Definition: BTD.h:168
+
#define L2CAP_CMD_CONFIG_RESPONSE
Definition: BTD.h:170
void pair(void)
Definition: Wii.h:89
-
uint16_t hci_handle
Definition: BTD.h:611
-
void setLedOn(LEDEnum a)
Definition: Wii.cpp:932
+
uint16_t hci_handle
Definition: BTD.h:615
+
void setLedOn(LEDEnum a)
Definition: Wii.cpp:939
HatEnum
Definition: Wii.h:36
int16_t accYnunchuck
Definition: Wii.h:236
int16_t gyroYawZero
Definition: Wii.h:270
-
uint32_t l2cap_event_flag
Definition: BTD.h:614
+
uint32_t l2cap_event_flag
Definition: BTD.h:618
#define wii_check_flag(flag)
Definition: Wii.h:31
Definition: Wii.h:46
-
#define WII_INIT_MOTION_PLUS_STATE
Definition: BTD.h:131
-
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1221
-
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1296
-
#define PENDING
Definition: BTD.h:174
-
#define L2CAP_FLAG_INTERRUPT_CONNECTED
Definition: BTD.h:142
-
#define l2cap_set_flag(flag)
Definition: BTD.h:159
-
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1279
- -
bool getButtonPress(ButtonEnum b)
Definition: Wii.cpp:1086
-
#define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS
Definition: BTD.h:135
- -
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:164
+
#define WII_INIT_MOTION_PLUS_STATE
Definition: BTD.h:134
+
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
Definition: BTD.cpp:1219
+
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
Definition: BTD.cpp:1294
+
#define PENDING
Definition: BTD.h:177
+
#define L2CAP_FLAG_INTERRUPT_CONNECTED
Definition: BTD.h:145
+
#define l2cap_set_flag(flag)
Definition: BTD.h:162
+
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
Definition: BTD.cpp:1277
+ +
bool getButtonPress(ButtonEnum b)
Definition: Wii.cpp:1097
+
#define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS
Definition: BTD.h:138
+ +
#define L2CAP_CMD_CONNECTION_REQUEST
Definition: BTD.h:167
float getWiimotePitch()
Definition: Wii.h:212
bool motionPlusConnected
Definition: Wii.h:200
int16_t gyroRollZero
Definition: Wii.h:271
-
float getTotalWeight()
Definition: Wii.cpp:1152
-
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:600
-
#define L2CAP_INTERRUPT_CONNECT_REQUEST
Definition: BTD.h:112
-
void Run()
Definition: Wii.cpp:718
-
#define L2CAP_INTERRUPT_DISCONNECT
Definition: BTD.h:114
+
float getTotalWeight()
Definition: Wii.cpp:1163
+
bool checkHciHandle(uint8_t *buf, uint16_t handle)
Definition: BTD.h:604
+
#define L2CAP_INTERRUPT_CONNECT_REQUEST
Definition: BTD.h:115
+
void Run()
Definition: Wii.cpp:725
+
#define L2CAP_INTERRUPT_DISCONNECT
Definition: BTD.h:117
int16_t accXwiimote
Definition: Wii.h:230
-
float getWeight(BalanceBoardEnum pos)
Definition: Wii.cpp:1139
+
float getWeight(BalanceBoardEnum pos)
Definition: Wii.cpp:1150
int16_t accZwiimote
Definition: Wii.h:230
-
#define L2CAP_CMD_COMMAND_REJECT
Definition: BTD.h:163
+
#define L2CAP_CMD_COMMAND_REJECT
Definition: BTD.h:166
diff --git a/_wii_8h.html b/_wii_8h.html index b1ea30d6..7d33fab2 100644 --- a/_wii_8h.html +++ b/_wii_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Wii.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ WII_FLAG_MOTION_PLUS_CONNECTED

+
@@ -163,11 +145,13 @@ Enumerations
-

Definition at line 27 of file Wii.h.

+

Definition at line 27 of file Wii.h.

- + +

◆ WII_FLAG_NUNCHUCK_CONNECTED

+
@@ -177,11 +161,13 @@ Enumerations
-

Definition at line 28 of file Wii.h.

+

Definition at line 28 of file Wii.h.

- + +

◆ WII_FLAG_CALIBRATE_BALANCE_BOARD

+
@@ -191,11 +177,13 @@ Enumerations
-

Definition at line 29 of file Wii.h.

+

Definition at line 29 of file Wii.h.

- + +

◆ wii_check_flag

+
@@ -209,11 +197,13 @@ Enumerations
-

Definition at line 31 of file Wii.h.

+

Definition at line 31 of file Wii.h.

- + +

◆ wii_set_flag

+
@@ -227,11 +217,13 @@ Enumerations
-

Definition at line 32 of file Wii.h.

+

Definition at line 32 of file Wii.h.

- + +

◆ wii_clear_flag

+
@@ -245,12 +237,14 @@ Enumerations
-

Definition at line 33 of file Wii.h.

+

Definition at line 33 of file Wii.h.

Enumeration Type Documentation

- + +

◆ HatEnum

+
@@ -261,19 +255,19 @@ Enumerations

Enum used to read the joystick on the Nunchuck.

- -
Enumerator
HatX  -

Read the x-axis on the Nunchuck joystick.

+
Enumerator
HatX 

Read the x-axis on the Nunchuck joystick.

HatY  -

Read the y-axis on the Nunchuck joystick.

+
HatY 

Read the y-axis on the Nunchuck joystick.

-

Definition at line 36 of file Wii.h.

+

Definition at line 36 of file Wii.h.

- + +

◆ BalanceBoardEnum

+
@@ -284,17 +278,13 @@ Enumerations

Enum used to read the weight on Wii Balance Board.

- - - - + + + +
Enumerator
TopRight  -
BotRight  -
TopLeft  -
BotLeft  -
Enumerator
TopRight 
BotRight 
TopLeft 
BotLeft 
-

Definition at line 44 of file Wii.h.

+

Definition at line 44 of file Wii.h.

@@ -303,7 +293,7 @@ Enumerations diff --git a/_wii_8h__dep__incl.md5 b/_wii_8h__dep__incl.md5 index 141f0cf4..0f042ba6 100644 --- a/_wii_8h__dep__incl.md5 +++ b/_wii_8h__dep__incl.md5 @@ -1 +1 @@ -68e486939ecaf1de2be16bf264fe38d3 \ No newline at end of file +cd6696ab2d85cd1fa739c986e5b9679c \ No newline at end of file diff --git a/_wii_8h__dep__incl.png b/_wii_8h__dep__incl.png index f66dbfa2..b6f6e0ba 100644 Binary files a/_wii_8h__dep__incl.png and b/_wii_8h__dep__incl.png differ diff --git a/_wii_8h__incl.md5 b/_wii_8h__incl.md5 index 6bc35bec..b796d868 100644 --- a/_wii_8h__incl.md5 +++ b/_wii_8h__incl.md5 @@ -1 +1 @@ -a8d2a81727ce46fe1f181ac702c5895a \ No newline at end of file +bc8787b4f0a06d996d94818acf6bfe3a \ No newline at end of file diff --git a/_wii_8h__incl.png b/_wii_8h__incl.png index 0e31702c..927adb78 100644 Binary files a/_wii_8h__incl.png and b/_wii_8h__incl.png differ diff --git a/_wii_8h_source.html b/_wii_8h_source.html index 00a15daf..6d82c4aa 100644 --- a/_wii_8h_source.html +++ b/_wii_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Wii.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16 
17  IR camera support added by Allan Glover (adglover9.81@gmail.com) and Kristian Lauszus
18  */
19 
20 #ifndef _wii_h_
21 #define _wii_h_
22 
23 #include "BTD.h"
24 #include "controllerEnums.h"
25 
26 /* Wii event flags */
27 #define WII_FLAG_MOTION_PLUS_CONNECTED (1 << 0)
28 #define WII_FLAG_NUNCHUCK_CONNECTED (1 << 1)
29 #define WII_FLAG_CALIBRATE_BALANCE_BOARD (1 << 2)
30 
31 #define wii_check_flag(flag) (wii_event_flag & (flag))
32 #define wii_set_flag(flag) (wii_event_flag |= (flag))
33 #define wii_clear_flag(flag) (wii_event_flag &= ~(flag))
34 
36 enum HatEnum {
38  HatX = 0,
40  HatY = 1,
41 };
42 
45  TopRight = 0,
46  BotRight = 1,
47  TopLeft = 2,
48  BotLeft = 3,
49 };
50 
56 class WII : public BluetoothService {
57 public:
64  WII(BTD *p, bool pair = false);
65 
68  void disconnect();
82  bool getButtonPress(ButtonEnum b);
83  bool getButtonClick(ButtonEnum b);
89  void pair(void) {
90  if(pBtd)
92  };
98  uint8_t getAnalogHat(HatEnum a);
104  uint16_t getAnalogHat(AnalogHatEnum a);
105 
110  float getPitch() {
112  return compPitch;
113  return getWiimotePitch();
114  };
115 
120  float getRoll() {
122  return compRoll;
123  return getWiimoteRoll();
124  };
125 
132  float getYaw() {
133  return gyroYaw;
134  };
135 
137  void setAllOff();
139  void setRumbleOff();
141  void setRumbleOn();
143  void setRumbleToggle();
144 
149  void setLedRaw(uint8_t value);
150 
152  void setLedOff() {
153  setLedRaw(0);
154  };
159  void setLedOff(LEDEnum a);
164  void setLedOn(LEDEnum a);
169  void setLedToggle(LEDEnum a);
177  void setLedStatus();
178 
183  uint8_t getBatteryLevel();
184 
189  uint8_t getWiiState() {
190  return wiiState;
191  };
196  bool wiimoteConnected;
207  /* IMU Data, might be usefull if you need to do something more advanced than just calculating the angle */
208 
212  float getWiimotePitch() {
213  return (atan2f(accYwiimote, accZwiimote) + PI) * RAD_TO_DEG;
214  };
215 
216  float getWiimoteRoll() {
217  return (atan2f(accXwiimote, accZwiimote) + PI) * RAD_TO_DEG;
218  };
225  return (atan2f(accYnunchuck, accZnunchuck) + PI) * RAD_TO_DEG;
226  };
227 
228  float getNunchuckRoll() {
229  return (atan2f(accXnunchuck, accZnunchuck) + PI) * RAD_TO_DEG;
230  };
239  /* Variables for the gyro inside the Motion Plus */
241  float gyroPitch;
243  float gyroRoll;
245  float gyroYaw;
246 
256  uint16_t pitchGyroScale;
257  uint16_t rollGyroScale;
258  uint16_t yawGyroScale;
263  int16_t gyroYawRaw;
264  int16_t gyroRollRaw;
265  int16_t gyroPitchRaw;
270  int16_t gyroYawZero;
271  int16_t gyroRollZero;
272  int16_t gyroPitchZero;
282  float getWeight(BalanceBoardEnum pos);
283 
288  float getTotalWeight();
289 
296  return wiiBalanceBoardRaw[pos];
297  };
300 #ifdef WIICAMERA
301 
305  void IRinitialize();
306 
311  uint16_t getIRx1() {
312  return IR_object_x1;
313  };
314 
319  uint16_t getIRy1() {
320  return IR_object_y1;
321  };
322 
327  uint8_t getIRs1() {
328  return IR_object_s1;
329  };
330 
335  uint16_t getIRx2() {
336  return IR_object_x2;
337  };
338 
343  uint16_t getIRy2() {
344  return IR_object_y2;
345  };
346 
351  uint8_t getIRs2() {
352  return IR_object_s2;
353  };
354 
359  uint16_t getIRx3() {
360  return IR_object_x3;
361  };
362 
367  uint16_t getIRy3() {
368  return IR_object_y3;
369  };
370 
375  uint8_t getIRs3() {
376  return IR_object_s3;
377  };
378 
383  uint16_t getIRx4() {
384  return IR_object_x4;
385  };
386 
391  uint16_t getIRy4() {
392  return IR_object_y4;
393  };
394 
399  uint8_t getIRs4() {
400  return IR_object_s4;
401  };
402 
409  return (wiiState & 0x08);
410  };
412 #endif
413 
414 protected:
420  void ACLData(uint8_t* ACLData);
422  void Run();
424  void Reset();
430  void onInit();
433 private:
434 
435  void L2CAP_task(); // L2CAP state machine
436 
437  /* Variables filled from HCI event management */
438  bool activeConnection; // Used to indicate if it's already has established a connection
439 
440  /* Variables used by high level L2CAP task */
441  uint8_t l2cap_state;
442  uint8_t wii_event_flag; // Used for Wii flags
443 
444  uint32_t ButtonState;
445  uint32_t OldButtonState;
446  uint32_t ButtonClickState;
447  uint16_t hatValues[4];
448 
449  uint8_t HIDBuffer[3]; // Used to store HID commands
450 
451  uint16_t stateCounter;
452  bool unknownExtensionConnected;
453  bool extensionConnected;
454  bool checkBatteryLevel; // Set to true when getBatteryLevel() is called otherwise if should be false
455  bool motionPlusInside; // True if it's a new Wiimote with the Motion Plus extension build into it
456 
457  /* L2CAP Channels */
458  uint8_t control_scid[2]; // L2CAP source CID for HID_Control
459  uint8_t control_dcid[2]; // 0x0060
460  uint8_t interrupt_scid[2]; // L2CAP source CID for HID_Interrupt
461  uint8_t interrupt_dcid[2]; // 0x0061
462 
463  /* HID Commands */
464  void HID_Command(uint8_t* data, uint8_t nbytes);
465  void setReportMode(bool continuous, uint8_t mode);
466 
467  void writeData(uint32_t offset, uint8_t size, uint8_t* data);
468  void initExtension1();
469  void initExtension2();
470 
471  void statusRequest(); // Used to update the Wiimote state and battery level
472 
473  void readData(uint32_t offset, uint16_t size, bool EEPROM);
474  void readExtensionType();
475  void readCalData();
476  void readWiiBalanceBoardCalibration(); // Used by the library to read the Wii Balance Board calibration values
477 
478  void checkMotionPresent(); // Used to see if a Motion Plus is connected to the Wiimote
479  void initMotionPlus();
480  void activateMotionPlus();
481 
482  uint16_t wiiBalanceBoardRaw[4]; // Wii Balance Board raw values
483  uint16_t wiiBalanceBoardCal[3][4]; // Wii Balance Board calibration values
484 
485  float compPitch; // Fusioned angle using a complimentary filter if the Motion Plus is connected
486  float compRoll; // Fusioned angle using a complimentary filter if the Motion Plus is connected
487 
488  bool activateNunchuck;
489  bool motionValuesReset; // This bool is true when the gyro values has been reset
490  uint32_t timer;
491 
492  uint8_t wiiState; // Stores the value in l2capinbuf[12] - (0x01: Battery is nearly empty), (0x02: An Extension Controller is connected), (0x04: Speaker enabled), (0x08: IR enabled), (0x10: LED1, 0x20: LED2, 0x40: LED3, 0x80: LED4)
493  uint8_t batteryLevel;
494 
495 #ifdef WIICAMERA
496  /* Private function and variables for the readings from the IR Camera */
497  void enableIRCamera1(); // Sets bit 2 of output report 13
498  void enableIRCamera2(); // Sets bit 2 of output report 1A
499  void writeSensitivityBlock1();
500  void writeSensitivityBlock2();
501  void write0x08Value();
502  void setWiiModeNumber(uint8_t mode_number);
503 
504  uint16_t IR_object_x1; // IR x position 10 bits
505  uint16_t IR_object_y1; // IR y position 10 bits
506  uint8_t IR_object_s1; // IR size value
507  uint16_t IR_object_x2;
508  uint16_t IR_object_y2;
509  uint8_t IR_object_s2;
510  uint16_t IR_object_x3; // IR x position 10 bits
511  uint16_t IR_object_y3; // IR y position 10 bits
512  uint8_t IR_object_s3; // IR size value
513  uint16_t IR_object_x4;
514  uint16_t IR_object_y4;
515  uint8_t IR_object_s4;
516 #endif
517 };
518 #endif
bool wiimoteConnected
Definition: Wii.h:191
-
void onInit()
Definition: Wii.cpp:1128
+
void onInit()
Definition: Wii.cpp:1139
int16_t gyroPitchRaw
Definition: Wii.h:265
uint16_t rollGyroScale
Definition: Wii.h:257
-
void setLedToggle(LEDEnum a)
Definition: Wii.cpp:942
-
void setLedRaw(uint8_t value)
Definition: Wii.cpp:920
-
uint8_t getAnalogHat(HatEnum a)
Definition: Wii.cpp:1104
+
void setLedToggle(LEDEnum a)
Definition: Wii.cpp:949
+
void setLedRaw(uint8_t value)
Definition: Wii.cpp:927
+
uint8_t getAnalogHat(HatEnum a)
Definition: Wii.cpp:1115
uint16_t yawGyroScale
Definition: Wii.h:258
Definition: Wii.h:40
-
Definition: BTD.h:198
+
Definition: BTD.h:201
uint8_t getIRs1()
Definition: Wii.h:327
uint8_t getIRs3()
Definition: Wii.h:375
void ACLData(uint8_t *ACLData)
Definition: Wii.cpp:133
uint16_t getIRx4()
Definition: Wii.h:383
float pitchGyroSpeed
Definition: Wii.h:249
-
void setRumbleOn()
Definition: Wii.cpp:908
+
void setRumbleOn()
Definition: Wii.cpp:915
void Reset()
Definition: Wii.cpp:101
-
AnalogHatEnum
+
AnalogHatEnum
int16_t accZnunchuck
Definition: Wii.h:236
Definition: Wii.h:48
-
uint8_t getBatteryLevel()
Definition: Wii.cpp:961
+
uint8_t getBatteryLevel()
Definition: Wii.cpp:968
void disconnect()
Definition: Wii.cpp:116
Definition: Wii.h:47
int16_t accXnunchuck
Definition: Wii.h:236
uint8_t getWiiState()
Definition: Wii.h:189
uint16_t getIRy2()
Definition: Wii.h:343
int16_t gyroRollRaw
Definition: Wii.h:264
-
LEDEnum
-
void IRinitialize()
Definition: Wii.cpp:1162
+
LEDEnum
+
void IRinitialize()
Definition: Wii.cpp:1173
Definition: Wii.h:38
uint16_t getIRx2()
Definition: Wii.h:335
uint16_t getIRx1()
Definition: Wii.h:311
-
void setRumbleToggle()
Definition: Wii.cpp:914
+
void setRumbleToggle()
Definition: Wii.cpp:921
int16_t gyroPitchZero
Definition: Wii.h:272
uint16_t pitchGyroScale
Definition: Wii.h:256
float getPitch()
Definition: Wii.h:110
@@ -132,23 +112,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
uint8_t getIRs4()
Definition: Wii.h:399
float rollGyroSpeed
Definition: Wii.h:250
uint16_t getIRy3()
Definition: Wii.h:367
- -
void setLedStatus()
Definition: Wii.cpp:948
+ +
void setLedStatus()
Definition: Wii.cpp:955
BalanceBoardEnum
Definition: Wii.h:44
-
ButtonEnum
-
bool getButtonClick(ButtonEnum b)
Definition: Wii.cpp:1093
+
ButtonEnum
+
bool getButtonClick(ButtonEnum b)
Definition: Wii.cpp:1104
int16_t accYwiimote
Definition: Wii.h:230
bool wiiUProControllerConnected
Definition: Wii.h:202
float getYaw()
Definition: Wii.h:132
-
void setRumbleOff()
Definition: Wii.cpp:902
+
void setRumbleOff()
Definition: Wii.cpp:909
bool wiiBalanceBoardConnected
Definition: Wii.h:204
float gyroRoll
Definition: Wii.h:243
-
void setAllOff()
Definition: Wii.cpp:896
+
void setAllOff()
Definition: Wii.cpp:903
void setLedOff()
Definition: Wii.h:152
float getWiimoteRoll()
Definition: Wii.h:216
uint16_t getIRy1()
Definition: Wii.h:319
uint16_t getIRx3()
Definition: Wii.h:359
-
BTD * pBtd
Definition: BTD.h:608
+
BTD * pBtd
Definition: BTD.h:612
bool nunchuckConnected
Definition: Wii.h:198
uint16_t getIRy4()
Definition: Wii.h:391
float gyroPitch
Definition: Wii.h:241
@@ -158,33 +138,33 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
bool isIRCameraEnabled()
Definition: Wii.h:408
float yawGyroSpeed
Definition: Wii.h:251
void pair(void)
Definition: Wii.h:89
-
void setLedOn(LEDEnum a)
Definition: Wii.cpp:932
+
void setLedOn(LEDEnum a)
Definition: Wii.cpp:939
uint16_t getWeightRaw(BalanceBoardEnum pos)
Definition: Wii.h:295
float getRoll()
Definition: Wii.h:120
HatEnum
Definition: Wii.h:36
int16_t accYnunchuck
Definition: Wii.h:236
int16_t gyroYawZero
Definition: Wii.h:270
Definition: Wii.h:46
-
void pairWithWiimote()
Definition: BTD.h:464
+
void pairWithWiimote()
Definition: BTD.h:467
uint8_t getIRs2()
Definition: Wii.h:351
Definition: Wii.h:56
-
bool getButtonPress(ButtonEnum b)
Definition: Wii.cpp:1086
+
bool getButtonPress(ButtonEnum b)
Definition: Wii.cpp:1097
float getWiimotePitch()
Definition: Wii.h:212
bool motionPlusConnected
Definition: Wii.h:200
int16_t gyroRollZero
Definition: Wii.h:271
-
float getTotalWeight()
Definition: Wii.cpp:1152
+
float getTotalWeight()
Definition: Wii.cpp:1163
float getNunchuckRoll()
Definition: Wii.h:228
-
void Run()
Definition: Wii.cpp:718
+
void Run()
Definition: Wii.cpp:725
int16_t accXwiimote
Definition: Wii.h:230
-
float getWeight(BalanceBoardEnum pos)
Definition: Wii.cpp:1139
+
float getWeight(BalanceBoardEnum pos)
Definition: Wii.cpp:1150
int16_t accZwiimote
Definition: Wii.h:230
diff --git a/_wii_camera_readme_8md.html b/_wii_camera_readme_8md.html index ff934b29..2475f815 100644 --- a/_wii_camera_readme_8md.html +++ b/_wii_camera_readme_8md.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: WiiCameraReadme.md File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + + - + - - + + + + - + - - + + + +
 

Variable Documentation

- + +

◆ XBOXOLD_BUTTONS

+
@@ -125,7 +107,7 @@ Variables
Initial value:
= {
0x01,
0x08,
0x02,
0x04,
0x20,
0x10,
0x40,
0x80,
4,
5,
6,
7,
1,
0,
2,
3,
}

Buttons on the controllers

-

Definition at line 24 of file XBOXOLD.cpp.

+

Definition at line 24 of file XBOXOLD.cpp.

@@ -134,7 +116,7 @@ Variables diff --git a/_x_b_o_x_o_l_d_8cpp__incl.md5 b/_x_b_o_x_o_l_d_8cpp__incl.md5 index 4e66fc26..bc962cd7 100644 --- a/_x_b_o_x_o_l_d_8cpp__incl.md5 +++ b/_x_b_o_x_o_l_d_8cpp__incl.md5 @@ -1 +1 @@ -6e170bd84842a4541b9931c43ed0f42c \ No newline at end of file +d14013d39d687e63de1d15795f5252c3 \ No newline at end of file diff --git a/_x_b_o_x_o_l_d_8cpp__incl.png b/_x_b_o_x_o_l_d_8cpp__incl.png index 35ad0934..1d628393 100644 Binary files a/_x_b_o_x_o_l_d_8cpp__incl.png and b/_x_b_o_x_o_l_d_8cpp__incl.png differ diff --git a/_x_b_o_x_o_l_d_8cpp_source.html b/_x_b_o_x_o_l_d_8cpp_source.html index a37cc976..83efcaee 100644 --- a/_x_b_o_x_o_l_d_8cpp_source.html +++ b/_x_b_o_x_o_l_d_8cpp_source.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: XBOXOLD.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
XBOXOLD.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "XBOXOLD.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the Xbox controller
22 
24 const uint8_t XBOXOLD_BUTTONS[] PROGMEM = {
25  0x01, // UP
26  0x08, // RIGHT
27  0x02, // DOWN
28  0x04, // LEFT
29 
30  0x20, // BACK
31  0x10, // START
32  0x40, // L3
33  0x80, // R3
34 
35  // A, B, X, Y, BLACK, WHITE, L1, and R1 are analog buttons
36  4, // BLACK
37  5, // WHTIE
38  6, // L1
39  7, // R1
40 
41  1, // B
42  0, // A
43  2, // X
44  3, // Y
45 };
46 
48 pUsb(p), // pointer to USB class instance - mandatory
49 bAddress(0), // device address - mandatory
50 bPollEnable(false) { // don't start polling before dongle is connected
51  for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
52  epInfo[i].epAddr = 0;
53  epInfo[i].maxPktSize = (i) ? 0 : 8;
54  epInfo[i].bmSndToggle = 0;
55  epInfo[i].bmRcvToggle = 0;
57  }
58 
59  if(pUsb) // register in USB subsystem
60  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
61 }
62 
63 uint8_t XBOXOLD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
64  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
65  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
66  uint8_t rcode;
67  UsbDevice *p = NULL;
68  EpInfo *oldep_ptr = NULL;
69  uint16_t PID;
70  uint16_t VID;
71 
72  // get memory address of USB device address pool
73  AddressPool &addrPool = pUsb->GetAddressPool();
74 #ifdef EXTRADEBUG
75  Notify(PSTR("\r\nXBOXUSB Init"), 0x80);
76 #endif
77  // check if address has already been assigned to an instance
78  if(bAddress) {
79 #ifdef DEBUG_USB_HOST
80  Notify(PSTR("\r\nAddress in use"), 0x80);
81 #endif
83  }
84 
85  // Get pointer to pseudo device with address 0 assigned
86  p = addrPool.GetUsbDevicePtr(0);
87 
88  if(!p) {
89 #ifdef DEBUG_USB_HOST
90  Notify(PSTR("\r\nAddress not found"), 0x80);
91 #endif
93  }
94 
95  if(!p->epinfo) {
96 #ifdef DEBUG_USB_HOST
97  Notify(PSTR("\r\nepinfo is null"), 0x80);
98 #endif
100  }
101 
102  // Save old pointer to EP_RECORD of address 0
103  oldep_ptr = p->epinfo;
104 
105  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
106  p->epinfo = epInfo;
107 
108  p->lowspeed = lowspeed;
109 
110  // Get device descriptor
111  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
112  // Restore p->epinfo
113  p->epinfo = oldep_ptr;
114 
115  if(rcode)
116  goto FailGetDevDescr;
117 
118  VID = udd->idVendor;
119  PID = udd->idProduct;
120 
121  if((VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) || (PID != XBOX_OLD_PID1 && PID != XBOX_OLD_PID2 && PID != XBOX_OLD_PID3 && PID != XBOX_OLD_PID4)) // Check if VID and PID match
122  goto FailUnknownDevice;
123 
124  // Allocate new address according to device class
125  bAddress = addrPool.AllocAddress(parent, false, port);
126 
127  if(!bAddress)
129 
130  // Extract Max Packet Size from device descriptor
131  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
132 
133  // Assign new address to the device
134  rcode = pUsb->setAddr(0, 0, bAddress);
135  if(rcode) {
136  p->lowspeed = false;
137  addrPool.FreeAddress(bAddress);
138  bAddress = 0;
139 #ifdef DEBUG_USB_HOST
140  Notify(PSTR("\r\nsetAddr: "), 0x80);
141  D_PrintHex<uint8_t > (rcode, 0x80);
142 #endif
143  return rcode;
144  }
145 #ifdef EXTRADEBUG
146  Notify(PSTR("\r\nAddr: "), 0x80);
147  D_PrintHex<uint8_t > (bAddress, 0x80);
148 #endif
149  //delay(300); // Spec says you should wait at least 200ms
150 
151  p->lowspeed = false;
152 
153  //get pointer to assigned address record
154  p = addrPool.GetUsbDevicePtr(bAddress);
155  if(!p)
157 
158  p->lowspeed = lowspeed;
159 
160  // Assign epInfo to epinfo pointer - only EP0 is known
161  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
162  if(rcode)
163  goto FailSetDevTblEntry;
164 
165  /* The application will work in reduced host mode, so we can save program and data
166  memory space. After verifying the VID we will use known values for the
167  configuration values for device, interface, endpoints and HID for the XBOX controllers */
168 
169  /* Initialize data structures for endpoints of device */
170  epInfo[ XBOX_INPUT_PIPE ].epAddr = 0x01; // XBOX report endpoint
172  epInfo[ XBOX_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
176  epInfo[ XBOX_OUTPUT_PIPE ].epAddr = 0x02; // XBOX output endpoint
178  epInfo[ XBOX_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
182 
183  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
184  if(rcode)
185  goto FailSetDevTblEntry;
186 
187  delay(200); // Give time for address change
188 
189  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
190  if(rcode)
191  goto FailSetConfDescr;
192 
193 #ifdef DEBUG_USB_HOST
194  Notify(PSTR("\r\nXbox Controller Connected\r\n"), 0x80);
195 #endif
196  if(pFuncOnInit)
197  pFuncOnInit(); // Call the user function
198  XboxConnected = true;
199  bPollEnable = true;
200  return 0; // Successful configuration
201 
202  /* Diagnostic messages */
203 FailGetDevDescr:
204 #ifdef DEBUG_USB_HOST
206  goto Fail;
207 #endif
208 
209 FailSetDevTblEntry:
210 #ifdef DEBUG_USB_HOST
212  goto Fail;
213 #endif
214 
215 FailSetConfDescr:
216 #ifdef DEBUG_USB_HOST
218 #endif
219  goto Fail;
220 
221 FailUnknownDevice:
222 #ifdef DEBUG_USB_HOST
223  NotifyFailUnknownDevice(VID, PID);
224 #endif
226 
227 Fail:
228 #ifdef DEBUG_USB_HOST
229  Notify(PSTR("\r\nXbox Init Failed, error code: "), 0x80);
230  NotifyFail(rcode);
231 #endif
232  Release();
233  return rcode;
234 }
235 
236 /* Performs a cleanup after failed Init() attempt */
237 uint8_t XBOXOLD::Release() {
238  XboxConnected = false;
240  bAddress = 0;
241  bPollEnable = false;
242  return 0;
243 }
244 
245 uint8_t XBOXOLD::Poll() {
246  if(!bPollEnable)
247  return 0;
248  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
249  pUsb->inTransfer(bAddress, epInfo[ XBOX_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
250  readReport();
251 #ifdef PRINTREPORT
252  printReport(BUFFER_SIZE); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox controller
253 #endif
254  return 0;
255 }
256 
257 void XBOXOLD::readReport() {
258  ButtonState = readBuf[2];
259 
260  for(uint8_t i = 0; i < sizeof (buttonValues); i++)
261  buttonValues[i] = readBuf[i + 4]; // A, B, X, Y, BLACK, WHITE, L1, and R1
262 
263  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[12] << 8) | readBuf[13]);
264  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[14] << 8) | readBuf[15]);
265  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[16] << 8) | readBuf[17]);
266  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[18] << 8) | readBuf[19]);
267 
268  //Notify(PSTR("\r\nButtonState"), 0x80);
269  //PrintHex<uint8_t>(ButtonState, 0x80);
270 
271  if(ButtonState != OldButtonState || memcmp(buttonValues, oldButtonValues, sizeof (buttonValues)) != 0) {
272  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
273  OldButtonState = ButtonState;
274 
275  for(uint8_t i = 0; i < sizeof (buttonValues); i++) {
276  if(oldButtonValues[i] == 0 && buttonValues[i] != 0)
277  buttonClicked[i] = true; // Update A, B, X, Y, BLACK, WHITE, L1, and R1 click state
278  oldButtonValues[i] = buttonValues[i];
279  }
280  }
281 }
282 
283 void XBOXOLD::printReport(uint16_t length) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox controller
284 #ifdef PRINTREPORT
285  if(readBuf == NULL)
286  return;
287  for(uint8_t i = 0; i < length; i++) {
288  D_PrintHex<uint8_t > (readBuf[i], 0x80);
289  Notify(PSTR(" "), 0x80);
290  }
291  Notify(PSTR("\r\n"), 0x80);
292 #endif
293 }
294 
296  uint8_t button = pgm_read_byte(&XBOXOLD_BUTTONS[(uint8_t)b]);
297  if(b == A || b == B || b == X || b == Y || b == BLACK || b == WHITE || b == L1 || b == R1) // A, B, X, Y, BLACK, WHITE, L1, and R1 are analog buttons
298  return buttonValues[button]; // Analog buttons
299  return (ButtonState & button); // Digital buttons
300 }
301 
303  uint8_t button = pgm_read_byte(&XBOXOLD_BUTTONS[(uint8_t)b]);
304  if(b == A || b == B || b == X || b == Y || b == BLACK || b == WHITE || b == L1 || b == R1) { // A, B, X, Y, BLACK, WHITE, L1, and R1 are analog buttons
305  if(buttonClicked[button]) {
306  buttonClicked[button] = false;
307  return true;
308  }
309  return false;
310  }
311 
312  bool click = (ButtonClickState & button);
313  ButtonClickState &= ~button; // clear "click" event
314  return click;
315 }
316 
318  return hatValue[a];
319 }
320 
321 /* Xbox Controller commands */
322 void XBOXOLD::XboxCommand(uint8_t* data, uint16_t nbytes) {
323  //bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x00), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)
324  pUsb->ctrlReq(bAddress, epInfo[XBOX_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);
325 }
326 
327 void XBOXOLD::setRumbleOn(uint8_t lValue, uint8_t rValue) {
328  uint8_t writeBuf[6];
329 
330  writeBuf[0] = 0x00;
331  writeBuf[1] = 0x06;
332  writeBuf[2] = 0x00;
333  writeBuf[3] = rValue; // small weight
334  writeBuf[4] = 0x00;
335  writeBuf[5] = lValue; // big weight
336 
337  XboxCommand(writeBuf, 6);
338 }
-
uint8_t bmRcvToggle
Definition: address.h:41
- - -
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
uint8_t bmNakPower
Definition: address.h:42
- +Go to the documentation of this file.
1 /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "XBOXOLD.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the Xbox controller
22 
24 const uint8_t XBOXOLD_BUTTONS[] PROGMEM = {
25  0x01, // UP
26  0x08, // RIGHT
27  0x02, // DOWN
28  0x04, // LEFT
29 
30  0x20, // BACK
31  0x10, // START
32  0x40, // L3
33  0x80, // R3
34 
35  // A, B, X, Y, BLACK, WHITE, L1, and R1 are analog buttons
36  4, // BLACK
37  5, // WHTIE
38  6, // L1
39  7, // R1
40 
41  1, // B
42  0, // A
43  2, // X
44  3, // Y
45 };
46 
48 pUsb(p), // pointer to USB class instance - mandatory
49 bAddress(0), // device address - mandatory
50 bPollEnable(false) { // don't start polling before dongle is connected
51  for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
52  epInfo[i].epAddr = 0;
53  epInfo[i].maxPktSize = (i) ? 0 : 8;
54  epInfo[i].bmSndToggle = 0;
55  epInfo[i].bmRcvToggle = 0;
57  }
58 
59  if(pUsb) // register in USB subsystem
60  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
61 }
62 
63 uint8_t XBOXOLD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
64  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
65  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
66  uint8_t rcode;
67  UsbDevice *p = NULL;
68  EpInfo *oldep_ptr = NULL;
69  uint16_t PID;
70  uint16_t VID;
71 
72  // get memory address of USB device address pool
73  AddressPool &addrPool = pUsb->GetAddressPool();
74 #ifdef EXTRADEBUG
75  Notify(PSTR("\r\nXBOXUSB Init"), 0x80);
76 #endif
77  // check if address has already been assigned to an instance
78  if(bAddress) {
79 #ifdef DEBUG_USB_HOST
80  Notify(PSTR("\r\nAddress in use"), 0x80);
81 #endif
83  }
84 
85  // Get pointer to pseudo device with address 0 assigned
86  p = addrPool.GetUsbDevicePtr(0);
87 
88  if(!p) {
89 #ifdef DEBUG_USB_HOST
90  Notify(PSTR("\r\nAddress not found"), 0x80);
91 #endif
93  }
94 
95  if(!p->epinfo) {
96 #ifdef DEBUG_USB_HOST
97  Notify(PSTR("\r\nepinfo is null"), 0x80);
98 #endif
100  }
101 
102  // Save old pointer to EP_RECORD of address 0
103  oldep_ptr = p->epinfo;
104 
105  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
106  p->epinfo = epInfo;
107 
108  p->lowspeed = lowspeed;
109 
110  // Get device descriptor
111  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
112  // Restore p->epinfo
113  p->epinfo = oldep_ptr;
114 
115  if(rcode)
116  goto FailGetDevDescr;
117 
118  VID = udd->idVendor;
119  PID = udd->idProduct;
120 
121  if((VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) || (PID != XBOX_OLD_PID1 && PID != XBOX_OLD_PID2 && PID != XBOX_OLD_PID3 && PID != XBOX_OLD_PID4)) // Check if VID and PID match
122  goto FailUnknownDevice;
123 
124  // Allocate new address according to device class
125  bAddress = addrPool.AllocAddress(parent, false, port);
126 
127  if(!bAddress)
129 
130  // Extract Max Packet Size from device descriptor
131  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
132 
133  // Assign new address to the device
134  rcode = pUsb->setAddr(0, 0, bAddress);
135  if(rcode) {
136  p->lowspeed = false;
137  addrPool.FreeAddress(bAddress);
138  bAddress = 0;
139 #ifdef DEBUG_USB_HOST
140  Notify(PSTR("\r\nsetAddr: "), 0x80);
141  D_PrintHex<uint8_t > (rcode, 0x80);
142 #endif
143  return rcode;
144  }
145 #ifdef EXTRADEBUG
146  Notify(PSTR("\r\nAddr: "), 0x80);
147  D_PrintHex<uint8_t > (bAddress, 0x80);
148 #endif
149  //delay(300); // Spec says you should wait at least 200ms
150 
151  p->lowspeed = false;
152 
153  //get pointer to assigned address record
154  p = addrPool.GetUsbDevicePtr(bAddress);
155  if(!p)
157 
158  p->lowspeed = lowspeed;
159 
160  // Assign epInfo to epinfo pointer - only EP0 is known
161  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
162  if(rcode)
163  goto FailSetDevTblEntry;
164 
165  /* The application will work in reduced host mode, so we can save program and data
166  memory space. After verifying the VID we will use known values for the
167  configuration values for device, interface, endpoints and HID for the XBOX controllers */
168 
169  /* Initialize data structures for endpoints of device */
170  epInfo[ XBOX_INPUT_PIPE ].epAddr = 0x01; // XBOX report endpoint
172  epInfo[ XBOX_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
176  epInfo[ XBOX_OUTPUT_PIPE ].epAddr = 0x02; // XBOX output endpoint
178  epInfo[ XBOX_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
182 
183  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
184  if(rcode)
185  goto FailSetDevTblEntry;
186 
187  delay(200); // Give time for address change
188 
189  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
190  if(rcode)
191  goto FailSetConfDescr;
192 
193 #ifdef DEBUG_USB_HOST
194  Notify(PSTR("\r\nXbox Controller Connected\r\n"), 0x80);
195 #endif
196  if(pFuncOnInit)
197  pFuncOnInit(); // Call the user function
198  XboxConnected = true;
199  bPollEnable = true;
200  return 0; // Successful configuration
201 
202  /* Diagnostic messages */
203 FailGetDevDescr:
204 #ifdef DEBUG_USB_HOST
206  goto Fail;
207 #endif
208 
209 FailSetDevTblEntry:
210 #ifdef DEBUG_USB_HOST
212  goto Fail;
213 #endif
214 
215 FailSetConfDescr:
216 #ifdef DEBUG_USB_HOST
218 #endif
219  goto Fail;
220 
221 FailUnknownDevice:
222 #ifdef DEBUG_USB_HOST
223  NotifyFailUnknownDevice(VID, PID);
224 #endif
226 
227 Fail:
228 #ifdef DEBUG_USB_HOST
229  Notify(PSTR("\r\nXbox Init Failed, error code: "), 0x80);
230  NotifyFail(rcode);
231 #endif
232  Release();
233  return rcode;
234 }
235 
236 /* Performs a cleanup after failed Init() attempt */
237 uint8_t XBOXOLD::Release() {
238  XboxConnected = false;
240  bAddress = 0;
241  bPollEnable = false;
242  return 0;
243 }
244 
245 uint8_t XBOXOLD::Poll() {
246  if(!bPollEnable)
247  return 0;
248  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
249  pUsb->inTransfer(bAddress, epInfo[ XBOX_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
250  readReport();
251 #ifdef PRINTREPORT
252  printReport(BUFFER_SIZE); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox controller
253 #endif
254  return 0;
255 }
256 
257 void XBOXOLD::readReport() {
258  ButtonState = readBuf[2];
259 
260  for(uint8_t i = 0; i < sizeof (buttonValues); i++)
261  buttonValues[i] = readBuf[i + 4]; // A, B, X, Y, BLACK, WHITE, L1, and R1
262 
263  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[12] << 8) | readBuf[13]);
264  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[14] << 8) | readBuf[15]);
265  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[16] << 8) | readBuf[17]);
266  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[18] << 8) | readBuf[19]);
267 
268  //Notify(PSTR("\r\nButtonState"), 0x80);
269  //PrintHex<uint8_t>(ButtonState, 0x80);
270 
271  if(ButtonState != OldButtonState || memcmp(buttonValues, oldButtonValues, sizeof (buttonValues)) != 0) {
272  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
273  OldButtonState = ButtonState;
274 
275  for(uint8_t i = 0; i < sizeof (buttonValues); i++) {
276  if(oldButtonValues[i] == 0 && buttonValues[i] != 0)
277  buttonClicked[i] = true; // Update A, B, X, Y, BLACK, WHITE, L1, and R1 click state
278  oldButtonValues[i] = buttonValues[i];
279  }
280  }
281 }
282 
283 void XBOXOLD::printReport(uint16_t length __attribute__((unused))) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox controller
284 #ifdef PRINTREPORT
285  if(readBuf == NULL)
286  return;
287  for(uint8_t i = 0; i < length; i++) {
288  D_PrintHex<uint8_t > (readBuf[i], 0x80);
289  Notify(PSTR(" "), 0x80);
290  }
291  Notify(PSTR("\r\n"), 0x80);
292 #endif
293 }
294 
296  uint8_t button = pgm_read_byte(&XBOXOLD_BUTTONS[(uint8_t)b]);
297  if(b == A || b == B || b == X || b == Y || b == BLACK || b == WHITE || b == L1 || b == R1) // A, B, X, Y, BLACK, WHITE, L1, and R1 are analog buttons
298  return buttonValues[button]; // Analog buttons
299  return (ButtonState & button); // Digital buttons
300 }
301 
303  uint8_t button = pgm_read_byte(&XBOXOLD_BUTTONS[(uint8_t)b]);
304  if(b == A || b == B || b == X || b == Y || b == BLACK || b == WHITE || b == L1 || b == R1) { // A, B, X, Y, BLACK, WHITE, L1, and R1 are analog buttons
305  if(buttonClicked[button]) {
306  buttonClicked[button] = false;
307  return true;
308  }
309  return false;
310  }
311 
312  bool click = (ButtonClickState & button);
313  ButtonClickState &= ~button; // clear "click" event
314  return click;
315 }
316 
318  return hatValue[a];
319 }
320 
321 /* Xbox Controller commands */
322 void XBOXOLD::XboxCommand(uint8_t* data, uint16_t nbytes) {
323  //bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x00), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)
324  pUsb->ctrlReq(bAddress, epInfo[XBOX_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);
325 }
326 
327 void XBOXOLD::setRumbleOn(uint8_t lValue, uint8_t rValue) {
328  uint8_t writeBuf[6];
329 
330  writeBuf[0] = 0x00;
331  writeBuf[1] = 0x06;
332  writeBuf[2] = 0x00;
333  writeBuf[3] = rValue; // small weight
334  writeBuf[4] = 0x00;
335  writeBuf[5] = lValue; // big weight
336 
337  XboxCommand(writeBuf, 6);
338 }
+
uint8_t bmRcvToggle
Definition: address.h:48
+ + +
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
uint8_t bmNakPower
Definition: address.h:49
+
uint8_t Release()
Definition: XBOXOLD.cpp:237
-
#define NotifyFail(...)
Definition: message.h:55
- -
AnalogHatEnum
- -
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
-
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:86
+
#define NotifyFail(...)
Definition: message.h:62
+ +
AnalogHatEnum
+ +
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
#define bmREQ_HID_OUT
Definition: usbhid.h:63
-
#define pgm_read_byte(addr)
+
#define pgm_read_byte(addr)
void setRumbleOn(uint8_t lValue, uint8_t rValue)
Definition: XBOXOLD.cpp:327
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
- -
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
+ +
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
#define XBOX_OLD_PID4
Definition: XBOXOLD.h:41
EpInfo epInfo[XBOX_MAX_ENDPOINTS]
Definition: XBOXOLD.h:153
#define EP_MAXPKTSIZE
Definition: PS3USB.h:26
virtual void FreeAddress(uint8_t addr)=0
-
uint8_t epAttribs
Definition: address.h:37
- -
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
+
uint8_t epAttribs
Definition: address.h:44
+ +
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
const uint8_t XBOXOLD_BUTTONS[]
Definition: XBOXOLD.cpp:24
-
#define Notify(...)
Definition: message.h:44
- -
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
- -
uint8_t epAddr
Definition: address.h:33
-
#define NotifyFailUnknownDevice(...)
Definition: message.h:54
- -
#define USB_NAK_MAX_POWER
Definition: address.h:27
+
#define Notify(...)
Definition: message.h:51
+ +
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+ +
uint8_t epAddr
Definition: address.h:40
+
#define NotifyFailUnknownDevice(...)
Definition: message.h:61
+ +
#define USB_NAK_MAX_POWER
Definition: address.h:34
int16_t getAnalogHat(AnalogHatEnum a)
Definition: XBOXOLD.cpp:317
#define XBOX_VID
Definition: XBOXOLD.h:34
#define XBOX_INPUT_PIPE
Definition: XBOXOLD.h:30
- +
XBOXOLD(USB *pUsb)
Definition: XBOXOLD.cpp:47
#define XBOX_OLD_PID1
Definition: XBOXOLD.h:38
-
Definition: address.h:32
-
ButtonEnum
+
Definition: address.h:39
+
ButtonEnum
#define JOYTECH_VID
Definition: XBOXOLD.h:36
USB * pUsb
Definition: XBOXOLD.h:149
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
+
uint8_t bmSndToggle
Definition: address.h:47
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
uint8_t Poll()
Definition: XBOXOLD.cpp:245
#define XBOX_OLD_PID2
Definition: XBOXOLD.h:39
#define MADCATZ_VID
Definition: XBOXOLD.h:35
#define XBOX_OUTPUT_PIPE
Definition: XBOXOLD.h:31
-
#define USB_NAK_NOWAIT
Definition: address.h:29
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
- -
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
+
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
+ +
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXOLD.cpp:63
#define XBOX_MAX_ENDPOINTS
Definition: XBOXOLD.h:43
#define XBOX_OLD_PID3
Definition: XBOXOLD.h:40
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
bool XboxConnected
Definition: XBOXOLD.h:141
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
Definition: UsbCore.h:197
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
Definition: UsbCore.h:208
bool getButtonClick(ButtonEnum b)
Definition: XBOXOLD.cpp:302
uint8_t getButtonPress(ButtonEnum b)
Definition: XBOXOLD.cpp:295
#define XBOX_CONTROL_PIPE
Definition: XBOXOLD.h:29
uint8_t bAddress
Definition: XBOXOLD.h:151
- - + +
#define HID_REQUEST_SET_REPORT
Definition: usbhid.h:72
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
- +
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
diff --git a/_x_b_o_x_o_l_d_8h.html b/_x_b_o_x_o_l_d_8h.html index f5540bc9..f512d7d3 100644 --- a/_x_b_o_x_o_l_d_8h.html +++ b/_x_b_o_x_o_l_d_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXOLD.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- + - +
@@ -151,7 +131,9 @@ Macros  

Macro Definition Documentation

- + +

◆ EP_MAXPKTSIZE

+
@@ -161,11 +143,13 @@ Macros
-

Definition at line 26 of file XBOXOLD.h.

+

Definition at line 26 of file XBOXOLD.h.

- + +

◆ XBOX_CONTROL_PIPE

+
@@ -175,11 +159,13 @@ Macros
-

Definition at line 29 of file XBOXOLD.h.

+

Definition at line 29 of file XBOXOLD.h.

- + +

◆ XBOX_INPUT_PIPE

+
@@ -189,11 +175,13 @@ Macros
-

Definition at line 30 of file XBOXOLD.h.

+

Definition at line 30 of file XBOXOLD.h.

- + +

◆ XBOX_OUTPUT_PIPE

+
@@ -203,11 +191,13 @@ Macros
-

Definition at line 31 of file XBOXOLD.h.

+

Definition at line 31 of file XBOXOLD.h.

- + +

◆ XBOX_VID

+
@@ -217,11 +207,13 @@ Macros
-

Definition at line 34 of file XBOXOLD.h.

+

Definition at line 34 of file XBOXOLD.h.

- + +

◆ MADCATZ_VID

+
@@ -231,11 +223,13 @@ Macros
-

Definition at line 35 of file XBOXOLD.h.

+

Definition at line 35 of file XBOXOLD.h.

- + +

◆ JOYTECH_VID

+
@@ -245,11 +239,13 @@ Macros
-

Definition at line 36 of file XBOXOLD.h.

+

Definition at line 36 of file XBOXOLD.h.

- + +

◆ XBOX_OLD_PID1

+
@@ -259,11 +255,13 @@ Macros
-

Definition at line 38 of file XBOXOLD.h.

+

Definition at line 38 of file XBOXOLD.h.

- + +

◆ XBOX_OLD_PID2

+
@@ -273,11 +271,13 @@ Macros
-

Definition at line 39 of file XBOXOLD.h.

+

Definition at line 39 of file XBOXOLD.h.

- + +

◆ XBOX_OLD_PID3

+
@@ -287,11 +287,13 @@ Macros
-

Definition at line 40 of file XBOXOLD.h.

+

Definition at line 40 of file XBOXOLD.h.

- + +

◆ XBOX_OLD_PID4

+
@@ -301,11 +303,13 @@ Macros
-

Definition at line 41 of file XBOXOLD.h.

+

Definition at line 41 of file XBOXOLD.h.

- + +

◆ XBOX_MAX_ENDPOINTS

+
@@ -315,7 +319,7 @@ Macros
-

Definition at line 43 of file XBOXOLD.h.

+

Definition at line 43 of file XBOXOLD.h.

@@ -324,7 +328,7 @@ Macros diff --git a/_x_b_o_x_o_l_d_8h__dep__incl.md5 b/_x_b_o_x_o_l_d_8h__dep__incl.md5 index cc366f2a..5636aca6 100644 --- a/_x_b_o_x_o_l_d_8h__dep__incl.md5 +++ b/_x_b_o_x_o_l_d_8h__dep__incl.md5 @@ -1 +1 @@ -82c0a98cce5027def9ffaed26c3bac43 \ No newline at end of file +40aa5e977625e2239fdc92221cc54178 \ No newline at end of file diff --git a/_x_b_o_x_o_l_d_8h__dep__incl.png b/_x_b_o_x_o_l_d_8h__dep__incl.png index fc4cb216..6db36860 100644 Binary files a/_x_b_o_x_o_l_d_8h__dep__incl.png and b/_x_b_o_x_o_l_d_8h__dep__incl.png differ diff --git a/_x_b_o_x_o_l_d_8h__incl.map b/_x_b_o_x_o_l_d_8h__incl.map index f9bea934..1f686752 100644 --- a/_x_b_o_x_o_l_d_8h__incl.map +++ b/_x_b_o_x_o_l_d_8h__incl.map @@ -1,6 +1,6 @@ - + - + diff --git a/_x_b_o_x_o_l_d_8h__incl.md5 b/_x_b_o_x_o_l_d_8h__incl.md5 index 00cfe4cd..4d76a76a 100644 --- a/_x_b_o_x_o_l_d_8h__incl.md5 +++ b/_x_b_o_x_o_l_d_8h__incl.md5 @@ -1 +1 @@ -6f0fa83f2b72b0b7a7795b417af236ee \ No newline at end of file +a5adfa0570ca84123bf5bd39bb76ff4d \ No newline at end of file diff --git a/_x_b_o_x_o_l_d_8h__incl.png b/_x_b_o_x_o_l_d_8h__incl.png index 683b12a8..f5b39a4c 100644 Binary files a/_x_b_o_x_o_l_d_8h__incl.png and b/_x_b_o_x_o_l_d_8h__incl.png differ diff --git a/_x_b_o_x_o_l_d_8h_source.html b/_x_b_o_x_o_l_d_8h_source.html index f7e9cd0c..e4d96b7b 100644 --- a/_x_b_o_x_o_l_d_8h_source.html +++ b/_x_b_o_x_o_l_d_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXOLD.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
Go to the documentation of this file.
1 /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _xboxold_h_
19 #define _xboxold_h_
20 
21 #include "Usb.h"
22 #include "usbhid.h"
23 #include "controllerEnums.h"
24 
25 /* Data Xbox taken from descriptors */
26 #define EP_MAXPKTSIZE 32 // Max size for data via USB
27 
28 /* Names we give to the 3 Xbox pipes */
29 #define XBOX_CONTROL_PIPE 0
30 #define XBOX_INPUT_PIPE 1
31 #define XBOX_OUTPUT_PIPE 2
32 
33 // PID and VID of the different devices
34 #define XBOX_VID 0x045E // Microsoft Corporation
35 #define MADCATZ_VID 0x1BAD // For unofficial Mad Catz controllers
36 #define JOYTECH_VID 0x162E // For unofficial Joytech controllers
37 
38 #define XBOX_OLD_PID1 0x0202 // Original Microsoft Xbox controller (US)
39 #define XBOX_OLD_PID2 0x0285 // Original Microsoft Xbox controller (Japan)
40 #define XBOX_OLD_PID3 0x0287 // Microsoft Microsoft Xbox Controller S
41 #define XBOX_OLD_PID4 0x0289 // Smaller Microsoft Xbox controller (US)
42 
43 #define XBOX_MAX_ENDPOINTS 3
44 
46 class XBOXOLD : public USBDeviceConfig {
47 public:
52  XBOXOLD(USB *pUsb);
53 
62  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
67  uint8_t Release();
72  uint8_t Poll();
73 
78  virtual uint8_t GetAddress() {
79  return bAddress;
80  };
81 
86  virtual bool isReady() {
87  return bPollEnable;
88  };
89 
96  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
97  return ((vid == XBOX_VID || vid == MADCATZ_VID || vid == JOYTECH_VID) && (pid == XBOX_OLD_PID1 || pid == XBOX_OLD_PID2 || pid == XBOX_OLD_PID3 || pid == XBOX_OLD_PID4));
98  };
112  uint8_t getButtonPress(ButtonEnum b);
113  bool getButtonClick(ButtonEnum b);
122  int16_t getAnalogHat(AnalogHatEnum a);
123 
125  void setRumbleOff() {
126  setRumbleOn(0, 0);
127  };
133  void setRumbleOn(uint8_t lValue, uint8_t rValue);
134 
139  void attachOnInit(void (*funcOnInit)(void)) {
140  pFuncOnInit = funcOnInit;
141  };
145  bool XboxConnected;
146 
147 protected:
151  uint8_t bAddress;
154 
155 private:
161  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
162 
163  bool bPollEnable;
164 
165  /* Variables to store the digital buttons */
166  uint8_t ButtonState;
167  uint8_t OldButtonState;
168  uint8_t ButtonClickState;
169 
170  /* Variables to store the analog buttons */
171  uint8_t buttonValues[8]; // A, B, X, Y, BLACK, WHITE, L1, and R1
172  uint8_t oldButtonValues[8];
173  bool buttonClicked[8];
174 
175  int16_t hatValue[4]; // Joystick values
176 
177  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
178 
179  void readReport(); // Read incoming data
180  void printReport(uint16_t length); // Print incoming date
181 
182  /* Private commands */
183  void XboxCommand(uint8_t* data, uint16_t nbytes);
184 };
185 #endif
uint8_t Release()
Definition: XBOXOLD.cpp:237
void attachOnInit(void(*funcOnInit)(void))
Definition: XBOXOLD.h:139
-
AnalogHatEnum
+
AnalogHatEnum
virtual uint8_t GetAddress()
Definition: XBOXOLD.h:78
- +
void setRumbleOn(uint8_t lValue, uint8_t rValue)
Definition: XBOXOLD.cpp:327
@@ -106,8 +86,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
#define XBOX_VID
Definition: XBOXOLD.h:34
XBOXOLD(USB *pUsb)
Definition: XBOXOLD.cpp:47
#define XBOX_OLD_PID1
Definition: XBOXOLD.h:38
-
Definition: address.h:32
-
ButtonEnum
+
Definition: address.h:39
+
ButtonEnum
#define JOYTECH_VID
Definition: XBOXOLD.h:36
USB * pUsb
Definition: XBOXOLD.h:149
uint8_t Poll()
Definition: XBOXOLD.cpp:245
@@ -118,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
#define XBOX_OLD_PID3
Definition: XBOXOLD.h:40
bool XboxConnected
Definition: XBOXOLD.h:141
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
bool getButtonClick(ButtonEnum b)
Definition: XBOXOLD.cpp:302
void setRumbleOff()
Definition: XBOXOLD.h:125
uint8_t getButtonPress(ButtonEnum b)
Definition: XBOXOLD.cpp:295
@@ -130,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_x_b_o_x_o_n_e_8cpp.html b/_x_b_o_x_o_n_e_8cpp.html index 536ed2fb..c9713956 100644 --- a/_x_b_o_x_o_n_e_8cpp.html +++ b/_x_b_o_x_o_n_e_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXONE.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/_x_b_o_x_o_n_e_8cpp__incl.md5 b/_x_b_o_x_o_n_e_8cpp__incl.md5 index adfce4de..561c5fc7 100644 --- a/_x_b_o_x_o_n_e_8cpp__incl.md5 +++ b/_x_b_o_x_o_n_e_8cpp__incl.md5 @@ -1 +1 @@ -a31c4a2760319c972359266d1c3ccfe5 \ No newline at end of file +4f538d4414a636d7fa50b4947c386571 \ No newline at end of file diff --git a/_x_b_o_x_o_n_e_8cpp__incl.png b/_x_b_o_x_o_n_e_8cpp__incl.png index 48da411f..2dde9b7c 100644 Binary files a/_x_b_o_x_o_n_e_8cpp__incl.png and b/_x_b_o_x_o_n_e_8cpp__incl.png differ diff --git a/_x_b_o_x_o_n_e_8cpp_source.html b/_x_b_o_x_o_n_e_8cpp_source.html index fe472067..68578996 100644 --- a/_x_b_o_x_o_n_e_8cpp_source.html +++ b/_x_b_o_x_o_n_e_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXONE.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
XBOXONE.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
2  Copyright (C) 2015 guruthree
3 
4  This software may be distributed and modified under the terms of the GNU
5  General Public License version 2 (GPL2) as published by the Free Software
6  Foundation and appearing in the file GPL2.TXT included in the packaging of
7  this file. Please note that GPL2 Section 2[b] requires that all works based
8  on this software must also be made publicly available under the terms of
9  the GPL2 ("Copyleft").
10 
11  Contact information
12  -------------------
13 
14  Kristian Lauszus, TKJ Electronics
15  Web : http://www.tkjelectronics.com
16  e-mail : kristianl@tkjelectronics.com
17 
18  guruthree
19  Web : https://github.com/guruthree/
20  */
21 
22 #include "XBOXONE.h"
23 // To enable serial debugging see "settings.h"
24 //#define EXTRADEBUG // Uncomment to get even more debugging data
25 //#define PRINTREPORT // Uncomment to print the report send by the Xbox ONE Controller
26 
28 pUsb(p), // pointer to USB class instance - mandatory
29 bAddress(0), // device address - mandatory
30 bPollEnable(false) { // don't start polling before dongle is connected
31  for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
32  epInfo[i].epAddr = 0;
33  epInfo[i].maxPktSize = (i) ? 0 : 8;
34  epInfo[i].bmSndToggle = 0;
35  epInfo[i].bmRcvToggle = 0;
37  }
38 
39  if(pUsb) // register in USB subsystem
40  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
41 }
42 
43 uint8_t XBOXONE::Init(uint8_t parent, uint8_t port, bool lowspeed) {
44  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
45  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
46  uint8_t rcode;
47  UsbDevice *p = NULL;
48  EpInfo *oldep_ptr = NULL;
49  uint16_t PID;
50  uint16_t VID;
51 
52  // get memory address of USB device address pool
53  AddressPool &addrPool = pUsb->GetAddressPool();
54 #ifdef EXTRADEBUG
55  Notify(PSTR("\r\nXBOXONE Init"), 0x80);
56 #endif
57  // check if address has already been assigned to an instance
58  if(bAddress) {
59 #ifdef DEBUG_USB_HOST
60  Notify(PSTR("\r\nAddress in use"), 0x80);
61 #endif
63  }
64 
65  // Get pointer to pseudo device with address 0 assigned
66  p = addrPool.GetUsbDevicePtr(0);
67 
68  if(!p) {
69 #ifdef DEBUG_USB_HOST
70  Notify(PSTR("\r\nAddress not found"), 0x80);
71 #endif
73  }
74 
75  if(!p->epinfo) {
76 #ifdef DEBUG_USB_HOST
77  Notify(PSTR("\r\nepinfo is null"), 0x80);
78 #endif
80  }
81 
82  // Save old pointer to EP_RECORD of address 0
83  oldep_ptr = p->epinfo;
84 
85  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
86  p->epinfo = epInfo;
87 
88  p->lowspeed = lowspeed;
89 
90  // Get device descriptor
91  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
92  // Restore p->epinfo
93  p->epinfo = oldep_ptr;
94 
95  if(rcode)
96  goto FailGetDevDescr;
97 
98  VID = udd->idVendor;
99  PID = udd->idProduct;
100 
101  if(!VIDPIDOK(VID, PID)) // Check VID
102  goto FailUnknownDevice;
103 
104  // Allocate new address according to device class
105  bAddress = addrPool.AllocAddress(parent, false, port);
106 
107  if(!bAddress)
109 
110  // Extract Max Packet Size from device descriptor
111  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
112 
113  // Assign new address to the device
114  rcode = pUsb->setAddr(0, 0, bAddress);
115  if(rcode) {
116  p->lowspeed = false;
117  addrPool.FreeAddress(bAddress);
118  bAddress = 0;
119 #ifdef DEBUG_USB_HOST
120  Notify(PSTR("\r\nsetAddr: "), 0x80);
121  D_PrintHex<uint8_t > (rcode, 0x80);
122 #endif
123  return rcode;
124  }
125 #ifdef EXTRADEBUG
126  Notify(PSTR("\r\nAddr: "), 0x80);
127  D_PrintHex<uint8_t > (bAddress, 0x80);
128 #endif
129  //delay(300); // Spec says you should wait at least 200ms
130 
131  p->lowspeed = false;
132 
133  //get pointer to assigned address record
134  p = addrPool.GetUsbDevicePtr(bAddress);
135  if(!p)
137 
138  p->lowspeed = lowspeed;
139 
140  // Assign epInfo to epinfo pointer - only EP0 is known
141  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
142  if(rcode)
143  goto FailSetDevTblEntry;
144 
145  /* The application will work in reduced host mode, so we can save program and data
146  memory space. After verifying the VID we will use known values for the
147  configuration values for device, interface, endpoints and HID for the XBOXONE Controllers */
148 
149  /* Initialize data structures for endpoints of device */
150  epInfo[ XBOX_OUTPUT_PIPE ].epAddr = 0x01; // XBOX one output endpoint
152  epInfo[ XBOX_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
156  epInfo[ XBOX_INPUT_PIPE ].epAddr = 0x01; // XBOX one input endpoint
158  epInfo[ XBOX_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
162 
163  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
164  if(rcode)
165  goto FailSetDevTblEntry;
166 
167  delay(200); // Give time for address change
168 
169  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
170  if(rcode)
171  goto FailSetConfDescr;
172 
173 #ifdef DEBUG_USB_HOST
174  Notify(PSTR("\r\nXbox One Controller Connected\r\n"), 0x80);
175 #endif
176 
177  delay(200); // let things settle
178 
179  // initialize the controller for input
180  writeBuf[0] = 0x05;
181  writeBuf[1] = 0x20;
182  rcode = XboxCommand(writeBuf, 2);
183  if (rcode)
184  goto Fail;
185 
186  onInit();
187  XboxOneConnected = true;
188  bPollEnable = true;
189  return 0; // Successful configuration
190 
191  /* Diagnostic messages */
192 FailGetDevDescr:
193 #ifdef DEBUG_USB_HOST
195  goto Fail;
196 #endif
197 
198 FailSetDevTblEntry:
199 #ifdef DEBUG_USB_HOST
201  goto Fail;
202 #endif
203 
204 FailSetConfDescr:
205 #ifdef DEBUG_USB_HOST
207 #endif
208  goto Fail;
209 
210 FailUnknownDevice:
211 #ifdef DEBUG_USB_HOST
212  NotifyFailUnknownDevice(VID, PID);
213 #endif
215 
216 Fail:
217 #ifdef DEBUG_USB_HOST
218  Notify(PSTR("\r\nXbox One Init Failed, error code: "), 0x80);
219  NotifyFail(rcode);
220 #endif
221  Release();
222  return rcode;
223 }
224 
225 /* Performs a cleanup after failed Init() attempt */
226 uint8_t XBOXONE::Release() {
227  XboxOneConnected = false;
229  bAddress = 0;
230  bPollEnable = false;
231 #ifdef DEBUG_USB_HOST
232  Notify(PSTR("\r\nXbox One Controller Disconnected\r\n"), 0x80);
233 #endif
234  return 0;
235 }
236 
237 uint8_t XBOXONE::Poll() {
238  if(!bPollEnable)
239  return 0;
240  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
241  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ XBOX_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf);
242  if (!rcode) {
243  readReport();
244 #ifdef PRINTREPORT
245  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox ONE Controller
246 #endif
247  }
248 #ifdef DEBUG_USB_HOST
249  else if (rcode != 0x04) { // not a matter of no update to send
250  Notify(PSTR("\r\nXbox One Poll Failed, error code: "), 0x80);
251  NotifyFail(rcode);
252  }
253 #endif
254  return rcode;
255 }
256 
257 void XBOXONE::readReport() {
258  if(readBuf == NULL)
259  return;
260  if(readBuf[0] == 0x07) {
261  // The XBOX button has a separate message
262  if(readBuf[4] == 1)
263  ButtonState |= XBOX_BUTTONS[XBOX];
264  else
265  ButtonState &= ~XBOX_BUTTONS[XBOX];
266  }
267  if(readBuf[0] != 0x20) { // Check if it's the correct report, otherwise return - the controller also sends different status reports
268 #ifdef EXTRADEBUG
269  Notify(PSTR("\r\nXbox Poll: "), 0x80);
270  D_PrintHex<uint8_t > (readBuf[0], 0x80); // 0x03 is a heart beat report!
271 #endif
272  return;
273  }
274 
275  uint16_t xbox = ButtonState & XBOX_BUTTONS[XBOX]; // Since the XBOX button is separate, save it and add it back in
276  // xbox button from before, dpad, abxy, start/back, sync, stick click, shoulder buttons
277  ButtonState = xbox | (((uint16_t)readBuf[5] & 0xF) << 8) | (readBuf[4] & 0xF0) | (((uint16_t)readBuf[4] & 0x0C) << 10) | ((readBuf[4] & 0x01) << 3) | (((uint16_t)readBuf[5] & 0xC0) << 8) | ((readBuf[5] & 0x30) >> 4);
278 
279  triggerValue[0] = (uint16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
280  triggerValue[1] = (uint16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
281 
282  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
283  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
284  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
285  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
286 
287  //Notify(PSTR("\r\nButtonState"), 0x80);
288  //PrintHex<uint16_t>(ButtonState, 0x80);
289 
290  if(ButtonState != OldButtonState) {
291  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
292  OldButtonState = ButtonState;
293  }
294 
295  // Handle click detection for triggers
296  if(triggerValue[0] != 0 && triggerValueOld[0] == 0)
297  L2Clicked = true;
298  triggerValueOld[0] = triggerValue[0];
299  if(triggerValue[1] != 0 && triggerValueOld[1] == 0)
300  R2Clicked = true;
301  triggerValueOld[1] = triggerValue[1];
302 }
303 
304 void XBOXONE::printReport() { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox ONE Controller
305 #ifdef PRINTREPORT
306  if(readBuf == NULL)
307  return;
308  for(uint8_t i = 0; i < XBOX_REPORT_BUFFER_SIZE; i++) {
309  D_PrintHex<uint8_t > (readBuf[i], 0x80);
310  Notify(PSTR(" "), 0x80);
311  }
312  Notify(PSTR("\r\n"), 0x80);
313 #endif
314 }
315 
317  if(b == L2) // These are analog buttons
318  return triggerValue[0];
319  else if(b == R2)
320  return triggerValue[1];
321  return (bool)(ButtonState & ((uint16_t)pgm_read_word(&XBOX_BUTTONS[(uint8_t)b])));
322 }
323 
325  if(b == L2) {
326  if(L2Clicked) {
327  L2Clicked = false;
328  return true;
329  }
330  return false;
331  } else if(b == R2) {
332  if(R2Clicked) {
333  R2Clicked = false;
334  return true;
335  }
336  return false;
337  }
338  uint16_t button = pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]);
339  bool click = (ButtonClickState & button);
340  ButtonClickState &= ~button; // clear "click" event
341  return click;
342 }
343 
345  return hatValue[a];
346 }
347 
348 /* Xbox Controller commands */
349 uint8_t XBOXONE::XboxCommand(uint8_t* data, uint16_t nbytes) {
350  uint8_t rcode = pUsb->outTransfer(bAddress, epInfo[ XBOX_OUTPUT_PIPE ].epAddr, nbytes, data);
351 #ifdef DEBUG_USB_HOST
352  Notify(PSTR("\r\nXboxCommand, Return: "), 0x80);
353  D_PrintHex<uint8_t > (rcode, 0x80);
354 #endif
355  return rcode;
356 }
357 
358 void XBOXONE::onInit() {
359  // a short buzz to show the controller is active
360  writeBuf[0] = 0x09;
361  writeBuf[1] = 0x08;
362  writeBuf[2] = 0x00;
363  writeBuf[3] = 0x09;
364  writeBuf[4] = 0x00;
365  writeBuf[5] = 0x0f;
366  writeBuf[6] = 0x04;
367  writeBuf[7] = 0x04;
368  writeBuf[8] = 0x20;
369  writeBuf[9] = 0x20;
370  writeBuf[10] = 0x80;
371  XboxCommand(writeBuf, 11);
372 
373  if(pFuncOnInit)
374  pFuncOnInit(); // Call the user function
375 }
uint8_t bmRcvToggle
Definition: address.h:41
- - -
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
uint8_t bmNakPower
Definition: address.h:42
- -
#define pgm_read_word(addr)
-
USB * pUsb
Definition: XBOXONE.h:136
-
#define NotifyFail(...)
Definition: message.h:55
-
AnalogHatEnum
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
-
uint8_t bAddress
Definition: XBOXONE.h:138
-
EpInfo epInfo[XBOX_MAX_ENDPOINTS]
Definition: XBOXONE.h:140
+Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
2  Copyright (C) 2015 guruthree
3 
4  This software may be distributed and modified under the terms of the GNU
5  General Public License version 2 (GPL2) as published by the Free Software
6  Foundation and appearing in the file GPL2.TXT included in the packaging of
7  this file. Please note that GPL2 Section 2[b] requires that all works based
8  on this software must also be made publicly available under the terms of
9  the GPL2 ("Copyleft").
10 
11  Contact information
12  -------------------
13 
14  Kristian Lauszus, TKJ Electronics
15  Web : http://www.tkjelectronics.com
16  e-mail : kristianl@tkjelectronics.com
17 
18  guruthree
19  Web : https://github.com/guruthree/
20  */
21 
22 #include "XBOXONE.h"
23 // To enable serial debugging see "settings.h"
24 //#define EXTRADEBUG // Uncomment to get even more debugging data
25 //#define PRINTREPORT // Uncomment to print the report send by the Xbox ONE Controller
26 
28 pUsb(p), // pointer to USB class instance - mandatory
29 bAddress(0), // device address - mandatory
30 bNumEP(1), // If config descriptor needs to be parsed
31 qNextPollTime(0), // Reset NextPollTime
32 pollInterval(0),
33 bPollEnable(false) { // don't start polling before dongle is connected
34  for(uint8_t i = 0; i < XBOX_ONE_MAX_ENDPOINTS; i++) {
35  epInfo[i].epAddr = 0;
36  epInfo[i].maxPktSize = (i) ? 0 : 8;
37  epInfo[i].bmSndToggle = 0;
38  epInfo[i].bmRcvToggle = 0;
40  }
41 
42  if(pUsb) // register in USB subsystem
43  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
44 }
45 
46 uint8_t XBOXONE::Init(uint8_t parent, uint8_t port, bool lowspeed) {
47  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
48  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
49  uint8_t rcode;
50  UsbDevice *p = NULL;
51  EpInfo *oldep_ptr = NULL;
52  uint16_t PID, VID;
53  uint8_t num_of_conf; // Number of configurations
54 
55  // get memory address of USB device address pool
56  AddressPool &addrPool = pUsb->GetAddressPool();
57 #ifdef EXTRADEBUG
58  Notify(PSTR("\r\nXBOXONE Init"), 0x80);
59 #endif
60  // check if address has already been assigned to an instance
61  if(bAddress) {
62 #ifdef DEBUG_USB_HOST
63  Notify(PSTR("\r\nAddress in use"), 0x80);
64 #endif
66  }
67 
68  // Get pointer to pseudo device with address 0 assigned
69  p = addrPool.GetUsbDevicePtr(0);
70 
71  if(!p) {
72 #ifdef DEBUG_USB_HOST
73  Notify(PSTR("\r\nAddress not found"), 0x80);
74 #endif
76  }
77 
78  if(!p->epinfo) {
79 #ifdef DEBUG_USB_HOST
80  Notify(PSTR("\r\nepinfo is null"), 0x80);
81 #endif
83  }
84 
85  // Save old pointer to EP_RECORD of address 0
86  oldep_ptr = p->epinfo;
87 
88  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
89  p->epinfo = epInfo;
90 
91  p->lowspeed = lowspeed;
92 
93  // Get device descriptor
94  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
95  // Restore p->epinfo
96  p->epinfo = oldep_ptr;
97 
98  if(rcode)
99  goto FailGetDevDescr;
100 
101  VID = udd->idVendor;
102  PID = udd->idProduct;
103 
104  if(!VIDPIDOK(VID, PID)) // Check VID
105  goto FailUnknownDevice;
106 
107  // Allocate new address according to device class
108  bAddress = addrPool.AllocAddress(parent, false, port);
109 
110  if(!bAddress)
112 
113  // Extract Max Packet Size from device descriptor
114  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
115 
116  // Assign new address to the device
117  rcode = pUsb->setAddr(0, 0, bAddress);
118  if(rcode) {
119  p->lowspeed = false;
120  addrPool.FreeAddress(bAddress);
121  bAddress = 0;
122 #ifdef DEBUG_USB_HOST
123  Notify(PSTR("\r\nsetAddr: "), 0x80);
124  D_PrintHex<uint8_t > (rcode, 0x80);
125 #endif
126  return rcode;
127  }
128 #ifdef EXTRADEBUG
129  Notify(PSTR("\r\nAddr: "), 0x80);
130  D_PrintHex<uint8_t > (bAddress, 0x80);
131 #endif
132  //delay(300); // Spec says you should wait at least 200ms
133 
134  p->lowspeed = false;
135 
136  //get pointer to assigned address record
137  p = addrPool.GetUsbDevicePtr(bAddress);
138  if(!p)
140 
141  p->lowspeed = lowspeed;
142 
143  // Assign epInfo to epinfo pointer - only EP0 is known
144  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
145  if(rcode)
146  goto FailSetDevTblEntry;
147 
148  num_of_conf = udd->bNumConfigurations; // Number of configurations
149 
150  USBTRACE2("NC:", num_of_conf);
151 
152  // Check if attached device is a Xbox One controller and fill endpoint data structure
153  for(uint8_t i = 0; i < num_of_conf; i++) {
154  ConfigDescParser<0, 0, 0, 0> confDescrParser(this); // Allow all devices, as we have already verified that it is a Xbox One controller from the VID and PID
155  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
156  if(rcode) // Check error code
157  goto FailGetConfDescr;
158  if(bNumEP >= XBOX_ONE_MAX_ENDPOINTS) // All endpoints extracted
159  break;
160  }
161 
163  goto FailUnknownDevice;
164 
166  if(rcode)
167  goto FailSetDevTblEntry;
168 
169  delay(200); // Give time for address change
170 
172  if(rcode)
173  goto FailSetConfDescr;
174 
175 #ifdef DEBUG_USB_HOST
176  Notify(PSTR("\r\nXbox One Controller Connected\r\n"), 0x80);
177 #endif
178 
179  delay(200); // let things settle
180 
181  // Initialize the controller for input
182  cmdCounter = 0; // Reset the counter used when sending out the commands
183  uint8_t writeBuf[5];
184  writeBuf[0] = 0x05;
185  writeBuf[1] = 0x20;
186  // Byte 2 is set in "XboxCommand"
187  writeBuf[3] = 0x01;
188  writeBuf[4] = 0x00;
189  rcode = XboxCommand(writeBuf, 5);
190  if (rcode)
191  goto Fail;
192 
193  onInit();
194  XboxOneConnected = true;
195  bPollEnable = true;
196  return 0; // Successful configuration
197 
198  /* Diagnostic messages */
199 FailGetDevDescr:
200 #ifdef DEBUG_USB_HOST
202  goto Fail;
203 #endif
204 
205 FailSetDevTblEntry:
206 #ifdef DEBUG_USB_HOST
208  goto Fail;
209 #endif
210 
211 FailGetConfDescr:
212 #ifdef DEBUG_USB_HOST
214  goto Fail;
215 #endif
216 
217 FailSetConfDescr:
218 #ifdef DEBUG_USB_HOST
220 #endif
221  goto Fail;
222 
223 FailUnknownDevice:
224 #ifdef DEBUG_USB_HOST
225  NotifyFailUnknownDevice(VID, PID);
226 #endif
228 
229 Fail:
230 #ifdef DEBUG_USB_HOST
231  Notify(PSTR("\r\nXbox One Init Failed, error code: "), 0x80);
232  NotifyFail(rcode);
233 #endif
234  Release();
235  return rcode;
236 }
237 
238 /* Extracts endpoint information from config descriptor */
239 void XBOXONE::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
240  bConfNum = conf;
241  uint8_t index;
242 
243  if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT) { // Interrupt endpoint
244  index = (pep->bEndpointAddress & 0x80) == 0x80 ? XBOX_ONE_INPUT_PIPE : XBOX_ONE_OUTPUT_PIPE; // Set the endpoint index
245  } else
246  return;
247 
248  // Fill the rest of endpoint data structure
249  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
250  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
251 #ifdef EXTRADEBUG
253 #endif
254  if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
255  pollInterval = pep->bInterval;
256  bNumEP++;
257 }
258 
260 #ifdef EXTRADEBUG
261  Notify(PSTR("\r\nEndpoint descriptor:"), 0x80);
262  Notify(PSTR("\r\nLength:\t\t"), 0x80);
263  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
264  Notify(PSTR("\r\nType:\t\t"), 0x80);
265  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
266  Notify(PSTR("\r\nAddress:\t"), 0x80);
267  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
268  Notify(PSTR("\r\nAttributes:\t"), 0x80);
269  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
270  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
271  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
272  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
273  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
274 #endif
275 }
276 
277 /* Performs a cleanup after failed Init() attempt */
278 uint8_t XBOXONE::Release() {
279  XboxOneConnected = false;
281  bAddress = 0; // Clear device address
282  bNumEP = 1; // Must have to be reset to 1
283  qNextPollTime = 0; // Reset next poll time
284  pollInterval = 0;
285  bPollEnable = false;
286 #ifdef DEBUG_USB_HOST
287  Notify(PSTR("\r\nXbox One Controller Disconnected\r\n"), 0x80);
288 #endif
289  return 0;
290 }
291 
292 uint8_t XBOXONE::Poll() {
293  uint8_t rcode = 0;
294 
295  if(!bPollEnable)
296  return 0;
297 
298  if((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L) { // Do not poll if shorter than polling interval
299  qNextPollTime = (uint32_t)millis() + pollInterval; // Set new poll time
300  uint16_t length = (uint16_t)epInfo[ XBOX_ONE_INPUT_PIPE ].maxPktSize; // Read the maximum packet size from the endpoint
301  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ XBOX_ONE_INPUT_PIPE ].epAddr, &length, readBuf, pollInterval);
302  if(!rcode) {
303  readReport();
304 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send by the Xbox ONE Controller
305  for(uint8_t i = 0; i < length; i++) {
306  D_PrintHex<uint8_t > (readBuf[i], 0x80);
307  Notify(PSTR(" "), 0x80);
308  }
309  Notify(PSTR("\r\n"), 0x80);
310 #endif
311  }
312 #ifdef DEBUG_USB_HOST
313  else if(rcode != hrNAK) { // Not a matter of no update to send
314  Notify(PSTR("\r\nXbox One Poll Failed, error code: "), 0x80);
315  NotifyFail(rcode);
316  }
317 #endif
318  }
319  return rcode;
320 }
321 
322 void XBOXONE::readReport() {
323  if(readBuf[0] == 0x07) {
324  // The XBOX button has a separate message
325  if(readBuf[4] == 1)
326  ButtonState |= pgm_read_word(&XBOX_BUTTONS[XBOX]);
327  else
328  ButtonState &= ~pgm_read_word(&XBOX_BUTTONS[XBOX]);
329 
330  if(ButtonState != OldButtonState) {
331  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
332  OldButtonState = ButtonState;
333  }
334  }
335  if(readBuf[0] != 0x20) { // Check if it's the correct report, otherwise return - the controller also sends different status reports
336 #ifdef EXTRADEBUG
337  Notify(PSTR("\r\nXbox Poll: "), 0x80);
338  D_PrintHex<uint8_t > (readBuf[0], 0x80); // 0x03 is a heart beat report!
339 #endif
340  return;
341  }
342 
343  uint16_t xbox = ButtonState & pgm_read_word(&XBOX_BUTTONS[XBOX]); // Since the XBOX button is separate, save it and add it back in
344  // xbox button from before, dpad, abxy, start/back, sync, stick click, shoulder buttons
345  ButtonState = xbox | (((uint16_t)readBuf[5] & 0xF) << 8) | (readBuf[4] & 0xF0) | (((uint16_t)readBuf[4] & 0x0C) << 10) | ((readBuf[4] & 0x01) << 3) | (((uint16_t)readBuf[5] & 0xC0) << 8) | ((readBuf[5] & 0x30) >> 4);
346 
347  triggerValue[0] = (uint16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
348  triggerValue[1] = (uint16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
349 
350  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
351  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
352  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
353  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
354 
355  //Notify(PSTR("\r\nButtonState"), 0x80);
356  //PrintHex<uint16_t>(ButtonState, 0x80);
357 
358  if(ButtonState != OldButtonState) {
359  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
360  OldButtonState = ButtonState;
361  }
362 
363  // Handle click detection for triggers
364  if(triggerValue[0] != 0 && triggerValueOld[0] == 0)
365  L2Clicked = true;
366  triggerValueOld[0] = triggerValue[0];
367  if(triggerValue[1] != 0 && triggerValueOld[1] == 0)
368  R2Clicked = true;
369  triggerValueOld[1] = triggerValue[1];
370 }
371 
373  if(b == L2) // These are analog buttons
374  return triggerValue[0];
375  else if(b == R2)
376  return triggerValue[1];
377  return (bool)(ButtonState & ((uint16_t)pgm_read_word(&XBOX_BUTTONS[(uint8_t)b])));
378 }
379 
381  if(b == L2) {
382  if(L2Clicked) {
383  L2Clicked = false;
384  return true;
385  }
386  return false;
387  } else if(b == R2) {
388  if(R2Clicked) {
389  R2Clicked = false;
390  return true;
391  }
392  return false;
393  }
394  uint16_t button = pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]);
395  bool click = (ButtonClickState & button);
396  ButtonClickState &= ~button; // Clear "click" event
397  return click;
398 }
399 
401  return hatValue[a];
402 }
403 
404 /* Xbox Controller commands */
405 uint8_t XBOXONE::XboxCommand(uint8_t* data, uint16_t nbytes) {
406  data[2] = cmdCounter++; // Increment the output command counter
407  uint8_t rcode = pUsb->outTransfer(bAddress, epInfo[ XBOX_ONE_OUTPUT_PIPE ].epAddr, nbytes, data);
408 #ifdef DEBUG_USB_HOST
409  Notify(PSTR("\r\nXboxCommand, Return: "), 0x80);
410  D_PrintHex<uint8_t > (rcode, 0x80);
411 #endif
412  return rcode;
413 }
414 
415 // The Xbox One packets are described at: https://github.com/quantus/xbox-one-controller-protocol
416 void XBOXONE::onInit() {
417  // A short buzz to show the controller is active
418  uint8_t writeBuf[13];
419 
420  // Activate rumble
421  writeBuf[0] = 0x09;
422  writeBuf[1] = 0x00;
423  // Byte 2 is set in "XboxCommand"
424 
425  // Single rumble effect
426  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
427  writeBuf[4] = 0x00; // Mode
428  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
429  writeBuf[6] = 0x04; // lT force
430  writeBuf[7] = 0x04; // rT force
431  writeBuf[8] = 0x20; // L force
432  writeBuf[9] = 0x20; // R force
433  writeBuf[10] = 0x80; // Length of pulse
434  writeBuf[11] = 0x00; // Off period
435  writeBuf[12] = 0x00; // Repeat count
436  XboxCommand(writeBuf, 13);
437 
438  if(pFuncOnInit)
439  pFuncOnInit(); // Call the user function
440 }
441 
443  uint8_t writeBuf[13];
444 
445  // Activate rumble
446  writeBuf[0] = 0x09;
447  writeBuf[1] = 0x00;
448  // Byte 2 is set in "XboxCommand"
449 
450  // Continuous rumble effect
451  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
452  writeBuf[4] = 0x00; // Mode
453  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
454  writeBuf[6] = 0x00; // lT force
455  writeBuf[7] = 0x00; // rT force
456  writeBuf[8] = 0x00; // L force
457  writeBuf[9] = 0x00; // R force
458  writeBuf[10] = 0x00; // On period
459  writeBuf[11] = 0x00; // Off period
460  writeBuf[12] = 0x00; // Repeat count
461  XboxCommand(writeBuf, 13);
462 }
463 
464 void XBOXONE::setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor) {
465  uint8_t writeBuf[13];
466 
467  // Activate rumble
468  writeBuf[0] = 0x09;
469  writeBuf[1] = 0x00;
470  // Byte 2 is set in "XboxCommand"
471 
472  // Continuous rumble effect
473  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
474  writeBuf[4] = 0x00; // Mode
475  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
476  writeBuf[6] = leftTrigger; // lT force
477  writeBuf[7] = rightTrigger; // rT force
478  writeBuf[8] = leftMotor; // L force
479  writeBuf[9] = rightMotor; // R force
480  writeBuf[10] = 0xFF; // On period
481  writeBuf[11] = 0x00; // Off period
482  writeBuf[12] = 0xFF; // Repeat count
483  XboxCommand(writeBuf, 13);
484 }
uint8_t bConfNum
Definition: XBOXONE.h:185
+
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+
uint8_t bmRcvToggle
Definition: address.h:48
+ + +
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
uint8_t bmNakPower
Definition: address.h:49
+ +
#define pgm_read_word(addr)
+ + + +
USB * pUsb
Definition: XBOXONE.h:178
+
#define NotifyFail(...)
Definition: message.h:62
+
AnalogHatEnum
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
uint8_t bAddress
Definition: XBOXONE.h:180
XBOXONE(USB *pUsb)
Definition: XBOXONE.cpp:27
-
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:86
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
-
#define EP_MAXPKTSIZE
Definition: PS3USB.h:26
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
+
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: XBOXONE.cpp:239
virtual void FreeAddress(uint8_t addr)=0
-
uint8_t epAttribs
Definition: address.h:37
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
#define Notify(...)
Definition: message.h:44
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
uint8_t epAddr
Definition: address.h:33
-
bool XboxOneConnected
Definition: XBOXONE.h:128
-
#define NotifyFailUnknownDevice(...)
Definition: message.h:54
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
-
virtual uint8_t Release()
Definition: XBOXONE.cpp:226
-
#define XBOX_INPUT_PIPE
Definition: XBOXOLD.h:30
- -
Definition: address.h:32
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
-
ButtonEnum
- -
uint16_t getButtonPress(ButtonEnum b)
Definition: XBOXONE.cpp:316
+
uint8_t bNumEP
Definition: XBOXONE.h:187
+
#define Notify(...)
Definition: message.h:51
+ + +
#define USBTRACE2(s, r)
Definition: macros.h:84
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
#define NotifyFailGetConfDescr(...)
Definition: message.h:59
+
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: XBOXONE.cpp:259
+
uint8_t epAddr
Definition: address.h:40
+
bool XboxOneConnected
Definition: XBOXONE.h:174
+
#define XBOX_ONE_MAX_ENDPOINTS
Definition: XBOXONE.h:37
+
#define NotifyFailUnknownDevice(...)
Definition: message.h:61
+
void setRumbleOff()
Definition: XBOXONE.cpp:442
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
+
virtual uint8_t Release()
Definition: XBOXONE.cpp:278
+ +
Definition: address.h:39
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
+
#define hrNAK
Definition: max3421e.h:218
+
ButtonEnum
+
uint16_t wMaxPacketSize
Definition: usb_ch9.h:153
+
#define bmUSB_TRANSFER_TYPE
Definition: usb_ch9.h:94
+ +
uint16_t getButtonPress(ButtonEnum b)
Definition: XBOXONE.cpp:372
+ +
uint32_t qNextPollTime
Definition: XBOXONE.h:189
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
- -
bool getButtonClick(ButtonEnum b)
Definition: XBOXONE.cpp:324
-
virtual uint8_t Poll()
Definition: XBOXONE.cpp:237
-
#define XBOX_OUTPUT_PIPE
Definition: XBOXOLD.h:31
-
#define USB_NAK_NOWAIT
Definition: address.h:29
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
-
#define XBOX_MAX_ENDPOINTS
Definition: XBOXOLD.h:43
-
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXONE.cpp:43
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
Definition: UsbCore.h:197
-
#define XBOX_CONTROL_PIPE
Definition: XBOXOLD.h:29
- -
int16_t getAnalogHat(AnalogHatEnum a)
Definition: XBOXONE.cpp:344
- - +
uint8_t bEndpointAddress
Definition: usb_ch9.h:151
+
uint8_t bmSndToggle
Definition: address.h:47
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
+
#define XBOX_ONE_INPUT_PIPE
Definition: XBOXONE.h:35
+ +
EpInfo epInfo[XBOX_ONE_MAX_ENDPOINTS]
Definition: XBOXONE.h:182
+ +
bool getButtonClick(ButtonEnum b)
Definition: XBOXONE.cpp:380
+
virtual uint8_t Poll()
Definition: XBOXONE.cpp:292
+
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
+
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXONE.cpp:46
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
Definition: UsbCore.h:208
+
#define XBOX_ONE_CONTROL_PIPE
Definition: XBOXONE.h:33
+
#define XBOX_ONE_OUTPUT_PIPE
Definition: XBOXONE.h:34
+ +
int16_t getAnalogHat(AnalogHatEnum a)
Definition: XBOXONE.cpp:400
+ +
const uint16_t XBOX_BUTTONS[]
Definition: xboxEnums.h:41
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
-
#define XBOX_REPORT_BUFFER_SIZE
Definition: XBOXONE.h:41
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
-
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: XBOXONE.h:96
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
- +
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: XBOXONE.h:123
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)
Definition: XBOXONE.cpp:464
+
diff --git a/_x_b_o_x_o_n_e_8h.html b/_x_b_o_x_o_n_e_8h.html index fb8afa1e..2d02f2cd 100644 --- a/_x_b_o_x_o_n_e_8h.html +++ b/_x_b_o_x_o_n_e_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXONE.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Macros

#define EP_MAXPKTSIZE   32
 
#define XBOX_CONTROL_PIPE   0
 
#define XBOX_OUTPUT_PIPE   1
 
#define XBOX_INPUT_PIPE   2
 
#define XBOX_VID   0x045E
 
#define XBOX_ONE_PID   0x02D1
 
#define XBOX_REPORT_BUFFER_SIZE   14
 
#define XBOX_MAX_ENDPOINTS   3
 
#define XBOX_ONE_EP_MAXPKTSIZE   64
 
#define XBOX_ONE_CONTROL_PIPE   0
 
#define XBOX_ONE_OUTPUT_PIPE   1
 
#define XBOX_ONE_INPUT_PIPE   2
 
#define XBOX_ONE_MAX_ENDPOINTS   3
 
#define XBOX_VID1   0x045E
 
#define XBOX_ONE_PID1   0x02D1
 
#define XBOX_ONE_PID2   0x02DD
 
#define XBOX_ONE_PID3   0x02E3
 
#define XBOX_ONE_PID4   0x02EA
 
#define XBOX_VID2   0x0738
 
#define XBOX_VID3   0x0E6F
 
#define XBOX_VID4   0x0F0D
 
#define XBOX_VID5   0x1532
 
#define XBOX_VID6   0x24C6
 
#define XBOX_ONE_PID5   0x4A01
 
#define XBOX_ONE_PID6   0x0139
 
#define XBOX_ONE_PID7   0x0146
 
#define XBOX_ONE_PID8   0x0067
 
#define XBOX_ONE_PID9   0x0A03
 
#define XBOX_ONE_PID10   0x541A
 
#define XBOX_ONE_PID11   0x542A
 
#define XBOX_ONE_PID12   0x543A
 

Macro Definition Documentation

- + +

◆ XBOX_ONE_EP_MAXPKTSIZE

+
- +
#define EP_MAXPKTSIZE   32#define XBOX_ONE_EP_MAXPKTSIZE   64
-

Definition at line 30 of file XBOXONE.h.

+

Definition at line 30 of file XBOXONE.h.

- + +

◆ XBOX_ONE_CONTROL_PIPE

+
- +
#define XBOX_CONTROL_PIPE   0#define XBOX_ONE_CONTROL_PIPE   0
-

Definition at line 33 of file XBOXONE.h.

+

Definition at line 33 of file XBOXONE.h.

- + +

◆ XBOX_ONE_OUTPUT_PIPE

+
- +
#define XBOX_OUTPUT_PIPE   1#define XBOX_ONE_OUTPUT_PIPE   1
-

Definition at line 34 of file XBOXONE.h.

+

Definition at line 34 of file XBOXONE.h.

- + +

◆ XBOX_ONE_INPUT_PIPE

+
- +
#define XBOX_INPUT_PIPE   2#define XBOX_ONE_INPUT_PIPE   2
-

Definition at line 35 of file XBOXONE.h.

+

Definition at line 35 of file XBOXONE.h.

- + +

◆ XBOX_ONE_MAX_ENDPOINTS

+
- +
#define XBOX_VID   0x045E#define XBOX_ONE_MAX_ENDPOINTS   3
-

Definition at line 38 of file XBOXONE.h.

+

Definition at line 37 of file XBOXONE.h.

- + +

◆ XBOX_VID1

+
- +
#define XBOX_ONE_PID   0x02D1#define XBOX_VID1   0x045E
-

Definition at line 39 of file XBOXONE.h.

+

Definition at line 42 of file XBOXONE.h.

- + +

◆ XBOX_ONE_PID1

+
- +
#define XBOX_REPORT_BUFFER_SIZE   14#define XBOX_ONE_PID1   0x02D1
-

Definition at line 41 of file XBOXONE.h.

+

Definition at line 43 of file XBOXONE.h.

- + +

◆ XBOX_ONE_PID2

+
- +
#define XBOX_MAX_ENDPOINTS   3#define XBOX_ONE_PID2   0x02DD
-

Definition at line 43 of file XBOXONE.h.

+

Definition at line 44 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID3

+ +
+
+ + + + +
#define XBOX_ONE_PID3   0x02E3
+
+ +

Definition at line 45 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID4

+ +
+
+ + + + +
#define XBOX_ONE_PID4   0x02EA
+
+ +

Definition at line 46 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_VID2

+ +
+
+ + + + +
#define XBOX_VID2   0x0738
+
+ +

Definition at line 49 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_VID3

+ +
+
+ + + + +
#define XBOX_VID3   0x0E6F
+
+ +

Definition at line 50 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_VID4

+ +
+
+ + + + +
#define XBOX_VID4   0x0F0D
+
+ +

Definition at line 51 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_VID5

+ +
+
+ + + + +
#define XBOX_VID5   0x1532
+
+ +

Definition at line 52 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_VID6

+ +
+
+ + + + +
#define XBOX_VID6   0x24C6
+
+ +

Definition at line 53 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID5

+ +
+
+ + + + +
#define XBOX_ONE_PID5   0x4A01
+
+ +

Definition at line 55 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID6

+ +
+
+ + + + +
#define XBOX_ONE_PID6   0x0139
+
+ +

Definition at line 56 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID7

+ +
+
+ + + + +
#define XBOX_ONE_PID7   0x0146
+
+ +

Definition at line 57 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID8

+ +
+
+ + + + +
#define XBOX_ONE_PID8   0x0067
+
+ +

Definition at line 58 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID9

+ +
+
+ + + + +
#define XBOX_ONE_PID9   0x0A03
+
+ +

Definition at line 59 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID10

+ +
+
+ + + + +
#define XBOX_ONE_PID10   0x541A
+
+ +

Definition at line 60 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID11

+ +
+
+ + + + +
#define XBOX_ONE_PID11   0x542A
+
+ +

Definition at line 61 of file XBOXONE.h.

+ +
+
+ +

◆ XBOX_ONE_PID12

+ +
+
+ + + + +
#define XBOX_ONE_PID12   0x543A
+
+ +

Definition at line 62 of file XBOXONE.h.

@@ -258,7 +524,7 @@ Macros diff --git a/_x_b_o_x_o_n_e_8h__dep__incl.md5 b/_x_b_o_x_o_n_e_8h__dep__incl.md5 index c13f788f..138afee0 100644 --- a/_x_b_o_x_o_n_e_8h__dep__incl.md5 +++ b/_x_b_o_x_o_n_e_8h__dep__incl.md5 @@ -1 +1 @@ -fd61d6c8f3280fcb7695abf658ecef71 \ No newline at end of file +62b27de5bf2e11b4776c6317ba9ba67c \ No newline at end of file diff --git a/_x_b_o_x_o_n_e_8h__dep__incl.png b/_x_b_o_x_o_n_e_8h__dep__incl.png index 9ddbb2a6..473cae86 100644 Binary files a/_x_b_o_x_o_n_e_8h__dep__incl.png and b/_x_b_o_x_o_n_e_8h__dep__incl.png differ diff --git a/_x_b_o_x_o_n_e_8h__incl.md5 b/_x_b_o_x_o_n_e_8h__incl.md5 index 14781353..77d2358c 100644 --- a/_x_b_o_x_o_n_e_8h__incl.md5 +++ b/_x_b_o_x_o_n_e_8h__incl.md5 @@ -1 +1 @@ -0dde0ce6aa02e651aff1df3147ecf48a \ No newline at end of file +2a496eec75d3a13d8c9db56169dc7730 \ No newline at end of file diff --git a/_x_b_o_x_o_n_e_8h__incl.png b/_x_b_o_x_o_n_e_8h__incl.png index 5b9e6491..63261062 100644 Binary files a/_x_b_o_x_o_n_e_8h__incl.png and b/_x_b_o_x_o_n_e_8h__incl.png differ diff --git a/_x_b_o_x_o_n_e_8h_source.html b/_x_b_o_x_o_n_e_8h_source.html index da87d4d9..bc7e85e8 100644 --- a/_x_b_o_x_o_n_e_8h_source.html +++ b/_x_b_o_x_o_n_e_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXONE.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
XBOXONE.h
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
2  Copyright (C) 2015 guruthree
3 
4  This software may be distributed and modified under the terms of the GNU
5  General Public License version 2 (GPL2) as published by the Free Software
6  Foundation and appearing in the file GPL2.TXT included in the packaging of
7  this file. Please note that GPL2 Section 2[b] requires that all works based
8  on this software must also be made publicly available under the terms of
9  the GPL2 ("Copyleft").
10 
11  Contact information
12  -------------------
13 
14  Kristian Lauszus, TKJ Electronics
15  Web : http://www.tkjelectronics.com
16  e-mail : kristianl@tkjelectronics.com
17 
18  guruthree
19  Web : https://github.com/guruthree/
20  */
21 
22 
23 #ifndef _xboxone_h_
24 #define _xboxone_h_
25 
26 #include "Usb.h"
27 #include "xboxEnums.h"
28 
29 /* Data Xbox ONE taken from descriptors */
30 #define EP_MAXPKTSIZE 32 // max size for data via USB
31 
32 /* Names we give to the 3 XboxONE pipes */
33 #define XBOX_CONTROL_PIPE 0
34 #define XBOX_OUTPUT_PIPE 1
35 #define XBOX_INPUT_PIPE 2
36 
37 // PID and VID of the different devices
38 #define XBOX_VID 0x045E // Microsoft Corporation
39 #define XBOX_ONE_PID 0x02D1 // Microsoft One Wired controller
40 
41 #define XBOX_REPORT_BUFFER_SIZE 14 // Size of the input report buffer
42 
43 #define XBOX_MAX_ENDPOINTS 3
44 
46 class XBOXONE : public USBDeviceConfig {
47 public:
52  XBOXONE(USB *pUsb);
53 
62  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
67  virtual uint8_t Release();
72  virtual uint8_t Poll();
73 
78  virtual uint8_t GetAddress() {
79  return bAddress;
80  };
81 
86  virtual bool isReady() {
87  return bPollEnable;
88  };
89 
96  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
97  return (vid == XBOX_VID && pid == XBOX_ONE_PID);
98  };
112  uint16_t getButtonPress(ButtonEnum b);
113  bool getButtonClick(ButtonEnum b);
114 
120  int16_t getAnalogHat(AnalogHatEnum a);
121 
126  void attachOnInit(void (*funcOnInit)(void)) {
127  pFuncOnInit = funcOnInit;
128  };
132  bool XboxOneConnected;
133 
134 protected:
138  uint8_t bAddress;
141 
142 private:
147  void onInit();
148  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
149 
150  bool bPollEnable;
151 
152  /* Variables to store the buttons */
153  uint16_t ButtonState;
154  uint16_t OldButtonState;
155  uint16_t ButtonClickState;
156  int16_t hatValue[4];
157  uint16_t triggerValue[2];
158  uint16_t triggerValueOld[2];
159 
160  bool L2Clicked; // These buttons are analog, so we use we use these bools to check if they where clicked or not
161  bool R2Clicked;
162 
163  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
164  uint8_t writeBuf[12]; // General purpose buffer for output data
165 
166  void readReport(); // read incoming data
167  void printReport(); // print incoming date - Uncomment for debugging
168 
169  /* Private commands */
170  uint8_t XboxCommand(uint8_t* data, uint16_t nbytes);
171 };
172 #endif
-
virtual bool isReady()
Definition: XBOXONE.h:86
-
#define XBOX_VID
Definition: XBOXONE.h:38
-
USB * pUsb
Definition: XBOXONE.h:136
-
void attachOnInit(void(*funcOnInit)(void))
Definition: XBOXONE.h:126
-
AnalogHatEnum
-
uint8_t bAddress
Definition: XBOXONE.h:138
-
EpInfo epInfo[XBOX_MAX_ENDPOINTS]
Definition: XBOXONE.h:140
+Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
2  Copyright (C) 2015 guruthree
3 
4  This software may be distributed and modified under the terms of the GNU
5  General Public License version 2 (GPL2) as published by the Free Software
6  Foundation and appearing in the file GPL2.TXT included in the packaging of
7  this file. Please note that GPL2 Section 2[b] requires that all works based
8  on this software must also be made publicly available under the terms of
9  the GPL2 ("Copyleft").
10 
11  Contact information
12  -------------------
13 
14  Kristian Lauszus, TKJ Electronics
15  Web : http://www.tkjelectronics.com
16  e-mail : kristianl@tkjelectronics.com
17 
18  guruthree
19  Web : https://github.com/guruthree/
20  */
21 
22 
23 #ifndef _xboxone_h_
24 #define _xboxone_h_
25 
26 #include "Usb.h"
27 #include "xboxEnums.h"
28 
29 /* Xbox One data taken from descriptors */
30 #define XBOX_ONE_EP_MAXPKTSIZE 64 // Max size for data via USB
31 
32 /* Names we give to the 3 XboxONE pipes */
33 #define XBOX_ONE_CONTROL_PIPE 0
34 #define XBOX_ONE_OUTPUT_PIPE 1
35 #define XBOX_ONE_INPUT_PIPE 2
36 
37 #define XBOX_ONE_MAX_ENDPOINTS 3
38 
39 // PID and VID of the different versions of the controller - see: https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c
40 
41 // Official controllers
42 #define XBOX_VID1 0x045E // Microsoft Corporation
43 #define XBOX_ONE_PID1 0x02D1 // Microsoft X-Box One pad
44 #define XBOX_ONE_PID2 0x02DD // Microsoft X-Box One pad (Firmware 2015)
45 #define XBOX_ONE_PID3 0x02E3 // Microsoft X-Box One Elite pad
46 #define XBOX_ONE_PID4 0x02EA // Microsoft X-Box One S pad
47 
48 // Unofficial controllers
49 #define XBOX_VID2 0x0738 // Mad Catz
50 #define XBOX_VID3 0x0E6F // Afterglow
51 #define XBOX_VID4 0x0F0D // HORIPAD ONE
52 #define XBOX_VID5 0x1532 // Razer
53 #define XBOX_VID6 0x24C6 // PowerA
54 
55 #define XBOX_ONE_PID5 0x4A01 // Mad Catz FightStick TE 2 - might have different mapping for triggers?
56 #define XBOX_ONE_PID6 0x0139 // Afterglow Prismatic Wired Controller
57 #define XBOX_ONE_PID7 0x0146 // Rock Candy Wired Controller for Xbox One
58 #define XBOX_ONE_PID8 0x0067 // HORIPAD ONE
59 #define XBOX_ONE_PID9 0x0A03 // Razer Wildcat
60 #define XBOX_ONE_PID10 0x541A // PowerA Xbox One Mini Wired Controller
61 #define XBOX_ONE_PID11 0x542A // Xbox ONE spectra
62 #define XBOX_ONE_PID12 0x543A // PowerA Xbox One wired controller
63 
65 class XBOXONE : public USBDeviceConfig, public UsbConfigXtracter {
66 public:
71  XBOXONE(USB *pUsb);
72 
81  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
86  virtual uint8_t Release();
91  virtual uint8_t Poll();
92 
97  virtual uint8_t GetAddress() {
98  return bAddress;
99  };
100 
105  virtual bool isReady() {
106  return bPollEnable;
107  };
108 
113  uint8_t readPollInterval() {
114  return pollInterval;
115  };
116 
123  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
124  return ((vid == XBOX_VID1 || vid == XBOX_VID2 || vid == XBOX_VID3 || vid == XBOX_VID4 || vid == XBOX_VID5 || vid == XBOX_VID6) &&
125  (pid == XBOX_ONE_PID1 || pid == XBOX_ONE_PID2 || pid == XBOX_ONE_PID3 || pid == XBOX_ONE_PID4 ||
126  pid == XBOX_ONE_PID5 || pid == XBOX_ONE_PID6 || pid == XBOX_ONE_PID7 || pid == XBOX_ONE_PID8 ||
127  pid == XBOX_ONE_PID9 || pid == XBOX_ONE_PID10 || pid == XBOX_ONE_PID11 || pid == XBOX_ONE_PID12));
128  };
142  uint16_t getButtonPress(ButtonEnum b);
143  bool getButtonClick(ButtonEnum b);
144 
150  int16_t getAnalogHat(AnalogHatEnum a);
151 
156  void attachOnInit(void (*funcOnInit)(void)) {
157  pFuncOnInit = funcOnInit;
158  };
159 
161  void setRumbleOff();
162 
170  void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor);
175 
176 protected:
180  uint8_t bAddress;
183 
185  uint8_t bConfNum;
187  uint8_t bNumEP;
189  uint32_t qNextPollTime;
190 
200  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
208 
209 private:
214  void onInit();
215  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
216 
217  uint8_t pollInterval;
218  bool bPollEnable;
219 
220  /* Variables to store the buttons */
221  uint16_t ButtonState;
222  uint16_t OldButtonState;
223  uint16_t ButtonClickState;
224  int16_t hatValue[4];
225  uint16_t triggerValue[2];
226  uint16_t triggerValueOld[2];
227 
228  bool L2Clicked; // These buttons are analog, so we use we use these bools to check if they where clicked or not
229  bool R2Clicked;
230 
231  uint8_t readBuf[XBOX_ONE_EP_MAXPKTSIZE]; // General purpose buffer for input data
232  uint8_t cmdCounter;
233 
234  void readReport(); // Used to read the incoming data
235 
236  /* Private commands */
237  uint8_t XboxCommand(uint8_t* data, uint16_t nbytes);
238 };
239 #endif
uint8_t bConfNum
Definition: XBOXONE.h:185
+
#define XBOX_ONE_PID5
Definition: XBOXONE.h:55
+
#define XBOX_ONE_PID10
Definition: XBOXONE.h:60
+
#define XBOX_ONE_PID9
Definition: XBOXONE.h:59
+ +
virtual bool isReady()
Definition: XBOXONE.h:105
+
#define XBOX_ONE_EP_MAXPKTSIZE
Definition: XBOXONE.h:30
+ +
USB * pUsb
Definition: XBOXONE.h:178
+
void attachOnInit(void(*funcOnInit)(void))
Definition: XBOXONE.h:156
+
AnalogHatEnum
+
uint8_t bAddress
Definition: XBOXONE.h:180
XBOXONE(USB *pUsb)
Definition: XBOXONE.cpp:27
- + -
#define XBOX_MAX_ENDPOINTS
Definition: XBOXONE.h:43
-
bool XboxOneConnected
Definition: XBOXONE.h:128
-
virtual uint8_t Release()
Definition: XBOXONE.cpp:226
-
Definition: address.h:32
-
ButtonEnum
-
uint16_t getButtonPress(ButtonEnum b)
Definition: XBOXONE.cpp:316
-
virtual uint8_t GetAddress()
Definition: XBOXONE.h:78
-
#define EP_MAXPKTSIZE
Definition: XBOXONE.h:30
-
bool getButtonClick(ButtonEnum b)
Definition: XBOXONE.cpp:324
-
virtual uint8_t Poll()
Definition: XBOXONE.cpp:237
-
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXONE.cpp:43
-
Definition: UsbCore.h:197
-
int16_t getAnalogHat(AnalogHatEnum a)
Definition: XBOXONE.cpp:344
-
#define XBOX_ONE_PID
Definition: XBOXONE.h:39
- -
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: XBOXONE.h:96
+
#define XBOX_VID3
Definition: XBOXONE.h:50
+
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: XBOXONE.cpp:239
+
uint8_t bNumEP
Definition: XBOXONE.h:187
+
#define XBOX_VID6
Definition: XBOXONE.h:53
+
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: XBOXONE.cpp:259
+
bool XboxOneConnected
Definition: XBOXONE.h:174
+
#define XBOX_ONE_MAX_ENDPOINTS
Definition: XBOXONE.h:37
+
#define XBOX_VID2
Definition: XBOXONE.h:49
+
void setRumbleOff()
Definition: XBOXONE.cpp:442
+
#define XBOX_ONE_PID8
Definition: XBOXONE.h:58
+
virtual uint8_t Release()
Definition: XBOXONE.cpp:278
+
#define XBOX_VID4
Definition: XBOXONE.h:51
+
Definition: address.h:39
+
ButtonEnum
+
uint16_t getButtonPress(ButtonEnum b)
Definition: XBOXONE.cpp:372
+
virtual uint8_t GetAddress()
Definition: XBOXONE.h:97
+
uint32_t qNextPollTime
Definition: XBOXONE.h:189
+
#define XBOX_ONE_PID2
Definition: XBOXONE.h:44
+
EpInfo epInfo[XBOX_ONE_MAX_ENDPOINTS]
Definition: XBOXONE.h:182
+ +
bool getButtonClick(ButtonEnum b)
Definition: XBOXONE.cpp:380
+
uint8_t readPollInterval()
Definition: XBOXONE.h:113
+
virtual uint8_t Poll()
Definition: XBOXONE.cpp:292
+
#define XBOX_ONE_PID11
Definition: XBOXONE.h:61
+
#define XBOX_ONE_PID4
Definition: XBOXONE.h:46
+
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXONE.cpp:46
+
#define XBOX_ONE_PID7
Definition: XBOXONE.h:57
+
#define XBOX_ONE_PID12
Definition: XBOXONE.h:62
+
Definition: UsbCore.h:208
+
#define XBOX_VID5
Definition: XBOXONE.h:52
+
#define XBOX_ONE_PID6
Definition: XBOXONE.h:56
+
int16_t getAnalogHat(AnalogHatEnum a)
Definition: XBOXONE.cpp:400
+
#define XBOX_VID1
Definition: XBOXONE.h:42
+ +
#define XBOX_ONE_PID1
Definition: XBOXONE.h:43
+
#define XBOX_ONE_PID3
Definition: XBOXONE.h:45
+
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: XBOXONE.h:123
+
void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)
Definition: XBOXONE.cpp:464
diff --git a/_x_b_o_x_r_e_c_v_8cpp.html b/_x_b_o_x_r_e_c_v_8cpp.html index 91c53db9..a44cd1c3 100644 --- a/_x_b_o_x_r_e_c_v_8cpp.html +++ b/_x_b_o_x_r_e_c_v_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXRECV.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/_x_b_o_x_r_e_c_v_8cpp__incl.md5 b/_x_b_o_x_r_e_c_v_8cpp__incl.md5 index b0488834..e9c2cced 100644 --- a/_x_b_o_x_r_e_c_v_8cpp__incl.md5 +++ b/_x_b_o_x_r_e_c_v_8cpp__incl.md5 @@ -1 +1 @@ -afd0356fb2e414737dbcea38c7c8282b \ No newline at end of file +6ca63669978b108ea8fd430b01be5e9e \ No newline at end of file diff --git a/_x_b_o_x_r_e_c_v_8cpp__incl.png b/_x_b_o_x_r_e_c_v_8cpp__incl.png index 15938116..98e61932 100644 Binary files a/_x_b_o_x_r_e_c_v_8cpp__incl.png and b/_x_b_o_x_r_e_c_v_8cpp__incl.png differ diff --git a/_x_b_o_x_r_e_c_v_8cpp_source.html b/_x_b_o_x_r_e_c_v_8cpp_source.html index b20d418a..db819b8c 100644 --- a/_x_b_o_x_r_e_c_v_8cpp_source.html +++ b/_x_b_o_x_r_e_c_v_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXRECV.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
XBOXRECV.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16 
17  getBatteryLevel and checkStatus functions made by timstamp.co.uk found using BusHound from Perisoft.net
18  */
19 
20 #include "XBOXRECV.h"
21 // To enable serial debugging see "settings.h"
22 //#define EXTRADEBUG // Uncomment to get even more debugging data
23 //#define PRINTREPORT // Uncomment to print the report send by the Xbox 360 Controller
24 
26 pUsb(p), // pointer to USB class instance - mandatory
27 bAddress(0), // device address - mandatory
28 bPollEnable(false) { // don't start polling before dongle is connected
29  for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
30  epInfo[i].epAddr = 0;
31  epInfo[i].maxPktSize = (i) ? 0 : 8;
32  epInfo[i].bmSndToggle = 0;
33  epInfo[i].bmRcvToggle = 0;
35  }
36 
37  if(pUsb) // register in USB subsystem
38  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
39 }
40 
41 uint8_t XBOXRECV::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
42  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
43  uint8_t buf[constBufSize];
44  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
45  uint8_t rcode;
46  UsbDevice *p = NULL;
47  EpInfo *oldep_ptr = NULL;
48  uint16_t PID, VID;
49 
50  AddressPool &addrPool = pUsb->GetAddressPool(); // Get memory address of USB device address pool
51 #ifdef EXTRADEBUG
52  Notify(PSTR("\r\nXBOXRECV Init"), 0x80);
53 #endif
54 
55  if(bAddress) { // Check if address has already been assigned to an instance
56 #ifdef DEBUG_USB_HOST
57  Notify(PSTR("\r\nAddress in use"), 0x80);
58 #endif
60  }
61 
62  p = addrPool.GetUsbDevicePtr(0); // Get pointer to pseudo device with address 0 assigned
63 
64  if(!p) {
65 #ifdef DEBUG_USB_HOST
66  Notify(PSTR("\r\nAddress not found"), 0x80);
67 #endif
69  }
70 
71  if(!p->epinfo) {
72 #ifdef DEBUG_USB_HOST
73  Notify(PSTR("\r\nepinfo is null"), 0x80);
74 #endif
76  }
77 
78  oldep_ptr = p->epinfo; // Save old pointer to EP_RECORD of address 0
79  p->epinfo = epInfo; // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
80  p->lowspeed = lowspeed;
81 
82  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
83 
84  p->epinfo = oldep_ptr; // Restore p->epinfo
85 
86  if(rcode)
87  goto FailGetDevDescr;
88 
89  VID = udd->idVendor;
90  PID = udd->idProduct;
91 
92  if((VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) || (PID != XBOX_WIRELESS_RECEIVER_PID && PID != XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID)) { // Check if it's a Xbox receiver using the Vendor ID and Product ID
93 #ifdef DEBUG_USB_HOST
94  Notify(PSTR("\r\nYou'll need a wireless receiver for this libary to work"), 0x80);
95 #endif
96  goto FailUnknownDevice;
97  }
98 
99  bAddress = addrPool.AllocAddress(parent, false, port); // Allocate new address according to device class
100 
101  if(!bAddress) {
102 #ifdef DEBUG_USB_HOST
103  Notify(PSTR("\r\nOut of address space"), 0x80);
104 #endif
106  }
107 
108  epInfo[0].maxPktSize = udd->bMaxPacketSize0; // Extract Max Packet Size from device descriptor
109 
110  delay(20); // Wait a little before resetting device
111 
113 
114  /* Diagnostic messages */
115 FailGetDevDescr:
116 #ifdef DEBUG_USB_HOST
117  NotifyFailGetDevDescr(rcode);
118 #endif
119  if(rcode != hrJERR)
121  goto Fail;
122 
123 FailUnknownDevice:
124 #ifdef DEBUG_USB_HOST
125  NotifyFailUnknownDevice(VID, PID);
126 #endif
128 
129 Fail:
130 #ifdef DEBUG_USB_HOST
131  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
132  NotifyFail(rcode);
133 #endif
134  Release();
135  return rcode;
136 };
137 
138 uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
139  uint8_t rcode;
140 
141  AddressPool &addrPool = pUsb->GetAddressPool();
142 #ifdef EXTRADEBUG
143  Notify(PSTR("\r\nBTD Init"), 0x80);
144 #endif
145  UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
146 
147  if(!p) {
148 #ifdef DEBUG_USB_HOST
149  Notify(PSTR("\r\nAddress not found"), 0x80);
150 #endif
152  }
153 
154  delay(300); // Assign new address to the device
155 
156  rcode = pUsb->setAddr(0, 0, bAddress); // Assign new address to the device
157  if(rcode) {
158 #ifdef DEBUG_USB_HOST
159  Notify(PSTR("\r\nsetAddr: "), 0x80);
160  D_PrintHex<uint8_t > (rcode, 0x80);
161 #endif
162  p->lowspeed = false;
163  goto Fail;
164  }
165 #ifdef EXTRADEBUG
166  Notify(PSTR("\r\nAddr: "), 0x80);
167  D_PrintHex<uint8_t > (bAddress, 0x80);
168 #endif
169 
170  p->lowspeed = false;
171 
172  p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
173  if(!p) {
174 #ifdef DEBUG_USB_HOST
175  Notify(PSTR("\r\nAddress not found"), 0x80);
176 #endif
178  }
179 
180  p->lowspeed = lowspeed;
181 
182  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo); // Assign epInfo to epinfo pointer - only EP0 is known
183  if(rcode)
184  goto FailSetDevTblEntry;
185 
186  /* The application will work in reduced host mode, so we can save program and data
187  memory space. After verifying the VID we will use known values for the
188  configuration values for device, interface, endpoints and HID for the XBOX360 Wireless receiver */
189 
190  /* Initialize data structures for endpoints of device */
191  epInfo[ XBOX_INPUT_PIPE_1 ].epAddr = 0x01; // XBOX 360 report endpoint - poll interval 1ms
193  epInfo[ XBOX_INPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
197  epInfo[ XBOX_OUTPUT_PIPE_1 ].epAddr = 0x01; // XBOX 360 output endpoint - poll interval 8ms
199  epInfo[ XBOX_OUTPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
203 
204  epInfo[ XBOX_INPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 report endpoint - poll interval 1ms
206  epInfo[ XBOX_INPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
210  epInfo[ XBOX_OUTPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 output endpoint - poll interval 8ms
212  epInfo[ XBOX_OUTPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
216 
217  epInfo[ XBOX_INPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 report endpoint - poll interval 1ms
219  epInfo[ XBOX_INPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
223  epInfo[ XBOX_OUTPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 output endpoint - poll interval 8ms
225  epInfo[ XBOX_OUTPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
229 
230  epInfo[ XBOX_INPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 report endpoint - poll interval 1ms
232  epInfo[ XBOX_INPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
236  epInfo[ XBOX_OUTPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 output endpoint - poll interval 8ms
238  epInfo[ XBOX_OUTPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
242 
243  rcode = pUsb->setEpInfoEntry(bAddress, 9, epInfo);
244  if(rcode)
245  goto FailSetDevTblEntry;
246 
247  delay(200); //Give time for address change
248 
249  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
250  if(rcode)
251  goto FailSetConfDescr;
252 
253 #ifdef DEBUG_USB_HOST
254  Notify(PSTR("\r\nXbox Wireless Receiver Connected\r\n"), 0x80);
255 #endif
256  XboxReceiverConnected = true;
257  bPollEnable = true;
258  checkStatusTimer = 0; // Reset timer
259  return 0; // Successful configuration
260 
261  /* Diagnostic messages */
262 FailSetDevTblEntry:
263 #ifdef DEBUG_USB_HOST
265  goto Fail;
266 #endif
267 
268 FailSetConfDescr:
269 #ifdef DEBUG_USB_HOST
271 #endif
272 
273 Fail:
274 #ifdef DEBUG_USB_HOST
275  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
276  NotifyFail(rcode);
277 #endif
278  Release();
279  return rcode;
280 }
281 
282 /* Performs a cleanup after failed Init() attempt */
283 uint8_t XBOXRECV::Release() {
284  XboxReceiverConnected = false;
285  for(uint8_t i = 0; i < 4; i++)
286  Xbox360Connected[i] = 0x00;
288  bAddress = 0;
289  bPollEnable = false;
290  return 0;
291 }
292 
293 uint8_t XBOXRECV::Poll() {
294  if(!bPollEnable)
295  return 0;
296  if(!checkStatusTimer || ((millis() - checkStatusTimer) > 3000)) { // Run checkStatus every 3 seconds
297  checkStatusTimer = millis();
298  checkStatus();
299  }
300 
301  uint8_t inputPipe;
302  uint16_t bufferSize;
303  for(uint8_t i = 0; i < 4; i++) {
304  if(i == 0)
305  inputPipe = XBOX_INPUT_PIPE_1;
306  else if(i == 1)
307  inputPipe = XBOX_INPUT_PIPE_2;
308  else if(i == 2)
309  inputPipe = XBOX_INPUT_PIPE_3;
310  else
311  inputPipe = XBOX_INPUT_PIPE_4;
312 
313  bufferSize = EP_MAXPKTSIZE; // This is the maximum number of bytes we want to receive
314  pUsb->inTransfer(bAddress, epInfo[ inputPipe ].epAddr, &bufferSize, readBuf);
315  if(bufferSize > 0) { // The number of received bytes
316 #ifdef EXTRADEBUG
317  Notify(PSTR("Bytes Received: "), 0x80);
318  D_PrintHex<uint16_t > (bufferSize, 0x80);
319  Notify(PSTR("\r\n"), 0x80);
320 #endif
321  readReport(i);
322 #ifdef PRINTREPORT
323  printReport(i, bufferSize); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
324 #endif
325  }
326  }
327  return 0;
328 }
329 
330 void XBOXRECV::readReport(uint8_t controller) {
331  if(readBuf == NULL)
332  return;
333  // This report is send when a controller is connected and disconnected
334  if(readBuf[0] == 0x08 && readBuf[1] != Xbox360Connected[controller]) {
335  Xbox360Connected[controller] = readBuf[1];
336 #ifdef DEBUG_USB_HOST
337  Notify(PSTR("Controller "), 0x80);
338  Notify(controller, 0x80);
339 #endif
340  if(Xbox360Connected[controller]) {
341 #ifdef DEBUG_USB_HOST
342  const char* str = 0;
343  switch(readBuf[1]) {
344  case 0x80: str = PSTR(" as controller\r\n");
345  break;
346  case 0x40: str = PSTR(" as headset\r\n");
347  break;
348  case 0xC0: str = PSTR(" as controller+headset\r\n");
349  break;
350  }
351  Notify(PSTR(": connected"), 0x80);
352  Notify(str, 0x80);
353 #endif
354  onInit(controller);
355  }
356 #ifdef DEBUG_USB_HOST
357  else
358  Notify(PSTR(": disconnected\r\n"), 0x80);
359 #endif
360  return;
361  }
362  // Controller status report
363  if(readBuf[1] == 0x00 && readBuf[3] & 0x13 && readBuf[4] >= 0x22) {
364  controllerStatus[controller] = ((uint16_t)readBuf[3] << 8) | readBuf[4];
365  return;
366  }
367  if(readBuf[1] != 0x01) // Check if it's the correct report - the receiver also sends different status reports
368  return;
369 
370  // A controller must be connected if it's sending data
371  if(!Xbox360Connected[controller])
372  Xbox360Connected[controller] |= 0x80;
373 
374  ButtonState[controller] = (uint32_t)(readBuf[9] | ((uint16_t)readBuf[8] << 8) | ((uint32_t)readBuf[7] << 16) | ((uint32_t)readBuf[6] << 24));
375 
376  hatValue[controller][LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
377  hatValue[controller][LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
378  hatValue[controller][RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
379  hatValue[controller][RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
380 
381  //Notify(PSTR("\r\nButtonState: "), 0x80);
382  //PrintHex<uint32_t>(ButtonState[controller], 0x80);
383 
384  if(ButtonState[controller] != OldButtonState[controller]) {
385  buttonStateChanged[controller] = true;
386  ButtonClickState[controller] = (ButtonState[controller] >> 16) & ((~OldButtonState[controller]) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
387  if(((uint8_t)OldButtonState[controller]) == 0 && ((uint8_t)ButtonState[controller]) != 0) // The L2 and R2 buttons are special as they are analog buttons
388  R2Clicked[controller] = true;
389  if((uint8_t)(OldButtonState[controller] >> 8) == 0 && (uint8_t)(ButtonState[controller] >> 8) != 0)
390  L2Clicked[controller] = true;
391  OldButtonState[controller] = ButtonState[controller];
392  }
393 }
394 
395 void XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
396 #ifdef PRINTREPORT
397  if(readBuf == NULL)
398  return;
399  Notify(PSTR("Controller "), 0x80);
400  Notify(controller, 0x80);
401  Notify(PSTR(": "), 0x80);
402  for(uint8_t i = 0; i < nBytes; i++) {
403  D_PrintHex<uint8_t > (readBuf[i], 0x80);
404  Notify(PSTR(" "), 0x80);
405  }
406  Notify(PSTR("\r\n"), 0x80);
407 #endif
408 }
409 
410 uint8_t XBOXRECV::getButtonPress(ButtonEnum b, uint8_t controller) {
411  if(b == L2) // These are analog buttons
412  return (uint8_t)(ButtonState[controller] >> 8);
413  else if(b == R2)
414  return (uint8_t)ButtonState[controller];
415  return (bool)(ButtonState[controller] & ((uint32_t)pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]) << 16));
416 }
417 
418 bool XBOXRECV::getButtonClick(ButtonEnum b, uint8_t controller) {
419  if(b == L2) {
420  if(L2Clicked[controller]) {
421  L2Clicked[controller] = false;
422  return true;
423  }
424  return false;
425  } else if(b == R2) {
426  if(R2Clicked[controller]) {
427  R2Clicked[controller] = false;
428  return true;
429  }
430  return false;
431  }
432  uint16_t button = pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]);
433  bool click = (ButtonClickState[controller] & button);
434  ButtonClickState[controller] &= ~button; // clear "click" event
435  return click;
436 }
437 
438 int16_t XBOXRECV::getAnalogHat(AnalogHatEnum a, uint8_t controller) {
439  return hatValue[controller][a];
440 }
441 
442 bool XBOXRECV::buttonChanged(uint8_t controller) {
443  bool state = buttonStateChanged[controller];
444  buttonStateChanged[controller] = false;
445  return state;
446 }
447 
448 /*
449 ControllerStatus Breakdown
450 ControllerStatus[controller] & 0x0001 // 0
451 ControllerStatus[controller] & 0x0002 // normal batteries, no rechargeable battery pack
452 ControllerStatus[controller] & 0x0004 // controller starting up / settling
453 ControllerStatus[controller] & 0x0008 // headset adapter plugged in, but no headphones connected (mute?)
454 ControllerStatus[controller] & 0x0010 // 0
455 ControllerStatus[controller] & 0x0020 // 1
456 ControllerStatus[controller] & 0x0040 // battery level (high bit)
457 ControllerStatus[controller] & 0x0080 // battery level (low bit)
458 ControllerStatus[controller] & 0x0100 // 1
459 ControllerStatus[controller] & 0x0200 // 1
460 ControllerStatus[controller] & 0x0400 // headset adapter plugged in
461 ControllerStatus[controller] & 0x0800 // 0
462 ControllerStatus[controller] & 0x1000 // 1
463 ControllerStatus[controller] & 0x2000 // 0
464 ControllerStatus[controller] & 0x4000 // 0
465 ControllerStatus[controller] & 0x8000 // 0
466  */
467 uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
468  return ((controllerStatus[controller] & 0x00C0) >> 6);
469 }
470 
471 void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
472 #ifdef EXTRADEBUG
473  uint8_t rcode;
474 #endif
475  uint8_t outputPipe;
476  switch(controller) {
477  case 0: outputPipe = XBOX_OUTPUT_PIPE_1;
478  break;
479  case 1: outputPipe = XBOX_OUTPUT_PIPE_2;
480  break;
481  case 2: outputPipe = XBOX_OUTPUT_PIPE_3;
482  break;
483  case 3: outputPipe = XBOX_OUTPUT_PIPE_4;
484  break;
485  default:
486  return;
487  }
488 #ifdef EXTRADEBUG
489  rcode =
490 #endif
491  pUsb->outTransfer(bAddress, epInfo[ outputPipe ].epAddr, nbytes, data);
492 #ifdef EXTRADEBUG
493  if(rcode)
494  Notify(PSTR("Error sending Xbox message\r\n"), 0x80);
495 #endif
496 }
497 
498 void XBOXRECV::disconnect(uint8_t controller) {
499  writeBuf[0] = 0x00;
500  writeBuf[1] = 0x00;
501  writeBuf[2] = 0x08;
502  writeBuf[3] = 0xC0;
503 
504  XboxCommand(controller, writeBuf, 4);
505 }
506 
507 void XBOXRECV::setLedRaw(uint8_t value, uint8_t controller) {
508  writeBuf[0] = 0x00;
509  writeBuf[1] = 0x00;
510  writeBuf[2] = 0x08;
511  writeBuf[3] = value | 0x40;
512 
513  XboxCommand(controller, writeBuf, 4);
514 }
515 
516 void XBOXRECV::setLedOn(LEDEnum led, uint8_t controller) {
517  if(led == OFF)
518  setLedRaw(0, controller);
519  else if(led != ALL) // All LEDs can't be on a the same time
520  setLedRaw(pgm_read_byte(&XBOX_LEDS[(uint8_t)led]) + 4, controller);
521 }
522 
523 void XBOXRECV::setLedBlink(LEDEnum led, uint8_t controller) {
524  setLedRaw(pgm_read_byte(&XBOX_LEDS[(uint8_t)led]), controller);
525 }
526 
527 void XBOXRECV::setLedMode(LEDModeEnum ledMode, uint8_t controller) { // This function is used to do some speciel LED stuff the controller supports
528  setLedRaw((uint8_t)ledMode, controller);
529 }
530 
531 /* PC runs this at interval of approx 2 seconds
532 Thanks to BusHound from Perisoft.net for the Windows USB Analysis output
533 Found by timstamp.co.uk
534  */
535 void XBOXRECV::checkStatus() {
536  if(!bPollEnable)
537  return;
538  // Get controller info
539  writeBuf[0] = 0x08;
540  writeBuf[1] = 0x00;
541  writeBuf[2] = 0x0f;
542  writeBuf[3] = 0xc0;
543  for(uint8_t i = 0; i < 4; i++) {
544  XboxCommand(i, writeBuf, 4);
545  }
546  // Get battery status
547  writeBuf[0] = 0x00;
548  writeBuf[1] = 0x00;
549  writeBuf[2] = 0x00;
550  writeBuf[3] = 0x40;
551  for(uint8_t i = 0; i < 4; i++) {
552  if(Xbox360Connected[i])
553  XboxCommand(i, writeBuf, 4);
554  }
555 }
556 
557 void XBOXRECV::setRumbleOn(uint8_t lValue, uint8_t rValue, uint8_t controller) {
558  writeBuf[0] = 0x00;
559  writeBuf[1] = 0x01;
560  writeBuf[2] = 0x0f;
561  writeBuf[3] = 0xc0;
562  writeBuf[4] = 0x00;
563  writeBuf[5] = lValue; // big weight
564  writeBuf[6] = rValue; // small weight
565 
566  XboxCommand(controller, writeBuf, 7);
567 }
568 
569 void XBOXRECV::onInit(uint8_t controller) {
570  if(pFuncOnInit)
571  pFuncOnInit(); // Call the user function
572  else {
573  LEDEnum led;
574  if(controller == 0)
575  led = static_cast<LEDEnum>(LED1);
576  else if(controller == 1)
577  led = static_cast<LEDEnum>(LED2);
578  else if(controller == 2)
579  led = static_cast<LEDEnum>(LED3);
580  else
581  led = static_cast<LEDEnum>(LED4);
582  setLedOn(led, controller);
583  }
584 }
uint8_t bmRcvToggle
Definition: address.h:41
- +Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16 
17  getBatteryLevel and checkStatus functions made by timstamp.co.uk found using BusHound from Perisoft.net
18  */
19 
20 #include "XBOXRECV.h"
21 // To enable serial debugging see "settings.h"
22 //#define EXTRADEBUG // Uncomment to get even more debugging data
23 //#define PRINTREPORT // Uncomment to print the report send by the Xbox 360 Controller
24 
26 pUsb(p), // pointer to USB class instance - mandatory
27 bAddress(0), // device address - mandatory
28 bPollEnable(false) { // don't start polling before dongle is connected
29  for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
30  epInfo[i].epAddr = 0;
31  epInfo[i].maxPktSize = (i) ? 0 : 8;
32  epInfo[i].bmSndToggle = 0;
33  epInfo[i].bmRcvToggle = 0;
35  }
36 
37  if(pUsb) // register in USB subsystem
38  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
39 }
40 
41 uint8_t XBOXRECV::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
42  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
43  uint8_t buf[constBufSize];
44  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
45  uint8_t rcode;
46  UsbDevice *p = NULL;
47  EpInfo *oldep_ptr = NULL;
48  uint16_t PID, VID;
49 
50  AddressPool &addrPool = pUsb->GetAddressPool(); // Get memory address of USB device address pool
51 #ifdef EXTRADEBUG
52  Notify(PSTR("\r\nXBOXRECV Init"), 0x80);
53 #endif
54 
55  if(bAddress) { // Check if address has already been assigned to an instance
56 #ifdef DEBUG_USB_HOST
57  Notify(PSTR("\r\nAddress in use"), 0x80);
58 #endif
60  }
61 
62  p = addrPool.GetUsbDevicePtr(0); // Get pointer to pseudo device with address 0 assigned
63 
64  if(!p) {
65 #ifdef DEBUG_USB_HOST
66  Notify(PSTR("\r\nAddress not found"), 0x80);
67 #endif
69  }
70 
71  if(!p->epinfo) {
72 #ifdef DEBUG_USB_HOST
73  Notify(PSTR("\r\nepinfo is null"), 0x80);
74 #endif
76  }
77 
78  oldep_ptr = p->epinfo; // Save old pointer to EP_RECORD of address 0
79  p->epinfo = epInfo; // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
80  p->lowspeed = lowspeed;
81 
82  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
83 
84  p->epinfo = oldep_ptr; // Restore p->epinfo
85 
86  if(rcode)
87  goto FailGetDevDescr;
88 
89  VID = udd->idVendor;
90  PID = udd->idProduct;
91 
92  if((VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) || (PID != XBOX_WIRELESS_RECEIVER_PID && PID != XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID)) { // Check if it's a Xbox receiver using the Vendor ID and Product ID
93 #ifdef DEBUG_USB_HOST
94  Notify(PSTR("\r\nYou'll need a wireless receiver for this libary to work"), 0x80);
95 #endif
96  goto FailUnknownDevice;
97  }
98 
99  bAddress = addrPool.AllocAddress(parent, false, port); // Allocate new address according to device class
100 
101  if(!bAddress) {
102 #ifdef DEBUG_USB_HOST
103  Notify(PSTR("\r\nOut of address space"), 0x80);
104 #endif
106  }
107 
108  epInfo[0].maxPktSize = udd->bMaxPacketSize0; // Extract Max Packet Size from device descriptor
109 
110  delay(20); // Wait a little before resetting device
111 
113 
114  /* Diagnostic messages */
115 FailGetDevDescr:
116 #ifdef DEBUG_USB_HOST
117  NotifyFailGetDevDescr(rcode);
118 #endif
119  if(rcode != hrJERR)
121  goto Fail;
122 
123 FailUnknownDevice:
124 #ifdef DEBUG_USB_HOST
125  NotifyFailUnknownDevice(VID, PID);
126 #endif
128 
129 Fail:
130 #ifdef DEBUG_USB_HOST
131  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
132  NotifyFail(rcode);
133 #endif
134  Release();
135  return rcode;
136 };
137 
138 uint8_t XBOXRECV::Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed) {
139  uint8_t rcode;
140 
141  AddressPool &addrPool = pUsb->GetAddressPool();
142 #ifdef EXTRADEBUG
143  Notify(PSTR("\r\nBTD Init"), 0x80);
144 #endif
145  UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
146 
147  if(!p) {
148 #ifdef DEBUG_USB_HOST
149  Notify(PSTR("\r\nAddress not found"), 0x80);
150 #endif
152  }
153 
154  delay(300); // Assign new address to the device
155 
156  rcode = pUsb->setAddr(0, 0, bAddress); // Assign new address to the device
157  if(rcode) {
158 #ifdef DEBUG_USB_HOST
159  Notify(PSTR("\r\nsetAddr: "), 0x80);
160  D_PrintHex<uint8_t > (rcode, 0x80);
161 #endif
162  p->lowspeed = false;
163  goto Fail;
164  }
165 #ifdef EXTRADEBUG
166  Notify(PSTR("\r\nAddr: "), 0x80);
167  D_PrintHex<uint8_t > (bAddress, 0x80);
168 #endif
169 
170  p->lowspeed = false;
171 
172  p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
173  if(!p) {
174 #ifdef DEBUG_USB_HOST
175  Notify(PSTR("\r\nAddress not found"), 0x80);
176 #endif
178  }
179 
180  p->lowspeed = lowspeed;
181 
182  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo); // Assign epInfo to epinfo pointer - only EP0 is known
183  if(rcode)
184  goto FailSetDevTblEntry;
185 
186  /* The application will work in reduced host mode, so we can save program and data
187  memory space. After verifying the VID we will use known values for the
188  configuration values for device, interface, endpoints and HID for the XBOX360 Wireless receiver */
189 
190  /* Initialize data structures for endpoints of device */
191  epInfo[ XBOX_INPUT_PIPE_1 ].epAddr = 0x01; // XBOX 360 report endpoint - poll interval 1ms
193  epInfo[ XBOX_INPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
197  epInfo[ XBOX_OUTPUT_PIPE_1 ].epAddr = 0x01; // XBOX 360 output endpoint - poll interval 8ms
199  epInfo[ XBOX_OUTPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
203 
204  epInfo[ XBOX_INPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 report endpoint - poll interval 1ms
206  epInfo[ XBOX_INPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
210  epInfo[ XBOX_OUTPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 output endpoint - poll interval 8ms
212  epInfo[ XBOX_OUTPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
216 
217  epInfo[ XBOX_INPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 report endpoint - poll interval 1ms
219  epInfo[ XBOX_INPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
223  epInfo[ XBOX_OUTPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 output endpoint - poll interval 8ms
225  epInfo[ XBOX_OUTPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
229 
230  epInfo[ XBOX_INPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 report endpoint - poll interval 1ms
232  epInfo[ XBOX_INPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
236  epInfo[ XBOX_OUTPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 output endpoint - poll interval 8ms
238  epInfo[ XBOX_OUTPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
242 
243  rcode = pUsb->setEpInfoEntry(bAddress, 9, epInfo);
244  if(rcode)
245  goto FailSetDevTblEntry;
246 
247  delay(200); //Give time for address change
248 
249  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
250  if(rcode)
251  goto FailSetConfDescr;
252 
253 #ifdef DEBUG_USB_HOST
254  Notify(PSTR("\r\nXbox Wireless Receiver Connected\r\n"), 0x80);
255 #endif
256  XboxReceiverConnected = true;
257  bPollEnable = true;
258  checkStatusTimer = 0; // Reset timer
259  return 0; // Successful configuration
260 
261  /* Diagnostic messages */
262 FailSetDevTblEntry:
263 #ifdef DEBUG_USB_HOST
265  goto Fail;
266 #endif
267 
268 FailSetConfDescr:
269 #ifdef DEBUG_USB_HOST
271 #endif
272 
273 Fail:
274 #ifdef DEBUG_USB_HOST
275  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
276  NotifyFail(rcode);
277 #endif
278  Release();
279  return rcode;
280 }
281 
282 /* Performs a cleanup after failed Init() attempt */
283 uint8_t XBOXRECV::Release() {
284  XboxReceiverConnected = false;
285  for(uint8_t i = 0; i < 4; i++)
286  Xbox360Connected[i] = 0x00;
288  bAddress = 0;
289  bPollEnable = false;
290  return 0;
291 }
292 
293 uint8_t XBOXRECV::Poll() {
294  if(!bPollEnable)
295  return 0;
296  if(!checkStatusTimer || ((int32_t)((uint32_t)millis() - checkStatusTimer) > 3000)) { // Run checkStatus every 3 seconds
297  checkStatusTimer = (uint32_t)millis();
298  checkStatus();
299  }
300 
301  uint8_t inputPipe;
302  uint16_t bufferSize;
303  for(uint8_t i = 0; i < 4; i++) {
304  if(i == 0)
305  inputPipe = XBOX_INPUT_PIPE_1;
306  else if(i == 1)
307  inputPipe = XBOX_INPUT_PIPE_2;
308  else if(i == 2)
309  inputPipe = XBOX_INPUT_PIPE_3;
310  else
311  inputPipe = XBOX_INPUT_PIPE_4;
312 
313  bufferSize = EP_MAXPKTSIZE; // This is the maximum number of bytes we want to receive
314  pUsb->inTransfer(bAddress, epInfo[ inputPipe ].epAddr, &bufferSize, readBuf);
315  if(bufferSize > 0) { // The number of received bytes
316 #ifdef EXTRADEBUG
317  Notify(PSTR("Bytes Received: "), 0x80);
318  D_PrintHex<uint16_t > (bufferSize, 0x80);
319  Notify(PSTR("\r\n"), 0x80);
320 #endif
321  readReport(i);
322 #ifdef PRINTREPORT
323  printReport(i, bufferSize); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
324 #endif
325  }
326  }
327  return 0;
328 }
329 
330 void XBOXRECV::readReport(uint8_t controller) {
331  if(readBuf == NULL)
332  return;
333  // This report is send when a controller is connected and disconnected
334  if(readBuf[0] == 0x08 && readBuf[1] != Xbox360Connected[controller]) {
335  Xbox360Connected[controller] = readBuf[1];
336 #ifdef DEBUG_USB_HOST
337  Notify(PSTR("Controller "), 0x80);
338  Notify(controller, 0x80);
339 #endif
340  if(Xbox360Connected[controller]) {
341 #ifdef DEBUG_USB_HOST
342  const char* str = 0;
343  switch(readBuf[1]) {
344  case 0x80: str = PSTR(" as controller\r\n");
345  break;
346  case 0x40: str = PSTR(" as headset\r\n");
347  break;
348  case 0xC0: str = PSTR(" as controller+headset\r\n");
349  break;
350  }
351  Notify(PSTR(": connected"), 0x80);
352  Notify(str, 0x80);
353 #endif
354  onInit(controller);
355  }
356 #ifdef DEBUG_USB_HOST
357  else
358  Notify(PSTR(": disconnected\r\n"), 0x80);
359 #endif
360  return;
361  }
362  // Controller status report
363  if(readBuf[1] == 0x00 && readBuf[3] & 0x13 && readBuf[4] >= 0x22) {
364  controllerStatus[controller] = ((uint16_t)readBuf[3] << 8) | readBuf[4];
365  return;
366  }
367  if(readBuf[1] != 0x01) // Check if it's the correct report - the receiver also sends different status reports
368  return;
369 
370  // A controller must be connected if it's sending data
371  if(!Xbox360Connected[controller])
372  Xbox360Connected[controller] |= 0x80;
373 
374  ButtonState[controller] = (uint32_t)(readBuf[9] | ((uint16_t)readBuf[8] << 8) | ((uint32_t)readBuf[7] << 16) | ((uint32_t)readBuf[6] << 24));
375 
376  hatValue[controller][LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
377  hatValue[controller][LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
378  hatValue[controller][RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
379  hatValue[controller][RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
380 
381  //Notify(PSTR("\r\nButtonState: "), 0x80);
382  //PrintHex<uint32_t>(ButtonState[controller], 0x80);
383 
384  if(ButtonState[controller] != OldButtonState[controller]) {
385  buttonStateChanged[controller] = true;
386  ButtonClickState[controller] = (ButtonState[controller] >> 16) & ((~OldButtonState[controller]) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
387  if(((uint8_t)OldButtonState[controller]) == 0 && ((uint8_t)ButtonState[controller]) != 0) // The L2 and R2 buttons are special as they are analog buttons
388  R2Clicked[controller] = true;
389  if((uint8_t)(OldButtonState[controller] >> 8) == 0 && (uint8_t)(ButtonState[controller] >> 8) != 0)
390  L2Clicked[controller] = true;
391  OldButtonState[controller] = ButtonState[controller];
392  }
393 }
394 
395 void XBOXRECV::printReport(uint8_t controller __attribute__((unused)), uint8_t nBytes __attribute__((unused))) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
396 #ifdef PRINTREPORT
397  if(readBuf == NULL)
398  return;
399  Notify(PSTR("Controller "), 0x80);
400  Notify(controller, 0x80);
401  Notify(PSTR(": "), 0x80);
402  for(uint8_t i = 0; i < nBytes; i++) {
403  D_PrintHex<uint8_t > (readBuf[i], 0x80);
404  Notify(PSTR(" "), 0x80);
405  }
406  Notify(PSTR("\r\n"), 0x80);
407 #endif
408 }
409 
410 uint8_t XBOXRECV::getButtonPress(ButtonEnum b, uint8_t controller) {
411  if(b == L2) // These are analog buttons
412  return (uint8_t)(ButtonState[controller] >> 8);
413  else if(b == R2)
414  return (uint8_t)ButtonState[controller];
415  return (bool)(ButtonState[controller] & ((uint32_t)pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]) << 16));
416 }
417 
418 bool XBOXRECV::getButtonClick(ButtonEnum b, uint8_t controller) {
419  if(b == L2) {
420  if(L2Clicked[controller]) {
421  L2Clicked[controller] = false;
422  return true;
423  }
424  return false;
425  } else if(b == R2) {
426  if(R2Clicked[controller]) {
427  R2Clicked[controller] = false;
428  return true;
429  }
430  return false;
431  }
432  uint16_t button = pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]);
433  bool click = (ButtonClickState[controller] & button);
434  ButtonClickState[controller] &= ~button; // clear "click" event
435  return click;
436 }
437 
438 int16_t XBOXRECV::getAnalogHat(AnalogHatEnum a, uint8_t controller) {
439  return hatValue[controller][a];
440 }
441 
442 bool XBOXRECV::buttonChanged(uint8_t controller) {
443  bool state = buttonStateChanged[controller];
444  buttonStateChanged[controller] = false;
445  return state;
446 }
447 
448 /*
449 ControllerStatus Breakdown
450 ControllerStatus[controller] & 0x0001 // 0
451 ControllerStatus[controller] & 0x0002 // normal batteries, no rechargeable battery pack
452 ControllerStatus[controller] & 0x0004 // controller starting up / settling
453 ControllerStatus[controller] & 0x0008 // headset adapter plugged in, but no headphones connected (mute?)
454 ControllerStatus[controller] & 0x0010 // 0
455 ControllerStatus[controller] & 0x0020 // 1
456 ControllerStatus[controller] & 0x0040 // battery level (high bit)
457 ControllerStatus[controller] & 0x0080 // battery level (low bit)
458 ControllerStatus[controller] & 0x0100 // 1
459 ControllerStatus[controller] & 0x0200 // 1
460 ControllerStatus[controller] & 0x0400 // headset adapter plugged in
461 ControllerStatus[controller] & 0x0800 // 0
462 ControllerStatus[controller] & 0x1000 // 1
463 ControllerStatus[controller] & 0x2000 // 0
464 ControllerStatus[controller] & 0x4000 // 0
465 ControllerStatus[controller] & 0x8000 // 0
466  */
467 uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
468  return ((controllerStatus[controller] & 0x00C0) >> 6);
469 }
470 
471 void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
472 #ifdef EXTRADEBUG
473  uint8_t rcode;
474 #endif
475  uint8_t outputPipe;
476  switch(controller) {
477  case 0: outputPipe = XBOX_OUTPUT_PIPE_1;
478  break;
479  case 1: outputPipe = XBOX_OUTPUT_PIPE_2;
480  break;
481  case 2: outputPipe = XBOX_OUTPUT_PIPE_3;
482  break;
483  case 3: outputPipe = XBOX_OUTPUT_PIPE_4;
484  break;
485  default:
486  return;
487  }
488 #ifdef EXTRADEBUG
489  rcode =
490 #endif
491  pUsb->outTransfer(bAddress, epInfo[ outputPipe ].epAddr, nbytes, data);
492 #ifdef EXTRADEBUG
493  if(rcode)
494  Notify(PSTR("Error sending Xbox message\r\n"), 0x80);
495 #endif
496 }
497 
498 void XBOXRECV::disconnect(uint8_t controller) {
499  writeBuf[0] = 0x00;
500  writeBuf[1] = 0x00;
501  writeBuf[2] = 0x08;
502  writeBuf[3] = 0xC0;
503 
504  XboxCommand(controller, writeBuf, 4);
505 }
506 
507 void XBOXRECV::setLedRaw(uint8_t value, uint8_t controller) {
508  writeBuf[0] = 0x00;
509  writeBuf[1] = 0x00;
510  writeBuf[2] = 0x08;
511  writeBuf[3] = value | 0x40;
512 
513  XboxCommand(controller, writeBuf, 4);
514 }
515 
516 void XBOXRECV::setLedOn(LEDEnum led, uint8_t controller) {
517  if(led == OFF)
518  setLedRaw(0, controller);
519  else if(led != ALL) // All LEDs can't be on a the same time
520  setLedRaw(pgm_read_byte(&XBOX_LEDS[(uint8_t)led]) + 4, controller);
521 }
522 
523 void XBOXRECV::setLedBlink(LEDEnum led, uint8_t controller) {
524  setLedRaw(pgm_read_byte(&XBOX_LEDS[(uint8_t)led]), controller);
525 }
526 
527 void XBOXRECV::setLedMode(LEDModeEnum ledMode, uint8_t controller) { // This function is used to do some speciel LED stuff the controller supports
528  setLedRaw((uint8_t)ledMode, controller);
529 }
530 
531 /* PC runs this at interval of approx 2 seconds
532 Thanks to BusHound from Perisoft.net for the Windows USB Analysis output
533 Found by timstamp.co.uk
534  */
535 void XBOXRECV::checkStatus() {
536  if(!bPollEnable)
537  return;
538  // Get controller info
539  writeBuf[0] = 0x08;
540  writeBuf[1] = 0x00;
541  writeBuf[2] = 0x0f;
542  writeBuf[3] = 0xc0;
543  for(uint8_t i = 0; i < 4; i++) {
544  XboxCommand(i, writeBuf, 4);
545  }
546  // Get battery status
547  writeBuf[0] = 0x00;
548  writeBuf[1] = 0x00;
549  writeBuf[2] = 0x00;
550  writeBuf[3] = 0x40;
551  for(uint8_t i = 0; i < 4; i++) {
552  if(Xbox360Connected[i])
553  XboxCommand(i, writeBuf, 4);
554  }
555 }
556 
557 void XBOXRECV::setRumbleOn(uint8_t lValue, uint8_t rValue, uint8_t controller) {
558  writeBuf[0] = 0x00;
559  writeBuf[1] = 0x01;
560  writeBuf[2] = 0x0f;
561  writeBuf[3] = 0xc0;
562  writeBuf[4] = 0x00;
563  writeBuf[5] = lValue; // big weight
564  writeBuf[6] = rValue; // small weight
565 
566  XboxCommand(controller, writeBuf, 7);
567 }
568 
569 void XBOXRECV::onInit(uint8_t controller) {
570  if(pFuncOnInit)
571  pFuncOnInit(); // Call the user function
572  else {
573  LEDEnum led;
574  if(controller == 0)
575  led = static_cast<LEDEnum>(LED1);
576  else if(controller == 1)
577  led = static_cast<LEDEnum>(LED2);
578  else if(controller == 2)
579  led = static_cast<LEDEnum>(LED3);
580  else
581  led = static_cast<LEDEnum>(LED4);
582  setLedOn(led, controller);
583  }
584 }
uint8_t bmRcvToggle
Definition: address.h:48
+
#define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID
Definition: XBOXRECV.h:46
- +
LEDModeEnum
Definition: xboxEnums.h:24
-
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
+
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
uint8_t Poll()
Definition: XBOXRECV.cpp:293
void setRumbleOn(uint8_t lValue, uint8_t rValue, uint8_t controller=0)
Definition: XBOXRECV.cpp:557
-
uint8_t bmNakPower
Definition: address.h:42
+
uint8_t bmNakPower
Definition: address.h:49
#define XBOX_WIRELESS_RECEIVER_PID
Definition: XBOXRECV.h:45
- +
uint8_t bAddress
Definition: XBOXRECV.h:237
- - -
#define pgm_read_word(addr)
+ + +
#define pgm_read_word(addr)
-
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:105
-
#define NotifyFail(...)
Definition: message.h:55
+
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:112
+
#define NotifyFail(...)
Definition: message.h:62
uint8_t Xbox360Connected[4]
Definition: XBOXRECV.h:231
void setLedMode(LEDModeEnum lm, uint8_t controller=0)
Definition: XBOXRECV.cpp:527
-
AnalogHatEnum
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
+
AnalogHatEnum
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
bool buttonChanged(uint8_t controller=0)
Definition: XBOXRECV.cpp:442
#define XBOX_OUTPUT_PIPE_3
Definition: XBOXRECV.h:36
uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXRECV.cpp:41
-
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:86
-
#define USB_ERROR_FailGetDevDescr
Definition: UsbCore.h:89
-
#define pgm_read_byte(addr)
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
-
#define hrJERR
Definition: max3421e.h:220
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
+
#define USB_ERROR_FailGetDevDescr
Definition: UsbCore.h:100
+
#define pgm_read_byte(addr)
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
+
#define hrJERR
Definition: max3421e.h:227
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
#define EP_MAXPKTSIZE
Definition: PS3USB.h:26
virtual void FreeAddress(uint8_t addr)=0
-
LEDEnum
-
uint8_t epAttribs
Definition: address.h:37
+
LEDEnum
+
uint8_t epAttribs
Definition: address.h:44
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
#define Notify(...)
Definition: message.h:44
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
uint8_t epAddr
Definition: address.h:33
+
#define Notify(...)
Definition: message.h:51
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
uint8_t epAddr
Definition: address.h:40
#define XBOX_INPUT_PIPE_2
Definition: XBOXRECV.h:33
-
#define NotifyFailUnknownDevice(...)
Definition: message.h:54
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
- +
#define NotifyFailUnknownDevice(...)
Definition: message.h:61
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
+
#define XBOX_VID
Definition: XBOXOLD.h:34
- +
uint8_t Release()
Definition: XBOXRECV.cpp:283
-
Definition: address.h:32
+
Definition: address.h:39
bool getButtonClick(ButtonEnum b, uint8_t controller=0)
Definition: XBOXRECV.cpp:418
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
void setLedOn(LEDEnum l, uint8_t controller=0)
Definition: XBOXRECV.cpp:516
-
ButtonEnum
+
ButtonEnum
uint8_t getButtonPress(ButtonEnum b, uint8_t controller=0)
Definition: XBOXRECV.cpp:410
bool XboxReceiverConnected
Definition: XBOXRECV.h:225
- - + +
#define JOYTECH_VID
Definition: XBOXOLD.h:36
- +
uint8_t getBatteryLevel(uint8_t controller=0)
Definition: XBOXRECV.cpp:467
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
#define XBOX_OUTPUT_PIPE_1
Definition: XBOXRECV.h:32
-
uint8_t bmSndToggle
Definition: address.h:40
+
uint8_t bmSndToggle
Definition: address.h:47
int16_t getAnalogHat(AnalogHatEnum a, uint8_t controller=0)
Definition: XBOXRECV.cpp:438
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
XBOXRECV(USB *pUsb)
Definition: XBOXRECV.cpp:25
#define MADCATZ_VID
Definition: XBOXOLD.h:35
#define XBOX_INPUT_PIPE_1
Definition: XBOXRECV.h:31
void setLedBlink(LEDEnum l, uint8_t controller=0)
Definition: XBOXRECV.cpp:523
- -
#define USB_NAK_NOWAIT
Definition: address.h:29
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
+ +
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXRECV.cpp:138
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
void setLedRaw(uint8_t value, uint8_t controller=0)
Definition: XBOXRECV.cpp:507
const uint8_t XBOX_LEDS[]
Definition: xboxEnums.h:32
-
uint16_t idProduct
Definition: usb_ch9.h:107
+
uint16_t idProduct
Definition: usb_ch9.h:114
#define XBOX_MAX_ENDPOINTS
Definition: XBOXOLD.h:43
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
Definition: UsbCore.h:197
- +
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
Definition: UsbCore.h:208
+
#define XBOX_INPUT_PIPE_3
Definition: XBOXRECV.h:35
#define XBOX_CONTROL_PIPE
Definition: XBOXOLD.h:29
- - - + + +
#define XBOX_INPUT_PIPE_4
Definition: XBOXRECV.h:37
const uint16_t XBOX_BUTTONS[]
Definition: xboxEnums.h:41
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
void disconnect(uint8_t controller=0)
Definition: XBOXRECV.cpp:498
#define XBOX_OUTPUT_PIPE_4
Definition: XBOXRECV.h:38
USB * pUsb
Definition: XBOXRECV.h:235
#define XBOX_OUTPUT_PIPE_2
Definition: XBOXRECV.h:34
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
EpInfo epInfo[XBOX_MAX_ENDPOINTS]
Definition: XBOXRECV.h:239
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
-
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
Definition: UsbCore.h:88
- +
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
Definition: UsbCore.h:99
+
diff --git a/_x_b_o_x_r_e_c_v_8h.html b/_x_b_o_x_r_e_c_v_8h.html index 52a7132c..7f33823e 100644 --- a/_x_b_o_x_r_e_c_v_8h.html +++ b/_x_b_o_x_r_e_c_v_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXRECV.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ EP_MAXPKTSIZE

+
@@ -167,11 +149,13 @@ Macros
-

Definition at line 27 of file XBOXRECV.h.

+

Definition at line 27 of file XBOXRECV.h.

- + +

◆ XBOX_CONTROL_PIPE

+
@@ -181,11 +165,13 @@ Macros
-

Definition at line 30 of file XBOXRECV.h.

+

Definition at line 30 of file XBOXRECV.h.

- + +

◆ XBOX_INPUT_PIPE_1

+
@@ -195,11 +181,13 @@ Macros
-

Definition at line 31 of file XBOXRECV.h.

+

Definition at line 31 of file XBOXRECV.h.

- + +

◆ XBOX_OUTPUT_PIPE_1

+
@@ -209,11 +197,13 @@ Macros
-

Definition at line 32 of file XBOXRECV.h.

+

Definition at line 32 of file XBOXRECV.h.

- + +

◆ XBOX_INPUT_PIPE_2

+
@@ -223,11 +213,13 @@ Macros
-

Definition at line 33 of file XBOXRECV.h.

+

Definition at line 33 of file XBOXRECV.h.

- + +

◆ XBOX_OUTPUT_PIPE_2

+
@@ -237,11 +229,13 @@ Macros
-

Definition at line 34 of file XBOXRECV.h.

+

Definition at line 34 of file XBOXRECV.h.

- + +

◆ XBOX_INPUT_PIPE_3

+
@@ -251,11 +245,13 @@ Macros
-

Definition at line 35 of file XBOXRECV.h.

+

Definition at line 35 of file XBOXRECV.h.

- + +

◆ XBOX_OUTPUT_PIPE_3

+
@@ -265,11 +261,13 @@ Macros
-

Definition at line 36 of file XBOXRECV.h.

+

Definition at line 36 of file XBOXRECV.h.

- + +

◆ XBOX_INPUT_PIPE_4

+
@@ -279,11 +277,13 @@ Macros
-

Definition at line 37 of file XBOXRECV.h.

+

Definition at line 37 of file XBOXRECV.h.

- + +

◆ XBOX_OUTPUT_PIPE_4

+
@@ -293,11 +293,13 @@ Macros
-

Definition at line 38 of file XBOXRECV.h.

+

Definition at line 38 of file XBOXRECV.h.

- + +

◆ XBOX_VID

+
@@ -307,11 +309,13 @@ Macros
-

Definition at line 41 of file XBOXRECV.h.

+

Definition at line 41 of file XBOXRECV.h.

- + +

◆ MADCATZ_VID

+
@@ -321,11 +325,13 @@ Macros
-

Definition at line 42 of file XBOXRECV.h.

+

Definition at line 42 of file XBOXRECV.h.

- + +

◆ JOYTECH_VID

+
@@ -335,11 +341,13 @@ Macros
-

Definition at line 43 of file XBOXRECV.h.

+

Definition at line 43 of file XBOXRECV.h.

- + +

◆ XBOX_WIRELESS_RECEIVER_PID

+
@@ -349,11 +357,13 @@ Macros
-

Definition at line 45 of file XBOXRECV.h.

+

Definition at line 45 of file XBOXRECV.h.

- + +

◆ XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID

+
@@ -363,11 +373,13 @@ Macros
-

Definition at line 46 of file XBOXRECV.h.

+

Definition at line 46 of file XBOXRECV.h.

- + +

◆ XBOX_MAX_ENDPOINTS

+
@@ -377,7 +389,7 @@ Macros
-

Definition at line 48 of file XBOXRECV.h.

+

Definition at line 48 of file XBOXRECV.h.

@@ -386,7 +398,7 @@ Macros diff --git a/_x_b_o_x_r_e_c_v_8h__dep__incl.md5 b/_x_b_o_x_r_e_c_v_8h__dep__incl.md5 index 10cd6192..ca6d54fe 100644 --- a/_x_b_o_x_r_e_c_v_8h__dep__incl.md5 +++ b/_x_b_o_x_r_e_c_v_8h__dep__incl.md5 @@ -1 +1 @@ -1b17ab2dd30a29c1f644e03c41d46777 \ No newline at end of file +c63f097fed6791ddd934ab2f88d1fc85 \ No newline at end of file diff --git a/_x_b_o_x_r_e_c_v_8h__dep__incl.png b/_x_b_o_x_r_e_c_v_8h__dep__incl.png index 93745241..986a9365 100644 Binary files a/_x_b_o_x_r_e_c_v_8h__dep__incl.png and b/_x_b_o_x_r_e_c_v_8h__dep__incl.png differ diff --git a/_x_b_o_x_r_e_c_v_8h__incl.md5 b/_x_b_o_x_r_e_c_v_8h__incl.md5 index e4e3f6bf..63f0f207 100644 --- a/_x_b_o_x_r_e_c_v_8h__incl.md5 +++ b/_x_b_o_x_r_e_c_v_8h__incl.md5 @@ -1 +1 @@ -b243ba8a771536bf11d1fde69b3f7cff \ No newline at end of file +78db048a5c5881107b171aa2f31c9649 \ No newline at end of file diff --git a/_x_b_o_x_r_e_c_v_8h__incl.png b/_x_b_o_x_r_e_c_v_8h__incl.png index d6a2233b..ee7023a2 100644 Binary files a/_x_b_o_x_r_e_c_v_8h__incl.png and b/_x_b_o_x_r_e_c_v_8h__incl.png differ diff --git a/_x_b_o_x_r_e_c_v_8h_source.html b/_x_b_o_x_r_e_c_v_8h_source.html index 48f4174f..93e844bf 100644 --- a/_x_b_o_x_r_e_c_v_8h_source.html +++ b/_x_b_o_x_r_e_c_v_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXRECV.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
XBOXRECV::GetAddress
virtual uint8_t GetAddress()
Definition: XBOXRECV.h:95
XBOXRECV::Xbox360Connected
uint8_t Xbox360Connected[4]
Definition: XBOXRECV.h:231
XBOXRECV::setLedMode
void setLedMode(LEDModeEnum lm, uint8_t controller=0)
Definition: XBOXRECV.cpp:527
-
AnalogHatEnum
AnalogHatEnum
Definition: controllerEnums.h:153
+
AnalogHatEnum
AnalogHatEnum
Definition: controllerEnums.h:157
XBOXRECV::buttonChanged
bool buttonChanged(uint8_t controller=0)
Definition: XBOXRECV.cpp:442
XBOXRECV::setRumbleOff
void setRumbleOff(uint8_t controller=0)
Definition: XBOXRECV.h:162
XBOXRECV::ConfigureDevice
uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXRECV.cpp:41
-
USBDeviceConfig
Definition: UsbCore.h:121
+
USBDeviceConfig
Definition: UsbCore.h:132
Usb.h
XBOXRECV::isReady
virtual bool isReady()
Definition: XBOXRECV.h:103
-
LEDEnum
LEDEnum
Definition: controllerEnums.h:27
+
LEDEnum
LEDEnum
Definition: controllerEnums.h:31
XBOX_VID
#define XBOX_VID
Definition: XBOXRECV.h:41
XBOXRECV::setAllOff
void setAllOff(uint8_t controller=0)
Definition: XBOXRECV.h:153
XBOXRECV::Release
uint8_t Release()
Definition: XBOXRECV.cpp:283
-
EpInfo
Definition: address.h:32
+
EpInfo
Definition: address.h:39
XBOXRECV::getButtonClick
bool getButtonClick(ButtonEnum b, uint8_t controller=0)
Definition: XBOXRECV.cpp:418
XBOXRECV::setLedOn
void setLedOn(LEDEnum l, uint8_t controller=0)
Definition: XBOXRECV.cpp:516
-
ButtonEnum
ButtonEnum
Definition: controllerEnums.h:74
+
ButtonEnum
ButtonEnum
Definition: controllerEnums.h:78
XBOXRECV::getButtonPress
uint8_t getButtonPress(ButtonEnum b, uint8_t controller=0)
Definition: XBOXRECV.cpp:410
XBOXRECV::XboxReceiverConnected
bool XboxReceiverConnected
Definition: XBOXRECV.h:225
XBOXRECV::getBatteryLevel
uint8_t getBatteryLevel(uint8_t controller=0)
Definition: XBOXRECV.cpp:467
@@ -128,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXRECV::Init
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXRECV.cpp:138
MADCATZ_VID
#define MADCATZ_VID
Definition: XBOXRECV.h:42
XBOXRECV::setLedRaw
void setLedRaw(uint8_t value, uint8_t controller=0)
Definition: XBOXRECV.cpp:507
-
USB
Definition: UsbCore.h:197
+
USB
Definition: UsbCore.h:208
XBOXRECV::attachOnInit
void attachOnInit(void(*funcOnInit)(void))
Definition: XBOXRECV.h:223
XBOXRECV::disconnect
void disconnect(uint8_t controller=0)
Definition: XBOXRECV.cpp:498
XBOXRECV
Definition: XBOXRECV.h:55
@@ -140,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_x_b_o_x_u_s_b_8cpp.html b/_x_b_o_x_u_s_b_8cpp.html index 0adea0bc..0a847d67 100644 --- a/_x_b_o_x_u_s_b_8cpp.html +++ b/_x_b_o_x_u_s_b_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXUSB.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
- + - - + + @@ -111,7 +91,7 @@ Include dependency graph for XBOXUSB.cpp:
diff --git a/_x_b_o_x_u_s_b_8cpp__incl.map b/_x_b_o_x_u_s_b_8cpp__incl.map index 3a3769ca..05f473ea 100644 --- a/_x_b_o_x_u_s_b_8cpp__incl.map +++ b/_x_b_o_x_u_s_b_8cpp__incl.map @@ -1,8 +1,8 @@ - + - - + + diff --git a/_x_b_o_x_u_s_b_8cpp__incl.md5 b/_x_b_o_x_u_s_b_8cpp__incl.md5 index 56fff921..d4f8925b 100644 --- a/_x_b_o_x_u_s_b_8cpp__incl.md5 +++ b/_x_b_o_x_u_s_b_8cpp__incl.md5 @@ -1 +1 @@ -c0796622753a276d2229e35ba1e7b14a \ No newline at end of file +807e2c62bb3b87c5cd4d582d24faff91 \ No newline at end of file diff --git a/_x_b_o_x_u_s_b_8cpp__incl.png b/_x_b_o_x_u_s_b_8cpp__incl.png index 92c907c7..750b45c1 100644 Binary files a/_x_b_o_x_u_s_b_8cpp__incl.png and b/_x_b_o_x_u_s_b_8cpp__incl.png differ diff --git a/_x_b_o_x_u_s_b_8cpp_source.html b/_x_b_o_x_u_s_b_8cpp_source.html index c423d887..6d8a6ce3 100644 --- a/_x_b_o_x_u_s_b_8cpp_source.html +++ b/_x_b_o_x_u_s_b_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXUSB.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
XBOXUSB.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "XBOXUSB.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the Xbox 360 Controller
22 
24 pUsb(p), // pointer to USB class instance - mandatory
25 bAddress(0), // device address - mandatory
26 bPollEnable(false) { // don't start polling before dongle is connected
27  for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
28  epInfo[i].epAddr = 0;
29  epInfo[i].maxPktSize = (i) ? 0 : 8;
30  epInfo[i].bmSndToggle = 0;
31  epInfo[i].bmRcvToggle = 0;
33  }
34 
35  if(pUsb) // register in USB subsystem
36  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
37 }
38 
39 uint8_t XBOXUSB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
40  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
41  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
42  uint8_t rcode;
43  UsbDevice *p = NULL;
44  EpInfo *oldep_ptr = NULL;
45  uint16_t PID;
46  uint16_t VID;
47 
48  // get memory address of USB device address pool
49  AddressPool &addrPool = pUsb->GetAddressPool();
50 #ifdef EXTRADEBUG
51  Notify(PSTR("\r\nXBOXUSB Init"), 0x80);
52 #endif
53  // check if address has already been assigned to an instance
54  if(bAddress) {
55 #ifdef DEBUG_USB_HOST
56  Notify(PSTR("\r\nAddress in use"), 0x80);
57 #endif
59  }
60 
61  // Get pointer to pseudo device with address 0 assigned
62  p = addrPool.GetUsbDevicePtr(0);
63 
64  if(!p) {
65 #ifdef DEBUG_USB_HOST
66  Notify(PSTR("\r\nAddress not found"), 0x80);
67 #endif
69  }
70 
71  if(!p->epinfo) {
72 #ifdef DEBUG_USB_HOST
73  Notify(PSTR("\r\nepinfo is null"), 0x80);
74 #endif
76  }
77 
78  // Save old pointer to EP_RECORD of address 0
79  oldep_ptr = p->epinfo;
80 
81  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
82  p->epinfo = epInfo;
83 
84  p->lowspeed = lowspeed;
85 
86  // Get device descriptor
87  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
88  // Restore p->epinfo
89  p->epinfo = oldep_ptr;
90 
91  if(rcode)
92  goto FailGetDevDescr;
93 
94  VID = udd->idVendor;
95  PID = udd->idProduct;
96 
97  if(VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID && VID != GAMESTOP_VID) // Check VID
98  goto FailUnknownDevice;
99  if(PID == XBOX_WIRELESS_PID) {
100 #ifdef DEBUG_USB_HOST
101  Notify(PSTR("\r\nYou have plugged in a wireless Xbox 360 controller - it doesn't support USB communication"), 0x80);
102 #endif
103  goto FailUnknownDevice;
105 #ifdef DEBUG_USB_HOST
106  Notify(PSTR("\r\nThis library only supports Xbox 360 controllers via USB"), 0x80);
107 #endif
108  goto FailUnknownDevice;
109  } else if(PID != XBOX_WIRED_PID && PID != MADCATZ_WIRED_PID && PID != GAMESTOP_WIRED_PID && PID != AFTERGLOW_WIRED_PID && PID != JOYTECH_WIRED_PID) // Check PID
110  goto FailUnknownDevice;
111 
112  // Allocate new address according to device class
113  bAddress = addrPool.AllocAddress(parent, false, port);
114 
115  if(!bAddress)
117 
118  // Extract Max Packet Size from device descriptor
119  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
120 
121  // Assign new address to the device
122  rcode = pUsb->setAddr(0, 0, bAddress);
123  if(rcode) {
124  p->lowspeed = false;
125  addrPool.FreeAddress(bAddress);
126  bAddress = 0;
127 #ifdef DEBUG_USB_HOST
128  Notify(PSTR("\r\nsetAddr: "), 0x80);
129  D_PrintHex<uint8_t > (rcode, 0x80);
130 #endif
131  return rcode;
132  }
133 #ifdef EXTRADEBUG
134  Notify(PSTR("\r\nAddr: "), 0x80);
135  D_PrintHex<uint8_t > (bAddress, 0x80);
136 #endif
137  //delay(300); // Spec says you should wait at least 200ms
138 
139  p->lowspeed = false;
140 
141  //get pointer to assigned address record
142  p = addrPool.GetUsbDevicePtr(bAddress);
143  if(!p)
145 
146  p->lowspeed = lowspeed;
147 
148  // Assign epInfo to epinfo pointer - only EP0 is known
149  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
150  if(rcode)
151  goto FailSetDevTblEntry;
152 
153  /* The application will work in reduced host mode, so we can save program and data
154  memory space. After verifying the VID we will use known values for the
155  configuration values for device, interface, endpoints and HID for the XBOX360 Controllers */
156 
157  /* Initialize data structures for endpoints of device */
158  epInfo[ XBOX_INPUT_PIPE ].epAddr = 0x01; // XBOX 360 report endpoint
160  epInfo[ XBOX_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
164  epInfo[ XBOX_OUTPUT_PIPE ].epAddr = 0x02; // XBOX 360 output endpoint
166  epInfo[ XBOX_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
170 
171  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
172  if(rcode)
173  goto FailSetDevTblEntry;
174 
175  delay(200); // Give time for address change
176 
177  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
178  if(rcode)
179  goto FailSetConfDescr;
180 
181 #ifdef DEBUG_USB_HOST
182  Notify(PSTR("\r\nXbox 360 Controller Connected\r\n"), 0x80);
183 #endif
184  onInit();
185  Xbox360Connected = true;
186  bPollEnable = true;
187  return 0; // Successful configuration
188 
189  /* Diagnostic messages */
190 FailGetDevDescr:
191 #ifdef DEBUG_USB_HOST
193  goto Fail;
194 #endif
195 
196 FailSetDevTblEntry:
197 #ifdef DEBUG_USB_HOST
199  goto Fail;
200 #endif
201 
202 FailSetConfDescr:
203 #ifdef DEBUG_USB_HOST
205 #endif
206  goto Fail;
207 
208 FailUnknownDevice:
209 #ifdef DEBUG_USB_HOST
210  NotifyFailUnknownDevice(VID, PID);
211 #endif
213 
214 Fail:
215 #ifdef DEBUG_USB_HOST
216  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
217  NotifyFail(rcode);
218 #endif
219  Release();
220  return rcode;
221 }
222 
223 /* Performs a cleanup after failed Init() attempt */
224 uint8_t XBOXUSB::Release() {
225  Xbox360Connected = false;
227  bAddress = 0;
228  bPollEnable = false;
229  return 0;
230 }
231 
232 uint8_t XBOXUSB::Poll() {
233  if(!bPollEnable)
234  return 0;
235  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
236  pUsb->inTransfer(bAddress, epInfo[ XBOX_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
237  readReport();
238 #ifdef PRINTREPORT
239  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
240 #endif
241  return 0;
242 }
243 
244 void XBOXUSB::readReport() {
245  if(readBuf == NULL)
246  return;
247  if(readBuf[0] != 0x00 || readBuf[1] != 0x14) { // Check if it's the correct report - the controller also sends different status reports
248  return;
249  }
250 
251  ButtonState = (uint32_t)(readBuf[5] | ((uint16_t)readBuf[4] << 8) | ((uint32_t)readBuf[3] << 16) | ((uint32_t)readBuf[2] << 24));
252 
253  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
254  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
255  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
256  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
257 
258  //Notify(PSTR("\r\nButtonState"), 0x80);
259  //PrintHex<uint32_t>(ButtonState, 0x80);
260 
261  if(ButtonState != OldButtonState) {
262  ButtonClickState = (ButtonState >> 16) & ((~OldButtonState) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
263  if(((uint8_t)OldButtonState) == 0 && ((uint8_t)ButtonState) != 0) // The L2 and R2 buttons are special as they are analog buttons
264  R2Clicked = true;
265  if((uint8_t)(OldButtonState >> 8) == 0 && (uint8_t)(ButtonState >> 8) != 0)
266  L2Clicked = true;
267  OldButtonState = ButtonState;
268  }
269 }
270 
271 void XBOXUSB::printReport() { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
272 #ifdef PRINTREPORT
273  if(readBuf == NULL)
274  return;
275  for(uint8_t i = 0; i < XBOX_REPORT_BUFFER_SIZE; i++) {
276  D_PrintHex<uint8_t > (readBuf[i], 0x80);
277  Notify(PSTR(" "), 0x80);
278  }
279  Notify(PSTR("\r\n"), 0x80);
280 #endif
281 }
282 
284  if(b == L2) // These are analog buttons
285  return (uint8_t)(ButtonState >> 8);
286  else if(b == R2)
287  return (uint8_t)ButtonState;
288  return (bool)(ButtonState & ((uint32_t)pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]) << 16));
289 }
290 
292  if(b == L2) {
293  if(L2Clicked) {
294  L2Clicked = false;
295  return true;
296  }
297  return false;
298  } else if(b == R2) {
299  if(R2Clicked) {
300  R2Clicked = false;
301  return true;
302  }
303  return false;
304  }
305  uint16_t button = pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]);
306  bool click = (ButtonClickState & button);
307  ButtonClickState &= ~button; // clear "click" event
308  return click;
309 }
310 
312  return hatValue[a];
313 }
314 
315 /* Xbox Controller commands */
316 void XBOXUSB::XboxCommand(uint8_t* data, uint16_t nbytes) {
317  //bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x00), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)
318  pUsb->ctrlReq(bAddress, epInfo[XBOX_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);
319 }
320 
321 void XBOXUSB::setLedRaw(uint8_t value) {
322  writeBuf[0] = 0x01;
323  writeBuf[1] = 0x03;
324  writeBuf[2] = value;
325 
326  XboxCommand(writeBuf, 3);
327 }
328 
330  if(led == OFF)
331  setLedRaw(0);
332  else if(led != ALL) // All LEDs can't be on a the same time
333  setLedRaw(pgm_read_byte(&XBOX_LEDS[(uint8_t)led]) + 4);
334 }
335 
337  setLedRaw(pgm_read_byte(&XBOX_LEDS[(uint8_t)led]));
338 }
339 
340 void XBOXUSB::setLedMode(LEDModeEnum ledMode) { // This function is used to do some special LED stuff the controller supports
341  setLedRaw((uint8_t)ledMode);
342 }
343 
344 void XBOXUSB::setRumbleOn(uint8_t lValue, uint8_t rValue) {
345  writeBuf[0] = 0x00;
346  writeBuf[1] = 0x08;
347  writeBuf[2] = 0x00;
348  writeBuf[3] = lValue; // big weight
349  writeBuf[4] = rValue; // small weight
350  writeBuf[5] = 0x00;
351  writeBuf[6] = 0x00;
352  writeBuf[7] = 0x00;
353 
354  XboxCommand(writeBuf, 8);
355 }
356 
357 void XBOXUSB::onInit() {
358  if(pFuncOnInit)
359  pFuncOnInit(); // Call the user function
360  else
361  setLedOn(static_cast<LEDEnum>(LED1));
362 }
#define XBOX_WIRED_PID
Definition: XBOXUSB.h:39
-
uint8_t bmRcvToggle
Definition: address.h:41
- +Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #include "XBOXUSB.h"
19 // To enable serial debugging see "settings.h"
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
21 //#define PRINTREPORT // Uncomment to print the report send by the Xbox 360 Controller
22 
24 pUsb(p), // pointer to USB class instance - mandatory
25 bAddress(0), // device address - mandatory
26 bPollEnable(false) { // don't start polling before dongle is connected
27  for(uint8_t i = 0; i < XBOX_MAX_ENDPOINTS; i++) {
28  epInfo[i].epAddr = 0;
29  epInfo[i].maxPktSize = (i) ? 0 : 8;
30  epInfo[i].bmSndToggle = 0;
31  epInfo[i].bmRcvToggle = 0;
33  }
34 
35  if(pUsb) // register in USB subsystem
36  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
37 }
38 
39 uint8_t XBOXUSB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
40  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
41  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
42  uint8_t rcode;
43  UsbDevice *p = NULL;
44  EpInfo *oldep_ptr = NULL;
45  uint16_t PID;
46  uint16_t VID;
47 
48  // get memory address of USB device address pool
49  AddressPool &addrPool = pUsb->GetAddressPool();
50 #ifdef EXTRADEBUG
51  Notify(PSTR("\r\nXBOXUSB Init"), 0x80);
52 #endif
53  // check if address has already been assigned to an instance
54  if(bAddress) {
55 #ifdef DEBUG_USB_HOST
56  Notify(PSTR("\r\nAddress in use"), 0x80);
57 #endif
59  }
60 
61  // Get pointer to pseudo device with address 0 assigned
62  p = addrPool.GetUsbDevicePtr(0);
63 
64  if(!p) {
65 #ifdef DEBUG_USB_HOST
66  Notify(PSTR("\r\nAddress not found"), 0x80);
67 #endif
69  }
70 
71  if(!p->epinfo) {
72 #ifdef DEBUG_USB_HOST
73  Notify(PSTR("\r\nepinfo is null"), 0x80);
74 #endif
76  }
77 
78  // Save old pointer to EP_RECORD of address 0
79  oldep_ptr = p->epinfo;
80 
81  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
82  p->epinfo = epInfo;
83 
84  p->lowspeed = lowspeed;
85 
86  // Get device descriptor
87  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
88  // Restore p->epinfo
89  p->epinfo = oldep_ptr;
90 
91  if(rcode)
92  goto FailGetDevDescr;
93 
94  VID = udd->idVendor;
95  PID = udd->idProduct;
96 
97  if(VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID && VID != GAMESTOP_VID) // Check VID
98  goto FailUnknownDevice;
99  if(PID == XBOX_WIRELESS_PID) {
100 #ifdef DEBUG_USB_HOST
101  Notify(PSTR("\r\nYou have plugged in a wireless Xbox 360 controller - it doesn't support USB communication"), 0x80);
102 #endif
103  goto FailUnknownDevice;
105 #ifdef DEBUG_USB_HOST
106  Notify(PSTR("\r\nThis library only supports Xbox 360 controllers via USB"), 0x80);
107 #endif
108  goto FailUnknownDevice;
109  } else if(PID != XBOX_WIRED_PID && PID != MADCATZ_WIRED_PID && PID != GAMESTOP_WIRED_PID && PID != AFTERGLOW_WIRED_PID && PID != JOYTECH_WIRED_PID) // Check PID
110  goto FailUnknownDevice;
111 
112  // Allocate new address according to device class
113  bAddress = addrPool.AllocAddress(parent, false, port);
114 
115  if(!bAddress)
117 
118  // Extract Max Packet Size from device descriptor
119  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
120 
121  // Assign new address to the device
122  rcode = pUsb->setAddr(0, 0, bAddress);
123  if(rcode) {
124  p->lowspeed = false;
125  addrPool.FreeAddress(bAddress);
126  bAddress = 0;
127 #ifdef DEBUG_USB_HOST
128  Notify(PSTR("\r\nsetAddr: "), 0x80);
129  D_PrintHex<uint8_t > (rcode, 0x80);
130 #endif
131  return rcode;
132  }
133 #ifdef EXTRADEBUG
134  Notify(PSTR("\r\nAddr: "), 0x80);
135  D_PrintHex<uint8_t > (bAddress, 0x80);
136 #endif
137  //delay(300); // Spec says you should wait at least 200ms
138 
139  p->lowspeed = false;
140 
141  //get pointer to assigned address record
142  p = addrPool.GetUsbDevicePtr(bAddress);
143  if(!p)
145 
146  p->lowspeed = lowspeed;
147 
148  // Assign epInfo to epinfo pointer - only EP0 is known
149  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
150  if(rcode)
151  goto FailSetDevTblEntry;
152 
153  /* The application will work in reduced host mode, so we can save program and data
154  memory space. After verifying the VID we will use known values for the
155  configuration values for device, interface, endpoints and HID for the XBOX360 Controllers */
156 
157  /* Initialize data structures for endpoints of device */
158  epInfo[ XBOX_INPUT_PIPE ].epAddr = 0x01; // XBOX 360 report endpoint
160  epInfo[ XBOX_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
164  epInfo[ XBOX_OUTPUT_PIPE ].epAddr = 0x02; // XBOX 360 output endpoint
166  epInfo[ XBOX_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
170 
171  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
172  if(rcode)
173  goto FailSetDevTblEntry;
174 
175  delay(200); // Give time for address change
176 
177  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
178  if(rcode)
179  goto FailSetConfDescr;
180 
181 #ifdef DEBUG_USB_HOST
182  Notify(PSTR("\r\nXbox 360 Controller Connected\r\n"), 0x80);
183 #endif
184  onInit();
185  Xbox360Connected = true;
186  bPollEnable = true;
187  return 0; // Successful configuration
188 
189  /* Diagnostic messages */
190 FailGetDevDescr:
191 #ifdef DEBUG_USB_HOST
193  goto Fail;
194 #endif
195 
196 FailSetDevTblEntry:
197 #ifdef DEBUG_USB_HOST
199  goto Fail;
200 #endif
201 
202 FailSetConfDescr:
203 #ifdef DEBUG_USB_HOST
205 #endif
206  goto Fail;
207 
208 FailUnknownDevice:
209 #ifdef DEBUG_USB_HOST
210  NotifyFailUnknownDevice(VID, PID);
211 #endif
213 
214 Fail:
215 #ifdef DEBUG_USB_HOST
216  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
217  NotifyFail(rcode);
218 #endif
219  Release();
220  return rcode;
221 }
222 
223 /* Performs a cleanup after failed Init() attempt */
224 uint8_t XBOXUSB::Release() {
225  Xbox360Connected = false;
227  bAddress = 0;
228  bPollEnable = false;
229  return 0;
230 }
231 
232 uint8_t XBOXUSB::Poll() {
233  if(!bPollEnable)
234  return 0;
235  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
236  pUsb->inTransfer(bAddress, epInfo[ XBOX_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
237  readReport();
238 #ifdef PRINTREPORT
239  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
240 #endif
241  return 0;
242 }
243 
244 void XBOXUSB::readReport() {
245  if(readBuf == NULL)
246  return;
247  if(readBuf[0] != 0x00 || readBuf[1] != 0x14) { // Check if it's the correct report - the controller also sends different status reports
248  return;
249  }
250 
251  ButtonState = (uint32_t)(readBuf[5] | ((uint16_t)readBuf[4] << 8) | ((uint32_t)readBuf[3] << 16) | ((uint32_t)readBuf[2] << 24));
252 
253  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
254  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
255  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
256  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
257 
258  //Notify(PSTR("\r\nButtonState"), 0x80);
259  //PrintHex<uint32_t>(ButtonState, 0x80);
260 
261  if(ButtonState != OldButtonState) {
262  ButtonClickState = (ButtonState >> 16) & ((~OldButtonState) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
263  if(((uint8_t)OldButtonState) == 0 && ((uint8_t)ButtonState) != 0) // The L2 and R2 buttons are special as they are analog buttons
264  R2Clicked = true;
265  if((uint8_t)(OldButtonState >> 8) == 0 && (uint8_t)(ButtonState >> 8) != 0)
266  L2Clicked = true;
267  OldButtonState = ButtonState;
268  }
269 }
270 
271 void XBOXUSB::printReport() { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
272 #ifdef PRINTREPORT
273  if(readBuf == NULL)
274  return;
275  for(uint8_t i = 0; i < XBOX_REPORT_BUFFER_SIZE; i++) {
276  D_PrintHex<uint8_t > (readBuf[i], 0x80);
277  Notify(PSTR(" "), 0x80);
278  }
279  Notify(PSTR("\r\n"), 0x80);
280 #endif
281 }
282 
284  if(b == L2) // These are analog buttons
285  return (uint8_t)(ButtonState >> 8);
286  else if(b == R2)
287  return (uint8_t)ButtonState;
288  return (bool)(ButtonState & ((uint32_t)pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]) << 16));
289 }
290 
292  if(b == L2) {
293  if(L2Clicked) {
294  L2Clicked = false;
295  return true;
296  }
297  return false;
298  } else if(b == R2) {
299  if(R2Clicked) {
300  R2Clicked = false;
301  return true;
302  }
303  return false;
304  }
305  uint16_t button = pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]);
306  bool click = (ButtonClickState & button);
307  ButtonClickState &= ~button; // clear "click" event
308  return click;
309 }
310 
312  return hatValue[a];
313 }
314 
315 /* Xbox Controller commands */
316 void XBOXUSB::XboxCommand(uint8_t* data, uint16_t nbytes) {
317  //bmRequest = Host to device (0x00) | Class (0x20) | Interface (0x01) = 0x21, bRequest = Set Report (0x09), Report ID (0x00), Report Type (Output 0x02), interface (0x00), datalength, datalength, data)
318  pUsb->ctrlReq(bAddress, epInfo[XBOX_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);
319 }
320 
321 void XBOXUSB::setLedRaw(uint8_t value) {
322  writeBuf[0] = 0x01;
323  writeBuf[1] = 0x03;
324  writeBuf[2] = value;
325 
326  XboxCommand(writeBuf, 3);
327 }
328 
330  if(led == OFF)
331  setLedRaw(0);
332  else if(led != ALL) // All LEDs can't be on a the same time
333  setLedRaw(pgm_read_byte(&XBOX_LEDS[(uint8_t)led]) + 4);
334 }
335 
337  setLedRaw(pgm_read_byte(&XBOX_LEDS[(uint8_t)led]));
338 }
339 
340 void XBOXUSB::setLedMode(LEDModeEnum ledMode) { // This function is used to do some special LED stuff the controller supports
341  setLedRaw((uint8_t)ledMode);
342 }
343 
344 void XBOXUSB::setRumbleOn(uint8_t lValue, uint8_t rValue) {
345  writeBuf[0] = 0x00;
346  writeBuf[1] = 0x08;
347  writeBuf[2] = 0x00;
348  writeBuf[3] = lValue; // big weight
349  writeBuf[4] = rValue; // small weight
350  writeBuf[5] = 0x00;
351  writeBuf[6] = 0x00;
352  writeBuf[7] = 0x00;
353 
354  XboxCommand(writeBuf, 8);
355 }
356 
357 void XBOXUSB::onInit() {
358  if(pFuncOnInit)
359  pFuncOnInit(); // Call the user function
360  else
361  setLedOn(static_cast<LEDEnum>(LED1));
362 }
#define XBOX_WIRED_PID
Definition: XBOXUSB.h:39
+
uint8_t bmRcvToggle
Definition: address.h:48
+
#define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID
Definition: XBOXRECV.h:46
- +
LEDModeEnum
Definition: xboxEnums.h:24
-
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
uint8_t bmNakPower
Definition: address.h:42
+
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
uint8_t bmNakPower
Definition: address.h:49
#define XBOX_WIRELESS_RECEIVER_PID
Definition: XBOXRECV.h:45
void setLedOn(LEDEnum l)
Definition: XBOXUSB.cpp:329
- - -
#define pgm_read_word(addr)
+ + +
#define pgm_read_word(addr)
#define JOYTECH_WIRED_PID
Definition: XBOXUSB.h:44
-
#define NotifyFail(...)
Definition: message.h:55
-
AnalogHatEnum
+
#define NotifyFail(...)
Definition: message.h:62
+
AnalogHatEnum
USB * pUsb
Definition: XBOXUSB.h:189
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
+
#define XBOX_REPORT_BUFFER_SIZE
Definition: XBOXUSB.h:48
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXUSB.cpp:39
-
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:86
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
int16_t getAnalogHat(AnalogHatEnum a)
Definition: XBOXUSB.cpp:311
#define bmREQ_HID_OUT
Definition: usbhid.h:63
void setLedBlink(LEDEnum l)
Definition: XBOXUSB.cpp:336
-
#define pgm_read_byte(addr)
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
+
#define pgm_read_byte(addr)
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
#define AFTERGLOW_WIRED_PID
Definition: XBOXUSB.h:46
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
#define EP_MAXPKTSIZE
Definition: PS3USB.h:26
virtual void FreeAddress(uint8_t addr)=0
-
LEDEnum
-
uint8_t epAttribs
Definition: address.h:37
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
+
LEDEnum
+
uint8_t epAttribs
Definition: address.h:44
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
#define Notify(...)
Definition: message.h:44
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
uint8_t epAddr
Definition: address.h:33
-
#define NotifyFailUnknownDevice(...)
Definition: message.h:54
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
+
#define Notify(...)
Definition: message.h:51
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
uint8_t epAddr
Definition: address.h:40
+
#define NotifyFailUnknownDevice(...)
Definition: message.h:61
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
#define XBOX_VID
Definition: XBOXOLD.h:34
#define XBOX_INPUT_PIPE
Definition: XBOXOLD.h:30
- +
uint8_t bAddress
Definition: XBOXUSB.h:191
uint8_t getButtonPress(ButtonEnum b)
Definition: XBOXUSB.cpp:283
-
Definition: address.h:32
+
Definition: address.h:39
#define XBOX_WIRELESS_PID
Definition: XBOXUSB.h:40
-
ButtonEnum
+
ButtonEnum
bool Xbox360Connected
Definition: XBOXUSB.h:181
- +
#define JOYTECH_VID
Definition: XBOXOLD.h:36
- +
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
+
uint8_t bmSndToggle
Definition: address.h:47
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
void setRumbleOn(uint8_t lValue, uint8_t rValue)
Definition: XBOXUSB.cpp:344
XBOXUSB(USB *pUsb)
Definition: XBOXUSB.cpp:23
#define MADCATZ_VID
Definition: XBOXOLD.h:35
- +
#define XBOX_OUTPUT_PIPE
Definition: XBOXOLD.h:31
-
#define USB_NAK_NOWAIT
Definition: address.h:29
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
+
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
#define GAMESTOP_VID
Definition: XBOXUSB.h:37
const uint8_t XBOX_LEDS[]
Definition: xboxEnums.h:32
bool getButtonClick(ButtonEnum b)
Definition: XBOXUSB.cpp:291
#define XBOX_MAX_ENDPOINTS
Definition: XBOXOLD.h:43
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
void setLedRaw(uint8_t value)
Definition: XBOXUSB.cpp:321
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
void setLedMode(LEDModeEnum lm)
Definition: XBOXUSB.cpp:340
#define MADCATZ_WIRED_PID
Definition: XBOXUSB.h:43
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
Definition: UsbCore.h:197
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
Definition: UsbCore.h:208
#define XBOX_CONTROL_PIPE
Definition: XBOXOLD.h:29
- - - + + +
uint8_t Release()
Definition: XBOXUSB.cpp:224
#define HID_REQUEST_SET_REPORT
Definition: usbhid.h:72
const uint16_t XBOX_BUTTONS[]
Definition: xboxEnums.h:41
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
-
#define XBOX_REPORT_BUFFER_SIZE
Definition: XBOXONE.h:41
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
uint8_t Poll()
Definition: XBOXUSB.cpp:232
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
EpInfo epInfo[XBOX_MAX_ENDPOINTS]
Definition: XBOXUSB.h:193
#define GAMESTOP_WIRED_PID
Definition: XBOXUSB.h:45
- +
diff --git a/_x_b_o_x_u_s_b_8h.html b/_x_b_o_x_u_s_b_8h.html index 6967af08..fc1efcdf 100644 --- a/_x_b_o_x_u_s_b_8h.html +++ b/_x_b_o_x_u_s_b_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXUSB.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- - + + @@ -164,7 +144,9 @@ Macros  

Macro Definition Documentation

- + +

◆ EP_MAXPKTSIZE

+
@@ -174,11 +156,13 @@ Macros
-

Definition at line 26 of file XBOXUSB.h.

+

Definition at line 26 of file XBOXUSB.h.

- + +

◆ XBOX_CONTROL_PIPE

+
@@ -188,11 +172,13 @@ Macros
-

Definition at line 29 of file XBOXUSB.h.

+

Definition at line 29 of file XBOXUSB.h.

- + +

◆ XBOX_INPUT_PIPE

+
@@ -202,11 +188,13 @@ Macros
-

Definition at line 30 of file XBOXUSB.h.

+

Definition at line 30 of file XBOXUSB.h.

- + +

◆ XBOX_OUTPUT_PIPE

+
@@ -216,11 +204,13 @@ Macros
-

Definition at line 31 of file XBOXUSB.h.

+

Definition at line 31 of file XBOXUSB.h.

- + +

◆ XBOX_VID

+
@@ -230,11 +220,13 @@ Macros
-

Definition at line 34 of file XBOXUSB.h.

+

Definition at line 34 of file XBOXUSB.h.

- + +

◆ MADCATZ_VID

+
@@ -244,11 +236,13 @@ Macros
-

Definition at line 35 of file XBOXUSB.h.

+

Definition at line 35 of file XBOXUSB.h.

- + +

◆ JOYTECH_VID

+
@@ -258,11 +252,13 @@ Macros
-

Definition at line 36 of file XBOXUSB.h.

+

Definition at line 36 of file XBOXUSB.h.

- + +

◆ GAMESTOP_VID

+
@@ -272,11 +268,13 @@ Macros
-

Definition at line 37 of file XBOXUSB.h.

+

Definition at line 37 of file XBOXUSB.h.

- + +

◆ XBOX_WIRED_PID

+
@@ -286,11 +284,13 @@ Macros
-

Definition at line 39 of file XBOXUSB.h.

+

Definition at line 39 of file XBOXUSB.h.

- + +

◆ XBOX_WIRELESS_PID

+
@@ -300,11 +300,13 @@ Macros
-

Definition at line 40 of file XBOXUSB.h.

+

Definition at line 40 of file XBOXUSB.h.

- + +

◆ XBOX_WIRELESS_RECEIVER_PID

+
@@ -314,11 +316,13 @@ Macros
-

Definition at line 41 of file XBOXUSB.h.

+

Definition at line 41 of file XBOXUSB.h.

- + +

◆ XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID

+
@@ -328,11 +332,13 @@ Macros
-

Definition at line 42 of file XBOXUSB.h.

+

Definition at line 42 of file XBOXUSB.h.

- + +

◆ MADCATZ_WIRED_PID

+
@@ -342,11 +348,13 @@ Macros
-

Definition at line 43 of file XBOXUSB.h.

+

Definition at line 43 of file XBOXUSB.h.

- + +

◆ JOYTECH_WIRED_PID

+
@@ -356,11 +364,13 @@ Macros
-

Definition at line 44 of file XBOXUSB.h.

+

Definition at line 44 of file XBOXUSB.h.

- + +

◆ GAMESTOP_WIRED_PID

+
@@ -370,11 +380,13 @@ Macros
-

Definition at line 45 of file XBOXUSB.h.

+

Definition at line 45 of file XBOXUSB.h.

- + +

◆ AFTERGLOW_WIRED_PID

+
@@ -384,11 +396,13 @@ Macros
-

Definition at line 46 of file XBOXUSB.h.

+

Definition at line 46 of file XBOXUSB.h.

- + +

◆ XBOX_REPORT_BUFFER_SIZE

+
@@ -398,11 +412,13 @@ Macros
-

Definition at line 48 of file XBOXUSB.h.

+

Definition at line 48 of file XBOXUSB.h.

- + +

◆ XBOX_MAX_ENDPOINTS

+
@@ -412,7 +428,7 @@ Macros
-

Definition at line 50 of file XBOXUSB.h.

+

Definition at line 50 of file XBOXUSB.h.

@@ -421,7 +437,7 @@ Macros diff --git a/_x_b_o_x_u_s_b_8h__dep__incl.md5 b/_x_b_o_x_u_s_b_8h__dep__incl.md5 index ffb0405c..3486b50b 100644 --- a/_x_b_o_x_u_s_b_8h__dep__incl.md5 +++ b/_x_b_o_x_u_s_b_8h__dep__incl.md5 @@ -1 +1 @@ -18da52fa9e2758f5b169a34307b52822 \ No newline at end of file +e72de7b87014e17ae5652145a0bf146b \ No newline at end of file diff --git a/_x_b_o_x_u_s_b_8h__dep__incl.png b/_x_b_o_x_u_s_b_8h__dep__incl.png index d7f2e384..2d2b9dea 100644 Binary files a/_x_b_o_x_u_s_b_8h__dep__incl.png and b/_x_b_o_x_u_s_b_8h__dep__incl.png differ diff --git a/_x_b_o_x_u_s_b_8h__incl.map b/_x_b_o_x_u_s_b_8h__incl.map index 22b358ce..8e5c5131 100644 --- a/_x_b_o_x_u_s_b_8h__incl.map +++ b/_x_b_o_x_u_s_b_8h__incl.map @@ -1,7 +1,7 @@ - - + + diff --git a/_x_b_o_x_u_s_b_8h__incl.md5 b/_x_b_o_x_u_s_b_8h__incl.md5 index 9ea5abe3..55decb56 100644 --- a/_x_b_o_x_u_s_b_8h__incl.md5 +++ b/_x_b_o_x_u_s_b_8h__incl.md5 @@ -1 +1 @@ -bffb200b269ce5778ffd1fb3cca482e2 \ No newline at end of file +6f08202f11b618a1375a96c653bf625c \ No newline at end of file diff --git a/_x_b_o_x_u_s_b_8h__incl.png b/_x_b_o_x_u_s_b_8h__incl.png index a368b3c6..240d98ec 100644 Binary files a/_x_b_o_x_u_s_b_8h__incl.png and b/_x_b_o_x_u_s_b_8h__incl.png differ diff --git a/_x_b_o_x_u_s_b_8h_source.html b/_x_b_o_x_u_s_b_8h_source.html index 04aff0a9..e8dd836e 100644 --- a/_x_b_o_x_u_s_b_8h_source.html +++ b/_x_b_o_x_u_s_b_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXUSB.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
xboxEnums.h
XBOXUSB::VIDPIDOK
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: XBOXUSB.h:103
JOYTECH_WIRED_PID
#define JOYTECH_WIRED_PID
Definition: XBOXUSB.h:44
-
AnalogHatEnum
AnalogHatEnum
Definition: controllerEnums.h:153
+
AnalogHatEnum
AnalogHatEnum
Definition: controllerEnums.h:157
XBOXUSB::pUsb
USB * pUsb
Definition: XBOXUSB.h:189
XBOXUSB::setLedOff
void setLedOff()
Definition: XBOXUSB.h:156
XBOXUSB::Init
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: XBOXUSB.cpp:39
-
USBDeviceConfig
Definition: UsbCore.h:121
+
USBDeviceConfig
Definition: UsbCore.h:132
XBOXUSB::getAnalogHat
int16_t getAnalogHat(AnalogHatEnum a)
Definition: XBOXUSB.cpp:311
Usb.h
XBOXUSB::setLedBlink
void setLedBlink(LEDEnum l)
Definition: XBOXUSB.cpp:336
XBOXUSB::isReady
virtual bool isReady()
Definition: XBOXUSB.h:93
AFTERGLOW_WIRED_PID
#define AFTERGLOW_WIRED_PID
Definition: XBOXUSB.h:46
-
LEDEnum
LEDEnum
Definition: controllerEnums.h:27
+
LEDEnum
LEDEnum
Definition: controllerEnums.h:31
XBOXUSB::attachOnInit
void attachOnInit(void(*funcOnInit)(void))
Definition: XBOXUSB.h:179
XBOXUSB::bAddress
uint8_t bAddress
Definition: XBOXUSB.h:191
XBOXUSB::getButtonPress
uint8_t getButtonPress(ButtonEnum b)
Definition: XBOXUSB.cpp:283
-
EpInfo
Definition: address.h:32
-
ButtonEnum
ButtonEnum
Definition: controllerEnums.h:74
+
EpInfo
Definition: address.h:39
+
ButtonEnum
ButtonEnum
Definition: controllerEnums.h:78
XBOXUSB::Xbox360Connected
bool Xbox360Connected
Definition: XBOXUSB.h:181
XBOX_VID
#define XBOX_VID
Definition: XBOXUSB.h:34
XBOXUSB::setRumbleOn
void setRumbleOn(uint8_t lValue, uint8_t rValue)
Definition: XBOXUSB.cpp:344
@@ -129,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXUSB::setLedMode
void setLedMode(LEDModeEnum lm)
Definition: XBOXUSB.cpp:340
MADCATZ_WIRED_PID
#define MADCATZ_WIRED_PID
Definition: XBOXUSB.h:43
XBOXUSB
Definition: XBOXUSB.h:53
-
USB
Definition: UsbCore.h:197
+
USB
Definition: UsbCore.h:208
XBOXUSB::setAllOff
void setAllOff()
Definition: XBOXUSB.h:132
XBOXUSB::Release
uint8_t Release()
Definition: XBOXUSB.cpp:224
XBOXUSB::Poll
uint8_t Poll()
Definition: XBOXUSB.cpp:232
@@ -140,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/address_8h.html b/address_8h.html index 7fb7ddab..a47e663e 100644 --- a/address_8h.html +++ b/address_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: address.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
 

Macro Definition Documentation

- + +

◆ USB_NAK_MAX_POWER

+
@@ -147,11 +129,13 @@ Typedefs
-

Definition at line 27 of file address.h.

+

Definition at line 34 of file address.h.

- + +

◆ USB_NAK_DEFAULT

+
@@ -161,11 +145,13 @@ Typedefs
-

Definition at line 28 of file address.h.

+

Definition at line 35 of file address.h.

- + +

◆ USB_NAK_NOWAIT

+
@@ -175,11 +161,13 @@ Typedefs
-

Definition at line 29 of file address.h.

+

Definition at line 36 of file address.h.

- + +

◆ USB_NAK_NONAK

+
@@ -189,11 +177,13 @@ Typedefs
-

Definition at line 30 of file address.h.

+

Definition at line 37 of file address.h.

- + +

◆ bmUSB_DEV_ADDR_ADDRESS

+
@@ -203,11 +193,13 @@ Typedefs
-

Definition at line 71 of file address.h.

+

Definition at line 78 of file address.h.

- + +

◆ bmUSB_DEV_ADDR_PARENT

+
@@ -217,11 +209,13 @@ Typedefs
-

Definition at line 72 of file address.h.

+

Definition at line 79 of file address.h.

- + +

◆ bmUSB_DEV_ADDR_HUB

+
@@ -231,11 +225,13 @@ Typedefs
-

Definition at line 73 of file address.h.

+

Definition at line 80 of file address.h.

- + +

◆ ADDR_ERROR_INVALID_INDEX

+
@@ -245,11 +241,13 @@ Typedefs
-

Definition at line 92 of file address.h.

+

Definition at line 99 of file address.h.

- + +

◆ ADDR_ERROR_INVALID_ADDRESS

+
@@ -259,12 +257,14 @@ Typedefs
-

Definition at line 93 of file address.h.

+

Definition at line 100 of file address.h.

Typedef Documentation

- + +

◆ UsbDeviceHandleFunc

+
@@ -274,7 +274,7 @@ Typedefs
-

Definition at line 90 of file address.h.

+

Definition at line 97 of file address.h.

@@ -283,7 +283,7 @@ Typedefs diff --git a/address_8h_source.html b/address_8h_source.html index bbeb394c..4e461709 100644 --- a/address_8h_source.html +++ b/address_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: address.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
address.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(_usb_h_) || defined(__ADDRESS_H__)
19 #error "Never include address.h directly; include Usb.h instead"
20 #else
21 #define __ADDRESS_H__
22 
23 
24 
25 /* NAK powers. To save space in endpoint data structure, amount of retries before giving up and returning 0x4 is stored in */
26 /* bmNakPower as a power of 2. The actual nak_limit is then calculated as nak_limit = ( 2^bmNakPower - 1) */
27 #define USB_NAK_MAX_POWER 15 //NAK binary order maximum value
28 #define USB_NAK_DEFAULT 14 //default 32K-1 NAKs before giving up
29 #define USB_NAK_NOWAIT 1 //Single NAK stops transfer
30 #define USB_NAK_NONAK 0 //Do not count NAKs, stop retrying after USB Timeout
31 
32 struct EpInfo {
33  uint8_t epAddr; // Endpoint address
34  uint8_t maxPktSize; // Maximum packet size
35 
36  union {
37  uint8_t epAttribs;
38 
39  struct {
40  uint8_t bmSndToggle : 1; // Send toggle, when zero bmSNDTOG0, bmSNDTOG1 otherwise
41  uint8_t bmRcvToggle : 1; // Send toggle, when zero bmRCVTOG0, bmRCVTOG1 otherwise
42  uint8_t bmNakPower : 6; // Binary order for NAK_LIMIT value
43  } __attribute__((packed));
44  };
45 } __attribute__((packed));
46 
47 // 7 6 5 4 3 2 1 0
48 // ---------------------------------
49 // | | H | P | P | P | A | A | A |
50 // ---------------------------------
51 //
52 // H - if 1 the address is a hub address
53 // P - parent hub address
54 // A - device address / port number in case of hub
55 //
56 
58 
59  union {
60 
61  struct {
62  uint8_t bmAddress : 3; // device address/port number
63  uint8_t bmParent : 3; // parent hub address
64  uint8_t bmHub : 1; // hub flag
65  uint8_t bmReserved : 1; // reserved, must be zero
66  } __attribute__((packed));
67  uint8_t devAddress;
68  };
69 } __attribute__((packed));
70 
71 #define bmUSB_DEV_ADDR_ADDRESS 0x07
72 #define bmUSB_DEV_ADDR_PARENT 0x38
73 #define bmUSB_DEV_ADDR_HUB 0x40
74 
75 struct UsbDevice {
76  EpInfo *epinfo; // endpoint info pointer
78  uint8_t epcount; // number of endpoints
79  bool lowspeed; // indicates if a device is the low speed one
80  // uint8_t devclass; // device class
81 } __attribute__((packed));
82 
83 class AddressPool {
84 public:
85  virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) = 0;
86  virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) = 0;
87  virtual void FreeAddress(uint8_t addr) = 0;
88 };
89 
90 typedef void (*UsbDeviceHandleFunc)(UsbDevice *pdev);
91 
92 #define ADDR_ERROR_INVALID_INDEX 0xFF
93 #define ADDR_ERROR_INVALID_ADDRESS 0xFF
94 
95 template <const uint8_t MAX_DEVICES_ALLOWED>
96 class AddressPoolImpl : public AddressPool {
97  EpInfo dev0ep; //Endpoint data structure used during enumeration for uninitialized device
98 
99  uint8_t hubCounter; // hub counter is kept
100  // in order to avoid hub address duplication
101 
102  UsbDevice thePool[MAX_DEVICES_ALLOWED];
103 
104  // Initializes address pool entry
105 
106  void InitEntry(uint8_t index) {
107  thePool[index].address.devAddress = 0;
108  thePool[index].epcount = 1;
109  thePool[index].lowspeed = 0;
110  thePool[index].epinfo = &dev0ep;
111  };
112 
113  // Returns thePool index for a given address
114 
115  uint8_t FindAddressIndex(uint8_t address = 0) {
116  for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) {
117  if(thePool[i].address.devAddress == address)
118  return i;
119  }
120  return 0;
121  };
122 
123  // Returns thePool child index for a given parent
124 
125  uint8_t FindChildIndex(UsbDeviceAddress addr, uint8_t start = 1) {
126  for(uint8_t i = (start < 1 || start >= MAX_DEVICES_ALLOWED) ? 1 : start; i < MAX_DEVICES_ALLOWED; i++) {
127  if(thePool[i].address.bmParent == addr.bmAddress)
128  return i;
129  }
130  return 0;
131  };
132 
133  // Frees address entry specified by index parameter
134 
135  void FreeAddressByIndex(uint8_t index) {
136  // Zero field is reserved and should not be affected
137  if(index == 0)
138  return;
139 
140  UsbDeviceAddress uda = thePool[index].address;
141  // If a hub was switched off all port addresses should be freed
142  if(uda.bmHub == 1) {
143  for(uint8_t i = 1; (i = FindChildIndex(uda, i));)
144  FreeAddressByIndex(i);
145 
146  // If the hub had the last allocated address, hubCounter should be decremented
147  if(hubCounter == uda.bmAddress)
148  hubCounter--;
149  }
150  InitEntry(index);
151  }
152 
153  // Initializes the whole address pool at once
154 
155  void InitAllAddresses() {
156  for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++)
157  InitEntry(i);
158 
159  hubCounter = 0;
160  };
161 
162 public:
163 
164  AddressPoolImpl() : hubCounter(0) {
165  // Zero address is reserved
166  InitEntry(0);
167 
168  thePool[0].address.devAddress = 0;
169  thePool[0].epinfo = &dev0ep;
170  dev0ep.epAddr = 0;
171  dev0ep.maxPktSize = 8;
172  dev0ep.bmSndToggle = 0; // Set DATA0/1 toggles to 0
173  dev0ep.bmRcvToggle = 0;
174  dev0ep.bmNakPower = USB_NAK_MAX_POWER;
175 
176  InitAllAddresses();
177  };
178 
179  // Returns a pointer to a specified address entry
180 
181  virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) {
182  if(!addr)
183  return thePool;
184 
185  uint8_t index = FindAddressIndex(addr);
186 
187  return (!index) ? NULL : thePool + index;
188  };
189 
190  // Performs an operation specified by pfunc for each addressed device
191 
193  if(!pfunc)
194  return;
195 
196  for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++)
197  if(thePool[i].address.devAddress)
198  pfunc(thePool + i);
199  };
200 
201  // Allocates new address
202 
203  virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) {
204  /* if (parent != 0 && port == 0)
205  USB_HOST_SERIAL.println("PRT:0"); */
206  UsbDeviceAddress _parent;
207  _parent.devAddress = parent;
208  if(_parent.bmReserved || port > 7)
209  //if(parent > 127 || port > 7)
210  return 0;
211 
212  if(is_hub && hubCounter == 7)
213  return 0;
214 
215  // finds first empty address entry starting from one
216  uint8_t index = FindAddressIndex(0);
217 
218  if(!index) // if empty entry is not found
219  return 0;
220 
221  if(_parent.devAddress == 0) {
222  if(is_hub) {
223  thePool[index].address.devAddress = 0x41;
224  hubCounter++;
225  } else
226  thePool[index].address.devAddress = 1;
227 
228  return thePool[index].address.devAddress;
229  }
230 
231  UsbDeviceAddress addr;
232  addr.devAddress = 0; // Ensure all bits are zero
233  addr.bmParent = _parent.bmAddress;
234  if(is_hub) {
235  addr.bmHub = 1;
236  addr.bmAddress = ++hubCounter;
237  } else {
238  addr.bmHub = 0;
239  addr.bmAddress = port;
240  }
241  thePool[index].address = addr;
242  /*
243  USB_HOST_SERIAL.print("Addr:");
244  USB_HOST_SERIAL.print(addr.bmHub, HEX);
245  USB_HOST_SERIAL.print(".");
246  USB_HOST_SERIAL.print(addr.bmParent, HEX);
247  USB_HOST_SERIAL.print(".");
248  USB_HOST_SERIAL.println(addr.bmAddress, HEX);
249  */
250  return thePool[index].address.devAddress;
251  };
252 
253  // Empties pool entry
254 
255  virtual void FreeAddress(uint8_t addr) {
256  // if the root hub is disconnected all the addresses should be initialized
257  if(addr == 0x41) {
258  InitAllAddresses();
259  return;
260  }
261  uint8_t index = FindAddressIndex(addr);
262  FreeAddressByIndex(index);
263  };
264 
265  // Returns number of hubs attached
266  // It can be rather helpfull to find out if there are hubs attached than getting the exact number of hubs.
267  //uint8_t GetNumHubs()
268  //{
269  // return hubCounter;
270  //};
271  //uint8_t GetNumDevices()
272  //{
273  // uint8_t counter = 0;
274 
275  // for (uint8_t i=1; i<MAX_DEVICES_ALLOWED; i++)
276  // if (thePool[i].address != 0);
277  // counter ++;
278 
279  // return counter;
280  //};
281 };
282 
283 #endif // __ADDRESS_H__
uint8_t bmRcvToggle
Definition: address.h:41
- -
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
uint8_t bmNakPower
Definition: address.h:42
- - -
uint8_t bmReserved
Definition: address.h:65
-
uint8_t epAttribs
Definition: address.h:37
-
uint8_t epAddr
Definition: address.h:33
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
-
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)
Definition: address.h:181
-
Definition: address.h:32
-
uint8_t bmSndToggle
Definition: address.h:40
-
uint8_t devAddress
Definition: address.h:67
-
uint8_t bmAddress
Definition: address.h:62
-
uint8_t bmParent
Definition: address.h:63
- -
uint8_t epcount
Definition: address.h:78
-
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc)
Definition: address.h:192
-
uint8_t maxPktSize
Definition: address.h:34
-
virtual void FreeAddress(uint8_t addr)
Definition: address.h:255
- -
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)
Definition: address.h:203
-
UsbDeviceAddress address
Definition: address.h:77
-
uint8_t bmHub
Definition: address.h:64
-
void(* UsbDeviceHandleFunc)(UsbDevice *pdev)
Definition: address.h:90
+Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 Contact information
18 -------------------
19 
20 Circuits At Home, LTD
21 Web : http://www.circuitsathome.com
22 e-mail : support@circuitsathome.com
23  */
24 
25 #if !defined(_usb_h_) || defined(__ADDRESS_H__)
26 #error "Never include address.h directly; include Usb.h instead"
27 #else
28 #define __ADDRESS_H__
29 
30 
31 
32 /* NAK powers. To save space in endpoint data structure, amount of retries before giving up and returning 0x4 is stored in */
33 /* bmNakPower as a power of 2. The actual nak_limit is then calculated as nak_limit = ( 2^bmNakPower - 1) */
34 #define USB_NAK_MAX_POWER 15 //NAK binary order maximum value
35 #define USB_NAK_DEFAULT 14 //default 32K-1 NAKs before giving up
36 #define USB_NAK_NOWAIT 1 //Single NAK stops transfer
37 #define USB_NAK_NONAK 0 //Do not count NAKs, stop retrying after USB Timeout
38 
39 struct EpInfo {
40  uint8_t epAddr; // Endpoint address
41  uint8_t maxPktSize; // Maximum packet size
42 
43  union {
44  uint8_t epAttribs;
45 
46  struct {
47  uint8_t bmSndToggle : 1; // Send toggle, when zero bmSNDTOG0, bmSNDTOG1 otherwise
48  uint8_t bmRcvToggle : 1; // Send toggle, when zero bmRCVTOG0, bmRCVTOG1 otherwise
49  uint8_t bmNakPower : 6; // Binary order for NAK_LIMIT value
50  } __attribute__((packed));
51  };
52 } __attribute__((packed));
53 
54 // 7 6 5 4 3 2 1 0
55 // ---------------------------------
56 // | | H | P | P | P | A | A | A |
57 // ---------------------------------
58 //
59 // H - if 1 the address is a hub address
60 // P - parent hub address
61 // A - device address / port number in case of hub
62 //
63 
65 
66  union {
67 
68  struct {
69  uint8_t bmAddress : 3; // device address/port number
70  uint8_t bmParent : 3; // parent hub address
71  uint8_t bmHub : 1; // hub flag
72  uint8_t bmReserved : 1; // reserved, must be zero
73  } __attribute__((packed));
74  uint8_t devAddress;
75  };
76 } __attribute__((packed));
77 
78 #define bmUSB_DEV_ADDR_ADDRESS 0x07
79 #define bmUSB_DEV_ADDR_PARENT 0x38
80 #define bmUSB_DEV_ADDR_HUB 0x40
81 
82 struct UsbDevice {
83  EpInfo *epinfo; // endpoint info pointer
85  uint8_t epcount; // number of endpoints
86  bool lowspeed; // indicates if a device is the low speed one
87  // uint8_t devclass; // device class
88 } __attribute__((packed));
89 
90 class AddressPool {
91 public:
92  virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) = 0;
93  virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) = 0;
94  virtual void FreeAddress(uint8_t addr) = 0;
95 };
96 
97 typedef void (*UsbDeviceHandleFunc)(UsbDevice *pdev);
98 
99 #define ADDR_ERROR_INVALID_INDEX 0xFF
100 #define ADDR_ERROR_INVALID_ADDRESS 0xFF
101 
102 template <const uint8_t MAX_DEVICES_ALLOWED>
103 class AddressPoolImpl : public AddressPool {
104  EpInfo dev0ep; //Endpoint data structure used during enumeration for uninitialized device
105 
106  uint8_t hubCounter; // hub counter is kept
107  // in order to avoid hub address duplication
108 
109  UsbDevice thePool[MAX_DEVICES_ALLOWED];
110 
111  // Initializes address pool entry
112 
113  void InitEntry(uint8_t index) {
114  thePool[index].address.devAddress = 0;
115  thePool[index].epcount = 1;
116  thePool[index].lowspeed = 0;
117  thePool[index].epinfo = &dev0ep;
118  };
119 
120  // Returns thePool index for a given address
121 
122  uint8_t FindAddressIndex(uint8_t address = 0) {
123  for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) {
124  if(thePool[i].address.devAddress == address)
125  return i;
126  }
127  return 0;
128  };
129 
130  // Returns thePool child index for a given parent
131 
132  uint8_t FindChildIndex(UsbDeviceAddress addr, uint8_t start = 1) {
133  for(uint8_t i = (start < 1 || start >= MAX_DEVICES_ALLOWED) ? 1 : start; i < MAX_DEVICES_ALLOWED; i++) {
134  if(thePool[i].address.bmParent == addr.bmAddress)
135  return i;
136  }
137  return 0;
138  };
139 
140  // Frees address entry specified by index parameter
141 
142  void FreeAddressByIndex(uint8_t index) {
143  // Zero field is reserved and should not be affected
144  if(index == 0)
145  return;
146 
147  UsbDeviceAddress uda = thePool[index].address;
148  // If a hub was switched off all port addresses should be freed
149  if(uda.bmHub == 1) {
150  for(uint8_t i = 1; (i = FindChildIndex(uda, i));)
151  FreeAddressByIndex(i);
152 
153  // If the hub had the last allocated address, hubCounter should be decremented
154  if(hubCounter == uda.bmAddress)
155  hubCounter--;
156  }
157  InitEntry(index);
158  }
159 
160  // Initializes the whole address pool at once
161 
162  void InitAllAddresses() {
163  for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++)
164  InitEntry(i);
165 
166  hubCounter = 0;
167  };
168 
169 public:
170 
171  AddressPoolImpl() : hubCounter(0) {
172  // Zero address is reserved
173  InitEntry(0);
174 
175  thePool[0].address.devAddress = 0;
176  thePool[0].epinfo = &dev0ep;
177  dev0ep.epAddr = 0;
178  dev0ep.maxPktSize = 8;
179  dev0ep.bmSndToggle = 0; // Set DATA0/1 toggles to 0
180  dev0ep.bmRcvToggle = 0;
181  dev0ep.bmNakPower = USB_NAK_MAX_POWER;
182 
183  InitAllAddresses();
184  };
185 
186  // Returns a pointer to a specified address entry
187 
188  virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) {
189  if(!addr)
190  return thePool;
191 
192  uint8_t index = FindAddressIndex(addr);
193 
194  return (!index) ? NULL : thePool + index;
195  };
196 
197  // Performs an operation specified by pfunc for each addressed device
198 
200  if(!pfunc)
201  return;
202 
203  for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++)
204  if(thePool[i].address.devAddress)
205  pfunc(thePool + i);
206  };
207 
208  // Allocates new address
209 
210  virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) {
211  /* if (parent != 0 && port == 0)
212  USB_HOST_SERIAL.println("PRT:0"); */
213  UsbDeviceAddress _parent;
214  _parent.devAddress = parent;
215  if(_parent.bmReserved || port > 7)
216  //if(parent > 127 || port > 7)
217  return 0;
218 
219  if(is_hub && hubCounter == 7)
220  return 0;
221 
222  // finds first empty address entry starting from one
223  uint8_t index = FindAddressIndex(0);
224 
225  if(!index) // if empty entry is not found
226  return 0;
227 
228  if(_parent.devAddress == 0) {
229  if(is_hub) {
230  thePool[index].address.devAddress = 0x41;
231  hubCounter++;
232  } else
233  thePool[index].address.devAddress = 1;
234 
235  return thePool[index].address.devAddress;
236  }
237 
238  UsbDeviceAddress addr;
239  addr.devAddress = 0; // Ensure all bits are zero
240  addr.bmParent = _parent.bmAddress;
241  if(is_hub) {
242  addr.bmHub = 1;
243  addr.bmAddress = ++hubCounter;
244  } else {
245  addr.bmHub = 0;
246  addr.bmAddress = port;
247  }
248  thePool[index].address = addr;
249  /*
250  USB_HOST_SERIAL.print("Addr:");
251  USB_HOST_SERIAL.print(addr.bmHub, HEX);
252  USB_HOST_SERIAL.print(".");
253  USB_HOST_SERIAL.print(addr.bmParent, HEX);
254  USB_HOST_SERIAL.print(".");
255  USB_HOST_SERIAL.println(addr.bmAddress, HEX);
256  */
257  return thePool[index].address.devAddress;
258  };
259 
260  // Empties pool entry
261 
262  virtual void FreeAddress(uint8_t addr) {
263  // if the root hub is disconnected all the addresses should be initialized
264  if(addr == 0x41) {
265  InitAllAddresses();
266  return;
267  }
268  uint8_t index = FindAddressIndex(addr);
269  FreeAddressByIndex(index);
270  };
271 
272  // Returns number of hubs attached
273  // It can be rather helpfull to find out if there are hubs attached than getting the exact number of hubs.
274  //uint8_t GetNumHubs()
275  //{
276  // return hubCounter;
277  //};
278  //uint8_t GetNumDevices()
279  //{
280  // uint8_t counter = 0;
281 
282  // for (uint8_t i=1; i<MAX_DEVICES_ALLOWED; i++)
283  // if (thePool[i].address != 0);
284  // counter ++;
285 
286  // return counter;
287  //};
288 };
289 
290 #endif // __ADDRESS_H__
uint8_t bmRcvToggle
Definition: address.h:48
+ +
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
uint8_t bmNakPower
Definition: address.h:49
+ + +
uint8_t bmReserved
Definition: address.h:72
+
virtual void FreeAddress(uint8_t addr)=0
+
uint8_t epAttribs
Definition: address.h:44
+
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
+
uint8_t epAddr
Definition: address.h:40
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
+
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)
Definition: address.h:188
+
Definition: address.h:39
+
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
+
uint8_t bmSndToggle
Definition: address.h:47
+
uint8_t devAddress
Definition: address.h:74
+
uint8_t bmAddress
Definition: address.h:69
+
uint8_t bmParent
Definition: address.h:70
+ +
uint8_t epcount
Definition: address.h:85
+
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc)
Definition: address.h:199
+
uint8_t maxPktSize
Definition: address.h:41
+
virtual void FreeAddress(uint8_t addr)
Definition: address.h:262
+ +
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)
Definition: address.h:210
+
UsbDeviceAddress address
Definition: address.h:84
+
uint8_t bmHub
Definition: address.h:71
+
void(* UsbDeviceHandleFunc)(UsbDevice *pdev)
Definition: address.h:97
diff --git a/adk_8cpp.html b/adk_8cpp.html index 99d83a7f..c95fef2a 100644 --- a/adk_8cpp.html +++ b/adk_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: adk.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/adk_8cpp__incl.md5 b/adk_8cpp__incl.md5 index aeb01f6d..b86ac594 100644 --- a/adk_8cpp__incl.md5 +++ b/adk_8cpp__incl.md5 @@ -1 +1 @@ -44064901c7f950ea3e40c91d455ee2ad \ No newline at end of file +37a39de020a1edaf438fb10fe5d6d241 \ No newline at end of file diff --git a/adk_8cpp__incl.png b/adk_8cpp__incl.png index 50af6776..85e64546 100644 Binary files a/adk_8cpp__incl.png and b/adk_8cpp__incl.png differ diff --git a/adk_8cpp_source.html b/adk_8cpp_source.html index c61c58e8..2e246883 100644 --- a/adk_8cpp_source.html +++ b/adk_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: adk.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
adk.cpp
-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 /* Google ADK interface */
19 
20 #include "adk.h"
21 
22 const uint8_t ADK::epDataInIndex = 1;
23 const uint8_t ADK::epDataOutIndex = 2;
24 
25 ADK::ADK(USB *p, const char* manufacturer,
26  const char* model,
27  const char* description,
28  const char* version,
29  const char* uri,
30  const char* serial) :
31 
32 /* ADK ID Strings */
33 manufacturer(manufacturer),
34 model(model),
35 description(description),
36 version(version),
37 uri(uri),
38 serial(serial),
39 pUsb(p), //pointer to USB class instance - mandatory
40 bAddress(0), //device address - mandatory
41 bConfNum(0), //configuration number
42 bNumEP(1), //if config descriptor needs to be parsed
43 ready(false) {
44  // initialize endpoint data structures
45  for(uint8_t i = 0; i < ADK_MAX_ENDPOINTS; i++) {
46  epInfo[i].epAddr = 0;
47  epInfo[i].maxPktSize = (i) ? 0 : 8;
48  epInfo[i].bmSndToggle = 0;
49  epInfo[i].bmRcvToggle = 0;
51  }//for(uint8_t i=0; i<ADK_MAX_ENDPOINTS; i++...
52 
53  // register in USB subsystem
54  if(pUsb) {
55  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
56  }
57 }
58 
59 uint8_t ADK::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
60  return Init(parent, port, lowspeed); // Just call Init. Yes, really!
61 }
62 
63 /* Connection initialization of an Android phone */
64 uint8_t ADK::Init(uint8_t parent, uint8_t port, bool lowspeed) {
65  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
66  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
67  uint8_t rcode;
68  uint8_t num_of_conf; // number of configurations
69  UsbDevice *p = NULL;
70  EpInfo *oldep_ptr = NULL;
71 
72  // get memory address of USB device address pool
73  AddressPool &addrPool = pUsb->GetAddressPool();
74 
75  USBTRACE("\r\nADK Init");
76 
77  // check if address has already been assigned to an instance
78  if(bAddress) {
79  USBTRACE("\r\nAddress in use");
81  }
82 
83  // Get pointer to pseudo device with address 0 assigned
84  p = addrPool.GetUsbDevicePtr(0);
85 
86  if(!p) {
87  USBTRACE("\r\nAddress not found");
89  }
90 
91  if(!p->epinfo) {
92  USBTRACE("epinfo is null\r\n");
94  }
95 
96  // Save old pointer to EP_RECORD of address 0
97  oldep_ptr = p->epinfo;
98 
99  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
100  p->epinfo = epInfo;
101 
102  p->lowspeed = lowspeed;
103 
104  // Get device descriptor
105  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
106 
107  // Restore p->epinfo
108  p->epinfo = oldep_ptr;
109 
110  if(rcode) {
111  goto FailGetDevDescr;
112  }
113 
114  // Allocate new address according to device class
115  bAddress = addrPool.AllocAddress(parent, false, port);
116 
117  // Extract Max Packet Size from device descriptor
118  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
119 
120  // Assign new address to the device
121  rcode = pUsb->setAddr(0, 0, bAddress);
122  if(rcode) {
123  p->lowspeed = false;
124  addrPool.FreeAddress(bAddress);
125  bAddress = 0;
126  //USBTRACE2("setAddr:",rcode);
127  return rcode;
128  }//if (rcode...
129 
130  //USBTRACE2("\r\nAddr:", bAddress);
131  // Spec says you should wait at least 200ms.
132  //delay(300);
133 
134  p->lowspeed = false;
135 
136  //get pointer to assigned address record
137  p = addrPool.GetUsbDevicePtr(bAddress);
138  if(!p) {
140  }
141 
142  p->lowspeed = lowspeed;
143 
144  // Assign epInfo to epinfo pointer - only EP0 is known
145  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
146  if(rcode) {
147  goto FailSetDevTblEntry;
148  }
149 
150  //check if ADK device is already in accessory mode; if yes, configure and exit
151  if(udd->idVendor == ADK_VID &&
152  (udd->idProduct == ADK_PID || udd->idProduct == ADB_PID)) {
153  USBTRACE("\r\nAcc.mode device detected");
154  /* go through configurations, find first bulk-IN, bulk-OUT EP, fill epInfo and quit */
155  num_of_conf = udd->bNumConfigurations;
156 
157  //USBTRACE2("\r\nNC:",num_of_conf);
158  for(uint8_t i = 0; i < num_of_conf; i++) {
159  ConfigDescParser < 0, 0, 0, 0 > confDescrParser(this);
160  delay(1);
161  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
162 #if defined(XOOM)
163  //added by Jaylen Scott Vanorden
164  if(rcode) {
165  USBTRACE2("\r\nGot 1st bad code for config: ", rcode);
166  // Try once more
167  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
168  }
169 #endif
170  if(rcode) {
171  goto FailGetConfDescr;
172  }
173  if(bNumEP > 2) {
174  break;
175  }
176  } // for (uint8_t i=0; i<num_of_conf; i++...
177 
178  if(bNumEP == 3) {
179  // Assign epInfo to epinfo pointer - this time all 3 endpoins
180  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
181  if(rcode) {
182  goto FailSetDevTblEntry;
183  }
184  }
185 
186  // Set Configuration Value
187  rcode = pUsb->setConf(bAddress, 0, bConfNum);
188  if(rcode) {
189  goto FailSetConfDescr;
190  }
191  /* print endpoint structure */
192  /*
193  USBTRACE("\r\nEndpoint Structure:");
194  USBTRACE("\r\nEP0:");
195  USBTRACE2("\r\nAddr: ", epInfo[0].epAddr);
196  USBTRACE2("\r\nMax.pkt.size: ", epInfo[0].maxPktSize);
197  USBTRACE2("\r\nAttr: ", epInfo[0].epAttribs);
198  USBTRACE("\r\nEpout:");
199  USBTRACE2("\r\nAddr: ", epInfo[epDataOutIndex].epAddr);
200  USBTRACE2("\r\nMax.pkt.size: ", epInfo[epDataOutIndex].maxPktSize);
201  USBTRACE2("\r\nAttr: ", epInfo[epDataOutIndex].epAttribs);
202  USBTRACE("\r\nEpin:");
203  USBTRACE2("\r\nAddr: ", epInfo[epDataInIndex].epAddr);
204  USBTRACE2("\r\nMax.pkt.size: ", epInfo[epDataInIndex].maxPktSize);
205  USBTRACE2("\r\nAttr: ", epInfo[epDataInIndex].epAttribs);
206  */
207 
208  USBTRACE("\r\nConfiguration successful");
209  ready = true;
210  return 0; //successful configuration
211  }//if( buf->idVendor == ADK_VID...
212 
213  //probe device - get accessory protocol revision
214  {
215  uint16_t adkproto = -1;
216  delay(1);
217  rcode = getProto((uint8_t*) & adkproto);
218 #if defined(XOOM)
219  //added by Jaylen Scott Vanorden
220  if(rcode) {
221  USBTRACE2("\r\nGot 1st bad code for proto: ", rcode);
222  // Try once more
223  rcode = getProto((uint8_t*) & adkproto);
224  }
225 #endif
226  if(rcode) {
227  goto FailGetProto; //init fails
228  }
229  USBTRACE2("\r\nADK protocol rev. ", adkproto);
230  }
231 
232  delay(100);
233 
234  //sending ID strings
235  sendStr(ACCESSORY_STRING_MANUFACTURER, manufacturer);
236  delay(10);
237  sendStr(ACCESSORY_STRING_MODEL, model);
238  delay(10);
239  sendStr(ACCESSORY_STRING_DESCRIPTION, description);
240  delay(10);
241  sendStr(ACCESSORY_STRING_VERSION, version);
242  delay(10);
243  sendStr(ACCESSORY_STRING_URI, uri);
244  delay(10);
245  sendStr(ACCESSORY_STRING_SERIAL, serial);
246 
247  delay(100);
248 
249  //switch to accessory mode
250  //the Android phone will reset
251  rcode = switchAcc();
252  if(rcode) {
253  goto FailSwAcc; //init fails
254  }
256  delay(100); // Give Android a chance to do its reset. This is a guess, and possibly could be lower.
257  goto SwAttempt; //switch to accessory mode attempted
258 
259  /* diagnostic messages */
260 FailGetDevDescr:
261 #ifdef DEBUG_USB_HOST
262  NotifyFailGetDevDescr(rcode);
263  goto Fail;
264 #endif
265 
266 FailSetDevTblEntry:
267 #ifdef DEBUG_USB_HOST
269  goto Fail;
270 #endif
271 
272 FailGetConfDescr:
273 #ifdef DEBUG_USB_HOST
274  NotifyFailGetConfDescr(rcode);
275  goto Fail;
276 #endif
277 
278 FailSetConfDescr:
279 #ifdef DEBUG_USB_HOST
280  NotifyFailSetConfDescr(rcode);
281  goto Fail;
282 #endif
283 
284 FailGetProto:
285 #ifdef DEBUG_USB_HOST
286  USBTRACE("\r\ngetProto:");
287  goto Fail;
288 #endif
289 
290 FailSwAcc:
291 #ifdef DEBUG_USB_HOST
292  USBTRACE("\r\nswAcc:");
293  goto Fail;
294 #endif
295 
296  //FailOnInit:
297  // USBTRACE("OnInit:");
298  // goto Fail;
299  //
300 SwAttempt:
301 #ifdef DEBUG_USB_HOST
302  USBTRACE("\r\nAccessory mode switch attempt");
303 Fail:
304 #endif
305  //USBTRACE2("\r\nADK Init Failed, error code: ", rcode);
306  //NotifyFail(rcode);
307  Release();
308  return rcode;
309 }
310 
311 /* Extracts bulk-IN and bulk-OUT endpoint information from config descriptor */
312 void ADK::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
313  //ErrorMessage<uint8_t>(PSTR("Conf.Val"), conf);
314  //ErrorMessage<uint8_t>(PSTR("Iface Num"), iface);
315  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
316 
317  //added by Yuuichi Akagawa
318  if(bNumEP == 3) {
319  return;
320  }
321 
322  bConfNum = conf;
323 
324  if((pep->bmAttributes & 0x02) == 2) {
325  uint8_t index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
326  // Fill in the endpoint info structure
327  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
328  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
329 
330  bNumEP++;
331 
332  //PrintEndpointDescriptor(pep);
333  }
334 }
335 
336 /* Performs a cleanup after failed Init() attempt */
337 uint8_t ADK::Release() {
339 
340  bNumEP = 1; //must have to be reset to 1
341 
342  bAddress = 0;
343  ready = false;
344  return 0;
345 }
346 
347 uint8_t ADK::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
348  //USBTRACE2("\r\nAddr: ", bAddress );
349  //USBTRACE2("\r\nEP: ",epInfo[epDataInIndex].epAddr);
350  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
351 }
352 
353 uint8_t ADK::SndData(uint16_t nbytes, uint8_t *dataptr) {
354  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
355 }
356 
358  Notify(PSTR("Endpoint descriptor:"), 0x80);
359  Notify(PSTR("\r\nLength:\t\t"), 0x80);
360  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
361  Notify(PSTR("\r\nType:\t\t"), 0x80);
362  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
363  Notify(PSTR("\r\nAddress:\t"), 0x80);
364  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
365  Notify(PSTR("\r\nAttributes:\t"), 0x80);
366  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
367  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
368  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
369  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
370  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
371  Notify(PSTR("\r\n"), 0x80);
372 }
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
-
uint8_t bmRcvToggle
Definition: address.h:41
- +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 /* Google ADK interface */
19 
20 #include "adk.h"
21 
22 const uint8_t ADK::epDataInIndex = 1;
23 const uint8_t ADK::epDataOutIndex = 2;
24 
25 ADK::ADK(USB *p, const char* manufacturer,
26  const char* model,
27  const char* description,
28  const char* version,
29  const char* uri,
30  const char* serial) :
31 
32 /* ADK ID Strings */
33 manufacturer(manufacturer),
34 model(model),
35 description(description),
36 version(version),
37 uri(uri),
38 serial(serial),
39 pUsb(p), //pointer to USB class instance - mandatory
40 bAddress(0), //device address - mandatory
41 bConfNum(0), //configuration number
42 bNumEP(1), //if config descriptor needs to be parsed
43 ready(false) {
44  // initialize endpoint data structures
45  for(uint8_t i = 0; i < ADK_MAX_ENDPOINTS; i++) {
46  epInfo[i].epAddr = 0;
47  epInfo[i].maxPktSize = (i) ? 0 : 8;
48  epInfo[i].bmSndToggle = 0;
49  epInfo[i].bmRcvToggle = 0;
51  }//for(uint8_t i=0; i<ADK_MAX_ENDPOINTS; i++...
52 
53  // register in USB subsystem
54  if(pUsb) {
55  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
56  }
57 }
58 
59 uint8_t ADK::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
60  return Init(parent, port, lowspeed); // Just call Init. Yes, really!
61 }
62 
63 /* Connection initialization of an Android phone */
64 uint8_t ADK::Init(uint8_t parent, uint8_t port, bool lowspeed) {
65  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
66  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
67  uint8_t rcode;
68  uint8_t num_of_conf; // number of configurations
69  UsbDevice *p = NULL;
70  EpInfo *oldep_ptr = NULL;
71 
72  // get memory address of USB device address pool
73  AddressPool &addrPool = pUsb->GetAddressPool();
74 
75  USBTRACE("\r\nADK Init");
76 
77  // check if address has already been assigned to an instance
78  if(bAddress) {
79  USBTRACE("\r\nAddress in use");
81  }
82 
83  // Get pointer to pseudo device with address 0 assigned
84  p = addrPool.GetUsbDevicePtr(0);
85 
86  if(!p) {
87  USBTRACE("\r\nAddress not found");
89  }
90 
91  if(!p->epinfo) {
92  USBTRACE("epinfo is null\r\n");
94  }
95 
96  // Save old pointer to EP_RECORD of address 0
97  oldep_ptr = p->epinfo;
98 
99  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
100  p->epinfo = epInfo;
101 
102  p->lowspeed = lowspeed;
103 
104  // Get device descriptor
105  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
106 
107  // Restore p->epinfo
108  p->epinfo = oldep_ptr;
109 
110  if(rcode) {
111  goto FailGetDevDescr;
112  }
113 
114  // Allocate new address according to device class
115  bAddress = addrPool.AllocAddress(parent, false, port);
116 
117  // Extract Max Packet Size from device descriptor
118  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
119 
120  // Assign new address to the device
121  rcode = pUsb->setAddr(0, 0, bAddress);
122  if(rcode) {
123  p->lowspeed = false;
124  addrPool.FreeAddress(bAddress);
125  bAddress = 0;
126  //USBTRACE2("setAddr:",rcode);
127  return rcode;
128  }//if (rcode...
129 
130  //USBTRACE2("\r\nAddr:", bAddress);
131  // Spec says you should wait at least 200ms.
132  //delay(300);
133 
134  p->lowspeed = false;
135 
136  //get pointer to assigned address record
137  p = addrPool.GetUsbDevicePtr(bAddress);
138  if(!p) {
140  }
141 
142  p->lowspeed = lowspeed;
143 
144  // Assign epInfo to epinfo pointer - only EP0 is known
145  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
146  if(rcode) {
147  goto FailSetDevTblEntry;
148  }
149 
150  //check if ADK device is already in accessory mode; if yes, configure and exit
151  if(udd->idVendor == ADK_VID &&
152  (udd->idProduct == ADK_PID || udd->idProduct == ADB_PID)) {
153  USBTRACE("\r\nAcc.mode device detected");
154  /* go through configurations, find first bulk-IN, bulk-OUT EP, fill epInfo and quit */
155  num_of_conf = udd->bNumConfigurations;
156 
157  //USBTRACE2("\r\nNC:",num_of_conf);
158  for(uint8_t i = 0; i < num_of_conf; i++) {
159  ConfigDescParser < 0, 0, 0, 0 > confDescrParser(this);
160  delay(1);
161  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
162 #if defined(XOOM)
163  //added by Jaylen Scott Vanorden
164  if(rcode) {
165  USBTRACE2("\r\nGot 1st bad code for config: ", rcode);
166  // Try once more
167  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
168  }
169 #endif
170  if(rcode) {
171  goto FailGetConfDescr;
172  }
173  if(bNumEP > 2) {
174  break;
175  }
176  } // for (uint8_t i=0; i<num_of_conf; i++...
177 
178  if(bNumEP == 3) {
179  // Assign epInfo to epinfo pointer - this time all 3 endpoins
180  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
181  if(rcode) {
182  goto FailSetDevTblEntry;
183  }
184  }
185 
186  // Set Configuration Value
187  rcode = pUsb->setConf(bAddress, 0, bConfNum);
188  if(rcode) {
189  goto FailSetConfDescr;
190  }
191  /* print endpoint structure */
192  /*
193  USBTRACE("\r\nEndpoint Structure:");
194  USBTRACE("\r\nEP0:");
195  USBTRACE2("\r\nAddr: ", epInfo[0].epAddr);
196  USBTRACE2("\r\nMax.pkt.size: ", epInfo[0].maxPktSize);
197  USBTRACE2("\r\nAttr: ", epInfo[0].epAttribs);
198  USBTRACE("\r\nEpout:");
199  USBTRACE2("\r\nAddr: ", epInfo[epDataOutIndex].epAddr);
200  USBTRACE2("\r\nMax.pkt.size: ", epInfo[epDataOutIndex].maxPktSize);
201  USBTRACE2("\r\nAttr: ", epInfo[epDataOutIndex].epAttribs);
202  USBTRACE("\r\nEpin:");
203  USBTRACE2("\r\nAddr: ", epInfo[epDataInIndex].epAddr);
204  USBTRACE2("\r\nMax.pkt.size: ", epInfo[epDataInIndex].maxPktSize);
205  USBTRACE2("\r\nAttr: ", epInfo[epDataInIndex].epAttribs);
206  */
207 
208  USBTRACE("\r\nConfiguration successful");
209  ready = true;
210  return 0; //successful configuration
211  }//if( buf->idVendor == ADK_VID...
212 
213  //probe device - get accessory protocol revision
214  {
215  uint16_t adkproto = -1;
216  delay(1);
217  rcode = getProto((uint8_t*) & adkproto);
218 #if defined(XOOM)
219  //added by Jaylen Scott Vanorden
220  if(rcode) {
221  USBTRACE2("\r\nGot 1st bad code for proto: ", rcode);
222  // Try once more
223  rcode = getProto((uint8_t*) & adkproto);
224  }
225 #endif
226  if(rcode) {
227  goto FailGetProto; //init fails
228  }
229  USBTRACE2("\r\nADK protocol rev. ", adkproto);
230  }
231 
232  delay(100);
233 
234  //sending ID strings
235  sendStr(ACCESSORY_STRING_MANUFACTURER, manufacturer);
236  delay(10);
237  sendStr(ACCESSORY_STRING_MODEL, model);
238  delay(10);
239  sendStr(ACCESSORY_STRING_DESCRIPTION, description);
240  delay(10);
241  sendStr(ACCESSORY_STRING_VERSION, version);
242  delay(10);
243  sendStr(ACCESSORY_STRING_URI, uri);
244  delay(10);
245  sendStr(ACCESSORY_STRING_SERIAL, serial);
246 
247  delay(100);
248 
249  //switch to accessory mode
250  //the Android phone will reset
251  rcode = switchAcc();
252  if(rcode) {
253  goto FailSwAcc; //init fails
254  }
256  delay(100); // Give Android a chance to do its reset. This is a guess, and possibly could be lower.
257  goto SwAttempt; //switch to accessory mode attempted
258 
259  /* diagnostic messages */
260 FailGetDevDescr:
261 #ifdef DEBUG_USB_HOST
262  NotifyFailGetDevDescr(rcode);
263  goto Fail;
264 #endif
265 
266 FailSetDevTblEntry:
267 #ifdef DEBUG_USB_HOST
269  goto Fail;
270 #endif
271 
272 FailGetConfDescr:
273 #ifdef DEBUG_USB_HOST
274  NotifyFailGetConfDescr(rcode);
275  goto Fail;
276 #endif
277 
278 FailSetConfDescr:
279 #ifdef DEBUG_USB_HOST
280  NotifyFailSetConfDescr(rcode);
281  goto Fail;
282 #endif
283 
284 FailGetProto:
285 #ifdef DEBUG_USB_HOST
286  USBTRACE("\r\ngetProto:");
287  goto Fail;
288 #endif
289 
290 FailSwAcc:
291 #ifdef DEBUG_USB_HOST
292  USBTRACE("\r\nswAcc:");
293  goto Fail;
294 #endif
295 
296  //FailOnInit:
297  // USBTRACE("OnInit:");
298  // goto Fail;
299  //
300 SwAttempt:
301 #ifdef DEBUG_USB_HOST
302  USBTRACE("\r\nAccessory mode switch attempt");
303 Fail:
304 #endif
305  //USBTRACE2("\r\nADK Init Failed, error code: ", rcode);
306  //NotifyFail(rcode);
307  Release();
308  return rcode;
309 }
310 
311 /* Extracts bulk-IN and bulk-OUT endpoint information from config descriptor */
312 void ADK::EndpointXtract(uint8_t conf, uint8_t iface __attribute__((unused)), uint8_t alt __attribute__((unused)), uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *pep) {
313  //ErrorMessage<uint8_t>(PSTR("Conf.Val"), conf);
314  //ErrorMessage<uint8_t>(PSTR("Iface Num"), iface);
315  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
316 
317  //added by Yuuichi Akagawa
318  if(bNumEP == 3) {
319  return;
320  }
321 
322  bConfNum = conf;
323 
325  uint8_t index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
326  // Fill in the endpoint info structure
327  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
328  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
329 
330  bNumEP++;
331 
332  //PrintEndpointDescriptor(pep);
333  }
334 }
335 
336 /* Performs a cleanup after failed Init() attempt */
337 uint8_t ADK::Release() {
339 
340  bNumEP = 1; //must have to be reset to 1
341 
342  bAddress = 0;
343  ready = false;
344  return 0;
345 }
346 
347 uint8_t ADK::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
348  //USBTRACE2("\r\nAddr: ", bAddress );
349  //USBTRACE2("\r\nEP: ",epInfo[epDataInIndex].epAddr);
350  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
351 }
352 
353 uint8_t ADK::SndData(uint16_t nbytes, uint8_t *dataptr) {
354  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
355 }
356 
358  Notify(PSTR("Endpoint descriptor:"), 0x80);
359  Notify(PSTR("\r\nLength:\t\t"), 0x80);
360  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
361  Notify(PSTR("\r\nType:\t\t"), 0x80);
362  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
363  Notify(PSTR("\r\nAddress:\t"), 0x80);
364  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
365  Notify(PSTR("\r\nAttributes:\t"), 0x80);
366  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
367  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
368  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
369  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
370  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
371  Notify(PSTR("\r\n"), 0x80);
372 }
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+
uint8_t bmRcvToggle
Definition: address.h:48
+
#define ADB_PID
Definition: adk.h:27
#define ACCESSORY_STRING_MODEL
Definition: adk.h:43
static const uint8_t epDataInIndex
Definition: adk.h:69
uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr)
Definition: adk.cpp:347
-
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
uint8_t bmNakPower
Definition: address.h:42
- +
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
uint8_t bmNakPower
Definition: address.h:49
+
uint8_t Release()
Definition: adk.cpp:337
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
Definition: adk.cpp:353
- - - + + +
#define ACCESSORY_STRING_URI
Definition: adk.h:46
#define ACCESSORY_STRING_MANUFACTURER
Definition: adk.h:42
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: adk.cpp:312
USB * pUsb
Definition: adk.h:73
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: adk.cpp:59
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
static const uint8_t epDataOutIndex
Definition: adk.h:70
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
#define ADK_PID
Definition: adk.h:26
virtual void FreeAddress(uint8_t addr)=0
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
#define Notify(...)
Definition: message.h:44
- - -
#define USBTRACE2(s, r)
Definition: macros.h:77
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
#define NotifyFailGetConfDescr(...)
Definition: message.h:52
-
uint8_t epAddr
Definition: address.h:33
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
+
#define Notify(...)
Definition: message.h:51
+ + +
#define USBTRACE2(s, r)
Definition: macros.h:84
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
#define NotifyFailGetConfDescr(...)
Definition: message.h:59
+
uint8_t epAddr
Definition: address.h:40
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
bool ready
Definition: adk.h:78
#define ACCESSORY_STRING_SERIAL
Definition: adk.h:47
-
Definition: address.h:32
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
-
uint16_t wMaxPacketSize
Definition: usb_ch9.h:146
+
Definition: address.h:39
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
+
uint16_t wMaxPacketSize
Definition: usb_ch9.h:153
+
#define bmUSB_TRANSFER_TYPE
Definition: usb_ch9.h:94
#define ACCESSORY_STRING_VERSION
Definition: adk.h:45
ADK(USB *pUsb, const char *manufacturer, const char *model, const char *description, const char *version, const char *uri, const char *serial)
Definition: adk.cpp:25
EpInfo epInfo[ADK_MAX_ENDPOINTS]
Definition: adk.h:81
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bEndpointAddress
Definition: usb_ch9.h:144
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
+
uint8_t bEndpointAddress
Definition: usb_ch9.h:151
+
uint8_t bmSndToggle
Definition: address.h:47
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
#define ADK_MAX_ENDPOINTS
Definition: adk.h:49
- +
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: adk.cpp:357
-
#define USB_NAK_NOWAIT
Definition: address.h:29
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
+
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: adk.cpp:64
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
+
#define USB_TRANSFER_TYPE_BULK
Definition: usb_ch9.h:92
#define ACCESSORY_STRING_DESCRIPTION
Definition: adk.h:44
uint8_t bNumEP
Definition: adk.h:77
#define ADK_VID
Definition: adk.h:25
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
uint8_t bConfNum
Definition: adk.h:75
-
#define USBTRACE(s)
Definition: macros.h:75
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
+
#define USBTRACE(s)
Definition: macros.h:82
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
uint8_t bAddress
Definition: adk.h:74
-
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
Definition: UsbCore.h:88
- +
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
Definition: UsbCore.h:99
+
diff --git a/adk_8h.html b/adk_8h.html index a8006e0e..1b36397d 100644 --- a/adk_8h.html +++ b/adk_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: adk.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ ADK_VID

+
@@ -164,11 +146,13 @@ Macros
-

Definition at line 25 of file adk.h.

+

Definition at line 25 of file adk.h.

- + +

◆ ADK_PID

+
@@ -178,11 +162,13 @@ Macros
-

Definition at line 26 of file adk.h.

+

Definition at line 26 of file adk.h.

- + +

◆ ADB_PID

+
@@ -192,11 +178,13 @@ Macros
-

Definition at line 27 of file adk.h.

+

Definition at line 27 of file adk.h.

- + +

◆ XOOM

+
@@ -206,11 +194,13 @@ Macros
-

Definition at line 29 of file adk.h.

+

Definition at line 29 of file adk.h.

- + +

◆ ADK_GETPROTO

+
@@ -220,11 +210,13 @@ Macros
-

Definition at line 35 of file adk.h.

+

Definition at line 35 of file adk.h.

- + +

◆ ADK_SENDSTR

+
@@ -234,11 +226,13 @@ Macros
-

Definition at line 36 of file adk.h.

+

Definition at line 36 of file adk.h.

- + +

◆ ADK_ACCSTART

+
@@ -248,11 +242,13 @@ Macros
-

Definition at line 37 of file adk.h.

+

Definition at line 37 of file adk.h.

- + +

◆ bmREQ_ADK_GET

+
@@ -262,11 +258,13 @@ Macros
-

Definition at line 39 of file adk.h.

+

Definition at line 39 of file adk.h.

- + +

◆ bmREQ_ADK_SEND

+
@@ -276,11 +274,13 @@ Macros
-

Definition at line 40 of file adk.h.

+

Definition at line 40 of file adk.h.

- + +

◆ ACCESSORY_STRING_MANUFACTURER

+
@@ -290,11 +290,13 @@ Macros
-

Definition at line 42 of file adk.h.

+

Definition at line 42 of file adk.h.

- + +

◆ ACCESSORY_STRING_MODEL

+
@@ -304,11 +306,13 @@ Macros
-

Definition at line 43 of file adk.h.

+

Definition at line 43 of file adk.h.

- + +

◆ ACCESSORY_STRING_DESCRIPTION

+
@@ -318,11 +322,13 @@ Macros
-

Definition at line 44 of file adk.h.

+

Definition at line 44 of file adk.h.

- + +

◆ ACCESSORY_STRING_VERSION

+
@@ -332,11 +338,13 @@ Macros
-

Definition at line 45 of file adk.h.

+

Definition at line 45 of file adk.h.

- + +

◆ ACCESSORY_STRING_URI

+
@@ -346,11 +354,13 @@ Macros
-

Definition at line 46 of file adk.h.

+

Definition at line 46 of file adk.h.

- + +

◆ ACCESSORY_STRING_SERIAL

+
@@ -360,11 +370,13 @@ Macros
-

Definition at line 47 of file adk.h.

+

Definition at line 47 of file adk.h.

- + +

◆ ADK_MAX_ENDPOINTS

+
@@ -374,7 +386,7 @@ Macros
-

Definition at line 49 of file adk.h.

+

Definition at line 49 of file adk.h.

@@ -383,7 +395,7 @@ Macros diff --git a/adk_8h__dep__incl.md5 b/adk_8h__dep__incl.md5 index 721031bf..18dadafe 100644 --- a/adk_8h__dep__incl.md5 +++ b/adk_8h__dep__incl.md5 @@ -1 +1 @@ -e6d0d56c52d3fb6e81b76806cae456b2 \ No newline at end of file +a78ec97d5c424edcde2b6c3a1b1b88c2 \ No newline at end of file diff --git a/adk_8h__dep__incl.png b/adk_8h__dep__incl.png index 119386d5..e5ddcbf0 100644 Binary files a/adk_8h__dep__incl.png and b/adk_8h__dep__incl.png differ diff --git a/adk_8h__incl.md5 b/adk_8h__incl.md5 index 78ab8688..383ea7d2 100644 --- a/adk_8h__incl.md5 +++ b/adk_8h__incl.md5 @@ -1 +1 @@ -6316d3a392a1c1e1b044b310cd053323 \ No newline at end of file +42c5ecb0a034afd3b6c9fa96def7afb2 \ No newline at end of file diff --git a/adk_8h__incl.png b/adk_8h__incl.png index 89061315..0799da79 100644 Binary files a/adk_8h__incl.png and b/adk_8h__incl.png differ diff --git a/adk_8h_source.html b/adk_8h_source.html index 70e5d293..394baaf0 100644 --- a/adk_8h_source.html +++ b/adk_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: adk.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
adk.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 /* Google ADK interface support header */
19 
20 #if !defined(_ADK_H_)
21 #define _ADK_H_
22 
23 #include "Usb.h"
24 
25 #define ADK_VID 0x18D1
26 #define ADK_PID 0x2D00
27 #define ADB_PID 0x2D01
28 
29 #define XOOM //enables repeating getProto() and getConf() attempts
30 //necessary for slow devices such as Motorola XOOM
31 //defined by default, can be commented out to save memory
32 
33 /* requests */
34 
35 #define ADK_GETPROTO 51 //check USB accessory protocol version
36 #define ADK_SENDSTR 52 //send identifying string
37 #define ADK_ACCSTART 53 //start device in accessory mode
38 
39 #define bmREQ_ADK_GET USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE
40 #define bmREQ_ADK_SEND USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE
41 
42 #define ACCESSORY_STRING_MANUFACTURER 0
43 #define ACCESSORY_STRING_MODEL 1
44 #define ACCESSORY_STRING_DESCRIPTION 2
45 #define ACCESSORY_STRING_VERSION 3
46 #define ACCESSORY_STRING_URI 4
47 #define ACCESSORY_STRING_SERIAL 5
48 
49 #define ADK_MAX_ENDPOINTS 3 //endpoint 0, bulk_IN, bulk_OUT
50 
51 class ADK;
52 
53 class ADK : public USBDeviceConfig, public UsbConfigXtracter {
54 private:
55  /* ID strings */
56  const char* manufacturer;
57  const char* model;
58  const char* description;
59  const char* version;
60  const char* uri;
61  const char* serial;
62 
63  /* ADK proprietary requests */
64  uint8_t getProto(uint8_t* adkproto);
65  uint8_t sendStr(uint8_t index, const char* str);
66  uint8_t switchAcc(void);
67 
68 protected:
69  static const uint8_t epDataInIndex; // DataIn endpoint index
70  static const uint8_t epDataOutIndex; // DataOUT endpoint index
71 
72  /* mandatory members */
74  uint8_t bAddress;
75  uint8_t bConfNum; // configuration number
76 
77  uint8_t bNumEP; // total number of EP in the configuration
78  bool ready;
79 
80  /* Endpoint data structure */
82 
84 
85 public:
86  ADK(USB *pUsb, const char* manufacturer,
87  const char* model,
88  const char* description,
89  const char* version,
90  const char* uri,
91  const char* serial);
92 
93  // Methods for receiving and sending data
94  uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr);
95  uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
96 
97 
98  // USBDeviceConfig implementation
99  uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed);
100  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
101  uint8_t Release();
102 
103  virtual uint8_t Poll() {
104  return 0;
105  };
106 
107  virtual uint8_t GetAddress() {
108  return bAddress;
109  };
110 
111  virtual bool isReady() {
112  return ready;
113  };
114 
115  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
116  return (vid == ADK_VID && (pid == ADK_PID || pid == ADB_PID));
117  };
118 
119  //UsbConfigXtracter implementation
120  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
121 }; //class ADK : public USBDeviceConfig ...
122 
123 /* get ADK protocol version */
124 
125 /* returns 2 bytes in *adkproto */
126 inline uint8_t ADK::getProto(uint8_t* adkproto) {
127  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_ADK_GET, ADK_GETPROTO, 0, 0, 0, 2, 2, adkproto, NULL));
128 }
129 
130 /* send ADK string */
131 inline uint8_t ADK::sendStr(uint8_t index, const char* str) {
132  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_ADK_SEND, ADK_SENDSTR, 0, 0, index, strlen(str) + 1, strlen(str) + 1, (uint8_t*)str, NULL));
133 }
134 
135 /* switch to accessory mode */
136 inline uint8_t ADK::switchAcc(void) {
137  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_ADK_SEND, ADK_ACCSTART, 0, 0, 0, 0, 0, NULL, NULL));
138 }
139 
140 #endif // _ADK_H_
#define ADB_PID
Definition: adk.h:27
+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 /* Google ADK interface support header */
19 
20 #if !defined(_ADK_H_)
21 #define _ADK_H_
22 
23 #include "Usb.h"
24 
25 #define ADK_VID 0x18D1
26 #define ADK_PID 0x2D00
27 #define ADB_PID 0x2D01
28 
29 #define XOOM //enables repeating getProto() and getConf() attempts
30 //necessary for slow devices such as Motorola XOOM
31 //defined by default, can be commented out to save memory
32 
33 /* requests */
34 
35 #define ADK_GETPROTO 51 //check USB accessory protocol version
36 #define ADK_SENDSTR 52 //send identifying string
37 #define ADK_ACCSTART 53 //start device in accessory mode
38 
39 #define bmREQ_ADK_GET USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE
40 #define bmREQ_ADK_SEND USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_VENDOR|USB_SETUP_RECIPIENT_DEVICE
41 
42 #define ACCESSORY_STRING_MANUFACTURER 0
43 #define ACCESSORY_STRING_MODEL 1
44 #define ACCESSORY_STRING_DESCRIPTION 2
45 #define ACCESSORY_STRING_VERSION 3
46 #define ACCESSORY_STRING_URI 4
47 #define ACCESSORY_STRING_SERIAL 5
48 
49 #define ADK_MAX_ENDPOINTS 3 //endpoint 0, bulk_IN, bulk_OUT
50 
51 class ADK;
52 
53 class ADK : public USBDeviceConfig, public UsbConfigXtracter {
54 private:
55  /* ID strings */
56  const char* manufacturer;
57  const char* model;
58  const char* description;
59  const char* version;
60  const char* uri;
61  const char* serial;
62 
63  /* ADK proprietary requests */
64  uint8_t getProto(uint8_t* adkproto);
65  uint8_t sendStr(uint8_t index, const char* str);
66  uint8_t switchAcc(void);
67 
68 protected:
69  static const uint8_t epDataInIndex; // DataIn endpoint index
70  static const uint8_t epDataOutIndex; // DataOUT endpoint index
71 
72  /* mandatory members */
74  uint8_t bAddress;
75  uint8_t bConfNum; // configuration number
76 
77  uint8_t bNumEP; // total number of EP in the configuration
78  bool ready;
79 
80  /* Endpoint data structure */
82 
84 
85 public:
86  ADK(USB *pUsb, const char* manufacturer,
87  const char* model,
88  const char* description,
89  const char* version,
90  const char* uri,
91  const char* serial);
92 
93  // Methods for receiving and sending data
94  uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr);
95  uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
96 
97 
98  // USBDeviceConfig implementation
99  uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed);
100  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
101  uint8_t Release();
102 
103  virtual uint8_t Poll() {
104  return 0;
105  };
106 
107  virtual uint8_t GetAddress() {
108  return bAddress;
109  };
110 
111  virtual bool isReady() {
112  return ready;
113  };
114 
115  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
116  return (vid == ADK_VID && (pid == ADK_PID || pid == ADB_PID));
117  };
118 
119  //UsbConfigXtracter implementation
120  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
121 }; //class ADK : public USBDeviceConfig ...
122 
123 /* get ADK protocol version */
124 
125 /* returns 2 bytes in *adkproto */
126 inline uint8_t ADK::getProto(uint8_t* adkproto) {
127  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_ADK_GET, ADK_GETPROTO, 0, 0, 0, 2, 2, adkproto, NULL));
128 }
129 
130 /* send ADK string */
131 inline uint8_t ADK::sendStr(uint8_t index, const char* str) {
132  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_ADK_SEND, ADK_SENDSTR, 0, 0, index, strlen(str) + 1, strlen(str) + 1, (uint8_t*)str, NULL));
133 }
134 
135 /* switch to accessory mode */
136 inline uint8_t ADK::switchAcc(void) {
137  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_ADK_SEND, ADK_ACCSTART, 0, 0, 0, 0, 0, NULL, NULL));
138 }
139 
140 #endif // _ADK_H_
#define ADB_PID
Definition: adk.h:27
static const uint8_t epDataInIndex
Definition: adk.h:69
uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr)
Definition: adk.cpp:347
uint8_t Release()
Definition: adk.cpp:337
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
Definition: adk.cpp:353
- +
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: adk.cpp:312
USB * pUsb
Definition: adk.h:73
uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
Definition: adk.cpp:59
#define ADK_GETPROTO
Definition: adk.h:35
- +
virtual bool isReady()
Definition: adk.h:111
static const uint8_t epDataOutIndex
Definition: adk.h:70
@@ -108,21 +88,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
#define ADK_ACCSTART
Definition: adk.h:37
#define ADK_PID
Definition: adk.h:26
virtual uint8_t Poll()
Definition: adk.h:103
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
#define ADK_SENDSTR
Definition: adk.h:36
#define bmREQ_ADK_GET
Definition: adk.h:39
bool ready
Definition: adk.h:78
virtual uint8_t GetAddress()
Definition: adk.h:107
-
Definition: address.h:32
+
Definition: address.h:39
ADK(USB *pUsb, const char *manufacturer, const char *model, const char *description, const char *version, const char *uri, const char *serial)
Definition: adk.cpp:25
EpInfo epInfo[ADK_MAX_ENDPOINTS]
Definition: adk.h:81
#define bmREQ_ADK_SEND
Definition: adk.h:40
#define ADK_MAX_ENDPOINTS
Definition: adk.h:49
- +
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: adk.cpp:357
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: adk.h:115
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: adk.cpp:64
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
uint8_t bNumEP
Definition: adk.h:77
#define ADK_VID
Definition: adk.h:25
uint8_t bConfNum
Definition: adk.h:75
@@ -132,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/annotated.html b/annotated.html index 7792e895..0d44efd1 100644 --- a/annotated.html +++ b/annotated.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
- + - - + + + + - + - - + + + +
avrpins.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 /* derived from Konstantin Chizhov's AVR port templates */
19 
20 #if !defined(_usb_h_) || defined(_avrpins_h_)
21 #error "Never include avrpins.h directly; include Usb.h instead"
22 #else
23 #define _avrpins_h_
24 
25 #if defined(__AVR__)
26 
27 // pointers are 16 bits on AVR
28 #define pgm_read_pointer(p) pgm_read_word(p)
29 
30 // Support for these boards needs to be manually activated in settings.h or in a makefile
31 #if !defined(BOARD_MEGA_ADK) && defined(__AVR_ATmega2560__) && (USE_UHS_MEGA_ADK || defined(ARDUINO_AVR_ADK))
32 #define BOARD_MEGA_ADK
33 #elif !defined(BOARD_BLACK_WIDDOW) && USE_UHS_BLACK_WIDDOW
34 #define BOARD_BLACK_WIDDOW
35 #endif
36 
37 #ifdef PORTA
38 #define USE_PORTA
39 #endif
40 #ifdef PORTB
41 #define USE_PORTB
42 #endif
43 #ifdef PORTC
44 #define USE_PORTC
45 #endif
46 #ifdef PORTD
47 #define USE_PORTD
48 #endif
49 #ifdef PORTE
50 #define USE_PORTE
51 #endif
52 #ifdef PORTF
53 #define USE_PORTF
54 #endif
55 #ifdef PORTG
56 #define USE_PORTG
57 #endif
58 #ifdef PORTH
59 #define USE_PORTH
60 #endif
61 #ifdef PORTJ
62 #define USE_PORTJ
63 #endif
64 #ifdef PORTK
65 #define USE_PORTK
66 #endif
67 #ifdef PORTL
68 #define USE_PORTL
69 #endif
70 #ifdef PORTQ
71 #define USE_PORTQ
72 #endif
73 #ifdef PORTR
74 #define USE_PORTR
75 #endif
76 
77 #ifdef TCCR0A
78 #define USE_TCCR0A
79 #endif
80 #ifdef TCCR1A
81 #define USE_TCCR1A
82 #endif
83 #ifdef TCCR2A
84 #define USE_TCCR2A
85 #endif
86 
87 //Port definitions for AtTiny, AtMega families.
88 
89 #define MAKE_PORT(portName, ddrName, pinName, className, ID) \
90  class className{\
91  public:\
92  typedef uint8_t DataT;\
93  public:\
94  static void Write(DataT value){portName = value;}\
95  static void ClearAndSet(DataT clearMask, DataT value){portName = (portName & ~clearMask) | value;}\
96  static DataT Read(){return portName;}\
97  static void DirWrite(DataT value){ddrName = value;}\
98  static DataT DirRead(){return ddrName;}\
99  static void Set(DataT value){portName |= value;}\
100  static void Clear(DataT value){portName &= ~value;}\
101  static void Toggle(DataT value){portName ^= value;}\
102  static void DirSet(DataT value){ddrName |= value;}\
103  static void DirClear(DataT value){ddrName &= ~value;}\
104  static void DirToggle(DataT value){ddrName ^= value;}\
105  static DataT PinRead(){return pinName;}\
106  enum{Id = ID};\
107  enum{Width=sizeof(DataT)*8};\
108  };
109 
110 // TCCR registers to set/clear Arduino PWM
111 #define MAKE_TCCR(TccrName, className) \
112  class className{\
113  public:\
114  typedef uint8_t DataT;\
115  public:\
116  static void Write(DataT value){TccrName = value;}\
117  static void ClearAndSet(DataT clearMask, DataT value){TccrName = (TccrName & ~clearMask) | value;}\
118  static DataT Read(){return TccrName;}\
119  static void Set(DataT value){TccrName |= value;}\
120  static void Clear(DataT value){TccrName &= ~value;}\
121  static void Toggle(DataT value){TccrName ^= value;}\
122  enum{Width=sizeof(DataT)*8};\
123  };
124 
125 #ifdef USE_PORTA
126 
127 MAKE_PORT(PORTA, DDRA, PINA, Porta, 'A')
128 #endif
129 #ifdef USE_PORTB
130 MAKE_PORT(PORTB, DDRB, PINB, Portb, 'B')
131 #endif
132 #ifdef USE_PORTC
133 MAKE_PORT(PORTC, DDRC, PINC, Portc, 'C')
134 #endif
135 #ifdef USE_PORTD
136 MAKE_PORT(PORTD, DDRD, PIND, Portd, 'D')
137 #endif
138 #ifdef USE_PORTE
139 MAKE_PORT(PORTE, DDRE, PINE, Porte, 'E')
140 #endif
141 #ifdef USE_PORTF
142 MAKE_PORT(PORTF, DDRF, PINF, Portf, 'F')
143 #endif
144 #ifdef USE_PORTG
145 MAKE_PORT(PORTG, DDRG, PING, Portg, 'G')
146 #endif
147 #ifdef USE_PORTH
148 MAKE_PORT(PORTH, DDRH, PINH, Porth, 'H')
149 #endif
150 #ifdef USE_PORTJ
151 MAKE_PORT(PORTJ, DDRJ, PINJ, Portj, 'J')
152 #endif
153 #ifdef USE_PORTK
154 MAKE_PORT(PORTK, DDRK, PINK, Portk, 'K')
155 #endif
156 #ifdef USE_PORTL
157 MAKE_PORT(PORTL, DDRL, PINL, Portl, 'L')
158 #endif
159 #ifdef USE_PORTQ
160 MAKE_PORT(PORTQ, DDRQ, PINQ, Portq, 'Q')
161 #endif
162 #ifdef USE_PORTR
163 MAKE_PORT(PORTR, DDRR, PINR, Portr, 'R')
164 #endif
165 
166 #ifdef USE_TCCR0A
167 MAKE_TCCR(TCCR0A, Tccr0a)
168 #endif
169 #ifdef USE_TCCR1A
170 MAKE_TCCR(TCCR1A, Tccr1a)
171 #endif
172 #ifdef USE_TCCR2A
173 MAKE_TCCR(TCCR2A, Tccr2a)
174 #endif
175 
176 // this class represents one pin in a IO port.
177 // It is fully static.
178 template<typename PORT, uint8_t PIN>
179 class TPin {
180  // BOOST_STATIC_ASSERT(PIN < PORT::Width);
181 public:
182  typedef PORT Port;
183 
184  enum {
185  Number = PIN
186  };
187 
188  static void Set() {
189  PORT::Set(1 << PIN);
190  }
191 
192  static void Set(uint8_t val) {
193  if(val)
194  Set();
195  else Clear();
196  }
197 
198  static void SetDir(uint8_t val) {
199  if(val)
200  SetDirWrite();
201  else SetDirRead();
202  }
203 
204  static void Clear() {
205  PORT::Clear(1 << PIN);
206  }
207 
208  static void Toggle() {
209  PORT::Toggle(1 << PIN);
210  }
211 
212  static void SetDirRead() {
213  PORT::DirClear(1 << PIN);
214  }
215 
216  static void SetDirWrite() {
217  PORT::DirSet(1 << PIN);
218  }
219 
220  static uint8_t IsSet() {
221  return PORT::PinRead() & (uint8_t)(1 << PIN);
222  }
223 
224  static void WaiteForSet() {
225  while(IsSet() == 0) {
226  }
227  }
228 
229  static void WaiteForClear() {
230  while(IsSet()) {
231  }
232  }
233 }; //class TPin...
234 
235 // this class represents one bit in TCCR port.
236 // used to set/clear TCCRx bits
237 // It is fully static.
238 
239 template<typename TCCR, uint8_t COM>
240 class TCom {
241  // BOOST_STATIC_ASSERT(PIN < PORT::Width);
242 public:
243  typedef TCCR Tccr;
244 
245  enum {
246  Com = COM
247  };
248 
249  static void Set() {
250  TCCR::Set(1 << COM);
251  }
252 
253  static void Clear() {
254  TCCR::Clear(1 << COM);
255  }
256 
257  static void Toggle() {
258  TCCR::Toggle(1 << COM);
259  }
260 }; //class TCom...
261 
262 //Short pin definitions
263 #ifdef USE_PORTA
264 typedef TPin<Porta, 0 > Pa0;
265 typedef TPin<Porta, 1 > Pa1;
266 typedef TPin<Porta, 2 > Pa2;
267 typedef TPin<Porta, 3 > Pa3;
268 typedef TPin<Porta, 4 > Pa4;
269 typedef TPin<Porta, 5 > Pa5;
270 typedef TPin<Porta, 6 > Pa6;
271 typedef TPin<Porta, 7 > Pa7;
272 #endif
273 
274 #ifdef USE_PORTB
275 typedef TPin<Portb, 0 > Pb0;
276 typedef TPin<Portb, 1 > Pb1;
277 typedef TPin<Portb, 2 > Pb2;
278 typedef TPin<Portb, 3 > Pb3;
279 typedef TPin<Portb, 4 > Pb4;
280 typedef TPin<Portb, 5 > Pb5;
281 typedef TPin<Portb, 6 > Pb6;
282 typedef TPin<Portb, 7 > Pb7;
283 #endif
284 
285 #ifdef USE_PORTC
286 typedef TPin<Portc, 0 > Pc0;
287 typedef TPin<Portc, 1 > Pc1;
288 typedef TPin<Portc, 2 > Pc2;
289 typedef TPin<Portc, 3 > Pc3;
290 typedef TPin<Portc, 4 > Pc4;
291 typedef TPin<Portc, 5 > Pc5;
292 typedef TPin<Portc, 6 > Pc6;
293 typedef TPin<Portc, 7 > Pc7;
294 #endif
295 
296 #ifdef USE_PORTD
297 typedef TPin<Portd, 0 > Pd0;
298 typedef TPin<Portd, 1 > Pd1;
299 typedef TPin<Portd, 2 > Pd2;
300 typedef TPin<Portd, 3 > Pd3;
301 typedef TPin<Portd, 4 > Pd4;
302 typedef TPin<Portd, 5 > Pd5;
303 typedef TPin<Portd, 6 > Pd6;
304 typedef TPin<Portd, 7 > Pd7;
305 #endif
306 
307 #ifdef USE_PORTE
308 typedef TPin<Porte, 0 > Pe0;
309 typedef TPin<Porte, 1 > Pe1;
310 typedef TPin<Porte, 2 > Pe2;
311 typedef TPin<Porte, 3 > Pe3;
312 typedef TPin<Porte, 4 > Pe4;
313 typedef TPin<Porte, 5 > Pe5;
314 typedef TPin<Porte, 6 > Pe6;
315 typedef TPin<Porte, 7 > Pe7;
316 #endif
317 
318 #ifdef USE_PORTF
319 typedef TPin<Portf, 0 > Pf0;
320 typedef TPin<Portf, 1 > Pf1;
321 typedef TPin<Portf, 2 > Pf2;
322 typedef TPin<Portf, 3 > Pf3;
323 typedef TPin<Portf, 4 > Pf4;
324 typedef TPin<Portf, 5 > Pf5;
325 typedef TPin<Portf, 6 > Pf6;
326 typedef TPin<Portf, 7 > Pf7;
327 #endif
328 
329 #ifdef USE_PORTG
330 typedef TPin<Portg, 0 > Pg0;
331 typedef TPin<Portg, 1 > Pg1;
332 typedef TPin<Portg, 2 > Pg2;
333 typedef TPin<Portg, 3 > Pg3;
334 typedef TPin<Portg, 4 > Pg4;
335 typedef TPin<Portg, 5 > Pg5;
336 typedef TPin<Portg, 6 > Pg6;
337 typedef TPin<Portg, 7 > Pg7;
338 #endif
339 
340 #ifdef USE_PORTH
341 typedef TPin<Porth, 0 > Ph0;
342 typedef TPin<Porth, 1 > Ph1;
343 typedef TPin<Porth, 2 > Ph2;
344 typedef TPin<Porth, 3 > Ph3;
345 typedef TPin<Porth, 4 > Ph4;
346 typedef TPin<Porth, 5 > Ph5;
347 typedef TPin<Porth, 6 > Ph6;
348 typedef TPin<Porth, 7 > Ph7;
349 #endif
350 
351 #ifdef USE_PORTJ
352 typedef TPin<Portj, 0 > Pj0;
353 typedef TPin<Portj, 1 > Pj1;
354 typedef TPin<Portj, 2 > Pj2;
355 typedef TPin<Portj, 3 > Pj3;
356 typedef TPin<Portj, 4 > Pj4;
357 typedef TPin<Portj, 5 > Pj5;
358 typedef TPin<Portj, 6 > Pj6;
359 typedef TPin<Portj, 7 > Pj7;
360 #endif
361 
362 #ifdef USE_PORTK
363 typedef TPin<Portk, 0 > Pk0;
364 typedef TPin<Portk, 1 > Pk1;
365 typedef TPin<Portk, 2 > Pk2;
366 typedef TPin<Portk, 3 > Pk3;
367 typedef TPin<Portk, 4 > Pk4;
368 typedef TPin<Portk, 5 > Pk5;
369 typedef TPin<Portk, 6 > Pk6;
370 typedef TPin<Portk, 7 > Pk7;
371 #endif
372 
373 #ifdef USE_PORTL
374 typedef TPin<Portl, 0 > Pl0;
375 typedef TPin<Portl, 1 > Pl1;
376 typedef TPin<Portl, 2 > Pl2;
377 typedef TPin<Portl, 3 > Pl3;
378 typedef TPin<Portl, 4 > Pl4;
379 typedef TPin<Portl, 5 > Pl5;
380 typedef TPin<Portl, 6 > Pl6;
381 typedef TPin<Portl, 7 > Pl7;
382 #endif
383 
384 #ifdef USE_PORTQ
385 typedef TPin<Portq, 0 > Pq0;
386 typedef TPin<Portq, 1 > Pq1;
387 typedef TPin<Portq, 2 > Pq2;
388 typedef TPin<Portq, 3 > Pq3;
389 typedef TPin<Portq, 4 > Pq4;
390 typedef TPin<Portq, 5 > Pq5;
391 typedef TPin<Portq, 6 > Pq6;
392 typedef TPin<Portq, 7 > Pq7;
393 #endif
394 
395 #ifdef USE_PORTR
396 typedef TPin<Portr, 0 > Pr0;
397 typedef TPin<Portr, 1 > Pr1;
398 typedef TPin<Portr, 2 > Pr2;
399 typedef TPin<Portr, 3 > Pr3;
400 typedef TPin<Portr, 4 > Pr4;
401 typedef TPin<Portr, 5 > Pr5;
402 typedef TPin<Portr, 6 > Pr6;
403 typedef TPin<Portr, 7 > Pr7;
404 #endif
405 
406 #ifdef USE_TCCR0A
407 typedef TCom<Tccr0a, COM0A1> Tc0a; //P6
408 typedef TCom<Tccr0a, COM0B1> Tc0b; //P5
409 #endif
410 
411 #ifdef USE_TCCR1A
412 typedef TCom<Tccr1a, COM1A1> Tc1a; //P9
413 typedef TCom<Tccr1a, COM1B1> Tc1b; //P10
414 #endif
415 
416 #ifdef USE_TCCR2A
417 typedef TCom<Tccr2a, COM2A1> Tc2a; //P11
418 typedef TCom<Tccr2a, COM2B1> Tc2b; //P3
419 #endif
420 
421 template<typename Tp_pin, typename Tc_bit>
422 class Tp_Tc {
423 public:
424 
425  static void SetDir(uint8_t val) {
426  if(val)
427  SetDirWrite();
428  else SetDirRead();
429  }
430 
431  static void SetDirRead() {
432  Tp_pin::SetDirRead(); //set pin direction
433  Tc_bit::Clear(); //disconnect pin from PWM
434  }
435 
436  static void SetDirWrite() {
437  Tp_pin::SetDirWrite();
438  Tc_bit::Clear();
439  }
440 };
441 
442 /* pin definitions for cases where it's necessary to clear compare output mode bits */
443 
444 //typedef Tp_Tc<Pd3, Tc2b> P3; //Arduino pin 3
445 //typedef Tp_Tc<Pd5, Tc0b> P5; //Arduino pin 5
446 //typedef Tp_Tc<Pd6, Tc0a> P6; //Arduino pin 6
447 //typedef Tp_Tc<Pb1, Tc1a> P9; //Arduino pin 9
448 //typedef Tp_Tc<Pb2, Tc1b> P10; //Arduino pin 10
449 //typedef Tp_Tc<Pb3, Tc2a> P11; //Arduino pin 11
450 
451 /* Arduino pin definitions */
452 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
453 // "Mega" Arduino pin numbers
454 
455 #define P0 Pe0
456 #define P1 Pe1
457 #define P2 Pe4
458 #define P3 Pe5
459 #define P4 Pg5
460 #define P5 Pe3
461 #define P6 Ph3
462 #define P7 Ph4
463 
464 #define P8 Ph5
465 #define P9 Ph6
466 #define P10 Pb4
467 #define P11 Pb5
468 #define P12 Pb6
469 #define P13 Pb7
470 
471 #define P14 Pj1
472 #define P15 Pj0
473 #define P16 Ph1
474 #define P17 Ph0
475 #define P18 Pd3
476 #define P19 Pd2
477 #define P20 Pd1
478 #define P21 Pd0
479 
480 #define P22 Pa0
481 #define P23 Pa1
482 #define P24 Pa2
483 #define P25 Pa3
484 #define P26 Pa4
485 #define P27 Pa5
486 #define P28 Pa6
487 #define P29 Pa7
488 #define P30 Pc7
489 #define P31 Pc6
490 #define P32 Pc5
491 #define P33 Pc4
492 #define P34 Pc3
493 #define P35 Pc2
494 #define P36 Pc1
495 #define P37 Pc0
496 
497 #define P38 Pd7
498 #define P39 Pg2
499 #define P40 Pg1
500 #define P41 Pg0
501 #define P42 Pl7
502 #define P43 Pl6
503 #define P44 Pl5
504 #define P45 Pl4
505 #define P46 Pl3
506 #define P47 Pl2
507 #define P48 Pl1
508 #define P49 Pl0
509 #define P50 Pb3
510 #define P51 Pb2
511 #define P52 Pb1
512 #define P53 Pb0
513 
514 #ifdef BOARD_MEGA_ADK // These pins are not broken out on the Arduino ADK
515 #define P54 Pe6 // INT on Arduino ADK
516 #define P55 Pj2 // MAX_RESET on Arduino ADK
517 #endif
518 
519 // "Mega" pin numbers
520 
521 #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
522 // "Classic" Arduino pin numbers
523 
524 #define P0 Pd0
525 #define P1 Pd1
526 #define P2 Pd2
527 #define P3 Pd3
528 #define P4 Pd4
529 #define P5 Pd5
530 #define P6 Pd6
531 #define P7 Pd7
532 
533 #define P8 Pb0
534 #define P9 Pb1
535 #define P10 Pb2
536 #define P11 Pb3
537 #define P12 Pb4
538 #define P13 Pb5
539 
540 #define P14 Pc0
541 #define P15 Pc1
542 #define P16 Pc2
543 #define P17 Pc3
544 #define P18 Pc4
545 #define P19 Pc5
546 
547 // "Classic" Arduino pin numbers
548 
549 #elif defined(CORE_TEENSY) && defined(__AVR_ATmega32U4__)
550 // Teensy 2.0 pin numbers
551 // http://www.pjrc.com/teensy/pinout.html
552 #define P0 Pb0
553 #define P1 Pb1
554 #define P2 Pb2
555 #define P3 Pb3
556 #define P4 Pb7
557 #define P5 Pd0
558 #define P6 Pd1
559 #define P7 Pd2
560 #define P8 Pd3
561 #define P9 Pc6
562 #define P10 Pc7
563 #define P11 Pd6
564 #define P12 Pd7
565 #define P13 Pb4
566 #define P14 Pb5
567 #define P15 Pb6
568 #define P16 Pf7
569 #define P17 Pf6
570 #define P18 Pf5
571 #define P19 Pf4
572 #define P20 Pf1
573 #define P21 Pf0
574 #define P22 Pd4
575 #define P23 Pd5
576 #define P24 Pe6
577 // Teensy 2.0
578 
579 #elif defined(__AVR_ATmega32U4__)
580 // Arduino Leonardo pin numbers
581 
582 #define P0 Pd2 // D0 - PD2
583 #define P1 Pd3 // D1 - PD3
584 #define P2 Pd1 // D2 - PD1
585 #define P3 Pd0 // D3 - PD0
586 #define P4 Pd4 // D4 - PD4
587 #define P5 Pc6 // D5 - PC6
588 #define P6 Pd7 // D6 - PD7
589 #define P7 Pe6 // D7 - PE6
590 
591 #define P8 Pb4 // D8 - PB4
592 #define P9 Pb5 // D9 - PB5
593 #define P10 Pb6 // D10 - PB6
594 #define P11 Pb7 // D11 - PB7
595 #define P12 Pd6 // D12 - PD6
596 #define P13 Pc7 // D13 - PC7
597 
598 #define P14 Pb3 // D14 - MISO - PB3
599 #define P15 Pb1 // D15 - SCK - PB1
600 #define P16 Pb2 // D16 - MOSI - PB2
601 #define P17 Pb0 // D17 - SS - PB0
602 
603 #define P18 Pf7 // D18 - A0 - PF7
604 #define P19 Pf6 // D19 - A1 - PF6
605 #define P20 Pf5 // D20 - A2 - PF5
606 #define P21 Pf4 // D21 - A3 - PF4
607 #define P22 Pf1 // D22 - A4 - PF1
608 #define P23 Pf0 // D23 - A5 - PF0
609 
610 #define P24 Pd4 // D24 / D4 - A6 - PD4
611 #define P25 Pd7 // D25 / D6 - A7 - PD7
612 #define P26 Pb4 // D26 / D8 - A8 - PB4
613 #define P27 Pb5 // D27 / D9 - A9 - PB5
614 #define P28 Pb6 // D28 / D10 - A10 - PB6
615 #define P29 Pd6 // D29 / D12 - A11 - PD6
616 
617 // Arduino Leonardo pin numbers
618 
619 #elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
620 // Teensy++ 1.0 and 2.0 pin numbers
621 // http://www.pjrc.com/teensy/pinout.html
622 #define P0 Pd0
623 #define P1 Pd1
624 #define P2 Pd2
625 #define P3 Pd3
626 #define P4 Pd4
627 #define P5 Pd5
628 #define P6 Pd6
629 #define P7 Pd7
630 #define P8 Pe0
631 #define P9 Pe1
632 #define P10 Pc0
633 #define P11 Pc1
634 #define P12 Pc2
635 #define P13 Pc3
636 #define P14 Pc4
637 #define P15 Pc5
638 #define P16 Pc6
639 #define P17 Pc7
640 #define P18 Pe6
641 #define P19 Pe7
642 #define P20 Pb0
643 #define P21 Pb1
644 #define P22 Pb2
645 #define P23 Pb3
646 #define P24 Pb4
647 #define P25 Pb5
648 #define P26 Pb6
649 #define P27 Pb7
650 #define P28 Pa0
651 #define P29 Pa1
652 #define P30 Pa2
653 #define P31 Pa3
654 #define P32 Pa4
655 #define P33 Pa5
656 #define P34 Pa6
657 #define P35 Pa7
658 #define P36 Pe4
659 #define P37 Pe5
660 #define P38 Pf0
661 #define P39 Pf1
662 #define P40 Pf2
663 #define P41 Pf3
664 #define P42 Pf4
665 #define P43 Pf5
666 #define P44 Pf6
667 #define P45 Pf7
668 // Teensy++ 1.0 and 2.0
669 
670 #elif defined(ARDUINO_AVR_BALANDUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284P__))
671 // Balanduino pin numbers
672 // http://balanduino.net/
673 #define P0 Pd0 /* 0 - PD0 */
674 #define P1 Pd1 /* 1 - PD1 */
675 
676 #if BALANDUINO_REVISION < 13
677  #define P2 Pb2 /* 2 - PB2 */
678  #define P3 Pd6 /* 3 - PD6 */
679  #define P4 Pd7 /* 4 - PD7 */
680  #define P5 Pb3 /* 5 - PB3 */
681 #else
682  #define P2 Pd2 /* 2 - PD2 */
683  #define P3 Pd3 /* 3 - PD3 */
684  #define P4 Pd6 /* 4 - PD6 */
685  #define P5 Pd7 /* 5 - PD7 */
686 #endif
687 
688 #define P6 Pb4 /* 6 - PB4 */
689 #define P7 Pa0 /* 7 - PA0 */
690 #define P8 Pa1 /* 8 - PA1 */
691 #define P9 Pa2 /* 9 - PA2 */
692 #define P10 Pa3 /* 10 - PA3 */
693 #define P11 Pa4 /* 11 - PA4 */
694 #define P12 Pa5 /* 12 - PA5 */
695 #define P13 Pc1 /* 13 - PC1 */
696 #define P14 Pc0 /* 14 - PC0 */
697 
698 #if BALANDUINO_REVISION < 13
699  #define P15 Pd2 /* 15 - PD2 */
700  #define P16 Pd3 /* 16 - PD3 */
701 #else
702  #define P15 Pb2 /* 15 - PB2 */
703  #define P16 Pb3 /* 16 - PB2 */
704 #endif
705 
706 #define P17 Pd4 /* 17 - PD4 */
707 #define P18 Pd5 /* 18 - PD5 */
708 #define P19 Pc2 /* 19 - PC2 */
709 #define P20 Pc3 /* 20 - PC3 */
710 #define P21 Pc4 /* 21 - PC4 */
711 #define P22 Pc5 /* 22 - PC5 */
712 #define P23 Pc6 /* 23 - PC6 */
713 #define P24 Pc7 /* 24 - PC7 */
714 #define P25 Pb0 /* 25 - PB0 */
715 #define P26 Pb1 /* 26 - PB1 */
716 #define P27 Pb5 /* 27 - PB5 */
717 #define P28 Pb6 /* 28 - PB6 */
718 #define P29 Pb7 /* 29 - PB7 */
719 #define P30 Pa6 /* 30 - PA6 */
720 #define P31 Pa7 /* 31 - PA7 */
721 // Balanduino
722 
723 #elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
724 // Sanguino pin numbers
725 // Homepage: http://sanguino.cc/hardware
726 // Hardware add-on: https://github.com/Lauszus/Sanguino
727 #define P0 Pb0
728 #define P1 Pb1
729 #define P2 Pb2
730 #define P3 Pb3
731 #define P4 Pb4
732 #define P5 Pb5
733 #define P6 Pb6
734 #define P7 Pb7
735 #define P8 Pd0
736 #define P9 Pd1
737 #define P10 Pd2
738 #define P11 Pd3
739 #define P12 Pd4
740 #define P13 Pd5
741 #define P14 Pd6
742 #define P15 Pd7
743 #define P16 Pc0
744 #define P17 Pc1
745 #define P18 Pc2
746 #define P19 Pc3
747 #define P20 Pc4
748 #define P21 Pc5
749 #define P22 Pc6
750 #define P23 Pc7
751 #define P24 Pa0
752 #define P25 Pa1
753 #define P26 Pa2
754 #define P27 Pa3
755 #define P28 Pa4
756 #define P29 Pa5
757 #define P30 Pa6
758 #define P31 Pa7
759 // Sanguino
760 
761 #else
762 #error "Please define board in avrpins.h"
763 
764 #endif // Arduino pin definitions
765 
766 #elif defined(__arm__)
767 
768 // pointers are 32 bits on ARM
769 #define pgm_read_pointer(p) pgm_read_dword(p)
770 
771 #if defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__))
772 
773 #include "core_pins.h"
774 #include "avr_emulation.h"
775 
776 #define GPIO_BITBAND_ADDR(reg, bit) (((uint32_t)&(reg) - 0x40000000) * 32 + (bit) * 4 + 0x42000000)
777 #define GPIO_BITBAND_PTR(reg, bit) ((uint8_t *)GPIO_BITBAND_ADDR((reg), (bit)))
778 
779 #define MAKE_PIN(className, baseReg, pinNum, configReg) \
780 class className { \
781 public: \
782  static void Set() { \
783  *GPIO_BITBAND_PTR(baseReg, pinNum) = 1; \
784  } \
785  static void Clear() { \
786  *GPIO_BITBAND_PTR(baseReg, pinNum) = 0; \
787  } \
788  static void SetDirRead() { \
789  configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
790  *(GPIO_BITBAND_PTR(baseReg, pinNum) + 640) = 0; \
791  } \
792  static void SetDirWrite() { \
793  configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
794  *(GPIO_BITBAND_PTR(baseReg, pinNum) + 640) = 1; \
795  } \
796  static uint8_t IsSet() { \
797  return *(GPIO_BITBAND_PTR(baseReg, pinNum) + 512); \
798  } \
799 };
800 
801 MAKE_PIN(P0, CORE_PIN0_PORTREG, CORE_PIN0_BIT, CORE_PIN0_CONFIG);
802 MAKE_PIN(P1, CORE_PIN1_PORTREG, CORE_PIN1_BIT, CORE_PIN1_CONFIG);
803 MAKE_PIN(P2, CORE_PIN2_PORTREG, CORE_PIN2_BIT, CORE_PIN2_CONFIG);
804 MAKE_PIN(P3, CORE_PIN3_PORTREG, CORE_PIN3_BIT, CORE_PIN3_CONFIG);
805 MAKE_PIN(P4, CORE_PIN4_PORTREG, CORE_PIN4_BIT, CORE_PIN4_CONFIG);
806 MAKE_PIN(P5, CORE_PIN5_PORTREG, CORE_PIN5_BIT, CORE_PIN5_CONFIG);
807 MAKE_PIN(P6, CORE_PIN6_PORTREG, CORE_PIN6_BIT, CORE_PIN6_CONFIG);
808 MAKE_PIN(P7, CORE_PIN7_PORTREG, CORE_PIN7_BIT, CORE_PIN7_CONFIG);
809 MAKE_PIN(P8, CORE_PIN8_PORTREG, CORE_PIN8_BIT, CORE_PIN8_CONFIG);
810 MAKE_PIN(P9, CORE_PIN9_PORTREG, CORE_PIN9_BIT, CORE_PIN9_CONFIG);
811 MAKE_PIN(P10, CORE_PIN10_PORTREG, CORE_PIN10_BIT, CORE_PIN10_CONFIG);
812 MAKE_PIN(P11, CORE_PIN11_PORTREG, CORE_PIN11_BIT, CORE_PIN11_CONFIG);
813 MAKE_PIN(P12, CORE_PIN12_PORTREG, CORE_PIN12_BIT, CORE_PIN12_CONFIG);
814 MAKE_PIN(P13, CORE_PIN13_PORTREG, CORE_PIN13_BIT, CORE_PIN13_CONFIG);
815 MAKE_PIN(P14, CORE_PIN14_PORTREG, CORE_PIN14_BIT, CORE_PIN14_CONFIG);
816 MAKE_PIN(P15, CORE_PIN15_PORTREG, CORE_PIN15_BIT, CORE_PIN15_CONFIG);
817 MAKE_PIN(P16, CORE_PIN16_PORTREG, CORE_PIN16_BIT, CORE_PIN16_CONFIG);
818 MAKE_PIN(P17, CORE_PIN17_PORTREG, CORE_PIN17_BIT, CORE_PIN17_CONFIG);
819 MAKE_PIN(P18, CORE_PIN18_PORTREG, CORE_PIN18_BIT, CORE_PIN18_CONFIG);
820 MAKE_PIN(P19, CORE_PIN19_PORTREG, CORE_PIN19_BIT, CORE_PIN19_CONFIG);
821 MAKE_PIN(P20, CORE_PIN20_PORTREG, CORE_PIN20_BIT, CORE_PIN20_CONFIG);
822 MAKE_PIN(P21, CORE_PIN21_PORTREG, CORE_PIN21_BIT, CORE_PIN21_CONFIG);
823 MAKE_PIN(P22, CORE_PIN22_PORTREG, CORE_PIN22_BIT, CORE_PIN22_CONFIG);
824 MAKE_PIN(P23, CORE_PIN23_PORTREG, CORE_PIN23_BIT, CORE_PIN23_CONFIG);
825 MAKE_PIN(P24, CORE_PIN24_PORTREG, CORE_PIN24_BIT, CORE_PIN24_CONFIG);
826 MAKE_PIN(P25, CORE_PIN25_PORTREG, CORE_PIN25_BIT, CORE_PIN25_CONFIG);
827 MAKE_PIN(P26, CORE_PIN26_PORTREG, CORE_PIN26_BIT, CORE_PIN26_CONFIG);
828 MAKE_PIN(P27, CORE_PIN27_PORTREG, CORE_PIN27_BIT, CORE_PIN27_CONFIG);
829 MAKE_PIN(P28, CORE_PIN28_PORTREG, CORE_PIN28_BIT, CORE_PIN28_CONFIG);
830 MAKE_PIN(P29, CORE_PIN29_PORTREG, CORE_PIN29_BIT, CORE_PIN29_CONFIG);
831 MAKE_PIN(P30, CORE_PIN30_PORTREG, CORE_PIN30_BIT, CORE_PIN30_CONFIG);
832 MAKE_PIN(P31, CORE_PIN31_PORTREG, CORE_PIN31_BIT, CORE_PIN31_CONFIG);
833 MAKE_PIN(P32, CORE_PIN32_PORTREG, CORE_PIN32_BIT, CORE_PIN32_CONFIG);
834 MAKE_PIN(P33, CORE_PIN33_PORTREG, CORE_PIN33_BIT, CORE_PIN33_CONFIG);
835 
836 #undef MAKE_PIN
837 
838 #elif defined(CORE_TEENSY) && (defined(__MKL26Z64__))
839 
840 // we could get lower level by making these macros work properly.
841 // for now just use the semi optimised version, it costs a lookup in the pin pgm table per op
842 // but for now it will do.
843 //#define GPIO_BITBAND_ADDR(reg, bit) (((volatile uint8_t *)&(reg) + ((bit) >> 3)))
844 //#define GPIO_BITBAND_MASK(reg, bit) (1<<((bit) & 7))
845 //#define GPIO_BITBAND_PTR(reg, bit) ((volatile uint8_t *)GPIO_BITBAND_ADDR((reg), (bit)))
846 
847 #include "core_pins.h"
848 #include "avr_emulation.h"
849 
850 #define MAKE_PIN(className, baseReg, pinNum, configReg) \
851 class className { \
852 public: \
853  static void Set() { \
854  *portSetRegister(pinNum) = digitalPinToBitMask(pinNum); \
855  } \
856  static void Clear() { \
857  *portClearRegister(pinNum) = digitalPinToBitMask(pinNum); \
858  } \
859  static void SetDirRead() { \
860  configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
861  *portModeRegister(pinNum) &= ~digitalPinToBitMask(pinNum); \
862  } \
863  static void SetDirWrite() { \
864  configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
865  *portModeRegister(pinNum) |= digitalPinToBitMask(pinNum); \
866  } \
867  static uint8_t IsSet() { \
868  return (*portInputRegister(pinNum) & digitalPinToBitMask(pinNum)) ? 1 : 0; \
869  } \
870 };
871 
872 MAKE_PIN(P0, CORE_PIN0_PORTREG, 0, CORE_PIN0_CONFIG);
873 MAKE_PIN(P1, CORE_PIN1_PORTREG, 1, CORE_PIN1_CONFIG);
874 MAKE_PIN(P2, CORE_PIN2_PORTREG, 2, CORE_PIN2_CONFIG);
875 MAKE_PIN(P3, CORE_PIN3_PORTREG, 3, CORE_PIN3_CONFIG);
876 MAKE_PIN(P4, CORE_PIN4_PORTREG, 4, CORE_PIN4_CONFIG);
877 MAKE_PIN(P5, CORE_PIN5_PORTREG, 5, CORE_PIN5_CONFIG);
878 MAKE_PIN(P6, CORE_PIN6_PORTREG, 6, CORE_PIN6_CONFIG);
879 MAKE_PIN(P7, CORE_PIN7_PORTREG, 7, CORE_PIN7_CONFIG);
880 MAKE_PIN(P8, CORE_PIN8_PORTREG, 8, CORE_PIN8_CONFIG);
881 MAKE_PIN(P9, CORE_PIN9_PORTREG, 9, CORE_PIN9_CONFIG);
882 MAKE_PIN(P10, CORE_PIN10_PORTREG, 10, CORE_PIN10_CONFIG);
883 MAKE_PIN(P11, CORE_PIN11_PORTREG, 11, CORE_PIN11_CONFIG);
884 MAKE_PIN(P12, CORE_PIN12_PORTREG, 12, CORE_PIN12_CONFIG);
885 MAKE_PIN(P13, CORE_PIN13_PORTREG, 13, CORE_PIN13_CONFIG);
886 MAKE_PIN(P14, CORE_PIN14_PORTREG, 14, CORE_PIN14_CONFIG);
887 MAKE_PIN(P15, CORE_PIN15_PORTREG, 15, CORE_PIN15_CONFIG);
888 MAKE_PIN(P16, CORE_PIN16_PORTREG, 16, CORE_PIN16_CONFIG);
889 MAKE_PIN(P17, CORE_PIN17_PORTREG, 17, CORE_PIN17_CONFIG);
890 MAKE_PIN(P18, CORE_PIN18_PORTREG, 18, CORE_PIN18_CONFIG);
891 MAKE_PIN(P19, CORE_PIN19_PORTREG, 19, CORE_PIN19_CONFIG);
892 MAKE_PIN(P20, CORE_PIN20_PORTREG, 20, CORE_PIN20_CONFIG);
893 MAKE_PIN(P21, CORE_PIN21_PORTREG, 21, CORE_PIN21_CONFIG);
894 MAKE_PIN(P22, CORE_PIN22_PORTREG, 22, CORE_PIN22_CONFIG);
895 MAKE_PIN(P23, CORE_PIN23_PORTREG, 23, CORE_PIN23_CONFIG);
896 MAKE_PIN(P24, CORE_PIN24_PORTREG, 24, CORE_PIN24_CONFIG);
897 MAKE_PIN(P25, CORE_PIN25_PORTREG, 25, CORE_PIN25_CONFIG);
898 MAKE_PIN(P26, CORE_PIN26_PORTREG, 26, CORE_PIN26_CONFIG);
899 
900 #undef MAKE_PIN
901 
902 #elif defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)
903 
904 // SetDirRead:
905 // Disable interrupts
906 // Disable the pull up resistor
907 // Set to INPUT
908 // Enable PIO
909 
910 // SetDirWrite:
911 // Disable interrupts
912 // Disable the pull up resistor
913 // Set to OUTPUT
914 // Enable PIO
915 
916 #define MAKE_PIN(className, pio, pinMask) \
917 class className { \
918 public: \
919  static void Set() { \
920  pio->PIO_SODR = pinMask; \
921  } \
922  static void Clear() { \
923  pio->PIO_CODR = pinMask; \
924  } \
925  static void SetDirRead() { \
926  pio->PIO_IDR = pinMask ; \
927  pio->PIO_PUDR = pinMask; \
928  pio->PIO_ODR = pinMask; \
929  pio->PIO_PER = pinMask; \
930  } \
931  static void SetDirWrite() { \
932  pio->PIO_IDR = pinMask ; \
933  pio->PIO_PUDR = pinMask; \
934  pio->PIO_OER = pinMask; \
935  pio->PIO_PER = pinMask; \
936  } \
937  static uint8_t IsSet() { \
938  return pio->PIO_PDSR & pinMask; \
939  } \
940 };
941 
942 // See: http://arduino.cc/en/Hacking/PinMappingSAM3X and variant.cpp
943 
944 MAKE_PIN(P0, PIOA, PIO_PA8);
945 MAKE_PIN(P1, PIOA, PIO_PA9);
946 MAKE_PIN(P2, PIOB, PIO_PB25);
947 MAKE_PIN(P3, PIOC, PIO_PC28);
948 MAKE_PIN(P4, PIOC, PIO_PC26);
949 MAKE_PIN(P5, PIOC, PIO_PC25);
950 MAKE_PIN(P6, PIOC, PIO_PC24);
951 MAKE_PIN(P7, PIOC, PIO_PC23);
952 MAKE_PIN(P8, PIOC, PIO_PC22);
953 MAKE_PIN(P9, PIOC, PIO_PC21);
954 MAKE_PIN(P10, PIOC, PIO_PC29);
955 MAKE_PIN(P11, PIOD, PIO_PD7);
956 MAKE_PIN(P12, PIOD, PIO_PD8);
957 MAKE_PIN(P13, PIOB, PIO_PB27);
958 MAKE_PIN(P14, PIOD, PIO_PD4);
959 MAKE_PIN(P15, PIOD, PIO_PD5);
960 MAKE_PIN(P16, PIOA, PIO_PA13);
961 MAKE_PIN(P17, PIOA, PIO_PA12);
962 MAKE_PIN(P18, PIOA, PIO_PA11);
963 MAKE_PIN(P19, PIOA, PIO_PA10);
964 MAKE_PIN(P20, PIOB, PIO_PB12);
965 MAKE_PIN(P21, PIOB, PIO_PB13);
966 MAKE_PIN(P22, PIOB, PIO_PB26);
967 MAKE_PIN(P23, PIOA, PIO_PA14);
968 MAKE_PIN(P24, PIOA, PIO_PA15);
969 MAKE_PIN(P25, PIOD, PIO_PD0);
970 MAKE_PIN(P26, PIOD, PIO_PD1);
971 MAKE_PIN(P27, PIOD, PIO_PD2);
972 MAKE_PIN(P28, PIOD, PIO_PD3);
973 MAKE_PIN(P29, PIOD, PIO_PD6);
974 MAKE_PIN(P30, PIOD, PIO_PD9);
975 MAKE_PIN(P31, PIOA, PIO_PA7);
976 MAKE_PIN(P32, PIOD, PIO_PD10);
977 MAKE_PIN(P33, PIOC, PIO_PC1);
978 MAKE_PIN(P34, PIOC, PIO_PC2);
979 MAKE_PIN(P35, PIOC, PIO_PC3);
980 MAKE_PIN(P36, PIOC, PIO_PC4);
981 MAKE_PIN(P37, PIOC, PIO_PC5);
982 MAKE_PIN(P38, PIOC, PIO_PC6);
983 MAKE_PIN(P39, PIOC, PIO_PC7);
984 MAKE_PIN(P40, PIOC, PIO_PC8);
985 MAKE_PIN(P41, PIOC, PIO_PC9);
986 MAKE_PIN(P42, PIOA, PIO_PA19);
987 MAKE_PIN(P43, PIOA, PIO_PA20);
988 MAKE_PIN(P44, PIOC, PIO_PC19);
989 MAKE_PIN(P45, PIOC, PIO_PC18);
990 MAKE_PIN(P46, PIOC, PIO_PC17);
991 MAKE_PIN(P47, PIOC, PIO_PC16);
992 MAKE_PIN(P48, PIOC, PIO_PC15);
993 MAKE_PIN(P49, PIOC, PIO_PC14);
994 MAKE_PIN(P50, PIOC, PIO_PC13);
995 MAKE_PIN(P51, PIOC, PIO_PC12);
996 MAKE_PIN(P52, PIOB, PIO_PB21);
997 MAKE_PIN(P53, PIOB, PIO_PB14);
998 MAKE_PIN(P54, PIOA, PIO_PA16);
999 MAKE_PIN(P55, PIOA, PIO_PA24);
1000 MAKE_PIN(P56, PIOA, PIO_PA23);
1001 MAKE_PIN(P57, PIOA, PIO_PA22);
1002 MAKE_PIN(P58, PIOA, PIO_PA6);
1003 MAKE_PIN(P59, PIOA, PIO_PA4);
1004 MAKE_PIN(P60, PIOA, PIO_PA3);
1005 MAKE_PIN(P61, PIOA, PIO_PA2);
1006 MAKE_PIN(P62, PIOB, PIO_PB17);
1007 MAKE_PIN(P63, PIOB, PIO_PB18);
1008 MAKE_PIN(P64, PIOB, PIO_PB19);
1009 MAKE_PIN(P65, PIOB, PIO_PB20);
1010 MAKE_PIN(P66, PIOB, PIO_PB15);
1011 MAKE_PIN(P67, PIOB, PIO_PB16);
1012 MAKE_PIN(P68, PIOA, PIO_PA1);
1013 MAKE_PIN(P69, PIOA, PIO_PA0);
1014 MAKE_PIN(P70, PIOA, PIO_PA17);
1015 MAKE_PIN(P71, PIOA, PIO_PA18);
1016 MAKE_PIN(P72, PIOC, PIO_PC30);
1017 MAKE_PIN(P73, PIOA, PIO_PA21);
1018 MAKE_PIN(P74, PIOA, PIO_PA25); // MISO
1019 MAKE_PIN(P75, PIOA, PIO_PA26); // MOSI
1020 MAKE_PIN(P76, PIOA, PIO_PA27); // CLK
1021 MAKE_PIN(P77, PIOA, PIO_PA28);
1022 MAKE_PIN(P78, PIOB, PIO_PB23); // Unconnected
1023 
1024 #undef MAKE_PIN
1025 
1026 #elif defined(RBL_NRF51822)
1027 
1028 #define MAKE_PIN(className, pin) \
1029 class className { \
1030 public: \
1031  static void Set() { \
1032  nrf_gpio_pin_set(pin); \
1033  } \
1034  static void Clear() { \
1035  nrf_gpio_pin_clear(pin); \
1036  } \
1037  static void SetDirRead() { \
1038  nrf_gpio_cfg_input(pin, NRF_GPIO_PIN_NOPULL); \
1039  } \
1040  static void SetDirWrite() { \
1041  nrf_gpio_cfg_output(pin); \
1042  } \
1043  static uint8_t IsSet() { \
1044  return (uint8_t)nrf_gpio_pin_read(pin); \
1045  } \
1046 };
1047 
1048 // See: pin_transform.c in RBL nRF51822 SDK
1049 MAKE_PIN(P0, Pin_nRF51822_to_Arduino(D0));
1050 MAKE_PIN(P1, Pin_nRF51822_to_Arduino(D1));
1051 MAKE_PIN(P2, Pin_nRF51822_to_Arduino(D2));
1052 MAKE_PIN(P3, Pin_nRF51822_to_Arduino(D3));
1053 MAKE_PIN(P4, Pin_nRF51822_to_Arduino(D4));
1054 MAKE_PIN(P5, Pin_nRF51822_to_Arduino(D5));
1055 MAKE_PIN(P6, Pin_nRF51822_to_Arduino(D6));
1056 MAKE_PIN(P7, Pin_nRF51822_to_Arduino(D7));
1057 MAKE_PIN(P8, Pin_nRF51822_to_Arduino(D8));
1058 MAKE_PIN(P9, Pin_nRF51822_to_Arduino(D9)); // INT
1059 MAKE_PIN(P10, Pin_nRF51822_to_Arduino(D10)); // SS
1060 MAKE_PIN(P11, Pin_nRF51822_to_Arduino(D11));
1061 MAKE_PIN(P12, Pin_nRF51822_to_Arduino(D12));
1062 MAKE_PIN(P13, Pin_nRF51822_to_Arduino(D13));
1063 MAKE_PIN(P14, Pin_nRF51822_to_Arduino(D14));
1064 MAKE_PIN(P15, Pin_nRF51822_to_Arduino(D15));
1065 MAKE_PIN(P17, Pin_nRF51822_to_Arduino(D17)); // MISO
1066 MAKE_PIN(P18, Pin_nRF51822_to_Arduino(D18)); // MOSI
1067 MAKE_PIN(P16, Pin_nRF51822_to_Arduino(D16)); // CLK
1068 MAKE_PIN(P19, Pin_nRF51822_to_Arduino(D19));
1069 MAKE_PIN(P20, Pin_nRF51822_to_Arduino(D20));
1070 MAKE_PIN(P21, Pin_nRF51822_to_Arduino(D21));
1071 MAKE_PIN(P22, Pin_nRF51822_to_Arduino(D22));
1072 MAKE_PIN(P23, Pin_nRF51822_to_Arduino(D23));
1073 MAKE_PIN(P24, Pin_nRF51822_to_Arduino(D24));
1074 
1075 #undef MAKE_PIN
1076 
1077 #elif defined(STM32F446xx)
1078 // NUCLEO-F446RE
1079 
1080 #define MAKE_PIN(className, port, pin) \
1081 class className { \
1082 public: \
1083  static void Set() { \
1084  HAL_GPIO_WritePin(port, pin, GPIO_PIN_SET); \
1085  } \
1086  static void Clear() { \
1087  HAL_GPIO_WritePin(port, pin, GPIO_PIN_RESET); \
1088  } \
1089  static void SetDirRead() { \
1090  static GPIO_InitTypeDef GPIO_InitStruct; \
1091  GPIO_InitStruct.Pin = pin; \
1092  GPIO_InitStruct.Mode = GPIO_MODE_INPUT; \
1093  GPIO_InitStruct.Pull = GPIO_NOPULL; \
1094  HAL_GPIO_Init(port, &GPIO_InitStruct); \
1095  } \
1096  static void SetDirWrite() { \
1097  static GPIO_InitTypeDef GPIO_InitStruct; \
1098  GPIO_InitStruct.Pin = pin; \
1099  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; \
1100  GPIO_InitStruct.Pull = GPIO_NOPULL; \
1101  GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; \
1102  HAL_GPIO_Init(port, &GPIO_InitStruct); \
1103  } \
1104  static GPIO_PinState IsSet() { \
1105  return HAL_GPIO_ReadPin(port, pin); \
1106  } \
1107 };
1108 
1109 MAKE_PIN(P0, GPIOA, GPIO_PIN_3); // D0
1110 MAKE_PIN(P1, GPIOA, GPIO_PIN_2); // D1
1111 MAKE_PIN(P2, GPIOA, GPIO_PIN_10); // D2
1112 MAKE_PIN(P3, GPIOB, GPIO_PIN_3); // D3
1113 MAKE_PIN(P4, GPIOB, GPIO_PIN_5); // D4
1114 MAKE_PIN(P5, GPIOB, GPIO_PIN_4); // D5
1115 MAKE_PIN(P6, GPIOB, GPIO_PIN_10); // D6
1116 MAKE_PIN(P7, GPIOA, GPIO_PIN_8); // D7
1117 MAKE_PIN(P8, GPIOA, GPIO_PIN_9); // D8
1118 MAKE_PIN(P9, GPIOC, GPIO_PIN_7); // D9
1119 MAKE_PIN(P10, GPIOB, GPIO_PIN_6); // D10
1120 MAKE_PIN(P11, GPIOA, GPIO_PIN_7); // D11
1121 MAKE_PIN(P12, GPIOA, GPIO_PIN_6); // D12
1122 MAKE_PIN(P13, GPIOA, GPIO_PIN_5); // D13
1123 
1124 MAKE_PIN(P14, GPIOA, GPIO_PIN_0); // A0
1125 MAKE_PIN(P15, GPIOA, GPIO_PIN_1); // A1
1126 MAKE_PIN(P16, GPIOA, GPIO_PIN_4); // A2
1127 MAKE_PIN(P17, GPIOB, GPIO_PIN_0); // A3
1128 MAKE_PIN(P18, GPIOC, GPIO_PIN_1); // A4
1129 MAKE_PIN(P19, GPIOC, GPIO_PIN_0); // A5
1130 
1131 #undef MAKE_PIN
1132 
1133 #else
1134 #error "Please define board in avrpins.h"
1135 
1136 #endif
1137 
1138 #elif defined(__ARDUINO_X86__) // Intel Galileo, Intel Galileo 2 and Intel Edison
1139 
1140 #include <avr/pgmspace.h>
1141 
1142 // Pointers are 32 bits on x86
1143 #define pgm_read_pointer(p) pgm_read_dword(p)
1144 
1145 #if PLATFORM_ID == 0xE1 // Edison platform id
1146 #define pinToFastPin(pin) 1 // As far as I can tell all pins can be used as fast pins
1147 #endif
1148 
1149 // Pin 2 and 3 on the Intel Galileo supports a higher rate,
1150 // so it is recommended to use one of these as the SS pin.
1151 
1152 #define MAKE_PIN(className, pin) \
1153 class className { \
1154 public: \
1155  static void Set() { \
1156  fastDigitalWrite(pin, HIGH); \
1157  } \
1158  static void Clear() { \
1159  fastDigitalWrite(pin, LOW); \
1160  } \
1161  static void SetDirRead() { \
1162  if (pinToFastPin(pin)) \
1163  pinMode(pin, INPUT_FAST); \
1164  else \
1165  pinMode(pin, INPUT); \
1166  } \
1167  static void SetDirWrite() { \
1168  if (pinToFastPin(pin)) \
1169  pinMode(pin, OUTPUT_FAST); \
1170  else \
1171  pinMode(pin, OUTPUT); \
1172  } \
1173  static uint8_t IsSet() { \
1174  return fastDigitalRead(pin); \
1175  } \
1176 };
1177 
1178 MAKE_PIN(P0, 0);
1179 MAKE_PIN(P1, 1);
1180 MAKE_PIN(P2, 2);
1181 MAKE_PIN(P3, 3);
1182 MAKE_PIN(P4, 4);
1183 MAKE_PIN(P5, 5);
1184 MAKE_PIN(P6, 6);
1185 MAKE_PIN(P7, 7);
1186 MAKE_PIN(P8, 8);
1187 MAKE_PIN(P9, 9);
1188 MAKE_PIN(P10, 10);
1189 MAKE_PIN(P11, 11);
1190 MAKE_PIN(P12, 12);
1191 MAKE_PIN(P13, 13);
1192 MAKE_PIN(P14, 14); // A0
1193 MAKE_PIN(P15, 15); // A1
1194 MAKE_PIN(P16, 16); // A2
1195 MAKE_PIN(P17, 17); // A3
1196 MAKE_PIN(P18, 18); // A4
1197 MAKE_PIN(P19, 19); // A5
1198 
1199 #undef MAKE_PIN
1200 
1201 #elif defined(__MIPSEL__)
1202 // MIPSEL (MIPS architecture using a little endian byte order)
1203 
1204 // MIPS size_t = 4
1205 #define pgm_read_pointer(p) pgm_read_dword(p)
1206 
1207 #define MAKE_PIN(className, pin) \
1208 class className { \
1209 public: \
1210  static void Set() { \
1211  digitalWrite(pin, HIGH);\
1212  } \
1213  static void Clear() { \
1214  digitalWrite(pin, LOW); \
1215  } \
1216  static void SetDirRead() { \
1217  pinMode(pin, INPUT); \
1218  } \
1219  static void SetDirWrite() { \
1220  pinMode(pin, OUTPUT); \
1221  } \
1222  static uint8_t IsSet() { \
1223  return digitalRead(pin); \
1224  } \
1225 };
1226 
1227 // 0 .. 13 - Digital pins
1228 MAKE_PIN(P0, 0); // RX
1229 MAKE_PIN(P1, 1); // TX
1230 MAKE_PIN(P2, 2); //
1231 MAKE_PIN(P3, 3); //
1232 MAKE_PIN(P4, 4); //
1233 MAKE_PIN(P5, 5); //
1234 MAKE_PIN(P6, 6); //
1235 MAKE_PIN(P7, 7); //
1236 MAKE_PIN(P8, 8); //
1237 MAKE_PIN(P9, 9); //
1238 MAKE_PIN(P10, 10); //
1239 MAKE_PIN(P11, 11); //
1240 MAKE_PIN(P12, 12); //
1241 MAKE_PIN(P13, 13); //
1242 
1243 #undef MAKE_PIN
1244 
1245 #else
1246 #error "Please define board in avrpins.h"
1247 
1248 #endif
1249 
1250 #endif //_avrpins_h_
+Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 Contact information
18 -------------------
19 
20 Circuits At Home, LTD
21 Web : http://www.circuitsathome.com
22 e-mail : support@circuitsathome.com
23  */
24 
25 /* derived from Konstantin Chizhov's AVR port templates */
26 
27 #if !defined(_usb_h_) || defined(_avrpins_h_)
28 #error "Never include avrpins.h directly; include Usb.h instead"
29 #else
30 #define _avrpins_h_
31 
32 #if defined(__AVR__)
33 
34 // pointers are 16 bits on AVR
35 #define pgm_read_pointer(p) pgm_read_word(p)
36 
37 // Support for these boards needs to be manually activated in settings.h or in a makefile
38 #if !defined(BOARD_MEGA_ADK) && defined(__AVR_ATmega2560__) && (USE_UHS_MEGA_ADK || defined(ARDUINO_AVR_ADK))
39 #define BOARD_MEGA_ADK
40 #elif !defined(BOARD_BLACK_WIDDOW) && USE_UHS_BLACK_WIDDOW
41 #define BOARD_BLACK_WIDDOW
42 #endif
43 
44 #ifdef PORTA
45 #define USE_PORTA
46 #endif
47 #ifdef PORTB
48 #define USE_PORTB
49 #endif
50 #ifdef PORTC
51 #define USE_PORTC
52 #endif
53 #ifdef PORTD
54 #define USE_PORTD
55 #endif
56 #ifdef PORTE
57 #define USE_PORTE
58 #endif
59 #ifdef PORTF
60 #define USE_PORTF
61 #endif
62 #ifdef PORTG
63 #define USE_PORTG
64 #endif
65 #ifdef PORTH
66 #define USE_PORTH
67 #endif
68 #ifdef PORTJ
69 #define USE_PORTJ
70 #endif
71 #ifdef PORTK
72 #define USE_PORTK
73 #endif
74 #ifdef PORTL
75 #define USE_PORTL
76 #endif
77 #ifdef PORTQ
78 #define USE_PORTQ
79 #endif
80 #ifdef PORTR
81 #define USE_PORTR
82 #endif
83 
84 #ifdef TCCR0A
85 #define USE_TCCR0A
86 #endif
87 #ifdef TCCR1A
88 #define USE_TCCR1A
89 #endif
90 #ifdef TCCR2A
91 #define USE_TCCR2A
92 #endif
93 
94 //Port definitions for AtTiny, AtMega families.
95 
96 #define MAKE_PORT(portName, ddrName, pinName, className, ID) \
97  class className{\
98  public:\
99  typedef uint8_t DataT;\
100  public:\
101  static void Write(DataT value){portName = value;}\
102  static void ClearAndSet(DataT clearMask, DataT value){portName = (portName & ~clearMask) | value;}\
103  static DataT Read(){return portName;}\
104  static void DirWrite(DataT value){ddrName = value;}\
105  static DataT DirRead(){return ddrName;}\
106  static void Set(DataT value){portName |= value;}\
107  static void Clear(DataT value){portName &= ~value;}\
108  static void Toggle(DataT value){portName ^= value;}\
109  static void DirSet(DataT value){ddrName |= value;}\
110  static void DirClear(DataT value){ddrName &= ~value;}\
111  static void DirToggle(DataT value){ddrName ^= value;}\
112  static DataT PinRead(){return pinName;}\
113  enum{Id = ID};\
114  enum{Width=sizeof(DataT)*8};\
115  };
116 
117 // TCCR registers to set/clear Arduino PWM
118 #define MAKE_TCCR(TccrName, className) \
119  class className{\
120  public:\
121  typedef uint8_t DataT;\
122  public:\
123  static void Write(DataT value){TccrName = value;}\
124  static void ClearAndSet(DataT clearMask, DataT value){TccrName = (TccrName & ~clearMask) | value;}\
125  static DataT Read(){return TccrName;}\
126  static void Set(DataT value){TccrName |= value;}\
127  static void Clear(DataT value){TccrName &= ~value;}\
128  static void Toggle(DataT value){TccrName ^= value;}\
129  enum{Width=sizeof(DataT)*8};\
130  };
131 
132 #ifdef USE_PORTA
133 
134 MAKE_PORT(PORTA, DDRA, PINA, Porta, 'A')
135 #endif
136 #ifdef USE_PORTB
137 MAKE_PORT(PORTB, DDRB, PINB, Portb, 'B')
138 #endif
139 #ifdef USE_PORTC
140 MAKE_PORT(PORTC, DDRC, PINC, Portc, 'C')
141 #endif
142 #ifdef USE_PORTD
143 MAKE_PORT(PORTD, DDRD, PIND, Portd, 'D')
144 #endif
145 #ifdef USE_PORTE
146 MAKE_PORT(PORTE, DDRE, PINE, Porte, 'E')
147 #endif
148 #ifdef USE_PORTF
149 MAKE_PORT(PORTF, DDRF, PINF, Portf, 'F')
150 #endif
151 #ifdef USE_PORTG
152 MAKE_PORT(PORTG, DDRG, PING, Portg, 'G')
153 #endif
154 #ifdef USE_PORTH
155 MAKE_PORT(PORTH, DDRH, PINH, Porth, 'H')
156 #endif
157 #ifdef USE_PORTJ
158 MAKE_PORT(PORTJ, DDRJ, PINJ, Portj, 'J')
159 #endif
160 #ifdef USE_PORTK
161 MAKE_PORT(PORTK, DDRK, PINK, Portk, 'K')
162 #endif
163 #ifdef USE_PORTL
164 MAKE_PORT(PORTL, DDRL, PINL, Portl, 'L')
165 #endif
166 #ifdef USE_PORTQ
167 MAKE_PORT(PORTQ, DDRQ, PINQ, Portq, 'Q')
168 #endif
169 #ifdef USE_PORTR
170 MAKE_PORT(PORTR, DDRR, PINR, Portr, 'R')
171 #endif
172 
173 #ifdef USE_TCCR0A
174 MAKE_TCCR(TCCR0A, Tccr0a)
175 #endif
176 #ifdef USE_TCCR1A
177 MAKE_TCCR(TCCR1A, Tccr1a)
178 #endif
179 #ifdef USE_TCCR2A
180 MAKE_TCCR(TCCR2A, Tccr2a)
181 #endif
182 
183 // this class represents one pin in a IO port.
184 // It is fully static.
185 template<typename PORT, uint8_t PIN>
186 class TPin {
187  // BOOST_STATIC_ASSERT(PIN < PORT::Width);
188 public:
189  typedef PORT Port;
190 
191  enum {
192  Number = PIN
193  };
194 
195  static void Set() {
196  PORT::Set(1 << PIN);
197  }
198 
199  static void Set(uint8_t val) {
200  if(val)
201  Set();
202  else Clear();
203  }
204 
205  static void SetDir(uint8_t val) {
206  if(val)
207  SetDirWrite();
208  else SetDirRead();
209  }
210 
211  static void Clear() {
212  PORT::Clear(1 << PIN);
213  }
214 
215  static void Toggle() {
216  PORT::Toggle(1 << PIN);
217  }
218 
219  static void SetDirRead() {
220  PORT::DirClear(1 << PIN);
221  }
222 
223  static void SetDirWrite() {
224  PORT::DirSet(1 << PIN);
225  }
226 
227  static uint8_t IsSet() {
228  return PORT::PinRead() & (uint8_t)(1 << PIN);
229  }
230 
231  static void WaiteForSet() {
232  while(IsSet() == 0) {
233  }
234  }
235 
236  static void WaiteForClear() {
237  while(IsSet()) {
238  }
239  }
240 }; //class TPin...
241 
242 // this class represents one bit in TCCR port.
243 // used to set/clear TCCRx bits
244 // It is fully static.
245 
246 template<typename TCCR, uint8_t COM>
247 class TCom {
248  // BOOST_STATIC_ASSERT(PIN < PORT::Width);
249 public:
250  typedef TCCR Tccr;
251 
252  enum {
253  Com = COM
254  };
255 
256  static void Set() {
257  TCCR::Set(1 << COM);
258  }
259 
260  static void Clear() {
261  TCCR::Clear(1 << COM);
262  }
263 
264  static void Toggle() {
265  TCCR::Toggle(1 << COM);
266  }
267 }; //class TCom...
268 
269 //Short pin definitions
270 #ifdef USE_PORTA
271 typedef TPin<Porta, 0 > Pa0;
272 typedef TPin<Porta, 1 > Pa1;
273 typedef TPin<Porta, 2 > Pa2;
274 typedef TPin<Porta, 3 > Pa3;
275 typedef TPin<Porta, 4 > Pa4;
276 typedef TPin<Porta, 5 > Pa5;
277 typedef TPin<Porta, 6 > Pa6;
278 typedef TPin<Porta, 7 > Pa7;
279 #endif
280 
281 #ifdef USE_PORTB
282 typedef TPin<Portb, 0 > Pb0;
283 typedef TPin<Portb, 1 > Pb1;
284 typedef TPin<Portb, 2 > Pb2;
285 typedef TPin<Portb, 3 > Pb3;
286 typedef TPin<Portb, 4 > Pb4;
287 typedef TPin<Portb, 5 > Pb5;
288 typedef TPin<Portb, 6 > Pb6;
289 typedef TPin<Portb, 7 > Pb7;
290 #endif
291 
292 #ifdef USE_PORTC
293 typedef TPin<Portc, 0 > Pc0;
294 typedef TPin<Portc, 1 > Pc1;
295 typedef TPin<Portc, 2 > Pc2;
296 typedef TPin<Portc, 3 > Pc3;
297 typedef TPin<Portc, 4 > Pc4;
298 typedef TPin<Portc, 5 > Pc5;
299 typedef TPin<Portc, 6 > Pc6;
300 typedef TPin<Portc, 7 > Pc7;
301 #endif
302 
303 #ifdef USE_PORTD
304 typedef TPin<Portd, 0 > Pd0;
305 typedef TPin<Portd, 1 > Pd1;
306 typedef TPin<Portd, 2 > Pd2;
307 typedef TPin<Portd, 3 > Pd3;
308 typedef TPin<Portd, 4 > Pd4;
309 typedef TPin<Portd, 5 > Pd5;
310 typedef TPin<Portd, 6 > Pd6;
311 typedef TPin<Portd, 7 > Pd7;
312 #endif
313 
314 #ifdef USE_PORTE
315 typedef TPin<Porte, 0 > Pe0;
316 typedef TPin<Porte, 1 > Pe1;
317 typedef TPin<Porte, 2 > Pe2;
318 typedef TPin<Porte, 3 > Pe3;
319 typedef TPin<Porte, 4 > Pe4;
320 typedef TPin<Porte, 5 > Pe5;
321 typedef TPin<Porte, 6 > Pe6;
322 typedef TPin<Porte, 7 > Pe7;
323 #endif
324 
325 #ifdef USE_PORTF
326 typedef TPin<Portf, 0 > Pf0;
327 typedef TPin<Portf, 1 > Pf1;
328 typedef TPin<Portf, 2 > Pf2;
329 typedef TPin<Portf, 3 > Pf3;
330 typedef TPin<Portf, 4 > Pf4;
331 typedef TPin<Portf, 5 > Pf5;
332 typedef TPin<Portf, 6 > Pf6;
333 typedef TPin<Portf, 7 > Pf7;
334 #endif
335 
336 #ifdef USE_PORTG
337 typedef TPin<Portg, 0 > Pg0;
338 typedef TPin<Portg, 1 > Pg1;
339 typedef TPin<Portg, 2 > Pg2;
340 typedef TPin<Portg, 3 > Pg3;
341 typedef TPin<Portg, 4 > Pg4;
342 typedef TPin<Portg, 5 > Pg5;
343 typedef TPin<Portg, 6 > Pg6;
344 typedef TPin<Portg, 7 > Pg7;
345 #endif
346 
347 #ifdef USE_PORTH
348 typedef TPin<Porth, 0 > Ph0;
349 typedef TPin<Porth, 1 > Ph1;
350 typedef TPin<Porth, 2 > Ph2;
351 typedef TPin<Porth, 3 > Ph3;
352 typedef TPin<Porth, 4 > Ph4;
353 typedef TPin<Porth, 5 > Ph5;
354 typedef TPin<Porth, 6 > Ph6;
355 typedef TPin<Porth, 7 > Ph7;
356 #endif
357 
358 #ifdef USE_PORTJ
359 typedef TPin<Portj, 0 > Pj0;
360 typedef TPin<Portj, 1 > Pj1;
361 typedef TPin<Portj, 2 > Pj2;
362 typedef TPin<Portj, 3 > Pj3;
363 typedef TPin<Portj, 4 > Pj4;
364 typedef TPin<Portj, 5 > Pj5;
365 typedef TPin<Portj, 6 > Pj6;
366 typedef TPin<Portj, 7 > Pj7;
367 #endif
368 
369 #ifdef USE_PORTK
370 typedef TPin<Portk, 0 > Pk0;
371 typedef TPin<Portk, 1 > Pk1;
372 typedef TPin<Portk, 2 > Pk2;
373 typedef TPin<Portk, 3 > Pk3;
374 typedef TPin<Portk, 4 > Pk4;
375 typedef TPin<Portk, 5 > Pk5;
376 typedef TPin<Portk, 6 > Pk6;
377 typedef TPin<Portk, 7 > Pk7;
378 #endif
379 
380 #ifdef USE_PORTL
381 typedef TPin<Portl, 0 > Pl0;
382 typedef TPin<Portl, 1 > Pl1;
383 typedef TPin<Portl, 2 > Pl2;
384 typedef TPin<Portl, 3 > Pl3;
385 typedef TPin<Portl, 4 > Pl4;
386 typedef TPin<Portl, 5 > Pl5;
387 typedef TPin<Portl, 6 > Pl6;
388 typedef TPin<Portl, 7 > Pl7;
389 #endif
390 
391 #ifdef USE_PORTQ
392 typedef TPin<Portq, 0 > Pq0;
393 typedef TPin<Portq, 1 > Pq1;
394 typedef TPin<Portq, 2 > Pq2;
395 typedef TPin<Portq, 3 > Pq3;
396 typedef TPin<Portq, 4 > Pq4;
397 typedef TPin<Portq, 5 > Pq5;
398 typedef TPin<Portq, 6 > Pq6;
399 typedef TPin<Portq, 7 > Pq7;
400 #endif
401 
402 #ifdef USE_PORTR
403 typedef TPin<Portr, 0 > Pr0;
404 typedef TPin<Portr, 1 > Pr1;
405 typedef TPin<Portr, 2 > Pr2;
406 typedef TPin<Portr, 3 > Pr3;
407 typedef TPin<Portr, 4 > Pr4;
408 typedef TPin<Portr, 5 > Pr5;
409 typedef TPin<Portr, 6 > Pr6;
410 typedef TPin<Portr, 7 > Pr7;
411 #endif
412 
413 #ifdef USE_TCCR0A
414 typedef TCom<Tccr0a, COM0A1> Tc0a; //P6
415 typedef TCom<Tccr0a, COM0B1> Tc0b; //P5
416 #endif
417 
418 #ifdef USE_TCCR1A
419 typedef TCom<Tccr1a, COM1A1> Tc1a; //P9
420 typedef TCom<Tccr1a, COM1B1> Tc1b; //P10
421 #endif
422 
423 #ifdef USE_TCCR2A
424 typedef TCom<Tccr2a, COM2A1> Tc2a; //P11
425 typedef TCom<Tccr2a, COM2B1> Tc2b; //P3
426 #endif
427 
428 template<typename Tp_pin, typename Tc_bit>
429 class Tp_Tc {
430 public:
431 
432  static void SetDir(uint8_t val) {
433  if(val)
434  SetDirWrite();
435  else SetDirRead();
436  }
437 
438  static void SetDirRead() {
439  Tp_pin::SetDirRead(); //set pin direction
440  Tc_bit::Clear(); //disconnect pin from PWM
441  }
442 
443  static void SetDirWrite() {
444  Tp_pin::SetDirWrite();
445  Tc_bit::Clear();
446  }
447 };
448 
449 /* pin definitions for cases where it's necessary to clear compare output mode bits */
450 
451 //typedef Tp_Tc<Pd3, Tc2b> P3; //Arduino pin 3
452 //typedef Tp_Tc<Pd5, Tc0b> P5; //Arduino pin 5
453 //typedef Tp_Tc<Pd6, Tc0a> P6; //Arduino pin 6
454 //typedef Tp_Tc<Pb1, Tc1a> P9; //Arduino pin 9
455 //typedef Tp_Tc<Pb2, Tc1b> P10; //Arduino pin 10
456 //typedef Tp_Tc<Pb3, Tc2a> P11; //Arduino pin 11
457 
458 /* Arduino pin definitions */
459 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
460 // "Mega" Arduino pin numbers
461 
462 #define P0 Pe0
463 #define P1 Pe1
464 #define P2 Pe4
465 #define P3 Pe5
466 #define P4 Pg5
467 #define P5 Pe3
468 #define P6 Ph3
469 #define P7 Ph4
470 
471 #define P8 Ph5
472 #define P9 Ph6
473 #define P10 Pb4
474 #define P11 Pb5
475 #define P12 Pb6
476 #define P13 Pb7
477 
478 #define P14 Pj1
479 #define P15 Pj0
480 #define P16 Ph1
481 #define P17 Ph0
482 #define P18 Pd3
483 #define P19 Pd2
484 #define P20 Pd1
485 #define P21 Pd0
486 
487 #define P22 Pa0
488 #define P23 Pa1
489 #define P24 Pa2
490 #define P25 Pa3
491 #define P26 Pa4
492 #define P27 Pa5
493 #define P28 Pa6
494 #define P29 Pa7
495 #define P30 Pc7
496 #define P31 Pc6
497 #define P32 Pc5
498 #define P33 Pc4
499 #define P34 Pc3
500 #define P35 Pc2
501 #define P36 Pc1
502 #define P37 Pc0
503 
504 #define P38 Pd7
505 #define P39 Pg2
506 #define P40 Pg1
507 #define P41 Pg0
508 #define P42 Pl7
509 #define P43 Pl6
510 #define P44 Pl5
511 #define P45 Pl4
512 #define P46 Pl3
513 #define P47 Pl2
514 #define P48 Pl1
515 #define P49 Pl0
516 #define P50 Pb3
517 #define P51 Pb2
518 #define P52 Pb1
519 #define P53 Pb0
520 
521 #ifdef BOARD_MEGA_ADK // These pins are not broken out on the Arduino ADK
522 #define P54 Pe6 // INT on Arduino ADK
523 #define P55 Pj2 // MAX_RESET on Arduino ADK
524 #endif
525 
526 // "Mega" pin numbers
527 
528 #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
529 // "Classic" Arduino pin numbers
530 
531 #define P0 Pd0
532 #define P1 Pd1
533 #define P2 Pd2
534 #define P3 Pd3
535 #define P4 Pd4
536 #define P5 Pd5
537 #define P6 Pd6
538 #define P7 Pd7
539 
540 #define P8 Pb0
541 #define P9 Pb1
542 #define P10 Pb2
543 #define P11 Pb3
544 #define P12 Pb4
545 #define P13 Pb5
546 
547 #define P14 Pc0
548 #define P15 Pc1
549 #define P16 Pc2
550 #define P17 Pc3
551 #define P18 Pc4
552 #define P19 Pc5
553 
554 // "Classic" Arduino pin numbers
555 
556 #elif defined(CORE_TEENSY) && defined(__AVR_ATmega32U4__)
557 // Teensy 2.0 pin numbers
558 // http://www.pjrc.com/teensy/pinout.html
559 #define P0 Pb0
560 #define P1 Pb1
561 #define P2 Pb2
562 #define P3 Pb3
563 #define P4 Pb7
564 #define P5 Pd0
565 #define P6 Pd1
566 #define P7 Pd2
567 #define P8 Pd3
568 #define P9 Pc6
569 #define P10 Pc7
570 #define P11 Pd6
571 #define P12 Pd7
572 #define P13 Pb4
573 #define P14 Pb5
574 #define P15 Pb6
575 #define P16 Pf7
576 #define P17 Pf6
577 #define P18 Pf5
578 #define P19 Pf4
579 #define P20 Pf1
580 #define P21 Pf0
581 #define P22 Pd4
582 #define P23 Pd5
583 #define P24 Pe6
584 // Teensy 2.0
585 
586 #elif defined(__AVR_ATmega32U4__)
587 // Arduino Leonardo pin numbers
588 
589 #define P0 Pd2 // D0 - PD2
590 #define P1 Pd3 // D1 - PD3
591 #define P2 Pd1 // D2 - PD1
592 #define P3 Pd0 // D3 - PD0
593 #define P4 Pd4 // D4 - PD4
594 #define P5 Pc6 // D5 - PC6
595 #define P6 Pd7 // D6 - PD7
596 #define P7 Pe6 // D7 - PE6
597 
598 #define P8 Pb4 // D8 - PB4
599 #define P9 Pb5 // D9 - PB5
600 #define P10 Pb6 // D10 - PB6
601 #define P11 Pb7 // D11 - PB7
602 #define P12 Pd6 // D12 - PD6
603 #define P13 Pc7 // D13 - PC7
604 
605 #define P14 Pb3 // D14 - MISO - PB3
606 #define P15 Pb1 // D15 - SCK - PB1
607 #define P16 Pb2 // D16 - MOSI - PB2
608 #define P17 Pb0 // D17 - SS - PB0
609 
610 #define P18 Pf7 // D18 - A0 - PF7
611 #define P19 Pf6 // D19 - A1 - PF6
612 #define P20 Pf5 // D20 - A2 - PF5
613 #define P21 Pf4 // D21 - A3 - PF4
614 #define P22 Pf1 // D22 - A4 - PF1
615 #define P23 Pf0 // D23 - A5 - PF0
616 
617 #define P24 Pd4 // D24 / D4 - A6 - PD4
618 #define P25 Pd7 // D25 / D6 - A7 - PD7
619 #define P26 Pb4 // D26 / D8 - A8 - PB4
620 #define P27 Pb5 // D27 / D9 - A9 - PB5
621 #define P28 Pb6 // D28 / D10 - A10 - PB6
622 #define P29 Pd6 // D29 / D12 - A11 - PD6
623 
624 // Arduino Leonardo pin numbers
625 
626 #elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
627 // Teensy++ 1.0 and 2.0 pin numbers
628 // http://www.pjrc.com/teensy/pinout.html
629 #define P0 Pd0
630 #define P1 Pd1
631 #define P2 Pd2
632 #define P3 Pd3
633 #define P4 Pd4
634 #define P5 Pd5
635 #define P6 Pd6
636 #define P7 Pd7
637 #define P8 Pe0
638 #define P9 Pe1
639 #define P10 Pc0
640 #define P11 Pc1
641 #define P12 Pc2
642 #define P13 Pc3
643 #define P14 Pc4
644 #define P15 Pc5
645 #define P16 Pc6
646 #define P17 Pc7
647 #define P18 Pe6
648 #define P19 Pe7
649 #define P20 Pb0
650 #define P21 Pb1
651 #define P22 Pb2
652 #define P23 Pb3
653 #define P24 Pb4
654 #define P25 Pb5
655 #define P26 Pb6
656 #define P27 Pb7
657 #define P28 Pa0
658 #define P29 Pa1
659 #define P30 Pa2
660 #define P31 Pa3
661 #define P32 Pa4
662 #define P33 Pa5
663 #define P34 Pa6
664 #define P35 Pa7
665 #define P36 Pe4
666 #define P37 Pe5
667 #define P38 Pf0
668 #define P39 Pf1
669 #define P40 Pf2
670 #define P41 Pf3
671 #define P42 Pf4
672 #define P43 Pf5
673 #define P44 Pf6
674 #define P45 Pf7
675 // Teensy++ 1.0 and 2.0
676 
677 #elif defined(ARDUINO_AVR_BALANDUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284P__))
678 // Balanduino pin numbers
679 // http://balanduino.net/
680 #define P0 Pd0 /* 0 - PD0 */
681 #define P1 Pd1 /* 1 - PD1 */
682 
683 #if BALANDUINO_REVISION < 13
684  #define P2 Pb2 /* 2 - PB2 */
685  #define P3 Pd6 /* 3 - PD6 */
686  #define P4 Pd7 /* 4 - PD7 */
687  #define P5 Pb3 /* 5 - PB3 */
688 #else
689  #define P2 Pd2 /* 2 - PD2 */
690  #define P3 Pd3 /* 3 - PD3 */
691  #define P4 Pd6 /* 4 - PD6 */
692  #define P5 Pd7 /* 5 - PD7 */
693 #endif
694 
695 #define P6 Pb4 /* 6 - PB4 */
696 #define P7 Pa0 /* 7 - PA0 */
697 #define P8 Pa1 /* 8 - PA1 */
698 #define P9 Pa2 /* 9 - PA2 */
699 #define P10 Pa3 /* 10 - PA3 */
700 #define P11 Pa4 /* 11 - PA4 */
701 #define P12 Pa5 /* 12 - PA5 */
702 #define P13 Pc1 /* 13 - PC1 */
703 #define P14 Pc0 /* 14 - PC0 */
704 
705 #if BALANDUINO_REVISION < 13
706  #define P15 Pd2 /* 15 - PD2 */
707  #define P16 Pd3 /* 16 - PD3 */
708 #else
709  #define P15 Pb2 /* 15 - PB2 */
710  #define P16 Pb3 /* 16 - PB2 */
711 #endif
712 
713 #define P17 Pd4 /* 17 - PD4 */
714 #define P18 Pd5 /* 18 - PD5 */
715 #define P19 Pc2 /* 19 - PC2 */
716 #define P20 Pc3 /* 20 - PC3 */
717 #define P21 Pc4 /* 21 - PC4 */
718 #define P22 Pc5 /* 22 - PC5 */
719 #define P23 Pc6 /* 23 - PC6 */
720 #define P24 Pc7 /* 24 - PC7 */
721 #define P25 Pb0 /* 25 - PB0 */
722 #define P26 Pb1 /* 26 - PB1 */
723 #define P27 Pb5 /* 27 - PB5 */
724 #define P28 Pb6 /* 28 - PB6 */
725 #define P29 Pb7 /* 29 - PB7 */
726 #define P30 Pa6 /* 30 - PA6 */
727 #define P31 Pa7 /* 31 - PA7 */
728 // Balanduino
729 
730 #elif defined(ARDUINO_AVR_UNO_PRO) && defined(__AVR_ATmega1284P__)
731 // UNO*Pro pin numbers
732 // Homepage: http://www.hobbytronics.co.uk/arduino-uno-pro
733 // Pin Reference: http://www.hobbytronics.co.uk/download/uno_pro/pins_arduino.h
734 #define P0 Pd0
735 #define P1 Pd1
736 #define P2 Pb2
737 #define P3 Pb3
738 #define P4 Pb0
739 #define P5 Pb1
740 #define P6 Pd2
741 #define P7 Pd3
742 #define P8 Pd5
743 #define P9 Pd6
744 #define P10 Pb4
745 #define P11 Pb5
746 #define P12 Pb6
747 #define P13 Pb7
748 #define P14 Pa7
749 #define P15 Pa6
750 #define P16 Pa5
751 #define P17 Pa4
752 #define P18 Pa3
753 #define P19 Pa2
754 #define P20 Pa1
755 #define P21 Pa0
756 #define P22 Pc0
757 #define P23 Pc1
758 #define P24 Pc2
759 #define P25 Pc3
760 #define P26 Pc4
761 #define P27 Pc5
762 #define P28 Pc6
763 #define P29 Pc7
764 #define P30 Pd4
765 #define P31 Pd7
766 // UNO*Pro
767 
768 #elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
769 // Sanguino pin numbers
770 // Homepage: http://sanguino.cc/hardware
771 // Hardware add-on: https://github.com/Lauszus/Sanguino
772 #define P0 Pb0
773 #define P1 Pb1
774 #define P2 Pb2
775 #define P3 Pb3
776 #define P4 Pb4
777 #define P5 Pb5
778 #define P6 Pb6
779 #define P7 Pb7
780 #define P8 Pd0
781 #define P9 Pd1
782 #define P10 Pd2
783 #define P11 Pd3
784 #define P12 Pd4
785 #define P13 Pd5
786 #define P14 Pd6
787 #define P15 Pd7
788 #define P16 Pc0
789 #define P17 Pc1
790 #define P18 Pc2
791 #define P19 Pc3
792 #define P20 Pc4
793 #define P21 Pc5
794 #define P22 Pc6
795 #define P23 Pc7
796 #define P24 Pa0
797 #define P25 Pa1
798 #define P26 Pa2
799 #define P27 Pa3
800 #define P28 Pa4
801 #define P29 Pa5
802 #define P30 Pa6
803 #define P31 Pa7
804 // Sanguino
805 
806 #else
807 #error "Please define board in avrpins.h"
808 
809 #endif // Arduino pin definitions
810 
811 #elif defined(__arm__)
812 
813 // pointers are 32 bits on ARM
814 #define pgm_read_pointer(p) pgm_read_dword(p)
815 
816 #if defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__))
817 
818 #include "core_pins.h"
819 #include "avr_emulation.h"
820 
821 #define GPIO_BITBAND_ADDR(reg, bit) (((uint32_t)&(reg) - 0x40000000) * 32 + (bit) * 4 + 0x42000000)
822 #define GPIO_BITBAND_PTR(reg, bit) ((uint8_t *)GPIO_BITBAND_ADDR((reg), (bit)))
823 
824 #define MAKE_PIN(className, baseReg, pinNum, configReg) \
825 class className { \
826 public: \
827  static void Set() { \
828  *GPIO_BITBAND_PTR(baseReg, pinNum) = 1; \
829  } \
830  static void Clear() { \
831  *GPIO_BITBAND_PTR(baseReg, pinNum) = 0; \
832  } \
833  static void SetDirRead() { \
834  configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
835  *(GPIO_BITBAND_PTR(baseReg, pinNum) + 640) = 0; \
836  } \
837  static void SetDirWrite() { \
838  configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
839  *(GPIO_BITBAND_PTR(baseReg, pinNum) + 640) = 1; \
840  } \
841  static uint8_t IsSet() { \
842  return *(GPIO_BITBAND_PTR(baseReg, pinNum) + 512); \
843  } \
844 };
845 
846 MAKE_PIN(P0, CORE_PIN0_PORTREG, CORE_PIN0_BIT, CORE_PIN0_CONFIG);
847 MAKE_PIN(P1, CORE_PIN1_PORTREG, CORE_PIN1_BIT, CORE_PIN1_CONFIG);
848 MAKE_PIN(P2, CORE_PIN2_PORTREG, CORE_PIN2_BIT, CORE_PIN2_CONFIG);
849 MAKE_PIN(P3, CORE_PIN3_PORTREG, CORE_PIN3_BIT, CORE_PIN3_CONFIG);
850 MAKE_PIN(P4, CORE_PIN4_PORTREG, CORE_PIN4_BIT, CORE_PIN4_CONFIG);
851 MAKE_PIN(P5, CORE_PIN5_PORTREG, CORE_PIN5_BIT, CORE_PIN5_CONFIG);
852 MAKE_PIN(P6, CORE_PIN6_PORTREG, CORE_PIN6_BIT, CORE_PIN6_CONFIG);
853 MAKE_PIN(P7, CORE_PIN7_PORTREG, CORE_PIN7_BIT, CORE_PIN7_CONFIG);
854 MAKE_PIN(P8, CORE_PIN8_PORTREG, CORE_PIN8_BIT, CORE_PIN8_CONFIG);
855 MAKE_PIN(P9, CORE_PIN9_PORTREG, CORE_PIN9_BIT, CORE_PIN9_CONFIG);
856 MAKE_PIN(P10, CORE_PIN10_PORTREG, CORE_PIN10_BIT, CORE_PIN10_CONFIG);
857 MAKE_PIN(P11, CORE_PIN11_PORTREG, CORE_PIN11_BIT, CORE_PIN11_CONFIG);
858 MAKE_PIN(P12, CORE_PIN12_PORTREG, CORE_PIN12_BIT, CORE_PIN12_CONFIG);
859 MAKE_PIN(P13, CORE_PIN13_PORTREG, CORE_PIN13_BIT, CORE_PIN13_CONFIG);
860 MAKE_PIN(P14, CORE_PIN14_PORTREG, CORE_PIN14_BIT, CORE_PIN14_CONFIG);
861 MAKE_PIN(P15, CORE_PIN15_PORTREG, CORE_PIN15_BIT, CORE_PIN15_CONFIG);
862 MAKE_PIN(P16, CORE_PIN16_PORTREG, CORE_PIN16_BIT, CORE_PIN16_CONFIG);
863 MAKE_PIN(P17, CORE_PIN17_PORTREG, CORE_PIN17_BIT, CORE_PIN17_CONFIG);
864 MAKE_PIN(P18, CORE_PIN18_PORTREG, CORE_PIN18_BIT, CORE_PIN18_CONFIG);
865 MAKE_PIN(P19, CORE_PIN19_PORTREG, CORE_PIN19_BIT, CORE_PIN19_CONFIG);
866 MAKE_PIN(P20, CORE_PIN20_PORTREG, CORE_PIN20_BIT, CORE_PIN20_CONFIG);
867 MAKE_PIN(P21, CORE_PIN21_PORTREG, CORE_PIN21_BIT, CORE_PIN21_CONFIG);
868 MAKE_PIN(P22, CORE_PIN22_PORTREG, CORE_PIN22_BIT, CORE_PIN22_CONFIG);
869 MAKE_PIN(P23, CORE_PIN23_PORTREG, CORE_PIN23_BIT, CORE_PIN23_CONFIG);
870 MAKE_PIN(P24, CORE_PIN24_PORTREG, CORE_PIN24_BIT, CORE_PIN24_CONFIG);
871 MAKE_PIN(P25, CORE_PIN25_PORTREG, CORE_PIN25_BIT, CORE_PIN25_CONFIG);
872 MAKE_PIN(P26, CORE_PIN26_PORTREG, CORE_PIN26_BIT, CORE_PIN26_CONFIG);
873 MAKE_PIN(P27, CORE_PIN27_PORTREG, CORE_PIN27_BIT, CORE_PIN27_CONFIG);
874 MAKE_PIN(P28, CORE_PIN28_PORTREG, CORE_PIN28_BIT, CORE_PIN28_CONFIG);
875 MAKE_PIN(P29, CORE_PIN29_PORTREG, CORE_PIN29_BIT, CORE_PIN29_CONFIG);
876 MAKE_PIN(P30, CORE_PIN30_PORTREG, CORE_PIN30_BIT, CORE_PIN30_CONFIG);
877 MAKE_PIN(P31, CORE_PIN31_PORTREG, CORE_PIN31_BIT, CORE_PIN31_CONFIG);
878 MAKE_PIN(P32, CORE_PIN32_PORTREG, CORE_PIN32_BIT, CORE_PIN32_CONFIG);
879 MAKE_PIN(P33, CORE_PIN33_PORTREG, CORE_PIN33_BIT, CORE_PIN33_CONFIG);
880 #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
881 MAKE_PIN(P34, CORE_PIN34_PORTREG, CORE_PIN34_BIT, CORE_PIN34_CONFIG);
882 MAKE_PIN(P35, CORE_PIN35_PORTREG, CORE_PIN35_BIT, CORE_PIN35_CONFIG);
883 MAKE_PIN(P36, CORE_PIN36_PORTREG, CORE_PIN36_BIT, CORE_PIN36_CONFIG);
884 MAKE_PIN(P37, CORE_PIN37_PORTREG, CORE_PIN37_BIT, CORE_PIN37_CONFIG);
885 MAKE_PIN(P38, CORE_PIN38_PORTREG, CORE_PIN38_BIT, CORE_PIN38_CONFIG);
886 MAKE_PIN(P39, CORE_PIN39_PORTREG, CORE_PIN39_BIT, CORE_PIN39_CONFIG);
887 MAKE_PIN(P40, CORE_PIN40_PORTREG, CORE_PIN40_BIT, CORE_PIN40_CONFIG);
888 MAKE_PIN(P41, CORE_PIN41_PORTREG, CORE_PIN41_BIT, CORE_PIN41_CONFIG);
889 MAKE_PIN(P42, CORE_PIN42_PORTREG, CORE_PIN42_BIT, CORE_PIN42_CONFIG);
890 MAKE_PIN(P43, CORE_PIN43_PORTREG, CORE_PIN43_BIT, CORE_PIN43_CONFIG);
891 MAKE_PIN(P44, CORE_PIN44_PORTREG, CORE_PIN44_BIT, CORE_PIN44_CONFIG);
892 MAKE_PIN(P45, CORE_PIN45_PORTREG, CORE_PIN45_BIT, CORE_PIN45_CONFIG);
893 MAKE_PIN(P46, CORE_PIN46_PORTREG, CORE_PIN46_BIT, CORE_PIN46_CONFIG);
894 MAKE_PIN(P47, CORE_PIN47_PORTREG, CORE_PIN47_BIT, CORE_PIN47_CONFIG);
895 MAKE_PIN(P48, CORE_PIN48_PORTREG, CORE_PIN48_BIT, CORE_PIN48_CONFIG);
896 MAKE_PIN(P49, CORE_PIN49_PORTREG, CORE_PIN49_BIT, CORE_PIN49_CONFIG);
897 MAKE_PIN(P50, CORE_PIN50_PORTREG, CORE_PIN50_BIT, CORE_PIN50_CONFIG);
898 MAKE_PIN(P51, CORE_PIN51_PORTREG, CORE_PIN51_BIT, CORE_PIN51_CONFIG);
899 MAKE_PIN(P52, CORE_PIN52_PORTREG, CORE_PIN52_BIT, CORE_PIN52_CONFIG);
900 MAKE_PIN(P53, CORE_PIN53_PORTREG, CORE_PIN53_BIT, CORE_PIN53_CONFIG);
901 MAKE_PIN(P54, CORE_PIN54_PORTREG, CORE_PIN54_BIT, CORE_PIN54_CONFIG);
902 MAKE_PIN(P55, CORE_PIN55_PORTREG, CORE_PIN55_BIT, CORE_PIN55_CONFIG);
903 MAKE_PIN(P56, CORE_PIN56_PORTREG, CORE_PIN56_BIT, CORE_PIN56_CONFIG);
904 MAKE_PIN(P57, CORE_PIN57_PORTREG, CORE_PIN57_BIT, CORE_PIN57_CONFIG);
905 MAKE_PIN(P58, CORE_PIN58_PORTREG, CORE_PIN58_BIT, CORE_PIN58_CONFIG);
906 MAKE_PIN(P59, CORE_PIN59_PORTREG, CORE_PIN59_BIT, CORE_PIN59_CONFIG);
907 MAKE_PIN(P60, CORE_PIN60_PORTREG, CORE_PIN60_BIT, CORE_PIN60_CONFIG);
908 MAKE_PIN(P61, CORE_PIN61_PORTREG, CORE_PIN61_BIT, CORE_PIN61_CONFIG);
909 MAKE_PIN(P62, CORE_PIN62_PORTREG, CORE_PIN62_BIT, CORE_PIN62_CONFIG);
910 MAKE_PIN(P63, CORE_PIN63_PORTREG, CORE_PIN63_BIT, CORE_PIN63_CONFIG);
911 #endif
912 
913 #undef MAKE_PIN
914 
915 #elif defined(CORE_TEENSY) && (defined(__MKL26Z64__))
916 
917 // we could get lower level by making these macros work properly.
918 // for now just use the semi optimised version, it costs a lookup in the pin pgm table per op
919 // but for now it will do.
920 //#define GPIO_BITBAND_ADDR(reg, bit) (((volatile uint8_t *)&(reg) + ((bit) >> 3)))
921 //#define GPIO_BITBAND_MASK(reg, bit) (1<<((bit) & 7))
922 //#define GPIO_BITBAND_PTR(reg, bit) ((volatile uint8_t *)GPIO_BITBAND_ADDR((reg), (bit)))
923 
924 #include "core_pins.h"
925 #include "avr_emulation.h"
926 
927 #define MAKE_PIN(className, baseReg, pinNum, configReg) \
928 class className { \
929 public: \
930  static void Set() { \
931  *portSetRegister(pinNum) = digitalPinToBitMask(pinNum); \
932  } \
933  static void Clear() { \
934  *portClearRegister(pinNum) = digitalPinToBitMask(pinNum); \
935  } \
936  static void SetDirRead() { \
937  configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
938  *portModeRegister(pinNum) &= ~digitalPinToBitMask(pinNum); \
939  } \
940  static void SetDirWrite() { \
941  configReg = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); \
942  *portModeRegister(pinNum) |= digitalPinToBitMask(pinNum); \
943  } \
944  static uint8_t IsSet() { \
945  return (*portInputRegister(pinNum) & digitalPinToBitMask(pinNum)) ? 1 : 0; \
946  } \
947 };
948 
949 MAKE_PIN(P0, CORE_PIN0_PORTREG, 0, CORE_PIN0_CONFIG);
950 MAKE_PIN(P1, CORE_PIN1_PORTREG, 1, CORE_PIN1_CONFIG);
951 MAKE_PIN(P2, CORE_PIN2_PORTREG, 2, CORE_PIN2_CONFIG);
952 MAKE_PIN(P3, CORE_PIN3_PORTREG, 3, CORE_PIN3_CONFIG);
953 MAKE_PIN(P4, CORE_PIN4_PORTREG, 4, CORE_PIN4_CONFIG);
954 MAKE_PIN(P5, CORE_PIN5_PORTREG, 5, CORE_PIN5_CONFIG);
955 MAKE_PIN(P6, CORE_PIN6_PORTREG, 6, CORE_PIN6_CONFIG);
956 MAKE_PIN(P7, CORE_PIN7_PORTREG, 7, CORE_PIN7_CONFIG);
957 MAKE_PIN(P8, CORE_PIN8_PORTREG, 8, CORE_PIN8_CONFIG);
958 MAKE_PIN(P9, CORE_PIN9_PORTREG, 9, CORE_PIN9_CONFIG);
959 MAKE_PIN(P10, CORE_PIN10_PORTREG, 10, CORE_PIN10_CONFIG);
960 MAKE_PIN(P11, CORE_PIN11_PORTREG, 11, CORE_PIN11_CONFIG);
961 MAKE_PIN(P12, CORE_PIN12_PORTREG, 12, CORE_PIN12_CONFIG);
962 MAKE_PIN(P13, CORE_PIN13_PORTREG, 13, CORE_PIN13_CONFIG);
963 MAKE_PIN(P14, CORE_PIN14_PORTREG, 14, CORE_PIN14_CONFIG);
964 MAKE_PIN(P15, CORE_PIN15_PORTREG, 15, CORE_PIN15_CONFIG);
965 MAKE_PIN(P16, CORE_PIN16_PORTREG, 16, CORE_PIN16_CONFIG);
966 MAKE_PIN(P17, CORE_PIN17_PORTREG, 17, CORE_PIN17_CONFIG);
967 MAKE_PIN(P18, CORE_PIN18_PORTREG, 18, CORE_PIN18_CONFIG);
968 MAKE_PIN(P19, CORE_PIN19_PORTREG, 19, CORE_PIN19_CONFIG);
969 MAKE_PIN(P20, CORE_PIN20_PORTREG, 20, CORE_PIN20_CONFIG);
970 MAKE_PIN(P21, CORE_PIN21_PORTREG, 21, CORE_PIN21_CONFIG);
971 MAKE_PIN(P22, CORE_PIN22_PORTREG, 22, CORE_PIN22_CONFIG);
972 MAKE_PIN(P23, CORE_PIN23_PORTREG, 23, CORE_PIN23_CONFIG);
973 MAKE_PIN(P24, CORE_PIN24_PORTREG, 24, CORE_PIN24_CONFIG);
974 MAKE_PIN(P25, CORE_PIN25_PORTREG, 25, CORE_PIN25_CONFIG);
975 MAKE_PIN(P26, CORE_PIN26_PORTREG, 26, CORE_PIN26_CONFIG);
976 
977 #undef MAKE_PIN
978 
979 #elif defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)
980 
981 // SetDirRead:
982 // Disable interrupts
983 // Disable the pull up resistor
984 // Set to INPUT
985 // Enable PIO
986 
987 // SetDirWrite:
988 // Disable interrupts
989 // Disable the pull up resistor
990 // Set to OUTPUT
991 // Enable PIO
992 
993 #define MAKE_PIN(className, pio, pinMask) \
994 class className { \
995 public: \
996  static void Set() { \
997  pio->PIO_SODR = pinMask; \
998  } \
999  static void Clear() { \
1000  pio->PIO_CODR = pinMask; \
1001  } \
1002  static void SetDirRead() { \
1003  pio->PIO_IDR = pinMask ; \
1004  pio->PIO_PUDR = pinMask; \
1005  pio->PIO_ODR = pinMask; \
1006  pio->PIO_PER = pinMask; \
1007  } \
1008  static void SetDirWrite() { \
1009  pio->PIO_IDR = pinMask ; \
1010  pio->PIO_PUDR = pinMask; \
1011  pio->PIO_OER = pinMask; \
1012  pio->PIO_PER = pinMask; \
1013  } \
1014  static uint8_t IsSet() { \
1015  return pio->PIO_PDSR & pinMask; \
1016  } \
1017 };
1018 
1019 // See: http://arduino.cc/en/Hacking/PinMappingSAM3X and variant.cpp
1020 
1021 MAKE_PIN(P0, PIOA, PIO_PA8);
1022 MAKE_PIN(P1, PIOA, PIO_PA9);
1023 MAKE_PIN(P2, PIOB, PIO_PB25);
1024 MAKE_PIN(P3, PIOC, PIO_PC28);
1025 MAKE_PIN(P4, PIOC, PIO_PC26);
1026 MAKE_PIN(P5, PIOC, PIO_PC25);
1027 MAKE_PIN(P6, PIOC, PIO_PC24);
1028 MAKE_PIN(P7, PIOC, PIO_PC23);
1029 MAKE_PIN(P8, PIOC, PIO_PC22);
1030 MAKE_PIN(P9, PIOC, PIO_PC21);
1031 MAKE_PIN(P10, PIOC, PIO_PC29);
1032 MAKE_PIN(P11, PIOD, PIO_PD7);
1033 MAKE_PIN(P12, PIOD, PIO_PD8);
1034 MAKE_PIN(P13, PIOB, PIO_PB27);
1035 MAKE_PIN(P14, PIOD, PIO_PD4);
1036 MAKE_PIN(P15, PIOD, PIO_PD5);
1037 MAKE_PIN(P16, PIOA, PIO_PA13);
1038 MAKE_PIN(P17, PIOA, PIO_PA12);
1039 MAKE_PIN(P18, PIOA, PIO_PA11);
1040 MAKE_PIN(P19, PIOA, PIO_PA10);
1041 MAKE_PIN(P20, PIOB, PIO_PB12);
1042 MAKE_PIN(P21, PIOB, PIO_PB13);
1043 MAKE_PIN(P22, PIOB, PIO_PB26);
1044 MAKE_PIN(P23, PIOA, PIO_PA14);
1045 MAKE_PIN(P24, PIOA, PIO_PA15);
1046 MAKE_PIN(P25, PIOD, PIO_PD0);
1047 MAKE_PIN(P26, PIOD, PIO_PD1);
1048 MAKE_PIN(P27, PIOD, PIO_PD2);
1049 MAKE_PIN(P28, PIOD, PIO_PD3);
1050 MAKE_PIN(P29, PIOD, PIO_PD6);
1051 MAKE_PIN(P30, PIOD, PIO_PD9);
1052 MAKE_PIN(P31, PIOA, PIO_PA7);
1053 MAKE_PIN(P32, PIOD, PIO_PD10);
1054 MAKE_PIN(P33, PIOC, PIO_PC1);
1055 MAKE_PIN(P34, PIOC, PIO_PC2);
1056 MAKE_PIN(P35, PIOC, PIO_PC3);
1057 MAKE_PIN(P36, PIOC, PIO_PC4);
1058 MAKE_PIN(P37, PIOC, PIO_PC5);
1059 MAKE_PIN(P38, PIOC, PIO_PC6);
1060 MAKE_PIN(P39, PIOC, PIO_PC7);
1061 MAKE_PIN(P40, PIOC, PIO_PC8);
1062 MAKE_PIN(P41, PIOC, PIO_PC9);
1063 MAKE_PIN(P42, PIOA, PIO_PA19);
1064 MAKE_PIN(P43, PIOA, PIO_PA20);
1065 MAKE_PIN(P44, PIOC, PIO_PC19);
1066 MAKE_PIN(P45, PIOC, PIO_PC18);
1067 MAKE_PIN(P46, PIOC, PIO_PC17);
1068 MAKE_PIN(P47, PIOC, PIO_PC16);
1069 MAKE_PIN(P48, PIOC, PIO_PC15);
1070 MAKE_PIN(P49, PIOC, PIO_PC14);
1071 MAKE_PIN(P50, PIOC, PIO_PC13);
1072 MAKE_PIN(P51, PIOC, PIO_PC12);
1073 MAKE_PIN(P52, PIOB, PIO_PB21);
1074 MAKE_PIN(P53, PIOB, PIO_PB14);
1075 MAKE_PIN(P54, PIOA, PIO_PA16);
1076 MAKE_PIN(P55, PIOA, PIO_PA24);
1077 MAKE_PIN(P56, PIOA, PIO_PA23);
1078 MAKE_PIN(P57, PIOA, PIO_PA22);
1079 MAKE_PIN(P58, PIOA, PIO_PA6);
1080 MAKE_PIN(P59, PIOA, PIO_PA4);
1081 MAKE_PIN(P60, PIOA, PIO_PA3);
1082 MAKE_PIN(P61, PIOA, PIO_PA2);
1083 MAKE_PIN(P62, PIOB, PIO_PB17);
1084 MAKE_PIN(P63, PIOB, PIO_PB18);
1085 MAKE_PIN(P64, PIOB, PIO_PB19);
1086 MAKE_PIN(P65, PIOB, PIO_PB20);
1087 MAKE_PIN(P66, PIOB, PIO_PB15);
1088 MAKE_PIN(P67, PIOB, PIO_PB16);
1089 MAKE_PIN(P68, PIOA, PIO_PA1);
1090 MAKE_PIN(P69, PIOA, PIO_PA0);
1091 MAKE_PIN(P70, PIOA, PIO_PA17);
1092 MAKE_PIN(P71, PIOA, PIO_PA18);
1093 MAKE_PIN(P72, PIOC, PIO_PC30);
1094 MAKE_PIN(P73, PIOA, PIO_PA21);
1095 MAKE_PIN(P74, PIOA, PIO_PA25); // MISO
1096 MAKE_PIN(P75, PIOA, PIO_PA26); // MOSI
1097 MAKE_PIN(P76, PIOA, PIO_PA27); // CLK
1098 MAKE_PIN(P77, PIOA, PIO_PA28);
1099 MAKE_PIN(P78, PIOB, PIO_PB23); // Unconnected
1100 
1101 #undef MAKE_PIN
1102 
1103 #elif defined(RBL_NRF51822)
1104 
1105 #define MAKE_PIN(className, pin) \
1106 class className { \
1107 public: \
1108  static void Set() { \
1109  nrf_gpio_pin_set(pin); \
1110  } \
1111  static void Clear() { \
1112  nrf_gpio_pin_clear(pin); \
1113  } \
1114  static void SetDirRead() { \
1115  nrf_gpio_cfg_input(pin, NRF_GPIO_PIN_NOPULL); \
1116  } \
1117  static void SetDirWrite() { \
1118  nrf_gpio_cfg_output(pin); \
1119  } \
1120  static uint8_t IsSet() { \
1121  return (uint8_t)nrf_gpio_pin_read(pin); \
1122  } \
1123 };
1124 
1125 // See: pin_transform.c in RBL nRF51822 SDK
1126 MAKE_PIN(P0, Pin_nRF51822_to_Arduino(D0));
1127 MAKE_PIN(P1, Pin_nRF51822_to_Arduino(D1));
1128 MAKE_PIN(P2, Pin_nRF51822_to_Arduino(D2));
1129 MAKE_PIN(P3, Pin_nRF51822_to_Arduino(D3));
1130 MAKE_PIN(P4, Pin_nRF51822_to_Arduino(D4));
1131 MAKE_PIN(P5, Pin_nRF51822_to_Arduino(D5));
1132 MAKE_PIN(P6, Pin_nRF51822_to_Arduino(D6));
1133 MAKE_PIN(P7, Pin_nRF51822_to_Arduino(D7));
1134 MAKE_PIN(P8, Pin_nRF51822_to_Arduino(D8));
1135 MAKE_PIN(P9, Pin_nRF51822_to_Arduino(D9)); // INT
1136 MAKE_PIN(P10, Pin_nRF51822_to_Arduino(D10)); // SS
1137 MAKE_PIN(P11, Pin_nRF51822_to_Arduino(D11));
1138 MAKE_PIN(P12, Pin_nRF51822_to_Arduino(D12));
1139 MAKE_PIN(P13, Pin_nRF51822_to_Arduino(D13));
1140 MAKE_PIN(P14, Pin_nRF51822_to_Arduino(D14));
1141 MAKE_PIN(P15, Pin_nRF51822_to_Arduino(D15));
1142 MAKE_PIN(P17, Pin_nRF51822_to_Arduino(D17)); // MISO
1143 MAKE_PIN(P18, Pin_nRF51822_to_Arduino(D18)); // MOSI
1144 MAKE_PIN(P16, Pin_nRF51822_to_Arduino(D16)); // CLK
1145 MAKE_PIN(P19, Pin_nRF51822_to_Arduino(D19));
1146 MAKE_PIN(P20, Pin_nRF51822_to_Arduino(D20));
1147 MAKE_PIN(P21, Pin_nRF51822_to_Arduino(D21));
1148 MAKE_PIN(P22, Pin_nRF51822_to_Arduino(D22));
1149 MAKE_PIN(P23, Pin_nRF51822_to_Arduino(D23));
1150 MAKE_PIN(P24, Pin_nRF51822_to_Arduino(D24));
1151 
1152 #undef MAKE_PIN
1153 
1154 #elif defined(STM32F446xx)
1155 // NUCLEO-F446RE
1156 
1157 #define MAKE_PIN(className, port, pin) \
1158 class className { \
1159 public: \
1160  static void Set() { \
1161  HAL_GPIO_WritePin(port, pin, GPIO_PIN_SET); \
1162  } \
1163  static void Clear() { \
1164  HAL_GPIO_WritePin(port, pin, GPIO_PIN_RESET); \
1165  } \
1166  static void SetDirRead() { \
1167  static GPIO_InitTypeDef GPIO_InitStruct; \
1168  GPIO_InitStruct.Pin = pin; \
1169  GPIO_InitStruct.Mode = GPIO_MODE_INPUT; \
1170  GPIO_InitStruct.Pull = GPIO_NOPULL; \
1171  HAL_GPIO_Init(port, &GPIO_InitStruct); \
1172  } \
1173  static void SetDirWrite() { \
1174  static GPIO_InitTypeDef GPIO_InitStruct; \
1175  GPIO_InitStruct.Pin = pin; \
1176  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; \
1177  GPIO_InitStruct.Pull = GPIO_NOPULL; \
1178  GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; \
1179  HAL_GPIO_Init(port, &GPIO_InitStruct); \
1180  } \
1181  static GPIO_PinState IsSet() { \
1182  return HAL_GPIO_ReadPin(port, pin); \
1183  } \
1184 };
1185 
1186 MAKE_PIN(P0, GPIOA, GPIO_PIN_3); // D0
1187 MAKE_PIN(P1, GPIOA, GPIO_PIN_2); // D1
1188 MAKE_PIN(P2, GPIOA, GPIO_PIN_10); // D2
1189 MAKE_PIN(P3, GPIOB, GPIO_PIN_3); // D3
1190 MAKE_PIN(P4, GPIOB, GPIO_PIN_5); // D4
1191 MAKE_PIN(P5, GPIOB, GPIO_PIN_4); // D5
1192 MAKE_PIN(P6, GPIOB, GPIO_PIN_10); // D6
1193 MAKE_PIN(P7, GPIOA, GPIO_PIN_8); // D7
1194 MAKE_PIN(P8, GPIOA, GPIO_PIN_9); // D8
1195 MAKE_PIN(P9, GPIOC, GPIO_PIN_7); // D9
1196 MAKE_PIN(P10, GPIOB, GPIO_PIN_6); // D10
1197 MAKE_PIN(P11, GPIOA, GPIO_PIN_7); // D11
1198 MAKE_PIN(P12, GPIOA, GPIO_PIN_6); // D12
1199 MAKE_PIN(P13, GPIOA, GPIO_PIN_5); // D13
1200 
1201 MAKE_PIN(P14, GPIOA, GPIO_PIN_0); // A0
1202 MAKE_PIN(P15, GPIOA, GPIO_PIN_1); // A1
1203 MAKE_PIN(P16, GPIOA, GPIO_PIN_4); // A2
1204 MAKE_PIN(P17, GPIOB, GPIO_PIN_0); // A3
1205 MAKE_PIN(P18, GPIOC, GPIO_PIN_1); // A4
1206 MAKE_PIN(P19, GPIOC, GPIO_PIN_0); // A5
1207 
1208 #undef MAKE_PIN
1209 
1210 #else
1211 #error "Please define board in avrpins.h"
1212 
1213 #endif
1214 
1215 #elif defined(__ARDUINO_ARC__)
1216 
1217 #include <avr/pgmspace.h>
1218 // Pointers are 32 bits on arc
1219 #define pgm_read_pointer(p) pgm_read_dword(p)
1220 
1221 #define MAKE_PIN(className, pin) \
1222 class className { \
1223 public: \
1224  static void Set() { \
1225  digitalWrite(pin, HIGH);\
1226  } \
1227  static void Clear() { \
1228  digitalWrite(pin, LOW); \
1229  } \
1230  static void SetDirRead() { \
1231  pinMode(pin, INPUT); \
1232  } \
1233  static void SetDirWrite() { \
1234  pinMode(pin, OUTPUT); \
1235  } \
1236  static uint8_t IsSet() { \
1237  return digitalRead(pin); \
1238  } \
1239 };
1240 
1241 MAKE_PIN(P0, 0);
1242 MAKE_PIN(P1, 1);
1243 MAKE_PIN(P2, 2);
1244 MAKE_PIN(P3, 3); //PWM
1245 MAKE_PIN(P4, 4);
1246 MAKE_PIN(P5, 5); //PWM
1247 MAKE_PIN(P6, 6); //PWM
1248 MAKE_PIN(P7, 7);
1249 MAKE_PIN(P8, 8);
1250 MAKE_PIN(P9, 9); //PWM
1251 
1252 MAKE_PIN(P10, 10); //SPI SS
1253 MAKE_PIN(P11, 11); //SPI MOSI
1254 MAKE_PIN(P12, 12); //SPI MISO
1255 MAKE_PIN(P13, 13); //SPI SCK / BUILTIN LED
1256 
1257 MAKE_PIN(P14, 14); // A0
1258 MAKE_PIN(P15, 15); // A1
1259 MAKE_PIN(P16, 16); // A2
1260 MAKE_PIN(P17, 17); // A3
1261 MAKE_PIN(P18, 18); // A4 SDA
1262 MAKE_PIN(P19, 19); // A5 SCL
1263 MAKE_PIN(P20, 20); // ATN
1264 
1265 #undef MAKE_PIN
1266 
1267 #elif defined(__ARDUINO_X86__) // Intel Galileo, Intel Galileo 2 and Intel Edison
1268 
1269 #include <avr/pgmspace.h>
1270 
1271 // Pointers are 32 bits on x86
1272 #define pgm_read_pointer(p) pgm_read_dword(p)
1273 
1274 #if PLATFORM_ID == 0xE1 // Edison platform id
1275 #define pinToFastPin(pin) 1 // As far as I can tell all pins can be used as fast pins
1276 #endif
1277 
1278 // Pin 2 and 3 on the Intel Galileo supports a higher rate,
1279 // so it is recommended to use one of these as the SS pin.
1280 
1281 #define MAKE_PIN(className, pin) \
1282 class className { \
1283 public: \
1284  static void Set() { \
1285  fastDigitalWrite(pin, HIGH); \
1286  } \
1287  static void Clear() { \
1288  fastDigitalWrite(pin, LOW); \
1289  } \
1290  static void SetDirRead() { \
1291  if (pinToFastPin(pin)) \
1292  pinMode(pin, INPUT_FAST); \
1293  else \
1294  pinMode(pin, INPUT); \
1295  } \
1296  static void SetDirWrite() { \
1297  if (pinToFastPin(pin)) \
1298  pinMode(pin, OUTPUT_FAST); \
1299  else \
1300  pinMode(pin, OUTPUT); \
1301  } \
1302  static uint8_t IsSet() { \
1303  return fastDigitalRead(pin); \
1304  } \
1305 };
1306 
1307 MAKE_PIN(P0, 0);
1308 MAKE_PIN(P1, 1);
1309 MAKE_PIN(P2, 2);
1310 MAKE_PIN(P3, 3);
1311 MAKE_PIN(P4, 4);
1312 MAKE_PIN(P5, 5);
1313 MAKE_PIN(P6, 6);
1314 MAKE_PIN(P7, 7);
1315 MAKE_PIN(P8, 8);
1316 MAKE_PIN(P9, 9);
1317 MAKE_PIN(P10, 10);
1318 MAKE_PIN(P11, 11);
1319 MAKE_PIN(P12, 12);
1320 MAKE_PIN(P13, 13);
1321 MAKE_PIN(P14, 14); // A0
1322 MAKE_PIN(P15, 15); // A1
1323 MAKE_PIN(P16, 16); // A2
1324 MAKE_PIN(P17, 17); // A3
1325 MAKE_PIN(P18, 18); // A4
1326 MAKE_PIN(P19, 19); // A5
1327 
1328 #undef MAKE_PIN
1329 
1330 #elif defined(__MIPSEL__)
1331 // MIPSEL (MIPS architecture using a little endian byte order)
1332 
1333 // MIPS size_t = 4
1334 #define pgm_read_pointer(p) pgm_read_dword(p)
1335 
1336 #define MAKE_PIN(className, pin) \
1337 class className { \
1338 public: \
1339  static void Set() { \
1340  digitalWrite(pin, HIGH);\
1341  } \
1342  static void Clear() { \
1343  digitalWrite(pin, LOW); \
1344  } \
1345  static void SetDirRead() { \
1346  pinMode(pin, INPUT); \
1347  } \
1348  static void SetDirWrite() { \
1349  pinMode(pin, OUTPUT); \
1350  } \
1351  static uint8_t IsSet() { \
1352  return digitalRead(pin); \
1353  } \
1354 };
1355 
1356 // 0 .. 13 - Digital pins
1357 MAKE_PIN(P0, 0); // RX
1358 MAKE_PIN(P1, 1); // TX
1359 MAKE_PIN(P2, 2); //
1360 MAKE_PIN(P3, 3); //
1361 MAKE_PIN(P4, 4); //
1362 MAKE_PIN(P5, 5); //
1363 MAKE_PIN(P6, 6); //
1364 MAKE_PIN(P7, 7); //
1365 MAKE_PIN(P8, 8); //
1366 MAKE_PIN(P9, 9); //
1367 MAKE_PIN(P10, 10); //
1368 MAKE_PIN(P11, 11); //
1369 MAKE_PIN(P12, 12); //
1370 MAKE_PIN(P13, 13); //
1371 
1372 #undef MAKE_PIN
1373 
1374 #elif defined(ESP8266) || defined(ESP32)
1375 
1376 #define MAKE_PIN(className, pin) \
1377 class className { \
1378 public: \
1379  static void Set() { \
1380  digitalWrite(pin, HIGH);\
1381  } \
1382  static void Clear() { \
1383  digitalWrite(pin, LOW); \
1384  } \
1385  static void SetDirRead() { \
1386  pinMode(pin, INPUT); \
1387  } \
1388  static void SetDirWrite() { \
1389  pinMode(pin, OUTPUT); \
1390  } \
1391  static uint8_t IsSet() { \
1392  return digitalRead(pin); \
1393  } \
1394 };
1395 
1396 #if defined(ESP8266)
1397 
1398 // Pinout for ESP-12 module
1399 // 0 .. 16 - Digital pins
1400 // GPIO 6 to 11 and 16 are not usable in this library.
1401 
1402 MAKE_PIN(P0, 0);
1403 MAKE_PIN(P1, 1); // TX0
1404 MAKE_PIN(P2, 2); // TX1
1405 MAKE_PIN(P3, 3); // RX0
1406 MAKE_PIN(P4, 4); // SDA
1407 MAKE_PIN(P5, 5); // SCL
1408 MAKE_PIN(P12, 12); // MISO
1409 MAKE_PIN(P13, 13); // MOSI
1410 MAKE_PIN(P14, 14); // SCK
1411 MAKE_PIN(P15, 15); // SS
1412 
1413 #elif defined(ESP32)
1414 
1415 // Workaround strict-aliasing warnings
1416 #ifdef pgm_read_word
1417 #undef pgm_read_word
1418 #endif
1419 #ifdef pgm_read_dword
1420 #undef pgm_read_dword
1421 #endif
1422 #ifdef pgm_read_float
1423 #undef pgm_read_float
1424 #endif
1425 #ifdef pgm_read_ptr
1426 #undef pgm_read_ptr
1427 #endif
1428 
1429 #define pgm_read_word(addr) ({ \
1430  typeof(addr) _addr = (addr); \
1431  *(const unsigned short *)(_addr); \
1432 })
1433 #define pgm_read_dword(addr) ({ \
1434  typeof(addr) _addr = (addr); \
1435  *(const unsigned long *)(_addr); \
1436 })
1437 #define pgm_read_float(addr) ({ \
1438  typeof(addr) _addr = (addr); \
1439  *(const float *)(_addr); \
1440 })
1441 #define pgm_read_ptr(addr) ({ \
1442  typeof(addr) _addr = (addr); \
1443  *(void * const *)(_addr); \
1444 })
1445 
1446 // Pinout for ESP32 dev module
1447 
1448 MAKE_PIN(P0, 0);
1449 MAKE_PIN(P1, 1); // TX0
1450 MAKE_PIN(P10, 10); // TX1
1451 MAKE_PIN(P3, 3); // RX0
1452 MAKE_PIN(P21, 21); // SDA
1453 MAKE_PIN(P22, 22); // SCL
1454 MAKE_PIN(P19, 19); // MISO
1455 MAKE_PIN(P23, 23); // MOSI
1456 MAKE_PIN(P18, 18); // SCK
1457 MAKE_PIN(P5, 5); // SS
1458 MAKE_PIN(P17, 17); // INT
1459 
1460 #endif
1461 
1462 #undef MAKE_PIN
1463 
1464 // pgm_read_ptr is not defined in the ESP32, so we have to undef the diffinition from version_helper.h
1465 #ifdef pgm_read_pointer
1466 #undef pgm_read_pointer
1467 #endif
1468 #define pgm_read_pointer(p) pgm_read_ptr(p)
1469 
1470 #else
1471 #error "Please define board in avrpins.h"
1472 
1473 #endif
1474 
1475 #endif //_avrpins_h_
diff --git a/cdc___x_r21_b1411_8cpp.html b/cdc___x_r21_b1411_8cpp.html index 459dd375..b05adf25 100644 --- a/cdc___x_r21_b1411_8cpp.html +++ b/cdc___x_r21_b1411_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdc_XR21B1411.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
diff --git a/cdc___x_r21_b1411_8cpp__incl.md5 b/cdc___x_r21_b1411_8cpp__incl.md5 index 488365a4..96940093 100644 --- a/cdc___x_r21_b1411_8cpp__incl.md5 +++ b/cdc___x_r21_b1411_8cpp__incl.md5 @@ -1 +1 @@ -94c1f3e832d30d1e0699ba30de20f4fa \ No newline at end of file +91e9029051e41cc4e0144ef4cbbca25d \ No newline at end of file diff --git a/cdc___x_r21_b1411_8cpp__incl.png b/cdc___x_r21_b1411_8cpp__incl.png index fb15fdd7..9b16c978 100644 Binary files a/cdc___x_r21_b1411_8cpp__incl.png and b/cdc___x_r21_b1411_8cpp__incl.png differ diff --git a/cdc___x_r21_b1411_8cpp_source.html b/cdc___x_r21_b1411_8cpp_source.html index 9030df02..df7fb151 100644 --- a/cdc___x_r21_b1411_8cpp_source.html +++ b/cdc___x_r21_b1411_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdc_XR21B1411.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
cdc_XR21B1411.cpp
-Go to the documentation of this file.
1 /* Copyright (C) 2015 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 #include "cdc_XR21B1411.h"
18 
20 ACM(p, pasync) {
21  // Is this needed??
22  _enhanced_status = enhanced_features(); // Set up features
23 }
24 
25 uint8_t XR21B1411::Init(uint8_t parent, uint8_t port, bool lowspeed) {
26  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
27 
28  uint8_t buf[constBufSize];
29  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
30 
31  uint8_t rcode;
32  UsbDevice *p = NULL;
33  EpInfo *oldep_ptr = NULL;
34  uint8_t num_of_conf; // number of configurations
35 
36  AddressPool &addrPool = pUsb->GetAddressPool();
37 
38  USBTRACE("XR Init\r\n");
39 
40  if(bAddress)
42 
43  // Get pointer to pseudo device with address 0 assigned
44  p = addrPool.GetUsbDevicePtr(0);
45 
46  if(!p)
48 
49  if(!p->epinfo) {
50  USBTRACE("epinfo\r\n");
52  }
53 
54  // Save old pointer to EP_RECORD of address 0
55  oldep_ptr = p->epinfo;
56 
57  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
58  p->epinfo = epInfo;
59 
60  p->lowspeed = lowspeed;
61 
62  // Get device descriptor
63  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf);
64 
65  // Restore p->epinfo
66  p->epinfo = oldep_ptr;
67 
68  if(rcode)
69  goto FailGetDevDescr;
70 
71  // Allocate new address according to device class
72  bAddress = addrPool.AllocAddress(parent, false, port);
73 
74  if(!bAddress)
76 
77  // Extract Max Packet Size from the device descriptor
79 
80  // Assign new address to the device
81  rcode = pUsb->setAddr(0, 0, bAddress);
82 
83  if(rcode) {
84  p->lowspeed = false;
85  addrPool.FreeAddress(bAddress);
86  bAddress = 0;
87  USBTRACE2("setAddr:", rcode);
88  return rcode;
89  }
90 
91  USBTRACE2("Addr:", bAddress);
92 
93  p->lowspeed = false;
94 
95  p = addrPool.GetUsbDevicePtr(bAddress);
96 
97  if(!p)
99 
100  p->lowspeed = lowspeed;
101 
102  num_of_conf = udd->bNumConfigurations;
103 
104  if((((udd->idVendor != 0x2890U) || (udd->idProduct != 0x0201U)) && ((udd->idVendor != 0x04e2U) || (udd->idProduct != 0x1411U))))
106 
107  // Assign epInfo to epinfo pointer
108  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
109 
110  if(rcode)
111  goto FailSetDevTblEntry;
112 
113  USBTRACE2("NC:", num_of_conf);
114 
115  for(uint8_t i = 0; i < num_of_conf; i++) {
121  CP_MASK_COMPARE_PROTOCOL > CdcControlParser(this);
122 
124  CP_MASK_COMPARE_CLASS> CdcDataParser(this);
125 
126  rcode = pUsb->getConfDescr(bAddress, 0, i, &CdcControlParser);
127 
128  if(rcode)
129  goto FailGetConfDescr;
130 
131  rcode = pUsb->getConfDescr(bAddress, 0, i, &CdcDataParser);
132 
133  if(rcode)
134  goto FailGetConfDescr;
135 
136  if(bNumEP > 1)
137  break;
138  } // for
139 
140  if(bNumEP < 4)
142 
143  // Assign epInfo to epinfo pointer
145 
146  USBTRACE2("Conf:", bConfNum);
147 
148  // Set Configuration Value
149  rcode = pUsb->setConf(bAddress, 0, bConfNum);
150 
151  if(rcode)
152  goto FailSetConfDescr;
153 
154  // Set up features status
156  half_duplex(false);
157  autoflowRTS(false);
158  autoflowDSR(false);
159  autoflowXON(false);
160  wide(false); // Always false, because this is only available in custom mode.
161 
162  rcode = pAsync->OnInit(this);
163 
164  if(rcode)
165  goto FailOnInit;
166 
167  USBTRACE("XR configured\r\n");
168 
169  ready = true;
170 
171  //bPollEnable = true;
172 
173  //USBTRACE("Poll enabled\r\n");
174  return 0;
175 
176 FailGetDevDescr:
177 #ifdef DEBUG_USB_HOST
179  goto Fail;
180 #endif
181 
182 FailSetDevTblEntry:
183 #ifdef DEBUG_USB_HOST
185  goto Fail;
186 #endif
187 
188 FailGetConfDescr:
189 #ifdef DEBUG_USB_HOST
191  goto Fail;
192 #endif
193 
194 FailSetConfDescr:
195 #ifdef DEBUG_USB_HOST
197  goto Fail;
198 #endif
199 
200 FailOnInit:
201 #ifdef DEBUG_USB_HOST
202  USBTRACE("OnInit:");
203 #endif
204 
205 #ifdef DEBUG_USB_HOST
206 Fail:
207  NotifyFail(rcode);
208 #endif
209  Release();
210  return rcode;
211 }
#define USB_CLASS_COM_AND_CDC_CTRL
Definition: UsbCore.h:58
-
#define USB_CLASS_CDC_DATA
Definition: UsbCore.h:65
-
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
- +Go to the documentation of this file.
1 /* Copyright (C) 2015 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 #include "cdc_XR21B1411.h"
18 
20 ACM(p, pasync) {
21  // Is this needed??
22  _enhanced_status = enhanced_features(); // Set up features
23 }
24 
25 uint8_t XR21B1411::Init(uint8_t parent, uint8_t port, bool lowspeed) {
26  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
27 
28  uint8_t buf[constBufSize];
29  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
30 
31  uint8_t rcode;
32  UsbDevice *p = NULL;
33  EpInfo *oldep_ptr = NULL;
34  uint8_t num_of_conf; // number of configurations
35 
36  AddressPool &addrPool = pUsb->GetAddressPool();
37 
38  USBTRACE("XR Init\r\n");
39 
40  if(bAddress)
42 
43  // Get pointer to pseudo device with address 0 assigned
44  p = addrPool.GetUsbDevicePtr(0);
45 
46  if(!p)
48 
49  if(!p->epinfo) {
50  USBTRACE("epinfo\r\n");
52  }
53 
54  // Save old pointer to EP_RECORD of address 0
55  oldep_ptr = p->epinfo;
56 
57  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
58  p->epinfo = epInfo;
59 
60  p->lowspeed = lowspeed;
61 
62  // Get device descriptor
63  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf);
64 
65  // Restore p->epinfo
66  p->epinfo = oldep_ptr;
67 
68  if(rcode)
69  goto FailGetDevDescr;
70 
71  // Allocate new address according to device class
72  bAddress = addrPool.AllocAddress(parent, false, port);
73 
74  if(!bAddress)
76 
77  // Extract Max Packet Size from the device descriptor
79 
80  // Assign new address to the device
81  rcode = pUsb->setAddr(0, 0, bAddress);
82 
83  if(rcode) {
84  p->lowspeed = false;
85  addrPool.FreeAddress(bAddress);
86  bAddress = 0;
87  USBTRACE2("setAddr:", rcode);
88  return rcode;
89  }
90 
91  USBTRACE2("Addr:", bAddress);
92 
93  p->lowspeed = false;
94 
95  p = addrPool.GetUsbDevicePtr(bAddress);
96 
97  if(!p)
99 
100  p->lowspeed = lowspeed;
101 
102  num_of_conf = udd->bNumConfigurations;
103 
104  if((((udd->idVendor != 0x2890U) || (udd->idProduct != 0x0201U)) && ((udd->idVendor != 0x04e2U) || (udd->idProduct != 0x1411U))))
106 
107  // Assign epInfo to epinfo pointer
108  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
109 
110  if(rcode)
111  goto FailSetDevTblEntry;
112 
113  USBTRACE2("NC:", num_of_conf);
114 
115  for(uint8_t i = 0; i < num_of_conf; i++) {
121  CP_MASK_COMPARE_PROTOCOL > CdcControlParser(this);
122 
124  CP_MASK_COMPARE_CLASS> CdcDataParser(this);
125 
126  rcode = pUsb->getConfDescr(bAddress, 0, i, &CdcControlParser);
127 
128  if(rcode)
129  goto FailGetConfDescr;
130 
131  rcode = pUsb->getConfDescr(bAddress, 0, i, &CdcDataParser);
132 
133  if(rcode)
134  goto FailGetConfDescr;
135 
136  if(bNumEP > 1)
137  break;
138  } // for
139 
140  if(bNumEP < 4)
142 
143  // Assign epInfo to epinfo pointer
145 
146  USBTRACE2("Conf:", bConfNum);
147 
148  // Set Configuration Value
149  rcode = pUsb->setConf(bAddress, 0, bConfNum);
150 
151  if(rcode)
152  goto FailSetConfDescr;
153 
154  // Set up features status
156  half_duplex(false);
157  autoflowRTS(false);
158  autoflowDSR(false);
159  autoflowXON(false);
160  wide(false); // Always false, because this is only available in custom mode.
161 
162  rcode = pAsync->OnInit(this);
163 
164  if(rcode)
165  goto FailOnInit;
166 
167  USBTRACE("XR configured\r\n");
168 
169  ready = true;
170 
171  //bPollEnable = true;
172 
173  //USBTRACE("Poll enabled\r\n");
174  return 0;
175 
176 FailGetDevDescr:
177 #ifdef DEBUG_USB_HOST
179  goto Fail;
180 #endif
181 
182 FailSetDevTblEntry:
183 #ifdef DEBUG_USB_HOST
185  goto Fail;
186 #endif
187 
188 FailGetConfDescr:
189 #ifdef DEBUG_USB_HOST
191  goto Fail;
192 #endif
193 
194 FailSetConfDescr:
195 #ifdef DEBUG_USB_HOST
197  goto Fail;
198 #endif
199 
200 FailOnInit:
201 #ifdef DEBUG_USB_HOST
202  USBTRACE("OnInit:");
203 #endif
204 
205 #ifdef DEBUG_USB_HOST
206 Fail:
207  NotifyFail(rcode);
208 #endif
209  Release();
210  return rcode;
211 }
#define USB_CLASS_COM_AND_CDC_CTRL
Definition: UsbCore.h:69
+
#define USB_CLASS_CDC_DATA
Definition: UsbCore.h:76
+
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+
#define CDC_SUBCLASS_ACM
Definition: cdcacm.h:27
#define CDC_PROTOCOL_ITU_T_V_250
Definition: cdcacm.h:40
-
EpInfo * epinfo
Definition: address.h:76
-
#define CP_MASK_COMPARE_PROTOCOL
+
EpInfo * epinfo
Definition: address.h:83
+
#define CP_MASK_COMPARE_PROTOCOL
virtual void autoflowRTS(bool s)
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
virtual uint8_t OnInit(ACM *pacm)
Definition: cdcacm.h:131
- - -
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:105
-
volatile bool ready
Definition: cdcacm.h:178
-
#define NotifyFail(...)
Definition: message.h:55
-
USB * pUsb
Definition: cdcacm.h:169
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
-
uint8_t bNumEP
Definition: cdcacm.h:175
-
EpInfo epInfo[ACM_MAX_ENDPOINTS]
Definition: cdcacm.h:181
+ + +
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:112
+
volatile bool ready
Definition: cdcacm.h:174
+
#define NotifyFail(...)
Definition: message.h:62
+
USB * pUsb
Definition: cdcacm.h:165
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
uint8_t bNumEP
Definition: cdcacm.h:171
+
EpInfo epInfo[ACM_MAX_ENDPOINTS]
Definition: cdcacm.h:183
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
-
#define CP_MASK_COMPARE_CLASS
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
+
#define CP_MASK_COMPARE_CLASS
virtual void FreeAddress(uint8_t addr)=0
virtual void half_duplex(bool s)
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
CDCAsyncOper * pAsync
Definition: cdcacm.h:170
+
CDCAsyncOper * pAsync
Definition: cdcacm.h:166
XR21B1411(USB *pusb, CDCAsyncOper *pasync)
- -
#define USBTRACE2(s, r)
Definition: macros.h:77
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
#define NotifyFailGetConfDescr(...)
Definition: message.h:52
-
virtual void wide(bool s)
Definition: cdcacm.h:245
+ +
#define USBTRACE2(s, r)
Definition: macros.h:84
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
#define NotifyFailGetConfDescr(...)
Definition: message.h:59
+
virtual void wide(bool s)
Definition: cdcacm.h:244
virtual void autoflowXON(bool s)
-
Definition: address.h:32
-
#define CP_MASK_COMPARE_SUBCLASS
+
Definition: address.h:39
+
#define CP_MASK_COMPARE_SUBCLASS
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bAddress
Definition: cdcacm.h:171
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
+
uint8_t bAddress
Definition: cdcacm.h:167
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
virtual tty_features enhanced_features(void)
virtual void autoflowDSR(bool s)
-
uint16_t idProduct
Definition: usb_ch9.h:107
-
uint8_t Release()
Definition: cdcacm.cpp:259
-
uint8_t bConfNum
Definition: cdcacm.h:172
-
uint8_t bNumConfigurations
Definition: usb_ch9.h:112
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
+
uint16_t idProduct
Definition: usb_ch9.h:114
+
uint8_t Release()
Definition: cdcacm.cpp:258
+
uint8_t bConfNum
Definition: cdcacm.h:168
+
uint8_t bNumConfigurations
Definition: usb_ch9.h:119
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
Definition: UsbCore.h:197
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
Definition: UsbCore.h:208
Definition: cdcacm.h:163
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
-
tty_features _enhanced_status
Definition: cdcacm.h:179
-
#define USBTRACE(s)
Definition: macros.h:75
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
- +
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
+
tty_features _enhanced_status
Definition: cdcacm.h:175
+
#define USBTRACE(s)
Definition: macros.h:82
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
diff --git a/cdc___x_r21_b1411_8h.html b/cdc___x_r21_b1411_8h.html index 428f0f6a..1fc8e3e7 100644 --- a/cdc___x_r21_b1411_8h.html +++ b/cdc___x_r21_b1411_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdc_XR21B1411.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
  #define XR_REG_ERROR_STATUS_MASK   (0x00F8U)   -#define XR_REG_ERROR_STATUS_ERROR   (0x0078U) +#define XR_REG_ERROR_STATUS_ERROR   (0x0070U)   #define XR_REG_ERROR_STATUS_BREAK   (0x0008U)   -#define XR_REG_ERROR_STATUS_FRAME   (0x0010U) -  +#define XR_REG_ERROR_STATUS_OVERRUN   (0x0010U) +  #define XR_REG_ERROR_STATUS_PARITY   (0x0020U)   -#define XR_REG_ERROR_STATUS_OVERRUN   (0x0040U) -  -#define XR_REG_ERROR_STATUS_BREAK_STATUS   (0x0080U) -  +#define XR_REG_ERROR_STATUS_FRAME   (0x0040U) +  +#define XR_REG_ERROR_STATUS_BREAKING   (0x0080U) +  #define XR_REG_TX_BREAK   (0x0C0AU)   #define XR_REG_XCVR_EN_DELAY   (0x0C0BU) @@ -235,7 +215,9 @@ Macros  

Macro Definition Documentation

- + +

◆ XR_REG_CUSTOM_DRIVER

+
@@ -245,11 +227,13 @@ Macros
-

Definition at line 24 of file cdc_XR21B1411.h.

+

Definition at line 24 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_CUSTOM_DRIVER_ACTIVE

+
@@ -259,11 +243,13 @@ Macros
-

Definition at line 25 of file cdc_XR21B1411.h.

+

Definition at line 25 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ACM_FLOW_CTL

+
@@ -273,11 +259,13 @@ Macros
-

Definition at line 27 of file cdc_XR21B1411.h.

+

Definition at line 27 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_FLOW_CTL

+
@@ -287,11 +275,13 @@ Macros
-

Definition at line 28 of file cdc_XR21B1411.h.

+

Definition at line 28 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_FLOW_CTL_HALF_DPLX

+
@@ -301,11 +291,13 @@ Macros
-

Definition at line 29 of file cdc_XR21B1411.h.

+

Definition at line 29 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_FLOW_CTL_MODE_MASK

+
@@ -315,11 +307,13 @@ Macros
-

Definition at line 30 of file cdc_XR21B1411.h.

+

Definition at line 30 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_FLOW_CTL_NONE

+
@@ -329,11 +323,13 @@ Macros
-

Definition at line 31 of file cdc_XR21B1411.h.

+

Definition at line 31 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_FLOW_CTL_HW

+
@@ -343,11 +339,13 @@ Macros
-

Definition at line 32 of file cdc_XR21B1411.h.

+

Definition at line 32 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_FLOW_CTL_SW

+
@@ -357,11 +355,13 @@ Macros
-

Definition at line 33 of file cdc_XR21B1411.h.

+

Definition at line 33 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_FLOW_CTL_MMMRX

+
@@ -371,11 +371,13 @@ Macros
-

Definition at line 34 of file cdc_XR21B1411.h.

+

Definition at line 34 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_FLOW_CTL_MMMRXTX

+
@@ -385,11 +387,13 @@ Macros
-

Definition at line 35 of file cdc_XR21B1411.h.

+

Definition at line 35 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ACM_GPIO_MODE

+
@@ -399,11 +403,13 @@ Macros
-

Definition at line 37 of file cdc_XR21B1411.h.

+

Definition at line 37 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_MODE

+
@@ -413,11 +419,13 @@ Macros
-

Definition at line 38 of file cdc_XR21B1411.h.

+

Definition at line 38 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_MODE_GPIO

+
@@ -427,11 +435,13 @@ Macros
-

Definition at line 39 of file cdc_XR21B1411.h.

+

Definition at line 39 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_MODE_FC_RTSCTS

+
@@ -441,11 +451,13 @@ Macros
-

Definition at line 40 of file cdc_XR21B1411.h.

+

Definition at line 40 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_MODE_FC_DTRDSR

+
@@ -455,11 +467,13 @@ Macros
-

Definition at line 41 of file cdc_XR21B1411.h.

+

Definition at line 41 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_MODE_ATE

+
@@ -469,11 +483,13 @@ Macros
-

Definition at line 42 of file cdc_XR21B1411.h.

+

Definition at line 42 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_MODE_ATE_ADDRESS

+
@@ -483,11 +499,13 @@ Macros
-

Definition at line 43 of file cdc_XR21B1411.h.

+

Definition at line 43 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ACM_GPIO_DIR

+
@@ -497,11 +515,13 @@ Macros
-

Definition at line 45 of file cdc_XR21B1411.h.

+

Definition at line 45 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_DIR

+
@@ -511,11 +531,13 @@ Macros
-

Definition at line 46 of file cdc_XR21B1411.h.

+

Definition at line 46 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ACM_GPIO_INT

+
@@ -525,11 +547,13 @@ Macros
-

Definition at line 48 of file cdc_XR21B1411.h.

+

Definition at line 48 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_INT

+
@@ -539,11 +563,13 @@ Macros
-

Definition at line 49 of file cdc_XR21B1411.h.

+

Definition at line 49 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_MASK

+
@@ -553,11 +579,13 @@ Macros
-

Definition at line 50 of file cdc_XR21B1411.h.

+

Definition at line 50 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_UART_ENABLE

+
@@ -567,11 +595,13 @@ Macros
-

Definition at line 52 of file cdc_XR21B1411.h.

+

Definition at line 52 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_UART_ENABLE_RX

+
@@ -581,11 +611,13 @@ Macros
-

Definition at line 53 of file cdc_XR21B1411.h.

+

Definition at line 53 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_UART_ENABLE_TX

+
@@ -595,11 +627,13 @@ Macros
-

Definition at line 54 of file cdc_XR21B1411.h.

+

Definition at line 54 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ERROR_STATUS

+
@@ -609,11 +643,13 @@ Macros
-

Definition at line 56 of file cdc_XR21B1411.h.

+

Definition at line 56 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ERROR_STATUS_MASK

+
@@ -623,25 +659,29 @@ Macros
-

Definition at line 57 of file cdc_XR21B1411.h.

+

Definition at line 57 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ERROR_STATUS_ERROR

+
- +
#define XR_REG_ERROR_STATUS_ERROR   (0x0078U)#define XR_REG_ERROR_STATUS_ERROR   (0x0070U)
-

Definition at line 58 of file cdc_XR21B1411.h.

+

Definition at line 58 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ERROR_STATUS_BREAK

+
@@ -651,25 +691,29 @@ Macros
-

Definition at line 59 of file cdc_XR21B1411.h.

+

Definition at line 59 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ERROR_STATUS_OVERRUN

+
- +
#define XR_REG_ERROR_STATUS_FRAME   (0x0010U)#define XR_REG_ERROR_STATUS_OVERRUN   (0x0010U)
-

Definition at line 60 of file cdc_XR21B1411.h.

+

Definition at line 60 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ERROR_STATUS_PARITY

+
@@ -679,39 +723,45 @@ Macros
-

Definition at line 61 of file cdc_XR21B1411.h.

+

Definition at line 61 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ERROR_STATUS_FRAME

+
- +
#define XR_REG_ERROR_STATUS_OVERRUN   (0x0040U)#define XR_REG_ERROR_STATUS_FRAME   (0x0040U)
-

Definition at line 62 of file cdc_XR21B1411.h.

+

Definition at line 62 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_ERROR_STATUS_BREAKING

+
- +
#define XR_REG_ERROR_STATUS_BREAK_STATUS   (0x0080U)#define XR_REG_ERROR_STATUS_BREAKING   (0x0080U)
-

Definition at line 63 of file cdc_XR21B1411.h.

+

Definition at line 63 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_TX_BREAK

+
@@ -721,11 +771,13 @@ Macros
-

Definition at line 65 of file cdc_XR21B1411.h.

+

Definition at line 65 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_XCVR_EN_DELAY

+
@@ -735,11 +787,13 @@ Macros
-

Definition at line 67 of file cdc_XR21B1411.h.

+

Definition at line 67 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_SET

+
@@ -749,11 +803,13 @@ Macros
-

Definition at line 69 of file cdc_XR21B1411.h.

+

Definition at line 69 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_CLR

+
@@ -763,11 +819,13 @@ Macros
-

Definition at line 71 of file cdc_XR21B1411.h.

+

Definition at line 71 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_GPIO_STATUS

+
@@ -777,11 +835,13 @@ Macros
-

Definition at line 73 of file cdc_XR21B1411.h.

+

Definition at line 73 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_CUSTOMISED_INT

+
@@ -791,11 +851,13 @@ Macros
-

Definition at line 75 of file cdc_XR21B1411.h.

+

Definition at line 75 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_PIN_PULLUP_ENABLE

+
@@ -805,11 +867,13 @@ Macros
-

Definition at line 77 of file cdc_XR21B1411.h.

+

Definition at line 77 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_PIN_PULLDOWN_ENABLE

+
@@ -819,11 +883,13 @@ Macros
-

Definition at line 79 of file cdc_XR21B1411.h.

+

Definition at line 79 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_LOOPBACK

+
@@ -833,11 +899,13 @@ Macros
-

Definition at line 81 of file cdc_XR21B1411.h.

+

Definition at line 81 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_RX_FIFO_LATENCY

+
@@ -847,11 +915,13 @@ Macros
-

Definition at line 83 of file cdc_XR21B1411.h.

+

Definition at line 83 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_RX_FIFO_LATENCY_ENABLE

+
@@ -861,11 +931,13 @@ Macros
-

Definition at line 84 of file cdc_XR21B1411.h.

+

Definition at line 84 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_WIDE_MODE

+
@@ -875,11 +947,13 @@ Macros
-

Definition at line 86 of file cdc_XR21B1411.h.

+

Definition at line 86 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_WIDE_MODE_ENABLE

+
@@ -889,11 +963,13 @@ Macros
-

Definition at line 87 of file cdc_XR21B1411.h.

+

Definition at line 87 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_XON_CHAR

+
@@ -903,11 +979,13 @@ Macros
-

Definition at line 89 of file cdc_XR21B1411.h.

+

Definition at line 89 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_XOFF_CHAR

+
@@ -917,11 +995,13 @@ Macros
-

Definition at line 90 of file cdc_XR21B1411.h.

+

Definition at line 90 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_TX_FIFO_RESET

+
@@ -931,11 +1011,13 @@ Macros
-

Definition at line 92 of file cdc_XR21B1411.h.

+

Definition at line 92 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_TX_FIFO_COUNT

+
@@ -945,11 +1027,13 @@ Macros
-

Definition at line 93 of file cdc_XR21B1411.h.

+

Definition at line 93 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_RX_FIFO_RESET

+
@@ -959,11 +1043,13 @@ Macros
-

Definition at line 94 of file cdc_XR21B1411.h.

+

Definition at line 94 of file cdc_XR21B1411.h.

- + +

◆ XR_REG_RX_FIFO_COUNT

+
@@ -973,11 +1059,13 @@ Macros
-

Definition at line 95 of file cdc_XR21B1411.h.

+

Definition at line 95 of file cdc_XR21B1411.h.

- + +

◆ XR_WRITE_REQUEST_TYPE

+
@@ -987,11 +1075,13 @@ Macros
-

Definition at line 97 of file cdc_XR21B1411.h.

+

Definition at line 97 of file cdc_XR21B1411.h.

- + +

◆ XR_READ_REQUEST_TYPE

+
@@ -1001,11 +1091,13 @@ Macros
-

Definition at line 99 of file cdc_XR21B1411.h.

+

Definition at line 99 of file cdc_XR21B1411.h.

- + +

◆ XR_MAX_ENDPOINTS

+
@@ -1015,7 +1107,7 @@ Macros
-

Definition at line 101 of file cdc_XR21B1411.h.

+

Definition at line 101 of file cdc_XR21B1411.h.

@@ -1024,7 +1116,7 @@ Macros diff --git a/cdc___x_r21_b1411_8h__dep__incl.md5 b/cdc___x_r21_b1411_8h__dep__incl.md5 index d1f48836..ccb81d4b 100644 --- a/cdc___x_r21_b1411_8h__dep__incl.md5 +++ b/cdc___x_r21_b1411_8h__dep__incl.md5 @@ -1 +1 @@ -250b78e5b50dfc5c4569c99531678ec3 \ No newline at end of file +e53d5ac5df7beb8def48e46bf452afe4 \ No newline at end of file diff --git a/cdc___x_r21_b1411_8h__dep__incl.png b/cdc___x_r21_b1411_8h__dep__incl.png index f110787f..0b1a46b7 100644 Binary files a/cdc___x_r21_b1411_8h__dep__incl.png and b/cdc___x_r21_b1411_8h__dep__incl.png differ diff --git a/cdc___x_r21_b1411_8h__incl.md5 b/cdc___x_r21_b1411_8h__incl.md5 index 8ab25f05..833d38dd 100644 --- a/cdc___x_r21_b1411_8h__incl.md5 +++ b/cdc___x_r21_b1411_8h__incl.md5 @@ -1 +1 @@ -ab5d3dff2680fe378e5afcfe3049b74b \ No newline at end of file +81ae8245618e642787cd8f06ec2914c8 \ No newline at end of file diff --git a/cdc___x_r21_b1411_8h__incl.png b/cdc___x_r21_b1411_8h__incl.png index 0d676005..d29f5958 100644 Binary files a/cdc___x_r21_b1411_8h__incl.png and b/cdc___x_r21_b1411_8h__incl.png differ diff --git a/cdc___x_r21_b1411_8h_source.html b/cdc___x_r21_b1411_8h_source.html index f4bbb5fe..44e05b21 100644 --- a/cdc___x_r21_b1411_8h_source.html +++ b/cdc___x_r21_b1411_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdc_XR21B1411.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
cdc_XR21B1411.h
-Go to the documentation of this file.
1 /* Copyright (C) 2015 Andrew J. Kroll
2  and
3  Circuits At Home, LTD. All rights reserved.
4 
5 This software may be distributed and modified under the terms of the GNU
6 General Public License version 2 (GPL2) as published by the Free Software
7 Foundation and appearing in the file GPL2.TXT included in the packaging of
8 this file. Please note that GPL2 Section 2[b] requires that all works based
9 on this software must also be made publicly available under the terms of
10 the GPL2 ("Copyleft").
11 
12 Contact information
13 -------------------
14 
15 Circuits At Home, LTD
16 Web : http://www.circuitsathome.com
17 e-mail : support@circuitsathome.com
18  */
19 #if !defined(__CDC_XR21B1411_H__)
20 #define __CDC_XR21B1411_H__
21 
22 #include "cdcacm.h"
23 
24 #define XR_REG_CUSTOM_DRIVER (0x020DU) // DRIVER SELECT
25 #define XR_REG_CUSTOM_DRIVER_ACTIVE (0x0001U) // 0: CDC 1: CUSTOM
26 
27 #define XR_REG_ACM_FLOW_CTL (0x0216U) // FLOW CONTROL REGISTER CDCACM MODE
28 #define XR_REG_FLOW_CTL (0x0C06U) // FLOW CONTROL REGISTER CUSTOM MODE
29 #define XR_REG_FLOW_CTL_HALF_DPLX (0x0008U) // 0:FULL DUPLEX 1:HALF DUPLEX
30 #define XR_REG_FLOW_CTL_MODE_MASK (0x0007U) // MODE BITMASK
31 #define XR_REG_FLOW_CTL_NONE (0x0000U) // NO FLOW CONTROL
32 #define XR_REG_FLOW_CTL_HW (0x0001U) // HARDWARE FLOW CONTROL
33 #define XR_REG_FLOW_CTL_SW (0x0002U) // SOFTWARE FLOW CONTROL
34 #define XR_REG_FLOW_CTL_MMMRX (0x0003U) // MULTIDROP RX UPON ADDRESS MATCH
35 #define XR_REG_FLOW_CTL_MMMRXTX (0x0004U) // MULTIDROP RX/TX UPON ADDRESS MATCH
36 
37 #define XR_REG_ACM_GPIO_MODE (0x0217U) // GPIO MODE REGISTER IN CDCACM MODE
38 #define XR_REG_GPIO_MODE (0x0C0CU) // GPIO MODE REGISTER IN CUSTOM MODE
39 #define XR_REG_GPIO_MODE_GPIO (0x0000U) // ALL GPIO PINS ACM PROGRAMMABLE
40 #define XR_REG_GPIO_MODE_FC_RTSCTS (0x0001U) // AUTO RTSCTS HW FC (GPIO 4/5)
41 #define XR_REG_GPIO_MODE_FC_DTRDSR (0x0002U) // AUTO DTRDSR HW FC (GPIO 2/3)
42 #define XR_REG_GPIO_MODE_ATE (0x0003U) // AUTO TRANSCEIVER ENABLE DURING TX (GPIO 5)
43 #define XR_REG_GPIO_MODE_ATE_ADDRESS (0x0004U) // AUTO TRANSCEIVER ENABLE ON ADDRESS MATCH (GPIO 5)
44 
45 #define XR_REG_ACM_GPIO_DIR (0x0218U) // GPIO DIRECTION REGISTER CDCACM MODE, 0:IN 1:OUT
46 #define XR_REG_GPIO_DIR (0x0C0DU) // GPIO DIRECTION REGISTER CUSTOM MODE, 0:IN 1:OUT
47 
48 #define XR_REG_ACM_GPIO_INT (0x0219U) // GPIO PIN CHANGE INTERRUPT ENABLE CDCACM MODE, 0: ENABLED 1: DISABLED
49 #define XR_REG_GPIO_INT (0x0C11U) // GPIO PIN CHANGE INTERRUPT ENABLE CUSTOM MODE, 0: ENABLED 1: DISABLED
50 #define XR_REG_GPIO_MASK (0x001FU) // GPIO REGISTERS BITMASK
51 
52 #define XR_REG_UART_ENABLE (0x0C00U) // UART I/O ENABLE REGISTER
53 #define XR_REG_UART_ENABLE_RX (0x0002U) // 0:DISABLED 1:ENABLED
54 #define XR_REG_UART_ENABLE_TX (0x0001U) // 0:DISABLED 1:ENABLED
55 
56 #define XR_REG_ERROR_STATUS (0x0C09U) // ERROR STATUS REGISTER
57 #define XR_REG_ERROR_STATUS_MASK (0x00F8U) // ERROR STATUS BITMASK
58 #define XR_REG_ERROR_STATUS_ERROR (0x0078U) // ERROR STATUS ERROR BITMASK
59 #define XR_REG_ERROR_STATUS_BREAK (0x0008U) // BREAK ERROR HAS BEEN DETECTED
60 #define XR_REG_ERROR_STATUS_FRAME (0x0010U) // FRAMING ERROR HAS BEEN DETECTED
61 #define XR_REG_ERROR_STATUS_PARITY (0x0020U) // PARITY ERROR HAS BEEN DETECTED
62 #define XR_REG_ERROR_STATUS_OVERRUN (0x0040U) // RX OVERRUN ERROR HAS BEEN DETECTED
63 #define XR_REG_ERROR_STATUS_BREAK_STATUS (0x0080U) // BREAK CONDITION IS CURRENTLY BEING DETECTED
64 
65 #define XR_REG_TX_BREAK (0x0C0AU) // TRANSMIT BREAK. 0X0001-0XFFE TIME IN MS, 0X0000 STOP, 0X0FFF BREAK ON
66 
67 #define XR_REG_XCVR_EN_DELAY (0x0C0BU) // TURN-ARROUND DELAY IN BIT-TIMES 0X0000-0X000F
68 
69 #define XR_REG_GPIO_SET (0x0C0EU) // 1:SET GPIO PIN
70 
71 #define XR_REG_GPIO_CLR (0x0C0FU) // 1:CLEAR GPIO PIN
72 
73 #define XR_REG_GPIO_STATUS (0x0C10U) // READ GPIO PINS
74 
75 #define XR_REG_CUSTOMISED_INT (0x0C12U) // 0:STANDARD 1:CUSTOM SEE DATA SHEET
76 
77 #define XR_REG_PIN_PULLUP_ENABLE (0x0C14U) // 0:DISABLE 1:ENABLE, BITS 0-5:GPIO, 6:RX 7:TX
78 
79 #define XR_REG_PIN_PULLDOWN_ENABLE (0x0C15U) // 0:DISABLE 1:ENABLE, BITS 0-5:GPIO, 6:RX 7:TX
80 
81 #define XR_REG_LOOPBACK (0x0C16U) // 0:DISABLE 1:ENABLE, SEE DATA SHEET
82 
83 #define XR_REG_RX_FIFO_LATENCY (0x0CC2U) // FIFO LATENCY REGISTER
84 #define XR_REG_RX_FIFO_LATENCY_ENABLE (0x0001U) //
85 
86 #define XR_REG_WIDE_MODE (0x0D02U)
87 #define XR_REG_WIDE_MODE_ENABLE (0x0001U)
88 
89 #define XR_REG_XON_CHAR (0x0C07U)
90 #define XR_REG_XOFF_CHAR (0x0C08U)
91 
92 #define XR_REG_TX_FIFO_RESET (0x0C80U) // 1: RESET, SELF-CLEARING
93 #define XR_REG_TX_FIFO_COUNT (0x0C81U) // READ-ONLY
94 #define XR_REG_RX_FIFO_RESET (0x0CC0U) // 1: RESET, SELF-CLEARING
95 #define XR_REG_RX_FIFO_COUNT (0x0CC1U) // READ-ONLY
96 
97 #define XR_WRITE_REQUEST_TYPE (0x40U)
98 
99 #define XR_READ_REQUEST_TYPE (0xC0U)
100 
101 #define XR_MAX_ENDPOINTS 4
102 
103 class XR21B1411 : public ACM {
104 protected:
105 
106 public:
107  XR21B1411(USB *pusb, CDCAsyncOper *pasync);
108 
115  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
116  return (((vid == 0x2890U) && (pid == 0x0201U)) || ((vid == 0x04e2U) && (pid == 0x1411U)));
117  };
118 
119  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
120 
122  tty_features rv;
123  rv.enhanced = true;
124  rv.autoflow_RTS = true;
125  rv.autoflow_DSR = true;
126  rv.autoflow_XON = true;
127  rv.half_duplex = true;
128  rv.wide = true;
129  return rv;
130  };
131 
132  uint8_t read_register(uint16_t reg, uint16_t *val) {
133  return (pUsb->ctrlReq(bAddress, 0, XR_READ_REQUEST_TYPE, 1, 0, 0, reg, 2, 2, (uint8_t *)val, NULL));
134  }
135 
136  uint8_t write_register(uint16_t reg, uint16_t val) {
137  return (pUsb->ctrlReq(bAddress, 0, XR_WRITE_REQUEST_TYPE, 0, BGRAB0(val), BGRAB1(val), reg, 0, 0, NULL, NULL));
138  }
139 
140 
142  // The following methods set the CDC-ACM defaults.
144 
145  virtual void autoflowRTS(bool s) {
146  uint16_t val;
147  uint8_t rval;
148  rval = read_register(XR_REG_ACM_FLOW_CTL, &val);
149  if(!rval) {
150  if(s) {
152  val |= XR_REG_FLOW_CTL_HW;
153  } else {
155  }
156  rval = write_register(XR_REG_ACM_FLOW_CTL, val);
157  if(!rval) {
159  if(!rval) {
160  // ACM commands apply the new settings.
161  LINE_CODING LCT;
162  rval = GetLineCoding(&LCT);
163  if(!rval) {
164  rval = SetLineCoding(&LCT);
165  if(!rval) {
169  }
170  }
171  }
172  }
173  }
174  };
175 
176  virtual void autoflowDSR(bool s) {
177  uint16_t val;
178  uint8_t rval;
179  rval = read_register(XR_REG_ACM_FLOW_CTL, &val);
180  if(!rval) {
181  if(s) {
183  val |= XR_REG_FLOW_CTL_HW;
184  } else {
186  }
187  rval = write_register(XR_REG_ACM_FLOW_CTL, val);
188  if(!rval) {
189  if(s) {
191  } else {
193  }
194  if(!rval) {
195  // ACM commands apply the new settings.
196  LINE_CODING LCT;
197  rval = GetLineCoding(&LCT);
198  if(!rval) {
199  rval = SetLineCoding(&LCT);
200  if(!rval) {
204  }
205  }
206  }
207  }
208  }
209  };
210 
211  virtual void autoflowXON(bool s) {
212  // NOTE: hardware defaults to the normal XON/XOFF
213  uint16_t val;
214  uint8_t rval;
215  rval = read_register(XR_REG_ACM_FLOW_CTL, &val);
216  if(!rval) {
217  if(s) {
219  val |= XR_REG_FLOW_CTL_SW;
220  } else {
222  }
223  rval = write_register(XR_REG_ACM_FLOW_CTL, val);
224  if(!rval) {
226  if(!rval) {
227  // ACM commands apply the new settings.
228  LINE_CODING LCT;
229  rval = GetLineCoding(&LCT);
230  if(!rval) {
231  rval = SetLineCoding(&LCT);
232  if(!rval) {
236  }
237  }
238  }
239  }
240  }
241  };
242 
243  virtual void half_duplex(bool s) {
244  uint16_t val;
245  uint8_t rval;
246  rval = read_register(XR_REG_ACM_FLOW_CTL, &val);
247  if(!rval) {
248  if(s) {
250  } else {
252  }
253  rval = write_register(XR_REG_ACM_FLOW_CTL, val);
254  if(!rval) {
255  // ACM commands apply the new settings.
256  LINE_CODING LCT;
257  rval = GetLineCoding(&LCT);
258  if(!rval) {
259  rval = SetLineCoding(&LCT);
260  if(!rval) {
262  }
263  }
264  }
265  }
266  };
267 
268 
269 
270 };
271 
272 #endif // __CDCPROLIFIC_H__
virtual void autoflowRTS(bool s)
+Go to the documentation of this file.
1 /* Copyright (C) 2015 Andrew J. Kroll
2  and
3  Circuits At Home, LTD. All rights reserved.
4 
5 This software may be distributed and modified under the terms of the GNU
6 General Public License version 2 (GPL2) as published by the Free Software
7 Foundation and appearing in the file GPL2.TXT included in the packaging of
8 this file. Please note that GPL2 Section 2[b] requires that all works based
9 on this software must also be made publicly available under the terms of
10 the GPL2 ("Copyleft").
11 
12 Contact information
13 -------------------
14 
15 Circuits At Home, LTD
16 Web : http://www.circuitsathome.com
17 e-mail : support@circuitsathome.com
18  */
19 #if !defined(__CDC_XR21B1411_H__)
20 #define __CDC_XR21B1411_H__
21 
22 #include "cdcacm.h"
23 
24 #define XR_REG_CUSTOM_DRIVER (0x020DU) // DRIVER SELECT
25 #define XR_REG_CUSTOM_DRIVER_ACTIVE (0x0001U) // 0: CDC 1: CUSTOM
26 
27 #define XR_REG_ACM_FLOW_CTL (0x0216U) // FLOW CONTROL REGISTER CDCACM MODE
28 #define XR_REG_FLOW_CTL (0x0C06U) // FLOW CONTROL REGISTER CUSTOM MODE
29 #define XR_REG_FLOW_CTL_HALF_DPLX (0x0008U) // 0:FULL DUPLEX 1:HALF DUPLEX
30 #define XR_REG_FLOW_CTL_MODE_MASK (0x0007U) // MODE BITMASK
31 #define XR_REG_FLOW_CTL_NONE (0x0000U) // NO FLOW CONTROL
32 #define XR_REG_FLOW_CTL_HW (0x0001U) // HARDWARE FLOW CONTROL
33 #define XR_REG_FLOW_CTL_SW (0x0002U) // SOFTWARE FLOW CONTROL
34 #define XR_REG_FLOW_CTL_MMMRX (0x0003U) // MULTIDROP RX UPON ADDRESS MATCH
35 #define XR_REG_FLOW_CTL_MMMRXTX (0x0004U) // MULTIDROP RX/TX UPON ADDRESS MATCH
36 
37 #define XR_REG_ACM_GPIO_MODE (0x0217U) // GPIO MODE REGISTER IN CDCACM MODE
38 #define XR_REG_GPIO_MODE (0x0C0CU) // GPIO MODE REGISTER IN CUSTOM MODE
39 #define XR_REG_GPIO_MODE_GPIO (0x0000U) // ALL GPIO PINS ACM PROGRAMMABLE
40 #define XR_REG_GPIO_MODE_FC_RTSCTS (0x0001U) // AUTO RTSCTS HW FC (GPIO 4/5)
41 #define XR_REG_GPIO_MODE_FC_DTRDSR (0x0002U) // AUTO DTRDSR HW FC (GPIO 2/3)
42 #define XR_REG_GPIO_MODE_ATE (0x0003U) // AUTO TRANSCEIVER ENABLE DURING TX (GPIO 5)
43 #define XR_REG_GPIO_MODE_ATE_ADDRESS (0x0004U) // AUTO TRANSCEIVER ENABLE ON ADDRESS MATCH (GPIO 5)
44 
45 #define XR_REG_ACM_GPIO_DIR (0x0218U) // GPIO DIRECTION REGISTER CDCACM MODE, 0:IN 1:OUT
46 #define XR_REG_GPIO_DIR (0x0C0DU) // GPIO DIRECTION REGISTER CUSTOM MODE, 0:IN 1:OUT
47 
48 #define XR_REG_ACM_GPIO_INT (0x0219U) // GPIO PIN CHANGE INTERRUPT ENABLE CDCACM MODE, 0: ENABLED 1: DISABLED
49 #define XR_REG_GPIO_INT (0x0C11U) // GPIO PIN CHANGE INTERRUPT ENABLE CUSTOM MODE, 0: ENABLED 1: DISABLED
50 #define XR_REG_GPIO_MASK (0x001FU) // GPIO REGISTERS BITMASK
51 
52 #define XR_REG_UART_ENABLE (0x0C00U) // UART I/O ENABLE REGISTER
53 #define XR_REG_UART_ENABLE_RX (0x0002U) // 0:DISABLED 1:ENABLED
54 #define XR_REG_UART_ENABLE_TX (0x0001U) // 0:DISABLED 1:ENABLED
55 
56 #define XR_REG_ERROR_STATUS (0x0C09U) // ERROR STATUS REGISTER
57 #define XR_REG_ERROR_STATUS_MASK (0x00F8U) // ERROR STATUS BITMASK
58 #define XR_REG_ERROR_STATUS_ERROR (0x0070U) // ERROR STATUS ERROR BITMASK
59 #define XR_REG_ERROR_STATUS_BREAK (0x0008U) // BREAK HAS BEEN DETECTED
60 #define XR_REG_ERROR_STATUS_OVERRUN (0x0010U) // RX OVERRUN ERROR
61 #define XR_REG_ERROR_STATUS_PARITY (0x0020U) // PARITY ERROR
62 #define XR_REG_ERROR_STATUS_FRAME (0x0040U) // FRAMING ERROR
63 #define XR_REG_ERROR_STATUS_BREAKING (0x0080U) // BREAK IS BEING DETECTED
64 
65 #define XR_REG_TX_BREAK (0x0C0AU) // TRANSMIT BREAK. 0X0001-0XFFE TIME IN MS, 0X0000 STOP, 0X0FFF BREAK ON
66 
67 #define XR_REG_XCVR_EN_DELAY (0x0C0BU) // TURN-ARROUND DELAY IN BIT-TIMES 0X0000-0X000F
68 
69 #define XR_REG_GPIO_SET (0x0C0EU) // 1:SET GPIO PIN
70 
71 #define XR_REG_GPIO_CLR (0x0C0FU) // 1:CLEAR GPIO PIN
72 
73 #define XR_REG_GPIO_STATUS (0x0C10U) // READ GPIO PINS
74 
75 #define XR_REG_CUSTOMISED_INT (0x0C12U) // 0:STANDARD 1:CUSTOM SEE DATA SHEET
76 
77 #define XR_REG_PIN_PULLUP_ENABLE (0x0C14U) // 0:DISABLE 1:ENABLE, BITS 0-5:GPIO, 6:RX 7:TX
78 
79 #define XR_REG_PIN_PULLDOWN_ENABLE (0x0C15U) // 0:DISABLE 1:ENABLE, BITS 0-5:GPIO, 6:RX 7:TX
80 
81 #define XR_REG_LOOPBACK (0x0C16U) // 0:DISABLE 1:ENABLE, SEE DATA SHEET
82 
83 #define XR_REG_RX_FIFO_LATENCY (0x0CC2U) // FIFO LATENCY REGISTER
84 #define XR_REG_RX_FIFO_LATENCY_ENABLE (0x0001U) //
85 
86 #define XR_REG_WIDE_MODE (0x0D02U)
87 #define XR_REG_WIDE_MODE_ENABLE (0x0001U)
88 
89 #define XR_REG_XON_CHAR (0x0C07U)
90 #define XR_REG_XOFF_CHAR (0x0C08U)
91 
92 #define XR_REG_TX_FIFO_RESET (0x0C80U) // 1: RESET, SELF-CLEARING
93 #define XR_REG_TX_FIFO_COUNT (0x0C81U) // READ-ONLY
94 #define XR_REG_RX_FIFO_RESET (0x0CC0U) // 1: RESET, SELF-CLEARING
95 #define XR_REG_RX_FIFO_COUNT (0x0CC1U) // READ-ONLY
96 
97 #define XR_WRITE_REQUEST_TYPE (0x40U)
98 
99 #define XR_READ_REQUEST_TYPE (0xC0U)
100 
101 #define XR_MAX_ENDPOINTS 4
102 
103 class XR21B1411 : public ACM {
104 protected:
105 
106 public:
107  XR21B1411(USB *pusb, CDCAsyncOper *pasync);
108 
115  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
116  return (((vid == 0x2890U) && (pid == 0x0201U)) || ((vid == 0x04e2U) && (pid == 0x1411U)));
117  };
118 
119  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
120 
122  tty_features rv;
123  rv.enhanced = true;
124  rv.autoflow_RTS = true;
125  rv.autoflow_DSR = true;
126  rv.autoflow_XON = true;
127  rv.half_duplex = true;
128  rv.wide = true;
129  return rv;
130  };
131 
132  uint8_t read_register(uint16_t reg, uint16_t *val) {
133  return (pUsb->ctrlReq(bAddress, 0, XR_READ_REQUEST_TYPE, 1, 0, 0, reg, 2, 2, (uint8_t *)val, NULL));
134  }
135 
136  uint8_t write_register(uint16_t reg, uint16_t val) {
137  return (pUsb->ctrlReq(bAddress, 0, XR_WRITE_REQUEST_TYPE, 0, BGRAB0(val), BGRAB1(val), reg, 0, 0, NULL, NULL));
138  }
139 
140 
142  // The following methods set the CDC-ACM defaults.
144 
145  virtual void autoflowRTS(bool s) {
146  uint16_t val;
147  uint8_t rval;
148  rval = read_register(XR_REG_ACM_FLOW_CTL, &val);
149  if(!rval) {
150  if(s) {
152  val |= XR_REG_FLOW_CTL_HW;
153  } else {
155  }
156  rval = write_register(XR_REG_ACM_FLOW_CTL, val);
157  if(!rval) {
159  if(!rval) {
160  // ACM commands apply the new settings.
161  LINE_CODING LCT;
162  rval = GetLineCoding(&LCT);
163  if(!rval) {
164  rval = SetLineCoding(&LCT);
165  if(!rval) {
169  }
170  }
171  }
172  }
173  }
174  };
175 
176  virtual void autoflowDSR(bool s) {
177  uint16_t val;
178  uint8_t rval;
179  rval = read_register(XR_REG_ACM_FLOW_CTL, &val);
180  if(!rval) {
181  if(s) {
183  val |= XR_REG_FLOW_CTL_HW;
184  } else {
186  }
187  rval = write_register(XR_REG_ACM_FLOW_CTL, val);
188  if(!rval) {
189  if(s) {
191  } else {
193  }
194  if(!rval) {
195  // ACM commands apply the new settings.
196  LINE_CODING LCT;
197  rval = GetLineCoding(&LCT);
198  if(!rval) {
199  rval = SetLineCoding(&LCT);
200  if(!rval) {
204  }
205  }
206  }
207  }
208  }
209  };
210 
211  virtual void autoflowXON(bool s) {
212  // NOTE: hardware defaults to the normal XON/XOFF
213  uint16_t val;
214  uint8_t rval;
215  rval = read_register(XR_REG_ACM_FLOW_CTL, &val);
216  if(!rval) {
217  if(s) {
219  val |= XR_REG_FLOW_CTL_SW;
220  } else {
222  }
223  rval = write_register(XR_REG_ACM_FLOW_CTL, val);
224  if(!rval) {
226  if(!rval) {
227  // ACM commands apply the new settings.
228  LINE_CODING LCT;
229  rval = GetLineCoding(&LCT);
230  if(!rval) {
231  rval = SetLineCoding(&LCT);
232  if(!rval) {
236  }
237  }
238  }
239  }
240  }
241  };
242 
243  virtual void half_duplex(bool s) {
244  uint16_t val;
245  uint8_t rval;
246  rval = read_register(XR_REG_ACM_FLOW_CTL, &val);
247  if(!rval) {
248  if(s) {
250  } else {
252  }
253  rval = write_register(XR_REG_ACM_FLOW_CTL, val);
254  if(!rval) {
255  // ACM commands apply the new settings.
256  LINE_CODING LCT;
257  rval = GetLineCoding(&LCT);
258  if(!rval) {
259  rval = SetLineCoding(&LCT);
260  if(!rval) {
262  }
263  }
264  }
265  }
266  };
267 
268 
269 
270 };
271 
272 #endif // __CDCPROLIFIC_H__
virtual void autoflowRTS(bool s)
#define XR_REG_ACM_FLOW_CTL
Definition: cdc_XR21B1411.h:27
uint8_t write_register(uint16_t reg, uint16_t val)
-
USB * pUsb
Definition: cdcacm.h:169
-
#define BGRAB0(__usi__)
Definition: macros.h:49
+
USB * pUsb
Definition: cdcacm.h:165
+
#define BGRAB0(__usi__)
Definition: macros.h:56
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
#define XR_WRITE_REQUEST_TYPE
Definition: cdc_XR21B1411.h:97
virtual void half_duplex(bool s)
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
XR21B1411(USB *pusb, CDCAsyncOper *pasync)
#define XR_REG_GPIO_MODE_FC_DTRDSR
Definition: cdc_XR21B1411.h:41
-
uint8_t GetLineCoding(LINE_CODING *dataptr)
Definition: cdcacm.cpp:306
+
uint8_t GetLineCoding(LINE_CODING *dataptr)
Definition: cdcacm.cpp:328
#define XR_REG_FLOW_CTL_HW
Definition: cdc_XR21B1411.h:32
bool enhanced
Definition: cdcacm.h:149
bool wide
Definition: cdcacm.h:152
@@ -113,9 +93,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
bool autoflow_DSR
Definition: cdcacm.h:154
-
uint8_t bAddress
Definition: cdcacm.h:171
+
uint8_t bAddress
Definition: cdcacm.h:167
-
uint8_t SetLineCoding(const LINE_CODING *dataptr)
Definition: cdcacm.cpp:302
+
uint8_t SetLineCoding(const LINE_CODING *dataptr)
Definition: cdcacm.cpp:320
#define XR_REG_FLOW_CTL_HALF_DPLX
Definition: cdc_XR21B1411.h:29
@@ -123,12 +103,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
virtual void autoflowDSR(bool s)
bool half_duplex
Definition: cdcacm.h:156
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
uint8_t read_register(uint16_t reg, uint16_t *val)
Definition: cdcacm.h:163
#define XR_REG_ACM_GPIO_MODE
Definition: cdc_XR21B1411.h:37
-
tty_features _enhanced_status
Definition: cdcacm.h:179
-
#define BGRAB1(__usi__)
Definition: macros.h:50
+
tty_features _enhanced_status
Definition: cdcacm.h:175
+
#define BGRAB1(__usi__)
Definition: macros.h:57
#define XR_REG_GPIO_MODE_GPIO
Definition: cdc_XR21B1411.h:39
#define XR_REG_FLOW_CTL_MODE_MASK
Definition: cdc_XR21B1411.h:30
@@ -136,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/cdcacm_8cpp.html b/cdcacm_8cpp.html index 51e66a6b..040ed2f5 100644 --- a/cdcacm_8cpp.html +++ b/cdcacm_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcacm.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/cdcacm_8cpp__incl.md5 b/cdcacm_8cpp__incl.md5 index 9fd4609d..de6f288e 100644 --- a/cdcacm_8cpp__incl.md5 +++ b/cdcacm_8cpp__incl.md5 @@ -1 +1 @@ -8836c5951dac28c739547b666b24d9f8 \ No newline at end of file +dc13b74ea4b2ee21c679139ece235c5e \ No newline at end of file diff --git a/cdcacm_8cpp__incl.png b/cdcacm_8cpp__incl.png index d83a5703..0e5c7949 100644 Binary files a/cdcacm_8cpp__incl.png and b/cdcacm_8cpp__incl.png differ diff --git a/cdcacm_8cpp_source.html b/cdcacm_8cpp_source.html index 14cf81fd..c228b37d 100644 --- a/cdcacm_8cpp_source.html +++ b/cdcacm_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcacm.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
cdcacm.cpp
-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 #include "cdcacm.h"
18 
19 const uint8_t ACM::epDataInIndex = 1;
20 const uint8_t ACM::epDataOutIndex = 2;
21 const uint8_t ACM::epInterruptInIndex = 3;
22 
23 ACM::ACM(USB *p, CDCAsyncOper *pasync) :
24 pUsb(p),
25 pAsync(pasync),
26 bAddress(0),
27 bControlIface(0),
28 bDataIface(0),
29 bNumEP(1),
30 qNextPollTime(0),
31 bPollEnable(false),
32 ready(false) {
33  _enhanced_status = enhanced_features(); // Set up features
34  for(uint8_t i = 0; i < ACM_MAX_ENDPOINTS; i++) {
35  epInfo[i].epAddr = 0;
36  epInfo[i].maxPktSize = (i) ? 0 : 8;
37  epInfo[i].bmSndToggle = 0;
38  epInfo[i].bmRcvToggle = 0;
40 
41  }
42  if(pUsb)
44 }
45 
46 uint8_t ACM::Init(uint8_t parent, uint8_t port, bool lowspeed) {
47 
48  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
49 
50  uint8_t buf[constBufSize];
51  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
52 
53  uint8_t rcode;
54  UsbDevice *p = NULL;
55  EpInfo *oldep_ptr = NULL;
56  uint8_t num_of_conf; // number of configurations
57 
58  AddressPool &addrPool = pUsb->GetAddressPool();
59 
60  USBTRACE("ACM Init\r\n");
61 
62  if(bAddress)
64 
65  // Get pointer to pseudo device with address 0 assigned
66  p = addrPool.GetUsbDevicePtr(0);
67 
68  if(!p)
70 
71  if(!p->epinfo) {
72  USBTRACE("epinfo\r\n");
74  }
75 
76  // Save old pointer to EP_RECORD of address 0
77  oldep_ptr = p->epinfo;
78 
79  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
80  p->epinfo = epInfo;
81 
82  p->lowspeed = lowspeed;
83 
84  // Get device descriptor
85  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf);
86 
87  // Restore p->epinfo
88  p->epinfo = oldep_ptr;
89 
90  if(rcode)
91  goto FailGetDevDescr;
92 
93  // Allocate new address according to device class
94  bAddress = addrPool.AllocAddress(parent, false, port);
95 
96  if(!bAddress)
98 
99  // Extract Max Packet Size from the device descriptor
101 
102  // Assign new address to the device
103  rcode = pUsb->setAddr(0, 0, bAddress);
104 
105  if(rcode) {
106  p->lowspeed = false;
107  addrPool.FreeAddress(bAddress);
108  bAddress = 0;
109  USBTRACE2("setAddr:", rcode);
110  return rcode;
111  }
112 
113  USBTRACE2("Addr:", bAddress);
114 
115  p->lowspeed = false;
116 
117  p = addrPool.GetUsbDevicePtr(bAddress);
118 
119  if(!p)
121 
122  p->lowspeed = lowspeed;
123 
124  num_of_conf = udd->bNumConfigurations;
125 
126  // Assign epInfo to epinfo pointer
127  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
128 
129  if(rcode)
130  goto FailSetDevTblEntry;
131 
132  USBTRACE2("NC:", num_of_conf);
133 
134  for(uint8_t i = 0; i < num_of_conf; i++) {
140  CP_MASK_COMPARE_PROTOCOL > CdcControlParser(this);
141 
143  CP_MASK_COMPARE_CLASS> CdcDataParser(this);
144 
145  rcode = pUsb->getConfDescr(bAddress, 0, i, &CdcControlParser);
146 
147  if(rcode)
148  goto FailGetConfDescr;
149 
150  rcode = pUsb->getConfDescr(bAddress, 0, i, &CdcDataParser);
151 
152  if(rcode)
153  goto FailGetConfDescr;
154 
155  if(bNumEP > 1)
156  break;
157  } // for
158 
159  if(bNumEP < 4)
161 
162  // Assign epInfo to epinfo pointer
164 
165  USBTRACE2("Conf:", bConfNum);
166 
167  // Set Configuration Value
168  rcode = pUsb->setConf(bAddress, 0, bConfNum);
169 
170  if(rcode)
171  goto FailSetConfDescr;
172 
173  // Set up features status
175  half_duplex(false);
176  autoflowRTS(false);
177  autoflowDSR(false);
178  autoflowXON(false);
179  wide(false); // Always false, because this is only available in custom mode.
180  rcode = pAsync->OnInit(this);
181 
182  if(rcode)
183  goto FailOnInit;
184 
185  USBTRACE("ACM configured\r\n");
186 
187  ready = true;
188 
189  //bPollEnable = true;
190 
191  //USBTRACE("Poll enabled\r\n");
192  return 0;
193 
194 FailGetDevDescr:
195 #ifdef DEBUG_USB_HOST
197  goto Fail;
198 #endif
199 
200 FailSetDevTblEntry:
201 #ifdef DEBUG_USB_HOST
203  goto Fail;
204 #endif
205 
206 FailGetConfDescr:
207 #ifdef DEBUG_USB_HOST
209  goto Fail;
210 #endif
211 
212 FailSetConfDescr:
213 #ifdef DEBUG_USB_HOST
215  goto Fail;
216 #endif
217 
218 FailOnInit:
219 #ifdef DEBUG_USB_HOST
220  USBTRACE("OnInit:");
221 #endif
222 
223 #ifdef DEBUG_USB_HOST
224 Fail:
225  NotifyFail(rcode);
226 #endif
227  Release();
228  return rcode;
229 }
230 
231 void ACM::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
232  //ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
233  //ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
234  //ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
235 
236  bConfNum = conf;
237 
238  uint8_t index;
239 
240  if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
241  index = epInterruptInIndex;
242  else
243  if((pep->bmAttributes & 0x02) == 2)
244  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
245  else
246  return;
247 
248  // Fill in the endpoint info structure
249  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
250  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
251  epInfo[index].bmSndToggle = 0;
252  epInfo[index].bmRcvToggle = 0;
253 
254  bNumEP++;
255 
257 }
258 
259 uint8_t ACM::Release() {
260  ready = false;
262 
263  bControlIface = 0;
264  bDataIface = 0;
265  bNumEP = 1;
266 
267  bAddress = 0;
268  qNextPollTime = 0;
269  bPollEnable = false;
270  return 0;
271 }
272 
273 uint8_t ACM::Poll() {
274  uint8_t rcode = 0;
275 
276  if(!bPollEnable)
277  return 0;
278 
279  return rcode;
280 }
281 
282 uint8_t ACM::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
283  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
284 }
285 
286 uint8_t ACM::SndData(uint16_t nbytes, uint8_t *dataptr) {
287  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
288 }
289 
290 uint8_t ACM::SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr) {
291  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, nbytes, nbytes, dataptr, NULL));
292 }
293 
294 uint8_t ACM::GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr) {
295  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCIN, CDC_GET_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, nbytes, nbytes, dataptr, NULL));
296 }
297 
298 uint8_t ACM::ClearCommFeature(uint16_t fid) {
299  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_CLEAR_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, 0, 0, NULL, NULL));
300 }
301 
302 uint8_t ACM::SetLineCoding(const LINE_CODING *dataptr) {
303  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_LINE_CODING, 0x00, 0x00, bControlIface, sizeof (LINE_CODING), sizeof (LINE_CODING), (uint8_t*)dataptr, NULL));
304 }
305 
306 uint8_t ACM::GetLineCoding(LINE_CODING *dataptr) {
307  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCIN, CDC_GET_LINE_CODING, 0x00, 0x00, bControlIface, sizeof (LINE_CODING), sizeof (LINE_CODING), (uint8_t*)dataptr, NULL));
308 }
309 
310 uint8_t ACM::SetControlLineState(uint8_t state) {
311  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_CONTROL_LINE_STATE, state, 0, bControlIface, 0, 0, NULL, NULL));
312 }
313 
314 uint8_t ACM::SendBreak(uint16_t duration) {
315  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SEND_BREAK, (duration & 0xff), (duration >> 8), bControlIface, 0, 0, NULL, NULL));
316 }
317 
319  Notify(PSTR("Endpoint descriptor:"), 0x80);
320  Notify(PSTR("\r\nLength:\t\t"), 0x80);
321  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
322  Notify(PSTR("\r\nType:\t\t"), 0x80);
323  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
324  Notify(PSTR("\r\nAddress:\t"), 0x80);
325  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
326  Notify(PSTR("\r\nAttributes:\t"), 0x80);
327  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
328  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
329  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
330  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
331  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
332  Notify(PSTR("\r\n"), 0x80);
333 }
#define USB_CLASS_COM_AND_CDC_CTRL
Definition: UsbCore.h:58
-
#define USB_CLASS_CDC_DATA
Definition: UsbCore.h:65
-
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
-
uint8_t bmRcvToggle
Definition: address.h:41
- +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 #include "cdcacm.h"
18 
19 const uint8_t ACM::epDataInIndex = 1;
20 const uint8_t ACM::epDataOutIndex = 2;
21 const uint8_t ACM::epInterruptInIndex = 3;
22 
23 ACM::ACM(USB *p, CDCAsyncOper *pasync) :
24 pUsb(p),
25 pAsync(pasync),
26 bAddress(0),
27 bControlIface(0),
28 bDataIface(0),
29 bNumEP(1),
30 qNextPollTime(0),
31 bPollEnable(false),
32 ready(false) {
33  _enhanced_status = enhanced_features(); // Set up features
34  for(uint8_t i = 0; i < ACM_MAX_ENDPOINTS; i++) {
35  epInfo[i].epAddr = 0;
36  epInfo[i].maxPktSize = (i) ? 0 : 8;
37  epInfo[i].bmSndToggle = 0;
38  epInfo[i].bmRcvToggle = 0;
40 
41  }
42  if(pUsb)
44 }
45 
46 uint8_t ACM::Init(uint8_t parent, uint8_t port, bool lowspeed) {
47 
48  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
49 
50  uint8_t buf[constBufSize];
51  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
52 
53  uint8_t rcode;
54  UsbDevice *p = NULL;
55  EpInfo *oldep_ptr = NULL;
56  uint8_t num_of_conf; // number of configurations
57 
58  AddressPool &addrPool = pUsb->GetAddressPool();
59 
60  USBTRACE("ACM Init\r\n");
61 
62  if(bAddress)
64 
65  // Get pointer to pseudo device with address 0 assigned
66  p = addrPool.GetUsbDevicePtr(0);
67 
68  if(!p)
70 
71  if(!p->epinfo) {
72  USBTRACE("epinfo\r\n");
74  }
75 
76  // Save old pointer to EP_RECORD of address 0
77  oldep_ptr = p->epinfo;
78 
79  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
80  p->epinfo = epInfo;
81 
82  p->lowspeed = lowspeed;
83 
84  // Get device descriptor
85  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf);
86 
87  // Restore p->epinfo
88  p->epinfo = oldep_ptr;
89 
90  if(rcode)
91  goto FailGetDevDescr;
92 
93  // Allocate new address according to device class
94  bAddress = addrPool.AllocAddress(parent, false, port);
95 
96  if(!bAddress)
98 
99  // Extract Max Packet Size from the device descriptor
101 
102  // Assign new address to the device
103  rcode = pUsb->setAddr(0, 0, bAddress);
104 
105  if(rcode) {
106  p->lowspeed = false;
107  addrPool.FreeAddress(bAddress);
108  bAddress = 0;
109  USBTRACE2("setAddr:", rcode);
110  return rcode;
111  }
112 
113  USBTRACE2("Addr:", bAddress);
114 
115  p->lowspeed = false;
116 
117  p = addrPool.GetUsbDevicePtr(bAddress);
118 
119  if(!p)
121 
122  p->lowspeed = lowspeed;
123 
124  num_of_conf = udd->bNumConfigurations;
125 
126  // Assign epInfo to epinfo pointer
127  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
128 
129  if(rcode)
130  goto FailSetDevTblEntry;
131 
132  USBTRACE2("NC:", num_of_conf);
133 
134  for(uint8_t i = 0; i < num_of_conf; i++) {
140  CP_MASK_COMPARE_PROTOCOL > CdcControlParser(this);
141 
143  CP_MASK_COMPARE_CLASS> CdcDataParser(this);
144 
145  rcode = pUsb->getConfDescr(bAddress, 0, i, &CdcControlParser);
146 
147  if(rcode)
148  goto FailGetConfDescr;
149 
150  rcode = pUsb->getConfDescr(bAddress, 0, i, &CdcDataParser);
151 
152  if(rcode)
153  goto FailGetConfDescr;
154 
155  if(bNumEP > 1)
156  break;
157  } // for
158 
159  if(bNumEP < 4)
161 
162  // Assign epInfo to epinfo pointer
164 
165  USBTRACE2("Conf:", bConfNum);
166 
167  // Set Configuration Value
168  rcode = pUsb->setConf(bAddress, 0, bConfNum);
169 
170  if(rcode)
171  goto FailSetConfDescr;
172 
173  // Set up features status
175  half_duplex(false);
176  autoflowRTS(false);
177  autoflowDSR(false);
178  autoflowXON(false);
179  wide(false); // Always false, because this is only available in custom mode.
180  rcode = pAsync->OnInit(this);
181 
182  if(rcode)
183  goto FailOnInit;
184 
185  USBTRACE("ACM configured\r\n");
186 
187  ready = true;
188 
189  //bPollEnable = true;
190 
191  //USBTRACE("Poll enabled\r\n");
192  return 0;
193 
194 FailGetDevDescr:
195 #ifdef DEBUG_USB_HOST
197  goto Fail;
198 #endif
199 
200 FailSetDevTblEntry:
201 #ifdef DEBUG_USB_HOST
203  goto Fail;
204 #endif
205 
206 FailGetConfDescr:
207 #ifdef DEBUG_USB_HOST
209  goto Fail;
210 #endif
211 
212 FailSetConfDescr:
213 #ifdef DEBUG_USB_HOST
215  goto Fail;
216 #endif
217 
218 FailOnInit:
219 #ifdef DEBUG_USB_HOST
220  USBTRACE("OnInit:");
221 #endif
222 
223 #ifdef DEBUG_USB_HOST
224 Fail:
225  NotifyFail(rcode);
226 #endif
227  Release();
228  return rcode;
229 }
230 
231 void ACM::EndpointXtract(uint8_t conf, uint8_t iface __attribute__((unused)), uint8_t alt __attribute__((unused)), uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *pep) {
232  //ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
233  //ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
234  //ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
235 
236  bConfNum = conf;
237 
238  uint8_t index;
239 
240  if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
241  index = epInterruptInIndex;
243  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
244  else
245  return;
246 
247  // Fill in the endpoint info structure
248  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
249  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
250  epInfo[index].bmSndToggle = 0;
251  epInfo[index].bmRcvToggle = 0;
252 
253  bNumEP++;
254 
256 }
257 
258 uint8_t ACM::Release() {
259  ready = false;
261 
262  bControlIface = 0;
263  bDataIface = 0;
264  bNumEP = 1;
265 
266  bAddress = 0;
267  qNextPollTime = 0;
268  bPollEnable = false;
269  return 0;
270 }
271 
272 uint8_t ACM::Poll() {
273  //uint8_t rcode = 0;
274  //if(!bPollEnable)
275  // return 0;
276  //return rcode;
277  return 0;
278 }
279 
280 uint8_t ACM::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
281  uint8_t rv = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
282  if(rv && rv != hrNAK) {
283  Release();
284  }
285  return rv;
286 }
287 
288 uint8_t ACM::SndData(uint16_t nbytes, uint8_t *dataptr) {
289  uint8_t rv = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
290  if(rv && rv != hrNAK) {
291  Release();
292  }
293  return rv;
294 }
295 
296 uint8_t ACM::SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr) {
297  uint8_t rv = ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, nbytes, nbytes, dataptr, NULL));
298  if(rv && rv != hrNAK) {
299  Release();
300  }
301  return rv;
302 }
303 
304 uint8_t ACM::GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr) {
305  uint8_t rv = ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCIN, CDC_GET_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, nbytes, nbytes, dataptr, NULL));
306  if(rv && rv != hrNAK) {
307  Release();
308  }
309  return rv;
310 }
311 
312 uint8_t ACM::ClearCommFeature(uint16_t fid) {
313  uint8_t rv = ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_CLEAR_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, 0, 0, NULL, NULL));
314  if(rv && rv != hrNAK) {
315  Release();
316  }
317  return rv;
318 }
319 
320 uint8_t ACM::SetLineCoding(const LINE_CODING *dataptr) {
321  uint8_t rv = ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_LINE_CODING, 0x00, 0x00, bControlIface, sizeof (LINE_CODING), sizeof (LINE_CODING), (uint8_t*)dataptr, NULL));
322  if(rv && rv != hrNAK) {
323  Release();
324  }
325  return rv;
326 }
327 
328 uint8_t ACM::GetLineCoding(LINE_CODING *dataptr) {
329  uint8_t rv = ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCIN, CDC_GET_LINE_CODING, 0x00, 0x00, bControlIface, sizeof (LINE_CODING), sizeof (LINE_CODING), (uint8_t*)dataptr, NULL));
330  if(rv && rv != hrNAK) {
331  Release();
332  }
333  return rv;
334 }
335 
336 uint8_t ACM::SetControlLineState(uint8_t state) {
337  uint8_t rv = ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_CONTROL_LINE_STATE, state, 0, bControlIface, 0, 0, NULL, NULL));
338  if(rv && rv != hrNAK) {
339  Release();
340  }
341  return rv;
342 }
343 
344 uint8_t ACM::SendBreak(uint16_t duration) {
345  uint8_t rv = ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SEND_BREAK, (duration & 0xff), (duration >> 8), bControlIface, 0, 0, NULL, NULL));
346  if(rv && rv != hrNAK) {
347  Release();
348  }
349  return rv;
350 }
351 
353  Notify(PSTR("Endpoint descriptor:"), 0x80);
354  Notify(PSTR("\r\nLength:\t\t"), 0x80);
355  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
356  Notify(PSTR("\r\nType:\t\t"), 0x80);
357  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
358  Notify(PSTR("\r\nAddress:\t"), 0x80);
359  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
360  Notify(PSTR("\r\nAttributes:\t"), 0x80);
361  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
362  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
363  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
364  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
365  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
366  Notify(PSTR("\r\n"), 0x80);
367 }
#define USB_CLASS_COM_AND_CDC_CTRL
Definition: UsbCore.h:69
+
#define USB_CLASS_CDC_DATA
Definition: UsbCore.h:76
+
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+
uint8_t bmRcvToggle
Definition: address.h:48
+
#define CDC_SUBCLASS_ACM
Definition: cdcacm.h:27
-
virtual tty_features enhanced_features(void)
Definition: cdcacm.h:222
+
virtual tty_features enhanced_features(void)
Definition: cdcacm.h:221
ACM(USB *pusb, CDCAsyncOper *pasync)
Definition: cdcacm.cpp:23
#define CDC_PROTOCOL_ITU_T_V_250
Definition: cdcacm.h:40
-
EpInfo * epinfo
Definition: address.h:76
-
#define CP_MASK_COMPARE_PROTOCOL
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
+
EpInfo * epinfo
Definition: address.h:83
+
#define CP_MASK_COMPARE_PROTOCOL
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
virtual uint8_t OnInit(ACM *pacm)
Definition: cdcacm.h:131
-
static const uint8_t epInterruptInIndex
Definition: cdcacm.h:167
-
uint8_t bmNakPower
Definition: address.h:42
-
static const uint8_t epDataOutIndex
Definition: cdcacm.h:166
+
static const uint8_t epInterruptInIndex
Definition: cdcacm.h:182
+
uint8_t bmNakPower
Definition: address.h:49
+
static const uint8_t epDataOutIndex
Definition: cdcacm.h:181
#define CDC_CLEAR_COMM_FEATURE
Definition: cdcacm.h:55
-
uint32_t qNextPollTime
Definition: cdcacm.h:176
- -
uint8_t bControlIface
Definition: cdcacm.h:173
+
uint32_t qNextPollTime
Definition: cdcacm.h:172
+ +
uint8_t bControlIface
Definition: cdcacm.h:169
#define CDC_SET_COMM_FEATURE
Definition: cdcacm.h:53
- - + +
#define CDC_SET_LINE_CODING
Definition: cdcacm.h:62
- -
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:105
-
volatile bool ready
Definition: cdcacm.h:178
-
#define NotifyFail(...)
Definition: message.h:55
-
uint8_t bDataIface
Definition: cdcacm.h:174
-
USB * pUsb
Definition: cdcacm.h:169
-
virtual void autoflowRTS(bool s)
Definition: cdcacm.h:233
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
-
uint8_t bNumEP
Definition: cdcacm.h:175
+ +
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:112
+
volatile bool ready
Definition: cdcacm.h:174
+
#define NotifyFail(...)
Definition: message.h:62
+
uint8_t bDataIface
Definition: cdcacm.h:170
+
USB * pUsb
Definition: cdcacm.h:165
+
virtual void autoflowRTS(bool s)
Definition: cdcacm.h:232
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
uint8_t bNumEP
Definition: cdcacm.h:171
#define bmREQ_CDCOUT
Definition: cdcacm.h:22
-
EpInfo epInfo[ACM_MAX_ENDPOINTS]
Definition: cdcacm.h:181
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
-
#define CP_MASK_COMPARE_CLASS
+
EpInfo epInfo[ACM_MAX_ENDPOINTS]
Definition: cdcacm.h:183
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
+
#define CP_MASK_COMPARE_CLASS
#define CDC_SEND_BREAK
Definition: cdcacm.h:65
#define CDC_GET_COMM_FEATURE
Definition: cdcacm.h:54
virtual void FreeAddress(uint8_t addr)=0
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: cdcacm.cpp:318
-
#define Notify(...)
Definition: message.h:44
-
CDCAsyncOper * pAsync
Definition: cdcacm.h:170
- - -
#define USBTRACE2(s, r)
Definition: macros.h:77
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
+
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: cdcacm.cpp:352
+
#define Notify(...)
Definition: message.h:51
+
CDCAsyncOper * pAsync
Definition: cdcacm.h:166
+ + +
#define USBTRACE2(s, r)
Definition: macros.h:84
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
#define ACM_MAX_ENDPOINTS
Definition: cdcacm.h:161
-
#define NotifyFailGetConfDescr(...)
Definition: message.h:52
-
virtual void wide(bool s)
Definition: cdcacm.h:245
-
uint8_t GetLineCoding(LINE_CODING *dataptr)
Definition: cdcacm.cpp:306
-
uint8_t epAddr
Definition: address.h:33
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
-
virtual void autoflowXON(bool s)
Definition: cdcacm.h:239
+
#define NotifyFailGetConfDescr(...)
Definition: message.h:59
+
virtual void wide(bool s)
Definition: cdcacm.h:244
+
uint8_t GetLineCoding(LINE_CODING *dataptr)
Definition: cdcacm.cpp:328
+
uint8_t epAddr
Definition: address.h:40
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
+
virtual void autoflowXON(bool s)
Definition: cdcacm.h:238
#define bmREQ_CDCIN
Definition: cdcacm.h:23
-
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
Definition: cdcacm.cpp:286
-
uint8_t Poll()
Definition: cdcacm.cpp:273
-
Definition: address.h:32
+
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
Definition: cdcacm.cpp:288
+
uint8_t Poll()
Definition: cdcacm.cpp:272
+
Definition: address.h:39
#define CDC_GET_LINE_CODING
Definition: cdcacm.h:63
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
-
uint16_t wMaxPacketSize
Definition: usb_ch9.h:146
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
+
#define hrNAK
Definition: max3421e.h:218
+
uint16_t wMaxPacketSize
Definition: usb_ch9.h:153
+
#define bmUSB_TRANSFER_TYPE
Definition: usb_ch9.h:94
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: cdcacm.cpp:46
-
#define CP_MASK_COMPARE_SUBCLASS
+
#define CP_MASK_COMPARE_SUBCLASS
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bEndpointAddress
Definition: usb_ch9.h:144
-
static const uint8_t epDataInIndex
Definition: cdcacm.h:165
-
virtual void autoflowDSR(bool s)
Definition: cdcacm.h:236
-
uint8_t bAddress
Definition: cdcacm.h:171
-
uint8_t bmSndToggle
Definition: address.h:40
+
uint8_t bEndpointAddress
Definition: usb_ch9.h:151
+
static const uint8_t epDataInIndex
Definition: cdcacm.h:180
+
virtual void autoflowDSR(bool s)
Definition: cdcacm.h:235
+
uint8_t bAddress
Definition: cdcacm.h:167
+
uint8_t bmSndToggle
Definition: address.h:47
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
- -
uint8_t SetLineCoding(const LINE_CODING *dataptr)
Definition: cdcacm.cpp:302
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
+ +
uint8_t SetLineCoding(const LINE_CODING *dataptr)
Definition: cdcacm.cpp:320
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: cdcacm.cpp:231
-
#define USB_NAK_NOWAIT
Definition: address.h:29
-
uint8_t SendBreak(uint16_t duration)
Definition: cdcacm.cpp:314
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
+
#define USB_NAK_NOWAIT
Definition: address.h:36
+
uint8_t SendBreak(uint16_t duration)
Definition: cdcacm.cpp:344
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
-
uint8_t GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)
Definition: cdcacm.cpp:294
-
uint8_t Release()
Definition: cdcacm.cpp:259
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
uint8_t bConfNum
Definition: cdcacm.h:172
-
uint8_t bNumConfigurations
Definition: usb_ch9.h:112
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
+
uint8_t GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)
Definition: cdcacm.cpp:304
+
uint8_t Release()
Definition: cdcacm.cpp:258
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
uint8_t bConfNum
Definition: cdcacm.h:168
+
uint8_t bNumConfigurations
Definition: usb_ch9.h:119
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
#define CDC_SET_CONTROL_LINE_STATE
Definition: cdcacm.h:64
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
Definition: UsbCore.h:197
-
volatile bool bPollEnable
Definition: cdcacm.h:177
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
-
tty_features _enhanced_status
Definition: cdcacm.h:179
-
uint8_t SetControlLineState(uint8_t state)
Definition: cdcacm.cpp:310
-
uint8_t SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)
Definition: cdcacm.cpp:290
-
uint8_t ClearCommFeature(uint16_t fid)
Definition: cdcacm.cpp:298
-
virtual void half_duplex(bool s)
Definition: cdcacm.h:242
-
#define USBTRACE(s)
Definition: macros.h:75
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
-
uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr)
Definition: cdcacm.cpp:282
- +
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
Definition: UsbCore.h:208
+
#define USB_TRANSFER_TYPE_BULK
Definition: usb_ch9.h:92
+
volatile bool bPollEnable
Definition: cdcacm.h:173
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
+
tty_features _enhanced_status
Definition: cdcacm.h:175
+
uint8_t SetControlLineState(uint8_t state)
Definition: cdcacm.cpp:336
+
uint8_t SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)
Definition: cdcacm.cpp:296
+
uint8_t ClearCommFeature(uint16_t fid)
Definition: cdcacm.cpp:312
+
virtual void half_duplex(bool s)
Definition: cdcacm.h:241
+
#define USBTRACE(s)
Definition: macros.h:82
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr)
Definition: cdcacm.cpp:280
+
diff --git a/cdcacm_8h.html b/cdcacm_8h.html index be60d2aa..14e2b548 100644 --- a/cdcacm_8h.html +++ b/cdcacm_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcacm.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ bmREQ_CDCOUT

+
@@ -264,11 +246,13 @@ Typedefs
-

Definition at line 22 of file cdcacm.h.

+

Definition at line 22 of file cdcacm.h.

- + +

◆ bmREQ_CDCIN

+
@@ -278,11 +262,13 @@ Typedefs
-

Definition at line 23 of file cdcacm.h.

+

Definition at line 23 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_DLCM

+
@@ -292,11 +278,13 @@ Typedefs
-

Definition at line 26 of file cdcacm.h.

+

Definition at line 26 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_ACM

+
@@ -306,11 +294,13 @@ Typedefs
-

Definition at line 27 of file cdcacm.h.

+

Definition at line 27 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_TCM

+
@@ -320,11 +310,13 @@ Typedefs
-

Definition at line 28 of file cdcacm.h.

+

Definition at line 28 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_MCCM

+
@@ -334,11 +326,13 @@ Typedefs
-

Definition at line 29 of file cdcacm.h.

+

Definition at line 29 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_CAPI

+
@@ -348,11 +342,13 @@ Typedefs
-

Definition at line 30 of file cdcacm.h.

+

Definition at line 30 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_ETHERNET

+
@@ -362,11 +358,13 @@ Typedefs
-

Definition at line 31 of file cdcacm.h.

+

Definition at line 31 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_ATM

+
@@ -376,11 +374,13 @@ Typedefs
-

Definition at line 32 of file cdcacm.h.

+

Definition at line 32 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_WIRELESS_HANDSET

+
@@ -390,11 +390,13 @@ Typedefs
-

Definition at line 33 of file cdcacm.h.

+

Definition at line 33 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_DEVICE_MANAGEMENT

+
@@ -404,11 +406,13 @@ Typedefs
-

Definition at line 34 of file cdcacm.h.

+

Definition at line 34 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_MOBILE_DIRECT_LINE

+
@@ -418,11 +422,13 @@ Typedefs
-

Definition at line 35 of file cdcacm.h.

+

Definition at line 35 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_OBEX

+
@@ -432,11 +438,13 @@ Typedefs
-

Definition at line 36 of file cdcacm.h.

+

Definition at line 36 of file cdcacm.h.

- + +

◆ CDC_SUBCLASS_ETHERNET_EMU

+
@@ -446,11 +454,13 @@ Typedefs
-

Definition at line 37 of file cdcacm.h.

+

Definition at line 37 of file cdcacm.h.

- + +

◆ CDC_PROTOCOL_ITU_T_V_250

+
@@ -460,11 +470,13 @@ Typedefs
-

Definition at line 40 of file cdcacm.h.

+

Definition at line 40 of file cdcacm.h.

- + +

◆ CDC_PROTOCOL_PCCA_101

+
@@ -474,11 +486,13 @@ Typedefs
-

Definition at line 41 of file cdcacm.h.

+

Definition at line 41 of file cdcacm.h.

- + +

◆ CDC_PROTOCOL_PCCA_101_O

+
@@ -488,11 +502,13 @@ Typedefs
-

Definition at line 42 of file cdcacm.h.

+

Definition at line 42 of file cdcacm.h.

- + +

◆ CDC_PROTOCOL_GSM_7_07

+
@@ -502,11 +518,13 @@ Typedefs
-

Definition at line 43 of file cdcacm.h.

+

Definition at line 43 of file cdcacm.h.

- + +

◆ CDC_PROTOCOL_3GPP_27_07

+
@@ -516,11 +534,13 @@ Typedefs
-

Definition at line 44 of file cdcacm.h.

+

Definition at line 44 of file cdcacm.h.

- + +

◆ CDC_PROTOCOL_C_S0017_0

+
@@ -530,11 +550,13 @@ Typedefs
-

Definition at line 45 of file cdcacm.h.

+

Definition at line 45 of file cdcacm.h.

- + +

◆ CDC_PROTOCOL_USB_EEM

+
@@ -544,11 +566,13 @@ Typedefs
-

Definition at line 46 of file cdcacm.h.

+

Definition at line 46 of file cdcacm.h.

- + +

◆ CDC_SEND_ENCAPSULATED_COMMAND

+
@@ -558,11 +582,13 @@ Typedefs
-

Definition at line 49 of file cdcacm.h.

+

Definition at line 49 of file cdcacm.h.

- + +

◆ CDC_GET_ENCAPSULATED_RESPONSE

+
@@ -572,11 +598,13 @@ Typedefs
-

Definition at line 50 of file cdcacm.h.

+

Definition at line 50 of file cdcacm.h.

- + +

◆ CDC_SET_COMM_FEATURE

+
@@ -586,11 +614,13 @@ Typedefs
-

Definition at line 53 of file cdcacm.h.

+

Definition at line 53 of file cdcacm.h.

- + +

◆ CDC_GET_COMM_FEATURE

+
@@ -600,11 +630,13 @@ Typedefs
-

Definition at line 54 of file cdcacm.h.

+

Definition at line 54 of file cdcacm.h.

- + +

◆ CDC_CLEAR_COMM_FEATURE

+
@@ -614,11 +646,13 @@ Typedefs
-

Definition at line 55 of file cdcacm.h.

+

Definition at line 55 of file cdcacm.h.

- + +

◆ CDC_SET_AUX_LINE_STATE

+
@@ -628,11 +662,13 @@ Typedefs
-

Definition at line 56 of file cdcacm.h.

+

Definition at line 56 of file cdcacm.h.

- + +

◆ CDC_SET_HOOK_STATE

+
@@ -642,11 +678,13 @@ Typedefs
-

Definition at line 57 of file cdcacm.h.

+

Definition at line 57 of file cdcacm.h.

- + +

◆ CDC_PULSE_SETUP

+
@@ -656,11 +694,13 @@ Typedefs
-

Definition at line 58 of file cdcacm.h.

+

Definition at line 58 of file cdcacm.h.

- + +

◆ CDC_SEND_PULSE

+
@@ -670,11 +710,13 @@ Typedefs
-

Definition at line 59 of file cdcacm.h.

+

Definition at line 59 of file cdcacm.h.

- + +

◆ CDC_SET_PULSE_TIME

+
@@ -684,11 +726,13 @@ Typedefs
-

Definition at line 60 of file cdcacm.h.

+

Definition at line 60 of file cdcacm.h.

- + +

◆ CDC_RING_AUX_JACK

+
@@ -698,11 +742,13 @@ Typedefs
-

Definition at line 61 of file cdcacm.h.

+

Definition at line 61 of file cdcacm.h.

- + +

◆ CDC_SET_LINE_CODING

+
@@ -712,11 +758,13 @@ Typedefs
-

Definition at line 62 of file cdcacm.h.

+

Definition at line 62 of file cdcacm.h.

- + +

◆ CDC_GET_LINE_CODING

+
@@ -726,11 +774,13 @@ Typedefs
-

Definition at line 63 of file cdcacm.h.

+

Definition at line 63 of file cdcacm.h.

- + +

◆ CDC_SET_CONTROL_LINE_STATE

+
@@ -740,11 +790,13 @@ Typedefs
-

Definition at line 64 of file cdcacm.h.

+

Definition at line 64 of file cdcacm.h.

- + +

◆ CDC_SEND_BREAK

+
@@ -754,11 +806,13 @@ Typedefs
-

Definition at line 65 of file cdcacm.h.

+

Definition at line 65 of file cdcacm.h.

- + +

◆ CDC_SET_RINGER_PARMS

+
@@ -768,11 +822,13 @@ Typedefs
-

Definition at line 66 of file cdcacm.h.

+

Definition at line 66 of file cdcacm.h.

- + +

◆ CDC_GET_RINGER_PARMS

+
@@ -782,11 +838,13 @@ Typedefs
-

Definition at line 67 of file cdcacm.h.

+

Definition at line 67 of file cdcacm.h.

- + +

◆ CDC_SET_OPERATION_PARMS

+
@@ -796,11 +854,13 @@ Typedefs
-

Definition at line 68 of file cdcacm.h.

+

Definition at line 68 of file cdcacm.h.

- + +

◆ CDC_GET_OPERATION_PARMS

+
@@ -810,11 +870,13 @@ Typedefs
-

Definition at line 69 of file cdcacm.h.

+

Definition at line 69 of file cdcacm.h.

- + +

◆ CDC_SET_LINE_PARMS

+
@@ -824,11 +886,13 @@ Typedefs
-

Definition at line 70 of file cdcacm.h.

+

Definition at line 70 of file cdcacm.h.

- + +

◆ CDC_GET_LINE_PARMS

+
@@ -838,11 +902,13 @@ Typedefs
-

Definition at line 71 of file cdcacm.h.

+

Definition at line 71 of file cdcacm.h.

- + +

◆ CDC_DIAL_DIGITS

+
@@ -852,11 +918,13 @@ Typedefs
-

Definition at line 72 of file cdcacm.h.

+

Definition at line 72 of file cdcacm.h.

- + +

◆ NETWORK_CONNECTION

+
@@ -866,11 +934,13 @@ Typedefs
-

Definition at line 75 of file cdcacm.h.

+

Definition at line 75 of file cdcacm.h.

- + +

◆ RESPONSE_AVAILABLE

+
@@ -880,11 +950,13 @@ Typedefs
-

Definition at line 76 of file cdcacm.h.

+

Definition at line 76 of file cdcacm.h.

- + +

◆ AUX_JACK_HOOK_STATE

+
@@ -894,11 +966,13 @@ Typedefs
-

Definition at line 77 of file cdcacm.h.

+

Definition at line 77 of file cdcacm.h.

- + +

◆ RING_DETECT

+
@@ -908,11 +982,13 @@ Typedefs
-

Definition at line 78 of file cdcacm.h.

+

Definition at line 78 of file cdcacm.h.

- + +

◆ SERIAL_STATE

+
@@ -922,11 +998,13 @@ Typedefs
-

Definition at line 79 of file cdcacm.h.

+

Definition at line 79 of file cdcacm.h.

- + +

◆ CALL_STATE_CHANGE

+
@@ -936,11 +1014,13 @@ Typedefs
-

Definition at line 80 of file cdcacm.h.

+

Definition at line 80 of file cdcacm.h.

- + +

◆ LINE_STATE_CHANGE

+
@@ -950,11 +1030,13 @@ Typedefs
-

Definition at line 81 of file cdcacm.h.

+

Definition at line 81 of file cdcacm.h.

- + +

◆ CONNECTION_SPEED_CHANGE

+
@@ -964,11 +1046,13 @@ Typedefs
-

Definition at line 82 of file cdcacm.h.

+

Definition at line 82 of file cdcacm.h.

- + +

◆ ACM_MAX_ENDPOINTS

+
@@ -978,12 +1062,14 @@ Typedefs
-

Definition at line 161 of file cdcacm.h.

+

Definition at line 161 of file cdcacm.h.

Typedef Documentation

- + +

◆ DLM_FUNC_DESCR

+
@@ -995,7 +1081,9 @@ Typedefs - + +

◆ TEL_OPER_MODES_FUNC_DESCR

+
@@ -1007,7 +1095,9 @@ Typedefs - + +

◆ TEL_CALL_STATE_REP_CPBL_FUNC_DESCR

+
@@ -1025,7 +1115,7 @@ Typedefs diff --git a/cdcacm_8h__dep__incl.md5 b/cdcacm_8h__dep__incl.md5 index 9355f061..b8fe34c4 100644 --- a/cdcacm_8h__dep__incl.md5 +++ b/cdcacm_8h__dep__incl.md5 @@ -1 +1 @@ -d9684fa8dbbab21f6c77cde6aba312ed \ No newline at end of file +a290fd140b9c53cb509a0c1f221809bd \ No newline at end of file diff --git a/cdcacm_8h__dep__incl.png b/cdcacm_8h__dep__incl.png index 03fa1f4e..5eca2cca 100644 Binary files a/cdcacm_8h__dep__incl.png and b/cdcacm_8h__dep__incl.png differ diff --git a/cdcacm_8h__incl.md5 b/cdcacm_8h__incl.md5 index ac958164..4ba15cd9 100644 --- a/cdcacm_8h__incl.md5 +++ b/cdcacm_8h__incl.md5 @@ -1 +1 @@ -107fd47c127eab19013c78d1f9837064 \ No newline at end of file +e1dbfabc42dd79acb3eb7148c02f8f1f \ No newline at end of file diff --git a/cdcacm_8h__incl.png b/cdcacm_8h__incl.png index 0c43d9bb..cf5d2c5f 100644 Binary files a/cdcacm_8h__incl.png and b/cdcacm_8h__incl.png differ diff --git a/cdcacm_8h_source.html b/cdcacm_8h_source.html index 9674c2fd..70825ab0 100644 --- a/cdcacm_8h_source.html +++ b/cdcacm_8h_source.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: cdcacm.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
cdcacm.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 #if !defined(__CDCACM_H__)
18 #define __CDCACM_H__
19 
20 #include "Usb.h"
21 
22 #define bmREQ_CDCOUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
23 #define bmREQ_CDCIN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
24 
25 // CDC Subclass Constants
26 #define CDC_SUBCLASS_DLCM 0x01 // Direct Line Control Model
27 #define CDC_SUBCLASS_ACM 0x02 // Abstract Control Model
28 #define CDC_SUBCLASS_TCM 0x03 // Telephone Control Model
29 #define CDC_SUBCLASS_MCCM 0x04 // Multi Channel Control Model
30 #define CDC_SUBCLASS_CAPI 0x05 // CAPI Control Model
31 #define CDC_SUBCLASS_ETHERNET 0x06 // Ethernet Network Control Model
32 #define CDC_SUBCLASS_ATM 0x07 // ATM Network Control Model
33 #define CDC_SUBCLASS_WIRELESS_HANDSET 0x08 // Wireless Handset Control Model
34 #define CDC_SUBCLASS_DEVICE_MANAGEMENT 0x09 // Device Management
35 #define CDC_SUBCLASS_MOBILE_DIRECT_LINE 0x0A // Mobile Direct Line Model
36 #define CDC_SUBCLASS_OBEX 0x0B // OBEX
37 #define CDC_SUBCLASS_ETHERNET_EMU 0x0C // Ethernet Emulation Model
38 
39 // Communication Interface Class Control Protocol Codes
40 #define CDC_PROTOCOL_ITU_T_V_250 0x01 // AT Commands defined by ITU-T V.250
41 #define CDC_PROTOCOL_PCCA_101 0x02 // AT Commands defined by PCCA-101
42 #define CDC_PROTOCOL_PCCA_101_O 0x03 // AT Commands defined by PCCA-101 & Annex O
43 #define CDC_PROTOCOL_GSM_7_07 0x04 // AT Commands defined by GSM 7.07
44 #define CDC_PROTOCOL_3GPP_27_07 0x05 // AT Commands defined by 3GPP 27.007
45 #define CDC_PROTOCOL_C_S0017_0 0x06 // AT Commands defined by TIA for CDMA
46 #define CDC_PROTOCOL_USB_EEM 0x07 // Ethernet Emulation Model
47 
48 // CDC Commands defined by CDC 1.2
49 #define CDC_SEND_ENCAPSULATED_COMMAND 0x00
50 #define CDC_GET_ENCAPSULATED_RESPONSE 0x01
51 
52 // CDC Commands defined by PSTN 1.2
53 #define CDC_SET_COMM_FEATURE 0x02
54 #define CDC_GET_COMM_FEATURE 0x03
55 #define CDC_CLEAR_COMM_FEATURE 0x04
56 #define CDC_SET_AUX_LINE_STATE 0x10
57 #define CDC_SET_HOOK_STATE 0x11
58 #define CDC_PULSE_SETUP 0x12
59 #define CDC_SEND_PULSE 0x13
60 #define CDC_SET_PULSE_TIME 0x14
61 #define CDC_RING_AUX_JACK 0x15
62 #define CDC_SET_LINE_CODING 0x20
63 #define CDC_GET_LINE_CODING 0x21
64 #define CDC_SET_CONTROL_LINE_STATE 0x22
65 #define CDC_SEND_BREAK 0x23
66 #define CDC_SET_RINGER_PARMS 0x30
67 #define CDC_GET_RINGER_PARMS 0x31
68 #define CDC_SET_OPERATION_PARMS 0x32
69 #define CDC_GET_OPERATION_PARMS 0x33
70 #define CDC_SET_LINE_PARMS 0x34
71 #define CDC_GET_LINE_PARMS 0x35
72 #define CDC_DIAL_DIGITS 0x36
73 
74 //Class-Specific Notification Codes
75 #define NETWORK_CONNECTION 0x00
76 #define RESPONSE_AVAILABLE 0x01
77 #define AUX_JACK_HOOK_STATE 0x08
78 #define RING_DETECT 0x09
79 #define SERIAL_STATE 0x20
80 #define CALL_STATE_CHANGE 0x28
81 #define LINE_STATE_CHANGE 0x29
82 #define CONNECTION_SPEED_CHANGE 0x2a
83 
84 // CDC Functional Descriptor Structures
85 
86 typedef struct {
87  uint8_t bFunctionLength;
88  uint8_t bDescriptorType;
90  uint8_t bmCapabilities;
91  uint8_t bDataInterface;
93 
94 typedef struct {
95  uint8_t bFunctionLength;
96  uint8_t bDescriptorType;
98  uint8_t bmCapabilities;
101 
102 typedef struct {
109 
110 typedef struct {
111  uint32_t dwDTERate; // Data Terminal Rate in bits per second
112  uint8_t bCharFormat; // 0 - 1 stop bit, 1 - 1.5 stop bits, 2 - 2 stop bits
113  uint8_t bParityType; // 0 - None, 1 - Odd, 2 - Even, 3 - Mark, 4 - Space
114  uint8_t bDataBits; // Data bits (5, 6, 7, 8 or 16)
115 } LINE_CODING;
116 
117 typedef struct {
118  uint8_t bmRequestType; // 0xa1 for class-specific notifications
119  uint8_t bNotification;
120  uint16_t wValue;
121  uint16_t wIndex;
122  uint16_t wLength;
123  uint16_t bmState; //UART state bitmap for SERIAL_STATE, other notifications variable length
125 
126 class ACM;
127 
129 public:
130 
131  virtual uint8_t OnInit(ACM *pacm) {
132  return 0;
133  };
134  //virtual void OnDataRcvd(ACM *pacm, uint8_t nbytes, uint8_t *dataptr) = 0;
135  //virtual void OnDisconnected(ACM *pacm) = 0;
136 };
137 
143 typedef struct {
144 
145  union {
146  uint8_t tty;
147 
148  struct {
149  bool enhanced : 1; // Do we have the ability to set/clear any features?
150  // Status and 8th bit in data stream.
151  // Presence only indicates feature is available, but this isn't used for CDC-ACM.
152  bool wide : 1;
153  bool autoflow_RTS : 1; // Has autoflow on RTS/CTS
154  bool autoflow_DSR : 1; // Has autoflow on DTR/DSR
155  bool autoflow_XON : 1; // Has autoflow XON/XOFF
156  bool half_duplex : 1; // Has half-duplex capability.
157  } __attribute__((packed));
158  };
159 } tty_features;
160 
161 #define ACM_MAX_ENDPOINTS 4
162 
163 class ACM : public USBDeviceConfig, public UsbConfigXtracter {
164 protected:
165  static const uint8_t epDataInIndex; // DataIn endpoint index
166  static const uint8_t epDataOutIndex; // DataOUT endpoint index
167  static const uint8_t epInterruptInIndex; // InterruptIN endpoint index
168 
171  uint8_t bAddress;
172  uint8_t bConfNum; // configuration number
173  uint8_t bControlIface; // Control interface value
174  uint8_t bDataIface; // Data interface value
175  uint8_t bNumEP; // total number of EP in the configuration
176  uint32_t qNextPollTime; // next poll time
177  volatile bool bPollEnable; // poll enable flag
178  volatile bool ready; //device ready indicator
179  tty_features _enhanced_status; // current status
180 
182 
183  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
184 
185 public:
186  ACM(USB *pusb, CDCAsyncOper *pasync);
187 
188  uint8_t SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr);
189  uint8_t GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr);
190  uint8_t ClearCommFeature(uint16_t fid);
191  uint8_t SetLineCoding(const LINE_CODING *dataptr);
192  uint8_t GetLineCoding(LINE_CODING *dataptr);
193  uint8_t SetControlLineState(uint8_t state);
194  uint8_t SendBreak(uint16_t duration);
195  uint8_t GetNotif(uint16_t *bytes_rcvd, uint8_t *dataptr);
196 
197  // Methods for receiving and sending data
198  uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr);
199  uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
200 
201  // USBDeviceConfig implementation
202  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
203  uint8_t Release();
204  uint8_t Poll();
205 
206  bool available(void) {
207  return false;
208  };
209 
210  virtual uint8_t GetAddress() {
211  return bAddress;
212  };
213 
214  virtual bool isReady() {
215  return ready;
216  };
217 
219  return _enhanced_status;
220  };
221 
223  tty_features rv;
224  rv.enhanced = false;
225  rv.autoflow_RTS = false;
226  rv.autoflow_DSR = false;
227  rv.autoflow_XON = false;
228  rv.half_duplex = false;
229  rv.wide = false;
230  return rv;
231  };
232 
233  virtual void autoflowRTS(bool s) {
234  };
235 
236  virtual void autoflowDSR(bool s) {
237  };
238 
239  virtual void autoflowXON(bool s) {
240  };
241 
242  virtual void half_duplex(bool s) {
243  };
244 
245  virtual void wide(bool s) {
246  };
247 
248  // UsbConfigXtracter implementation
249  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
250 };
251 
252 #endif // __CDCACM_H__
uint16_t wIndex
Definition: cdcacm.h:121
-
virtual tty_features enhanced_features(void)
Definition: cdcacm.h:222
-
bool available(void)
Definition: cdcacm.h:206
+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 #if !defined(__CDCACM_H__)
18 #define __CDCACM_H__
19 
20 #include "Usb.h"
21 
22 #define bmREQ_CDCOUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
23 #define bmREQ_CDCIN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
24 
25 // CDC Subclass Constants
26 #define CDC_SUBCLASS_DLCM 0x01 // Direct Line Control Model
27 #define CDC_SUBCLASS_ACM 0x02 // Abstract Control Model
28 #define CDC_SUBCLASS_TCM 0x03 // Telephone Control Model
29 #define CDC_SUBCLASS_MCCM 0x04 // Multi Channel Control Model
30 #define CDC_SUBCLASS_CAPI 0x05 // CAPI Control Model
31 #define CDC_SUBCLASS_ETHERNET 0x06 // Ethernet Network Control Model
32 #define CDC_SUBCLASS_ATM 0x07 // ATM Network Control Model
33 #define CDC_SUBCLASS_WIRELESS_HANDSET 0x08 // Wireless Handset Control Model
34 #define CDC_SUBCLASS_DEVICE_MANAGEMENT 0x09 // Device Management
35 #define CDC_SUBCLASS_MOBILE_DIRECT_LINE 0x0A // Mobile Direct Line Model
36 #define CDC_SUBCLASS_OBEX 0x0B // OBEX
37 #define CDC_SUBCLASS_ETHERNET_EMU 0x0C // Ethernet Emulation Model
38 
39 // Communication Interface Class Control Protocol Codes
40 #define CDC_PROTOCOL_ITU_T_V_250 0x01 // AT Commands defined by ITU-T V.250
41 #define CDC_PROTOCOL_PCCA_101 0x02 // AT Commands defined by PCCA-101
42 #define CDC_PROTOCOL_PCCA_101_O 0x03 // AT Commands defined by PCCA-101 & Annex O
43 #define CDC_PROTOCOL_GSM_7_07 0x04 // AT Commands defined by GSM 7.07
44 #define CDC_PROTOCOL_3GPP_27_07 0x05 // AT Commands defined by 3GPP 27.007
45 #define CDC_PROTOCOL_C_S0017_0 0x06 // AT Commands defined by TIA for CDMA
46 #define CDC_PROTOCOL_USB_EEM 0x07 // Ethernet Emulation Model
47 
48 // CDC Commands defined by CDC 1.2
49 #define CDC_SEND_ENCAPSULATED_COMMAND 0x00
50 #define CDC_GET_ENCAPSULATED_RESPONSE 0x01
51 
52 // CDC Commands defined by PSTN 1.2
53 #define CDC_SET_COMM_FEATURE 0x02
54 #define CDC_GET_COMM_FEATURE 0x03
55 #define CDC_CLEAR_COMM_FEATURE 0x04
56 #define CDC_SET_AUX_LINE_STATE 0x10
57 #define CDC_SET_HOOK_STATE 0x11
58 #define CDC_PULSE_SETUP 0x12
59 #define CDC_SEND_PULSE 0x13
60 #define CDC_SET_PULSE_TIME 0x14
61 #define CDC_RING_AUX_JACK 0x15
62 #define CDC_SET_LINE_CODING 0x20
63 #define CDC_GET_LINE_CODING 0x21
64 #define CDC_SET_CONTROL_LINE_STATE 0x22
65 #define CDC_SEND_BREAK 0x23
66 #define CDC_SET_RINGER_PARMS 0x30
67 #define CDC_GET_RINGER_PARMS 0x31
68 #define CDC_SET_OPERATION_PARMS 0x32
69 #define CDC_GET_OPERATION_PARMS 0x33
70 #define CDC_SET_LINE_PARMS 0x34
71 #define CDC_GET_LINE_PARMS 0x35
72 #define CDC_DIAL_DIGITS 0x36
73 
74 //Class-Specific Notification Codes
75 #define NETWORK_CONNECTION 0x00
76 #define RESPONSE_AVAILABLE 0x01
77 #define AUX_JACK_HOOK_STATE 0x08
78 #define RING_DETECT 0x09
79 #define SERIAL_STATE 0x20
80 #define CALL_STATE_CHANGE 0x28
81 #define LINE_STATE_CHANGE 0x29
82 #define CONNECTION_SPEED_CHANGE 0x2a
83 
84 // CDC Functional Descriptor Structures
85 
86 typedef struct {
87  uint8_t bFunctionLength;
88  uint8_t bDescriptorType;
90  uint8_t bmCapabilities;
91  uint8_t bDataInterface;
93 
94 typedef struct {
95  uint8_t bFunctionLength;
96  uint8_t bDescriptorType;
98  uint8_t bmCapabilities;
101 
102 typedef struct {
109 
110 typedef struct {
111  uint32_t dwDTERate; // Data Terminal Rate in bits per second
112  uint8_t bCharFormat; // 0 - 1 stop bit, 1 - 1.5 stop bits, 2 - 2 stop bits
113  uint8_t bParityType; // 0 - None, 1 - Odd, 2 - Even, 3 - Mark, 4 - Space
114  uint8_t bDataBits; // Data bits (5, 6, 7, 8 or 16)
115 } LINE_CODING;
116 
117 typedef struct {
118  uint8_t bmRequestType; // 0xa1 for class-specific notifications
119  uint8_t bNotification;
120  uint16_t wValue;
121  uint16_t wIndex;
122  uint16_t wLength;
123  uint16_t bmState; //UART state bitmap for SERIAL_STATE, other notifications variable length
125 
126 class ACM;
127 
129 public:
130 
131  virtual uint8_t OnInit(ACM *pacm __attribute__((unused))) {
132  return 0;
133  };
134  //virtual void OnDataRcvd(ACM *pacm, uint8_t nbytes, uint8_t *dataptr) = 0;
135  //virtual void OnDisconnected(ACM *pacm) = 0;
136 };
137 
143 typedef struct {
144 
145  union {
146  uint8_t tty;
147 
148  struct {
149  bool enhanced : 1; // Do we have the ability to set/clear any features?
150  // Status and 8th bit in data stream.
151  // Presence only indicates feature is available, but this isn't used for CDC-ACM.
152  bool wide : 1;
153  bool autoflow_RTS : 1; // Has autoflow on RTS/CTS
154  bool autoflow_DSR : 1; // Has autoflow on DTR/DSR
155  bool autoflow_XON : 1; // Has autoflow XON/XOFF
156  bool half_duplex : 1; // Has half-duplex capability.
157  } __attribute__((packed));
158  };
159 } tty_features;
160 
161 #define ACM_MAX_ENDPOINTS 4
162 
163 class ACM : public USBDeviceConfig, public UsbConfigXtracter {
164 protected:
167  uint8_t bAddress;
168  uint8_t bConfNum; // configuration number
169  uint8_t bControlIface; // Control interface value
170  uint8_t bDataIface; // Data interface value
171  uint8_t bNumEP; // total number of EP in the configuration
172  uint32_t qNextPollTime; // next poll time
173  volatile bool bPollEnable; // poll enable flag
174  volatile bool ready; //device ready indicator
175  tty_features _enhanced_status; // current status
176 
178 
179 public:
180  static const uint8_t epDataInIndex; // DataIn endpoint index
181  static const uint8_t epDataOutIndex; // DataOUT endpoint index
182  static const uint8_t epInterruptInIndex; // InterruptIN endpoint index
184 
185  ACM(USB *pusb, CDCAsyncOper *pasync);
186 
187  uint8_t SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr);
188  uint8_t GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr);
189  uint8_t ClearCommFeature(uint16_t fid);
190  uint8_t SetLineCoding(const LINE_CODING *dataptr);
191  uint8_t GetLineCoding(LINE_CODING *dataptr);
192  uint8_t SetControlLineState(uint8_t state);
193  uint8_t SendBreak(uint16_t duration);
194  uint8_t GetNotif(uint16_t *bytes_rcvd, uint8_t *dataptr);
195 
196  // Methods for receiving and sending data
197  uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr);
198  uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
199 
200  // USBDeviceConfig implementation
201  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
202  uint8_t Release();
203  uint8_t Poll();
204 
205  bool available(void) {
206  return false;
207  };
208 
209  virtual uint8_t GetAddress() {
210  return bAddress;
211  };
212 
213  virtual bool isReady() {
214  return ready;
215  };
216 
218  return _enhanced_status;
219  };
220 
222  tty_features rv;
223  rv.enhanced = false;
224  rv.autoflow_RTS = false;
225  rv.autoflow_DSR = false;
226  rv.autoflow_XON = false;
227  rv.half_duplex = false;
228  rv.wide = false;
229  return rv;
230  };
231 
232  virtual void autoflowRTS(bool s __attribute__((unused))) {
233  };
234 
235  virtual void autoflowDSR(bool s __attribute__((unused))) {
236  };
237 
238  virtual void autoflowXON(bool s __attribute__((unused))) {
239  };
240 
241  virtual void half_duplex(bool s __attribute__((unused))) {
242  };
243 
244  virtual void wide(bool s __attribute__((unused))) {
245  };
246 
247  // UsbConfigXtracter implementation
248  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
249 };
250 
251 #endif // __CDCACM_H__
uint16_t wIndex
Definition: cdcacm.h:121
+
virtual tty_features enhanced_features(void)
Definition: cdcacm.h:221
+
bool available(void)
Definition: cdcacm.h:205
+
ACM(USB *pusb, CDCAsyncOper *pasync)
Definition: cdcacm.cpp:23
virtual uint8_t OnInit(ACM *pacm)
Definition: cdcacm.h:131
-
static const uint8_t epInterruptInIndex
Definition: cdcacm.h:167
-
virtual uint8_t GetAddress()
Definition: cdcacm.h:210
-
static const uint8_t epDataOutIndex
Definition: cdcacm.h:166
-
uint32_t qNextPollTime
Definition: cdcacm.h:176
+
static const uint8_t epInterruptInIndex
Definition: cdcacm.h:182
+
virtual uint8_t GetAddress()
Definition: cdcacm.h:209
+
static const uint8_t epDataOutIndex
Definition: cdcacm.h:181
+
uint32_t qNextPollTime
Definition: cdcacm.h:172
uint8_t bParityType
Definition: cdcacm.h:113
uint8_t bCharFormat
Definition: cdcacm.h:112
uint8_t bDataBits
Definition: cdcacm.h:114
uint8_t bNotification
Definition: cdcacm.h:119
-
uint8_t bControlIface
Definition: cdcacm.h:173
+
uint8_t bControlIface
Definition: cdcacm.h:169
uint16_t wValue
Definition: cdcacm.h:120
- -
volatile bool ready
Definition: cdcacm.h:178
-
uint8_t bDataIface
Definition: cdcacm.h:174
-
USB * pUsb
Definition: cdcacm.h:169
+ +
volatile bool ready
Definition: cdcacm.h:174
+
uint8_t bDataIface
Definition: cdcacm.h:170
+
USB * pUsb
Definition: cdcacm.h:165
uint8_t bDataInterface
Definition: cdcacm.h:91
uint8_t bDescriptorType
Definition: cdcacm.h:88
-
virtual void autoflowRTS(bool s)
Definition: cdcacm.h:233
-
uint8_t bNumEP
Definition: cdcacm.h:175
+
virtual void autoflowRTS(bool s)
Definition: cdcacm.h:232
+
uint8_t bNumEP
Definition: cdcacm.h:171
- +
EpInfo epInfo[ACM_MAX_ENDPOINTS]
Definition: cdcacm.h:183
+
uint8_t tty
Definition: cdcacm.h:146
uint8_t bFunctionLength
Definition: cdcacm.h:95
-
virtual tty_features enhanced_status(void)
Definition: cdcacm.h:218
+
virtual tty_features enhanced_status(void)
Definition: cdcacm.h:217
uint8_t bDescriptorSubtype
Definition: cdcacm.h:89
uint8_t bNumRingerPatterns
Definition: cdcacm.h:107
uint8_t bDescriptorSubtype
Definition: cdcacm.h:97
uint16_t bmState
Definition: cdcacm.h:123
-
CDCAsyncOper * pAsync
Definition: cdcacm.h:170
+
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
Definition: cdcacm.cpp:352
+
CDCAsyncOper * pAsync
Definition: cdcacm.h:166
#define ACM_MAX_ENDPOINTS
Definition: cdcacm.h:161
-
virtual void wide(bool s)
Definition: cdcacm.h:245
+
virtual void wide(bool s)
Definition: cdcacm.h:244
+
uint8_t GetLineCoding(LINE_CODING *dataptr)
Definition: cdcacm.cpp:328
uint8_t bDescriptorType
Definition: cdcacm.h:96
bool enhanced
Definition: cdcacm.h:149
bool wide
Definition: cdcacm.h:152
-
virtual void autoflowXON(bool s)
Definition: cdcacm.h:239
+
virtual void autoflowXON(bool s)
Definition: cdcacm.h:238
uint8_t bRingerVolSteps
Definition: cdcacm.h:106
bool autoflow_XON
Definition: cdcacm.h:155
+
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
Definition: cdcacm.cpp:288
bool autoflow_RTS
Definition: cdcacm.h:153
-
Definition: address.h:32
+
uint8_t Poll()
Definition: cdcacm.cpp:272
+
Definition: address.h:39
uint8_t bmCapabilities
Definition: cdcacm.h:98
uint8_t bDescriptorSubtype
Definition: cdcacm.h:105
+
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: cdcacm.cpp:46
uint8_t bmRequestType
Definition: cdcacm.h:118
bool autoflow_DSR
Definition: cdcacm.h:154
-
static const uint8_t epDataInIndex
Definition: cdcacm.h:165
-
virtual void autoflowDSR(bool s)
Definition: cdcacm.h:236
-
uint8_t bAddress
Definition: cdcacm.h:171
+
static const uint8_t epDataInIndex
Definition: cdcacm.h:180
+
virtual void autoflowDSR(bool s)
Definition: cdcacm.h:235
+
uint8_t bAddress
Definition: cdcacm.h:167
-
virtual bool isReady()
Definition: cdcacm.h:214
- +
virtual bool isReady()
Definition: cdcacm.h:213
+
uint8_t SetLineCoding(const LINE_CODING *dataptr)
Definition: cdcacm.cpp:320
+
uint8_t bFunctionLength
Definition: cdcacm.h:103
struct ACM_FUNC_DESCR TEL_CALL_STATE_REP_CPBL_FUNC_DESCR
+
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: cdcacm.cpp:231
+
uint8_t SendBreak(uint16_t duration)
Definition: cdcacm.cpp:344
uint16_t wLength
Definition: cdcacm.h:122
+
uint8_t GetNotif(uint16_t *bytes_rcvd, uint8_t *dataptr)
uint32_t dwDTERate
Definition: cdcacm.h:111
+
uint8_t GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)
Definition: cdcacm.cpp:304
bool half_duplex
Definition: cdcacm.h:156
-
uint8_t bConfNum
Definition: cdcacm.h:172
+
uint8_t Release()
Definition: cdcacm.cpp:258
+
uint8_t bConfNum
Definition: cdcacm.h:168
struct ACM_FUNC_DESCR TEL_OPER_MODES_FUNC_DESCR
-
Definition: UsbCore.h:197
-
volatile bool bPollEnable
Definition: cdcacm.h:177
+
Definition: UsbCore.h:208
+
volatile bool bPollEnable
Definition: cdcacm.h:173
Definition: cdcacm.h:163
uint8_t bDescriptorType
Definition: cdcacm.h:104
-
tty_features _enhanced_status
Definition: cdcacm.h:179
+
tty_features _enhanced_status
Definition: cdcacm.h:175
+
uint8_t SetControlLineState(uint8_t state)
Definition: cdcacm.cpp:336
+
uint8_t SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)
Definition: cdcacm.cpp:296
+
uint8_t ClearCommFeature(uint16_t fid)
Definition: cdcacm.cpp:312
struct ACM_FUNC_DESCR DLM_FUNC_DESCR
-
virtual void half_duplex(bool s)
Definition: cdcacm.h:242
+
virtual void half_duplex(bool s)
Definition: cdcacm.h:241
uint8_t bFunctionLength
Definition: cdcacm.h:87
uint8_t bmCapabilities
Definition: cdcacm.h:90
+
uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr)
Definition: cdcacm.cpp:280
diff --git a/cdcftdi_8cpp.html b/cdcftdi_8cpp.html index 71bea6e7..3ab7765a 100644 --- a/cdcftdi_8cpp.html +++ b/cdcftdi_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcftdi.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/cdcftdi_8cpp__incl.md5 b/cdcftdi_8cpp__incl.md5 index f6dd1fa8..c172e2fa 100644 --- a/cdcftdi_8cpp__incl.md5 +++ b/cdcftdi_8cpp__incl.md5 @@ -1 +1 @@ -e865f32d985af2b4d5e2da82e7c52bae \ No newline at end of file +5aa4a4ebba11b439405ccd1452ff839b \ No newline at end of file diff --git a/cdcftdi_8cpp__incl.png b/cdcftdi_8cpp__incl.png index be6e12a6..c1892317 100644 Binary files a/cdcftdi_8cpp__incl.png and b/cdcftdi_8cpp__incl.png differ diff --git a/cdcftdi_8cpp_source.html b/cdcftdi_8cpp_source.html index b6d33ee2..f3078532 100644 --- a/cdcftdi_8cpp_source.html +++ b/cdcftdi_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcftdi.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
cdcftdi.cpp
-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 #include "cdcftdi.h"
18 
19 const uint8_t FTDI::epDataInIndex = 1;
20 const uint8_t FTDI::epDataOutIndex = 2;
21 const uint8_t FTDI::epInterruptInIndex = 3;
22 
23 FTDI::FTDI(USB *p, FTDIAsyncOper *pasync, uint16_t idProduct) :
24 pAsync(pasync),
25 pUsb(p),
26 bAddress(0),
27 bNumEP(1),
28 wFTDIType(0),
29 wIdProduct(idProduct) {
30  for(uint8_t i = 0; i < FTDI_MAX_ENDPOINTS; i++) {
31  epInfo[i].epAddr = 0;
32  epInfo[i].maxPktSize = (i) ? 0 : 8;
33  epInfo[i].bmSndToggle = 0;
34  epInfo[i].bmRcvToggle = 0;
35  epInfo[i].bmNakPower = (i==epDataInIndex) ? USB_NAK_NOWAIT: USB_NAK_MAX_POWER;
36  }
37  if(pUsb)
38  pUsb->RegisterDeviceClass(this);
39 }
40 
41 uint8_t FTDI::Init(uint8_t parent, uint8_t port, bool lowspeed) {
42  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
43 
44  uint8_t buf[constBufSize];
45  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
46  uint8_t rcode;
47  UsbDevice *p = NULL;
48  EpInfo *oldep_ptr = NULL;
49 
50  uint8_t num_of_conf; // number of configurations
51 
52  AddressPool &addrPool = pUsb->GetAddressPool();
53 
54  USBTRACE("FTDI Init\r\n");
55 
56  if(bAddress)
58 
59  // Get pointer to pseudo device with address 0 assigned
60  p = addrPool.GetUsbDevicePtr(0);
61 
62  if(!p)
64 
65  if(!p->epinfo) {
66  USBTRACE("epinfo\r\n");
68  }
69 
70  // Save old pointer to EP_RECORD of address 0
71  oldep_ptr = p->epinfo;
72 
73  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
74  p->epinfo = epInfo;
75 
76  p->lowspeed = lowspeed;
77 
78  // Get device descriptor
79  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), buf);
80 
81  // Restore p->epinfo
82  p->epinfo = oldep_ptr;
83 
84  if(rcode)
85  goto FailGetDevDescr;
86  if(udd->idVendor != FTDI_VID || udd->idProduct != wIdProduct)
87  {
88  USBTRACE("FTDI Init: Product not supported\r\n");
89  USBTRACE2("Expected VID:", FTDI_VID);
90  USBTRACE2("Found VID:", udd->idVendor);
91 
92  USBTRACE2("Expected PID:", wIdProduct);
93  USBTRACE2("Found PID:", udd->idProduct);
95  }
96 
97  // Save type of FTDI chip
98  wFTDIType = udd->bcdDevice;
99 
100  // Allocate new address according to device class
101  bAddress = addrPool.AllocAddress(parent, false, port);
102 
103  if(!bAddress)
105 
106  // Extract Max Packet Size from the device descriptor
107  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
108 
109  // Assign new address to the device
110  rcode = pUsb->setAddr(0, 0, bAddress);
111 
112  if(rcode) {
113  p->lowspeed = false;
114  addrPool.FreeAddress(bAddress);
115  bAddress = 0;
116  USBTRACE2("setAddr:", rcode);
117  return rcode;
118  }
119 
120  USBTRACE2("Addr:", bAddress);
121 
122  p->lowspeed = false;
123 
124  p = addrPool.GetUsbDevicePtr(bAddress);
125 
126  if(!p)
128 
129  p->lowspeed = lowspeed;
130 
131  num_of_conf = udd->bNumConfigurations;
132 
133  // Assign epInfo to epinfo pointer
134  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
135 
136  if(rcode)
137  goto FailSetDevTblEntry;
138 
139  USBTRACE2("NC:", num_of_conf);
140 
141  for(uint8_t i = 0; i < num_of_conf; i++) {
144 
145  rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
146 
147  if(rcode)
148  goto FailGetConfDescr;
149 
150  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
151 
152  if(rcode)
153  goto FailGetConfDescr;
154 
155  if(bNumEP > 1)
156  break;
157  } // for
158 
159  if(bNumEP < 2)
161 
162  USBTRACE2("NumEP:", bNumEP);
163 
164  // Assign epInfo to epinfo pointer
165  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
166 
167  USBTRACE2("Conf:", bConfNum);
168 
169  // Set Configuration Value
170  rcode = pUsb->setConf(bAddress, 0, bConfNum);
171 
172  if(rcode)
173  goto FailSetConfDescr;
174 
175  rcode = pAsync->OnInit(this);
176 
177  if(rcode)
178  goto FailOnInit;
179 
180  USBTRACE("FTDI configured\r\n");
181 
182  bPollEnable = true;
183  return 0;
184 
185 FailGetDevDescr:
186 #ifdef DEBUG_USB_HOST
188  goto Fail;
189 #endif
190 
191 FailSetDevTblEntry:
192 #ifdef DEBUG_USB_HOST
194  goto Fail;
195 #endif
196 
197 FailGetConfDescr:
198 #ifdef DEBUG_USB_HOST
200  goto Fail;
201 #endif
202 
203 FailSetConfDescr:
204 #ifdef DEBUG_USB_HOST
206  goto Fail;
207 #endif
208 
209 FailOnInit:
210 #ifdef DEBUG_USB_HOST
211  USBTRACE("OnInit:");
212 
213 Fail:
214  NotifyFail(rcode);
215 #endif
216  Release();
217  return rcode;
218 }
219 
220 void FTDI::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
221  ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
222  ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
223  ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
224 
225  bConfNum = conf;
226 
227  uint8_t index;
228 
229  if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
230  index = epInterruptInIndex;
231  else
232  if((pep->bmAttributes & 0x02) == 2)
233  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
234  else
235  return;
236 
237  // Fill in the endpoint info structure
238  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
239  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
240  epInfo[index].bmSndToggle = 0;
241  epInfo[index].bmRcvToggle = 0;
242 
243  bNumEP++;
244 
245  PrintEndpointDescriptor(pep);
246 }
247 
248 uint8_t FTDI::Release() {
249  pUsb->GetAddressPool().FreeAddress(bAddress);
250 
251  bAddress = 0;
252  bNumEP = 1;
253  qNextPollTime = 0;
254  bPollEnable = false;
255  return pAsync->OnRelease(this);
256 }
257 
258 uint8_t FTDI::Poll() {
259  uint8_t rcode = 0;
260 
261  //if (!bPollEnable)
262  // return 0;
263 
264  //if (qNextPollTime <= millis())
265  //{
266  // USB_HOST_SERIAL.println(bAddress, HEX);
267 
268  // qNextPollTime = millis() + 100;
269  //}
270  return rcode;
271 }
272 
273 uint8_t FTDI::SetBaudRate(uint32_t baud) {
274  uint16_t baud_value, baud_index = 0;
275  uint32_t divisor3;
276 
277  divisor3 = 48000000 / 2 / baud; // divisor shifted 3 bits to the left
278 
279  if(wFTDIType == FT232AM) {
280  if((divisor3 & 0x7) == 7)
281  divisor3++; // round x.7/8 up to x+1
282 
283  baud_value = divisor3 >> 3;
284  divisor3 &= 0x7;
285 
286  if(divisor3 == 1) baud_value |= 0xc000;
287  else // 0.125
288  if(divisor3 >= 4) baud_value |= 0x4000;
289  else // 0.5
290  if(divisor3 != 0) baud_value |= 0x8000; // 0.25
291  if(baud_value == 1) baud_value = 0; /* special case for maximum baud rate */
292  } else {
293  static const unsigned char divfrac [8] = {0, 3, 2, 0, 1, 1, 2, 3};
294  static const unsigned char divindex[8] = {0, 0, 0, 1, 0, 1, 1, 1};
295 
296  baud_value = divisor3 >> 3;
297  baud_value |= divfrac [divisor3 & 0x7] << 14;
298  baud_index = divindex[divisor3 & 0x7];
299 
300  /* Deal with special cases for highest baud rates. */
301  if(baud_value == 1) baud_value = 0;
302  else // 1.0
303  if(baud_value == 0x4001) baud_value = 1; // 1.5
304  }
305  USBTRACE2("baud_value:", baud_value);
306  USBTRACE2("baud_index:", baud_index);
307  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_BAUD_RATE, baud_value & 0xff, baud_value >> 8, baud_index, 0, 0, NULL, NULL);
308 }
309 
310 uint8_t FTDI::SetModemControl(uint16_t signal) {
311  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_MODEM_CTRL, signal & 0xff, signal >> 8, 0, 0, 0, NULL, NULL);
312 }
313 
314 uint8_t FTDI::SetFlowControl(uint8_t protocol, uint8_t xon, uint8_t xoff) {
315  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_FLOW_CTRL, xon, xoff, protocol << 8, 0, 0, NULL, NULL);
316 }
317 
318 uint8_t FTDI::SetData(uint16_t databm) {
319  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_DATA, databm & 0xff, databm >> 8, 0, 0, 0, NULL, NULL);
320 }
321 
322 uint8_t FTDI::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
323  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
324 }
325 
326 uint8_t FTDI::SndData(uint16_t nbytes, uint8_t *dataptr) {
327  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
328 }
329 
330 void FTDI::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
331  Notify(PSTR("Endpoint descriptor:"), 0x80);
332  Notify(PSTR("\r\nLength:\t\t"), 0x80);
333  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
334  Notify(PSTR("\r\nType:\t\t"), 0x80);
335  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
336  Notify(PSTR("\r\nAddress:\t"), 0x80);
337  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
338  Notify(PSTR("\r\nAttributes:\t"), 0x80);
339  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
340  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
341  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
342  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
343  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
344  Notify(PSTR("\r\n"), 0x80);
345 }
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
-
uint8_t bmRcvToggle
Definition: address.h:41
- +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 #include "cdcftdi.h"
18 
19 const uint8_t FTDI::epDataInIndex = 1;
20 const uint8_t FTDI::epDataOutIndex = 2;
21 const uint8_t FTDI::epInterruptInIndex = 3;
22 
23 FTDI::FTDI(USB *p, FTDIAsyncOper *pasync, uint16_t idProduct) :
24 pAsync(pasync),
25 pUsb(p),
26 bAddress(0),
27 bNumEP(1),
28 wFTDIType(0),
29 wIdProduct(idProduct) {
30  for(uint8_t i = 0; i < FTDI_MAX_ENDPOINTS; i++) {
31  epInfo[i].epAddr = 0;
32  epInfo[i].maxPktSize = (i) ? 0 : 8;
33  epInfo[i].bmSndToggle = 0;
34  epInfo[i].bmRcvToggle = 0;
35  epInfo[i].bmNakPower = (i==epDataInIndex) ? USB_NAK_NOWAIT: USB_NAK_MAX_POWER;
36  }
37  if(pUsb)
38  pUsb->RegisterDeviceClass(this);
39 }
40 
41 uint8_t FTDI::Init(uint8_t parent, uint8_t port, bool lowspeed) {
42  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
43 
44  uint8_t buf[constBufSize];
45  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
46  uint8_t rcode;
47  UsbDevice *p = NULL;
48  EpInfo *oldep_ptr = NULL;
49 
50  uint8_t num_of_conf; // number of configurations
51 
52  AddressPool &addrPool = pUsb->GetAddressPool();
53 
54  USBTRACE("FTDI Init\r\n");
55 
56  if(bAddress) {
57  USBTRACE("FTDI CLASS IN USE??\r\n");
59  }
60  // Get pointer to pseudo device with address 0 assigned
61  p = addrPool.GetUsbDevicePtr(0);
62 
63  if(!p) {
64  USBTRACE("FTDI NO ADDRESS??\r\n");
66  }
67  if(!p->epinfo) {
68  USBTRACE("epinfo\r\n");
70  }
71 
72  // Save old pointer to EP_RECORD of address 0
73  oldep_ptr = p->epinfo;
74 
75  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
76  p->epinfo = epInfo;
77 
78  p->lowspeed = lowspeed;
79 
80  // Get device descriptor
81  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), buf);
82 
83  // Restore p->epinfo
84  p->epinfo = oldep_ptr;
85 
86  if(rcode) {
87  goto FailGetDevDescr;
88  }
89  if(udd->idVendor != FTDI_VID || udd->idProduct != wIdProduct)
90  {
91  USBTRACE("FTDI Init: Product not supported\r\n");
92  USBTRACE2("Expected VID:", FTDI_VID);
93  USBTRACE2("Found VID:", udd->idVendor);
94 
95  USBTRACE2("Expected PID:", wIdProduct);
96  USBTRACE2("Found PID:", udd->idProduct);
98  }
99 
100  // Save type of FTDI chip
101  wFTDIType = udd->bcdDevice;
102 
103  // Allocate new address according to device class
104  bAddress = addrPool.AllocAddress(parent, false, port);
105 
106  if(!bAddress)
108 
109  // Extract Max Packet Size from the device descriptor
110  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
111 
112  // Assign new address to the device
113  rcode = pUsb->setAddr(0, 0, bAddress);
114 
115  if(rcode) {
116  p->lowspeed = false;
117  addrPool.FreeAddress(bAddress);
118  bAddress = 0;
119  USBTRACE2("setAddr:", rcode);
120  return rcode;
121  }
122 
123  USBTRACE2("Addr:", bAddress);
124 
125  p->lowspeed = false;
126 
127  p = addrPool.GetUsbDevicePtr(bAddress);
128 
129  if(!p)
131 
132  p->lowspeed = lowspeed;
133 
134  num_of_conf = udd->bNumConfigurations;
135 
136  // Assign epInfo to epinfo pointer
137  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
138 
139  if(rcode)
140  goto FailSetDevTblEntry;
141 
142  USBTRACE2("NC:", num_of_conf);
143 
144  for(uint8_t i = 0; i < num_of_conf; i++) {
146 
147  // This interferes with serial output, and should be opt-in for debugging.
148  //HexDumper<USBReadParser, uint16_t, uint16_t> HexDump;
149  //rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
150  //if(rcode)
151  // goto FailGetConfDescr;
152 
153  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
154 
155  if(rcode)
156  goto FailGetConfDescr;
157 
158  if(bNumEP > 1)
159  break;
160  } // for
161 
162  if(bNumEP < 2)
164 
165  USBTRACE2("NumEP:", bNumEP);
166 
167  // Assign epInfo to epinfo pointer
168  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
169 
170  USBTRACE2("Conf:", bConfNum);
171 
172  // Set Configuration Value
173  rcode = pUsb->setConf(bAddress, 0, bConfNum);
174 
175  if(rcode)
176  goto FailSetConfDescr;
177 
178  rcode = pAsync->OnInit(this);
179 
180  if(rcode)
181  goto FailOnInit;
182 
183  USBTRACE("FTDI configured\r\n");
184 
185  ready = true;
186  return 0;
187 
188 FailGetDevDescr:
189 #ifdef DEBUG_USB_HOST
191  goto Fail;
192 #endif
193 
194 FailSetDevTblEntry:
195 #ifdef DEBUG_USB_HOST
197  goto Fail;
198 #endif
199 
200 FailGetConfDescr:
201 #ifdef DEBUG_USB_HOST
203  goto Fail;
204 #endif
205 
206 FailSetConfDescr:
207 #ifdef DEBUG_USB_HOST
209  goto Fail;
210 #endif
211 
212 FailOnInit:
213 #ifdef DEBUG_USB_HOST
214  USBTRACE("OnInit:");
215 
216 Fail:
217  NotifyFail(rcode);
218 #endif
219  Release();
220  return rcode;
221 }
222 
223 void FTDI::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *pep) {
224  ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
225  ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
226  ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
227 
228  bConfNum = conf;
229 
230  uint8_t index;
231 
232  if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
233  index = epInterruptInIndex;
235  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
236  else
237  return;
238 
239  // Fill in the endpoint info structure
240  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
241  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
242  epInfo[index].bmSndToggle = 0;
243  epInfo[index].bmRcvToggle = 0;
244 
245  bNumEP++;
246 
247  PrintEndpointDescriptor(pep);
248 }
249 
250 uint8_t FTDI::Release() {
251  pUsb->GetAddressPool().FreeAddress(bAddress);
252 
253  bAddress = 0;
254  bNumEP = 1;
255  qNextPollTime = 0;
256  bPollEnable = false;
257  ready = false;
258  return pAsync->OnRelease(this);
259 }
260 
261 uint8_t FTDI::Poll() {
262  uint8_t rcode = 0;
263 
264  //if (!bPollEnable)
265  // return 0;
266 
267  //if (qNextPollTime <= (uint32_t)millis())
268  //{
269  // USB_HOST_SERIAL.println(bAddress, HEX);
270 
271  // qNextPollTime = (uint32_t)millis() + 100;
272  //}
273  return rcode;
274 }
275 
276 uint8_t FTDI::SetBaudRate(uint32_t baud) {
277  uint16_t baud_value, baud_index = 0;
278  uint32_t divisor3;
279  divisor3 = 48000000 / 2 / baud; // divisor shifted 3 bits to the left
280 
281  if(wFTDIType == FT232AM) {
282  if((divisor3 & 0x7) == 7)
283  divisor3++; // round x.7/8 up to x+1
284 
285  baud_value = divisor3 >> 3;
286  divisor3 &= 0x7;
287 
288  if(divisor3 == 1) baud_value |= 0xc000;
289  else // 0.125
290  if(divisor3 >= 4) baud_value |= 0x4000;
291  else // 0.5
292  if(divisor3 != 0) baud_value |= 0x8000; // 0.25
293  if(baud_value == 1) baud_value = 0; /* special case for maximum baud rate */
294  } else {
295  static const uint8_t divfrac [8] = {0, 3, 2, 0, 1, 1, 2, 3};
296  static const uint8_t divindex[8] = {0, 0, 0, 1, 0, 1, 1, 1};
297 
298  baud_value = divisor3 >> 3;
299  baud_value |= divfrac [divisor3 & 0x7] << 14;
300  baud_index = divindex[divisor3 & 0x7];
301 
302  /* Deal with special cases for highest baud rates. */
303  if(baud_value == 1) baud_value = 0;
304  else // 1.0
305  if(baud_value == 0x4001) baud_value = 1; // 1.5
306  }
307  USBTRACE2("baud_value:", baud_value);
308  USBTRACE2("baud_index:", baud_index);
309  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_BAUD_RATE, baud_value & 0xff, baud_value >> 8, baud_index, 0, 0, NULL, NULL);
310  if(rv && rv != hrNAK) {
311  Release();
312  }
313  return rv;
314 }
315 
316 uint8_t FTDI::SetModemControl(uint16_t signal) {
317  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_MODEM_CTRL, signal & 0xff, signal >> 8, 0, 0, 0, NULL, NULL);
318  if(rv && rv != hrNAK) {
319  Release();
320  }
321  return rv;
322 }
323 
324 uint8_t FTDI::SetFlowControl(uint8_t protocol, uint8_t xon, uint8_t xoff) {
325  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_FLOW_CTRL, xon, xoff, protocol << 8, 0, 0, NULL, NULL);
326  if(rv && rv != hrNAK) {
327  Release();
328  }
329  return rv;
330 }
331 
332 uint8_t FTDI::SetData(uint16_t databm) {
333  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_DATA, databm & 0xff, databm >> 8, 0, 0, 0, NULL, NULL);
334  if(rv && rv != hrNAK) {
335  Release();
336  }
337  return rv;
338 }
339 
340 uint8_t FTDI::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
341  uint8_t rv = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
342  if(rv && rv != hrNAK) {
343  Release();
344  }
345  return rv;
346 }
347 
348 uint8_t FTDI::SndData(uint16_t nbytes, uint8_t *dataptr) {
349  uint8_t rv = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
350  if(rv && rv != hrNAK) {
351  Release();
352  }
353  return rv;
354 }
355 
356 void FTDI::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
357  Notify(PSTR("Endpoint descriptor:"), 0x80);
358  Notify(PSTR("\r\nLength:\t\t"), 0x80);
359  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
360  Notify(PSTR("\r\nType:\t\t"), 0x80);
361  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
362  Notify(PSTR("\r\nAddress:\t"), 0x80);
363  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
364  Notify(PSTR("\r\nAttributes:\t"), 0x80);
365  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
366  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
367  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
368  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
369  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
370  Notify(PSTR("\r\n"), 0x80);
371 }
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+
uint8_t bmRcvToggle
Definition: address.h:48
+
#define bmREQ_FTDI_OUT
Definition: cdcftdi.h:22
-
EpInfo * epinfo
Definition: address.h:76
-
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: cdcftdi.cpp:220
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
uint8_t SetBaudRate(uint32_t baud)
Definition: cdcftdi.cpp:273
-
uint8_t bmNakPower
Definition: address.h:42
+
EpInfo * epinfo
Definition: address.h:83
+
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: cdcftdi.cpp:223
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
uint8_t SetBaudRate(uint32_t baud)
Definition: cdcftdi.cpp:276
+
uint8_t bmNakPower
Definition: address.h:49
#define FT232AM
Definition: cdcftdi.h:31
- -
uint16_t bcdDevice
Definition: usb_ch9.h:108
-
uint8_t SetModemControl(uint16_t control)
Definition: cdcftdi.cpp:310
- - + +
uint16_t bcdDevice
Definition: usb_ch9.h:115
+
uint8_t SetModemControl(uint16_t control)
Definition: cdcftdi.cpp:316
+
#define FTDI_SIO_SET_BAUD_RATE
Definition: cdcftdi.h:40
- - - -
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:105
+ + + +
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:112
-
#define NotifyFail(...)
Definition: message.h:55
+
#define NotifyFail(...)
Definition: message.h:62
#define FTDI_SIO_SET_DATA
Definition: cdcftdi.h:41
-
uint8_t SetFlowControl(uint8_t protocol, uint8_t xon=0x11, uint8_t xoff=0x13)
Definition: cdcftdi.cpp:314
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
+
uint8_t SetFlowControl(uint8_t protocol, uint8_t xon=0x11, uint8_t xoff=0x13)
Definition: cdcftdi.cpp:324
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
-
uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
Definition: cdcftdi.cpp:322
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
+
uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
Definition: cdcftdi.cpp:340
virtual void FreeAddress(uint8_t addr)=0
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
#define Notify(...)
Definition: message.h:44
- - -
#define USBTRACE2(s, r)
Definition: macros.h:77
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
#define NotifyFailGetConfDescr(...)
Definition: message.h:52
-
uint8_t epAddr
Definition: address.h:33
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
+
#define Notify(...)
Definition: message.h:51
+ + +
#define USBTRACE2(s, r)
Definition: macros.h:84
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
#define NotifyFailGetConfDescr(...)
Definition: message.h:59
+
uint8_t epAddr
Definition: address.h:40
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct=FTDI_PID)
Definition: cdcftdi.cpp:23
-
uint8_t Poll()
Definition: cdcftdi.cpp:258
-
Definition: address.h:32
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
-
uint16_t wMaxPacketSize
Definition: usb_ch9.h:146
+
uint8_t Poll()
Definition: cdcftdi.cpp:261
+
Definition: address.h:39
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
+
#define hrNAK
Definition: max3421e.h:218
+
uint16_t wMaxPacketSize
Definition: usb_ch9.h:153
+
#define bmUSB_TRANSFER_TYPE
Definition: usb_ch9.h:94
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: cdcftdi.cpp:41
#define FTDI_SIO_SET_FLOW_CTRL
Definition: cdcftdi.h:39
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bEndpointAddress
Definition: usb_ch9.h:144
+
uint8_t bEndpointAddress
Definition: usb_ch9.h:151
virtual uint8_t OnInit(FTDI *pftdi)
Definition: cdcftdi.h:82
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
-
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
Definition: cdcftdi.cpp:326
- -
#define USB_NAK_NOWAIT
Definition: address.h:29
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
+
uint8_t bmSndToggle
Definition: address.h:47
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
+
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
Definition: cdcftdi.cpp:348
+ +
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
virtual uint8_t OnRelease(FTDI *pftdi)
Definition: cdcftdi.h:86
#define FTDI_VID
Definition: cdcftdi.h:28
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
-
uint8_t Release()
Definition: cdcftdi.cpp:248
-
uint16_t idProduct
Definition: usb_ch9.h:107
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
uint8_t bNumConfigurations
Definition: usb_ch9.h:112
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
+
uint8_t Release()
Definition: cdcftdi.cpp:250
+
uint16_t idProduct
Definition: usb_ch9.h:114
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
uint8_t bNumConfigurations
Definition: usb_ch9.h:119
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
#define FTDI_SIO_MODEM_CTRL
Definition: cdcftdi.h:38
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
Definition: UsbCore.h:197
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
-
uint8_t SetData(uint16_t databm)
Definition: cdcftdi.cpp:318
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
Definition: UsbCore.h:208
+
#define USB_TRANSFER_TYPE_BULK
Definition: usb_ch9.h:92
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
+
uint8_t SetData(uint16_t databm)
Definition: cdcftdi.cpp:332
#define FTDI_MAX_ENDPOINTS
Definition: cdcftdi.h:94
-
#define USBTRACE(s)
Definition: macros.h:75
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
- +
#define USBTRACE(s)
Definition: macros.h:82
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
diff --git a/cdcftdi_8h.html b/cdcftdi_8h.html index bad006db..0c6a5b3f 100644 --- a/cdcftdi_8h.html +++ b/cdcftdi_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcftdi.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ bmREQ_FTDI_OUT

+
@@ -220,11 +202,13 @@ Macros
-

Definition at line 22 of file cdcftdi.h.

+

Definition at line 22 of file cdcftdi.h.

- + +

◆ bmREQ_FTDI_IN

+
@@ -234,11 +218,13 @@ Macros
-

Definition at line 23 of file cdcftdi.h.

+

Definition at line 23 of file cdcftdi.h.

- + +

◆ FTDI_VID

+
@@ -248,11 +234,13 @@ Macros
-

Definition at line 28 of file cdcftdi.h.

+

Definition at line 28 of file cdcftdi.h.

- + +

◆ FTDI_PID

+
@@ -262,11 +250,13 @@ Macros
-

Definition at line 29 of file cdcftdi.h.

+

Definition at line 29 of file cdcftdi.h.

- + +

◆ FT232AM

+
@@ -276,11 +266,13 @@ Macros
-

Definition at line 31 of file cdcftdi.h.

+

Definition at line 31 of file cdcftdi.h.

- + +

◆ FT232BM

+
@@ -290,11 +282,13 @@ Macros
-

Definition at line 32 of file cdcftdi.h.

+

Definition at line 32 of file cdcftdi.h.

- + +

◆ FT2232

+
@@ -304,11 +298,13 @@ Macros
-

Definition at line 33 of file cdcftdi.h.

+

Definition at line 33 of file cdcftdi.h.

- + +

◆ FT232R

+
@@ -318,11 +314,13 @@ Macros
-

Definition at line 34 of file cdcftdi.h.

+

Definition at line 34 of file cdcftdi.h.

- + +

◆ FTDI_SIO_RESET

+
@@ -332,11 +330,13 @@ Macros
-

Definition at line 37 of file cdcftdi.h.

+

Definition at line 37 of file cdcftdi.h.

- + +

◆ FTDI_SIO_MODEM_CTRL

+
@@ -346,11 +346,13 @@ Macros
-

Definition at line 38 of file cdcftdi.h.

+

Definition at line 38 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_FLOW_CTRL

+
@@ -360,11 +362,13 @@ Macros
-

Definition at line 39 of file cdcftdi.h.

+

Definition at line 39 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_BAUD_RATE

+
@@ -374,11 +378,13 @@ Macros
-

Definition at line 40 of file cdcftdi.h.

+

Definition at line 40 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DATA

+
@@ -388,11 +394,13 @@ Macros
-

Definition at line 41 of file cdcftdi.h.

+

Definition at line 41 of file cdcftdi.h.

- + +

◆ FTDI_SIO_GET_MODEM_STATUS

+
@@ -402,11 +410,13 @@ Macros
-

Definition at line 42 of file cdcftdi.h.

+

Definition at line 42 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_EVENT_CHAR

+
@@ -416,11 +426,13 @@ Macros
-

Definition at line 43 of file cdcftdi.h.

+

Definition at line 43 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_ERROR_CHAR

+
@@ -430,11 +442,13 @@ Macros
-

Definition at line 44 of file cdcftdi.h.

+

Definition at line 44 of file cdcftdi.h.

- + +

◆ FTDI_SIO_RESET_SIO

+
@@ -444,11 +458,13 @@ Macros
-

Definition at line 46 of file cdcftdi.h.

+

Definition at line 46 of file cdcftdi.h.

- + +

◆ FTDI_SIO_RESET_PURGE_RX

+
@@ -458,11 +474,13 @@ Macros
-

Definition at line 47 of file cdcftdi.h.

+

Definition at line 47 of file cdcftdi.h.

- + +

◆ FTDI_SIO_RESET_PURGE_TX

+
@@ -472,11 +490,13 @@ Macros
-

Definition at line 48 of file cdcftdi.h.

+

Definition at line 48 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DATA_PARITY_NONE

+
@@ -486,11 +506,13 @@ Macros
-

Definition at line 50 of file cdcftdi.h.

+

Definition at line 50 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DATA_PARITY_ODD

+
@@ -500,11 +522,13 @@ Macros
-

Definition at line 51 of file cdcftdi.h.

+

Definition at line 51 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DATA_PARITY_EVEN

+
@@ -514,11 +538,13 @@ Macros
-

Definition at line 52 of file cdcftdi.h.

+

Definition at line 52 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DATA_PARITY_MARK

+
@@ -528,11 +554,13 @@ Macros
-

Definition at line 53 of file cdcftdi.h.

+

Definition at line 53 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DATA_PARITY_SPACE

+
@@ -542,11 +570,13 @@ Macros
-

Definition at line 54 of file cdcftdi.h.

+

Definition at line 54 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DATA_STOP_BITS_1

+
@@ -556,11 +586,13 @@ Macros
-

Definition at line 55 of file cdcftdi.h.

+

Definition at line 55 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DATA_STOP_BITS_15

+
@@ -570,11 +602,13 @@ Macros
-

Definition at line 56 of file cdcftdi.h.

+

Definition at line 56 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DATA_STOP_BITS_2

+
@@ -584,11 +618,13 @@ Macros
-

Definition at line 57 of file cdcftdi.h.

+

Definition at line 57 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_BREAK

+
@@ -598,11 +634,13 @@ Macros
-

Definition at line 58 of file cdcftdi.h.

+

Definition at line 58 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DTR_MASK

+
@@ -612,11 +650,13 @@ Macros
-

Definition at line 60 of file cdcftdi.h.

+

Definition at line 60 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DTR_HIGH

+
@@ -626,11 +666,13 @@ Macros
-

Definition at line 61 of file cdcftdi.h.

+

Definition at line 61 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_DTR_LOW

+
@@ -640,11 +682,13 @@ Macros
-

Definition at line 62 of file cdcftdi.h.

+

Definition at line 62 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_RTS_MASK

+
@@ -654,11 +698,13 @@ Macros
-

Definition at line 63 of file cdcftdi.h.

+

Definition at line 63 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_RTS_HIGH

+
@@ -668,11 +714,13 @@ Macros
-

Definition at line 64 of file cdcftdi.h.

+

Definition at line 64 of file cdcftdi.h.

- + +

◆ FTDI_SIO_SET_RTS_LOW

+
@@ -682,11 +730,13 @@ Macros
-

Definition at line 65 of file cdcftdi.h.

+

Definition at line 65 of file cdcftdi.h.

- + +

◆ FTDI_SIO_DISABLE_FLOW_CTRL

+
@@ -696,11 +746,13 @@ Macros
-

Definition at line 67 of file cdcftdi.h.

+

Definition at line 67 of file cdcftdi.h.

- + +

◆ FTDI_SIO_RTS_CTS_HS

+
@@ -710,11 +762,13 @@ Macros
-

Definition at line 68 of file cdcftdi.h.

+

Definition at line 68 of file cdcftdi.h.

- + +

◆ FTDI_SIO_DTR_DSR_HS

+
@@ -724,11 +778,13 @@ Macros
-

Definition at line 69 of file cdcftdi.h.

+

Definition at line 69 of file cdcftdi.h.

- + +

◆ FTDI_SIO_XON_XOFF_HS

+
@@ -738,11 +794,13 @@ Macros
-

Definition at line 70 of file cdcftdi.h.

+

Definition at line 70 of file cdcftdi.h.

- + +

◆ FTDI_SIO_CTS_MASK

+
@@ -752,11 +810,13 @@ Macros
-

Definition at line 72 of file cdcftdi.h.

+

Definition at line 72 of file cdcftdi.h.

- + +

◆ FTDI_SIO_DSR_MASK

+
@@ -766,11 +826,13 @@ Macros
-

Definition at line 73 of file cdcftdi.h.

+

Definition at line 73 of file cdcftdi.h.

- + +

◆ FTDI_SIO_RI_MASK

+
@@ -780,11 +842,13 @@ Macros
-

Definition at line 74 of file cdcftdi.h.

+

Definition at line 74 of file cdcftdi.h.

- + +

◆ FTDI_SIO_RLSD_MASK

+
@@ -794,11 +858,13 @@ Macros
-

Definition at line 75 of file cdcftdi.h.

+

Definition at line 75 of file cdcftdi.h.

- + +

◆ FTDI_MAX_ENDPOINTS

+
@@ -808,7 +874,7 @@ Macros
-

Definition at line 94 of file cdcftdi.h.

+

Definition at line 94 of file cdcftdi.h.

@@ -817,7 +883,7 @@ Macros diff --git a/cdcftdi_8h__dep__incl.md5 b/cdcftdi_8h__dep__incl.md5 index d2a73e5f..d21df7d0 100644 --- a/cdcftdi_8h__dep__incl.md5 +++ b/cdcftdi_8h__dep__incl.md5 @@ -1 +1 @@ -bb94e7e9d10e1bde33f1040736fc690f \ No newline at end of file +2580f835598c65f780bc9a84dd4f7552 \ No newline at end of file diff --git a/cdcftdi_8h__dep__incl.png b/cdcftdi_8h__dep__incl.png index 023738cb..f483ac2e 100644 Binary files a/cdcftdi_8h__dep__incl.png and b/cdcftdi_8h__dep__incl.png differ diff --git a/cdcftdi_8h__incl.md5 b/cdcftdi_8h__incl.md5 index 8f85634d..51c8bad8 100644 --- a/cdcftdi_8h__incl.md5 +++ b/cdcftdi_8h__incl.md5 @@ -1 +1 @@ -5a325c73b89e2318a59e437a1ca1f735 \ No newline at end of file +891212ff8fe5d0168dc1f0aa39801762 \ No newline at end of file diff --git a/cdcftdi_8h__incl.png b/cdcftdi_8h__incl.png index d9c699ce..5ff6d0f8 100644 Binary files a/cdcftdi_8h__incl.png and b/cdcftdi_8h__incl.png differ diff --git a/cdcftdi_8h_source.html b/cdcftdi_8h_source.html index b203316d..4f6b1333 100644 --- a/cdcftdi_8h_source.html +++ b/cdcftdi_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcftdi.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
cdcftdi.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 #if !defined(__CDCFTDI_H__)
18 #define __CDCFTDI_H__
19 
20 #include "Usb.h"
21 
22 #define bmREQ_FTDI_OUT 0x40
23 #define bmREQ_FTDI_IN 0xc0
24 
25 //#define bmREQ_FTDI_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
26 //#define bmREQ_FTDI_IN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
27 
28 #define FTDI_VID 0x0403 // FTDI VID
29 #define FTDI_PID 0x6001 // FTDI PID
30 
31 #define FT232AM 0x0200
32 #define FT232BM 0x0400
33 #define FT2232 0x0500
34 #define FT232R 0x0600
35 
36 // Commands
37 #define FTDI_SIO_RESET 0 /* Reset the port */
38 #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
39 #define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */
40 #define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */
41 #define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */
42 #define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */
43 #define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */
44 #define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */
45 
46 #define FTDI_SIO_RESET_SIO 0
47 #define FTDI_SIO_RESET_PURGE_RX 1
48 #define FTDI_SIO_RESET_PURGE_TX 2
49 
50 #define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8 )
51 #define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8 )
52 #define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8 )
53 #define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8 )
54 #define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8 )
55 #define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)
56 #define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)
57 #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)
58 #define FTDI_SIO_SET_BREAK (0x1 << 14)
59 
60 #define FTDI_SIO_SET_DTR_MASK 0x1
61 #define FTDI_SIO_SET_DTR_HIGH ( 1 | ( FTDI_SIO_SET_DTR_MASK << 8))
62 #define FTDI_SIO_SET_DTR_LOW ( 0 | ( FTDI_SIO_SET_DTR_MASK << 8))
63 #define FTDI_SIO_SET_RTS_MASK 0x2
64 #define FTDI_SIO_SET_RTS_HIGH ( 2 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
65 #define FTDI_SIO_SET_RTS_LOW ( 0 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
66 
67 #define FTDI_SIO_DISABLE_FLOW_CTRL 0x0
68 #define FTDI_SIO_RTS_CTS_HS (0x1 << 8)
69 #define FTDI_SIO_DTR_DSR_HS (0x2 << 8)
70 #define FTDI_SIO_XON_XOFF_HS (0x4 << 8)
71 
72 #define FTDI_SIO_CTS_MASK 0x10
73 #define FTDI_SIO_DSR_MASK 0x20
74 #define FTDI_SIO_RI_MASK 0x40
75 #define FTDI_SIO_RLSD_MASK 0x80
76 
77 class FTDI;
78 
80 public:
81 
82  virtual uint8_t OnInit(FTDI *pftdi) {
83  return 0;
84  };
85 
86  virtual uint8_t OnRelease(FTDI *pftdi) {
87  return 0;
88  };
89 };
90 
91 
92 // Only single port chips are currently supported by the library,
93 // so only three endpoints are allocated.
94 #define FTDI_MAX_ENDPOINTS 3
95 
96 class FTDI : public USBDeviceConfig, public UsbConfigXtracter {
97  static const uint8_t epDataInIndex; // DataIn endpoint index
98  static const uint8_t epDataOutIndex; // DataOUT endpoint index
99  static const uint8_t epInterruptInIndex; // InterruptIN endpoint index
100 
101  FTDIAsyncOper *pAsync;
102  USB *pUsb;
103  uint8_t bAddress;
104  uint8_t bConfNum; // configuration number
105  uint8_t bNumIface; // number of interfaces in the configuration
106  uint8_t bNumEP; // total number of EP in the configuration
107  uint32_t qNextPollTime; // next poll time
108  bool bPollEnable; // poll enable flag
109  uint16_t wFTDIType; // Type of FTDI chip
110  uint16_t wIdProduct; // expected PID
111 
112  EpInfo epInfo[FTDI_MAX_ENDPOINTS];
113 
114  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
115 
116 public:
117  FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct = FTDI_PID);
118 
119  uint8_t SetBaudRate(uint32_t baud);
120  uint8_t SetModemControl(uint16_t control);
121  uint8_t SetFlowControl(uint8_t protocol, uint8_t xon = 0x11, uint8_t xoff = 0x13);
122  uint8_t SetData(uint16_t databm);
123 
124  // Methods for recieving and sending data
125  uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr);
126  uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
127 
128  // USBDeviceConfig implementation
129  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
130  uint8_t Release();
131  uint8_t Poll();
132 
133  virtual uint8_t GetAddress() {
134  return bAddress;
135  };
136 
137  // UsbConfigXtracter implementation
138  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
139 
140  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
141  return (vid == FTDI_VID && pid == FTDI_PID);
142  }
143 
144 };
145 
146 #endif // __CDCFTDI_H__
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: cdcftdi.h:140
- - +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 #if !defined(__CDCFTDI_H__)
18 #define __CDCFTDI_H__
19 
20 #include "Usb.h"
21 
22 #define bmREQ_FTDI_OUT 0x40
23 #define bmREQ_FTDI_IN 0xc0
24 
25 //#define bmREQ_FTDI_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
26 //#define bmREQ_FTDI_IN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
27 
28 #define FTDI_VID 0x0403 // FTDI VID
29 #define FTDI_PID 0x6001 // FTDI PID
30 
31 #define FT232AM 0x0200
32 #define FT232BM 0x0400
33 #define FT2232 0x0500
34 #define FT232R 0x0600
35 
36 // Commands
37 #define FTDI_SIO_RESET 0 /* Reset the port */
38 #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
39 #define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */
40 #define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */
41 #define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */
42 #define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */
43 #define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */
44 #define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */
45 
46 #define FTDI_SIO_RESET_SIO 0
47 #define FTDI_SIO_RESET_PURGE_RX 1
48 #define FTDI_SIO_RESET_PURGE_TX 2
49 
50 #define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8 )
51 #define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8 )
52 #define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8 )
53 #define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8 )
54 #define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8 )
55 #define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)
56 #define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)
57 #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)
58 #define FTDI_SIO_SET_BREAK (0x1 << 14)
59 
60 #define FTDI_SIO_SET_DTR_MASK 0x1
61 #define FTDI_SIO_SET_DTR_HIGH ( 1 | ( FTDI_SIO_SET_DTR_MASK << 8))
62 #define FTDI_SIO_SET_DTR_LOW ( 0 | ( FTDI_SIO_SET_DTR_MASK << 8))
63 #define FTDI_SIO_SET_RTS_MASK 0x2
64 #define FTDI_SIO_SET_RTS_HIGH ( 2 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
65 #define FTDI_SIO_SET_RTS_LOW ( 0 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
66 
67 #define FTDI_SIO_DISABLE_FLOW_CTRL 0x0
68 #define FTDI_SIO_RTS_CTS_HS (0x1 << 8)
69 #define FTDI_SIO_DTR_DSR_HS (0x2 << 8)
70 #define FTDI_SIO_XON_XOFF_HS (0x4 << 8)
71 
72 #define FTDI_SIO_CTS_MASK 0x10
73 #define FTDI_SIO_DSR_MASK 0x20
74 #define FTDI_SIO_RI_MASK 0x40
75 #define FTDI_SIO_RLSD_MASK 0x80
76 
77 class FTDI;
78 
80 public:
81 
82  virtual uint8_t OnInit(FTDI *pftdi __attribute__((unused))) {
83  return 0;
84  };
85 
86  virtual uint8_t OnRelease(FTDI *pftdi __attribute__((unused))) {
87  return 0;
88  };
89 };
90 
91 
92 // Only single port chips are currently supported by the library,
93 // so only three endpoints are allocated.
94 #define FTDI_MAX_ENDPOINTS 3
95 
96 class FTDI : public USBDeviceConfig, public UsbConfigXtracter {
97  static const uint8_t epDataInIndex; // DataIn endpoint index
98  static const uint8_t epDataOutIndex; // DataOUT endpoint index
99  static const uint8_t epInterruptInIndex; // InterruptIN endpoint index
100 
101  FTDIAsyncOper *pAsync;
102  USB *pUsb;
103  uint8_t bAddress;
104  uint8_t bConfNum; // configuration number
105  uint8_t bNumIface; // number of interfaces in the configuration
106  uint8_t bNumEP; // total number of EP in the configuration
107  uint32_t qNextPollTime; // next poll time
108  volatile bool bPollEnable; // poll enable flag
109  volatile bool ready; //device ready indicator
110  uint16_t wFTDIType; // Type of FTDI chip
111  uint16_t wIdProduct; // expected PID
112 
113  EpInfo epInfo[FTDI_MAX_ENDPOINTS];
114 
115  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
116 
117 public:
118  FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct = FTDI_PID);
119 
120  uint8_t SetBaudRate(uint32_t baud);
121  uint8_t SetModemControl(uint16_t control);
122  uint8_t SetFlowControl(uint8_t protocol, uint8_t xon = 0x11, uint8_t xoff = 0x13);
123  uint8_t SetData(uint16_t databm);
124 
125  // Methods for recieving and sending data
126  uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr);
127  uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
128 
129  // USBDeviceConfig implementation
130  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
131  uint8_t Release();
132  uint8_t Poll();
133 
134  virtual uint8_t GetAddress() {
135  return bAddress;
136  };
137 
138  // UsbConfigXtracter implementation
139  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
140 
141  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
142  return (vid == FTDI_VID && pid == wIdProduct);
143  }
144  virtual bool isReady() {
145  return ready;
146  };
147 
148 };
149 
150 #endif // __CDCFTDI_H__
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: cdcftdi.h:141
+
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: cdcftdi.cpp:223
+
uint8_t SetBaudRate(uint32_t baud)
Definition: cdcftdi.cpp:276
+
uint8_t SetModemControl(uint16_t control)
Definition: cdcftdi.cpp:316
+ +
uint8_t SetFlowControl(uint8_t protocol, uint8_t xon=0x11, uint8_t xoff=0x13)
Definition: cdcftdi.cpp:324
+ -
Definition: address.h:32
+
uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
Definition: cdcftdi.cpp:340
+
FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct=FTDI_PID)
Definition: cdcftdi.cpp:23
+
uint8_t Poll()
Definition: cdcftdi.cpp:261
+
Definition: address.h:39
Definition: cdcftdi.h:96
#define FTDI_PID
Definition: cdcftdi.h:29
+
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: cdcftdi.cpp:41
+
virtual bool isReady()
Definition: cdcftdi.h:144
virtual uint8_t OnInit(FTDI *pftdi)
Definition: cdcftdi.h:82
-
virtual uint8_t GetAddress()
Definition: cdcftdi.h:133
- +
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
Definition: cdcftdi.cpp:348
+
virtual uint8_t GetAddress()
Definition: cdcftdi.h:134
+
virtual uint8_t OnRelease(FTDI *pftdi)
Definition: cdcftdi.h:86
#define FTDI_VID
Definition: cdcftdi.h:28
-
Definition: UsbCore.h:197
+
uint8_t Release()
Definition: cdcftdi.cpp:250
+
Definition: UsbCore.h:208
+
uint8_t SetData(uint16_t databm)
Definition: cdcftdi.cpp:332
#define FTDI_MAX_ENDPOINTS
Definition: cdcftdi.h:94
diff --git a/cdcprolific_8cpp.html b/cdcprolific_8cpp.html index aa541235..b0b2ed6a 100644 --- a/cdcprolific_8cpp.html +++ b/cdcprolific_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcprolific.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/cdcprolific_8cpp__incl.md5 b/cdcprolific_8cpp__incl.md5 index 1e1ab220..23a54331 100644 --- a/cdcprolific_8cpp__incl.md5 +++ b/cdcprolific_8cpp__incl.md5 @@ -1 +1 @@ -a91e5714ebd81502b745c96a64138390 \ No newline at end of file +80a2f4a7375bdcd59e0374c878b54419 \ No newline at end of file diff --git a/cdcprolific_8cpp__incl.png b/cdcprolific_8cpp__incl.png index 3487f759..670eae43 100644 Binary files a/cdcprolific_8cpp__incl.png and b/cdcprolific_8cpp__incl.png differ diff --git a/cdcprolific_8cpp_source.html b/cdcprolific_8cpp_source.html index f1bf2334..2a786002 100644 --- a/cdcprolific_8cpp_source.html +++ b/cdcprolific_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcprolific.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
cdcprolific.cpp
-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 #include "cdcprolific.h"
18 
20 ACM(p, pasync),
21 wPLType(0) {
22 }
23 
24 uint8_t PL2303::Init(uint8_t parent, uint8_t port, bool lowspeed) {
25  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
26 
27  uint8_t buf[constBufSize];
28  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
29  uint8_t rcode;
30  UsbDevice *p = NULL;
31  EpInfo *oldep_ptr = NULL;
32  uint8_t num_of_conf; // number of configurations
33 #ifdef PL2303_COMPAT
34  enum pl2303_type pltype = unknown;
35 #endif
36 
37  AddressPool &addrPool = pUsb->GetAddressPool();
38 
39  USBTRACE("PL Init\r\n");
40 
41  if(bAddress)
43 
44  // Get pointer to pseudo device with address 0 assigned
45  p = addrPool.GetUsbDevicePtr(0);
46 
47  if(!p)
49 
50  if(!p->epinfo) {
51  USBTRACE("epinfo\r\n");
53  }
54 
55  // Save old pointer to EP_RECORD of address 0
56  oldep_ptr = p->epinfo;
57 
58  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
59  p->epinfo = epInfo;
60 
61  p->lowspeed = lowspeed;
62 
63  // Get device descriptor
64  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
65 
66  // Restore p->epinfo
67  p->epinfo = oldep_ptr;
68 
69  if(rcode)
70  goto FailGetDevDescr;
71 
72  if(udd->idVendor != PL_VID && CHECK_PID(udd->idProduct))
74 
75  /* determine chip variant */
76 #ifdef PL2303_COMPAT
77  if(udd->bDeviceClass == 0x02 )
78  pltype = type_0;
79  else if(udd->bMaxPacketSize0 == 0x40 )
80  pltype = rev_HX;
81  else if(udd->bDeviceClass == 0x00)
82  pltype = type_1;
83  else if(udd->bDeviceClass == 0xff)
84  pltype = type_1;
85 #endif
86 
87  // Save type of PL chip
88  wPLType = udd->bcdDevice;
89 
90  // Allocate new address according to device class
91  bAddress = addrPool.AllocAddress(parent, false, port);
92 
93  if(!bAddress)
95 
96  // Extract Max Packet Size from the device descriptor
98 
99  // Assign new address to the device
100  rcode = pUsb->setAddr(0, 0, bAddress);
101 
102  if(rcode) {
103  p->lowspeed = false;
104  addrPool.FreeAddress(bAddress);
105  bAddress = 0;
106  USBTRACE2("setAddr:", rcode);
107  return rcode;
108  }
109 
110  USBTRACE2("Addr:", bAddress);
111 
112  p->lowspeed = false;
113 
114  p = addrPool.GetUsbDevicePtr(bAddress);
115 
116  if(!p)
118 
119  p->lowspeed = lowspeed;
120 
121  num_of_conf = udd->bNumConfigurations;
122 
123  // Assign epInfo to epinfo pointer
124  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
125 
126  if(rcode)
127  goto FailSetDevTblEntry;
128 
129  USBTRACE2("NC:", num_of_conf);
130 
131  for(uint8_t i = 0; i < num_of_conf; i++) {
134 
135  rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
136 
137  if(rcode)
138  goto FailGetConfDescr;
139 
140  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
141 
142  if(rcode)
143  goto FailGetConfDescr;
144 
145  if(bNumEP > 1)
146  break;
147  } // for
148 
149  if(bNumEP < 2)
151 
152  // Assign epInfo to epinfo pointer
154 
155  USBTRACE2("Conf:", bConfNum);
156 
157  // Set Configuration Value
158  rcode = pUsb->setConf(bAddress, 0, bConfNum);
159 
160  if(rcode)
161  goto FailSetConfDescr;
162 
163 #ifdef PL2303_COMPAT
164  /* Shamanic dance - sending Prolific init data as-is */
165  vendorRead( 0x84, 0x84, 0, buf );
166  vendorWrite( 0x04, 0x04, 0 );
167  vendorRead( 0x84, 0x84, 0, buf );
168  vendorRead( 0x83, 0x83, 0, buf );
169  vendorRead( 0x84, 0x84, 0, buf );
170  vendorWrite( 0x04, 0x04, 1 );
171  vendorRead( 0x84, 0x84, 0, buf);
172  vendorRead( 0x83, 0x83, 0, buf);
173  vendorWrite( 0, 0, 1 );
174  vendorWrite( 1, 0, 0 );
175  if( pltype == rev_HX ) {
176  vendorWrite( 2, 0, 0x44 );
177  vendorWrite( 0x06, 0x06, 0 ); // From W7 init
178  }
179  else {
180  vendorWrite( 2, 0, 0x24 );
181  }
182  /* Shamanic dance end */
183 #endif
184  /* Calling post-init callback */
185  rcode = pAsync->OnInit(this);
186 
187  if(rcode)
188  goto FailOnInit;
189 
190  USBTRACE("PL configured\r\n");
191 
192  //bPollEnable = true;
193  ready = true;
194  return 0;
195 
196 FailGetDevDescr:
197 #ifdef DEBUG_USB_HOST
199  goto Fail;
200 #endif
201 
202 FailSetDevTblEntry:
203 #ifdef DEBUG_USB_HOST
205  goto Fail;
206 #endif
207 
208 FailGetConfDescr:
209 #ifdef DEBUG_USB_HOST
211  goto Fail;
212 #endif
213 
214 FailSetConfDescr:
215 #ifdef DEBUG_USB_HOST
217  goto Fail;
218 #endif
219 
220 FailOnInit:
221 #ifdef DEBUG_USB_HOST
222  USBTRACE("OnInit:");
223 #endif
224 
225 #ifdef DEBUG_USB_HOST
226 Fail:
227  NotifyFail(rcode);
228 #endif
229  Release();
230  return rcode;
231 }
232 
233 //uint8_t PL::Poll()
234 //{
235 // uint8_t rcode = 0;
236 //
237 // //if (!bPollEnable)
238 // // return 0;
239 //
240 // //if (qNextPollTime <= millis())
241 // //{
242 // // USB_HOST_SERIAL.println(bAddress, HEX);
243 //
244 // // qNextPollTime = millis() + 100;
245 // //}
246 // return rcode;
247 //}
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
- -
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
+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 #include "cdcprolific.h"
18 
20 ACM(p, pasync),
21 wPLType(0) {
22 }
23 
24 uint8_t PL2303::Init(uint8_t parent, uint8_t port, bool lowspeed) {
25  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
26 
27  uint8_t buf[constBufSize];
28  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
29  uint8_t rcode;
30  UsbDevice *p = NULL;
31  EpInfo *oldep_ptr = NULL;
32  uint8_t num_of_conf; // number of configurations
33 #ifdef PL2303_COMPAT
34  enum pl2303_type pltype = unknown;
35 #endif
36 
37  AddressPool &addrPool = pUsb->GetAddressPool();
38 
39  USBTRACE("PL Init\r\n");
40 
41  if(bAddress)
43 
44  // Get pointer to pseudo device with address 0 assigned
45  p = addrPool.GetUsbDevicePtr(0);
46 
47  if(!p)
49 
50  if(!p->epinfo) {
51  USBTRACE("epinfo\r\n");
53  }
54 
55  // Save old pointer to EP_RECORD of address 0
56  oldep_ptr = p->epinfo;
57 
58  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
59  p->epinfo = epInfo;
60 
61  p->lowspeed = lowspeed;
62 
63  // Get device descriptor
64  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
65 
66  // Restore p->epinfo
67  p->epinfo = oldep_ptr;
68 
69  if(rcode)
70  goto FailGetDevDescr;
71 
72  if(udd->idVendor != PL_VID && CHECK_PID(udd->idProduct))
74 
75  /* determine chip variant */
76 #ifdef PL2303_COMPAT
77  if(udd->bDeviceClass == 0x02 )
78  pltype = type_0;
79  else if(udd->bMaxPacketSize0 == 0x40 )
80  pltype = rev_HX;
81  else if(udd->bDeviceClass == 0x00)
82  pltype = type_1;
83  else if(udd->bDeviceClass == 0xff)
84  pltype = type_1;
85 #endif
86 
87  // Save type of PL chip
88  wPLType = udd->bcdDevice;
89 
90  // Allocate new address according to device class
91  bAddress = addrPool.AllocAddress(parent, false, port);
92 
93  if(!bAddress)
95 
96  // Extract Max Packet Size from the device descriptor
98 
99  // Assign new address to the device
100  rcode = pUsb->setAddr(0, 0, bAddress);
101 
102  if(rcode) {
103  p->lowspeed = false;
104  addrPool.FreeAddress(bAddress);
105  bAddress = 0;
106  USBTRACE2("setAddr:", rcode);
107  return rcode;
108  }
109 
110  USBTRACE2("Addr:", bAddress);
111 
112  p->lowspeed = false;
113 
114  p = addrPool.GetUsbDevicePtr(bAddress);
115 
116  if(!p)
118 
119  p->lowspeed = lowspeed;
120 
121  num_of_conf = udd->bNumConfigurations;
122 
123  // Assign epInfo to epinfo pointer
124  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
125 
126  if(rcode)
127  goto FailSetDevTblEntry;
128 
129  USBTRACE2("NC:", num_of_conf);
130 
131  for(uint8_t i = 0; i < num_of_conf; i++) {
134 
135  rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
136 
137  if(rcode)
138  goto FailGetConfDescr;
139 
140  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
141 
142  if(rcode)
143  goto FailGetConfDescr;
144 
145  if(bNumEP > 1)
146  break;
147  } // for
148 
149  if(bNumEP < 2)
151 
152  // Assign epInfo to epinfo pointer
154 
155  USBTRACE2("Conf:", bConfNum);
156 
157  // Set Configuration Value
158  rcode = pUsb->setConf(bAddress, 0, bConfNum);
159 
160  if(rcode)
161  goto FailSetConfDescr;
162 
163 #ifdef PL2303_COMPAT
164  /* Shamanic dance - sending Prolific init data as-is */
165  vendorRead( 0x84, 0x84, 0, buf );
166  vendorWrite( 0x04, 0x04, 0 );
167  vendorRead( 0x84, 0x84, 0, buf );
168  vendorRead( 0x83, 0x83, 0, buf );
169  vendorRead( 0x84, 0x84, 0, buf );
170  vendorWrite( 0x04, 0x04, 1 );
171  vendorRead( 0x84, 0x84, 0, buf);
172  vendorRead( 0x83, 0x83, 0, buf);
173  vendorWrite( 0, 0, 1 );
174  vendorWrite( 1, 0, 0 );
175  if( pltype == rev_HX ) {
176  vendorWrite( 2, 0, 0x44 );
177  vendorWrite( 0x06, 0x06, 0 ); // From W7 init
178  }
179  else {
180  vendorWrite( 2, 0, 0x24 );
181  }
182  /* Shamanic dance end */
183 #endif
184  /* Calling post-init callback */
185  rcode = pAsync->OnInit(this);
186 
187  if(rcode)
188  goto FailOnInit;
189 
190  USBTRACE("PL configured\r\n");
191 
192  //bPollEnable = true;
193  ready = true;
194  return 0;
195 
196 FailGetDevDescr:
197 #ifdef DEBUG_USB_HOST
199  goto Fail;
200 #endif
201 
202 FailSetDevTblEntry:
203 #ifdef DEBUG_USB_HOST
205  goto Fail;
206 #endif
207 
208 FailGetConfDescr:
209 #ifdef DEBUG_USB_HOST
211  goto Fail;
212 #endif
213 
214 FailSetConfDescr:
215 #ifdef DEBUG_USB_HOST
217  goto Fail;
218 #endif
219 
220 FailOnInit:
221 #ifdef DEBUG_USB_HOST
222  USBTRACE("OnInit:");
223 #endif
224 
225 #ifdef DEBUG_USB_HOST
226 Fail:
227  NotifyFail(rcode);
228 #endif
229  Release();
230  return rcode;
231 }
232 
233 //uint8_t PL::Poll()
234 //{
235 // uint8_t rcode = 0;
236 //
237 // //if (!bPollEnable)
238 // // return 0;
239 //
240 // //if (qNextPollTime <= (uint32_t)millis())
241 // //{
242 // // USB_HOST_SERIAL.println(bAddress, HEX);
243 //
244 // // qNextPollTime = (uint32_t)millis() + 100;
245 // //}
246 // return rcode;
247 //}
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+ +
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
virtual uint8_t OnInit(ACM *pacm)
Definition: cdcacm.h:131
- -
uint16_t bcdDevice
Definition: usb_ch9.h:108
+ +
uint16_t bcdDevice
Definition: usb_ch9.h:115
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: cdcprolific.cpp:24
- +
PL2303(USB *pusb, CDCAsyncOper *pasync)
Definition: cdcprolific.cpp:19
- -
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:105
-
volatile bool ready
Definition: cdcacm.h:178
-
#define NotifyFail(...)
Definition: message.h:55
-
#define CHECK_PID(pid)
Definition: cdcprolific.h:25
-
USB * pUsb
Definition: cdcacm.h:169
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
-
uint8_t bNumEP
Definition: cdcacm.h:175
-
EpInfo epInfo[ACM_MAX_ENDPOINTS]
Definition: cdcacm.h:181
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
+ +
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:112
+
volatile bool ready
Definition: cdcacm.h:174
+
#define NotifyFail(...)
Definition: message.h:62
+
USB * pUsb
Definition: cdcacm.h:165
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
uint8_t bNumEP
Definition: cdcacm.h:171
+
EpInfo epInfo[ACM_MAX_ENDPOINTS]
Definition: cdcacm.h:183
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
virtual void FreeAddress(uint8_t addr)=0
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
CDCAsyncOper * pAsync
Definition: cdcacm.h:170
- -
#define USBTRACE2(s, r)
Definition: macros.h:77
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
#define NotifyFailGetConfDescr(...)
Definition: message.h:52
+
CDCAsyncOper * pAsync
Definition: cdcacm.h:166
+ +
#define USBTRACE2(s, r)
Definition: macros.h:84
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
#define NotifyFailGetConfDescr(...)
Definition: message.h:59
-
Definition: address.h:32
+
Definition: address.h:39
#define PL_VID
Definition: cdcprolific.h:24
pl2303_type
Definition: cdcprolific.h:112
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bAddress
Definition: cdcacm.h:171
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
uint8_t bDeviceClass
Definition: usb_ch9.h:102
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
+
uint8_t bAddress
Definition: cdcacm.h:167
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
uint8_t bDeviceClass
Definition: usb_ch9.h:109
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
-
uint16_t idProduct
Definition: usb_ch9.h:107
-
uint8_t Release()
Definition: cdcacm.cpp:259
-
uint8_t bConfNum
Definition: cdcacm.h:172
-
uint8_t bNumConfigurations
Definition: usb_ch9.h:112
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
-
Definition: UsbCore.h:197
+
uint16_t idProduct
Definition: usb_ch9.h:114
+
uint8_t Release()
Definition: cdcacm.cpp:258
+
uint8_t bConfNum
Definition: cdcacm.h:168
+
uint8_t bNumConfigurations
Definition: usb_ch9.h:119
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
+
Definition: UsbCore.h:208
Definition: cdcacm.h:163
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
-
#define USBTRACE(s)
Definition: macros.h:75
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
- +
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
+
#define CHECK_PID(pid)
Definition: cdcprolific.h:25
+
#define USBTRACE(s)
Definition: macros.h:82
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
diff --git a/cdcprolific_8h.html b/cdcprolific_8h.html index 683ca157..a07ee4e8 100644 --- a/cdcprolific_8h.html +++ b/cdcprolific_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcprolific.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
Macros #define PL_VID   0x067B   -#define CHECK_PID(pid)    ( pid != 0x2303 && pid != 0x0609 ) -  +#define CHECK_PID(pid)   ( pid != 0x2303 && pid != 0x0609 ) +  #define PROLIFIC_REV_H   0x0202   #define PROLIFIC_REV_X   0x0300 @@ -266,7 +246,9 @@ Enumerations  

Macro Definition Documentation

- + +

◆ PL_VID

+
@@ -276,11 +258,13 @@ Enumerations
-

Definition at line 24 of file cdcprolific.h.

+

Definition at line 24 of file cdcprolific.h.

- + +

◆ CHECK_PID

+
@@ -294,11 +278,13 @@ Enumerations
-

Definition at line 25 of file cdcprolific.h.

+

Definition at line 25 of file cdcprolific.h.

- + +

◆ PROLIFIC_REV_H

+
@@ -308,11 +294,13 @@ Enumerations
-

Definition at line 29 of file cdcprolific.h.

+

Definition at line 29 of file cdcprolific.h.

- + +

◆ PROLIFIC_REV_X

+
@@ -322,11 +310,13 @@ Enumerations
-

Definition at line 30 of file cdcprolific.h.

+

Definition at line 30 of file cdcprolific.h.

- + +

◆ PROLIFIC_REV_HX_CHIP_D

+
@@ -336,11 +326,13 @@ Enumerations
-

Definition at line 31 of file cdcprolific.h.

+

Definition at line 31 of file cdcprolific.h.

- + +

◆ PROLIFIC_REV_1

+
@@ -350,11 +342,13 @@ Enumerations
-

Definition at line 32 of file cdcprolific.h.

+

Definition at line 32 of file cdcprolific.h.

- + +

◆ kXOnChar

+
@@ -364,11 +358,13 @@ Enumerations
-

Definition at line 34 of file cdcprolific.h.

+

Definition at line 34 of file cdcprolific.h.

- + +

◆ kXOffChar

+
@@ -378,11 +374,13 @@ Enumerations
-

Definition at line 35 of file cdcprolific.h.

+

Definition at line 35 of file cdcprolific.h.

- + +

◆ SPECIAL_SHIFT

+
@@ -392,11 +390,13 @@ Enumerations
-

Definition at line 37 of file cdcprolific.h.

+

Definition at line 37 of file cdcprolific.h.

- + +

◆ SPECIAL_MASK

+
@@ -406,11 +406,13 @@ Enumerations
-

Definition at line 38 of file cdcprolific.h.

+

Definition at line 38 of file cdcprolific.h.

- + +

◆ STATE_ALL

+
@@ -420,11 +422,13 @@ Enumerations
-

Definition at line 39 of file cdcprolific.h.

+

Definition at line 39 of file cdcprolific.h.

- + +

◆ FLOW_RX_AUTO

+
@@ -434,11 +438,13 @@ Enumerations
-

Definition at line 40 of file cdcprolific.h.

+

Definition at line 40 of file cdcprolific.h.

- + +

◆ FLOW_TX_AUTO

+
@@ -448,11 +454,13 @@ Enumerations
-

Definition at line 41 of file cdcprolific.h.

+

Definition at line 41 of file cdcprolific.h.

- + +

◆ CAN_BE_AUTO

+
@@ -462,11 +470,13 @@ Enumerations
-

Definition at line 42 of file cdcprolific.h.

+

Definition at line 42 of file cdcprolific.h.

- + +

◆ CAN_NOTIFY

+
@@ -476,11 +486,13 @@ Enumerations
-

Definition at line 43 of file cdcprolific.h.

+

Definition at line 43 of file cdcprolific.h.

- + +

◆ EXTERNAL_MASK

+
@@ -490,11 +502,13 @@ Enumerations
-

Definition at line 44 of file cdcprolific.h.

+

Definition at line 44 of file cdcprolific.h.

- + +

◆ INTERNAL_DELAY

+
@@ -504,11 +518,13 @@ Enumerations
-

Definition at line 45 of file cdcprolific.h.

+

Definition at line 45 of file cdcprolific.h.

- + +

◆ DEFAULT_AUTO

+
@@ -518,11 +534,13 @@ Enumerations
-

Definition at line 46 of file cdcprolific.h.

+

Definition at line 46 of file cdcprolific.h.

- + +

◆ DEFAULT_NOTIFY

+
@@ -532,11 +550,13 @@ Enumerations
-

Definition at line 47 of file cdcprolific.h.

+

Definition at line 47 of file cdcprolific.h.

- + +

◆ DEFAULT_STATE

+
@@ -546,11 +566,13 @@ Enumerations
-

Definition at line 48 of file cdcprolific.h.

+

Definition at line 48 of file cdcprolific.h.

- + +

◆ CONTINUE_SEND

+
@@ -560,11 +582,13 @@ Enumerations
-

Definition at line 50 of file cdcprolific.h.

+

Definition at line 50 of file cdcprolific.h.

- + +

◆ PAUSE_SEND

+
@@ -574,11 +598,13 @@ Enumerations
-

Definition at line 51 of file cdcprolific.h.

+

Definition at line 51 of file cdcprolific.h.

- + +

◆ kRxAutoFlow

+
@@ -588,11 +614,13 @@ Enumerations
-

Definition at line 53 of file cdcprolific.h.

+

Definition at line 53 of file cdcprolific.h.

- + +

◆ kTxAutoFlow

+
@@ -602,11 +630,13 @@ Enumerations
-

Definition at line 54 of file cdcprolific.h.

+

Definition at line 54 of file cdcprolific.h.

- + +

◆ kControl_StateMask

+
@@ -616,11 +646,13 @@ Enumerations
-

Definition at line 55 of file cdcprolific.h.

+

Definition at line 55 of file cdcprolific.h.

- + +

◆ kRxQueueState

+
@@ -630,11 +662,13 @@ Enumerations
-

Definition at line 56 of file cdcprolific.h.

+

Definition at line 56 of file cdcprolific.h.

- + +

◆ kTxQueueState

+
@@ -644,11 +678,13 @@ Enumerations
-

Definition at line 57 of file cdcprolific.h.

+

Definition at line 57 of file cdcprolific.h.

- + +

◆ kCONTROL_DTR

+
@@ -658,11 +694,13 @@ Enumerations
-

Definition at line 59 of file cdcprolific.h.

+

Definition at line 59 of file cdcprolific.h.

- + +

◆ kCONTROL_RTS

+
@@ -672,11 +710,13 @@ Enumerations
-

Definition at line 60 of file cdcprolific.h.

+

Definition at line 60 of file cdcprolific.h.

- + +

◆ kStateTransientMask

+
@@ -686,11 +726,13 @@ Enumerations
-

Definition at line 62 of file cdcprolific.h.

+

Definition at line 62 of file cdcprolific.h.

- + +

◆ kBreakError

+
@@ -700,11 +742,13 @@ Enumerations
-

Definition at line 63 of file cdcprolific.h.

+

Definition at line 63 of file cdcprolific.h.

- + +

◆ kFrameError

+
@@ -714,11 +758,13 @@ Enumerations
-

Definition at line 64 of file cdcprolific.h.

+

Definition at line 64 of file cdcprolific.h.

- + +

◆ kParityError

+
@@ -728,11 +774,13 @@ Enumerations
-

Definition at line 65 of file cdcprolific.h.

+

Definition at line 65 of file cdcprolific.h.

- + +

◆ kOverrunError

+
@@ -742,11 +790,13 @@ Enumerations
-

Definition at line 66 of file cdcprolific.h.

+

Definition at line 66 of file cdcprolific.h.

- + +

◆ kCTS

+
@@ -756,11 +806,13 @@ Enumerations
-

Definition at line 68 of file cdcprolific.h.

+

Definition at line 68 of file cdcprolific.h.

- + +

◆ kDSR

+
@@ -770,11 +822,13 @@ Enumerations
-

Definition at line 69 of file cdcprolific.h.

+

Definition at line 69 of file cdcprolific.h.

- + +

◆ kRI

+
@@ -784,11 +838,13 @@ Enumerations
-

Definition at line 70 of file cdcprolific.h.

+

Definition at line 70 of file cdcprolific.h.

- + +

◆ kDCD

+
@@ -798,11 +854,13 @@ Enumerations
-

Definition at line 71 of file cdcprolific.h.

+

Definition at line 71 of file cdcprolific.h.

- + +

◆ kHandshakeInMask

+
@@ -812,11 +870,13 @@ Enumerations
-

Definition at line 72 of file cdcprolific.h.

+

Definition at line 72 of file cdcprolific.h.

- + +

◆ VENDOR_WRITE_REQUEST_TYPE

+
@@ -826,11 +886,13 @@ Enumerations
-

Definition at line 74 of file cdcprolific.h.

+

Definition at line 74 of file cdcprolific.h.

- + +

◆ VENDOR_WRITE_REQUEST

+
@@ -840,11 +902,13 @@ Enumerations
-

Definition at line 75 of file cdcprolific.h.

+

Definition at line 75 of file cdcprolific.h.

- + +

◆ VENDOR_READ_REQUEST_TYPE

+
@@ -854,11 +918,13 @@ Enumerations
-

Definition at line 77 of file cdcprolific.h.

+

Definition at line 77 of file cdcprolific.h.

- + +

◆ VENDOR_READ_REQUEST

+
@@ -868,11 +934,13 @@ Enumerations
-

Definition at line 78 of file cdcprolific.h.

+

Definition at line 78 of file cdcprolific.h.

- + +

◆ SET_DCR0

+
@@ -882,11 +950,13 @@ Enumerations
-

Definition at line 81 of file cdcprolific.h.

+

Definition at line 81 of file cdcprolific.h.

- + +

◆ GET_DCR0

+
@@ -896,11 +966,13 @@ Enumerations
-

Definition at line 82 of file cdcprolific.h.

+

Definition at line 82 of file cdcprolific.h.

- + +

◆ DCR0_INIT

+
@@ -910,11 +982,13 @@ Enumerations
-

Definition at line 83 of file cdcprolific.h.

+

Definition at line 83 of file cdcprolific.h.

- + +

◆ DCR0_INIT_H

+
@@ -924,11 +998,13 @@ Enumerations
-

Definition at line 84 of file cdcprolific.h.

+

Definition at line 84 of file cdcprolific.h.

- + +

◆ DCR0_INIT_X

+
@@ -938,11 +1014,13 @@ Enumerations
-

Definition at line 85 of file cdcprolific.h.

+

Definition at line 85 of file cdcprolific.h.

- + +

◆ SET_DCR1

+
@@ -952,11 +1030,13 @@ Enumerations
-

Definition at line 87 of file cdcprolific.h.

+

Definition at line 87 of file cdcprolific.h.

- + +

◆ GET_DCR1

+
@@ -966,11 +1046,13 @@ Enumerations
-

Definition at line 88 of file cdcprolific.h.

+

Definition at line 88 of file cdcprolific.h.

- + +

◆ DCR1_INIT_H

+
@@ -980,11 +1062,13 @@ Enumerations
-

Definition at line 89 of file cdcprolific.h.

+

Definition at line 89 of file cdcprolific.h.

- + +

◆ DCR1_INIT_X

+
@@ -994,11 +1078,13 @@ Enumerations
-

Definition at line 90 of file cdcprolific.h.

+

Definition at line 90 of file cdcprolific.h.

- + +

◆ SET_DCR2

+
@@ -1008,11 +1094,13 @@ Enumerations
-

Definition at line 92 of file cdcprolific.h.

+

Definition at line 92 of file cdcprolific.h.

- + +

◆ GET_DCR2

+
@@ -1022,11 +1110,13 @@ Enumerations
-

Definition at line 93 of file cdcprolific.h.

+

Definition at line 93 of file cdcprolific.h.

- + +

◆ DCR2_INIT_H

+
@@ -1036,11 +1126,13 @@ Enumerations
-

Definition at line 94 of file cdcprolific.h.

+

Definition at line 94 of file cdcprolific.h.

- + +

◆ DCR2_INIT_X

+
@@ -1050,11 +1142,13 @@ Enumerations
-

Definition at line 95 of file cdcprolific.h.

+

Definition at line 95 of file cdcprolific.h.

- + +

◆ RESET_DOWNSTREAM_DATA_PIPE

+
@@ -1064,11 +1158,13 @@ Enumerations
-

Definition at line 98 of file cdcprolific.h.

+

Definition at line 98 of file cdcprolific.h.

- + +

◆ RESET_UPSTREAM_DATA_PIPE

+
@@ -1078,11 +1174,13 @@ Enumerations
-

Definition at line 99 of file cdcprolific.h.

+

Definition at line 99 of file cdcprolific.h.

- + +

◆ PL_MAX_ENDPOINTS

+
@@ -1092,12 +1190,14 @@ Enumerations
-

Definition at line 102 of file cdcprolific.h.

+

Definition at line 102 of file cdcprolific.h.

Enumeration Type Documentation

- + +

◆ tXO_State

+
@@ -1107,23 +1207,20 @@ Enumerations
- - - - - + + + + +
Enumerator
kXOnSent  -
kXOffSent  -
kXO_Idle  -
kXOffNeeded  -
kXOnNeeded  -
Enumerator
kXOnSent 
kXOffSent 
kXO_Idle 
kXOffNeeded 
kXOnNeeded 
-

Definition at line 104 of file cdcprolific.h.

+

Definition at line 104 of file cdcprolific.h.

- + +

◆ pl2303_type

+
@@ -1133,21 +1230,15 @@ Enumerations
- - - - - - + + + + + +
Enumerator
unknown  -
type_0  -
type_1  -
rev_X  -
rev_HX  -
rev_H  -
Enumerator
unknown 
type_0 
type_1 
rev_X 
rev_HX 
rev_H 
-

Definition at line 112 of file cdcprolific.h.

+

Definition at line 112 of file cdcprolific.h.

@@ -1156,7 +1247,7 @@ Enumerations diff --git a/cdcprolific_8h__dep__incl.md5 b/cdcprolific_8h__dep__incl.md5 index 3f648651..c78552e9 100644 --- a/cdcprolific_8h__dep__incl.md5 +++ b/cdcprolific_8h__dep__incl.md5 @@ -1 +1 @@ -5601c68c5c5e913b421194d3f765f64d \ No newline at end of file +2a214c1fef9fd137dcc008a5d205d6e0 \ No newline at end of file diff --git a/cdcprolific_8h__dep__incl.png b/cdcprolific_8h__dep__incl.png index 38b57989..ffc64fe9 100644 Binary files a/cdcprolific_8h__dep__incl.png and b/cdcprolific_8h__dep__incl.png differ diff --git a/cdcprolific_8h__incl.md5 b/cdcprolific_8h__incl.md5 index e7519a47..f207c73e 100644 --- a/cdcprolific_8h__incl.md5 +++ b/cdcprolific_8h__incl.md5 @@ -1 +1 @@ -9d9a09dd605ff7c3be8e192a907ecbfe \ No newline at end of file +22650dc525aafafba98e38845a99fed8 \ No newline at end of file diff --git a/cdcprolific_8h__incl.png b/cdcprolific_8h__incl.png index e27af48e..4d678997 100644 Binary files a/cdcprolific_8h__incl.png and b/cdcprolific_8h__incl.png differ diff --git a/cdcprolific_8h_source.html b/cdcprolific_8h_source.html index 81350929..1bb64d12 100644 --- a/cdcprolific_8h_source.html +++ b/cdcprolific_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: cdcprolific.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
cdcprolific.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 #if !defined(__CDCPROLIFIC_H__)
18 #define __CDCPROLIFIC_H__
19 
20 #include "cdcacm.h"
21 
22 //#define PL2303_COMPAT // Uncomment it if you have compatibility problems
23 
24 #define PL_VID 0x067B
25 #define CHECK_PID(pid) ( pid != 0x2303 && pid != 0x0609 )
26 
27 //#define PL_PID 0x0609
28 
29 #define PROLIFIC_REV_H 0x0202
30 #define PROLIFIC_REV_X 0x0300
31 #define PROLIFIC_REV_HX_CHIP_D 0x0400
32 #define PROLIFIC_REV_1 0x0001
33 
34 #define kXOnChar '\x11'
35 #define kXOffChar '\x13'
36 
37 #define SPECIAL_SHIFT (5)
38 #define SPECIAL_MASK ((1<<SPECIAL_SHIFT) - 1)
39 #define STATE_ALL ( PD_RS232_S_MASK | PD_S_MASK )
40 #define FLOW_RX_AUTO ( PD_RS232_A_RFR | PD_RS232_A_DTR | PD_RS232_A_RXO )
41 #define FLOW_TX_AUTO ( PD_RS232_A_CTS | PD_RS232_A_DSR | PD_RS232_A_TXO | PD_RS232_A_DCD )
42 #define CAN_BE_AUTO ( FLOW_RX_AUTO | FLOW_TX_AUTO )
43 #define CAN_NOTIFY ( PD_RS232_N_MASK )
44 #define EXTERNAL_MASK ( PD_S_MASK | (PD_RS232_S_MASK & ~PD_RS232_S_LOOP) )
45 #define INTERNAL_DELAY ( PD_RS232_S_LOOP )
46 #define DEFAULT_AUTO ( PD_RS232_A_DTR | PD_RS232_A_RFR | PD_RS232_A_CTS | PD_RS232_A_DSR )
47 #define DEFAULT_NOTIFY 0x00
48 #define DEFAULT_STATE ( PD_S_TX_ENABLE | PD_S_RX_ENABLE | PD_RS232_A_TXO | PD_RS232_A_RXO )
49 
50 #define CONTINUE_SEND 1
51 #define PAUSE_SEND 2
52 
53 #define kRxAutoFlow ((UInt32)( PD_RS232_A_RFR | PD_RS232_A_DTR | PD_RS232_A_RXO ))
54 #define kTxAutoFlow ((UInt32)( PD_RS232_A_CTS | PD_RS232_A_DSR | PD_RS232_A_TXO | PD_RS232_A_DCD ))
55 #define kControl_StateMask ((UInt32)( PD_RS232_S_CTS | PD_RS232_S_DSR | PD_RS232_S_CAR | PD_RS232_S_RI ))
56 #define kRxQueueState ((UInt32)( PD_S_RXQ_EMPTY | PD_S_RXQ_LOW_WATER | PD_S_RXQ_HIGH_WATER | PD_S_RXQ_FULL ))
57 #define kTxQueueState ((UInt32)( PD_S_TXQ_EMPTY | PD_S_TXQ_LOW_WATER | PD_S_TXQ_HIGH_WATER | PD_S_TXQ_FULL ))
58 
59 #define kCONTROL_DTR 0x01
60 #define kCONTROL_RTS 0x02
61 
62 #define kStateTransientMask 0x74
63 #define kBreakError 0x04
64 #define kFrameError 0x10
65 #define kParityError 0x20
66 #define kOverrunError 0x40
67 
68 #define kCTS 0x80
69 #define kDSR 0x02
70 #define kRI 0x08
71 #define kDCD 0x01
72 #define kHandshakeInMask ((UInt32)( PD_RS232_S_CTS | PD_RS232_S_DSR | PD_RS232_S_CAR | PD_RS232_S_RI ))
73 
74 #define VENDOR_WRITE_REQUEST_TYPE 0x40
75 #define VENDOR_WRITE_REQUEST 0x01
76 
77 #define VENDOR_READ_REQUEST_TYPE 0xc0
78 #define VENDOR_READ_REQUEST 0x01
79 
80 // Device Configuration Registers (DCR0, DCR1, DCR2)
81 #define SET_DCR0 0x00
82 #define GET_DCR0 0x80
83 #define DCR0_INIT 0x01
84 #define DCR0_INIT_H 0x41
85 #define DCR0_INIT_X 0x61
86 
87 #define SET_DCR1 0x01
88 #define GET_DCR1 0x81
89 #define DCR1_INIT_H 0x80
90 #define DCR1_INIT_X 0x00
91 
92 #define SET_DCR2 0x02
93 #define GET_DCR2 0x82
94 #define DCR2_INIT_H 0x24
95 #define DCR2_INIT_X 0x44
96 
97 // On-chip Data Buffers:
98 #define RESET_DOWNSTREAM_DATA_PIPE 0x08
99 #define RESET_UPSTREAM_DATA_PIPE 0x09
100 
101 
102 #define PL_MAX_ENDPOINTS 4
103 
104 enum tXO_State {
105  kXOnSent = -2,
106  kXOffSent = -1,
107  kXO_Idle = 0,
110 };
111 
114  type_0, /* don't know the difference between type 0 and */
115  type_1, /* type 1, until someone from prolific tells us... */
117  rev_HX, /* HX version of the pl2303 chip */
119 };
120 
121 
122 class PL2303 : public ACM {
123  uint16_t wPLType; // Type of chip
124 
125 public:
126  PL2303(USB *pusb, CDCAsyncOper *pasync);
127 
128  // USBDeviceConfig implementation
129  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
130  //virtual uint8_t Release();
131  //virtual uint8_t Poll();
132  //virtual uint8_t GetAddress() { return bAddress; };
133 
135  //virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
136 
137 #ifdef PL2303_COMPAT
138 private:
139  /* Prolific proprietary requests */
140  uint8_t vendorRead( uint8_t val_lo, uint8_t val_hi, uint16_t index, uint8_t* buf );
141  uint8_t vendorWrite( uint8_t val_lo, uint8_t val_hi, uint8_t index );
142 #endif
143 };
144 
145 #ifdef PL2303_COMPAT
146 /* vendor read request */
147 inline uint8_t PL2303::vendorRead( uint8_t val_lo, uint8_t val_hi, uint16_t index, uint8_t* buf )
148 {
149  return( pUsb->ctrlReq(bAddress, 0, VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, val_lo, val_hi, index, 1, 1, buf, NULL ));
150 }
151 
152 /* vendor write request */
153 inline uint8_t PL2303::vendorWrite( uint8_t val_lo, uint8_t val_hi, uint8_t index )
154 {
155  return( pUsb->ctrlReq(bAddress, 0, VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, val_lo, val_hi, index, 0, 0, NULL, NULL ));
156 }
157 #endif
158 
159 #endif // __CDCPROLIFIC_H__
#define VENDOR_READ_REQUEST_TYPE
Definition: cdcprolific.h:77
+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 #if !defined(__CDCPROLIFIC_H__)
18 #define __CDCPROLIFIC_H__
19 
20 #include "cdcacm.h"
21 
22 //#define PL2303_COMPAT // Uncomment it if you have compatibility problems
23 
24 #define PL_VID 0x067B
25 #define CHECK_PID(pid) ( pid != 0x2303 && pid != 0x0609 )
26 
27 //#define PL_PID 0x0609
28 
29 #define PROLIFIC_REV_H 0x0202
30 #define PROLIFIC_REV_X 0x0300
31 #define PROLIFIC_REV_HX_CHIP_D 0x0400
32 #define PROLIFIC_REV_1 0x0001
33 
34 #define kXOnChar '\x11'
35 #define kXOffChar '\x13'
36 
37 #define SPECIAL_SHIFT (5)
38 #define SPECIAL_MASK ((1<<SPECIAL_SHIFT) - 1)
39 #define STATE_ALL ( PD_RS232_S_MASK | PD_S_MASK )
40 #define FLOW_RX_AUTO ( PD_RS232_A_RFR | PD_RS232_A_DTR | PD_RS232_A_RXO )
41 #define FLOW_TX_AUTO ( PD_RS232_A_CTS | PD_RS232_A_DSR | PD_RS232_A_TXO | PD_RS232_A_DCD )
42 #define CAN_BE_AUTO ( FLOW_RX_AUTO | FLOW_TX_AUTO )
43 #define CAN_NOTIFY ( PD_RS232_N_MASK )
44 #define EXTERNAL_MASK ( PD_S_MASK | (PD_RS232_S_MASK & ~PD_RS232_S_LOOP) )
45 #define INTERNAL_DELAY ( PD_RS232_S_LOOP )
46 #define DEFAULT_AUTO ( PD_RS232_A_DTR | PD_RS232_A_RFR | PD_RS232_A_CTS | PD_RS232_A_DSR )
47 #define DEFAULT_NOTIFY 0x00
48 #define DEFAULT_STATE ( PD_S_TX_ENABLE | PD_S_RX_ENABLE | PD_RS232_A_TXO | PD_RS232_A_RXO )
49 
50 #define CONTINUE_SEND 1
51 #define PAUSE_SEND 2
52 
53 #define kRxAutoFlow ((UInt32)( PD_RS232_A_RFR | PD_RS232_A_DTR | PD_RS232_A_RXO ))
54 #define kTxAutoFlow ((UInt32)( PD_RS232_A_CTS | PD_RS232_A_DSR | PD_RS232_A_TXO | PD_RS232_A_DCD ))
55 #define kControl_StateMask ((UInt32)( PD_RS232_S_CTS | PD_RS232_S_DSR | PD_RS232_S_CAR | PD_RS232_S_RI ))
56 #define kRxQueueState ((UInt32)( PD_S_RXQ_EMPTY | PD_S_RXQ_LOW_WATER | PD_S_RXQ_HIGH_WATER | PD_S_RXQ_FULL ))
57 #define kTxQueueState ((UInt32)( PD_S_TXQ_EMPTY | PD_S_TXQ_LOW_WATER | PD_S_TXQ_HIGH_WATER | PD_S_TXQ_FULL ))
58 
59 #define kCONTROL_DTR 0x01
60 #define kCONTROL_RTS 0x02
61 
62 #define kStateTransientMask 0x74
63 #define kBreakError 0x04
64 #define kFrameError 0x10
65 #define kParityError 0x20
66 #define kOverrunError 0x40
67 
68 #define kCTS 0x80
69 #define kDSR 0x02
70 #define kRI 0x08
71 #define kDCD 0x01
72 #define kHandshakeInMask ((UInt32)( PD_RS232_S_CTS | PD_RS232_S_DSR | PD_RS232_S_CAR | PD_RS232_S_RI ))
73 
74 #define VENDOR_WRITE_REQUEST_TYPE 0x40
75 #define VENDOR_WRITE_REQUEST 0x01
76 
77 #define VENDOR_READ_REQUEST_TYPE 0xc0
78 #define VENDOR_READ_REQUEST 0x01
79 
80 // Device Configuration Registers (DCR0, DCR1, DCR2)
81 #define SET_DCR0 0x00
82 #define GET_DCR0 0x80
83 #define DCR0_INIT 0x01
84 #define DCR0_INIT_H 0x41
85 #define DCR0_INIT_X 0x61
86 
87 #define SET_DCR1 0x01
88 #define GET_DCR1 0x81
89 #define DCR1_INIT_H 0x80
90 #define DCR1_INIT_X 0x00
91 
92 #define SET_DCR2 0x02
93 #define GET_DCR2 0x82
94 #define DCR2_INIT_H 0x24
95 #define DCR2_INIT_X 0x44
96 
97 // On-chip Data Buffers:
98 #define RESET_DOWNSTREAM_DATA_PIPE 0x08
99 #define RESET_UPSTREAM_DATA_PIPE 0x09
100 
101 
102 #define PL_MAX_ENDPOINTS 4
103 
104 enum tXO_State {
105  kXOnSent = -2,
106  kXOffSent = -1,
107  kXO_Idle = 0,
110 };
111 
114  type_0, /* don't know the difference between type 0 and */
115  type_1, /* type 1, until someone from prolific tells us... */
117  rev_HX, /* HX version of the pl2303 chip */
119 };
120 
121 
122 class PL2303 : public ACM {
123  uint16_t wPLType; // Type of chip
124 
125 public:
126  PL2303(USB *pusb, CDCAsyncOper *pasync);
127 
128  // USBDeviceConfig implementation
129  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
130  //virtual uint8_t Release();
131  //virtual uint8_t Poll();
132  //virtual uint8_t GetAddress() { return bAddress; };
133 
135  //virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
136 
137 #ifdef PL2303_COMPAT
138 private:
139  /* Prolific proprietary requests */
140  uint8_t vendorRead( uint8_t val_lo, uint8_t val_hi, uint16_t index, uint8_t* buf );
141  uint8_t vendorWrite( uint8_t val_lo, uint8_t val_hi, uint8_t index );
142 #endif
143 };
144 
145 #ifdef PL2303_COMPAT
146 /* vendor read request */
147 inline uint8_t PL2303::vendorRead( uint8_t val_lo, uint8_t val_hi, uint16_t index, uint8_t* buf )
148 {
149  return( pUsb->ctrlReq(bAddress, 0, VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, val_lo, val_hi, index, 1, 1, buf, NULL ));
150 }
151 
152 /* vendor write request */
153 inline uint8_t PL2303::vendorWrite( uint8_t val_lo, uint8_t val_hi, uint8_t index )
154 {
155  return( pUsb->ctrlReq(bAddress, 0, VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, val_lo, val_hi, index, 0, 0, NULL, NULL ));
156 }
157 #endif
158 
159 #endif // __CDCPROLIFIC_H__
#define VENDOR_READ_REQUEST_TYPE
Definition: cdcprolific.h:77
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: cdcprolific.cpp:24
PL2303(USB *pusb, CDCAsyncOper *pasync)
Definition: cdcprolific.cpp:19
-
USB * pUsb
Definition: cdcacm.h:169
+
USB * pUsb
Definition: cdcacm.h:165
#define VENDOR_WRITE_REQUEST_TYPE
Definition: cdcprolific.h:74
#define VENDOR_READ_REQUEST
Definition: cdcprolific.h:78
tXO_State
Definition: cdcprolific.h:104
-
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:126
+
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
Definition: Usb.cpp:133
pl2303_type
Definition: cdcprolific.h:112
-
uint8_t bAddress
Definition: cdcacm.h:171
+
uint8_t bAddress
Definition: cdcacm.h:167
#define VENDOR_WRITE_REQUEST
Definition: cdcprolific.h:75
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
Definition: cdcacm.h:163
diff --git a/class_a_c_m-members.html b/class_a_c_m-members.html index deed73fc..3ecc3d05 100644 --- a/class_a_c_m-members.html +++ b/class_a_c_m-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)ACMvirtual enhanced_features(void)ACMinlinevirtual enhanced_status(void)ACMinlinevirtual - epDataInIndexACMprotectedstatic - epDataOutIndexACMprotectedstatic - epInfoACMprotected - epInterruptInIndexACMprotectedstatic + epDataInIndexACMstatic + epDataOutIndexACMstatic + epInfoACM + epInterruptInIndexACMstatic GetAddress()ACMinlinevirtual GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM GetLineCoding(LINE_CODING *dataptr)ACM @@ -142,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_a_c_m.html b/class_a_c_m.html index 0ee9a3fe..50d7d03e 100644 --- a/class_a_c_m.html +++ b/class_a_c_m.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: ACM Class Reference @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
Public Member Functions | +Public Attributes | +Static Public Attributes | Protected Member Functions | Protected Attributes | -Static Protected Attributes | List of all members
ACM Class Reference
@@ -186,6 +165,20 @@ Public Member Functions virtual bool DEVSUBCLASSOK (uint8_t subklass)   + + + +

+Public Attributes

EpInfo epInfo [ACM_MAX_ENDPOINTS]
 
+ + + + + + + +

+Static Public Attributes

static const uint8_t epDataInIndex = 1
 
static const uint8_t epDataOutIndex = 2
 
static const uint8_t epInterruptInIndex = 3
 
@@ -215,23 +208,14 @@ Protected Attributes - - -

Protected Member Functions

void PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
 
tty_features _enhanced_status
 
EpInfo epInfo [ACM_MAX_ENDPOINTS]
 
- - - - - - -

-Static Protected Attributes

static const uint8_t epDataInIndex = 1
 
static const uint8_t epDataOutIndex = 2
 
static const uint8_t epInterruptInIndex = 3
 

Detailed Description

-

Definition at line 163 of file cdcacm.h.

+

Definition at line 163 of file cdcacm.h.

Constructor & Destructor Documentation

- + +

◆ ACM()

+
@@ -255,12 +239,14 @@ Static Protected Attributes
-

Definition at line 23 of file cdcacm.cpp.

+

Definition at line 23 of file cdcacm.cpp.

Member Function Documentation

- + +

◆ PrintEndpointDescriptor()

+
@@ -282,11 +268,13 @@ Static Protected Attributes
-

Definition at line 318 of file cdcacm.cpp.

+

Definition at line 352 of file cdcacm.cpp.

- + +

◆ SetCommFeature()

+
@@ -316,11 +304,13 @@ Static Protected Attributes
-

Definition at line 290 of file cdcacm.cpp.

+

Definition at line 296 of file cdcacm.cpp.

- + +

◆ GetCommFeature()

+
@@ -350,11 +340,13 @@ Static Protected Attributes
-

Definition at line 294 of file cdcacm.cpp.

+

Definition at line 304 of file cdcacm.cpp.

- + +

◆ ClearCommFeature()

+
@@ -368,11 +360,13 @@ Static Protected Attributes
-

Definition at line 298 of file cdcacm.cpp.

+

Definition at line 312 of file cdcacm.cpp.

- + +

◆ SetLineCoding()

+
@@ -386,11 +380,13 @@ Static Protected Attributes
-

Definition at line 302 of file cdcacm.cpp.

+

Definition at line 320 of file cdcacm.cpp.

- + +

◆ GetLineCoding()

+
@@ -404,11 +400,13 @@ Static Protected Attributes
-

Definition at line 306 of file cdcacm.cpp.

+

Definition at line 328 of file cdcacm.cpp.

- + +

◆ SetControlLineState()

+
@@ -422,11 +420,13 @@ Static Protected Attributes
-

Definition at line 310 of file cdcacm.cpp.

+

Definition at line 336 of file cdcacm.cpp.

- + +

◆ SendBreak()

+
@@ -440,11 +440,13 @@ Static Protected Attributes
-

Definition at line 314 of file cdcacm.cpp.

+

Definition at line 344 of file cdcacm.cpp.

- + +

◆ GetNotif()

+
@@ -470,7 +472,9 @@ Static Protected Attributes - + +

◆ RcvData()

+
@@ -494,11 +498,13 @@ Static Protected Attributes
-

Definition at line 282 of file cdcacm.cpp.

+

Definition at line 280 of file cdcacm.cpp.

- + +

◆ SndData()

+
@@ -522,11 +528,13 @@ Static Protected Attributes
-

Definition at line 286 of file cdcacm.cpp.

+

Definition at line 288 of file cdcacm.cpp.

- + +

◆ Init()

+
@@ -568,11 +576,13 @@ Static Protected Attributes

Reimplemented in PL2303.

-

Definition at line 46 of file cdcacm.cpp.

+

Definition at line 46 of file cdcacm.cpp.

- + +

◆ Release()

+
@@ -595,11 +605,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 259 of file cdcacm.cpp.

+

Definition at line 258 of file cdcacm.cpp.

- + +

◆ Poll()

+
@@ -622,11 +634,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 273 of file cdcacm.cpp.

+

Definition at line 272 of file cdcacm.cpp.

- + +

◆ available()

+
@@ -648,11 +662,13 @@ Static Protected Attributes
-

Definition at line 206 of file cdcacm.h.

+

Definition at line 205 of file cdcacm.h.

- + +

◆ GetAddress()

+
@@ -675,11 +691,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 210 of file cdcacm.h.

+

Definition at line 209 of file cdcacm.h.

- + +

◆ isReady()

+
@@ -700,11 +718,13 @@ Static Protected Attributes
-

Definition at line 214 of file cdcacm.h.

+

Definition at line 213 of file cdcacm.h.

- + +

◆ enhanced_status()

+
@@ -726,11 +746,13 @@ Static Protected Attributes
-

Definition at line 218 of file cdcacm.h.

+

Definition at line 217 of file cdcacm.h.

- + +

◆ enhanced_features()

+
@@ -754,11 +776,13 @@ Static Protected Attributes

Reimplemented in XR21B1411.

-

Definition at line 222 of file cdcacm.h.

+

Definition at line 221 of file cdcacm.h.

- + +

◆ autoflowRTS()

+
@@ -782,11 +806,13 @@ Static Protected Attributes

Reimplemented in XR21B1411.

-

Definition at line 233 of file cdcacm.h.

+

Definition at line 232 of file cdcacm.h.

- + +

◆ autoflowDSR()

+
@@ -810,11 +836,13 @@ Static Protected Attributes

Reimplemented in XR21B1411.

-

Definition at line 236 of file cdcacm.h.

+

Definition at line 235 of file cdcacm.h.

- + +

◆ autoflowXON()

+
@@ -838,11 +866,13 @@ Static Protected Attributes

Reimplemented in XR21B1411.

-

Definition at line 239 of file cdcacm.h.

+

Definition at line 238 of file cdcacm.h.

- + +

◆ half_duplex()

+
@@ -866,11 +896,13 @@ Static Protected Attributes

Reimplemented in XR21B1411.

-

Definition at line 242 of file cdcacm.h.

+

Definition at line 241 of file cdcacm.h.

- + +

◆ wide()

+
@@ -892,11 +924,13 @@ Static Protected Attributes
-

Definition at line 245 of file cdcacm.h.

+

Definition at line 244 of file cdcacm.h.

- + +

◆ EndpointXtract()

+
@@ -948,78 +982,14 @@ Static Protected Attributes

Reimplemented from UsbConfigXtracter.

-

Definition at line 231 of file cdcacm.cpp.

+

Definition at line 231 of file cdcacm.cpp.

Member Data Documentation

- -
-
-
- - - - -
- - - - -
const uint8_t ACM::epDataInIndex = 1
-
-staticprotected
-
+ +

◆ pUsb

-

Definition at line 165 of file cdcacm.h.

- -
-
- -
-
- - - - - -
- - - - -
const uint8_t ACM::epDataOutIndex = 2
-
-staticprotected
-
- -

Definition at line 166 of file cdcacm.h.

- -
-
- -
-
- - - - - -
- - - - -
const uint8_t ACM::epInterruptInIndex = 3
-
-staticprotected
-
- -

Definition at line 167 of file cdcacm.h.

- -
-
-
@@ -1037,11 +1007,13 @@ Static Protected Attributes
-

Definition at line 169 of file cdcacm.h.

+

Definition at line 165 of file cdcacm.h.

- + +

◆ pAsync

+
@@ -1059,11 +1031,13 @@ Static Protected Attributes
-

Definition at line 170 of file cdcacm.h.

+

Definition at line 166 of file cdcacm.h.

- + +

◆ bAddress

+
@@ -1081,11 +1055,13 @@ Static Protected Attributes
-

Definition at line 171 of file cdcacm.h.

+

Definition at line 167 of file cdcacm.h.

- + +

◆ bConfNum

+
@@ -1103,11 +1079,13 @@ Static Protected Attributes
-

Definition at line 172 of file cdcacm.h.

+

Definition at line 168 of file cdcacm.h.

- + +

◆ bControlIface

+
@@ -1125,11 +1103,13 @@ Static Protected Attributes
-

Definition at line 173 of file cdcacm.h.

+

Definition at line 169 of file cdcacm.h.

- + +

◆ bDataIface

+
@@ -1147,11 +1127,13 @@ Static Protected Attributes
-

Definition at line 174 of file cdcacm.h.

+

Definition at line 170 of file cdcacm.h.

- + +

◆ bNumEP

+
@@ -1169,11 +1151,13 @@ Static Protected Attributes
-

Definition at line 175 of file cdcacm.h.

+

Definition at line 171 of file cdcacm.h.

- + +

◆ qNextPollTime

+
@@ -1191,11 +1175,13 @@ Static Protected Attributes
-

Definition at line 176 of file cdcacm.h.

+

Definition at line 172 of file cdcacm.h.

- + +

◆ bPollEnable

+
@@ -1213,11 +1199,13 @@ Static Protected Attributes
-

Definition at line 177 of file cdcacm.h.

+

Definition at line 173 of file cdcacm.h.

- + +

◆ ready

+
@@ -1235,11 +1223,13 @@ Static Protected Attributes
-

Definition at line 178 of file cdcacm.h.

+

Definition at line 174 of file cdcacm.h.

- + +

◆ _enhanced_status

+
@@ -1257,11 +1247,13 @@ Static Protected Attributes
-

Definition at line 179 of file cdcacm.h.

+

Definition at line 175 of file cdcacm.h.

- + +

◆ epDataInIndex

+
@@ -1269,17 +1261,81 @@ Static Protected Attributes +static
- +
EpInfo ACM::epInfo[ACM_MAX_ENDPOINTS]const uint8_t ACM::epDataInIndex = 1
-protected
-

Definition at line 181 of file cdcacm.h.

+

Definition at line 180 of file cdcacm.h.

+ +
+
+ +

◆ epDataOutIndex

+ +
+
+ + + + + +
+ + + + +
const uint8_t ACM::epDataOutIndex = 2
+
+static
+
+ +

Definition at line 181 of file cdcacm.h.

+ +
+
+ +

◆ epInterruptInIndex

+ +
+
+ + + + + +
+ + + + +
const uint8_t ACM::epInterruptInIndex = 3
+
+static
+
+ +

Definition at line 182 of file cdcacm.h.

+ +
+
+ +

◆ epInfo

+ +
+
+ + + + +
EpInfo ACM::epInfo[ACM_MAX_ENDPOINTS]
+
+ +

Definition at line 183 of file cdcacm.h.

@@ -1292,7 +1348,7 @@ Static Protected Attributes diff --git a/class_a_c_m__coll__graph.md5 b/class_a_c_m__coll__graph.md5 index f43712cc..be335838 100644 --- a/class_a_c_m__coll__graph.md5 +++ b/class_a_c_m__coll__graph.md5 @@ -1 +1 @@ -587ce662854a9a2b4677918117ea2d18 \ No newline at end of file +38f287d7d437d8845cd9849dda3c4ebc \ No newline at end of file diff --git a/class_a_c_m__coll__graph.png b/class_a_c_m__coll__graph.png index 8544d30d..d08e029a 100644 Binary files a/class_a_c_m__coll__graph.png and b/class_a_c_m__coll__graph.png differ diff --git a/class_a_c_m__inherit__graph.md5 b/class_a_c_m__inherit__graph.md5 index 69d55cdc..f0237ac2 100644 --- a/class_a_c_m__inherit__graph.md5 +++ b/class_a_c_m__inherit__graph.md5 @@ -1 +1 @@ -1778af41b23c3b83c73bd88577cd17cc \ No newline at end of file +34233ca0a4afb6e0d20ee9a1d854c8cf \ No newline at end of file diff --git a/class_a_c_m__inherit__graph.png b/class_a_c_m__inherit__graph.png index ff988c4b..863fa977 100644 Binary files a/class_a_c_m__inherit__graph.png and b/class_a_c_m__inherit__graph.png differ diff --git a/class_a_d_k-members.html b/class_a_d_k-members.html index 13ffc9ca..33f16e4f 100644 --- a/class_a_d_k-members.html +++ b/class_a_d_k-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 53 of file adk.h.

+

Definition at line 53 of file adk.h.

Constructor & Destructor Documentation

- + +

◆ ADK()

+
@@ -235,12 +215,14 @@ Static Protected Attributes
-

Definition at line 25 of file adk.cpp.

+

Definition at line 25 of file adk.cpp.

Member Function Documentation

- + +

◆ PrintEndpointDescriptor()

+
@@ -262,11 +244,13 @@ Static Protected Attributes
-

Definition at line 357 of file adk.cpp.

+

Definition at line 357 of file adk.cpp.

- + +

◆ RcvData()

+
@@ -290,11 +274,13 @@ Static Protected Attributes
-

Definition at line 347 of file adk.cpp.

+

Definition at line 347 of file adk.cpp.

- + +

◆ SndData()

+
@@ -318,11 +304,13 @@ Static Protected Attributes
-

Definition at line 353 of file adk.cpp.

+

Definition at line 353 of file adk.cpp.

- + +

◆ ConfigureDevice()

+
@@ -362,11 +350,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 59 of file adk.cpp.

+

Definition at line 59 of file adk.cpp.

- + +

◆ Init()

+
@@ -406,11 +396,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 64 of file adk.cpp.

+

Definition at line 64 of file adk.cpp.

- + +

◆ Release()

+
@@ -433,11 +425,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 337 of file adk.cpp.

+

Definition at line 337 of file adk.cpp.

- + +

◆ Poll()

+
@@ -460,11 +454,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 103 of file adk.h.

+

Definition at line 103 of file adk.h.

- + +

◆ GetAddress()

+
@@ -487,11 +483,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 107 of file adk.h.

+

Definition at line 107 of file adk.h.

- + +

◆ isReady()

+
@@ -512,11 +510,13 @@ Static Protected Attributes
-

Definition at line 111 of file adk.h.

+

Definition at line 111 of file adk.h.

- + +

◆ VIDPIDOK()

+
@@ -550,11 +550,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 115 of file adk.h.

+

Definition at line 115 of file adk.h.

- + +

◆ EndpointXtract()

+
@@ -606,12 +608,14 @@ Static Protected Attributes

Reimplemented from UsbConfigXtracter.

-

Definition at line 312 of file adk.cpp.

+

Definition at line 312 of file adk.cpp.

Member Data Documentation

- + +

◆ epDataInIndex

+
@@ -629,11 +633,13 @@ Static Protected Attributes
-

Definition at line 69 of file adk.h.

+

Definition at line 69 of file adk.h.

- + +

◆ epDataOutIndex

+
@@ -651,11 +657,13 @@ Static Protected Attributes
-

Definition at line 70 of file adk.h.

+

Definition at line 70 of file adk.h.

- + +

◆ pUsb

+
@@ -673,11 +681,13 @@ Static Protected Attributes
-

Definition at line 73 of file adk.h.

+

Definition at line 73 of file adk.h.

- + +

◆ bAddress

+
@@ -695,11 +705,13 @@ Static Protected Attributes
-

Definition at line 74 of file adk.h.

+

Definition at line 74 of file adk.h.

- + +

◆ bConfNum

+
@@ -717,11 +729,13 @@ Static Protected Attributes
-

Definition at line 75 of file adk.h.

+

Definition at line 75 of file adk.h.

- + +

◆ bNumEP

+
@@ -739,11 +753,13 @@ Static Protected Attributes
-

Definition at line 77 of file adk.h.

+

Definition at line 77 of file adk.h.

- + +

◆ ready

+
@@ -761,11 +777,13 @@ Static Protected Attributes
-

Definition at line 78 of file adk.h.

+

Definition at line 78 of file adk.h.

- + +

◆ epInfo

+
@@ -783,7 +801,7 @@ Static Protected Attributes
-

Definition at line 81 of file adk.h.

+

Definition at line 81 of file adk.h.

@@ -796,7 +814,7 @@ Static Protected Attributes diff --git a/class_a_d_k__coll__graph.md5 b/class_a_d_k__coll__graph.md5 index 6e64816d..25bc8093 100644 --- a/class_a_d_k__coll__graph.md5 +++ b/class_a_d_k__coll__graph.md5 @@ -1 +1 @@ -677a6776b852e96bee247fd946d74be2 \ No newline at end of file +348104757e62d2b90a8ea7ecf8b2514d \ No newline at end of file diff --git a/class_a_d_k__coll__graph.png b/class_a_d_k__coll__graph.png index db04a5df..a8a123a6 100644 Binary files a/class_a_d_k__coll__graph.png and b/class_a_d_k__coll__graph.png differ diff --git a/class_a_d_k__inherit__graph.md5 b/class_a_d_k__inherit__graph.md5 index 55e30802..473c9f33 100644 --- a/class_a_d_k__inherit__graph.md5 +++ b/class_a_d_k__inherit__graph.md5 @@ -1 +1 @@ -bca330dbfb30c1761bf024a703ee6a77 \ No newline at end of file +5f518fcc911734c80c7fef9e0bbfcf11 \ No newline at end of file diff --git a/class_a_d_k__inherit__graph.png b/class_a_d_k__inherit__graph.png index a3c46fda..748f40dd 100644 Binary files a/class_a_d_k__inherit__graph.png and b/class_a_d_k__inherit__graph.png differ diff --git a/class_address_pool-members.html b/class_address_pool-members.html index 63250730..3943f453 100644 --- a/class_address_pool-members.html +++ b/class_address_pool-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 83 of file address.h.

+

Definition at line 90 of file address.h.

Member Function Documentation

- + +

◆ GetUsbDevicePtr()

+
@@ -142,7 +122,9 @@ Public Member Functions - + +

◆ AllocAddress()

+
@@ -184,7 +166,9 @@ Public Member Functions - + +

◆ FreeAddress()

+
@@ -218,7 +202,7 @@ Public Member Functions diff --git a/class_address_pool__inherit__graph.md5 b/class_address_pool__inherit__graph.md5 index 67a01c56..01fc9bff 100644 --- a/class_address_pool__inherit__graph.md5 +++ b/class_address_pool__inherit__graph.md5 @@ -1 +1 @@ -1e8b44e83a78a2dc42bcafc432f2a436 \ No newline at end of file +555ffc408a79052867a3f670eda97a3c \ No newline at end of file diff --git a/class_address_pool__inherit__graph.png b/class_address_pool__inherit__graph.png index e9f3f0da..8c5c24ad 100644 Binary files a/class_address_pool__inherit__graph.png and b/class_address_pool__inherit__graph.png differ diff --git a/class_address_pool_impl-members.html b/class_address_pool_impl-members.html index 367af086..245a09b9 100644 --- a/class_address_pool_impl-members.html +++ b/class_address_pool_impl-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +
class AddressPoolImpl< MAX_DEVICES_ALLOWED > -

Definition at line 96 of file address.h.

+

Definition at line 103 of file address.h.

Constructor & Destructor Documentation

- + +

◆ AddressPoolImpl()

+
@@ -153,12 +133,14 @@ template<const uint8_t MAX_DEVICES_ALLOWED>
-

Definition at line 164 of file address.h.

+

Definition at line 171 of file address.h.

Member Function Documentation

- + +

◆ GetUsbDevicePtr()

+
@@ -184,11 +166,13 @@ template<const uint8_t MAX_DEVICES_ALLOWED>

Implements AddressPool.

-

Definition at line 181 of file address.h.

+

Definition at line 188 of file address.h.

- + +

◆ ForEachUsbDevice()

+
@@ -212,11 +196,13 @@ template<const uint8_t MAX_DEVICES_ALLOWED>
-

Definition at line 192 of file address.h.

+

Definition at line 199 of file address.h.

- + +

◆ AllocAddress()

+
@@ -258,11 +244,13 @@ template<const uint8_t MAX_DEVICES_ALLOWED>

Implements AddressPool.

-

Definition at line 203 of file address.h.

+

Definition at line 210 of file address.h.

- + +

◆ FreeAddress()

+
@@ -288,7 +276,7 @@ template<const uint8_t MAX_DEVICES_ALLOWED>

Implements AddressPool.

-

Definition at line 255 of file address.h.

+

Definition at line 262 of file address.h.

@@ -300,7 +288,7 @@ template<const uint8_t MAX_DEVICES_ALLOWED>
diff --git a/class_address_pool_impl__coll__graph.md5 b/class_address_pool_impl__coll__graph.md5 index 77f1e07a..b9076984 100644 --- a/class_address_pool_impl__coll__graph.md5 +++ b/class_address_pool_impl__coll__graph.md5 @@ -1 +1 @@ -77bc5e9fa2748d39429df403e8aba060 \ No newline at end of file +0ccbc0934c894d97b943ba1fd85404e1 \ No newline at end of file diff --git a/class_address_pool_impl__coll__graph.png b/class_address_pool_impl__coll__graph.png index 81e28399..c74587b3 100644 Binary files a/class_address_pool_impl__coll__graph.png and b/class_address_pool_impl__coll__graph.png differ diff --git a/class_address_pool_impl__inherit__graph.md5 b/class_address_pool_impl__inherit__graph.md5 index 77f1e07a..f9ed713c 100644 --- a/class_address_pool_impl__inherit__graph.md5 +++ b/class_address_pool_impl__inherit__graph.md5 @@ -1 +1 @@ -77bc5e9fa2748d39429df403e8aba060 \ No newline at end of file +bf21db1ad5951b3ac32e2bce64875193 \ No newline at end of file diff --git a/class_address_pool_impl__inherit__graph.png b/class_address_pool_impl__inherit__graph.png index 81e28399..c74587b3 100644 Binary files a/class_address_pool_impl__inherit__graph.png and b/class_address_pool_impl__inherit__graph.png differ diff --git a/class_b_t_d-members.html b/class_b_t_d-members.html index 5c26c4d3..af16b35d 100644 --- a/class_b_t_d-members.html +++ b/class_b_t_d-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
rfcommConnectionClaimedBTD sdpConnectionClaimedBTD VIDPIDOK(uint16_t vid, uint16_t pid)BTDinlinevirtual - watingForConnectionBTD + waitingForConnectionBTD wiiUProControllerBTD
diff --git a/class_b_t_d.html b/class_b_t_d.html index 2b7d8ef2..d3e8213b 100644 --- a/class_b_t_d.html +++ b/class_b_t_d.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: BTD Class Reference @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@ - + - - + + + +
- - + + @@ -290,9 +268,11 @@ Static Protected Attributes

Detailed Description

The Bluetooth Dongle class will take care of all the USB communication and then pass the data to the BluetoothService classes.

-

Definition at line 198 of file BTD.h.

+

Definition at line 201 of file BTD.h.

Constructor & Destructor Documentation

- + +

◆ BTD()

+

Public Attributes

bool watingForConnection
 
bool waitingForConnection
 
bool l2capConnectionClaimed
 
bool sdpConnectionClaimed
@@ -312,12 +292,14 @@ Static Protected Attributes -

Definition at line 27 of file BTD.cpp.

+

Definition at line 27 of file BTD.cpp.

Member Function Documentation

- + +

◆ ConfigureDevice()

+
@@ -366,11 +348,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 48 of file BTD.cpp.

+

Definition at line 48 of file BTD.cpp.

- + +

◆ Init()

+
@@ -419,11 +403,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 134 of file BTD.cpp.

+

Definition at line 134 of file BTD.cpp.

- + +

◆ Release()

+
@@ -447,11 +433,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 378 of file BTD.cpp.

+

Definition at line 376 of file BTD.cpp.

- + +

◆ Poll()

+
@@ -475,11 +463,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 384 of file BTD.cpp.

+

Definition at line 382 of file BTD.cpp.

- + +

◆ GetAddress()

+
@@ -503,11 +493,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 238 of file BTD.h.

+

Definition at line 241 of file BTD.h.

- + +

◆ isReady()

+
@@ -529,11 +521,13 @@ Static Protected Attributes

Used to check if the dongle has been initialized.

Returns
True if it's ready.
-

Definition at line 246 of file BTD.h.

+

Definition at line 249 of file BTD.h.

- + +

◆ DEVCLASSOK()

+
@@ -564,11 +558,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 255 of file BTD.h.

+

Definition at line 258 of file BTD.h.

- + +

◆ VIDPIDOK()

+
@@ -610,11 +606,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 266 of file BTD.h.

+

Definition at line 269 of file BTD.h.

- + +

◆ EndpointXtract()

+
@@ -676,11 +674,13 @@ Static Protected Attributes

Reimplemented from UsbConfigXtracter.

-

Definition at line 327 of file BTD.cpp.

+

Definition at line 327 of file BTD.cpp.

- + +

◆ disconnect()

+
@@ -694,11 +694,13 @@ Static Protected Attributes

Disconnects both the L2CAP Channel and the HCI Connection for all Bluetooth services.

-

Definition at line 396 of file BTD.cpp.

+

Definition at line 394 of file BTD.cpp.

- + +

◆ registerBluetoothService()

+
@@ -727,11 +729,13 @@ Static Protected Attributes
Returns
The service ID on success or -1 on fail.
-

Definition at line 297 of file BTD.h.

+

Definition at line 300 of file BTD.h.

- + +

◆ HCI_Command()

+
@@ -762,11 +766,13 @@ Static Protected Attributes -

Definition at line 950 of file BTD.cpp.

+

Definition at line 948 of file BTD.cpp.

- + +

◆ hci_reset()

+
@@ -780,11 +786,13 @@ Static Protected Attributes

Reset the Bluetooth dongle.

-

Definition at line 955 of file BTD.cpp.

+

Definition at line 953 of file BTD.cpp.

- + +

◆ hci_read_bdaddr()

+
@@ -798,11 +806,13 @@ Static Protected Attributes

Read the Bluetooth address of the dongle.

-

Definition at line 986 of file BTD.cpp.

+

Definition at line 984 of file BTD.cpp.

- + +

◆ hci_read_local_version_information()

+
@@ -816,11 +826,13 @@ Static Protected Attributes

Read the HCI Version of the Bluetooth dongle.

-

Definition at line 995 of file BTD.cpp.

+

Definition at line 993 of file BTD.cpp.

- + +

◆ hci_set_local_name()

+
@@ -840,11 +852,13 @@ Static Protected Attributes -

Definition at line 1039 of file BTD.cpp.

+

Definition at line 1037 of file BTD.cpp.

- + +

◆ hci_write_scan_enable()

+
@@ -858,11 +872,13 @@ Static Protected Attributes

Enable visibility to other Bluetooth devices.

-

Definition at line 964 of file BTD.cpp.

+

Definition at line 962 of file BTD.cpp.

- + +

◆ hci_write_scan_disable()

+
@@ -876,11 +892,13 @@ Static Protected Attributes

Disable visibility to other Bluetooth devices.

-

Definition at line 977 of file BTD.cpp.

+

Definition at line 975 of file BTD.cpp.

- + +

◆ hci_remote_name()

+
@@ -894,11 +912,13 @@ Static Protected Attributes

Read the remote devices name.

-

Definition at line 1020 of file BTD.cpp.

+

Definition at line 1018 of file BTD.cpp.

- + +

◆ hci_accept_connection()

+
@@ -912,11 +932,13 @@ Static Protected Attributes

Accept the connection with the Bluetooth device.

-

Definition at line 1004 of file BTD.cpp.

+

Definition at line 1002 of file BTD.cpp.

- + +

◆ hci_disconnect()

+
@@ -936,11 +958,13 @@ Static Protected Attributes -

Definition at line 1173 of file BTD.cpp.

+

Definition at line 1171 of file BTD.cpp.

- + +

◆ hci_pin_code_request_reply()

+
@@ -954,11 +978,13 @@ Static Protected Attributes

Respond with the pin for the connection. The pin is automatically set for the Wii library, but can be customized for the SPP library.

-

Definition at line 1099 of file BTD.cpp.

+

Definition at line 1097 of file BTD.cpp.

- + +

◆ hci_pin_code_negative_request_reply()

+
@@ -972,11 +998,13 @@ Static Protected Attributes

Respons when no pin was set.

-

Definition at line 1135 of file BTD.cpp.

+

Definition at line 1133 of file BTD.cpp.

- + +

◆ hci_link_key_request_negative_reply()

+
@@ -990,11 +1018,13 @@ Static Protected Attributes

Command is used to reply to a Link Key Request event from the BR/EDR Controller if the Host does not have a stored Link Key for the connection.

-

Definition at line 1149 of file BTD.cpp.

+

Definition at line 1147 of file BTD.cpp.

- + +

◆ hci_authentication_request()

+
@@ -1008,11 +1038,13 @@ Static Protected Attributes

Used to try to authenticate with the remote device.

-

Definition at line 1163 of file BTD.cpp.

+

Definition at line 1161 of file BTD.cpp.

- + +

◆ hci_inquiry()

+
@@ -1026,11 +1058,13 @@ Static Protected Attributes

Start a HCI inquiry.

-

Definition at line 1051 of file BTD.cpp.

+

Definition at line 1049 of file BTD.cpp.

- + +

◆ hci_inquiry_cancel()

+
@@ -1044,11 +1078,13 @@ Static Protected Attributes

Cancel a HCI inquiry.

-

Definition at line 1065 of file BTD.cpp.

+

Definition at line 1063 of file BTD.cpp.

- + +

◆ hci_connect() [1/2]

+
@@ -1062,11 +1098,13 @@ Static Protected Attributes

Connect to last device communicated with.

-

Definition at line 1073 of file BTD.cpp.

+

Definition at line 1071 of file BTD.cpp.

- + +

◆ hci_connect() [2/2]

+
@@ -1086,11 +1124,13 @@ Static Protected Attributes -

Definition at line 1077 of file BTD.cpp.

+

Definition at line 1075 of file BTD.cpp.

- + +

◆ hci_write_class_of_device()

+
@@ -1104,11 +1144,13 @@ Static Protected Attributes

Used to a set the class of the device.

-

Definition at line 1185 of file BTD.cpp.

+

Definition at line 1183 of file BTD.cpp.

- + +

◆ L2CAP_Command()

+
@@ -1159,11 +1201,13 @@ Static Protected Attributes -

Definition at line 1221 of file BTD.cpp.

+

Definition at line 1219 of file BTD.cpp.

- + +

◆ l2cap_connection_request()

+
@@ -1208,11 +1252,13 @@ Static Protected Attributes -

Definition at line 1249 of file BTD.cpp.

+

Definition at line 1247 of file BTD.cpp.

- + +

◆ l2cap_connection_response()

+
@@ -1264,11 +1310,13 @@ Static Protected Attributes -

Definition at line 1262 of file BTD.cpp.

+

Definition at line 1260 of file BTD.cpp.

- + +

◆ l2cap_config_request()

+
@@ -1306,11 +1354,13 @@ Static Protected Attributes -

Definition at line 1279 of file BTD.cpp.

+

Definition at line 1277 of file BTD.cpp.

- + +

◆ l2cap_config_response()

+
@@ -1348,11 +1398,13 @@ Static Protected Attributes -

Definition at line 1296 of file BTD.cpp.

+

Definition at line 1294 of file BTD.cpp.

- + +

◆ l2cap_disconnection_request()

+
@@ -1397,11 +1449,13 @@ Static Protected Attributes -

Definition at line 1315 of file BTD.cpp.

+

Definition at line 1313 of file BTD.cpp.

- + +

◆ l2cap_disconnection_response()

+
@@ -1446,11 +1500,13 @@ Static Protected Attributes -

Definition at line 1328 of file BTD.cpp.

+

Definition at line 1326 of file BTD.cpp.

- + +

◆ l2cap_information_response()

+
@@ -1494,11 +1550,13 @@ Static Protected Attributes -

Definition at line 1341 of file BTD.cpp.

+

Definition at line 1339 of file BTD.cpp.

- + +

◆ pairWithWiimote()

+
@@ -1520,11 +1578,13 @@ Static Protected Attributes

Call this function to pair with a Wiimote

-

Definition at line 464 of file BTD.h.

+

Definition at line 467 of file BTD.h.

- + +

◆ pairWithHID()

+
@@ -1544,13 +1604,15 @@ Static Protected Attributes
-

Call this function to pair with a Wiimote

+

Call this function to pair with a HID device

-

Definition at line 480 of file BTD.h.

+

Definition at line 483 of file BTD.h.

- + +

◆ readPollInterval()

+
@@ -1572,11 +1634,13 @@ Static Protected Attributes

Read the poll interval taken from the endpoint descriptors.

Returns
The poll interval in ms.
-

Definition at line 495 of file BTD.h.

+

Definition at line 499 of file BTD.h.

- + +

◆ PrintEndpointDescriptor()

+
@@ -1604,27 +1668,31 @@ Static Protected Attributes -

Definition at line 359 of file BTD.cpp.

+

Definition at line 357 of file BTD.cpp.

Member Data Documentation

- + +

◆ waitingForConnection

+
- +
bool BTD::watingForConnectionbool BTD::waitingForConnection

Use this to see if it is waiting for a incoming connection.

-

Definition at line 435 of file BTD.h.

+

Definition at line 438 of file BTD.h.

- + +

◆ l2capConnectionClaimed

+
@@ -1635,11 +1703,13 @@ Static Protected Attributes

This is used by the service to know when to store the device information.

-

Definition at line 437 of file BTD.h.

+

Definition at line 440 of file BTD.h.

- + +

◆ sdpConnectionClaimed

+
@@ -1650,11 +1720,13 @@ Static Protected Attributes

This is used by the SPP library to claim the current SDP incoming request.

-

Definition at line 439 of file BTD.h.

+

Definition at line 442 of file BTD.h.

- + +

◆ rfcommConnectionClaimed

+
@@ -1665,11 +1737,13 @@ Static Protected Attributes

This is used by the SPP library to claim the current RFCOMM incoming request.

-

Definition at line 441 of file BTD.h.

+

Definition at line 444 of file BTD.h.

- + +

◆ btdName

+
@@ -1680,11 +1754,13 @@ Static Protected Attributes

The name you wish to make the dongle show up as. It is set automatically by the SPP library.

-

Definition at line 444 of file BTD.h.

+

Definition at line 447 of file BTD.h.

- + +

◆ btdPin

+
@@ -1695,11 +1771,13 @@ Static Protected Attributes

The pin you wish to make the dongle use for authentication. It is set automatically by the SPP and BTHID library.

-

Definition at line 446 of file BTD.h.

+

Definition at line 449 of file BTD.h.

- + +

◆ my_bdaddr

+
@@ -1710,11 +1788,13 @@ Static Protected Attributes

The bluetooth dongles Bluetooth address.

-

Definition at line 449 of file BTD.h.

+

Definition at line 452 of file BTD.h.

- + +

◆ hci_handle

+
@@ -1725,11 +1805,13 @@ Static Protected Attributes

HCI handle for the last connection.

-

Definition at line 451 of file BTD.h.

+

Definition at line 454 of file BTD.h.

- + +

◆ disc_bdaddr

+
@@ -1740,11 +1822,13 @@ Static Protected Attributes

Last incoming devices Bluetooth address.

-

Definition at line 453 of file BTD.h.

+

Definition at line 456 of file BTD.h.

- + +

◆ remote_name

+
@@ -1755,11 +1839,13 @@ Static Protected Attributes

First 30 chars of last remote name.

-

Definition at line 455 of file BTD.h.

+

Definition at line 458 of file BTD.h.

- + +

◆ hci_version

+
@@ -1770,11 +1856,13 @@ Static Protected Attributes

The supported HCI Version read from the Bluetooth dongle. Used by the PS3BT library to check the HCI Version of the Bluetooth dongle, it should be at least 3 to work properly with the library.

-

Definition at line 461 of file BTD.h.

+

Definition at line 464 of file BTD.h.

- + +

◆ connectToWii

+
@@ -1785,11 +1873,13 @@ Static Protected Attributes

Used to only send the ACL data to the Wiimote.

-

Definition at line 467 of file BTD.h.

+

Definition at line 470 of file BTD.h.

- + +

◆ incomingWii

+
@@ -1800,11 +1890,13 @@ Static Protected Attributes

True if a Wiimote is connecting.

-

Definition at line 471 of file BTD.h.

+

Definition at line 474 of file BTD.h.

- + +

◆ pairWithWii

+
@@ -1815,11 +1907,13 @@ Static Protected Attributes

True when it should pair with a Wiimote.

-

Definition at line 473 of file BTD.h.

+

Definition at line 476 of file BTD.h.

- + +

◆ motionPlusInside

+
@@ -1830,11 +1924,13 @@ Static Protected Attributes

True if it's the new Wiimote with the Motion Plus Inside or a Wii U Pro Controller.

-

Definition at line 475 of file BTD.h.

+

Definition at line 478 of file BTD.h.

- + +

◆ wiiUProController

+
@@ -1845,11 +1941,13 @@ Static Protected Attributes

True if it's a Wii U Pro Controller.

-

Definition at line 477 of file BTD.h.

+

Definition at line 480 of file BTD.h.

- + +

◆ connectToHIDDevice

+
@@ -1858,13 +1956,15 @@ Static Protected Attributes
-

Used to only send the ACL data to the Wiimote.

+

Used to only send the ACL data to the HID device.

-

Definition at line 483 of file BTD.h.

+

Definition at line 487 of file BTD.h.

- + +

◆ incomingHIDDevice

+
@@ -1873,13 +1973,15 @@ Static Protected Attributes
-

True if a Wiimote is connecting.

+

True if a HID device is connecting.

-

Definition at line 487 of file BTD.h.

+

Definition at line 491 of file BTD.h.

- + +

◆ pairWithHIDDevice

+
@@ -1890,11 +1992,13 @@ Static Protected Attributes

True when it should pair with a device like a mouse or keyboard.

-

Definition at line 489 of file BTD.h.

+

Definition at line 493 of file BTD.h.

- + +

◆ pUsb

+
@@ -1913,11 +2017,13 @@ Static Protected Attributes

Pointer to USB class instance.

-

Definition at line 497 of file BTD.h.

+

Definition at line 501 of file BTD.h.

- + +

◆ bAddress

+
@@ -1936,11 +2042,13 @@ Static Protected Attributes

Device address.

-

Definition at line 503 of file BTD.h.

+

Definition at line 507 of file BTD.h.

- + +

◆ epInfo

+
@@ -1959,11 +2067,13 @@ Static Protected Attributes

Endpoint info structure.

-

Definition at line 505 of file BTD.h.

+

Definition at line 509 of file BTD.h.

- + +

◆ bConfNum

+
@@ -1982,11 +2092,13 @@ Static Protected Attributes

Configuration number.

-

Definition at line 508 of file BTD.h.

+

Definition at line 512 of file BTD.h.

- + +

◆ bNumEP

+
@@ -2005,11 +2117,13 @@ Static Protected Attributes

Total number of endpoints in the configuration.

-

Definition at line 510 of file BTD.h.

+

Definition at line 514 of file BTD.h.

- + +

◆ qNextPollTime

+
@@ -2028,11 +2142,13 @@ Static Protected Attributes

Next poll time based on poll interval taken from the USB descriptor.

-

Definition at line 512 of file BTD.h.

+

Definition at line 516 of file BTD.h.

- + +

◆ BTD_CONTROL_PIPE

+
@@ -2051,11 +2167,13 @@ Static Protected Attributes

Bluetooth dongle control endpoint.

-

Definition at line 515 of file BTD.h.

+

Definition at line 519 of file BTD.h.

- + +

◆ BTD_EVENT_PIPE

+
@@ -2074,11 +2192,13 @@ Static Protected Attributes

HCI event endpoint index.

-

Definition at line 517 of file BTD.h.

+

Definition at line 521 of file BTD.h.

- + +

◆ BTD_DATAIN_PIPE

+
@@ -2097,11 +2217,13 @@ Static Protected Attributes

ACL In endpoint index.

-

Definition at line 519 of file BTD.h.

+

Definition at line 523 of file BTD.h.

- + +

◆ BTD_DATAOUT_PIPE

+
@@ -2120,7 +2242,7 @@ Static Protected Attributes

ACL Out endpoint index.

-

Definition at line 521 of file BTD.h.

+

Definition at line 525 of file BTD.h.

@@ -2133,7 +2255,7 @@ Static Protected Attributes diff --git a/class_b_t_d__coll__graph.md5 b/class_b_t_d__coll__graph.md5 index 7288133e..6b850d5b 100644 --- a/class_b_t_d__coll__graph.md5 +++ b/class_b_t_d__coll__graph.md5 @@ -1 +1 @@ -e72568841cb2f05e3bfabb29e1ce8457 \ No newline at end of file +d30fe5eedeff8ac785a92b5f99c8d16d \ No newline at end of file diff --git a/class_b_t_d__coll__graph.png b/class_b_t_d__coll__graph.png index fccee644..35f69121 100644 Binary files a/class_b_t_d__coll__graph.png and b/class_b_t_d__coll__graph.png differ diff --git a/class_b_t_d__inherit__graph.md5 b/class_b_t_d__inherit__graph.md5 index 95bb3a3b..bf83e9fe 100644 --- a/class_b_t_d__inherit__graph.md5 +++ b/class_b_t_d__inherit__graph.md5 @@ -1 +1 @@ -36ee382408a95d482da81524513435df \ No newline at end of file +cc3b5af420b1b442f97eb1e44ba768a6 \ No newline at end of file diff --git a/class_b_t_d__inherit__graph.png b/class_b_t_d__inherit__graph.png index e847ffd3..54fca8b3 100644 Binary files a/class_b_t_d__inherit__graph.png and b/class_b_t_d__inherit__graph.png differ diff --git a/class_b_t_h_i_d-members.html b/class_b_t_h_i_d-members.html index d2b57a60..c0b6d610 100644 --- a/class_b_t_h_i_d-members.html +++ b/class_b_t_h_i_d-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

This BluetoothService class implements support for Bluetooth HID devices.

-

Definition at line 29 of file BTHID.h.

+

Definition at line 29 of file BTHID.h.

Constructor & Destructor Documentation

- + +

◆ BTHID()

+
@@ -234,12 +214,14 @@ BluetoothService implementation -

Definition at line 23 of file BTHID.cpp.

+

Definition at line 23 of file BTHID.cpp.

Member Function Documentation

- + +

◆ disconnect()

+
@@ -263,11 +245,13 @@ BluetoothService implementation

Implements BluetoothService.

-

Definition at line 49 of file BTHID.cpp.

+

Definition at line 49 of file BTHID.cpp.

- + +

◆ GetReportParser()

+
@@ -296,11 +280,13 @@ BluetoothService implementation
Returns
Returns the corresponding HIDReportParser. Returns NULL if id is not valid.
-

Definition at line 49 of file BTHID.h.

+

Definition at line 49 of file BTHID.h.

- + +

◆ SetReportParser()

+
@@ -340,11 +326,13 @@ BluetoothService implementation
Returns
Returns true if the HIDReportParser is set. False otherwise.
-

Definition at line 61 of file BTHID.h.

+

Definition at line 61 of file BTHID.h.

- + +

◆ setProtocolMode()

+
@@ -372,11 +360,13 @@ BluetoothService implementation -

Definition at line 72 of file BTHID.h.

+

Definition at line 72 of file BTHID.h.

- + +

◆ setLeds() [1/2]

+
@@ -404,11 +394,13 @@ BluetoothService implementation -

Definition at line 81 of file BTHID.h.

+

Definition at line 81 of file BTHID.h.

- + +

◆ setLeds() [2/2]

+
@@ -428,11 +420,13 @@ BluetoothService implementation -

Definition at line 393 of file BTHID.cpp.

+

Definition at line 393 of file BTHID.cpp.

- + +

◆ pair()

+
@@ -455,11 +449,13 @@ BluetoothService implementation

Call this to start the pairing sequence with a device

-

Definition at line 91 of file BTHID.h.

+

Definition at line 91 of file BTHID.h.

- + +

◆ ACLData()

+
@@ -489,11 +485,13 @@ BluetoothService implementation

Implements BluetoothService.

-

Definition at line 56 of file BTHID.cpp.

+

Definition at line 56 of file BTHID.cpp.

- + +

◆ Run()

+
@@ -517,11 +515,13 @@ BluetoothService implementation

Implements BluetoothService.

-

Definition at line 344 of file BTHID.cpp.

+

Definition at line 344 of file BTHID.cpp.

- + +

◆ Reset()

+
@@ -545,11 +545,13 @@ BluetoothService implementation

Implements BluetoothService.

-

Definition at line 41 of file BTHID.cpp.

+

Definition at line 41 of file BTHID.cpp.

- + +

◆ onInit()

+
@@ -573,11 +575,13 @@ BluetoothService implementation

Implements BluetoothService.

-

Definition at line 112 of file BTHID.h.

+

Definition at line 112 of file BTHID.h.

- + +

◆ ParseBTHIDData()

+
@@ -618,11 +622,13 @@ BluetoothService implementation

Reimplemented in PS4BT.

-

Definition at line 125 of file BTHID.h.

+

Definition at line 125 of file BTHID.h.

- + +

◆ OnInitBTHID()

+
@@ -646,11 +652,13 @@ BluetoothService implementation

Reimplemented in PS4BT.

-

Definition at line 129 of file BTHID.h.

+

Definition at line 129 of file BTHID.h.

- + +

◆ ResetBTHID()

+
@@ -674,12 +682,14 @@ BluetoothService implementation

Reimplemented in PS4BT.

-

Definition at line 133 of file BTHID.h.

+

Definition at line 133 of file BTHID.h.

Member Data Documentation

- + +

◆ connected

+
@@ -690,11 +700,13 @@ BluetoothService implementation

True if a device is connected

-

Definition at line 88 of file BTHID.h.

+

Definition at line 88 of file BTHID.h.

- + +

◆ control_scid

+
@@ -713,11 +725,13 @@ BluetoothService implementation

L2CAP source CID for HID_Control

-

Definition at line 139 of file BTHID.h.

+

Definition at line 139 of file BTHID.h.

- + +

◆ interrupt_scid

+
@@ -736,7 +750,7 @@ BluetoothService implementation

L2CAP source CID for HID_Interrupt

-

Definition at line 142 of file BTHID.h.

+

Definition at line 142 of file BTHID.h.

@@ -749,7 +763,7 @@ BluetoothService implementation diff --git a/class_b_t_h_i_d__coll__graph.md5 b/class_b_t_h_i_d__coll__graph.md5 index b8a6fc7c..996a40fc 100644 --- a/class_b_t_h_i_d__coll__graph.md5 +++ b/class_b_t_h_i_d__coll__graph.md5 @@ -1 +1 @@ -328440863f58d32544996d4a0a7788ae \ No newline at end of file +e6ad60679e1606b380d672df2dfdcf2c \ No newline at end of file diff --git a/class_b_t_h_i_d__coll__graph.png b/class_b_t_h_i_d__coll__graph.png index 76ed3971..1f7b2e4a 100644 Binary files a/class_b_t_h_i_d__coll__graph.png and b/class_b_t_h_i_d__coll__graph.png differ diff --git a/class_b_t_h_i_d__inherit__graph.md5 b/class_b_t_h_i_d__inherit__graph.md5 index d99946b7..d58d7c11 100644 --- a/class_b_t_h_i_d__inherit__graph.md5 +++ b/class_b_t_h_i_d__inherit__graph.md5 @@ -1 +1 @@ -0461eab4196d51bce1337c7c83a0da9f \ No newline at end of file +73f12b410d2c8d19939b12cd5c431b1f \ No newline at end of file diff --git a/class_b_t_h_i_d__inherit__graph.png b/class_b_t_h_i_d__inherit__graph.png index 2df7f9cc..af60699e 100644 Binary files a/class_b_t_h_i_d__inherit__graph.png and b/class_b_t_h_i_d__inherit__graph.png differ diff --git a/class_bluetooth_service-members.html b/class_bluetooth_service-members.html index b0a89b3e..5fac88ee 100644 --- a/class_bluetooth_service-members.html +++ b/class_bluetooth_service-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

All Bluetooth services should inherit this class.

-

Definition at line 565 of file BTD.h.

+

Definition at line 569 of file BTD.h.

Constructor & Destructor Documentation

- + +

◆ BluetoothService()

+
@@ -183,12 +163,14 @@ Protected Attributes
-

Definition at line 567 of file BTD.h.

+

Definition at line 571 of file BTD.h.

Member Function Documentation

- + +

◆ ACLData()

+
@@ -220,7 +202,9 @@ Protected Attributes - + +

◆ Run()

+
@@ -246,7 +230,9 @@ Protected Attributes - + +

◆ Reset()

+
@@ -272,7 +258,9 @@ Protected Attributes - + +

◆ disconnect()

+
@@ -298,7 +286,9 @@ Protected Attributes - + +

◆ attachOnInit()

+
@@ -326,11 +316,13 @@ Protected Attributes -

Definition at line 587 of file BTD.h.

+

Definition at line 591 of file BTD.h.

- + +

◆ onInit()

+
@@ -356,7 +348,9 @@ Protected Attributes - + +

◆ checkHciHandle()

+
@@ -389,12 +383,14 @@ Protected Attributes

Used to check if the incoming L2CAP data matches the HCI Handle

-

Definition at line 600 of file BTD.h.

+

Definition at line 604 of file BTD.h.

Member Data Documentation

- + +

◆ pFuncOnInit

+
@@ -413,11 +409,13 @@ Protected Attributes

Pointer to function called in onInit().

-

Definition at line 605 of file BTD.h.

+

Definition at line 609 of file BTD.h.

- + +

◆ pBtd

+
@@ -436,11 +434,13 @@ Protected Attributes

Pointer to BTD instance.

-

Definition at line 608 of file BTD.h.

+

Definition at line 612 of file BTD.h.

- + +

◆ hci_handle

+
@@ -459,11 +459,13 @@ Protected Attributes

The HCI Handle for the connection.

-

Definition at line 611 of file BTD.h.

+

Definition at line 615 of file BTD.h.

- + +

◆ l2cap_event_flag

+
@@ -482,11 +484,13 @@ Protected Attributes

L2CAP flags of received Bluetooth events.

-

Definition at line 614 of file BTD.h.

+

Definition at line 618 of file BTD.h.

- + +

◆ identifier

+
@@ -505,7 +509,7 @@ Protected Attributes

Identifier for L2CAP commands.

-

Definition at line 617 of file BTD.h.

+

Definition at line 621 of file BTD.h.

@@ -517,7 +521,7 @@ Protected Attributes diff --git a/class_bluetooth_service__coll__graph.md5 b/class_bluetooth_service__coll__graph.md5 index c59d7e12..490b9a94 100644 --- a/class_bluetooth_service__coll__graph.md5 +++ b/class_bluetooth_service__coll__graph.md5 @@ -1 +1 @@ -63004da77f15c2792f7eb5740b2b02f1 \ No newline at end of file +4848ab684b54b7ac5bf7a1f2400768da \ No newline at end of file diff --git a/class_bluetooth_service__coll__graph.png b/class_bluetooth_service__coll__graph.png index acd45b9a..da585752 100644 Binary files a/class_bluetooth_service__coll__graph.png and b/class_bluetooth_service__coll__graph.png differ diff --git a/class_bluetooth_service__inherit__graph.md5 b/class_bluetooth_service__inherit__graph.md5 index 89adea58..63b5ecd4 100644 --- a/class_bluetooth_service__inherit__graph.md5 +++ b/class_bluetooth_service__inherit__graph.md5 @@ -1 +1 @@ -ed04eb4acfc3583220d1627fb69bac21 \ No newline at end of file +b3a86935fe164ef9bcd701cb63ba4e37 \ No newline at end of file diff --git a/class_bluetooth_service__inherit__graph.png b/class_bluetooth_service__inherit__graph.png index 5723a865..886abc94 100644 Binary files a/class_bluetooth_service__inherit__graph.png and b/class_bluetooth_service__inherit__graph.png differ diff --git a/class_bulk_only-members.html b/class_bulk_only-members.html index 8fd4e61d..1105034a 100644 --- a/class_bulk_only-members.html +++ b/class_bulk_only-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 462 of file masstorage.h.

+

Definition at line 469 of file masstorage.h.

Constructor & Destructor Documentation

- + +

◆ BulkOnly()

+
@@ -241,12 +221,14 @@ Static Protected Attributes
-

Definition at line 222 of file masstorage.cpp.

+

Definition at line 229 of file masstorage.cpp.

Member Function Documentation

- + +

◆ PrintEndpointDescriptor()

+
@@ -274,11 +256,13 @@ Static Protected Attributes -

Definition at line 1214 of file masstorage.cpp.

+

Definition at line 1220 of file masstorage.cpp.

- + +

◆ OnInit()

+
@@ -299,11 +283,13 @@ Static Protected Attributes
-

Definition at line 492 of file masstorage.h.

+

Definition at line 499 of file masstorage.h.

- + +

◆ GetLastUsbError()

+
@@ -324,11 +310,13 @@ Static Protected Attributes
-

Definition at line 498 of file masstorage.h.

+

Definition at line 505 of file masstorage.h.

- + +

◆ GetbMaxLUN()

+
@@ -349,11 +337,13 @@ Static Protected Attributes
-

Definition at line 502 of file masstorage.h.

+

Definition at line 509 of file masstorage.h.

- + +

◆ GetbTheLUN()

+
@@ -374,11 +364,13 @@ Static Protected Attributes
-

Definition at line 506 of file masstorage.h.

+

Definition at line 513 of file masstorage.h.

- + +

◆ WriteProtected()

+
@@ -400,11 +392,13 @@ Static Protected Attributes
Returns
cached status of write protect switch
-

Definition at line 70 of file masstorage.cpp.

+

Definition at line 77 of file masstorage.cpp.

- + +

◆ MediaCTL()

+
@@ -437,11 +431,13 @@ Static Protected Attributes
Returns
0 on success
-

Definition at line 130 of file masstorage.cpp.

+

Definition at line 137 of file masstorage.cpp.

- + +

◆ Read() [1/2]

+
@@ -495,11 +491,13 @@ Static Protected Attributes
Returns
0 on success
-

Definition at line 154 of file masstorage.cpp.

+

Definition at line 161 of file masstorage.cpp.

- + +

◆ Read() [2/2]

+
@@ -541,11 +539,13 @@ Static Protected Attributes
-

Definition at line 1241 of file masstorage.cpp.

+

Definition at line 1247 of file masstorage.cpp.

- + +

◆ Write()

+
@@ -599,11 +599,13 @@ Static Protected Attributes
Returns
0 on success
-

Definition at line 188 of file masstorage.cpp.

+

Definition at line 195 of file masstorage.cpp.

- + +

◆ LockMedia()

+
@@ -636,11 +638,13 @@ Static Protected Attributes
Returns
-

Definition at line 114 of file masstorage.cpp.

+

Definition at line 121 of file masstorage.cpp.

- + +

◆ LUNIsGood()

+
@@ -662,11 +666,13 @@ Static Protected Attributes
Returns
true if LUN is ready for use
-

Definition at line 60 of file masstorage.cpp.

+

Definition at line 67 of file masstorage.cpp.

- + +

◆ GetCapacity()

+
@@ -688,11 +694,13 @@ Static Protected Attributes
Returns
media capacity
-

Definition at line 36 of file masstorage.cpp.

+

Definition at line 43 of file masstorage.cpp.

- + +

◆ GetSectorSize()

+
@@ -714,11 +722,13 @@ Static Protected Attributes
Returns
media sector size
-

Definition at line 48 of file masstorage.cpp.

+

Definition at line 55 of file masstorage.cpp.

- + +

◆ Init()

+
@@ -767,11 +777,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 326 of file masstorage.cpp.

+

Definition at line 333 of file masstorage.cpp.

- + +

◆ ConfigureDevice()

+
@@ -822,11 +834,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 251 of file masstorage.cpp.

+

Definition at line 258 of file masstorage.cpp.

- + +

◆ Release()

+
@@ -851,11 +865,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 592 of file masstorage.cpp.

+

Definition at line 598 of file masstorage.cpp.

- + +

◆ Poll()

+
@@ -880,11 +896,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 670 of file masstorage.cpp.

+

Definition at line 676 of file masstorage.cpp.

- + +

◆ GetAddress()

+
@@ -907,11 +925,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 528 of file masstorage.h.

+

Definition at line 535 of file masstorage.h.

- + +

◆ EndpointXtract()

+
@@ -974,11 +994,13 @@ Static Protected Attributes

Reimplemented from UsbConfigXtracter.

-

Definition at line 543 of file masstorage.cpp.

+

Definition at line 550 of file masstorage.cpp.

- + +

◆ DEVCLASSOK()

+
@@ -1002,11 +1024,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 535 of file masstorage.h.

+

Definition at line 542 of file masstorage.h.

- + +

◆ SCSITransaction6()

+
@@ -1053,11 +1077,13 @@ Static Protected Attributes
Returns
-

Definition at line 83 of file masstorage.cpp.

+

Definition at line 90 of file masstorage.cpp.

- + +

◆ SCSITransaction10()

+
@@ -1104,12 +1130,14 @@ Static Protected Attributes
Returns
-

Definition at line 99 of file masstorage.cpp.

+

Definition at line 106 of file masstorage.cpp.

Member Data Documentation

- + +

◆ epDataInIndex

+
@@ -1127,11 +1155,13 @@ Static Protected Attributes
-

Definition at line 464 of file masstorage.h.

+

Definition at line 471 of file masstorage.h.

- + +

◆ epDataOutIndex

+
@@ -1149,11 +1179,13 @@ Static Protected Attributes
-

Definition at line 465 of file masstorage.h.

+

Definition at line 472 of file masstorage.h.

- + +

◆ epInterruptInIndex

+
@@ -1171,11 +1203,13 @@ Static Protected Attributes
-

Definition at line 466 of file masstorage.h.

+

Definition at line 473 of file masstorage.h.

- + +

◆ pUsb

+
@@ -1193,11 +1227,13 @@ Static Protected Attributes
-

Definition at line 468 of file masstorage.h.

+

Definition at line 475 of file masstorage.h.

- + +

◆ bAddress

+
@@ -1215,11 +1251,13 @@ Static Protected Attributes
-

Definition at line 469 of file masstorage.h.

+

Definition at line 476 of file masstorage.h.

- + +

◆ bConfNum

+
@@ -1237,11 +1275,13 @@ Static Protected Attributes
-

Definition at line 470 of file masstorage.h.

+

Definition at line 477 of file masstorage.h.

- + +

◆ bIface

+
@@ -1259,11 +1299,13 @@ Static Protected Attributes
-

Definition at line 471 of file masstorage.h.

+

Definition at line 478 of file masstorage.h.

- + +

◆ bNumEP

+
@@ -1281,11 +1323,13 @@ Static Protected Attributes
-

Definition at line 472 of file masstorage.h.

+

Definition at line 479 of file masstorage.h.

- + +

◆ qNextPollTime

+
@@ -1303,11 +1347,13 @@ Static Protected Attributes
-

Definition at line 473 of file masstorage.h.

+

Definition at line 480 of file masstorage.h.

- + +

◆ bPollEnable

+
@@ -1325,11 +1371,13 @@ Static Protected Attributes
-

Definition at line 474 of file masstorage.h.

+

Definition at line 481 of file masstorage.h.

- + +

◆ epInfo

+
@@ -1347,11 +1395,13 @@ Static Protected Attributes
-

Definition at line 476 of file masstorage.h.

+

Definition at line 483 of file masstorage.h.

- + +

◆ dCBWTag

+
@@ -1369,11 +1419,13 @@ Static Protected Attributes
-

Definition at line 478 of file masstorage.h.

+

Definition at line 485 of file masstorage.h.

- + +

◆ bLastUsbError

+
@@ -1391,11 +1443,13 @@ Static Protected Attributes
-

Definition at line 480 of file masstorage.h.

+

Definition at line 487 of file masstorage.h.

- + +

◆ bMaxLUN

+
@@ -1413,11 +1467,13 @@ Static Protected Attributes
-

Definition at line 481 of file masstorage.h.

+

Definition at line 488 of file masstorage.h.

- + +

◆ bTheLUN

+
@@ -1435,11 +1491,13 @@ Static Protected Attributes
-

Definition at line 482 of file masstorage.h.

+

Definition at line 489 of file masstorage.h.

- + +

◆ CurrentCapacity

+
@@ -1457,11 +1515,13 @@ Static Protected Attributes
-

Definition at line 483 of file masstorage.h.

+

Definition at line 490 of file masstorage.h.

- + +

◆ CurrentSectorSize

+
@@ -1479,11 +1539,13 @@ Static Protected Attributes
-

Definition at line 484 of file masstorage.h.

+

Definition at line 491 of file masstorage.h.

- + +

◆ LUNOk

+
@@ -1501,11 +1563,13 @@ Static Protected Attributes
-

Definition at line 485 of file masstorage.h.

+

Definition at line 492 of file masstorage.h.

- + +

◆ WriteOk

+
@@ -1523,7 +1587,7 @@ Static Protected Attributes
-

Definition at line 486 of file masstorage.h.

+

Definition at line 493 of file masstorage.h.

@@ -1536,7 +1600,7 @@ Static Protected Attributes diff --git a/class_bulk_only__coll__graph.md5 b/class_bulk_only__coll__graph.md5 index 65616e8f..38e17c78 100644 --- a/class_bulk_only__coll__graph.md5 +++ b/class_bulk_only__coll__graph.md5 @@ -1 +1 @@ -f9839364bbfdcee0034202ae5496cf49 \ No newline at end of file +922595c1eab8d375f2394c87eb7b7d3b \ No newline at end of file diff --git a/class_bulk_only__coll__graph.png b/class_bulk_only__coll__graph.png index 6f091d3b..46536924 100644 Binary files a/class_bulk_only__coll__graph.png and b/class_bulk_only__coll__graph.png differ diff --git a/class_bulk_only__inherit__graph.md5 b/class_bulk_only__inherit__graph.md5 index ab44521f..f268bf55 100644 --- a/class_bulk_only__inherit__graph.md5 +++ b/class_bulk_only__inherit__graph.md5 @@ -1 +1 @@ -2b66e1860fb7442508174e207255d1ed \ No newline at end of file +f8d5729746afdcd2f3b036bed5864279 \ No newline at end of file diff --git a/class_bulk_only__inherit__graph.png b/class_bulk_only__inherit__graph.png index 82658a57..6b684b87 100644 Binary files a/class_bulk_only__inherit__graph.png and b/class_bulk_only__inherit__graph.png differ diff --git a/class_byte_skipper-members.html b/class_byte_skipper-members.html index a53e8f7c..e0f40c90 100644 --- a/class_byte_skipper-members.html +++ b/class_byte_skipper-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 50 of file parsetools.h.

+

Definition at line 57 of file parsetools.h.

Constructor & Destructor Documentation

- + +

◆ ByteSkipper()

+
@@ -128,12 +108,14 @@ Public Member Functions
-

Definition at line 57 of file parsetools.h.

+

Definition at line 64 of file parsetools.h.

Member Function Documentation

- + +

◆ Initialize()

+
@@ -155,11 +137,13 @@ Public Member Functions
-

Definition at line 60 of file parsetools.h.

+

Definition at line 67 of file parsetools.h.

- + +

◆ Skip()

+
@@ -197,7 +181,7 @@ Public Member Functions
-

Definition at line 65 of file parsetools.h.

+

Definition at line 72 of file parsetools.h.

@@ -209,7 +193,7 @@ Public Member Functions diff --git a/class_c_d_c_async_oper-members.html b/class_c_d_c_async_oper-members.html index f1af7c38..bc2c3c63 100644 --- a/class_c_d_c_async_oper-members.html +++ b/class_c_d_c_async_oper-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 128 of file cdcacm.h.

+

Definition at line 128 of file cdcacm.h.

Member Function Documentation

- + +

◆ OnInit()

+
@@ -125,7 +105,7 @@ Public Member Functions
-

Definition at line 131 of file cdcacm.h.

+

Definition at line 131 of file cdcacm.h.

@@ -137,7 +117,7 @@ Public Member Functions diff --git a/class_config_desc_parser-members.html b/class_config_desc_parser-members.html index 46d3e697..e56efc82 100644 --- a/class_config_desc_parser-members.html +++ b/class_config_desc_parser-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +
class ConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK > -

Definition at line 40 of file confdescparser.h.

+

Definition at line 47 of file confdescparser.h.

Constructor & Destructor Documentation

- + +

◆ ConfigDescParser()

+
@@ -142,12 +122,14 @@ template<const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PRO
-

Definition at line 72 of file confdescparser.h.

+

Definition at line 79 of file confdescparser.h.

Member Function Documentation

- + +

◆ SetOR()

+
@@ -171,11 +153,13 @@ template<const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PRO
-

Definition at line 64 of file confdescparser.h.

+

Definition at line 71 of file confdescparser.h.

- + +

◆ Parse()

+
@@ -217,7 +201,7 @@ template<const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PRO

Implements USBReadParser.

-

Definition at line 84 of file confdescparser.h.

+

Definition at line 91 of file confdescparser.h.

@@ -229,7 +213,7 @@ template<const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PRO diff --git a/class_config_desc_parser__coll__graph.md5 b/class_config_desc_parser__coll__graph.md5 index 6d67d32a..9543b832 100644 --- a/class_config_desc_parser__coll__graph.md5 +++ b/class_config_desc_parser__coll__graph.md5 @@ -1 +1 @@ -43e2ececa16e23c2ef0bb98404d9dd99 \ No newline at end of file +8d46f1e236686517ba32dc78e05067b2 \ No newline at end of file diff --git a/class_config_desc_parser__coll__graph.png b/class_config_desc_parser__coll__graph.png index 29185207..d27e8724 100644 Binary files a/class_config_desc_parser__coll__graph.png and b/class_config_desc_parser__coll__graph.png differ diff --git a/class_config_desc_parser__inherit__graph.md5 b/class_config_desc_parser__inherit__graph.md5 index 6d67d32a..007fa887 100644 --- a/class_config_desc_parser__inherit__graph.md5 +++ b/class_config_desc_parser__inherit__graph.md5 @@ -1 +1 @@ -43e2ececa16e23c2ef0bb98404d9dd99 \ No newline at end of file +09e7aef4816627c161587a65c67bc25c \ No newline at end of file diff --git a/class_config_desc_parser__inherit__graph.png b/class_config_desc_parser__inherit__graph.png index 29185207..d27e8724 100644 Binary files a/class_config_desc_parser__inherit__graph.png and b/class_config_desc_parser__inherit__graph.png differ diff --git a/class_f_t_d_i-members.html b/class_f_t_d_i-members.html index f9bbdefa..f46df995 100644 --- a/class_f_t_d_i-members.html +++ b/class_f_t_d_i-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct=FTDI_PID)FTDI GetAddress()FTDIinlinevirtual Init(uint8_t parent, uint8_t port, bool lowspeed)FTDIvirtual - Poll()FTDIvirtual - RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)FTDI - Release()FTDIvirtual - ResetHubPort(uint8_t port)USBDeviceConfiginlinevirtual - SetBaudRate(uint32_t baud)FTDI - SetData(uint16_t databm)FTDI - SetFlowControl(uint8_t protocol, uint8_t xon=0x11, uint8_t xoff=0x13)FTDI - SetModemControl(uint16_t control)FTDI - SndData(uint16_t nbytes, uint8_t *dataptr)FTDI - VIDPIDOK(uint16_t vid, uint16_t pid)FTDIinlinevirtual + isReady()FTDIinlinevirtual + Poll()FTDIvirtual + RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)FTDI + Release()FTDIvirtual + ResetHubPort(uint8_t port)USBDeviceConfiginlinevirtual + SetBaudRate(uint32_t baud)FTDI + SetData(uint16_t databm)FTDI + SetFlowControl(uint8_t protocol, uint8_t xon=0x11, uint8_t xoff=0x13)FTDI + SetModemControl(uint16_t control)FTDI + SndData(uint16_t nbytes, uint8_t *dataptr)FTDI + VIDPIDOK(uint16_t vid, uint16_t pid)FTDIinlinevirtual
diff --git a/class_f_t_d_i.html b/class_f_t_d_i.html index 739a3f08..f6fdef54 100644 --- a/class_f_t_d_i.html +++ b/class_f_t_d_i.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: FTDI Class Reference @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
  virtual bool VIDPIDOK (uint16_t vid, uint16_t pid)   +virtual bool isReady () +  - Public Member Functions inherited from USBDeviceConfig virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed)   @@ -152,9 +132,11 @@ Public Member Functions

Detailed Description

-

Definition at line 96 of file cdcftdi.h.

+

Definition at line 96 of file cdcftdi.h.

Constructor & Destructor Documentation

- + +

◆ FTDI()

+
@@ -184,12 +166,14 @@ Public Member Functions
-

Definition at line 23 of file cdcftdi.cpp.

+

Definition at line 23 of file cdcftdi.cpp.

Member Function Documentation

- + +

◆ SetBaudRate()

+
@@ -203,11 +187,13 @@ Public Member Functions
-

Definition at line 273 of file cdcftdi.cpp.

+

Definition at line 276 of file cdcftdi.cpp.

- + +

◆ SetModemControl()

+
@@ -221,11 +207,13 @@ Public Member Functions
-

Definition at line 310 of file cdcftdi.cpp.

+

Definition at line 316 of file cdcftdi.cpp.

- + +

◆ SetFlowControl()

+
@@ -255,11 +243,13 @@ Public Member Functions
-

Definition at line 314 of file cdcftdi.cpp.

+

Definition at line 324 of file cdcftdi.cpp.

- + +

◆ SetData()

+
@@ -273,11 +263,13 @@ Public Member Functions
-

Definition at line 318 of file cdcftdi.cpp.

+

Definition at line 332 of file cdcftdi.cpp.

- + +

◆ RcvData()

+
@@ -301,11 +293,13 @@ Public Member Functions
-

Definition at line 322 of file cdcftdi.cpp.

+

Definition at line 340 of file cdcftdi.cpp.

- + +

◆ SndData()

+
@@ -329,11 +323,13 @@ Public Member Functions
-

Definition at line 326 of file cdcftdi.cpp.

+

Definition at line 348 of file cdcftdi.cpp.

- + +

◆ Init()

+
@@ -373,11 +369,13 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 41 of file cdcftdi.cpp.

+

Definition at line 41 of file cdcftdi.cpp.

- + +

◆ Release()

+
@@ -400,11 +398,13 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 248 of file cdcftdi.cpp.

+

Definition at line 250 of file cdcftdi.cpp.

- + +

◆ Poll()

+
@@ -427,11 +427,13 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 258 of file cdcftdi.cpp.

+

Definition at line 261 of file cdcftdi.cpp.

- + +

◆ GetAddress()

+
@@ -454,11 +456,13 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 133 of file cdcftdi.h.

+

Definition at line 134 of file cdcftdi.h.

- + +

◆ EndpointXtract()

+
@@ -510,11 +514,13 @@ Public Member Functions

Reimplemented from UsbConfigXtracter.

-

Definition at line 220 of file cdcftdi.cpp.

+

Definition at line 223 of file cdcftdi.cpp.

- + +

◆ VIDPIDOK()

+
@@ -548,7 +554,34 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 140 of file cdcftdi.h.

+

Definition at line 141 of file cdcftdi.h.

+ + + + +

◆ isReady()

+ +
+
+
+ + + + +
+ + + + + + + +
virtual bool FTDI::isReady ()
+
+inlinevirtual
+
+ +

Definition at line 144 of file cdcftdi.h.

@@ -561,7 +594,7 @@ Public Member Functions diff --git a/class_f_t_d_i__coll__graph.md5 b/class_f_t_d_i__coll__graph.md5 index 8736ae0b..03701d05 100644 --- a/class_f_t_d_i__coll__graph.md5 +++ b/class_f_t_d_i__coll__graph.md5 @@ -1 +1 @@ -7639ae03a2a3c77cae9f7ef89dc8dcfd \ No newline at end of file +ce47df1c759cd4a94063a5e7d0082de2 \ No newline at end of file diff --git a/class_f_t_d_i__coll__graph.png b/class_f_t_d_i__coll__graph.png index a4f7ea18..8375b67e 100644 Binary files a/class_f_t_d_i__coll__graph.png and b/class_f_t_d_i__coll__graph.png differ diff --git a/class_f_t_d_i__inherit__graph.md5 b/class_f_t_d_i__inherit__graph.md5 index 8736ae0b..64b84c33 100644 --- a/class_f_t_d_i__inherit__graph.md5 +++ b/class_f_t_d_i__inherit__graph.md5 @@ -1 +1 @@ -7639ae03a2a3c77cae9f7ef89dc8dcfd \ No newline at end of file +5c89ec39cab7057f56e7027e29a41346 \ No newline at end of file diff --git a/class_f_t_d_i__inherit__graph.png b/class_f_t_d_i__inherit__graph.png index a4f7ea18..8375b67e 100644 Binary files a/class_f_t_d_i__inherit__graph.png and b/class_f_t_d_i__inherit__graph.png differ diff --git a/class_f_t_d_i_async_oper-members.html b/class_f_t_d_i_async_oper-members.html index d1083ae9..8b59e822 100644 --- a/class_f_t_d_i_async_oper-members.html +++ b/class_f_t_d_i_async_oper-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 79 of file cdcftdi.h.

+

Definition at line 79 of file cdcftdi.h.

Member Function Documentation

- + +

◆ OnInit()

+
@@ -127,11 +107,13 @@ Public Member Functions
-

Definition at line 82 of file cdcftdi.h.

+

Definition at line 82 of file cdcftdi.h.

- + +

◆ OnRelease()

+
@@ -153,7 +135,7 @@ Public Member Functions
-

Definition at line 86 of file cdcftdi.h.

+

Definition at line 86 of file cdcftdi.h.

@@ -165,7 +147,7 @@ Public Member Functions diff --git a/class_h_i_d_boot-members.html b/class_h_i_d_boot-members.html index f1e06336..59807807 100644 --- a/class_h_i_d_boot-members.html +++ b/class_h_i_d_boot-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +
class HIDBoot< BOOT_PROTOCOL > -

Definition at line 201 of file hidboot.h.

+

Definition at line 201 of file hidboot.h.

Constructor & Destructor Documentation

- + +

◆ HIDBoot()

+
@@ -224,12 +204,14 @@ template<const uint8_t BOOT_PROTOCOL>
-

Definition at line 256 of file hidboot.h.

+

Definition at line 256 of file hidboot.h.

Member Function Documentation

- + +

◆ SetReportParser()

+
@@ -265,11 +247,13 @@ template<const uint8_t BOOT_PROTOCOL>

Reimplemented from USBHID.

-

Definition at line 224 of file hidboot.h.

+

Definition at line 224 of file hidboot.h.

- + +

◆ Init()

+
@@ -311,11 +295,13 @@ template<const uint8_t BOOT_PROTOCOL>

Reimplemented from USBDeviceConfig.

-

Definition at line 285 of file hidboot.h.

+

Definition at line 285 of file hidboot.h.

- + +

◆ Release()

+
@@ -340,11 +326,13 @@ template<const uint8_t BOOT_PROTOCOL>

Reimplemented from USBDeviceConfig.

-

Definition at line 561 of file hidboot.h.

+

Definition at line 564 of file hidboot.h.

- + +

◆ Poll()

+
@@ -369,11 +357,13 @@ template<const uint8_t BOOT_PROTOCOL>

Reimplemented from USBDeviceConfig.

-

Definition at line 575 of file hidboot.h.

+

Definition at line 578 of file hidboot.h.

- + +

◆ GetAddress()

+
@@ -398,11 +388,13 @@ template<const uint8_t BOOT_PROTOCOL>

Reimplemented from USBDeviceConfig.

-

Definition at line 234 of file hidboot.h.

+

Definition at line 234 of file hidboot.h.

- + +

◆ isReady()

+
@@ -425,11 +417,13 @@ template<const uint8_t BOOT_PROTOCOL>
-

Definition at line 238 of file hidboot.h.

+

Definition at line 238 of file hidboot.h.

- + +

◆ EndpointXtract()

+
@@ -483,11 +477,13 @@ template<const uint8_t BOOT_PROTOCOL>

Reimplemented from UsbConfigXtracter.

-

Definition at line 536 of file hidboot.h.

+

Definition at line 539 of file hidboot.h.

- + +

◆ DEVCLASSOK()

+
@@ -513,11 +509,13 @@ template<const uint8_t BOOT_PROTOCOL>

Reimplemented from USBDeviceConfig.

-

Definition at line 246 of file hidboot.h.

+

Definition at line 246 of file hidboot.h.

- + +

◆ DEVSUBCLASSOK()

+
@@ -543,7 +541,7 @@ template<const uint8_t BOOT_PROTOCOL>

Reimplemented from USBDeviceConfig.

-

Definition at line 250 of file hidboot.h.

+

Definition at line 250 of file hidboot.h.

@@ -555,7 +553,7 @@ template<const uint8_t BOOT_PROTOCOL>
diff --git a/class_h_i_d_boot__coll__graph.md5 b/class_h_i_d_boot__coll__graph.md5 index de81f923..3625c217 100644 --- a/class_h_i_d_boot__coll__graph.md5 +++ b/class_h_i_d_boot__coll__graph.md5 @@ -1 +1 @@ -a19c6c2c9e133ec0ee972f6c6da3910c \ No newline at end of file +f259975bab1bae919945e1d52865d138 \ No newline at end of file diff --git a/class_h_i_d_boot__coll__graph.png b/class_h_i_d_boot__coll__graph.png index 7d07de44..60b6cc67 100644 Binary files a/class_h_i_d_boot__coll__graph.png and b/class_h_i_d_boot__coll__graph.png differ diff --git a/class_h_i_d_boot__inherit__graph.md5 b/class_h_i_d_boot__inherit__graph.md5 index bb37f2b2..22fee73b 100644 --- a/class_h_i_d_boot__inherit__graph.md5 +++ b/class_h_i_d_boot__inherit__graph.md5 @@ -1 +1 @@ -0163fec2b92b9cadecd0eed3ad26c28f \ No newline at end of file +33a2d817f07a1965ceb3d476c83e4fdb \ No newline at end of file diff --git a/class_h_i_d_boot__inherit__graph.png b/class_h_i_d_boot__inherit__graph.png index 7e7c6fec..f7f4d234 100644 Binary files a/class_h_i_d_boot__inherit__graph.png and b/class_h_i_d_boot__inherit__graph.png differ diff --git a/class_h_i_d_composite-members.html b/class_h_i_d_composite-members.html index e1e1749d..7e7a6507 100644 --- a/class_h_i_d_composite-members.html +++ b/class_h_i_d_composite-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 24 of file hidcomposite.h.

+

Definition at line 24 of file hidcomposite.h.

Constructor & Destructor Documentation

- + +

◆ HIDComposite()

+
@@ -239,12 +219,14 @@ Additional Inherited Members
-

Definition at line 20 of file hidcomposite.cpp.

+

Definition at line 20 of file hidcomposite.cpp.

Member Function Documentation

- + +

◆ GetReportParser()

+
@@ -268,11 +250,13 @@ Additional Inherited Members

Reimplemented from USBHID.

-

Definition at line 83 of file hidcomposite.cpp.

+

Definition at line 83 of file hidcomposite.cpp.

- + +

◆ OnInitSuccessful()

+
@@ -293,11 +277,13 @@ Additional Inherited Members
-

Definition at line 71 of file hidcomposite.h.

+

Definition at line 71 of file hidcomposite.h.

- + +

◆ ParseHIDData()

+
@@ -347,11 +333,13 @@ Additional Inherited Members
-

Definition at line 75 of file hidcomposite.h.

+

Definition at line 75 of file hidcomposite.h.

- + +

◆ SetReportParser()

+
@@ -385,11 +373,13 @@ Additional Inherited Members

Reimplemented from USBHID.

-

Definition at line 72 of file hidcomposite.cpp.

+

Definition at line 72 of file hidcomposite.cpp.

- + +

◆ Init()

+
@@ -429,11 +419,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 94 of file hidcomposite.cpp.

+

Definition at line 94 of file hidcomposite.cpp.

- + +

◆ Release()

+
@@ -456,11 +448,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 342 of file hidcomposite.cpp.

+

Definition at line 340 of file hidcomposite.cpp.

- + +

◆ Poll()

+
@@ -483,11 +477,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 357 of file hidcomposite.cpp.

+

Definition at line 355 of file hidcomposite.cpp.

- + +

◆ GetAddress()

+
@@ -510,11 +506,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 90 of file hidcomposite.h.

+

Definition at line 90 of file hidcomposite.h.

- + +

◆ isReady()

+
@@ -535,11 +533,13 @@ Additional Inherited Members
-

Definition at line 94 of file hidcomposite.h.

+

Definition at line 94 of file hidcomposite.h.

- + +

◆ EndpointXtract()

+
@@ -591,11 +591,13 @@ Additional Inherited Members

Reimplemented from UsbConfigXtracter.

-

Definition at line 297 of file hidcomposite.cpp.

+

Definition at line 297 of file hidcomposite.cpp.

- + +

◆ SndRpt()

+
@@ -619,11 +621,13 @@ Additional Inherited Members
-

Definition at line 415 of file hidcomposite.cpp.

+

Definition at line 413 of file hidcomposite.cpp.

- + +

◆ SelectInterface()

+
@@ -658,7 +662,9 @@ Additional Inherited Members

Member Data Documentation

- + +

◆ epInfo

+
@@ -676,11 +682,13 @@ Additional Inherited Members
-

Definition at line 61 of file hidcomposite.h.

+

Definition at line 61 of file hidcomposite.h.

- + +

◆ hidInterfaces

+
@@ -698,11 +706,13 @@ Additional Inherited Members
-

Definition at line 62 of file hidcomposite.h.

+

Definition at line 62 of file hidcomposite.h.

- + +

◆ bHasReportId

+
@@ -720,11 +730,13 @@ Additional Inherited Members
-

Definition at line 64 of file hidcomposite.h.

+

Definition at line 64 of file hidcomposite.h.

- + +

◆ PID

+
@@ -742,11 +754,13 @@ Additional Inherited Members
-

Definition at line 66 of file hidcomposite.h.

+

Definition at line 66 of file hidcomposite.h.

- + +

◆ VID

+
@@ -764,7 +778,7 @@ Additional Inherited Members
-

Definition at line 66 of file hidcomposite.h.

+

Definition at line 66 of file hidcomposite.h.

@@ -777,7 +791,7 @@ Additional Inherited Members diff --git a/class_h_i_d_composite__coll__graph.md5 b/class_h_i_d_composite__coll__graph.md5 index cb51ec95..8c822c0b 100644 --- a/class_h_i_d_composite__coll__graph.md5 +++ b/class_h_i_d_composite__coll__graph.md5 @@ -1 +1 @@ -cb1afeb4ef0790903388054fd3bdbf40 \ No newline at end of file +53a6c18af1475d71fd895b0881f48e79 \ No newline at end of file diff --git a/class_h_i_d_composite__coll__graph.png b/class_h_i_d_composite__coll__graph.png index e8859751..78c89664 100644 Binary files a/class_h_i_d_composite__coll__graph.png and b/class_h_i_d_composite__coll__graph.png differ diff --git a/class_h_i_d_composite__inherit__graph.md5 b/class_h_i_d_composite__inherit__graph.md5 index 9ac7faab..8e8d4518 100644 --- a/class_h_i_d_composite__inherit__graph.md5 +++ b/class_h_i_d_composite__inherit__graph.md5 @@ -1 +1 @@ -7bba052169c3e9cd86fb29246bed4535 \ No newline at end of file +5365f14a032a8fd6dcc87df5954edbd5 \ No newline at end of file diff --git a/class_h_i_d_composite__inherit__graph.png b/class_h_i_d_composite__inherit__graph.png index 6eae4c34..2e531700 100644 Binary files a/class_h_i_d_composite__inherit__graph.png and b/class_h_i_d_composite__inherit__graph.png differ diff --git a/class_h_i_d_report_parser-members.html b/class_h_i_d_report_parser-members.html index a8dfd0a0..d9d5465d 100644 --- a/class_h_i_d_report_parser-members.html +++ b/class_h_i_d_report_parser-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 138 of file usbhid.h.

+

Definition at line 138 of file usbhid.h.

Member Function Documentation

- + +

◆ Parse()

+
@@ -169,7 +149,7 @@ Public Member Functions diff --git a/class_h_i_d_report_parser__inherit__graph.md5 b/class_h_i_d_report_parser__inherit__graph.md5 index 25b71fe2..593cf846 100644 --- a/class_h_i_d_report_parser__inherit__graph.md5 +++ b/class_h_i_d_report_parser__inherit__graph.md5 @@ -1 +1 @@ -8be112e5d3300b51cf0649c53a258712 \ No newline at end of file +7f123ea9da7dc06b494537ace718925b \ No newline at end of file diff --git a/class_h_i_d_report_parser__inherit__graph.png b/class_h_i_d_report_parser__inherit__graph.png index c140d340..d4544833 100644 Binary files a/class_h_i_d_report_parser__inherit__graph.png and b/class_h_i_d_report_parser__inherit__graph.png differ diff --git a/class_h_i_d_universal-members.html b/class_h_i_d_universal-members.html index 61c1b3c4..08b7f9e1 100644 --- a/class_h_i_d_universal-members.html +++ b/class_h_i_d_universal-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 24 of file hiduniversal.h.

+

Definition at line 24 of file hiduniversal.h.

Constructor & Destructor Documentation

- + +

◆ HIDUniversal()

+
@@ -239,12 +219,14 @@ Additional Inherited Members
-

Definition at line 20 of file hiduniversal.cpp.

+

Definition at line 20 of file hiduniversal.cpp.

Member Function Documentation

- + +

◆ GetReportParser()

+
@@ -268,11 +250,13 @@ Additional Inherited Members

Reimplemented from USBHID.

-

Definition at line 85 of file hiduniversal.cpp.

+

Definition at line 85 of file hiduniversal.cpp.

- + +

◆ OnInitSuccessful()

+
@@ -295,11 +279,13 @@ Additional Inherited Members

Reimplemented in PSBuzz, and PS4USB.

-

Definition at line 74 of file hiduniversal.h.

+

Definition at line 74 of file hiduniversal.h.

- + +

◆ ParseHIDData()

+
@@ -345,11 +331,13 @@ Additional Inherited Members

Reimplemented in PSBuzz, and PS4USB.

-

Definition at line 78 of file hiduniversal.h.

+

Definition at line 78 of file hiduniversal.h.

- + +

◆ SetReportParser()

+
@@ -383,11 +371,13 @@ Additional Inherited Members

Reimplemented from USBHID.

-

Definition at line 74 of file hiduniversal.cpp.

+

Definition at line 74 of file hiduniversal.cpp.

- + +

◆ Init()

+
@@ -427,11 +417,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 96 of file hiduniversal.cpp.

+

Definition at line 96 of file hiduniversal.cpp.

- + +

◆ Release()

+
@@ -454,11 +446,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 342 of file hiduniversal.cpp.

+

Definition at line 340 of file hiduniversal.cpp.

- + +

◆ Poll()

+
@@ -481,11 +475,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 369 of file hiduniversal.cpp.

+

Definition at line 367 of file hiduniversal.cpp.

- + +

◆ GetAddress()

+
@@ -508,11 +504,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 93 of file hiduniversal.h.

+

Definition at line 93 of file hiduniversal.h.

- + +

◆ isReady()

+
@@ -533,11 +531,13 @@ Additional Inherited Members
-

Definition at line 97 of file hiduniversal.h.

+

Definition at line 97 of file hiduniversal.h.

- + +

◆ EndpointXtract()

+
@@ -589,11 +589,13 @@ Additional Inherited Members

Reimplemented from UsbConfigXtracter.

-

Definition at line 295 of file hiduniversal.cpp.

+

Definition at line 295 of file hiduniversal.cpp.

- + +

◆ SndRpt()

+
@@ -617,12 +619,14 @@ Additional Inherited Members
-

Definition at line 425 of file hiduniversal.cpp.

+

Definition at line 423 of file hiduniversal.cpp.

Member Data Documentation

- + +

◆ epInfo

+
@@ -640,11 +644,13 @@ Additional Inherited Members
-

Definition at line 64 of file hiduniversal.h.

+

Definition at line 64 of file hiduniversal.h.

- + +

◆ hidInterfaces

+
@@ -662,11 +668,13 @@ Additional Inherited Members
-

Definition at line 65 of file hiduniversal.h.

+

Definition at line 65 of file hiduniversal.h.

- + +

◆ bHasReportId

+
@@ -684,11 +692,13 @@ Additional Inherited Members
-

Definition at line 67 of file hiduniversal.h.

+

Definition at line 67 of file hiduniversal.h.

- + +

◆ PID

+
@@ -706,11 +716,13 @@ Additional Inherited Members
-

Definition at line 69 of file hiduniversal.h.

+

Definition at line 69 of file hiduniversal.h.

- + +

◆ VID

+
@@ -728,7 +740,7 @@ Additional Inherited Members
-

Definition at line 69 of file hiduniversal.h.

+

Definition at line 69 of file hiduniversal.h.

@@ -741,7 +753,7 @@ Additional Inherited Members diff --git a/class_h_i_d_universal__coll__graph.md5 b/class_h_i_d_universal__coll__graph.md5 index 5c56aa71..13f76bd9 100644 --- a/class_h_i_d_universal__coll__graph.md5 +++ b/class_h_i_d_universal__coll__graph.md5 @@ -1 +1 @@ -9798e993ef1d49a2c1f0b1530f49b8e4 \ No newline at end of file +358769c50e28d51b35035f35270dea75 \ No newline at end of file diff --git a/class_h_i_d_universal__coll__graph.png b/class_h_i_d_universal__coll__graph.png index 43bbf8e6..3df6464c 100644 Binary files a/class_h_i_d_universal__coll__graph.png and b/class_h_i_d_universal__coll__graph.png differ diff --git a/class_h_i_d_universal__inherit__graph.md5 b/class_h_i_d_universal__inherit__graph.md5 index 2e820cab..3c09b3e6 100644 --- a/class_h_i_d_universal__inherit__graph.md5 +++ b/class_h_i_d_universal__inherit__graph.md5 @@ -1 +1 @@ -1ce1a5f9211e70eba63ba823d3663601 \ No newline at end of file +382694dd81f1384547b0acd28e432505 \ No newline at end of file diff --git a/class_h_i_d_universal__inherit__graph.png b/class_h_i_d_universal__inherit__graph.png index 76982c15..57c182f0 100644 Binary files a/class_h_i_d_universal__inherit__graph.png and b/class_h_i_d_universal__inherit__graph.png differ diff --git a/class_hex_dumper-members.html b/class_hex_dumper-members.html index 8d952b32..d084cb01 100644 --- a/class_hex_dumper-members.html +++ b/class_hex_dumper-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +
Inheritance graph
+ +
[legend]
Collaboration diagram for HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >:
Collaboration graph
+ +
[legend]
class HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE > -

Definition at line 25 of file hexdump.h.

+

Definition at line 33 of file hexdump.h.

Constructor & Destructor Documentation

- + +

◆ HexDumper()

+
@@ -143,12 +127,14 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>

@@ -118,9 +100,11 @@ Public Member Functions

-

Definition at line 31 of file hexdump.h.

+

Definition at line 39 of file hexdump.h.

Member Function Documentation

- + +

◆ Initialize()

+
@@ -171,11 +157,13 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
-

Definition at line 34 of file hexdump.h.

+

Definition at line 42 of file hexdump.h.

- + +

◆ Parse()

+
@@ -207,7 +195,7 @@ template<class BASE_CLASS , class LEN_TYPE , class OFFSET_TYPE >
-

Definition at line 43 of file hexdump.h.

+

Definition at line 51 of file hexdump.h.

@@ -219,7 +207,7 @@ template<class BASE_CLASS , class LEN_TYPE , class OFFSET_TYPE >
diff --git a/class_hex_dumper__coll__graph.md5 b/class_hex_dumper__coll__graph.md5 index c9f3f213..5f2c81dd 100644 --- a/class_hex_dumper__coll__graph.md5 +++ b/class_hex_dumper__coll__graph.md5 @@ -1 +1 @@ -5be5e99ec5970ed3fe98ca3cc812cd40 \ No newline at end of file +d0d43b636db83e71ec57c3a665a482d9 \ No newline at end of file diff --git a/class_hex_dumper__coll__graph.png b/class_hex_dumper__coll__graph.png index 9890adfe..73120ef7 100644 Binary files a/class_hex_dumper__coll__graph.png and b/class_hex_dumper__coll__graph.png differ diff --git a/class_hex_dumper__inherit__graph.md5 b/class_hex_dumper__inherit__graph.md5 index c9f3f213..f9793cee 100644 --- a/class_hex_dumper__inherit__graph.md5 +++ b/class_hex_dumper__inherit__graph.md5 @@ -1 +1 @@ -5be5e99ec5970ed3fe98ca3cc812cd40 \ No newline at end of file +cc82cd63686d13b6e0e1784a3a9e8b6b \ No newline at end of file diff --git a/class_hex_dumper__inherit__graph.png b/class_hex_dumper__inherit__graph.png index 9890adfe..73120ef7 100644 Binary files a/class_hex_dumper__inherit__graph.png and b/class_hex_dumper__inherit__graph.png differ diff --git a/class_keyboard_report_parser-members.html b/class_keyboard_report_parser-members.html index 6fdc420b..44125a38 100644 --- a/class_keyboard_report_parser-members.html +++ b/class_keyboard_report_parser-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 121 of file hidboot.h.

+

Definition at line 121 of file hidboot.h.

Constructor & Destructor Documentation

- + +

◆ KeyboardReportParser()

+
@@ -184,12 +164,14 @@ Protected Attributes
-

Definition at line 143 of file hidboot.h.

+

Definition at line 143 of file hidboot.h.

Member Function Documentation

- + +

◆ OemToAscii()

+
@@ -221,11 +203,13 @@ Protected Attributes
-

Definition at line 165 of file hidboot.cpp.

+

Definition at line 165 of file hidboot.cpp.

- + +

◆ Parse()

+
@@ -271,11 +255,13 @@ Protected Attributes

Implements HIDReportParser.

-

Definition at line 127 of file hidboot.cpp.

+

Definition at line 127 of file hidboot.cpp.

- + +

◆ HandleLockingKeys()

+
@@ -307,11 +293,13 @@ Protected Attributes
-

Definition at line 151 of file hidboot.h.

+

Definition at line 151 of file hidboot.h.

- + +

◆ OnControlKeysChanged()

+
@@ -343,11 +331,13 @@ Protected Attributes
-

Definition at line 174 of file hidboot.h.

+

Definition at line 174 of file hidboot.h.

- + +

◆ OnKeyDown()

+
@@ -379,11 +369,13 @@ Protected Attributes
-

Definition at line 177 of file hidboot.h.

+

Definition at line 177 of file hidboot.h.

- + +

◆ OnKeyUp()

+
@@ -415,11 +407,13 @@ Protected Attributes
-

Definition at line 180 of file hidboot.h.

+

Definition at line 180 of file hidboot.h.

- + +

◆ getNumKeys()

+
@@ -440,11 +434,13 @@ Protected Attributes
-

Definition at line 183 of file hidboot.h.

+

Definition at line 183 of file hidboot.h.

- + +

◆ getSymKeysUp()

+
@@ -465,11 +461,13 @@ Protected Attributes
-

Definition at line 187 of file hidboot.h.

+

Definition at line 187 of file hidboot.h.

- + +

◆ getSymKeysLo()

+
@@ -490,11 +488,13 @@ Protected Attributes
-

Definition at line 191 of file hidboot.h.

+

Definition at line 191 of file hidboot.h.

- + +

◆ getPadKeys()

+
@@ -515,12 +515,14 @@ Protected Attributes
-

Definition at line 195 of file hidboot.h.

+

Definition at line 195 of file hidboot.h.

Member Data Documentation

- + +

◆ kbdInfo

+
@@ -530,11 +532,13 @@ Protected Attributes
-

Definition at line 130 of file hidboot.h.

+

Definition at line 130 of file hidboot.h.

- + +

◆ bInfo

+
@@ -544,11 +548,13 @@ Protected Attributes
-

Definition at line 131 of file hidboot.h.

+

Definition at line 131 of file hidboot.h.

- + +

◆ prevState

+
@@ -560,7 +566,9 @@ Protected Attributes - + +

◆ kbdLeds

+
@@ -570,11 +578,13 @@ Protected Attributes
-

Definition at line 135 of file hidboot.h.

+

Definition at line 135 of file hidboot.h.

- + +

◆ bLeds

+
@@ -584,11 +594,13 @@ Protected Attributes
-

Definition at line 136 of file hidboot.h.

+

Definition at line 136 of file hidboot.h.

- + +

◆ kbdLockingKeys

+
@@ -609,7 +621,7 @@ Protected Attributes diff --git a/class_keyboard_report_parser__coll__graph.md5 b/class_keyboard_report_parser__coll__graph.md5 index b3538af0..f53186dd 100644 --- a/class_keyboard_report_parser__coll__graph.md5 +++ b/class_keyboard_report_parser__coll__graph.md5 @@ -1 +1 @@ -bb7b1a74ec2625233c79c3d3448ef47a \ No newline at end of file +f2c6d00835acadc8658c82e0cf0d6156 \ No newline at end of file diff --git a/class_keyboard_report_parser__coll__graph.png b/class_keyboard_report_parser__coll__graph.png index 46745bc2..103a65c2 100644 Binary files a/class_keyboard_report_parser__coll__graph.png and b/class_keyboard_report_parser__coll__graph.png differ diff --git a/class_keyboard_report_parser__inherit__graph.md5 b/class_keyboard_report_parser__inherit__graph.md5 index 5b9658e5..c76aa0ce 100644 --- a/class_keyboard_report_parser__inherit__graph.md5 +++ b/class_keyboard_report_parser__inherit__graph.md5 @@ -1 +1 @@ -c874e74f72d0db473ce869577e6f92d6 \ No newline at end of file +adfb83fe955c3333a5c32778e9b1fc68 \ No newline at end of file diff --git a/class_keyboard_report_parser__inherit__graph.png b/class_keyboard_report_parser__inherit__graph.png index a9cb1ccb..d4ab049f 100644 Binary files a/class_keyboard_report_parser__inherit__graph.png and b/class_keyboard_report_parser__inherit__graph.png differ diff --git a/class_m_a_x3421e-members.html b/class_m_a_x3421e-members.html index ce57661a..9c590ac4 100644 --- a/class_m_a_x3421e-members.html +++ b/class_m_a_x3421e-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +
class MAX3421e< SPI_SS, INTR > -

Definition at line 109 of file usbhost.h.

+

Definition at line 132 of file usbhost.h.

Constructor & Destructor Documentation

- + +

◆ MAX3421e()

+
@@ -159,12 +139,14 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 142 of file usbhost.h.

+

Definition at line 165 of file usbhost.h.

Member Function Documentation

- + +

◆ regWr()

+
@@ -190,11 +172,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 153 of file usbhost.h.

+

Definition at line 176 of file usbhost.h.

- + +

◆ bytesWr()

+
@@ -226,11 +210,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 196 of file usbhost.h.

+

Definition at line 219 of file usbhost.h.

- + +

◆ gpioWr()

+
@@ -246,11 +232,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 250 of file usbhost.h.

+

Definition at line 273 of file usbhost.h.

- + +

◆ regRd()

+
@@ -266,11 +254,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 259 of file usbhost.h.

+

Definition at line 282 of file usbhost.h.

- + +

◆ bytesRd()

+
@@ -302,11 +292,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 298 of file usbhost.h.

+

Definition at line 321 of file usbhost.h.

- + +

◆ gpioRd()

+
@@ -321,11 +313,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 361 of file usbhost.h.

+

Definition at line 384 of file usbhost.h.

- + +

◆ reset()

+
@@ -340,11 +334,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 372 of file usbhost.h.

+

Definition at line 395 of file usbhost.h.

- + +

◆ Init() [1/2]

+
@@ -359,11 +355,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 386 of file usbhost.h.

+

Definition at line 409 of file usbhost.h.

- + +

◆ Init() [2/2]

+
@@ -379,11 +377,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 423 of file usbhost.h.

+

Definition at line 446 of file usbhost.h.

- + +

◆ vbusPower()

+
@@ -407,11 +407,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 124 of file usbhost.h.

+

Definition at line 147 of file usbhost.h.

- + +

◆ getVbusState()

+
@@ -435,11 +437,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 128 of file usbhost.h.

+

Definition at line 151 of file usbhost.h.

- + +

◆ busprobe()

+
@@ -454,11 +458,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 467 of file usbhost.h.

+

Definition at line 490 of file usbhost.h.

- + +

◆ GpxHandler()

+
@@ -475,7 +481,9 @@ template<typename SPI_SS , typename INTR >
- + +

◆ IntHandler()

+
@@ -490,11 +498,13 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 521 of file usbhost.h.

+

Definition at line 544 of file usbhost.h.

- + +

◆ Task()

+
@@ -510,7 +520,7 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 502 of file usbhost.h.

+

Definition at line 525 of file usbhost.h.

@@ -522,7 +532,7 @@ template<typename SPI_SS , typename INTR >
diff --git a/class_m_a_x3421e__inherit__graph.md5 b/class_m_a_x3421e__inherit__graph.md5 index e9dc0389..c1c302a9 100644 --- a/class_m_a_x3421e__inherit__graph.md5 +++ b/class_m_a_x3421e__inherit__graph.md5 @@ -1 +1 @@ -6b7dcdcf5b00fbf00c69a08de5fc301c \ No newline at end of file +0fb6ebaa0a7caab1752808a63748c691 \ No newline at end of file diff --git a/class_m_a_x3421e__inherit__graph.png b/class_m_a_x3421e__inherit__graph.png index 48dba11b..d3ff9459 100644 Binary files a/class_m_a_x3421e__inherit__graph.png and b/class_m_a_x3421e__inherit__graph.png differ diff --git a/class_max___l_c_d-members.html b/class_max___l_c_d-members.html index c2da4d08..84354646 100644 --- a/class_max___l_c_d-members.html +++ b/class_max___l_c_d-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +
Inheritance graph
+ +
[legend]
Collaboration diagram for Max_LCD:
Collaboration graph
+ +
[legend]

@@ -151,9 +133,11 @@ Public Member Functions

Detailed Description

-

Definition at line 65 of file max_LCD.h.

+

Definition at line 65 of file max_LCD.h.

Constructor & Destructor Documentation

- + +

◆ Max_LCD()

+
@@ -167,12 +151,14 @@ Public Member Functions
-

Definition at line 42 of file max_LCD.cpp.

+

Definition at line 42 of file max_LCD.cpp.

Member Function Documentation

- + +

◆ init()

+
@@ -185,11 +171,13 @@ Public Member Functions
-

Definition at line 46 of file max_LCD.cpp.

+

Definition at line 46 of file max_LCD.cpp.

- + +

◆ begin()

+
@@ -219,11 +207,13 @@ Public Member Functions
-

Definition at line 54 of file max_LCD.cpp.

+

Definition at line 54 of file max_LCD.cpp.

- + +

◆ clear()

+
@@ -236,11 +226,13 @@ Public Member Functions
-

Definition at line 114 of file max_LCD.cpp.

+

Definition at line 114 of file max_LCD.cpp.

- + +

◆ home()

+
@@ -253,11 +245,13 @@ Public Member Functions
-

Definition at line 119 of file max_LCD.cpp.

+

Definition at line 119 of file max_LCD.cpp.

- + +

◆ noDisplay()

+
@@ -270,11 +264,13 @@ Public Member Functions
-

Definition at line 135 of file max_LCD.cpp.

+

Definition at line 135 of file max_LCD.cpp.

- + +

◆ display()

+
@@ -287,11 +283,13 @@ Public Member Functions
-

Definition at line 140 of file max_LCD.cpp.

+

Definition at line 140 of file max_LCD.cpp.

- + +

◆ noBlink()

+
@@ -304,11 +302,13 @@ Public Member Functions
-

Definition at line 160 of file max_LCD.cpp.

+

Definition at line 160 of file max_LCD.cpp.

- + +

◆ blink()

+
@@ -321,11 +321,13 @@ Public Member Functions
-

Definition at line 165 of file max_LCD.cpp.

+

Definition at line 165 of file max_LCD.cpp.

- + +

◆ noCursor()

+
@@ -338,11 +340,13 @@ Public Member Functions
-

Definition at line 147 of file max_LCD.cpp.

+

Definition at line 147 of file max_LCD.cpp.

- + +

◆ cursor()

+
@@ -355,11 +359,13 @@ Public Member Functions
-

Definition at line 152 of file max_LCD.cpp.

+

Definition at line 152 of file max_LCD.cpp.

- + +

◆ scrollDisplayLeft()

+
@@ -373,11 +379,13 @@ Public Member Functions
-

Definition at line 172 of file max_LCD.cpp.

+

Definition at line 172 of file max_LCD.cpp.

- + +

◆ scrollDisplayRight()

+
@@ -391,11 +399,13 @@ Public Member Functions
-

Definition at line 176 of file max_LCD.cpp.

+

Definition at line 176 of file max_LCD.cpp.

- + +

◆ leftToRight()

+
@@ -409,11 +419,13 @@ Public Member Functions
-

Definition at line 182 of file max_LCD.cpp.

+

Definition at line 182 of file max_LCD.cpp.

- + +

◆ rightToLeft()

+
@@ -427,11 +439,13 @@ Public Member Functions
-

Definition at line 189 of file max_LCD.cpp.

+

Definition at line 189 of file max_LCD.cpp.

- + +

◆ autoscroll()

+
@@ -445,11 +459,13 @@ Public Member Functions
-

Definition at line 196 of file max_LCD.cpp.

+

Definition at line 196 of file max_LCD.cpp.

- + +

◆ noAutoscroll()

+
@@ -463,11 +479,13 @@ Public Member Functions
-

Definition at line 203 of file max_LCD.cpp.

+

Definition at line 203 of file max_LCD.cpp.

- + +

◆ createChar()

+
@@ -491,11 +509,13 @@ Public Member Functions
-

Definition at line 211 of file max_LCD.cpp.

+

Definition at line 211 of file max_LCD.cpp.

- + +

◆ setCursor()

+
@@ -519,11 +539,13 @@ Public Member Functions
-

Definition at line 124 of file max_LCD.cpp.

+

Definition at line 124 of file max_LCD.cpp.

- + +

◆ command()

+
@@ -545,11 +567,13 @@ Public Member Functions
-

Definition at line 221 of file max_LCD.cpp.

+

Definition at line 221 of file max_LCD.cpp.

- + +

◆ write()

+
@@ -571,7 +595,7 @@ Public Member Functions
-

Definition at line 228 of file max_LCD.cpp.

+

Definition at line 228 of file max_LCD.cpp.

@@ -584,7 +608,7 @@ Public Member Functions diff --git a/class_max___l_c_d__coll__graph.md5 b/class_max___l_c_d__coll__graph.md5 index 8d049f39..3f3bddcb 100644 --- a/class_max___l_c_d__coll__graph.md5 +++ b/class_max___l_c_d__coll__graph.md5 @@ -1 +1 @@ -14cf14911886c71d7e91596c82a5010c \ No newline at end of file +e2f8a913599c12410a410520826dbb8e \ No newline at end of file diff --git a/class_max___l_c_d__coll__graph.png b/class_max___l_c_d__coll__graph.png index 6d1bd6b6..92c76c33 100644 Binary files a/class_max___l_c_d__coll__graph.png and b/class_max___l_c_d__coll__graph.png differ diff --git a/class_max___l_c_d__inherit__graph.md5 b/class_max___l_c_d__inherit__graph.md5 index 8d049f39..f53444bf 100644 --- a/class_max___l_c_d__inherit__graph.md5 +++ b/class_max___l_c_d__inherit__graph.md5 @@ -1 +1 @@ -14cf14911886c71d7e91596c82a5010c \ No newline at end of file +74eb966daa02727e2eb676099a813686 \ No newline at end of file diff --git a/class_max___l_c_d__inherit__graph.png b/class_max___l_c_d__inherit__graph.png index 6d1bd6b6..92c76c33 100644 Binary files a/class_max___l_c_d__inherit__graph.png and b/class_max___l_c_d__inherit__graph.png differ diff --git a/class_mouse_report_parser-members.html b/class_mouse_report_parser-members.html index 56bbe033..e5f224ad 100644 --- a/class_mouse_report_parser-members.html +++ b/class_mouse_report_parser-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 51 of file hidboot.h.

+

Definition at line 51 of file hidboot.h.

Member Function Documentation

- + +

◆ Parse()

+
@@ -184,11 +164,13 @@ Protected Member Functions

Implements HIDReportParser.

-

Definition at line 19 of file hidboot.cpp.

+

Definition at line 19 of file hidboot.cpp.

- + +

◆ OnMouseMove()

+
@@ -210,11 +192,13 @@ Protected Member Functions
-

Definition at line 63 of file hidboot.h.

+

Definition at line 63 of file hidboot.h.

- + +

◆ OnLeftButtonUp()

+
@@ -236,11 +220,13 @@ Protected Member Functions
-

Definition at line 66 of file hidboot.h.

+

Definition at line 66 of file hidboot.h.

- + +

◆ OnLeftButtonDown()

+
@@ -262,11 +248,13 @@ Protected Member Functions
-

Definition at line 69 of file hidboot.h.

+

Definition at line 69 of file hidboot.h.

- + +

◆ OnRightButtonUp()

+
@@ -288,11 +276,13 @@ Protected Member Functions
-

Definition at line 72 of file hidboot.h.

+

Definition at line 72 of file hidboot.h.

- + +

◆ OnRightButtonDown()

+
@@ -314,11 +304,13 @@ Protected Member Functions
-

Definition at line 75 of file hidboot.h.

+

Definition at line 75 of file hidboot.h.

- + +

◆ OnMiddleButtonUp()

+
@@ -340,11 +332,13 @@ Protected Member Functions
-

Definition at line 78 of file hidboot.h.

+

Definition at line 78 of file hidboot.h.

- + +

◆ OnMiddleButtonDown()

+
@@ -366,12 +360,14 @@ Protected Member Functions
-

Definition at line 81 of file hidboot.h.

+

Definition at line 81 of file hidboot.h.

Member Data Documentation

- + +

◆ mouseInfo

+
@@ -381,11 +377,13 @@ Protected Member Functions
-

Definition at line 54 of file hidboot.h.

+

Definition at line 54 of file hidboot.h.

- + +

◆ bInfo

+
@@ -395,7 +393,7 @@ Protected Member Functions
-

Definition at line 55 of file hidboot.h.

+

Definition at line 55 of file hidboot.h.

@@ -408,7 +406,7 @@ Protected Member Functions diff --git a/class_mouse_report_parser__coll__graph.md5 b/class_mouse_report_parser__coll__graph.md5 index 0d410a43..d0d55908 100644 --- a/class_mouse_report_parser__coll__graph.md5 +++ b/class_mouse_report_parser__coll__graph.md5 @@ -1 +1 @@ -405a7d8e938e10b74a7c678fcf2f2523 \ No newline at end of file +f9c222dcf7223f947690ce165b721cd3 \ No newline at end of file diff --git a/class_mouse_report_parser__coll__graph.png b/class_mouse_report_parser__coll__graph.png index 617492db..633f0cec 100644 Binary files a/class_mouse_report_parser__coll__graph.png and b/class_mouse_report_parser__coll__graph.png differ diff --git a/class_mouse_report_parser__inherit__graph.md5 b/class_mouse_report_parser__inherit__graph.md5 index 6dbeddc2..74c8e5f2 100644 --- a/class_mouse_report_parser__inherit__graph.md5 +++ b/class_mouse_report_parser__inherit__graph.md5 @@ -1 +1 @@ -06cbf9c7fbacf4aaec1bcdfdc9d69628 \ No newline at end of file +a2dc8148933377ae624709e45bd68601 \ No newline at end of file diff --git a/class_mouse_report_parser__inherit__graph.png b/class_mouse_report_parser__inherit__graph.png index 986daf6f..f9c953ee 100644 Binary files a/class_mouse_report_parser__inherit__graph.png and b/class_mouse_report_parser__inherit__graph.png differ diff --git a/class_multi_byte_value_parser-members.html b/class_multi_byte_value_parser-members.html index 915006af..9bf583d8 100644 --- a/class_multi_byte_value_parser-members.html +++ b/class_multi_byte_value_parser-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 28 of file parsetools.h.

+

Definition at line 35 of file parsetools.h.

Constructor & Destructor Documentation

- + +

◆ MultiByteValueParser()

+
@@ -130,12 +110,14 @@ Public Member Functions
-

Definition at line 35 of file parsetools.h.

+

Definition at line 42 of file parsetools.h.

Member Function Documentation

- + +

◆ GetBuffer()

+
@@ -156,11 +138,13 @@ Public Member Functions
-

Definition at line 38 of file parsetools.h.

+

Definition at line 45 of file parsetools.h.

- + +

◆ Initialize()

+
@@ -182,11 +166,13 @@ Public Member Functions
-

Definition at line 42 of file parsetools.h.

+

Definition at line 49 of file parsetools.h.

- + +

◆ Parse()

+
@@ -210,7 +196,7 @@ Public Member Functions
-

Definition at line 19 of file parsetools.cpp.

+

Definition at line 26 of file parsetools.cpp.

@@ -223,7 +209,7 @@ Public Member Functions diff --git a/class_p_l2303-members.html b/class_p_l2303-members.html index a7afffe9..4d65e089 100644 --- a/class_p_l2303-members.html +++ b/class_p_l2303-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)ACMvirtual enhanced_features(void)ACMinlinevirtual enhanced_status(void)ACMinlinevirtual - epDataInIndexACMprotectedstatic - epDataOutIndexACMprotectedstatic - epInfoACMprotected - epInterruptInIndexACMprotectedstatic + epDataInIndexACMstatic + epDataOutIndexACMstatic + epInfoACM + epInterruptInIndexACMstatic GetAddress()ACMinlinevirtual GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM GetLineCoding(LINE_CODING *dataptr)ACM @@ -143,7 +121,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_p_l2303.html b/class_p_l2303.html index c1e543f6..dd842b76 100644 --- a/class_p_l2303.html +++ b/class_p_l2303.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: PL2303 Class Reference @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
Collaboration graph
- + @@ -188,6 +166,16 @@ Public Member Functions + + + + + + + + + + @@ -214,21 +202,14 @@ Additional Inherited Members - - - - - - - - -

Additional Inherited Members

- Public Attributes inherited from ACM
EpInfo epInfo [ACM_MAX_ENDPOINTS]
 
- Static Public Attributes inherited from ACM
static const uint8_t epDataInIndex = 1
 
static const uint8_t epDataOutIndex = 2
 
static const uint8_t epInterruptInIndex = 3
 
- Protected Member Functions inherited from ACM
void PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
 
 
tty_features _enhanced_status
 
EpInfo epInfo [ACM_MAX_ENDPOINTS]
 
- Static Protected Attributes inherited from ACM
static const uint8_t epDataInIndex = 1
 
static const uint8_t epDataOutIndex = 2
 
static const uint8_t epInterruptInIndex = 3
 

Detailed Description

-

Definition at line 122 of file cdcprolific.h.

+

Definition at line 122 of file cdcprolific.h.

Constructor & Destructor Documentation

- + +

◆ PL2303()

+
@@ -252,12 +233,14 @@ Additional Inherited Members
-

Definition at line 19 of file cdcprolific.cpp.

+

Definition at line 19 of file cdcprolific.cpp.

Member Function Documentation

- + +

◆ Init()

+
@@ -297,7 +280,7 @@ Additional Inherited Members

Reimplemented from ACM.

-

Definition at line 24 of file cdcprolific.cpp.

+

Definition at line 24 of file cdcprolific.cpp.

@@ -310,7 +293,7 @@ Additional Inherited Members diff --git a/class_p_l2303__coll__graph.map b/class_p_l2303__coll__graph.map index abad38d3..3d1e5069 100644 --- a/class_p_l2303__coll__graph.map +++ b/class_p_l2303__coll__graph.map @@ -1,5 +1,5 @@ - + diff --git a/class_p_l2303__coll__graph.md5 b/class_p_l2303__coll__graph.md5 index 3fccb2c3..747c3494 100644 --- a/class_p_l2303__coll__graph.md5 +++ b/class_p_l2303__coll__graph.md5 @@ -1 +1 @@ -da3590f8b39ab5267484ef72f2899a2c \ No newline at end of file +a109a304a1e8b7c2885b5ed40e050f2d \ No newline at end of file diff --git a/class_p_l2303__coll__graph.png b/class_p_l2303__coll__graph.png index fec05578..996af398 100644 Binary files a/class_p_l2303__coll__graph.png and b/class_p_l2303__coll__graph.png differ diff --git a/class_p_l2303__inherit__graph.md5 b/class_p_l2303__inherit__graph.md5 index 8fff62d8..71c336d7 100644 --- a/class_p_l2303__inherit__graph.md5 +++ b/class_p_l2303__inherit__graph.md5 @@ -1 +1 @@ -dd455d55317b48c08e2327d045dafb04 \ No newline at end of file +2921424f538e5b4baf7916aede8cb89f \ No newline at end of file diff --git a/class_p_l2303__inherit__graph.png b/class_p_l2303__inherit__graph.png index 997e8422..49ad0460 100644 Binary files a/class_p_l2303__inherit__graph.png and b/class_p_l2303__inherit__graph.png differ diff --git a/class_p_s3_b_t-members.html b/class_p_s3_b_t-members.html index dfaa9f75..24b5040a 100644 --- a/class_p_s3_b_t-members.html +++ b/class_p_s3_b_t-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

This BluetoothService class implements support for all the official PS3 Controllers: Dualshock 3, Navigation or a Motion controller via Bluetooth.

Information about the protocol can be found at the wiki: https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information.

-

Definition at line 32 of file PS3BT.h.

+

Definition at line 32 of file PS3BT.h.

Constructor & Destructor Documentation

- + +

◆ PS3BT()

+
@@ -280,12 +260,14 @@ Additional Inherited Members -

Definition at line 23 of file PS3BT.cpp.

+

Definition at line 23 of file PS3BT.cpp.

Member Function Documentation

- + +

◆ disconnect()

+
@@ -309,11 +291,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 217 of file PS3BT.cpp.

+

Definition at line 217 of file PS3BT.cpp.

- + +

◆ getButtonPress()

+
@@ -336,11 +320,13 @@ Additional Inherited Members
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 49 of file PS3BT.cpp.

+

Definition at line 49 of file PS3BT.cpp.

- + +

◆ getButtonClick()

+
@@ -363,11 +349,13 @@ Additional Inherited Members
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 53 of file PS3BT.cpp.

+

Definition at line 53 of file PS3BT.cpp.

- + +

◆ getAnalogButton()

+
@@ -388,11 +376,13 @@ Additional Inherited Members
Returns
Analog value in the range of 0-255.
-

Definition at line 60 of file PS3BT.cpp.

+

Definition at line 60 of file PS3BT.cpp.

- + +

◆ getAnalogHat()

+
@@ -413,11 +403,13 @@ Additional Inherited Members
Returns
Return the analog value in the range of 0-255.
-

Definition at line 64 of file PS3BT.cpp.

+

Definition at line 64 of file PS3BT.cpp.

- + +

◆ getSensor()

+
@@ -438,11 +430,13 @@ Additional Inherited Members
Returns
Return the raw sensor value.
-

Definition at line 68 of file PS3BT.cpp.

+

Definition at line 68 of file PS3BT.cpp.

- + +

◆ getAngle()

+
@@ -463,11 +457,13 @@ Additional Inherited Members
Returns
Return the angle in the range of 0-360.
-

Definition at line 85 of file PS3BT.cpp.

+

Definition at line 85 of file PS3BT.cpp.

- + +

◆ get9DOFValues()

+
@@ -488,11 +484,13 @@ Additional Inherited Members
Returns
The value in SI units.
-

Definition at line 112 of file PS3BT.cpp.

+

Definition at line 112 of file PS3BT.cpp.

- + +

◆ getStatus()

+
@@ -513,11 +511,13 @@ Additional Inherited Members
Returns
True if correct and false if not.
-

Definition at line 156 of file PS3BT.cpp.

+

Definition at line 156 of file PS3BT.cpp.

- + +

◆ printStatusString()

+
@@ -531,11 +531,13 @@ Additional Inherited Members

Read all the available statuses from the controller and prints it as a nice formated string.

-

Definition at line 160 of file PS3BT.cpp.

+

Definition at line 160 of file PS3BT.cpp.

- + +

◆ getTemperature()

+
@@ -549,11 +551,13 @@ Additional Inherited Members

Read the temperature from the Move controller.

Returns
The temperature in degrees Celsius.
-

Definition at line 141 of file PS3BT.cpp.

+

Definition at line 141 of file PS3BT.cpp.

- + +

◆ setAllOff()

+
@@ -567,11 +571,13 @@ Additional Inherited Members

Used to set all LEDs and rumble off.

-

Definition at line 519 of file PS3BT.cpp.

+

Definition at line 519 of file PS3BT.cpp.

- + +

◆ setRumbleOff()

+
@@ -585,11 +591,13 @@ Additional Inherited Members

Turn off rumble.

-

Definition at line 530 of file PS3BT.cpp.

+

Definition at line 530 of file PS3BT.cpp.

- + +

◆ setRumbleOn() [1/2]

+
@@ -609,11 +617,13 @@ Additional Inherited Members -

Definition at line 540 of file PS3BT.cpp.

+

Definition at line 540 of file PS3BT.cpp.

- + +

◆ setRumbleOn() [2/2]

+
@@ -658,11 +668,13 @@ Additional Inherited Members -

Definition at line 549 of file PS3BT.cpp.

+

Definition at line 549 of file PS3BT.cpp.

- + +

◆ setLedRaw()

+
@@ -682,11 +694,13 @@ Additional Inherited Members -

Definition at line 559 of file PS3BT.cpp.

+

Definition at line 559 of file PS3BT.cpp.

- + +

◆ setLedOff() [1/2]

+
@@ -708,11 +722,13 @@ Additional Inherited Members

Turn all LEDs off.

-

Definition at line 138 of file PS3BT.h.

+

Definition at line 138 of file PS3BT.h.

- + +

◆ setLedOff() [2/2]

+
@@ -732,11 +748,13 @@ Additional Inherited Members -

Definition at line 564 of file PS3BT.cpp.

+

Definition at line 564 of file PS3BT.cpp.

- + +

◆ setLedOn()

+
@@ -756,11 +774,13 @@ Additional Inherited Members -

Definition at line 569 of file PS3BT.cpp.

+

Definition at line 569 of file PS3BT.cpp.

- + +

◆ setLedToggle()

+
@@ -780,11 +800,13 @@ Additional Inherited Members -

Definition at line 578 of file PS3BT.cpp.

+

Definition at line 578 of file PS3BT.cpp.

- + +

◆ moveSetBulb() [1/2]

+
@@ -820,11 +842,13 @@ Additional Inherited Members -

Definition at line 604 of file PS3BT.cpp.

+

Definition at line 604 of file PS3BT.cpp.

- + +

◆ moveSetBulb() [2/2]

+
@@ -844,11 +868,13 @@ Additional Inherited Members -

Definition at line 613 of file PS3BT.cpp.

+

Definition at line 613 of file PS3BT.cpp.

- + +

◆ moveSetRumble()

+
@@ -868,11 +894,13 @@ Additional Inherited Members -

Definition at line 617 of file PS3BT.cpp.

+

Definition at line 617 of file PS3BT.cpp.

- + +

◆ getLastMessageTime()

+
@@ -894,11 +922,13 @@ Additional Inherited Members

Used to get the millis() of the last message

-

Definition at line 174 of file PS3BT.h.

+

Definition at line 174 of file PS3BT.h.

- + +

◆ ACLData()

+
@@ -928,11 +958,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 224 of file PS3BT.cpp.

+

Definition at line 224 of file PS3BT.cpp.

- + +

◆ Run()

+
@@ -956,11 +988,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 454 of file PS3BT.cpp.

+

Definition at line 454 of file PS3BT.cpp.

- + +

◆ Reset()

+
@@ -984,11 +1018,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 204 of file PS3BT.cpp.

+

Definition at line 204 of file PS3BT.cpp.

- + +

◆ onInit()

+
@@ -1012,12 +1048,14 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 628 of file PS3BT.cpp.

+

Definition at line 628 of file PS3BT.cpp.

Member Data Documentation

- + +

◆ PS3Connected

+
@@ -1028,11 +1066,13 @@ Additional Inherited Members

Variable used to indicate if the normal Playstation controller is successfully connected.

-

Definition at line 176 of file PS3BT.h.

+

Definition at line 176 of file PS3BT.h.

- + +

◆ PS3MoveConnected

+
@@ -1043,11 +1083,13 @@ Additional Inherited Members

Variable used to indicate if the Move controller is successfully connected.

-

Definition at line 182 of file PS3BT.h.

+

Definition at line 182 of file PS3BT.h.

- + +

◆ PS3NavigationConnected

+
@@ -1058,7 +1100,7 @@ Additional Inherited Members

Variable used to indicate if the Navigation controller is successfully connected.

-

Definition at line 184 of file PS3BT.h.

+

Definition at line 184 of file PS3BT.h.

@@ -1071,7 +1113,7 @@ Additional Inherited Members diff --git a/class_p_s3_b_t__coll__graph.md5 b/class_p_s3_b_t__coll__graph.md5 index 9944a07a..8d1c35cc 100644 --- a/class_p_s3_b_t__coll__graph.md5 +++ b/class_p_s3_b_t__coll__graph.md5 @@ -1 +1 @@ -7cded78e6e9cacc4756734b2d8e3a17f \ No newline at end of file +2afa3c1ee396396537c80a9e82e8ab8c \ No newline at end of file diff --git a/class_p_s3_b_t__coll__graph.png b/class_p_s3_b_t__coll__graph.png index fafb7c64..066951bb 100644 Binary files a/class_p_s3_b_t__coll__graph.png and b/class_p_s3_b_t__coll__graph.png differ diff --git a/class_p_s3_b_t__inherit__graph.md5 b/class_p_s3_b_t__inherit__graph.md5 index c4a47a9b..485bbf3f 100644 --- a/class_p_s3_b_t__inherit__graph.md5 +++ b/class_p_s3_b_t__inherit__graph.md5 @@ -1 +1 @@ -af123ea0ba1b2bc2c3a6775f7cb65fa0 \ No newline at end of file +3d26891ef8cb1c025100fb5c239bf7cb \ No newline at end of file diff --git a/class_p_s3_b_t__inherit__graph.png b/class_p_s3_b_t__inherit__graph.png index 8cad5dca..0991a4b6 100644 Binary files a/class_p_s3_b_t__inherit__graph.png and b/class_p_s3_b_t__inherit__graph.png differ diff --git a/class_p_s3_u_s_b-members.html b/class_p_s3_u_s_b-members.html index 61040b73..39a63f94 100644 --- a/class_p_s3_u_s_b-members.html +++ b/class_p_s3_u_s_b-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

One can only set the color of the bulb, set the rumble, set and get the bluetooth address and calibrate the magnetometer via USB on the Move controller.

Information about the protocol can be found at the wiki: https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information.

-

Definition at line 49 of file PS3USB.h.

+

Definition at line 49 of file PS3USB.h.

Constructor & Destructor Documentation

- + +

◆ PS3USB()

+
@@ -281,12 +261,14 @@ Protected Attributes -

Definition at line 23 of file PS3USB.cpp.

+

Definition at line 23 of file PS3USB.cpp.

Member Function Documentation

- + +

◆ Init()

+
@@ -335,11 +317,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 47 of file PS3USB.cpp.

+

Definition at line 47 of file PS3USB.cpp.

- + +

◆ Release()

+
@@ -363,11 +347,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 262 of file PS3USB.cpp.

+

Definition at line 262 of file PS3USB.cpp.

- + +

◆ Poll()

+
@@ -391,11 +377,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 272 of file PS3USB.cpp.

+

Definition at line 272 of file PS3USB.cpp.

- + +

◆ GetAddress()

+
@@ -419,11 +407,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 84 of file PS3USB.h.

+

Definition at line 84 of file PS3USB.h.

- + +

◆ isReady()

+
@@ -445,11 +435,13 @@ Protected Attributes

Used to check if the controller has been initialized.

Returns
True if it's ready.
-

Definition at line 92 of file PS3USB.h.

+

Definition at line 92 of file PS3USB.h.

- + +

◆ VIDPIDOK()

+
@@ -491,11 +483,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 102 of file PS3USB.h.

+

Definition at line 102 of file PS3USB.h.

- + +

◆ setBdaddr()

+
@@ -515,11 +509,13 @@ Protected Attributes -

Definition at line 465 of file PS3USB.cpp.

+

Definition at line 465 of file PS3USB.cpp.

- + +

◆ getBdaddr()

+
@@ -539,11 +535,13 @@ Protected Attributes -

Definition at line 478 of file PS3USB.cpp.

+

Definition at line 478 of file PS3USB.cpp.

- + +

◆ setMoveBdaddr()

+
@@ -563,11 +561,13 @@ Protected Attributes -

Definition at line 527 of file PS3USB.cpp.

+

Definition at line 527 of file PS3USB.cpp.

- + +

◆ getMoveBdaddr()

+
@@ -587,11 +587,13 @@ Protected Attributes -

Definition at line 543 of file PS3USB.cpp.

+

Definition at line 543 of file PS3USB.cpp.

- + +

◆ getMoveCalibration()

+
@@ -611,11 +613,13 @@ Protected Attributes -

Definition at line 553 of file PS3USB.cpp.

+

Definition at line 553 of file PS3USB.cpp.

- + +

◆ getButtonPress()

+
@@ -638,11 +642,13 @@ Protected Attributes
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 316 of file PS3USB.cpp.

+

Definition at line 316 of file PS3USB.cpp.

- + +

◆ getButtonClick()

+
@@ -665,11 +671,13 @@ Protected Attributes
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 320 of file PS3USB.cpp.

+

Definition at line 320 of file PS3USB.cpp.

- + +

◆ getAnalogButton()

+
@@ -690,11 +698,13 @@ Protected Attributes
Returns
Analog value in the range of 0-255.
-

Definition at line 327 of file PS3USB.cpp.

+

Definition at line 327 of file PS3USB.cpp.

- + +

◆ getAnalogHat()

+
@@ -715,11 +725,13 @@ Protected Attributes
Returns
Return the analog value in the range of 0-255.
-

Definition at line 331 of file PS3USB.cpp.

+

Definition at line 331 of file PS3USB.cpp.

- + +

◆ getSensor()

+
@@ -740,11 +752,13 @@ Protected Attributes
Returns
Return the raw sensor value.
-

Definition at line 335 of file PS3USB.cpp.

+

Definition at line 335 of file PS3USB.cpp.

- + +

◆ getAngle()

+
@@ -765,11 +779,13 @@ Protected Attributes
Returns
Return the angle in the range of 0-360.
-

Definition at line 339 of file PS3USB.cpp.

+

Definition at line 339 of file PS3USB.cpp.

- + +

◆ getStatus()

+
@@ -790,11 +806,13 @@ Protected Attributes
Returns
True if correct and false if not.
-

Definition at line 360 of file PS3USB.cpp.

+

Definition at line 360 of file PS3USB.cpp.

- + +

◆ printStatusString()

+
@@ -808,11 +826,13 @@ Protected Attributes

Read all the available statuses from the controller and prints it as a nice formated string.

-

Definition at line 364 of file PS3USB.cpp.

+

Definition at line 364 of file PS3USB.cpp.

- + +

◆ setAllOff()

+
@@ -826,11 +846,13 @@ Protected Attributes

Used to set all LEDs and rumble off.

-

Definition at line 403 of file PS3USB.cpp.

+

Definition at line 403 of file PS3USB.cpp.

- + +

◆ setRumbleOff()

+
@@ -844,11 +866,13 @@ Protected Attributes

Turn off rumble.

-

Definition at line 410 of file PS3USB.cpp.

+

Definition at line 410 of file PS3USB.cpp.

- + +

◆ setRumbleOn() [1/2]

+
@@ -868,11 +892,13 @@ Protected Attributes -

Definition at line 420 of file PS3USB.cpp.

+

Definition at line 420 of file PS3USB.cpp.

- + +

◆ setRumbleOn() [2/2]

+
@@ -917,11 +943,13 @@ Protected Attributes -

Definition at line 431 of file PS3USB.cpp.

+

Definition at line 431 of file PS3USB.cpp.

- + +

◆ setLedRaw()

+
@@ -941,11 +969,13 @@ Protected Attributes -

Definition at line 441 of file PS3USB.cpp.

+

Definition at line 441 of file PS3USB.cpp.

- + +

◆ setLedOff() [1/2]

+
@@ -967,11 +997,13 @@ Protected Attributes

Turn all LEDs off.

-

Definition at line 215 of file PS3USB.h.

+

Definition at line 215 of file PS3USB.h.

- + +

◆ setLedOff() [2/2]

+
@@ -991,11 +1023,13 @@ Protected Attributes -

Definition at line 446 of file PS3USB.cpp.

+

Definition at line 446 of file PS3USB.cpp.

- + +

◆ setLedOn()

+
@@ -1015,11 +1049,13 @@ Protected Attributes -

Definition at line 451 of file PS3USB.cpp.

+

Definition at line 451 of file PS3USB.cpp.

- + +

◆ setLedToggle()

+
@@ -1039,11 +1075,13 @@ Protected Attributes -

Definition at line 460 of file PS3USB.cpp.

+

Definition at line 460 of file PS3USB.cpp.

- + +

◆ moveSetBulb() [1/2]

+
@@ -1079,11 +1117,13 @@ Protected Attributes -

Definition at line 504 of file PS3USB.cpp.

+

Definition at line 504 of file PS3USB.cpp.

- + +

◆ moveSetBulb() [2/2]

+
@@ -1103,11 +1143,13 @@ Protected Attributes -

Definition at line 513 of file PS3USB.cpp.

+

Definition at line 513 of file PS3USB.cpp.

- + +

◆ moveSetRumble()

+
@@ -1127,11 +1169,13 @@ Protected Attributes -

Definition at line 517 of file PS3USB.cpp.

+

Definition at line 517 of file PS3USB.cpp.

- + +

◆ attachOnInit()

+
@@ -1159,12 +1203,14 @@ Protected Attributes -

Definition at line 254 of file PS3USB.h.

+

Definition at line 254 of file PS3USB.h.

Member Data Documentation

- + +

◆ PS3Connected

+
@@ -1175,11 +1221,13 @@ Protected Attributes

Variable used to indicate if the normal playstation controller is successfully connected.

-

Definition at line 256 of file PS3USB.h.

+

Definition at line 256 of file PS3USB.h.

- + +

◆ PS3MoveConnected

+
@@ -1190,11 +1238,13 @@ Protected Attributes

Variable used to indicate if the move controller is successfully connected.

-

Definition at line 262 of file PS3USB.h.

+

Definition at line 262 of file PS3USB.h.

- + +

◆ PS3NavigationConnected

+
@@ -1205,11 +1255,13 @@ Protected Attributes

Variable used to indicate if the navigation controller is successfully connected.

-

Definition at line 264 of file PS3USB.h.

+

Definition at line 264 of file PS3USB.h.

- + +

◆ pUsb

+
@@ -1228,11 +1280,13 @@ Protected Attributes

Pointer to USB class instance.

-

Definition at line 268 of file PS3USB.h.

+

Definition at line 268 of file PS3USB.h.

- + +

◆ bAddress

+
@@ -1251,11 +1305,13 @@ Protected Attributes

Device address.

-

Definition at line 270 of file PS3USB.h.

+

Definition at line 270 of file PS3USB.h.

- + +

◆ epInfo

+
@@ -1274,7 +1330,7 @@ Protected Attributes

Endpoint info structure.

-

Definition at line 272 of file PS3USB.h.

+

Definition at line 272 of file PS3USB.h.

@@ -1287,7 +1343,7 @@ Protected Attributes diff --git a/class_p_s3_u_s_b__coll__graph.md5 b/class_p_s3_u_s_b__coll__graph.md5 index 1aae81d3..3cb61626 100644 --- a/class_p_s3_u_s_b__coll__graph.md5 +++ b/class_p_s3_u_s_b__coll__graph.md5 @@ -1 +1 @@ -06f5f28fefcd0973f7f3cf5ab5f01033 \ No newline at end of file +419b4e935c78301cc0a62882347018ba \ No newline at end of file diff --git a/class_p_s3_u_s_b__coll__graph.png b/class_p_s3_u_s_b__coll__graph.png index 4e1da018..fec3c749 100644 Binary files a/class_p_s3_u_s_b__coll__graph.png and b/class_p_s3_u_s_b__coll__graph.png differ diff --git a/class_p_s3_u_s_b__inherit__graph.md5 b/class_p_s3_u_s_b__inherit__graph.md5 index b241da78..25fa853d 100644 --- a/class_p_s3_u_s_b__inherit__graph.md5 +++ b/class_p_s3_u_s_b__inherit__graph.md5 @@ -1 +1 @@ -77f7ca570be060c1a40a0845510a4a59 \ No newline at end of file +b322f707cca63b07e436aa0d678c09f6 \ No newline at end of file diff --git a/class_p_s3_u_s_b__inherit__graph.png b/class_p_s3_u_s_b__inherit__graph.png index 2cbfcbd3..887c41f0 100644 Binary files a/class_p_s3_u_s_b__inherit__graph.png and b/class_p_s3_u_s_b__inherit__graph.png differ diff --git a/class_p_s4_b_t-members.html b/class_p_s4_b_t-members.html index d6fb78d6..548cffb2 100644 --- a/class_p_s4_b_t-members.html +++ b/class_p_s4_b_t-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

This class implements support for the PS4 controller via Bluetooth. It uses the BTHID class for all the Bluetooth communication.

-

Definition at line 28 of file PS4BT.h.

+

Definition at line 28 of file PS4BT.h.

Constructor & Destructor Documentation

- + +

◆ PS4BT()

+
@@ -299,12 +279,14 @@ Additional Inherited Members -

Definition at line 36 of file PS4BT.h.

+

Definition at line 36 of file PS4BT.h.

Member Function Documentation

- + +

◆ connected()

+
@@ -326,11 +308,13 @@ Additional Inherited Members

Used to check if a PS4 controller is connected.

Returns
Returns true if it is connected.
-

Definition at line 45 of file PS4BT.h.

+

Definition at line 45 of file PS4BT.h.

- + +

◆ ParseBTHIDData()

+
@@ -371,11 +355,13 @@ Additional Inherited Members

Reimplemented from BTHID.

-

Definition at line 56 of file PS4BT.h.

+

Definition at line 56 of file PS4BT.h.

- + +

◆ OnInitBTHID()

+
@@ -399,11 +385,13 @@ Additional Inherited Members

Reimplemented from BTHID.

-

Definition at line 65 of file PS4BT.h.

+

Definition at line 65 of file PS4BT.h.

- + +

◆ ResetBTHID()

+
@@ -427,11 +415,13 @@ Additional Inherited Members

Reimplemented from BTHID.

-

Definition at line 75 of file PS4BT.h.

+

Definition at line 75 of file PS4BT.h.

- + +

◆ sendOutputReport()

+
@@ -461,7 +451,7 @@ Additional Inherited Members

Implements PS4Parser.

-

Definition at line 81 of file PS4BT.h.

+

Definition at line 81 of file PS4BT.h.

@@ -473,7 +463,7 @@ Additional Inherited Members diff --git a/class_p_s4_b_t__coll__graph.md5 b/class_p_s4_b_t__coll__graph.md5 index 57a44763..62540081 100644 --- a/class_p_s4_b_t__coll__graph.md5 +++ b/class_p_s4_b_t__coll__graph.md5 @@ -1 +1 @@ -4bb85a2b4d5163f1d591f32b835727dc \ No newline at end of file +caf6d41b8cdc6da742f8f2054e40560a \ No newline at end of file diff --git a/class_p_s4_b_t__coll__graph.png b/class_p_s4_b_t__coll__graph.png index d96b67a9..bc7cb196 100644 Binary files a/class_p_s4_b_t__coll__graph.png and b/class_p_s4_b_t__coll__graph.png differ diff --git a/class_p_s4_b_t__inherit__graph.md5 b/class_p_s4_b_t__inherit__graph.md5 index 22e73541..10dc4741 100644 --- a/class_p_s4_b_t__inherit__graph.md5 +++ b/class_p_s4_b_t__inherit__graph.md5 @@ -1 +1 @@ -405752bfa16040ed3832aa96d3e4fa2f \ No newline at end of file +2de412526e28e795ed39015c162d3536 \ No newline at end of file diff --git a/class_p_s4_b_t__inherit__graph.png b/class_p_s4_b_t__inherit__graph.png index 25a19bcf..7c387315 100644 Binary files a/class_p_s4_b_t__inherit__graph.png and b/class_p_s4_b_t__inherit__graph.png differ diff --git a/class_p_s4_parser-members.html b/class_p_s4_parser-members.html index baa936ec..db3617f7 100644 --- a/class_p_s4_parser-members.html +++ b/class_p_s4_parser-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

This class parses all the data sent by the PS4 controller

-

Definition at line 124 of file PS4Parser.h.

+

Definition at line 124 of file PS4Parser.h.

Constructor & Destructor Documentation

- + +

◆ PS4Parser()

+
@@ -190,12 +170,14 @@ Protected Member Functions

Constructor for the PS4Parser class.

-

Definition at line 127 of file PS4Parser.h.

+

Definition at line 127 of file PS4Parser.h.

Member Function Documentation

- + +

◆ getButtonPress()

+
@@ -218,11 +200,13 @@ Protected Member Functions
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 50 of file PS4Parser.cpp.

+

Definition at line 50 of file PS4Parser.cpp.

- + +

◆ getButtonClick()

+
@@ -245,11 +229,13 @@ Protected Member Functions
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 57 of file PS4Parser.cpp.

+

Definition at line 57 of file PS4Parser.cpp.

- + +

◆ getAnalogButton()

+
@@ -264,17 +250,19 @@ Protected Member Functions

Used to get the analog value from button presses.

Parameters
- +
bThe ButtonEnum to read. The supported buttons are: UP, RIGHT, DOWN, LEFT, L1, L2, R1, R2, TRIANGLE, CIRCLE, CROSS, SQUARE, and T.
bThe ButtonEnum to read. The supported buttons are: L2 and R2.
Returns
Analog value in the range of 0-255.
-

Definition at line 64 of file PS4Parser.cpp.

+

Definition at line 64 of file PS4Parser.cpp.

- + +

◆ getAnalogHat()

+
@@ -295,11 +283,13 @@ Protected Member Functions
Returns
Return the analog value in the range of 0-255.
-

Definition at line 72 of file PS4Parser.cpp.

+

Definition at line 72 of file PS4Parser.cpp.

- + +

◆ getX()

+
@@ -339,11 +329,13 @@ Protected Member Functions
Returns
Returns the x-coordinate of the finger.
-

Definition at line 171 of file PS4Parser.h.

+

Definition at line 170 of file PS4Parser.h.

- + +

◆ getY()

+
@@ -383,11 +375,13 @@ Protected Member Functions
Returns
Returns the y-coordinate of the finger.
-

Definition at line 183 of file PS4Parser.h.

+

Definition at line 182 of file PS4Parser.h.

- + +

◆ isTouching()

+
@@ -427,11 +421,13 @@ Protected Member Functions
Returns
Returns true if the specific finger is touching the touchpad.
-

Definition at line 195 of file PS4Parser.h.

+

Definition at line 194 of file PS4Parser.h.

- + +

◆ getTouchCounter()

+
@@ -471,11 +467,13 @@ Protected Member Functions
Returns
Return the value of the counter, note that it is only a 7-bit value.
-

Definition at line 207 of file PS4Parser.h.

+

Definition at line 206 of file PS4Parser.h.

- + +

◆ getAngle()

+
@@ -504,11 +502,13 @@ Protected Member Functions
Returns
Return the angle in the range of 0-360.
-

Definition at line 216 of file PS4Parser.h.

+

Definition at line 215 of file PS4Parser.h.

- + +

◆ getSensor()

+
@@ -537,11 +537,13 @@ Protected Member Functions
Returns
Returns the raw sensor reading.
-

Definition at line 228 of file PS4Parser.h.

+

Definition at line 227 of file PS4Parser.h.

- + +

◆ getBatteryLevel()

+
@@ -563,11 +565,13 @@ Protected Member Functions

Return the battery level of the PS4 controller.

Returns
The battery level in the range 0-15.
-

Definition at line 251 of file PS4Parser.h.

+

Definition at line 250 of file PS4Parser.h.

- + +

◆ getUsbStatus()

+
@@ -589,11 +593,13 @@ Protected Member Functions

Use this to check if an USB cable is connected to the PS4 controller.

Returns
Returns true if an USB cable is connected.
-

Definition at line 259 of file PS4Parser.h.

+

Definition at line 258 of file PS4Parser.h.

- + +

◆ getAudioStatus()

+
@@ -615,11 +621,13 @@ Protected Member Functions

Use this to check if an audio jack cable is connected to the PS4 controller.

Returns
Returns true if an audio jack cable is connected.
-

Definition at line 267 of file PS4Parser.h.

+

Definition at line 266 of file PS4Parser.h.

- + +

◆ getMicStatus()

+
@@ -641,11 +649,13 @@ Protected Member Functions

Use this to check if a microphone is connected to the PS4 controller.

Returns
Returns true if a microphone is connected.
-

Definition at line 275 of file PS4Parser.h.

+

Definition at line 274 of file PS4Parser.h.

- + +

◆ setAllOff()

+
@@ -667,11 +677,13 @@ Protected Member Functions

Turn both rumble and the LEDs off.

-

Definition at line 280 of file PS4Parser.h.

+

Definition at line 279 of file PS4Parser.h.

- + +

◆ setRumbleOff()

+
@@ -693,11 +705,13 @@ Protected Member Functions

Set rumble off.

-

Definition at line 286 of file PS4Parser.h.

+

Definition at line 285 of file PS4Parser.h.

- + +

◆ setRumbleOn() [1/2]

+
@@ -725,11 +739,13 @@ Protected Member Functions -

Definition at line 294 of file PS4Parser.h.

+

Definition at line 293 of file PS4Parser.h.

- + +

◆ setRumbleOn() [2/2]

+
@@ -768,11 +784,13 @@ Protected Member Functions -

Definition at line 306 of file PS4Parser.h.

+

Definition at line 305 of file PS4Parser.h.

- + +

◆ setLedOff()

+
@@ -794,11 +812,13 @@ Protected Member Functions

Turn all LEDs off.

-

Definition at line 313 of file PS4Parser.h.

+

Definition at line 312 of file PS4Parser.h.

- + +

◆ setLed() [1/2]

+
@@ -842,11 +862,13 @@ Protected Member Functions -

Definition at line 321 of file PS4Parser.h.

+

Definition at line 320 of file PS4Parser.h.

- + +

◆ setLed() [2/2]

+
@@ -874,11 +896,13 @@ Protected Member Functions -

Definition at line 332 of file PS4Parser.h.

+

Definition at line 331 of file PS4Parser.h.

- + +

◆ setLedFlash()

+
@@ -917,11 +941,13 @@ Protected Member Functions -

Definition at line 341 of file PS4Parser.h.

+

Definition at line 340 of file PS4Parser.h.

- + +

◆ Parse()

+
@@ -960,11 +986,13 @@ Protected Member Functions -

Definition at line 76 of file PS4Parser.cpp.

+

Definition at line 76 of file PS4Parser.cpp.

- + +

◆ Reset()

+
@@ -986,11 +1014,13 @@ Protected Member Functions

Used to reset the different buffers to their default values

-

Definition at line 130 of file PS4Parser.cpp.

+

Definition at line 130 of file PS4Parser.cpp.

- + +

◆ sendOutputReport()

+
@@ -1031,7 +1061,7 @@ Protected Member Functions diff --git a/class_p_s4_parser__inherit__graph.md5 b/class_p_s4_parser__inherit__graph.md5 index 7d6cd78a..65bfd4cb 100644 --- a/class_p_s4_parser__inherit__graph.md5 +++ b/class_p_s4_parser__inherit__graph.md5 @@ -1 +1 @@ -b842fe07d690c9e08045bf8e0d96d45b \ No newline at end of file +dc6cd7ca1f2260cb5f86a8ae5bfdc9df \ No newline at end of file diff --git a/class_p_s4_parser__inherit__graph.png b/class_p_s4_parser__inherit__graph.png index 46483571..bb500769 100644 Binary files a/class_p_s4_parser__inherit__graph.png and b/class_p_s4_parser__inherit__graph.png differ diff --git a/class_p_s4_u_s_b-members.html b/class_p_s4_u_s_b-members.html index 8bea55cc..c8ac6986 100644 --- a/class_p_s4_u_s_b-members.html +++ b/class_p_s4_u_s_b-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

This class implements support for the PS4 controller via USB. It uses the HIDUniversal class for all the USB communication.

-

Definition at line 31 of file PS4USB.h.

+

Definition at line 32 of file PS4USB.h.

Constructor & Destructor Documentation

- + +

◆ PS4USB()

+
@@ -316,12 +296,14 @@ Additional Inherited Members -

Definition at line 37 of file PS4USB.h.

+

Definition at line 38 of file PS4USB.h.

Member Function Documentation

- + +

◆ connected()

+
@@ -343,11 +325,13 @@ Additional Inherited Members

Used to check if a PS4 controller is connected.

Returns
Returns true if it is connected.
-

Definition at line 46 of file PS4USB.h.

+

Definition at line 47 of file PS4USB.h.

- + +

◆ attachOnInit()

+
@@ -375,11 +359,13 @@ Additional Inherited Members -

Definition at line 54 of file PS4USB.h.

+

Definition at line 55 of file PS4USB.h.

- + +

◆ ParseHIDData()

+
@@ -434,11 +420,13 @@ Additional Inherited Members

Reimplemented from HIDUniversal.

-

Definition at line 67 of file PS4USB.h.

+

Definition at line 68 of file PS4USB.h.

- + +

◆ OnInitSuccessful()

+
@@ -462,11 +450,13 @@ Additional Inherited Members

Reimplemented from HIDUniversal.

-

Definition at line 77 of file PS4USB.h.

+

Definition at line 78 of file PS4USB.h.

- + +

◆ sendOutputReport()

+
@@ -496,11 +486,13 @@ Additional Inherited Members

Implements PS4Parser.

-

Definition at line 90 of file PS4USB.h.

+

Definition at line 91 of file PS4USB.h.

- + +

◆ VIDPIDOK()

+
@@ -542,7 +534,7 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 122 of file PS4USB.h.

+

Definition at line 123 of file PS4USB.h.

@@ -554,7 +546,7 @@ Additional Inherited Members diff --git a/class_p_s4_u_s_b__coll__graph.md5 b/class_p_s4_u_s_b__coll__graph.md5 index 31d2a590..58a3f35e 100644 --- a/class_p_s4_u_s_b__coll__graph.md5 +++ b/class_p_s4_u_s_b__coll__graph.md5 @@ -1 +1 @@ -6510784396c1c05ff338806741b9ed6c \ No newline at end of file +c1e443ad969075b8a7ad79af4e899d3e \ No newline at end of file diff --git a/class_p_s4_u_s_b__coll__graph.png b/class_p_s4_u_s_b__coll__graph.png index 74c54723..810a0a8d 100644 Binary files a/class_p_s4_u_s_b__coll__graph.png and b/class_p_s4_u_s_b__coll__graph.png differ diff --git a/class_p_s4_u_s_b__inherit__graph.md5 b/class_p_s4_u_s_b__inherit__graph.md5 index da6b8966..dca636bd 100644 --- a/class_p_s4_u_s_b__inherit__graph.md5 +++ b/class_p_s4_u_s_b__inherit__graph.md5 @@ -1 +1 @@ -cb813f5f3004b0786d96c27613056cb9 \ No newline at end of file +2c2ec41d26cf7fe9f9ccfbd8eebeb9bd \ No newline at end of file diff --git a/class_p_s4_u_s_b__inherit__graph.png b/class_p_s4_u_s_b__inherit__graph.png index 4fe4b97c..a0678d8a 100644 Binary files a/class_p_s4_u_s_b__inherit__graph.png and b/class_p_s4_u_s_b__inherit__graph.png differ diff --git a/class_p_s_buzz-members.html b/class_p_s_buzz-members.html index 1c84c0fe..844dc8b0 100644 --- a/class_p_s_buzz-members.html +++ b/class_p_s_buzz-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

This class implements support for the PS Buzz controllers via USB. It uses the HIDUniversal class for all the USB communication.

-

Definition at line 43 of file PSBuzz.h.

+

Definition at line 43 of file PSBuzz.h.

Constructor & Destructor Documentation

- + +

◆ PSBuzz()

+
@@ -279,12 +259,14 @@ Additional Inherited Members -

Definition at line 49 of file PSBuzz.h.

+

Definition at line 49 of file PSBuzz.h.

Member Function Documentation

- + +

◆ connected()

+
@@ -306,11 +288,13 @@ Additional Inherited Members

Used to check if a PS Buzz controller is connected.

Returns
Returns true if it is connected.
-

Definition at line 58 of file PSBuzz.h.

+

Definition at line 58 of file PSBuzz.h.

- + +

◆ attachOnInit()

+
@@ -338,11 +322,13 @@ Additional Inherited Members -

Definition at line 66 of file PSBuzz.h.

+

Definition at line 66 of file PSBuzz.h.

- + +

◆ getButtonPress()

+
@@ -376,11 +362,13 @@ Additional Inherited Members
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 52 of file PSBuzz.cpp.

+

Definition at line 52 of file PSBuzz.cpp.

- + +

◆ getButtonClick()

+
@@ -414,11 +402,13 @@ Additional Inherited Members
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 56 of file PSBuzz.cpp.

+

Definition at line 56 of file PSBuzz.cpp.

- + +

◆ setLedRaw()

+
@@ -450,11 +440,13 @@ Additional Inherited Members -

Definition at line 64 of file PSBuzz.cpp.

+

Definition at line 64 of file PSBuzz.cpp.

- + +

◆ setLedOffAll()

+
@@ -476,11 +468,13 @@ Additional Inherited Members

Turn all LEDs off.

-

Definition at line 98 of file PSBuzz.h.

+

Definition at line 98 of file PSBuzz.h.

- + +

◆ setLedOff()

+
@@ -508,11 +502,13 @@ Additional Inherited Members -

Definition at line 108 of file PSBuzz.h.

+

Definition at line 108 of file PSBuzz.h.

- + +

◆ setLedOnAll()

+
@@ -534,11 +530,13 @@ Additional Inherited Members

Turn all LEDs on.

-

Definition at line 114 of file PSBuzz.h.

+

Definition at line 114 of file PSBuzz.h.

- + +

◆ setLedOn()

+
@@ -566,11 +564,13 @@ Additional Inherited Members -

Definition at line 124 of file PSBuzz.h.

+

Definition at line 124 of file PSBuzz.h.

- + +

◆ setLedToggle()

+
@@ -598,11 +598,13 @@ Additional Inherited Members -

Definition at line 132 of file PSBuzz.h.

+

Definition at line 132 of file PSBuzz.h.

- + +

◆ ParseHIDData()

+
@@ -657,11 +659,13 @@ Additional Inherited Members

Reimplemented from HIDUniversal.

-

Definition at line 23 of file PSBuzz.cpp.

+

Definition at line 23 of file PSBuzz.cpp.

- + +

◆ OnInitSuccessful()

+
@@ -685,11 +689,13 @@ Additional Inherited Members

Reimplemented from HIDUniversal.

-

Definition at line 41 of file PSBuzz.cpp.

+

Definition at line 41 of file PSBuzz.cpp.

- + +

◆ Reset()

+
@@ -711,11 +717,13 @@ Additional Inherited Members

Used to reset the different buffers to their default values

-

Definition at line 157 of file PSBuzz.h.

+

Definition at line 157 of file PSBuzz.h.

- + +

◆ VIDPIDOK()

+
@@ -757,7 +765,7 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 172 of file PSBuzz.h.

+

Definition at line 172 of file PSBuzz.h.

@@ -770,7 +778,7 @@ Additional Inherited Members diff --git a/class_p_s_buzz__coll__graph.md5 b/class_p_s_buzz__coll__graph.md5 index babb5e21..a7baa4ca 100644 --- a/class_p_s_buzz__coll__graph.md5 +++ b/class_p_s_buzz__coll__graph.md5 @@ -1 +1 @@ -fea9ba05db96f5aefabee7a11c9c9f52 \ No newline at end of file +21462fd15ee84876fa8daa1b607dba33 \ No newline at end of file diff --git a/class_p_s_buzz__coll__graph.png b/class_p_s_buzz__coll__graph.png index 2c6a7ba8..780e6763 100644 Binary files a/class_p_s_buzz__coll__graph.png and b/class_p_s_buzz__coll__graph.png differ diff --git a/class_p_s_buzz__inherit__graph.md5 b/class_p_s_buzz__inherit__graph.md5 index f6913f03..9e4d2b3d 100644 --- a/class_p_s_buzz__inherit__graph.md5 +++ b/class_p_s_buzz__inherit__graph.md5 @@ -1 +1 @@ -044341a0d1db5d69a79fcdf68e3f63aa \ No newline at end of file +24bc2881d71535eed040c27bf71992a9 \ No newline at end of file diff --git a/class_p_s_buzz__inherit__graph.png b/class_p_s_buzz__inherit__graph.png index 2fc62fc1..9e841b47 100644 Binary files a/class_p_s_buzz__inherit__graph.png and b/class_p_s_buzz__inherit__graph.png differ diff --git a/class_p_t_p_list_parser-members.html b/class_p_t_p_list_parser-members.html index 20cd64dd..e72f78e4 100644 --- a/class_p_t_p_list_parser-members.html +++ b/class_p_t_p_list_parser-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 83 of file parsetools.h.

+

Definition at line 90 of file parsetools.h.

Member Enumeration Documentation

- + +

◆ ParseMode

+
@@ -125,18 +105,18 @@ Public Member Functions
- - + +
Enumerator
modeArray  -
modeRange  -
Enumerator
modeArray 
modeRange 
-

Definition at line 86 of file parsetools.h.

+

Definition at line 93 of file parsetools.h.

Constructor & Destructor Documentation

- + +

◆ PTPListParser()

+
@@ -157,12 +137,14 @@ Public Member Functions
-

Definition at line 109 of file parsetools.h.

+

Definition at line 116 of file parsetools.h.

Member Function Documentation

- + +

◆ Initialize()

+
@@ -206,11 +188,13 @@ Public Member Functions
-

Definition at line 120 of file parsetools.h.

+

Definition at line 127 of file parsetools.h.

- + +

◆ Parse()

+
@@ -246,7 +230,7 @@ Public Member Functions
-

Definition at line 34 of file parsetools.cpp.

+

Definition at line 41 of file parsetools.cpp.

@@ -259,7 +243,7 @@ Public Member Functions diff --git a/class_report_desc_parser-members.html b/class_report_desc_parser-members.html index 84967627..1b7889ee 100644 --- a/class_report_desc_parser-members.html +++ b/class_report_desc_parser-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 145 of file hidescriptorparser.h.

+

Definition at line 145 of file hidescriptorparser.h.


The documentation for this class was generated from the following file: @@ -313,7 +291,7 @@ Additional Inherited Members diff --git a/class_report_desc_parser2-members.html b/class_report_desc_parser2-members.html index 2f4844f5..7d3cfcdb 100644 --- a/class_report_desc_parser2-members.html +++ b/class_report_desc_parser2-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 148 of file hidescriptorparser.h.

+

Definition at line 148 of file hidescriptorparser.h.

Constructor & Destructor Documentation

- + +

◆ ReportDescParser2()

+
@@ -348,12 +328,14 @@ Additional Inherited Members
-

Definition at line 165 of file hidescriptorparser.h.

+

Definition at line 165 of file hidescriptorparser.h.

Member Function Documentation

- + +

◆ ParseItem()

+
@@ -387,7 +369,7 @@ Additional Inherited Members

Reimplemented from ReportDescParserBase.

-

Definition at line 1429 of file hidescriptorparser.cpp.

+

Definition at line 1429 of file hidescriptorparser.cpp.

@@ -400,7 +382,7 @@ Additional Inherited Members diff --git a/class_report_desc_parser2__coll__graph.md5 b/class_report_desc_parser2__coll__graph.md5 index af9db977..a7dc2736 100644 --- a/class_report_desc_parser2__coll__graph.md5 +++ b/class_report_desc_parser2__coll__graph.md5 @@ -1 +1 @@ -27a80771267ed2f61d1a7277c51beb79 \ No newline at end of file +337962214a97d1da9120f71057904a21 \ No newline at end of file diff --git a/class_report_desc_parser2__coll__graph.png b/class_report_desc_parser2__coll__graph.png index 285ac140..db10a039 100644 Binary files a/class_report_desc_parser2__coll__graph.png and b/class_report_desc_parser2__coll__graph.png differ diff --git a/class_report_desc_parser2__inherit__graph.md5 b/class_report_desc_parser2__inherit__graph.md5 index 5a0ef029..819fec93 100644 --- a/class_report_desc_parser2__inherit__graph.md5 +++ b/class_report_desc_parser2__inherit__graph.md5 @@ -1 +1 @@ -28f3942ed411cf191d1a779af42e8bd4 \ No newline at end of file +820b0c432ce98035ef31739b6890111a \ No newline at end of file diff --git a/class_report_desc_parser2__inherit__graph.png b/class_report_desc_parser2__inherit__graph.png index 7ae4ec29..5847bda9 100644 Binary files a/class_report_desc_parser2__inherit__graph.png and b/class_report_desc_parser2__inherit__graph.png differ diff --git a/class_report_desc_parser__coll__graph.md5 b/class_report_desc_parser__coll__graph.md5 index 60356562..ece91e52 100644 --- a/class_report_desc_parser__coll__graph.md5 +++ b/class_report_desc_parser__coll__graph.md5 @@ -1 +1 @@ -4eeff98c7d713241096fda58cb34b342 \ No newline at end of file +bba4c01c09194908b45e06e17ad8b5da \ No newline at end of file diff --git a/class_report_desc_parser__coll__graph.png b/class_report_desc_parser__coll__graph.png index 7d4dca49..fc16daec 100644 Binary files a/class_report_desc_parser__coll__graph.png and b/class_report_desc_parser__coll__graph.png differ diff --git a/class_report_desc_parser__inherit__graph.md5 b/class_report_desc_parser__inherit__graph.md5 index f89c23d6..110a89dc 100644 --- a/class_report_desc_parser__inherit__graph.md5 +++ b/class_report_desc_parser__inherit__graph.md5 @@ -1 +1 @@ -d91197785a3b88c599def77d68a6ee2e \ No newline at end of file +2251768d2a22ec22c4c321cf08cb7759 \ No newline at end of file diff --git a/class_report_desc_parser__inherit__graph.png b/class_report_desc_parser__inherit__graph.png index c6d35d10..fd95ed86 100644 Binary files a/class_report_desc_parser__inherit__graph.png and b/class_report_desc_parser__inherit__graph.png differ diff --git a/class_report_desc_parser_base-members.html b/class_report_desc_parser_base-members.html index 65eb99e4..b0af4c12 100644 --- a/class_report_desc_parser_base-members.html +++ b/class_report_desc_parser_base-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 22 of file hidescriptorparser.h.

+

Definition at line 22 of file hidescriptorparser.h.

Member Typedef Documentation

- + +

◆ UsagePageFunc

+
@@ -337,12 +317,14 @@ Static Protected Attributes
-

Definition at line 24 of file hidescriptorparser.h.

+

Definition at line 24 of file hidescriptorparser.h.

Member Enumeration Documentation

- + +

◆ anonymous enum

+
@@ -352,20 +334,19 @@ Static Protected Attributes
- - - + + +
Enumerator
enErrorSuccess  -
enErrorIncomplete  -
enErrorBufferTooSmall  -
Enumerator
enErrorSuccess 
enErrorIncomplete 
enErrorBufferTooSmall 
-

Definition at line 138 of file hidescriptorparser.h.

+

Definition at line 138 of file hidescriptorparser.h.

Constructor & Destructor Documentation

- + +

◆ ReportDescParserBase()

+
@@ -386,12 +367,14 @@ Static Protected Attributes
-

Definition at line 124 of file hidescriptorparser.h.

+

Definition at line 124 of file hidescriptorparser.h.

Member Function Documentation

- + +

◆ PrintGenericDesktopPageUsage()

+
@@ -413,11 +396,13 @@ Static Protected Attributes
-

Definition at line 1293 of file hidescriptorparser.cpp.

+

Definition at line 1293 of file hidescriptorparser.cpp.

- + +

◆ PrintSimulationControlsPageUsage()

+
@@ -439,11 +424,13 @@ Static Protected Attributes
-

Definition at line 1305 of file hidescriptorparser.cpp.

+

Definition at line 1305 of file hidescriptorparser.cpp.

- + +

◆ PrintVRControlsPageUsage()

+
@@ -465,11 +452,13 @@ Static Protected Attributes
-

Definition at line 1315 of file hidescriptorparser.cpp.

+

Definition at line 1315 of file hidescriptorparser.cpp.

- + +

◆ PrintSportsControlsPageUsage()

+
@@ -491,11 +480,13 @@ Static Protected Attributes
-

Definition at line 1324 of file hidescriptorparser.cpp.

+

Definition at line 1324 of file hidescriptorparser.cpp.

- + +

◆ PrintGameControlsPageUsage()

+
@@ -517,11 +508,13 @@ Static Protected Attributes
-

Definition at line 1334 of file hidescriptorparser.cpp.

+

Definition at line 1334 of file hidescriptorparser.cpp.

- + +

◆ PrintGenericDeviceControlsPageUsage()

+
@@ -543,11 +536,13 @@ Static Protected Attributes
-

Definition at line 1343 of file hidescriptorparser.cpp.

+

Definition at line 1343 of file hidescriptorparser.cpp.

- + +

◆ PrintLEDPageUsage()

+
@@ -569,11 +564,13 @@ Static Protected Attributes
-

Definition at line 1351 of file hidescriptorparser.cpp.

+

Definition at line 1351 of file hidescriptorparser.cpp.

- + +

◆ PrintButtonPageUsage()

+
@@ -595,11 +592,13 @@ Static Protected Attributes
-

Definition at line 1276 of file hidescriptorparser.cpp.

+

Definition at line 1276 of file hidescriptorparser.cpp.

- + +

◆ PrintOrdinalPageUsage()

+
@@ -621,11 +620,13 @@ Static Protected Attributes
-

Definition at line 1284 of file hidescriptorparser.cpp.

+

Definition at line 1284 of file hidescriptorparser.cpp.

- + +

◆ PrintTelephonyPageUsage()

+
@@ -647,11 +648,13 @@ Static Protected Attributes
-

Definition at line 1359 of file hidescriptorparser.cpp.

+

Definition at line 1359 of file hidescriptorparser.cpp.

- + +

◆ PrintConsumerPageUsage()

+
@@ -673,11 +676,13 @@ Static Protected Attributes
-

Definition at line 1372 of file hidescriptorparser.cpp.

+

Definition at line 1372 of file hidescriptorparser.cpp.

- + +

◆ PrintDigitizerPageUsage()

+
@@ -699,11 +704,13 @@ Static Protected Attributes
-

Definition at line 1394 of file hidescriptorparser.cpp.

+

Definition at line 1394 of file hidescriptorparser.cpp.

- + +

◆ PrintAlphanumDisplayPageUsage()

+
@@ -725,11 +732,13 @@ Static Protected Attributes
-

Definition at line 1404 of file hidescriptorparser.cpp.

+

Definition at line 1404 of file hidescriptorparser.cpp.

- + +

◆ PrintMedicalInstrumentPageUsage()

+
@@ -751,11 +760,13 @@ Static Protected Attributes
-

Definition at line 1414 of file hidescriptorparser.cpp.

+

Definition at line 1414 of file hidescriptorparser.cpp.

- + +

◆ PrintValue()

+
@@ -787,11 +798,13 @@ Static Protected Attributes
-

Definition at line 1013 of file hidescriptorparser.cpp.

+

Definition at line 1013 of file hidescriptorparser.cpp.

- + +

◆ PrintByteValue()

+
@@ -813,11 +826,13 @@ Static Protected Attributes
-

Definition at line 1020 of file hidescriptorparser.cpp.

+

Definition at line 1020 of file hidescriptorparser.cpp.

- + +

◆ PrintItemTitle()

+
@@ -839,11 +854,13 @@ Static Protected Attributes
-

Definition at line 1026 of file hidescriptorparser.cpp.

+

Definition at line 1026 of file hidescriptorparser.cpp.

- + +

◆ ParseItem()

+
@@ -877,11 +894,13 @@ Static Protected Attributes

Reimplemented in ReportDescParser2.

-

Definition at line 1091 of file hidescriptorparser.cpp.

+

Definition at line 1091 of file hidescriptorparser.cpp.

- + +

◆ PrintUsagePage()

+
@@ -903,11 +922,13 @@ Static Protected Attributes
-

Definition at line 1251 of file hidescriptorparser.cpp.

+

Definition at line 1251 of file hidescriptorparser.cpp.

- + +

◆ SetUsagePage()

+
@@ -929,11 +950,13 @@ Static Protected Attributes
-

Definition at line 1233 of file hidescriptorparser.cpp.

+

Definition at line 1233 of file hidescriptorparser.cpp.

- + +

◆ Parse()

+
@@ -973,12 +996,14 @@ Static Protected Attributes

Implements USBReadParser.

-

Definition at line 993 of file hidescriptorparser.cpp.

+

Definition at line 993 of file hidescriptorparser.cpp.

Member Data Documentation

- + +

◆ usagePageTitles0

+
@@ -996,11 +1021,13 @@ Static Protected Attributes
- + +

◆ usagePageTitles1

+
@@ -1018,11 +1045,13 @@ Static Protected Attributes
- + +

◆ genDesktopTitles0

+
@@ -1040,11 +1069,13 @@ Static Protected Attributes
- + +

◆ genDesktopTitles1

+ - + +

◆ genDesktopTitles2

+ - + +

◆ genDesktopTitles3

+ - + +

◆ genDesktopTitles4

+ - + +

◆ simuTitles0

+ - + +

◆ simuTitles1

+
@@ -1172,11 +1213,13 @@ Static Protected Attributes
- + +

◆ simuTitles2

+
@@ -1194,11 +1237,13 @@ Static Protected Attributes
-

Definition at line 55 of file hidescriptorparser.h.

+

Definition at line 55 of file hidescriptorparser.h.

- + +

◆ vrTitles0

+
@@ -1216,11 +1261,13 @@ Static Protected Attributes
- + +

◆ vrTitles1

+
@@ -1238,11 +1285,13 @@ Static Protected Attributes
Initial value: -

Definition at line 57 of file hidescriptorparser.h.

+

Definition at line 57 of file hidescriptorparser.h.

- + +

◆ sportsCtrlTitles0

+
@@ -1260,11 +1309,13 @@ Static Protected Attributes
Initial value: -

Definition at line 58 of file hidescriptorparser.h.

+

Definition at line 58 of file hidescriptorparser.h.

- + +

◆ sportsCtrlTitles1

+
@@ -1282,11 +1333,13 @@ Static Protected Attributes
- + +

◆ sportsCtrlTitles2

+ - + +

◆ gameTitles0

+
@@ -1326,11 +1381,13 @@ Static Protected Attributes
Initial value: -

Definition at line 61 of file hidescriptorparser.h.

+

Definition at line 61 of file hidescriptorparser.h.

- + +

◆ gameTitles1

+ - + +

◆ genDevCtrlTitles

+ - + +

◆ ledTitles

+
@@ -1392,11 +1453,13 @@ Static Protected Attributes
-

Definition at line 64 of file hidescriptorparser.h.

+

Definition at line 64 of file hidescriptorparser.h.

- + +

◆ telTitles0

+
@@ -1414,11 +1477,13 @@ Static Protected Attributes
- + +

◆ telTitles1

+ - + +

◆ telTitles2

+
@@ -1458,11 +1525,13 @@ Static Protected Attributes
Initial value: -

Definition at line 67 of file hidescriptorparser.h.

+

Definition at line 67 of file hidescriptorparser.h.

- + +

◆ telTitles3

+
@@ -1480,11 +1549,13 @@ Static Protected Attributes
- + +

◆ telTitles4

+ - + +

◆ telTitles5

+ - + +

◆ consTitles0

+
@@ -1546,11 +1621,13 @@ Static Protected Attributes
- + +

◆ consTitles1

+
@@ -1568,11 +1645,13 @@ Static Protected Attributes
Initial value: -

Definition at line 72 of file hidescriptorparser.h.

+

Definition at line 72 of file hidescriptorparser.h.

- + +

◆ consTitles2

+
@@ -1590,11 +1669,13 @@ Static Protected Attributes
- + +

◆ consTitles3

+
@@ -1612,11 +1693,13 @@ Static Protected Attributes
- + +

◆ consTitles4

+
@@ -1634,11 +1717,13 @@ Static Protected Attributes
- + +

◆ consTitles5

+
@@ -1656,11 +1741,13 @@ Static Protected Attributes
-

Definition at line 76 of file hidescriptorparser.h.

+

Definition at line 76 of file hidescriptorparser.h.

- + +

◆ consTitles6

+
@@ -1678,11 +1765,13 @@ Static Protected Attributes
-

Definition at line 77 of file hidescriptorparser.h.

+

Definition at line 77 of file hidescriptorparser.h.

- + +

◆ consTitles7

+
@@ -1700,11 +1789,13 @@ Static Protected Attributes
- + +

◆ consTitles8

+
@@ -1722,11 +1813,13 @@ Static Protected Attributes
- + +

◆ consTitles9

+ - + +

◆ consTitlesA

+
@@ -1766,11 +1861,13 @@ Static Protected Attributes
- + +

◆ consTitlesB

+ - + +

◆ consTitlesC

+
@@ -1810,11 +1909,13 @@ Static Protected Attributes
- + +

◆ consTitlesD

+
@@ -1832,11 +1933,13 @@ Static Protected Attributes
-

Definition at line 84 of file hidescriptorparser.h.

+

Definition at line 84 of file hidescriptorparser.h.

- + +

◆ consTitlesE

+
@@ -1854,11 +1957,13 @@ Static Protected Attributes
-

Definition at line 85 of file hidescriptorparser.h.

+

Definition at line 85 of file hidescriptorparser.h.

- + +

◆ digitTitles0

+ - + +

◆ digitTitles1

+
@@ -1898,11 +2005,13 @@ Static Protected Attributes
Initial value: -

Definition at line 87 of file hidescriptorparser.h.

+

Definition at line 87 of file hidescriptorparser.h.

- + +

◆ digitTitles2

+ - + +

◆ aplphanumTitles0

+
@@ -1942,11 +2053,13 @@ Static Protected Attributes
Initial value: -

Definition at line 89 of file hidescriptorparser.h.

+

Definition at line 89 of file hidescriptorparser.h.

- + +

◆ aplphanumTitles1

+
@@ -1964,11 +2077,13 @@ Static Protected Attributes
-

Definition at line 90 of file hidescriptorparser.h.

+

Definition at line 90 of file hidescriptorparser.h.

- + +

◆ aplphanumTitles2

+ - + +

◆ medInstrTitles0

+
@@ -2008,11 +2125,13 @@ Static Protected Attributes
- + +

◆ medInstrTitles1

+
@@ -2030,11 +2149,13 @@ Static Protected Attributes
Initial value: -

Definition at line 93 of file hidescriptorparser.h.

+

Definition at line 93 of file hidescriptorparser.h.

- + +

◆ medInstrTitles2

+
@@ -2052,11 +2173,13 @@ Static Protected Attributes
Initial value: -

Definition at line 94 of file hidescriptorparser.h.

+

Definition at line 94 of file hidescriptorparser.h.

- + +

◆ medInstrTitles3

+ - + +

◆ medInstrTitles4

+
@@ -2096,11 +2221,13 @@ Static Protected Attributes
Initial value: -

Definition at line 96 of file hidescriptorparser.h.

+

Definition at line 96 of file hidescriptorparser.h.

- + +

◆ usagePageFunctions

+ - + +

◆ theBuffer

+
@@ -2140,11 +2269,13 @@ Static Protected Attributes
-

Definition at line 101 of file hidescriptorparser.h.

+

Definition at line 101 of file hidescriptorparser.h.

- + +

◆ valParser

+
@@ -2162,11 +2293,13 @@ Static Protected Attributes
-

Definition at line 102 of file hidescriptorparser.h.

+

Definition at line 102 of file hidescriptorparser.h.

- + +

◆ theSkipper

+
@@ -2184,11 +2317,13 @@ Static Protected Attributes
-

Definition at line 103 of file hidescriptorparser.h.

+

Definition at line 103 of file hidescriptorparser.h.

- + +

◆ varBuffer

+
@@ -2206,11 +2341,13 @@ Static Protected Attributes
-

Definition at line 104 of file hidescriptorparser.h.

+

Definition at line 104 of file hidescriptorparser.h.

- + +

◆ itemParseState

+
@@ -2228,11 +2365,13 @@ Static Protected Attributes
-

Definition at line 106 of file hidescriptorparser.h.

+

Definition at line 106 of file hidescriptorparser.h.

- + +

◆ itemSize

+
@@ -2250,11 +2389,13 @@ Static Protected Attributes
-

Definition at line 107 of file hidescriptorparser.h.

+

Definition at line 107 of file hidescriptorparser.h.

- + +

◆ itemPrefix

+
@@ -2272,11 +2413,13 @@ Static Protected Attributes
-

Definition at line 108 of file hidescriptorparser.h.

+

Definition at line 108 of file hidescriptorparser.h.

- + +

◆ rptSize

+
@@ -2294,11 +2437,13 @@ Static Protected Attributes
-

Definition at line 109 of file hidescriptorparser.h.

+

Definition at line 109 of file hidescriptorparser.h.

- + +

◆ rptCount

+
@@ -2316,11 +2461,13 @@ Static Protected Attributes
-

Definition at line 110 of file hidescriptorparser.h.

+

Definition at line 110 of file hidescriptorparser.h.

- + +

◆ totalSize

+
@@ -2338,11 +2485,13 @@ Static Protected Attributes
-

Definition at line 112 of file hidescriptorparser.h.

+

Definition at line 112 of file hidescriptorparser.h.

- + +

◆ pfUsage

+
@@ -2360,7 +2509,7 @@ Static Protected Attributes
-

Definition at line 117 of file hidescriptorparser.h.

+

Definition at line 117 of file hidescriptorparser.h.

@@ -2373,7 +2522,7 @@ Static Protected Attributes diff --git a/class_report_desc_parser_base__coll__graph.md5 b/class_report_desc_parser_base__coll__graph.md5 index 668df278..bbe75e65 100644 --- a/class_report_desc_parser_base__coll__graph.md5 +++ b/class_report_desc_parser_base__coll__graph.md5 @@ -1 +1 @@ -b9d3bd37562883d7bba8b8814d6dc468 \ No newline at end of file +f73fbd568e2e89c15da6964b370648d9 \ No newline at end of file diff --git a/class_report_desc_parser_base__coll__graph.png b/class_report_desc_parser_base__coll__graph.png index ee696701..f4e3a1df 100644 Binary files a/class_report_desc_parser_base__coll__graph.png and b/class_report_desc_parser_base__coll__graph.png differ diff --git a/class_report_desc_parser_base__inherit__graph.md5 b/class_report_desc_parser_base__inherit__graph.md5 index 92049196..d89bf997 100644 --- a/class_report_desc_parser_base__inherit__graph.md5 +++ b/class_report_desc_parser_base__inherit__graph.md5 @@ -1 +1 @@ -e17b83123517010d14d04955e7bfd25a \ No newline at end of file +bf2a9d7ab53e22e743a9e609df1e484c \ No newline at end of file diff --git a/class_report_desc_parser_base__inherit__graph.png b/class_report_desc_parser_base__inherit__graph.png index 3992f055..d45b37f7 100644 Binary files a/class_report_desc_parser_base__inherit__graph.png and b/class_report_desc_parser_base__inherit__graph.png differ diff --git a/class_s_p_p-members.html b/class_s_p_p-members.html index e4f89282..b70048a7 100644 --- a/class_s_p_p-members.html +++ b/class_s_p_p-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

This BluetoothService class implements the Serial Port Protocol (SPP). It inherits the Arduino Stream class. This allows it to use all the standard Arduino print and stream functions.

-

Definition at line 61 of file SPP.h.

+

Definition at line 61 of file SPP.h.

Constructor & Destructor Documentation

- + +

◆ SPP()

+
@@ -224,12 +204,14 @@ Additional Inherited Members -

Definition at line 45 of file SPP.cpp.

+

Definition at line 45 of file SPP.cpp.

Member Function Documentation

- + +

◆ disconnect()

+
@@ -253,11 +235,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 72 of file SPP.cpp.

+

Definition at line 72 of file SPP.cpp.

- + +

◆ operator bool()

+
@@ -279,11 +263,13 @@ Additional Inherited Members

Used to provide Boolean tests for the class.

Returns
Return true if SPP communication is connected.
-

Definition at line 80 of file SPP.h.

+

Definition at line 80 of file SPP.h.

- + +

◆ available()

+
@@ -298,11 +284,13 @@ Additional Inherited Members

Get number of bytes waiting to be read.

Returns
Return the number of bytes ready to be read.
-

Definition at line 797 of file SPP.cpp.

+

Definition at line 797 of file SPP.cpp.

- + +

◆ flush()

+
@@ -325,11 +313,13 @@ Additional Inherited Members

Send out all bytes in the buffer.

-

Definition at line 94 of file SPP.h.

+

Definition at line 94 of file SPP.h.

- + +

◆ peek()

+
@@ -344,11 +334,13 @@ Additional Inherited Members

Used to read the next value in the buffer without advancing to the next one.

Returns
Return the byte. Will return -1 if no bytes are available.
-

Definition at line 805 of file SPP.cpp.

+

Definition at line 805 of file SPP.cpp.

- + +

◆ read()

+
@@ -363,11 +355,13 @@ Additional Inherited Members

Used to read the buffer.

Returns
Return the byte. Will return -1 if no bytes are available.
-

Definition at line 811 of file SPP.cpp.

+

Definition at line 811 of file SPP.cpp.

- + +

◆ write() [1/2]

+
@@ -388,11 +382,13 @@ Additional Inherited Members
Returns
Return the number of bytes written.
-

Definition at line 742 of file SPP.cpp.

+

Definition at line 742 of file SPP.cpp.

- + +

◆ write() [2/2]

+
@@ -424,11 +420,13 @@ Additional Inherited Members
Returns
Return the number of bytes written.
-

Definition at line 754 of file SPP.cpp.

+

Definition at line 754 of file SPP.cpp.

- + +

◆ discard()

+
@@ -443,11 +441,13 @@ Additional Inherited Members

Discard all the bytes in the buffer.

-

Definition at line 801 of file SPP.cpp.

+

Definition at line 801 of file SPP.cpp.

- + +

◆ send()

+
@@ -462,11 +462,13 @@ Additional Inherited Members

This will send all the bytes in the buffer. This is called whenever Usb.Task() is called, but can also be called via this function.

-

Definition at line 769 of file SPP.cpp.

+

Definition at line 769 of file SPP.cpp.

- + +

◆ ACLData()

+
@@ -496,11 +498,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 84 of file SPP.cpp.

+

Definition at line 84 of file SPP.cpp.

- + +

◆ Run()

+
@@ -524,11 +528,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 423 of file SPP.cpp.

+

Definition at line 423 of file SPP.cpp.

- + +

◆ Reset()

+
@@ -552,11 +558,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 60 of file SPP.cpp.

+

Definition at line 60 of file SPP.cpp.

- + +

◆ onInit()

+
@@ -580,12 +588,14 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 433 of file SPP.cpp.

+

Definition at line 433 of file SPP.cpp.

Member Data Documentation

- + +

◆ connected

+
@@ -596,7 +606,7 @@ Additional Inherited Members

Variable used to indicate if the connection is established.

-

Definition at line 84 of file SPP.h.

+

Definition at line 84 of file SPP.h.

@@ -609,7 +619,7 @@ Additional Inherited Members diff --git a/class_s_p_p__coll__graph.md5 b/class_s_p_p__coll__graph.md5 index 7a218c80..787a2f39 100644 --- a/class_s_p_p__coll__graph.md5 +++ b/class_s_p_p__coll__graph.md5 @@ -1 +1 @@ -cad9aa3d2819cbf714312820a38ed5ae \ No newline at end of file +1e3a16374007af2c1704b8030bf6cd2e \ No newline at end of file diff --git a/class_s_p_p__coll__graph.png b/class_s_p_p__coll__graph.png index c74e8061..073b4061 100644 Binary files a/class_s_p_p__coll__graph.png and b/class_s_p_p__coll__graph.png differ diff --git a/class_s_p_p__inherit__graph.md5 b/class_s_p_p__inherit__graph.md5 index 57b548e0..4994254f 100644 --- a/class_s_p_p__inherit__graph.md5 +++ b/class_s_p_p__inherit__graph.md5 @@ -1 +1 @@ -c60255fca3d4c819dfb05175121e3419 \ No newline at end of file +7800950b72dc105e9aff9c4a92cf0a7f \ No newline at end of file diff --git a/class_s_p_p__inherit__graph.png b/class_s_p_p__inherit__graph.png index 5d8ed5ed..ed3a8da1 100644 Binary files a/class_s_p_p__inherit__graph.png and b/class_s_p_p__inherit__graph.png differ diff --git a/class_s_pi-members.html b/class_s_pi-members.html index f5815981..10801325 100644 --- a/class_s_pi-members.html +++ b/class_s_pi-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +
class SPi< SPI_CLK, SPI_MOSI, SPI_MISO, SPI_SS > -

Definition at line 31 of file usbhost.h.

+

Definition at line 38 of file usbhost.h.

Member Function Documentation

- + +

◆ init()

+
@@ -129,7 +109,7 @@ template<typename SPI_CLK , typename SPI_MOSI , typename SPI_MISO , typename
-

Definition at line 54 of file usbhost.h.

+

Definition at line 61 of file usbhost.h.

@@ -141,7 +121,7 @@ template<typename SPI_CLK , typename SPI_MOSI , typename SPI_MISO , typename diff --git a/class_sink_parser-members.html b/class_sink_parser-members.html index c7f21334..252bbdd8 100644 --- a/class_sink_parser-members.html +++ b/class_sink_parser-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +
Inheritance graph
+ +
[legend]
Collaboration diagram for SinkParser< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >:
Collaboration graph
+ +
[legend]
class SinkParser< BASE_CLASS, LEN_TYPE, OFFSET_TYPE > -

Definition at line 27 of file sink_parser.h.

+

Definition at line 35 of file sink_parser.h.

Constructor & Destructor Documentation

- + +

◆ SinkParser()

+
@@ -143,12 +127,14 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>

@@ -118,9 +100,11 @@ Public Member Functions

-

Definition at line 30 of file sink_parser.h.

+

Definition at line 38 of file sink_parser.h.

Member Function Documentation

- + +

◆ Initialize()

+
@@ -171,11 +157,13 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
-

Definition at line 33 of file sink_parser.h.

+

Definition at line 41 of file sink_parser.h.

- + +

◆ Parse()

+
@@ -215,7 +203,7 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
-

Definition at line 36 of file sink_parser.h.

+

Definition at line 44 of file sink_parser.h.

@@ -227,7 +215,7 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
diff --git a/class_sink_parser__coll__graph.md5 b/class_sink_parser__coll__graph.md5 index 1a5a95f4..d1545881 100644 --- a/class_sink_parser__coll__graph.md5 +++ b/class_sink_parser__coll__graph.md5 @@ -1 +1 @@ -d02f7fd8d26a0375ade46df3226bf199 \ No newline at end of file +d020ff3f97932ad0814add922e6e3f64 \ No newline at end of file diff --git a/class_sink_parser__coll__graph.png b/class_sink_parser__coll__graph.png index 15c7ad13..ca29fb69 100644 Binary files a/class_sink_parser__coll__graph.png and b/class_sink_parser__coll__graph.png differ diff --git a/class_sink_parser__inherit__graph.md5 b/class_sink_parser__inherit__graph.md5 index 1a5a95f4..10b46018 100644 --- a/class_sink_parser__inherit__graph.md5 +++ b/class_sink_parser__inherit__graph.md5 @@ -1 +1 @@ -d02f7fd8d26a0375ade46df3226bf199 \ No newline at end of file +2cc3cf9eea33b15a4670b329f94ff207 \ No newline at end of file diff --git a/class_sink_parser__inherit__graph.png b/class_sink_parser__inherit__graph.png index 15c7ad13..ca29fb69 100644 Binary files a/class_sink_parser__inherit__graph.png and b/class_sink_parser__inherit__graph.png differ diff --git a/class_u_s_b-members.html b/class_u_s_b-members.html index 2731b9fd..8cf00f93 100644 --- a/class_u_s_b-members.html +++ b/class_u_s_b-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 197 of file UsbCore.h.

+

Definition at line 208 of file UsbCore.h.

Constructor & Destructor Documentation

- + +

◆ USB()

+
@@ -217,12 +197,14 @@ Public Member Functions
-

Definition at line 25 of file Usb.cpp.

+

Definition at line 32 of file Usb.cpp.

Member Function Documentation

- + +

◆ SetHubPreMask()

+
@@ -243,11 +225,13 @@ Public Member Functions
-

Definition at line 205 of file UsbCore.h.

+

Definition at line 216 of file UsbCore.h.

- + +

◆ ResetHubPreMask()

+
@@ -268,11 +252,13 @@ Public Member Functions
-

Definition at line 209 of file UsbCore.h.

+

Definition at line 220 of file UsbCore.h.

- + +

◆ GetAddressPool()

+
@@ -293,11 +279,13 @@ Public Member Functions
-

Definition at line 213 of file UsbCore.h.

+

Definition at line 224 of file UsbCore.h.

- + +

◆ RegisterDeviceClass()

+
@@ -319,11 +307,13 @@ Public Member Functions
-

Definition at line 217 of file UsbCore.h.

+

Definition at line 228 of file UsbCore.h.

- + +

◆ ForEachUsbDevice()

+
@@ -345,11 +335,13 @@ Public Member Functions
-

Definition at line 227 of file UsbCore.h.

+

Definition at line 238 of file UsbCore.h.

- + +

◆ getUsbTaskState()

+
@@ -363,11 +355,13 @@ Public Member Functions
-

Definition at line 36 of file Usb.cpp.

+

Definition at line 43 of file Usb.cpp.

- + +

◆ setUsbTaskState()

+
@@ -381,11 +375,13 @@ Public Member Functions
-

Definition at line 40 of file Usb.cpp.

+

Definition at line 47 of file Usb.cpp.

- + +

◆ getEpInfoEntry()

+
@@ -409,11 +405,13 @@ Public Member Functions
-

Definition at line 44 of file Usb.cpp.

+

Definition at line 51 of file Usb.cpp.

- + +

◆ setEpInfoEntry()

+
@@ -443,11 +441,13 @@ Public Member Functions
-

Definition at line 64 of file Usb.cpp.

+

Definition at line 71 of file Usb.cpp.

- + +

◆ getDevDescr()

+
@@ -485,11 +485,13 @@ Public Member Functions

defined(USB_METHODS_INLINE)

-

Definition at line 766 of file Usb.cpp.

+

Definition at line 779 of file Usb.cpp.

- + +

◆ getConfDescr() [1/2]

+
@@ -531,11 +533,13 @@ Public Member Functions
-

Definition at line 771 of file Usb.cpp.

+

Definition at line 784 of file Usb.cpp.

- + +

◆ getConfDescr() [2/2]

+
@@ -571,11 +575,13 @@ Public Member Functions
-

Definition at line 777 of file Usb.cpp.

+

Definition at line 790 of file Usb.cpp.

- + +

◆ getStrDescr()

+
@@ -623,11 +629,13 @@ Public Member Functions
-

Definition at line 796 of file Usb.cpp.

+

Definition at line 809 of file Usb.cpp.

- + +

◆ setAddr()

+
@@ -657,11 +665,13 @@ Public Member Functions
-

Definition at line 801 of file Usb.cpp.

+

Definition at line 814 of file Usb.cpp.

- + +

◆ setConf()

+
@@ -691,11 +701,13 @@ Public Member Functions
-

Definition at line 810 of file Usb.cpp.

+

Definition at line 823 of file Usb.cpp.

- + +

◆ ctrlData()

+
@@ -739,7 +751,9 @@ Public Member Functions - + +

◆ ctrlStatus()

+
@@ -771,7 +785,9 @@ Public Member Functions - + +

◆ inTransfer()

+
@@ -813,11 +829,13 @@ Public Member Functions
-

Definition at line 206 of file Usb.cpp.

+

Definition at line 213 of file Usb.cpp.

- + +

◆ outTransfer()

+
@@ -853,11 +871,13 @@ Public Member Functions
-

Definition at line 293 of file Usb.cpp.

+

Definition at line 300 of file Usb.cpp.

- + +

◆ dispatchPkt()

+
@@ -887,11 +907,13 @@ Public Member Functions
-

Definition at line 377 of file Usb.cpp.

+

Definition at line 384 of file Usb.cpp.

- + +

◆ Task()

+
@@ -905,11 +927,13 @@ Public Member Functions
-

Definition at line 425 of file Usb.cpp.

+

Definition at line 438 of file Usb.cpp.

- + +

◆ DefaultAddressing()

+
@@ -939,11 +963,13 @@ Public Member Functions
-

Definition at line 531 of file Usb.cpp.

+

Definition at line 544 of file Usb.cpp.

- + +

◆ Configuring()

+
@@ -973,11 +999,13 @@ Public Member Functions
-

Definition at line 653 of file Usb.cpp.

+

Definition at line 666 of file Usb.cpp.

- + +

◆ ReleaseDevice()

+
@@ -991,11 +1019,13 @@ Public Member Functions
-

Definition at line 751 of file Usb.cpp.

+

Definition at line 764 of file Usb.cpp.

- + +

◆ ctrlReq()

+
@@ -1073,7 +1103,7 @@ Public Member Functions
-

Definition at line 126 of file Usb.cpp.

+

Definition at line 133 of file Usb.cpp.

@@ -1086,7 +1116,7 @@ Public Member Functions diff --git a/class_u_s_b__coll__graph.md5 b/class_u_s_b__coll__graph.md5 index 2b3a8617..ca823f4a 100644 --- a/class_u_s_b__coll__graph.md5 +++ b/class_u_s_b__coll__graph.md5 @@ -1 +1 @@ -48f1f6d22e8ca875c8c73c2869a63fbd \ No newline at end of file +f6ccf1fad8d6ecd2cff38fc98711f46e \ No newline at end of file diff --git a/class_u_s_b__coll__graph.png b/class_u_s_b__coll__graph.png index 522ab8dd..020093c9 100644 Binary files a/class_u_s_b__coll__graph.png and b/class_u_s_b__coll__graph.png differ diff --git a/class_u_s_b__inherit__graph.md5 b/class_u_s_b__inherit__graph.md5 index 2b3a8617..9e938cee 100644 --- a/class_u_s_b__inherit__graph.md5 +++ b/class_u_s_b__inherit__graph.md5 @@ -1 +1 @@ -48f1f6d22e8ca875c8c73c2869a63fbd \ No newline at end of file +23dbf1d6fae001672365342de66fd798 \ No newline at end of file diff --git a/class_u_s_b__inherit__graph.png b/class_u_s_b__inherit__graph.png index 522ab8dd..020093c9 100644 Binary files a/class_u_s_b__inherit__graph.png and b/class_u_s_b__inherit__graph.png differ diff --git a/class_u_s_b_device_config-members.html b/class_u_s_b_device_config-members.html index a7627f28..a48093b7 100644 --- a/class_u_s_b_device_config-members.html +++ b/class_u_s_b_device_config-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 121 of file UsbCore.h.

+

Definition at line 132 of file UsbCore.h.

Member Function Documentation

- + +

◆ Init()

+
@@ -184,13 +164,15 @@ Public Member Functions
- + +

◆ ConfigureDevice()

+
@@ -230,11 +212,13 @@ Public Member Functions

Reimplemented in BulkOnly, BTD, ADK, and XBOXRECV.

-

Definition at line 128 of file UsbCore.h.

+

Definition at line 139 of file UsbCore.h.

- + +

◆ Release()

+
@@ -255,13 +239,15 @@ Public Member Functions
- + +

◆ Poll()

+
@@ -282,13 +268,15 @@ Public Member Functions
-

Reimplemented in BulkOnly, BTD, HIDBoot< BOOT_PROTOCOL >, ACM, USBHub, FTDI, ADK, HIDUniversal, XBOXRECV, HIDComposite, XBOXUSB, PS3USB, XBOXOLD, and XBOXONE.

+

Reimplemented in BulkOnly, BTD, HIDBoot< BOOT_PROTOCOL >, ACM, USBHub, FTDI, ADK, HIDUniversal, XBOXONE, XBOXRECV, HIDComposite, XBOXUSB, PS3USB, and XBOXOLD.

-

Definition at line 136 of file UsbCore.h.

+

Definition at line 147 of file UsbCore.h.

- + +

◆ GetAddress()

+
@@ -309,13 +297,15 @@ Public Member Functions
- + +

◆ ResetHubPort()

+
@@ -339,11 +329,13 @@ Public Member Functions

Reimplemented in USBHub.

-

Definition at line 144 of file UsbCore.h.

+

Definition at line 155 of file UsbCore.h.

- + +

◆ VIDPIDOK()

+
@@ -375,13 +367,15 @@ Public Member Functions
-

Reimplemented in BTD, PSBuzz, FTDI, PS4USB, ADK, XR21B1411, XBOXRECV, XBOXUSB, PS3USB, XBOXOLD, and XBOXONE.

+

Reimplemented in BTD, PSBuzz, FTDI, PS4USB, XBOXONE, ADK, XR21B1411, XBOXRECV, XBOXUSB, PS3USB, and XBOXOLD.

-

Definition at line 148 of file UsbCore.h.

+

Definition at line 159 of file UsbCore.h.

- + +

◆ DEVCLASSOK()

+
@@ -405,11 +399,13 @@ Public Member Functions

Reimplemented in BulkOnly, BTD, HIDBoot< BOOT_PROTOCOL >, and USBHub.

-

Definition at line 152 of file UsbCore.h.

+

Definition at line 163 of file UsbCore.h.

- + +

◆ DEVSUBCLASSOK()

+
@@ -433,7 +429,7 @@ Public Member Functions

Reimplemented in HIDBoot< BOOT_PROTOCOL >.

-

Definition at line 156 of file UsbCore.h.

+

Definition at line 167 of file UsbCore.h.

@@ -445,7 +441,7 @@ Public Member Functions diff --git a/class_u_s_b_device_config__inherit__graph.md5 b/class_u_s_b_device_config__inherit__graph.md5 index 336e2e81..3348af13 100644 --- a/class_u_s_b_device_config__inherit__graph.md5 +++ b/class_u_s_b_device_config__inherit__graph.md5 @@ -1 +1 @@ -fd915a8e1b72b3dd4dec81d6c1c419c0 \ No newline at end of file +994d0cc22c63895732978d50034f369c \ No newline at end of file diff --git a/class_u_s_b_device_config__inherit__graph.png b/class_u_s_b_device_config__inherit__graph.png index c283d4b0..7ef6d2ea 100644 Binary files a/class_u_s_b_device_config__inherit__graph.png and b/class_u_s_b_device_config__inherit__graph.png differ diff --git a/class_u_s_b_h___m_i_d_i-members.html b/class_u_s_b_h___m_i_d_i-members.html index e90abf5c..7dd638f9 100644 --- a/class_u_s_b_h___m_i_d_i-members.html +++ b/class_u_s_b_h___m_i_d_i-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
bConfNumUSBH_MIDIprotected bNumEPUSBH_MIDIprotected bPollEnableUSBH_MIDIprotected - ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual - countSysExDataSize(uint8_t *dataptr)USBH_MIDIprotected - DEVCLASSOK(uint8_t klass)USBDeviceConfiginlinevirtual - DEVSUBCLASSOK(uint8_t subklass)USBDeviceConfiginlinevirtual - epDataInIndexUSBH_MIDIprotectedstatic - epDataInIndexVSPUSBH_MIDIprotectedstatic - epDataOutIndexUSBH_MIDIprotectedstatic - epDataOutIndexVSPUSBH_MIDIprotectedstatic - epInfoUSBH_MIDIprotected + bTransferTypeMaskUSBH_MIDIprotected + ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual + countSysExDataSize(uint8_t *dataptr)USBH_MIDIprotected + DEVCLASSOK(uint8_t klass)USBDeviceConfiginlinevirtual + DEVSUBCLASSOK(uint8_t subklass)USBDeviceConfiginlinevirtual + epDataInIndexUSBH_MIDIprotectedstatic + epDataInIndexVSPUSBH_MIDIprotectedstatic + epDataOutIndexUSBH_MIDIprotectedstatic + epDataOutIndexVSPUSBH_MIDIprotectedstatic + epInfoUSBH_MIDIprotected + extractSysExData(uint8_t *p, uint8_t *buf)USBH_MIDI GetAddress()USBH_MIDIinlinevirtual + idProduct()USBH_MIDIinline + idVendor()USBH_MIDIinline Init(uint8_t parent, uint8_t port, bool lowspeed)USBH_MIDIvirtual isMidiFoundUSBH_MIDIprotected - parseConfigDescr(byte addr, byte conf)USBH_MIDIprotected - pidUSBH_MIDI + lookupMsgSize(uint8_t midiMsg, uint8_t cin=0)USBH_MIDI + operator bool()USBH_MIDIinline + parseConfigDescr(uint8_t addr, uint8_t conf)USBH_MIDIprotected + pidUSBH_MIDIprotected Poll()USBDeviceConfiginlinevirtual pUsbUSBH_MIDIprotected RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)USBH_MIDIinline @@ -116,20 +100,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); readPtrUSBH_MIDIprotected recvBufUSBH_MIDIprotected RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)USBH_MIDI - RecvData(uint8_t *outBuf)USBH_MIDI - Release()USBH_MIDIvirtual - ResetHubPort(uint8_t port)USBDeviceConfiginlinevirtual - SendData(uint8_t *dataptr, byte nCable=0)USBH_MIDI - SendSysEx(uint8_t *dataptr, unsigned int datasize, byte nCable=0)USBH_MIDI - USBH_MIDI(USB *p)USBH_MIDI - vidUSBH_MIDI - VIDPIDOK(uint16_t vid, uint16_t pid)USBDeviceConfiginlinevirtual + RecvData(uint8_t *outBuf, bool isRaw=false)USBH_MIDI + RecvRawData(uint8_t *outBuf)USBH_MIDI + Release()USBH_MIDIvirtual + ResetHubPort(uint8_t port)USBDeviceConfiginlinevirtual + SendData(uint8_t *dataptr, uint8_t nCable=0)USBH_MIDI + SendRawData(uint16_t bytes_send, uint8_t *dataptr)USBH_MIDI + SendSysEx(uint8_t *dataptr, uint16_t datasize, uint8_t nCable=0)USBH_MIDI + setupDeviceSpecific()USBH_MIDIprotected + USBH_MIDI(USB *p)USBH_MIDI + vidUSBH_MIDIprotected + VIDPIDOK(uint16_t vid, uint16_t pid)USBDeviceConfiginlinevirtual
diff --git a/class_u_s_b_h___m_i_d_i.html b/class_u_s_b_h___m_i_d_i.html index 565d10b2..cb7768da 100644 --- a/class_u_s_b_h___m_i_d_i.html +++ b/class_u_s_b_h___m_i_d_i.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: USBH_MIDI Class Reference @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
Public Member Functions  USBH_MIDI (USB *p)   + operator bool () +  +uint16_t idVendor () +  +uint16_t idProduct () +  uint8_t RecvData (uint16_t *bytes_rcvd, uint8_t *dataptr)   -uint8_t RecvData (uint8_t *outBuf) -  -uint8_t SendData (uint8_t *dataptr, byte nCable=0) -  -uint8_t SendSysEx (uint8_t *dataptr, unsigned int datasize, byte nCable=0) -  +uint8_t RecvData (uint8_t *outBuf, bool isRaw=false) +  +uint8_t RecvRawData (uint8_t *outBuf) +  +uint8_t SendData (uint8_t *dataptr, uint8_t nCable=0) +  +uint8_t lookupMsgSize (uint8_t midiMsg, uint8_t cin=0) +  +uint8_t SendSysEx (uint8_t *dataptr, uint16_t datasize, uint8_t nCable=0) +  +uint8_t extractSysExData (uint8_t *p, uint8_t *buf) +  +uint8_t SendRawData (uint16_t bytes_send, uint8_t *dataptr) +  uint8_t RcvData (uint16_t *bytes_rcvd, uint8_t *dataptr)   uint8_t RcvData (uint8_t *outBuf) @@ -153,19 +144,14 @@ Public Member Functions virtual bool DEVSUBCLASSOK (uint8_t subklass)   - - - - - -

-Public Attributes

uint16_t pid
 
uint16_t vid
 
- - - - + + + + + +

Protected Member Functions

void parseConfigDescr (byte addr, byte conf)
 
unsigned int countSysExDataSize (uint8_t *dataptr)
 
uint8_t parseConfigDescr (uint8_t addr, uint8_t conf)
 
uint16_t countSysExDataSize (uint8_t *dataptr)
 
void setupDeviceSpecific ()
 
@@ -181,6 +167,12 @@ Protected Attributes + + + + + + @@ -201,9 +193,11 @@ Static Protected Attributes

Protected Attributes

 
bool isMidiFound
 
uint16_t pid
 
uint16_t vid
 
uint8_t bTransferTypeMask
 
EpInfo epInfo [MIDI_MAX_ENDPOINTS]
 
uint8_t recvBuf [MIDI_EVENT_PACKET_SIZE]

Detailed Description

-

Definition at line 37 of file usbh_midi.h.

+

Definition at line 39 of file usbh_midi.h.

Constructor & Destructor Documentation

- + +

◆ USBH_MIDI()

+
@@ -217,12 +211,14 @@ Static Protected Attributes
-

Definition at line 87 of file usbh_midi.cpp.

+

Definition at line 87 of file usbh_midi.cpp.

Member Function Documentation

- + +

◆ parseConfigDescr()

+
@@ -230,15 +226,15 @@ Static Protected Attributes
- + - + - + @@ -254,11 +250,13 @@ Static Protected Attributes
void USBH_MIDI::parseConfigDescr uint8_t USBH_MIDI::parseConfigDescr (byte uint8_t  addr,
byte uint8_t  conf 
-

Definition at line 240 of file usbh_midi.cpp.

+

Definition at line 253 of file usbh_midi.cpp.

- + +

◆ countSysExDataSize()

+
@@ -266,7 +264,7 @@ Static Protected Attributes diff --git a/class_u_s_b_h___m_i_d_i__coll__graph.md5 b/class_u_s_b_h___m_i_d_i__coll__graph.md5 index 9672b222..0da20209 100644 --- a/class_u_s_b_h___m_i_d_i__coll__graph.md5 +++ b/class_u_s_b_h___m_i_d_i__coll__graph.md5 @@ -1 +1 @@ -25cb7fd7fbb45243f203aae31cb09034 \ No newline at end of file +68a4b7f7cabc03126d08e6372706b04f \ No newline at end of file diff --git a/class_u_s_b_h___m_i_d_i__coll__graph.png b/class_u_s_b_h___m_i_d_i__coll__graph.png index 118c3204..970bc205 100644 Binary files a/class_u_s_b_h___m_i_d_i__coll__graph.png and b/class_u_s_b_h___m_i_d_i__coll__graph.png differ diff --git a/class_u_s_b_h___m_i_d_i__inherit__graph.md5 b/class_u_s_b_h___m_i_d_i__inherit__graph.md5 index 3e6af39f..906c0796 100644 --- a/class_u_s_b_h___m_i_d_i__inherit__graph.md5 +++ b/class_u_s_b_h___m_i_d_i__inherit__graph.md5 @@ -1 +1 @@ -040098623cab6b270fc5a8a159a31c5e \ No newline at end of file +46133410a3d5a24eaed9e2779b770092 \ No newline at end of file diff --git a/class_u_s_b_h___m_i_d_i__inherit__graph.png b/class_u_s_b_h___m_i_d_i__inherit__graph.png index 25a3a590..6b2330c2 100644 Binary files a/class_u_s_b_h___m_i_d_i__inherit__graph.png and b/class_u_s_b_h___m_i_d_i__inherit__graph.png differ diff --git a/class_u_s_b_h_i_d-members.html b/class_u_s_b_h_i_d-members.html index cfecbb96..4beb2751 100644 --- a/class_u_s_b_h_i_d-members.html +++ b/class_u_s_b_h_i_d-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + @@ -280,11 +278,121 @@ Static Protected Attributes
unsigned int USBH_MIDI::countSysExDataSize uint16_t USBH_MIDI::countSysExDataSize ( uint8_t *  dataptr)
-

Definition at line 487 of file usbh_midi.cpp.

+

Definition at line 532 of file usbh_midi.cpp.

- + +

◆ setupDeviceSpecific()

+ +
+
+ + + + + +
+ + + + + + + +
void USBH_MIDI::setupDeviceSpecific ()
+
+protected
+
+ +

Definition at line 345 of file usbh_midi.cpp.

+ +
+
+ +

◆ operator bool()

+ +
+
+ + + + + +
+ + + + + + + +
USBH_MIDI::operator bool ()
+
+inline
+
+ +

Definition at line 71 of file usbh_midi.h.

+ +
+
+ +

◆ idVendor()

+ +
+
+ + + + + +
+ + + + + + + +
uint16_t USBH_MIDI::idVendor ()
+
+inline
+
+ +

Definition at line 72 of file usbh_midi.h.

+ +
+
+ +

◆ idProduct()

+ +
+
+ + + + + +
+ + + + + + + +
uint16_t USBH_MIDI::idProduct ()
+
+inline
+
+ +

Definition at line 73 of file usbh_midi.h.

+ +
+
+ +

◆ RecvData() [1/2]

+
@@ -308,11 +416,13 @@ Static Protected Attributes
-

Definition at line 321 of file usbh_midi.cpp.

+

Definition at line 357 of file usbh_midi.cpp.

- + +

◆ RecvData() [2/2]

+
@@ -320,17 +430,49 @@ Static Protected Attributes + + + + + + + + + + + + + +
uint8_t USBH_MIDI::RecvData ( uint8_t * outBuf,
bool isRaw = false 
)
+
+ +

Definition at line 370 of file usbh_midi.cpp.

+ +
+
+ +

◆ RecvRawData()

+ +
+
+ + + + +
uint8_t USBH_MIDI::RecvRawData (uint8_t *  outBuf)
-

Definition at line 334 of file usbh_midi.cpp.

+

Definition at line 411 of file usbh_midi.cpp.

- + +

◆ SendData()

+
@@ -343,7 +485,7 @@ Static Protected Attributes - + @@ -354,11 +496,43 @@ Static Protected Attributes
byte uint8_t  nCable = 0 
-

Definition at line 373 of file usbh_midi.cpp.

+

Definition at line 417 of file usbh_midi.cpp.

- + +

◆ lookupMsgSize()

+ +
+
+ + + + + + + + + + + + + + + + + + +
uint8_t USBH_MIDI::lookupMsgSize (uint8_t midiMsg,
uint8_t cin = 0 
)
+
+ +

Definition at line 481 of file usbh_midi.cpp.

+ +
+
+ +

◆ SendSysEx()

+
@@ -371,13 +545,13 @@ Static Protected Attributes - + - + @@ -388,11 +562,73 @@ Static Protected Attributes
unsigned int uint16_t  datasize,
byte uint8_t  nCable = 0 
-

Definition at line 511 of file usbh_midi.cpp.

+

Definition at line 556 of file usbh_midi.cpp.

- + +

◆ extractSysExData()

+ +
+
+ + + + + + + + + + + + + + + + + + +
uint8_t USBH_MIDI::extractSysExData (uint8_t * p,
uint8_t * buf 
)
+
+ +

Definition at line 619 of file usbh_midi.cpp.

+ +
+
+ +

◆ SendRawData()

+ +
+
+ + + + + + + + + + + + + + + + + + +
uint8_t USBH_MIDI::SendRawData (uint16_t bytes_send,
uint8_t * dataptr 
)
+
+ +

Definition at line 613 of file usbh_midi.cpp.

+ +
+
+ +

◆ RcvData() [1/2]

+
@@ -424,11 +660,13 @@ Static Protected Attributes
-

Definition at line 76 of file usbh_midi.h.

+

Definition at line 84 of file usbh_midi.h.

- + +

◆ RcvData() [2/2]

+
@@ -450,11 +688,13 @@ Static Protected Attributes
-

Definition at line 77 of file usbh_midi.h.

+

Definition at line 85 of file usbh_midi.h.

- + +

◆ Init()

+
@@ -494,11 +734,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 110 of file usbh_midi.cpp.

+

Definition at line 108 of file usbh_midi.cpp.

- + +

◆ Release()

+
@@ -521,11 +763,13 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 310 of file usbh_midi.cpp.

+

Definition at line 334 of file usbh_midi.cpp.

- + +

◆ GetAddress()

+
@@ -548,12 +792,14 @@ Static Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 82 of file usbh_midi.h.

+

Definition at line 90 of file usbh_midi.h.

Member Data Documentation

- + +

◆ epDataInIndex

+
@@ -571,11 +817,13 @@ Static Protected Attributes
-

Definition at line 43 of file usbh_midi.h.

+

Definition at line 42 of file usbh_midi.h.

- + +

◆ epDataOutIndex

+
@@ -593,11 +841,13 @@ Static Protected Attributes
-

Definition at line 44 of file usbh_midi.h.

+

Definition at line 43 of file usbh_midi.h.

- + +

◆ epDataInIndexVSP

+
@@ -615,11 +865,13 @@ Static Protected Attributes
-

Definition at line 45 of file usbh_midi.h.

+

Definition at line 44 of file usbh_midi.h.

- + +

◆ epDataOutIndexVSP

+
@@ -637,11 +889,13 @@ Static Protected Attributes
-

Definition at line 46 of file usbh_midi.h.

+

Definition at line 45 of file usbh_midi.h.

- + +

◆ pUsb

+
@@ -659,11 +913,13 @@ Static Protected Attributes
-

Definition at line 49 of file usbh_midi.h.

+

Definition at line 48 of file usbh_midi.h.

- + +

◆ bAddress

+
@@ -681,11 +937,13 @@ Static Protected Attributes
-

Definition at line 50 of file usbh_midi.h.

+

Definition at line 49 of file usbh_midi.h.

- + +

◆ bConfNum

+
@@ -703,11 +961,13 @@ Static Protected Attributes
-

Definition at line 51 of file usbh_midi.h.

+

Definition at line 50 of file usbh_midi.h.

- + +

◆ bNumEP

+
@@ -725,11 +985,13 @@ Static Protected Attributes
-

Definition at line 52 of file usbh_midi.h.

+

Definition at line 51 of file usbh_midi.h.

- + +

◆ bPollEnable

+
@@ -747,11 +1009,13 @@ Static Protected Attributes
-

Definition at line 53 of file usbh_midi.h.

+

Definition at line 52 of file usbh_midi.h.

- + +

◆ isMidiFound

+
@@ -769,11 +1033,85 @@ Static Protected Attributes
-

Definition at line 55 of file usbh_midi.h.

+

Definition at line 53 of file usbh_midi.h.

- + +

◆ pid

+ +
+
+ + + + + +
+ + + + +
uint16_t USBH_MIDI::pid
+
+protected
+
+ +

Definition at line 54 of file usbh_midi.h.

+ +
+
+ +

◆ vid

+ +
+
+ + + + + +
+ + + + +
uint16_t USBH_MIDI::vid
+
+protected
+
+ +

Definition at line 54 of file usbh_midi.h.

+ +
+
+ +

◆ bTransferTypeMask

+ +
+
+ + + + + +
+ + + + +
uint8_t USBH_MIDI::bTransferTypeMask
+
+protected
+
+ +

Definition at line 55 of file usbh_midi.h.

+ +
+
+ +

◆ epInfo

+
@@ -791,11 +1129,13 @@ Static Protected Attributes
-

Definition at line 57 of file usbh_midi.h.

+

Definition at line 57 of file usbh_midi.h.

- + +

◆ recvBuf

+
@@ -813,11 +1153,13 @@ Static Protected Attributes
-

Definition at line 59 of file usbh_midi.h.

+

Definition at line 59 of file usbh_midi.h.

- + +

◆ readPtr

+
@@ -835,35 +1177,7 @@ Static Protected Attributes
-

Definition at line 60 of file usbh_midi.h.

- -
-
- -
-
- - - - -
uint16_t USBH_MIDI::pid
-
- -

Definition at line 68 of file usbh_midi.h.

- -
-
- -
-
- - - - -
uint16_t USBH_MIDI::vid
-
- -

Definition at line 68 of file usbh_midi.h.

+

Definition at line 60 of file usbh_midi.h.

@@ -876,7 +1190,7 @@ Static Protected Attributes
- + - - + + + +
- + - - + + + +

Detailed Description

-

Definition at line 143 of file usbhid.h.

+

Definition at line 143 of file usbhid.h.

Constructor & Destructor Documentation

- + +

◆ USBHID()

+
@@ -224,12 +204,14 @@ Static Protected Attributes
-

Definition at line 165 of file usbhid.h.

+

Definition at line 165 of file usbhid.h.

Member Function Documentation

- + +

◆ PrintEndpointDescriptor()

+
@@ -251,11 +233,13 @@ Static Protected Attributes
-

Definition at line 74 of file usbhid.cpp.

+

Definition at line 74 of file usbhid.cpp.

- + +

◆ PrintHidDescriptor()

+
@@ -277,11 +261,13 @@ Static Protected Attributes
-

Definition at line 90 of file usbhid.cpp.

+

Definition at line 90 of file usbhid.cpp.

- + +

◆ GetReportParser()

+
@@ -305,11 +291,13 @@ Static Protected Attributes

Reimplemented in HIDUniversal, and HIDComposite.

-

Definition at line 159 of file usbhid.h.

+

Definition at line 159 of file usbhid.h.

- + +

◆ GetUsb()

+
@@ -330,11 +318,13 @@ Static Protected Attributes
-

Definition at line 168 of file usbhid.h.

+

Definition at line 168 of file usbhid.h.

- + +

◆ SetReportParser()

+
@@ -368,11 +358,13 @@ Static Protected Attributes

Reimplemented in HIDBoot< BOOT_PROTOCOL >, HIDUniversal, and HIDComposite.

-

Definition at line 172 of file usbhid.h.

+

Definition at line 172 of file usbhid.h.

- + +

◆ SetProtocol()

+
@@ -396,11 +388,13 @@ Static Protected Attributes
-

Definition at line 66 of file usbhid.cpp.

+

Definition at line 66 of file usbhid.cpp.

- + +

◆ GetProtocol()

+
@@ -424,11 +418,13 @@ Static Protected Attributes
-

Definition at line 70 of file usbhid.cpp.

+

Definition at line 70 of file usbhid.cpp.

- + +

◆ GetIdle()

+
@@ -458,11 +454,13 @@ Static Protected Attributes
-

Definition at line 58 of file usbhid.cpp.

+

Definition at line 58 of file usbhid.cpp.

- + +

◆ SetIdle()

+
@@ -492,11 +490,13 @@ Static Protected Attributes
-

Definition at line 62 of file usbhid.cpp.

+

Definition at line 62 of file usbhid.cpp.

- + +

◆ GetReportDescr()

+
@@ -520,11 +520,13 @@ Static Protected Attributes
-

Definition at line 34 of file usbhid.cpp.

+

Definition at line 34 of file usbhid.cpp.

- + +

◆ GetHidDescr()

+
@@ -556,7 +558,9 @@ Static Protected Attributes - + +

◆ GetReport()

+
@@ -604,11 +608,13 @@ Static Protected Attributes
-

Definition at line 54 of file usbhid.cpp.

+

Definition at line 54 of file usbhid.cpp.

- + +

◆ SetReport()

+
@@ -656,12 +662,14 @@ Static Protected Attributes
-

Definition at line 50 of file usbhid.cpp.

+

Definition at line 50 of file usbhid.cpp.

Member Data Documentation

- + +

◆ pUsb

+
@@ -679,11 +687,13 @@ Static Protected Attributes
-

Definition at line 145 of file usbhid.h.

+

Definition at line 145 of file usbhid.h.

- + +

◆ bAddress

+
@@ -701,11 +711,13 @@ Static Protected Attributes
-

Definition at line 146 of file usbhid.h.

+

Definition at line 146 of file usbhid.h.

- + +

◆ epInterruptInIndex

+
@@ -723,11 +735,13 @@ Static Protected Attributes
-

Definition at line 149 of file usbhid.h.

+

Definition at line 149 of file usbhid.h.

- + +

◆ epInterruptOutIndex

+
@@ -745,11 +759,13 @@ Static Protected Attributes
-

Definition at line 150 of file usbhid.h.

+

Definition at line 150 of file usbhid.h.

- + +

◆ maxHidInterfaces

+
@@ -767,11 +783,13 @@ Static Protected Attributes
-

Definition at line 152 of file usbhid.h.

+

Definition at line 152 of file usbhid.h.

- + +

◆ maxEpPerInterface

+
@@ -789,11 +807,13 @@ Static Protected Attributes
-

Definition at line 153 of file usbhid.h.

+

Definition at line 153 of file usbhid.h.

- + +

◆ totalEndpoints

+
@@ -811,7 +831,7 @@ Static Protected Attributes
-

Definition at line 154 of file usbhid.h.

+

Definition at line 154 of file usbhid.h.

@@ -824,7 +844,7 @@ Static Protected Attributes diff --git a/class_u_s_b_h_i_d__coll__graph.md5 b/class_u_s_b_h_i_d__coll__graph.md5 index 92be9460..b8d9dc3c 100644 --- a/class_u_s_b_h_i_d__coll__graph.md5 +++ b/class_u_s_b_h_i_d__coll__graph.md5 @@ -1 +1 @@ -cf485acf15d75bd6f1697dfca03233cb \ No newline at end of file +55575cb1417a298be7b19ac4ba5cc390 \ No newline at end of file diff --git a/class_u_s_b_h_i_d__coll__graph.png b/class_u_s_b_h_i_d__coll__graph.png index 6a2aa4d1..a4aa6298 100644 Binary files a/class_u_s_b_h_i_d__coll__graph.png and b/class_u_s_b_h_i_d__coll__graph.png differ diff --git a/class_u_s_b_h_i_d__inherit__graph.md5 b/class_u_s_b_h_i_d__inherit__graph.md5 index 1094a598..966fc3f1 100644 --- a/class_u_s_b_h_i_d__inherit__graph.md5 +++ b/class_u_s_b_h_i_d__inherit__graph.md5 @@ -1 +1 @@ -fd1ceed8df188748cafb6f9910104e67 \ No newline at end of file +21b3a3c0457bbd752948baa7e8c1df2a \ No newline at end of file diff --git a/class_u_s_b_h_i_d__inherit__graph.png b/class_u_s_b_h_i_d__inherit__graph.png index e2a2b3f5..adee4d7a 100644 Binary files a/class_u_s_b_h_i_d__inherit__graph.png and b/class_u_s_b_h_i_d__inherit__graph.png differ diff --git a/class_u_s_b_hub-members.html b/class_u_s_b_hub-members.html index 9c2d71ce..b0f323c0 100644 --- a/class_u_s_b_hub-members.html +++ b/class_u_s_b_hub-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 164 of file usbhub.h.

+

Definition at line 164 of file usbhub.h.

Constructor & Destructor Documentation

- + +

◆ USBHub()

+
@@ -163,12 +143,14 @@ Public Member Functions
-

Definition at line 21 of file usbhub.cpp.

+

Definition at line 21 of file usbhub.cpp.

Member Function Documentation

- + +

◆ ClearHubFeature()

+
@@ -190,11 +172,13 @@ Public Member Functions
-

Definition at line 211 of file usbhub.h.

+

Definition at line 211 of file usbhub.h.

- + +

◆ ClearPortFeature()

+
@@ -232,11 +216,13 @@ Public Member Functions
-

Definition at line 216 of file usbhub.h.

+

Definition at line 216 of file usbhub.h.

- + +

◆ GetHubDescriptor()

+
@@ -274,11 +260,13 @@ Public Member Functions
-

Definition at line 221 of file usbhub.h.

+

Definition at line 221 of file usbhub.h.

- + +

◆ GetHubStatus()

+
@@ -310,11 +298,13 @@ Public Member Functions
-

Definition at line 226 of file usbhub.h.

+

Definition at line 226 of file usbhub.h.

- + +

◆ GetPortStatus()

+
@@ -352,11 +342,13 @@ Public Member Functions
-

Definition at line 231 of file usbhub.h.

+

Definition at line 231 of file usbhub.h.

- + +

◆ SetHubDescriptor()

+
@@ -394,11 +386,13 @@ Public Member Functions
-

Definition at line 236 of file usbhub.h.

+

Definition at line 236 of file usbhub.h.

- + +

◆ SetHubFeature()

+
@@ -420,11 +414,13 @@ Public Member Functions
-

Definition at line 241 of file usbhub.h.

+

Definition at line 241 of file usbhub.h.

- + +

◆ SetPortFeature()

+
@@ -462,11 +458,13 @@ Public Member Functions
-

Definition at line 246 of file usbhub.h.

+

Definition at line 246 of file usbhub.h.

- + +

◆ PrintHubStatus()

+
@@ -481,7 +479,9 @@ Public Member Functions - + +

◆ Init()

+
@@ -521,11 +521,13 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 44 of file usbhub.cpp.

+

Definition at line 44 of file usbhub.cpp.

- + +

◆ Release()

+
@@ -548,11 +550,13 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 216 of file usbhub.cpp.

+

Definition at line 216 of file usbhub.cpp.

- + +

◆ Poll()

+
@@ -575,11 +579,13 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 229 of file usbhub.cpp.

+

Definition at line 229 of file usbhub.cpp.

- + +

◆ ResetHubPort()

+
@@ -603,11 +609,13 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 309 of file usbhub.cpp.

+

Definition at line 309 of file usbhub.cpp.

- + +

◆ GetAddress()

+
@@ -630,11 +638,13 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 199 of file usbhub.h.

+

Definition at line 199 of file usbhub.h.

- + +

◆ DEVCLASSOK()

+
@@ -658,7 +668,7 @@ Public Member Functions

Reimplemented from USBDeviceConfig.

-

Definition at line 203 of file usbhub.h.

+

Definition at line 203 of file usbhub.h.

@@ -671,7 +681,7 @@ Public Member Functions diff --git a/class_u_s_b_hub__coll__graph.md5 b/class_u_s_b_hub__coll__graph.md5 index 5328fe8d..acaaeb5a 100644 --- a/class_u_s_b_hub__coll__graph.md5 +++ b/class_u_s_b_hub__coll__graph.md5 @@ -1 +1 @@ -bf8ca3c3b9277566d37448eda78dfa47 \ No newline at end of file +19a6b573cae00d583786c381a3eb5446 \ No newline at end of file diff --git a/class_u_s_b_hub__coll__graph.png b/class_u_s_b_hub__coll__graph.png index 28212229..d0a58c21 100644 Binary files a/class_u_s_b_hub__coll__graph.png and b/class_u_s_b_hub__coll__graph.png differ diff --git a/class_u_s_b_hub__inherit__graph.md5 b/class_u_s_b_hub__inherit__graph.md5 index 5328fe8d..33450caf 100644 --- a/class_u_s_b_hub__inherit__graph.md5 +++ b/class_u_s_b_hub__inherit__graph.md5 @@ -1 +1 @@ -bf8ca3c3b9277566d37448eda78dfa47 \ No newline at end of file +f8fb8ebf62ffeb914faf5e448f0fa095 \ No newline at end of file diff --git a/class_u_s_b_hub__inherit__graph.png b/class_u_s_b_hub__inherit__graph.png index 28212229..d0a58c21 100644 Binary files a/class_u_s_b_hub__inherit__graph.png and b/class_u_s_b_hub__inherit__graph.png differ diff --git a/class_u_s_b_read_parser-members.html b/class_u_s_b_read_parser-members.html index 5b07368b..610cecf2 100644 --- a/class_u_s_b_read_parser-members.html +++ b/class_u_s_b_read_parser-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 192 of file UsbCore.h.

+

Definition at line 203 of file UsbCore.h.

Member Function Documentation

- + +

◆ Parse()

+
@@ -164,7 +144,7 @@ Public Member Functions diff --git a/class_u_s_b_read_parser__inherit__graph.md5 b/class_u_s_b_read_parser__inherit__graph.md5 index b9ca8675..083c726c 100644 --- a/class_u_s_b_read_parser__inherit__graph.md5 +++ b/class_u_s_b_read_parser__inherit__graph.md5 @@ -1 +1 @@ -ec3e429c5021a90ad76c1c993c8aa8bc \ No newline at end of file +bfbf139c46e46f9f8d2fef64f5bb2e5b \ No newline at end of file diff --git a/class_u_s_b_read_parser__inherit__graph.png b/class_u_s_b_read_parser__inherit__graph.png index 5fa1ca01..cc993a2a 100644 Binary files a/class_u_s_b_read_parser__inherit__graph.png and b/class_u_s_b_read_parser__inherit__graph.png differ diff --git a/class_universal_report_parser-members.html b/class_universal_report_parser-members.html index f6dd7f79..8423b2df 100644 --- a/class_universal_report_parser-members.html +++ b/class_universal_report_parser-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

-

Definition at line 170 of file hidescriptorparser.h.

+

Definition at line 170 of file hidescriptorparser.h.

Member Function Documentation

- + +

◆ Parse()

+
@@ -165,7 +145,7 @@ Public Member Functions

Implements HIDReportParser.

-

Definition at line 1581 of file hidescriptorparser.cpp.

+

Definition at line 1581 of file hidescriptorparser.cpp.

@@ -178,7 +158,7 @@ Public Member Functions diff --git a/class_universal_report_parser__coll__graph.md5 b/class_universal_report_parser__coll__graph.md5 index 18ce6809..b9a0d07a 100644 --- a/class_universal_report_parser__coll__graph.md5 +++ b/class_universal_report_parser__coll__graph.md5 @@ -1 +1 @@ -6ae2ae36eea0ce9a020916893890ce48 \ No newline at end of file +77621cd9b3f148b98b1c0c2ce929a351 \ No newline at end of file diff --git a/class_universal_report_parser__coll__graph.png b/class_universal_report_parser__coll__graph.png index e3af2beb..bea114d5 100644 Binary files a/class_universal_report_parser__coll__graph.png and b/class_universal_report_parser__coll__graph.png differ diff --git a/class_universal_report_parser__inherit__graph.md5 b/class_universal_report_parser__inherit__graph.md5 index 18ce6809..078a0db8 100644 --- a/class_universal_report_parser__inherit__graph.md5 +++ b/class_universal_report_parser__inherit__graph.md5 @@ -1 +1 @@ -6ae2ae36eea0ce9a020916893890ce48 \ No newline at end of file +6e5e7f853ac6bc17614d8031baec2670 \ No newline at end of file diff --git a/class_universal_report_parser__inherit__graph.png b/class_universal_report_parser__inherit__graph.png index e3af2beb..bea114d5 100644 Binary files a/class_universal_report_parser__inherit__graph.png and b/class_universal_report_parser__inherit__graph.png differ diff --git a/class_usb_config_xtracter-members.html b/class_usb_config_xtracter-members.html index 7d758e70..d476998f 100644 --- a/class_usb_config_xtracter-members.html +++ b/class_usb_config_xtracter-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +
+ @@ -121,9 +100,11 @@ Public Member Functions

Detailed Description

-

Definition at line 23 of file confdescparser.h.

+

Definition at line 30 of file confdescparser.h.

Member Function Documentation

- + +

◆ EndpointXtract()

+
@@ -173,9 +154,9 @@ Public Member Functions
-

Reimplemented in BulkOnly, BTD, ACM, HIDBoot< BOOT_PROTOCOL >, FTDI, ADK, HIDUniversal, and HIDComposite.

+

Reimplemented in BulkOnly, BTD, ACM, HIDBoot< BOOT_PROTOCOL >, XBOXONE, FTDI, ADK, HIDUniversal, and HIDComposite.

-

Definition at line 28 of file confdescparser.h.

+

Definition at line 35 of file confdescparser.h.

@@ -187,7 +168,7 @@ Public Member Functions diff --git a/class_usb_config_xtracter__inherit__graph.map b/class_usb_config_xtracter__inherit__graph.map index 129cf935..5c747991 100644 --- a/class_usb_config_xtracter__inherit__graph.map +++ b/class_usb_config_xtracter__inherit__graph.map @@ -5,6 +5,7 @@ + diff --git a/class_usb_config_xtracter__inherit__graph.md5 b/class_usb_config_xtracter__inherit__graph.md5 index 905b81e5..122b897f 100644 --- a/class_usb_config_xtracter__inherit__graph.md5 +++ b/class_usb_config_xtracter__inherit__graph.md5 @@ -1 +1 @@ -3da5adc5fba589839a6e9363a14c8467 \ No newline at end of file +9c2a0c5b68bd54ead963169aff634d3f \ No newline at end of file diff --git a/class_usb_config_xtracter__inherit__graph.png b/class_usb_config_xtracter__inherit__graph.png index 3c31a225..24ab644e 100644 Binary files a/class_usb_config_xtracter__inherit__graph.png and b/class_usb_config_xtracter__inherit__graph.png differ diff --git a/class_w_i_i-members.html b/class_w_i_i-members.html index 3bc3840c..c9de803c 100644 --- a/class_w_i_i-members.html +++ b/class_w_i_i-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

This BluetoothService class implements support for the Wiimote including the Nunchuck and Motion Plus extension.

It also support the Wii U Pro Controller.

-

Definition at line 56 of file Wii.h.

+

Definition at line 56 of file Wii.h.

Constructor & Destructor Documentation

- + +

◆ WII()

+
@@ -344,12 +324,14 @@ Additional Inherited Members -

Definition at line 85 of file Wii.cpp.

+

Definition at line 85 of file Wii.cpp.

Member Function Documentation

- + +

◆ disconnect()

+
@@ -373,11 +355,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 116 of file Wii.cpp.

+

Definition at line 116 of file Wii.cpp.

- + +

◆ getButtonPress()

+
@@ -400,11 +384,13 @@ Additional Inherited Members
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 1086 of file Wii.cpp.

+

Definition at line 1097 of file Wii.cpp.

- + +

◆ getButtonClick()

+
@@ -427,11 +413,13 @@ Additional Inherited Members
Returns
getButtonPress(ButtonEnum b) will return a true as long as a button is held down, while getButtonClick(ButtonEnum b) will return true once for each button press.
-

Definition at line 1093 of file Wii.cpp.

+

Definition at line 1104 of file Wii.cpp.

- + +

◆ pair()

+
@@ -454,11 +442,13 @@ Additional Inherited Members

Call this to start the pairing sequence with a controller

-

Definition at line 89 of file Wii.h.

+

Definition at line 89 of file Wii.h.

- + +

◆ getAnalogHat() [1/2]

+
@@ -479,11 +469,13 @@ Additional Inherited Members
Returns
Return the analog value in the range from approximately 25-230.
-

Definition at line 1104 of file Wii.cpp.

+

Definition at line 1115 of file Wii.cpp.

- + +

◆ getAnalogHat() [2/2]

+
@@ -504,11 +496,13 @@ Additional Inherited Members
Returns
Return the analog value in the range from approximately 800-3200.
-

Definition at line 1116 of file Wii.cpp.

+

Definition at line 1127 of file Wii.cpp.

- + +

◆ getPitch()

+
@@ -530,11 +524,13 @@ Additional Inherited Members

Pitch calculated from the Wiimote. A complimentary filter is used if the Motion Plus is connected.

Returns
Pitch in the range from 0-360.
-

Definition at line 110 of file Wii.h.

+

Definition at line 110 of file Wii.h.

- + +

◆ getRoll()

+
@@ -556,11 +552,13 @@ Additional Inherited Members

Roll calculated from the Wiimote. A complimentary filter is used if the Motion Plus is connected.

Returns
Roll in the range from 0-360.
-

Definition at line 120 of file Wii.h.

+

Definition at line 120 of file Wii.h.

- + +

◆ getYaw()

+
@@ -583,11 +581,13 @@ Additional Inherited Members

This is the yaw calculated by the gyro.

NOTE: This angle will drift a lot and is only available if the Motion Plus extension is connected.

Returns
The angle calculated using the gyro.
-

Definition at line 132 of file Wii.h.

+

Definition at line 132 of file Wii.h.

- + +

◆ setAllOff()

+
@@ -601,11 +601,13 @@ Additional Inherited Members

Used to set all LEDs and rumble off.

-

Definition at line 896 of file Wii.cpp.

+

Definition at line 903 of file Wii.cpp.

- + +

◆ setRumbleOff()

+
@@ -619,11 +621,13 @@ Additional Inherited Members

Turn off rumble.

-

Definition at line 902 of file Wii.cpp.

+

Definition at line 909 of file Wii.cpp.

- + +

◆ setRumbleOn()

+
@@ -637,11 +641,13 @@ Additional Inherited Members

Turn on rumble.

-

Definition at line 908 of file Wii.cpp.

+

Definition at line 915 of file Wii.cpp.

- + +

◆ setRumbleToggle()

+
@@ -655,11 +661,13 @@ Additional Inherited Members

Toggle rumble.

-

Definition at line 914 of file Wii.cpp.

+

Definition at line 921 of file Wii.cpp.

- + +

◆ setLedRaw()

+
@@ -679,11 +687,13 @@ Additional Inherited Members -

Definition at line 920 of file Wii.cpp.

+

Definition at line 927 of file Wii.cpp.

- + +

◆ setLedOff() [1/2]

+
@@ -705,11 +715,13 @@ Additional Inherited Members

Turn all LEDs off.

-

Definition at line 152 of file Wii.h.

+

Definition at line 152 of file Wii.h.

- + +

◆ setLedOff() [2/2]

+
@@ -729,11 +741,13 @@ Additional Inherited Members -

Definition at line 926 of file Wii.cpp.

+

Definition at line 933 of file Wii.cpp.

- + +

◆ setLedOn()

+
@@ -753,11 +767,13 @@ Additional Inherited Members -

Definition at line 932 of file Wii.cpp.

+

Definition at line 939 of file Wii.cpp.

- + +

◆ setLedToggle()

+
@@ -777,11 +793,13 @@ Additional Inherited Members -

Definition at line 942 of file Wii.cpp.

+

Definition at line 949 of file Wii.cpp.

- + +

◆ setLedStatus()

+
@@ -796,11 +814,13 @@ Additional Inherited Members

This will set the LEDs, so the user can see which connections are active.

The first LEDEnum indicate that the Wiimote is connected, the second LEDEnum indicate indicate that a Motion Plus is also connected the third LEDEnum will indicate that a Nunchuck controller is also connected.

-

Definition at line 948 of file Wii.cpp.

+

Definition at line 955 of file Wii.cpp.

- + +

◆ getBatteryLevel()

+
@@ -814,11 +834,13 @@ Additional Inherited Members

Return the battery level of the Wiimote.

Returns
The battery level in the range 0-255.
-

Definition at line 961 of file Wii.cpp.

+

Definition at line 968 of file Wii.cpp.

- + +

◆ getWiiState()

+
@@ -840,11 +862,13 @@ Additional Inherited Members

Return the Wiimote state.

Returns
See: http://wiibrew.org/wiki/Wiimote#0x20:_Status.
-

Definition at line 189 of file Wii.h.

+

Definition at line 189 of file Wii.h.

- + +

◆ getWiimotePitch()

+
@@ -866,11 +890,13 @@ Additional Inherited Members

Pitch and roll calculated from the accelerometer inside the Wiimote.

-

Definition at line 212 of file Wii.h.

+

Definition at line 212 of file Wii.h.

- + +

◆ getWiimoteRoll()

+
@@ -892,11 +918,13 @@ Additional Inherited Members

Pitch and roll calculated from the accelerometer inside the Wiimote.

-

Definition at line 216 of file Wii.h.

+

Definition at line 216 of file Wii.h.

- + +

◆ getNunchuckPitch()

+
@@ -918,11 +946,13 @@ Additional Inherited Members

Pitch and roll calculated from the accelerometer inside the Nunchuck.

-

Definition at line 224 of file Wii.h.

+

Definition at line 224 of file Wii.h.

- + +

◆ getNunchuckRoll()

+
@@ -944,11 +974,13 @@ Additional Inherited Members

Pitch and roll calculated from the accelerometer inside the Nunchuck.

-

Definition at line 228 of file Wii.h.

+

Definition at line 228 of file Wii.h.

- + +

◆ getWeight()

+
@@ -969,11 +1001,13 @@ Additional Inherited Members
Returns
Returns the weight in kg.
-

Definition at line 1139 of file Wii.cpp.

+

Definition at line 1150 of file Wii.cpp.

- + +

◆ getTotalWeight()

+
@@ -987,11 +1021,13 @@ Additional Inherited Members

Used to get total weight on the Wii Balance Board.

Returns
Returns the weight in kg.
-

Definition at line 1152 of file Wii.cpp.

+

Definition at line 1163 of file Wii.cpp.

- + +

◆ getWeightRaw()

+
@@ -1020,11 +1056,13 @@ Additional Inherited Members
Returns
Returns the raw reading.
-

Definition at line 295 of file Wii.h.

+

Definition at line 295 of file Wii.h.

- + +

◆ IRinitialize()

+
@@ -1038,11 +1076,13 @@ Additional Inherited Members

Initialises the camera as per the steps from: http://wiibrew.org/wiki/Wiimote#IR_Camera

-

Definition at line 1162 of file Wii.cpp.

+

Definition at line 1173 of file Wii.cpp.

- + +

◆ getIRx1()

+
@@ -1064,11 +1104,13 @@ Additional Inherited Members

IR object 1 x-position read from the Wii IR camera.

Returns
The x-position of the object in the range 0-1023.
-

Definition at line 311 of file Wii.h.

+

Definition at line 311 of file Wii.h.

- + +

◆ getIRy1()

+
@@ -1090,11 +1132,13 @@ Additional Inherited Members

IR object 1 y-position read from the Wii IR camera.

Returns
The y-position of the object in the range 0-767.
-

Definition at line 319 of file Wii.h.

+

Definition at line 319 of file Wii.h.

- + +

◆ getIRs1()

+
@@ -1116,11 +1160,13 @@ Additional Inherited Members

IR object 1 size read from the Wii IR camera.

Returns
The size of the object in the range 0-15.
-

Definition at line 327 of file Wii.h.

+

Definition at line 327 of file Wii.h.

- + +

◆ getIRx2()

+
@@ -1142,11 +1188,13 @@ Additional Inherited Members

IR object 2 x-position read from the Wii IR camera.

Returns
The x-position of the object in the range 0-1023.
-

Definition at line 335 of file Wii.h.

+

Definition at line 335 of file Wii.h.

- + +

◆ getIRy2()

+
@@ -1168,11 +1216,13 @@ Additional Inherited Members

IR object 2 y-position read from the Wii IR camera.

Returns
The y-position of the object in the range 0-767.
-

Definition at line 343 of file Wii.h.

+

Definition at line 343 of file Wii.h.

- + +

◆ getIRs2()

+
@@ -1194,11 +1244,13 @@ Additional Inherited Members

IR object 2 size read from the Wii IR camera.

Returns
The size of the object in the range 0-15.
-

Definition at line 351 of file Wii.h.

+

Definition at line 351 of file Wii.h.

- + +

◆ getIRx3()

+
@@ -1220,11 +1272,13 @@ Additional Inherited Members

IR object 3 x-position read from the Wii IR camera.

Returns
The x-position of the object in the range 0-1023.
-

Definition at line 359 of file Wii.h.

+

Definition at line 359 of file Wii.h.

- + +

◆ getIRy3()

+
@@ -1246,11 +1300,13 @@ Additional Inherited Members

IR object 3 y-position read from the Wii IR camera.

Returns
The y-position of the object in the range 0-767.
-

Definition at line 367 of file Wii.h.

+

Definition at line 367 of file Wii.h.

- + +

◆ getIRs3()

+
@@ -1272,11 +1328,13 @@ Additional Inherited Members

IR object 3 size read from the Wii IR camera.

Returns
The size of the object in the range 0-15.
-

Definition at line 375 of file Wii.h.

+

Definition at line 375 of file Wii.h.

- + +

◆ getIRx4()

+
@@ -1298,11 +1356,13 @@ Additional Inherited Members

IR object 4 x-position read from the Wii IR camera.

Returns
The x-position of the object in the range 0-1023.
-

Definition at line 383 of file Wii.h.

+

Definition at line 383 of file Wii.h.

- + +

◆ getIRy4()

+
@@ -1324,11 +1384,13 @@ Additional Inherited Members

IR object 4 y-position read from the Wii IR camera.

Returns
The y-position of the object in the range 0-767.
-

Definition at line 391 of file Wii.h.

+

Definition at line 391 of file Wii.h.

- + +

◆ getIRs4()

+
@@ -1350,11 +1412,13 @@ Additional Inherited Members

IR object 4 size read from the Wii IR camera.

Returns
The size of the object in the range 0-15.
-

Definition at line 399 of file Wii.h.

+

Definition at line 399 of file Wii.h.

- + +

◆ isIRCameraEnabled()

+
@@ -1376,11 +1440,13 @@ Additional Inherited Members

Use this to check if the camera is enabled or not. If not call WII::IRinitialize to initialize the IR camera.

Returns
True if it's enabled, false if not.
-

Definition at line 408 of file Wii.h.

+

Definition at line 408 of file Wii.h.

- + +

◆ ACLData()

+
@@ -1410,11 +1476,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 133 of file Wii.cpp.

+

Definition at line 133 of file Wii.cpp.

- + +

◆ Run()

+
@@ -1438,11 +1506,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 718 of file Wii.cpp.

+

Definition at line 725 of file Wii.cpp.

- + +

◆ Reset()

+
@@ -1466,11 +1536,13 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 101 of file Wii.cpp.

+

Definition at line 101 of file Wii.cpp.

- + +

◆ onInit()

+
@@ -1494,12 +1566,14 @@ Additional Inherited Members

Implements BluetoothService.

-

Definition at line 1128 of file Wii.cpp.

+

Definition at line 1139 of file Wii.cpp.

Member Data Documentation

- + +

◆ wiimoteConnected

+
@@ -1510,11 +1584,13 @@ Additional Inherited Members

Variable used to indicate if a Wiimote is connected.

-

Definition at line 191 of file Wii.h.

+

Definition at line 191 of file Wii.h.

- + +

◆ nunchuckConnected

+
@@ -1525,11 +1601,13 @@ Additional Inherited Members

Variable used to indicate if a Nunchuck controller is connected.

-

Definition at line 198 of file Wii.h.

+

Definition at line 198 of file Wii.h.

- + +

◆ motionPlusConnected

+
@@ -1540,11 +1618,13 @@ Additional Inherited Members

Variable used to indicate if a Nunchuck controller is connected.

-

Definition at line 200 of file Wii.h.

+

Definition at line 200 of file Wii.h.

- + +

◆ wiiUProControllerConnected

+
@@ -1555,11 +1635,13 @@ Additional Inherited Members

Variable used to indicate if a Wii U Pro controller is connected.

-

Definition at line 202 of file Wii.h.

+

Definition at line 202 of file Wii.h.

- + +

◆ wiiBalanceBoardConnected

+
@@ -1570,11 +1652,13 @@ Additional Inherited Members

Variable used to indicate if a Wii Balance Board is connected.

-

Definition at line 204 of file Wii.h.

+

Definition at line 204 of file Wii.h.

- + +

◆ accXwiimote

+
@@ -1585,11 +1669,13 @@ Additional Inherited Members

Accelerometer values used to calculate pitch and roll.

-

Definition at line 230 of file Wii.h.

+

Definition at line 230 of file Wii.h.

- + +

◆ accYwiimote

+
@@ -1600,11 +1686,13 @@ Additional Inherited Members

Accelerometer values used to calculate pitch and roll.

-

Definition at line 230 of file Wii.h.

+

Definition at line 230 of file Wii.h.

- + +

◆ accZwiimote

+
@@ -1615,11 +1703,13 @@ Additional Inherited Members

Accelerometer values used to calculate pitch and roll.

-

Definition at line 230 of file Wii.h.

+

Definition at line 230 of file Wii.h.

- + +

◆ accXnunchuck

+
@@ -1630,11 +1720,13 @@ Additional Inherited Members

Accelerometer values used to calculate pitch and roll.

-

Definition at line 236 of file Wii.h.

+

Definition at line 236 of file Wii.h.

- + +

◆ accYnunchuck

+
@@ -1645,11 +1737,13 @@ Additional Inherited Members

Accelerometer values used to calculate pitch and roll.

-

Definition at line 236 of file Wii.h.

+

Definition at line 236 of file Wii.h.

- + +

◆ accZnunchuck

+
@@ -1660,11 +1754,13 @@ Additional Inherited Members

Accelerometer values used to calculate pitch and roll.

-

Definition at line 236 of file Wii.h.

+

Definition at line 236 of file Wii.h.

- + +

◆ gyroPitch

+
@@ -1675,11 +1771,13 @@ Additional Inherited Members

This is the pitch calculated by the gyro - use this to tune WII::pitchGyroScale.

-

Definition at line 241 of file Wii.h.

+

Definition at line 241 of file Wii.h.

- + +

◆ gyroRoll

+
@@ -1690,11 +1788,13 @@ Additional Inherited Members

This is the roll calculated by the gyro - use this to tune WII::rollGyroScale.

-

Definition at line 243 of file Wii.h.

+

Definition at line 243 of file Wii.h.

- + +

◆ gyroYaw

+
@@ -1705,11 +1805,13 @@ Additional Inherited Members

This is the yaw calculated by the gyro - use this to tune WII::yawGyroScale.

-

Definition at line 245 of file Wii.h.

+

Definition at line 245 of file Wii.h.

- + +

◆ pitchGyroSpeed

+
@@ -1720,11 +1822,13 @@ Additional Inherited Members

The speed in deg/s from the gyro.

-

Definition at line 249 of file Wii.h.

+

Definition at line 249 of file Wii.h.

- + +

◆ rollGyroSpeed

+
@@ -1735,11 +1839,13 @@ Additional Inherited Members

The speed in deg/s from the gyro.

-

Definition at line 250 of file Wii.h.

+

Definition at line 250 of file Wii.h.

- + +

◆ yawGyroSpeed

+
@@ -1750,11 +1856,13 @@ Additional Inherited Members

The speed in deg/s from the gyro.

-

Definition at line 251 of file Wii.h.

+

Definition at line 251 of file Wii.h.

- + +

◆ pitchGyroScale

+
@@ -1765,11 +1873,13 @@ Additional Inherited Members

You might need to fine-tune these values.

-

Definition at line 256 of file Wii.h.

+

Definition at line 256 of file Wii.h.

- + +

◆ rollGyroScale

+
@@ -1780,11 +1890,13 @@ Additional Inherited Members

You might need to fine-tune these values.

-

Definition at line 257 of file Wii.h.

+

Definition at line 257 of file Wii.h.

- + +

◆ yawGyroScale

+
@@ -1795,11 +1907,13 @@ Additional Inherited Members

You might need to fine-tune these values.

-

Definition at line 258 of file Wii.h.

+

Definition at line 258 of file Wii.h.

- + +

◆ gyroYawRaw

+
@@ -1810,11 +1924,13 @@ Additional Inherited Members

Raw value read directly from the Motion Plus.

-

Definition at line 263 of file Wii.h.

+

Definition at line 263 of file Wii.h.

- + +

◆ gyroRollRaw

+
@@ -1825,11 +1941,13 @@ Additional Inherited Members

Raw value read directly from the Motion Plus.

-

Definition at line 264 of file Wii.h.

+

Definition at line 264 of file Wii.h.

- + +

◆ gyroPitchRaw

+
@@ -1840,11 +1958,13 @@ Additional Inherited Members

Raw value read directly from the Motion Plus.

-

Definition at line 265 of file Wii.h.

+

Definition at line 265 of file Wii.h.

- + +

◆ gyroYawZero

+
@@ -1855,11 +1975,13 @@ Additional Inherited Members

These values are set when the controller is first initialized.

-

Definition at line 270 of file Wii.h.

+

Definition at line 270 of file Wii.h.

- + +

◆ gyroRollZero

+
@@ -1870,11 +1992,13 @@ Additional Inherited Members

These values are set when the controller is first initialized.

-

Definition at line 271 of file Wii.h.

+

Definition at line 271 of file Wii.h.

- + +

◆ gyroPitchZero

+
@@ -1885,7 +2009,7 @@ Additional Inherited Members

These values are set when the controller is first initialized.

-

Definition at line 272 of file Wii.h.

+

Definition at line 272 of file Wii.h.

@@ -1898,7 +2022,7 @@ Additional Inherited Members diff --git a/class_w_i_i__coll__graph.md5 b/class_w_i_i__coll__graph.md5 index 32ea2769..a10fe2cb 100644 --- a/class_w_i_i__coll__graph.md5 +++ b/class_w_i_i__coll__graph.md5 @@ -1 +1 @@ -e2fa40aab171687d763b41a969505c68 \ No newline at end of file +e1501afe750d6b78ef0a9e4e2bae788b \ No newline at end of file diff --git a/class_w_i_i__coll__graph.png b/class_w_i_i__coll__graph.png index 4fc5e085..a3305940 100644 Binary files a/class_w_i_i__coll__graph.png and b/class_w_i_i__coll__graph.png differ diff --git a/class_w_i_i__inherit__graph.md5 b/class_w_i_i__inherit__graph.md5 index 6b41428e..7b7bcaf0 100644 --- a/class_w_i_i__inherit__graph.md5 +++ b/class_w_i_i__inherit__graph.md5 @@ -1 +1 @@ -0f2ab569d0b7006cfff8d64fe9f9fda1 \ No newline at end of file +e76134827ecba3876499802eaee4ce30 \ No newline at end of file diff --git a/class_w_i_i__inherit__graph.png b/class_w_i_i__inherit__graph.png index 3255cae9..c1c53ca4 100644 Binary files a/class_w_i_i__inherit__graph.png and b/class_w_i_i__inherit__graph.png differ diff --git a/class_x_b_o_x_o_l_d-members.html b/class_x_b_o_x_o_l_d-members.html index d04599e4..68adb942 100644 --- a/class_x_b_o_x_o_l_d-members.html +++ b/class_x_b_o_x_o_l_d-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

This class implements support for a the original Xbox controller via USB.

-

Definition at line 46 of file XBOXOLD.h.

+

Definition at line 46 of file XBOXOLD.h.

Constructor & Destructor Documentation

- + +

◆ XBOXOLD()

+
@@ -194,12 +174,14 @@ Protected Attributes -

Definition at line 47 of file XBOXOLD.cpp.

+

Definition at line 47 of file XBOXOLD.cpp.

Member Function Documentation

- + +

◆ Init()

+
@@ -248,11 +230,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 63 of file XBOXOLD.cpp.

+

Definition at line 63 of file XBOXOLD.cpp.

- + +

◆ Release()

+
@@ -276,11 +260,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 237 of file XBOXOLD.cpp.

+

Definition at line 237 of file XBOXOLD.cpp.

- + +

◆ Poll()

+
@@ -304,11 +290,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 245 of file XBOXOLD.cpp.

+

Definition at line 245 of file XBOXOLD.cpp.

- + +

◆ GetAddress()

+
@@ -332,11 +320,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 78 of file XBOXOLD.h.

+

Definition at line 78 of file XBOXOLD.h.

- + +

◆ isReady()

+
@@ -358,11 +348,13 @@ Protected Attributes

Used to check if the controller has been initialized.

Returns
True if it's ready.
-

Definition at line 86 of file XBOXOLD.h.

+

Definition at line 86 of file XBOXOLD.h.

- + +

◆ VIDPIDOK()

+
@@ -404,11 +396,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 96 of file XBOXOLD.h.

+

Definition at line 96 of file XBOXOLD.h.

- + +

◆ getButtonPress()

+
@@ -431,11 +425,13 @@ Protected Attributes
Returns
getButtonClick(ButtonEnum b) will return a bool, while getButtonPress(ButtonEnum b) will return a byte if reading L2 or R2.
-

Definition at line 295 of file XBOXOLD.cpp.

+

Definition at line 295 of file XBOXOLD.cpp.

- + +

◆ getButtonClick()

+
@@ -458,11 +454,13 @@ Protected Attributes
Returns
getButtonClick(ButtonEnum b) will return a bool, while getButtonPress(ButtonEnum b) will return a byte if reading L2 or R2.
-

Definition at line 302 of file XBOXOLD.cpp.

+

Definition at line 302 of file XBOXOLD.cpp.

- + +

◆ getAnalogHat()

+
@@ -483,11 +481,13 @@ Protected Attributes
Returns
Returns a signed 16-bit integer.
-

Definition at line 317 of file XBOXOLD.cpp.

+

Definition at line 317 of file XBOXOLD.cpp.

- + +

◆ setRumbleOff()

+
@@ -509,11 +509,13 @@ Protected Attributes

Turn rumble off the controller.

-

Definition at line 125 of file XBOXOLD.h.

+

Definition at line 125 of file XBOXOLD.h.

- + +

◆ setRumbleOn()

+
@@ -544,11 +546,13 @@ Protected Attributes -

Definition at line 327 of file XBOXOLD.cpp.

+

Definition at line 327 of file XBOXOLD.cpp.

- + +

◆ attachOnInit()

+
@@ -576,12 +580,14 @@ Protected Attributes -

Definition at line 139 of file XBOXOLD.h.

+

Definition at line 139 of file XBOXOLD.h.

Member Data Documentation

- + +

◆ XboxConnected

+
@@ -592,11 +598,13 @@ Protected Attributes

True if a Xbox controller is connected.

-

Definition at line 141 of file XBOXOLD.h.

+

Definition at line 141 of file XBOXOLD.h.

- + +

◆ pUsb

+
@@ -615,11 +623,13 @@ Protected Attributes

Pointer to USB class instance.

-

Definition at line 149 of file XBOXOLD.h.

+

Definition at line 149 of file XBOXOLD.h.

- + +

◆ bAddress

+
@@ -638,11 +648,13 @@ Protected Attributes

Device address.

-

Definition at line 151 of file XBOXOLD.h.

+

Definition at line 151 of file XBOXOLD.h.

- + +

◆ epInfo

+
@@ -661,7 +673,7 @@ Protected Attributes

Endpoint info structure.

-

Definition at line 153 of file XBOXOLD.h.

+

Definition at line 153 of file XBOXOLD.h.

@@ -674,7 +686,7 @@ Protected Attributes diff --git a/class_x_b_o_x_o_l_d__coll__graph.md5 b/class_x_b_o_x_o_l_d__coll__graph.md5 index c02a188a..42b7005f 100644 --- a/class_x_b_o_x_o_l_d__coll__graph.md5 +++ b/class_x_b_o_x_o_l_d__coll__graph.md5 @@ -1 +1 @@ -3285ca35607fc26fc3c6347499cd29e6 \ No newline at end of file +c0023cd1084e2018409a7a9723373210 \ No newline at end of file diff --git a/class_x_b_o_x_o_l_d__coll__graph.png b/class_x_b_o_x_o_l_d__coll__graph.png index f9be51b0..dc6c3dcc 100644 Binary files a/class_x_b_o_x_o_l_d__coll__graph.png and b/class_x_b_o_x_o_l_d__coll__graph.png differ diff --git a/class_x_b_o_x_o_l_d__inherit__graph.md5 b/class_x_b_o_x_o_l_d__inherit__graph.md5 index 73dafbc3..de29cd5b 100644 --- a/class_x_b_o_x_o_l_d__inherit__graph.md5 +++ b/class_x_b_o_x_o_l_d__inherit__graph.md5 @@ -1 +1 @@ -1eeb2bcd708d5b17ef18f534c5633a29 \ No newline at end of file +8ea0f3477d33c1fccfccfb30f84bc05e \ No newline at end of file diff --git a/class_x_b_o_x_o_l_d__inherit__graph.png b/class_x_b_o_x_o_l_d__inherit__graph.png index 03a81f78..b24a6a90 100644 Binary files a/class_x_b_o_x_o_l_d__inherit__graph.png and b/class_x_b_o_x_o_l_d__inherit__graph.png differ diff --git a/class_x_b_o_x_o_n_e-members.html b/class_x_b_o_x_o_n_e-members.html index 2d8aaa8d..3ed5b264 100644 --- a/class_x_b_o_x_o_n_e-members.html +++ b/class_x_b_o_x_o_n_e-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
attachOnInit(void(*funcOnInit)(void))XBOXONEinline bAddressXBOXONEprotected + bConfNumXBOXONEprotected + bNumEPXBOXONEprotected ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual DEVCLASSOK(uint8_t klass)USBDeviceConfiginlinevirtual DEVSUBCLASSOK(uint8_t subklass)USBDeviceConfiginlinevirtual - epInfoXBOXONEprotected - GetAddress()XBOXONEinlinevirtual - getAnalogHat(AnalogHatEnum a)XBOXONE - getButtonClick(ButtonEnum b)XBOXONE - getButtonPress(ButtonEnum b)XBOXONE - Init(uint8_t parent, uint8_t port, bool lowspeed)XBOXONEvirtual - isReady()XBOXONEinlinevirtual - Poll()XBOXONEvirtual + EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)XBOXONEprotectedvirtual + epInfoXBOXONEprotected + GetAddress()XBOXONEinlinevirtual + getAnalogHat(AnalogHatEnum a)XBOXONE + getButtonClick(ButtonEnum b)XBOXONE + getButtonPress(ButtonEnum b)XBOXONE + Init(uint8_t parent, uint8_t port, bool lowspeed)XBOXONEvirtual + isReady()XBOXONEinlinevirtual + Poll()XBOXONEvirtual + PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)XBOXONEprotected pUsbXBOXONEprotected + qNextPollTimeXBOXONEprotected + readPollInterval()XBOXONEinline Release()XBOXONEvirtual ResetHubPort(uint8_t port)USBDeviceConfiginlinevirtual + setRumbleOff()XBOXONE + setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)XBOXONE VIDPIDOK(uint16_t vid, uint16_t pid)XBOXONEinlinevirtual XBOXONE(USB *pUsb)XBOXONE XboxOneConnectedXBOXONE @@ -115,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_x_b_o_x_o_n_e.html b/class_x_b_o_x_o_n_e.html index fc1ba634..674955be 100644 --- a/class_x_b_o_x_o_n_e.html +++ b/class_x_b_o_x_o_n_e.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XBOXONE Class Reference @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
@@ -101,6 +80,7 @@ Inheritance diagram for XBOXONE:
Inheritance graph
+
[legend]
@@ -109,9 +89,10 @@ Collaboration diagram for XBOXONE:
Collaboration graph
- - - + + + +
[legend]
@@ -130,6 +111,8 @@ Public Member Functions + + @@ -141,6 +124,10 @@ Public Member Functions + + + + @@ -156,21 +143,37 @@ Public Attributes
 
virtual bool isReady ()
 
uint8_t readPollInterval ()
 
virtual bool VIDPIDOK (uint16_t vid, uint16_t pid)
 
Xbox Controller functions
 
void attachOnInit (void(*funcOnInit)(void))
 
void setRumbleOff ()
 
void setRumbleOn (uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor)
 
- Public Member Functions inherited from USBDeviceConfig
virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed)
 
bool XboxOneConnected
 
+ + + + + + +

+Protected Member Functions

void PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
 
UsbConfigXtracter implementation
void EndpointXtract (uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
 
- - + + + + + + + +

Protected Attributes

USBpUsb
 
uint8_t bAddress
 
EpInfo epInfo [XBOX_MAX_ENDPOINTS]
 
EpInfo epInfo [XBOX_ONE_MAX_ENDPOINTS]
 
uint8_t bConfNum
 
uint8_t bNumEP
 
uint32_t qNextPollTime
 

Detailed Description

This class implements support for a Xbox ONE controller connected via USB.

-

Definition at line 46 of file XBOXONE.h.

+

Definition at line 65 of file XBOXONE.h.

Constructor & Destructor Documentation

- + +

◆ XBOXONE()

+
@@ -190,12 +193,14 @@ Protected Attributes -

Definition at line 27 of file XBOXONE.cpp.

+

Definition at line 27 of file XBOXONE.cpp.

Member Function Documentation

- + +

◆ Init()

+
@@ -244,11 +249,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 43 of file XBOXONE.cpp.

+

Definition at line 46 of file XBOXONE.cpp.

- + +

◆ Release()

+
@@ -272,11 +279,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 226 of file XBOXONE.cpp.

+

Definition at line 278 of file XBOXONE.cpp.

- + +

◆ Poll()

+
@@ -300,11 +309,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 237 of file XBOXONE.cpp.

+

Definition at line 292 of file XBOXONE.cpp.

- + +

◆ GetAddress()

+
@@ -328,11 +339,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 78 of file XBOXONE.h.

+

Definition at line 97 of file XBOXONE.h.

- + +

◆ isReady()

+
@@ -354,11 +367,41 @@ Protected Attributes

Used to check if the controller has been initialized.

Returns
True if it's ready.
-

Definition at line 86 of file XBOXONE.h.

+

Definition at line 105 of file XBOXONE.h.

- + +

◆ readPollInterval()

+ +
+
+
+ + + + +
+ + + + + + + +
uint8_t XBOXONE::readPollInterval ()
+
+inline
+
+

Read the poll interval taken from the endpoint descriptors.

Returns
The poll interval in ms.
+ +

Definition at line 113 of file XBOXONE.h.

+ +
+
+ +

◆ VIDPIDOK()

+
@@ -400,11 +443,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 96 of file XBOXONE.h.

+

Definition at line 123 of file XBOXONE.h.

- + +

◆ getButtonPress()

+
@@ -427,11 +472,13 @@ Protected Attributes
Returns
getButtonClick(ButtonEnum b) will return a bool, while getButtonPress(ButtonEnum b) will return a word if reading L2 or R2.
-

Definition at line 316 of file XBOXONE.cpp.

+

Definition at line 372 of file XBOXONE.cpp.

- + +

◆ getButtonClick()

+
@@ -454,11 +501,13 @@ Protected Attributes
Returns
getButtonClick(ButtonEnum b) will return a bool, while getButtonPress(ButtonEnum b) will return a word if reading L2 or R2.
-

Definition at line 324 of file XBOXONE.cpp.

+

Definition at line 380 of file XBOXONE.cpp.

- + +

◆ getAnalogHat()

+
@@ -479,11 +528,13 @@ Protected Attributes
Returns
Returns a signed 16-bit integer.
-

Definition at line 344 of file XBOXONE.cpp.

+

Definition at line 400 of file XBOXONE.cpp.

- + +

◆ attachOnInit()

+
@@ -511,12 +562,187 @@ Protected Attributes -

Definition at line 126 of file XBOXONE.h.

+

Definition at line 156 of file XBOXONE.h.

+ + + + +

◆ setRumbleOff()

+ +
+
+
+ + + + + + +
void XBOXONE::setRumbleOff ()
+
+

Used to set the rumble off.

+ +

Definition at line 442 of file XBOXONE.cpp.

+ +
+
+ +

◆ setRumbleOn()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void XBOXONE::setRumbleOn (uint8_t leftTrigger,
uint8_t rightTrigger,
uint8_t leftMotor,
uint8_t rightMotor 
)
+
+

Used to turn on rumble continuously.

Parameters
+ + + + + +
leftTriggerLeft trigger force.
rightTriggerRight trigger force.
leftMotorLeft motor force.
rightMotorRight motor force.
+
+
+ +

Definition at line 464 of file XBOXONE.cpp.

+ +
+
+ +

◆ EndpointXtract()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void XBOXONE::EndpointXtract (uint8_t conf,
uint8_t iface,
uint8_t alt,
uint8_t proto,
const USB_ENDPOINT_DESCRIPTORep 
)
+
+protectedvirtual
+
+

UsbConfigXtracter implementation, used to extract endpoint information.

Parameters
+ + + + + + +
confConfiguration value.
ifaceInterface number.
altAlternate setting.
protoInterface Protocol.
epEndpoint Descriptor.
+
+
+ +

Reimplemented from UsbConfigXtracter.

+ +

Definition at line 239 of file XBOXONE.cpp.

+ +
+
+ +

◆ PrintEndpointDescriptor()

+ +
+
+ + + + + +
+ + + + + + + + +
void XBOXONE::PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTORep_ptr)
+
+protected
+
+

Used to print the USB Endpoint Descriptor.

Parameters
+ + +
ep_ptrPointer to USB Endpoint Descriptor.
+
+
+ +

Definition at line 259 of file XBOXONE.cpp.

Member Data Documentation

- + +

◆ XboxOneConnected

+
@@ -527,11 +753,13 @@ Protected Attributes

True if a Xbox ONE controller is connected.

-

Definition at line 128 of file XBOXONE.h.

+

Definition at line 174 of file XBOXONE.h.

- + +

◆ pUsb

+
@@ -550,11 +778,13 @@ Protected Attributes

Pointer to USB class instance.

-

Definition at line 136 of file XBOXONE.h.

+

Definition at line 178 of file XBOXONE.h.

- + +

◆ bAddress

+
@@ -573,11 +803,13 @@ Protected Attributes

Device address.

-

Definition at line 138 of file XBOXONE.h.

+

Definition at line 180 of file XBOXONE.h.

- + +

◆ epInfo

+
@@ -585,7 +817,7 @@ Protected Attributes @@ -596,7 +828,82 @@ Protected Attributes

Endpoint info structure.

-

Definition at line 140 of file XBOXONE.h.

+

Definition at line 182 of file XBOXONE.h.

+ +
+ + +

◆ bConfNum

+ +
+
+
- +
EpInfo XBOXONE::epInfo[XBOX_MAX_ENDPOINTS]EpInfo XBOXONE::epInfo[XBOX_ONE_MAX_ENDPOINTS]
+ + + + +
+ + + + +
uint8_t XBOXONE::bConfNum
+
+protected
+
+

Configuration number.

+ +

Definition at line 185 of file XBOXONE.h.

+ +
+
+ +

◆ bNumEP

+ +
+
+ + + + + +
+ + + + +
uint8_t XBOXONE::bNumEP
+
+protected
+
+

Total number of endpoints in the configuration.

+ +

Definition at line 187 of file XBOXONE.h.

+ +
+
+ +

◆ qNextPollTime

+ +
+
+ + + + + +
+ + + + +
uint32_t XBOXONE::qNextPollTime
+
+protected
+
+

Next poll time based on poll interval taken from the USB descriptor.

+ +

Definition at line 189 of file XBOXONE.h.

@@ -609,7 +916,7 @@ Protected Attributes diff --git a/class_x_b_o_x_o_n_e__coll__graph.map b/class_x_b_o_x_o_n_e__coll__graph.map index d57aea04..e391c8a3 100644 --- a/class_x_b_o_x_o_n_e__coll__graph.map +++ b/class_x_b_o_x_o_n_e__coll__graph.map @@ -1,6 +1,7 @@ - - - + + + + diff --git a/class_x_b_o_x_o_n_e__coll__graph.md5 b/class_x_b_o_x_o_n_e__coll__graph.md5 index 44dc070e..11a3d6d9 100644 --- a/class_x_b_o_x_o_n_e__coll__graph.md5 +++ b/class_x_b_o_x_o_n_e__coll__graph.md5 @@ -1 +1 @@ -57bf78dcea511b3e3448e9603d73bed9 \ No newline at end of file +685a1b999dfc021cbeace7d73ca5f08c \ No newline at end of file diff --git a/class_x_b_o_x_o_n_e__coll__graph.png b/class_x_b_o_x_o_n_e__coll__graph.png index e6e06030..0f715995 100644 Binary files a/class_x_b_o_x_o_n_e__coll__graph.png and b/class_x_b_o_x_o_n_e__coll__graph.png differ diff --git a/class_x_b_o_x_o_n_e__inherit__graph.map b/class_x_b_o_x_o_n_e__inherit__graph.map index 1aee89ae..5477b12a 100644 --- a/class_x_b_o_x_o_n_e__inherit__graph.map +++ b/class_x_b_o_x_o_n_e__inherit__graph.map @@ -1,3 +1,4 @@ + diff --git a/class_x_b_o_x_o_n_e__inherit__graph.md5 b/class_x_b_o_x_o_n_e__inherit__graph.md5 index 394fccd8..3e4c3048 100644 --- a/class_x_b_o_x_o_n_e__inherit__graph.md5 +++ b/class_x_b_o_x_o_n_e__inherit__graph.md5 @@ -1 +1 @@ -7524668a9732abeee25eb125a21bda5f \ No newline at end of file +01199dc77ff7dcdfb5dccdc4b3c6381b \ No newline at end of file diff --git a/class_x_b_o_x_o_n_e__inherit__graph.png b/class_x_b_o_x_o_n_e__inherit__graph.png index d60bbc9f..06c1ed3d 100644 Binary files a/class_x_b_o_x_o_n_e__inherit__graph.png and b/class_x_b_o_x_o_n_e__inherit__graph.png differ diff --git a/class_x_b_o_x_r_e_c_v-members.html b/class_x_b_o_x_r_e_c_v-members.html index 8204172e..226160a2 100644 --- a/class_x_b_o_x_r_e_c_v-members.html +++ b/class_x_b_o_x_r_e_c_v-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

This class implements support for a Xbox Wireless receiver.

Up to four controllers can connect to one receiver, if more is needed one can use a second receiver via the USBHub class.

-

Definition at line 55 of file XBOXRECV.h.

+

Definition at line 55 of file XBOXRECV.h.

Constructor & Destructor Documentation

- + +

◆ XBOXRECV()

+
@@ -215,12 +195,14 @@ Protected Attributes -

Definition at line 25 of file XBOXRECV.cpp.

+

Definition at line 25 of file XBOXRECV.cpp.

Member Function Documentation

- + +

◆ ConfigureDevice()

+
@@ -269,11 +251,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 41 of file XBOXRECV.cpp.

+

Definition at line 41 of file XBOXRECV.cpp.

- + +

◆ Init()

+
@@ -322,11 +306,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 138 of file XBOXRECV.cpp.

+

Definition at line 138 of file XBOXRECV.cpp.

- + +

◆ Release()

+
@@ -350,11 +336,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 283 of file XBOXRECV.cpp.

+

Definition at line 283 of file XBOXRECV.cpp.

- + +

◆ Poll()

+
@@ -378,11 +366,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 293 of file XBOXRECV.cpp.

+

Definition at line 293 of file XBOXRECV.cpp.

- + +

◆ GetAddress()

+
@@ -406,11 +396,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 95 of file XBOXRECV.h.

+

Definition at line 95 of file XBOXRECV.h.

- + +

◆ isReady()

+
@@ -432,11 +424,13 @@ Protected Attributes

Used to check if the controller has been initialized.

Returns
True if it's ready.
-

Definition at line 103 of file XBOXRECV.h.

+

Definition at line 103 of file XBOXRECV.h.

- + +

◆ VIDPIDOK()

+
@@ -478,11 +472,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 113 of file XBOXRECV.h.

+

Definition at line 113 of file XBOXRECV.h.

- + +

◆ getButtonPress()

+
@@ -516,11 +512,13 @@ Protected Attributes
Returns
getButtonClick(uint8_t controller, ButtonEnum b) will return a bool, while getButtonPress(uint8_t controller, ButtonEnum b) will return a byte if reading L2 or R2.
-

Definition at line 410 of file XBOXRECV.cpp.

+

Definition at line 410 of file XBOXRECV.cpp.

- + +

◆ getButtonClick()

+
@@ -554,11 +552,13 @@ Protected Attributes
Returns
getButtonClick(uint8_t controller, ButtonEnum b) will return a bool, while getButtonPress(uint8_t controller, ButtonEnum b) will return a byte if reading L2 or R2.
-

Definition at line 418 of file XBOXRECV.cpp.

+

Definition at line 418 of file XBOXRECV.cpp.

- + +

◆ getAnalogHat()

+
@@ -590,11 +590,13 @@ Protected Attributes
Returns
Returns a signed 16-bit integer.
-

Definition at line 438 of file XBOXRECV.cpp.

+

Definition at line 438 of file XBOXRECV.cpp.

- + +

◆ disconnect()

+
@@ -614,11 +616,13 @@ Protected Attributes -

Definition at line 498 of file XBOXRECV.cpp.

+

Definition at line 498 of file XBOXRECV.cpp.

- + +

◆ setAllOff()

+
@@ -646,11 +650,13 @@ Protected Attributes -

Definition at line 153 of file XBOXRECV.h.

+

Definition at line 153 of file XBOXRECV.h.

- + +

◆ setRumbleOff()

+
@@ -678,11 +684,13 @@ Protected Attributes -

Definition at line 162 of file XBOXRECV.h.

+

Definition at line 162 of file XBOXRECV.h.

- + +

◆ setRumbleOn()

+
@@ -720,11 +728,13 @@ Protected Attributes -

Definition at line 557 of file XBOXRECV.cpp.

+

Definition at line 557 of file XBOXRECV.cpp.

- + +

◆ setLedRaw()

+
@@ -755,11 +765,13 @@ Protected Attributes -

Definition at line 507 of file XBOXRECV.cpp.

+

Definition at line 507 of file XBOXRECV.cpp.

- + +

◆ setLedOff()

+
@@ -787,11 +799,13 @@ Protected Attributes -

Definition at line 185 of file XBOXRECV.h.

+

Definition at line 185 of file XBOXRECV.h.

- + +

◆ setLedOn()

+
@@ -822,11 +836,13 @@ Protected Attributes -

Definition at line 516 of file XBOXRECV.cpp.

+

Definition at line 516 of file XBOXRECV.cpp.

- + +

◆ setLedBlink()

+
@@ -857,11 +873,13 @@ Protected Attributes -

Definition at line 523 of file XBOXRECV.cpp.

+

Definition at line 523 of file XBOXRECV.cpp.

- + +

◆ setLedMode()

+
@@ -892,11 +910,13 @@ Protected Attributes -

Definition at line 527 of file XBOXRECV.cpp.

+

Definition at line 527 of file XBOXRECV.cpp.

- + +

◆ getBatteryLevel()

+
@@ -917,11 +937,13 @@ Protected Attributes
Returns
Returns the battery level as an integer in the range of 0-3.
-

Definition at line 467 of file XBOXRECV.cpp.

+

Definition at line 467 of file XBOXRECV.cpp.

- + +

◆ buttonChanged()

+
@@ -942,11 +964,13 @@ Protected Attributes
Returns
True if a button has changed.
-

Definition at line 442 of file XBOXRECV.cpp.

+

Definition at line 442 of file XBOXRECV.cpp.

- + +

◆ attachOnInit()

+
@@ -974,12 +998,14 @@ Protected Attributes -

Definition at line 223 of file XBOXRECV.h.

+

Definition at line 223 of file XBOXRECV.h.

Member Data Documentation

- + +

◆ XboxReceiverConnected

+
@@ -990,11 +1016,13 @@ Protected Attributes

True if a wireless receiver is connected.

-

Definition at line 225 of file XBOXRECV.h.

+

Definition at line 225 of file XBOXRECV.h.

- + +

◆ Xbox360Connected

+
@@ -1005,11 +1033,13 @@ Protected Attributes

Variable used to indicate if the XBOX 360 controller is successfully connected.

-

Definition at line 231 of file XBOXRECV.h.

+

Definition at line 231 of file XBOXRECV.h.

- + +

◆ pUsb

+
@@ -1028,11 +1058,13 @@ Protected Attributes

Pointer to USB class instance.

-

Definition at line 235 of file XBOXRECV.h.

+

Definition at line 235 of file XBOXRECV.h.

- + +

◆ bAddress

+
@@ -1051,11 +1083,13 @@ Protected Attributes

Device address.

-

Definition at line 237 of file XBOXRECV.h.

+

Definition at line 237 of file XBOXRECV.h.

- + +

◆ epInfo

+
@@ -1074,7 +1108,7 @@ Protected Attributes

Endpoint info structure.

-

Definition at line 239 of file XBOXRECV.h.

+

Definition at line 239 of file XBOXRECV.h.

@@ -1087,7 +1121,7 @@ Protected Attributes diff --git a/class_x_b_o_x_r_e_c_v__coll__graph.md5 b/class_x_b_o_x_r_e_c_v__coll__graph.md5 index bb538112..d5c8e537 100644 --- a/class_x_b_o_x_r_e_c_v__coll__graph.md5 +++ b/class_x_b_o_x_r_e_c_v__coll__graph.md5 @@ -1 +1 @@ -2d7f0ed5a487b4ea4ec343e72841b2c4 \ No newline at end of file +0ca59a14f198ee4c34dfdb2ce5f86159 \ No newline at end of file diff --git a/class_x_b_o_x_r_e_c_v__coll__graph.png b/class_x_b_o_x_r_e_c_v__coll__graph.png index 6a857781..94f92c1f 100644 Binary files a/class_x_b_o_x_r_e_c_v__coll__graph.png and b/class_x_b_o_x_r_e_c_v__coll__graph.png differ diff --git a/class_x_b_o_x_r_e_c_v__inherit__graph.md5 b/class_x_b_o_x_r_e_c_v__inherit__graph.md5 index b6ad7df6..1518a1e6 100644 --- a/class_x_b_o_x_r_e_c_v__inherit__graph.md5 +++ b/class_x_b_o_x_r_e_c_v__inherit__graph.md5 @@ -1 +1 @@ -f7208ed6bda886c3efbb05f7e1cbd52d \ No newline at end of file +74130f6418584d70a67a0ea80db1eaa1 \ No newline at end of file diff --git a/class_x_b_o_x_r_e_c_v__inherit__graph.png b/class_x_b_o_x_r_e_c_v__inherit__graph.png index 856a4f08..edcb8494 100644 Binary files a/class_x_b_o_x_r_e_c_v__inherit__graph.png and b/class_x_b_o_x_r_e_c_v__inherit__graph.png differ diff --git a/class_x_b_o_x_u_s_b-members.html b/class_x_b_o_x_u_s_b-members.html index ff22878d..e5ce9dfa 100644 --- a/class_x_b_o_x_u_s_b-members.html +++ b/class_x_b_o_x_u_s_b-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + + - + - - + + + +

Detailed Description

This class implements support for a Xbox wired controller via USB.

-

Definition at line 53 of file XBOXUSB.h.

+

Definition at line 53 of file XBOXUSB.h.

Constructor & Destructor Documentation

- + +

◆ XBOXUSB()

+
@@ -206,12 +186,14 @@ Protected Attributes -

Definition at line 23 of file XBOXUSB.cpp.

+

Definition at line 23 of file XBOXUSB.cpp.

Member Function Documentation

- + +

◆ Init()

+
@@ -260,11 +242,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 39 of file XBOXUSB.cpp.

+

Definition at line 39 of file XBOXUSB.cpp.

- + +

◆ Release()

+
@@ -288,11 +272,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 224 of file XBOXUSB.cpp.

+

Definition at line 224 of file XBOXUSB.cpp.

- + +

◆ Poll()

+
@@ -316,11 +302,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 232 of file XBOXUSB.cpp.

+

Definition at line 232 of file XBOXUSB.cpp.

- + +

◆ GetAddress()

+
@@ -344,11 +332,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 85 of file XBOXUSB.h.

+

Definition at line 85 of file XBOXUSB.h.

- + +

◆ isReady()

+
@@ -370,11 +360,13 @@ Protected Attributes

Used to check if the controller has been initialized.

Returns
True if it's ready.
-

Definition at line 93 of file XBOXUSB.h.

+

Definition at line 93 of file XBOXUSB.h.

- + +

◆ VIDPIDOK()

+
@@ -416,11 +408,13 @@ Protected Attributes

Reimplemented from USBDeviceConfig.

-

Definition at line 103 of file XBOXUSB.h.

+

Definition at line 103 of file XBOXUSB.h.

- + +

◆ getButtonPress()

+
@@ -443,11 +437,13 @@ Protected Attributes
Returns
getButtonClick(ButtonEnum b) will return a bool, while getButtonPress(ButtonEnum b) will return a byte if reading L2 or R2.
-

Definition at line 283 of file XBOXUSB.cpp.

+

Definition at line 283 of file XBOXUSB.cpp.

- + +

◆ getButtonClick()

+
@@ -470,11 +466,13 @@ Protected Attributes
Returns
getButtonClick(ButtonEnum b) will return a bool, while getButtonPress(ButtonEnum b) will return a byte if reading L2 or R2.
-

Definition at line 291 of file XBOXUSB.cpp.

+

Definition at line 291 of file XBOXUSB.cpp.

- + +

◆ getAnalogHat()

+
@@ -495,11 +493,13 @@ Protected Attributes
Returns
Returns a signed 16-bit integer.
-

Definition at line 311 of file XBOXUSB.cpp.

+

Definition at line 311 of file XBOXUSB.cpp.

- + +

◆ setAllOff()

+
@@ -521,11 +521,13 @@ Protected Attributes

Turn rumble off and all the LEDs on the controller.

-

Definition at line 132 of file XBOXUSB.h.

+

Definition at line 132 of file XBOXUSB.h.

- + +

◆ setRumbleOff()

+
@@ -547,11 +549,13 @@ Protected Attributes

Turn rumble off the controller.

-

Definition at line 138 of file XBOXUSB.h.

+

Definition at line 138 of file XBOXUSB.h.

- + +

◆ setRumbleOn()

+
@@ -582,11 +586,13 @@ Protected Attributes -

Definition at line 344 of file XBOXUSB.cpp.

+

Definition at line 344 of file XBOXUSB.cpp.

- + +

◆ setLedRaw()

+
@@ -606,11 +612,13 @@ Protected Attributes -

Definition at line 321 of file XBOXUSB.cpp.

+

Definition at line 321 of file XBOXUSB.cpp.

- + +

◆ setLedOff()

+
@@ -632,11 +640,13 @@ Protected Attributes

Turn all LEDs off the controller.

-

Definition at line 156 of file XBOXUSB.h.

+

Definition at line 156 of file XBOXUSB.h.

- + +

◆ setLedOn()

+
@@ -656,11 +666,13 @@ Protected Attributes -

Definition at line 329 of file XBOXUSB.cpp.

+

Definition at line 329 of file XBOXUSB.cpp.

- + +

◆ setLedBlink()

+
@@ -680,11 +692,13 @@ Protected Attributes -

Definition at line 336 of file XBOXUSB.cpp.

+

Definition at line 336 of file XBOXUSB.cpp.

- + +

◆ setLedMode()

+
@@ -704,11 +718,13 @@ Protected Attributes -

Definition at line 340 of file XBOXUSB.cpp.

+

Definition at line 340 of file XBOXUSB.cpp.

- + +

◆ attachOnInit()

+
@@ -736,12 +752,14 @@ Protected Attributes -

Definition at line 179 of file XBOXUSB.h.

+

Definition at line 179 of file XBOXUSB.h.

Member Data Documentation

- + +

◆ Xbox360Connected

+
@@ -752,11 +770,13 @@ Protected Attributes

True if a Xbox 360 controller is connected.

-

Definition at line 181 of file XBOXUSB.h.

+

Definition at line 181 of file XBOXUSB.h.

- + +

◆ pUsb

+
@@ -775,11 +795,13 @@ Protected Attributes

Pointer to USB class instance.

-

Definition at line 189 of file XBOXUSB.h.

+

Definition at line 189 of file XBOXUSB.h.

- + +

◆ bAddress

+
@@ -798,11 +820,13 @@ Protected Attributes

Device address.

-

Definition at line 191 of file XBOXUSB.h.

+

Definition at line 191 of file XBOXUSB.h.

- + +

◆ epInfo

+
@@ -821,7 +845,7 @@ Protected Attributes

Endpoint info structure.

-

Definition at line 193 of file XBOXUSB.h.

+

Definition at line 193 of file XBOXUSB.h.

@@ -834,7 +858,7 @@ Protected Attributes diff --git a/class_x_b_o_x_u_s_b__coll__graph.md5 b/class_x_b_o_x_u_s_b__coll__graph.md5 index d2631857..4024397e 100644 --- a/class_x_b_o_x_u_s_b__coll__graph.md5 +++ b/class_x_b_o_x_u_s_b__coll__graph.md5 @@ -1 +1 @@ -654de9f0f1b78cafbc20482878c5abaf \ No newline at end of file +3faed061859104f3cc71c3486dd11752 \ No newline at end of file diff --git a/class_x_b_o_x_u_s_b__coll__graph.png b/class_x_b_o_x_u_s_b__coll__graph.png index ce00116c..60ad930e 100644 Binary files a/class_x_b_o_x_u_s_b__coll__graph.png and b/class_x_b_o_x_u_s_b__coll__graph.png differ diff --git a/class_x_b_o_x_u_s_b__inherit__graph.md5 b/class_x_b_o_x_u_s_b__inherit__graph.md5 index 816edbfb..5035c5d3 100644 --- a/class_x_b_o_x_u_s_b__inherit__graph.md5 +++ b/class_x_b_o_x_u_s_b__inherit__graph.md5 @@ -1 +1 @@ -f856eb1a72c58d28a6481d6c3bc6012d \ No newline at end of file +901d7e9b19359e5d2c53012c155e3718 \ No newline at end of file diff --git a/class_x_b_o_x_u_s_b__inherit__graph.png b/class_x_b_o_x_u_s_b__inherit__graph.png index dbcbe761..4bfcea8b 100644 Binary files a/class_x_b_o_x_u_s_b__inherit__graph.png and b/class_x_b_o_x_u_s_b__inherit__graph.png differ diff --git a/class_x_r21_b1411-members.html b/class_x_r21_b1411-members.html index dd661c36..44ff1e6f 100644 --- a/class_x_r21_b1411-members.html +++ b/class_x_r21_b1411-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)ACMvirtual enhanced_features(void)XR21B1411inlinevirtual enhanced_status(void)ACMinlinevirtual - epDataInIndexACMprotectedstatic - epDataOutIndexACMprotectedstatic - epInfoACMprotected - epInterruptInIndexACMprotectedstatic + epDataInIndexACMstatic + epDataOutIndexACMstatic + epInfoACM + epInterruptInIndexACMstatic GetAddress()ACMinlinevirtual GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM GetLineCoding(LINE_CODING *dataptr)ACM @@ -145,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_x_r21_b1411.html b/class_x_r21_b1411.html index b4ad5eb7..92f550df 100644 --- a/class_x_r21_b1411.html +++ b/class_x_r21_b1411.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: XR21B1411 Class Reference @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
Collaboration graph
- + @@ -194,6 +172,16 @@ Public Member Functions + + + + + + + + + + @@ -220,21 +208,14 @@ Additional Inherited Members - - - - - - - - -

Additional Inherited Members

- Public Attributes inherited from ACM
EpInfo epInfo [ACM_MAX_ENDPOINTS]
 
- Static Public Attributes inherited from ACM
static const uint8_t epDataInIndex = 1
 
static const uint8_t epDataOutIndex = 2
 
static const uint8_t epInterruptInIndex = 3
 
- Protected Member Functions inherited from ACM
void PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
 
 
tty_features _enhanced_status
 
EpInfo epInfo [ACM_MAX_ENDPOINTS]
 
- Static Protected Attributes inherited from ACM
static const uint8_t epDataInIndex = 1
 
static const uint8_t epDataOutIndex = 2
 
static const uint8_t epInterruptInIndex = 3
 

Detailed Description

-

Definition at line 103 of file cdc_XR21B1411.h.

+

Definition at line 103 of file cdc_XR21B1411.h.

Constructor & Destructor Documentation

- + +

◆ XR21B1411()

+
@@ -258,12 +239,14 @@ Additional Inherited Members
-

Definition at line 19 of file cdc_XR21B1411.cpp.

+

Definition at line 19 of file cdc_XR21B1411.cpp.

Member Function Documentation

- + +

◆ VIDPIDOK()

+
@@ -305,11 +288,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 115 of file cdc_XR21B1411.h.

+

Definition at line 115 of file cdc_XR21B1411.h.

- + +

◆ Init()

+
@@ -349,11 +334,13 @@ Additional Inherited Members

Reimplemented from USBDeviceConfig.

-

Definition at line 25 of file cdc_XR21B1411.cpp.

+

Definition at line 25 of file cdc_XR21B1411.cpp.

- + +

◆ enhanced_features()

+
@@ -377,11 +364,13 @@ Additional Inherited Members

Reimplemented from ACM.

-

Definition at line 121 of file cdc_XR21B1411.h.

+

Definition at line 121 of file cdc_XR21B1411.h.

- + +

◆ read_register()

+
@@ -413,11 +402,13 @@ Additional Inherited Members
-

Definition at line 132 of file cdc_XR21B1411.h.

+

Definition at line 132 of file cdc_XR21B1411.h.

- + +

◆ write_register()

+
@@ -449,11 +440,13 @@ Additional Inherited Members
-

Definition at line 136 of file cdc_XR21B1411.h.

+

Definition at line 136 of file cdc_XR21B1411.h.

- + +

◆ autoflowRTS()

+
@@ -477,11 +470,13 @@ Additional Inherited Members

Reimplemented from ACM.

-

Definition at line 145 of file cdc_XR21B1411.h.

+

Definition at line 145 of file cdc_XR21B1411.h.

- + +

◆ autoflowDSR()

+
@@ -505,11 +500,13 @@ Additional Inherited Members

Reimplemented from ACM.

-

Definition at line 176 of file cdc_XR21B1411.h.

+

Definition at line 176 of file cdc_XR21B1411.h.

- + +

◆ autoflowXON()

+
@@ -533,11 +530,13 @@ Additional Inherited Members

Reimplemented from ACM.

-

Definition at line 211 of file cdc_XR21B1411.h.

+

Definition at line 211 of file cdc_XR21B1411.h.

- + +

◆ half_duplex()

+
@@ -561,7 +560,7 @@ Additional Inherited Members

Reimplemented from ACM.

-

Definition at line 243 of file cdc_XR21B1411.h.

+

Definition at line 243 of file cdc_XR21B1411.h.

@@ -574,7 +573,7 @@ Additional Inherited Members diff --git a/class_x_r21_b1411__coll__graph.map b/class_x_r21_b1411__coll__graph.map index 130845a5..061eda89 100644 --- a/class_x_r21_b1411__coll__graph.map +++ b/class_x_r21_b1411__coll__graph.map @@ -1,5 +1,5 @@ - + diff --git a/class_x_r21_b1411__coll__graph.md5 b/class_x_r21_b1411__coll__graph.md5 index f6a09260..3553a473 100644 --- a/class_x_r21_b1411__coll__graph.md5 +++ b/class_x_r21_b1411__coll__graph.md5 @@ -1 +1 @@ -2dbccd1b011c53b5f85709ffafe012c5 \ No newline at end of file +74eb1928e681995aa3f1df1987bc06dc \ No newline at end of file diff --git a/class_x_r21_b1411__coll__graph.png b/class_x_r21_b1411__coll__graph.png index 31c6a205..faadda5a 100644 Binary files a/class_x_r21_b1411__coll__graph.png and b/class_x_r21_b1411__coll__graph.png differ diff --git a/class_x_r21_b1411__inherit__graph.md5 b/class_x_r21_b1411__inherit__graph.md5 index b61794d2..cf04dca4 100644 --- a/class_x_r21_b1411__inherit__graph.md5 +++ b/class_x_r21_b1411__inherit__graph.md5 @@ -1 +1 @@ -b90701a331346260b7eefd76bf910398 \ No newline at end of file +a23c31938e633c59322b2327db463c90 \ No newline at end of file diff --git a/class_x_r21_b1411__inherit__graph.png b/class_x_r21_b1411__inherit__graph.png index f7767365..4418a917 100644 Binary files a/class_x_r21_b1411__inherit__graph.png and b/class_x_r21_b1411__inherit__graph.png differ diff --git a/classes.html b/classes.html index 08f94aed..d563ba18 100644 --- a/classes.html +++ b/classes.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Index @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
- + - - + + + +
Class Index
-
A | B | C | E | F | H | I | K | L | M | P | R | S | T | U | W | X
+
a | b | c | e | f | h | i | k | l | m | p | r | s | t | u | w | x
- - - - - - - - - - - + + + + + + + + + + + + - - - + + - - - - - - + + + + + - - - - - - + + + +
  A  
-
CommandBlockWrapper   KBDLEDS   PS4USB   USB_HID_DESCRIPTOR   
CommandBlockWrapperBase   KeyboardReportParser   PSBuzz   USB_INTERFACE_DESCRIPTOR   
ACM   CommandStatusWrapper   
  L  
-
PSBUZZButtons   UsbConfigXtracter   
ACM_FUNC_DESCR   ConfigDescParser   PTPListParser   UsbDevice   
AddressPool   
  E  
-
LINE_CODING   
  R  
-
UsbDeviceAddress   
AddressPoolImpl   
  M  
-
USBDeviceConfig   
ADK   EpInfo   ReportDescParser   USBH_MIDI   
  B  
-
  F  
-
MainItemIOFeature   ReportDescParser2   USBHID   
MAX3421e   ReportDescParserBase   USBHub   
BASICCDB   FTDI   Max_LCD   RequestSenseResponce   USBReadParser   
BluetoothService   FTDIAsyncOper   MODIFIERKEYS   
  S  
-
  W  
+
  a  
+
CommandBlockWrapper   KBDLEDS   PS4USB   USB_DEVICE_DESCRIPTOR   
CommandBlockWrapperBase   KeyboardReportParser   PSBuzz   USB_ENDPOINT_DESCRIPTOR   
ACM   CommandStatusWrapper   
  l  
+
PSBUZZButtons   USB_HID_DESCRIPTOR   
ACM_FUNC_DESCR   ConfigDescParser   PTPListParser   USB_INTERFACE_DESCRIPTOR   
AddressPool   
  e  
+
LINE_CODING   
  r  
+
UsbConfigXtracter   
AddressPoolImpl   
  m  
+
UsbDevice   
ADK   EpInfo   ReportDescParser   UsbDeviceAddress   
  b  
+
  f  
+
MainItemIOFeature   ReportDescParser2   USBDeviceConfig   
MAX3421e   ReportDescParserBase   USBH_MIDI   
BASICCDB   FTDI   Max_LCD   RequestSenseResponce   USBHID   
BluetoothService   FTDIAsyncOper   MODIFIERKEYS   
  s  
+
USBHub   
BTD   
  h  
+
MOUSEINFO   USBReadParser   
BTHID   MouseReportParser   SETUP_PKT   
  w  
BTD   
  H  
-
MOUSEINFO   
BTHID   MouseReportParser   SETUP_PKT   WII   
BulkOnly   HexDumper   MultiByteValueParser   SinkParser   
  X  
+
BulkOnly   HexDumper   MultiByteValueParser   SinkParser   
ByteSkipper   HID_CLASS_DESCRIPTOR_LEN_AND_TYPE   MultiValueBuffer   SPi   WII   
  c  
+
HIDBoot   
  p  
+
SPP   
  x  
ByteSkipper   HID_CLASS_DESCRIPTOR_LEN_AND_TYPE   MultiValueBuffer   SPi   
  C  
-
HIDBoot   
  P  
-
SPP   XBOXOLD   
HIDComposite   
  T  
-
XBOXONE   
CALL_MGMNT_FUNC_DESCR   HidItemPrefix   PL2303   XBOXRECV   
Capacity   HIDReportParser   PS3BT   TEL_RINGER_FUNC_DESCR   XBOXUSB   
CDB10   HIDUniversal   PS3USB   
  U  
+
HIDComposite   
  t  
+
CALL_MGMNT_FUNC_DESCR   HidItemPrefix   PL2303   XBOXOLD   
Capacity   HIDReportParser   PS3BT   TEL_RINGER_FUNC_DESCR   XBOXONE   
CDB10   HIDUniversal   PS3USB   touchpadXY   XBOXRECV   
CDB12   HubDescriptor   PS4BT   tty_features   XBOXUSB   
CDB6   HubEvent   PS4Buttons   
  u  
XR21B1411   
CDB12   HubDescriptor   PS4BT   
  t  
-
CDB6   HubEvent   PS4Buttons   UniversalReportParser   
CDB_LBA32_16   
  I  
-
PS4Data   USB   touchpadXY   
CDB_LBA64_16   PS4Output   USB_CONFIGURATION_DESCRIPTOR   tty_features   
CDCAsyncOper   InquiryResponse   PS4Parser   USB_DEVICE_DESCRIPTOR   
CLASS_NOTIFICATION   
  K  
-
PS4Status   USB_ENDPOINT_DESCRIPTOR   
CDB_LBA32_16   
  i  
+
PS4Data   
CDB_LBA64_16   PS4Output   UniversalReportParser   
CDCAsyncOper   InquiryResponse   PS4Parser   USB   
CLASS_NOTIFICATION   
  k  
+
PS4Status   USB_CONFIGURATION_DESCRIPTOR   
KBDINFO   
-
A | B | C | E | F | H | I | K | L | M | P | R | S | T | U | W | X
+
a | b | c | e | f | h | i | k | l | m | p | r | s | t | u | w | x
diff --git a/confdescparser_8h.html b/confdescparser_8h.html index b09636a0..19405677 100644 --- a/confdescparser_8h.html +++ b/confdescparser_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: confdescparser.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ CP_MASK_COMPARE_CLASS

+
@@ -125,11 +107,13 @@ Macros
-

Definition at line 32 of file confdescparser.h.

+

Definition at line 39 of file confdescparser.h.

- + +

◆ CP_MASK_COMPARE_SUBCLASS

+
@@ -139,11 +123,13 @@ Macros
-

Definition at line 33 of file confdescparser.h.

+

Definition at line 40 of file confdescparser.h.

- + +

◆ CP_MASK_COMPARE_PROTOCOL

+
@@ -153,11 +139,13 @@ Macros
-

Definition at line 34 of file confdescparser.h.

+

Definition at line 41 of file confdescparser.h.

- + +

◆ CP_MASK_COMPARE_ALL

+
@@ -167,7 +155,7 @@ Macros
-

Definition at line 35 of file confdescparser.h.

+

Definition at line 42 of file confdescparser.h.

@@ -176,7 +164,7 @@ Macros diff --git a/confdescparser_8h_source.html b/confdescparser_8h_source.html index 8c707512..6edb2ee6 100644 --- a/confdescparser_8h_source.html +++ b/confdescparser_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: confdescparser.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
confdescparser.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 #if !defined(_usb_h_) || defined(__CONFDESCPARSER_H__)
18 #error "Never include confdescparser.h directly; include Usb.h instead"
19 #else
20 
21 #define __CONFDESCPARSER_H__
22 
24 public:
25  //virtual void ConfigXtract(const USB_CONFIGURATION_DESCRIPTOR *conf) = 0;
26  //virtual void InterfaceXtract(uint8_t conf, const USB_INTERFACE_DESCRIPTOR *iface) = 0;
27 
28  virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep) {
29  };
30 };
31 
32 #define CP_MASK_COMPARE_CLASS 1
33 #define CP_MASK_COMPARE_SUBCLASS 2
34 #define CP_MASK_COMPARE_PROTOCOL 4
35 #define CP_MASK_COMPARE_ALL 7
36 
37 // Configuration Descriptor Parser Class Template
38 
39 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
41  UsbConfigXtracter *theXtractor;
42  MultiValueBuffer theBuffer;
43  MultiByteValueParser valParser;
44  ByteSkipper theSkipper;
45  uint8_t varBuffer[16 /*sizeof(USB_CONFIGURATION_DESCRIPTOR)*/];
46 
47  uint8_t stateParseDescr; // ParseDescriptor state
48 
49  uint8_t dscrLen; // Descriptor length
50  uint8_t dscrType; // Descriptor type
51 
52  bool isGoodInterface; // Apropriate interface flag
53  uint8_t confValue; // Configuration value
54  uint8_t protoValue; // Protocol value
55  uint8_t ifaceNumber; // Interface number
56  uint8_t ifaceAltSet; // Interface alternate settings
57 
58  bool UseOr;
59  bool ParseDescriptor(uint8_t **pp, uint16_t *pcntdn);
60  void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc);
61 
62 public:
63 
64  void SetOR(void) {
65  UseOr = true;
66  }
68  void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset);
69 };
70 
71 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
73 theXtractor(xtractor),
74 stateParseDescr(0),
75 dscrLen(0),
76 dscrType(0),
77 UseOr(false) {
78  theBuffer.pValue = varBuffer;
79  valParser.Initialize(&theBuffer);
80  theSkipper.Initialize(&theBuffer);
81 };
82 
83 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
84 void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) {
85  uint16_t cntdn = (uint16_t)len;
86  uint8_t *p = (uint8_t*)pbuf;
87 
88  while(cntdn)
89  if(!ParseDescriptor(&p, &cntdn))
90  return;
91 }
92 
93 /* Parser for the configuration descriptor. Takes values for class, subclass, protocol fields in interface descriptor and
94  compare masks for them. When the match is found, calls EndpointXtract passing buffer containing endpoint descriptor */
95 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
97  USB_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR*>(varBuffer);
98  USB_INTERFACE_DESCRIPTOR* uid = reinterpret_cast<USB_INTERFACE_DESCRIPTOR*>(varBuffer);
99  switch(stateParseDescr) {
100  case 0:
101  theBuffer.valueSize = 2;
102  valParser.Initialize(&theBuffer);
103  stateParseDescr = 1;
104  case 1:
105  if(!valParser.Parse(pp, pcntdn))
106  return false;
107  dscrLen = *((uint8_t*)theBuffer.pValue);
108  dscrType = *((uint8_t*)theBuffer.pValue + 1);
109  stateParseDescr = 2;
110  case 2:
111  // This is a sort of hack. Assuming that two bytes are all ready in the buffer
112  // the pointer is positioned two bytes ahead in order for the rest of descriptor
113  // to be read right after the size and the type fields.
114  // This should be used carefully. varBuffer should be used directly to handle data
115  // in the buffer.
116  theBuffer.pValue = varBuffer + 2;
117  stateParseDescr = 3;
118  case 3:
119  switch(dscrType) {
121  isGoodInterface = false;
123  theBuffer.valueSize = sizeof (USB_CONFIGURATION_DESCRIPTOR) - 2;
124  break;
126  theBuffer.valueSize = sizeof (USB_ENDPOINT_DESCRIPTOR) - 2;
127  break;
128  case HID_DESCRIPTOR_HID:
129  theBuffer.valueSize = dscrLen - 2;
130  break;
131  }
132  valParser.Initialize(&theBuffer);
133  stateParseDescr = 4;
134  case 4:
135  switch(dscrType) {
137  if(!valParser.Parse(pp, pcntdn))
138  return false;
139  confValue = ucd->bConfigurationValue;
140  break;
142  if(!valParser.Parse(pp, pcntdn))
143  return false;
144  if((MASK & CP_MASK_COMPARE_CLASS) && uid->bInterfaceClass != CLASS_ID)
145  break;
146  if((MASK & CP_MASK_COMPARE_SUBCLASS) && uid->bInterfaceSubClass != SUBCLASS_ID)
147  break;
148  if(UseOr) {
149  if((!((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol)))
150  break;
151  } else {
152  if((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol != PROTOCOL_ID)
153  break;
154  }
155  isGoodInterface = true;
156  ifaceNumber = uid->bInterfaceNumber;
157  ifaceAltSet = uid->bAlternateSetting;
158  protoValue = uid->bInterfaceProtocol;
159  break;
161  if(!valParser.Parse(pp, pcntdn))
162  return false;
163  if(isGoodInterface)
164  if(theXtractor)
165  theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer);
166  break;
167  //case HID_DESCRIPTOR_HID:
168  // if (!valParser.Parse(pp, pcntdn))
169  // return false;
170  // PrintHidDescriptor((const USB_HID_DESCRIPTOR*)varBuffer);
171  // break;
172  default:
173  if(!theSkipper.Skip(pp, pcntdn, dscrLen - 2))
174  return false;
175  }
176  theBuffer.pValue = varBuffer;
177  stateParseDescr = 0;
178  }
179  return true;
180 }
181 
182 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
184  Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80);
185  Notify(PSTR("bDescLength:\t\t"), 0x80);
186  PrintHex<uint8_t > (pDesc->bLength, 0x80);
187 
188  Notify(PSTR("\r\nbDescriptorType:\t"), 0x80);
189  PrintHex<uint8_t > (pDesc->bDescriptorType, 0x80);
190 
191  Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80);
192  PrintHex<uint16_t > (pDesc->bcdHID, 0x80);
193 
194  Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80);
195  PrintHex<uint8_t > (pDesc->bCountryCode, 0x80);
196 
197  Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80);
198  PrintHex<uint8_t > (pDesc->bNumDescriptors, 0x80);
199 
200  for(uint8_t i = 0; i < pDesc->bNumDescriptors; i++) {
202 
203  Notify(PSTR("\r\nbDescrType:\t\t"), 0x80);
204  PrintHex<uint8_t > (pLT[i].bDescrType, 0x80);
205 
206  Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80);
207  PrintHex<uint16_t > (pLT[i].wDescriptorLength, 0x80);
208  }
209  Notify(PSTR("\r\n"), 0x80);
210 }
211 
212 
213 #endif // __CONFDESCPARSER_H__
#define CP_MASK_COMPARE_PROTOCOL
- -
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
- - - - -
#define USB_DESCRIPTOR_ENDPOINT
Definition: usb_ch9.h:67
-
uint8_t bLength
Definition: usb_ch9.h:152
- -
void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset)
-
#define CP_MASK_COMPARE_CLASS
- - -
#define USB_DESCRIPTOR_CONFIGURATION
Definition: usb_ch9.h:64
-
#define Notify(...)
Definition: message.h:44
- - - - -
bool Skip(uint8_t **pp, uint16_t *pcntdn, uint16_t bytes_to_skip)
Definition: parsetools.h:65
-
void Initialize(MultiValueBuffer *pbuf)
Definition: parsetools.h:60
-
uint8_t bCountryCode
Definition: usb_ch9.h:155
- -
#define CP_MASK_COMPARE_SUBCLASS
-
void SetOR(void)
-
uint8_t bNumDescriptors
Definition: usb_ch9.h:156
-
bool Parse(uint8_t **pp, uint16_t *pcntdn)
Definition: parsetools.cpp:19
- -
uint8_t bDescriptorType
Definition: usb_ch9.h:153
-
#define PSTR(str)
- -
#define HID_DESCRIPTOR_HID
Definition: usb_ch9.h:73
-
uint8_t valueSize
Definition: parsetools.h:24
- - -
ConfigDescParser(UsbConfigXtracter *xtractor)
-
void Initialize(MultiValueBuffer *const pbuf)
Definition: parsetools.h:42
-
uint8_t bInterfaceSubClass
Definition: usb_ch9.h:135
- -
uint16_t bcdHID
Definition: usb_ch9.h:154
-
uint8_t bInterfaceProtocol
Definition: usb_ch9.h:136
-
uint8_t bDescrType
Definition: usb_ch9.h:157
-
#define USB_DESCRIPTOR_INTERFACE
Definition: usb_ch9.h:66
+Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 Contact information
18 -------------------
19 
20 Circuits At Home, LTD
21 Web : http://www.circuitsathome.com
22 e-mail : support@circuitsathome.com
23  */
24 #if !defined(_usb_h_) || defined(__CONFDESCPARSER_H__)
25 #error "Never include confdescparser.h directly; include Usb.h instead"
26 #else
27 
28 #define __CONFDESCPARSER_H__
29 
31 public:
32  //virtual void ConfigXtract(const USB_CONFIGURATION_DESCRIPTOR *conf) = 0;
33  //virtual void InterfaceXtract(uint8_t conf, const USB_INTERFACE_DESCRIPTOR *iface) = 0;
34 
35  virtual void EndpointXtract(uint8_t conf __attribute__((unused)), uint8_t iface __attribute__((unused)), uint8_t alt __attribute__((unused)), uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *ep __attribute__((unused))) {
36  };
37 };
38 
39 #define CP_MASK_COMPARE_CLASS 1
40 #define CP_MASK_COMPARE_SUBCLASS 2
41 #define CP_MASK_COMPARE_PROTOCOL 4
42 #define CP_MASK_COMPARE_ALL 7
43 
44 // Configuration Descriptor Parser Class Template
45 
46 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
48  UsbConfigXtracter *theXtractor;
49  MultiValueBuffer theBuffer;
50  MultiByteValueParser valParser;
51  ByteSkipper theSkipper;
52  uint8_t varBuffer[16 /*sizeof(USB_CONFIGURATION_DESCRIPTOR)*/];
53 
54  uint8_t stateParseDescr; // ParseDescriptor state
55 
56  uint8_t dscrLen; // Descriptor length
57  uint8_t dscrType; // Descriptor type
58 
59  bool isGoodInterface; // Apropriate interface flag
60  uint8_t confValue; // Configuration value
61  uint8_t protoValue; // Protocol value
62  uint8_t ifaceNumber; // Interface number
63  uint8_t ifaceAltSet; // Interface alternate settings
64 
65  bool UseOr;
66  bool ParseDescriptor(uint8_t **pp, uint16_t *pcntdn);
67  void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc);
68 
69 public:
70 
71  void SetOR(void) {
72  UseOr = true;
73  }
75  void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset);
76 };
77 
78 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
80 theXtractor(xtractor),
81 stateParseDescr(0),
82 dscrLen(0),
83 dscrType(0),
84 UseOr(false) {
85  theBuffer.pValue = varBuffer;
86  valParser.Initialize(&theBuffer);
87  theSkipper.Initialize(&theBuffer);
88 };
89 
90 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
91 void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset __attribute__((unused))) {
92  uint16_t cntdn = (uint16_t)len;
93  uint8_t *p = (uint8_t*)pbuf;
94 
95  while(cntdn)
96  if(!ParseDescriptor(&p, &cntdn))
97  return;
98 }
99 
100 /* Parser for the configuration descriptor. Takes values for class, subclass, protocol fields in interface descriptor and
101  compare masks for them. When the match is found, calls EndpointXtract passing buffer containing endpoint descriptor */
102 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
104  USB_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR*>(varBuffer);
105  USB_INTERFACE_DESCRIPTOR* uid = reinterpret_cast<USB_INTERFACE_DESCRIPTOR*>(varBuffer);
106  switch(stateParseDescr) {
107  case 0:
108  theBuffer.valueSize = 2;
109  valParser.Initialize(&theBuffer);
110  stateParseDescr = 1;
111  case 1:
112  if(!valParser.Parse(pp, pcntdn))
113  return false;
114  dscrLen = *((uint8_t*)theBuffer.pValue);
115  dscrType = *((uint8_t*)theBuffer.pValue + 1);
116  stateParseDescr = 2;
117  case 2:
118  // This is a sort of hack. Assuming that two bytes are all ready in the buffer
119  // the pointer is positioned two bytes ahead in order for the rest of descriptor
120  // to be read right after the size and the type fields.
121  // This should be used carefully. varBuffer should be used directly to handle data
122  // in the buffer.
123  theBuffer.pValue = varBuffer + 2;
124  stateParseDescr = 3;
125  case 3:
126  switch(dscrType) {
128  isGoodInterface = false;
129  break;
132  case HID_DESCRIPTOR_HID:
133  break;
134  }
135  theBuffer.valueSize = dscrLen - 2;
136  valParser.Initialize(&theBuffer);
137  stateParseDescr = 4;
138  case 4:
139  switch(dscrType) {
141  if(!valParser.Parse(pp, pcntdn))
142  return false;
143  confValue = ucd->bConfigurationValue;
144  break;
146  if(!valParser.Parse(pp, pcntdn))
147  return false;
148  if((MASK & CP_MASK_COMPARE_CLASS) && uid->bInterfaceClass != CLASS_ID)
149  break;
150  if((MASK & CP_MASK_COMPARE_SUBCLASS) && uid->bInterfaceSubClass != SUBCLASS_ID)
151  break;
152  if(UseOr) {
153  if((!((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol)))
154  break;
155  } else {
156  if((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol != PROTOCOL_ID)
157  break;
158  }
159  isGoodInterface = true;
160  ifaceNumber = uid->bInterfaceNumber;
161  ifaceAltSet = uid->bAlternateSetting;
162  protoValue = uid->bInterfaceProtocol;
163  break;
165  if(!valParser.Parse(pp, pcntdn))
166  return false;
167  if(isGoodInterface)
168  if(theXtractor)
169  theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer);
170  break;
171  //case HID_DESCRIPTOR_HID:
172  // if (!valParser.Parse(pp, pcntdn))
173  // return false;
174  // PrintHidDescriptor((const USB_HID_DESCRIPTOR*)varBuffer);
175  // break;
176  default:
177  if(!theSkipper.Skip(pp, pcntdn, dscrLen - 2))
178  return false;
179  }
180  theBuffer.pValue = varBuffer;
181  stateParseDescr = 0;
182  }
183  return true;
184 }
185 
186 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
188  Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80);
189  Notify(PSTR("bDescLength:\t\t"), 0x80);
190  PrintHex<uint8_t > (pDesc->bLength, 0x80);
191 
192  Notify(PSTR("\r\nbDescriptorType:\t"), 0x80);
193  PrintHex<uint8_t > (pDesc->bDescriptorType, 0x80);
194 
195  Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80);
196  PrintHex<uint16_t > (pDesc->bcdHID, 0x80);
197 
198  Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80);
199  PrintHex<uint8_t > (pDesc->bCountryCode, 0x80);
200 
201  Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80);
202  PrintHex<uint8_t > (pDesc->bNumDescriptors, 0x80);
203 
204  for(uint8_t i = 0; i < pDesc->bNumDescriptors; i++) {
206 
207  Notify(PSTR("\r\nbDescrType:\t\t"), 0x80);
208  PrintHex<uint8_t > (pLT[i].bDescrType, 0x80);
209 
210  Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80);
211  PrintHex<uint16_t > (pLT[i].wDescriptorLength, 0x80);
212  }
213  Notify(PSTR("\r\n"), 0x80);
214 }
215 
216 
217 #endif // __CONFDESCPARSER_H__
#define CP_MASK_COMPARE_PROTOCOL
+ +
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
+ + + + +
#define USB_DESCRIPTOR_ENDPOINT
Definition: usb_ch9.h:74
+
uint8_t bLength
Definition: usb_ch9.h:159
+ +
void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset)
+
#define CP_MASK_COMPARE_CLASS
+ + +
#define USB_DESCRIPTOR_CONFIGURATION
Definition: usb_ch9.h:71
+
#define Notify(...)
Definition: message.h:51
+ + + + +
void Initialize(MultiValueBuffer *pbuf)
Definition: parsetools.h:67
+
uint8_t bCountryCode
Definition: usb_ch9.h:162
+ +
#define CP_MASK_COMPARE_SUBCLASS
+
void SetOR(void)
+
uint8_t bNumDescriptors
Definition: usb_ch9.h:163
+ +
uint8_t bDescriptorType
Definition: usb_ch9.h:160
+
#define PSTR(str)
+ +
#define HID_DESCRIPTOR_HID
Definition: usb_ch9.h:80
+ + +
ConfigDescParser(UsbConfigXtracter *xtractor)
+
void Initialize(MultiValueBuffer *const pbuf)
Definition: parsetools.h:49
+
uint8_t bInterfaceSubClass
Definition: usb_ch9.h:142
+ +
uint16_t bcdHID
Definition: usb_ch9.h:161
+
uint8_t bInterfaceProtocol
Definition: usb_ch9.h:143
+
uint8_t bDescrType
Definition: usb_ch9.h:164
+
#define USB_DESCRIPTOR_INTERFACE
Definition: usb_ch9.h:73
diff --git a/controller_enums_8h.html b/controller_enums_8h.html index e9f48667..bd5767bd 100644 --- a/controller_enums_8h.html +++ b/controller_enums_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: controllerEnums.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- + - + @@ -260,7 +240,9 @@ Enumerations  

Enumeration Type Documentation

- + +

◆ LEDEnum

+
@@ -271,38 +253,28 @@ Enumerations

This header file is used to store different enums for the controllers, This is necessary so all the different libraries can be used at once.Enum used to turn on the LEDs on the different controllers.

- - - - - - - - - - - - + + + + + + + + + + +
Enumerator
OFF  -
LED1  -
LED2  -
LED3  -
LED4  -
LED5  -
LED6  -
LED7  -
LED8  -
LED9  -
LED10  -
ALL  -

Used to blink all LEDs on the Xbox controller

+
Enumerator
OFF 
LED1 
LED2 
LED3 
LED4 
LED5 
LED6 
LED7 
LED8 
LED9 
LED10 
ALL 

Used to blink all LEDs on the Xbox controller

-

Definition at line 27 of file controllerEnums.h.

+

Definition at line 31 of file controllerEnums.h.

- + +

◆ ColorsEnum

+
@@ -313,39 +285,32 @@ Enumerations

Used to set the colors of the Move and PS4 controller.

- - - - - - - + - -
Enumerator
Red  -

r = 255, g = 0, b = 0

+
Enumerator
Red 

r = 255, g = 0, b = 0

Green  -

r = 0, g = 255, b = 0

+
Green 

r = 0, g = 255, b = 0

Blue  -

r = 0, g = 0, b = 255

+
Blue 

r = 0, g = 0, b = 255

Yellow  -

r = 255, g = 235, b = 4

+
Yellow 

r = 255, g = 235, b = 4

Lightblue  -

r = 0, g = 255, b = 255

+
Lightblue 

r = 0, g = 255, b = 255

Purple  -

r = 255, g = 0, b = 255

+
Purple 

r = 255, g = 0, b = 255

Purble  +
Purble 
White 

r = 255, g = 255, b = 255

White  -

r = 255, g = 255, b = 255

-
Off  -

r = 0, g = 0, b = 0

+
Off 

r = 0, g = 0, b = 0

-

Definition at line 46 of file controllerEnums.h.

+

Definition at line 50 of file controllerEnums.h.

- + +

◆ RumbleEnum

+
@@ -355,17 +320,17 @@ Enumerations
- - + +
Enumerator
RumbleHigh  -
RumbleLow  -
Enumerator
RumbleHigh 
RumbleLow 
-

Definition at line 68 of file controllerEnums.h.

+

Definition at line 72 of file controllerEnums.h.

- + +

◆ ButtonEnum

+
@@ -376,148 +341,103 @@ Enumerations

This enum is used to read all the different buttons on the different controllers

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - + + + +
Enumerator
UP  -

These buttons are available on all the the controllers

+
Enumerator
UP 

These buttons are available on all the the controllers

RIGHT  -

These buttons are available on all the the controllers

+
RIGHT 

These buttons are available on all the the controllers

DOWN  -

These buttons are available on all the the controllers

+
DOWN 

These buttons are available on all the the controllers

LEFT  -

These buttons are available on all the the controllers

+
LEFT 

These buttons are available on all the the controllers

PLUS  -

Wii buttons

+
PLUS 

Wii buttons

TWO  -

Wii buttons

+
TWO 

Wii buttons

ONE  -

Wii buttons

+
ONE 

Wii buttons

MINUS  -

Wii buttons

+
MINUS 

Wii buttons

HOME  -

Wii buttons

+
HOME 

Wii buttons

-

Wii buttons

+

Wii buttons

-

Wii buttons

+

Wii buttons

-

Wii buttons

+

Wii buttons

-

Wii buttons

+

Wii buttons

-

These are only available on the Wii U Pro Controller

+

These are only available on the Wii U Pro Controller

-

These are only available on the Wii U Pro Controller

+

These are only available on the Wii U Pro Controller

ZL  -

These are only available on the Wii U Pro Controller

+
ZL 

These are only available on the Wii U Pro Controller

ZR  -

These are only available on the Wii U Pro Controller

+
ZR 

These are only available on the Wii U Pro Controller

SELECT  -

PS3 controllers buttons

+
SELECT 

PS3 controllers buttons

START  -

PS3 controllers buttons

+
START 

PS3 controllers buttons

L3  -

PS3 controllers buttons

+
L3 

PS3 controllers buttons

R3  -

PS3 controllers buttons

+
R3 

PS3 controllers buttons

L2  -

PS3 controllers buttons

+
L2 

PS3 controllers buttons

R2  -

PS3 controllers buttons

+
R2 

PS3 controllers buttons

L1  -

PS3 controllers buttons

+
L1 

PS3 controllers buttons

R1  -

PS3 controllers buttons

+
R1 

PS3 controllers buttons

TRIANGLE  -

PS3 controllers buttons

+
TRIANGLE 

PS3 controllers buttons

CIRCLE  -

PS3 controllers buttons

+
CIRCLE 

PS3 controllers buttons

CROSS  -

PS3 controllers buttons

+
CROSS 

PS3 controllers buttons

SQUARE  -

PS3 controllers buttons

+
SQUARE 

PS3 controllers buttons

PS  -

PS3 controllers buttons

+
PS 

PS3 controllers buttons

MOVE  -

PS3 controllers buttons

+
MOVE 

PS3 controllers buttons

-

PS3 controllers buttons

+

PS3 controllers buttons

SHARE  -

PS4 controllers buttons - SHARE and OPTIONS are present instead of SELECT and START

+
SHARE 

PS4 controllers buttons - SHARE and OPTIONS are present instead of SELECT and START

OPTIONS  +
OPTIONS 
TOUCHPAD 
BACK 

Xbox buttons

TOUCHPAD  +

Xbox buttons

BACK  -

Xbox buttons

+

Xbox buttons

-

Xbox buttons

+
XBOX 

Xbox buttons

-

Xbox buttons

+
SYNC 

Xbox buttons

XBOX  -

Xbox buttons

+
BLACK 

Xbox buttons

SYNC  -

Xbox buttons

+
WHITE 

Xbox buttons

BLACK  -

Xbox buttons

-
WHITE  -

Xbox buttons

-
RED  -

PS Buzz controllers

-
YELLOW  -
GREEN  -
ORANGE  -
BLUE  +
RED 

PS Buzz controllers

YELLOW 
GREEN 
ORANGE 
BLUE 
-

Definition at line 74 of file controllerEnums.h.

+

Definition at line 78 of file controllerEnums.h.

- + +

◆ AnalogHatEnum

+
@@ -528,25 +448,23 @@ Enumerations

Joysticks on the PS3 and Xbox controllers.

- - - -
Enumerator
LeftHatX  -

Left joystick x-axis

+
Enumerator
LeftHatX 

Left joystick x-axis

LeftHatY  -

Left joystick y-axis

+
LeftHatY 

Left joystick y-axis

RightHatX  -

Right joystick x-axis

+
RightHatX 

Right joystick x-axis

RightHatY  -

Right joystick y-axis

+
RightHatY 

Right joystick y-axis

-

Definition at line 153 of file controllerEnums.h.

+

Definition at line 157 of file controllerEnums.h.

- + +

◆ SensorEnum

+
@@ -557,57 +475,43 @@ Enumerations

Sensors inside the Sixaxis Dualshock 3, Move controller and PS4 controller. Note: that the location is shifted 9 when it's connected via USB on the PS3 controller.

- - + + - + + - - - - - - - - - - - - -
Enumerator
aX  -

Accelerometer values

+
Enumerator
aX 

Accelerometer values

aY  +
aY 
aZ 
gZ 

Gyro z-axis

aZ  +
gX 
gY 
aXmove 

Accelerometer x-axis

gZ  -

Gyro z-axis

+
aZmove 

Accelerometer z-axis

gX  +
aYmove 

Accelerometer y-axis

gY  +
gXmove 

Gyro x-axis

aXmove  -

Accelerometer x-axis

+
gZmove 

Gyro z-axis

aZmove  -

Accelerometer z-axis

+
gYmove 

Gyro y-axis

aYmove  -

Accelerometer y-axis

+
tempMove 

Temperature sensor

gXmove  -

Gyro x-axis

+
mXmove 

Magnetometer x-axis

gZmove  -

Gyro z-axis

+
mZmove 

Magnetometer z-axis

gYmove  -

Gyro y-axis

-
tempMove  -

Temperature sensor

-
mXmove  -

Magnetometer x-axis

-
mZmove  -

Magnetometer z-axis

-
mYmove  -

Magnetometer y-axis

+
mYmove 

Magnetometer y-axis

-

Definition at line 168 of file controllerEnums.h.

+

Definition at line 172 of file controllerEnums.h.

- + +

◆ AngleEnum

+
@@ -618,13 +522,11 @@ Enumerations

Used to get the angle calculated using the PS3 controller and PS4 controller.

- - + +
Enumerator
Pitch  -
Roll  -
Enumerator
Pitch 
Roll 
-

Definition at line 201 of file controllerEnums.h.

+

Definition at line 205 of file controllerEnums.h.

@@ -633,7 +535,7 @@ Enumerations diff --git a/controller_enums_8h__dep__incl.map b/controller_enums_8h__dep__incl.map index 00c525a3..91d38ced 100644 --- a/controller_enums_8h__dep__incl.map +++ b/controller_enums_8h__dep__incl.map @@ -2,10 +2,10 @@ - + - + diff --git a/controller_enums_8h__dep__incl.png b/controller_enums_8h__dep__incl.png index 539588fa..a25d8320 100644 Binary files a/controller_enums_8h__dep__incl.png and b/controller_enums_8h__dep__incl.png differ diff --git a/controller_enums_8h_source.html b/controller_enums_8h_source.html index 03eeb4e8..b12982dd 100644 --- a/controller_enums_8h_source.html +++ b/controller_enums_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: controllerEnums.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
controllerEnums.h
-Go to the documentation of this file.
1 /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _controllerenums_h
19 #define _controllerenums_h
20 
27 enum LEDEnum {
28  OFF = 0,
29 #ifndef RBL_NRF51822
30  LED1 = 1,
31  LED2 = 2,
32  LED3 = 3,
33  LED4 = 4,
34 #endif
35  LED5 = 5,
36  LED6 = 6,
37  LED7 = 7,
38  LED8 = 8,
39  LED9 = 9,
40  LED10 = 10,
42  ALL = 5,
43 };
44 
46 enum ColorsEnum {
48  Red = 0xFF0000,
50  Green = 0xFF00,
52  Blue = 0xFF,
53 
55  Yellow = 0xFFEB04,
57  Lightblue = 0xFFFF,
59  Purple = 0xFF00FF,
60  Purble = 0xFF00FF,
61 
63  White = 0xFFFFFF,
65  Off = 0x00,
66 };
67 
68 enum RumbleEnum {
69  RumbleHigh = 0x10,
70  RumbleLow = 0x20,
71 };
72 
74 enum ButtonEnum {
77  UP = 0,
78  RIGHT = 1,
79  DOWN = 2,
80  LEFT = 3,
85  PLUS = 5,
86  TWO = 6,
87  ONE = 7,
88  MINUS = 8,
89  HOME = 9,
90  Z = 10,
91  C = 11,
92  B = 12,
93  A = 13,
98  L = 16,
99  R = 17,
100  ZL = 18,
101  ZR = 19,
106  SELECT = 4,
107  START = 5,
108  L3 = 6,
109  R3 = 7,
110 
111  L2 = 8,
112  R2 = 9,
113  L1 = 10,
114  R1 = 11,
115  TRIANGLE = 12,
116  CIRCLE = 13,
117  CROSS = 14,
118  SQUARE = 15,
119 
120  PS = 16,
121 
122  MOVE = 17, // Covers 12 bits - we only need to read the top 8
123  T = 18, // Covers 12 bits - we only need to read the top 8
127  SHARE = 4,
128  OPTIONS = 5,
129  TOUCHPAD = 17,
134  BACK = 4,
135  X = 14,
136  Y = 15,
137  XBOX = 16,
138  SYNC = 17,
139  BLACK = 8, // Available on the original Xbox controller
140  WHITE = 9, // Available on the original Xbox controller
144  RED = 0,
145  YELLOW = 1,
146  GREEN = 2,
147  ORANGE = 3,
148  BLUE = 4,
150 };
151 
155  LeftHatX = 0,
157  LeftHatY = 1,
162 };
163 
170  aX = 50, aY = 52, aZ = 54,
172  gZ = 56,
173  gX, gY, // These are not available on the PS3 controller
174 
176  aXmove = 28,
178  aZmove = 30,
180  aYmove = 32,
181 
183  gXmove = 40,
185  gZmove = 42,
187  gYmove = 44,
188 
190  tempMove = 46,
191 
193  mXmove = 47,
195  mZmove = 49,
197  mYmove = 50,
198 };
199 
201 enum AngleEnum {
202  Pitch = 0x01,
203  Roll = 0x02,
204 };
205 
206 #endif
- - - - - - - - - - - - - - -
AnalogHatEnum
- - - - - - - - - - - - - -
LEDEnum
- - - - -
RumbleEnum
- - - - - - - - - - - - -
ButtonEnum
- - - - - - - - - - - - - - - -
ColorsEnum
- - - - -
AngleEnum
- - - - - - - - - - - - - - - - - - - - -
SensorEnum
- - - - - - - - - +Go to the documentation of this file.
1 /* Copyright (C) 2013 Kristian Lauszus, TKJ Electronics. 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  Kristian Lauszus, TKJ Electronics
14  Web : http://www.tkjelectronics.com
15  e-mail : kristianl@tkjelectronics.com
16  */
17 
18 #ifndef _controllerenums_h
19 #define _controllerenums_h
20 
21 #if defined(ESP32)
22 #undef PS
23 #endif
24 
31 enum LEDEnum {
32  OFF = 0,
33 #ifndef RBL_NRF51822
34  LED1 = 1,
35  LED2 = 2,
36  LED3 = 3,
37  LED4 = 4,
38 #endif
39  LED5 = 5,
40  LED6 = 6,
41  LED7 = 7,
42  LED8 = 8,
43  LED9 = 9,
44  LED10 = 10,
46  ALL = 5,
47 };
48 
50 enum ColorsEnum {
52  Red = 0xFF0000,
54  Green = 0xFF00,
56  Blue = 0xFF,
57 
59  Yellow = 0xFFEB04,
61  Lightblue = 0xFFFF,
63  Purple = 0xFF00FF,
64  Purble = 0xFF00FF,
65 
67  White = 0xFFFFFF,
69  Off = 0x00,
70 };
71 
72 enum RumbleEnum {
73  RumbleHigh = 0x10,
74  RumbleLow = 0x20,
75 };
76 
78 enum ButtonEnum {
81  UP = 0,
82  RIGHT = 1,
83  DOWN = 2,
84  LEFT = 3,
89  PLUS = 5,
90  TWO = 6,
91  ONE = 7,
92  MINUS = 8,
93  HOME = 9,
94  Z = 10,
95  C = 11,
96  B = 12,
97  A = 13,
102  L = 16,
103  R = 17,
104  ZL = 18,
105  ZR = 19,
110  SELECT = 4,
111  START = 5,
112  L3 = 6,
113  R3 = 7,
114 
115  L2 = 8,
116  R2 = 9,
117  L1 = 10,
118  R1 = 11,
119  TRIANGLE = 12,
120  CIRCLE = 13,
121  CROSS = 14,
122  SQUARE = 15,
123 
124  PS = 16,
125 
126  MOVE = 17, // Covers 12 bits - we only need to read the top 8
127  T = 18, // Covers 12 bits - we only need to read the top 8
131  SHARE = 4,
132  OPTIONS = 5,
133  TOUCHPAD = 17,
138  BACK = 4,
139  X = 14,
140  Y = 15,
141  XBOX = 16,
142  SYNC = 17,
143  BLACK = 8, // Available on the original Xbox controller
144  WHITE = 9, // Available on the original Xbox controller
148  RED = 0,
149  YELLOW = 1,
150  GREEN = 2,
151  ORANGE = 3,
152  BLUE = 4,
154 };
155 
159  LeftHatX = 0,
161  LeftHatY = 1,
166 };
167 
174  aX = 50, aY = 52, aZ = 54,
176  gZ = 56,
177  gX, gY, // These are not available on the PS3 controller
178 
180  aXmove = 28,
182  aZmove = 30,
184  aYmove = 32,
185 
187  gXmove = 40,
189  gZmove = 42,
191  gYmove = 44,
192 
194  tempMove = 46,
195 
197  mXmove = 47,
199  mZmove = 49,
201  mYmove = 50,
202 };
203 
205 enum AngleEnum {
206  Pitch = 0x01,
207  Roll = 0x02,
208 };
209 
210 #endif
+ + + + + + + + + + + + + + +
AnalogHatEnum
+ + + + + + + + + + + + + +
LEDEnum
+ + + + +
RumbleEnum
+ + + + + + + + + + + + +
ButtonEnum
+ + + + + + + + + + + + + + + +
ColorsEnum
+ + + + +
AngleEnum
+ + + + + + + + + + + + + + + + + + + + +
SensorEnum
+ + + + + + + + +
diff --git a/dir_69161428018e52ad84691a5947f27cc9.html b/dir_69161428018e52ad84691a5947f27cc9.html index 544be4c4..e05cc768 100644 --- a/dir_69161428018e52ad84691a5947f27cc9.html +++ b/dir_69161428018e52ad84691a5947f27cc9.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Github Directory Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/dir_ee762931928e29ae94e054d18c99dc9e.html b/dir_ee762931928e29ae94e054d18c99dc9e.html index 832210da..c359673e 100644 --- a/dir_ee762931928e29ae94e054d18c99dc9e.html +++ b/dir_ee762931928e29ae94e054d18c99dc9e.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: USB_Host_Shield_2_0 Directory Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/doxygen.css b/doxygen.css index 1425ec53..266c8b3a 100644 --- a/doxygen.css +++ b/doxygen.css @@ -1,9 +1,13 @@ -/* The standard CSS for doxygen 1.8.11 */ +/* The standard CSS for doxygen 1.8.14 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; } +p.reference, p.definition { + font: 400 14px/22px Roboto,sans-serif; +} + /* @group Heading Levels */ h1.groupheader { @@ -173,7 +177,7 @@ pre.fragment { } div.fragment { - padding: 4px 6px; + padding: 0px; margin: 4px 8px 4px 2px; background-color: #FBFCFD; border: 1px solid #C4CFE5; @@ -232,6 +236,15 @@ span.lineno a:hover { background-color: #C8C8C8; } +.lineno { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + div.ah, span.ah { background-color: black; font-weight: bold; @@ -501,6 +514,29 @@ table.memberdecls { /* Styles for detailed member documentation */ +.memtitle { + padding: 8px; + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + margin-bottom: -1px; + background-image: url('nav_f.png'); + background-repeat: repeat-x; + background-color: #E2E8F2; + line-height: 1.25; + font-weight: 300; + float:left; +} + +.permalink +{ + font-size: 65%; + display: inline-block; + vertical-align: middle; +} + .memtemplate { font-size: 80%; color: #4665A2; @@ -539,7 +575,7 @@ table.memberdecls { } .memname { - font-weight: bold; + font-weight: 400; margin-left: 6px; } @@ -555,24 +591,24 @@ table.memberdecls { color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); - background-image:url('nav_f.png'); - background-repeat:repeat-x; - background-color: #E2E8F2; + background-color: #DFE5F1; /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 4px; - border-top-left-radius: 4px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 4px; - -moz-border-radius-topleft: 4px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 4px; - -webkit-border-top-left-radius: 4px; } +.overload { + font-family: "courier new",courier,monospace; + font-size: 65%; +} + .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; @@ -914,6 +950,7 @@ table.fieldtable { padding-bottom: 4px; padding-top: 5px; text-align:left; + font-weight: 400; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; @@ -1178,6 +1215,11 @@ dl.section dd { text-align: center; } +.plantumlgraph +{ + text-align: center; +} + .diagraph { text-align: center; @@ -1473,3 +1515,82 @@ tr.heading h2 { } } +/* @group Markdown */ + +/* +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.markdownTableHead tr { +} + +table.markdownTableBodyLeft td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th.markdownTableHeadNone { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft { + text-align: left +} + +th.markdownTableHeadRight { + text-align: right +} + +th.markdownTableHeadCenter { + text-align: center +} +*/ + +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.markdownTable tr { +} + +th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft, td.markdownTableBodyLeft { + text-align: left +} + +th.markdownTableHeadRight, td.markdownTableBodyRight { + text-align: right +} + +th.markdownTableHeadCenter, td.markdownTableBodyCenter { + text-align: center +} + + +/* @end */ diff --git a/dynsections.js b/dynsections.js index 1e6bf07f..537e3e49 100644 --- a/dynsections.js +++ b/dynsections.js @@ -1,3 +1,26 @@ +/* + @licstart The following is the entire license notice for the + JavaScript code in this file. + + Copyright (C) 1997-2017 by Dimitri van Heesch + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + @licend The above is the entire license notice + for the JavaScript code in this file + */ function toggleVisibility(linkObj) { var base = $(linkObj).attr('id'); @@ -15,7 +38,7 @@ function toggleVisibility(linkObj) summary.hide(); $(linkObj).removeClass('closed').addClass('opened'); $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); - } + } return false; } @@ -37,7 +60,7 @@ function toggleLevel(level) $(this).show(); } else if (l==level+1) { i.removeClass('iconfclosed iconfopen').addClass('iconfclosed'); - a.html('►'); + a.html('▶'); $(this).show(); } else { $(this).hide(); @@ -64,7 +87,7 @@ function toggleFolder(id) // replace down arrow by right arrow for current row var currentRowSpans = currentRow.find("span"); currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed"); - currentRowSpans.filter(".arrow").html('►'); + currentRowSpans.filter(".arrow").html('▶'); rows.filter("[id^=row_"+id+"]").hide(); // hide all children } else { // we are SHOWING // replace right arrow by down arrow for current row @@ -74,7 +97,7 @@ function toggleFolder(id) // replace down arrows by right arrows for child rows var childRowsSpans = childRows.find("span"); childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed"); - childRowsSpans.filter(".arrow").html('►'); + childRowsSpans.filter(".arrow").html('▶'); childRows.show(); //show all children } updateStripes(); @@ -94,7 +117,7 @@ function toggleInherit(id) $(img).attr('src',src.substring(0,src.length-10)+'open.png'); } } - +/* @license-end */ $(document).ready(function() { $('.code,.codeRef').each(function() { diff --git a/files.html b/files.html index 67ff7e08..959b1da9 100644 --- a/files.html +++ b/files.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: File List @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- _ -

    +

    - _ -

    • _enhanced_status : ACM
    • @@ -135,7 +74,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_a.html b/functions_a.html index 64860fc6..29bda365 100644 --- a/functions_a.html +++ b/functions_a.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members @@ -11,9 +12,6 @@ - @@ -32,81 +30,22 @@
- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- a -

    +

    - a -

    • A_M_L_LB : CDB_LBA32_16
    • @@ -284,7 +223,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_b.html b/functions_b.html index b8117f57..3b8b2cc8 100644 --- a/functions_b.html +++ b/functions_b.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members @@ -11,9 +12,6 @@ - @@ -32,81 +30,22 @@
- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- b -

    +

    - b -

    • b : PS4Output
    • @@ -178,6 +117,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , BTD , BulkOnly , USBH_MIDI +, XBOXONE
    • bControlIface : ACM @@ -484,6 +424,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , BTD , BulkOnly , USBH_MIDI +, XBOXONE
    • bNumInterfaces : USB_CONFIGURATION_DESCRIPTOR @@ -557,6 +498,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : PS4Data , PSBUZZButtons
    • +
    • bTransferTypeMask +: USBH_MIDI +
    • bType : HidItemPrefix
    • @@ -584,7 +528,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_c.html b/functions_c.html index 6043d39c..9727b5d5 100644 --- a/functions_c.html +++ b/functions_c.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members @@ -11,9 +12,6 @@ - @@ -32,81 +30,22 @@
- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- c -

    +

    - c -

    • CBWCB : CommandBlockWrapper
    • @@ -256,7 +195,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : touchpadXY
    • countSysExDataSize() -: USBH_MIDI +: USBH_MIDI
    • createChar() : Max_LCD @@ -288,7 +227,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_d.html b/functions_d.html index 9e114331..1ec7a80a 100644 --- a/functions_d.html +++ b/functions_d.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members @@ -11,9 +12,6 @@ - @@ -32,81 +30,22 @@
- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- d -

    +

    - d -

    • data : Capacity
    • @@ -229,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_e.html b/functions_e.html index 0a83f942..a8da7700 100644 --- a/functions_e.html +++ b/functions_e.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members @@ -11,9 +12,6 @@ - @@ -32,81 +30,22 @@
- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- e -

diff --git a/functions_enum.html b/functions_enum.html index 1fe022a9..8317a377 100644 --- a/functions_enum.html +++ b/functions_enum.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Enumerations @@ -11,9 +12,6 @@ - @@ -32,52 +30,22 @@
- + - - - + + + +
- + - - - + + + +
- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- f -

    +

    - f -

    • finger : touchpadXY
    • @@ -155,7 +94,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func.html b/functions_func.html index 27a2cbc6..2b56d5ce 100644 --- a/functions_func.html +++ b/functions_func.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- a -

    +

    - a -

    • ACLData() : BluetoothService , BTHID @@ -178,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_b.html b/functions_func_b.html index 6168a012..e8e04849 100644 --- a/functions_func_b.html +++ b/functions_func_b.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- b -

    +

    - b -

    • begin() : Max_LCD
    • @@ -162,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_c.html b/functions_func_c.html index 603e36ec..f3e4626b 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- c -

    +

    - c -

    • CDB10() : CDB10
    • @@ -172,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , PSBuzz
    • countSysExDataSize() -: USBH_MIDI +: USBH_MIDI
    • createChar() : Max_LCD @@ -195,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_d.html b/functions_func_d.html index 6ed783df..d33362af 100644 --- a/functions_func_d.html +++ b/functions_func_d.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- d -

    +

    - d -

    • DefaultAddressing() : USB
    • @@ -161,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_e.html b/functions_func_e.html index c960c647..3ea2be78 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- e -

    +

    - e -

    • EndpointXtract() : ACM , ADK @@ -133,6 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , HIDComposite , HIDUniversal , UsbConfigXtracter +, XBOXONE
    • enhanced_features() : ACM @@ -141,13 +84,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    • enhanced_status() : ACM
    • +
    • extractSysExData() +: USBH_MIDI +
diff --git a/functions_func_f.html b/functions_func_f.html index 8d9b4b3a..eb72146f 100644 --- a/functions_func_f.html +++ b/functions_func_f.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- f -

    +

    - f -

    • flush() : SPP
    • @@ -143,7 +85,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_g.html b/functions_func_g.html index d74abfe7..08d97d6d 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- g -

    +

    - g -

    • get9DOFValues() : PS3BT
    • @@ -414,7 +356,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_h.html b/functions_func_h.html index 797287f1..04e9d097 100644 --- a/functions_func_h.html +++ b/functions_func_h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- h -

    +

    - h -

    • half_duplex() : ACM , XR21B1411 @@ -205,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_i.html b/functions_func_i.html index 8377bdfe..bf2fe59b 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- i -

    +

    - i -

      +
    • idProduct() +: USBH_MIDI +
    • +
    • idVendor() +: USBH_MIDI +
    • Init() : ACM , ADK @@ -177,6 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : ACM , ADK , BTD +, FTDI , HIDBoot< BOOT_PROTOCOL > , HIDComposite , HIDUniversal @@ -195,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_k.html b/functions_func_k.html index 41c2ae86..7667e286 100644 --- a/functions_func_k.html +++ b/functions_func_k.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- k -

    +

    - k -

    • KeyboardReportParser() : KeyboardReportParser
    • @@ -132,7 +74,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_l.html b/functions_func_l.html index 8ad97d5a..4a047a62 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- l -

    +

    - l -

    • L2CAP_Command() : BTD
    • @@ -153,6 +95,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    • LockMedia() : BulkOnly
    • +
    • lookupMsgSize() +: USBH_MIDI +
    • LUNIsGood() : BulkOnly
    • @@ -162,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_m.html b/functions_func_m.html index 09d1e28c..6b9b1cd7 100644 --- a/functions_func_m.html +++ b/functions_func_m.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- m -

    +

    - m -

    • MAX3421e() : MAX3421e< SPI_SS, INTR >
    • @@ -149,7 +91,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_n.html b/functions_func_n.html index 66c14028..4db1fb57 100644 --- a/functions_func_n.html +++ b/functions_func_n.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- n -

    +

    - n -

    • noAutoscroll() : Max_LCD
    • @@ -141,7 +83,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_o.html b/functions_func_o.html index 11fa19dc..78e3667d 100644 --- a/functions_func_o.html +++ b/functions_func_o.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Functions @@ -11,9 +12,6 @@ - @@ -32,78 +30,22 @@
- + - - - - + + + +
  -

- o -

- + - - - - + + + +
  -

- p -

- + - - - - + + + +
  -

- r -

- + - - - - + + + +
  -

- s -

- + - - - - + + + +
  -

- t -

- + - - - - + + + +
  -

- u -

- + - - - - + + + +
  -

- v -

- + - - - - + + + +
  -

- w -

- + - - - - + + + +
  -

- x -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- g -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- h -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- i -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- k -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- l -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- m -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- n -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- o -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- p -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- q -

@@ -137,7 +77,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_r.html b/functions_r.html index 4cb74242..5ea8981e 100644 --- a/functions_r.html +++ b/functions_r.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members @@ -11,9 +12,6 @@ - @@ -32,81 +30,22 @@ - + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- r -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- s -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- t -

- + - - - + + + + - + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- u -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- v -

- + - - - - + + + +
  -

- _ -

- + - - - - + + + +
  -

- a -

- + - - - - + + + +
  -

- b -

- + - - - - + + + +
  -

- c -

- + - - - - + + + +
  -

- d -

- + - - - - + + + +
  -

- e -

- + - - - - + + + +
  -

- f -

- + - - - - + + + +
  -

- g -

- + - - - - + + + +
  -

- h -

- + - - - - + + + +
  -

- i -

- + - - - - + + + +
  -

- k -

- + - - - - + + + +
  -

- l -

- + - - - - + + + +
  -

- m -

- + - - - - + + + +
  -

- n -

- + - - - - + + + +
  -

- o -

- + - - - - + + + +
  -

- p -

- + - - - - + + + +
  -

- q -

@@ -137,7 +77,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_r.html b/functions_vars_r.html index dc4bc2e5..1ab396a5 100644 --- a/functions_vars_r.html +++ b/functions_vars_r.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Class Members - Variables @@ -11,9 +12,6 @@ - @@ -32,81 +30,22 @@ - + - - - - + + + +
  -

- r -

- + - - - - + + + +
  -

- s -

- + - - - - + + + +
  -

- t -

- + - - - - + + + +
  -

- u -

- + - - - - + + + +
  -

- v -

- + - - - - + + + +
  -

- w -

- + - - - - + + + +
  -

- x -

- + - - - - + + + +
  -

- y -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- w -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- x -

- + - - - - + + + +
Here is a list of all class members with links to the classes they belong to:
-

- y -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- _ -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- a -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- b -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- c -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- d -

- + - - - - + + + +
  -

- _ -

- + - - - - + + + +
  -

- a -

- + - - - - + + + +
  -

- b -

- + - - - - + + + +
  -

- c -

- + - - - - + + + +
  -

- d -

- + - - - - + + + +
  -

- e -

- + - - - - + + + +
  -

- f -

- + - - - - + + + +
  -

- g -

- + - - - - + + + +
  -

- h -

- + - - - - + + + +
  -

- i -

- + - - - - + + + +
  -

- j -

- + - - - - + + + +
  -

- k -

- + - - - - + + + +
  -

- l -

- + - - - - + + + +
  -

- m -

- + - - - - + + + +
  -

- n -

- + - - - - + + + +
  -

- o -

- + - - - - + + + +
  -

- p -

- + - - - - + + + +
  -

- r -

- + - - - - + + + +
  -

- s -

- + - - - - + + + +
  -

- t -

- + - - - - + + + +
  -

- u -

- + - - - - + + + +
  -

- v -

- + - - - - + + + +
  -

- w -

- + - - - - + + + +
  -

- x -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- e -

- + - - - + + + + - + - - - - + + + +
  -

- a -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- f -

- + - - - + + + + - + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- g -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- h -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- i -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- j -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- k -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- l -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- m -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- n -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- o -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- p -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- r -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- s -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- t -

- + - - - + + + + - + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- u -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- v -

- + - - - - + + + +
  -

- p -

- + - - - - + + + +
  -

- r -

- + - - - - + + + +
  -

- u -

- + - - - - + + + +
  -

- w -

- + - - - - + + + +
  -

- x -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- w -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- x -

- + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- y -

diff --git a/globals_z.html b/globals_z.html index ed5c1026..e4f2324b 100644 --- a/globals_z.html +++ b/globals_z.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: File Members @@ -11,9 +12,6 @@ - @@ -32,81 +30,22 @@ - + - - - - + + + +
Here is a list of all file members with links to the files they belong to:
-

- z -

- + - + + + +

This page explains how to interpret the graphs that are generated by doxygen.

-

Consider the following example:

1 /*! Invisible class because of truncation */
2 class Invisible { };
3 
4 /*! Truncated class, inheritance relation is hidden */
5 class Truncated : public Invisible { };
6 
7 /* Class not documented with doxygen comments */
8 class Undocumented { };
9 
10 /*! Class that is inherited using public inheritance */
11 class PublicBase : public Truncated { };
12 
13 /*! A template class */
14 template<class T> class Templ { };
15 
16 /*! Class that is inherited using protected inheritance */
17 class ProtectedBase { };
18 
19 /*! Class that is inherited using private inheritance */
20 class PrivateBase { };
21 
22 /*! Class that is used by the Inherited class */
23 class Used { };
24 
25 /*! Super class that inherits a number of other classes */
26 class Inherited : public PublicBase,
27  protected ProtectedBase,
28  private PrivateBase,
29  public Undocumented,
30  public Templ<int>
31 {
32  private:
33  Used *m_usedClass;
34 };

This will result in the following graph:

+

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };
/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };
/* Class not documented with doxygen comments */
class Undocumented { };
/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };
/*! A template class */
template<class T> class Templ { };
/*! Class that is inherited using protected inheritance */
class ProtectedBase { };
/*! Class that is inherited using private inheritance */
class PrivateBase { };
/*! Class that is used by the Inherited class */
class Used { };
/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
protected ProtectedBase,
private PrivateBase,
public Undocumented,
public Templ<int>
{
private:
Used *m_usedClass;
};

This will result in the following graph:

- +

The boxes in the above graph have the following meaning:

diff --git a/graph_legend.png b/graph_legend.png index c13c9d07..881e40f9 100644 Binary files a/graph_legend.png and b/graph_legend.png differ diff --git a/hexdump_8h.html b/hexdump_8h.html index baf46ba3..0a360793 100644 --- a/hexdump_8h.html +++ b/hexdump_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hexdump.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Variable Documentation

- + +

◆ UsbDEBUGlvl

+
@@ -117,7 +99,7 @@ Variables
-

Definition at line 22 of file message.cpp.

+

Definition at line 29 of file message.cpp.

@@ -126,7 +108,7 @@ Variables diff --git a/hexdump_8h_source.html b/hexdump_8h_source.html index 072ffd28..8a272661 100644 --- a/hexdump_8h_source.html +++ b/hexdump_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hexdump.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
hexdump.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 #if !defined(_usb_h_) || defined(__HEXDUMP_H__)
18 #error "Never include hexdump.h directly; include Usb.h instead"
19 #else
20 #define __HEXDUMP_H__
21 
22 extern int UsbDEBUGlvl;
23 
24 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
25 class HexDumper : public BASE_CLASS {
26  uint8_t byteCount;
27  OFFSET_TYPE byteTotal;
28 
29 public:
30 
31  HexDumper() : byteCount(0), byteTotal(0) {
32  };
33 
34  void Initialize() {
35  byteCount = 0;
36  byteTotal = 0;
37  };
38 
39  void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset);
40 };
41 
42 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
43 void HexDumper<BASE_CLASS, LEN_TYPE, OFFSET_TYPE>::Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) {
44  if(UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug.
45  for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) {
46  if(!byteCount) {
47  PrintHex<OFFSET_TYPE > (byteTotal, 0x80);
48  E_Notify(PSTR(": "), 0x80);
49  }
50  PrintHex<uint8_t > (pbuf[j], 0x80);
51  E_Notify(PSTR(" "), 0x80);
52 
53  if(byteCount == 15) {
54  E_Notify(PSTR("\r\n"), 0x80);
55  byteCount = 0xFF;
56  }
57  }
58  }
59 }
60 
61 #endif // __HEXDUMP_H__
-
int UsbDEBUGlvl
Definition: message.cpp:22
-
void Initialize()
Definition: hexdump.h:34
-
#define PSTR(str)
-
void E_Notify(char const *msg, int lvl)
Definition: message.cpp:34
-
HexDumper()
Definition: hexdump.h:31
-
void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset)
Definition: hexdump.h:43
+Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 Contact information
18 -------------------
19 
20 Circuits At Home, LTD
21 Web : http://www.circuitsathome.com
22 e-mail : support@circuitsathome.com
23  */
24 
25 #if !defined(_usb_h_) || defined(__HEXDUMP_H__)
26 #error "Never include hexdump.h directly; include Usb.h instead"
27 #else
28 #define __HEXDUMP_H__
29 
30 extern int UsbDEBUGlvl;
31 
32 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
33 class HexDumper : public BASE_CLASS {
34  uint8_t byteCount;
35  OFFSET_TYPE byteTotal;
36 
37 public:
38 
39  HexDumper() : byteCount(0), byteTotal(0) {
40  };
41 
42  void Initialize() {
43  byteCount = 0;
44  byteTotal = 0;
45  };
46 
47  void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset);
48 };
49 
50 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
51 void HexDumper<BASE_CLASS, LEN_TYPE, OFFSET_TYPE>::Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset __attribute__((unused))) {
52  if(UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug.
53  for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) {
54  if(!byteCount) {
55  PrintHex<OFFSET_TYPE > (byteTotal, 0x80);
56  E_Notify(PSTR(": "), 0x80);
57  }
58  PrintHex<uint8_t > (pbuf[j], 0x80);
59  E_Notify(PSTR(" "), 0x80);
60 
61  if(byteCount == 15) {
62  E_Notify(PSTR("\r\n"), 0x80);
63  byteCount = 0xFF;
64  }
65  }
66  }
67 }
68 
69 #endif // __HEXDUMP_H__
+
int UsbDEBUGlvl
Definition: message.cpp:29
+
void Initialize()
Definition: hexdump.h:42
+
#define PSTR(str)
+
void E_Notify(char const *msg, int lvl)
Definition: message.cpp:41
+
HexDumper()
Definition: hexdump.h:39
+
void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset)
Definition: hexdump.h:51
diff --git a/hidboot_8cpp.html b/hidboot_8cpp.html index 6edc7e57..99161609 100644 --- a/hidboot_8cpp.html +++ b/hidboot_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidboot.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/hidboot_8cpp__incl.md5 b/hidboot_8cpp__incl.md5 index 8925fe78..de6cd8aa 100644 --- a/hidboot_8cpp__incl.md5 +++ b/hidboot_8cpp__incl.md5 @@ -1 +1 @@ -fd9ffd5fbb0339f5a30f2cdb6ce0f03f \ No newline at end of file +b569b0654ae2e389bfc498a0f61c5075 \ No newline at end of file diff --git a/hidboot_8cpp__incl.png b/hidboot_8cpp__incl.png index 71f68b5d..38f3dee9 100644 Binary files a/hidboot_8cpp__incl.png and b/hidboot_8cpp__incl.png differ diff --git a/hidboot_8cpp_source.html b/hidboot_8cpp_source.html index 67a6f463..588bbfe2 100644 --- a/hidboot_8cpp_source.html +++ b/hidboot_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidboot.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
hidboot.cpp
-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 #include "hidboot.h"
18 
19 void MouseReportParser::Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
20  MOUSEINFO *pmi = (MOUSEINFO*)buf;
21  // Future:
22  // bool event;
23 
24 #if 0
25  if (prevState.mouseInfo.bmLeftButton == 0 && pmi->bmLeftButton == 1)
26  OnLeftButtonDown(pmi);
27 
28  if (prevState.mouseInfo.bmLeftButton == 1 && pmi->bmLeftButton == 0)
29  OnLeftButtonUp(pmi);
30 
31  if (prevState.mouseInfo.bmRightButton == 0 && pmi->bmRightButton == 1)
32  OnRightButtonDown(pmi);
33 
34  if (prevState.mouseInfo.bmRightButton == 1 && pmi->bmRightButton == 0)
35  OnRightButtonUp(pmi);
36 
37  if (prevState.mouseInfo.bmMiddleButton == 0 && pmi->bmMiddleButton == 1)
38  OnMiddleButtonDown(pmi);
39 
40  if (prevState.mouseInfo.bmMiddleButton == 1 && pmi->bmMiddleButton == 0)
41  OnMiddleButtonUp(pmi);
42 
43  if (prevState.mouseInfo.dX != pmi->dX || prevState.mouseInfo.dY != pmi->dY)
44  OnMouseMove(pmi);
45 
46  if (len > sizeof (MOUSEINFO))
47  for (uint8_t i = 0; i<sizeof (MOUSEINFO); i++)
48  prevState.bInfo[i] = buf[i];
49 #else
50  //
51  // Optimization idea:
52  //
53  // 1: Don't pass the structure on every event. Buttons would not need it.
54  // 2: Only pass x/y values in the movement routine.
55  //
56  // These two changes (with the ones I have made) will save extra flash.
57  // The only "bad" thing is that it could break old code.
58  //
59  // Future thoughts:
60  //
61  // The extra space gained can be used for a generic mouse event that can be called
62  // when there are _ANY_ changes. This one you _MAY_ want to pass everything, however the
63  // sketch could already have noted these facts to support drag/drop scroll wheel stuff, etc.
64  //
65 
66  // Why do we need to pass the structure for buttons?
67  // The function call not enough of a hint for what is happening?
68  if(prevState.mouseInfo.bmLeftButton != pmi->bmLeftButton ) {
69  if(pmi->bmLeftButton) {
70  OnLeftButtonDown(pmi);
71  } else {
72  OnLeftButtonUp(pmi);
73  }
74  // Future:
75  // event = true;
76  }
77 
78  if(prevState.mouseInfo.bmRightButton != pmi->bmRightButton) {
79  if(pmi->bmRightButton) {
80  OnRightButtonDown(pmi);
81  } else {
82  OnRightButtonUp(pmi);
83  }
84  // Future:
85  // event = true;
86  }
87 
88  if(prevState.mouseInfo.bmMiddleButton != pmi->bmMiddleButton) {
89  if(pmi->bmMiddleButton) {
90  OnMiddleButtonDown(pmi);
91  } else {
92  OnMiddleButtonUp(pmi);
93  }
94  // Future:
95  // event = true;
96  }
97 
98  //
99  // Scroll wheel(s), are not part of the spec, but we could support it.
100  // Logitech wireless keyboard and mouse combo reports scroll wheel in byte 4
101  // We wouldn't even need to save this information.
102  //if(len > 3) {
103  //}
104  //
105 
106  // Mice only report motion when they actually move!
107  // Why not just pass the x/y values to simplify things??
108  if(pmi->dX || pmi->dY) {
109  OnMouseMove(pmi);
110  // Future:
111  // event = true;
112  }
113 
114  //
115  // Future:
116  // Provide a callback that operates on the gathered events from above.
117  //
118  // if(event) OnMouse();
119  //
120 
121  // Only the first byte matters (buttons). We do NOT need to save position info.
122  prevState.bInfo[0] = buf[0];
123 #endif
124 
125 };
126 
127 void KeyboardReportParser::Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
128  // On error - return
129  if (buf[2] == 1)
130  return;
131 
132  //KBDINFO *pki = (KBDINFO*)buf;
133 
134  // provide event for changed control key state
135  if (prevState.bInfo[0x00] != buf[0x00]) {
136  OnControlKeysChanged(prevState.bInfo[0x00], buf[0x00]);
137  }
138 
139  for (uint8_t i = 2; i < 8; i++) {
140  bool down = false;
141  bool up = false;
142 
143  for (uint8_t j = 2; j < 8; j++) {
144  if (buf[i] == prevState.bInfo[j] && buf[i] != 1)
145  down = true;
146  if (buf[j] == prevState.bInfo[i] && prevState.bInfo[i] != 1)
147  up = true;
148  }
149  if (!down) {
150  HandleLockingKeys(hid, buf[i]);
151  OnKeyDown(*buf, buf[i]);
152  }
153  if (!up)
154  OnKeyUp(prevState.bInfo[0], prevState.bInfo[i]);
155  }
156  for (uint8_t i = 0; i < 8; i++)
157  prevState.bInfo[i] = buf[i];
158 };
159 
160 const uint8_t KeyboardReportParser::numKeys[10] PROGMEM = {'!', '@', '#', '$', '%', '^', '&', '*', '(', ')'};
161 const uint8_t KeyboardReportParser::symKeysUp[12] PROGMEM = {'_', '+', '{', '}', '|', '~', ':', '"', '~', '<', '>', '?'};
162 const uint8_t KeyboardReportParser::symKeysLo[12] PROGMEM = {'-', '=', '[', ']', '\\', ' ', ';', '\'', '`', ',', '.', '/'};
163 const uint8_t KeyboardReportParser::padKeys[5] PROGMEM = {'/', '*', '-', '+', 0x13};
164 
165 uint8_t KeyboardReportParser::OemToAscii(uint8_t mod, uint8_t key) {
166  uint8_t shift = (mod & 0x22);
167 
168  // [a-z]
169  if (VALUE_WITHIN(key, 0x04, 0x1d)) {
170  // Upper case letters
171  if ((kbdLockingKeys.kbdLeds.bmCapsLock == 0 && shift) ||
172  (kbdLockingKeys.kbdLeds.bmCapsLock == 1 && shift == 0))
173  return (key - 4 + 'A');
174 
175  // Lower case letters
176  else
177  return (key - 4 + 'a');
178  }// Numbers
179  else if (VALUE_WITHIN(key, 0x1e, 0x27)) {
180  if (shift)
181  return ((uint8_t)pgm_read_byte(&getNumKeys()[key - 0x1e]));
182  else
183  return ((key == UHS_HID_BOOT_KEY_ZERO) ? '0' : key - 0x1e + '1');
184  }// Keypad Numbers
185  else if(VALUE_WITHIN(key, 0x59, 0x61)) {
186  if(kbdLockingKeys.kbdLeds.bmNumLock == 1)
187  return (key - 0x59 + '1');
188  } else if(VALUE_WITHIN(key, 0x2d, 0x38))
189  return ((shift) ? (uint8_t)pgm_read_byte(&getSymKeysUp()[key - 0x2d]) : (uint8_t)pgm_read_byte(&getSymKeysLo()[key - 0x2d]));
190  else if(VALUE_WITHIN(key, 0x54, 0x58))
191  return (uint8_t)pgm_read_byte(&getPadKeys()[key - 0x54]);
192  else {
193  switch(key) {
194  case UHS_HID_BOOT_KEY_SPACE: return (0x20);
195  case UHS_HID_BOOT_KEY_ENTER: return (0x13);
196  case UHS_HID_BOOT_KEY_ZERO2: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '0': 0);
197  case UHS_HID_BOOT_KEY_PERIOD: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '.': 0);
198  }
199  }
200  return ( 0);
201 }
+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 #include "hidboot.h"
18 
19 void MouseReportParser::Parse(USBHID *hid __attribute__((unused)), bool is_rpt_id __attribute__((unused)), uint8_t len __attribute__((unused)), uint8_t *buf) {
20  MOUSEINFO *pmi = (MOUSEINFO*)buf;
21  // Future:
22  // bool event;
23 
24 #if 0
25  if (prevState.mouseInfo.bmLeftButton == 0 && pmi->bmLeftButton == 1)
26  OnLeftButtonDown(pmi);
27 
28  if (prevState.mouseInfo.bmLeftButton == 1 && pmi->bmLeftButton == 0)
29  OnLeftButtonUp(pmi);
30 
31  if (prevState.mouseInfo.bmRightButton == 0 && pmi->bmRightButton == 1)
32  OnRightButtonDown(pmi);
33 
34  if (prevState.mouseInfo.bmRightButton == 1 && pmi->bmRightButton == 0)
35  OnRightButtonUp(pmi);
36 
37  if (prevState.mouseInfo.bmMiddleButton == 0 && pmi->bmMiddleButton == 1)
38  OnMiddleButtonDown(pmi);
39 
40  if (prevState.mouseInfo.bmMiddleButton == 1 && pmi->bmMiddleButton == 0)
41  OnMiddleButtonUp(pmi);
42 
43  if (prevState.mouseInfo.dX != pmi->dX || prevState.mouseInfo.dY != pmi->dY)
44  OnMouseMove(pmi);
45 
46  if (len > sizeof (MOUSEINFO))
47  for (uint8_t i = 0; i<sizeof (MOUSEINFO); i++)
48  prevState.bInfo[i] = buf[i];
49 #else
50  //
51  // Optimization idea:
52  //
53  // 1: Don't pass the structure on every event. Buttons would not need it.
54  // 2: Only pass x/y values in the movement routine.
55  //
56  // These two changes (with the ones I have made) will save extra flash.
57  // The only "bad" thing is that it could break old code.
58  //
59  // Future thoughts:
60  //
61  // The extra space gained can be used for a generic mouse event that can be called
62  // when there are _ANY_ changes. This one you _MAY_ want to pass everything, however the
63  // sketch could already have noted these facts to support drag/drop scroll wheel stuff, etc.
64  //
65 
66  // Why do we need to pass the structure for buttons?
67  // The function call not enough of a hint for what is happening?
68  if(prevState.mouseInfo.bmLeftButton != pmi->bmLeftButton ) {
69  if(pmi->bmLeftButton) {
70  OnLeftButtonDown(pmi);
71  } else {
72  OnLeftButtonUp(pmi);
73  }
74  // Future:
75  // event = true;
76  }
77 
78  if(prevState.mouseInfo.bmRightButton != pmi->bmRightButton) {
79  if(pmi->bmRightButton) {
80  OnRightButtonDown(pmi);
81  } else {
82  OnRightButtonUp(pmi);
83  }
84  // Future:
85  // event = true;
86  }
87 
88  if(prevState.mouseInfo.bmMiddleButton != pmi->bmMiddleButton) {
89  if(pmi->bmMiddleButton) {
90  OnMiddleButtonDown(pmi);
91  } else {
92  OnMiddleButtonUp(pmi);
93  }
94  // Future:
95  // event = true;
96  }
97 
98  //
99  // Scroll wheel(s), are not part of the spec, but we could support it.
100  // Logitech wireless keyboard and mouse combo reports scroll wheel in byte 4
101  // We wouldn't even need to save this information.
102  //if(len > 3) {
103  //}
104  //
105 
106  // Mice only report motion when they actually move!
107  // Why not just pass the x/y values to simplify things??
108  if(pmi->dX || pmi->dY) {
109  OnMouseMove(pmi);
110  // Future:
111  // event = true;
112  }
113 
114  //
115  // Future:
116  // Provide a callback that operates on the gathered events from above.
117  //
118  // if(event) OnMouse();
119  //
120 
121  // Only the first byte matters (buttons). We do NOT need to save position info.
122  prevState.bInfo[0] = buf[0];
123 #endif
124 
125 };
126 
127 void KeyboardReportParser::Parse(USBHID *hid, bool is_rpt_id __attribute__((unused)), uint8_t len __attribute__((unused)), uint8_t *buf) {
128  // On error - return
129  if (buf[2] == 1)
130  return;
131 
132  //KBDINFO *pki = (KBDINFO*)buf;
133 
134  // provide event for changed control key state
135  if (prevState.bInfo[0x00] != buf[0x00]) {
136  OnControlKeysChanged(prevState.bInfo[0x00], buf[0x00]);
137  }
138 
139  for (uint8_t i = 2; i < 8; i++) {
140  bool down = false;
141  bool up = false;
142 
143  for (uint8_t j = 2; j < 8; j++) {
144  if (buf[i] == prevState.bInfo[j] && buf[i] != 1)
145  down = true;
146  if (buf[j] == prevState.bInfo[i] && prevState.bInfo[i] != 1)
147  up = true;
148  }
149  if (!down) {
150  HandleLockingKeys(hid, buf[i]);
151  OnKeyDown(*buf, buf[i]);
152  }
153  if (!up)
154  OnKeyUp(prevState.bInfo[0], prevState.bInfo[i]);
155  }
156  for (uint8_t i = 0; i < 8; i++)
157  prevState.bInfo[i] = buf[i];
158 };
159 
160 const uint8_t KeyboardReportParser::numKeys[10] PROGMEM = {'!', '@', '#', '$', '%', '^', '&', '*', '(', ')'};
161 const uint8_t KeyboardReportParser::symKeysUp[12] PROGMEM = {'_', '+', '{', '}', '|', '~', ':', '"', '~', '<', '>', '?'};
162 const uint8_t KeyboardReportParser::symKeysLo[12] PROGMEM = {'-', '=', '[', ']', '\\', ' ', ';', '\'', '`', ',', '.', '/'};
163 const uint8_t KeyboardReportParser::padKeys[5] PROGMEM = {'/', '*', '-', '+', 0x13};
164 
165 uint8_t KeyboardReportParser::OemToAscii(uint8_t mod, uint8_t key) {
166  uint8_t shift = (mod & 0x22);
167 
168  // [a-z]
169  if (VALUE_WITHIN(key, 0x04, 0x1d)) {
170  // Upper case letters
171  if ((kbdLockingKeys.kbdLeds.bmCapsLock == 0 && shift) ||
172  (kbdLockingKeys.kbdLeds.bmCapsLock == 1 && shift == 0))
173  return (key - 4 + 'A');
174 
175  // Lower case letters
176  else
177  return (key - 4 + 'a');
178  }// Numbers
179  else if (VALUE_WITHIN(key, 0x1e, 0x27)) {
180  if (shift)
181  return ((uint8_t)pgm_read_byte(&getNumKeys()[key - 0x1e]));
182  else
183  return ((key == UHS_HID_BOOT_KEY_ZERO) ? '0' : key - 0x1e + '1');
184  }// Keypad Numbers
185  else if(VALUE_WITHIN(key, 0x59, 0x61)) {
186  if(kbdLockingKeys.kbdLeds.bmNumLock == 1)
187  return (key - 0x59 + '1');
188  } else if(VALUE_WITHIN(key, 0x2d, 0x38))
189  return ((shift) ? (uint8_t)pgm_read_byte(&getSymKeysUp()[key - 0x2d]) : (uint8_t)pgm_read_byte(&getSymKeysLo()[key - 0x2d]));
190  else if(VALUE_WITHIN(key, 0x54, 0x58))
191  return (uint8_t)pgm_read_byte(&getPadKeys()[key - 0x54]);
192  else {
193  switch(key) {
194  case UHS_HID_BOOT_KEY_SPACE: return (0x20);
195  case UHS_HID_BOOT_KEY_ENTER: return (0x13);
196  case UHS_HID_BOOT_KEY_ZERO2: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '0': 0);
197  case UHS_HID_BOOT_KEY_PERIOD: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '.': 0);
198  }
199  }
200  return ( 0);
201 }
Definition: usbhid.h:143
#define UHS_HID_BOOT_KEY_PERIOD
Definition: hidboot.h:29
uint8_t bmRightButton
Definition: hidboot.h:43
+
virtual const uint8_t * getSymKeysLo()
Definition: hidboot.h:191
virtual void OnRightButtonDown(MOUSEINFO *mi)
Definition: hidboot.h:75
+
virtual void OnKeyDown(uint8_t mod, uint8_t key)
Definition: hidboot.h:177
virtual void OnMiddleButtonUp(MOUSEINFO *mi)
Definition: hidboot.h:78
#define UHS_HID_BOOT_KEY_ZERO2
Definition: hidboot.h:28
-
#define pgm_read_byte(addr)
+
#define pgm_read_byte(addr)
#define UHS_HID_BOOT_KEY_ZERO
Definition: hidboot.h:22
+
virtual void OnKeyUp(uint8_t mod, uint8_t key)
Definition: hidboot.h:180
+
virtual const uint8_t * getSymKeysUp()
Definition: hidboot.h:187
uint8_t bmMiddleButton
Definition: hidboot.h:44
void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hidboot.cpp:127
virtual void OnLeftButtonUp(MOUSEINFO *mi)
Definition: hidboot.h:66
#define UHS_HID_BOOT_KEY_SPACE
Definition: hidboot.h:24
+
virtual uint8_t HandleLockingKeys(USBHID *hid, uint8_t key)
Definition: hidboot.h:151
virtual void OnMouseMove(MOUSEINFO *mi)
Definition: hidboot.h:63
virtual void OnRightButtonUp(MOUSEINFO *mi)
Definition: hidboot.h:72
-
#define VALUE_WITHIN(v, l, h)
Definition: macros.h:28
+
#define VALUE_WITHIN(v, l, h)
Definition: macros.h:35
virtual void OnMiddleButtonDown(MOUSEINFO *mi)
Definition: hidboot.h:81
#define UHS_HID_BOOT_KEY_ENTER
Definition: hidboot.h:23
+
union KeyboardReportParser::@17 prevState
int8_t dX
Definition: hidboot.h:47
+
virtual void OnControlKeysChanged(uint8_t before, uint8_t after)
Definition: hidboot.h:174
virtual void OnLeftButtonDown(MOUSEINFO *mi)
Definition: hidboot.h:69
+
virtual const uint8_t * getNumKeys()
Definition: hidboot.h:183
+
union KeyboardReportParser::@18 kbdLockingKeys
+
virtual const uint8_t * getPadKeys()
Definition: hidboot.h:195
int8_t dY
Definition: hidboot.h:48
void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hidboot.cpp:19
uint8_t bmLeftButton
Definition: hidboot.h:42
@@ -120,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidboot_8h.html b/hidboot_8h.html index f4b3703c..b9694f7b 100644 --- a/hidboot_8h.html +++ b/hidboot_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidboot.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
 

Macro Definition Documentation

- + +

◆ UHS_HID_BOOT_KEY_ZERO

+
@@ -171,11 +153,13 @@ Macros
-

Definition at line 22 of file hidboot.h.

+

Definition at line 22 of file hidboot.h.

- + +

◆ UHS_HID_BOOT_KEY_ENTER

+
@@ -185,11 +169,13 @@ Macros
-

Definition at line 23 of file hidboot.h.

+

Definition at line 23 of file hidboot.h.

- + +

◆ UHS_HID_BOOT_KEY_SPACE

+
@@ -199,11 +185,13 @@ Macros
-

Definition at line 24 of file hidboot.h.

+

Definition at line 24 of file hidboot.h.

- + +

◆ UHS_HID_BOOT_KEY_CAPS_LOCK

+
@@ -213,11 +201,13 @@ Macros
-

Definition at line 25 of file hidboot.h.

+

Definition at line 25 of file hidboot.h.

- + +

◆ UHS_HID_BOOT_KEY_SCROLL_LOCK

+
@@ -227,11 +217,13 @@ Macros
-

Definition at line 26 of file hidboot.h.

+

Definition at line 26 of file hidboot.h.

- + +

◆ UHS_HID_BOOT_KEY_NUM_LOCK

+
@@ -241,11 +233,13 @@ Macros
-

Definition at line 27 of file hidboot.h.

+

Definition at line 27 of file hidboot.h.

- + +

◆ UHS_HID_BOOT_KEY_ZERO2

+
@@ -255,11 +249,13 @@ Macros
-

Definition at line 28 of file hidboot.h.

+

Definition at line 28 of file hidboot.h.

- + +

◆ UHS_HID_BOOT_KEY_PERIOD

+
@@ -269,11 +265,13 @@ Macros
-

Definition at line 29 of file hidboot.h.

+

Definition at line 29 of file hidboot.h.

- + +

◆ bitsEndpoints

+
@@ -287,11 +285,13 @@ Macros
-

Definition at line 32 of file hidboot.h.

+

Definition at line 32 of file hidboot.h.

- + +

◆ totalEndpoints

+
@@ -305,11 +305,13 @@ Macros
-

Definition at line 33 of file hidboot.h.

+

Definition at line 33 of file hidboot.h.

- + +

◆ epMUL

+
@@ -323,7 +325,7 @@ Macros
-

Definition at line 34 of file hidboot.h.

+

Definition at line 34 of file hidboot.h.

@@ -332,7 +334,7 @@ Macros diff --git a/hidboot_8h__dep__incl.md5 b/hidboot_8h__dep__incl.md5 index 4ec250d7..12452ce7 100644 --- a/hidboot_8h__dep__incl.md5 +++ b/hidboot_8h__dep__incl.md5 @@ -1 +1 @@ -eb017a1dbabb14c916b6c609ad0b5f09 \ No newline at end of file +11192c88997fec3c341a31aaf71e25e4 \ No newline at end of file diff --git a/hidboot_8h__dep__incl.png b/hidboot_8h__dep__incl.png index 47cdcb82..377462e0 100644 Binary files a/hidboot_8h__dep__incl.png and b/hidboot_8h__dep__incl.png differ diff --git a/hidboot_8h__incl.md5 b/hidboot_8h__incl.md5 index 0cf8d499..99907aea 100644 --- a/hidboot_8h__incl.md5 +++ b/hidboot_8h__incl.md5 @@ -1 +1 @@ -8dee61608a93687c155ca4b339d92198 \ No newline at end of file +83d1d2f9fe90e118568a3d6b3086c8da \ No newline at end of file diff --git a/hidboot_8h__incl.png b/hidboot_8h__incl.png index 264ef2b1..67d65ee8 100644 Binary files a/hidboot_8h__incl.png and b/hidboot_8h__incl.png differ diff --git a/hidboot_8h_source.html b/hidboot_8h_source.html index 595fe7e2..41d9b092 100644 --- a/hidboot_8h_source.html +++ b/hidboot_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidboot.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
hidboot.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 #if !defined(__HIDBOOT_H__)
18 #define __HIDBOOT_H__
19 
20 #include "usbhid.h"
21 
22 #define UHS_HID_BOOT_KEY_ZERO 0x27
23 #define UHS_HID_BOOT_KEY_ENTER 0x28
24 #define UHS_HID_BOOT_KEY_SPACE 0x2c
25 #define UHS_HID_BOOT_KEY_CAPS_LOCK 0x39
26 #define UHS_HID_BOOT_KEY_SCROLL_LOCK 0x47
27 #define UHS_HID_BOOT_KEY_NUM_LOCK 0x53
28 #define UHS_HID_BOOT_KEY_ZERO2 0x62
29 #define UHS_HID_BOOT_KEY_PERIOD 0x63
30 
31 // Don't worry, GCC will optimize the result to a final value.
32 #define bitsEndpoints(p) ((((p) & USB_HID_PROTOCOL_KEYBOARD)? 2 : 0) | (((p) & USB_HID_PROTOCOL_MOUSE)? 1 : 0))
33 #define totalEndpoints(p) ((bitsEndpoints(p) == 3) ? 3 : 2)
34 #define epMUL(p) ((((p) & USB_HID_PROTOCOL_KEYBOARD)? 1 : 0) + (((p) & USB_HID_PROTOCOL_MOUSE)? 1 : 0))
35 
36 // Already defined in hid.h
37 // #define HID_MAX_HID_CLASS_DESCRIPTORS 5
38 
39 struct MOUSEINFO {
40 
41  struct {
42  uint8_t bmLeftButton : 1;
43  uint8_t bmRightButton : 1;
44  uint8_t bmMiddleButton : 1;
45  uint8_t bmDummy : 5;
46  };
47  int8_t dX;
48  int8_t dY;
49 };
50 
52 
53  union {
55  uint8_t bInfo[sizeof (MOUSEINFO)];
56  } prevState;
57 
58 public:
59  void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
60 
61 protected:
62 
63  virtual void OnMouseMove(MOUSEINFO *mi) {
64  };
65 
66  virtual void OnLeftButtonUp(MOUSEINFO *mi) {
67  };
68 
69  virtual void OnLeftButtonDown(MOUSEINFO *mi) {
70  };
71 
72  virtual void OnRightButtonUp(MOUSEINFO *mi) {
73  };
74 
75  virtual void OnRightButtonDown(MOUSEINFO *mi) {
76  };
77 
78  virtual void OnMiddleButtonUp(MOUSEINFO *mi) {
79  };
80 
81  virtual void OnMiddleButtonDown(MOUSEINFO *mi) {
82  };
83 };
84 
85 struct MODIFIERKEYS {
86  uint8_t bmLeftCtrl : 1;
87  uint8_t bmLeftShift : 1;
88  uint8_t bmLeftAlt : 1;
89  uint8_t bmLeftGUI : 1;
90  uint8_t bmRightCtrl : 1;
91  uint8_t bmRightShift : 1;
92  uint8_t bmRightAlt : 1;
93  uint8_t bmRightGUI : 1;
94 };
95 
96 struct KBDINFO {
97 
98  struct {
99  uint8_t bmLeftCtrl : 1;
100  uint8_t bmLeftShift : 1;
101  uint8_t bmLeftAlt : 1;
102  uint8_t bmLeftGUI : 1;
103  uint8_t bmRightCtrl : 1;
104  uint8_t bmRightShift : 1;
105  uint8_t bmRightAlt : 1;
106  uint8_t bmRightGUI : 1;
107  };
108  uint8_t bReserved;
109  uint8_t Keys[6];
110 };
111 
112 struct KBDLEDS {
113  uint8_t bmNumLock : 1;
114  uint8_t bmCapsLock : 1;
115  uint8_t bmScrollLock : 1;
116  uint8_t bmCompose : 1;
117  uint8_t bmKana : 1;
118  uint8_t bmReserved : 3;
119 };
120 
122  static const uint8_t numKeys[10];
123  static const uint8_t symKeysUp[12];
124  static const uint8_t symKeysLo[12];
125  static const uint8_t padKeys[5];
126 
127 protected:
128 
129  union {
131  uint8_t bInfo[sizeof (KBDINFO)];
132  } prevState;
133 
134  union {
136  uint8_t bLeds;
137  } kbdLockingKeys;
138 
139  uint8_t OemToAscii(uint8_t mod, uint8_t key);
140 
141 public:
142 
144  kbdLockingKeys.bLeds = 0;
145  };
146 
147  void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
148 
149 protected:
150 
151  virtual uint8_t HandleLockingKeys(USBHID* hid, uint8_t key) {
152  uint8_t old_keys = kbdLockingKeys.bLeds;
153 
154  switch(key) {
156  kbdLockingKeys.kbdLeds.bmNumLock = ~kbdLockingKeys.kbdLeds.bmNumLock;
157  break;
159  kbdLockingKeys.kbdLeds.bmCapsLock = ~kbdLockingKeys.kbdLeds.bmCapsLock;
160  break;
162  kbdLockingKeys.kbdLeds.bmScrollLock = ~kbdLockingKeys.kbdLeds.bmScrollLock;
163  break;
164  }
165 
166  if(old_keys != kbdLockingKeys.bLeds && hid) {
167  uint8_t lockLeds = kbdLockingKeys.bLeds;
168  return (hid->SetReport(0, 0/*hid->GetIface()*/, 2, 0, 1, &lockLeds));
169  }
170 
171  return 0;
172  };
173 
174  virtual void OnControlKeysChanged(uint8_t before, uint8_t after) {
175  };
176 
177  virtual void OnKeyDown(uint8_t mod, uint8_t key) {
178  };
179 
180  virtual void OnKeyUp(uint8_t mod, uint8_t key) {
181  };
182 
183  virtual const uint8_t *getNumKeys() {
184  return numKeys;
185  };
186 
187  virtual const uint8_t *getSymKeysUp() {
188  return symKeysUp;
189  };
190 
191  virtual const uint8_t *getSymKeysLo() {
192  return symKeysLo;
193  };
194 
195  virtual const uint8_t *getPadKeys() {
196  return padKeys;
197  };
198 };
199 
200 template <const uint8_t BOOT_PROTOCOL>
201 class HIDBoot : public USBHID //public USBDeviceConfig, public UsbConfigXtracter
202 {
203  EpInfo epInfo[totalEndpoints(BOOT_PROTOCOL)];
204  HIDReportParser *pRptParser[epMUL(BOOT_PROTOCOL)];
205 
206  uint8_t bConfNum; // configuration number
207  uint8_t bIfaceNum; // Interface Number
208  uint8_t bNumIface; // number of interfaces in the configuration
209  uint8_t bNumEP; // total number of EP in the configuration
210  uint32_t qNextPollTime; // next poll time
211  bool bPollEnable; // poll enable flag
212  uint8_t bInterval; // largest interval
213  bool bRptProtoEnable; // Report Protocol enable flag
214 
215  void Initialize();
216 
217  virtual HIDReportParser* GetReportParser(uint8_t id) {
218  return pRptParser[id];
219  };
220 
221 public:
222  HIDBoot(USB *p, bool bRptProtoEnable = false);
223 
224  virtual bool SetReportParser(uint8_t id, HIDReportParser *prs) {
225  pRptParser[id] = prs;
226  return true;
227  };
228 
229  // USBDeviceConfig implementation
230  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
231  uint8_t Release();
232  uint8_t Poll();
233 
234  virtual uint8_t GetAddress() {
235  return bAddress;
236  };
237 
238  virtual bool isReady() {
239  return bPollEnable;
240  };
241 
242  // UsbConfigXtracter implementation
243  // Method should be defined here if virtual.
244  virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
245 
246  virtual bool DEVCLASSOK(uint8_t klass) {
247  return (klass == USB_CLASS_HID);
248  }
249 
250  virtual bool DEVSUBCLASSOK(uint8_t subklass) {
251  return (subklass == BOOT_PROTOCOL);
252  }
253 };
254 
255 template <const uint8_t BOOT_PROTOCOL>
256 HIDBoot<BOOT_PROTOCOL>::HIDBoot(USB *p, bool bRptProtoEnable/* = false*/) :
257 USBHID(p),
258 qNextPollTime(0),
259 bPollEnable(false),
260 bRptProtoEnable(bRptProtoEnable) {
261  Initialize();
262 
263  for(int i = 0; i < epMUL(BOOT_PROTOCOL); i++) {
264  pRptParser[i] = NULL;
265  }
266  if(pUsb)
267  pUsb->RegisterDeviceClass(this);
268 }
269 
270 template <const uint8_t BOOT_PROTOCOL>
272  for(int i = 0; i < totalEndpoints(BOOT_PROTOCOL); i++) {
273  epInfo[i].epAddr = 0;
274  epInfo[i].maxPktSize = (i) ? 0 : 8;
275  epInfo[i].bmSndToggle = 0;
276  epInfo[i].bmRcvToggle = 0;
277  epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
278  }
279  bNumEP = 1;
280  bNumIface = 0;
281  bConfNum = 0;
282 }
283 
284 template <const uint8_t BOOT_PROTOCOL>
285 uint8_t HIDBoot<BOOT_PROTOCOL>::Init(uint8_t parent, uint8_t port, bool lowspeed) {
286  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
287 
288  uint8_t buf[constBufSize];
289  uint8_t rcode;
290  UsbDevice *p = NULL;
291  EpInfo *oldep_ptr = NULL;
292  uint8_t len = 0;
293  //uint16_t cd_len = 0;
294 
295  uint8_t num_of_conf; // number of configurations
296  //uint8_t num_of_intf; // number of interfaces
297 
298  AddressPool &addrPool = pUsb->GetAddressPool();
299 
300  USBTRACE("BM Init\r\n");
301  //USBTRACE2("totalEndpoints:", (uint8_t) (totalEndpoints(BOOT_PROTOCOL)));
302  //USBTRACE2("epMUL:", epMUL(BOOT_PROTOCOL));
303 
304  if(bAddress)
306 
307  bInterval = 0;
308  // Get pointer to pseudo device with address 0 assigned
309  p = addrPool.GetUsbDevicePtr(0);
310 
311  if(!p)
313 
314  if(!p->epinfo) {
315  USBTRACE("epinfo\r\n");
317  }
318 
319  // Save old pointer to EP_RECORD of address 0
320  oldep_ptr = p->epinfo;
321 
322  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
323  p->epinfo = epInfo;
324 
325  p->lowspeed = lowspeed;
326 
327  // Get device descriptor
328  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
329 
330  if(!rcode)
331  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
332 
333  if(rcode) {
334  // Restore p->epinfo
335  p->epinfo = oldep_ptr;
336 
337  goto FailGetDevDescr;
338  }
339 
340  // Restore p->epinfo
341  p->epinfo = oldep_ptr;
342 
343  // Allocate new address according to device class
344  bAddress = addrPool.AllocAddress(parent, false, port);
345 
346  if(!bAddress)
348 
349  // Extract Max Packet Size from the device descriptor
350  epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0;
351 
352  // Assign new address to the device
353  rcode = pUsb->setAddr(0, 0, bAddress);
354 
355  if(rcode) {
356  p->lowspeed = false;
357  addrPool.FreeAddress(bAddress);
358  bAddress = 0;
359  USBTRACE2("setAddr:", rcode);
360  return rcode;
361  }
362  //delay(2); //per USB 2.0 sect.9.2.6.3
363 
364  USBTRACE2("Addr:", bAddress);
365 
366  p->lowspeed = false;
367 
368  p = addrPool.GetUsbDevicePtr(bAddress);
369 
370  if(!p)
372 
373  p->lowspeed = lowspeed;
374 
375  if(len)
376  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
377 
378  if(rcode)
379  goto FailGetDevDescr;
380 
381  num_of_conf = ((USB_DEVICE_DESCRIPTOR*)buf)->bNumConfigurations;
382 
383  USBTRACE2("NC:", num_of_conf);
384 
385  // GCC will optimize unused stuff away.
387  USBTRACE("HID_PROTOCOL_KEYBOARD AND MOUSE\r\n");
392  CP_MASK_COMPARE_ALL > confDescrParser(this);
393  confDescrParser.SetOR(); // Use the OR variant.
394  for(uint8_t i = 0; i < num_of_conf; i++) {
395  pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
396  if(bNumEP == (uint8_t)(totalEndpoints(BOOT_PROTOCOL)))
397  break;
398  }
399  } else {
400  // GCC will optimize unused stuff away.
401  if(BOOT_PROTOCOL & USB_HID_PROTOCOL_KEYBOARD) {
402  USBTRACE("HID_PROTOCOL_KEYBOARD\r\n");
403  for(uint8_t i = 0; i < num_of_conf; i++) {
408  CP_MASK_COMPARE_ALL> confDescrParserA(this);
409 
410  pUsb->getConfDescr(bAddress, 0, i, &confDescrParserA);
411  if(bNumEP == (uint8_t)(totalEndpoints(BOOT_PROTOCOL)))
412  break;
413  }
414  }
415 
416  // GCC will optimize unused stuff away.
417  if(BOOT_PROTOCOL & USB_HID_PROTOCOL_MOUSE) {
418  USBTRACE("HID_PROTOCOL_MOUSE\r\n");
419  for(uint8_t i = 0; i < num_of_conf; i++) {
424  CP_MASK_COMPARE_ALL> confDescrParserB(this);
425 
426  pUsb->getConfDescr(bAddress, 0, i, &confDescrParserB);
427  if(bNumEP == ((uint8_t)(totalEndpoints(BOOT_PROTOCOL))))
428  break;
429 
430  }
431  }
432  }
433  USBTRACE2("bNumEP:", bNumEP);
434 
435  if(bNumEP != (uint8_t)(totalEndpoints(BOOT_PROTOCOL))) {
437  goto Fail;
438  }
439 
440  // Assign epInfo to epinfo pointer
441  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
442  //USBTRACE2("setEpInfoEntry returned ", rcode);
443  USBTRACE2("Cnf:", bConfNum);
444 
445  delay(1000);
446 
447  // Set Configuration Value
448  rcode = pUsb->setConf(bAddress, 0, bConfNum);
449 
450  if(rcode)
451  goto FailSetConfDescr;
452 
453  delay(1000);
454 
455  USBTRACE2("bIfaceNum:", bIfaceNum);
456  USBTRACE2("bNumIface:", bNumIface);
457 
458  // Yes, mouse wants SetProtocol and SetIdle too!
459  for(uint8_t i = 0; i < epMUL(BOOT_PROTOCOL); i++) {
460  USBTRACE2("\r\nInterface:", i);
461  rcode = SetProtocol(i, bRptProtoEnable ? HID_RPT_PROTOCOL : USB_HID_BOOT_PROTOCOL);
462  if(rcode) goto FailSetProtocol;
463  USBTRACE2("PROTOCOL SET HID_BOOT rcode:", rcode);
464  rcode = SetIdle(i, 0, 0);
465  USBTRACE2("SET_IDLE rcode:", rcode);
466  // if(rcode) goto FailSetIdle; This can fail.
467  // Get the RPIPE and just throw it away.
469  rcode = GetReportDescr(i, &sink);
470  USBTRACE2("RPIPE rcode:", rcode);
471  }
472 
473  // Get RPIPE and throw it away.
474 
475  if(BOOT_PROTOCOL & USB_HID_PROTOCOL_KEYBOARD) {
476  // Wake keyboard interface by twinkling up to 5 LEDs that are in the spec.
477  // kana, compose, scroll, caps, num
478  rcode = 0x20; // Reuse rcode.
479  while(rcode) {
480  rcode >>= 1;
481  // Ignore any error returned, we don't care if LED is not supported
482  SetReport(0, 0, 2, 0, 1, &rcode); // Eventually becomes zero (All off)
483  delay(25);
484  }
485  }
486  USBTRACE("BM configured\r\n");
487 
488  bPollEnable = true;
489  return 0;
490 
491 FailGetDevDescr:
492 #ifdef DEBUG_USB_HOST
494  goto Fail;
495 #endif
496 
497  //FailSetDevTblEntry:
498  //#ifdef DEBUG_USB_HOST
499  // NotifyFailSetDevTblEntry();
500  // goto Fail;
501  //#endif
502 
503  //FailGetConfDescr:
504  //#ifdef DEBUG_USB_HOST
505  // NotifyFailGetConfDescr();
506  // goto Fail;
507  //#endif
508 
509 FailSetConfDescr:
510 #ifdef DEBUG_USB_HOST
512  goto Fail;
513 #endif
514 
515 FailSetProtocol:
516 #ifdef DEBUG_USB_HOST
517  USBTRACE("SetProto:");
518  goto Fail;
519 #endif
520 
521  //FailSetIdle:
522  //#ifdef DEBUG_USB_HOST
523  // USBTRACE("SetIdle:");
524  //#endif
525 
526 Fail:
527 #ifdef DEBUG_USB_HOST
528  NotifyFail(rcode);
529 #endif
530  Release();
531 
532  return rcode;
533 }
534 
535 template <const uint8_t BOOT_PROTOCOL>
536 void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
537 
538  // If the first configuration satisfies, the others are not considered.
539  //if(bNumEP > 1 && conf != bConfNum)
540  if(bNumEP == totalEndpoints(BOOT_PROTOCOL))
541  return;
542 
543  bConfNum = conf;
544  bIfaceNum = iface;
545 
546  if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) {
547  if(pep->bInterval > bInterval) bInterval = pep->bInterval;
548 
549  // Fill in the endpoint info structure
550  epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
551  epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
552  epInfo[bNumEP].bmSndToggle = 0;
553  epInfo[bNumEP].bmRcvToggle = 0;
554  epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
555  bNumEP++;
556 
557  }
558 }
559 
560 template <const uint8_t BOOT_PROTOCOL>
563 
564  bConfNum = 0;
565  bIfaceNum = 0;
566  bNumEP = 1;
567  bAddress = 0;
568  qNextPollTime = 0;
569  bPollEnable = false;
570 
571  return 0;
572 }
573 
574 template <const uint8_t BOOT_PROTOCOL>
576  uint8_t rcode = 0;
577 
578  if(bPollEnable && ((long)(millis() - qNextPollTime) >= 0L)) {
579 
580  // To-do: optimize manually, using the for loop only if needed.
581  for(int i = 0; i < epMUL(BOOT_PROTOCOL); i++) {
582  const uint16_t const_buff_len = 16;
583  uint8_t buf[const_buff_len];
584 
585  USBTRACE3("(hidboot.h) i=", i, 0x81);
586  USBTRACE3("(hidboot.h) epInfo[epInterruptInIndex + i].epAddr=", epInfo[epInterruptInIndex + i].epAddr, 0x81);
587  USBTRACE3("(hidboot.h) epInfo[epInterruptInIndex + i].maxPktSize=", epInfo[epInterruptInIndex + i].maxPktSize, 0x81);
588  uint16_t read = (uint16_t)epInfo[epInterruptInIndex + i].maxPktSize;
589 
590  rcode = pUsb->inTransfer(bAddress, epInfo[epInterruptInIndex + i].epAddr, &read, buf);
591  // SOME buggy dongles report extra keys (like sleep) using a 2 byte packet on the wrong endpoint.
592  // Since keyboard and mice must report at least 3 bytes, we ignore the extra data.
593  if(!rcode && read > 2) {
594  if(pRptParser[i])
595  pRptParser[i]->Parse((USBHID*)this, 0, (uint8_t)read, buf);
596 #ifdef DEBUG_USB_HOST
597  // We really don't care about errors and anomalies unless we are debugging.
598  } else {
599  if(rcode != hrNAK) {
600  USBTRACE3("(hidboot.h) Poll:", rcode, 0x81);
601  }
602  if(!rcode && read) {
603  USBTRACE3("(hidboot.h) Strange read count: ", read, 0x80);
604  USBTRACE3("(hidboot.h) Interface:", i, 0x80);
605  }
606  }
607 
608  if(!rcode && read && (UsbDEBUGlvl > 0x7f)) {
609  for(uint8_t i = 0; i < read; i++) {
610  PrintHex<uint8_t > (buf[i], 0x80);
611  USBTRACE1(" ", 0x80);
612  }
613  if(read)
614  USBTRACE1("\r\n", 0x80);
615 #endif
616  }
617 
618  }
619  qNextPollTime = millis() + bInterval;
620  }
621  return rcode;
622 }
623 
624 #endif // __HIDBOOTMOUSE_H__
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
- -
uint8_t bmRcvToggle
Definition: address.h:41
+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 #if !defined(__HIDBOOT_H__)
18 #define __HIDBOOT_H__
19 
20 #include "usbhid.h"
21 
22 #define UHS_HID_BOOT_KEY_ZERO 0x27
23 #define UHS_HID_BOOT_KEY_ENTER 0x28
24 #define UHS_HID_BOOT_KEY_SPACE 0x2c
25 #define UHS_HID_BOOT_KEY_CAPS_LOCK 0x39
26 #define UHS_HID_BOOT_KEY_SCROLL_LOCK 0x47
27 #define UHS_HID_BOOT_KEY_NUM_LOCK 0x53
28 #define UHS_HID_BOOT_KEY_ZERO2 0x62
29 #define UHS_HID_BOOT_KEY_PERIOD 0x63
30 
31 // Don't worry, GCC will optimize the result to a final value.
32 #define bitsEndpoints(p) ((((p) & USB_HID_PROTOCOL_KEYBOARD)? 2 : 0) | (((p) & USB_HID_PROTOCOL_MOUSE)? 1 : 0))
33 #define totalEndpoints(p) ((bitsEndpoints(p) == 3) ? 3 : 2)
34 #define epMUL(p) ((((p) & USB_HID_PROTOCOL_KEYBOARD)? 1 : 0) + (((p) & USB_HID_PROTOCOL_MOUSE)? 1 : 0))
35 
36 // Already defined in hid.h
37 // #define HID_MAX_HID_CLASS_DESCRIPTORS 5
38 
39 struct MOUSEINFO {
40 
41  struct {
42  uint8_t bmLeftButton : 1;
43  uint8_t bmRightButton : 1;
44  uint8_t bmMiddleButton : 1;
45  uint8_t bmDummy : 5;
46  };
47  int8_t dX;
48  int8_t dY;
49 };
50 
52 
53  union {
55  uint8_t bInfo[sizeof (MOUSEINFO)];
56  } prevState;
57 
58 public:
59  void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
60 
61 protected:
62 
63  virtual void OnMouseMove(MOUSEINFO *mi __attribute__((unused))) {
64  };
65 
66  virtual void OnLeftButtonUp(MOUSEINFO *mi __attribute__((unused))) {
67  };
68 
69  virtual void OnLeftButtonDown(MOUSEINFO *mi __attribute__((unused))) {
70  };
71 
72  virtual void OnRightButtonUp(MOUSEINFO *mi __attribute__((unused))) {
73  };
74 
75  virtual void OnRightButtonDown(MOUSEINFO *mi __attribute__((unused))) {
76  };
77 
78  virtual void OnMiddleButtonUp(MOUSEINFO *mi __attribute__((unused))) {
79  };
80 
81  virtual void OnMiddleButtonDown(MOUSEINFO *mi __attribute__((unused))) {
82  };
83 };
84 
85 struct MODIFIERKEYS {
86  uint8_t bmLeftCtrl : 1;
87  uint8_t bmLeftShift : 1;
88  uint8_t bmLeftAlt : 1;
89  uint8_t bmLeftGUI : 1;
90  uint8_t bmRightCtrl : 1;
91  uint8_t bmRightShift : 1;
92  uint8_t bmRightAlt : 1;
93  uint8_t bmRightGUI : 1;
94 };
95 
96 struct KBDINFO {
97 
98  struct {
99  uint8_t bmLeftCtrl : 1;
100  uint8_t bmLeftShift : 1;
101  uint8_t bmLeftAlt : 1;
102  uint8_t bmLeftGUI : 1;
103  uint8_t bmRightCtrl : 1;
104  uint8_t bmRightShift : 1;
105  uint8_t bmRightAlt : 1;
106  uint8_t bmRightGUI : 1;
107  };
108  uint8_t bReserved;
109  uint8_t Keys[6];
110 };
111 
112 struct KBDLEDS {
113  uint8_t bmNumLock : 1;
114  uint8_t bmCapsLock : 1;
115  uint8_t bmScrollLock : 1;
116  uint8_t bmCompose : 1;
117  uint8_t bmKana : 1;
118  uint8_t bmReserved : 3;
119 };
120 
122  static const uint8_t numKeys[10];
123  static const uint8_t symKeysUp[12];
124  static const uint8_t symKeysLo[12];
125  static const uint8_t padKeys[5];
126 
127 protected:
128 
129  union {
131  uint8_t bInfo[sizeof (KBDINFO)];
132  } prevState;
133 
134  union {
136  uint8_t bLeds;
137  } kbdLockingKeys;
138 
139  uint8_t OemToAscii(uint8_t mod, uint8_t key);
140 
141 public:
142 
144  kbdLockingKeys.bLeds = 0;
145  };
146 
147  void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
148 
149 protected:
150 
151  virtual uint8_t HandleLockingKeys(USBHID* hid, uint8_t key) {
152  uint8_t old_keys = kbdLockingKeys.bLeds;
153 
154  switch(key) {
156  kbdLockingKeys.kbdLeds.bmNumLock = ~kbdLockingKeys.kbdLeds.bmNumLock;
157  break;
159  kbdLockingKeys.kbdLeds.bmCapsLock = ~kbdLockingKeys.kbdLeds.bmCapsLock;
160  break;
162  kbdLockingKeys.kbdLeds.bmScrollLock = ~kbdLockingKeys.kbdLeds.bmScrollLock;
163  break;
164  }
165 
166  if(old_keys != kbdLockingKeys.bLeds && hid) {
167  uint8_t lockLeds = kbdLockingKeys.bLeds;
168  return (hid->SetReport(0, 0/*hid->GetIface()*/, 2, 0, 1, &lockLeds));
169  }
170 
171  return 0;
172  };
173 
174  virtual void OnControlKeysChanged(uint8_t before __attribute__((unused)), uint8_t after __attribute__((unused))) {
175  };
176 
177  virtual void OnKeyDown(uint8_t mod __attribute__((unused)), uint8_t key __attribute__((unused))) {
178  };
179 
180  virtual void OnKeyUp(uint8_t mod __attribute__((unused)), uint8_t key __attribute__((unused))) {
181  };
182 
183  virtual const uint8_t *getNumKeys() {
184  return numKeys;
185  };
186 
187  virtual const uint8_t *getSymKeysUp() {
188  return symKeysUp;
189  };
190 
191  virtual const uint8_t *getSymKeysLo() {
192  return symKeysLo;
193  };
194 
195  virtual const uint8_t *getPadKeys() {
196  return padKeys;
197  };
198 };
199 
200 template <const uint8_t BOOT_PROTOCOL>
201 class HIDBoot : public USBHID //public USBDeviceConfig, public UsbConfigXtracter
202 {
203  EpInfo epInfo[totalEndpoints(BOOT_PROTOCOL)];
204  HIDReportParser *pRptParser[epMUL(BOOT_PROTOCOL)];
205 
206  uint8_t bConfNum; // configuration number
207  uint8_t bIfaceNum; // Interface Number
208  uint8_t bNumIface; // number of interfaces in the configuration
209  uint8_t bNumEP; // total number of EP in the configuration
210  uint32_t qNextPollTime; // next poll time
211  bool bPollEnable; // poll enable flag
212  uint8_t bInterval; // largest interval
213  bool bRptProtoEnable; // Report Protocol enable flag
214 
215  void Initialize();
216 
217  virtual HIDReportParser* GetReportParser(uint8_t id) {
218  return pRptParser[id];
219  };
220 
221 public:
222  HIDBoot(USB *p, bool bRptProtoEnable = false);
223 
224  virtual bool SetReportParser(uint8_t id, HIDReportParser *prs) {
225  pRptParser[id] = prs;
226  return true;
227  };
228 
229  // USBDeviceConfig implementation
230  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
231  uint8_t Release();
232  uint8_t Poll();
233 
234  virtual uint8_t GetAddress() {
235  return bAddress;
236  };
237 
238  virtual bool isReady() {
239  return bPollEnable;
240  };
241 
242  // UsbConfigXtracter implementation
243  // Method should be defined here if virtual.
244  virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
245 
246  virtual bool DEVCLASSOK(uint8_t klass) {
247  return (klass == USB_CLASS_HID);
248  }
249 
250  virtual bool DEVSUBCLASSOK(uint8_t subklass) {
251  return (subklass == BOOT_PROTOCOL);
252  }
253 };
254 
255 template <const uint8_t BOOT_PROTOCOL>
256 HIDBoot<BOOT_PROTOCOL>::HIDBoot(USB *p, bool bRptProtoEnable/* = false*/) :
257 USBHID(p),
258 qNextPollTime(0),
259 bPollEnable(false),
260 bRptProtoEnable(bRptProtoEnable) {
261  Initialize();
262 
263  for(int i = 0; i < epMUL(BOOT_PROTOCOL); i++) {
264  pRptParser[i] = NULL;
265  }
266  if(pUsb)
267  pUsb->RegisterDeviceClass(this);
268 }
269 
270 template <const uint8_t BOOT_PROTOCOL>
272  for(int i = 0; i < totalEndpoints(BOOT_PROTOCOL); i++) {
273  epInfo[i].epAddr = 0;
274  epInfo[i].maxPktSize = (i) ? 0 : 8;
275  epInfo[i].bmSndToggle = 0;
276  epInfo[i].bmRcvToggle = 0;
277  epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
278  }
279  bNumEP = 1;
280  bNumIface = 0;
281  bConfNum = 0;
282 }
283 
284 template <const uint8_t BOOT_PROTOCOL>
285 uint8_t HIDBoot<BOOT_PROTOCOL>::Init(uint8_t parent, uint8_t port, bool lowspeed) {
286  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
287 
288  uint8_t buf[constBufSize];
289  USB_DEVICE_DESCRIPTOR* device;
290  uint8_t rcode;
291  UsbDevice *p = NULL;
292  EpInfo *oldep_ptr = NULL;
293  uint8_t len = 0;
294  //uint16_t cd_len = 0;
295 
296  uint8_t num_of_conf; // number of configurations
297  //uint8_t num_of_intf; // number of interfaces
298 
299  AddressPool &addrPool = pUsb->GetAddressPool();
300 
301  USBTRACE("BM Init\r\n");
302  //USBTRACE2("totalEndpoints:", (uint8_t) (totalEndpoints(BOOT_PROTOCOL)));
303  //USBTRACE2("epMUL:", epMUL(BOOT_PROTOCOL));
304 
305  if(bAddress)
307 
308  bInterval = 0;
309  // Get pointer to pseudo device with address 0 assigned
310  p = addrPool.GetUsbDevicePtr(0);
311 
312  if(!p)
314 
315  if(!p->epinfo) {
316  USBTRACE("epinfo\r\n");
318  }
319 
320  // Save old pointer to EP_RECORD of address 0
321  oldep_ptr = p->epinfo;
322 
323  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
324  p->epinfo = epInfo;
325 
326  p->lowspeed = lowspeed;
327 
328  // Get device descriptor
329  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
330 
331  if(!rcode)
332  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
333 
334  device = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
335 
336  if(rcode) {
337  // Restore p->epinfo
338  p->epinfo = oldep_ptr;
339 
340  goto FailGetDevDescr;
341  }
342 
343  // Restore p->epinfo
344  p->epinfo = oldep_ptr;
345 
346  // Allocate new address according to device class
347  bAddress = addrPool.AllocAddress(parent, false, port);
348 
349  if(!bAddress)
351 
352  // Extract Max Packet Size from the device descriptor
353  epInfo[0].maxPktSize = (uint8_t)(device->bMaxPacketSize0);
354 
355  // Assign new address to the device
356  rcode = pUsb->setAddr(0, 0, bAddress);
357 
358  if(rcode) {
359  p->lowspeed = false;
360  addrPool.FreeAddress(bAddress);
361  bAddress = 0;
362  USBTRACE2("setAddr:", rcode);
363  return rcode;
364  }
365  //delay(2); //per USB 2.0 sect.9.2.6.3
366 
367  USBTRACE2("Addr:", bAddress);
368 
369  p->lowspeed = false;
370 
371  p = addrPool.GetUsbDevicePtr(bAddress);
372 
373  if(!p)
375 
376  p->lowspeed = lowspeed;
377 
378  if(len)
379  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
380 
381  if(rcode)
382  goto FailGetDevDescr;
383 
384  num_of_conf = device->bNumConfigurations;
385 
386  USBTRACE2("NC:", num_of_conf);
387 
388  // GCC will optimize unused stuff away.
390  USBTRACE("HID_PROTOCOL_KEYBOARD AND MOUSE\r\n");
395  CP_MASK_COMPARE_ALL > confDescrParser(this);
396  confDescrParser.SetOR(); // Use the OR variant.
397  for(uint8_t i = 0; i < num_of_conf; i++) {
398  pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
399  if(bNumEP == (uint8_t)(totalEndpoints(BOOT_PROTOCOL)))
400  break;
401  }
402  } else {
403  // GCC will optimize unused stuff away.
404  if(BOOT_PROTOCOL & USB_HID_PROTOCOL_KEYBOARD) {
405  USBTRACE("HID_PROTOCOL_KEYBOARD\r\n");
406  for(uint8_t i = 0; i < num_of_conf; i++) {
411  CP_MASK_COMPARE_ALL> confDescrParserA(this);
412 
413  pUsb->getConfDescr(bAddress, 0, i, &confDescrParserA);
414  if(bNumEP == (uint8_t)(totalEndpoints(BOOT_PROTOCOL)))
415  break;
416  }
417  }
418 
419  // GCC will optimize unused stuff away.
420  if(BOOT_PROTOCOL & USB_HID_PROTOCOL_MOUSE) {
421  USBTRACE("HID_PROTOCOL_MOUSE\r\n");
422  for(uint8_t i = 0; i < num_of_conf; i++) {
427  CP_MASK_COMPARE_ALL> confDescrParserB(this);
428 
429  pUsb->getConfDescr(bAddress, 0, i, &confDescrParserB);
430  if(bNumEP == ((uint8_t)(totalEndpoints(BOOT_PROTOCOL))))
431  break;
432 
433  }
434  }
435  }
436  USBTRACE2("bNumEP:", bNumEP);
437 
438  if(bNumEP != (uint8_t)(totalEndpoints(BOOT_PROTOCOL))) {
440  goto Fail;
441  }
442 
443  // Assign epInfo to epinfo pointer
444  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
445  //USBTRACE2("setEpInfoEntry returned ", rcode);
446  USBTRACE2("Cnf:", bConfNum);
447 
448  delay(1000);
449 
450  // Set Configuration Value
451  rcode = pUsb->setConf(bAddress, 0, bConfNum);
452 
453  if(rcode)
454  goto FailSetConfDescr;
455 
456  delay(1000);
457 
458  USBTRACE2("bIfaceNum:", bIfaceNum);
459  USBTRACE2("bNumIface:", bNumIface);
460 
461  // Yes, mouse wants SetProtocol and SetIdle too!
462  for(uint8_t i = 0; i < epMUL(BOOT_PROTOCOL); i++) {
463  USBTRACE2("\r\nInterface:", i);
464  rcode = SetProtocol(i, bRptProtoEnable ? HID_RPT_PROTOCOL : USB_HID_BOOT_PROTOCOL);
465  if(rcode) goto FailSetProtocol;
466  USBTRACE2("PROTOCOL SET HID_BOOT rcode:", rcode);
467  rcode = SetIdle(i, 0, 0);
468  USBTRACE2("SET_IDLE rcode:", rcode);
469  // if(rcode) goto FailSetIdle; This can fail.
470  // Get the RPIPE and just throw it away.
472  rcode = GetReportDescr(i, &sink);
473  USBTRACE2("RPIPE rcode:", rcode);
474  }
475 
476  // Get RPIPE and throw it away.
477 
478  if(BOOT_PROTOCOL & USB_HID_PROTOCOL_KEYBOARD) {
479  // Wake keyboard interface by twinkling up to 5 LEDs that are in the spec.
480  // kana, compose, scroll, caps, num
481  rcode = 0x20; // Reuse rcode.
482  while(rcode) {
483  rcode >>= 1;
484  // Ignore any error returned, we don't care if LED is not supported
485  SetReport(0, 0, 2, 0, 1, &rcode); // Eventually becomes zero (All off)
486  delay(25);
487  }
488  }
489  USBTRACE("BM configured\r\n");
490 
491  bPollEnable = true;
492  return 0;
493 
494 FailGetDevDescr:
495 #ifdef DEBUG_USB_HOST
497  goto Fail;
498 #endif
499 
500  //FailSetDevTblEntry:
501  //#ifdef DEBUG_USB_HOST
502  // NotifyFailSetDevTblEntry();
503  // goto Fail;
504  //#endif
505 
506  //FailGetConfDescr:
507  //#ifdef DEBUG_USB_HOST
508  // NotifyFailGetConfDescr();
509  // goto Fail;
510  //#endif
511 
512 FailSetConfDescr:
513 #ifdef DEBUG_USB_HOST
515  goto Fail;
516 #endif
517 
518 FailSetProtocol:
519 #ifdef DEBUG_USB_HOST
520  USBTRACE("SetProto:");
521  goto Fail;
522 #endif
523 
524  //FailSetIdle:
525  //#ifdef DEBUG_USB_HOST
526  // USBTRACE("SetIdle:");
527  //#endif
528 
529 Fail:
530 #ifdef DEBUG_USB_HOST
531  NotifyFail(rcode);
532 #endif
533  Release();
534 
535  return rcode;
536 }
537 
538 template <const uint8_t BOOT_PROTOCOL>
539 void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
540 
541  // If the first configuration satisfies, the others are not considered.
542  //if(bNumEP > 1 && conf != bConfNum)
543  if(bNumEP == totalEndpoints(BOOT_PROTOCOL))
544  return;
545 
546  bConfNum = conf;
547  bIfaceNum = iface;
548 
549  if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80) {
550  if(pep->bInterval > bInterval) bInterval = pep->bInterval;
551 
552  // Fill in the endpoint info structure
553  epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
554  epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
555  epInfo[bNumEP].bmSndToggle = 0;
556  epInfo[bNumEP].bmRcvToggle = 0;
557  epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
558  bNumEP++;
559 
560  }
561 }
562 
563 template <const uint8_t BOOT_PROTOCOL>
565  pUsb->GetAddressPool().FreeAddress(bAddress);
566 
567  bConfNum = 0;
568  bIfaceNum = 0;
569  bNumEP = 1;
570  bAddress = 0;
571  qNextPollTime = 0;
572  bPollEnable = false;
573 
574  return 0;
575 }
576 
577 template <const uint8_t BOOT_PROTOCOL>
579  uint8_t rcode = 0;
580 
581  if(bPollEnable && ((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L)) {
582 
583  // To-do: optimize manually, using the for loop only if needed.
584  for(int i = 0; i < epMUL(BOOT_PROTOCOL); i++) {
585  const uint16_t const_buff_len = 16;
586  uint8_t buf[const_buff_len];
587 
588  USBTRACE3("(hidboot.h) i=", i, 0x81);
589  USBTRACE3("(hidboot.h) epInfo[epInterruptInIndex + i].epAddr=", epInfo[epInterruptInIndex + i].epAddr, 0x81);
590  USBTRACE3("(hidboot.h) epInfo[epInterruptInIndex + i].maxPktSize=", epInfo[epInterruptInIndex + i].maxPktSize, 0x81);
591  uint16_t read = (uint16_t)epInfo[epInterruptInIndex + i].maxPktSize;
592 
593  rcode = pUsb->inTransfer(bAddress, epInfo[epInterruptInIndex + i].epAddr, &read, buf);
594  // SOME buggy dongles report extra keys (like sleep) using a 2 byte packet on the wrong endpoint.
595  // Since keyboard and mice must report at least 3 bytes, we ignore the extra data.
596  if(!rcode && read > 2) {
597  if(pRptParser[i])
598  pRptParser[i]->Parse((USBHID*)this, 0, (uint8_t)read, buf);
599 #ifdef DEBUG_USB_HOST
600  // We really don't care about errors and anomalies unless we are debugging.
601  } else {
602  if(rcode != hrNAK) {
603  USBTRACE3("(hidboot.h) Poll:", rcode, 0x81);
604  }
605  if(!rcode && read) {
606  USBTRACE3("(hidboot.h) Strange read count: ", read, 0x80);
607  USBTRACE3("(hidboot.h) Interface:", i, 0x80);
608  }
609  }
610 
611  if(!rcode && read && (UsbDEBUGlvl > 0x7f)) {
612  for(uint8_t i = 0; i < read; i++) {
613  PrintHex<uint8_t > (buf[i], 0x80);
614  USBTRACE1(" ", 0x80);
615  }
616  if(read)
617  USBTRACE1("\r\n", 0x80);
618 #endif
619  }
620 
621  }
622  qNextPollTime = (uint32_t)millis() + bInterval;
623  }
624  return rcode;
625 }
626 
627 #endif // __HIDBOOTMOUSE_H__
- + -
#define CP_MASK_COMPARE_ALL
+
#define CP_MASK_COMPARE_ALL
Definition: usbhid.h:143
USB * pUsb
Definition: usbhid.h:145
-
EpInfo * epinfo
Definition: address.h:76
+
uint8_t bmLeftShift
Definition: hidboot.h:87
+
EpInfo * epinfo
Definition: address.h:83
+
uint8_t bmKana
Definition: hidboot.h:117
#define HID_BOOT_INTF_SUBCLASS
Definition: usbhid.h:89
uint8_t bmRightButton
Definition: hidboot.h:43
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
virtual const uint8_t * getSymKeysLo()
Definition: hidboot.h:191
virtual void OnRightButtonDown(MOUSEINFO *mi)
Definition: hidboot.h:75
virtual void OnKeyDown(uint8_t mod, uint8_t key)
Definition: hidboot.h:177
-
uint8_t bmNakPower
Definition: address.h:42
-
uint8_t GetReportDescr(uint16_t wIndex, USBReadParser *parser=NULL)
Definition: usbhid.cpp:34
-
uint8_t Poll()
Definition: hidboot.h:575
- +
uint8_t Poll()
Definition: hidboot.h:578
+ +
uint8_t bmLeftCtrl
Definition: hidboot.h:99
- - -
#define NotifyFail(...)
Definition: message.h:55
+ + +
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:112
+
uint8_t bmRightShift
Definition: hidboot.h:104
+
#define NotifyFail(...)
Definition: message.h:62
virtual void OnMiddleButtonUp(MOUSEINFO *mi)
Definition: hidboot.h:78
MOUSEINFO mouseInfo
Definition: hidboot.h:54
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
-
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: hidboot.h:536
+
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: hidboot.h:539
virtual bool DEVCLASSOK(uint8_t klass)
Definition: hidboot.h:246
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
+
uint8_t bmCapsLock
Definition: hidboot.h:114
+
uint8_t bmNumLock
Definition: hidboot.h:113
#define UHS_HID_BOOT_KEY_SCROLL_LOCK
Definition: hidboot.h:26
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: hidboot.h:285
virtual bool SetReportParser(uint8_t id, HIDReportParser *prs)
Definition: hidboot.h:224
virtual void OnKeyUp(uint8_t mod, uint8_t key)
Definition: hidboot.h:180
-
int UsbDEBUGlvl
Definition: message.cpp:22
-
#define USB_CLASS_HID
Definition: UsbCore.h:59
+
int UsbDEBUGlvl
Definition: message.cpp:29
+
uint8_t bmLeftGUI
Definition: hidboot.h:102
+
#define USB_CLASS_HID
Definition: UsbCore.h:70
virtual void FreeAddress(uint8_t addr)=0
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
-
uint8_t SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)
Definition: usbhid.cpp:62
- - + +
uint8_t bmReserved
Definition: hidboot.h:118
+
virtual const uint8_t * getSymKeysUp()
Definition: hidboot.h:187
-
#define USBTRACE2(s, r)
Definition: macros.h:77
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
+
#define USBTRACE2(s, r)
Definition: macros.h:84
uint8_t bmMiddleButton
Definition: hidboot.h:44
+
void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hidboot.cpp:127
virtual void OnLeftButtonUp(MOUSEINFO *mi)
Definition: hidboot.h:66
-
uint8_t epAddr
Definition: address.h:33
uint8_t bmDummy
Definition: hidboot.h:45
+
uint8_t bmLeftAlt
Definition: hidboot.h:88
virtual uint8_t GetAddress()
Definition: hidboot.h:234
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
HIDBoot(USB *p, bool bRptProtoEnable=false)
Definition: hidboot.h:256
+
uint8_t bInfo[sizeof(KBDINFO)]
Definition: hidboot.h:131
+
uint8_t bmRightCtrl
Definition: hidboot.h:103
virtual uint8_t HandleLockingKeys(USBHID *hid, uint8_t key)
Definition: hidboot.h:151
+
uint8_t bInfo[sizeof(MOUSEINFO)]
Definition: hidboot.h:55
#define epMUL(p)
Definition: hidboot.h:34
-
Definition: address.h:32
+
Definition: address.h:39
virtual void OnMouseMove(MOUSEINFO *mi)
Definition: hidboot.h:63
-
#define hrNAK
Definition: max3421e.h:211
+
#define hrNAK
Definition: max3421e.h:218
virtual void OnRightButtonUp(MOUSEINFO *mi)
Definition: hidboot.h:72
+
uint8_t bmLeftGUI
Definition: hidboot.h:89
uint8_t bAddress
Definition: usbhid.h:146
-
uint16_t wMaxPacketSize
Definition: usb_ch9.h:146
+
uint16_t wMaxPacketSize
Definition: usb_ch9.h:153
+
#define bmUSB_TRANSFER_TYPE
Definition: usb_ch9.h:94
virtual void OnMiddleButtonDown(MOUSEINFO *mi)
Definition: hidboot.h:81
- - -
static const uint8_t epInterruptInIndex
Definition: usbhid.h:149
+ + +
uint8_t bmRightCtrl
Definition: hidboot.h:90
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bEndpointAddress
Definition: usb_ch9.h:144
+
uint8_t bEndpointAddress
Definition: usb_ch9.h:151
+
uint8_t bmRightGUI
Definition: hidboot.h:93
#define UHS_HID_BOOT_KEY_NUM_LOCK
Definition: hidboot.h:27
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
+
uint8_t bmScrollLock
Definition: hidboot.h:115
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
#define USB_HID_PROTOCOL_KEYBOARD
Definition: usbhid.h:93
#define totalEndpoints(p)
Definition: hidboot.h:33
-
#define USBTRACE1(s, l)
Definition: macros.h:76
-
#define USB_NAK_NOWAIT
Definition: address.h:29
-
uint8_t SetProtocol(uint8_t iface, uint8_t protocol)
Definition: usbhid.cpp:66
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
+
uint8_t bmLeftShift
Definition: hidboot.h:100
+
#define USBTRACE1(s, l)
Definition: macros.h:83
+
uint8_t bmRightShift
Definition: hidboot.h:91
+
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
+
union KeyboardReportParser::@17 prevState
int8_t dX
Definition: hidboot.h:47
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
virtual void OnControlKeysChanged(uint8_t before, uint8_t after)
Definition: hidboot.h:174
static const uint8_t totalEndpoints
Definition: usbhid.h:154
-
uint8_t Release()
Definition: hidboot.h:561
+
uint8_t Release()
Definition: hidboot.h:564
+
uint8_t bmRightGUI
Definition: hidboot.h:106
virtual void OnLeftButtonDown(MOUSEINFO *mi)
Definition: hidboot.h:69
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
uint8_t SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)
Definition: usbhid.cpp:50
virtual const uint8_t * getNumKeys()
Definition: hidboot.h:183
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
+
uint8_t bNumConfigurations
Definition: usb_ch9.h:119
+
union KeyboardReportParser::@18 kbdLockingKeys
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
+
uint8_t bmLeftCtrl
Definition: hidboot.h:86
virtual bool isReady()
Definition: hidboot.h:238
#define USB_HID_BOOT_PROTOCOL
Definition: usbhid.h:82
virtual const uint8_t * getPadKeys()
Definition: hidboot.h:195
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
+
uint8_t bmRightAlt
Definition: hidboot.h:92
int8_t dY
Definition: hidboot.h:48
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
+
uint8_t bmRightAlt
Definition: hidboot.h:105
+
void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hidboot.cpp:19
virtual bool DEVSUBCLASSOK(uint8_t subklass)
Definition: hidboot.h:250
#define USB_HID_PROTOCOL_MOUSE
Definition: usbhid.h:94
-
#define USBTRACE3(s, r, l)
Definition: macros.h:78
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
-
virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)=0
+
uint8_t Keys[6]
Definition: hidboot.h:109
+
#define USBTRACE3(s, r, l)
Definition: macros.h:85
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
+
uint8_t bmCompose
Definition: hidboot.h:116
uint8_t bmLeftButton
Definition: hidboot.h:42
+
uint8_t bmLeftAlt
Definition: hidboot.h:101
uint8_t bReserved
Definition: hidboot.h:108
#define HID_RPT_PROTOCOL
Definition: usbhid.h:83
#define UHS_HID_BOOT_KEY_CAPS_LOCK
Definition: hidboot.h:25
-
#define USBTRACE(s)
Definition: macros.h:75
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
- +
#define USBTRACE(s)
Definition: macros.h:82
+
uint8_t OemToAscii(uint8_t mod, uint8_t key)
Definition: hidboot.cpp:165
+
diff --git a/hidcomposite_8cpp.html b/hidcomposite_8cpp.html index 100b9445..93bcb9a6 100644 --- a/hidcomposite_8cpp.html +++ b/hidcomposite_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidcomposite.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/hidcomposite_8cpp__incl.md5 b/hidcomposite_8cpp__incl.md5 index 26f07e87..d41de51b 100644 --- a/hidcomposite_8cpp__incl.md5 +++ b/hidcomposite_8cpp__incl.md5 @@ -1 +1 @@ -5165af043119ae7e1520852120f4b3a4 \ No newline at end of file +cfde20a929775a9aa01710373822c470 \ No newline at end of file diff --git a/hidcomposite_8cpp__incl.png b/hidcomposite_8cpp__incl.png index 3be31f5a..34978339 100644 Binary files a/hidcomposite_8cpp__incl.png and b/hidcomposite_8cpp__incl.png differ diff --git a/hidcomposite_8cpp_source.html b/hidcomposite_8cpp_source.html index bfc6610b..06c8baad 100644 --- a/hidcomposite_8cpp_source.html +++ b/hidcomposite_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidcomposite.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
hidcomposite.cpp
-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 #include "hidcomposite.h"
19 
21 USBHID(p),
22 qNextPollTime(0),
23 pollInterval(0),
24 bPollEnable(false),
25 bHasReportId(false) {
26  Initialize();
27 
28  if(pUsb)
30 }
31 
32 uint16_t HIDComposite::GetHidClassDescrLen(uint8_t type, uint8_t num) {
33  for(uint8_t i = 0, n = 0; i < HID_MAX_HID_CLASS_DESCRIPTORS; i++) {
34  if(descrInfo[i].bDescrType == type) {
35  if(n == num)
36  return descrInfo[i].wDescriptorLength;
37  n++;
38  }
39  }
40  return 0;
41 }
42 
43 void HIDComposite::Initialize() {
44  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
45  rptParsers[i].rptId = 0;
46  rptParsers[i].rptParser = NULL;
47  }
48  for(uint8_t i = 0; i < HID_MAX_HID_CLASS_DESCRIPTORS; i++) {
49  descrInfo[i].bDescrType = 0;
50  descrInfo[i].wDescriptorLength = 0;
51  }
52  for(uint8_t i = 0; i < maxHidInterfaces; i++) {
53  hidInterfaces[i].bmInterface = 0;
54  hidInterfaces[i].bmProtocol = 0;
55 
56  for(uint8_t j = 0; j < maxEpPerInterface; j++)
57  hidInterfaces[i].epIndex[j] = 0;
58  }
59  for(uint8_t i = 0; i < totalEndpoints; i++) {
60  epInfo[i].epAddr = 0;
61  epInfo[i].maxPktSize = (i) ? 0 : 8;
62  epInfo[i].bmSndToggle = 0;
63  epInfo[i].bmRcvToggle = 0;
65  }
66  bNumEP = 1;
67  bNumIface = 0;
68  bConfNum = 0;
69  pollInterval = 0;
70 }
71 
73  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
74  if(rptParsers[i].rptId == 0 && rptParsers[i].rptParser == NULL) {
75  rptParsers[i].rptId = id;
76  rptParsers[i].rptParser = prs;
77  return true;
78  }
79  }
80  return false;
81 }
82 
84  if(!bHasReportId)
85  return ((rptParsers[0].rptParser) ? rptParsers[0].rptParser : NULL);
86 
87  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
88  if(rptParsers[i].rptId == id)
89  return rptParsers[i].rptParser;
90  }
91  return NULL;
92 }
93 
94 uint8_t HIDComposite::Init(uint8_t parent, uint8_t port, bool lowspeed) {
95  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
96 
97  uint8_t buf[constBufSize];
98  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
99  uint8_t rcode;
100  UsbDevice *p = NULL;
101  EpInfo *oldep_ptr = NULL;
102  uint8_t len = 0;
103 
104  uint8_t num_of_conf; // number of configurations
105  //uint8_t num_of_intf; // number of interfaces
106 
107  AddressPool &addrPool = pUsb->GetAddressPool();
108 
109  USBTRACE("HU Init\r\n");
110 
111  if(bAddress)
113 
114  // Get pointer to pseudo device with address 0 assigned
115  p = addrPool.GetUsbDevicePtr(0);
116 
117  if(!p)
119 
120  if(!p->epinfo) {
121  USBTRACE("epinfo\r\n");
123  }
124 
125  // Save old pointer to EP_RECORD of address 0
126  oldep_ptr = p->epinfo;
127 
128  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
129  p->epinfo = epInfo;
130 
131  p->lowspeed = lowspeed;
132 
133  // Get device descriptor
134  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
135 
136  if(!rcode)
137  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
138 
139  if(rcode) {
140  // Restore p->epinfo
141  p->epinfo = oldep_ptr;
142 
143  goto FailGetDevDescr;
144  }
145 
146  // Restore p->epinfo
147  p->epinfo = oldep_ptr;
148 
149  // Allocate new address according to device class
150  bAddress = addrPool.AllocAddress(parent, false, port);
151 
152  if(!bAddress)
154 
155  // Extract Max Packet Size from the device descriptor
157 
158  // Assign new address to the device
159  rcode = pUsb->setAddr(0, 0, bAddress);
160 
161  if(rcode) {
162  p->lowspeed = false;
163  addrPool.FreeAddress(bAddress);
164  bAddress = 0;
165  USBTRACE2("setAddr:", rcode);
166  return rcode;
167  }
168 
169  //delay(2); //per USB 2.0 sect.9.2.6.3
170 
171  USBTRACE2("Addr:", bAddress);
172 
173  p->lowspeed = false;
174 
175  p = addrPool.GetUsbDevicePtr(bAddress);
176 
177  if(!p)
179 
180  p->lowspeed = lowspeed;
181 
182  if(len)
183  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
184 
185  if(rcode)
186  goto FailGetDevDescr;
187 
188  VID = udd->idVendor; // Can be used by classes that inherits this class to check the VID and PID of the connected device
189  PID = udd->idProduct;
190 
191  num_of_conf = udd->bNumConfigurations;
192 
193  // Assign epInfo to epinfo pointer
194  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
195 
196  if(rcode)
197  goto FailSetDevTblEntry;
198 
199  USBTRACE2("NC:", num_of_conf);
200 
201  for(uint8_t i = 0; i < num_of_conf; i++) {
202  //HexDumper<USBReadParser, uint16_t, uint16_t> HexDump;
204  CP_MASK_COMPARE_CLASS> confDescrParser(this);
205 
206  //rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
207  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
208 
209  if(rcode)
210  goto FailGetConfDescr;
211 
212  if(bNumEP > 1)
213  break;
214  } // for
215 
216  if(bNumEP < 2)
218 
219  // Assign epInfo to epinfo pointer
220  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
221 
222  USBTRACE2("Cnf:", bConfNum);
223 
224  // Set Configuration Value
225  rcode = pUsb->setConf(bAddress, 0, bConfNum);
226 
227  if(rcode)
228  goto FailSetConfDescr;
229 
230  USBTRACE2("NumIface:", bNumIface);
231 
232  for(uint8_t i = 0; i < bNumIface; i++) {
233  if(hidInterfaces[i].epIndex[epInterruptInIndex] == 0)
234  continue;
235 
236  USBTRACE2("SetIdle:", hidInterfaces[i].bmInterface);
237 
238  rcode = SetIdle(hidInterfaces[i].bmInterface, 0, 0);
239 
240  if(rcode && rcode != hrSTALL)
241  goto FailSetIdle;
242  }
243 
244  USBTRACE("HU configured\r\n");
245 
247 
248  bPollEnable = true;
249  return 0;
250 
251 FailGetDevDescr:
252 #ifdef DEBUG_USB_HOST
254  goto Fail;
255 #endif
256 
257 FailSetDevTblEntry:
258 #ifdef DEBUG_USB_HOST
260  goto Fail;
261 #endif
262 
263 FailGetConfDescr:
264 #ifdef DEBUG_USB_HOST
266  goto Fail;
267 #endif
268 
269 FailSetConfDescr:
270 #ifdef DEBUG_USB_HOST
272  goto Fail;
273 #endif
274 
275 
276 FailSetIdle:
277 #ifdef DEBUG_USB_HOST
278  USBTRACE("SetIdle:");
279 #endif
280 
281 #ifdef DEBUG_USB_HOST
282 Fail:
283  NotifyFail(rcode);
284 #endif
285  Release();
286  return rcode;
287 }
288 
289 HIDComposite::HIDInterface* HIDComposite::FindInterface(uint8_t iface, uint8_t alt, uint8_t proto) {
290  for(uint8_t i = 0; i < bNumIface && i < maxHidInterfaces; i++)
291  if(hidInterfaces[i].bmInterface == iface && hidInterfaces[i].bmAltSet == alt
292  && hidInterfaces[i].bmProtocol == proto)
293  return hidInterfaces + i;
294  return NULL;
295 }
296 
297 void HIDComposite::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
298  //ErrorMessage<uint8_t>(PSTR("\r\nConf.Val"), conf);
299  //ErrorMessage<uint8_t>(PSTR("Iface Num"), iface);
300  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
301 
302  bConfNum = conf;
303 
304  uint8_t index = 0;
305  HIDInterface *piface = FindInterface(iface, alt, proto);
306 
307  // Fill in interface structure in case of new interface
308  if(!piface) {
309  piface = hidInterfaces + bNumIface;
310  piface->bmInterface = iface;
311  piface->bmAltSet = alt;
312  piface->bmProtocol = proto;
313  bNumIface++;
314  }
315 
316  if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
317  index = epInterruptInIndex;
318  else
319  index = epInterruptOutIndex;
320 
321  if(!SelectInterface(iface, proto))
322  index = 0;
323 
324  if(index) {
325  // Fill in the endpoint info structure
326  epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
327  epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
328  epInfo[bNumEP].bmSndToggle = 0;
329  epInfo[bNumEP].bmRcvToggle = 0;
330  epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
331 
332  // Fill in the endpoint index list
333  piface->epIndex[index] = bNumEP; //(pep->bEndpointAddress & 0x0F);
334 
335  if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
336  pollInterval = pep->bInterval;
337 
338  bNumEP++;
339  }
340 }
341 
344 
345  bNumEP = 1;
346  bAddress = 0;
347  qNextPollTime = 0;
348  bPollEnable = false;
349  return 0;
350 }
351 
352 void HIDComposite::ZeroMemory(uint8_t len, uint8_t *buf) {
353  for(uint8_t i = 0; i < len; i++)
354  buf[i] = 0;
355 }
356 
358  uint8_t rcode = 0;
359 
360  if(!bPollEnable)
361  return 0;
362 
363  if((long)(millis() - qNextPollTime) >= 0L) {
364  qNextPollTime = millis() + pollInterval;
365 
366  uint8_t buf[constBuffLen];
367 
368  for(uint8_t i = 0; i < bNumIface; i++) {
369  uint8_t index = hidInterfaces[i].epIndex[epInterruptInIndex];
370 
371  if (index == 0)
372  continue;
373 
374  uint16_t read = (uint16_t)epInfo[index].maxPktSize;
375 
376  ZeroMemory(constBuffLen, buf);
377 
378  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[index].epAddr, &read, buf);
379 
380  if(rcode) {
381  if(rcode != hrNAK)
382  USBTRACE3("(hidcomposite.h) Poll:", rcode, 0x81);
383  continue;
384  }
385 
386  if(read == 0)
387  continue;
388 
389  if(read > constBuffLen)
390  read = constBuffLen;
391 
392 #if 0
393  Notify(PSTR("\r\nBuf: "), 0x80);
394 
395  for(uint8_t i = 0; i < read; i++) {
396  D_PrintHex<uint8_t > (buf[i], 0x80);
397  Notify(PSTR(" "), 0x80);
398  }
399 
400  Notify(PSTR("\r\n"), 0x80);
401 #endif
402  ParseHIDData(this, epInfo[index].epAddr, bHasReportId, (uint8_t)read, buf);
403 
404  HIDReportParser *prs = GetReportParser(((bHasReportId) ? *buf : 0));
405 
406  if(prs)
407  prs->Parse(this, bHasReportId, (uint8_t)read, buf);
408  }
409 
410  }
411  return rcode;
412 }
413 
414 // Send a report to interrupt out endpoint. This is NOT SetReport() request!
415 uint8_t HIDComposite::SndRpt(uint16_t nbytes, uint8_t *dataptr) {
416  return pUsb->outTransfer(bAddress, epInfo[epInterruptOutIndex].epAddr, nbytes, dataptr);
417 }
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
-
uint8_t bmRcvToggle
Definition: address.h:41
- +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 #include "hidcomposite.h"
19 
21 USBHID(p),
22 qNextPollTime(0),
23 pollInterval(0),
24 bPollEnable(false),
25 bHasReportId(false) {
26  Initialize();
27 
28  if(pUsb)
30 }
31 
32 uint16_t HIDComposite::GetHidClassDescrLen(uint8_t type, uint8_t num) {
33  for(uint8_t i = 0, n = 0; i < HID_MAX_HID_CLASS_DESCRIPTORS; i++) {
34  if(descrInfo[i].bDescrType == type) {
35  if(n == num)
36  return descrInfo[i].wDescriptorLength;
37  n++;
38  }
39  }
40  return 0;
41 }
42 
43 void HIDComposite::Initialize() {
44  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
45  rptParsers[i].rptId = 0;
46  rptParsers[i].rptParser = NULL;
47  }
48  for(uint8_t i = 0; i < HID_MAX_HID_CLASS_DESCRIPTORS; i++) {
49  descrInfo[i].bDescrType = 0;
50  descrInfo[i].wDescriptorLength = 0;
51  }
52  for(uint8_t i = 0; i < maxHidInterfaces; i++) {
53  hidInterfaces[i].bmInterface = 0;
54  hidInterfaces[i].bmProtocol = 0;
55 
56  for(uint8_t j = 0; j < maxEpPerInterface; j++)
57  hidInterfaces[i].epIndex[j] = 0;
58  }
59  for(uint8_t i = 0; i < totalEndpoints; i++) {
60  epInfo[i].epAddr = 0;
61  epInfo[i].maxPktSize = (i) ? 0 : 8;
62  epInfo[i].bmSndToggle = 0;
63  epInfo[i].bmRcvToggle = 0;
65  }
66  bNumEP = 1;
67  bNumIface = 0;
68  bConfNum = 0;
69  pollInterval = 0;
70 }
71 
73  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
74  if(rptParsers[i].rptId == 0 && rptParsers[i].rptParser == NULL) {
75  rptParsers[i].rptId = id;
76  rptParsers[i].rptParser = prs;
77  return true;
78  }
79  }
80  return false;
81 }
82 
84  if(!bHasReportId)
85  return ((rptParsers[0].rptParser) ? rptParsers[0].rptParser : NULL);
86 
87  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
88  if(rptParsers[i].rptId == id)
89  return rptParsers[i].rptParser;
90  }
91  return NULL;
92 }
93 
94 uint8_t HIDComposite::Init(uint8_t parent, uint8_t port, bool lowspeed) {
95  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
96 
97  uint8_t buf[constBufSize];
98  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
99  uint8_t rcode;
100  UsbDevice *p = NULL;
101  EpInfo *oldep_ptr = NULL;
102  uint8_t len = 0;
103 
104  uint8_t num_of_conf; // number of configurations
105  //uint8_t num_of_intf; // number of interfaces
106 
107  AddressPool &addrPool = pUsb->GetAddressPool();
108 
109  USBTRACE("HU Init\r\n");
110 
111  if(bAddress)
113 
114  // Get pointer to pseudo device with address 0 assigned
115  p = addrPool.GetUsbDevicePtr(0);
116 
117  if(!p)
119 
120  if(!p->epinfo) {
121  USBTRACE("epinfo\r\n");
123  }
124 
125  // Save old pointer to EP_RECORD of address 0
126  oldep_ptr = p->epinfo;
127 
128  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
129  p->epinfo = epInfo;
130 
131  p->lowspeed = lowspeed;
132 
133  // Get device descriptor
134  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
135 
136  if(!rcode)
137  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
138 
139  if(rcode) {
140  // Restore p->epinfo
141  p->epinfo = oldep_ptr;
142 
143  goto FailGetDevDescr;
144  }
145 
146  // Restore p->epinfo
147  p->epinfo = oldep_ptr;
148 
149  // Allocate new address according to device class
150  bAddress = addrPool.AllocAddress(parent, false, port);
151 
152  if(!bAddress)
154 
155  // Extract Max Packet Size from the device descriptor
157 
158  // Assign new address to the device
159  rcode = pUsb->setAddr(0, 0, bAddress);
160 
161  if(rcode) {
162  p->lowspeed = false;
163  addrPool.FreeAddress(bAddress);
164  bAddress = 0;
165  USBTRACE2("setAddr:", rcode);
166  return rcode;
167  }
168 
169  //delay(2); //per USB 2.0 sect.9.2.6.3
170 
171  USBTRACE2("Addr:", bAddress);
172 
173  p->lowspeed = false;
174 
175  p = addrPool.GetUsbDevicePtr(bAddress);
176 
177  if(!p)
179 
180  p->lowspeed = lowspeed;
181 
182  if(len)
183  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
184 
185  if(rcode)
186  goto FailGetDevDescr;
187 
188  VID = udd->idVendor; // Can be used by classes that inherits this class to check the VID and PID of the connected device
189  PID = udd->idProduct;
190 
191  num_of_conf = udd->bNumConfigurations;
192 
193  // Assign epInfo to epinfo pointer
194  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
195 
196  if(rcode)
197  goto FailSetDevTblEntry;
198 
199  USBTRACE2("NC:", num_of_conf);
200 
201  for(uint8_t i = 0; i < num_of_conf; i++) {
202  //HexDumper<USBReadParser, uint16_t, uint16_t> HexDump;
204  CP_MASK_COMPARE_CLASS> confDescrParser(this);
205 
206  //rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
207  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
208 
209  if(rcode)
210  goto FailGetConfDescr;
211 
212  if(bNumEP > 1)
213  break;
214  } // for
215 
216  if(bNumEP < 2)
218 
219  // Assign epInfo to epinfo pointer
220  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
221 
222  USBTRACE2("Cnf:", bConfNum);
223 
224  // Set Configuration Value
225  rcode = pUsb->setConf(bAddress, 0, bConfNum);
226 
227  if(rcode)
228  goto FailSetConfDescr;
229 
230  USBTRACE2("NumIface:", bNumIface);
231 
232  for(uint8_t i = 0; i < bNumIface; i++) {
233  if(hidInterfaces[i].epIndex[epInterruptInIndex] == 0)
234  continue;
235 
236  USBTRACE2("SetIdle:", hidInterfaces[i].bmInterface);
237 
238  rcode = SetIdle(hidInterfaces[i].bmInterface, 0, 0);
239 
240  if(rcode && rcode != hrSTALL)
241  goto FailSetIdle;
242  }
243 
244  USBTRACE("HU configured\r\n");
245 
247 
248  bPollEnable = true;
249  return 0;
250 
251 FailGetDevDescr:
252 #ifdef DEBUG_USB_HOST
254  goto Fail;
255 #endif
256 
257 FailSetDevTblEntry:
258 #ifdef DEBUG_USB_HOST
260  goto Fail;
261 #endif
262 
263 FailGetConfDescr:
264 #ifdef DEBUG_USB_HOST
266  goto Fail;
267 #endif
268 
269 FailSetConfDescr:
270 #ifdef DEBUG_USB_HOST
272  goto Fail;
273 #endif
274 
275 
276 FailSetIdle:
277 #ifdef DEBUG_USB_HOST
278  USBTRACE("SetIdle:");
279 #endif
280 
281 #ifdef DEBUG_USB_HOST
282 Fail:
283  NotifyFail(rcode);
284 #endif
285  Release();
286  return rcode;
287 }
288 
289 HIDComposite::HIDInterface* HIDComposite::FindInterface(uint8_t iface, uint8_t alt, uint8_t proto) {
290  for(uint8_t i = 0; i < bNumIface && i < maxHidInterfaces; i++)
291  if(hidInterfaces[i].bmInterface == iface && hidInterfaces[i].bmAltSet == alt
292  && hidInterfaces[i].bmProtocol == proto)
293  return hidInterfaces + i;
294  return NULL;
295 }
296 
297 void HIDComposite::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
298  //ErrorMessage<uint8_t>(PSTR("\r\nConf.Val"), conf);
299  //ErrorMessage<uint8_t>(PSTR("Iface Num"), iface);
300  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
301 
302  bConfNum = conf;
303 
304  uint8_t index = 0;
305  HIDInterface *piface = FindInterface(iface, alt, proto);
306 
307  // Fill in interface structure in case of new interface
308  if(!piface) {
309  piface = hidInterfaces + bNumIface;
310  piface->bmInterface = iface;
311  piface->bmAltSet = alt;
312  piface->bmProtocol = proto;
313  bNumIface++;
314  }
315 
317  index = (pep->bEndpointAddress & 0x80) == 0x80 ? epInterruptInIndex : epInterruptOutIndex;
318 
319  if(!SelectInterface(iface, proto))
320  index = 0;
321 
322  if(index) {
323  // Fill in the endpoint info structure
324  epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
325  epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
326  epInfo[bNumEP].bmSndToggle = 0;
327  epInfo[bNumEP].bmRcvToggle = 0;
328  epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
329 
330  // Fill in the endpoint index list
331  piface->epIndex[index] = bNumEP; //(pep->bEndpointAddress & 0x0F);
332 
333  if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
334  pollInterval = pep->bInterval;
335 
336  bNumEP++;
337  }
338 }
339 
342 
343  bNumEP = 1;
344  bAddress = 0;
345  qNextPollTime = 0;
346  bPollEnable = false;
347  return 0;
348 }
349 
350 void HIDComposite::ZeroMemory(uint8_t len, uint8_t *buf) {
351  for(uint8_t i = 0; i < len; i++)
352  buf[i] = 0;
353 }
354 
356  uint8_t rcode = 0;
357 
358  if(!bPollEnable)
359  return 0;
360 
361  if((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L) {
362  qNextPollTime = (uint32_t)millis() + pollInterval;
363 
364  uint8_t buf[constBuffLen];
365 
366  for(uint8_t i = 0; i < bNumIface; i++) {
367  uint8_t index = hidInterfaces[i].epIndex[epInterruptInIndex];
368 
369  if (index == 0)
370  continue;
371 
372  uint16_t read = (uint16_t)epInfo[index].maxPktSize;
373 
374  ZeroMemory(constBuffLen, buf);
375 
376  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[index].epAddr, &read, buf);
377 
378  if(rcode) {
379  if(rcode != hrNAK)
380  USBTRACE3("(hidcomposite.h) Poll:", rcode, 0x81);
381  continue;
382  }
383 
384  if(read == 0)
385  continue;
386 
387  if(read > constBuffLen)
388  read = constBuffLen;
389 
390 #if 0
391  Notify(PSTR("\r\nBuf: "), 0x80);
392 
393  for(uint8_t i = 0; i < read; i++) {
394  D_PrintHex<uint8_t > (buf[i], 0x80);
395  Notify(PSTR(" "), 0x80);
396  }
397 
398  Notify(PSTR("\r\n"), 0x80);
399 #endif
400  ParseHIDData(this, epInfo[index].epAddr, bHasReportId, (uint8_t)read, buf);
401 
402  HIDReportParser *prs = GetReportParser(((bHasReportId) ? *buf : 0));
403 
404  if(prs)
405  prs->Parse(this, bHasReportId, (uint8_t)read, buf);
406  }
407 
408  }
409  return rcode;
410 }
411 
412 // Send a report to interrupt out endpoint. This is NOT SetReport() request!
413 uint8_t HIDComposite::SndRpt(uint16_t nbytes, uint8_t *dataptr) {
414  return pUsb->outTransfer(bAddress, epInfo[epInterruptOutIndex].epAddr, nbytes, dataptr);
415 }
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+
uint8_t bmRcvToggle
Definition: address.h:48
+
Definition: usbhid.h:143
USB * pUsb
Definition: usbhid.h:145
-
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
#define hrSTALL
Definition: max3421e.h:212
-
uint8_t bmNakPower
Definition: address.h:42
+
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
#define hrSTALL
Definition: max3421e.h:219
+
uint8_t bmNakPower
Definition: address.h:49
#define HID_MAX_HID_CLASS_DESCRIPTORS
Definition: usbhid.h:24
- - + +
#define MAX_REPORT_PARSERS
Definition: usbhid.h:23
- - -
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:105
-
#define NotifyFail(...)
Definition: message.h:55
+ + +
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:112
+
#define NotifyFail(...)
Definition: message.h:62
virtual uint8_t OnInitSuccessful()
Definition: hidcomposite.h:71
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
- +
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+
HIDInterface hidInterfaces[maxHidInterfaces]
Definition: hidcomposite.h:62
virtual void ParseHIDData(USBHID *hid, uint8_t ep, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hidcomposite.h:75
bool bHasReportId
Definition: hidcomposite.h:64
-
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
+
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
EpInfo epInfo[totalEndpoints]
Definition: hidcomposite.h:61
-
#define CP_MASK_COMPARE_CLASS
-
#define USB_CLASS_HID
Definition: UsbCore.h:59
+
#define CP_MASK_COMPARE_CLASS
+
#define USB_CLASS_HID
Definition: UsbCore.h:70
virtual void FreeAddress(uint8_t addr)=0
- +
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
uint8_t SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)
Definition: usbhid.cpp:62
-
#define Notify(...)
Definition: message.h:44
- - -
#define USBTRACE2(s, r)
Definition: macros.h:77
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
#define NotifyFailGetConfDescr(...)
Definition: message.h:52
-
uint8_t epAddr
Definition: address.h:33
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
-
Definition: address.h:32
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
-
#define hrNAK
Definition: max3421e.h:211
+
#define Notify(...)
Definition: message.h:51
+ + +
#define USBTRACE2(s, r)
Definition: macros.h:84
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
#define NotifyFailGetConfDescr(...)
Definition: message.h:59
+
uint8_t epAddr
Definition: address.h:40
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
+
Definition: address.h:39
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
+
#define hrNAK
Definition: max3421e.h:218
static const uint8_t epInterruptOutIndex
Definition: usbhid.h:150
uint8_t bAddress
Definition: usbhid.h:146
-
uint16_t wMaxPacketSize
Definition: usb_ch9.h:146
-
uint8_t Poll()
+
uint16_t wMaxPacketSize
Definition: usb_ch9.h:153
+
#define bmUSB_TRANSFER_TYPE
Definition: usb_ch9.h:94
+
uint8_t Poll()
static const uint8_t maxEpPerInterface
Definition: usbhid.h:153
uint16_t PID
Definition: hidcomposite.h:66
virtual bool SelectInterface(uint8_t iface, uint8_t proto)=0
- +
HIDComposite(USB *p)
static const uint8_t epInterruptInIndex
Definition: usbhid.h:149
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bEndpointAddress
Definition: usb_ch9.h:144
+
uint8_t bEndpointAddress
Definition: usb_ch9.h:151
static const uint8_t maxHidInterfaces
Definition: usbhid.h:152
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
+
uint8_t bmSndToggle
Definition: address.h:47
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
uint16_t VID
Definition: hidcomposite.h:66
-
#define USB_NAK_NOWAIT
Definition: address.h:29
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
+
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
static const uint8_t totalEndpoints
Definition: usbhid.h:154
-
uint16_t idProduct
Definition: usb_ch9.h:107
+
uint16_t idProduct
Definition: usb_ch9.h:114
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
uint8_t bNumConfigurations
Definition: usb_ch9.h:112
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
-
uint8_t Release()
-
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
uint8_t bNumConfigurations
Definition: usb_ch9.h:119
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
+
uint8_t Release()
+
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
bool SetReportParser(uint8_t id, HIDReportParser *prs)
HIDReportParser * GetReportParser(uint8_t id)
-
#define USBTRACE3(s, r, l)
Definition: macros.h:78
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
+
#define USBTRACE3(s, r, l)
Definition: macros.h:85
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)=0
-
#define USBTRACE(s)
Definition: macros.h:75
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
- +
#define USBTRACE(s)
Definition: macros.h:82
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
diff --git a/hidcomposite_8h.html b/hidcomposite_8h.html index ba070461..074111b0 100644 --- a/hidcomposite_8h.html +++ b/hidcomposite_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidcomposite.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/hidcomposite_8h__dep__incl.md5 b/hidcomposite_8h__dep__incl.md5 index fa654d6e..3a8e4864 100644 --- a/hidcomposite_8h__dep__incl.md5 +++ b/hidcomposite_8h__dep__incl.md5 @@ -1 +1 @@ -e5cefe8e10450dabf59c09b38501c8d9 \ No newline at end of file +dad990da35aed65ee7e44e6b13e7614e \ No newline at end of file diff --git a/hidcomposite_8h__dep__incl.png b/hidcomposite_8h__dep__incl.png index 2fae936e..4dcafd5a 100644 Binary files a/hidcomposite_8h__dep__incl.png and b/hidcomposite_8h__dep__incl.png differ diff --git a/hidcomposite_8h__incl.md5 b/hidcomposite_8h__incl.md5 index a69ff5ec..7ee388ff 100644 --- a/hidcomposite_8h__incl.md5 +++ b/hidcomposite_8h__incl.md5 @@ -1 +1 @@ -dbac9dbca596a8ac61230cf0b5b0afd8 \ No newline at end of file +87d62da96e30b2fb1795d9cd42c0eb09 \ No newline at end of file diff --git a/hidcomposite_8h__incl.png b/hidcomposite_8h__incl.png index 9c9d6a4e..66fa0839 100644 Binary files a/hidcomposite_8h__incl.png and b/hidcomposite_8h__incl.png differ diff --git a/hidcomposite_8h_source.html b/hidcomposite_8h_source.html index 46a78745..dd45f442 100644 --- a/hidcomposite_8h_source.html +++ b/hidcomposite_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidcomposite.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
hidcomposite.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(__HIDCOMPOSITE_H__)
19 #define __HIDCOMPOSITE_H__
20 
21 #include "usbhid.h"
22 //#include "hidescriptorparser.h"
23 
24 class HIDComposite : public USBHID {
25 
26  struct ReportParser {
27  uint8_t rptId;
28  HIDReportParser *rptParser;
29  } rptParsers[MAX_REPORT_PARSERS];
30 
31  // HID class specific descriptor type and length info obtained from HID descriptor
33 
34  // Returns HID class specific descriptor length by its type and order number
35  uint16_t GetHidClassDescrLen(uint8_t type, uint8_t num);
36 
37  struct HIDInterface {
38  struct {
39  uint8_t bmInterface : 3;
40  uint8_t bmAltSet : 3;
41  uint8_t bmProtocol : 2;
42  };
43  uint8_t epIndex[maxEpPerInterface];
44  };
45 
46  uint8_t bConfNum; // configuration number
47  uint8_t bNumIface; // number of interfaces in the configuration
48  uint8_t bNumEP; // total number of EP in the configuration
49  uint32_t qNextPollTime; // next poll time
50  uint8_t pollInterval;
51  bool bPollEnable; // poll enable flag
52 
53  static const uint16_t constBuffLen = 64; // event buffer length
54 
55  void Initialize();
56  HIDInterface* FindInterface(uint8_t iface, uint8_t alt, uint8_t proto);
57 
58  void ZeroMemory(uint8_t len, uint8_t *buf);
59 
60 protected:
63 
65 
66  uint16_t PID, VID; // PID and VID of connected device
67 
68  // HID implementation
69  HIDReportParser* GetReportParser(uint8_t id);
70 
71  virtual uint8_t OnInitSuccessful() {
72  return 0;
73  };
74 
75  virtual void ParseHIDData(USBHID *hid, uint8_t ep, bool is_rpt_id, uint8_t len, uint8_t *buf) {
76  return;
77  };
78 
79 public:
80  HIDComposite(USB *p);
81 
82  // HID implementation
83  bool SetReportParser(uint8_t id, HIDReportParser *prs);
84 
85  // USBDeviceConfig implementation
86  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
87  uint8_t Release();
88  uint8_t Poll();
89 
90  virtual uint8_t GetAddress() {
91  return bAddress;
92  };
93 
94  virtual bool isReady() {
95  return bPollEnable;
96  };
97 
98  // UsbConfigXtracter implementation
99  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
100 
101  // Send report - do not mix with SetReport()!
102  uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr);
103 
104  // Returns true if we should listen on an interface, false if not
105  virtual bool SelectInterface(uint8_t iface, uint8_t proto) = 0;
106 };
107 
108 #endif // __HIDCOMPOSITE_H__
Definition: usbhid.h:143
+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(__HIDCOMPOSITE_H__)
19 #define __HIDCOMPOSITE_H__
20 
21 #include "usbhid.h"
22 //#include "hidescriptorparser.h"
23 
24 class HIDComposite : public USBHID {
25 
26  struct ReportParser {
27  uint8_t rptId;
28  HIDReportParser *rptParser;
29  } rptParsers[MAX_REPORT_PARSERS];
30 
31  // HID class specific descriptor type and length info obtained from HID descriptor
33 
34  // Returns HID class specific descriptor length by its type and order number
35  uint16_t GetHidClassDescrLen(uint8_t type, uint8_t num);
36 
37  struct HIDInterface {
38  struct {
39  uint8_t bmInterface : 3;
40  uint8_t bmAltSet : 3;
41  uint8_t bmProtocol : 2;
42  };
43  uint8_t epIndex[maxEpPerInterface];
44  };
45 
46  uint8_t bConfNum; // configuration number
47  uint8_t bNumIface; // number of interfaces in the configuration
48  uint8_t bNumEP; // total number of EP in the configuration
49  uint32_t qNextPollTime; // next poll time
50  uint8_t pollInterval;
51  bool bPollEnable; // poll enable flag
52 
53  static const uint16_t constBuffLen = 64; // event buffer length
54 
55  void Initialize();
56  HIDInterface* FindInterface(uint8_t iface, uint8_t alt, uint8_t proto);
57 
58  void ZeroMemory(uint8_t len, uint8_t *buf);
59 
60 protected:
63 
65 
66  uint16_t PID, VID; // PID and VID of connected device
67 
68  // HID implementation
69  HIDReportParser* GetReportParser(uint8_t id);
70 
71  virtual uint8_t OnInitSuccessful() {
72  return 0;
73  };
74 
75  virtual void ParseHIDData(USBHID *hid __attribute__((unused)), uint8_t ep __attribute__((unused)), bool is_rpt_id __attribute__((unused)), uint8_t len __attribute__((unused)), uint8_t *buf __attribute__((unused))) {
76  return;
77  };
78 
79 public:
80  HIDComposite(USB *p);
81 
82  // HID implementation
83  bool SetReportParser(uint8_t id, HIDReportParser *prs);
84 
85  // USBDeviceConfig implementation
86  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
87  uint8_t Release();
88  uint8_t Poll();
89 
90  virtual uint8_t GetAddress() {
91  return bAddress;
92  };
93 
94  virtual bool isReady() {
95  return bPollEnable;
96  };
97 
98  // UsbConfigXtracter implementation
99  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
100 
101  // Send report - do not mix with SetReport()!
102  uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr);
103 
104  // Returns true if we should listen on an interface, false if not
105  virtual bool SelectInterface(uint8_t iface, uint8_t proto) = 0;
106 };
107 
108 #endif // __HIDCOMPOSITE_H__
Definition: usbhid.h:143
#define HID_MAX_HID_CLASS_DESCRIPTORS
Definition: usbhid.h:24
#define MAX_REPORT_PARSERS
Definition: usbhid.h:23
- +
virtual uint8_t OnInitSuccessful()
Definition: hidcomposite.h:71
virtual bool isReady()
Definition: hidcomposite.h:94
- +
HIDInterface hidInterfaces[maxHidInterfaces]
Definition: hidcomposite.h:62
virtual void ParseHIDData(USBHID *hid, uint8_t ep, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hidcomposite.h:75
bool bHasReportId
Definition: hidcomposite.h:64
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
EpInfo epInfo[totalEndpoints]
Definition: hidcomposite.h:61
-
Definition: address.h:32
+
Definition: address.h:39
virtual uint8_t GetAddress()
Definition: hidcomposite.h:90
uint8_t bAddress
Definition: usbhid.h:146
-
uint8_t Poll()
+
uint8_t Poll()
static const uint8_t maxEpPerInterface
Definition: usbhid.h:153
uint16_t PID
Definition: hidcomposite.h:66
virtual bool SelectInterface(uint8_t iface, uint8_t proto)=0
@@ -116,10 +96,10 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
static const uint8_t totalEndpoints
Definition: usbhid.h:154
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
-
uint8_t Release()
-
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
+
uint8_t Release()
+
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
bool SetReportParser(uint8_t id, HIDReportParser *prs)
HIDReportParser * GetReportParser(uint8_t id)
@@ -127,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidescriptorparser_8cpp.html b/hidescriptorparser_8cpp.html index 87cafdba..cd87bb58 100644 --- a/hidescriptorparser_8cpp.html +++ b/hidescriptorparser_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidescriptorparser.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/hidescriptorparser_8cpp__incl.md5 b/hidescriptorparser_8cpp__incl.md5 index d9090345..5f7a7e19 100644 --- a/hidescriptorparser_8cpp__incl.md5 +++ b/hidescriptorparser_8cpp__incl.md5 @@ -1 +1 @@ -ae4f9bfa13694d05aed5bfbb544f5ac5 \ No newline at end of file +d1d45d08b037bd2134a3e6ccd1c08310 \ No newline at end of file diff --git a/hidescriptorparser_8cpp__incl.png b/hidescriptorparser_8cpp__incl.png index 34e6e087..767d89f9 100644 Binary files a/hidescriptorparser_8cpp__incl.png and b/hidescriptorparser_8cpp__incl.png differ diff --git a/hidescriptorparser_8cpp_source.html b/hidescriptorparser_8cpp_source.html index ee8aae92..0dcd1ba5 100644 --- a/hidescriptorparser_8cpp_source.html +++ b/hidescriptorparser_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidescriptorparser.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
hidescriptorparser.cpp
-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 #include "hidescriptorparser.h"
19 
20 const char * const ReportDescParserBase::usagePageTitles0[] PROGMEM = {
36 };
37 
38 const char * const ReportDescParserBase::usagePageTitles1[] PROGMEM = {
45 };
46 const char * const ReportDescParserBase::genDesktopTitles0[] PROGMEM = {
55 
56 };
57 const char * const ReportDescParserBase::genDesktopTitles1[] PROGMEM = {
58  pstrUsageX,
59  pstrUsageY,
60  pstrUsageZ,
83 };
84 const char * const ReportDescParserBase::genDesktopTitles2[] PROGMEM = {
105 };
106 const char * const ReportDescParserBase::genDesktopTitles3[] PROGMEM = {
116 };
117 const char * const ReportDescParserBase::genDesktopTitles4[] PROGMEM = {
126 };
127 const char * const ReportDescParserBase::simuTitles0[] PROGMEM = {
140 };
141 const char * const ReportDescParserBase::simuTitles1[] PROGMEM = {
148 };
149 const char * const ReportDescParserBase::simuTitles2[] PROGMEM = {
183 };
184 const char * const ReportDescParserBase::vrTitles0[] PROGMEM = {
195 };
196 const char * const ReportDescParserBase::vrTitles1[] PROGMEM = {
199 };
200 const char * const ReportDescParserBase::sportsCtrlTitles0[] PROGMEM = {
205 };
206 const char * const ReportDescParserBase::sportsCtrlTitles1[] PROGMEM = {
207  pstrUsageOar,
217 };
218 const char * const ReportDescParserBase::sportsCtrlTitles2[] PROGMEM = {
239 };
240 const char * const ReportDescParserBase::gameTitles0[] PROGMEM = {
244 };
245 const char * const ReportDescParserBase::gameTitles1[] PROGMEM = {
271 };
272 const char * const ReportDescParserBase::genDevCtrlTitles[] PROGMEM = {
280 };
281 const char * const ReportDescParserBase::ledTitles[] PROGMEM = {
301  pstrUsageCAV,
302  pstrUsageCLV,
359 };
360 const char * const ReportDescParserBase::telTitles0 [] PROGMEM = {
368 };
369 const char * const ReportDescParserBase::telTitles1 [] PROGMEM = {
388 };
389 const char * const ReportDescParserBase::telTitles2 [] PROGMEM = {
394 };
395 const char * const ReportDescParserBase::telTitles3 [] PROGMEM = {
401 };
402 const char * const ReportDescParserBase::telTitles4 [] PROGMEM = {
418 };
419 const char * const ReportDescParserBase::telTitles5 [] PROGMEM = {
436 };
437 const char * const ReportDescParserBase::consTitles0[] PROGMEM = {
444 };
445 const char * const ReportDescParserBase::consTitles1[] PROGMEM = {
449 };
450 const char * const ReportDescParserBase::consTitles2[] PROGMEM = {
458 
459 };
460 const char * const ReportDescParserBase::consTitles3[] PROGMEM = {
470 };
471 const char * const ReportDescParserBase::consTitles4[] PROGMEM = {
479 };
480 const char * const ReportDescParserBase::consTitles5[] PROGMEM = {
518 };
519 const char * const ReportDescParserBase::consTitles6[] PROGMEM = {
551 };
552 const char * const ReportDescParserBase::consTitles7[] PROGMEM = {
561  pstrUsageMPX,
564 };
565 const char * const ReportDescParserBase::consTitles8[] PROGMEM = {
572 };
573 const char * const ReportDescParserBase::consTitles9[] PROGMEM = {
588 };
589 const char * const ReportDescParserBase::consTitlesA[] PROGMEM = {
596 };
597 const char * const ReportDescParserBase::consTitlesB[] PROGMEM = {
609 };
610 const char * const ReportDescParserBase::consTitlesC[] PROGMEM = {
616 };
617 const char * const ReportDescParserBase::consTitlesD[] PROGMEM = {
690 };
691 const char * const ReportDescParserBase::consTitlesE[] PROGMEM = {
833 };
834 const char * const ReportDescParserBase::digitTitles0[] PROGMEM = {
836  pstrUsagePen,
848 };
849 const char * const ReportDescParserBase::digitTitles1[] PROGMEM = {
853 
854 };
855 const char * const ReportDescParserBase::digitTitles2[] PROGMEM = {
861  pstrUsageTap,
879 };
880 const char * const ReportDescParserBase::aplphanumTitles0[] PROGMEM = {
883 };
884 const char * const ReportDescParserBase::aplphanumTitles1[] PROGMEM = {
904  pstrUsageRow,
931 };
932 const char * const ReportDescParserBase::aplphanumTitles2[] PROGMEM = {
954 };
955 const char * const ReportDescParserBase::medInstrTitles0[] PROGMEM = {
964 };
965 const char * const ReportDescParserBase::medInstrTitles1[] PROGMEM = {
971 };
972 const char * const ReportDescParserBase::medInstrTitles2[] PROGMEM = {
975 };
976 const char * const ReportDescParserBase::medInstrTitles3[] PROGMEM = {
987 };
988 const char * const ReportDescParserBase::medInstrTitles4[] PROGMEM = {
991 };
992 
993 void ReportDescParserBase::Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) {
994  uint16_t cntdn = (uint16_t)len;
995  uint8_t *p = (uint8_t*)pbuf;
996 
997 
998  totalSize = 0;
999 
1000  while(cntdn) {
1001  //USB_HOST_SERIAL.println("");
1002  //PrintHex<uint16_t>(offset + len - cntdn);
1003  //USB_HOST_SERIAL.print(":");
1004 
1005  ParseItem(&p, &cntdn);
1006 
1007  //if (ParseItem(&p, &cntdn))
1008  // return;
1009  }
1010  //USBTRACE2("Total:", totalSize);
1011 }
1012 
1013 void ReportDescParserBase::PrintValue(uint8_t *p, uint8_t len) {
1014  E_Notify(PSTR("("), 0x80);
1015  for(; len; p++, len--)
1016  PrintHex<uint8_t > (*p, 0x80);
1017  E_Notify(PSTR(")"), 0x80);
1018 }
1019 
1021  E_Notify(PSTR("("), 0x80);
1022  PrintHex<uint8_t > (data, 0x80);
1023  E_Notify(PSTR(")"), 0x80);
1024 }
1025 
1027  switch(prefix & (TYPE_MASK | TAG_MASK)) {
1028  case (TYPE_GLOBAL | TAG_GLOBAL_PUSH):
1029  E_Notify(PSTR("\r\nPush"), 0x80);
1030  break;
1031  case (TYPE_GLOBAL | TAG_GLOBAL_POP):
1032  E_Notify(PSTR("\r\nPop"), 0x80);
1033  break;
1035  E_Notify(PSTR("\r\nUsage Page"), 0x80);
1036  break;
1038  E_Notify(PSTR("\r\nLogical Min"), 0x80);
1039  break;
1041  E_Notify(PSTR("\r\nLogical Max"), 0x80);
1042  break;
1044  E_Notify(PSTR("\r\nPhysical Min"), 0x80);
1045  break;
1047  E_Notify(PSTR("\r\nPhysical Max"), 0x80);
1048  break;
1050  E_Notify(PSTR("\r\nUnit Exp"), 0x80);
1051  break;
1052  case (TYPE_GLOBAL | TAG_GLOBAL_UNIT):
1053  E_Notify(PSTR("\r\nUnit"), 0x80);
1054  break;
1056  E_Notify(PSTR("\r\nReport Size"), 0x80);
1057  break;
1059  E_Notify(PSTR("\r\nReport Count"), 0x80);
1060  break;
1062  E_Notify(PSTR("\r\nReport Id"), 0x80);
1063  break;
1064  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
1065  E_Notify(PSTR("\r\nUsage"), 0x80);
1066  break;
1067  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
1068  E_Notify(PSTR("\r\nUsage Min"), 0x80);
1069  break;
1070  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
1071  E_Notify(PSTR("\r\nUsage Max"), 0x80);
1072  break;
1073  case (TYPE_MAIN | TAG_MAIN_COLLECTION):
1074  E_Notify(PSTR("\r\nCollection"), 0x80);
1075  break;
1077  E_Notify(PSTR("\r\nEnd Collection"), 0x80);
1078  break;
1079  case (TYPE_MAIN | TAG_MAIN_INPUT):
1080  E_Notify(PSTR("\r\nInput"), 0x80);
1081  break;
1082  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
1083  E_Notify(PSTR("\r\nOutput"), 0x80);
1084  break;
1085  case (TYPE_MAIN | TAG_MAIN_FEATURE):
1086  E_Notify(PSTR("\r\nFeature"), 0x80);
1087  break;
1088  } // switch (**pp & (TYPE_MASK | TAG_MASK))
1089 }
1090 
1091 uint8_t ReportDescParserBase::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
1092  //uint8_t ret = enErrorSuccess;
1093  //reinterpret_cast<>(varBuffer);
1094  switch(itemParseState) {
1095  case 0:
1096  if(**pp == HID_LONG_ITEM_PREFIX)
1097  USBTRACE("\r\nLONG\r\n");
1098  else {
1099  uint8_t size = ((**pp) & DATA_SIZE_MASK);
1100 
1101  itemPrefix = (**pp);
1102  itemSize = 1 + ((size == DATA_SIZE_4) ? 4 : size);
1103 
1105  }
1106  (*pp)++;
1107  (*pcntdn)--;
1108  itemSize--;
1109  itemParseState = 1;
1110 
1111  if(!itemSize)
1112  break;
1113 
1114  if(!pcntdn)
1115  return enErrorIncomplete;
1116  case 1:
1117  //USBTRACE2("\r\niSz:",itemSize);
1118 
1121  itemParseState = 2;
1122  case 2:
1123  if(!valParser.Parse(pp, pcntdn))
1124  return enErrorIncomplete;
1125  itemParseState = 3;
1126  case 3:
1127  {
1128  uint8_t data = *((uint8_t*)varBuffer);
1129 
1130  switch(itemPrefix & (TYPE_MASK | TAG_MASK)) {
1131  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
1132  if(pfUsage) {
1133  if(theBuffer.valueSize > 1) {
1134  uint16_t* ui16 = reinterpret_cast<uint16_t *>(varBuffer);
1135  pfUsage(*ui16);
1136  } else
1137  pfUsage(data);
1138  }
1139  break;
1141  rptSize = data;
1142  PrintByteValue(data);
1143  break;
1145  rptCount = data;
1146  PrintByteValue(data);
1147  break;
1153  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
1154  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
1156  case (TYPE_GLOBAL | TAG_GLOBAL_UNIT):
1158  break;
1159  case (TYPE_GLOBAL | TAG_GLOBAL_PUSH):
1160  case (TYPE_GLOBAL | TAG_GLOBAL_POP):
1161  break;
1163  SetUsagePage(data);
1164  PrintUsagePage(data);
1165  PrintByteValue(data);
1166  break;
1167  case (TYPE_MAIN | TAG_MAIN_COLLECTION):
1169  switch(data) {
1170  case 0x00:
1171  E_Notify(PSTR(" Physical"), 0x80);
1172  break;
1173  case 0x01:
1174  E_Notify(PSTR(" Application"), 0x80);
1175  break;
1176  case 0x02:
1177  E_Notify(PSTR(" Logical"), 0x80);
1178  break;
1179  case 0x03:
1180  E_Notify(PSTR(" Report"), 0x80);
1181  break;
1182  case 0x04:
1183  E_Notify(PSTR(" Named Array"), 0x80);
1184  break;
1185  case 0x05:
1186  E_Notify(PSTR(" Usage Switch"), 0x80);
1187  break;
1188  case 0x06:
1189  E_Notify(PSTR(" Usage Modifier"), 0x80);
1190  break;
1191  default:
1192  E_Notify(PSTR(" Vendor Defined("), 0x80);
1193  PrintHex<uint8_t > (data, 0x80);
1194  E_Notify(PSTR(")"), 0x80);
1195  }
1196  break;
1197  case (TYPE_MAIN | TAG_MAIN_INPUT):
1198  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
1199  case (TYPE_MAIN | TAG_MAIN_FEATURE):
1200  totalSize += (uint16_t)rptSize * (uint16_t)rptCount;
1201  rptSize = 0;
1202  rptCount = 0;
1203  E_Notify(PSTR("("), 0x80);
1204  PrintBin<uint8_t > (data, 0x80);
1205  E_Notify(PSTR(")"), 0x80);
1206  break;
1207  } // switch (**pp & (TYPE_MASK | TAG_MASK))
1208  }
1209  } // switch (itemParseState)
1210  itemParseState = 0;
1211  return enErrorSuccess;
1212 }
1213 
1221  NULL, // Keyboard/Keypad
1228  NULL, // Reserved
1229  NULL, // PID
1230  NULL // Unicode
1231 };
1232 
1234  pfUsage = NULL;
1235 
1236  if(VALUE_BETWEEN(page, 0x00, 0x11)) {
1237  pfUsage = (usagePageFunctions[page - 1]);
1238 
1239  } else {
1240  switch(page) {
1241  case 0x14:
1243  break;
1244  case 0x40:
1246  break;
1247  }
1248  }
1249 }
1250 
1252  const char * const * w;
1253  E_Notify(pstrSpace, 0x80);
1254 
1255  output_if_between(page, 0x00, 0x11, w, E_Notify, usagePageTitles0, 0x80)
1256  else output_if_between(page, 0x8b, 0x92, w, E_Notify, usagePageTitles1, 0x80)
1257  else if(VALUE_BETWEEN(page, 0x7f, 0x84))
1259  else if(VALUE_BETWEEN(page, 0x83, 0x8c))
1261  else if(page > 0xfeff /* && page <= 0xffff */)
1263  else
1264  switch(page) {
1265  case 0x14:
1267  break;
1268  case 0x40:
1270  break;
1271  default:
1273  }
1274 }
1275 
1277  E_Notify(pstrSpace, 0x80);
1278  E_Notify(PSTR("Btn"), 0x80);
1279  PrintHex<uint16_t > (usage, 0x80);
1280  E_Notify(PSTR("\r\n"), 0x80);
1281  //USB_HOST_SERIAL.print(usage, HEX);
1282 }
1283 
1285  E_Notify(pstrSpace, 0x80);
1286  E_Notify(PSTR("Inst"), 0x80);
1287  // Sorry, HEX for now...
1288  PrintHex<uint16_t > (usage, 0x80);
1289  E_Notify(PSTR("\r\n"), 0x80);
1290  //USB_HOST_SERIAL.print(usage, DEC);
1291 }
1292 
1294  const char * const * w;
1295  E_Notify(pstrSpace, 0x80);
1296 
1297  output_if_between(usage, 0x00, 0x0a, w, E_Notify, genDesktopTitles0, 0x80)
1298  else output_if_between(usage, 0x2f, 0x49, w, E_Notify, genDesktopTitles1, 0x80)
1299  else output_if_between(usage, 0x7f, 0x94, w, E_Notify, genDesktopTitles2, 0x80)
1300  else output_if_between(usage, 0x9f, 0xa9, w, E_Notify, genDesktopTitles3, 0x80)
1301  else output_if_between(usage, 0xaf, 0xb8, w, E_Notify, genDesktopTitles4, 0x80)
1302  else E_Notify(pstrUsagePageUndefined, 0x80);
1303 }
1304 
1306  const char * const * w;
1307  E_Notify(pstrSpace, 0x80);
1308 
1309  output_if_between(usage, 0x00, 0x0d, w, E_Notify, simuTitles0, 0x80)
1310  else output_if_between(usage, 0x1f, 0x26, w, E_Notify, simuTitles1, 0x80)
1311  else output_if_between(usage, 0xaf, 0xd1, w, E_Notify, simuTitles2, 0x80)
1312  else E_Notify(pstrUsagePageUndefined, 0x80);
1313 }
1314 
1316  const char * const * w;
1317  E_Notify(pstrSpace, 0x80);
1318 
1319  output_if_between(usage, 0x00, 0x0b, w, E_Notify, vrTitles0, 0x80)
1320  else output_if_between(usage, 0x1f, 0x22, w, E_Notify, vrTitles1, 0x80)
1321  else E_Notify(pstrUsagePageUndefined, 0x80);
1322 }
1323 
1325  const char * const * w;
1326  E_Notify(pstrSpace, 0x80);
1327 
1328  output_if_between(usage, 0x00, 0x05, w, E_Notify, sportsCtrlTitles0, 0x80)
1329  else output_if_between(usage, 0x2f, 0x3a, w, E_Notify, sportsCtrlTitles1, 0x80)
1330  else output_if_between(usage, 0x4f, 0x64, w, E_Notify, sportsCtrlTitles2, 0x80)
1331  else E_Notify(pstrUsagePageUndefined, 0x80);
1332 }
1333 
1335  const char * const * w;
1336  E_Notify(pstrSpace, 0x80);
1337 
1338  output_if_between(usage, 0x00, 0x04, w, E_Notify, gameTitles0, 0x80)
1339  else output_if_between(usage, 0x1f, 0x3a, w, E_Notify, gameTitles1, 0x80)
1340  else E_Notify(pstrUsagePageUndefined, 0x80);
1341 }
1342 
1344  const char * const * w;
1345  E_Notify(pstrSpace, 0x80);
1346 
1347  output_if_between(usage, 0x1f, 0x27, w, E_Notify, genDevCtrlTitles, 0x80)
1348  else E_Notify(pstrUsagePageUndefined, 0x80);
1349 }
1350 
1352  const char * const * w;
1353  E_Notify(pstrSpace, 0x80);
1354 
1355  output_if_between(usage, 0x00, 0x4e, w, E_Notify, ledTitles, 0x80)
1356  else E_Notify(pstrUsagePageUndefined, 0x80);
1357 }
1358 
1360  const char * const * w;
1361  E_Notify(pstrSpace, 0x80);
1362 
1363  output_if_between(usage, 0x00, 0x08, w, E_Notify, telTitles0, 0x80)
1364  else output_if_between(usage, 0x1f, 0x32, w, E_Notify, telTitles1, 0x80)
1365  else output_if_between(usage, 0x4f, 0x54, w, E_Notify, telTitles2, 0x80)
1366  else output_if_between(usage, 0x6f, 0x75, w, E_Notify, telTitles3, 0x80)
1367  else output_if_between(usage, 0x8f, 0x9f, w, E_Notify, telTitles4, 0x80)
1368  else output_if_between(usage, 0xaf, 0xc0, w, E_Notify, telTitles5, 0x80)
1369  else E_Notify(pstrUsagePageUndefined, 0x80);
1370 }
1371 
1373  const char * const * w;
1374  E_Notify(pstrSpace, 0x80);
1375 
1376  output_if_between(usage, 0x00, 0x07, w, E_Notify, consTitles0, 0x80)
1377  else output_if_between(usage, 0x1f, 0x23, w, E_Notify, consTitles1, 0x80)
1378  else output_if_between(usage, 0x2f, 0x37, w, E_Notify, consTitles2, 0x80)
1379  else output_if_between(usage, 0x3f, 0x49, w, E_Notify, consTitles3, 0x80)
1380  else output_if_between(usage, 0x5f, 0x67, w, E_Notify, consTitles4, 0x80)
1381  else output_if_between(usage, 0x7f, 0xa5, w, E_Notify, consTitles5, 0x80)
1382  else output_if_between(usage, 0xaf, 0xcf, w, E_Notify, consTitles6, 0x80)
1383  else output_if_between(usage, 0xdf, 0xeb, w, E_Notify, consTitles7, 0x80)
1384  else output_if_between(usage, 0xef, 0xf6, w, E_Notify, consTitles8, 0x80)
1385  else output_if_between(usage, 0xff, 0x10e, w, E_Notify, consTitles9, 0x80)
1386  else output_if_between(usage, 0x14f, 0x156, w, E_Notify, consTitlesA, 0x80)
1387  else output_if_between(usage, 0x15f, 0x16b, w, E_Notify, consTitlesB, 0x80)
1388  else output_if_between(usage, 0x16f, 0x175, w, E_Notify, consTitlesC, 0x80)
1389  else output_if_between(usage, 0x17f, 0x1c8, w, E_Notify, consTitlesD, 0x80)
1390  else output_if_between(usage, 0x1ff, 0x29d, w, E_Notify, consTitlesE, 0x80)
1391  else E_Notify(pstrUsagePageUndefined, 0x80);
1392 }
1393 
1395  const char * const * w;
1396  E_Notify(pstrSpace, 0x80);
1397 
1398  output_if_between(usage, 0x00, 0x0e, w, E_Notify, digitTitles0, 0x80)
1399  else output_if_between(usage, 0x1f, 0x23, w, E_Notify, digitTitles1, 0x80)
1400  else output_if_between(usage, 0x2f, 0x47, w, E_Notify, digitTitles2, 0x80)
1401  else E_Notify(pstrUsagePageUndefined, 0x80);
1402 }
1403 
1405  const char * const * w;
1406  E_Notify(pstrSpace, 0x80);
1407 
1408  output_if_between(usage, 0x00, 0x03, w, E_Notify, aplphanumTitles0, 0x80)
1409  else output_if_between(usage, 0x1f, 0x4e, w, E_Notify, aplphanumTitles1, 0x80)
1410  else output_if_between(usage, 0x7f, 0x96, w, E_Notify, digitTitles2, 0x80)
1411  else E_Notify(pstrUsagePageUndefined, 0x80);
1412 }
1413 
1415  const char * const * w;
1416  E_Notify(pstrSpace, 0x80);
1417 
1418  if(usage == 1) E_Notify(pstrUsageMedicalUltrasound, 0x80);
1419  else if(usage == 0x70)
1421  else output_if_between(usage, 0x1f, 0x28, w, E_Notify, medInstrTitles0, 0x80)
1422  else output_if_between(usage, 0x3f, 0x45, w, E_Notify, medInstrTitles1, 0x80)
1423  else output_if_between(usage, 0x5f, 0x62, w, E_Notify, medInstrTitles2, 0x80)
1424  else output_if_between(usage, 0x7f, 0x8a, w, E_Notify, medInstrTitles3, 0x80)
1425  else output_if_between(usage, 0x9f, 0xa2, w, E_Notify, medInstrTitles4, 0x80)
1426  else E_Notify(pstrUsagePageUndefined, 0x80);
1427 }
1428 
1429 uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
1430  //uint8_t ret = enErrorSuccess;
1431 
1432  switch(itemParseState) {
1433  case 0:
1434  if(**pp == HID_LONG_ITEM_PREFIX)
1435  USBTRACE("\r\nLONG\r\n");
1436  else {
1437  uint8_t size = ((**pp) & DATA_SIZE_MASK);
1438  itemPrefix = (**pp);
1439  itemSize = 1 + ((size == DATA_SIZE_4) ? 4 : size);
1440  }
1441  (*pp)++;
1442  (*pcntdn)--;
1443  itemSize--;
1444  itemParseState = 1;
1445 
1446  if(!itemSize)
1447  break;
1448 
1449  if(!pcntdn)
1450  return enErrorIncomplete;
1451  case 1:
1454  itemParseState = 2;
1455  case 2:
1456  if(!valParser.Parse(pp, pcntdn))
1457  return enErrorIncomplete;
1458  itemParseState = 3;
1459  case 3:
1460  {
1461  uint8_t data = *((uint8_t*)varBuffer);
1462 
1463  switch(itemPrefix & (TYPE_MASK | TAG_MASK)) {
1464  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
1465  if(pfUsage) {
1466  if(theBuffer.valueSize > 1) {
1467  uint16_t* ui16 = reinterpret_cast<uint16_t *>(varBuffer);
1468  pfUsage(*ui16);
1469  } else
1470  pfUsage(data);
1471  }
1472  break;
1474  rptSize = data;
1475  break;
1477  rptCount = data;
1478  break;
1480  rptId = data;
1481  break;
1482  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
1483  useMin = data;
1484  break;
1485  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
1486  useMax = data;
1487  break;
1489  SetUsagePage(data);
1490  break;
1491  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
1492  case (TYPE_MAIN | TAG_MAIN_FEATURE):
1493  rptSize = 0;
1494  rptCount = 0;
1495  useMin = 0;
1496  useMax = 0;
1497  break;
1498  case (TYPE_MAIN | TAG_MAIN_INPUT):
1499  OnInputItem(data);
1500 
1501  totalSize += (uint16_t)rptSize * (uint16_t)rptCount;
1502 
1503  rptSize = 0;
1504  rptCount = 0;
1505  useMin = 0;
1506  useMax = 0;
1507  break;
1508  } // switch (**pp & (TYPE_MASK | TAG_MASK))
1509  }
1510  } // switch (itemParseState)
1511  itemParseState = 0;
1512  return enErrorSuccess;
1513 }
1514 
1515 void ReportDescParser2::OnInputItem(uint8_t itm) {
1516  uint8_t byte_offset = (totalSize >> 3); // calculate offset to the next unhandled byte i = (int)(totalCount / 8);
1517  uint32_t tmp = (byte_offset << 3);
1518  uint8_t bit_offset = totalSize - tmp; // number of bits in the current byte already handled
1519  uint8_t *p = pBuf + byte_offset; // current byte pointer
1520 
1521  if(bit_offset)
1522  *p >>= bit_offset;
1523 
1524  uint8_t usage = useMin;
1525 
1526  bool print_usemin_usemax = ((useMin < useMax) && ((itm & 3) == 2) && pfUsage) ? true : false;
1527 
1528  uint8_t bits_of_byte = 8;
1529 
1530  // for each field in field array defined by rptCount
1531  for(uint8_t field = 0; field < rptCount; field++, usage++) {
1532 
1533  union {
1534  uint8_t bResult[4];
1535  uint16_t wResult[2];
1536  uint32_t dwResult;
1537  } result;
1538 
1539  result.dwResult = 0;
1540  uint8_t mask = 0;
1541 
1542  if(print_usemin_usemax)
1543  pfUsage(usage);
1544 
1545  // bits_left - number of bits in the field(array of fields, depending on Report Count) left to process
1546  // bits_of_byte - number of bits in current byte left to process
1547  // bits_to_copy - number of bits to copy to result buffer
1548 
1549  // for each bit in a field
1550  for(uint8_t bits_left = rptSize, bits_to_copy = 0; bits_left;
1551  bits_left -= bits_to_copy) {
1552  bits_to_copy = (bits_left > bits_of_byte) ? bits_of_byte : bits_left;
1553 
1554  result.dwResult <<= bits_to_copy; // Result buffer is shifted by the number of bits to be copied into it
1555 
1556  uint8_t val = *p;
1557 
1558  val >>= (8 - bits_of_byte); // Shift by the number of bits already processed
1559 
1560  mask = 0;
1561 
1562  for(uint8_t j = bits_to_copy; j; j--) {
1563  mask <<= 1;
1564  mask |= 1;
1565  }
1566 
1567  result.bResult[0] = (result.bResult[0] | (val & mask));
1568 
1569  bits_of_byte -= bits_to_copy;
1570 
1571  if(bits_of_byte < 1) {
1572  bits_of_byte = 8;
1573  p++;
1574  }
1575  }
1576  PrintByteValue(result.dwResult);
1577  }
1578  E_Notify(PSTR("\r\n"), 0x80);
1579 }
1580 
1581 void UniversalReportParser::Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
1582  ReportDescParser2 prs(len, buf);
1583 
1584  uint8_t ret = hid->GetReportDescr(0, &prs);
1585 
1586  if(ret)
1587  ErrorMessage<uint8_t > (PSTR("GetReportDescr-2"), ret);
1588 }
const char pstrUsageYTilt[]
Definition: hidusagestr.h:814
+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 #include "hidescriptorparser.h"
19 
20 const char * const ReportDescParserBase::usagePageTitles0[] PROGMEM = {
36 };
37 
38 const char * const ReportDescParserBase::usagePageTitles1[] PROGMEM = {
45 };
46 const char * const ReportDescParserBase::genDesktopTitles0[] PROGMEM = {
55 
56 };
57 const char * const ReportDescParserBase::genDesktopTitles1[] PROGMEM = {
58  pstrUsageX,
59  pstrUsageY,
60  pstrUsageZ,
83 };
84 const char * const ReportDescParserBase::genDesktopTitles2[] PROGMEM = {
105 };
106 const char * const ReportDescParserBase::genDesktopTitles3[] PROGMEM = {
116 };
117 const char * const ReportDescParserBase::genDesktopTitles4[] PROGMEM = {
126 };
127 const char * const ReportDescParserBase::simuTitles0[] PROGMEM = {
140 };
141 const char * const ReportDescParserBase::simuTitles1[] PROGMEM = {
148 };
149 const char * const ReportDescParserBase::simuTitles2[] PROGMEM = {
183 };
184 const char * const ReportDescParserBase::vrTitles0[] PROGMEM = {
195 };
196 const char * const ReportDescParserBase::vrTitles1[] PROGMEM = {
199 };
200 const char * const ReportDescParserBase::sportsCtrlTitles0[] PROGMEM = {
205 };
206 const char * const ReportDescParserBase::sportsCtrlTitles1[] PROGMEM = {
207  pstrUsageOar,
217 };
218 const char * const ReportDescParserBase::sportsCtrlTitles2[] PROGMEM = {
239 };
240 const char * const ReportDescParserBase::gameTitles0[] PROGMEM = {
244 };
245 const char * const ReportDescParserBase::gameTitles1[] PROGMEM = {
271 };
272 const char * const ReportDescParserBase::genDevCtrlTitles[] PROGMEM = {
280 };
281 const char * const ReportDescParserBase::ledTitles[] PROGMEM = {
301  pstrUsageCAV,
302  pstrUsageCLV,
359 };
360 const char * const ReportDescParserBase::telTitles0 [] PROGMEM = {
368 };
369 const char * const ReportDescParserBase::telTitles1 [] PROGMEM = {
388 };
389 const char * const ReportDescParserBase::telTitles2 [] PROGMEM = {
394 };
395 const char * const ReportDescParserBase::telTitles3 [] PROGMEM = {
401 };
402 const char * const ReportDescParserBase::telTitles4 [] PROGMEM = {
418 };
419 const char * const ReportDescParserBase::telTitles5 [] PROGMEM = {
436 };
437 const char * const ReportDescParserBase::consTitles0[] PROGMEM = {
444 };
445 const char * const ReportDescParserBase::consTitles1[] PROGMEM = {
449 };
450 const char * const ReportDescParserBase::consTitles2[] PROGMEM = {
458 
459 };
460 const char * const ReportDescParserBase::consTitles3[] PROGMEM = {
470 };
471 const char * const ReportDescParserBase::consTitles4[] PROGMEM = {
479 };
480 const char * const ReportDescParserBase::consTitles5[] PROGMEM = {
518 };
519 const char * const ReportDescParserBase::consTitles6[] PROGMEM = {
551 };
552 const char * const ReportDescParserBase::consTitles7[] PROGMEM = {
561  pstrUsageMPX,
564 };
565 const char * const ReportDescParserBase::consTitles8[] PROGMEM = {
572 };
573 const char * const ReportDescParserBase::consTitles9[] PROGMEM = {
588 };
589 const char * const ReportDescParserBase::consTitlesA[] PROGMEM = {
596 };
597 const char * const ReportDescParserBase::consTitlesB[] PROGMEM = {
609 };
610 const char * const ReportDescParserBase::consTitlesC[] PROGMEM = {
616 };
617 const char * const ReportDescParserBase::consTitlesD[] PROGMEM = {
690 };
691 const char * const ReportDescParserBase::consTitlesE[] PROGMEM = {
833 };
834 const char * const ReportDescParserBase::digitTitles0[] PROGMEM = {
836  pstrUsagePen,
848 };
849 const char * const ReportDescParserBase::digitTitles1[] PROGMEM = {
853 
854 };
855 const char * const ReportDescParserBase::digitTitles2[] PROGMEM = {
861  pstrUsageTap,
879 };
880 const char * const ReportDescParserBase::aplphanumTitles0[] PROGMEM = {
883 };
884 const char * const ReportDescParserBase::aplphanumTitles1[] PROGMEM = {
904  pstrUsageRow,
931 };
932 const char * const ReportDescParserBase::aplphanumTitles2[] PROGMEM = {
954 };
955 const char * const ReportDescParserBase::medInstrTitles0[] PROGMEM = {
964 };
965 const char * const ReportDescParserBase::medInstrTitles1[] PROGMEM = {
971 };
972 const char * const ReportDescParserBase::medInstrTitles2[] PROGMEM = {
975 };
976 const char * const ReportDescParserBase::medInstrTitles3[] PROGMEM = {
987 };
988 const char * const ReportDescParserBase::medInstrTitles4[] PROGMEM = {
991 };
992 
993 void ReportDescParserBase::Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset __attribute__((unused))) {
994  uint16_t cntdn = (uint16_t)len;
995  uint8_t *p = (uint8_t*)pbuf;
996 
997 
998  totalSize = 0;
999 
1000  while(cntdn) {
1001  //USB_HOST_SERIAL.println("");
1002  //PrintHex<uint16_t>(offset + len - cntdn);
1003  //USB_HOST_SERIAL.print(":");
1004 
1005  ParseItem(&p, &cntdn);
1006 
1007  //if (ParseItem(&p, &cntdn))
1008  // return;
1009  }
1010  //USBTRACE2("Total:", totalSize);
1011 }
1012 
1013 void ReportDescParserBase::PrintValue(uint8_t *p, uint8_t len) {
1014  E_Notify(PSTR("("), 0x80);
1015  for(; len; p++, len--)
1016  PrintHex<uint8_t > (*p, 0x80);
1017  E_Notify(PSTR(")"), 0x80);
1018 }
1019 
1021  E_Notify(PSTR("("), 0x80);
1022  PrintHex<uint8_t > (data, 0x80);
1023  E_Notify(PSTR(")"), 0x80);
1024 }
1025 
1027  switch(prefix & (TYPE_MASK | TAG_MASK)) {
1028  case (TYPE_GLOBAL | TAG_GLOBAL_PUSH):
1029  E_Notify(PSTR("\r\nPush"), 0x80);
1030  break;
1031  case (TYPE_GLOBAL | TAG_GLOBAL_POP):
1032  E_Notify(PSTR("\r\nPop"), 0x80);
1033  break;
1035  E_Notify(PSTR("\r\nUsage Page"), 0x80);
1036  break;
1038  E_Notify(PSTR("\r\nLogical Min"), 0x80);
1039  break;
1041  E_Notify(PSTR("\r\nLogical Max"), 0x80);
1042  break;
1044  E_Notify(PSTR("\r\nPhysical Min"), 0x80);
1045  break;
1047  E_Notify(PSTR("\r\nPhysical Max"), 0x80);
1048  break;
1050  E_Notify(PSTR("\r\nUnit Exp"), 0x80);
1051  break;
1052  case (TYPE_GLOBAL | TAG_GLOBAL_UNIT):
1053  E_Notify(PSTR("\r\nUnit"), 0x80);
1054  break;
1056  E_Notify(PSTR("\r\nReport Size"), 0x80);
1057  break;
1059  E_Notify(PSTR("\r\nReport Count"), 0x80);
1060  break;
1062  E_Notify(PSTR("\r\nReport Id"), 0x80);
1063  break;
1064  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
1065  E_Notify(PSTR("\r\nUsage"), 0x80);
1066  break;
1067  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
1068  E_Notify(PSTR("\r\nUsage Min"), 0x80);
1069  break;
1070  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
1071  E_Notify(PSTR("\r\nUsage Max"), 0x80);
1072  break;
1073  case (TYPE_MAIN | TAG_MAIN_COLLECTION):
1074  E_Notify(PSTR("\r\nCollection"), 0x80);
1075  break;
1077  E_Notify(PSTR("\r\nEnd Collection"), 0x80);
1078  break;
1079  case (TYPE_MAIN | TAG_MAIN_INPUT):
1080  E_Notify(PSTR("\r\nInput"), 0x80);
1081  break;
1082  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
1083  E_Notify(PSTR("\r\nOutput"), 0x80);
1084  break;
1085  case (TYPE_MAIN | TAG_MAIN_FEATURE):
1086  E_Notify(PSTR("\r\nFeature"), 0x80);
1087  break;
1088  } // switch (**pp & (TYPE_MASK | TAG_MASK))
1089 }
1090 
1091 uint8_t ReportDescParserBase::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
1092  //uint8_t ret = enErrorSuccess;
1093  //reinterpret_cast<>(varBuffer);
1094  switch(itemParseState) {
1095  case 0:
1096  if(**pp == HID_LONG_ITEM_PREFIX)
1097  USBTRACE("\r\nLONG\r\n");
1098  else {
1099  uint8_t size = ((**pp) & DATA_SIZE_MASK);
1100 
1101  itemPrefix = (**pp);
1102  itemSize = 1 + ((size == DATA_SIZE_4) ? 4 : size);
1103 
1105  }
1106  (*pp)++;
1107  (*pcntdn)--;
1108  itemSize--;
1109  itemParseState = 1;
1110 
1111  if(!itemSize)
1112  break;
1113 
1114  if(!pcntdn)
1115  return enErrorIncomplete;
1116  case 1:
1117  //USBTRACE2("\r\niSz:",itemSize);
1118 
1121  itemParseState = 2;
1122  case 2:
1123  if(!valParser.Parse(pp, pcntdn))
1124  return enErrorIncomplete;
1125  itemParseState = 3;
1126  case 3:
1127  {
1128  uint8_t data = *((uint8_t*)varBuffer);
1129 
1130  switch(itemPrefix & (TYPE_MASK | TAG_MASK)) {
1131  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
1132  if(pfUsage) {
1133  if(theBuffer.valueSize > 1) {
1134  uint16_t* ui16 = reinterpret_cast<uint16_t *>(varBuffer);
1135  pfUsage(*ui16);
1136  } else
1137  pfUsage(data);
1138  }
1139  break;
1141  rptSize = data;
1142  PrintByteValue(data);
1143  break;
1145  rptCount = data;
1146  PrintByteValue(data);
1147  break;
1153  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
1154  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
1156  case (TYPE_GLOBAL | TAG_GLOBAL_UNIT):
1158  break;
1159  case (TYPE_GLOBAL | TAG_GLOBAL_PUSH):
1160  case (TYPE_GLOBAL | TAG_GLOBAL_POP):
1161  break;
1163  SetUsagePage(data);
1164  PrintUsagePage(data);
1165  PrintByteValue(data);
1166  break;
1167  case (TYPE_MAIN | TAG_MAIN_COLLECTION):
1169  switch(data) {
1170  case 0x00:
1171  E_Notify(PSTR(" Physical"), 0x80);
1172  break;
1173  case 0x01:
1174  E_Notify(PSTR(" Application"), 0x80);
1175  break;
1176  case 0x02:
1177  E_Notify(PSTR(" Logical"), 0x80);
1178  break;
1179  case 0x03:
1180  E_Notify(PSTR(" Report"), 0x80);
1181  break;
1182  case 0x04:
1183  E_Notify(PSTR(" Named Array"), 0x80);
1184  break;
1185  case 0x05:
1186  E_Notify(PSTR(" Usage Switch"), 0x80);
1187  break;
1188  case 0x06:
1189  E_Notify(PSTR(" Usage Modifier"), 0x80);
1190  break;
1191  default:
1192  E_Notify(PSTR(" Vendor Defined("), 0x80);
1193  PrintHex<uint8_t > (data, 0x80);
1194  E_Notify(PSTR(")"), 0x80);
1195  }
1196  break;
1197  case (TYPE_MAIN | TAG_MAIN_INPUT):
1198  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
1199  case (TYPE_MAIN | TAG_MAIN_FEATURE):
1200  totalSize += (uint16_t)rptSize * (uint16_t)rptCount;
1201  rptSize = 0;
1202  rptCount = 0;
1203  E_Notify(PSTR("("), 0x80);
1204  PrintBin<uint8_t > (data, 0x80);
1205  E_Notify(PSTR(")"), 0x80);
1206  break;
1207  } // switch (**pp & (TYPE_MASK | TAG_MASK))
1208  }
1209  } // switch (itemParseState)
1210  itemParseState = 0;
1211  return enErrorSuccess;
1212 }
1213 
1221  NULL, // Keyboard/Keypad
1228  NULL, // Reserved
1229  NULL, // PID
1230  NULL // Unicode
1231 };
1232 
1234  pfUsage = NULL;
1235 
1236  if(VALUE_BETWEEN(page, 0x00, 0x11)) {
1237  pfUsage = (usagePageFunctions[page - 1]);
1238 
1239  } else {
1240  switch(page) {
1241  case 0x14:
1243  break;
1244  case 0x40:
1246  break;
1247  }
1248  }
1249 }
1250 
1252  const char * const * w;
1253  E_Notify(pstrSpace, 0x80);
1254 
1255  output_if_between(page, 0x00, 0x11, w, E_Notify, usagePageTitles0, 0x80)
1256  else output_if_between(page, 0x8b, 0x92, w, E_Notify, usagePageTitles1, 0x80)
1257  else if(VALUE_BETWEEN(page, 0x7f, 0x84))
1259  else if(VALUE_BETWEEN(page, 0x83, 0x8c))
1261  else if(page > 0xfeff /* && page <= 0xffff */)
1263  else
1264  switch(page) {
1265  case 0x14:
1267  break;
1268  case 0x40:
1270  break;
1271  default:
1273  }
1274 }
1275 
1277  E_Notify(pstrSpace, 0x80);
1278  E_Notify(PSTR("Btn"), 0x80);
1279  PrintHex<uint16_t > (usage, 0x80);
1280  E_Notify(PSTR("\r\n"), 0x80);
1281  //USB_HOST_SERIAL.print(usage, HEX);
1282 }
1283 
1285  E_Notify(pstrSpace, 0x80);
1286  E_Notify(PSTR("Inst"), 0x80);
1287  // Sorry, HEX for now...
1288  PrintHex<uint16_t > (usage, 0x80);
1289  E_Notify(PSTR("\r\n"), 0x80);
1290  //USB_HOST_SERIAL.print(usage, DEC);
1291 }
1292 
1294  const char * const * w;
1295  E_Notify(pstrSpace, 0x80);
1296 
1297  output_if_between(usage, 0x00, 0x0a, w, E_Notify, genDesktopTitles0, 0x80)
1298  else output_if_between(usage, 0x2f, 0x49, w, E_Notify, genDesktopTitles1, 0x80)
1299  else output_if_between(usage, 0x7f, 0x94, w, E_Notify, genDesktopTitles2, 0x80)
1300  else output_if_between(usage, 0x9f, 0xa9, w, E_Notify, genDesktopTitles3, 0x80)
1301  else output_if_between(usage, 0xaf, 0xb8, w, E_Notify, genDesktopTitles4, 0x80)
1302  else E_Notify(pstrUsagePageUndefined, 0x80);
1303 }
1304 
1306  const char * const * w;
1307  E_Notify(pstrSpace, 0x80);
1308 
1309  output_if_between(usage, 0x00, 0x0d, w, E_Notify, simuTitles0, 0x80)
1310  else output_if_between(usage, 0x1f, 0x26, w, E_Notify, simuTitles1, 0x80)
1311  else output_if_between(usage, 0xaf, 0xd1, w, E_Notify, simuTitles2, 0x80)
1312  else E_Notify(pstrUsagePageUndefined, 0x80);
1313 }
1314 
1316  const char * const * w;
1317  E_Notify(pstrSpace, 0x80);
1318 
1319  output_if_between(usage, 0x00, 0x0b, w, E_Notify, vrTitles0, 0x80)
1320  else output_if_between(usage, 0x1f, 0x22, w, E_Notify, vrTitles1, 0x80)
1321  else E_Notify(pstrUsagePageUndefined, 0x80);
1322 }
1323 
1325  const char * const * w;
1326  E_Notify(pstrSpace, 0x80);
1327 
1328  output_if_between(usage, 0x00, 0x05, w, E_Notify, sportsCtrlTitles0, 0x80)
1329  else output_if_between(usage, 0x2f, 0x3a, w, E_Notify, sportsCtrlTitles1, 0x80)
1330  else output_if_between(usage, 0x4f, 0x64, w, E_Notify, sportsCtrlTitles2, 0x80)
1331  else E_Notify(pstrUsagePageUndefined, 0x80);
1332 }
1333 
1335  const char * const * w;
1336  E_Notify(pstrSpace, 0x80);
1337 
1338  output_if_between(usage, 0x00, 0x04, w, E_Notify, gameTitles0, 0x80)
1339  else output_if_between(usage, 0x1f, 0x3a, w, E_Notify, gameTitles1, 0x80)
1340  else E_Notify(pstrUsagePageUndefined, 0x80);
1341 }
1342 
1344  const char * const * w;
1345  E_Notify(pstrSpace, 0x80);
1346 
1347  output_if_between(usage, 0x1f, 0x27, w, E_Notify, genDevCtrlTitles, 0x80)
1348  else E_Notify(pstrUsagePageUndefined, 0x80);
1349 }
1350 
1352  const char * const * w;
1353  E_Notify(pstrSpace, 0x80);
1354 
1355  output_if_between(usage, 0x00, 0x4e, w, E_Notify, ledTitles, 0x80)
1356  else E_Notify(pstrUsagePageUndefined, 0x80);
1357 }
1358 
1360  const char * const * w;
1361  E_Notify(pstrSpace, 0x80);
1362 
1363  output_if_between(usage, 0x00, 0x08, w, E_Notify, telTitles0, 0x80)
1364  else output_if_between(usage, 0x1f, 0x32, w, E_Notify, telTitles1, 0x80)
1365  else output_if_between(usage, 0x4f, 0x54, w, E_Notify, telTitles2, 0x80)
1366  else output_if_between(usage, 0x6f, 0x75, w, E_Notify, telTitles3, 0x80)
1367  else output_if_between(usage, 0x8f, 0x9f, w, E_Notify, telTitles4, 0x80)
1368  else output_if_between(usage, 0xaf, 0xc0, w, E_Notify, telTitles5, 0x80)
1369  else E_Notify(pstrUsagePageUndefined, 0x80);
1370 }
1371 
1373  const char * const * w;
1374  E_Notify(pstrSpace, 0x80);
1375 
1376  output_if_between(usage, 0x00, 0x07, w, E_Notify, consTitles0, 0x80)
1377  else output_if_between(usage, 0x1f, 0x23, w, E_Notify, consTitles1, 0x80)
1378  else output_if_between(usage, 0x2f, 0x37, w, E_Notify, consTitles2, 0x80)
1379  else output_if_between(usage, 0x3f, 0x49, w, E_Notify, consTitles3, 0x80)
1380  else output_if_between(usage, 0x5f, 0x67, w, E_Notify, consTitles4, 0x80)
1381  else output_if_between(usage, 0x7f, 0xa5, w, E_Notify, consTitles5, 0x80)
1382  else output_if_between(usage, 0xaf, 0xcf, w, E_Notify, consTitles6, 0x80)
1383  else output_if_between(usage, 0xdf, 0xeb, w, E_Notify, consTitles7, 0x80)
1384  else output_if_between(usage, 0xef, 0xf6, w, E_Notify, consTitles8, 0x80)
1385  else output_if_between(usage, 0xff, 0x10e, w, E_Notify, consTitles9, 0x80)
1386  else output_if_between(usage, 0x14f, 0x156, w, E_Notify, consTitlesA, 0x80)
1387  else output_if_between(usage, 0x15f, 0x16b, w, E_Notify, consTitlesB, 0x80)
1388  else output_if_between(usage, 0x16f, 0x175, w, E_Notify, consTitlesC, 0x80)
1389  else output_if_between(usage, 0x17f, 0x1c8, w, E_Notify, consTitlesD, 0x80)
1390  else output_if_between(usage, 0x1ff, 0x29d, w, E_Notify, consTitlesE, 0x80)
1391  else E_Notify(pstrUsagePageUndefined, 0x80);
1392 }
1393 
1395  const char * const * w;
1396  E_Notify(pstrSpace, 0x80);
1397 
1398  output_if_between(usage, 0x00, 0x0e, w, E_Notify, digitTitles0, 0x80)
1399  else output_if_between(usage, 0x1f, 0x23, w, E_Notify, digitTitles1, 0x80)
1400  else output_if_between(usage, 0x2f, 0x47, w, E_Notify, digitTitles2, 0x80)
1401  else E_Notify(pstrUsagePageUndefined, 0x80);
1402 }
1403 
1405  const char * const * w;
1406  E_Notify(pstrSpace, 0x80);
1407 
1408  output_if_between(usage, 0x00, 0x03, w, E_Notify, aplphanumTitles0, 0x80)
1409  else output_if_between(usage, 0x1f, 0x4e, w, E_Notify, aplphanumTitles1, 0x80)
1410  else output_if_between(usage, 0x7f, 0x96, w, E_Notify, digitTitles2, 0x80)
1411  else E_Notify(pstrUsagePageUndefined, 0x80);
1412 }
1413 
1415  const char * const * w;
1416  E_Notify(pstrSpace, 0x80);
1417 
1418  if(usage == 1) E_Notify(pstrUsageMedicalUltrasound, 0x80);
1419  else if(usage == 0x70)
1421  else output_if_between(usage, 0x1f, 0x28, w, E_Notify, medInstrTitles0, 0x80)
1422  else output_if_between(usage, 0x3f, 0x45, w, E_Notify, medInstrTitles1, 0x80)
1423  else output_if_between(usage, 0x5f, 0x62, w, E_Notify, medInstrTitles2, 0x80)
1424  else output_if_between(usage, 0x7f, 0x8a, w, E_Notify, medInstrTitles3, 0x80)
1425  else output_if_between(usage, 0x9f, 0xa2, w, E_Notify, medInstrTitles4, 0x80)
1426  else E_Notify(pstrUsagePageUndefined, 0x80);
1427 }
1428 
1429 uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
1430  //uint8_t ret = enErrorSuccess;
1431 
1432  switch(itemParseState) {
1433  case 0:
1434  if(**pp == HID_LONG_ITEM_PREFIX)
1435  USBTRACE("\r\nLONG\r\n");
1436  else {
1437  uint8_t size = ((**pp) & DATA_SIZE_MASK);
1438  itemPrefix = (**pp);
1439  itemSize = 1 + ((size == DATA_SIZE_4) ? 4 : size);
1440  }
1441  (*pp)++;
1442  (*pcntdn)--;
1443  itemSize--;
1444  itemParseState = 1;
1445 
1446  if(!itemSize)
1447  break;
1448 
1449  if(!pcntdn)
1450  return enErrorIncomplete;
1451  case 1:
1454  itemParseState = 2;
1455  case 2:
1456  if(!valParser.Parse(pp, pcntdn))
1457  return enErrorIncomplete;
1458  itemParseState = 3;
1459  case 3:
1460  {
1461  uint8_t data = *((uint8_t*)varBuffer);
1462 
1463  switch(itemPrefix & (TYPE_MASK | TAG_MASK)) {
1464  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
1465  if(pfUsage) {
1466  if(theBuffer.valueSize > 1) {
1467  uint16_t* ui16 = reinterpret_cast<uint16_t *>(varBuffer);
1468  pfUsage(*ui16);
1469  } else
1470  pfUsage(data);
1471  }
1472  break;
1474  rptSize = data;
1475  break;
1477  rptCount = data;
1478  break;
1480  rptId = data;
1481  break;
1482  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
1483  useMin = data;
1484  break;
1485  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
1486  useMax = data;
1487  break;
1489  SetUsagePage(data);
1490  break;
1491  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
1492  case (TYPE_MAIN | TAG_MAIN_FEATURE):
1493  rptSize = 0;
1494  rptCount = 0;
1495  useMin = 0;
1496  useMax = 0;
1497  break;
1498  case (TYPE_MAIN | TAG_MAIN_INPUT):
1499  OnInputItem(data);
1500 
1501  totalSize += (uint16_t)rptSize * (uint16_t)rptCount;
1502 
1503  rptSize = 0;
1504  rptCount = 0;
1505  useMin = 0;
1506  useMax = 0;
1507  break;
1508  } // switch (**pp & (TYPE_MASK | TAG_MASK))
1509  }
1510  } // switch (itemParseState)
1511  itemParseState = 0;
1512  return enErrorSuccess;
1513 }
1514 
1515 void ReportDescParser2::OnInputItem(uint8_t itm) {
1516  uint8_t byte_offset = (totalSize >> 3); // calculate offset to the next unhandled byte i = (int)(totalCount / 8);
1517  uint32_t tmp = (byte_offset << 3);
1518  uint8_t bit_offset = totalSize - tmp; // number of bits in the current byte already handled
1519  uint8_t *p = pBuf + byte_offset; // current byte pointer
1520 
1521  if(bit_offset)
1522  *p >>= bit_offset;
1523 
1524  uint8_t usage = useMin;
1525 
1526  bool print_usemin_usemax = ((useMin < useMax) && ((itm & 3) == 2) && pfUsage) ? true : false;
1527 
1528  uint8_t bits_of_byte = 8;
1529 
1530  // for each field in field array defined by rptCount
1531  for(uint8_t field = 0; field < rptCount; field++, usage++) {
1532 
1533  union {
1534  uint8_t bResult[4];
1535  uint16_t wResult[2];
1536  uint32_t dwResult;
1537  } result;
1538 
1539  result.dwResult = 0;
1540  uint8_t mask = 0;
1541 
1542  if(print_usemin_usemax)
1543  pfUsage(usage);
1544 
1545  // bits_left - number of bits in the field(array of fields, depending on Report Count) left to process
1546  // bits_of_byte - number of bits in current byte left to process
1547  // bits_to_copy - number of bits to copy to result buffer
1548 
1549  // for each bit in a field
1550  for(uint8_t bits_left = rptSize, bits_to_copy = 0; bits_left;
1551  bits_left -= bits_to_copy) {
1552  bits_to_copy = (bits_left > bits_of_byte) ? bits_of_byte : bits_left;
1553 
1554  result.dwResult <<= bits_to_copy; // Result buffer is shifted by the number of bits to be copied into it
1555 
1556  uint8_t val = *p;
1557 
1558  val >>= (8 - bits_of_byte); // Shift by the number of bits already processed
1559 
1560  mask = 0;
1561 
1562  for(uint8_t j = bits_to_copy; j; j--) {
1563  mask <<= 1;
1564  mask |= 1;
1565  }
1566 
1567  result.bResult[0] = (result.bResult[0] | (val & mask));
1568 
1569  bits_of_byte -= bits_to_copy;
1570 
1571  if(bits_of_byte < 1) {
1572  bits_of_byte = 8;
1573  p++;
1574  }
1575  }
1576  PrintByteValue(result.dwResult);
1577  }
1578  E_Notify(PSTR("\r\n"), 0x80);
1579 }
1580 
1581 void UniversalReportParser::Parse(USBHID *hid, bool is_rpt_id __attribute__((unused)), uint8_t len, uint8_t *buf) {
1582  ReportDescParser2 prs(len, buf);
1583 
1584  uint8_t ret = hid->GetReportDescr(0, &prs);
1585 
1586  if(ret)
1587  ErrorMessage<uint8_t > (PSTR("GetReportDescr-2"), ret);
1588 }
const char pstrUsageYTilt[]
Definition: hidusagestr.h:814
const char pstrUsageRewind[]
Definition: hidusagestr.h:323
static const char *const medInstrTitles0[]
static const char *const usagePageTitles0[]
@@ -402,7 +382,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
const char pstrUsageALLogon[]
Definition: hidusagestr.h:597
static const char *const medInstrTitles1[]
const char pstrUsageALCalendarSchedule[]
Definition: hidusagestr.h:584
-
#define output_if_between(v, l, h, wa, fp, mp, el)
Definition: macros.h:30
+
#define output_if_between(v, l, h, wa, fp, mp, el)
Definition: macros.h:37
const char pstrUsageMenu[]
Definition: hidusagestr.h:434
const char pstrUsageALNextTaskApplication[]
Definition: hidusagestr.h:605
const char pstrUsagePhoneMute[]
Definition: hidusagestr.h:373
@@ -573,7 +553,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
const char pstrUsageMotion[]
Definition: hidusagestr.h:544
const char pstrUsageACNew[]
Definition: hidusagestr.h:642
const char pstrUsageError[]
Definition: hidusagestr.h:328
-
#define VALUE_BETWEEN(v, l, h)
Definition: macros.h:27
+
#define VALUE_BETWEEN(v, l, h)
Definition: macros.h:34
const char pstrUsageSendCalls[]
Definition: hidusagestr.h:307
const char pstrUsageACMirrorVertical[]
Definition: hidusagestr.h:699
const char pstrUsageSystemDebuggerBreak[]
Definition: hidusagestr.h:115
@@ -653,7 +633,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
const char pstrUsageDigitizer[]
Definition: hidusagestr.h:784
const char pstrUsageDisplayData[]
Definition: hidusagestr.h:839
const char pstrUsageFeature[]
Definition: hidusagestr.h:360
-
bool Parse(uint8_t **pp, uint16_t *pcntdn)
Definition: parsetools.cpp:19
+
bool Parse(uint8_t **pp, uint16_t *pcntdn)
Definition: parsetools.cpp:26
const char pstrUsageFont14Segment[]
Definition: hidusagestr.h:863
const char pstrUsageRx[]
Definition: hidusagestr.h:70
@@ -689,7 +669,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
const char pstrUsageDisplayStatus[]
Definition: hidusagestr.h:840
const char pstrUsageACFontColor[]
Definition: hidusagestr.h:701
const char pstrUsageWheel[]
Definition: hidusagestr.h:75
-
#define PSTR(str)
+
#define PSTR(str)
const char pstrUsageACFontSelect[]
Definition: hidusagestr.h:700
const char pstrUsageRingSelect[]
Definition: hidusagestr.h:372
const char pstrUsageChannelSide[]
Definition: hidusagestr.h:560
@@ -710,7 +690,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
const char pstrUsageALSpellCheck[]
Definition: hidusagestr.h:613
static const char *const vrTitles0[]
const char pstrUsageACPanLeft[]
Definition: hidusagestr.h:679
-
void E_Notify(char const *msg, int lvl)
Definition: message.cpp:34
+
void E_Notify(char const *msg, int lvl)
Definition: message.cpp:41
const char pstrUsageSearchMarkBackwards[]
Definition: hidusagestr.h:509
const char pstrUsageZoomAdjust[]
Definition: hidusagestr.h:913
const char pstrUsageACClose[]
Definition: hidusagestr.h:644
@@ -772,7 +752,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
#define TYPE_MASK
Definition: usbhid.h:27
const char pstrUsageASCIICharacterSet[]
Definition: hidusagestr.h:828
const char pstrUsageExternalPowerConnected[]
Definition: hidusagestr.h:348
-
uint8_t valueSize
Definition: parsetools.h:24
+
uint8_t valueSize
Definition: parsetools.h:31
const char pstrUsagePageGenericDeviceControls[]
Definition: hidusagestr.h:35
const char pstrUsageBlitData[]
Definition: hidusagestr.h:886
const char pstrUsageForwardCalls[]
Definition: hidusagestr.h:366
@@ -846,7 +826,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
const char pstrUsageCharacterSpacingHorizontal[]
Definition: hidusagestr.h:858
static const char *const ledTitles[]
const char pstrUsageChannelDecrement[]
Definition: hidusagestr.h:479
-
void Initialize(MultiValueBuffer *const pbuf)
Definition: parsetools.h:42
+
void Initialize(MultiValueBuffer *const pbuf)
Definition: parsetools.h:49
const char pstrUsageStickFaceAngle[]
Definition: hidusagestr.h:205
const char pstrUsageBarrelPressure[]
Definition: hidusagestr.h:801
const char pstrUsageACReply[]
Definition: hidusagestr.h:762
@@ -1022,7 +1002,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
const char pstrUsagePageAlphaNumericDisplay[]
Definition: hidusagestr.h:45
const char pstrUsage5Wood[]
Definition: hidusagestr.h:228
const char pstrUsageDuresAlarm[]
Definition: hidusagestr.h:545
-
#define USBTRACE(s)
Definition: macros.h:75
+
#define USBTRACE(s)
Definition: macros.h:82
const char pstrUsageACUnderline[]
Definition: hidusagestr.h:689
const char pstrUsageALLaunchButtonConfigTool[]
Definition: hidusagestr.h:571
const char pstrUsageSailingSimulationDevice[]
Definition: hidusagestr.h:135
@@ -1078,7 +1058,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidescriptorparser_8h.html b/hidescriptorparser_8h.html index 846a4bec..936dd0e9 100644 --- a/hidescriptorparser_8h.html +++ b/hidescriptorparser_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidescriptorparser.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/hidescriptorparser_8h__dep__incl.md5 b/hidescriptorparser_8h__dep__incl.md5 index e086c781..a1421715 100644 --- a/hidescriptorparser_8h__dep__incl.md5 +++ b/hidescriptorparser_8h__dep__incl.md5 @@ -1 +1 @@ -f9ba94ed99ad5905f056e92fce988411 \ No newline at end of file +ef699e62c545d11d2c79ea503d951f57 \ No newline at end of file diff --git a/hidescriptorparser_8h__dep__incl.png b/hidescriptorparser_8h__dep__incl.png index aa5ace54..a9e67695 100644 Binary files a/hidescriptorparser_8h__dep__incl.png and b/hidescriptorparser_8h__dep__incl.png differ diff --git a/hidescriptorparser_8h__incl.md5 b/hidescriptorparser_8h__incl.md5 index bfc34772..f713943a 100644 --- a/hidescriptorparser_8h__incl.md5 +++ b/hidescriptorparser_8h__incl.md5 @@ -1 +1 @@ -fe5843698cf13b222c52c15fd3ff6cda \ No newline at end of file +81e0e69900d2442c43e8471fdfc78594 \ No newline at end of file diff --git a/hidescriptorparser_8h__incl.png b/hidescriptorparser_8h__incl.png index d091cd85..70923d31 100644 Binary files a/hidescriptorparser_8h__incl.png and b/hidescriptorparser_8h__incl.png differ diff --git a/hidescriptorparser_8h_source.html b/hidescriptorparser_8h_source.html index 15684222..35a127bb 100644 --- a/hidescriptorparser_8h_source.html +++ b/hidescriptorparser_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidescriptorparser.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
hidescriptorparser.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 #if !defined(__HIDDESCRIPTORPARSER_H__)
18 #define __HIDDESCRIPTORPARSER_H__
19 
20 #include "usbhid.h"
21 
23 public:
24  typedef void (*UsagePageFunc)(uint16_t usage);
25 
26  static void PrintGenericDesktopPageUsage(uint16_t usage);
27  static void PrintSimulationControlsPageUsage(uint16_t usage);
28  static void PrintVRControlsPageUsage(uint16_t usage);
29  static void PrintSportsControlsPageUsage(uint16_t usage);
30  static void PrintGameControlsPageUsage(uint16_t usage);
31  static void PrintGenericDeviceControlsPageUsage(uint16_t usage);
32  static void PrintLEDPageUsage(uint16_t usage);
33  static void PrintButtonPageUsage(uint16_t usage);
34  static void PrintOrdinalPageUsage(uint16_t usage);
35  static void PrintTelephonyPageUsage(uint16_t usage);
36  static void PrintConsumerPageUsage(uint16_t usage);
37  static void PrintDigitizerPageUsage(uint16_t usage);
38  static void PrintAlphanumDisplayPageUsage(uint16_t usage);
39  static void PrintMedicalInstrumentPageUsage(uint16_t usage);
40 
41  static void PrintValue(uint8_t *p, uint8_t len);
42  static void PrintByteValue(uint8_t data);
43 
44  static void PrintItemTitle(uint8_t prefix);
45 
46  static const char * const usagePageTitles0[];
47  static const char * const usagePageTitles1[];
48  static const char * const genDesktopTitles0[];
49  static const char * const genDesktopTitles1[];
50  static const char * const genDesktopTitles2[];
51  static const char * const genDesktopTitles3[];
52  static const char * const genDesktopTitles4[];
53  static const char * const simuTitles0[];
54  static const char * const simuTitles1[];
55  static const char * const simuTitles2[];
56  static const char * const vrTitles0[];
57  static const char * const vrTitles1[];
58  static const char * const sportsCtrlTitles0[];
59  static const char * const sportsCtrlTitles1[];
60  static const char * const sportsCtrlTitles2[];
61  static const char * const gameTitles0[];
62  static const char * const gameTitles1[];
63  static const char * const genDevCtrlTitles[];
64  static const char * const ledTitles[];
65  static const char * const telTitles0[];
66  static const char * const telTitles1[];
67  static const char * const telTitles2[];
68  static const char * const telTitles3[];
69  static const char * const telTitles4[];
70  static const char * const telTitles5[];
71  static const char * const consTitles0[];
72  static const char * const consTitles1[];
73  static const char * const consTitles2[];
74  static const char * const consTitles3[];
75  static const char * const consTitles4[];
76  static const char * const consTitles5[];
77  static const char * const consTitles6[];
78  static const char * const consTitles7[];
79  static const char * const consTitles8[];
80  static const char * const consTitles9[];
81  static const char * const consTitlesA[];
82  static const char * const consTitlesB[];
83  static const char * const consTitlesC[];
84  static const char * const consTitlesD[];
85  static const char * const consTitlesE[];
86  static const char * const digitTitles0[];
87  static const char * const digitTitles1[];
88  static const char * const digitTitles2[];
89  static const char * const aplphanumTitles0[];
90  static const char * const aplphanumTitles1[];
91  static const char * const aplphanumTitles2[];
92  static const char * const medInstrTitles0[];
93  static const char * const medInstrTitles1[];
94  static const char * const medInstrTitles2[];
95  static const char * const medInstrTitles3[];
96  static const char * const medInstrTitles4[];
97 
98 protected:
100 
105 
106  uint8_t itemParseState; // Item parser state variable
107  uint8_t itemSize; // Item size
108  uint8_t itemPrefix; // Item prefix (first byte)
109  uint8_t rptSize; // Report Size
110  uint8_t rptCount; // Report Count
111 
112  uint16_t totalSize; // Report size in bits
113 
114  // Method should be defined here if virtual.
115  virtual uint8_t ParseItem(uint8_t **pp, uint16_t *pcntdn);
116 
118 
119  static void PrintUsagePage(uint16_t page);
120  void SetUsagePage(uint16_t page);
121 
122 public:
123 
125  itemParseState(0),
126  itemSize(0),
127  itemPrefix(0),
128  rptSize(0),
129  rptCount(0),
130  pfUsage(NULL) {
131  theBuffer.pValue = varBuffer;
132  valParser.Initialize(&theBuffer);
133  theSkipper.Initialize(&theBuffer);
134  };
135 
136  void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset);
137 
138  enum {
140  , enErrorIncomplete // value or record is partialy read in buffer
142  };
143 };
144 
146 };
147 
149  uint8_t rptId; // Report ID
150  uint8_t useMin; // Usage Minimum
151  uint8_t useMax; // Usage Maximum
152  uint8_t fieldCount; // Number of field being currently processed
153 
154  void OnInputItem(uint8_t itm); // Method which is called every time Input item is found
155 
156  uint8_t *pBuf; // Report buffer pointer
157  uint8_t bLen; // Report length
158 
159 protected:
160  // Method should be defined here if virtual.
161  virtual uint8_t ParseItem(uint8_t **pp, uint16_t *pcntdn);
162 
163 public:
164 
165  ReportDescParser2(uint16_t len, uint8_t *pbuf) :
166  ReportDescParserBase(), rptId(0), useMin(0), useMax(0), fieldCount(0), pBuf(pbuf), bLen(len) {
167  };
168 };
169 
171 public:
172  // Method should be defined here if virtual.
173  virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
174 };
175 
176 #endif // __HIDDESCRIPTORPARSER_H__
static const char *const medInstrTitles0[]
+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 #if !defined(__HIDDESCRIPTORPARSER_H__)
18 #define __HIDDESCRIPTORPARSER_H__
19 
20 #include "usbhid.h"
21 
23 public:
24  typedef void (*UsagePageFunc)(uint16_t usage);
25 
26  static void PrintGenericDesktopPageUsage(uint16_t usage);
27  static void PrintSimulationControlsPageUsage(uint16_t usage);
28  static void PrintVRControlsPageUsage(uint16_t usage);
29  static void PrintSportsControlsPageUsage(uint16_t usage);
30  static void PrintGameControlsPageUsage(uint16_t usage);
31  static void PrintGenericDeviceControlsPageUsage(uint16_t usage);
32  static void PrintLEDPageUsage(uint16_t usage);
33  static void PrintButtonPageUsage(uint16_t usage);
34  static void PrintOrdinalPageUsage(uint16_t usage);
35  static void PrintTelephonyPageUsage(uint16_t usage);
36  static void PrintConsumerPageUsage(uint16_t usage);
37  static void PrintDigitizerPageUsage(uint16_t usage);
38  static void PrintAlphanumDisplayPageUsage(uint16_t usage);
39  static void PrintMedicalInstrumentPageUsage(uint16_t usage);
40 
41  static void PrintValue(uint8_t *p, uint8_t len);
42  static void PrintByteValue(uint8_t data);
43 
44  static void PrintItemTitle(uint8_t prefix);
45 
46  static const char * const usagePageTitles0[];
47  static const char * const usagePageTitles1[];
48  static const char * const genDesktopTitles0[];
49  static const char * const genDesktopTitles1[];
50  static const char * const genDesktopTitles2[];
51  static const char * const genDesktopTitles3[];
52  static const char * const genDesktopTitles4[];
53  static const char * const simuTitles0[];
54  static const char * const simuTitles1[];
55  static const char * const simuTitles2[];
56  static const char * const vrTitles0[];
57  static const char * const vrTitles1[];
58  static const char * const sportsCtrlTitles0[];
59  static const char * const sportsCtrlTitles1[];
60  static const char * const sportsCtrlTitles2[];
61  static const char * const gameTitles0[];
62  static const char * const gameTitles1[];
63  static const char * const genDevCtrlTitles[];
64  static const char * const ledTitles[];
65  static const char * const telTitles0[];
66  static const char * const telTitles1[];
67  static const char * const telTitles2[];
68  static const char * const telTitles3[];
69  static const char * const telTitles4[];
70  static const char * const telTitles5[];
71  static const char * const consTitles0[];
72  static const char * const consTitles1[];
73  static const char * const consTitles2[];
74  static const char * const consTitles3[];
75  static const char * const consTitles4[];
76  static const char * const consTitles5[];
77  static const char * const consTitles6[];
78  static const char * const consTitles7[];
79  static const char * const consTitles8[];
80  static const char * const consTitles9[];
81  static const char * const consTitlesA[];
82  static const char * const consTitlesB[];
83  static const char * const consTitlesC[];
84  static const char * const consTitlesD[];
85  static const char * const consTitlesE[];
86  static const char * const digitTitles0[];
87  static const char * const digitTitles1[];
88  static const char * const digitTitles2[];
89  static const char * const aplphanumTitles0[];
90  static const char * const aplphanumTitles1[];
91  static const char * const aplphanumTitles2[];
92  static const char * const medInstrTitles0[];
93  static const char * const medInstrTitles1[];
94  static const char * const medInstrTitles2[];
95  static const char * const medInstrTitles3[];
96  static const char * const medInstrTitles4[];
97 
98 protected:
100 
105 
106  uint8_t itemParseState; // Item parser state variable
107  uint8_t itemSize; // Item size
108  uint8_t itemPrefix; // Item prefix (first byte)
109  uint8_t rptSize; // Report Size
110  uint8_t rptCount; // Report Count
111 
112  uint16_t totalSize; // Report size in bits
113 
114  // Method should be defined here if virtual.
115  virtual uint8_t ParseItem(uint8_t **pp, uint16_t *pcntdn);
116 
118 
119  static void PrintUsagePage(uint16_t page);
120  void SetUsagePage(uint16_t page);
121 
122 public:
123 
125  itemParseState(0),
126  itemSize(0),
127  itemPrefix(0),
128  rptSize(0),
129  rptCount(0),
130  pfUsage(NULL) {
134  };
135 
136  void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset);
137 
138  enum {
140  , enErrorIncomplete // value or record is partialy read in buffer
142  };
143 };
144 
146 };
147 
149  uint8_t rptId; // Report ID
150  uint8_t useMin; // Usage Minimum
151  uint8_t useMax; // Usage Maximum
152  uint8_t fieldCount; // Number of field being currently processed
153 
154  void OnInputItem(uint8_t itm); // Method which is called every time Input item is found
155 
156  uint8_t *pBuf; // Report buffer pointer
157  uint8_t bLen; // Report length
158 
159 protected:
160  // Method should be defined here if virtual.
161  virtual uint8_t ParseItem(uint8_t **pp, uint16_t *pcntdn);
162 
163 public:
164 
165  ReportDescParser2(uint16_t len, uint8_t *pbuf) :
166  ReportDescParserBase(), rptId(0), useMin(0), useMax(0), fieldCount(0), pBuf(pbuf), bLen(len) {
167  };
168 };
169 
171 public:
172  // Method should be defined here if virtual.
173  virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
174 };
175 
176 #endif // __HIDDESCRIPTORPARSER_H__
static const char *const medInstrTitles0[]
static const char *const usagePageTitles0[]
static const char *const telTitles1[]
Definition: usbhid.h:143
static const char *const consTitles1[]
static const char *const consTitles5[]
static const char *const consTitlesD[]
+
virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
static void PrintValue(uint8_t *p, uint8_t len)
static const char *const genDesktopTitles1[]
@@ -107,7 +88,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
static const char *const genDesktopTitles0[]
static const char *const genDevCtrlTitles[]
- +
static void PrintTelephonyPageUsage(uint16_t usage)
static void PrintByteValue(uint8_t data)
static void PrintMedicalInstrumentPageUsage(uint16_t usage)
@@ -133,8 +114,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
static const char *const genDesktopTitles2[]
static const char *const consTitles9[]
static const char *const telTitles4[]
- - + +
static const char *const aplphanumTitles0[]
static const char *const sportsCtrlTitles2[]
@@ -143,9 +124,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
static void PrintGenericDeviceControlsPageUsage(uint16_t usage)
static void PrintSportsControlsPageUsage(uint16_t usage)
static const char *const consTitlesB[]
-
void Initialize(MultiValueBuffer *pbuf)
Definition: parsetools.h:60
+
void Initialize(MultiValueBuffer *pbuf)
Definition: parsetools.h:67
static void PrintVRControlsPageUsage(uint16_t usage)
- +
static const char *const medInstrTitles4[]
ReportDescParser2(uint16_t len, uint8_t *pbuf)
static const char *const telTitles3[]
@@ -156,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - +
MultiByteValueParser valParser
static const char *const consTitles6[]
@@ -174,7 +155,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
static const char *const vrTitles1[]
static const char *const ledTitles[]
-
void Initialize(MultiValueBuffer *const pbuf)
Definition: parsetools.h:42
+
void Initialize(MultiValueBuffer *const pbuf)
Definition: parsetools.h:49
static const char *const gameTitles0[]
void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset)
static const char *const consTitlesA[]
@@ -182,6 +163,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
static const char *const consTitlesE[]
static const char *const digitTitles0[]
+
virtual uint8_t ParseItem(uint8_t **pp, uint16_t *pcntdn)
static const char *const simuTitles0[]
static const char *const simuTitles2[]
static const char *const sportsCtrlTitles1[]
@@ -191,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
static UsagePageFunc usagePageFunctions[]
static const char *const consTitles8[]
- +
static const char *const medInstrTitles2[]
uint8_t varBuffer[sizeof(USB_CONFIGURATION_DESCRIPTOR)]
@@ -200,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hiduniversal_8cpp.html b/hiduniversal_8cpp.html index 81fbedc8..14a61bb3 100644 --- a/hiduniversal_8cpp.html +++ b/hiduniversal_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hiduniversal.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/hiduniversal_8cpp__incl.md5 b/hiduniversal_8cpp__incl.md5 index c3ad3b07..52c67d09 100644 --- a/hiduniversal_8cpp__incl.md5 +++ b/hiduniversal_8cpp__incl.md5 @@ -1 +1 @@ -1e66e5231753075199ca54c70eb24f20 \ No newline at end of file +61bccc66dff51679312c2d4713fe6ee2 \ No newline at end of file diff --git a/hiduniversal_8cpp__incl.png b/hiduniversal_8cpp__incl.png index 8d95269a..f3542320 100644 Binary files a/hiduniversal_8cpp__incl.png and b/hiduniversal_8cpp__incl.png differ diff --git a/hiduniversal_8cpp_source.html b/hiduniversal_8cpp_source.html index f57019a3..247b0cda 100644 --- a/hiduniversal_8cpp_source.html +++ b/hiduniversal_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hiduniversal.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
hiduniversal.cpp
-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 #include "hiduniversal.h"
19 
21 USBHID(p),
22 qNextPollTime(0),
23 pollInterval(0),
24 bPollEnable(false),
25 bHasReportId(false) {
26  Initialize();
27 
28  if(pUsb)
30 }
31 
32 uint16_t HIDUniversal::GetHidClassDescrLen(uint8_t type, uint8_t num) {
33  for(uint8_t i = 0, n = 0; i < HID_MAX_HID_CLASS_DESCRIPTORS; i++) {
34  if(descrInfo[i].bDescrType == type) {
35  if(n == num)
36  return descrInfo[i].wDescriptorLength;
37  n++;
38  }
39  }
40  return 0;
41 }
42 
43 void HIDUniversal::Initialize() {
44  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
45  rptParsers[i].rptId = 0;
46  rptParsers[i].rptParser = NULL;
47  }
48  for(uint8_t i = 0; i < HID_MAX_HID_CLASS_DESCRIPTORS; i++) {
49  descrInfo[i].bDescrType = 0;
50  descrInfo[i].wDescriptorLength = 0;
51  }
52  for(uint8_t i = 0; i < maxHidInterfaces; i++) {
53  hidInterfaces[i].bmInterface = 0;
54  hidInterfaces[i].bmProtocol = 0;
55 
56  for(uint8_t j = 0; j < maxEpPerInterface; j++)
57  hidInterfaces[i].epIndex[j] = 0;
58  }
59  for(uint8_t i = 0; i < totalEndpoints; i++) {
60  epInfo[i].epAddr = 0;
61  epInfo[i].maxPktSize = (i) ? 0 : 8;
62  epInfo[i].bmSndToggle = 0;
63  epInfo[i].bmRcvToggle = 0;
65  }
66  bNumEP = 1;
67  bNumIface = 0;
68  bConfNum = 0;
69  pollInterval = 0;
70 
71  ZeroMemory(constBuffLen, prevBuf);
72 }
73 
75  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
76  if(rptParsers[i].rptId == 0 && rptParsers[i].rptParser == NULL) {
77  rptParsers[i].rptId = id;
78  rptParsers[i].rptParser = prs;
79  return true;
80  }
81  }
82  return false;
83 }
84 
86  if(!bHasReportId)
87  return ((rptParsers[0].rptParser) ? rptParsers[0].rptParser : NULL);
88 
89  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
90  if(rptParsers[i].rptId == id)
91  return rptParsers[i].rptParser;
92  }
93  return NULL;
94 }
95 
96 uint8_t HIDUniversal::Init(uint8_t parent, uint8_t port, bool lowspeed) {
97  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
98 
99  uint8_t buf[constBufSize];
100  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
101  uint8_t rcode;
102  UsbDevice *p = NULL;
103  EpInfo *oldep_ptr = NULL;
104  uint8_t len = 0;
105 
106  uint8_t num_of_conf; // number of configurations
107  //uint8_t num_of_intf; // number of interfaces
108 
109  AddressPool &addrPool = pUsb->GetAddressPool();
110 
111  USBTRACE("HU Init\r\n");
112 
113  if(bAddress)
115 
116  // Get pointer to pseudo device with address 0 assigned
117  p = addrPool.GetUsbDevicePtr(0);
118 
119  if(!p)
121 
122  if(!p->epinfo) {
123  USBTRACE("epinfo\r\n");
125  }
126 
127  // Save old pointer to EP_RECORD of address 0
128  oldep_ptr = p->epinfo;
129 
130  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
131  p->epinfo = epInfo;
132 
133  p->lowspeed = lowspeed;
134 
135  // Get device descriptor
136  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
137 
138  if(!rcode)
139  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
140 
141  if(rcode) {
142  // Restore p->epinfo
143  p->epinfo = oldep_ptr;
144 
145  goto FailGetDevDescr;
146  }
147 
148  // Restore p->epinfo
149  p->epinfo = oldep_ptr;
150 
151  // Allocate new address according to device class
152  bAddress = addrPool.AllocAddress(parent, false, port);
153 
154  if(!bAddress)
156 
157  // Extract Max Packet Size from the device descriptor
159 
160  // Assign new address to the device
161  rcode = pUsb->setAddr(0, 0, bAddress);
162 
163  if(rcode) {
164  p->lowspeed = false;
165  addrPool.FreeAddress(bAddress);
166  bAddress = 0;
167  USBTRACE2("setAddr:", rcode);
168  return rcode;
169  }
170 
171  //delay(2); //per USB 2.0 sect.9.2.6.3
172 
173  USBTRACE2("Addr:", bAddress);
174 
175  p->lowspeed = false;
176 
177  p = addrPool.GetUsbDevicePtr(bAddress);
178 
179  if(!p)
181 
182  p->lowspeed = lowspeed;
183 
184  if(len)
185  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
186 
187  if(rcode)
188  goto FailGetDevDescr;
189 
190  VID = udd->idVendor; // Can be used by classes that inherits this class to check the VID and PID of the connected device
191  PID = udd->idProduct;
192 
193  num_of_conf = udd->bNumConfigurations;
194 
195  // Assign epInfo to epinfo pointer
196  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
197 
198  if(rcode)
199  goto FailSetDevTblEntry;
200 
201  USBTRACE2("NC:", num_of_conf);
202 
203  for(uint8_t i = 0; i < num_of_conf; i++) {
204  //HexDumper<USBReadParser, uint16_t, uint16_t> HexDump;
206  CP_MASK_COMPARE_CLASS> confDescrParser(this);
207 
208  //rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
209  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
210 
211  if(rcode)
212  goto FailGetConfDescr;
213 
214  if(bNumEP > 1)
215  break;
216  } // for
217 
218  if(bNumEP < 2)
220 
221  // Assign epInfo to epinfo pointer
222  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
223 
224  USBTRACE2("Cnf:", bConfNum);
225 
226  // Set Configuration Value
227  rcode = pUsb->setConf(bAddress, 0, bConfNum);
228 
229  if(rcode)
230  goto FailSetConfDescr;
231 
232  for(uint8_t i = 0; i < bNumIface; i++) {
233  if(hidInterfaces[i].epIndex[epInterruptInIndex] == 0)
234  continue;
235 
236  rcode = SetIdle(hidInterfaces[i].bmInterface, 0, 0);
237 
238  if(rcode && rcode != hrSTALL)
239  goto FailSetIdle;
240  }
241 
242  USBTRACE("HU configured\r\n");
243 
245 
246  bPollEnable = true;
247  return 0;
248 
249 FailGetDevDescr:
250 #ifdef DEBUG_USB_HOST
252  goto Fail;
253 #endif
254 
255 FailSetDevTblEntry:
256 #ifdef DEBUG_USB_HOST
258  goto Fail;
259 #endif
260 
261 FailGetConfDescr:
262 #ifdef DEBUG_USB_HOST
264  goto Fail;
265 #endif
266 
267 FailSetConfDescr:
268 #ifdef DEBUG_USB_HOST
270  goto Fail;
271 #endif
272 
273 
274 FailSetIdle:
275 #ifdef DEBUG_USB_HOST
276  USBTRACE("SetIdle:");
277 #endif
278 
279 #ifdef DEBUG_USB_HOST
280 Fail:
281  NotifyFail(rcode);
282 #endif
283  Release();
284  return rcode;
285 }
286 
287 HIDUniversal::HIDInterface* HIDUniversal::FindInterface(uint8_t iface, uint8_t alt, uint8_t proto) {
288  for(uint8_t i = 0; i < bNumIface && i < maxHidInterfaces; i++)
289  if(hidInterfaces[i].bmInterface == iface && hidInterfaces[i].bmAltSet == alt
290  && hidInterfaces[i].bmProtocol == proto)
291  return hidInterfaces + i;
292  return NULL;
293 }
294 
295 void HIDUniversal::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
296  // If the first configuration satisfies, the others are not concidered.
297  if(bNumEP > 1 && conf != bConfNum)
298  return;
299 
300  //ErrorMessage<uint8_t>(PSTR("\r\nConf.Val"), conf);
301  //ErrorMessage<uint8_t>(PSTR("Iface Num"), iface);
302  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
303 
304  bConfNum = conf;
305 
306  uint8_t index = 0;
307  HIDInterface *piface = FindInterface(iface, alt, proto);
308 
309  // Fill in interface structure in case of new interface
310  if(!piface) {
311  piface = hidInterfaces + bNumIface;
312  piface->bmInterface = iface;
313  piface->bmAltSet = alt;
314  piface->bmProtocol = proto;
315  bNumIface++;
316  }
317 
318  if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
319  index = epInterruptInIndex;
320  else
321  index = epInterruptOutIndex;
322 
323  if(index) {
324  // Fill in the endpoint info structure
325  epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
326  epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
327  epInfo[bNumEP].bmSndToggle = 0;
328  epInfo[bNumEP].bmRcvToggle = 0;
329  epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
330 
331  // Fill in the endpoint index list
332  piface->epIndex[index] = bNumEP; //(pep->bEndpointAddress & 0x0F);
333 
334  if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
335  pollInterval = pep->bInterval;
336 
337  bNumEP++;
338  }
339  //PrintEndpointDescriptor(pep);
340 }
341 
344 
345  bNumEP = 1;
346  bAddress = 0;
347  qNextPollTime = 0;
348  bPollEnable = false;
349  return 0;
350 }
351 
352 bool HIDUniversal::BuffersIdentical(uint8_t len, uint8_t *buf1, uint8_t *buf2) {
353  for(uint8_t i = 0; i < len; i++)
354  if(buf1[i] != buf2[i])
355  return false;
356  return true;
357 }
358 
359 void HIDUniversal::ZeroMemory(uint8_t len, uint8_t *buf) {
360  for(uint8_t i = 0; i < len; i++)
361  buf[i] = 0;
362 }
363 
364 void HIDUniversal::SaveBuffer(uint8_t len, uint8_t *src, uint8_t *dest) {
365  for(uint8_t i = 0; i < len; i++)
366  dest[i] = src[i];
367 }
368 
370  uint8_t rcode = 0;
371 
372  if(!bPollEnable)
373  return 0;
374 
375  if((long)(millis() - qNextPollTime) >= 0L) {
376  qNextPollTime = millis() + pollInterval;
377 
378  uint8_t buf[constBuffLen];
379 
380  for(uint8_t i = 0; i < bNumIface; i++) {
381  uint8_t index = hidInterfaces[i].epIndex[epInterruptInIndex];
382  uint16_t read = (uint16_t)epInfo[index].maxPktSize;
383 
384  ZeroMemory(constBuffLen, buf);
385 
386  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[index].epAddr, &read, buf);
387 
388  if(rcode) {
389  if(rcode != hrNAK)
390  USBTRACE3("(hiduniversal.h) Poll:", rcode, 0x81);
391  return rcode;
392  }
393 
394  if(read > constBuffLen)
395  read = constBuffLen;
396 
397  bool identical = BuffersIdentical(read, buf, prevBuf);
398 
399  SaveBuffer(read, buf, prevBuf);
400 
401  if(identical)
402  return 0;
403 #if 0
404  Notify(PSTR("\r\nBuf: "), 0x80);
405 
406  for(uint8_t i = 0; i < read; i++) {
407  D_PrintHex<uint8_t > (buf[i], 0x80);
408  Notify(PSTR(" "), 0x80);
409  }
410 
411  Notify(PSTR("\r\n"), 0x80);
412 #endif
413  ParseHIDData(this, bHasReportId, (uint8_t)read, buf);
414 
415  HIDReportParser *prs = GetReportParser(((bHasReportId) ? *buf : 0));
416 
417  if(prs)
418  prs->Parse(this, bHasReportId, (uint8_t)read, buf);
419  }
420  }
421  return rcode;
422 }
423 
424 // Send a report to interrupt out endpoint. This is NOT SetReport() request!
425 uint8_t HIDUniversal::SndRpt(uint16_t nbytes, uint8_t *dataptr) {
426  return pUsb->outTransfer(bAddress, epInfo[epInterruptOutIndex].epAddr, nbytes, dataptr);
427 }
uint16_t PID
Definition: hiduniversal.h:69
-
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:771
-
uint8_t bmRcvToggle
Definition: address.h:41
+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 #include "hiduniversal.h"
19 
21 USBHID(p),
22 qNextPollTime(0),
23 pollInterval(0),
24 bPollEnable(false),
25 bHasReportId(false) {
26  Initialize();
27 
28  if(pUsb)
30 }
31 
32 uint16_t HIDUniversal::GetHidClassDescrLen(uint8_t type, uint8_t num) {
33  for(uint8_t i = 0, n = 0; i < HID_MAX_HID_CLASS_DESCRIPTORS; i++) {
34  if(descrInfo[i].bDescrType == type) {
35  if(n == num)
36  return descrInfo[i].wDescriptorLength;
37  n++;
38  }
39  }
40  return 0;
41 }
42 
43 void HIDUniversal::Initialize() {
44  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
45  rptParsers[i].rptId = 0;
46  rptParsers[i].rptParser = NULL;
47  }
48  for(uint8_t i = 0; i < HID_MAX_HID_CLASS_DESCRIPTORS; i++) {
49  descrInfo[i].bDescrType = 0;
50  descrInfo[i].wDescriptorLength = 0;
51  }
52  for(uint8_t i = 0; i < maxHidInterfaces; i++) {
53  hidInterfaces[i].bmInterface = 0;
54  hidInterfaces[i].bmProtocol = 0;
55 
56  for(uint8_t j = 0; j < maxEpPerInterface; j++)
57  hidInterfaces[i].epIndex[j] = 0;
58  }
59  for(uint8_t i = 0; i < totalEndpoints; i++) {
60  epInfo[i].epAddr = 0;
61  epInfo[i].maxPktSize = (i) ? 0 : 8;
62  epInfo[i].bmSndToggle = 0;
63  epInfo[i].bmRcvToggle = 0;
65  }
66  bNumEP = 1;
67  bNumIface = 0;
68  bConfNum = 0;
69  pollInterval = 0;
70 
71  ZeroMemory(constBuffLen, prevBuf);
72 }
73 
75  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
76  if(rptParsers[i].rptId == 0 && rptParsers[i].rptParser == NULL) {
77  rptParsers[i].rptId = id;
78  rptParsers[i].rptParser = prs;
79  return true;
80  }
81  }
82  return false;
83 }
84 
86  if(!bHasReportId)
87  return ((rptParsers[0].rptParser) ? rptParsers[0].rptParser : NULL);
88 
89  for(uint8_t i = 0; i < MAX_REPORT_PARSERS; i++) {
90  if(rptParsers[i].rptId == id)
91  return rptParsers[i].rptParser;
92  }
93  return NULL;
94 }
95 
96 uint8_t HIDUniversal::Init(uint8_t parent, uint8_t port, bool lowspeed) {
97  const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
98 
99  uint8_t buf[constBufSize];
100  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
101  uint8_t rcode;
102  UsbDevice *p = NULL;
103  EpInfo *oldep_ptr = NULL;
104  uint8_t len = 0;
105 
106  uint8_t num_of_conf; // number of configurations
107  //uint8_t num_of_intf; // number of interfaces
108 
109  AddressPool &addrPool = pUsb->GetAddressPool();
110 
111  USBTRACE("HU Init\r\n");
112 
113  if(bAddress)
115 
116  // Get pointer to pseudo device with address 0 assigned
117  p = addrPool.GetUsbDevicePtr(0);
118 
119  if(!p)
121 
122  if(!p->epinfo) {
123  USBTRACE("epinfo\r\n");
125  }
126 
127  // Save old pointer to EP_RECORD of address 0
128  oldep_ptr = p->epinfo;
129 
130  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
131  p->epinfo = epInfo;
132 
133  p->lowspeed = lowspeed;
134 
135  // Get device descriptor
136  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
137 
138  if(!rcode)
139  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
140 
141  if(rcode) {
142  // Restore p->epinfo
143  p->epinfo = oldep_ptr;
144 
145  goto FailGetDevDescr;
146  }
147 
148  // Restore p->epinfo
149  p->epinfo = oldep_ptr;
150 
151  // Allocate new address according to device class
152  bAddress = addrPool.AllocAddress(parent, false, port);
153 
154  if(!bAddress)
156 
157  // Extract Max Packet Size from the device descriptor
159 
160  // Assign new address to the device
161  rcode = pUsb->setAddr(0, 0, bAddress);
162 
163  if(rcode) {
164  p->lowspeed = false;
165  addrPool.FreeAddress(bAddress);
166  bAddress = 0;
167  USBTRACE2("setAddr:", rcode);
168  return rcode;
169  }
170 
171  //delay(2); //per USB 2.0 sect.9.2.6.3
172 
173  USBTRACE2("Addr:", bAddress);
174 
175  p->lowspeed = false;
176 
177  p = addrPool.GetUsbDevicePtr(bAddress);
178 
179  if(!p)
181 
182  p->lowspeed = lowspeed;
183 
184  if(len)
185  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
186 
187  if(rcode)
188  goto FailGetDevDescr;
189 
190  VID = udd->idVendor; // Can be used by classes that inherits this class to check the VID and PID of the connected device
191  PID = udd->idProduct;
192 
193  num_of_conf = udd->bNumConfigurations;
194 
195  // Assign epInfo to epinfo pointer
196  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
197 
198  if(rcode)
199  goto FailSetDevTblEntry;
200 
201  USBTRACE2("NC:", num_of_conf);
202 
203  for(uint8_t i = 0; i < num_of_conf; i++) {
204  //HexDumper<USBReadParser, uint16_t, uint16_t> HexDump;
206  CP_MASK_COMPARE_CLASS> confDescrParser(this);
207 
208  //rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
209  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
210 
211  if(rcode)
212  goto FailGetConfDescr;
213 
214  if(bNumEP > 1)
215  break;
216  } // for
217 
218  if(bNumEP < 2)
220 
221  // Assign epInfo to epinfo pointer
222  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
223 
224  USBTRACE2("Cnf:", bConfNum);
225 
226  // Set Configuration Value
227  rcode = pUsb->setConf(bAddress, 0, bConfNum);
228 
229  if(rcode)
230  goto FailSetConfDescr;
231 
232  for(uint8_t i = 0; i < bNumIface; i++) {
233  if(hidInterfaces[i].epIndex[epInterruptInIndex] == 0)
234  continue;
235 
236  rcode = SetIdle(hidInterfaces[i].bmInterface, 0, 0);
237 
238  if(rcode && rcode != hrSTALL)
239  goto FailSetIdle;
240  }
241 
242  USBTRACE("HU configured\r\n");
243 
245 
246  bPollEnable = true;
247  return 0;
248 
249 FailGetDevDescr:
250 #ifdef DEBUG_USB_HOST
252  goto Fail;
253 #endif
254 
255 FailSetDevTblEntry:
256 #ifdef DEBUG_USB_HOST
258  goto Fail;
259 #endif
260 
261 FailGetConfDescr:
262 #ifdef DEBUG_USB_HOST
264  goto Fail;
265 #endif
266 
267 FailSetConfDescr:
268 #ifdef DEBUG_USB_HOST
270  goto Fail;
271 #endif
272 
273 
274 FailSetIdle:
275 #ifdef DEBUG_USB_HOST
276  USBTRACE("SetIdle:");
277 #endif
278 
279 #ifdef DEBUG_USB_HOST
280 Fail:
281  NotifyFail(rcode);
282 #endif
283  Release();
284  return rcode;
285 }
286 
287 HIDUniversal::HIDInterface* HIDUniversal::FindInterface(uint8_t iface, uint8_t alt, uint8_t proto) {
288  for(uint8_t i = 0; i < bNumIface && i < maxHidInterfaces; i++)
289  if(hidInterfaces[i].bmInterface == iface && hidInterfaces[i].bmAltSet == alt
290  && hidInterfaces[i].bmProtocol == proto)
291  return hidInterfaces + i;
292  return NULL;
293 }
294 
295 void HIDUniversal::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
296  // If the first configuration satisfies, the others are not concidered.
297  if(bNumEP > 1 && conf != bConfNum)
298  return;
299 
300  //ErrorMessage<uint8_t>(PSTR("\r\nConf.Val"), conf);
301  //ErrorMessage<uint8_t>(PSTR("Iface Num"), iface);
302  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
303 
304  bConfNum = conf;
305 
306  uint8_t index = 0;
307  HIDInterface *piface = FindInterface(iface, alt, proto);
308 
309  // Fill in interface structure in case of new interface
310  if(!piface) {
311  piface = hidInterfaces + bNumIface;
312  piface->bmInterface = iface;
313  piface->bmAltSet = alt;
314  piface->bmProtocol = proto;
315  bNumIface++;
316  }
317 
319  index = (pep->bEndpointAddress & 0x80) == 0x80 ? epInterruptInIndex : epInterruptOutIndex;
320 
321  if(index) {
322  // Fill in the endpoint info structure
323  epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
324  epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
325  epInfo[bNumEP].bmSndToggle = 0;
326  epInfo[bNumEP].bmRcvToggle = 0;
327  epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
328 
329  // Fill in the endpoint index list
330  piface->epIndex[index] = bNumEP; //(pep->bEndpointAddress & 0x0F);
331 
332  if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
333  pollInterval = pep->bInterval;
334 
335  bNumEP++;
336  }
337  //PrintEndpointDescriptor(pep);
338 }
339 
342 
343  bNumEP = 1;
344  bAddress = 0;
345  qNextPollTime = 0;
346  bPollEnable = false;
347  return 0;
348 }
349 
350 bool HIDUniversal::BuffersIdentical(uint8_t len, uint8_t *buf1, uint8_t *buf2) {
351  for(uint8_t i = 0; i < len; i++)
352  if(buf1[i] != buf2[i])
353  return false;
354  return true;
355 }
356 
357 void HIDUniversal::ZeroMemory(uint8_t len, uint8_t *buf) {
358  for(uint8_t i = 0; i < len; i++)
359  buf[i] = 0;
360 }
361 
362 void HIDUniversal::SaveBuffer(uint8_t len, uint8_t *src, uint8_t *dest) {
363  for(uint8_t i = 0; i < len; i++)
364  dest[i] = src[i];
365 }
366 
368  uint8_t rcode = 0;
369 
370  if(!bPollEnable)
371  return 0;
372 
373  if((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L) {
374  qNextPollTime = (uint32_t)millis() + pollInterval;
375 
376  uint8_t buf[constBuffLen];
377 
378  for(uint8_t i = 0; i < bNumIface; i++) {
379  uint8_t index = hidInterfaces[i].epIndex[epInterruptInIndex];
380  uint16_t read = (uint16_t)epInfo[index].maxPktSize;
381 
382  ZeroMemory(constBuffLen, buf);
383 
384  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[index].epAddr, &read, buf);
385 
386  if(rcode) {
387  if(rcode != hrNAK)
388  USBTRACE3("(hiduniversal.h) Poll:", rcode, 0x81);
389  return rcode;
390  }
391 
392  if(read > constBuffLen)
393  read = constBuffLen;
394 
395  bool identical = BuffersIdentical(read, buf, prevBuf);
396 
397  SaveBuffer(read, buf, prevBuf);
398 
399  if(identical)
400  return 0;
401 #if 0
402  Notify(PSTR("\r\nBuf: "), 0x80);
403 
404  for(uint8_t i = 0; i < read; i++) {
405  D_PrintHex<uint8_t > (buf[i], 0x80);
406  Notify(PSTR(" "), 0x80);
407  }
408 
409  Notify(PSTR("\r\n"), 0x80);
410 #endif
411  ParseHIDData(this, bHasReportId, (uint8_t)read, buf);
412 
413  HIDReportParser *prs = GetReportParser(((bHasReportId) ? *buf : 0));
414 
415  if(prs)
416  prs->Parse(this, bHasReportId, (uint8_t)read, buf);
417  }
418  }
419  return rcode;
420 }
421 
422 // Send a report to interrupt out endpoint. This is NOT SetReport() request!
423 uint8_t HIDUniversal::SndRpt(uint16_t nbytes, uint8_t *dataptr) {
424  return pUsb->outTransfer(bAddress, epInfo[epInterruptOutIndex].epAddr, nbytes, dataptr);
425 }
uint16_t PID
Definition: hiduniversal.h:69
+
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:784
+
uint8_t bmRcvToggle
Definition: address.h:48
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
- +
bool bHasReportId
Definition: hiduniversal.h:67
Definition: usbhid.h:143
USB * pUsb
Definition: usbhid.h:145
-
EpInfo * epinfo
Definition: address.h:76
-
bool lowspeed
Definition: address.h:79
-
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:83
-
#define hrSTALL
Definition: max3421e.h:212
-
uint8_t bmNakPower
Definition: address.h:42
+
EpInfo * epinfo
Definition: address.h:83
+
bool lowspeed
Definition: address.h:86
+
#define USB_ERROR_EPINFO_IS_NULL
Definition: UsbCore.h:94
+
#define hrSTALL
Definition: max3421e.h:219
+
uint8_t bmNakPower
Definition: address.h:49
#define HID_MAX_HID_CLASS_DESCRIPTORS
Definition: usbhid.h:24
- - + +
#define MAX_REPORT_PARSERS
Definition: usbhid.h:23
- - -
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:105
-
#define NotifyFail(...)
Definition: message.h:55
+ + +
uint8_t bMaxPacketSize0
Definition: usb_ch9.h:112
+
#define NotifyFail(...)
Definition: message.h:62
virtual void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hiduniversal.h:78
-
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:810
- -
#define NotifyFailGetDevDescr(...)
Definition: message.h:50
+
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
Definition: Usb.cpp:823
+ +
#define USB_TRANSFER_TYPE_INTERRUPT
Definition: usb_ch9.h:93
+
#define NotifyFailGetDevDescr(...)
Definition: message.h:57
HIDInterface hidInterfaces[maxHidInterfaces]
Definition: hiduniversal.h:65
-
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:64
-
uint8_t Release()
-
#define CP_MASK_COMPARE_CLASS
+
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
Definition: Usb.cpp:71
+
uint8_t Release()
+
#define CP_MASK_COMPARE_CLASS
uint16_t VID
Definition: hiduniversal.h:69
virtual uint8_t OnInitSuccessful()
Definition: hiduniversal.h:74
-
#define USB_CLASS_HID
Definition: UsbCore.h:59
+
#define USB_CLASS_HID
Definition: UsbCore.h:70
virtual void FreeAddress(uint8_t addr)=0
-
uint8_t Poll()
- +
uint8_t Poll()
+
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
uint8_t SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)
Definition: usbhid.cpp:62
-
#define Notify(...)
Definition: message.h:44
- - -
#define USBTRACE2(s, r)
Definition: macros.h:77
-
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:801
-
#define NotifyFailGetConfDescr(...)
Definition: message.h:52
-
uint8_t epAddr
Definition: address.h:33
-
#define USB_NAK_MAX_POWER
Definition: address.h:27
+
#define Notify(...)
Definition: message.h:51
+ + +
#define USBTRACE2(s, r)
Definition: macros.h:84
+
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:814
+
#define NotifyFailGetConfDescr(...)
Definition: message.h:59
+
uint8_t epAddr
Definition: address.h:40
+
#define USB_NAK_MAX_POWER
Definition: address.h:34
HIDReportParser * GetReportParser(uint8_t id)
-
Definition: address.h:32
-
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:293
+
Definition: address.h:39
+
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
Definition: Usb.cpp:300
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
-
#define hrNAK
Definition: max3421e.h:211
+
#define hrNAK
Definition: max3421e.h:218
static const uint8_t epInterruptOutIndex
Definition: usbhid.h:150
HIDUniversal(USB *p)
uint8_t bAddress
Definition: usbhid.h:146
-
uint16_t wMaxPacketSize
Definition: usb_ch9.h:146
+
uint16_t wMaxPacketSize
Definition: usb_ch9.h:153
+
#define bmUSB_TRANSFER_TYPE
Definition: usb_ch9.h:94
static const uint8_t maxEpPerInterface
Definition: usbhid.h:153
- +
static const uint8_t epInterruptInIndex
Definition: usbhid.h:149
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
-
uint8_t bEndpointAddress
Definition: usb_ch9.h:144
+
uint8_t bEndpointAddress
Definition: usb_ch9.h:151
static const uint8_t maxHidInterfaces
Definition: usbhid.h:152
-
uint8_t bmSndToggle
Definition: address.h:40
-
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:85
-
#define PSTR(str)
+
uint8_t bmSndToggle
Definition: address.h:47
+
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
Definition: UsbCore.h:96
+
#define PSTR(str)
-
#define USB_NAK_NOWAIT
Definition: address.h:29
-
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:82
-
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:77
+
#define USB_NAK_NOWAIT
Definition: address.h:36
+
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
Definition: UsbCore.h:93
+
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
Definition: UsbCore.h:88
static const uint8_t totalEndpoints
Definition: usbhid.h:154
-
uint16_t idProduct
Definition: usb_ch9.h:107
-
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:206
-
uint8_t bNumConfigurations
Definition: usb_ch9.h:112
-
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:80
-
uint8_t maxPktSize
Definition: address.h:34
-
AddressPool & GetAddressPool()
Definition: UsbCore.h:213
+
uint16_t idProduct
Definition: usb_ch9.h:114
+
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
+
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:213
+
uint8_t bNumConfigurations
Definition: usb_ch9.h:119
+
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
Definition: UsbCore.h:91
+
uint8_t maxPktSize
Definition: address.h:41
+
AddressPool & GetAddressPool()
Definition: UsbCore.h:224
-
Definition: UsbCore.h:197
-
#define USBTRACE3(s, r, l)
Definition: macros.h:78
-
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:217
-
#define NotifyFailSetConfDescr(...)
Definition: message.h:53
+
Definition: UsbCore.h:208
+
#define USBTRACE3(s, r, l)
Definition: macros.h:85
+
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
Definition: UsbCore.h:228
+
#define NotifyFailSetConfDescr(...)
Definition: message.h:60
virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)=0
EpInfo epInfo[totalEndpoints]
Definition: hiduniversal.h:64
bool SetReportParser(uint8_t id, HIDReportParser *prs)
-
#define USBTRACE(s)
Definition: macros.h:75
-
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:766
-
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:51
- +
#define USBTRACE(s)
Definition: macros.h:82
+
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:779
+
#define NotifyFailSetDevTblEntry(...)
Definition: message.h:58
+
diff --git a/hiduniversal_8h.html b/hiduniversal_8h.html index 81430d09..0c9a3b04 100644 --- a/hiduniversal_8h.html +++ b/hiduniversal_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hiduniversal.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
diff --git a/hiduniversal_8h__dep__incl.md5 b/hiduniversal_8h__dep__incl.md5 index 8b07bcbb..9c8e9ff2 100644 --- a/hiduniversal_8h__dep__incl.md5 +++ b/hiduniversal_8h__dep__incl.md5 @@ -1 +1 @@ -6079ba5023de3a9bc19938f024e95433 \ No newline at end of file +1a6e99a32a72ade5845249f3b21766ae \ No newline at end of file diff --git a/hiduniversal_8h__dep__incl.png b/hiduniversal_8h__dep__incl.png index 31efff41..93e33afd 100644 Binary files a/hiduniversal_8h__dep__incl.png and b/hiduniversal_8h__dep__incl.png differ diff --git a/hiduniversal_8h__incl.md5 b/hiduniversal_8h__incl.md5 index 649b21d3..1ef6962c 100644 --- a/hiduniversal_8h__incl.md5 +++ b/hiduniversal_8h__incl.md5 @@ -1 +1 @@ -f268788864ba2a6e059e34b990a9ae71 \ No newline at end of file +d068f50cb7c808f3f0e52a5289e1b776 \ No newline at end of file diff --git a/hiduniversal_8h__incl.png b/hiduniversal_8h__incl.png index eca6f80c..09df9459 100644 Binary files a/hiduniversal_8h__incl.png and b/hiduniversal_8h__incl.png differ diff --git a/hiduniversal_8h_source.html b/hiduniversal_8h_source.html index 5af9897b..8b05c856 100644 --- a/hiduniversal_8h_source.html +++ b/hiduniversal_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hiduniversal.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
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 "usbhid.h"
22 //#include "hidescriptorparser.h"
23 
24 class HIDUniversal : public USBHID {
25 
26  struct ReportParser {
27  uint8_t rptId;
28  HIDReportParser *rptParser;
29  } rptParsers[MAX_REPORT_PARSERS];
30 
31  // HID class specific descriptor type and length info obtained from HID descriptor
33 
34  // Returns HID class specific descriptor length by its type and order number
35  uint16_t GetHidClassDescrLen(uint8_t type, uint8_t num);
36 
37  struct HIDInterface {
38  struct {
39  uint8_t bmInterface : 3;
40  uint8_t bmAltSet : 3;
41  uint8_t bmProtocol : 2;
42  };
43  uint8_t epIndex[maxEpPerInterface];
44  };
45 
46  uint8_t bConfNum; // configuration number
47  uint8_t bNumIface; // number of interfaces in the configuration
48  uint8_t bNumEP; // total number of EP in the configuration
49  uint32_t qNextPollTime; // next poll time
50  uint8_t pollInterval;
51  bool bPollEnable; // poll enable flag
52 
53  static const uint16_t constBuffLen = 64; // event buffer length
54  uint8_t prevBuf[constBuffLen]; // previous event buffer
55 
56  void Initialize();
57  HIDInterface* FindInterface(uint8_t iface, uint8_t alt, uint8_t proto);
58 
59  void ZeroMemory(uint8_t len, uint8_t *buf);
60  bool BuffersIdentical(uint8_t len, uint8_t *buf1, uint8_t *buf2);
61  void SaveBuffer(uint8_t len, uint8_t *src, uint8_t *dest);
62 
63 protected:
66 
68 
69  uint16_t PID, VID; // PID and VID of connected device
70 
71  // HID implementation
72  HIDReportParser* GetReportParser(uint8_t id);
73 
74  virtual uint8_t OnInitSuccessful() {
75  return 0;
76  };
77 
78  virtual void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
79  return;
80  };
81 
82 public:
83  HIDUniversal(USB *p);
84 
85  // HID implementation
86  bool SetReportParser(uint8_t id, HIDReportParser *prs);
87 
88  // USBDeviceConfig implementation
89  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
90  uint8_t Release();
91  uint8_t Poll();
92 
93  virtual uint8_t GetAddress() {
94  return bAddress;
95  };
96 
97  virtual bool isReady() {
98  return bPollEnable;
99  };
100 
101  // UsbConfigXtracter implementation
102  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
103 
104  // Send report - do not mix with SetReport()!
105  uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr);
106 };
107 
108 #endif // __HIDUNIVERSAL_H__
uint16_t PID
Definition: hiduniversal.h:69
+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 "usbhid.h"
22 //#include "hidescriptorparser.h"
23 
24 class HIDUniversal : public USBHID {
25 
26  struct ReportParser {
27  uint8_t rptId;
28  HIDReportParser *rptParser;
29  } rptParsers[MAX_REPORT_PARSERS];
30 
31  // HID class specific descriptor type and length info obtained from HID descriptor
33 
34  // Returns HID class specific descriptor length by its type and order number
35  uint16_t GetHidClassDescrLen(uint8_t type, uint8_t num);
36 
37  struct HIDInterface {
38  struct {
39  uint8_t bmInterface : 3;
40  uint8_t bmAltSet : 3;
41  uint8_t bmProtocol : 2;
42  };
43  uint8_t epIndex[maxEpPerInterface];
44  };
45 
46  uint8_t bConfNum; // configuration number
47  uint8_t bNumIface; // number of interfaces in the configuration
48  uint8_t bNumEP; // total number of EP in the configuration
49  uint32_t qNextPollTime; // next poll time
50  uint8_t pollInterval;
51  bool bPollEnable; // poll enable flag
52 
53  static const uint16_t constBuffLen = 64; // event buffer length
54  uint8_t prevBuf[constBuffLen]; // previous event buffer
55 
56  void Initialize();
57  HIDInterface* FindInterface(uint8_t iface, uint8_t alt, uint8_t proto);
58 
59  void ZeroMemory(uint8_t len, uint8_t *buf);
60  bool BuffersIdentical(uint8_t len, uint8_t *buf1, uint8_t *buf2);
61  void SaveBuffer(uint8_t len, uint8_t *src, uint8_t *dest);
62 
63 protected:
66 
68 
69  uint16_t PID, VID; // PID and VID of connected device
70 
71  // HID implementation
72  HIDReportParser* GetReportParser(uint8_t id);
73 
74  virtual uint8_t OnInitSuccessful() {
75  return 0;
76  };
77 
78  virtual void ParseHIDData(USBHID *hid __attribute__((unused)), bool is_rpt_id __attribute__((unused)), uint8_t len __attribute__((unused)), uint8_t *buf __attribute__((unused))) {
79  return;
80  };
81 
82 public:
83  HIDUniversal(USB *p);
84 
85  // HID implementation
86  bool SetReportParser(uint8_t id, HIDReportParser *prs);
87 
88  // USBDeviceConfig implementation
89  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
90  uint8_t Release();
91  uint8_t Poll();
92 
93  virtual uint8_t GetAddress() {
94  return bAddress;
95  };
96 
97  virtual bool isReady() {
98  return bPollEnable;
99  };
100 
101  // UsbConfigXtracter implementation
102  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
103 
104  // Send report - do not mix with SetReport()!
105  uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr);
106 };
107 
108 #endif // __HIDUNIVERSAL_H__
uint16_t PID
Definition: hiduniversal.h:69
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
bool bHasReportId
Definition: hiduniversal.h:67
Definition: usbhid.h:143
virtual bool isReady()
Definition: hiduniversal.h:97
#define HID_MAX_HID_CLASS_DESCRIPTORS
Definition: usbhid.h:24
#define MAX_REPORT_PARSERS
Definition: usbhid.h:23
- +
virtual void ParseHIDData(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
Definition: hiduniversal.h:78
- +
HIDInterface hidInterfaces[maxHidInterfaces]
Definition: hiduniversal.h:65
-
uint8_t Release()
+
uint8_t Release()
uint16_t VID
Definition: hiduniversal.h:69
virtual uint8_t OnInitSuccessful()
Definition: hiduniversal.h:74
-
uint8_t Poll()
+
uint8_t Poll()
HIDReportParser * GetReportParser(uint8_t id)
-
Definition: address.h:32
+
Definition: address.h:39
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
HIDUniversal(USB *p)
uint8_t bAddress
Definition: usbhid.h:146
@@ -114,9 +94,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
static const uint8_t maxHidInterfaces
Definition: usbhid.h:152
static const uint8_t totalEndpoints
Definition: usbhid.h:154
-
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
+
uint8_t SndRpt(uint16_t nbytes, uint8_t *dataptr)
-
Definition: UsbCore.h:197
+
Definition: UsbCore.h:208
virtual uint8_t GetAddress()
Definition: hiduniversal.h:93
EpInfo epInfo[totalEndpoints]
Definition: hiduniversal.h:64
bool SetReportParser(uint8_t id, HIDReportParser *prs)
@@ -126,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidusagestr_8h.html b/hidusagestr_8h.html index 2acdc6c5..f553e1f5 100644 --- a/hidusagestr_8h.html +++ b/hidusagestr_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidusagestr.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + +
- - + + - - - - - - - + + + + + + + - + @@ -1864,7 +1844,9 @@ Variables  

Variable Documentation

- + +

◆ pstrSpace

+
@@ -1874,11 +1856,13 @@ Variables
-

Definition at line 22 of file hidusagestr.h.

+

Definition at line 22 of file hidusagestr.h.

- + +

◆ pstrCRLF

+
@@ -1888,11 +1872,13 @@ Variables
-

Definition at line 23 of file hidusagestr.h.

+

Definition at line 23 of file hidusagestr.h.

- + +

◆ pstrSingleTab

+
@@ -1902,11 +1888,13 @@ Variables
-

Definition at line 24 of file hidusagestr.h.

+

Definition at line 24 of file hidusagestr.h.

- + +

◆ pstrDoubleTab

+
@@ -1916,11 +1904,13 @@ Variables
-

Definition at line 25 of file hidusagestr.h.

+

Definition at line 25 of file hidusagestr.h.

- + +

◆ pstrTripleTab

+
@@ -1930,11 +1920,13 @@ Variables
-

Definition at line 26 of file hidusagestr.h.

+

Definition at line 26 of file hidusagestr.h.

- + +

◆ pstrUsagePageUndefined

+
@@ -1944,11 +1936,13 @@ Variables
-

Definition at line 29 of file hidusagestr.h.

+

Definition at line 29 of file hidusagestr.h.

- + +

◆ pstrUsagePageGenericDesktopControls

+
@@ -1958,11 +1952,13 @@ Variables
-

Definition at line 30 of file hidusagestr.h.

+

Definition at line 30 of file hidusagestr.h.

- + +

◆ pstrUsagePageSimulationControls

+
@@ -1972,11 +1968,13 @@ Variables
-

Definition at line 31 of file hidusagestr.h.

+

Definition at line 31 of file hidusagestr.h.

- + +

◆ pstrUsagePageVRControls

+
@@ -1986,11 +1984,13 @@ Variables
-

Definition at line 32 of file hidusagestr.h.

+

Definition at line 32 of file hidusagestr.h.

- + +

◆ pstrUsagePageSportControls

+
@@ -2000,11 +2000,13 @@ Variables
-

Definition at line 33 of file hidusagestr.h.

+

Definition at line 33 of file hidusagestr.h.

- + +

◆ pstrUsagePageGameControls

+
@@ -2014,11 +2016,13 @@ Variables
-

Definition at line 34 of file hidusagestr.h.

+

Definition at line 34 of file hidusagestr.h.

- + +

◆ pstrUsagePageGenericDeviceControls

+
@@ -2028,11 +2032,13 @@ Variables
-

Definition at line 35 of file hidusagestr.h.

+

Definition at line 35 of file hidusagestr.h.

- + +

◆ pstrUsagePageKeyboardKeypad

+
@@ -2042,11 +2048,13 @@ Variables
-

Definition at line 36 of file hidusagestr.h.

+

Definition at line 36 of file hidusagestr.h.

- + +

◆ pstrUsagePageLEDs

+
@@ -2056,11 +2064,13 @@ Variables
-

Definition at line 37 of file hidusagestr.h.

+

Definition at line 37 of file hidusagestr.h.

- + +

◆ pstrUsagePageButton

+
@@ -2070,11 +2080,13 @@ Variables
-

Definition at line 38 of file hidusagestr.h.

+

Definition at line 38 of file hidusagestr.h.

- + +

◆ pstrUsagePageOrdinal

+
@@ -2084,11 +2096,13 @@ Variables
-

Definition at line 39 of file hidusagestr.h.

+

Definition at line 39 of file hidusagestr.h.

- + +

◆ pstrUsagePageTelephone

+
@@ -2098,11 +2112,13 @@ Variables
-

Definition at line 40 of file hidusagestr.h.

+

Definition at line 40 of file hidusagestr.h.

- + +

◆ pstrUsagePageConsumer

+
@@ -2112,11 +2128,13 @@ Variables
-

Definition at line 41 of file hidusagestr.h.

+

Definition at line 41 of file hidusagestr.h.

- + +

◆ pstrUsagePageDigitizer

+
@@ -2126,11 +2144,13 @@ Variables
-

Definition at line 42 of file hidusagestr.h.

+

Definition at line 42 of file hidusagestr.h.

- + +

◆ pstrUsagePagePID

+
@@ -2140,11 +2160,13 @@ Variables
-

Definition at line 43 of file hidusagestr.h.

+

Definition at line 43 of file hidusagestr.h.

- + +

◆ pstrUsagePageUnicode

+
@@ -2154,11 +2176,13 @@ Variables
-

Definition at line 44 of file hidusagestr.h.

+

Definition at line 44 of file hidusagestr.h.

- + +

◆ pstrUsagePageAlphaNumericDisplay

+
@@ -2168,11 +2192,13 @@ Variables
-

Definition at line 45 of file hidusagestr.h.

+

Definition at line 45 of file hidusagestr.h.

- + +

◆ pstrUsagePageMedicalInstruments

+
@@ -2182,11 +2208,13 @@ Variables
-

Definition at line 46 of file hidusagestr.h.

+

Definition at line 46 of file hidusagestr.h.

- + +

◆ pstrUsagePageMonitor

+
@@ -2196,11 +2224,13 @@ Variables
-

Definition at line 47 of file hidusagestr.h.

+

Definition at line 47 of file hidusagestr.h.

- + +

◆ pstrUsagePagePower

+
@@ -2210,11 +2240,13 @@ Variables
-

Definition at line 48 of file hidusagestr.h.

+

Definition at line 48 of file hidusagestr.h.

- + +

◆ pstrUsagePageBarCodeScanner

+
@@ -2224,11 +2256,13 @@ Variables
-

Definition at line 49 of file hidusagestr.h.

+

Definition at line 49 of file hidusagestr.h.

- + +

◆ pstrUsagePageScale

+
@@ -2238,11 +2272,13 @@ Variables
-

Definition at line 50 of file hidusagestr.h.

+

Definition at line 50 of file hidusagestr.h.

- + +

◆ pstrUsagePageMSRDevices

+
@@ -2252,11 +2288,13 @@ Variables
-

Definition at line 51 of file hidusagestr.h.

+

Definition at line 51 of file hidusagestr.h.

- + +

◆ pstrUsagePagePointOfSale

+
@@ -2266,11 +2304,13 @@ Variables
-

Definition at line 52 of file hidusagestr.h.

+

Definition at line 52 of file hidusagestr.h.

- + +

◆ pstrUsagePageCameraControl

+
@@ -2280,11 +2320,13 @@ Variables
-

Definition at line 53 of file hidusagestr.h.

+

Definition at line 53 of file hidusagestr.h.

- + +

◆ pstrUsagePageArcade

+
@@ -2294,11 +2336,13 @@ Variables
-

Definition at line 54 of file hidusagestr.h.

+

Definition at line 54 of file hidusagestr.h.

- + +

◆ pstrUsagePageReserved

+
@@ -2308,11 +2352,13 @@ Variables
-

Definition at line 55 of file hidusagestr.h.

+

Definition at line 55 of file hidusagestr.h.

- + +

◆ pstrUsagePageVendorDefined

+
@@ -2322,11 +2368,13 @@ Variables
-

Definition at line 56 of file hidusagestr.h.

+

Definition at line 56 of file hidusagestr.h.

- + +

◆ pstrUsagePointer

+
@@ -2336,11 +2384,13 @@ Variables
-

Definition at line 59 of file hidusagestr.h.

+

Definition at line 59 of file hidusagestr.h.

- + +

◆ pstrUsageMouse

+
@@ -2350,11 +2400,13 @@ Variables
-

Definition at line 60 of file hidusagestr.h.

+

Definition at line 60 of file hidusagestr.h.

- + +

◆ pstrUsageJoystick

+
@@ -2364,11 +2416,13 @@ Variables
-

Definition at line 61 of file hidusagestr.h.

+

Definition at line 61 of file hidusagestr.h.

- + +

◆ pstrUsageGamePad

+
@@ -2378,11 +2432,13 @@ Variables
-

Definition at line 62 of file hidusagestr.h.

+

Definition at line 62 of file hidusagestr.h.

- + +

◆ pstrUsageKeyboard

+
@@ -2392,11 +2448,13 @@ Variables
-

Definition at line 63 of file hidusagestr.h.

+

Definition at line 63 of file hidusagestr.h.

- + +

◆ pstrUsageKeypad

+
@@ -2406,11 +2464,13 @@ Variables
-

Definition at line 64 of file hidusagestr.h.

+

Definition at line 64 of file hidusagestr.h.

- + +

◆ pstrUsageMultiAxisController

+
@@ -2420,11 +2480,13 @@ Variables
-

Definition at line 65 of file hidusagestr.h.

+

Definition at line 65 of file hidusagestr.h.

- + +

◆ pstrUsageTabletPCSystemControls

+
@@ -2434,11 +2496,13 @@ Variables
-

Definition at line 66 of file hidusagestr.h.

+

Definition at line 66 of file hidusagestr.h.

- + +

◆ pstrUsageX

+
@@ -2448,11 +2512,13 @@ Variables
-

Definition at line 67 of file hidusagestr.h.

+

Definition at line 67 of file hidusagestr.h.

- + +

◆ pstrUsageY

+
@@ -2462,11 +2528,13 @@ Variables
-

Definition at line 68 of file hidusagestr.h.

+

Definition at line 68 of file hidusagestr.h.

- + +

◆ pstrUsageZ

+
@@ -2476,11 +2544,13 @@ Variables
-

Definition at line 69 of file hidusagestr.h.

+

Definition at line 69 of file hidusagestr.h.

- + +

◆ pstrUsageRx

+
@@ -2490,11 +2560,13 @@ Variables
-

Definition at line 70 of file hidusagestr.h.

+

Definition at line 70 of file hidusagestr.h.

- + +

◆ pstrUsageRy

+
@@ -2504,11 +2576,13 @@ Variables
-

Definition at line 71 of file hidusagestr.h.

+

Definition at line 71 of file hidusagestr.h.

- + +

◆ pstrUsageRz

+
@@ -2518,11 +2592,13 @@ Variables
-

Definition at line 72 of file hidusagestr.h.

+

Definition at line 72 of file hidusagestr.h.

- + +

◆ pstrUsageSlider

+
@@ -2532,11 +2608,13 @@ Variables
-

Definition at line 73 of file hidusagestr.h.

+

Definition at line 73 of file hidusagestr.h.

- + +

◆ pstrUsageDial

+
@@ -2546,11 +2624,13 @@ Variables
-

Definition at line 74 of file hidusagestr.h.

+

Definition at line 74 of file hidusagestr.h.

- + +

◆ pstrUsageWheel

+
@@ -2560,11 +2640,13 @@ Variables
-

Definition at line 75 of file hidusagestr.h.

+

Definition at line 75 of file hidusagestr.h.

- + +

◆ pstrUsageHatSwitch

+
@@ -2574,11 +2656,13 @@ Variables
-

Definition at line 76 of file hidusagestr.h.

+

Definition at line 76 of file hidusagestr.h.

- + +

◆ pstrUsageCountedBuffer

+
@@ -2588,11 +2672,13 @@ Variables
-

Definition at line 77 of file hidusagestr.h.

+

Definition at line 77 of file hidusagestr.h.

- + +

◆ pstrUsageByteCount

+
@@ -2602,11 +2688,13 @@ Variables
-

Definition at line 78 of file hidusagestr.h.

+

Definition at line 78 of file hidusagestr.h.

- + +

◆ pstrUsageMotionWakeup

+
@@ -2616,11 +2704,13 @@ Variables
-

Definition at line 79 of file hidusagestr.h.

+

Definition at line 79 of file hidusagestr.h.

- + +

◆ pstrUsageStart

+
@@ -2630,11 +2720,13 @@ Variables
-

Definition at line 80 of file hidusagestr.h.

+

Definition at line 80 of file hidusagestr.h.

- + +

◆ pstrUsageSelect

+
@@ -2644,11 +2736,13 @@ Variables
-

Definition at line 81 of file hidusagestr.h.

+

Definition at line 81 of file hidusagestr.h.

- + +

◆ pstrUsageVx

+
@@ -2658,11 +2752,13 @@ Variables
-

Definition at line 82 of file hidusagestr.h.

+

Definition at line 82 of file hidusagestr.h.

- + +

◆ pstrUsageVy

+
@@ -2672,11 +2768,13 @@ Variables
-

Definition at line 83 of file hidusagestr.h.

+

Definition at line 83 of file hidusagestr.h.

- + +

◆ pstrUsageVz

+
@@ -2686,11 +2784,13 @@ Variables
-

Definition at line 84 of file hidusagestr.h.

+

Definition at line 84 of file hidusagestr.h.

- + +

◆ pstrUsageVbrx

+
@@ -2700,11 +2800,13 @@ Variables
-

Definition at line 85 of file hidusagestr.h.

+

Definition at line 85 of file hidusagestr.h.

- + +

◆ pstrUsageVbry

+
@@ -2714,11 +2816,13 @@ Variables
-

Definition at line 86 of file hidusagestr.h.

+

Definition at line 86 of file hidusagestr.h.

- + +

◆ pstrUsageVbrz

+
@@ -2728,11 +2832,13 @@ Variables
-

Definition at line 87 of file hidusagestr.h.

+

Definition at line 87 of file hidusagestr.h.

- + +

◆ pstrUsageVno

+
@@ -2742,11 +2848,13 @@ Variables
-

Definition at line 88 of file hidusagestr.h.

+

Definition at line 88 of file hidusagestr.h.

- + +

◆ pstrUsageFeatureNotification

+
@@ -2756,11 +2864,13 @@ Variables
-

Definition at line 89 of file hidusagestr.h.

+

Definition at line 89 of file hidusagestr.h.

- + +

◆ pstrUsageResolutionMultiplier

+
@@ -2770,11 +2880,13 @@ Variables
-

Definition at line 90 of file hidusagestr.h.

+

Definition at line 90 of file hidusagestr.h.

- + +

◆ pstrUsageSystemControl

+
@@ -2784,11 +2896,13 @@ Variables
-

Definition at line 91 of file hidusagestr.h.

+

Definition at line 91 of file hidusagestr.h.

- + +

◆ pstrUsageSystemPowerDown

+
@@ -2798,11 +2912,13 @@ Variables
-

Definition at line 92 of file hidusagestr.h.

+

Definition at line 92 of file hidusagestr.h.

- + +

◆ pstrUsageSystemSleep

+
@@ -2812,11 +2928,13 @@ Variables
-

Definition at line 93 of file hidusagestr.h.

+

Definition at line 93 of file hidusagestr.h.

- + +

◆ pstrUsageSystemWakeup

+
@@ -2826,11 +2944,13 @@ Variables
-

Definition at line 94 of file hidusagestr.h.

+

Definition at line 94 of file hidusagestr.h.

- + +

◆ pstrUsageSystemContextMenu

+
@@ -2840,11 +2960,13 @@ Variables
-

Definition at line 95 of file hidusagestr.h.

+

Definition at line 95 of file hidusagestr.h.

- + +

◆ pstrUsageSystemMainMenu

+
@@ -2854,11 +2976,13 @@ Variables
-

Definition at line 96 of file hidusagestr.h.

+

Definition at line 96 of file hidusagestr.h.

- + +

◆ pstrUsageSystemAppMenu

+
@@ -2868,11 +2992,13 @@ Variables
-

Definition at line 97 of file hidusagestr.h.

+

Definition at line 97 of file hidusagestr.h.

- + +

◆ pstrUsageSystemMenuHelp

+
@@ -2882,11 +3008,13 @@ Variables
-

Definition at line 98 of file hidusagestr.h.

+

Definition at line 98 of file hidusagestr.h.

- + +

◆ pstrUsageSystemMenuExit

+
@@ -2896,11 +3024,13 @@ Variables
-

Definition at line 99 of file hidusagestr.h.

+

Definition at line 99 of file hidusagestr.h.

- + +

◆ pstrUsageSystemMenuSelect

+
@@ -2910,11 +3040,13 @@ Variables
-

Definition at line 100 of file hidusagestr.h.

+

Definition at line 100 of file hidusagestr.h.

- + +

◆ pstrUsageSystemMenuRight

+
@@ -2924,11 +3056,13 @@ Variables
-

Definition at line 101 of file hidusagestr.h.

+

Definition at line 101 of file hidusagestr.h.

- + +

◆ pstrUsageSystemMenuLeft

+
@@ -2938,11 +3072,13 @@ Variables
-

Definition at line 102 of file hidusagestr.h.

+

Definition at line 102 of file hidusagestr.h.

- + +

◆ pstrUsageSystemMenuUp

+
@@ -2952,11 +3088,13 @@ Variables
-

Definition at line 103 of file hidusagestr.h.

+

Definition at line 103 of file hidusagestr.h.

- + +

◆ pstrUsageSystemMenuDown

+
@@ -2966,11 +3104,13 @@ Variables
-

Definition at line 104 of file hidusagestr.h.

+

Definition at line 104 of file hidusagestr.h.

- + +

◆ pstrUsageSystemColdRestart

+
@@ -2980,11 +3120,13 @@ Variables
-

Definition at line 105 of file hidusagestr.h.

+

Definition at line 105 of file hidusagestr.h.

- + +

◆ pstrUsageSystemWarmRestart

+
@@ -2994,11 +3136,13 @@ Variables
-

Definition at line 106 of file hidusagestr.h.

+

Definition at line 106 of file hidusagestr.h.

- + +

◆ pstrUsageDPadUp

+
@@ -3008,11 +3152,13 @@ Variables
-

Definition at line 107 of file hidusagestr.h.

+

Definition at line 107 of file hidusagestr.h.

- + +

◆ pstrUsageDPadDown

+
@@ -3022,11 +3168,13 @@ Variables
-

Definition at line 108 of file hidusagestr.h.

+

Definition at line 108 of file hidusagestr.h.

- + +

◆ pstrUsageDPadRight

+
@@ -3036,11 +3184,13 @@ Variables
-

Definition at line 109 of file hidusagestr.h.

+

Definition at line 109 of file hidusagestr.h.

- + +

◆ pstrUsageDPadLeft

+
@@ -3050,11 +3200,13 @@ Variables
-

Definition at line 110 of file hidusagestr.h.

+

Definition at line 110 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDock

+
@@ -3064,11 +3216,13 @@ Variables
-

Definition at line 111 of file hidusagestr.h.

+

Definition at line 111 of file hidusagestr.h.

- + +

◆ pstrUsageSystemUndock

+
@@ -3078,11 +3232,13 @@ Variables
-

Definition at line 112 of file hidusagestr.h.

+

Definition at line 112 of file hidusagestr.h.

- + +

◆ pstrUsageSystemSetup

+
@@ -3092,11 +3248,13 @@ Variables
-

Definition at line 113 of file hidusagestr.h.

+

Definition at line 113 of file hidusagestr.h.

- + +

◆ pstrUsageSystemBreak

+
@@ -3106,11 +3264,13 @@ Variables
-

Definition at line 114 of file hidusagestr.h.

+

Definition at line 114 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDebuggerBreak

+
@@ -3120,11 +3280,13 @@ Variables
-

Definition at line 115 of file hidusagestr.h.

+

Definition at line 115 of file hidusagestr.h.

- + +

◆ pstrUsageApplicationBreak

+
@@ -3134,11 +3296,13 @@ Variables
-

Definition at line 116 of file hidusagestr.h.

+

Definition at line 116 of file hidusagestr.h.

- + +

◆ pstrUsageApplicationDebuggerBreak

+
@@ -3148,11 +3312,13 @@ Variables
-

Definition at line 117 of file hidusagestr.h.

+

Definition at line 117 of file hidusagestr.h.

- + +

◆ pstrUsageSystemSpeakerMute

+
@@ -3162,11 +3328,13 @@ Variables
-

Definition at line 118 of file hidusagestr.h.

+

Definition at line 118 of file hidusagestr.h.

- + +

◆ pstrUsageSystemHibernate

+
@@ -3176,11 +3344,13 @@ Variables
-

Definition at line 119 of file hidusagestr.h.

+

Definition at line 119 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDisplayInvert

+
@@ -3190,11 +3360,13 @@ Variables
-

Definition at line 120 of file hidusagestr.h.

+

Definition at line 120 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDisplayInternal

+
@@ -3204,11 +3376,13 @@ Variables
-

Definition at line 121 of file hidusagestr.h.

+

Definition at line 121 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDisplayExternal

+
@@ -3218,11 +3392,13 @@ Variables
-

Definition at line 122 of file hidusagestr.h.

+

Definition at line 122 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDisplayBoth

+
@@ -3232,11 +3408,13 @@ Variables
-

Definition at line 123 of file hidusagestr.h.

+

Definition at line 123 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDisplayDual

+
@@ -3246,11 +3424,13 @@ Variables
-

Definition at line 124 of file hidusagestr.h.

+

Definition at line 124 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDisplayToggleIntExt

+
@@ -3260,11 +3440,13 @@ Variables
-

Definition at line 125 of file hidusagestr.h.

+

Definition at line 125 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDisplaySwapPriSec

+
@@ -3274,11 +3456,13 @@ Variables
-

Definition at line 126 of file hidusagestr.h.

+

Definition at line 126 of file hidusagestr.h.

- + +

◆ pstrUsageSystemDisplayLCDAutoscale

+
@@ -3288,11 +3472,13 @@ Variables
-

Definition at line 127 of file hidusagestr.h.

+

Definition at line 127 of file hidusagestr.h.

- + +

◆ pstrUsageFlightSimulationDevice

+
@@ -3302,11 +3488,13 @@ Variables
-

Definition at line 130 of file hidusagestr.h.

+

Definition at line 130 of file hidusagestr.h.

- + +

◆ pstrUsageAutomobileSimulationDevice

+
@@ -3316,11 +3504,13 @@ Variables
-

Definition at line 131 of file hidusagestr.h.

+

Definition at line 131 of file hidusagestr.h.

- + +

◆ pstrUsageTankSimulationDevice

+
@@ -3330,11 +3520,13 @@ Variables
-

Definition at line 132 of file hidusagestr.h.

+

Definition at line 132 of file hidusagestr.h.

- + +

◆ pstrUsageSpaceshipSimulationDevice

+
@@ -3344,11 +3536,13 @@ Variables
-

Definition at line 133 of file hidusagestr.h.

+

Definition at line 133 of file hidusagestr.h.

- + +

◆ pstrUsageSubmarineSimulationDevice

+
@@ -3358,11 +3552,13 @@ Variables
-

Definition at line 134 of file hidusagestr.h.

+

Definition at line 134 of file hidusagestr.h.

- + +

◆ pstrUsageSailingSimulationDevice

+
@@ -3372,11 +3568,13 @@ Variables
-

Definition at line 135 of file hidusagestr.h.

+

Definition at line 135 of file hidusagestr.h.

- + +

◆ pstrUsageMotocicleSimulationDevice

+
@@ -3386,11 +3584,13 @@ Variables
-

Definition at line 136 of file hidusagestr.h.

+

Definition at line 136 of file hidusagestr.h.

- + +

◆ pstrUsageSportsSimulationDevice

+
@@ -3400,11 +3600,13 @@ Variables
-

Definition at line 137 of file hidusagestr.h.

+

Definition at line 137 of file hidusagestr.h.

- + +

◆ pstrUsageAirplaneSimulationDevice

+
@@ -3414,11 +3616,13 @@ Variables
-

Definition at line 138 of file hidusagestr.h.

+

Definition at line 138 of file hidusagestr.h.

- + +

◆ pstrUsageHelicopterSimulationDevice

+
@@ -3428,11 +3632,13 @@ Variables
-

Definition at line 139 of file hidusagestr.h.

+

Definition at line 139 of file hidusagestr.h.

- + +

◆ pstrUsageMagicCarpetSimulationDevice

+
@@ -3442,11 +3648,13 @@ Variables
-

Definition at line 140 of file hidusagestr.h.

+

Definition at line 140 of file hidusagestr.h.

- + +

◆ pstrUsageBicycleSimulationDevice

+
@@ -3456,11 +3664,13 @@ Variables
-

Definition at line 141 of file hidusagestr.h.

+

Definition at line 141 of file hidusagestr.h.

- + +

◆ pstrUsageFlightControlStick

+
@@ -3470,11 +3680,13 @@ Variables
-

Definition at line 142 of file hidusagestr.h.

+

Definition at line 142 of file hidusagestr.h.

- + +

◆ pstrUsageFlightStick

+
@@ -3484,11 +3696,13 @@ Variables
-

Definition at line 143 of file hidusagestr.h.

+

Definition at line 143 of file hidusagestr.h.

- + +

◆ pstrUsageCyclicControl

+
@@ -3498,11 +3712,13 @@ Variables
-

Definition at line 144 of file hidusagestr.h.

+

Definition at line 144 of file hidusagestr.h.

- + +

◆ pstrUsageCyclicTrim

+
@@ -3512,11 +3728,13 @@ Variables
-

Definition at line 145 of file hidusagestr.h.

+

Definition at line 145 of file hidusagestr.h.

- + +

◆ pstrUsageFlightYoke

+
@@ -3526,11 +3744,13 @@ Variables
-

Definition at line 146 of file hidusagestr.h.

+

Definition at line 146 of file hidusagestr.h.

- + +

◆ pstrUsageTrackControl

+
@@ -3540,11 +3760,13 @@ Variables
-

Definition at line 147 of file hidusagestr.h.

+

Definition at line 147 of file hidusagestr.h.

- + +

◆ pstrUsageAileron

+
@@ -3554,11 +3776,13 @@ Variables
-

Definition at line 148 of file hidusagestr.h.

+

Definition at line 148 of file hidusagestr.h.

- + +

◆ pstrUsageAileronTrim

+
@@ -3568,11 +3792,13 @@ Variables
-

Definition at line 149 of file hidusagestr.h.

+

Definition at line 149 of file hidusagestr.h.

- + +

◆ pstrUsageAntiTorqueControl

+
@@ -3582,11 +3808,13 @@ Variables
-

Definition at line 150 of file hidusagestr.h.

+

Definition at line 150 of file hidusagestr.h.

- + +

◆ pstrUsageAutopilotEnable

+
@@ -3596,11 +3824,13 @@ Variables
-

Definition at line 151 of file hidusagestr.h.

+

Definition at line 151 of file hidusagestr.h.

- + +

◆ pstrUsageChaffRelease

+
@@ -3610,11 +3840,13 @@ Variables
-

Definition at line 152 of file hidusagestr.h.

+

Definition at line 152 of file hidusagestr.h.

- + +

◆ pstrUsageCollectiveControl

+
@@ -3624,11 +3856,13 @@ Variables
-

Definition at line 153 of file hidusagestr.h.

+

Definition at line 153 of file hidusagestr.h.

- + +

◆ pstrUsageDiveBrake

+
@@ -3638,11 +3872,13 @@ Variables
-

Definition at line 154 of file hidusagestr.h.

+

Definition at line 154 of file hidusagestr.h.

- + +

◆ pstrUsageElectronicCountermeasures

+
@@ -3652,11 +3888,13 @@ Variables
-

Definition at line 155 of file hidusagestr.h.

+

Definition at line 155 of file hidusagestr.h.

- + +

◆ pstrUsageElevator

+
@@ -3666,11 +3904,13 @@ Variables
-

Definition at line 156 of file hidusagestr.h.

+

Definition at line 156 of file hidusagestr.h.

- + +

◆ pstrUsageElevatorTrim

+
@@ -3680,11 +3920,13 @@ Variables
-

Definition at line 157 of file hidusagestr.h.

+

Definition at line 157 of file hidusagestr.h.

- + +

◆ pstrUsageRudder

+
@@ -3694,11 +3936,13 @@ Variables
-

Definition at line 158 of file hidusagestr.h.

+

Definition at line 158 of file hidusagestr.h.

- + +

◆ pstrUsageThrottle

+
@@ -3708,11 +3952,13 @@ Variables
-

Definition at line 159 of file hidusagestr.h.

+

Definition at line 159 of file hidusagestr.h.

- + +

◆ pstrUsageFlightCommunications

+
@@ -3722,11 +3968,13 @@ Variables
-

Definition at line 160 of file hidusagestr.h.

+

Definition at line 160 of file hidusagestr.h.

- + +

◆ pstrUsageFlareRelease

+
@@ -3736,11 +3984,13 @@ Variables
-

Definition at line 161 of file hidusagestr.h.

+

Definition at line 161 of file hidusagestr.h.

- + +

◆ pstrUsageLandingGear

+
@@ -3750,11 +4000,13 @@ Variables
-

Definition at line 162 of file hidusagestr.h.

+

Definition at line 162 of file hidusagestr.h.

- + +

◆ pstrUsageToeBrake

+
@@ -3764,11 +4016,13 @@ Variables
-

Definition at line 163 of file hidusagestr.h.

+

Definition at line 163 of file hidusagestr.h.

- + +

◆ pstrUsageTrigger

+
@@ -3778,11 +4032,13 @@ Variables
-

Definition at line 164 of file hidusagestr.h.

+

Definition at line 164 of file hidusagestr.h.

- + +

◆ pstrUsageWeaponsArm

+
@@ -3792,11 +4048,13 @@ Variables
-

Definition at line 165 of file hidusagestr.h.

+

Definition at line 165 of file hidusagestr.h.

- + +

◆ pstrUsageWeaponsSelect

+
@@ -3806,11 +4064,13 @@ Variables
-

Definition at line 166 of file hidusagestr.h.

+

Definition at line 166 of file hidusagestr.h.

- + +

◆ pstrUsageWingFlaps

+
@@ -3820,11 +4080,13 @@ Variables
-

Definition at line 167 of file hidusagestr.h.

+

Definition at line 167 of file hidusagestr.h.

- + +

◆ pstrUsageAccelerator

+
@@ -3834,11 +4096,13 @@ Variables
-

Definition at line 168 of file hidusagestr.h.

+

Definition at line 168 of file hidusagestr.h.

- + +

◆ pstrUsageBrake

+
@@ -3848,11 +4112,13 @@ Variables
-

Definition at line 169 of file hidusagestr.h.

+

Definition at line 169 of file hidusagestr.h.

- + +

◆ pstrUsageClutch

+
@@ -3862,11 +4128,13 @@ Variables
-

Definition at line 170 of file hidusagestr.h.

+

Definition at line 170 of file hidusagestr.h.

- + +

◆ pstrUsageShifter

+
@@ -3876,11 +4144,13 @@ Variables
-

Definition at line 171 of file hidusagestr.h.

+

Definition at line 171 of file hidusagestr.h.

- + +

◆ pstrUsageSteering

+
@@ -3890,11 +4160,13 @@ Variables
-

Definition at line 172 of file hidusagestr.h.

+

Definition at line 172 of file hidusagestr.h.

- + +

◆ pstrUsageTurretDirection

+
@@ -3904,11 +4176,13 @@ Variables
-

Definition at line 173 of file hidusagestr.h.

+

Definition at line 173 of file hidusagestr.h.

- + +

◆ pstrUsageBarrelElevation

+
@@ -3918,11 +4192,13 @@ Variables
-

Definition at line 174 of file hidusagestr.h.

+

Definition at line 174 of file hidusagestr.h.

- + +

◆ pstrUsageDivePlane

+
@@ -3932,11 +4208,13 @@ Variables
-

Definition at line 175 of file hidusagestr.h.

+

Definition at line 175 of file hidusagestr.h.

- + +

◆ pstrUsageBallast

+
@@ -3946,11 +4224,13 @@ Variables
-

Definition at line 176 of file hidusagestr.h.

+

Definition at line 176 of file hidusagestr.h.

- + +

◆ pstrUsageBicycleCrank

+
@@ -3960,11 +4240,13 @@ Variables
-

Definition at line 177 of file hidusagestr.h.

+

Definition at line 177 of file hidusagestr.h.

- + +

◆ pstrUsageHandleBars

+
@@ -3974,11 +4256,13 @@ Variables
-

Definition at line 178 of file hidusagestr.h.

+

Definition at line 178 of file hidusagestr.h.

- + +

◆ pstrUsageFrontBrake

+
@@ -3988,11 +4272,13 @@ Variables
-

Definition at line 179 of file hidusagestr.h.

+

Definition at line 179 of file hidusagestr.h.

- + +

◆ pstrUsageRearBrake

+
@@ -4002,11 +4288,13 @@ Variables
-

Definition at line 180 of file hidusagestr.h.

+

Definition at line 180 of file hidusagestr.h.

- + +

◆ pstrUsageBelt

+
@@ -4016,11 +4304,13 @@ Variables
-

Definition at line 183 of file hidusagestr.h.

+

Definition at line 183 of file hidusagestr.h.

- + +

◆ pstrUsageBodySuit

+
@@ -4030,11 +4320,13 @@ Variables
-

Definition at line 184 of file hidusagestr.h.

+

Definition at line 184 of file hidusagestr.h.

- + +

◆ pstrUsageFlexor

+
@@ -4044,11 +4336,13 @@ Variables
-

Definition at line 185 of file hidusagestr.h.

+

Definition at line 185 of file hidusagestr.h.

- + +

◆ pstrUsageGlove

+
@@ -4058,11 +4352,13 @@ Variables
-

Definition at line 186 of file hidusagestr.h.

+

Definition at line 186 of file hidusagestr.h.

- + +

◆ pstrUsageHeadTracker

+
@@ -4072,11 +4368,13 @@ Variables
-

Definition at line 187 of file hidusagestr.h.

+

Definition at line 187 of file hidusagestr.h.

- + +

◆ pstrUsageHeadMountedDisplay

+
@@ -4086,11 +4384,13 @@ Variables
-

Definition at line 188 of file hidusagestr.h.

+

Definition at line 188 of file hidusagestr.h.

- + +

◆ pstrUsageHandTracker

+
@@ -4100,11 +4400,13 @@ Variables
-

Definition at line 189 of file hidusagestr.h.

+

Definition at line 189 of file hidusagestr.h.

- + +

◆ pstrUsageOculometer

+
@@ -4114,11 +4416,13 @@ Variables
-

Definition at line 190 of file hidusagestr.h.

+

Definition at line 190 of file hidusagestr.h.

- + +

◆ pstrUsageVest

+
@@ -4128,11 +4432,13 @@ Variables
-

Definition at line 191 of file hidusagestr.h.

+

Definition at line 191 of file hidusagestr.h.

- + +

◆ pstrUsageAnimatronicDevice

+
@@ -4142,11 +4448,13 @@ Variables
-

Definition at line 192 of file hidusagestr.h.

+

Definition at line 192 of file hidusagestr.h.

- + +

◆ pstrUsageStereoEnable

+
@@ -4156,11 +4464,13 @@ Variables
-

Definition at line 193 of file hidusagestr.h.

+

Definition at line 193 of file hidusagestr.h.

- + +

◆ pstrUsageDisplayEnable

+
@@ -4170,11 +4480,13 @@ Variables
-

Definition at line 194 of file hidusagestr.h.

+

Definition at line 194 of file hidusagestr.h.

- + +

◆ pstrUsageBaseballBat

+
@@ -4184,11 +4496,13 @@ Variables
-

Definition at line 197 of file hidusagestr.h.

+

Definition at line 197 of file hidusagestr.h.

- + +

◆ pstrUsageGolfClub

+
@@ -4198,11 +4512,13 @@ Variables
-

Definition at line 198 of file hidusagestr.h.

+

Definition at line 198 of file hidusagestr.h.

- + +

◆ pstrUsageRowingMachine

+
@@ -4212,11 +4528,13 @@ Variables
-

Definition at line 199 of file hidusagestr.h.

+

Definition at line 199 of file hidusagestr.h.

- + +

◆ pstrUsageTreadmill

+
@@ -4226,11 +4544,13 @@ Variables
-

Definition at line 200 of file hidusagestr.h.

+

Definition at line 200 of file hidusagestr.h.

- + +

◆ pstrUsageOar

+
@@ -4240,11 +4560,13 @@ Variables
-

Definition at line 201 of file hidusagestr.h.

+

Definition at line 201 of file hidusagestr.h.

- + +

◆ pstrUsageSlope

+
@@ -4254,11 +4576,13 @@ Variables
-

Definition at line 202 of file hidusagestr.h.

+

Definition at line 202 of file hidusagestr.h.

- + +

◆ pstrUsageRate

+
@@ -4268,11 +4592,13 @@ Variables
-

Definition at line 203 of file hidusagestr.h.

+

Definition at line 203 of file hidusagestr.h.

- + +

◆ pstrUsageStickSpeed

+
@@ -4282,11 +4608,13 @@ Variables
-

Definition at line 204 of file hidusagestr.h.

+

Definition at line 204 of file hidusagestr.h.

- + +

◆ pstrUsageStickFaceAngle

+
@@ -4296,11 +4624,13 @@ Variables
-

Definition at line 205 of file hidusagestr.h.

+

Definition at line 205 of file hidusagestr.h.

- + +

◆ pstrUsageStickHeelToe

+
@@ -4310,11 +4640,13 @@ Variables
-

Definition at line 206 of file hidusagestr.h.

+

Definition at line 206 of file hidusagestr.h.

- + +

◆ pstrUsageStickFollowThough

+
@@ -4324,11 +4656,13 @@ Variables
-

Definition at line 207 of file hidusagestr.h.

+

Definition at line 207 of file hidusagestr.h.

- + +

◆ pstrUsageStickTempo

+
@@ -4338,11 +4672,13 @@ Variables
-

Definition at line 208 of file hidusagestr.h.

+

Definition at line 208 of file hidusagestr.h.

- + +

◆ pstrUsageStickType

+
@@ -4352,11 +4688,13 @@ Variables
-

Definition at line 209 of file hidusagestr.h.

+

Definition at line 209 of file hidusagestr.h.

- + +

◆ pstrUsageStickHeight

+
@@ -4366,11 +4704,13 @@ Variables
-

Definition at line 210 of file hidusagestr.h.

+

Definition at line 210 of file hidusagestr.h.

- + +

◆ pstrUsagePutter

+
@@ -4380,11 +4720,13 @@ Variables
-

Definition at line 211 of file hidusagestr.h.

+

Definition at line 211 of file hidusagestr.h.

- + +

◆ pstrUsage1Iron

+
@@ -4394,11 +4736,13 @@ Variables
-

Definition at line 212 of file hidusagestr.h.

+

Definition at line 212 of file hidusagestr.h.

- + +

◆ pstrUsage2Iron

+
@@ -4408,11 +4752,13 @@ Variables
-

Definition at line 213 of file hidusagestr.h.

+

Definition at line 213 of file hidusagestr.h.

- + +

◆ pstrUsage3Iron

+
@@ -4422,11 +4768,13 @@ Variables
-

Definition at line 214 of file hidusagestr.h.

+

Definition at line 214 of file hidusagestr.h.

- + +

◆ pstrUsage4Iron

+
@@ -4436,11 +4784,13 @@ Variables
-

Definition at line 215 of file hidusagestr.h.

+

Definition at line 215 of file hidusagestr.h.

- + +

◆ pstrUsage5Iron

+
@@ -4450,11 +4800,13 @@ Variables
-

Definition at line 216 of file hidusagestr.h.

+

Definition at line 216 of file hidusagestr.h.

- + +

◆ pstrUsage6Iron

+
@@ -4464,11 +4816,13 @@ Variables
-

Definition at line 217 of file hidusagestr.h.

+

Definition at line 217 of file hidusagestr.h.

- + +

◆ pstrUsage7Iron

+
@@ -4478,11 +4832,13 @@ Variables
-

Definition at line 218 of file hidusagestr.h.

+

Definition at line 218 of file hidusagestr.h.

- + +

◆ pstrUsage8Iron

+
@@ -4492,11 +4848,13 @@ Variables
-

Definition at line 219 of file hidusagestr.h.

+

Definition at line 219 of file hidusagestr.h.

- + +

◆ pstrUsage9Iron

+
@@ -4506,11 +4864,13 @@ Variables
-

Definition at line 220 of file hidusagestr.h.

+

Definition at line 220 of file hidusagestr.h.

- + +

◆ pstrUsage10Iron

+
@@ -4520,11 +4880,13 @@ Variables
-

Definition at line 221 of file hidusagestr.h.

+

Definition at line 221 of file hidusagestr.h.

- + +

◆ pstrUsage11Iron

+
@@ -4534,11 +4896,13 @@ Variables
-

Definition at line 222 of file hidusagestr.h.

+

Definition at line 222 of file hidusagestr.h.

- + +

◆ pstrUsageSandWedge

+
@@ -4548,11 +4912,13 @@ Variables
-

Definition at line 223 of file hidusagestr.h.

+

Definition at line 223 of file hidusagestr.h.

- + +

◆ pstrUsageLoftWedge

+
@@ -4562,11 +4928,13 @@ Variables
-

Definition at line 224 of file hidusagestr.h.

+

Definition at line 224 of file hidusagestr.h.

- + +

◆ pstrUsagePowerWedge

+
@@ -4576,11 +4944,13 @@ Variables
-

Definition at line 225 of file hidusagestr.h.

+

Definition at line 225 of file hidusagestr.h.

- + +

◆ pstrUsage1Wood

+
@@ -4590,11 +4960,13 @@ Variables
-

Definition at line 226 of file hidusagestr.h.

+

Definition at line 226 of file hidusagestr.h.

- + +

◆ pstrUsage3Wood

+
@@ -4604,11 +4976,13 @@ Variables
-

Definition at line 227 of file hidusagestr.h.

+

Definition at line 227 of file hidusagestr.h.

- + +

◆ pstrUsage5Wood

+
@@ -4618,11 +4992,13 @@ Variables
-

Definition at line 228 of file hidusagestr.h.

+

Definition at line 228 of file hidusagestr.h.

- + +

◆ pstrUsage7Wood

+
@@ -4632,11 +5008,13 @@ Variables
-

Definition at line 229 of file hidusagestr.h.

+

Definition at line 229 of file hidusagestr.h.

- + +

◆ pstrUsage9Wood

+
@@ -4646,11 +5024,13 @@ Variables
-

Definition at line 230 of file hidusagestr.h.

+

Definition at line 230 of file hidusagestr.h.

- + +

◆ pstrUsage3DGameController

+
@@ -4660,11 +5040,13 @@ Variables
-

Definition at line 233 of file hidusagestr.h.

+

Definition at line 233 of file hidusagestr.h.

- + +

◆ pstrUsagePinballDevice

+
@@ -4674,11 +5056,13 @@ Variables
-

Definition at line 234 of file hidusagestr.h.

+

Definition at line 234 of file hidusagestr.h.

- + +

◆ pstrUsageGunDevice

+
@@ -4688,11 +5072,13 @@ Variables
-

Definition at line 235 of file hidusagestr.h.

+

Definition at line 235 of file hidusagestr.h.

- + +

◆ pstrUsagePointOfView

+
@@ -4702,11 +5088,13 @@ Variables
-

Definition at line 236 of file hidusagestr.h.

+

Definition at line 236 of file hidusagestr.h.

- + +

◆ pstrUsageTurnRightLeft

+
@@ -4716,11 +5104,13 @@ Variables
-

Definition at line 237 of file hidusagestr.h.

+

Definition at line 237 of file hidusagestr.h.

- + +

◆ pstrUsagePitchForwardBackward

+
@@ -4730,11 +5120,13 @@ Variables
-

Definition at line 238 of file hidusagestr.h.

+

Definition at line 238 of file hidusagestr.h.

- + +

◆ pstrUsageRollRightLeft

+
@@ -4744,11 +5136,13 @@ Variables
-

Definition at line 239 of file hidusagestr.h.

+

Definition at line 239 of file hidusagestr.h.

- + +

◆ pstrUsageMoveRightLeft

+
@@ -4758,11 +5152,13 @@ Variables
-

Definition at line 240 of file hidusagestr.h.

+

Definition at line 240 of file hidusagestr.h.

- + +

◆ pstrUsageMoveForwardBackward

+
@@ -4772,11 +5168,13 @@ Variables
-

Definition at line 241 of file hidusagestr.h.

+

Definition at line 241 of file hidusagestr.h.

- + +

◆ pstrUsageMoveUpDown

+
@@ -4786,11 +5184,13 @@ Variables
-

Definition at line 242 of file hidusagestr.h.

+

Definition at line 242 of file hidusagestr.h.

- + +

◆ pstrUsageLeanRightLeft

+
@@ -4800,11 +5200,13 @@ Variables
-

Definition at line 243 of file hidusagestr.h.

+

Definition at line 243 of file hidusagestr.h.

- + +

◆ pstrUsageLeanForwardBackward

+
@@ -4814,11 +5216,13 @@ Variables
-

Definition at line 244 of file hidusagestr.h.

+

Definition at line 244 of file hidusagestr.h.

- + +

◆ pstrUsageHeightOfPOV

+
@@ -4828,11 +5232,13 @@ Variables
-

Definition at line 245 of file hidusagestr.h.

+

Definition at line 245 of file hidusagestr.h.

- + +

◆ pstrUsageFlipper

+
@@ -4842,11 +5248,13 @@ Variables
-

Definition at line 246 of file hidusagestr.h.

+

Definition at line 246 of file hidusagestr.h.

- + +

◆ pstrUsageSecondaryFlipper

+
@@ -4856,11 +5264,13 @@ Variables
-

Definition at line 247 of file hidusagestr.h.

+

Definition at line 247 of file hidusagestr.h.

- + +

◆ pstrUsageBump

+
@@ -4870,11 +5280,13 @@ Variables
-

Definition at line 248 of file hidusagestr.h.

+

Definition at line 248 of file hidusagestr.h.

- + +

◆ pstrUsageNewGame

+
@@ -4884,11 +5296,13 @@ Variables
-

Definition at line 249 of file hidusagestr.h.

+

Definition at line 249 of file hidusagestr.h.

- + +

◆ pstrUsageShootBall

+
@@ -4898,11 +5312,13 @@ Variables
-

Definition at line 250 of file hidusagestr.h.

+

Definition at line 250 of file hidusagestr.h.

- + +

◆ pstrUsagePlayer

+
@@ -4912,11 +5328,13 @@ Variables
-

Definition at line 251 of file hidusagestr.h.

+

Definition at line 251 of file hidusagestr.h.

- + +

◆ pstrUsageGunBolt

+
@@ -4926,11 +5344,13 @@ Variables
-

Definition at line 252 of file hidusagestr.h.

+

Definition at line 252 of file hidusagestr.h.

- + +

◆ pstrUsageGunClip

+
@@ -4940,11 +5360,13 @@ Variables
-

Definition at line 253 of file hidusagestr.h.

+

Definition at line 253 of file hidusagestr.h.

- + +

◆ pstrUsageGunSelector

+
@@ -4954,11 +5376,13 @@ Variables
-

Definition at line 254 of file hidusagestr.h.

+

Definition at line 254 of file hidusagestr.h.

- + +

◆ pstrUsageGunSingleShot

+
@@ -4968,11 +5392,13 @@ Variables
-

Definition at line 255 of file hidusagestr.h.

+

Definition at line 255 of file hidusagestr.h.

- + +

◆ pstrUsageGunBurst

+
@@ -4982,11 +5408,13 @@ Variables
-

Definition at line 256 of file hidusagestr.h.

+

Definition at line 256 of file hidusagestr.h.

- + +

◆ pstrUsageGunAutomatic

+
@@ -4996,11 +5424,13 @@ Variables
-

Definition at line 257 of file hidusagestr.h.

+

Definition at line 257 of file hidusagestr.h.

- + +

◆ pstrUsageGunSafety

+
@@ -5010,11 +5440,13 @@ Variables
-

Definition at line 258 of file hidusagestr.h.

+

Definition at line 258 of file hidusagestr.h.

- + +

◆ pstrUsageGamepadFireJump

+
@@ -5024,11 +5456,13 @@ Variables
-

Definition at line 259 of file hidusagestr.h.

+

Definition at line 259 of file hidusagestr.h.

- + +

◆ pstrUsageGamepadTrigger

+
@@ -5038,11 +5472,13 @@ Variables
-

Definition at line 260 of file hidusagestr.h.

+

Definition at line 260 of file hidusagestr.h.

- + +

◆ pstrUsageBatteryStrength

+
@@ -5052,11 +5488,13 @@ Variables
-

Definition at line 263 of file hidusagestr.h.

+

Definition at line 263 of file hidusagestr.h.

- + +

◆ pstrUsageWirelessChannel

+
@@ -5066,11 +5504,13 @@ Variables
-

Definition at line 264 of file hidusagestr.h.

+

Definition at line 264 of file hidusagestr.h.

- + +

◆ pstrUsageWirelessID

+
@@ -5080,11 +5520,13 @@ Variables
-

Definition at line 265 of file hidusagestr.h.

+

Definition at line 265 of file hidusagestr.h.

- + +

◆ pstrUsageDiscoverWirelessControl

+
@@ -5094,11 +5536,13 @@ Variables
-

Definition at line 266 of file hidusagestr.h.

+

Definition at line 266 of file hidusagestr.h.

- + +

◆ pstrUsageSecurityCodeCharEntered

+
@@ -5108,11 +5552,13 @@ Variables
-

Definition at line 267 of file hidusagestr.h.

+

Definition at line 267 of file hidusagestr.h.

- + +

◆ pstrUsageSecurityCodeCharErased

+
@@ -5122,11 +5568,13 @@ Variables
-

Definition at line 268 of file hidusagestr.h.

+

Definition at line 268 of file hidusagestr.h.

- + +

◆ pstrUsageSecurityCodeCleared

+
@@ -5136,11 +5584,13 @@ Variables
-

Definition at line 269 of file hidusagestr.h.

+

Definition at line 269 of file hidusagestr.h.

- + +

◆ pstrUsageNumLock

+
@@ -5150,11 +5600,13 @@ Variables
-

Definition at line 272 of file hidusagestr.h.

+

Definition at line 272 of file hidusagestr.h.

- + +

◆ pstrUsageCapsLock

+
@@ -5164,11 +5616,13 @@ Variables
-

Definition at line 273 of file hidusagestr.h.

+

Definition at line 273 of file hidusagestr.h.

- + +

◆ pstrUsageScrollLock

+
@@ -5178,11 +5632,13 @@ Variables
-

Definition at line 274 of file hidusagestr.h.

+

Definition at line 274 of file hidusagestr.h.

- + +

◆ pstrUsageCompose

+
@@ -5192,11 +5648,13 @@ Variables
-

Definition at line 275 of file hidusagestr.h.

+

Definition at line 275 of file hidusagestr.h.

- + +

◆ pstrUsageKana

+
@@ -5206,11 +5664,13 @@ Variables
-

Definition at line 276 of file hidusagestr.h.

+

Definition at line 276 of file hidusagestr.h.

- + +

◆ pstrUsagePower

+
@@ -5220,11 +5680,13 @@ Variables
-

Definition at line 277 of file hidusagestr.h.

+

Definition at line 277 of file hidusagestr.h.

- + +

◆ pstrUsageShift

+
@@ -5234,11 +5696,13 @@ Variables
-

Definition at line 278 of file hidusagestr.h.

+

Definition at line 278 of file hidusagestr.h.

- + +

◆ pstrUsageDoNotDisturb

+
@@ -5248,11 +5712,13 @@ Variables
-

Definition at line 279 of file hidusagestr.h.

+

Definition at line 279 of file hidusagestr.h.

- + +

◆ pstrUsageMute

+
@@ -5262,11 +5728,13 @@ Variables
-

Definition at line 280 of file hidusagestr.h.

+

Definition at line 280 of file hidusagestr.h.

- + +

◆ pstrUsageToneEnable

+
@@ -5276,11 +5744,13 @@ Variables
-

Definition at line 281 of file hidusagestr.h.

+

Definition at line 281 of file hidusagestr.h.

- + +

◆ pstrUsageHighCutFilter

+
@@ -5290,11 +5760,13 @@ Variables
-

Definition at line 282 of file hidusagestr.h.

+

Definition at line 282 of file hidusagestr.h.

- + +

◆ pstrUsageLowCutFilter

+
@@ -5304,11 +5776,13 @@ Variables
-

Definition at line 283 of file hidusagestr.h.

+

Definition at line 283 of file hidusagestr.h.

- + +

◆ pstrUsageEqualizerEnable

+
@@ -5318,11 +5792,13 @@ Variables
-

Definition at line 284 of file hidusagestr.h.

+

Definition at line 284 of file hidusagestr.h.

- + +

◆ pstrUsageSoundFieldOn

+
@@ -5332,11 +5808,13 @@ Variables
-

Definition at line 285 of file hidusagestr.h.

+

Definition at line 285 of file hidusagestr.h.

- + +

◆ pstrUsageSurroundOn

+
@@ -5346,11 +5824,13 @@ Variables
-

Definition at line 286 of file hidusagestr.h.

+

Definition at line 286 of file hidusagestr.h.

- + +

◆ pstrUsageRepeat

+
@@ -5360,11 +5840,13 @@ Variables
-

Definition at line 287 of file hidusagestr.h.

+

Definition at line 287 of file hidusagestr.h.

- + +

◆ pstrUsageStereo

+
@@ -5374,11 +5856,13 @@ Variables
-

Definition at line 288 of file hidusagestr.h.

+

Definition at line 288 of file hidusagestr.h.

- + +

◆ pstrUsageSamplingRateDetect

+
@@ -5388,11 +5872,13 @@ Variables
-

Definition at line 289 of file hidusagestr.h.

+

Definition at line 289 of file hidusagestr.h.

- + +

◆ pstrUsageSpinning

+
@@ -5402,11 +5888,13 @@ Variables
-

Definition at line 290 of file hidusagestr.h.

+

Definition at line 290 of file hidusagestr.h.

- + +

◆ pstrUsageCAV

+
@@ -5416,11 +5904,13 @@ Variables
-

Definition at line 291 of file hidusagestr.h.

+

Definition at line 291 of file hidusagestr.h.

- + +

◆ pstrUsageCLV

+
@@ -5430,11 +5920,13 @@ Variables
-

Definition at line 292 of file hidusagestr.h.

+

Definition at line 292 of file hidusagestr.h.

- + +

◆ pstrUsageRecordingFormatDetect

+
@@ -5444,11 +5936,13 @@ Variables
-

Definition at line 293 of file hidusagestr.h.

+

Definition at line 293 of file hidusagestr.h.

- + +

◆ pstrUsageOffHook

+
@@ -5458,11 +5952,13 @@ Variables
-

Definition at line 294 of file hidusagestr.h.

+

Definition at line 294 of file hidusagestr.h.

- + +

◆ pstrUsageRing

+
@@ -5472,11 +5968,13 @@ Variables
-

Definition at line 295 of file hidusagestr.h.

+

Definition at line 295 of file hidusagestr.h.

- + +

◆ pstrUsageMessageWaiting

+
@@ -5486,11 +5984,13 @@ Variables
-

Definition at line 296 of file hidusagestr.h.

+

Definition at line 296 of file hidusagestr.h.

- + +

◆ pstrUsageDataMode

+
@@ -5500,11 +6000,13 @@ Variables
-

Definition at line 297 of file hidusagestr.h.

+

Definition at line 297 of file hidusagestr.h.

- + +

◆ pstrUsageBatteryOperation

+
@@ -5514,11 +6016,13 @@ Variables
-

Definition at line 298 of file hidusagestr.h.

+

Definition at line 298 of file hidusagestr.h.

- + +

◆ pstrUsageBatteryOK

+
@@ -5528,11 +6032,13 @@ Variables
-

Definition at line 299 of file hidusagestr.h.

+

Definition at line 299 of file hidusagestr.h.

- + +

◆ pstrUsageBatteryLow

+
@@ -5542,11 +6048,13 @@ Variables
-

Definition at line 300 of file hidusagestr.h.

+

Definition at line 300 of file hidusagestr.h.

- + +

◆ pstrUsageSpeaker

+
@@ -5556,11 +6064,13 @@ Variables
-

Definition at line 301 of file hidusagestr.h.

+

Definition at line 301 of file hidusagestr.h.

- + +

◆ pstrUsageHeadSet

+
@@ -5570,11 +6080,13 @@ Variables
-

Definition at line 302 of file hidusagestr.h.

+

Definition at line 302 of file hidusagestr.h.

- + +

◆ pstrUsageHold

+
@@ -5584,11 +6096,13 @@ Variables
-

Definition at line 303 of file hidusagestr.h.

+

Definition at line 303 of file hidusagestr.h.

- + +

◆ pstrUsageMicrophone

+
@@ -5598,11 +6112,13 @@ Variables
-

Definition at line 304 of file hidusagestr.h.

+

Definition at line 304 of file hidusagestr.h.

- + +

◆ pstrUsageCoverage

+
@@ -5612,11 +6128,13 @@ Variables
-

Definition at line 305 of file hidusagestr.h.

+

Definition at line 305 of file hidusagestr.h.

- + +

◆ pstrUsageNightMode

+
@@ -5626,11 +6144,13 @@ Variables
-

Definition at line 306 of file hidusagestr.h.

+

Definition at line 306 of file hidusagestr.h.

- + +

◆ pstrUsageSendCalls

+
@@ -5640,11 +6160,13 @@ Variables
-

Definition at line 307 of file hidusagestr.h.

+

Definition at line 307 of file hidusagestr.h.

- + +

◆ pstrUsageCallPickup

+
@@ -5654,11 +6176,13 @@ Variables
-

Definition at line 308 of file hidusagestr.h.

+

Definition at line 308 of file hidusagestr.h.

- + +

◆ pstrUsageConference

+
@@ -5668,11 +6192,13 @@ Variables
-

Definition at line 309 of file hidusagestr.h.

+

Definition at line 309 of file hidusagestr.h.

- + +

◆ pstrUsageStandBy

+
@@ -5682,11 +6208,13 @@ Variables
-

Definition at line 310 of file hidusagestr.h.

+

Definition at line 310 of file hidusagestr.h.

- + +

◆ pstrUsageCameraOn

+
@@ -5696,11 +6224,13 @@ Variables
-

Definition at line 311 of file hidusagestr.h.

+

Definition at line 311 of file hidusagestr.h.

- + +

◆ pstrUsageCameraOff

+
@@ -5710,11 +6240,13 @@ Variables
-

Definition at line 312 of file hidusagestr.h.

+

Definition at line 312 of file hidusagestr.h.

- + +

◆ pstrUsageOnLine

+
@@ -5724,11 +6256,13 @@ Variables
-

Definition at line 313 of file hidusagestr.h.

+

Definition at line 313 of file hidusagestr.h.

- + +

◆ pstrUsageOffLine

+
@@ -5738,11 +6272,13 @@ Variables
-

Definition at line 314 of file hidusagestr.h.

+

Definition at line 314 of file hidusagestr.h.

- + +

◆ pstrUsageBusy

+
@@ -5752,11 +6288,13 @@ Variables
-

Definition at line 315 of file hidusagestr.h.

+

Definition at line 315 of file hidusagestr.h.

- + +

◆ pstrUsageReady

+
@@ -5766,11 +6304,13 @@ Variables
-

Definition at line 316 of file hidusagestr.h.

+

Definition at line 316 of file hidusagestr.h.

- + +

◆ pstrUsagePaperOut

+
@@ -5780,11 +6320,13 @@ Variables
-

Definition at line 317 of file hidusagestr.h.

+

Definition at line 317 of file hidusagestr.h.

- + +

◆ pstrUsagePaperJam

+
@@ -5794,11 +6336,13 @@ Variables
-

Definition at line 318 of file hidusagestr.h.

+

Definition at line 318 of file hidusagestr.h.

- + +

◆ pstrUsageRemote

+
@@ -5808,11 +6352,13 @@ Variables
-

Definition at line 319 of file hidusagestr.h.

+

Definition at line 319 of file hidusagestr.h.

- + +

◆ pstrUsageForward

+
@@ -5822,11 +6368,13 @@ Variables
-

Definition at line 320 of file hidusagestr.h.

+

Definition at line 320 of file hidusagestr.h.

- + +

◆ pstrUsageReverse

+
@@ -5836,11 +6384,13 @@ Variables
-

Definition at line 321 of file hidusagestr.h.

+

Definition at line 321 of file hidusagestr.h.

- + +

◆ pstrUsageStop

+
@@ -5850,11 +6400,13 @@ Variables
-

Definition at line 322 of file hidusagestr.h.

+

Definition at line 322 of file hidusagestr.h.

- + +

◆ pstrUsageRewind

+
@@ -5864,11 +6416,13 @@ Variables
-

Definition at line 323 of file hidusagestr.h.

+

Definition at line 323 of file hidusagestr.h.

- + +

◆ pstrUsageFastForward

+
@@ -5878,11 +6432,13 @@ Variables
-

Definition at line 324 of file hidusagestr.h.

+

Definition at line 324 of file hidusagestr.h.

- + +

◆ pstrUsagePlay

+
@@ -5892,11 +6448,13 @@ Variables
-

Definition at line 325 of file hidusagestr.h.

+

Definition at line 325 of file hidusagestr.h.

- + +

◆ pstrUsagePause

+
@@ -5906,11 +6464,13 @@ Variables
-

Definition at line 326 of file hidusagestr.h.

+

Definition at line 326 of file hidusagestr.h.

- + +

◆ pstrUsageRecord

+
@@ -5920,11 +6480,13 @@ Variables
-

Definition at line 327 of file hidusagestr.h.

+

Definition at line 327 of file hidusagestr.h.

- + +

◆ pstrUsageError

+
@@ -5934,11 +6496,13 @@ Variables
-

Definition at line 328 of file hidusagestr.h.

+

Definition at line 328 of file hidusagestr.h.

- + +

◆ pstrUsageSelectedIndicator

+
@@ -5948,11 +6512,13 @@ Variables
-

Definition at line 329 of file hidusagestr.h.

+

Definition at line 329 of file hidusagestr.h.

- + +

◆ pstrUsageInUseIndicator

+
@@ -5962,11 +6528,13 @@ Variables
-

Definition at line 330 of file hidusagestr.h.

+

Definition at line 330 of file hidusagestr.h.

- + +

◆ pstrUsageMultiModeIndicator

+
@@ -5976,11 +6544,13 @@ Variables
-

Definition at line 331 of file hidusagestr.h.

+

Definition at line 331 of file hidusagestr.h.

- + +

◆ pstrUsageIndicatorOn

+
@@ -5990,11 +6560,13 @@ Variables
-

Definition at line 332 of file hidusagestr.h.

+

Definition at line 332 of file hidusagestr.h.

- + +

◆ pstrUsageIndicatorFlash

+
@@ -6004,11 +6576,13 @@ Variables
-

Definition at line 333 of file hidusagestr.h.

+

Definition at line 333 of file hidusagestr.h.

- + +

◆ pstrUsageIndicatorSlowBlink

+
@@ -6018,11 +6592,13 @@ Variables
-

Definition at line 334 of file hidusagestr.h.

+

Definition at line 334 of file hidusagestr.h.

- + +

◆ pstrUsageIndicatorFastBlink

+
@@ -6032,11 +6608,13 @@ Variables
-

Definition at line 335 of file hidusagestr.h.

+

Definition at line 335 of file hidusagestr.h.

- + +

◆ pstrUsageIndicatorOff

+
@@ -6046,11 +6624,13 @@ Variables
-

Definition at line 336 of file hidusagestr.h.

+

Definition at line 336 of file hidusagestr.h.

- + +

◆ pstrUsageFlashOnTime

+
@@ -6060,11 +6640,13 @@ Variables
-

Definition at line 337 of file hidusagestr.h.

+

Definition at line 337 of file hidusagestr.h.

- + +

◆ pstrUsageSlowBlinkOnTime

+
@@ -6074,11 +6656,13 @@ Variables
-

Definition at line 338 of file hidusagestr.h.

+

Definition at line 338 of file hidusagestr.h.

- + +

◆ pstrUsageSlowBlinkOffTime

+
@@ -6088,11 +6672,13 @@ Variables
-

Definition at line 339 of file hidusagestr.h.

+

Definition at line 339 of file hidusagestr.h.

- + +

◆ pstrUsageFastBlinkOnTime

+
@@ -6102,11 +6688,13 @@ Variables
-

Definition at line 340 of file hidusagestr.h.

+

Definition at line 340 of file hidusagestr.h.

- + +

◆ pstrUsageFastBlinkOffTime

+
@@ -6116,11 +6704,13 @@ Variables
-

Definition at line 341 of file hidusagestr.h.

+

Definition at line 341 of file hidusagestr.h.

- + +

◆ pstrUsageIndicatorColor

+
@@ -6130,11 +6720,13 @@ Variables
-

Definition at line 342 of file hidusagestr.h.

+

Definition at line 342 of file hidusagestr.h.

- + +

◆ pstrUsageIndicatorRed

+
@@ -6144,11 +6736,13 @@ Variables
-

Definition at line 343 of file hidusagestr.h.

+

Definition at line 343 of file hidusagestr.h.

- + +

◆ pstrUsageIndicatorGreen

+
@@ -6158,11 +6752,13 @@ Variables
-

Definition at line 344 of file hidusagestr.h.

+

Definition at line 344 of file hidusagestr.h.

- + +

◆ pstrUsageIndicatorAmber

+
@@ -6172,11 +6768,13 @@ Variables
-

Definition at line 345 of file hidusagestr.h.

+

Definition at line 345 of file hidusagestr.h.

- + +

◆ pstrUsageGenericIndicator

+
@@ -6186,11 +6784,13 @@ Variables
-

Definition at line 346 of file hidusagestr.h.

+

Definition at line 346 of file hidusagestr.h.

- + +

◆ pstrUsageSystemSuspend

+
@@ -6200,11 +6800,13 @@ Variables
-

Definition at line 347 of file hidusagestr.h.

+

Definition at line 347 of file hidusagestr.h.

- + +

◆ pstrUsageExternalPowerConnected

+
@@ -6214,11 +6816,13 @@ Variables
-

Definition at line 348 of file hidusagestr.h.

+

Definition at line 348 of file hidusagestr.h.

- + +

◆ pstrUsagePhone

+
@@ -6228,11 +6832,13 @@ Variables
-

Definition at line 351 of file hidusagestr.h.

+

Definition at line 351 of file hidusagestr.h.

- + +

◆ pstrUsageAnsweringMachine

+
@@ -6242,11 +6848,13 @@ Variables
-

Definition at line 352 of file hidusagestr.h.

+

Definition at line 352 of file hidusagestr.h.

- + +

◆ pstrUsageMessageControls

+
@@ -6256,11 +6864,13 @@ Variables
-

Definition at line 353 of file hidusagestr.h.

+

Definition at line 353 of file hidusagestr.h.

- + +

◆ pstrUsageHandset

+
@@ -6270,11 +6880,13 @@ Variables
-

Definition at line 354 of file hidusagestr.h.

+

Definition at line 354 of file hidusagestr.h.

- + +

◆ pstrUsageHeadset

+
@@ -6284,11 +6896,13 @@ Variables
-

Definition at line 355 of file hidusagestr.h.

+

Definition at line 355 of file hidusagestr.h.

- + +

◆ pstrUsageTelephonyKeyPad

+
@@ -6298,11 +6912,13 @@ Variables
-

Definition at line 356 of file hidusagestr.h.

+

Definition at line 356 of file hidusagestr.h.

- + +

◆ pstrUsageProgrammableButton

+
@@ -6312,11 +6928,13 @@ Variables
-

Definition at line 357 of file hidusagestr.h.

+

Definition at line 357 of file hidusagestr.h.

- + +

◆ pstrUsageHookSwitch

+
@@ -6326,11 +6944,13 @@ Variables
-

Definition at line 358 of file hidusagestr.h.

+

Definition at line 358 of file hidusagestr.h.

- + +

◆ pstrUsageFlash

+
@@ -6340,11 +6960,13 @@ Variables
-

Definition at line 359 of file hidusagestr.h.

+

Definition at line 359 of file hidusagestr.h.

- + +

◆ pstrUsageFeature

+
@@ -6354,11 +6976,13 @@ Variables
-

Definition at line 360 of file hidusagestr.h.

+

Definition at line 360 of file hidusagestr.h.

- + +

◆ pstrUsageRedial

+
@@ -6368,11 +6992,13 @@ Variables
-

Definition at line 362 of file hidusagestr.h.

+

Definition at line 362 of file hidusagestr.h.

- + +

◆ pstrUsageTransfer

+
@@ -6382,11 +7008,13 @@ Variables
-

Definition at line 363 of file hidusagestr.h.

+

Definition at line 363 of file hidusagestr.h.

- + +

◆ pstrUsageDrop

+
@@ -6396,11 +7024,13 @@ Variables
-

Definition at line 364 of file hidusagestr.h.

+

Definition at line 364 of file hidusagestr.h.

- + +

◆ pstrUsagePark

+
@@ -6410,11 +7040,13 @@ Variables
-

Definition at line 365 of file hidusagestr.h.

+

Definition at line 365 of file hidusagestr.h.

- + +

◆ pstrUsageForwardCalls

+
@@ -6424,11 +7056,13 @@ Variables
-

Definition at line 366 of file hidusagestr.h.

+

Definition at line 366 of file hidusagestr.h.

- + +

◆ pstrUsageAlternateFunction

+
@@ -6438,11 +7072,13 @@ Variables
-

Definition at line 367 of file hidusagestr.h.

+

Definition at line 367 of file hidusagestr.h.

- + +

◆ pstrUsageLine

+
@@ -6452,11 +7088,13 @@ Variables
-

Definition at line 368 of file hidusagestr.h.

+

Definition at line 368 of file hidusagestr.h.

- + +

◆ pstrUsageSpeakerPhone

+
@@ -6466,11 +7104,13 @@ Variables
-

Definition at line 369 of file hidusagestr.h.

+

Definition at line 369 of file hidusagestr.h.

- + +

◆ pstrUsageRingEnable

+
@@ -6480,11 +7120,13 @@ Variables
-

Definition at line 371 of file hidusagestr.h.

+

Definition at line 371 of file hidusagestr.h.

- + +

◆ pstrUsageRingSelect

+
@@ -6494,11 +7136,13 @@ Variables
-

Definition at line 372 of file hidusagestr.h.

+

Definition at line 372 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneMute

+
@@ -6508,11 +7152,13 @@ Variables
-

Definition at line 373 of file hidusagestr.h.

+

Definition at line 373 of file hidusagestr.h.

- + +

◆ pstrUsageCallerID

+
@@ -6522,11 +7168,13 @@ Variables
-

Definition at line 374 of file hidusagestr.h.

+

Definition at line 374 of file hidusagestr.h.

- + +

◆ pstrUsageSend

+
@@ -6536,11 +7184,13 @@ Variables
-

Definition at line 375 of file hidusagestr.h.

+

Definition at line 375 of file hidusagestr.h.

- + +

◆ pstrUsageSpeedDial

+
@@ -6550,11 +7200,13 @@ Variables
-

Definition at line 376 of file hidusagestr.h.

+

Definition at line 376 of file hidusagestr.h.

- + +

◆ pstrUsageStoreNumber

+
@@ -6564,11 +7216,13 @@ Variables
-

Definition at line 377 of file hidusagestr.h.

+

Definition at line 377 of file hidusagestr.h.

- + +

◆ pstrUsageRecallNumber

+
@@ -6578,11 +7232,13 @@ Variables
-

Definition at line 378 of file hidusagestr.h.

+

Definition at line 378 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneDirectory

+
@@ -6592,11 +7248,13 @@ Variables
-

Definition at line 379 of file hidusagestr.h.

+

Definition at line 379 of file hidusagestr.h.

- + +

◆ pstrUsageVoiceMail

+
@@ -6606,11 +7264,13 @@ Variables
-

Definition at line 380 of file hidusagestr.h.

+

Definition at line 380 of file hidusagestr.h.

- + +

◆ pstrUsageScreenCalls

+
@@ -6620,11 +7280,13 @@ Variables
-

Definition at line 381 of file hidusagestr.h.

+

Definition at line 381 of file hidusagestr.h.

- + +

◆ pstrUsageMessage

+
@@ -6634,11 +7296,13 @@ Variables
-

Definition at line 383 of file hidusagestr.h.

+

Definition at line 383 of file hidusagestr.h.

- + +

◆ pstrUsageAnswerOnOff

+
@@ -6648,11 +7312,13 @@ Variables
-

Definition at line 384 of file hidusagestr.h.

+

Definition at line 384 of file hidusagestr.h.

- + +

◆ pstrUsageInsideDialTone

+
@@ -6662,11 +7328,13 @@ Variables
-

Definition at line 385 of file hidusagestr.h.

+

Definition at line 385 of file hidusagestr.h.

- + +

◆ pstrUsageOutsideDialTone

+
@@ -6676,11 +7344,13 @@ Variables
-

Definition at line 386 of file hidusagestr.h.

+

Definition at line 386 of file hidusagestr.h.

- + +

◆ pstrUsageInsideRingTone

+
@@ -6690,11 +7360,13 @@ Variables
-

Definition at line 387 of file hidusagestr.h.

+

Definition at line 387 of file hidusagestr.h.

- + +

◆ pstrUsageOutsideRingTone

+
@@ -6704,11 +7376,13 @@ Variables
-

Definition at line 388 of file hidusagestr.h.

+

Definition at line 388 of file hidusagestr.h.

- + +

◆ pstrUsagePriorityRingTone

+
@@ -6718,11 +7392,13 @@ Variables
-

Definition at line 389 of file hidusagestr.h.

+

Definition at line 389 of file hidusagestr.h.

- + +

◆ pstrUsageInsideRingback

+
@@ -6732,11 +7408,13 @@ Variables
-

Definition at line 390 of file hidusagestr.h.

+

Definition at line 390 of file hidusagestr.h.

- + +

◆ pstrUsagePriorityRingback

+
@@ -6746,11 +7424,13 @@ Variables
-

Definition at line 391 of file hidusagestr.h.

+

Definition at line 391 of file hidusagestr.h.

- + +

◆ pstrUsageLineBusyTone

+
@@ -6760,11 +7440,13 @@ Variables
-

Definition at line 392 of file hidusagestr.h.

+

Definition at line 392 of file hidusagestr.h.

- + +

◆ pstrUsageReorderTone

+
@@ -6774,11 +7456,13 @@ Variables
-

Definition at line 393 of file hidusagestr.h.

+

Definition at line 393 of file hidusagestr.h.

- + +

◆ pstrUsageCallWaitingTone

+
@@ -6788,11 +7472,13 @@ Variables
-

Definition at line 394 of file hidusagestr.h.

+

Definition at line 394 of file hidusagestr.h.

- + +

◆ pstrUsageConfirmationTone1

+
@@ -6802,11 +7488,13 @@ Variables
-

Definition at line 395 of file hidusagestr.h.

+

Definition at line 395 of file hidusagestr.h.

- + +

◆ pstrUsageConfirmationTone2

+
@@ -6816,11 +7504,13 @@ Variables
-

Definition at line 396 of file hidusagestr.h.

+

Definition at line 396 of file hidusagestr.h.

- + +

◆ pstrUsageTonesOff

+
@@ -6830,11 +7520,13 @@ Variables
-

Definition at line 397 of file hidusagestr.h.

+

Definition at line 397 of file hidusagestr.h.

- + +

◆ pstrUsageOutsideRingback

+
@@ -6844,11 +7536,13 @@ Variables
-

Definition at line 398 of file hidusagestr.h.

+

Definition at line 398 of file hidusagestr.h.

- + +

◆ pstrUsageRinger

+
@@ -6858,11 +7552,13 @@ Variables
-

Definition at line 399 of file hidusagestr.h.

+

Definition at line 399 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey0

+
@@ -6872,11 +7568,13 @@ Variables
-

Definition at line 400 of file hidusagestr.h.

+

Definition at line 400 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey1

+
@@ -6886,11 +7584,13 @@ Variables
-

Definition at line 401 of file hidusagestr.h.

+

Definition at line 401 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey2

+
@@ -6900,11 +7600,13 @@ Variables
-

Definition at line 402 of file hidusagestr.h.

+

Definition at line 402 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey3

+
@@ -6914,11 +7616,13 @@ Variables
-

Definition at line 403 of file hidusagestr.h.

+

Definition at line 403 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey4

+
@@ -6928,11 +7632,13 @@ Variables
-

Definition at line 404 of file hidusagestr.h.

+

Definition at line 404 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey5

+
@@ -6942,11 +7648,13 @@ Variables
-

Definition at line 405 of file hidusagestr.h.

+

Definition at line 405 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey6

+
@@ -6956,11 +7664,13 @@ Variables
-

Definition at line 406 of file hidusagestr.h.

+

Definition at line 406 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey7

+
@@ -6970,11 +7680,13 @@ Variables
-

Definition at line 407 of file hidusagestr.h.

+

Definition at line 407 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey8

+
@@ -6984,11 +7696,13 @@ Variables
-

Definition at line 408 of file hidusagestr.h.

+

Definition at line 408 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKey9

+
@@ -6998,11 +7712,13 @@ Variables
-

Definition at line 409 of file hidusagestr.h.

+

Definition at line 409 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKeyStar

+
@@ -7012,11 +7728,13 @@ Variables
-

Definition at line 410 of file hidusagestr.h.

+

Definition at line 410 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKeyPound

+
@@ -7026,11 +7744,13 @@ Variables
-

Definition at line 411 of file hidusagestr.h.

+

Definition at line 411 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKeyA

+
@@ -7040,11 +7760,13 @@ Variables
-

Definition at line 412 of file hidusagestr.h.

+

Definition at line 412 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKeyB

+
@@ -7054,11 +7776,13 @@ Variables
-

Definition at line 413 of file hidusagestr.h.

+

Definition at line 413 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKeyC

+
@@ -7068,11 +7792,13 @@ Variables
-

Definition at line 414 of file hidusagestr.h.

+

Definition at line 414 of file hidusagestr.h.

- + +

◆ pstrUsagePhoneKeyD

+
@@ -7082,11 +7808,13 @@ Variables
-

Definition at line 415 of file hidusagestr.h.

+

Definition at line 415 of file hidusagestr.h.

- + +

◆ pstrUsageConsumerControl

+
@@ -7096,11 +7824,13 @@ Variables
-

Definition at line 418 of file hidusagestr.h.

+

Definition at line 418 of file hidusagestr.h.

- + +

◆ pstrUsageNumericKeyPad

+
@@ -7110,11 +7840,13 @@ Variables
-

Definition at line 419 of file hidusagestr.h.

+

Definition at line 419 of file hidusagestr.h.

- + +

◆ pstrUsageHeadphone

+
@@ -7124,11 +7856,13 @@ Variables
-

Definition at line 422 of file hidusagestr.h.

+

Definition at line 422 of file hidusagestr.h.

- + +

◆ pstrUsageGraphicEqualizer

+
@@ -7138,11 +7872,13 @@ Variables
-

Definition at line 423 of file hidusagestr.h.

+

Definition at line 423 of file hidusagestr.h.

- + +

◆ pstrUsagePlus10

+
@@ -7152,11 +7888,13 @@ Variables
-

Definition at line 424 of file hidusagestr.h.

+

Definition at line 424 of file hidusagestr.h.

- + +

◆ pstrUsagePlus100

+
@@ -7166,11 +7904,13 @@ Variables
-

Definition at line 425 of file hidusagestr.h.

+

Definition at line 425 of file hidusagestr.h.

- + +

◆ pstrUsageAMPM

+
@@ -7180,11 +7920,13 @@ Variables
-

Definition at line 426 of file hidusagestr.h.

+

Definition at line 426 of file hidusagestr.h.

- + +

◆ pstrUsageReset

+
@@ -7194,11 +7936,13 @@ Variables
-

Definition at line 428 of file hidusagestr.h.

+

Definition at line 428 of file hidusagestr.h.

- + +

◆ pstrUsageSleep

+
@@ -7208,11 +7952,13 @@ Variables
-

Definition at line 429 of file hidusagestr.h.

+

Definition at line 429 of file hidusagestr.h.

- + +

◆ pstrUsageSleepAfter

+
@@ -7222,11 +7968,13 @@ Variables
-

Definition at line 430 of file hidusagestr.h.

+

Definition at line 430 of file hidusagestr.h.

- + +

◆ pstrUsageSleepMode

+
@@ -7236,11 +7984,13 @@ Variables
-

Definition at line 431 of file hidusagestr.h.

+

Definition at line 431 of file hidusagestr.h.

- + +

◆ pstrUsageIllumination

+
@@ -7250,11 +8000,13 @@ Variables
-

Definition at line 432 of file hidusagestr.h.

+

Definition at line 432 of file hidusagestr.h.

- + +

◆ pstrUsageFunctionButtons

+
@@ -7264,11 +8016,13 @@ Variables
-

Definition at line 433 of file hidusagestr.h.

+

Definition at line 433 of file hidusagestr.h.

- + +

◆ pstrUsageMenu

+
@@ -7278,11 +8032,13 @@ Variables
-

Definition at line 434 of file hidusagestr.h.

+

Definition at line 434 of file hidusagestr.h.

- + +

◆ pstrUsageMenuPick

+
@@ -7292,11 +8048,13 @@ Variables
-

Definition at line 435 of file hidusagestr.h.

+

Definition at line 435 of file hidusagestr.h.

- + +

◆ pstrUsageMenuUp

+
@@ -7306,11 +8064,13 @@ Variables
-

Definition at line 436 of file hidusagestr.h.

+

Definition at line 436 of file hidusagestr.h.

- + +

◆ pstrUsageMenuDown

+
@@ -7320,11 +8080,13 @@ Variables
-

Definition at line 437 of file hidusagestr.h.

+

Definition at line 437 of file hidusagestr.h.

- + +

◆ pstrUsageMenuLeft

+
@@ -7334,11 +8096,13 @@ Variables
-

Definition at line 438 of file hidusagestr.h.

+

Definition at line 438 of file hidusagestr.h.

- + +

◆ pstrUsageMenuRight

+
@@ -7348,11 +8112,13 @@ Variables
-

Definition at line 439 of file hidusagestr.h.

+

Definition at line 439 of file hidusagestr.h.

- + +

◆ pstrUsageMenuEscape

+
@@ -7362,11 +8128,13 @@ Variables
-

Definition at line 440 of file hidusagestr.h.

+

Definition at line 440 of file hidusagestr.h.

- + +

◆ pstrUsageMenuValueIncrease

+
@@ -7376,11 +8144,13 @@ Variables
-

Definition at line 441 of file hidusagestr.h.

+

Definition at line 441 of file hidusagestr.h.

- + +

◆ pstrUsageMenuValueDecrease

+
@@ -7390,11 +8160,13 @@ Variables
-

Definition at line 442 of file hidusagestr.h.

+

Definition at line 442 of file hidusagestr.h.

- + +

◆ pstrUsageDataOnScreen

+
@@ -7404,11 +8176,13 @@ Variables
-

Definition at line 443 of file hidusagestr.h.

+

Definition at line 443 of file hidusagestr.h.

- + +

◆ pstrUsageClosedCaption

+
@@ -7418,11 +8192,13 @@ Variables
-

Definition at line 444 of file hidusagestr.h.

+

Definition at line 444 of file hidusagestr.h.

- + +

◆ pstrUsageClosedCaptionSelect

+
@@ -7432,11 +8208,13 @@ Variables
-

Definition at line 445 of file hidusagestr.h.

+

Definition at line 445 of file hidusagestr.h.

- + +

◆ pstrUsageVCRTV

+
@@ -7446,11 +8224,13 @@ Variables
-

Definition at line 446 of file hidusagestr.h.

+

Definition at line 446 of file hidusagestr.h.

- + +

◆ pstrUsageBroadcastMode

+
@@ -7460,11 +8240,13 @@ Variables
-

Definition at line 447 of file hidusagestr.h.

+

Definition at line 447 of file hidusagestr.h.

- + +

◆ pstrUsageSnapshot

+
@@ -7474,11 +8256,13 @@ Variables
-

Definition at line 448 of file hidusagestr.h.

+

Definition at line 448 of file hidusagestr.h.

- + +

◆ pstrUsageStill

+
@@ -7488,11 +8272,13 @@ Variables
-

Definition at line 449 of file hidusagestr.h.

+

Definition at line 449 of file hidusagestr.h.

- + +

◆ pstrUsageSelection

+
@@ -7502,11 +8288,13 @@ Variables
-

Definition at line 450 of file hidusagestr.h.

+

Definition at line 450 of file hidusagestr.h.

- + +

◆ pstrUsageAssignSelection

+
@@ -7516,11 +8304,13 @@ Variables
-

Definition at line 451 of file hidusagestr.h.

+

Definition at line 451 of file hidusagestr.h.

- + +

◆ pstrUsageModeStep

+
@@ -7530,11 +8320,13 @@ Variables
-

Definition at line 452 of file hidusagestr.h.

+

Definition at line 452 of file hidusagestr.h.

- + +

◆ pstrUsageRecallLast

+
@@ -7544,11 +8336,13 @@ Variables
-

Definition at line 453 of file hidusagestr.h.

+

Definition at line 453 of file hidusagestr.h.

- + +

◆ pstrUsageEnterChannel

+
@@ -7558,11 +8352,13 @@ Variables
-

Definition at line 454 of file hidusagestr.h.

+

Definition at line 454 of file hidusagestr.h.

- + +

◆ pstrUsageOrderMovie

+
@@ -7572,11 +8368,13 @@ Variables
-

Definition at line 455 of file hidusagestr.h.

+

Definition at line 455 of file hidusagestr.h.

- + +

◆ pstrUsageChannel

+
@@ -7586,11 +8384,13 @@ Variables
-

Definition at line 456 of file hidusagestr.h.

+

Definition at line 456 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelection

+
@@ -7600,11 +8400,13 @@ Variables
-

Definition at line 457 of file hidusagestr.h.

+

Definition at line 457 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectComputer

+
@@ -7614,11 +8416,13 @@ Variables
-

Definition at line 458 of file hidusagestr.h.

+

Definition at line 458 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectTV

+
@@ -7628,11 +8432,13 @@ Variables
-

Definition at line 459 of file hidusagestr.h.

+

Definition at line 459 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectWWW

+
@@ -7642,11 +8448,13 @@ Variables
-

Definition at line 460 of file hidusagestr.h.

+

Definition at line 460 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectDVD

+
@@ -7656,11 +8464,13 @@ Variables
-

Definition at line 461 of file hidusagestr.h.

+

Definition at line 461 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectTelephone

+
@@ -7670,11 +8480,13 @@ Variables
-

Definition at line 462 of file hidusagestr.h.

+

Definition at line 462 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectProgramGuide

+
@@ -7684,11 +8496,13 @@ Variables
-

Definition at line 463 of file hidusagestr.h.

+

Definition at line 463 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectVideoPhone

+
@@ -7698,11 +8512,13 @@ Variables
-

Definition at line 464 of file hidusagestr.h.

+

Definition at line 464 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectGames

+
@@ -7712,11 +8528,13 @@ Variables
-

Definition at line 465 of file hidusagestr.h.

+

Definition at line 465 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectMessages

+
@@ -7726,11 +8544,13 @@ Variables
-

Definition at line 466 of file hidusagestr.h.

+

Definition at line 466 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectCD

+
@@ -7740,11 +8560,13 @@ Variables
-

Definition at line 467 of file hidusagestr.h.

+

Definition at line 467 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectVCR

+
@@ -7754,11 +8576,13 @@ Variables
-

Definition at line 468 of file hidusagestr.h.

+

Definition at line 468 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectTuner

+
@@ -7768,11 +8592,13 @@ Variables
-

Definition at line 469 of file hidusagestr.h.

+

Definition at line 469 of file hidusagestr.h.

- + +

◆ pstrUsageQuit

+
@@ -7782,11 +8608,13 @@ Variables
-

Definition at line 470 of file hidusagestr.h.

+

Definition at line 470 of file hidusagestr.h.

- + +

◆ pstrUsageHelp

+
@@ -7796,11 +8624,13 @@ Variables
-

Definition at line 471 of file hidusagestr.h.

+

Definition at line 471 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectTape

+
@@ -7810,11 +8640,13 @@ Variables
-

Definition at line 472 of file hidusagestr.h.

+

Definition at line 472 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectCable

+
@@ -7824,11 +8656,13 @@ Variables
-

Definition at line 473 of file hidusagestr.h.

+

Definition at line 473 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectSatellite

+
@@ -7838,11 +8672,13 @@ Variables
-

Definition at line 474 of file hidusagestr.h.

+

Definition at line 474 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectSecurity

+
@@ -7852,11 +8688,13 @@ Variables
-

Definition at line 475 of file hidusagestr.h.

+

Definition at line 475 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectHome

+
@@ -7866,11 +8704,13 @@ Variables
-

Definition at line 476 of file hidusagestr.h.

+

Definition at line 476 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectCall

+
@@ -7880,11 +8720,13 @@ Variables
-

Definition at line 477 of file hidusagestr.h.

+

Definition at line 477 of file hidusagestr.h.

- + +

◆ pstrUsageChannelIncrement

+
@@ -7894,11 +8736,13 @@ Variables
-

Definition at line 478 of file hidusagestr.h.

+

Definition at line 478 of file hidusagestr.h.

- + +

◆ pstrUsageChannelDecrement

+
@@ -7908,11 +8752,13 @@ Variables
-

Definition at line 479 of file hidusagestr.h.

+

Definition at line 479 of file hidusagestr.h.

- + +

◆ pstrUsageMediaSelectSAP

+
@@ -7922,11 +8768,13 @@ Variables
-

Definition at line 480 of file hidusagestr.h.

+

Definition at line 480 of file hidusagestr.h.

- + +

◆ pstrUsageVCRPlus

+
@@ -7936,11 +8784,13 @@ Variables
-

Definition at line 481 of file hidusagestr.h.

+

Definition at line 481 of file hidusagestr.h.

- + +

◆ pstrUsageOnce

+
@@ -7950,11 +8800,13 @@ Variables
-

Definition at line 482 of file hidusagestr.h.

+

Definition at line 482 of file hidusagestr.h.

- + +

◆ pstrUsageDaily

+
@@ -7964,11 +8816,13 @@ Variables
-

Definition at line 483 of file hidusagestr.h.

+

Definition at line 483 of file hidusagestr.h.

- + +

◆ pstrUsageWeekly

+
@@ -7978,11 +8832,13 @@ Variables
-

Definition at line 484 of file hidusagestr.h.

+

Definition at line 484 of file hidusagestr.h.

- + +

◆ pstrUsageMonthly

+
@@ -7992,11 +8848,13 @@ Variables
-

Definition at line 485 of file hidusagestr.h.

+

Definition at line 485 of file hidusagestr.h.

- + +

◆ pstrUsageScanNextTrack

+
@@ -8006,11 +8864,13 @@ Variables
-

Definition at line 491 of file hidusagestr.h.

+

Definition at line 491 of file hidusagestr.h.

- + +

◆ pstrUsageScanPreviousTrack

+
@@ -8020,11 +8880,13 @@ Variables
-

Definition at line 492 of file hidusagestr.h.

+

Definition at line 492 of file hidusagestr.h.

- + +

◆ pstrUsageEject

+
@@ -8034,11 +8896,13 @@ Variables
-

Definition at line 494 of file hidusagestr.h.

+

Definition at line 494 of file hidusagestr.h.

- + +

◆ pstrUsageRandomPlay

+
@@ -8048,11 +8912,13 @@ Variables
-

Definition at line 495 of file hidusagestr.h.

+

Definition at line 495 of file hidusagestr.h.

- + +

◆ pstrUsageSelectDisk

+
@@ -8062,11 +8928,13 @@ Variables
-

Definition at line 496 of file hidusagestr.h.

+

Definition at line 496 of file hidusagestr.h.

- + +

◆ pstrUsageEnterDisk

+
@@ -8076,11 +8944,13 @@ Variables
-

Definition at line 497 of file hidusagestr.h.

+

Definition at line 497 of file hidusagestr.h.

- + +

◆ pstrUsageTracking

+
@@ -8090,11 +8960,13 @@ Variables
-

Definition at line 499 of file hidusagestr.h.

+

Definition at line 499 of file hidusagestr.h.

- + +

◆ pstrUsageTrackNormal

+
@@ -8104,11 +8976,13 @@ Variables
-

Definition at line 500 of file hidusagestr.h.

+

Definition at line 500 of file hidusagestr.h.

- + +

◆ pstrUsageSlowTracking

+
@@ -8118,11 +8992,13 @@ Variables
-

Definition at line 501 of file hidusagestr.h.

+

Definition at line 501 of file hidusagestr.h.

- + +

◆ pstrUsageFrameForward

+
@@ -8132,11 +9008,13 @@ Variables
-

Definition at line 502 of file hidusagestr.h.

+

Definition at line 502 of file hidusagestr.h.

- + +

◆ pstrUsageFrameBackwards

+
@@ -8146,11 +9024,13 @@ Variables
-

Definition at line 503 of file hidusagestr.h.

+

Definition at line 503 of file hidusagestr.h.

- + +

◆ pstrUsageMark

+
@@ -8160,11 +9040,13 @@ Variables
-

Definition at line 504 of file hidusagestr.h.

+

Definition at line 504 of file hidusagestr.h.

- + +

◆ pstrUsageClearMark

+
@@ -8174,11 +9056,13 @@ Variables
-

Definition at line 505 of file hidusagestr.h.

+

Definition at line 505 of file hidusagestr.h.

- + +

◆ pstrUsageRepeatFromMark

+
@@ -8188,11 +9072,13 @@ Variables
-

Definition at line 506 of file hidusagestr.h.

+

Definition at line 506 of file hidusagestr.h.

- + +

◆ pstrUsageReturnToMark

+
@@ -8202,11 +9088,13 @@ Variables
-

Definition at line 507 of file hidusagestr.h.

+

Definition at line 507 of file hidusagestr.h.

- + +

◆ pstrUsageSearchMarkForward

+
@@ -8216,11 +9104,13 @@ Variables
-

Definition at line 508 of file hidusagestr.h.

+

Definition at line 508 of file hidusagestr.h.

- + +

◆ pstrUsageSearchMarkBackwards

+
@@ -8230,11 +9120,13 @@ Variables
-

Definition at line 509 of file hidusagestr.h.

+

Definition at line 509 of file hidusagestr.h.

- + +

◆ pstrUsageCounterReset

+
@@ -8244,11 +9136,13 @@ Variables
-

Definition at line 510 of file hidusagestr.h.

+

Definition at line 510 of file hidusagestr.h.

- + +

◆ pstrUsageShowCounter

+
@@ -8258,11 +9152,13 @@ Variables
-

Definition at line 511 of file hidusagestr.h.

+

Definition at line 511 of file hidusagestr.h.

- + +

◆ pstrUsageTrackingIncrement

+
@@ -8272,11 +9168,13 @@ Variables
-

Definition at line 512 of file hidusagestr.h.

+

Definition at line 512 of file hidusagestr.h.

- + +

◆ pstrUsageTrackingDecrement

+
@@ -8286,11 +9184,13 @@ Variables
-

Definition at line 513 of file hidusagestr.h.

+

Definition at line 513 of file hidusagestr.h.

- + +

◆ pstrUsageStopEject

+
@@ -8300,11 +9200,13 @@ Variables
-

Definition at line 514 of file hidusagestr.h.

+

Definition at line 514 of file hidusagestr.h.

- + +

◆ pstrUsagePlayPause

+
@@ -8314,11 +9216,13 @@ Variables
-

Definition at line 515 of file hidusagestr.h.

+

Definition at line 515 of file hidusagestr.h.

- + +

◆ pstrUsagePlaySkip

+
@@ -8328,11 +9232,13 @@ Variables
-

Definition at line 516 of file hidusagestr.h.

+

Definition at line 516 of file hidusagestr.h.

- + +

◆ pstrUsageVolume

+
@@ -8342,11 +9248,13 @@ Variables
-

Definition at line 517 of file hidusagestr.h.

+

Definition at line 517 of file hidusagestr.h.

- + +

◆ pstrUsageBalance

+
@@ -8356,11 +9264,13 @@ Variables
-

Definition at line 518 of file hidusagestr.h.

+

Definition at line 518 of file hidusagestr.h.

- + +

◆ pstrUsageBass

+
@@ -8370,11 +9280,13 @@ Variables
-

Definition at line 520 of file hidusagestr.h.

+

Definition at line 520 of file hidusagestr.h.

- + +

◆ pstrUsageTreble

+
@@ -8384,11 +9296,13 @@ Variables
-

Definition at line 521 of file hidusagestr.h.

+

Definition at line 521 of file hidusagestr.h.

- + +

◆ pstrUsageBassBoost

+
@@ -8398,11 +9312,13 @@ Variables
-

Definition at line 522 of file hidusagestr.h.

+

Definition at line 522 of file hidusagestr.h.

- + +

◆ pstrUsageSurroundMode

+
@@ -8412,11 +9328,13 @@ Variables
-

Definition at line 523 of file hidusagestr.h.

+

Definition at line 523 of file hidusagestr.h.

- + +

◆ pstrUsageLoudness

+
@@ -8426,11 +9344,13 @@ Variables
-

Definition at line 524 of file hidusagestr.h.

+

Definition at line 524 of file hidusagestr.h.

- + +

◆ pstrUsageMPX

+
@@ -8440,11 +9360,13 @@ Variables
-

Definition at line 525 of file hidusagestr.h.

+

Definition at line 525 of file hidusagestr.h.

- + +

◆ pstrUsageVolumeIncrement

+
@@ -8454,11 +9376,13 @@ Variables
-

Definition at line 526 of file hidusagestr.h.

+

Definition at line 526 of file hidusagestr.h.

- + +

◆ pstrUsageVolumeDecrement

+
@@ -8468,11 +9392,13 @@ Variables
-

Definition at line 527 of file hidusagestr.h.

+

Definition at line 527 of file hidusagestr.h.

- + +

◆ pstrUsageSpeedSelect

+
@@ -8482,11 +9408,13 @@ Variables
-

Definition at line 528 of file hidusagestr.h.

+

Definition at line 528 of file hidusagestr.h.

- + +

◆ pstrUsagePlaybackSpeed

+
@@ -8496,11 +9424,13 @@ Variables
-

Definition at line 529 of file hidusagestr.h.

+

Definition at line 529 of file hidusagestr.h.

- + +

◆ pstrUsageStandardPlay

+
@@ -8510,11 +9440,13 @@ Variables
-

Definition at line 530 of file hidusagestr.h.

+

Definition at line 530 of file hidusagestr.h.

- + +

◆ pstrUsageLongPlay

+
@@ -8524,11 +9456,13 @@ Variables
-

Definition at line 531 of file hidusagestr.h.

+

Definition at line 531 of file hidusagestr.h.

- + +

◆ pstrUsageExtendedPlay

+
@@ -8538,11 +9472,13 @@ Variables
-

Definition at line 532 of file hidusagestr.h.

+

Definition at line 532 of file hidusagestr.h.

- + +

◆ pstrUsageSlow

+
@@ -8552,11 +9488,13 @@ Variables
-

Definition at line 533 of file hidusagestr.h.

+

Definition at line 533 of file hidusagestr.h.

- + +

◆ pstrUsageFanEnable

+
@@ -8566,11 +9504,13 @@ Variables
-

Definition at line 534 of file hidusagestr.h.

+

Definition at line 534 of file hidusagestr.h.

- + +

◆ pstrUsageFanSpeed

+
@@ -8580,11 +9520,13 @@ Variables
-

Definition at line 535 of file hidusagestr.h.

+

Definition at line 535 of file hidusagestr.h.

- + +

◆ pstrUsageLightEnable

+
@@ -8594,11 +9536,13 @@ Variables
-

Definition at line 536 of file hidusagestr.h.

+

Definition at line 536 of file hidusagestr.h.

- + +

◆ pstrUsageLightIlluminationLevel

+
@@ -8608,11 +9552,13 @@ Variables
-

Definition at line 537 of file hidusagestr.h.

+

Definition at line 537 of file hidusagestr.h.

- + +

◆ pstrUsageClimateControlEnable

+
@@ -8622,11 +9568,13 @@ Variables
-

Definition at line 538 of file hidusagestr.h.

+

Definition at line 538 of file hidusagestr.h.

- + +

◆ pstrUsageRoomTemperature

+
@@ -8636,11 +9584,13 @@ Variables
-

Definition at line 539 of file hidusagestr.h.

+

Definition at line 539 of file hidusagestr.h.

- + +

◆ pstrUsageSecurityEnable

+
@@ -8650,11 +9600,13 @@ Variables
-

Definition at line 540 of file hidusagestr.h.

+

Definition at line 540 of file hidusagestr.h.

- + +

◆ pstrUsageFireAlarm

+
@@ -8664,11 +9616,13 @@ Variables
-

Definition at line 541 of file hidusagestr.h.

+

Definition at line 541 of file hidusagestr.h.

- + +

◆ pstrUsagePoliceAlarm

+
@@ -8678,11 +9632,13 @@ Variables
-

Definition at line 542 of file hidusagestr.h.

+

Definition at line 542 of file hidusagestr.h.

- + +

◆ pstrUsageProximity

+
@@ -8692,11 +9648,13 @@ Variables
-

Definition at line 543 of file hidusagestr.h.

+

Definition at line 543 of file hidusagestr.h.

- + +

◆ pstrUsageMotion

+
@@ -8706,11 +9664,13 @@ Variables
-

Definition at line 544 of file hidusagestr.h.

+

Definition at line 544 of file hidusagestr.h.

- + +

◆ pstrUsageDuresAlarm

+
@@ -8720,11 +9680,13 @@ Variables
-

Definition at line 545 of file hidusagestr.h.

+

Definition at line 545 of file hidusagestr.h.

- + +

◆ pstrUsageHoldupAlarm

+
@@ -8734,11 +9696,13 @@ Variables
-

Definition at line 546 of file hidusagestr.h.

+

Definition at line 546 of file hidusagestr.h.

- + +

◆ pstrUsageMedicalAlarm

+
@@ -8748,11 +9712,13 @@ Variables
-

Definition at line 547 of file hidusagestr.h.

+

Definition at line 547 of file hidusagestr.h.

- + +

◆ pstrUsageBalanceRight

+
@@ -8762,11 +9728,13 @@ Variables
-

Definition at line 548 of file hidusagestr.h.

+

Definition at line 548 of file hidusagestr.h.

- + +

◆ pstrUsageBalanceLeft

+
@@ -8776,11 +9744,13 @@ Variables
-

Definition at line 549 of file hidusagestr.h.

+

Definition at line 549 of file hidusagestr.h.

- + +

◆ pstrUsageBassIncrement

+
@@ -8790,11 +9760,13 @@ Variables
-

Definition at line 550 of file hidusagestr.h.

+

Definition at line 550 of file hidusagestr.h.

- + +

◆ pstrUsageBassDecrement

+
@@ -8804,11 +9776,13 @@ Variables
-

Definition at line 551 of file hidusagestr.h.

+

Definition at line 551 of file hidusagestr.h.

- + +

◆ pstrUsageTrebleIncrement

+
@@ -8818,11 +9792,13 @@ Variables
-

Definition at line 552 of file hidusagestr.h.

+

Definition at line 552 of file hidusagestr.h.

- + +

◆ pstrUsageTrebleDecrement

+
@@ -8832,11 +9808,13 @@ Variables
-

Definition at line 553 of file hidusagestr.h.

+

Definition at line 553 of file hidusagestr.h.

- + +

◆ pstrUsageSpeakerSystem

+
@@ -8846,11 +9824,13 @@ Variables
-

Definition at line 554 of file hidusagestr.h.

+

Definition at line 554 of file hidusagestr.h.

- + +

◆ pstrUsageChannelLeft

+
@@ -8860,11 +9840,13 @@ Variables
-

Definition at line 555 of file hidusagestr.h.

+

Definition at line 555 of file hidusagestr.h.

- + +

◆ pstrUsageChannelRight

+
@@ -8874,11 +9856,13 @@ Variables
-

Definition at line 556 of file hidusagestr.h.

+

Definition at line 556 of file hidusagestr.h.

- + +

◆ pstrUsageChannelCenter

+
@@ -8888,11 +9872,13 @@ Variables
-

Definition at line 557 of file hidusagestr.h.

+

Definition at line 557 of file hidusagestr.h.

- + +

◆ pstrUsageChannelFront

+
@@ -8902,11 +9888,13 @@ Variables
-

Definition at line 558 of file hidusagestr.h.

+

Definition at line 558 of file hidusagestr.h.

- + +

◆ pstrUsageChannelCenterFront

+
@@ -8916,11 +9904,13 @@ Variables
-

Definition at line 559 of file hidusagestr.h.

+

Definition at line 559 of file hidusagestr.h.

- + +

◆ pstrUsageChannelSide

+
@@ -8930,11 +9920,13 @@ Variables
-

Definition at line 560 of file hidusagestr.h.

+

Definition at line 560 of file hidusagestr.h.

- + +

◆ pstrUsageChannelSurround

+
@@ -8944,11 +9936,13 @@ Variables
-

Definition at line 561 of file hidusagestr.h.

+

Definition at line 561 of file hidusagestr.h.

- + +

◆ pstrUsageChannelLowFreqEnhancement

+
@@ -8958,11 +9952,13 @@ Variables
-

Definition at line 562 of file hidusagestr.h.

+

Definition at line 562 of file hidusagestr.h.

- + +

◆ pstrUsageChannelTop

+
@@ -8972,11 +9968,13 @@ Variables
-

Definition at line 563 of file hidusagestr.h.

+

Definition at line 563 of file hidusagestr.h.

- + +

◆ pstrUsageChannelUnknown

+
@@ -8986,11 +9984,13 @@ Variables
-

Definition at line 564 of file hidusagestr.h.

+

Definition at line 564 of file hidusagestr.h.

- + +

◆ pstrUsageSubChannel

+
@@ -9000,11 +10000,13 @@ Variables
-

Definition at line 565 of file hidusagestr.h.

+

Definition at line 565 of file hidusagestr.h.

- + +

◆ pstrUsageSubChannelIncrement

+
@@ -9014,11 +10016,13 @@ Variables
-

Definition at line 566 of file hidusagestr.h.

+

Definition at line 566 of file hidusagestr.h.

- + +

◆ pstrUsageSubChannelDecrement

+
@@ -9028,11 +10032,13 @@ Variables
-

Definition at line 567 of file hidusagestr.h.

+

Definition at line 567 of file hidusagestr.h.

- + +

◆ pstrUsageAlternateAudioIncrement

+
@@ -9042,11 +10048,13 @@ Variables
-

Definition at line 568 of file hidusagestr.h.

+

Definition at line 568 of file hidusagestr.h.

- + +

◆ pstrUsageAlternateAudioDecrement

+
@@ -9056,11 +10064,13 @@ Variables
-

Definition at line 569 of file hidusagestr.h.

+

Definition at line 569 of file hidusagestr.h.

- + +

◆ pstrUsageApplicationLaunchButtons

+
@@ -9070,11 +10080,13 @@ Variables
-

Definition at line 570 of file hidusagestr.h.

+

Definition at line 570 of file hidusagestr.h.

- + +

◆ pstrUsageALLaunchButtonConfigTool

+
@@ -9084,11 +10096,13 @@ Variables
-

Definition at line 571 of file hidusagestr.h.

+

Definition at line 571 of file hidusagestr.h.

- + +

◆ pstrUsageALProgrammableButton

+
@@ -9098,11 +10112,13 @@ Variables
-

Definition at line 572 of file hidusagestr.h.

+

Definition at line 572 of file hidusagestr.h.

- + +

◆ pstrUsageALConsumerControlConfig

+
@@ -9112,11 +10128,13 @@ Variables
-

Definition at line 573 of file hidusagestr.h.

+

Definition at line 573 of file hidusagestr.h.

- + +

◆ pstrUsageALWordProcessor

+
@@ -9126,11 +10144,13 @@ Variables
-

Definition at line 574 of file hidusagestr.h.

+

Definition at line 574 of file hidusagestr.h.

- + +

◆ pstrUsageALTextEditor

+
@@ -9140,11 +10160,13 @@ Variables
-

Definition at line 575 of file hidusagestr.h.

+

Definition at line 575 of file hidusagestr.h.

- + +

◆ pstrUsageALSpreadsheet

+
@@ -9154,11 +10176,13 @@ Variables
-

Definition at line 576 of file hidusagestr.h.

+

Definition at line 576 of file hidusagestr.h.

- + +

◆ pstrUsageALGraphicsEditor

+
@@ -9168,11 +10192,13 @@ Variables
-

Definition at line 577 of file hidusagestr.h.

+

Definition at line 577 of file hidusagestr.h.

- + +

◆ pstrUsageALPresentationApp

+
@@ -9182,11 +10208,13 @@ Variables
-

Definition at line 578 of file hidusagestr.h.

+

Definition at line 578 of file hidusagestr.h.

- + +

◆ pstrUsageALDatabaseApp

+
@@ -9196,11 +10224,13 @@ Variables
-

Definition at line 579 of file hidusagestr.h.

+

Definition at line 579 of file hidusagestr.h.

- + +

◆ pstrUsageALEmailReader

+
@@ -9210,11 +10240,13 @@ Variables
-

Definition at line 580 of file hidusagestr.h.

+

Definition at line 580 of file hidusagestr.h.

- + +

◆ pstrUsageALNewsreader

+
@@ -9224,11 +10256,13 @@ Variables
-

Definition at line 581 of file hidusagestr.h.

+

Definition at line 581 of file hidusagestr.h.

- + +

◆ pstrUsageALVoicemail

+
@@ -9238,11 +10272,13 @@ Variables
-

Definition at line 582 of file hidusagestr.h.

+

Definition at line 582 of file hidusagestr.h.

- + +

◆ pstrUsageALContactsAddressBook

+
@@ -9252,11 +10288,13 @@ Variables
-

Definition at line 583 of file hidusagestr.h.

+

Definition at line 583 of file hidusagestr.h.

- + +

◆ pstrUsageALCalendarSchedule

+
@@ -9266,11 +10304,13 @@ Variables
-

Definition at line 584 of file hidusagestr.h.

+

Definition at line 584 of file hidusagestr.h.

- + +

◆ pstrUsageALTaskProjectManager

+
@@ -9280,11 +10320,13 @@ Variables
-

Definition at line 585 of file hidusagestr.h.

+

Definition at line 585 of file hidusagestr.h.

- + +

◆ pstrUsageALLogJournalTimecard

+
@@ -9294,11 +10336,13 @@ Variables
-

Definition at line 586 of file hidusagestr.h.

+

Definition at line 586 of file hidusagestr.h.

- + +

◆ pstrUsageALCheckbookFinance

+
@@ -9308,11 +10352,13 @@ Variables
-

Definition at line 587 of file hidusagestr.h.

+

Definition at line 587 of file hidusagestr.h.

- + +

◆ pstrUsageALCalculator

+
@@ -9322,11 +10368,13 @@ Variables
-

Definition at line 588 of file hidusagestr.h.

+

Definition at line 588 of file hidusagestr.h.

- + +

◆ pstrUsageALAVCapturePlayback

+
@@ -9336,11 +10384,13 @@ Variables
-

Definition at line 589 of file hidusagestr.h.

+

Definition at line 589 of file hidusagestr.h.

- + +

◆ pstrUsageALLocalMachineBrowser

+
@@ -9350,11 +10400,13 @@ Variables
-

Definition at line 590 of file hidusagestr.h.

+

Definition at line 590 of file hidusagestr.h.

- + +

◆ pstrUsageALLANWANBrow

+
@@ -9364,11 +10416,13 @@ Variables
-

Definition at line 591 of file hidusagestr.h.

+

Definition at line 591 of file hidusagestr.h.

- + +

◆ pstrUsageALInternetBrowser

+
@@ -9378,11 +10432,13 @@ Variables
-

Definition at line 592 of file hidusagestr.h.

+

Definition at line 592 of file hidusagestr.h.

- + +

◆ pstrUsageALRemoteNetISPConnect

+
@@ -9392,11 +10448,13 @@ Variables
-

Definition at line 593 of file hidusagestr.h.

+

Definition at line 593 of file hidusagestr.h.

- + +

◆ pstrUsageALNetworkConference

+
@@ -9406,11 +10464,13 @@ Variables
-

Definition at line 594 of file hidusagestr.h.

+

Definition at line 594 of file hidusagestr.h.

- + +

◆ pstrUsageALNetworkChat

+
@@ -9420,11 +10480,13 @@ Variables
-

Definition at line 595 of file hidusagestr.h.

+

Definition at line 595 of file hidusagestr.h.

- + +

◆ pstrUsageALTelephonyDialer

+
@@ -9434,11 +10496,13 @@ Variables
-

Definition at line 596 of file hidusagestr.h.

+

Definition at line 596 of file hidusagestr.h.

- + +

◆ pstrUsageALLogon

+
@@ -9448,11 +10512,13 @@ Variables
-

Definition at line 597 of file hidusagestr.h.

+

Definition at line 597 of file hidusagestr.h.

- + +

◆ pstrUsageALLogoff

+
@@ -9462,11 +10528,13 @@ Variables
-

Definition at line 598 of file hidusagestr.h.

+

Definition at line 598 of file hidusagestr.h.

- + +

◆ pstrUsageALLogonLogoff

+
@@ -9476,11 +10544,13 @@ Variables
-

Definition at line 599 of file hidusagestr.h.

+

Definition at line 599 of file hidusagestr.h.

- + +

◆ pstrUsageALTermLockScrSav

+
@@ -9490,11 +10560,13 @@ Variables
-

Definition at line 600 of file hidusagestr.h.

+

Definition at line 600 of file hidusagestr.h.

- + +

◆ pstrUsageALControlPannel

+
@@ -9504,11 +10576,13 @@ Variables
-

Definition at line 601 of file hidusagestr.h.

+

Definition at line 601 of file hidusagestr.h.

- + +

◆ pstrUsageALCommandLineProcessorRun

+
@@ -9518,11 +10592,13 @@ Variables
-

Definition at line 602 of file hidusagestr.h.

+

Definition at line 602 of file hidusagestr.h.

- + +

◆ pstrUsageALProcessTaskManager

+
@@ -9532,11 +10608,13 @@ Variables
-

Definition at line 603 of file hidusagestr.h.

+

Definition at line 603 of file hidusagestr.h.

- + +

◆ pstrUsageALSelectTaskApplication

+
@@ -9546,11 +10624,13 @@ Variables
-

Definition at line 604 of file hidusagestr.h.

+

Definition at line 604 of file hidusagestr.h.

- + +

◆ pstrUsageALNextTaskApplication

+
@@ -9560,11 +10640,13 @@ Variables
-

Definition at line 605 of file hidusagestr.h.

+

Definition at line 605 of file hidusagestr.h.

- + +

◆ pstrUsageALPreviousTaskApplication

+
@@ -9574,11 +10656,13 @@ Variables
-

Definition at line 606 of file hidusagestr.h.

+

Definition at line 606 of file hidusagestr.h.

- + +

◆ pstrUsageALPreemptiveHaltTaskApp

+
@@ -9588,11 +10672,13 @@ Variables
-

Definition at line 607 of file hidusagestr.h.

+

Definition at line 607 of file hidusagestr.h.

- + +

◆ pstrUsageALIntegratedHelpCenter

+
@@ -9602,11 +10688,13 @@ Variables
-

Definition at line 608 of file hidusagestr.h.

+

Definition at line 608 of file hidusagestr.h.

- + +

◆ pstrUsageALDocuments

+
@@ -9616,11 +10704,13 @@ Variables
-

Definition at line 609 of file hidusagestr.h.

+

Definition at line 609 of file hidusagestr.h.

- + +

◆ pstrUsageALThesaurus

+
@@ -9630,11 +10720,13 @@ Variables
-

Definition at line 610 of file hidusagestr.h.

+

Definition at line 610 of file hidusagestr.h.

- + +

◆ pstrUsageALDictionary

+
@@ -9644,11 +10736,13 @@ Variables
-

Definition at line 611 of file hidusagestr.h.

+

Definition at line 611 of file hidusagestr.h.

- + +

◆ pstrUsageALDesktop

+
@@ -9658,11 +10752,13 @@ Variables
-

Definition at line 612 of file hidusagestr.h.

+

Definition at line 612 of file hidusagestr.h.

- + +

◆ pstrUsageALSpellCheck

+
@@ -9672,11 +10768,13 @@ Variables
-

Definition at line 613 of file hidusagestr.h.

+

Definition at line 613 of file hidusagestr.h.

- + +

◆ pstrUsageALGrammarCheck

+
@@ -9686,11 +10784,13 @@ Variables
-

Definition at line 614 of file hidusagestr.h.

+

Definition at line 614 of file hidusagestr.h.

- + +

◆ pstrUsageALWirelessStatus

+
@@ -9700,11 +10800,13 @@ Variables
-

Definition at line 615 of file hidusagestr.h.

+

Definition at line 615 of file hidusagestr.h.

- + +

◆ pstrUsageALKeyboardLayout

+
@@ -9714,11 +10816,13 @@ Variables
-

Definition at line 616 of file hidusagestr.h.

+

Definition at line 616 of file hidusagestr.h.

- + +

◆ pstrUsageALVirusProtection

+
@@ -9728,11 +10832,13 @@ Variables
-

Definition at line 617 of file hidusagestr.h.

+

Definition at line 617 of file hidusagestr.h.

- + +

◆ pstrUsageALEncryption

+
@@ -9742,11 +10848,13 @@ Variables
-

Definition at line 618 of file hidusagestr.h.

+

Definition at line 618 of file hidusagestr.h.

- + +

◆ pstrUsageALScreenSaver

+
@@ -9756,11 +10864,13 @@ Variables
-

Definition at line 619 of file hidusagestr.h.

+

Definition at line 619 of file hidusagestr.h.

- + +

◆ pstrUsageALAlarms

+
@@ -9770,11 +10880,13 @@ Variables
-

Definition at line 620 of file hidusagestr.h.

+

Definition at line 620 of file hidusagestr.h.

- + +

◆ pstrUsageALClock

+
@@ -9784,11 +10896,13 @@ Variables
-

Definition at line 621 of file hidusagestr.h.

+

Definition at line 621 of file hidusagestr.h.

- + +

◆ pstrUsageALFileBrowser

+
@@ -9798,11 +10912,13 @@ Variables
-

Definition at line 622 of file hidusagestr.h.

+

Definition at line 622 of file hidusagestr.h.

- + +

◆ pstrUsageALPowerStatus

+
@@ -9812,11 +10928,13 @@ Variables
-

Definition at line 623 of file hidusagestr.h.

+

Definition at line 623 of file hidusagestr.h.

- + +

◆ pstrUsageALImageBrowser

+
@@ -9826,11 +10944,13 @@ Variables
-

Definition at line 624 of file hidusagestr.h.

+

Definition at line 624 of file hidusagestr.h.

- + +

◆ pstrUsageALAudioBrowser

+
@@ -9840,11 +10960,13 @@ Variables
-

Definition at line 625 of file hidusagestr.h.

+

Definition at line 625 of file hidusagestr.h.

- + +

◆ pstrUsageALMovieBrowser

+
@@ -9854,11 +10976,13 @@ Variables
-

Definition at line 626 of file hidusagestr.h.

+

Definition at line 626 of file hidusagestr.h.

- + +

◆ pstrUsageALDigitalRightsManager

+
@@ -9868,11 +10992,13 @@ Variables
-

Definition at line 627 of file hidusagestr.h.

+

Definition at line 627 of file hidusagestr.h.

- + +

◆ pstrUsageALDigitalWallet

+
@@ -9882,11 +11008,13 @@ Variables
-

Definition at line 628 of file hidusagestr.h.

+

Definition at line 628 of file hidusagestr.h.

- + +

◆ pstrUsageALInstantMessaging

+
@@ -9896,11 +11024,13 @@ Variables
-

Definition at line 629 of file hidusagestr.h.

+

Definition at line 629 of file hidusagestr.h.

- + +

◆ pstrUsageALOEMFeaturesBrowser

+
@@ -9910,11 +11040,13 @@ Variables
-

Definition at line 630 of file hidusagestr.h.

+

Definition at line 630 of file hidusagestr.h.

- + +

◆ pstrUsageALOEMHelp

+
@@ -9924,11 +11056,13 @@ Variables
-

Definition at line 631 of file hidusagestr.h.

+

Definition at line 631 of file hidusagestr.h.

- + +

◆ pstrUsageALOnlineCommunity

+
@@ -9938,11 +11072,13 @@ Variables
-

Definition at line 632 of file hidusagestr.h.

+

Definition at line 632 of file hidusagestr.h.

- + +

◆ pstrUsageALEntertainmentContentBrow

+
@@ -9952,11 +11088,13 @@ Variables
-

Definition at line 633 of file hidusagestr.h.

+

Definition at line 633 of file hidusagestr.h.

- + +

◆ pstrUsageALOnlineShoppingBrowser

+
@@ -9966,11 +11104,13 @@ Variables
-

Definition at line 634 of file hidusagestr.h.

+

Definition at line 634 of file hidusagestr.h.

- + +

◆ pstrUsageALSmartCardInfoHelp

+
@@ -9980,11 +11120,13 @@ Variables
-

Definition at line 635 of file hidusagestr.h.

+

Definition at line 635 of file hidusagestr.h.

- + +

◆ pstrUsageALMarketMonitorFinBrowser

+
@@ -9994,11 +11136,13 @@ Variables
-

Definition at line 636 of file hidusagestr.h.

+

Definition at line 636 of file hidusagestr.h.

- + +

◆ pstrUsageALCustomCorpNewsBrowser

+
@@ -10008,11 +11152,13 @@ Variables
-

Definition at line 637 of file hidusagestr.h.

+

Definition at line 637 of file hidusagestr.h.

- + +

◆ pstrUsageALOnlineActivityBrowser

+
@@ -10022,11 +11168,13 @@ Variables
-

Definition at line 638 of file hidusagestr.h.

+

Definition at line 638 of file hidusagestr.h.

- + +

◆ pstrUsageALResearchSearchBrowser

+
@@ -10036,11 +11184,13 @@ Variables
-

Definition at line 639 of file hidusagestr.h.

+

Definition at line 639 of file hidusagestr.h.

- + +

◆ pstrUsageALAudioPlayer

+
@@ -10050,11 +11200,13 @@ Variables
-

Definition at line 640 of file hidusagestr.h.

+

Definition at line 640 of file hidusagestr.h.

- + +

◆ pstrUsageGenericGUIAppControls

+
@@ -10064,11 +11216,13 @@ Variables
-

Definition at line 641 of file hidusagestr.h.

+

Definition at line 641 of file hidusagestr.h.

- + +

◆ pstrUsageACNew

+
@@ -10078,11 +11232,13 @@ Variables
-

Definition at line 642 of file hidusagestr.h.

+

Definition at line 642 of file hidusagestr.h.

- + +

◆ pstrUsageACOpen

+
@@ -10092,11 +11248,13 @@ Variables
-

Definition at line 643 of file hidusagestr.h.

+

Definition at line 643 of file hidusagestr.h.

- + +

◆ pstrUsageACClose

+
@@ -10106,11 +11264,13 @@ Variables
-

Definition at line 644 of file hidusagestr.h.

+

Definition at line 644 of file hidusagestr.h.

- + +

◆ pstrUsageACExit

+
@@ -10120,11 +11280,13 @@ Variables
-

Definition at line 645 of file hidusagestr.h.

+

Definition at line 645 of file hidusagestr.h.

- + +

◆ pstrUsageACMaximize

+
@@ -10134,11 +11296,13 @@ Variables
-

Definition at line 646 of file hidusagestr.h.

+

Definition at line 646 of file hidusagestr.h.

- + +

◆ pstrUsageACMinimize

+
@@ -10148,11 +11312,13 @@ Variables
-

Definition at line 647 of file hidusagestr.h.

+

Definition at line 647 of file hidusagestr.h.

- + +

◆ pstrUsageACSave

+
@@ -10162,11 +11328,13 @@ Variables
-

Definition at line 648 of file hidusagestr.h.

+

Definition at line 648 of file hidusagestr.h.

- + +

◆ pstrUsageACPrint

+
@@ -10176,11 +11344,13 @@ Variables
-

Definition at line 649 of file hidusagestr.h.

+

Definition at line 649 of file hidusagestr.h.

- + +

◆ pstrUsageACProperties

+
@@ -10190,11 +11360,13 @@ Variables
-

Definition at line 650 of file hidusagestr.h.

+

Definition at line 650 of file hidusagestr.h.

- + +

◆ pstrUsageACUndo

+
@@ -10204,11 +11376,13 @@ Variables
-

Definition at line 651 of file hidusagestr.h.

+

Definition at line 651 of file hidusagestr.h.

- + +

◆ pstrUsageACCopy

+
@@ -10218,11 +11392,13 @@ Variables
-

Definition at line 652 of file hidusagestr.h.

+

Definition at line 652 of file hidusagestr.h.

- + +

◆ pstrUsageACCut

+
@@ -10232,11 +11408,13 @@ Variables
-

Definition at line 653 of file hidusagestr.h.

+

Definition at line 653 of file hidusagestr.h.

- + +

◆ pstrUsageACPaste

+
@@ -10246,11 +11424,13 @@ Variables
-

Definition at line 654 of file hidusagestr.h.

+

Definition at line 654 of file hidusagestr.h.

- + +

◆ pstrUsageACSelectAll

+
@@ -10260,11 +11440,13 @@ Variables
-

Definition at line 655 of file hidusagestr.h.

+

Definition at line 655 of file hidusagestr.h.

- + +

◆ pstrUsageACFind

+
@@ -10274,11 +11456,13 @@ Variables
-

Definition at line 656 of file hidusagestr.h.

+

Definition at line 656 of file hidusagestr.h.

- + +

◆ pstrUsageACFindAndReplace

+
@@ -10288,11 +11472,13 @@ Variables
-

Definition at line 657 of file hidusagestr.h.

+

Definition at line 657 of file hidusagestr.h.

- + +

◆ pstrUsageACSearch

+
@@ -10302,11 +11488,13 @@ Variables
-

Definition at line 658 of file hidusagestr.h.

+

Definition at line 658 of file hidusagestr.h.

- + +

◆ pstrUsageACGoto

+
@@ -10316,11 +11504,13 @@ Variables
-

Definition at line 659 of file hidusagestr.h.

+

Definition at line 659 of file hidusagestr.h.

- + +

◆ pstrUsageACHome

+
@@ -10330,11 +11520,13 @@ Variables
-

Definition at line 660 of file hidusagestr.h.

+

Definition at line 660 of file hidusagestr.h.

- + +

◆ pstrUsageACBack

+
@@ -10344,11 +11536,13 @@ Variables
-

Definition at line 661 of file hidusagestr.h.

+

Definition at line 661 of file hidusagestr.h.

- + +

◆ pstrUsageACForward

+
@@ -10358,11 +11552,13 @@ Variables
-

Definition at line 662 of file hidusagestr.h.

+

Definition at line 662 of file hidusagestr.h.

- + +

◆ pstrUsageACStop

+
@@ -10372,11 +11568,13 @@ Variables
-

Definition at line 663 of file hidusagestr.h.

+

Definition at line 663 of file hidusagestr.h.

- + +

◆ pstrUsageACRefresh

+
@@ -10386,11 +11584,13 @@ Variables
-

Definition at line 664 of file hidusagestr.h.

+

Definition at line 664 of file hidusagestr.h.

- + +

◆ pstrUsageACPreviousLink

+
@@ -10400,11 +11600,13 @@ Variables
-

Definition at line 665 of file hidusagestr.h.

+

Definition at line 665 of file hidusagestr.h.

- + +

◆ pstrUsageACNextLink

+
@@ -10414,11 +11616,13 @@ Variables
-

Definition at line 666 of file hidusagestr.h.

+

Definition at line 666 of file hidusagestr.h.

- + +

◆ pstrUsageACBookmarks

+
@@ -10428,11 +11632,13 @@ Variables
-

Definition at line 667 of file hidusagestr.h.

+

Definition at line 667 of file hidusagestr.h.

- + +

◆ pstrUsageACHistory

+
@@ -10442,11 +11648,13 @@ Variables
-

Definition at line 668 of file hidusagestr.h.

+

Definition at line 668 of file hidusagestr.h.

- + +

◆ pstrUsageACSubscriptions

+
@@ -10456,11 +11664,13 @@ Variables
-

Definition at line 669 of file hidusagestr.h.

+

Definition at line 669 of file hidusagestr.h.

- + +

◆ pstrUsageACZoomIn

+
@@ -10470,11 +11680,13 @@ Variables
-

Definition at line 670 of file hidusagestr.h.

+

Definition at line 670 of file hidusagestr.h.

- + +

◆ pstrUsageACZoomOut

+
@@ -10484,11 +11696,13 @@ Variables
-

Definition at line 671 of file hidusagestr.h.

+

Definition at line 671 of file hidusagestr.h.

- + +

◆ pstrUsageACZoom

+
@@ -10498,11 +11712,13 @@ Variables
-

Definition at line 672 of file hidusagestr.h.

+

Definition at line 672 of file hidusagestr.h.

- + +

◆ pstrUsageACFullScreenView

+
@@ -10512,11 +11728,13 @@ Variables
-

Definition at line 673 of file hidusagestr.h.

+

Definition at line 673 of file hidusagestr.h.

- + +

◆ pstrUsageACNormalView

+
@@ -10526,11 +11744,13 @@ Variables
-

Definition at line 674 of file hidusagestr.h.

+

Definition at line 674 of file hidusagestr.h.

- + +

◆ pstrUsageACViewToggle

+
@@ -10540,11 +11760,13 @@ Variables
-

Definition at line 675 of file hidusagestr.h.

+

Definition at line 675 of file hidusagestr.h.

- + +

◆ pstrUsageACScrollUp

+
@@ -10554,11 +11776,13 @@ Variables
-

Definition at line 676 of file hidusagestr.h.

+

Definition at line 676 of file hidusagestr.h.

- + +

◆ pstrUsageACScrollDown

+
@@ -10568,11 +11792,13 @@ Variables
-

Definition at line 677 of file hidusagestr.h.

+

Definition at line 677 of file hidusagestr.h.

- + +

◆ pstrUsageACScroll

+
@@ -10582,11 +11808,13 @@ Variables
-

Definition at line 678 of file hidusagestr.h.

+

Definition at line 678 of file hidusagestr.h.

- + +

◆ pstrUsageACPanLeft

+
@@ -10596,11 +11824,13 @@ Variables
-

Definition at line 679 of file hidusagestr.h.

+

Definition at line 679 of file hidusagestr.h.

- + +

◆ pstrUsageACPanRight

+
@@ -10610,11 +11840,13 @@ Variables
-

Definition at line 680 of file hidusagestr.h.

+

Definition at line 680 of file hidusagestr.h.

- + +

◆ pstrUsageACPan

+
@@ -10624,11 +11856,13 @@ Variables
-

Definition at line 681 of file hidusagestr.h.

+

Definition at line 681 of file hidusagestr.h.

- + +

◆ pstrUsageACNewWindow

+
@@ -10638,11 +11872,13 @@ Variables
-

Definition at line 682 of file hidusagestr.h.

+

Definition at line 682 of file hidusagestr.h.

- + +

◆ pstrUsageACTileHoriz

+
@@ -10652,11 +11888,13 @@ Variables
-

Definition at line 683 of file hidusagestr.h.

+

Definition at line 683 of file hidusagestr.h.

- + +

◆ pstrUsageACTileVert

+
@@ -10666,11 +11904,13 @@ Variables
-

Definition at line 684 of file hidusagestr.h.

+

Definition at line 684 of file hidusagestr.h.

- + +

◆ pstrUsageACFormat

+
@@ -10680,11 +11920,13 @@ Variables
-

Definition at line 685 of file hidusagestr.h.

+

Definition at line 685 of file hidusagestr.h.

- + +

◆ pstrUsageACEdit

+
@@ -10694,11 +11936,13 @@ Variables
-

Definition at line 686 of file hidusagestr.h.

+

Definition at line 686 of file hidusagestr.h.

- + +

◆ pstrUsageACBold

+
@@ -10708,11 +11952,13 @@ Variables
-

Definition at line 687 of file hidusagestr.h.

+

Definition at line 687 of file hidusagestr.h.

- + +

◆ pstrUsageACItalics

+
@@ -10722,11 +11968,13 @@ Variables
-

Definition at line 688 of file hidusagestr.h.

+

Definition at line 688 of file hidusagestr.h.

- + +

◆ pstrUsageACUnderline

+
@@ -10736,11 +11984,13 @@ Variables
-

Definition at line 689 of file hidusagestr.h.

+

Definition at line 689 of file hidusagestr.h.

- + +

◆ pstrUsageACStrikethrough

+
@@ -10750,11 +12000,13 @@ Variables
-

Definition at line 690 of file hidusagestr.h.

+

Definition at line 690 of file hidusagestr.h.

- + +

◆ pstrUsageACSubscript

+
@@ -10764,11 +12016,13 @@ Variables
-

Definition at line 691 of file hidusagestr.h.

+

Definition at line 691 of file hidusagestr.h.

- + +

◆ pstrUsageACSuperscript

+
@@ -10778,11 +12032,13 @@ Variables
-

Definition at line 692 of file hidusagestr.h.

+

Definition at line 692 of file hidusagestr.h.

- + +

◆ pstrUsageACAllCaps

+
@@ -10792,11 +12048,13 @@ Variables
-

Definition at line 693 of file hidusagestr.h.

+

Definition at line 693 of file hidusagestr.h.

- + +

◆ pstrUsageACRotate

+
@@ -10806,11 +12064,13 @@ Variables
-

Definition at line 694 of file hidusagestr.h.

+

Definition at line 694 of file hidusagestr.h.

- + +

◆ pstrUsageACResize

+
@@ -10820,11 +12080,13 @@ Variables
-

Definition at line 695 of file hidusagestr.h.

+

Definition at line 695 of file hidusagestr.h.

- + +

◆ pstrUsageACFlipHorizontal

+
@@ -10834,11 +12096,13 @@ Variables
-

Definition at line 696 of file hidusagestr.h.

+

Definition at line 696 of file hidusagestr.h.

- + +

◆ pstrUsageACFlipVertical

+
@@ -10848,11 +12112,13 @@ Variables
-

Definition at line 697 of file hidusagestr.h.

+

Definition at line 697 of file hidusagestr.h.

- + +

◆ pstrUsageACMirrorHorizontal

+
@@ -10862,11 +12128,13 @@ Variables
-

Definition at line 698 of file hidusagestr.h.

+

Definition at line 698 of file hidusagestr.h.

- + +

◆ pstrUsageACMirrorVertical

+
@@ -10876,11 +12144,13 @@ Variables
-

Definition at line 699 of file hidusagestr.h.

+

Definition at line 699 of file hidusagestr.h.

- + +

◆ pstrUsageACFontSelect

+
@@ -10890,11 +12160,13 @@ Variables
-

Definition at line 700 of file hidusagestr.h.

+

Definition at line 700 of file hidusagestr.h.

- + +

◆ pstrUsageACFontColor

+
@@ -10904,11 +12176,13 @@ Variables
-

Definition at line 701 of file hidusagestr.h.

+

Definition at line 701 of file hidusagestr.h.

- + +

◆ pstrUsageACFontSize

+
@@ -10918,11 +12192,13 @@ Variables
-

Definition at line 702 of file hidusagestr.h.

+

Definition at line 702 of file hidusagestr.h.

- + +

◆ pstrUsageACJustifyLeft

+
@@ -10932,11 +12208,13 @@ Variables
-

Definition at line 703 of file hidusagestr.h.

+

Definition at line 703 of file hidusagestr.h.

- + +

◆ pstrUsageACJustifyCenterH

+
@@ -10946,11 +12224,13 @@ Variables
-

Definition at line 704 of file hidusagestr.h.

+

Definition at line 704 of file hidusagestr.h.

- + +

◆ pstrUsageACJustifyRight

+
@@ -10960,11 +12240,13 @@ Variables
-

Definition at line 705 of file hidusagestr.h.

+

Definition at line 705 of file hidusagestr.h.

- + +

◆ pstrUsageACJustifyBlockH

+
@@ -10974,11 +12256,13 @@ Variables
-

Definition at line 706 of file hidusagestr.h.

+

Definition at line 706 of file hidusagestr.h.

- + +

◆ pstrUsageACJustifyTop

+
@@ -10988,11 +12272,13 @@ Variables
-

Definition at line 707 of file hidusagestr.h.

+

Definition at line 707 of file hidusagestr.h.

- + +

◆ pstrUsageACJustifyCenterV

+
@@ -11002,11 +12288,13 @@ Variables
-

Definition at line 708 of file hidusagestr.h.

+

Definition at line 708 of file hidusagestr.h.

- + +

◆ pstrUsageACJustifyBottom

+
@@ -11016,11 +12304,13 @@ Variables
-

Definition at line 709 of file hidusagestr.h.

+

Definition at line 709 of file hidusagestr.h.

- + +

◆ pstrUsageACJustifyBlockV

+
@@ -11030,11 +12320,13 @@ Variables
-

Definition at line 710 of file hidusagestr.h.

+

Definition at line 710 of file hidusagestr.h.

- + +

◆ pstrUsageACIndentDecrease

+
@@ -11044,11 +12336,13 @@ Variables
-

Definition at line 711 of file hidusagestr.h.

+

Definition at line 711 of file hidusagestr.h.

- + +

◆ pstrUsageACIndentIncrease

+
@@ -11058,11 +12352,13 @@ Variables
-

Definition at line 712 of file hidusagestr.h.

+

Definition at line 712 of file hidusagestr.h.

- + +

◆ pstrUsageACNumberedList

+
@@ -11072,11 +12368,13 @@ Variables
-

Definition at line 713 of file hidusagestr.h.

+

Definition at line 713 of file hidusagestr.h.

- + +

◆ pstrUsageACRestartNumbering

+
@@ -11086,11 +12384,13 @@ Variables
-

Definition at line 714 of file hidusagestr.h.

+

Definition at line 714 of file hidusagestr.h.

- + +

◆ pstrUsageACBulletedList

+
@@ -11100,11 +12400,13 @@ Variables
-

Definition at line 715 of file hidusagestr.h.

+

Definition at line 715 of file hidusagestr.h.

- + +

◆ pstrUsageACPromote

+
@@ -11114,11 +12416,13 @@ Variables
-

Definition at line 716 of file hidusagestr.h.

+

Definition at line 716 of file hidusagestr.h.

- + +

◆ pstrUsageACDemote

+
@@ -11128,11 +12432,13 @@ Variables
-

Definition at line 717 of file hidusagestr.h.

+

Definition at line 717 of file hidusagestr.h.

- + +

◆ pstrUsageACYes

+
@@ -11142,11 +12448,13 @@ Variables
-

Definition at line 718 of file hidusagestr.h.

+

Definition at line 718 of file hidusagestr.h.

- + +

◆ pstrUsageACNo

+
@@ -11156,11 +12464,13 @@ Variables
-

Definition at line 719 of file hidusagestr.h.

+

Definition at line 719 of file hidusagestr.h.

- + +

◆ pstrUsageACCancel

+
@@ -11170,11 +12480,13 @@ Variables
-

Definition at line 720 of file hidusagestr.h.

+

Definition at line 720 of file hidusagestr.h.

- + +

◆ pstrUsageACCatalog

+
@@ -11184,11 +12496,13 @@ Variables
-

Definition at line 721 of file hidusagestr.h.

+

Definition at line 721 of file hidusagestr.h.

- + +

◆ pstrUsageACBuyChkout

+
@@ -11198,11 +12512,13 @@ Variables
-

Definition at line 722 of file hidusagestr.h.

+

Definition at line 722 of file hidusagestr.h.

- + +

◆ pstrUsageACAddToCart

+
@@ -11212,11 +12528,13 @@ Variables
-

Definition at line 723 of file hidusagestr.h.

+

Definition at line 723 of file hidusagestr.h.

- + +

◆ pstrUsageACExpand

+
@@ -11226,11 +12544,13 @@ Variables
-

Definition at line 724 of file hidusagestr.h.

+

Definition at line 724 of file hidusagestr.h.

- + +

◆ pstrUsageACExpandAll

+
@@ -11240,11 +12560,13 @@ Variables
-

Definition at line 725 of file hidusagestr.h.

+

Definition at line 725 of file hidusagestr.h.

- + +

◆ pstrUsageACCollapse

+
@@ -11254,11 +12576,13 @@ Variables
-

Definition at line 726 of file hidusagestr.h.

+

Definition at line 726 of file hidusagestr.h.

- + +

◆ pstrUsageACCollapseAll

+
@@ -11268,11 +12592,13 @@ Variables
-

Definition at line 727 of file hidusagestr.h.

+

Definition at line 727 of file hidusagestr.h.

- + +

◆ pstrUsageACPrintPreview

+
@@ -11282,11 +12608,13 @@ Variables
-

Definition at line 728 of file hidusagestr.h.

+

Definition at line 728 of file hidusagestr.h.

- + +

◆ pstrUsageACPasteSpecial

+
@@ -11296,11 +12624,13 @@ Variables
-

Definition at line 729 of file hidusagestr.h.

+

Definition at line 729 of file hidusagestr.h.

- + +

◆ pstrUsageACInsertMode

+
@@ -11310,11 +12640,13 @@ Variables
-

Definition at line 730 of file hidusagestr.h.

+

Definition at line 730 of file hidusagestr.h.

- + +

◆ pstrUsageACDelete

+
@@ -11324,11 +12656,13 @@ Variables
-

Definition at line 731 of file hidusagestr.h.

+

Definition at line 731 of file hidusagestr.h.

- + +

◆ pstrUsageACLock

+
@@ -11338,11 +12672,13 @@ Variables
-

Definition at line 732 of file hidusagestr.h.

+

Definition at line 732 of file hidusagestr.h.

- + +

◆ pstrUsageACUnlock

+
@@ -11352,11 +12688,13 @@ Variables
-

Definition at line 733 of file hidusagestr.h.

+

Definition at line 733 of file hidusagestr.h.

- + +

◆ pstrUsageACProtect

+
@@ -11366,11 +12704,13 @@ Variables
-

Definition at line 734 of file hidusagestr.h.

+

Definition at line 734 of file hidusagestr.h.

- + +

◆ pstrUsageACUnprotect

+
@@ -11380,11 +12720,13 @@ Variables
-

Definition at line 735 of file hidusagestr.h.

+

Definition at line 735 of file hidusagestr.h.

- + +

◆ pstrUsageACAttachComment

+
@@ -11394,11 +12736,13 @@ Variables
-

Definition at line 736 of file hidusagestr.h.

+

Definition at line 736 of file hidusagestr.h.

- + +

◆ pstrUsageACDeleteComment

+
@@ -11408,11 +12752,13 @@ Variables
-

Definition at line 737 of file hidusagestr.h.

+

Definition at line 737 of file hidusagestr.h.

- + +

◆ pstrUsageACViewComment

+
@@ -11422,11 +12768,13 @@ Variables
-

Definition at line 738 of file hidusagestr.h.

+

Definition at line 738 of file hidusagestr.h.

- + +

◆ pstrUsageACSelectWord

+
@@ -11436,11 +12784,13 @@ Variables
-

Definition at line 739 of file hidusagestr.h.

+

Definition at line 739 of file hidusagestr.h.

- + +

◆ pstrUsageACSelectSentence

+
@@ -11450,11 +12800,13 @@ Variables
-

Definition at line 740 of file hidusagestr.h.

+

Definition at line 740 of file hidusagestr.h.

- + +

◆ pstrUsageACSelectParagraph

+
@@ -11464,11 +12816,13 @@ Variables
-

Definition at line 741 of file hidusagestr.h.

+

Definition at line 741 of file hidusagestr.h.

- + +

◆ pstrUsageACSelectColumn

+
@@ -11478,11 +12832,13 @@ Variables
-

Definition at line 742 of file hidusagestr.h.

+

Definition at line 742 of file hidusagestr.h.

- + +

◆ pstrUsageACSelectRow

+
@@ -11492,11 +12848,13 @@ Variables
-

Definition at line 743 of file hidusagestr.h.

+

Definition at line 743 of file hidusagestr.h.

- + +

◆ pstrUsageACSelectTable

+
@@ -11506,11 +12864,13 @@ Variables
-

Definition at line 744 of file hidusagestr.h.

+

Definition at line 744 of file hidusagestr.h.

- + +

◆ pstrUsageACSelectObject

+
@@ -11520,11 +12880,13 @@ Variables
-

Definition at line 745 of file hidusagestr.h.

+

Definition at line 745 of file hidusagestr.h.

- + +

◆ pstrUsageACRedoRepeat

+
@@ -11534,11 +12896,13 @@ Variables
-

Definition at line 746 of file hidusagestr.h.

+

Definition at line 746 of file hidusagestr.h.

- + +

◆ pstrUsageACSort

+
@@ -11548,11 +12912,13 @@ Variables
-

Definition at line 747 of file hidusagestr.h.

+

Definition at line 747 of file hidusagestr.h.

- + +

◆ pstrUsageACSortAscending

+
@@ -11562,11 +12928,13 @@ Variables
-

Definition at line 748 of file hidusagestr.h.

+

Definition at line 748 of file hidusagestr.h.

- + +

◆ pstrUsageACSortDescending

+
@@ -11576,11 +12944,13 @@ Variables
-

Definition at line 749 of file hidusagestr.h.

+

Definition at line 749 of file hidusagestr.h.

- + +

◆ pstrUsageACFilter

+
@@ -11590,11 +12960,13 @@ Variables
-

Definition at line 750 of file hidusagestr.h.

+

Definition at line 750 of file hidusagestr.h.

- + +

◆ pstrUsageACSetClock

+
@@ -11604,11 +12976,13 @@ Variables
-

Definition at line 751 of file hidusagestr.h.

+

Definition at line 751 of file hidusagestr.h.

- + +

◆ pstrUsageACViewClock

+
@@ -11618,11 +12992,13 @@ Variables
-

Definition at line 752 of file hidusagestr.h.

+

Definition at line 752 of file hidusagestr.h.

- + +

◆ pstrUsageACSelectTimeZone

+
@@ -11632,11 +13008,13 @@ Variables
-

Definition at line 753 of file hidusagestr.h.

+

Definition at line 753 of file hidusagestr.h.

- + +

◆ pstrUsageACEditTimeZone

+
@@ -11646,11 +13024,13 @@ Variables
-

Definition at line 754 of file hidusagestr.h.

+

Definition at line 754 of file hidusagestr.h.

- + +

◆ pstrUsageACSetAlarm

+
@@ -11660,11 +13040,13 @@ Variables
-

Definition at line 755 of file hidusagestr.h.

+

Definition at line 755 of file hidusagestr.h.

- + +

◆ pstrUsageACClearAlarm

+
@@ -11674,11 +13056,13 @@ Variables
-

Definition at line 756 of file hidusagestr.h.

+

Definition at line 756 of file hidusagestr.h.

- + +

◆ pstrUsageACSnoozeAlarm

+
@@ -11688,11 +13072,13 @@ Variables
-

Definition at line 757 of file hidusagestr.h.

+

Definition at line 757 of file hidusagestr.h.

- + +

◆ pstrUsageACResetAlarm

+
@@ -11702,11 +13088,13 @@ Variables
-

Definition at line 758 of file hidusagestr.h.

+

Definition at line 758 of file hidusagestr.h.

- + +

◆ pstrUsageACSyncronize

+
@@ -11716,11 +13104,13 @@ Variables
-

Definition at line 759 of file hidusagestr.h.

+

Definition at line 759 of file hidusagestr.h.

- + +

◆ pstrUsageACSendReceive

+
@@ -11730,11 +13120,13 @@ Variables
-

Definition at line 760 of file hidusagestr.h.

+

Definition at line 760 of file hidusagestr.h.

- + +

◆ pstrUsageACSendTo

+
@@ -11744,11 +13136,13 @@ Variables
-

Definition at line 761 of file hidusagestr.h.

+

Definition at line 761 of file hidusagestr.h.

- + +

◆ pstrUsageACReply

+
@@ -11758,11 +13152,13 @@ Variables
-

Definition at line 762 of file hidusagestr.h.

+

Definition at line 762 of file hidusagestr.h.

- + +

◆ pstrUsageACReplyAll

+
@@ -11772,11 +13168,13 @@ Variables
-

Definition at line 763 of file hidusagestr.h.

+

Definition at line 763 of file hidusagestr.h.

- + +

◆ pstrUsageACForwardMessage

+
@@ -11786,11 +13184,13 @@ Variables
-

Definition at line 764 of file hidusagestr.h.

+

Definition at line 764 of file hidusagestr.h.

- + +

◆ pstrUsageACSend

+
@@ -11800,11 +13200,13 @@ Variables
-

Definition at line 765 of file hidusagestr.h.

+

Definition at line 765 of file hidusagestr.h.

- + +

◆ pstrUsageACAttachFile

+
@@ -11814,11 +13216,13 @@ Variables
-

Definition at line 766 of file hidusagestr.h.

+

Definition at line 766 of file hidusagestr.h.

- + +

◆ pstrUsageACUpload

+
@@ -11828,11 +13232,13 @@ Variables
-

Definition at line 767 of file hidusagestr.h.

+

Definition at line 767 of file hidusagestr.h.

- + +

◆ pstrUsageACDownload

+
@@ -11842,11 +13248,13 @@ Variables
-

Definition at line 768 of file hidusagestr.h.

+

Definition at line 768 of file hidusagestr.h.

- + +

◆ pstrUsageACSetBorders

+
@@ -11856,11 +13264,13 @@ Variables
-

Definition at line 769 of file hidusagestr.h.

+

Definition at line 769 of file hidusagestr.h.

- + +

◆ pstrUsageACInsertRow

+
@@ -11870,11 +13280,13 @@ Variables
-

Definition at line 770 of file hidusagestr.h.

+

Definition at line 770 of file hidusagestr.h.

- + +

◆ pstrUsageACInsertColumn

+
@@ -11884,11 +13296,13 @@ Variables
-

Definition at line 771 of file hidusagestr.h.

+

Definition at line 771 of file hidusagestr.h.

- + +

◆ pstrUsageACInsertFile

+
@@ -11898,11 +13312,13 @@ Variables
-

Definition at line 772 of file hidusagestr.h.

+

Definition at line 772 of file hidusagestr.h.

- + +

◆ pstrUsageACInsertPicture

+
@@ -11912,11 +13328,13 @@ Variables
-

Definition at line 773 of file hidusagestr.h.

+

Definition at line 773 of file hidusagestr.h.

- + +

◆ pstrUsageACInsertObject

+
@@ -11926,11 +13344,13 @@ Variables
-

Definition at line 774 of file hidusagestr.h.

+

Definition at line 774 of file hidusagestr.h.

- + +

◆ pstrUsageACInsertSymbol

+
@@ -11940,11 +13360,13 @@ Variables
-

Definition at line 775 of file hidusagestr.h.

+

Definition at line 775 of file hidusagestr.h.

- + +

◆ pstrUsageACSaveAndClose

+
@@ -11954,11 +13376,13 @@ Variables
-

Definition at line 776 of file hidusagestr.h.

+

Definition at line 776 of file hidusagestr.h.

- + +

◆ pstrUsageACRename

+
@@ -11968,11 +13392,13 @@ Variables
-

Definition at line 777 of file hidusagestr.h.

+

Definition at line 777 of file hidusagestr.h.

- + +

◆ pstrUsageACMerge

+
@@ -11982,11 +13408,13 @@ Variables
-

Definition at line 778 of file hidusagestr.h.

+

Definition at line 778 of file hidusagestr.h.

- + +

◆ pstrUsageACSplit

+
@@ -11996,11 +13424,13 @@ Variables
-

Definition at line 779 of file hidusagestr.h.

+

Definition at line 779 of file hidusagestr.h.

- + +

◆ pstrUsageACDistributeHorizontaly

+
@@ -12010,11 +13440,13 @@ Variables
-

Definition at line 780 of file hidusagestr.h.

+

Definition at line 780 of file hidusagestr.h.

- + +

◆ pstrUsageACDistributeVerticaly

+
@@ -12024,11 +13456,13 @@ Variables
-

Definition at line 781 of file hidusagestr.h.

+

Definition at line 781 of file hidusagestr.h.

- + +

◆ pstrUsageDigitizer

+
@@ -12038,11 +13472,13 @@ Variables
-

Definition at line 784 of file hidusagestr.h.

+

Definition at line 784 of file hidusagestr.h.

- + +

◆ pstrUsagePen

+
@@ -12052,11 +13488,13 @@ Variables
-

Definition at line 785 of file hidusagestr.h.

+

Definition at line 785 of file hidusagestr.h.

- + +

◆ pstrUsageLightPen

+
@@ -12066,11 +13504,13 @@ Variables
-

Definition at line 786 of file hidusagestr.h.

+

Definition at line 786 of file hidusagestr.h.

- + +

◆ pstrUsageTouchScreen

+
@@ -12080,11 +13520,13 @@ Variables
-

Definition at line 787 of file hidusagestr.h.

+

Definition at line 787 of file hidusagestr.h.

- + +

◆ pstrUsageTouchPad

+
@@ -12094,11 +13536,13 @@ Variables
-

Definition at line 788 of file hidusagestr.h.

+

Definition at line 788 of file hidusagestr.h.

- + +

◆ pstrUsageWhiteBoard

+
@@ -12108,11 +13552,13 @@ Variables
-

Definition at line 789 of file hidusagestr.h.

+

Definition at line 789 of file hidusagestr.h.

- + +

◆ pstrUsageCoordinateMeasuringMachine

+
@@ -12122,11 +13568,13 @@ Variables
-

Definition at line 790 of file hidusagestr.h.

+

Definition at line 790 of file hidusagestr.h.

- + +

◆ pstrUsage3DDigitizer

+
@@ -12136,11 +13584,13 @@ Variables
-

Definition at line 791 of file hidusagestr.h.

+

Definition at line 791 of file hidusagestr.h.

- + +

◆ pstrUsageStereoPlotter

+
@@ -12150,11 +13600,13 @@ Variables
-

Definition at line 792 of file hidusagestr.h.

+

Definition at line 792 of file hidusagestr.h.

- + +

◆ pstrUsageArticulatedArm

+
@@ -12164,11 +13616,13 @@ Variables
-

Definition at line 793 of file hidusagestr.h.

+

Definition at line 793 of file hidusagestr.h.

- + +

◆ pstrUsageArmature

+
@@ -12178,11 +13632,13 @@ Variables
-

Definition at line 794 of file hidusagestr.h.

+

Definition at line 794 of file hidusagestr.h.

- + +

◆ pstrUsageMultiplePointDigitizer

+
@@ -12192,11 +13648,13 @@ Variables
-

Definition at line 795 of file hidusagestr.h.

+

Definition at line 795 of file hidusagestr.h.

- + +

◆ pstrUsageFreeSpaceWand

+
@@ -12206,11 +13664,13 @@ Variables
-

Definition at line 796 of file hidusagestr.h.

+

Definition at line 796 of file hidusagestr.h.

- + +

◆ pstrUsageStylus

+
@@ -12220,11 +13680,13 @@ Variables
-

Definition at line 797 of file hidusagestr.h.

+

Definition at line 797 of file hidusagestr.h.

- + +

◆ pstrUsagePuck

+
@@ -12234,11 +13696,13 @@ Variables
-

Definition at line 798 of file hidusagestr.h.

+

Definition at line 798 of file hidusagestr.h.

- + +

◆ pstrUsageFinger

+
@@ -12248,11 +13712,13 @@ Variables
-

Definition at line 799 of file hidusagestr.h.

+

Definition at line 799 of file hidusagestr.h.

- + +

◆ pstrUsageTipPressure

+
@@ -12262,11 +13728,13 @@ Variables
-

Definition at line 800 of file hidusagestr.h.

+

Definition at line 800 of file hidusagestr.h.

- + +

◆ pstrUsageBarrelPressure

+
@@ -12276,11 +13744,13 @@ Variables
-

Definition at line 801 of file hidusagestr.h.

+

Definition at line 801 of file hidusagestr.h.

- + +

◆ pstrUsageInRange

+
@@ -12290,11 +13760,13 @@ Variables
-

Definition at line 802 of file hidusagestr.h.

+

Definition at line 802 of file hidusagestr.h.

- + +

◆ pstrUsageTouch

+
@@ -12304,11 +13776,13 @@ Variables
-

Definition at line 803 of file hidusagestr.h.

+

Definition at line 803 of file hidusagestr.h.

- + +

◆ pstrUsageUntouch

+
@@ -12318,11 +13792,13 @@ Variables
-

Definition at line 804 of file hidusagestr.h.

+

Definition at line 804 of file hidusagestr.h.

- + +

◆ pstrUsageTap

+
@@ -12332,11 +13808,13 @@ Variables
-

Definition at line 805 of file hidusagestr.h.

+

Definition at line 805 of file hidusagestr.h.

- + +

◆ pstrUsageQuality

+
@@ -12346,11 +13824,13 @@ Variables
-

Definition at line 806 of file hidusagestr.h.

+

Definition at line 806 of file hidusagestr.h.

- + +

◆ pstrUsageDataValid

+
@@ -12360,11 +13840,13 @@ Variables
-

Definition at line 807 of file hidusagestr.h.

+

Definition at line 807 of file hidusagestr.h.

- + +

◆ pstrUsageTransducerIndex

+
@@ -12374,11 +13856,13 @@ Variables
-

Definition at line 808 of file hidusagestr.h.

+

Definition at line 808 of file hidusagestr.h.

- + +

◆ pstrUsageTabletFunctionKeys

+
@@ -12388,11 +13872,13 @@ Variables
-

Definition at line 809 of file hidusagestr.h.

+

Definition at line 809 of file hidusagestr.h.

- + +

◆ pstrUsageProgramChangeKeys

+
@@ -12402,11 +13888,13 @@ Variables
-

Definition at line 810 of file hidusagestr.h.

+

Definition at line 810 of file hidusagestr.h.

- + +

◆ pstrUsageInvert

+
@@ -12416,11 +13904,13 @@ Variables
-

Definition at line 812 of file hidusagestr.h.

+

Definition at line 812 of file hidusagestr.h.

- + +

◆ pstrUsageXTilt

+
@@ -12430,11 +13920,13 @@ Variables
-

Definition at line 813 of file hidusagestr.h.

+

Definition at line 813 of file hidusagestr.h.

- + +

◆ pstrUsageYTilt

+
@@ -12444,11 +13936,13 @@ Variables
-

Definition at line 814 of file hidusagestr.h.

+

Definition at line 814 of file hidusagestr.h.

- + +

◆ pstrUsageAzimuth

+
@@ -12458,11 +13952,13 @@ Variables
-

Definition at line 815 of file hidusagestr.h.

+

Definition at line 815 of file hidusagestr.h.

- + +

◆ pstrUsageAltitude

+
@@ -12472,11 +13968,13 @@ Variables
-

Definition at line 816 of file hidusagestr.h.

+

Definition at line 816 of file hidusagestr.h.

- + +

◆ pstrUsageTwist

+
@@ -12486,11 +13984,13 @@ Variables
-

Definition at line 817 of file hidusagestr.h.

+

Definition at line 817 of file hidusagestr.h.

- + +

◆ pstrUsageTipSwitch

+
@@ -12500,11 +14000,13 @@ Variables
-

Definition at line 818 of file hidusagestr.h.

+

Definition at line 818 of file hidusagestr.h.

- + +

◆ pstrUsageSecondaryTipSwitch

+
@@ -12514,11 +14016,13 @@ Variables
-

Definition at line 819 of file hidusagestr.h.

+

Definition at line 819 of file hidusagestr.h.

- + +

◆ pstrUsageBarrelSwitch

+
@@ -12528,11 +14032,13 @@ Variables
-

Definition at line 820 of file hidusagestr.h.

+

Definition at line 820 of file hidusagestr.h.

- + +

◆ pstrUsageEraser

+
@@ -12542,11 +14048,13 @@ Variables
-

Definition at line 821 of file hidusagestr.h.

+

Definition at line 821 of file hidusagestr.h.

- + +

◆ pstrUsageTabletPick

+
@@ -12556,11 +14064,13 @@ Variables
-

Definition at line 822 of file hidusagestr.h.

+

Definition at line 822 of file hidusagestr.h.

- + +

◆ pstrUsageAlphanumericDisplay

+
@@ -12570,11 +14080,13 @@ Variables
-

Definition at line 825 of file hidusagestr.h.

+

Definition at line 825 of file hidusagestr.h.

- + +

◆ pstrUsageBitmappedDisplay

+
@@ -12584,11 +14096,13 @@ Variables
-

Definition at line 826 of file hidusagestr.h.

+

Definition at line 826 of file hidusagestr.h.

- + +

◆ pstrUsageDisplayAttributesReport

+
@@ -12598,11 +14112,13 @@ Variables
-

Definition at line 827 of file hidusagestr.h.

+

Definition at line 827 of file hidusagestr.h.

- + +

◆ pstrUsageASCIICharacterSet

+
@@ -12612,11 +14128,13 @@ Variables
-

Definition at line 828 of file hidusagestr.h.

+

Definition at line 828 of file hidusagestr.h.

- + +

◆ pstrUsageDataReadBack

+
@@ -12626,11 +14144,13 @@ Variables
-

Definition at line 829 of file hidusagestr.h.

+

Definition at line 829 of file hidusagestr.h.

- + +

◆ pstrUsageFontReadBack

+
@@ -12640,11 +14160,13 @@ Variables
-

Definition at line 830 of file hidusagestr.h.

+

Definition at line 830 of file hidusagestr.h.

- + +

◆ pstrUsageDisplayControlReport

+
@@ -12654,11 +14176,13 @@ Variables
-

Definition at line 831 of file hidusagestr.h.

+

Definition at line 831 of file hidusagestr.h.

- + +

◆ pstrUsageClearDisplay

+
@@ -12668,11 +14192,13 @@ Variables
-

Definition at line 832 of file hidusagestr.h.

+

Definition at line 832 of file hidusagestr.h.

- + +

◆ pstrUsageScreenSaverDelay

+
@@ -12682,11 +14208,13 @@ Variables
-

Definition at line 834 of file hidusagestr.h.

+

Definition at line 834 of file hidusagestr.h.

- + +

◆ pstrUsageScreenSaverEnable

+
@@ -12696,11 +14224,13 @@ Variables
-

Definition at line 835 of file hidusagestr.h.

+

Definition at line 835 of file hidusagestr.h.

- + +

◆ pstrUsageVerticalScroll

+
@@ -12710,11 +14240,13 @@ Variables
-

Definition at line 836 of file hidusagestr.h.

+

Definition at line 836 of file hidusagestr.h.

- + +

◆ pstrUsageHorizontalScroll

+
@@ -12724,11 +14256,13 @@ Variables
-

Definition at line 837 of file hidusagestr.h.

+

Definition at line 837 of file hidusagestr.h.

- + +

◆ pstrUsageCharacterReport

+
@@ -12738,11 +14272,13 @@ Variables
-

Definition at line 838 of file hidusagestr.h.

+

Definition at line 838 of file hidusagestr.h.

- + +

◆ pstrUsageDisplayData

+
@@ -12752,11 +14288,13 @@ Variables
-

Definition at line 839 of file hidusagestr.h.

+

Definition at line 839 of file hidusagestr.h.

- + +

◆ pstrUsageDisplayStatus

+
@@ -12766,11 +14304,13 @@ Variables
-

Definition at line 840 of file hidusagestr.h.

+

Definition at line 840 of file hidusagestr.h.

- + +

◆ pstrUsageStatusNotReady

+
@@ -12780,11 +14320,13 @@ Variables
-

Definition at line 841 of file hidusagestr.h.

+

Definition at line 841 of file hidusagestr.h.

- + +

◆ pstrUsageStatusReady

+
@@ -12794,11 +14336,13 @@ Variables
-

Definition at line 842 of file hidusagestr.h.

+

Definition at line 842 of file hidusagestr.h.

- + +

◆ pstrUsageErrorNotALoadableCharacter

+
@@ -12808,11 +14352,13 @@ Variables
-

Definition at line 843 of file hidusagestr.h.

+

Definition at line 843 of file hidusagestr.h.

- + +

◆ pstrUsageErrorFotDataCanNotBeRead

+
@@ -12822,11 +14368,13 @@ Variables
-

Definition at line 844 of file hidusagestr.h.

+

Definition at line 844 of file hidusagestr.h.

- + +

◆ pstrUsageCursorPositionReport

+
@@ -12836,11 +14384,13 @@ Variables
-

Definition at line 845 of file hidusagestr.h.

+

Definition at line 845 of file hidusagestr.h.

- + +

◆ pstrUsageRow

+
@@ -12850,11 +14400,13 @@ Variables
-

Definition at line 846 of file hidusagestr.h.

+

Definition at line 846 of file hidusagestr.h.

- + +

◆ pstrUsageColumn

+
@@ -12864,11 +14416,13 @@ Variables
-

Definition at line 847 of file hidusagestr.h.

+

Definition at line 847 of file hidusagestr.h.

- + +

◆ pstrUsageRows

+
@@ -12878,11 +14432,13 @@ Variables
-

Definition at line 848 of file hidusagestr.h.

+

Definition at line 848 of file hidusagestr.h.

- + +

◆ pstrUsageColumns

+
@@ -12892,11 +14448,13 @@ Variables
-

Definition at line 849 of file hidusagestr.h.

+

Definition at line 849 of file hidusagestr.h.

- + +

◆ pstrUsageCursorPixelPosition

+
@@ -12906,11 +14464,13 @@ Variables
-

Definition at line 850 of file hidusagestr.h.

+

Definition at line 850 of file hidusagestr.h.

- + +

◆ pstrUsageCursorMode

+
@@ -12920,11 +14480,13 @@ Variables
-

Definition at line 851 of file hidusagestr.h.

+

Definition at line 851 of file hidusagestr.h.

- + +

◆ pstrUsageCursorEnable

+
@@ -12934,11 +14496,13 @@ Variables
-

Definition at line 852 of file hidusagestr.h.

+

Definition at line 852 of file hidusagestr.h.

- + +

◆ pstrUsageCursorBlink

+
@@ -12948,11 +14512,13 @@ Variables
-

Definition at line 853 of file hidusagestr.h.

+

Definition at line 853 of file hidusagestr.h.

- + +

◆ pstrUsageFontReport

+
@@ -12962,11 +14528,13 @@ Variables
-

Definition at line 854 of file hidusagestr.h.

+

Definition at line 854 of file hidusagestr.h.

- + +

◆ pstrUsageFontData

+
@@ -12976,11 +14544,13 @@ Variables
-

Definition at line 855 of file hidusagestr.h.

+

Definition at line 855 of file hidusagestr.h.

- + +

◆ pstrUsageCharacterWidth

+
@@ -12990,11 +14560,13 @@ Variables
-

Definition at line 856 of file hidusagestr.h.

+

Definition at line 856 of file hidusagestr.h.

- + +

◆ pstrUsageCharacterHeight

+
@@ -13004,11 +14576,13 @@ Variables
-

Definition at line 857 of file hidusagestr.h.

+

Definition at line 857 of file hidusagestr.h.

- + +

◆ pstrUsageCharacterSpacingHorizontal

+
@@ -13018,11 +14592,13 @@ Variables
-

Definition at line 858 of file hidusagestr.h.

+

Definition at line 858 of file hidusagestr.h.

- + +

◆ pstrUsageCharacterSpacingVertical

+
@@ -13032,11 +14608,13 @@ Variables
-

Definition at line 859 of file hidusagestr.h.

+

Definition at line 859 of file hidusagestr.h.

- + +

◆ pstrUsageUnicodeCharset

+
@@ -13046,11 +14624,13 @@ Variables
-

Definition at line 860 of file hidusagestr.h.

+

Definition at line 860 of file hidusagestr.h.

- + +

◆ pstrUsageFont7Segment

+
@@ -13060,11 +14640,13 @@ Variables
-

Definition at line 861 of file hidusagestr.h.

+

Definition at line 861 of file hidusagestr.h.

- + +

◆ pstrUsage7SegmentDirectMap

+
@@ -13074,11 +14656,13 @@ Variables
-

Definition at line 862 of file hidusagestr.h.

+

Definition at line 862 of file hidusagestr.h.

- + +

◆ pstrUsageFont14Segment

+
@@ -13088,11 +14672,13 @@ Variables
-

Definition at line 863 of file hidusagestr.h.

+

Definition at line 863 of file hidusagestr.h.

- + +

◆ pstrUsage14SegmentDirectMap

+
@@ -13102,11 +14688,13 @@ Variables
-

Definition at line 864 of file hidusagestr.h.

+

Definition at line 864 of file hidusagestr.h.

- + +

◆ pstrUsageDisplayBrightness

+
@@ -13116,11 +14704,13 @@ Variables
-

Definition at line 865 of file hidusagestr.h.

+

Definition at line 865 of file hidusagestr.h.

- + +

◆ pstrUsageDisplayContrast

+
@@ -13130,11 +14720,13 @@ Variables
-

Definition at line 866 of file hidusagestr.h.

+

Definition at line 866 of file hidusagestr.h.

- + +

◆ pstrUsageCharacterAttribute

+
@@ -13144,11 +14736,13 @@ Variables
-

Definition at line 867 of file hidusagestr.h.

+

Definition at line 867 of file hidusagestr.h.

- + +

◆ pstrUsageAttributeReadback

+
@@ -13158,11 +14752,13 @@ Variables
-

Definition at line 868 of file hidusagestr.h.

+

Definition at line 868 of file hidusagestr.h.

- + +

◆ pstrUsageAttributeData

+
@@ -13172,11 +14768,13 @@ Variables
-

Definition at line 869 of file hidusagestr.h.

+

Definition at line 869 of file hidusagestr.h.

- + +

◆ pstrUsageCharAttributeEnhance

+
@@ -13186,11 +14784,13 @@ Variables
-

Definition at line 870 of file hidusagestr.h.

+

Definition at line 870 of file hidusagestr.h.

- + +

◆ pstrUsageCharAttributeUnderline

+
@@ -13200,11 +14800,13 @@ Variables
-

Definition at line 871 of file hidusagestr.h.

+

Definition at line 871 of file hidusagestr.h.

- + +

◆ pstrUsageCharAttributeBlink

+
@@ -13214,11 +14816,13 @@ Variables
-

Definition at line 872 of file hidusagestr.h.

+

Definition at line 872 of file hidusagestr.h.

- + +

◆ pstrUsageBitmapSizeX

+
@@ -13228,11 +14832,13 @@ Variables
-

Definition at line 873 of file hidusagestr.h.

+

Definition at line 873 of file hidusagestr.h.

- + +

◆ pstrUsageBitmapSizeY

+
@@ -13242,11 +14848,13 @@ Variables
-

Definition at line 874 of file hidusagestr.h.

+

Definition at line 874 of file hidusagestr.h.

- + +

◆ pstrUsageBitDepthFormat

+
@@ -13256,11 +14864,13 @@ Variables
-

Definition at line 875 of file hidusagestr.h.

+

Definition at line 875 of file hidusagestr.h.

- + +

◆ pstrUsageDisplayOrientation

+
@@ -13270,11 +14880,13 @@ Variables
-

Definition at line 876 of file hidusagestr.h.

+

Definition at line 876 of file hidusagestr.h.

- + +

◆ pstrUsagePaletteReport

+
@@ -13284,11 +14896,13 @@ Variables
-

Definition at line 877 of file hidusagestr.h.

+

Definition at line 877 of file hidusagestr.h.

- + +

◆ pstrUsagePaletteDataSize

+
@@ -13298,11 +14912,13 @@ Variables
-

Definition at line 878 of file hidusagestr.h.

+

Definition at line 878 of file hidusagestr.h.

- + +

◆ pstrUsagePaletteDataOffset

+
@@ -13312,11 +14928,13 @@ Variables
-

Definition at line 879 of file hidusagestr.h.

+

Definition at line 879 of file hidusagestr.h.

- + +

◆ pstrUsagePaletteData

+
@@ -13326,11 +14944,13 @@ Variables
-

Definition at line 880 of file hidusagestr.h.

+

Definition at line 880 of file hidusagestr.h.

- + +

◆ pstrUsageBlitReport

+
@@ -13340,11 +14960,13 @@ Variables
-

Definition at line 881 of file hidusagestr.h.

+

Definition at line 881 of file hidusagestr.h.

- + +

◆ pstrUsageBlitRectangleX1

+
@@ -13354,11 +14976,13 @@ Variables
-

Definition at line 882 of file hidusagestr.h.

+

Definition at line 882 of file hidusagestr.h.

- + +

◆ pstrUsageBlitRectangleY1

+
@@ -13368,11 +14992,13 @@ Variables
-

Definition at line 883 of file hidusagestr.h.

+

Definition at line 883 of file hidusagestr.h.

- + +

◆ pstrUsageBlitRectangleX2

+
@@ -13382,11 +15008,13 @@ Variables
-

Definition at line 884 of file hidusagestr.h.

+

Definition at line 884 of file hidusagestr.h.

- + +

◆ pstrUsageBlitRectangleY2

+
@@ -13396,11 +15024,13 @@ Variables
-

Definition at line 885 of file hidusagestr.h.

+

Definition at line 885 of file hidusagestr.h.

- + +

◆ pstrUsageBlitData

+
@@ -13410,11 +15040,13 @@ Variables
-

Definition at line 886 of file hidusagestr.h.

+

Definition at line 886 of file hidusagestr.h.

- + +

◆ pstrUsageSoftButton

+
@@ -13424,11 +15056,13 @@ Variables
-

Definition at line 887 of file hidusagestr.h.

+

Definition at line 887 of file hidusagestr.h.

- + +

◆ pstrUsageSoftButtonID

+
@@ -13438,11 +15072,13 @@ Variables
-

Definition at line 888 of file hidusagestr.h.

+

Definition at line 888 of file hidusagestr.h.

- + +

◆ pstrUsageSoftButtonSide

+
@@ -13452,11 +15088,13 @@ Variables
-

Definition at line 889 of file hidusagestr.h.

+

Definition at line 889 of file hidusagestr.h.

- + +

◆ pstrUsageSoftButtonOffset1

+
@@ -13466,11 +15104,13 @@ Variables
-

Definition at line 890 of file hidusagestr.h.

+

Definition at line 890 of file hidusagestr.h.

- + +

◆ pstrUsageSoftButtonOffset2

+
@@ -13480,11 +15120,13 @@ Variables
-

Definition at line 891 of file hidusagestr.h.

+

Definition at line 891 of file hidusagestr.h.

- + +

◆ pstrUsageSoftButtonReport

+
@@ -13494,11 +15136,13 @@ Variables
-

Definition at line 892 of file hidusagestr.h.

+

Definition at line 892 of file hidusagestr.h.

- + +

◆ pstrUsageMedicalUltrasound

+
@@ -13508,11 +15152,13 @@ Variables
-

Definition at line 895 of file hidusagestr.h.

+

Definition at line 895 of file hidusagestr.h.

- + +

◆ pstrUsageVCRAcquisition

+
@@ -13522,11 +15168,13 @@ Variables
-

Definition at line 896 of file hidusagestr.h.

+

Definition at line 896 of file hidusagestr.h.

- + +

◆ pstrUsageFreezeThaw

+
@@ -13536,11 +15184,13 @@ Variables
-

Definition at line 897 of file hidusagestr.h.

+

Definition at line 897 of file hidusagestr.h.

- + +

◆ pstrUsageClipStore

+
@@ -13550,11 +15200,13 @@ Variables
-

Definition at line 898 of file hidusagestr.h.

+

Definition at line 898 of file hidusagestr.h.

- + +

◆ pstrUsageUpdate

+
@@ -13564,11 +15216,13 @@ Variables
-

Definition at line 899 of file hidusagestr.h.

+

Definition at line 899 of file hidusagestr.h.

- + +

◆ pstrUsageNext

+
@@ -13578,11 +15232,13 @@ Variables
-

Definition at line 900 of file hidusagestr.h.

+

Definition at line 900 of file hidusagestr.h.

- + +

◆ pstrUsageSave

+
@@ -13592,11 +15248,13 @@ Variables
-

Definition at line 901 of file hidusagestr.h.

+

Definition at line 901 of file hidusagestr.h.

- + +

◆ pstrUsagePrint

+
@@ -13606,11 +15264,13 @@ Variables
-

Definition at line 902 of file hidusagestr.h.

+

Definition at line 902 of file hidusagestr.h.

- + +

◆ pstrUsageMicrophoneEnable

+
@@ -13620,11 +15280,13 @@ Variables
-

Definition at line 903 of file hidusagestr.h.

+

Definition at line 903 of file hidusagestr.h.

- + +

◆ pstrUsageCine

+
@@ -13634,11 +15296,13 @@ Variables
-

Definition at line 904 of file hidusagestr.h.

+

Definition at line 904 of file hidusagestr.h.

- + +

◆ pstrUsageTransmitPower

+
@@ -13648,11 +15312,13 @@ Variables
-

Definition at line 905 of file hidusagestr.h.

+

Definition at line 905 of file hidusagestr.h.

- + +

◆ pstrUsageFocus

+
@@ -13662,11 +15328,13 @@ Variables
-

Definition at line 907 of file hidusagestr.h.

+

Definition at line 907 of file hidusagestr.h.

- + +

◆ pstrUsageDepth

+
@@ -13676,11 +15344,13 @@ Variables
-

Definition at line 908 of file hidusagestr.h.

+

Definition at line 908 of file hidusagestr.h.

- + +

◆ pstrUsageSoftStepPrimary

+
@@ -13690,11 +15360,13 @@ Variables
-

Definition at line 909 of file hidusagestr.h.

+

Definition at line 909 of file hidusagestr.h.

- + +

◆ pstrUsageSoftStepSecondary

+
@@ -13704,11 +15376,13 @@ Variables
-

Definition at line 910 of file hidusagestr.h.

+

Definition at line 910 of file hidusagestr.h.

- + +

◆ pstrUsageDepthGainCompensation

+
@@ -13718,11 +15392,13 @@ Variables
-

Definition at line 911 of file hidusagestr.h.

+

Definition at line 911 of file hidusagestr.h.

- + +

◆ pstrUsageZoomSelect

+
@@ -13732,11 +15408,13 @@ Variables
-

Definition at line 912 of file hidusagestr.h.

+

Definition at line 912 of file hidusagestr.h.

- + +

◆ pstrUsageZoomAdjust

+
@@ -13746,11 +15424,13 @@ Variables
-

Definition at line 913 of file hidusagestr.h.

+

Definition at line 913 of file hidusagestr.h.

- + +

◆ pstrUsageSpectralDopplerModeSelect

+
@@ -13760,11 +15440,13 @@ Variables
-

Definition at line 914 of file hidusagestr.h.

+

Definition at line 914 of file hidusagestr.h.

- + +

◆ pstrUsageSpectralDopplerModeAdjust

+
@@ -13774,11 +15456,13 @@ Variables
-

Definition at line 915 of file hidusagestr.h.

+

Definition at line 915 of file hidusagestr.h.

- + +

◆ pstrUsageColorDopplerModeSelect

+
@@ -13788,11 +15472,13 @@ Variables
-

Definition at line 916 of file hidusagestr.h.

+

Definition at line 916 of file hidusagestr.h.

- + +

◆ pstrUsageColorDopplerModeAdjust

+
@@ -13802,11 +15488,13 @@ Variables
-

Definition at line 917 of file hidusagestr.h.

+

Definition at line 917 of file hidusagestr.h.

- + +

◆ pstrUsageMotionModeSelect

+
@@ -13816,11 +15504,13 @@ Variables
-

Definition at line 918 of file hidusagestr.h.

+

Definition at line 918 of file hidusagestr.h.

- + +

◆ pstrUsageMotionModeAdjust

+
@@ -13830,11 +15520,13 @@ Variables
-

Definition at line 919 of file hidusagestr.h.

+

Definition at line 919 of file hidusagestr.h.

- + +

◆ pstrUsage2DModeSelect

+
@@ -13844,11 +15536,13 @@ Variables
-

Definition at line 920 of file hidusagestr.h.

+

Definition at line 920 of file hidusagestr.h.

- + +

◆ pstrUsage2DModeAdjust

+
@@ -13858,11 +15552,13 @@ Variables
-

Definition at line 921 of file hidusagestr.h.

+

Definition at line 921 of file hidusagestr.h.

- + +

◆ pstrUsageSoftControlSelect

+
@@ -13872,11 +15568,13 @@ Variables
-

Definition at line 922 of file hidusagestr.h.

+

Definition at line 922 of file hidusagestr.h.

- + +

◆ pstrUsageSoftControlAdjust

+
@@ -13886,7 +15584,7 @@ Variables
-

Definition at line 923 of file hidusagestr.h.

+

Definition at line 923 of file hidusagestr.h.

@@ -13895,7 +15593,7 @@ Variables diff --git a/hidusagestr_8h__dep__incl.map b/hidusagestr_8h__dep__incl.map index cdc03afe..ad554ce8 100644 --- a/hidusagestr_8h__dep__incl.map +++ b/hidusagestr_8h__dep__incl.map @@ -1,18 +1,18 @@ - - + + - - - - - - - + + + + + + + - + diff --git a/hidusagestr_8h__dep__incl.md5 b/hidusagestr_8h__dep__incl.md5 index 62d46b1e..f1a640ac 100644 --- a/hidusagestr_8h__dep__incl.md5 +++ b/hidusagestr_8h__dep__incl.md5 @@ -1 +1 @@ -44208c2c5892f1cc422f061692d78636 \ No newline at end of file +12434f462e22c3ae791de99a0f4323aa \ No newline at end of file diff --git a/hidusagestr_8h__dep__incl.png b/hidusagestr_8h__dep__incl.png index 66ee9765..2103f28c 100644 Binary files a/hidusagestr_8h__dep__incl.png and b/hidusagestr_8h__dep__incl.png differ diff --git a/hidusagestr_8h__incl.md5 b/hidusagestr_8h__incl.md5 index bc04b8cf..3d407f20 100644 --- a/hidusagestr_8h__incl.md5 +++ b/hidusagestr_8h__incl.md5 @@ -1 +1 @@ -794eccf037bd4feb00fd840fe0fc37b3 \ No newline at end of file +74eae8cd2429afa36b202f9e3b7f9c92 \ No newline at end of file diff --git a/hidusagestr_8h__incl.png b/hidusagestr_8h__incl.png index bd977374..55ba5a59 100644 Binary files a/hidusagestr_8h__incl.png and b/hidusagestr_8h__incl.png differ diff --git a/hidusagestr_8h_source.html b/hidusagestr_8h_source.html index e902695f..7d3ff278 100644 --- a/hidusagestr_8h_source.html +++ b/hidusagestr_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidusagestr.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + + - + - - + + + +
 

Macro Definition Documentation

- + +

◆ __HIDUSAGETITLEARRAYS_H__

+
@@ -121,7 +103,7 @@ Macros
-

Definition at line 18 of file hidusagetitlearrays.cpp.

+

Definition at line 18 of file hidusagetitlearrays.cpp.

@@ -130,7 +112,7 @@ Macros diff --git a/hidusagetitlearrays_8cpp__incl.md5 b/hidusagetitlearrays_8cpp__incl.md5 index 4e28641f..85cded89 100644 --- a/hidusagetitlearrays_8cpp__incl.md5 +++ b/hidusagetitlearrays_8cpp__incl.md5 @@ -1 +1 @@ -24f4b9fff6ebcb53f983ea5749309c1d \ No newline at end of file +bf6795292f5f5a0d124868b867d6bd79 \ No newline at end of file diff --git a/hidusagetitlearrays_8cpp__incl.png b/hidusagetitlearrays_8cpp__incl.png index 3387f6a8..d4775eb2 100644 Binary files a/hidusagetitlearrays_8cpp__incl.png and b/hidusagetitlearrays_8cpp__incl.png differ diff --git a/hidusagetitlearrays_8cpp_source.html b/hidusagetitlearrays_8cpp_source.html index e7ea4bad..7540b58a 100644 --- a/hidusagetitlearrays_8cpp_source.html +++ b/hidusagetitlearrays_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: hidusagetitlearrays.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
- + - - + + + + - + - - + + + +
@@ -206,7 +185,7 @@ This inheritance list is sorted roughly, but not completely, alphabetically: diff --git a/index.html b/index.html index ef981635..eec60744 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: USB Host Library Rev.2.0 @@ -11,9 +12,6 @@ - @@ -32,34 +30,22 @@
- + - + + + +
Some information can also be found at: http://blog.tkjelectronics.dk/.

The shield can be purchased at the main site: http://www.circuitsathome.com/products-page/arduino-shields or from TKJ Electronics: http://shop.tkjelectronics.dk/product_info.php?products_id=43.

-USB Host Shield +USB Host Shield

For more information about the hardware see the Hardware Manual.

Developed By

- + - - + + + +
- - - - + + + + - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - + + + + + + + @@ -412,7 +390,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/jquery.js b/jquery.js index 1f4d0b47..2771c749 100644 --- a/jquery.js +++ b/jquery.js @@ -1,3 +1,31 @@ +/* + @licstart The following is the entire license notice for the + JavaScript code in this file. + + Copyright (C) 1997-2017 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice + for the JavaScript code in this file + */ /*! * jQuery JavaScript Library v1.7.1 * http://jquery.com/ @@ -53,7 +81,7 @@ (function(b,c){var a=false;b(document).mouseup(function(d){a=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var d=this;this.element.bind("mousedown."+this.widgetName,function(e){return d._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(true===b.data(e.target,d.widgetName+".preventClickEvent")){b.removeData(e.target,d.widgetName+".preventClickEvent");e.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(f){if(a){return}(this._mouseStarted&&this._mouseUp(f));this._mouseDownEvent=f;var e=this,g=(f.which==1),d=(typeof this.options.cancel=="string"&&f.target.nodeName?b(f.target).closest(this.options.cancel).length:false);if(!g||d||!this._mouseCapture(f)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=(this._mouseStart(f)!==false);if(!this._mouseStarted){f.preventDefault();return true}}if(true===b.data(f.target,this.widgetName+".preventClickEvent")){b.removeData(f.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(h){return e._mouseMove(h)};this._mouseUpDelegate=function(h){return e._mouseUp(h)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);f.preventDefault();a=true;return true},_mouseMove:function(d){if(b.browser.msie&&!(document.documentMode>=9)&&!d.button){return this._mouseUp(d)}if(this._mouseStarted){this._mouseDrag(d);return d.preventDefault()}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,d)!==false);(this._mouseStarted?this._mouseDrag(d):this._mouseUp(d))}return !this._mouseStarted},_mouseUp:function(d){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(d.target==this._mouseDownEvent.target){b.data(d.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(d)}return false},_mouseDistanceMet:function(d){return(Math.max(Math.abs(this._mouseDownEvent.pageX-d.pageX),Math.abs(this._mouseDownEvent.pageY-d.pageY))>=this.options.distance)},_mouseDelayMet:function(d){return this.mouseDelayMet},_mouseStart:function(d){},_mouseDrag:function(d){},_mouseStop:function(d){},_mouseCapture:function(d){return true}})})(jQuery);(function(c,d){c.widget("ui.resizable",c.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000},_create:function(){var f=this,k=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(k.aspectRatio),aspectRatio:k.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:k.helper||k.ghost||k.animate?k.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){this.element.wrap(c('
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=k.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var l=this.handles.split(",");this.handles={};for(var g=0;g
');if(/sw|se|ne|nw/.test(j)){h.css({zIndex:++k.zIndex})}if("se"==j){h.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[j]=".ui-resizable-"+j;this.element.append(h)}}this._renderAxis=function(q){q=q||this.element;for(var n in this.handles){if(this.handles[n].constructor==String){this.handles[n]=c(this.handles[n],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var o=c(this.handles[n],this.element),p=0;p=/sw|ne|nw|se|n|s/.test(n)?o.outerHeight():o.outerWidth();var m=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");q.css(m,p);this._proportionallyResize()}if(!c(this.handles[n]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!f.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}f.axis=i&&i[1]?i[1]:"se"}});if(k.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){if(k.disabled){return}c(this).removeClass("ui-resizable-autohide");f._handles.show()},function(){if(k.disabled){return}if(!f.resizing){c(this).addClass("ui-resizable-autohide");f._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var e=function(g){c(g).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){e(this.element);var f=this.element;f.after(this.originalElement.css({position:f.css("position"),width:f.outerWidth(),height:f.outerHeight(),top:f.css("top"),left:f.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);e(this.originalElement);return this},_mouseCapture:function(f){var g=false;for(var e in this.handles){if(c(this.handles[e])[0]==f.target){g=true}}return !this.options.disabled&&g},_mouseStart:function(g){var j=this.options,f=this.element.position(),e=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(e.is(".ui-draggable")||(/absolute/).test(e.css("position"))){e.css({position:"absolute",top:f.top,left:f.left})}this._renderProxy();var k=b(this.helper.css("left")),h=b(this.helper.css("top"));if(j.containment){k+=c(j.containment).scrollLeft()||0;h+=c(j.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:k,top:h};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:k,top:h};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:g.pageX,top:g.pageY};this.aspectRatio=(typeof j.aspectRatio=="number")?j.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var i=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",i=="auto"?this.axis+"-resize":i);e.addClass("ui-resizable-resizing");this._propagate("start",g);return true},_mouseDrag:function(e){var h=this.helper,g=this.options,m={},q=this,j=this.originalMousePosition,n=this.axis;var r=(e.pageX-j.left)||0,p=(e.pageY-j.top)||0;var i=this._change[n];if(!i){return false}var l=i.apply(this,[e,r,p]),k=c.browser.msie&&c.browser.version<7,f=this.sizeDiff;this._updateVirtualBoundaries(e.shiftKey);if(this._aspectRatio||e.shiftKey){l=this._updateRatio(l,e)}l=this._respectSize(l,e);this._propagate("resize",e);h.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(l);this._trigger("resize",e,this.ui());return false},_mouseStop:function(h){this.resizing=false;var i=this.options,m=this;if(this._helper){var g=this._proportionallyResizeElements,e=g.length&&(/textarea/i).test(g[0].nodeName),f=e&&c.ui.hasScroll(g[0],"left")?0:m.sizeDiff.height,k=e?0:m.sizeDiff.width;var n={width:(m.helper.width()-k),height:(m.helper.height()-f)},j=(parseInt(m.element.css("left"),10)+(m.position.left-m.originalPosition.left))||null,l=(parseInt(m.element.css("top"),10)+(m.position.top-m.originalPosition.top))||null;if(!i.animate){this.element.css(c.extend(n,{top:l,left:j}))}m.helper.height(m.size.height);m.helper.width(m.size.width);if(this._helper&&!i.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",h);if(this._helper){this.helper.remove()}return false},_updateVirtualBoundaries:function(g){var j=this.options,i,h,f,k,e;e={minWidth:a(j.minWidth)?j.minWidth:0,maxWidth:a(j.maxWidth)?j.maxWidth:Infinity,minHeight:a(j.minHeight)?j.minHeight:0,maxHeight:a(j.maxHeight)?j.maxHeight:Infinity};if(this._aspectRatio||g){i=e.minHeight*this.aspectRatio;f=e.minWidth/this.aspectRatio;h=e.maxHeight*this.aspectRatio;k=e.maxWidth/this.aspectRatio;if(i>e.minWidth){e.minWidth=i}if(f>e.minHeight){e.minHeight=f}if(hl.width),s=a(l.height)&&i.minHeight&&(i.minHeight>l.height);if(h){l.width=i.minWidth}if(s){l.height=i.minHeight}if(t){l.width=i.maxWidth}if(m){l.height=i.maxHeight}var f=this.originalPosition.left+this.originalSize.width,p=this.position.top+this.size.height;var k=/sw|nw|w/.test(q),e=/nw|ne|n/.test(q);if(h&&k){l.left=f-i.minWidth}if(t&&k){l.left=f-i.maxWidth}if(s&&e){l.top=p-i.minHeight}if(m&&e){l.top=p-i.maxHeight}var n=!l.width&&!l.height;if(n&&!l.left&&l.top){l.top=null}else{if(n&&!l.top&&l.left){l.left=null}}return l},_proportionallyResize:function(){var k=this.options;if(!this._proportionallyResizeElements.length){return}var g=this.helper||this.element;for(var f=0;f');var e=c.browser.msie&&c.browser.version<7,g=(e?1:0),h=(e?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+h,height:this.element.outerHeight()+h,position:"absolute",left:this.elementOffset.left-g+"px",top:this.elementOffset.top-g+"px",zIndex:++i.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(g,f,e){return{width:this.originalSize.width+f}},w:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{left:i.left+f,width:g.width-f}},n:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{top:i.top+e,height:g.height-e}},s:function(g,f,e){return{height:this.originalSize.height+e}},se:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},sw:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[g,f,e]))},ne:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},nw:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[g,f,e]))}},_propagate:function(f,e){c.ui.plugin.call(this,f,[e,this.ui()]);(f!="resize"&&this._trigger(f,e,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});c.extend(c.ui.resizable,{version:"1.8.18"});c.ui.plugin.add("resizable","alsoResize",{start:function(f,g){var e=c(this).data("resizable"),i=e.options;var h=function(j){c(j).each(function(){var k=c(this);k.data("resizable-alsoresize",{width:parseInt(k.width(),10),height:parseInt(k.height(),10),left:parseInt(k.css("left"),10),top:parseInt(k.css("top"),10)})})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.parentNode){if(i.alsoResize.length){i.alsoResize=i.alsoResize[0];h(i.alsoResize)}else{c.each(i.alsoResize,function(j){h(j)})}}else{h(i.alsoResize)}},resize:function(g,i){var f=c(this).data("resizable"),j=f.options,h=f.originalSize,l=f.originalPosition;var k={height:(f.size.height-h.height)||0,width:(f.size.width-h.width)||0,top:(f.position.top-l.top)||0,left:(f.position.left-l.left)||0},e=function(m,n){c(m).each(function(){var q=c(this),r=c(this).data("resizable-alsoresize"),p={},o=n&&n.length?n:q.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];c.each(o,function(s,u){var t=(r[u]||0)+(k[u]||0);if(t&&t>=0){p[u]=t||null}});q.css(p)})};if(typeof(j.alsoResize)=="object"&&!j.alsoResize.nodeType){c.each(j.alsoResize,function(m,n){e(m,n)})}else{e(j.alsoResize)}},stop:function(e,f){c(this).removeData("resizable-alsoresize")}});c.ui.plugin.add("resizable","animate",{stop:function(i,n){var p=c(this).data("resizable"),j=p.options;var h=p._proportionallyResizeElements,e=h.length&&(/textarea/i).test(h[0].nodeName),f=e&&c.ui.hasScroll(h[0],"left")?0:p.sizeDiff.height,l=e?0:p.sizeDiff.width;var g={width:(p.size.width-l),height:(p.size.height-f)},k=(parseInt(p.element.css("left"),10)+(p.position.left-p.originalPosition.left))||null,m=(parseInt(p.element.css("top"),10)+(p.position.top-p.originalPosition.top))||null;p.element.animate(c.extend(g,m&&k?{top:m,left:k}:{}),{duration:j.animateDuration,easing:j.animateEasing,step:function(){var o={width:parseInt(p.element.css("width"),10),height:parseInt(p.element.css("height"),10),top:parseInt(p.element.css("top"),10),left:parseInt(p.element.css("left"),10)};if(h&&h.length){c(h[0]).css({width:o.width,height:o.height})}p._updateCache(o);p._propagate("resize",i)}})}});c.ui.plugin.add("resizable","containment",{start:function(f,r){var t=c(this).data("resizable"),j=t.options,l=t.element;var g=j.containment,k=(g instanceof c)?g.get(0):(/parent/.test(g))?l.parent().get(0):g;if(!k){return}t.containerElement=c(k);if(/document/.test(g)||g==document){t.containerOffset={left:0,top:0};t.containerPosition={left:0,top:0};t.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var n=c(k),i=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){i[p]=b(n.css("padding"+o))});t.containerOffset=n.offset();t.containerPosition=n.position();t.containerSize={height:(n.innerHeight()-i[3]),width:(n.innerWidth()-i[1])};var q=t.containerOffset,e=t.containerSize.height,m=t.containerSize.width,h=(c.ui.hasScroll(k,"left")?k.scrollWidth:m),s=(c.ui.hasScroll(k)?k.scrollHeight:e);t.parentData={element:k,left:q.left,top:q.top,width:h,height:s}}},resize:function(g,q){var t=c(this).data("resizable"),i=t.options,f=t.containerSize,p=t.containerOffset,m=t.size,n=t.position,r=t._aspectRatio||g.shiftKey,e={top:0,left:0},h=t.containerElement;if(h[0]!=document&&(/static/).test(h.css("position"))){e=p}if(n.left<(t._helper?p.left:0)){t.size.width=t.size.width+(t._helper?(t.position.left-p.left):(t.position.left-e.left));if(r){t.size.height=t.size.width/i.aspectRatio}t.position.left=i.helper?p.left:0}if(n.top<(t._helper?p.top:0)){t.size.height=t.size.height+(t._helper?(t.position.top-p.top):t.position.top);if(r){t.size.width=t.size.height*i.aspectRatio}t.position.top=t._helper?p.top:0}t.offset.left=t.parentData.left+t.position.left;t.offset.top=t.parentData.top+t.position.top;var l=Math.abs((t._helper?t.offset.left-e.left:(t.offset.left-e.left))+t.sizeDiff.width),s=Math.abs((t._helper?t.offset.top-e.top:(t.offset.top-p.top))+t.sizeDiff.height);var k=t.containerElement.get(0)==t.element.parent().get(0),j=/relative|absolute/.test(t.containerElement.css("position"));if(k&&j){l-=t.parentData.left}if(l+t.size.width>=t.parentData.width){t.size.width=t.parentData.width-l;if(r){t.size.height=t.size.width/t.aspectRatio}}if(s+t.size.height>=t.parentData.height){t.size.height=t.parentData.height-s;if(r){t.size.width=t.size.height*t.aspectRatio}}},stop:function(f,n){var q=c(this).data("resizable"),g=q.options,l=q.position,m=q.containerOffset,e=q.containerPosition,i=q.containerElement;var j=c(q.helper),r=j.offset(),p=j.outerWidth()-q.sizeDiff.width,k=j.outerHeight()-q.sizeDiff.height;if(q._helper&&!g.animate&&(/relative/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}if(q._helper&&!g.animate&&(/static/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}}});c.ui.plugin.add("resizable","ghost",{start:function(g,h){var e=c(this).data("resizable"),i=e.options,f=e.size;e.ghost=e.originalElement.clone();e.ghost.css({opacity:0.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof i.ghost=="string"?i.ghost:"");e.ghost.appendTo(e.helper)},resize:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost){e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})}},stop:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost&&e.helper){e.helper.get(0).removeChild(e.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(e,m){var p=c(this).data("resizable"),h=p.options,k=p.size,i=p.originalSize,j=p.originalPosition,n=p.axis,l=h._aspectRatio||e.shiftKey;h.grid=typeof h.grid=="number"?[h.grid,h.grid]:h.grid;var g=Math.round((k.width-i.width)/(h.grid[0]||1))*(h.grid[0]||1),f=Math.round((k.height-i.height)/(h.grid[1]||1))*(h.grid[1]||1);if(/^(se|s|e)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f}else{if(/^(ne)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f}else{if(/^(sw)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.left=j.left-g}else{p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f;p.position.left=j.left-g}}}}});var b=function(e){return parseInt(e,10)||0};var a=function(e){return !isNaN(parseInt(e,10))}})(jQuery);/*! * jQuery hashchange event - v1.3 - 7/21/2010 * http://benalman.com/projects/jquery-hashchange-plugin/ - * + * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ @@ -65,4 +93,23 @@ Released under MIT license. https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt */ -(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(k){var A=k(document),s=k(window),w=k("body");var n="displayController",e="hasActiveHover",d="forcedOpen",u="hasMouseMove",f="mouseOnToPopup",g="originalTitle",y="powertip",o="powertipjq",l="powertiptarget",E=180/Math.PI;var c={isTipOpen:false,isFixedTipOpen:false,isClosing:false,tipOpenImminent:false,activeHover:null,currentX:0,currentY:0,previousX:0,previousY:0,desyncTimeout:null,mouseTrackingActive:false,delayInProgress:false,windowWidth:0,windowHeight:0,scrollTop:0,scrollLeft:0};var p={none:0,top:1,bottom:2,left:4,right:8};k.fn.powerTip=function(F,N){if(!this.length){return this}if(k.type(F)==="string"&&k.powerTip[F]){return k.powerTip[F].call(this,this,N)}var O=k.extend({},k.fn.powerTip.defaults,F),G=new x(O);h();this.each(function M(){var R=k(this),Q=R.data(y),P=R.data(o),T=R.data(l),S;if(R.data(n)){k.powerTip.destroy(R)}S=R.attr("title");if(!Q&&!T&&!P&&S){R.data(y,S);R.data(g,S);R.removeAttr("title")}R.data(n,new t(R,O,G))});if(!O.manual){this.on({"mouseenter.powertip":function J(P){k.powerTip.show(this,P)},"mouseleave.powertip":function L(){k.powerTip.hide(this)},"focus.powertip":function K(){k.powerTip.show(this)},"blur.powertip":function H(){k.powerTip.hide(this,true)},"keydown.powertip":function I(P){if(P.keyCode===27){k.powerTip.hide(this,true)}}})}return this};k.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false};k.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};k.powerTip={show:function z(F,G){if(G){i(G);c.previousX=G.pageX;c.previousY=G.pageY;k(F).data(n).show()}else{k(F).first().data(n).show(true,true)}return F},reposition:function r(F){k(F).first().data(n).resetPosition();return F},hide:function D(G,F){if(G){k(G).first().data(n).hide(F)}else{if(c.activeHover){c.activeHover.data(n).hide(true)}}return G},destroy:function C(G){k(G).off(".powertip").each(function F(){var I=k(this),H=[g,n,e,d];if(I.data(g)){I.attr("title",I.data(g));H.push(y)}I.removeData(H)});return G}};k.powerTip.showTip=k.powerTip.show;k.powerTip.closeTip=k.powerTip.hide;function b(){var F=this;F.top="auto";F.left="auto";F.right="auto";F.bottom="auto";F.set=function(H,G){if(k.isNumeric(G)){F[H]=Math.round(G)}}}function t(K,N,F){var J=null;function L(P,Q){M();if(!K.data(e)){if(!P){c.tipOpenImminent=true;J=setTimeout(function O(){J=null;I()},N.intentPollInterval)}else{if(Q){K.data(d,true)}F.showTip(K)}}}function G(P){M();c.tipOpenImminent=false;if(K.data(e)){K.data(d,false);if(!P){c.delayInProgress=true;J=setTimeout(function O(){J=null;F.hideTip(K);c.delayInProgress=false},N.closeDelay)}else{F.hideTip(K)}}}function I(){var Q=Math.abs(c.previousX-c.currentX),O=Math.abs(c.previousY-c.currentY),P=Q+O;if(P",{id:Q.popupId});if(w.length===0){w=k("body")}w.append(O)}if(Q.followMouse){if(!O.data(u)){A.on("mousemove",M);s.on("scroll",M);O.data(u,true)}}if(Q.mouseOnToPopup){O.on({mouseenter:function L(){if(O.data(f)){if(c.activeHover){c.activeHover.data(n).cancel()}}},mouseleave:function N(){if(c.activeHover){c.activeHover.data(n).hide()}}})}function I(S){S.data(e,true);O.queue(function R(T){H(S);T()})}function H(S){var U;if(!S.data(e)){return}if(c.isTipOpen){if(!c.isClosing){K(c.activeHover)}O.delay(100).queue(function R(V){H(S);V()});return}S.trigger("powerTipPreRender");U=B(S);if(U){O.empty().append(U)}else{return}S.trigger("powerTipRender");c.activeHover=S;c.isTipOpen=true;O.data(f,Q.mouseOnToPopup);if(!Q.followMouse){G(S);c.isFixedTipOpen=true}else{M()}O.fadeIn(Q.fadeInTime,function T(){if(!c.desyncTimeout){c.desyncTimeout=setInterval(J,500)}S.trigger("powerTipOpen")})}function K(R){c.isClosing=true;c.activeHover=null;c.isTipOpen=false;c.desyncTimeout=clearInterval(c.desyncTimeout);R.data(e,false);R.data(d,false);O.fadeOut(Q.fadeOutTime,function S(){var T=new b();c.isClosing=false;c.isFixedTipOpen=false;O.removeClass();T.set("top",c.currentY+Q.offset);T.set("left",c.currentX+Q.offset);O.css(T);R.trigger("powerTipClose")})}function M(){if(!c.isFixedTipOpen&&(c.isTipOpen||(c.tipOpenImminent&&O.data(u)))){var R=O.outerWidth(),V=O.outerHeight(),U=new b(),S,T;U.set("top",c.currentY+Q.offset);U.set("left",c.currentX+Q.offset);S=m(U,R,V);if(S!==p.none){T=a(S);if(T===1){if(S===p.right){U.set("left",c.windowWidth-R)}else{if(S===p.bottom){U.set("top",c.scrollTop+c.windowHeight-V)}}}else{U.set("left",c.currentX-R-Q.offset);U.set("top",c.currentY-V-Q.offset)}}O.css(U)}}function G(S){var R,T;if(Q.smartPlacement){R=k.fn.powerTip.smartPlacementLists[Q.placement];k.each(R,function(U,W){var V=m(F(S,W),O.outerWidth(),O.outerHeight());T=W;if(V===p.none){return false}})}else{F(S,Q.placement);T=Q.placement}O.addClass(T)}function F(U,T){var R=0,S,W,V=new b();V.set("top",0);V.set("left",0);O.css(V);do{S=O.outerWidth();W=O.outerHeight();V=P.compute(U,T,S,W,Q.offset);O.css(V)}while(++R<=5&&(S!==O.outerWidth()||W!==O.outerHeight()));return V}function J(){var R=false;if(c.isTipOpen&&!c.isClosing&&!c.delayInProgress){if(c.activeHover.data(e)===false||c.activeHover.is(":disabled")){R=true}else{if(!v(c.activeHover)&&!c.activeHover.is(":focus")&&!c.activeHover.data(d)){if(O.data(f)){if(!v(O)){R=true}}else{R=true}}}if(R){K(c.activeHover)}}}this.showTip=I;this.hideTip=K;this.resetPosition=G}function q(F){return window.SVGElement&&F[0] instanceof SVGElement}function h(){if(!c.mouseTrackingActive){c.mouseTrackingActive=true;k(function H(){c.scrollLeft=s.scrollLeft();c.scrollTop=s.scrollTop();c.windowWidth=s.width();c.windowHeight=s.height()});A.on("mousemove",i);s.on({resize:function G(){c.windowWidth=s.width();c.windowHeight=s.height()},scroll:function F(){var I=s.scrollLeft(),J=s.scrollTop();if(I!==c.scrollLeft){c.currentX+=I-c.scrollLeft;c.scrollLeft=I}if(J!==c.scrollTop){c.currentY+=J-c.scrollTop;c.scrollTop=J}}})}}function i(F){c.currentX=F.pageX;c.currentY=F.pageY}function v(F){var H=F.offset(),J=F[0].getBoundingClientRect(),I=J.right-J.left,G=J.bottom-J.top;return c.currentX>=H.left&&c.currentX<=H.left+I&&c.currentY>=H.top&&c.currentY<=H.top+G}function B(I){var G=I.data(y),F=I.data(o),K=I.data(l),H,J;if(G){if(k.isFunction(G)){G=G.call(I[0])}J=G}else{if(F){if(k.isFunction(F)){F=F.call(I[0])}if(F.length>0){J=F.clone(true,true)}}else{if(K){H=k("#"+K);if(H.length>0){J=H.html()}}}}return J}function m(M,L,K){var G=c.scrollTop,J=c.scrollLeft,I=G+c.windowHeight,F=J+c.windowWidth,H=p.none;if(M.topI||Math.abs(M.bottom-c.windowHeight)>I){H|=p.bottom}if(M.leftF){H|=p.left}if(M.left+L>F||M.right",{id:Q.popupId});if(w.length===0){w=k("body")}w.append(O)}if(Q.followMouse){if(!O.data(u)){A.on("mousemove",M);s.on("scroll",M);O.data(u,true)}}if(Q.mouseOnToPopup){O.on({mouseenter:function L(){if(O.data(f)){if(c.activeHover){c.activeHover.data(n).cancel()}}},mouseleave:function N(){if(c.activeHover){c.activeHover.data(n).hide()}}})}function I(S){S.data(e,true);O.queue(function R(T){H(S);T()})}function H(S){var U;if(!S.data(e)){return}if(c.isTipOpen){if(!c.isClosing){K(c.activeHover)}O.delay(100).queue(function R(V){H(S);V()});return}S.trigger("powerTipPreRender");U=B(S);if(U){O.empty().append(U)}else{return}S.trigger("powerTipRender");c.activeHover=S;c.isTipOpen=true;O.data(f,Q.mouseOnToPopup);if(!Q.followMouse){G(S);c.isFixedTipOpen=true}else{M()}O.fadeIn(Q.fadeInTime,function T(){if(!c.desyncTimeout){c.desyncTimeout=setInterval(J,500)}S.trigger("powerTipOpen")})}function K(R){c.isClosing=true;c.activeHover=null;c.isTipOpen=false;c.desyncTimeout=clearInterval(c.desyncTimeout);R.data(e,false);R.data(d,false);O.fadeOut(Q.fadeOutTime,function S(){var T=new b();c.isClosing=false;c.isFixedTipOpen=false;O.removeClass();T.set("top",c.currentY+Q.offset);T.set("left",c.currentX+Q.offset);O.css(T);R.trigger("powerTipClose")})}function M(){if(!c.isFixedTipOpen&&(c.isTipOpen||(c.tipOpenImminent&&O.data(u)))){var R=O.outerWidth(),V=O.outerHeight(),U=new b(),S,T;U.set("top",c.currentY+Q.offset);U.set("left",c.currentX+Q.offset);S=m(U,R,V);if(S!==p.none){T=a(S);if(T===1){if(S===p.right){U.set("left",c.windowWidth-R)}else{if(S===p.bottom){U.set("top",c.scrollTop+c.windowHeight-V)}}}else{U.set("left",c.currentX-R-Q.offset);U.set("top",c.currentY-V-Q.offset)}}O.css(U)}}function G(S){var R,T;if(Q.smartPlacement){R=k.fn.powerTip.smartPlacementLists[Q.placement];k.each(R,function(U,W){var V=m(F(S,W),O.outerWidth(),O.outerHeight());T=W;if(V===p.none){return false}})}else{F(S,Q.placement);T=Q.placement}O.addClass(T)}function F(U,T){var R=0,S,W,V=new b();V.set("top",0);V.set("left",0);O.css(V);do{S=O.outerWidth();W=O.outerHeight();V=P.compute(U,T,S,W,Q.offset);O.css(V)}while(++R<=5&&(S!==O.outerWidth()||W!==O.outerHeight()));return V}function J(){var R=false;if(c.isTipOpen&&!c.isClosing&&!c.delayInProgress){if(c.activeHover.data(e)===false||c.activeHover.is(":disabled")){R=true}else{if(!v(c.activeHover)&&!c.activeHover.is(":focus")&&!c.activeHover.data(d)){if(O.data(f)){if(!v(O)){R=true}}else{R=true}}}if(R){K(c.activeHover)}}}this.showTip=I;this.hideTip=K;this.resetPosition=G}function q(F){return window.SVGElement&&F[0] instanceof SVGElement}function h(){if(!c.mouseTrackingActive){c.mouseTrackingActive=true;k(function H(){c.scrollLeft=s.scrollLeft();c.scrollTop=s.scrollTop();c.windowWidth=s.width();c.windowHeight=s.height()});A.on("mousemove",i);s.on({resize:function G(){c.windowWidth=s.width();c.windowHeight=s.height()},scroll:function F(){var I=s.scrollLeft(),J=s.scrollTop();if(I!==c.scrollLeft){c.currentX+=I-c.scrollLeft;c.scrollLeft=I}if(J!==c.scrollTop){c.currentY+=J-c.scrollTop;c.scrollTop=J}}})}}function i(F){c.currentX=F.pageX;c.currentY=F.pageY}function v(F){var H=F.offset(),J=F[0].getBoundingClientRect(),I=J.right-J.left,G=J.bottom-J.top;return c.currentX>=H.left&&c.currentX<=H.left+I&&c.currentY>=H.top&&c.currentY<=H.top+G}function B(I){var G=I.data(y),F=I.data(o),K=I.data(l),H,J;if(G){if(k.isFunction(G)){G=G.call(I[0])}J=G}else{if(F){if(k.isFunction(F)){F=F.call(I[0])}if(F.length>0){J=F.clone(true,true)}}else{if(K){H=k("#"+K);if(H.length>0){J=H.html()}}}}return J}function m(M,L,K){var G=c.scrollTop,J=c.scrollLeft,I=G+c.windowHeight,F=J+c.windowWidth,H=p.none;if(M.topI||Math.abs(M.bottom-c.windowHeight)>I){H|=p.bottom}if(M.leftF){H|=p.left}if(M.left+L>F||M.right1){return}h.preventDefault();var j=h.originalEvent.changedTouches[0],g=document.createEvent("MouseEvents");g.initMouseEvent(i,true,true,window,1,j.screenX,j.screenY,j.clientX,j.clientY,false,false,false,false,0,null);h.target.dispatchEvent(g)}d._touchStart=function(h){var g=this;if(a||!g._mouseCapture(h.originalEvent.changedTouches[0])){return}a=true;g._touchMoved=false;e(h,"mouseover");e(h,"mousemove");e(h,"mousedown")};d._touchMove=function(g){if(!a){return}this._touchMoved=true;e(g,"mousemove")};d._touchEnd=function(g){if(!a){return}e(g,"mouseup");e(g,"mouseout");if(!this._touchMoved){e(g,"click")}a=false};d._mouseInit=function(){var g=this;g.element.bind({touchstart:b.proxy(g,"_touchStart"),touchmove:b.proxy(g,"_touchMove"),touchend:b.proxy(g,"_touchEnd")});f.call(g)};d._mouseDestroy=function(){var g=this;g.element.unbind({touchstart:b.proxy(g,"_touchStart"),touchmove:b.proxy(g,"_touchMove"),touchend:b.proxy(g,"_touchEnd")});c.call(g)}})(jQuery);/*! + * SmartMenus jQuery Plugin - v1.0.0 - January 27, 2016 + * http://www.smartmenus.org/ + * + * Copyright Vasil Dinkov, Vadikom Web Ltd. + * http://vadikom.com + * + * Licensed MIT + */ +(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof module==="object"&&typeof module.exports==="object"){module.exports=a(require("jquery"))}else{a(jQuery)}}}(function(a){var b=[],e=!!window.createPopup,f=false,d="ontouchstart" in window,h=false,g=window.requestAnimationFrame||function(l){return setTimeout(l,1000/60)},c=window.cancelAnimationFrame||function(l){clearTimeout(l)};function k(m){var n=".smartmenus_mouse";if(!h&&!m){var o=true,l=null;a(document).bind(i([["mousemove",function(s){var t={x:s.pageX,y:s.pageY,timeStamp:new Date().getTime()};if(l){var q=Math.abs(l.x-t.x),p=Math.abs(l.y-t.y);if((q>0||p>0)&&q<=2&&p<=2&&t.timeStamp-l.timeStamp<=300){f=true;if(o){var r=a(s.target).closest("a");if(r.is("a")){a.each(b,function(){if(a.contains(this.$root[0],r[0])){this.itemEnter({currentTarget:r[0]});return false}})}o=false}}}l=t}],[d?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut",function(p){if(j(p.originalEvent)){f=false}}]],n));h=true}else{if(h&&m){a(document).unbind(n);h=false}}}function j(l){return !/^(4|mouse)$/.test(l.pointerType)}function i(l,n){if(!n){n=""}var m={};a.each(l,function(o,p){m[p[0].split(" ").join(n+" ")+n]=p[1]});return m}a.SmartMenus=function(m,l){this.$root=a(m);this.opts=l;this.rootId="";this.accessIdPrefix="";this.$subArrow=null;this.activatedItems=[];this.visibleSubMenus=[];this.showTimeout=0;this.hideTimeout=0;this.scrollTimeout=0;this.clickActivated=false;this.focusActivated=false;this.zIndexInc=0;this.idInc=0;this.$firstLink=null;this.$firstSub=null;this.disabled=false;this.$disableOverlay=null;this.$touchScrollingSub=null;this.cssTransforms3d="perspective" in m.style||"webkitPerspective" in m.style;this.wasCollapsible=false;this.init()};a.extend(a.SmartMenus,{hideAll:function(){a.each(b,function(){this.menuHideAll()})},destroy:function(){while(b.length){b[0].destroy()}k(true)},prototype:{init:function(n){var l=this;if(!n){b.push(this);this.rootId=(new Date().getTime()+Math.random()+"").replace(/\D/g,"");this.accessIdPrefix="sm-"+this.rootId+"-";if(this.$root.hasClass("sm-rtl")){this.opts.rightToLeftSubMenus=true}var r=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).bind(i([["mouseover focusin",a.proxy(this.rootOver,this)],["mouseout focusout",a.proxy(this.rootOut,this)],["keydown",a.proxy(this.rootKeyDown,this)]],r)).delegate("a",i([["mouseenter",a.proxy(this.itemEnter,this)],["mouseleave",a.proxy(this.itemLeave,this)],["mousedown",a.proxy(this.itemDown,this)],["focus",a.proxy(this.itemFocus,this)],["blur",a.proxy(this.itemBlur,this)],["click",a.proxy(this.itemClick,this)]],r));r+=this.rootId;if(this.opts.hideOnClick){a(document).bind(i([["touchstart",a.proxy(this.docTouchStart,this)],["touchmove",a.proxy(this.docTouchMove,this)],["touchend",a.proxy(this.docTouchEnd,this)],["click",a.proxy(this.docClick,this)]],r))}a(window).bind(i([["resize orientationchange",a.proxy(this.winResize,this)]],r));if(this.opts.subIndicators){this.$subArrow=a("").addClass("sub-arrow");if(this.opts.subIndicatorsText){this.$subArrow.html(this.opts.subIndicatorsText)}}k()}this.$firstSub=this.$root.find("ul").each(function(){l.menuInit(a(this))}).eq(0);this.$firstLink=this.$root.find("a").eq(0);if(this.opts.markCurrentItem){var p=/(index|default)\.[^#\?\/]*/i,m=/#.*/,q=window.location.href.replace(p,""),o=q.replace(m,"");this.$root.find("a").each(function(){var s=this.href.replace(p,""),t=a(this);if(s==q||s==o){t.addClass("current");if(l.opts.markCurrentTree){t.parentsUntil("[data-smartmenus-id]","ul").each(function(){a(this).dataSM("parent-a").addClass("current")})}}})}this.wasCollapsible=this.isCollapsible()},destroy:function(m){if(!m){var n=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").unbind(n).undelegate(n);n+=this.rootId;a(document).unbind(n);a(window).unbind(n);if(this.opts.subIndicators){this.$subArrow=null}}this.menuHideAll();var l=this;this.$root.find("ul").each(function(){var o=a(this);if(o.dataSM("scroll-arrows")){o.dataSM("scroll-arrows").remove()}if(o.dataSM("shown-before")){if(l.opts.subMenusMinWidth||l.opts.subMenusMaxWidth){o.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap")}if(o.dataSM("scroll-arrows")){o.dataSM("scroll-arrows").remove()}o.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})}if((o.attr("id")||"").indexOf(l.accessIdPrefix)==0){o.removeAttr("id")}}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("ie-shim").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded");this.$root.find("a.has-submenu").each(function(){var o=a(this);if(o.attr("id").indexOf(l.accessIdPrefix)==0){o.removeAttr("id")}}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub");if(this.opts.subIndicators){this.$root.find("span.sub-arrow").remove()}if(this.opts.markCurrentItem){this.$root.find("a.current").removeClass("current")}if(!m){this.$root=null;this.$firstLink=null;this.$firstSub=null;if(this.$disableOverlay){this.$disableOverlay.remove();this.$disableOverlay=null}b.splice(a.inArray(this,b),1)}},disable:function(l){if(!this.disabled){this.menuHideAll();if(!l&&!this.opts.isPopup&&this.$root.is(":visible")){var m=this.$root.offset();this.$disableOverlay=a('
').css({position:"absolute",top:m.top,left:m.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(true),opacity:0}).appendTo(document.body)}this.disabled=true}},docClick:function(l){if(this.$touchScrollingSub){this.$touchScrollingSub=null;return}if(this.visibleSubMenus.length&&!a.contains(this.$root[0],l.target)||a(l.target).is("a")){this.menuHideAll()}},docTouchEnd:function(m){if(!this.lastTouch){return}if(this.visibleSubMenus.length&&(this.lastTouch.x2===undefined||this.lastTouch.x1==this.lastTouch.x2)&&(this.lastTouch.y2===undefined||this.lastTouch.y1==this.lastTouch.y2)&&(!this.lastTouch.target||!a.contains(this.$root[0],this.lastTouch.target))){if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}var l=this;this.hideTimeout=setTimeout(function(){l.menuHideAll()},350)}this.lastTouch=null},docTouchMove:function(m){if(!this.lastTouch){return}var l=m.originalEvent.touches[0];this.lastTouch.x2=l.pageX;this.lastTouch.y2=l.pageY},docTouchStart:function(m){var l=m.originalEvent.touches[0];this.lastTouch={x1:l.pageX,y1:l.pageY,target:l.target}},enable:function(){if(this.disabled){if(this.$disableOverlay){this.$disableOverlay.remove();this.$disableOverlay=null}this.disabled=false}},getClosestMenu:function(m){var l=a(m).closest("ul");while(l.dataSM("in-mega")){l=l.parent().closest("ul")}return l[0]||null},getHeight:function(l){return this.getOffset(l,true)},getOffset:function(n,l){var m;if(n.css("display")=="none"){m={position:n[0].style.position,visibility:n[0].style.visibility};n.css({position:"absolute",visibility:"hidden"}).show()}var o=n[0].getBoundingClientRect&&n[0].getBoundingClientRect(),p=o&&(l?o.height||o.bottom-o.top:o.width||o.right-o.left);if(!p&&p!==0){p=l?n[0].offsetHeight:n[0].offsetWidth}if(m){n.hide().css(m)}return p},getStartZIndex:function(l){var m=parseInt(this[l?"$root":"$firstSub"].css("z-index"));if(!l&&isNaN(m)){m=parseInt(this.$root.css("z-index"))}return !isNaN(m)?m:1},getTouchPoint:function(l){return l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0]||l},getViewport:function(l){var m=l?"Height":"Width",o=document.documentElement["client"+m],n=window["inner"+m];if(n){o=Math.min(o,n)}return o},getViewportHeight:function(){return this.getViewport(true)},getViewportWidth:function(){return this.getViewport()},getWidth:function(l){return this.getOffset(l)},handleEvents:function(){return !this.disabled&&this.isCSSOn()},handleItemEvents:function(l){return this.handleEvents()&&!this.isLinkInMegaMenu(l)},isCollapsible:function(){return this.$firstSub.css("position")=="static"},isCSSOn:function(){return this.$firstLink.css("display")=="block"},isFixed:function(){var l=this.$root.css("position")=="fixed";if(!l){this.$root.parentsUntil("body").each(function(){if(a(this).css("position")=="fixed"){l=true;return false}})}return l},isLinkInMegaMenu:function(l){return a(this.getClosestMenu(l[0])).hasClass("mega-menu")},isTouchMode:function(){return !f||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(p,l){var n=p.closest("ul"),q=n.dataSM("level");if(q>1&&(!this.activatedItems[q-2]||this.activatedItems[q-2][0]!=n.dataSM("parent-a")[0])){var m=this;a(n.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(n).each(function(){m.itemActivate(a(this).dataSM("parent-a"))})}if(!this.isCollapsible()||l){this.menuHideSubMenus(!this.activatedItems[q-1]||this.activatedItems[q-1][0]!=p[0]?q-1:q)}this.activatedItems[q-1]=p;if(this.$root.triggerHandler("activate.smapi",p[0])===false){return}var o=p.dataSM("sub");if(o&&(this.isTouchMode()||(!this.opts.showOnClick||this.clickActivated))){this.menuShow(o)}},itemBlur:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}this.$root.triggerHandler("blur.smapi",l[0])},itemClick:function(o){var n=a(o.currentTarget);if(!this.handleItemEvents(n)){return}if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==n.closest("ul")[0]){this.$touchScrollingSub=null;o.stopPropagation();return false}if(this.$root.triggerHandler("click.smapi",n[0])===false){return false}var p=a(o.target).is("span.sub-arrow"),m=n.dataSM("sub"),l=m?m.dataSM("level")==2:false;if(m&&!m.is(":visible")){if(this.opts.showOnClick&&l){this.clickActivated=true}this.itemActivate(n);if(m.is(":visible")){this.focusActivated=true;return false}}else{if(this.isCollapsible()&&p){this.itemActivate(n);this.menuHide(m);return false}}if(this.opts.showOnClick&&l||n.hasClass("disabled")||this.$root.triggerHandler("select.smapi",n[0])===false){return false}},itemDown:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}l.dataSM("mousedown",true)},itemEnter:function(n){var m=a(n.currentTarget);if(!this.handleItemEvents(m)){return}if(!this.isTouchMode()){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}var l=this;this.showTimeout=setTimeout(function(){l.itemActivate(m)},this.opts.showOnClick&&m.closest("ul").dataSM("level")==1?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",m[0])},itemFocus:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}if(this.focusActivated&&(!this.isTouchMode()||!l.dataSM("mousedown"))&&(!this.activatedItems.length||this.activatedItems[this.activatedItems.length-1][0]!=l[0])){this.itemActivate(l,true)}this.$root.triggerHandler("focus.smapi",l[0])},itemLeave:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}if(!this.isTouchMode()){l[0].blur();if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}}l.removeDataSM("mousedown");this.$root.triggerHandler("mouseleave.smapi",l[0])},menuHide:function(m){if(this.$root.triggerHandler("beforehide.smapi",m[0])===false){return}m.stop(true,true);if(m.css("display")!="none"){var l=function(){m.css("z-index","")};if(this.isCollapsible()){if(this.opts.collapsibleHideFunction){this.opts.collapsibleHideFunction.call(this,m,l)}else{m.hide(this.opts.collapsibleHideDuration,l)}}else{if(this.opts.hideFunction){this.opts.hideFunction.call(this,m,l)}else{m.hide(this.opts.hideDuration,l)}}if(m.dataSM("ie-shim")){m.dataSM("ie-shim").remove().css({"-webkit-transform":"",transform:""})}if(m.dataSM("scroll")){this.menuScrollStop(m);m.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).unbind(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()}m.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false");m.attr({"aria-expanded":"false","aria-hidden":"true"});var n=m.dataSM("level");this.activatedItems.splice(n-1,1);this.visibleSubMenus.splice(a.inArray(m,this.visibleSubMenus),1);this.$root.triggerHandler("hide.smapi",m[0])}},menuHideAll:function(){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}var m=this.opts.isPopup?1:0;for(var l=this.visibleSubMenus.length-1;l>=m;l--){this.menuHide(this.visibleSubMenus[l])}if(this.opts.isPopup){this.$root.stop(true,true);if(this.$root.is(":visible")){if(this.opts.hideFunction){this.opts.hideFunction.call(this,this.$root)}else{this.$root.hide(this.opts.hideDuration)}if(this.$root.dataSM("ie-shim")){this.$root.dataSM("ie-shim").remove()}}}this.activatedItems=[];this.visibleSubMenus=[];this.clickActivated=false;this.focusActivated=false;this.zIndexInc=0;this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(n){for(var l=this.activatedItems.length-1;l>=n;l--){var m=this.activatedItems[l].dataSM("sub");if(m){this.menuHide(m)}}},menuIframeShim:function(l){if(e&&this.opts.overlapControlsInIE&&!l.dataSM("ie-shim")){l.dataSM("ie-shim",a(" +
+ + +
+
+
WiiCameraReadme
+
+
+

Please see http://wiibrew.org/wiki/Wiimote#IR_Camera for the complete capabilities of the Wii camera. The IR camera code was written based on the above website and with support from Kristian Lauszus.

+

This library is large, if you run into memory problems when uploading to the Arduino, disable serial debugging.

+

To enable the IR camera code, simply set ENABLE_WII_IR_CAMERA to 1 in settings.h.

+

This library implements the following settings:

+
    +
  • Report sensitivity mode: 00 00 00 00 00 00 90 00 41 40 00 Suggested by inio (high sensitivity)
  • +
  • Data Format: Extended mode (0x03). Full mode is not working yet. The output reports 0x3e and 0x3f need tampering with
      +
    • In this mode the camera outputs x and y coordinates and a size dimension for the 4 brightest points.
    • +
    +
  • +
+

Again, read through http://wiibrew.org/wiki/Wiimote#IR_Camera to get an understanding of the camera and its settings.

+
+ + + + diff --git a/menu.js b/menu.js new file mode 100644 index 00000000..89aaf575 --- /dev/null +++ b/menu.js @@ -0,0 +1,50 @@ +/* + @licstart The following is the entire license notice for the + JavaScript code in this file. + + Copyright (C) 1997-2017 by Dimitri van Heesch + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + @licend The above is the entire license notice + for the JavaScript code in this file + */ +function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { + function makeTree(data,relPath) { + var result=''; + if ('children' in data) { + result+=''; + } + return result; + } + + $('#main-nav').append(makeTree(menudata,relPath)); + $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); + if (searchEnabled) { + if (serverSide) { + $('#main-menu').append('
  • '); + } else { + $('#main-menu').append('
  • '); + } + } + $('#main-menu').smartmenus(); +} +/* @license-end */ diff --git a/menudata.js b/menudata.js new file mode 100644 index 00000000..c758126b --- /dev/null +++ b/menudata.js @@ -0,0 +1,196 @@ +/* +@ @licstart The following is the entire license notice for the +JavaScript code in this file. + +Copyright (C) 1997-2017 by Dimitri van Heesch + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +@licend The above is the entire license notice +for the JavaScript code in this file +*/ +var menudata={children:[ +{text:"Main Page",url:"index.html"}, +{text:"Related Pages",url:"pages.html"}, +{text:"Classes",url:"annotated.html",children:[ +{text:"Class List",url:"annotated.html"}, +{text:"Class Index",url:"classes.html"}, +{text:"Class Hierarchy",url:"inherits.html"}, +{text:"Class Members",url:"functions.html",children:[ +{text:"All",url:"functions.html",children:[ +{text:"_",url:"functions.html#index__"}, +{text:"a",url:"functions_a.html#index_a"}, +{text:"b",url:"functions_b.html#index_b"}, +{text:"c",url:"functions_c.html#index_c"}, +{text:"d",url:"functions_d.html#index_d"}, +{text:"e",url:"functions_e.html#index_e"}, +{text:"f",url:"functions_f.html#index_f"}, +{text:"g",url:"functions_g.html#index_g"}, +{text:"h",url:"functions_h.html#index_h"}, +{text:"i",url:"functions_i.html#index_i"}, +{text:"k",url:"functions_k.html#index_k"}, +{text:"l",url:"functions_l.html#index_l"}, +{text:"m",url:"functions_m.html#index_m"}, +{text:"n",url:"functions_n.html#index_n"}, +{text:"o",url:"functions_o.html#index_o"}, +{text:"p",url:"functions_p.html#index_p"}, +{text:"q",url:"functions_q.html#index_q"}, +{text:"r",url:"functions_r.html#index_r"}, +{text:"s",url:"functions_s.html#index_s"}, +{text:"t",url:"functions_t.html#index_t"}, +{text:"u",url:"functions_u.html#index_u"}, +{text:"v",url:"functions_v.html#index_v"}, +{text:"w",url:"functions_w.html#index_w"}, +{text:"x",url:"functions_x.html#index_x"}, +{text:"y",url:"functions_y.html#index_y"}]}, +{text:"Functions",url:"functions_func.html",children:[ +{text:"a",url:"functions_func.html#index_a"}, +{text:"b",url:"functions_func_b.html#index_b"}, +{text:"c",url:"functions_func_c.html#index_c"}, +{text:"d",url:"functions_func_d.html#index_d"}, +{text:"e",url:"functions_func_e.html#index_e"}, +{text:"f",url:"functions_func_f.html#index_f"}, +{text:"g",url:"functions_func_g.html#index_g"}, +{text:"h",url:"functions_func_h.html#index_h"}, +{text:"i",url:"functions_func_i.html#index_i"}, +{text:"k",url:"functions_func_k.html#index_k"}, +{text:"l",url:"functions_func_l.html#index_l"}, +{text:"m",url:"functions_func_m.html#index_m"}, +{text:"n",url:"functions_func_n.html#index_n"}, +{text:"o",url:"functions_func_o.html#index_o"}, +{text:"p",url:"functions_func_p.html#index_p"}, +{text:"r",url:"functions_func_r.html#index_r"}, +{text:"s",url:"functions_func_s.html#index_s"}, +{text:"t",url:"functions_func_t.html#index_t"}, +{text:"u",url:"functions_func_u.html#index_u"}, +{text:"v",url:"functions_func_v.html#index_v"}, +{text:"w",url:"functions_func_w.html#index_w"}, +{text:"x",url:"functions_func_x.html#index_x"}]}, +{text:"Variables",url:"functions_vars.html",children:[ +{text:"_",url:"functions_vars.html#index__"}, +{text:"a",url:"functions_vars_a.html#index_a"}, +{text:"b",url:"functions_vars_b.html#index_b"}, +{text:"c",url:"functions_vars_c.html#index_c"}, +{text:"d",url:"functions_vars_d.html#index_d"}, +{text:"e",url:"functions_vars_e.html#index_e"}, +{text:"f",url:"functions_vars_f.html#index_f"}, +{text:"g",url:"functions_vars_g.html#index_g"}, +{text:"h",url:"functions_vars_h.html#index_h"}, +{text:"i",url:"functions_vars_i.html#index_i"}, +{text:"k",url:"functions_vars_k.html#index_k"}, +{text:"l",url:"functions_vars_l.html#index_l"}, +{text:"m",url:"functions_vars_m.html#index_m"}, +{text:"n",url:"functions_vars_n.html#index_n"}, +{text:"o",url:"functions_vars_o.html#index_o"}, +{text:"p",url:"functions_vars_p.html#index_p"}, +{text:"q",url:"functions_vars_q.html#index_q"}, +{text:"r",url:"functions_vars_r.html#index_r"}, +{text:"s",url:"functions_vars_s.html#index_s"}, +{text:"t",url:"functions_vars_t.html#index_t"}, +{text:"u",url:"functions_vars_u.html#index_u"}, +{text:"v",url:"functions_vars_v.html#index_v"}, +{text:"w",url:"functions_vars_w.html#index_w"}, +{text:"x",url:"functions_vars_x.html#index_x"}, +{text:"y",url:"functions_vars_y.html#index_y"}]}, +{text:"Typedefs",url:"functions_type.html"}, +{text:"Enumerations",url:"functions_enum.html"}, +{text:"Enumerator",url:"functions_eval.html"}]}]}, +{text:"Files",url:"files.html",children:[ +{text:"File List",url:"files.html"}, +{text:"File Members",url:"globals.html",children:[ +{text:"All",url:"globals.html",children:[ +{text:"_",url:"globals.html#index__"}, +{text:"a",url:"globals_a.html#index_a"}, +{text:"b",url:"globals_b.html#index_b"}, +{text:"c",url:"globals_c.html#index_c"}, +{text:"d",url:"globals_d.html#index_d"}, +{text:"e",url:"globals_e.html#index_e"}, +{text:"f",url:"globals_f.html#index_f"}, +{text:"g",url:"globals_g.html#index_g"}, +{text:"h",url:"globals_h.html#index_h"}, +{text:"i",url:"globals_i.html#index_i"}, +{text:"j",url:"globals_j.html#index_j"}, +{text:"k",url:"globals_k.html#index_k"}, +{text:"l",url:"globals_l.html#index_l"}, +{text:"m",url:"globals_m.html#index_m"}, +{text:"n",url:"globals_n.html#index_n"}, +{text:"o",url:"globals_o.html#index_o"}, +{text:"p",url:"globals_p.html#index_p"}, +{text:"r",url:"globals_r.html#index_r"}, +{text:"s",url:"globals_s.html#index_s"}, +{text:"t",url:"globals_t.html#index_t"}, +{text:"u",url:"globals_u.html#index_u"}, +{text:"v",url:"globals_v.html#index_v"}, +{text:"w",url:"globals_w.html#index_w"}, +{text:"x",url:"globals_x.html#index_x"}, +{text:"y",url:"globals_y.html#index_y"}, +{text:"z",url:"globals_z.html#index_z"}]}, +{text:"Functions",url:"globals_func.html"}, +{text:"Variables",url:"globals_vars.html",children:[ +{text:"p",url:"globals_vars.html#index_p"}, +{text:"r",url:"globals_vars_r.html#index_r"}, +{text:"u",url:"globals_vars_u.html#index_u"}, +{text:"w",url:"globals_vars_w.html#index_w"}, +{text:"x",url:"globals_vars_x.html#index_x"}]}, +{text:"Typedefs",url:"globals_type.html"}, +{text:"Enumerations",url:"globals_enum.html"}, +{text:"Enumerator",url:"globals_eval.html",children:[ +{text:"a",url:"globals_eval.html#index_a"}, +{text:"b",url:"globals_eval.html#index_b"}, +{text:"c",url:"globals_eval.html#index_c"}, +{text:"d",url:"globals_eval.html#index_d"}, +{text:"f",url:"globals_eval.html#index_f"}, +{text:"g",url:"globals_eval.html#index_g"}, +{text:"h",url:"globals_eval.html#index_h"}, +{text:"k",url:"globals_eval.html#index_k"}, +{text:"l",url:"globals_eval.html#index_l"}, +{text:"m",url:"globals_eval.html#index_m"}, +{text:"n",url:"globals_eval.html#index_n"}, +{text:"o",url:"globals_eval.html#index_o"}, +{text:"p",url:"globals_eval.html#index_p"}, +{text:"r",url:"globals_eval.html#index_r"}, +{text:"s",url:"globals_eval.html#index_s"}, +{text:"t",url:"globals_eval.html#index_t"}, +{text:"u",url:"globals_eval.html#index_u"}, +{text:"v",url:"globals_eval.html#index_v"}, +{text:"w",url:"globals_eval.html#index_w"}, +{text:"x",url:"globals_eval.html#index_x"}, +{text:"y",url:"globals_eval.html#index_y"}, +{text:"z",url:"globals_eval.html#index_z"}]}, +{text:"Macros",url:"globals_defs.html",children:[ +{text:"_",url:"globals_defs.html#index__"}, +{text:"a",url:"globals_defs_a.html#index_a"}, +{text:"b",url:"globals_defs_b.html#index_b"}, +{text:"c",url:"globals_defs_c.html#index_c"}, +{text:"d",url:"globals_defs_d.html#index_d"}, +{text:"e",url:"globals_defs_e.html#index_e"}, +{text:"f",url:"globals_defs_f.html#index_f"}, +{text:"g",url:"globals_defs_g.html#index_g"}, +{text:"h",url:"globals_defs_h.html#index_h"}, +{text:"i",url:"globals_defs_i.html#index_i"}, +{text:"j",url:"globals_defs_j.html#index_j"}, +{text:"k",url:"globals_defs_k.html#index_k"}, +{text:"l",url:"globals_defs_l.html#index_l"}, +{text:"m",url:"globals_defs_m.html#index_m"}, +{text:"n",url:"globals_defs_n.html#index_n"}, +{text:"o",url:"globals_defs_o.html#index_o"}, +{text:"p",url:"globals_defs_p.html#index_p"}, +{text:"r",url:"globals_defs_r.html#index_r"}, +{text:"s",url:"globals_defs_s.html#index_s"}, +{text:"t",url:"globals_defs_t.html#index_t"}, +{text:"u",url:"globals_defs_u.html#index_u"}, +{text:"v",url:"globals_defs_v.html#index_v"}, +{text:"w",url:"globals_defs_w.html#index_w"}, +{text:"x",url:"globals_defs_x.html#index_x"}]}]}]}]} diff --git a/message_8cpp.html b/message_8cpp.html index 8a9c0e1f..745def40 100644 --- a/message_8cpp.html +++ b/message_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: message.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
     

    Function Documentation

    - + +

    ◆ E_Notifyc()

    +
    @@ -148,11 +130,13 @@ Variables
    -

    Definition at line 24 of file message.cpp.

    +

    Definition at line 31 of file message.cpp.

    - + +

    ◆ E_Notify() [1/3]

    +
    @@ -176,11 +160,13 @@ Variables
    -

    Definition at line 34 of file message.cpp.

    +

    Definition at line 41 of file message.cpp.

    - + +

    ◆ E_NotifyStr()

    +
    @@ -204,11 +190,13 @@ Variables
    -

    Definition at line 42 of file message.cpp.

    +

    Definition at line 49 of file message.cpp.

    - + +

    ◆ E_Notify() [2/3]

    +
    @@ -232,11 +220,13 @@ Variables
    -

    Definition at line 50 of file message.cpp.

    +

    Definition at line 57 of file message.cpp.

    - + +

    ◆ E_Notify() [3/3]

    +
    @@ -260,12 +250,14 @@ Variables
    -

    Definition at line 60 of file message.cpp.

    +

    Definition at line 67 of file message.cpp.

    Variable Documentation

    - + +

    ◆ UsbDEBUGlvl

    +
    @@ -275,7 +267,7 @@ Variables
    -

    Definition at line 22 of file message.cpp.

    +

    Definition at line 29 of file message.cpp.

    @@ -284,7 +276,7 @@ Variables diff --git a/message_8cpp__incl.md5 b/message_8cpp__incl.md5 index eaddf38a..5577f8dd 100644 --- a/message_8cpp__incl.md5 +++ b/message_8cpp__incl.md5 @@ -1 +1 @@ -cf24426f0f48ee21386b9f704dde4bb5 \ No newline at end of file +8dfd0a2f9c402eac5b70227f63e9b2d4 \ No newline at end of file diff --git a/message_8cpp__incl.png b/message_8cpp__incl.png index 133047b1..0b8de399 100644 Binary files a/message_8cpp__incl.png and b/message_8cpp__incl.png differ diff --git a/message_8cpp_source.html b/message_8cpp_source.html index df0cd78e..9ccedae0 100644 --- a/message_8cpp_source.html +++ b/message_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: message.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    message.cpp
    -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 #include "Usb.h"
    19 // 0x80 is the default (i.e. trace) to turn off set this global to something lower.
    20 // this allows for 126 other debugging levels.
    21 // TO-DO: Allow assignment to a different serial port by software
    22 int UsbDEBUGlvl = 0x80;
    23 
    24 void E_Notifyc(char c, int lvl) {
    25  if(UsbDEBUGlvl < lvl) return;
    26 #if defined(ARDUINO) && ARDUINO >=100
    27  USB_HOST_SERIAL.print(c);
    28 #else
    29  USB_HOST_SERIAL.print(c, BYTE);
    30 #endif
    31  //USB_HOST_SERIAL.flush();
    32 }
    33 
    34 void E_Notify(char const * msg, int lvl) {
    35  if(UsbDEBUGlvl < lvl) return;
    36  if(!msg) return;
    37  char c;
    38 
    39  while((c = pgm_read_byte(msg++))) E_Notifyc(c, lvl);
    40 }
    41 
    42 void E_NotifyStr(char const * msg, int lvl) {
    43  if(UsbDEBUGlvl < lvl) return;
    44  if(!msg) return;
    45  char c;
    46 
    47  while((c = *msg++)) E_Notifyc(c, lvl);
    48 }
    49 
    50 void E_Notify(uint8_t b, int lvl) {
    51  if(UsbDEBUGlvl < lvl) return;
    52 #if defined(ARDUINO) && ARDUINO >=100
    53  USB_HOST_SERIAL.print(b);
    54 #else
    55  USB_HOST_SERIAL.print(b, DEC);
    56 #endif
    57  //USB_HOST_SERIAL.flush();
    58 }
    59 
    60 void E_Notify(double d, int lvl) {
    61  if(UsbDEBUGlvl < lvl) return;
    62  USB_HOST_SERIAL.print(d);
    63  //USB_HOST_SERIAL.flush();
    64 }
    65 
    66 #ifdef DEBUG_USB_HOST
    67 
    68 void NotifyFailGetDevDescr(void) {
    69  Notify(PSTR("\r\ngetDevDescr "), 0x80);
    70 }
    71 
    72 void NotifyFailSetDevTblEntry(void) {
    73  Notify(PSTR("\r\nsetDevTblEn "), 0x80);
    74 }
    75 
    76 void NotifyFailGetConfDescr(void) {
    77  Notify(PSTR("\r\ngetConf "), 0x80);
    78 }
    79 
    80 void NotifyFailSetConfDescr(void) {
    81  Notify(PSTR("\r\nsetConf "), 0x80);
    82 }
    83 
    84 void NotifyFailGetDevDescr(uint8_t reason) {
    86  NotifyFail(reason);
    87 }
    88 
    89 void NotifyFailSetDevTblEntry(uint8_t reason) {
    91  NotifyFail(reason);
    92 
    93 }
    94 
    95 void NotifyFailGetConfDescr(uint8_t reason) {
    97  NotifyFail(reason);
    98 }
    99 
    100 void NotifyFailSetConfDescr(uint8_t reason) {
    102  NotifyFail(reason);
    103 }
    104 
    105 void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID) {
    106  Notify(PSTR("\r\nUnknown Device Connected - VID: "), 0x80);
    107  D_PrintHex<uint16_t > (VID, 0x80);
    108  Notify(PSTR(" PID: "), 0x80);
    109  D_PrintHex<uint16_t > (PID, 0x80);
    110 }
    111 
    112 void NotifyFail(uint8_t rcode) {
    113  D_PrintHex<uint8_t > (rcode, 0x80);
    114  Notify(PSTR("\r\n"), 0x80);
    115 }
    116 #endif
    void E_NotifyStr(char const *msg, int lvl)
    Definition: message.cpp:42
    -
    #define NotifyFail(...)
    Definition: message.h:55
    +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 
    25 #include "Usb.h"
    26 // 0x80 is the default (i.e. trace) to turn off set this global to something lower.
    27 // this allows for 126 other debugging levels.
    28 // TO-DO: Allow assignment to a different serial port by software
    29 int UsbDEBUGlvl = 0x80;
    30 
    31 void E_Notifyc(char c, int lvl) {
    32  if(UsbDEBUGlvl < lvl) return;
    33 #if defined(ARDUINO) && ARDUINO >=100
    34  USB_HOST_SERIAL.print(c);
    35 #else
    36  USB_HOST_SERIAL.print(c, BYTE);
    37 #endif
    38  //USB_HOST_SERIAL.flush();
    39 }
    40 
    41 void E_Notify(char const * msg, int lvl) {
    42  if(UsbDEBUGlvl < lvl) return;
    43  if(!msg) return;
    44  char c;
    45 
    46  while((c = pgm_read_byte(msg++))) E_Notifyc(c, lvl);
    47 }
    48 
    49 void E_NotifyStr(char const * msg, int lvl) {
    50  if(UsbDEBUGlvl < lvl) return;
    51  if(!msg) return;
    52  char c;
    53 
    54  while((c = *msg++)) E_Notifyc(c, lvl);
    55 }
    56 
    57 void E_Notify(uint8_t b, int lvl) {
    58  if(UsbDEBUGlvl < lvl) return;
    59 #if defined(ARDUINO) && ARDUINO >=100
    60  USB_HOST_SERIAL.print(b);
    61 #else
    62  USB_HOST_SERIAL.print(b, DEC);
    63 #endif
    64  //USB_HOST_SERIAL.flush();
    65 }
    66 
    67 void E_Notify(double d, int lvl) {
    68  if(UsbDEBUGlvl < lvl) return;
    69  USB_HOST_SERIAL.print(d);
    70  //USB_HOST_SERIAL.flush();
    71 }
    72 
    73 #ifdef DEBUG_USB_HOST
    74 
    75 void NotifyFailGetDevDescr(void) {
    76  Notify(PSTR("\r\ngetDevDescr "), 0x80);
    77 }
    78 
    79 void NotifyFailSetDevTblEntry(void) {
    80  Notify(PSTR("\r\nsetDevTblEn "), 0x80);
    81 }
    82 
    83 void NotifyFailGetConfDescr(void) {
    84  Notify(PSTR("\r\ngetConf "), 0x80);
    85 }
    86 
    87 void NotifyFailSetConfDescr(void) {
    88  Notify(PSTR("\r\nsetConf "), 0x80);
    89 }
    90 
    91 void NotifyFailGetDevDescr(uint8_t reason) {
    93  NotifyFail(reason);
    94 }
    95 
    96 void NotifyFailSetDevTblEntry(uint8_t reason) {
    98  NotifyFail(reason);
    99 
    100 }
    101 
    102 void NotifyFailGetConfDescr(uint8_t reason) {
    104  NotifyFail(reason);
    105 }
    106 
    107 void NotifyFailSetConfDescr(uint8_t reason) {
    109  NotifyFail(reason);
    110 }
    111 
    112 void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID) {
    113  Notify(PSTR("\r\nUnknown Device Connected - VID: "), 0x80);
    114  D_PrintHex<uint16_t > (VID, 0x80);
    115  Notify(PSTR(" PID: "), 0x80);
    116  D_PrintHex<uint16_t > (PID, 0x80);
    117 }
    118 
    119 void NotifyFail(uint8_t rcode) {
    120  D_PrintHex<uint8_t > (rcode, 0x80);
    121  Notify(PSTR("\r\n"), 0x80);
    122 }
    123 #endif
    void E_NotifyStr(char const *msg, int lvl)
    Definition: message.cpp:49
    +
    #define NotifyFail(...)
    Definition: message.h:62
    -
    #define pgm_read_byte(addr)
    -
    #define NotifyFailGetDevDescr(...)
    Definition: message.h:50
    -
    void E_Notifyc(char c, int lvl)
    Definition: message.cpp:24
    -
    #define Notify(...)
    Definition: message.h:44
    -
    #define USB_HOST_SERIAL
    Definition: settings.h:34
    -
    #define NotifyFailGetConfDescr(...)
    Definition: message.h:52
    -
    #define NotifyFailUnknownDevice(...)
    Definition: message.h:54
    -
    #define PSTR(str)
    -
    void E_Notify(char const *msg, int lvl)
    Definition: message.cpp:34
    -
    #define NotifyFailSetConfDescr(...)
    Definition: message.h:53
    -
    int UsbDEBUGlvl
    Definition: message.cpp:22
    -
    #define NotifyFailSetDevTblEntry(...)
    Definition: message.h:51
    +
    #define pgm_read_byte(addr)
    +
    #define NotifyFailGetDevDescr(...)
    Definition: message.h:57
    +
    void E_Notifyc(char c, int lvl)
    Definition: message.cpp:31
    +
    #define Notify(...)
    Definition: message.h:51
    +
    #define USB_HOST_SERIAL
    Definition: settings.h:49
    +
    #define NotifyFailGetConfDescr(...)
    Definition: message.h:59
    +
    #define NotifyFailUnknownDevice(...)
    Definition: message.h:61
    +
    #define PSTR(str)
    +
    void E_Notify(char const *msg, int lvl)
    Definition: message.cpp:41
    +
    #define NotifyFailSetConfDescr(...)
    Definition: message.h:60
    +
    int UsbDEBUGlvl
    Definition: message.cpp:29
    +
    #define NotifyFailSetDevTblEntry(...)
    Definition: message.h:58
    diff --git a/message_8h.html b/message_8h.html index ddf40998..4d508b58 100644 --- a/message_8h.html +++ b/message_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: message.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
     

    Macro Definition Documentation

    - + +

    ◆ Notify

    +
    @@ -161,11 +143,13 @@ Variables
    -

    Definition at line 44 of file message.h.

    +

    Definition at line 51 of file message.h.

    - + +

    ◆ NotifyStr

    +
    @@ -179,11 +163,13 @@ Variables
    -

    Definition at line 45 of file message.h.

    +

    Definition at line 52 of file message.h.

    - + +

    ◆ Notifyc

    +
    @@ -197,11 +183,13 @@ Variables
    -

    Definition at line 46 of file message.h.

    +

    Definition at line 53 of file message.h.

    - + +

    ◆ NotifyFailGetDevDescr [1/2]

    +
    @@ -215,11 +203,13 @@ Variables
    -

    Definition at line 50 of file message.h.

    +

    Definition at line 57 of file message.h.

    - + +

    ◆ NotifyFailSetDevTblEntry [1/2]

    +
    @@ -233,11 +223,13 @@ Variables
    -

    Definition at line 51 of file message.h.

    +

    Definition at line 58 of file message.h.

    - + +

    ◆ NotifyFailGetConfDescr [1/2]

    +
    @@ -251,11 +243,13 @@ Variables
    -

    Definition at line 52 of file message.h.

    +

    Definition at line 59 of file message.h.

    - + +

    ◆ NotifyFailGetDevDescr [2/2]

    +
    @@ -269,11 +263,13 @@ Variables
    -

    Definition at line 50 of file message.h.

    +

    Definition at line 57 of file message.h.

    - + +

    ◆ NotifyFailSetDevTblEntry [2/2]

    +
    @@ -287,11 +283,13 @@ Variables
    -

    Definition at line 51 of file message.h.

    +

    Definition at line 58 of file message.h.

    - + +

    ◆ NotifyFailGetConfDescr [2/2]

    +
    @@ -305,11 +303,13 @@ Variables
    -

    Definition at line 52 of file message.h.

    +

    Definition at line 59 of file message.h.

    - + +

    ◆ NotifyFailSetConfDescr

    +
    @@ -323,11 +323,13 @@ Variables
    -

    Definition at line 53 of file message.h.

    +

    Definition at line 60 of file message.h.

    - + +

    ◆ NotifyFailUnknownDevice

    +
    @@ -341,11 +343,13 @@ Variables
    -

    Definition at line 54 of file message.h.

    +

    Definition at line 61 of file message.h.

    - + +

    ◆ NotifyFail

    +
    @@ -359,12 +363,14 @@ Variables
    -

    Definition at line 55 of file message.h.

    +

    Definition at line 62 of file message.h.

    Function Documentation

    - + +

    ◆ E_Notify() [1/2]

    +
    @@ -388,11 +394,13 @@ Variables
    -

    Definition at line 34 of file message.cpp.

    +

    Definition at line 41 of file message.cpp.

    - + +

    ◆ E_Notify() [2/2]

    +
    @@ -416,11 +424,13 @@ Variables
    -

    Definition at line 50 of file message.cpp.

    +

    Definition at line 57 of file message.cpp.

    - + +

    ◆ E_NotifyStr()

    +
    @@ -444,11 +454,13 @@ Variables
    -

    Definition at line 42 of file message.cpp.

    +

    Definition at line 49 of file message.cpp.

    - + +

    ◆ E_Notifyc()

    +
    @@ -472,11 +484,13 @@ Variables
    -

    Definition at line 24 of file message.cpp.

    +

    Definition at line 31 of file message.cpp.

    - + +

    ◆ ErrorMessage() [1/2]

    +
    @@ -508,11 +522,13 @@ template<class ERROR_TYPE >
    -

    Definition at line 59 of file message.h.

    +

    Definition at line 66 of file message.h.

    - + +

    ◆ ErrorMessage() [2/2]

    +
    @@ -538,12 +554,14 @@ template<class ERROR_TYPE >
    -

    Definition at line 69 of file message.h.

    +

    Definition at line 76 of file message.h.

    Variable Documentation

    - + +

    ◆ UsbDEBUGlvl

    +
    @@ -553,7 +571,7 @@ template<class ERROR_TYPE >
    -

    Definition at line 22 of file message.cpp.

    +

    Definition at line 29 of file message.cpp.

    @@ -562,7 +580,7 @@ template<class ERROR_TYPE >
    diff --git a/message_8h_source.html b/message_8h_source.html index 51bcfd64..215499b1 100644 --- a/message_8h_source.html +++ b/message_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: message.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
    message.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 #if !defined(_usb_h_) || defined(__MESSAGE_H__)
    18 #error "Never include message.h directly; include Usb.h instead"
    19 #else
    20 #define __MESSAGE_H__
    21 
    22 extern int UsbDEBUGlvl;
    23 
    24 void E_Notify(char const * msg, int lvl);
    25 void E_Notify(uint8_t b, int lvl);
    26 void E_NotifyStr(char const * msg, int lvl);
    27 void E_Notifyc(char c, int lvl);
    28 
    29 #ifdef DEBUG_USB_HOST
    30 #define Notify E_Notify
    31 #define NotifyStr E_NotifyStr
    32 #define Notifyc E_Notifyc
    33 void NotifyFailGetDevDescr(uint8_t reason);
    34 void NotifyFailSetDevTblEntry(uint8_t reason);
    35 void NotifyFailGetConfDescr(uint8_t reason);
    36 void NotifyFailSetConfDescr(uint8_t reason);
    37 void NotifyFailGetDevDescr(void);
    38 void NotifyFailSetDevTblEntry(void);
    39 void NotifyFailGetConfDescr(void);
    40 void NotifyFailSetConfDescr(void);
    41 void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID);
    42 void NotifyFail(uint8_t rcode);
    43 #else
    44 #define Notify(...) ((void)0)
    45 #define NotifyStr(...) ((void)0)
    46 #define Notifyc(...) ((void)0)
    47 #define NotifyFailGetDevDescr(...) ((void)0)
    48 #define NotifyFailSetDevTblEntry(...) ((void)0)
    49 #define NotifyFailGetConfDescr(...) ((void)0)
    50 #define NotifyFailGetDevDescr(...) ((void)0)
    51 #define NotifyFailSetDevTblEntry(...) ((void)0)
    52 #define NotifyFailGetConfDescr(...) ((void)0)
    53 #define NotifyFailSetConfDescr(...) ((void)0)
    54 #define NotifyFailUnknownDevice(...) ((void)0)
    55 #define NotifyFail(...) ((void)0)
    56 #endif
    57 
    58 template <class ERROR_TYPE>
    59 void ErrorMessage(uint8_t level, char const * msg, ERROR_TYPE rcode = 0) {
    60 #ifdef DEBUG_USB_HOST
    61  Notify(msg, level);
    62  Notify(PSTR(": "), level);
    63  D_PrintHex<ERROR_TYPE > (rcode, level);
    64  Notify(PSTR("\r\n"), level);
    65 #endif
    66 }
    67 
    68 template <class ERROR_TYPE>
    69 void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) {
    70 #ifdef DEBUG_USB_HOST
    71  Notify(msg, 0x80);
    72  Notify(PSTR(": "), 0x80);
    73  D_PrintHex<ERROR_TYPE > (rcode, 0x80);
    74  Notify(PSTR("\r\n"), 0x80);
    75 #endif
    76 }
    77 
    78 #endif // __MESSAGE_H__
    void E_Notify(char const *msg, int lvl)
    Definition: message.cpp:34
    -
    #define NotifyFail(...)
    Definition: message.h:55
    -
    #define NotifyFailGetDevDescr(...)
    Definition: message.h:50
    -
    void E_NotifyStr(char const *msg, int lvl)
    Definition: message.cpp:42
    -
    #define Notify(...)
    Definition: message.h:44
    -
    #define NotifyFailGetConfDescr(...)
    Definition: message.h:52
    -
    #define NotifyFailUnknownDevice(...)
    Definition: message.h:54
    -
    void E_Notifyc(char c, int lvl)
    Definition: message.cpp:24
    -
    #define PSTR(str)
    -
    int UsbDEBUGlvl
    Definition: message.cpp:22
    -
    void ErrorMessage(uint8_t level, char const *msg, ERROR_TYPE rcode=0)
    Definition: message.h:59
    -
    #define NotifyFailSetConfDescr(...)
    Definition: message.h:53
    -
    #define NotifyFailSetDevTblEntry(...)
    Definition: message.h:51
    +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 #if !defined(_usb_h_) || defined(__MESSAGE_H__)
    25 #error "Never include message.h directly; include Usb.h instead"
    26 #else
    27 #define __MESSAGE_H__
    28 
    29 extern int UsbDEBUGlvl;
    30 
    31 void E_Notify(char const * msg, int lvl);
    32 void E_Notify(uint8_t b, int lvl);
    33 void E_NotifyStr(char const * msg, int lvl);
    34 void E_Notifyc(char c, int lvl);
    35 
    36 #ifdef DEBUG_USB_HOST
    37 #define Notify E_Notify
    38 #define NotifyStr E_NotifyStr
    39 #define Notifyc E_Notifyc
    40 void NotifyFailGetDevDescr(uint8_t reason);
    41 void NotifyFailSetDevTblEntry(uint8_t reason);
    42 void NotifyFailGetConfDescr(uint8_t reason);
    43 void NotifyFailSetConfDescr(uint8_t reason);
    44 void NotifyFailGetDevDescr(void);
    45 void NotifyFailSetDevTblEntry(void);
    46 void NotifyFailGetConfDescr(void);
    47 void NotifyFailSetConfDescr(void);
    48 void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID);
    49 void NotifyFail(uint8_t rcode);
    50 #else
    51 #define Notify(...) ((void)0)
    52 #define NotifyStr(...) ((void)0)
    53 #define Notifyc(...) ((void)0)
    54 #define NotifyFailGetDevDescr(...) ((void)0)
    55 #define NotifyFailSetDevTblEntry(...) ((void)0)
    56 #define NotifyFailGetConfDescr(...) ((void)0)
    57 #define NotifyFailGetDevDescr(...) ((void)0)
    58 #define NotifyFailSetDevTblEntry(...) ((void)0)
    59 #define NotifyFailGetConfDescr(...) ((void)0)
    60 #define NotifyFailSetConfDescr(...) ((void)0)
    61 #define NotifyFailUnknownDevice(...) ((void)0)
    62 #define NotifyFail(...) ((void)0)
    63 #endif
    64 
    65 template <class ERROR_TYPE>
    66 void ErrorMessage(uint8_t level, char const * msg, ERROR_TYPE rcode = 0) {
    67 #ifdef DEBUG_USB_HOST
    68  Notify(msg, level);
    69  Notify(PSTR(": "), level);
    70  D_PrintHex<ERROR_TYPE > (rcode, level);
    71  Notify(PSTR("\r\n"), level);
    72 #endif
    73 }
    74 
    75 template <class ERROR_TYPE>
    76 void ErrorMessage(char const * msg __attribute__((unused)), ERROR_TYPE rcode __attribute__((unused)) = 0) {
    77 #ifdef DEBUG_USB_HOST
    78  Notify(msg, 0x80);
    79  Notify(PSTR(": "), 0x80);
    80  D_PrintHex<ERROR_TYPE > (rcode, 0x80);
    81  Notify(PSTR("\r\n"), 0x80);
    82 #endif
    83 }
    84 
    85 #endif // __MESSAGE_H__
    void E_Notify(char const *msg, int lvl)
    Definition: message.cpp:41
    +
    #define NotifyFail(...)
    Definition: message.h:62
    +
    #define NotifyFailGetDevDescr(...)
    Definition: message.h:57
    +
    void E_NotifyStr(char const *msg, int lvl)
    Definition: message.cpp:49
    +
    #define Notify(...)
    Definition: message.h:51
    +
    #define NotifyFailGetConfDescr(...)
    Definition: message.h:59
    +
    #define NotifyFailUnknownDevice(...)
    Definition: message.h:61
    +
    void E_Notifyc(char c, int lvl)
    Definition: message.cpp:31
    +
    #define PSTR(str)
    +
    int UsbDEBUGlvl
    Definition: message.cpp:29
    +
    void ErrorMessage(uint8_t level, char const *msg, ERROR_TYPE rcode=0)
    Definition: message.h:66
    +
    #define NotifyFailSetConfDescr(...)
    Definition: message.h:60
    +
    #define NotifyFailSetDevTblEntry(...)
    Definition: message.h:58
    diff --git a/pages.html b/pages.html index d134310c..9a73081d 100644 --- a/pages.html +++ b/pages.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Related Pages @@ -11,9 +12,6 @@ - @@ -32,34 +30,22 @@
    - + - + + + +
    Here is a list of all related documentation pages:
    @@ -90,7 +76,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/parsetools_8cpp.html b/parsetools_8cpp.html index a84fa644..906bea83 100644 --- a/parsetools_8cpp.html +++ b/parsetools_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: parsetools.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
    diff --git a/parsetools_8cpp__incl.md5 b/parsetools_8cpp__incl.md5 index 6b33ed81..6156c826 100644 --- a/parsetools_8cpp__incl.md5 +++ b/parsetools_8cpp__incl.md5 @@ -1 +1 @@ -f52981a37509b50aa32fe60062bf932d \ No newline at end of file +a3293fd6ab335a9b25f5cff9388a7952 \ No newline at end of file diff --git a/parsetools_8cpp__incl.png b/parsetools_8cpp__incl.png index 9b9c69fc..30f8e858 100644 Binary files a/parsetools_8cpp__incl.png and b/parsetools_8cpp__incl.png differ diff --git a/parsetools_8cpp_source.html b/parsetools_8cpp_source.html index dcb22d32..3ba385ef 100644 --- a/parsetools_8cpp_source.html +++ b/parsetools_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: parsetools.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    parsetools.cpp
    -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 #include "Usb.h"
    18 
    19 bool MultiByteValueParser::Parse(uint8_t **pp, uint16_t *pcntdn) {
    20  if(!pBuf) {
    21  Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80);
    22  return false;
    23  }
    24  for(; countDown && (*pcntdn); countDown--, (*pcntdn)--, (*pp)++)
    25  pBuf[valueSize - countDown] = (**pp);
    26 
    27  if(countDown)
    28  return false;
    29 
    30  countDown = valueSize;
    31  return true;
    32 }
    33 
    34 bool PTPListParser::Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me) {
    35  switch(nStage) {
    36  case 0:
    37  pBuf->valueSize = lenSize;
    38  theParser.Initialize(pBuf);
    39  nStage = 1;
    40 
    41  case 1:
    42  if(!theParser.Parse(pp, pcntdn))
    43  return false;
    44 
    45  arLen = 0;
    46  arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue));
    47  arLenCntdn = arLen;
    48  nStage = 2;
    49 
    50  case 2:
    51  pBuf->valueSize = valSize;
    52  theParser.Initialize(pBuf);
    53  nStage = 3;
    54 
    55  case 3:
    56  for(; arLenCntdn; arLenCntdn--) {
    57  if(!theParser.Parse(pp, pcntdn))
    58  return false;
    59 
    60  if(pf)
    61  pf(pBuf, (arLen - arLenCntdn), me);
    62  }
    63 
    64  nStage = 0;
    65  }
    66  return true;
    67 }
    void(* PTP_ARRAY_EL_FUNC)(const MultiValueBuffer *const p, uint32_t count, const void *me)
    Definition: parsetools.h:81
    +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 #include "Usb.h"
    25 
    26 bool MultiByteValueParser::Parse(uint8_t **pp, uint16_t *pcntdn) {
    27  if(!pBuf) {
    28  Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80);
    29  return false;
    30  }
    31  for(; countDown && (*pcntdn); countDown--, (*pcntdn)--, (*pp)++)
    32  pBuf[valueSize - countDown] = (**pp);
    33 
    34  if(countDown)
    35  return false;
    36 
    37  countDown = valueSize;
    38  return true;
    39 }
    40 
    41 bool PTPListParser::Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me) {
    42  switch(nStage) {
    43  case 0:
    44  pBuf->valueSize = lenSize;
    45  theParser.Initialize(pBuf);
    46  nStage = 1;
    47 
    48  case 1:
    49  if(!theParser.Parse(pp, pcntdn))
    50  return false;
    51 
    52  arLen = 0;
    53  arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue));
    54  arLenCntdn = arLen;
    55  nStage = 2;
    56 
    57  case 2:
    58  pBuf->valueSize = valSize;
    59  theParser.Initialize(pBuf);
    60  nStage = 3;
    61 
    62  case 3:
    63  for(; arLenCntdn; arLenCntdn--) {
    64  if(!theParser.Parse(pp, pcntdn))
    65  return false;
    66 
    67  if(pf)
    68  pf(pBuf, (arLen - arLenCntdn), me);
    69  }
    70 
    71  nStage = 0;
    72  }
    73  return true;
    74 }
    void(* PTP_ARRAY_EL_FUNC)(const MultiValueBuffer *const p, uint32_t count, const void *me)
    Definition: parsetools.h:88
    -
    #define Notify(...)
    Definition: message.h:44
    -
    bool Parse(uint8_t **pp, uint16_t *pcntdn)
    Definition: parsetools.cpp:19
    -
    #define PSTR(str)
    -
    bool Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me=NULL)
    Definition: parsetools.cpp:34
    +
    #define Notify(...)
    Definition: message.h:51
    +
    bool Parse(uint8_t **pp, uint16_t *pcntdn)
    Definition: parsetools.cpp:26
    +
    #define PSTR(str)
    +
    uint8_t valueSize
    Definition: parsetools.h:31
    +
    void Initialize(MultiValueBuffer *const pbuf)
    Definition: parsetools.h:49
    +
    bool Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me=NULL)
    Definition: parsetools.cpp:41
    +
    diff --git a/parsetools_8h.html b/parsetools_8h.html index 7ddc7cee..853802a7 100644 --- a/parsetools_8h.html +++ b/parsetools_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: parsetools.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
     

    Typedef Documentation

    - + +

    ◆ PTP_ARRAY_EL_FUNC

    +
    @@ -123,7 +105,7 @@ Typedefs
    -

    Definition at line 81 of file parsetools.h.

    +

    Definition at line 88 of file parsetools.h.

    @@ -132,7 +114,7 @@ Typedefs diff --git a/parsetools_8h_source.html b/parsetools_8h_source.html index bcfd67c9..e6449cc2 100644 --- a/parsetools_8h_source.html +++ b/parsetools_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: parsetools.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    parsetools.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(_usb_h_) || defined(__PARSETOOLS_H__)
    19 #error "Never include parsetools.h directly; include Usb.h instead"
    20 #else
    21 #define __PARSETOOLS_H__
    22 
    24  uint8_t valueSize;
    25  void *pValue;
    26 } __attribute__((packed));
    27 
    29  uint8_t * pBuf;
    30  uint8_t countDown;
    31  uint8_t valueSize;
    32 
    33 public:
    34 
    35  MultiByteValueParser() : pBuf(NULL), countDown(0), valueSize(0) {
    36  };
    37 
    38  const uint8_t* GetBuffer() {
    39  return pBuf;
    40  };
    41 
    42  void Initialize(MultiValueBuffer * const pbuf) {
    43  pBuf = (uint8_t*)pbuf->pValue;
    44  countDown = valueSize = pbuf->valueSize;
    45  };
    46 
    47  bool Parse(uint8_t **pp, uint16_t *pcntdn);
    48 };
    49 
    50 class ByteSkipper {
    51  uint8_t *pBuf;
    52  uint8_t nStage;
    53  uint16_t countDown;
    54 
    55 public:
    56 
    57  ByteSkipper() : pBuf(NULL), nStage(0), countDown(0) {
    58  };
    59 
    61  pBuf = (uint8_t*)pbuf->pValue;
    62  countDown = 0;
    63  };
    64 
    65  bool Skip(uint8_t **pp, uint16_t *pcntdn, uint16_t bytes_to_skip) {
    66  switch(nStage) {
    67  case 0:
    68  countDown = bytes_to_skip;
    69  nStage++;
    70  case 1:
    71  for(; countDown && (*pcntdn); countDown--, (*pp)++, (*pcntdn)--);
    72 
    73  if(!countDown)
    74  nStage = 0;
    75  };
    76  return (!countDown);
    77  };
    78 };
    79 
    80 // Pointer to a callback function triggered for each element of PTP array when used with PTPArrayParser
    81 typedef void (*PTP_ARRAY_EL_FUNC)(const MultiValueBuffer * const p, uint32_t count, const void *me);
    82 
    84 public:
    85 
    86  enum ParseMode {
    87  modeArray, modeRange/*, modeEnum*/
    88  };
    89 
    90 private:
    91  uint8_t nStage;
    92  uint8_t enStage;
    93 
    94  uint32_t arLen;
    95  uint32_t arLenCntdn;
    96 
    97  uint8_t lenSize; // size of the array length field in bytes
    98  uint8_t valSize; // size of the array element in bytes
    99 
    100  MultiValueBuffer *pBuf;
    101 
    102  // The only parser for both size and array element parsing
    103  MultiByteValueParser theParser;
    104 
    105  uint8_t /*ParseMode*/ prsMode;
    106 
    107 public:
    108 
    110  nStage(0),
    111  enStage(0),
    112  arLen(0),
    113  arLenCntdn(0),
    114  lenSize(0),
    115  valSize(0),
    116  pBuf(NULL),
    117  prsMode(modeArray) {
    118  };
    119 
    120  void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer * const p, const uint8_t mode = modeArray) {
    121  pBuf = p;
    122  lenSize = len_size;
    123  valSize = val_size;
    124  prsMode = mode;
    125 
    126  if(prsMode == modeRange) {
    127  arLenCntdn = arLen = 3;
    128  nStage = 2;
    129  } else {
    130  arLenCntdn = arLen = 0;
    131  nStage = 0;
    132  }
    133  enStage = 0;
    134  theParser.Initialize(p);
    135  };
    136 
    137  bool Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me = NULL);
    138 };
    139 
    140 #endif // __PARSETOOLS_H__
    void(* PTP_ARRAY_EL_FUNC)(const MultiValueBuffer *const p, uint32_t count, const void *me)
    Definition: parsetools.h:81
    - -
    const uint8_t * GetBuffer()
    Definition: parsetools.h:38
    - - - -
    bool Skip(uint8_t **pp, uint16_t *pcntdn, uint16_t bytes_to_skip)
    Definition: parsetools.h:65
    -
    void Initialize(MultiValueBuffer *pbuf)
    Definition: parsetools.h:60
    - -
    void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer *const p, const uint8_t mode=modeArray)
    Definition: parsetools.h:120
    - -
    uint8_t valueSize
    Definition: parsetools.h:24
    -
    void Initialize(MultiValueBuffer *const pbuf)
    Definition: parsetools.h:42
    - - - +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 
    25 #if !defined(_usb_h_) || defined(__PARSETOOLS_H__)
    26 #error "Never include parsetools.h directly; include Usb.h instead"
    27 #else
    28 #define __PARSETOOLS_H__
    29 
    31  uint8_t valueSize;
    32  void *pValue;
    33 } __attribute__((packed));
    34 
    36  uint8_t * pBuf;
    37  uint8_t countDown;
    38  uint8_t valueSize;
    39 
    40 public:
    41 
    42  MultiByteValueParser() : pBuf(NULL), countDown(0), valueSize(0) {
    43  };
    44 
    45  const uint8_t* GetBuffer() {
    46  return pBuf;
    47  };
    48 
    49  void Initialize(MultiValueBuffer * const pbuf) {
    50  pBuf = (uint8_t*)pbuf->pValue;
    51  countDown = valueSize = pbuf->valueSize;
    52  };
    53 
    54  bool Parse(uint8_t **pp, uint16_t *pcntdn);
    55 };
    56 
    57 class ByteSkipper {
    58  uint8_t *pBuf;
    59  uint8_t nStage;
    60  uint16_t countDown;
    61 
    62 public:
    63 
    64  ByteSkipper() : pBuf(NULL), nStage(0), countDown(0) {
    65  };
    66 
    68  pBuf = (uint8_t*)pbuf->pValue;
    69  countDown = 0;
    70  };
    71 
    72  bool Skip(uint8_t **pp, uint16_t *pcntdn, uint16_t bytes_to_skip) {
    73  switch(nStage) {
    74  case 0:
    75  countDown = bytes_to_skip;
    76  nStage++;
    77  case 1:
    78  for(; countDown && (*pcntdn); countDown--, (*pp)++, (*pcntdn)--);
    79 
    80  if(!countDown)
    81  nStage = 0;
    82  };
    83  return (!countDown);
    84  };
    85 };
    86 
    87 // Pointer to a callback function triggered for each element of PTP array when used with PTPArrayParser
    88 typedef void (*PTP_ARRAY_EL_FUNC)(const MultiValueBuffer * const p, uint32_t count, const void *me);
    89 
    91 public:
    92 
    93  enum ParseMode {
    94  modeArray, modeRange/*, modeEnum*/
    95  };
    96 
    97 private:
    98  uint8_t nStage;
    99  uint8_t enStage;
    100 
    101  uint32_t arLen;
    102  uint32_t arLenCntdn;
    103 
    104  uint8_t lenSize; // size of the array length field in bytes
    105  uint8_t valSize; // size of the array element in bytes
    106 
    107  MultiValueBuffer *pBuf;
    108 
    109  // The only parser for both size and array element parsing
    110  MultiByteValueParser theParser;
    111 
    112  uint8_t /*ParseMode*/ prsMode;
    113 
    114 public:
    115 
    117  nStage(0),
    118  enStage(0),
    119  arLen(0),
    120  arLenCntdn(0),
    121  lenSize(0),
    122  valSize(0),
    123  pBuf(NULL),
    124  prsMode(modeArray) {
    125  };
    126 
    127  void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer * const p, const uint8_t mode = modeArray) {
    128  pBuf = p;
    129  lenSize = len_size;
    130  valSize = val_size;
    131  prsMode = mode;
    132 
    133  if(prsMode == modeRange) {
    134  arLenCntdn = arLen = 3;
    135  nStage = 2;
    136  } else {
    137  arLenCntdn = arLen = 0;
    138  nStage = 0;
    139  }
    140  enStage = 0;
    141  theParser.Initialize(p);
    142  };
    143 
    144  bool Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me = NULL);
    145 };
    146 
    147 #endif // __PARSETOOLS_H__
    void(* PTP_ARRAY_EL_FUNC)(const MultiValueBuffer *const p, uint32_t count, const void *me)
    Definition: parsetools.h:88
    + + +
    const uint8_t * GetBuffer()
    Definition: parsetools.h:45
    + + + +
    bool Skip(uint8_t **pp, uint16_t *pcntdn, uint16_t bytes_to_skip)
    Definition: parsetools.h:72
    +
    void Initialize(MultiValueBuffer *pbuf)
    Definition: parsetools.h:67
    + +
    bool Parse(uint8_t **pp, uint16_t *pcntdn)
    Definition: parsetools.cpp:26
    +
    void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer *const p, const uint8_t mode=modeArray)
    Definition: parsetools.h:127
    + + +
    uint8_t valueSize
    Definition: parsetools.h:31
    +
    void Initialize(MultiValueBuffer *const pbuf)
    Definition: parsetools.h:49
    + + +
    bool Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me=NULL)
    Definition: parsetools.cpp:41
    +
    diff --git a/printhex_8h.html b/printhex_8h.html index 964e9576..ba336088 100644 --- a/printhex_8h.html +++ b/printhex_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: printhex.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
     

    Function Documentation

    - + +

    ◆ E_Notifyc()

    +
    @@ -143,11 +125,13 @@ Functions
    -

    Definition at line 24 of file message.cpp.

    +

    Definition at line 31 of file message.cpp.

    - + +

    ◆ PrintHex()

    +
    @@ -173,11 +157,13 @@ template<class T >
    -

    Definition at line 26 of file printhex.h.

    +

    Definition at line 33 of file printhex.h.

    - + +

    ◆ PrintBin()

    +
    @@ -203,11 +189,13 @@ template<class T >
    -

    Definition at line 37 of file printhex.h.

    +

    Definition at line 44 of file printhex.h.

    - + +

    ◆ SerialPrintHex()

    +
    @@ -223,11 +211,13 @@ template<class T >
    -

    Definition at line 46 of file printhex.h.

    +

    Definition at line 53 of file printhex.h.

    - + +

    ◆ PrintHex2()

    +
    @@ -253,11 +243,13 @@ template<class T >
    -

    Definition at line 57 of file printhex.h.

    +

    Definition at line 64 of file printhex.h.

    - + +

    ◆ D_PrintHex()

    +
    @@ -283,11 +275,13 @@ template<class T >
    -

    Definition at line 69 of file printhex.h.

    +

    Definition at line 76 of file printhex.h.

    - + +

    ◆ D_PrintBin()

    +
    @@ -313,7 +307,7 @@ template<class T >
    -

    Definition at line 76 of file printhex.h.

    +

    Definition at line 83 of file printhex.h.

    @@ -322,7 +316,7 @@ template<class T >
    diff --git a/printhex_8h_source.html b/printhex_8h_source.html index 3db230c4..6e5ed92b 100644 --- a/printhex_8h_source.html +++ b/printhex_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: printhex.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
    printhex.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(_usb_h_) || defined(__PRINTHEX_H__)
    19 #error "Never include printhex.h directly; include Usb.h instead"
    20 #else
    21 #define __PRINTHEX_H__
    22 
    23 void E_Notifyc(char c, int lvl);
    24 
    25 template <class T>
    26 void PrintHex(T val, int lvl) {
    27  int num_nibbles = sizeof (T) * 2;
    28 
    29  do {
    30  char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f);
    31  if(v > 57) v += 7;
    32  E_Notifyc(v, lvl);
    33  } while(--num_nibbles);
    34 }
    35 
    36 template <class T>
    37 void PrintBin(T val, int lvl) {
    38  for(T mask = (((T)1) << ((sizeof (T) << 3) - 1)); mask; mask >>= 1)
    39  if(val & mask)
    40  E_Notifyc('1', lvl);
    41  else
    42  E_Notifyc('0', lvl);
    43 }
    44 
    45 template <class T>
    46 void SerialPrintHex(T val) {
    47  int num_nibbles = sizeof (T) * 2;
    48 
    49  do {
    50  char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f);
    51  if(v > 57) v += 7;
    52  USB_HOST_SERIAL.print(v);
    53  } while(--num_nibbles);
    54 }
    55 
    56 template <class T>
    57 void PrintHex2(Print *prn, T val) {
    58  T mask = (((T)1) << (((sizeof (T) << 1) - 1) << 2));
    59 
    60  while(mask > 1) {
    61  if(val < mask)
    62  prn->print("0");
    63 
    64  mask >>= 4;
    65  }
    66  prn->print((T)val, HEX);
    67 }
    68 
    69 template <class T> void D_PrintHex(T val, int lvl) {
    70 #ifdef DEBUG_USB_HOST
    71  PrintHex<T > (val, lvl);
    72 #endif
    73 }
    74 
    75 template <class T>
    76 void D_PrintBin(T val, int lvl) {
    77 #ifdef DEBUG_USB_HOST
    78  PrintBin<T > (val, lvl);
    79 #endif
    80 }
    81 
    82 
    83 
    84 #endif // __PRINTHEX_H__
    void SerialPrintHex(T val)
    Definition: printhex.h:46
    -
    void PrintBin(T val, int lvl)
    Definition: printhex.h:37
    -
    #define USB_HOST_SERIAL
    Definition: settings.h:34
    -
    void D_PrintBin(T val, int lvl)
    Definition: printhex.h:76
    -
    void E_Notifyc(char c, int lvl)
    Definition: message.cpp:24
    - -
    void PrintHex(T val, int lvl)
    Definition: printhex.h:26
    -
    void PrintHex2(Print *prn, T val)
    Definition: printhex.h:57
    -
    void D_PrintHex(T val, int lvl)
    Definition: printhex.h:69
    +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 
    25 #if !defined(_usb_h_) || defined(__PRINTHEX_H__)
    26 #error "Never include printhex.h directly; include Usb.h instead"
    27 #else
    28 #define __PRINTHEX_H__
    29 
    30 void E_Notifyc(char c, int lvl);
    31 
    32 template <class T>
    33 void PrintHex(T val, int lvl) {
    34  int num_nibbles = sizeof (T) * 2;
    35 
    36  do {
    37  char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f);
    38  if(v > 57) v += 7;
    39  E_Notifyc(v, lvl);
    40  } while(--num_nibbles);
    41 }
    42 
    43 template <class T>
    44 void PrintBin(T val, int lvl) {
    45  for(T mask = (((T)1) << ((sizeof (T) << 3) - 1)); mask; mask >>= 1)
    46  if(val & mask)
    47  E_Notifyc('1', lvl);
    48  else
    49  E_Notifyc('0', lvl);
    50 }
    51 
    52 template <class T>
    53 void SerialPrintHex(T val) {
    54  int num_nibbles = sizeof (T) * 2;
    55 
    56  do {
    57  char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f);
    58  if(v > 57) v += 7;
    59  USB_HOST_SERIAL.print(v);
    60  } while(--num_nibbles);
    61 }
    62 
    63 template <class T>
    64 void PrintHex2(Print *prn, T val) {
    65  T mask = (((T)1) << (((sizeof (T) << 1) - 1) << 2));
    66 
    67  while(mask > 1) {
    68  if(val < mask)
    69  prn->print("0");
    70 
    71  mask >>= 4;
    72  }
    73  prn->print((T)val, HEX);
    74 }
    75 
    76 template <class T> void D_PrintHex(T val __attribute__((unused)), int lvl __attribute__((unused))) {
    77 #ifdef DEBUG_USB_HOST
    78  PrintHex<T > (val, lvl);
    79 #endif
    80 }
    81 
    82 template <class T>
    83 void D_PrintBin(T val, int lvl) {
    84 #ifdef DEBUG_USB_HOST
    85  PrintBin<T > (val, lvl);
    86 #endif
    87 }
    88 
    89 
    90 
    91 #endif // __PRINTHEX_H__
    void SerialPrintHex(T val)
    Definition: printhex.h:53
    +
    void PrintBin(T val, int lvl)
    Definition: printhex.h:44
    +
    #define USB_HOST_SERIAL
    Definition: settings.h:49
    +
    void D_PrintBin(T val, int lvl)
    Definition: printhex.h:83
    +
    void E_Notifyc(char c, int lvl)
    Definition: message.cpp:31
    + +
    void PrintHex(T val, int lvl)
    Definition: printhex.h:33
    +
    void PrintHex2(Print *prn, T val)
    Definition: printhex.h:64
    +
    void D_PrintHex(T val, int lvl)
    Definition: printhex.h:76
    diff --git a/search/all_0.html b/search/all_0.html index d54e0bd8..5125b940 100644 --- a/search/all_0.html +++ b/search/all_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_1.html b/search/all_1.html index 8cc6a1de..b8ff8711 100644 --- a/search/all_1.html +++ b/search/all_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_10.html b/search/all_10.html index c25484f2..50bc449e 100644 --- a/search/all_10.html +++ b/search/all_10.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_10.js b/search/all_10.js index b3f4d9ec..786b5bc8 100644 --- a/search/all_10.js +++ b/search/all_10.js @@ -7,7 +7,7 @@ var searchData= ['pairwithwiimote',['pairWithWiimote',['../class_b_t_d.html#a6b66a27c0fd359e3129f53451352b55c',1,'BTD']]], ['parse',['Parse',['../class_config_desc_parser.html#a3722ad1dbbfcd4ecf5cbf9caf08cd517',1,'ConfigDescParser::Parse()'],['../class_hex_dumper.html#acaff9c9e5b97bbfe3596c7b7a2e2a78d',1,'HexDumper::Parse()'],['../class_mouse_report_parser.html#aed02196a692f8b633fbbebc76eefd4a1',1,'MouseReportParser::Parse()'],['../class_keyboard_report_parser.html#a122bfa9d4baa9f85010aea8245c2295c',1,'KeyboardReportParser::Parse()'],['../class_report_desc_parser_base.html#a7ecd266cbbbc18460ab8823651225e6b',1,'ReportDescParserBase::Parse()'],['../class_universal_report_parser.html#a77f459e6751a2ca360574e91a89f92b9',1,'UniversalReportParser::Parse()'],['../class_multi_byte_value_parser.html#a9d380bf3ab3fee2c8797883504bcd827',1,'MultiByteValueParser::Parse()'],['../class_p_t_p_list_parser.html#a15ebdbc2ca861bc6e6d051273cf3b66e',1,'PTPListParser::Parse()'],['../class_p_s4_parser.html#a6498fdeb767364e84ce09ef208980622',1,'PS4Parser::Parse()'],['../class_sink_parser.html#ac6cf61bb48d61cb7db178c62c5f86fd0',1,'SinkParser::Parse()'],['../class_u_s_b_read_parser.html#afdb9cea2a2fe18d26f4ec595b86a7f7c',1,'USBReadParser::Parse()'],['../class_h_i_d_report_parser.html#af6c4b832fad296860bae406730e792da',1,'HIDReportParser::Parse()']]], ['parsebthiddata',['ParseBTHIDData',['../class_b_t_h_i_d.html#a4de4a1efd32000a0cf5a884456e52c7d',1,'BTHID::ParseBTHIDData()'],['../class_p_s4_b_t.html#a0d92689d0c24e62ddc7a1b3c4c658512',1,'PS4BT::ParseBTHIDData()']]], - ['parseconfigdescr',['parseConfigDescr',['../class_u_s_b_h___m_i_d_i.html#a92359b023ab411c86af8efb7283c0e9f',1,'USBH_MIDI']]], + ['parseconfigdescr',['parseConfigDescr',['../class_u_s_b_h___m_i_d_i.html#aabe63c64fbcee52e7c724d489cd19394',1,'USBH_MIDI']]], ['parsehiddata',['ParseHIDData',['../class_h_i_d_composite.html#ac01dac60c82bd850509696252cd9b651',1,'HIDComposite::ParseHIDData()'],['../class_h_i_d_universal.html#a5d6e27f817d6d2c67692783a02872939',1,'HIDUniversal::ParseHIDData()'],['../class_p_s4_u_s_b.html#a8222cea2ec47bff310d6e5fbada9e695',1,'PS4USB::ParseHIDData()'],['../class_p_s_buzz.html#a73e7a2f4b5537a692d699dc7c57ca6d6',1,'PSBuzz::ParseHIDData()']]], ['parseitem',['ParseItem',['../class_report_desc_parser_base.html#ac1d6c015d9a2527bb2044e9a96fcaaf9',1,'ReportDescParserBase::ParseItem()'],['../class_report_desc_parser2.html#a84242b62a5d202b5d2d6fe26809bc0e2',1,'ReportDescParser2::ParseItem()']]], ['parsemode',['ParseMode',['../class_p_t_p_list_parser.html#a7919acc78eb409e0679d8ec69a43e6da',1,'PTPListParser']]], @@ -35,7 +35,7 @@ var searchData= ['pgm_5fread_5fword',['pgm_read_word',['../version__helper_8h.html#a910fb5f01313d339d3b835d45e1e5ad0',1,'version_helper.h']]], ['pgm_5fread_5fword_5ffar',['pgm_read_word_far',['../version__helper_8h.html#a3aaf70e2e58f5749ccbcd36032b1d1b3',1,'version_helper.h']]], ['pgm_5fread_5fword_5fnear',['pgm_read_word_near',['../version__helper_8h.html#a515a845ea5139d8cf1c7f09ad6dad243',1,'version_helper.h']]], - ['pid',['PID',['../class_h_i_d_composite.html#a1402689fc7e633723fca2b6b175c2a18',1,'HIDComposite::PID()'],['../class_h_i_d_universal.html#abc609e49d66fa6260e7cdcd2c4ff0a5a',1,'HIDUniversal::PID()'],['../class_u_s_b_h___m_i_d_i.html#aaf7ec77f0d8cefff1316ae049747e2a7',1,'USBH_MIDI::pid()']]], + ['pid',['pid',['../class_u_s_b_h___m_i_d_i.html#aaf7ec77f0d8cefff1316ae049747e2a7',1,'USBH_MIDI::pid()'],['../class_h_i_d_composite.html#a1402689fc7e633723fca2b6b175c2a18',1,'HIDComposite::PID()'],['../class_h_i_d_universal.html#abc609e49d66fa6260e7cdcd2c4ff0a5a',1,'HIDUniversal::PID()']]], ['pitch',['Pitch',['../controller_enums_8h.html#a7c7824a10a9ffa8fea85602fcf4d84e6ae3a34b760fa4a6854f28852e91d8bb47',1,'controllerEnums.h']]], ['pitchgyroscale',['pitchGyroScale',['../class_w_i_i.html#aea6ce6f3222df3e547e9957673c7a07a',1,'WII']]], ['pitchgyrospeed',['pitchGyroSpeed',['../class_w_i_i.html#aa47478ccdfe009dabb7c21232e07bfd5',1,'WII']]], @@ -54,7 +54,7 @@ var searchData= ['printbytevalue',['PrintByteValue',['../class_report_desc_parser_base.html#a1af970b456e54342e15a88ffd98ca6cc',1,'ReportDescParserBase']]], ['printconsumerpageusage',['PrintConsumerPageUsage',['../class_report_desc_parser_base.html#a9af1dc144bab9e9864394594be67d2eb',1,'ReportDescParserBase']]], ['printdigitizerpageusage',['PrintDigitizerPageUsage',['../class_report_desc_parser_base.html#aa62d11cfe404ee51ffd26f13c33800a1',1,'ReportDescParserBase']]], - ['printendpointdescriptor',['PrintEndpointDescriptor',['../class_a_d_k.html#ac4bd3303b99921289c3f59e2df219e50',1,'ADK::PrintEndpointDescriptor()'],['../class_b_t_d.html#aa5976eead215a58553aee683d42405a0',1,'BTD::PrintEndpointDescriptor()'],['../class_a_c_m.html#aa05a65487f5e02bab40ccba1018ee5b6',1,'ACM::PrintEndpointDescriptor()'],['../class_bulk_only.html#ac8a1d7b2ef82d9f6da44928c78039964',1,'BulkOnly::PrintEndpointDescriptor()'],['../class_u_s_b_h_i_d.html#a046f84af88dab2e9063db0bf36308cd4',1,'USBHID::PrintEndpointDescriptor()']]], + ['printendpointdescriptor',['PrintEndpointDescriptor',['../class_a_d_k.html#ac4bd3303b99921289c3f59e2df219e50',1,'ADK::PrintEndpointDescriptor()'],['../class_b_t_d.html#aa5976eead215a58553aee683d42405a0',1,'BTD::PrintEndpointDescriptor()'],['../class_a_c_m.html#aa05a65487f5e02bab40ccba1018ee5b6',1,'ACM::PrintEndpointDescriptor()'],['../class_bulk_only.html#ac8a1d7b2ef82d9f6da44928c78039964',1,'BulkOnly::PrintEndpointDescriptor()'],['../class_u_s_b_h_i_d.html#a046f84af88dab2e9063db0bf36308cd4',1,'USBHID::PrintEndpointDescriptor()'],['../class_x_b_o_x_o_n_e.html#a2eea30f2ce47380fc414d4fc4231335b',1,'XBOXONE::PrintEndpointDescriptor()']]], ['printf_5fp',['printf_P',['../version__helper_8h.html#ab9261eba134bf3ec83f80bd34e6c2faf',1,'version_helper.h']]], ['printgamecontrolspageusage',['PrintGameControlsPageUsage',['../class_report_desc_parser_base.html#a4e026cfeda7bfe9e07cf247cbcc4a122',1,'ReportDescParserBase']]], ['printgenericdesktoppageusage',['PrintGenericDesktopPageUsage',['../class_report_desc_parser_base.html#a3eff46688f9edbee3a58c43bbf104763',1,'ReportDescParserBase']]], @@ -109,6 +109,7 @@ var searchData= ['ps3usb_2eh',['PS3USB.h',['../_p_s3_u_s_b_8h.html',1,'']]], ['ps4_5fbuttons',['PS4_BUTTONS',['../_p_s4_parser_8h.html#a7e95303156f31f965a09cc2d3877b524',1,'PS4Parser.h']]], ['ps4_5fpid',['PS4_PID',['../_p_s4_u_s_b_8h.html#a776f4d4694166dbe732e585ebb8c816e',1,'PS4USB.h']]], + ['ps4_5fpid_5fslim',['PS4_PID_SLIM',['../_p_s4_u_s_b_8h.html#a7b76473e5da043c7b3ce1eefebe77dbc',1,'PS4USB.h']]], ['ps4_5fvid',['PS4_VID',['../_p_s4_u_s_b_8h.html#ac878fc36cc22549eb8a7ab6371197877',1,'PS4USB.h']]], ['ps4bt',['PS4BT',['../class_p_s4_b_t.html',1,'PS4BT'],['../class_p_s4_b_t.html#a616d5167f795b14c5955910807b5024b',1,'PS4BT::PS4BT()']]], ['ps4bt_2eh',['PS4BT.h',['../_p_s4_b_t_8h.html',1,'']]], diff --git a/search/all_11.html b/search/all_11.html index 3615c281..b35c8bf0 100644 --- a/search/all_11.html +++ b/search/all_11.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_11.js b/search/all_11.js index c9f0ea5b..404dda09 100644 --- a/search/all_11.js +++ b/search/all_11.js @@ -1,4 +1,4 @@ var searchData= [ - ['qnextpolltime',['qNextPollTime',['../class_b_t_d.html#a52d6c7895f6bb01729d01ce28a2f3079',1,'BTD::qNextPollTime()'],['../class_a_c_m.html#a6701d70ae4734e8a81971d9fb8b085f2',1,'ACM::qNextPollTime()'],['../class_bulk_only.html#a2d422ee0745cd7c04afff905278c4233',1,'BulkOnly::qNextPollTime()']]] + ['qnextpolltime',['qNextPollTime',['../class_b_t_d.html#a52d6c7895f6bb01729d01ce28a2f3079',1,'BTD::qNextPollTime()'],['../class_a_c_m.html#a6701d70ae4734e8a81971d9fb8b085f2',1,'ACM::qNextPollTime()'],['../class_bulk_only.html#a2d422ee0745cd7c04afff905278c4233',1,'BulkOnly::qNextPollTime()'],['../class_x_b_o_x_o_n_e.html#a4d0702c6fc0327535d909975670e9284',1,'XBOXONE::qNextPollTime()']]] ]; diff --git a/search/all_12.html b/search/all_12.html index abd082a5..fd265245 100644 --- a/search/all_12.html +++ b/search/all_12.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_12.js b/search/all_12.js index 21c8a866..42508296 100644 --- a/search/all_12.js +++ b/search/all_12.js @@ -1,20 +1,21 @@ var searchData= [ ['r',['r',['../struct_p_s4_output.html#a76a85e749899e2e6cb135a6ec6acabb3',1,'PS4Output::r()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fda1784b1a3d7cbd43c45ff82c72d05e4ae',1,'R(): controllerEnums.h']]], - ['r1',['R1',['../struct_inquiry_response.html#a72abbdbd399647227ea05cb1cec32b2d',1,'InquiryResponse::R1()'],['../union_p_s4_buttons.html#aba0cb76ee82bd0ebe9872aa7bcbffac6',1,'PS4Buttons::r1()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdaf8d87ff07efe24755164f550526f4dac',1,'R1(): controllerEnums.h']]], - ['r2',['R2',['../struct_inquiry_response.html#aa635575deb7f984d27142ee2071af5b3',1,'InquiryResponse::R2()'],['../union_p_s4_buttons.html#a416642ff357b1313825fe94e0491b60e',1,'PS4Buttons::r2()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fda629d7b403cea5f826352f3aefb9a6d6a',1,'R2(): controllerEnums.h']]], + ['r1',['r1',['../union_p_s4_buttons.html#aba0cb76ee82bd0ebe9872aa7bcbffac6',1,'PS4Buttons::r1()'],['../struct_inquiry_response.html#a72abbdbd399647227ea05cb1cec32b2d',1,'InquiryResponse::R1()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdaf8d87ff07efe24755164f550526f4dac',1,'R1(): controllerEnums.h']]], + ['r2',['r2',['../union_p_s4_buttons.html#a416642ff357b1313825fe94e0491b60e',1,'PS4Buttons::r2()'],['../struct_inquiry_response.html#aa635575deb7f984d27142ee2071af5b3',1,'InquiryResponse::R2()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fda629d7b403cea5f826352f3aefb9a6d6a',1,'R2(): controllerEnums.h']]], ['r3',['r3',['../union_p_s4_buttons.html#a09805f3bcc362c410d7897792599d61d',1,'PS4Buttons::r3()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdaad0b4725f69a34fed2c914517bcd9baa',1,'R3(): controllerEnums.h']]], ['rcpuctl',['rCPUCTL',['../max3421e_8h.html#a53da9de92c56d0cdac2a09ca10e94455',1,'max3421e.h']]], ['rcvdata',['RcvData',['../class_a_d_k.html#a66b9943dfa89f783a8cdeb655e6fe9b1',1,'ADK::RcvData()'],['../class_a_c_m.html#a7f455b7a649522c29f2e63d668b0ccca',1,'ACM::RcvData()'],['../class_f_t_d_i.html#aa367ae72fbfda931cae8ec751e9dc434',1,'FTDI::RcvData()'],['../class_u_s_b_h___m_i_d_i.html#a1f522c0aca86795e1bfb7575e1759338',1,'USBH_MIDI::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)'],['../class_u_s_b_h___m_i_d_i.html#afa51b7a718728cdc4f25f9abec25be52',1,'USBH_MIDI::RcvData(uint8_t *outBuf)']]], - ['read',['Read',['../class_bulk_only.html#a470a8f0ffd6694d9dfc834da5efa627a',1,'BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf)'],['../class_bulk_only.html#a52f54376dcd7f5baf17718105e8f085d',1,'BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, USBReadParser *prs)'],['../class_s_p_p.html#aae8dc037e845480f582afea57b858b95',1,'SPP::read()']]], + ['read',['read',['../class_s_p_p.html#aae8dc037e845480f582afea57b858b95',1,'SPP::read()'],['../class_bulk_only.html#a470a8f0ffd6694d9dfc834da5efa627a',1,'BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf)'],['../class_bulk_only.html#a52f54376dcd7f5baf17718105e8f085d',1,'BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, USBReadParser *prs)']]], ['read_5fregister',['read_register',['../class_x_r21_b1411.html#adfcc22eba1ec95fe62af960682b8ecbc',1,'XR21B1411']]], ['readme_2emd',['README.md',['../_r_e_a_d_m_e_8md.html',1,'']]], - ['readpollinterval',['readPollInterval',['../class_b_t_d.html#a2a9ecb996243e070e70972370e45e4fd',1,'BTD']]], + ['readpollinterval',['readPollInterval',['../class_b_t_d.html#a2a9ecb996243e070e70972370e45e4fd',1,'BTD::readPollInterval()'],['../class_x_b_o_x_o_n_e.html#ae606811be2389140b19421aad2cb040f',1,'XBOXONE::readPollInterval()']]], ['readptr',['readPtr',['../class_u_s_b_h___m_i_d_i.html#aad25eeebfe8741afa7a242ec398c846e',1,'USBH_MIDI']]], ['ready',['ready',['../class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4',1,'ADK::ready()'],['../class_a_c_m.html#ae9a10861da80510a54942a511ce9009e',1,'ACM::ready()']]], ['recipient',['recipient',['../struct_s_e_t_u_p___p_k_t.html#a690a55f65b2ce4e69c426b92004a1cc6',1,'SETUP_PKT']]], ['recvbuf',['recvBuf',['../class_u_s_b_h___m_i_d_i.html#aa84131af42cd34c3d62763a7b3f07d2f',1,'USBH_MIDI']]], - ['recvdata',['RecvData',['../class_u_s_b_h___m_i_d_i.html#adb10f3867c2171603faa37af3e9fd210',1,'USBH_MIDI::RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)'],['../class_u_s_b_h___m_i_d_i.html#a4cd869ca837db908f283d2f41f3eb608',1,'USBH_MIDI::RecvData(uint8_t *outBuf)']]], + ['recvdata',['RecvData',['../class_u_s_b_h___m_i_d_i.html#adb10f3867c2171603faa37af3e9fd210',1,'USBH_MIDI::RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)'],['../class_u_s_b_h___m_i_d_i.html#aea89f48a206501ecf09b7d962e1fa688',1,'USBH_MIDI::RecvData(uint8_t *outBuf, bool isRaw=false)']]], + ['recvrawdata',['RecvRawData',['../class_u_s_b_h___m_i_d_i.html#af9f74895deb356da3d1915d9eac24aca',1,'USBH_MIDI']]], ['red',['red',['../union_p_s_b_u_z_z_buttons.html#a7bc184a6500e943f8b8f13a003e9a929',1,'PSBUZZButtons::red()'],['../controller_enums_8h.html#aac6fa7b0395b95cc528deaad0ce884a2ad3163c1fcda01965b692ec2c3122b743',1,'Red(): controllerEnums.h'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdaf80f9a890089d211842d59625e561f88',1,'RED(): controllerEnums.h']]], ['registerbluetoothservice',['registerBluetoothService',['../class_b_t_d.html#ad00d299e64c1a939e4a781ef39f75684',1,'BTD']]], ['registerdeviceclass',['RegisterDeviceClass',['../class_u_s_b.html#a3f66bf622590413ef2e1864f93a3e0d2',1,'USB']]], @@ -35,7 +36,7 @@ var searchData= ['res',['Res',['../struct_inquiry_response.html#a9f642c5fccc1c87cf6b444a138b6aa4b',1,'InquiryResponse']]], ['reserved',['Reserved',['../struct_inquiry_response.html#abb4a48d4fc326ad932fb41c82fe289f3',1,'InquiryResponse::Reserved()'],['../struct_hub_descriptor.html#a0c3292fe67fdbdab6ceac8b198ef44bf',1,'HubDescriptor::Reserved()']]], ['reserved4',['Reserved4',['../struct_inquiry_response.html#ae5c315ca0c47104b17d5bde7c4d485a6',1,'InquiryResponse']]], - ['reset',['reset',['../class_m_a_x3421e.html#a15b78912dd4b1c96b6ad141117dcb7ee',1,'MAX3421e::reset()'],['../class_bluetooth_service.html#aa7c81841d4e898e9dc91533da6d7ab64',1,'BluetoothService::Reset()'],['../class_b_t_h_i_d.html#af4c58b81414a037910dd6fb78f97b96e',1,'BTHID::Reset()'],['../class_p_s3_b_t.html#a576d72cdf12af58ae59c8f2a02f99c0f',1,'PS3BT::Reset()'],['../class_p_s4_parser.html#a24640b2362b0f6f51785fbd3dd4f13f9',1,'PS4Parser::Reset()'],['../class_p_s_buzz.html#a5bb4f2ee80ca9d10d87031b57bd09268',1,'PSBuzz::Reset()'],['../class_s_p_p.html#ae2c661bd46cd2d74bd29c4c771cd2ef0',1,'SPP::Reset()'],['../class_w_i_i.html#a769ee2f9a0088da097438bc3cc677f7c',1,'WII::Reset()']]], + ['reset',['Reset',['../class_bluetooth_service.html#aa7c81841d4e898e9dc91533da6d7ab64',1,'BluetoothService::Reset()'],['../class_b_t_h_i_d.html#af4c58b81414a037910dd6fb78f97b96e',1,'BTHID::Reset()'],['../class_p_s3_b_t.html#a576d72cdf12af58ae59c8f2a02f99c0f',1,'PS3BT::Reset()'],['../class_p_s4_parser.html#a24640b2362b0f6f51785fbd3dd4f13f9',1,'PS4Parser::Reset()'],['../class_p_s_buzz.html#a5bb4f2ee80ca9d10d87031b57bd09268',1,'PSBuzz::Reset()'],['../class_s_p_p.html#ae2c661bd46cd2d74bd29c4c771cd2ef0',1,'SPP::Reset()'],['../class_w_i_i.html#a769ee2f9a0088da097438bc3cc677f7c',1,'WII::Reset()'],['../class_m_a_x3421e.html#a15b78912dd4b1c96b6ad141117dcb7ee',1,'MAX3421e::reset()']]], ['reset_5fdownstream_5fdata_5fpipe',['RESET_DOWNSTREAM_DATA_PIPE',['../cdcprolific_8h.html#a810fdf3da740b4c9e309cefb29f4eb3a',1,'cdcprolific.h']]], ['reset_5fupstream_5fdata_5fpipe',['RESET_UPSTREAM_DATA_PIPE',['../cdcprolific_8h.html#aea64b328d877a5eead187856dd28f847',1,'cdcprolific.h']]], ['resetbthid',['ResetBTHID',['../class_b_t_h_i_d.html#acc22bf5baaa096fe09b72c812c1134f0',1,'BTHID::ResetBTHID()'],['../class_p_s4_b_t.html#a4b1c9e15ccdc7ab24f7fb42fc9b5d827',1,'PS4BT::ResetBTHID()']]], diff --git a/search/all_13.html b/search/all_13.html index 88fa6531..04f66e2f 100644 --- a/search/all_13.html +++ b/search/all_13.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_13.js b/search/all_13.js index 1c253ed4..bf86e378 100644 --- a/search/all_13.js +++ b/search/all_13.js @@ -89,10 +89,11 @@ var searchData= ['selectinterface',['SelectInterface',['../class_h_i_d_composite.html#ada07ab100cb0760ef5641e254cab731d',1,'HIDComposite']]], ['send',['send',['../class_s_p_p.html#ab6c20e303965056403ae5aef1d228858',1,'SPP']]], ['sendbreak',['SendBreak',['../class_a_c_m.html#a2a618cbff52737740e76977db557ddff',1,'ACM']]], - ['senddata',['SendData',['../class_u_s_b_h___m_i_d_i.html#a060bae88a7b5bf358119458362929ffa',1,'USBH_MIDI']]], - ['sendlcdpins',['SENDlcdPins',['../max___l_c_d_8cpp.html#a8b1b918f6a2c50b113737fe4a8e493ed',1,'max_LCD.cpp']]], + ['senddata',['SendData',['../class_u_s_b_h___m_i_d_i.html#a65fd836d11336cce737ec1bdb1d5d4f3',1,'USBH_MIDI']]], + ['sendlcdpins',['SENDlcdPins',['../max___l_c_d_8cpp.html#ab9142420ababc8fe568edee4796183ba',1,'max_LCD.cpp']]], ['sendoutputreport',['sendOutputReport',['../class_p_s4_b_t.html#ad3bb50902905677726bd62d5f394b062',1,'PS4BT::sendOutputReport()'],['../class_p_s4_parser.html#a8788530b0c213dedfcf56b78e8ca4879',1,'PS4Parser::sendOutputReport()'],['../class_p_s4_u_s_b.html#a75dc09d15f149e1a1b96b8d2ccbbff89',1,'PS4USB::sendOutputReport()']]], - ['sendsysex',['SendSysEx',['../class_u_s_b_h___m_i_d_i.html#a2ae1ef447bebf00d6f63af5eed4fa859',1,'USBH_MIDI']]], + ['sendrawdata',['SendRawData',['../class_u_s_b_h___m_i_d_i.html#a3005d70999cbf2339c55bcdd6fc77bff',1,'USBH_MIDI']]], + ['sendsysex',['SendSysEx',['../class_u_s_b_h___m_i_d_i.html#aa5506d9556605493d25492ab1f2fe2a8',1,'USBH_MIDI']]], ['sensekeyspecific',['SenseKeySpecific',['../struct_request_sense_responce.html#a61d034714befc2fa0fb7dcea30942324',1,'RequestSenseResponce']]], ['sensorenum',['SensorEnum',['../controller_enums_8h.html#a00d5030559c481763282483889597d51',1,'controllerEnums.h']]], ['serial_5fstate',['SERIAL_STATE',['../cdcacm_8h.html#a8e278dbd137d5d873d24e1647be9d4e6',1,'cdcacm.h']]], @@ -140,11 +141,12 @@ var searchData= ['setprotocolmode',['setProtocolMode',['../class_b_t_h_i_d.html#afceaafc89581441da40b141170b98595',1,'BTHID']]], ['setreport',['SetReport',['../class_u_s_b_h_i_d.html#a66e217a1d1237239514ce6149e46cc56',1,'USBHID']]], ['setreportparser',['SetReportParser',['../class_b_t_h_i_d.html#a0e903f0b5040f3561e5de6c4431027b1',1,'BTHID::SetReportParser()'],['../class_h_i_d_boot.html#a3e44d340fab7e9eedb357ef61e1c19a5',1,'HIDBoot::SetReportParser()'],['../class_h_i_d_composite.html#a94136774d685b89c5a149c4e4df78087',1,'HIDComposite::SetReportParser()'],['../class_h_i_d_universal.html#afbd599879e9c3cdea382e87afd6ab29a',1,'HIDUniversal::SetReportParser()'],['../class_u_s_b_h_i_d.html#a17a732bbb37d8f21181d02d515f40499',1,'USBHID::SetReportParser()']]], - ['setrumbleoff',['setRumbleOff',['../class_p_s3_b_t.html#a5c87e7db5311a5d56f78c994b5545e4e',1,'PS3BT::setRumbleOff()'],['../class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a',1,'PS3USB::setRumbleOff()'],['../class_p_s4_parser.html#acc9b3be8fb673e8e1f637c56d72f1180',1,'PS4Parser::setRumbleOff()'],['../class_w_i_i.html#a2c5c32841b020b248f757cb793acb936',1,'WII::setRumbleOff()'],['../class_x_b_o_x_o_l_d.html#a8014cc70e141362e09beeedb49428746',1,'XBOXOLD::setRumbleOff()'],['../class_x_b_o_x_r_e_c_v.html#a2931e13960cde2c20adbcaf34cee84c5',1,'XBOXRECV::setRumbleOff()'],['../class_x_b_o_x_u_s_b.html#a5d9ac92da5086409ad864484bdf95871',1,'XBOXUSB::setRumbleOff()']]], - ['setrumbleon',['setRumbleOn',['../class_p_s3_b_t.html#a7a3e593911490538c061e9ccb4273f87',1,'PS3BT::setRumbleOn(RumbleEnum mode)'],['../class_p_s3_b_t.html#ae309556e995afc10b13dfbe4e6c32798',1,'PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)'],['../class_p_s3_u_s_b.html#a77f44b6007cc735c47bdeaf672c7e464',1,'PS3USB::setRumbleOn(RumbleEnum mode)'],['../class_p_s3_u_s_b.html#a0c2015b53aa60081aa28299800509f80',1,'PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)'],['../class_p_s4_parser.html#a44628a8521ef9c19d773347156962cab',1,'PS4Parser::setRumbleOn(RumbleEnum mode)'],['../class_p_s4_parser.html#a8299bdbb9d790e6b2e98e942e9bd154e',1,'PS4Parser::setRumbleOn(uint8_t bigRumble, uint8_t smallRumble)'],['../class_w_i_i.html#a0d9c869bd3677c4488a586c38558a137',1,'WII::setRumbleOn()'],['../class_x_b_o_x_o_l_d.html#ab69673ea316c30268a5eedc893bea3a9',1,'XBOXOLD::setRumbleOn()'],['../class_x_b_o_x_r_e_c_v.html#addf7c0dcfbdb025f2283dcd118b5ab76',1,'XBOXRECV::setRumbleOn()'],['../class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9',1,'XBOXUSB::setRumbleOn()']]], + ['setrumbleoff',['setRumbleOff',['../class_p_s3_b_t.html#a5c87e7db5311a5d56f78c994b5545e4e',1,'PS3BT::setRumbleOff()'],['../class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a',1,'PS3USB::setRumbleOff()'],['../class_p_s4_parser.html#acc9b3be8fb673e8e1f637c56d72f1180',1,'PS4Parser::setRumbleOff()'],['../class_w_i_i.html#a2c5c32841b020b248f757cb793acb936',1,'WII::setRumbleOff()'],['../class_x_b_o_x_o_l_d.html#a8014cc70e141362e09beeedb49428746',1,'XBOXOLD::setRumbleOff()'],['../class_x_b_o_x_o_n_e.html#a506e8add57ffac652a28e8c5b7e72e85',1,'XBOXONE::setRumbleOff()'],['../class_x_b_o_x_r_e_c_v.html#a2931e13960cde2c20adbcaf34cee84c5',1,'XBOXRECV::setRumbleOff()'],['../class_x_b_o_x_u_s_b.html#a5d9ac92da5086409ad864484bdf95871',1,'XBOXUSB::setRumbleOff()']]], + ['setrumbleon',['setRumbleOn',['../class_p_s3_b_t.html#a7a3e593911490538c061e9ccb4273f87',1,'PS3BT::setRumbleOn(RumbleEnum mode)'],['../class_p_s3_b_t.html#ae309556e995afc10b13dfbe4e6c32798',1,'PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)'],['../class_p_s3_u_s_b.html#a77f44b6007cc735c47bdeaf672c7e464',1,'PS3USB::setRumbleOn(RumbleEnum mode)'],['../class_p_s3_u_s_b.html#a0c2015b53aa60081aa28299800509f80',1,'PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)'],['../class_p_s4_parser.html#a44628a8521ef9c19d773347156962cab',1,'PS4Parser::setRumbleOn(RumbleEnum mode)'],['../class_p_s4_parser.html#a8299bdbb9d790e6b2e98e942e9bd154e',1,'PS4Parser::setRumbleOn(uint8_t bigRumble, uint8_t smallRumble)'],['../class_w_i_i.html#a0d9c869bd3677c4488a586c38558a137',1,'WII::setRumbleOn()'],['../class_x_b_o_x_o_l_d.html#ab69673ea316c30268a5eedc893bea3a9',1,'XBOXOLD::setRumbleOn()'],['../class_x_b_o_x_o_n_e.html#a6586343cacf8705c7a3c2d4f479f2261',1,'XBOXONE::setRumbleOn()'],['../class_x_b_o_x_r_e_c_v.html#addf7c0dcfbdb025f2283dcd118b5ab76',1,'XBOXRECV::setRumbleOn()'],['../class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9',1,'XBOXUSB::setRumbleOn()']]], ['setrumbletoggle',['setRumbleToggle',['../class_w_i_i.html#a841396b533cccccb05db37d35f6fef9c',1,'WII']]], ['settings_2eh',['settings.h',['../settings_8h.html',1,'']]], ['setup_5fpkt',['SETUP_PKT',['../struct_s_e_t_u_p___p_k_t.html',1,'']]], + ['setupdevicespecific',['setupDeviceSpecific',['../class_u_s_b_h___m_i_d_i.html#aa9f6790ed10bec5fc5a9ebfc43dacfeb',1,'USBH_MIDI']]], ['setusagepage',['SetUsagePage',['../class_report_desc_parser_base.html#a42fbc8fbccaf67eab88bd98b8d3bdd3f',1,'ReportDescParserBase']]], ['setusbtaskstate',['setUsbTaskState',['../class_u_s_b.html#a8ff697d334dc611720419374acd1e5fb',1,'USB']]], ['share',['share',['../union_p_s4_buttons.html#adf2ff3e6e4050070a68e90a83be81e92',1,'PS4Buttons::share()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fda3754861e8c074fb088a2ed4f64786268',1,'SHARE(): controllerEnums.h']]], diff --git a/search/all_14.html b/search/all_14.html index 518db1da..285f34bd 100644 --- a/search/all_14.html +++ b/search/all_14.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_15.html b/search/all_15.html index 1331c0d7..0ed74e01 100644 --- a/search/all_15.html +++ b/search/all_15.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_15.js b/search/all_15.js index 7cc4652e..2300a549 100644 --- a/search/all_15.js +++ b/search/all_15.js @@ -18,7 +18,7 @@ var searchData= ['usagepagefunctions',['usagePageFunctions',['../class_report_desc_parser_base.html#af91679187bb24d185979b3ec045c215b',1,'ReportDescParserBase']]], ['usagepagetitles0',['usagePageTitles0',['../class_report_desc_parser_base.html#a7f723a8b7bddd061aee7f0af06aeae08',1,'ReportDescParserBase']]], ['usagepagetitles1',['usagePageTitles1',['../class_report_desc_parser_base.html#ae6dadd42986663f261aac948d24911a6',1,'ReportDescParserBase']]], - ['usb',['USB',['../class_u_s_b.html',1,'USB'],['../class_u_s_b.html#a8ff8cd03496bdcb0ca26f18878ad299d',1,'USB::USB()'],['../struct_p_s4_status.html#a3e7fc4ece250c83c7753e3f557f6d710',1,'PS4Status::usb()']]], + ['usb',['USB',['../class_u_s_b.html',1,'USB'],['../struct_p_s4_status.html#a3e7fc4ece250c83c7753e3f557f6d710',1,'PS4Status::usb()'],['../class_u_s_b.html#a8ff8cd03496bdcb0ca26f18878ad299d',1,'USB::USB()']]], ['usb_2ecpp',['Usb.cpp',['../_usb_8cpp.html',1,'']]], ['usb_2eh',['Usb.h',['../_usb_8h.html',1,'']]], ['usb_5fattached_5fsubstate_5fget_5fdevice_5fdescriptor_5fsize',['USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE',['../_usb_core_8h.html#a23ebcbb956f600e06435b28ae0c855d4',1,'UsbCore.h']]], @@ -117,6 +117,7 @@ var searchData= ['usb_5fsetup_5ftype_5fclass',['USB_SETUP_TYPE_CLASS',['../usb__ch9_8h.html#acf3fd30992e9fe01f1bac9aaa7fea61b',1,'usb_ch9.h']]], ['usb_5fsetup_5ftype_5fstandard',['USB_SETUP_TYPE_STANDARD',['../usb__ch9_8h.html#a3b51a35acaa76cafbb987c07186a7868',1,'usb_ch9.h']]], ['usb_5fsetup_5ftype_5fvendor',['USB_SETUP_TYPE_VENDOR',['../usb__ch9_8h.html#a876bdd74d8bfb072121b9643556271ba',1,'usb_ch9.h']]], + ['usb_5fspi',['USB_SPI',['../settings_8h.html#a00c696e002848a253c812ca2f4509f04',1,'settings.h']]], ['usb_5fstate_5faddressing',['USB_STATE_ADDRESSING',['../_usb_core_8h.html#a474a95baaeb99abd17538c2a1364bf96',1,'UsbCore.h']]], ['usb_5fstate_5fconfiguring',['USB_STATE_CONFIGURING',['../_usb_core_8h.html#aac8c844e6a20f42298d70e4438a029e5',1,'UsbCore.h']]], ['usb_5fstate_5fdetached',['USB_STATE_DETACHED',['../_usb_core_8h.html#ae7fd7c5bb6dc87f44724dde2ad57df87',1,'UsbCore.h']]], diff --git a/search/all_16.html b/search/all_16.html index bec9d5dd..696f0252 100644 --- a/search/all_16.html +++ b/search/all_16.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_16.js b/search/all_16.js index 0f9cb0de..a6f27cc1 100644 --- a/search/all_16.js +++ b/search/all_16.js @@ -18,7 +18,7 @@ var searchData= ['version',['Version',['../struct_inquiry_response.html#a86832a5def98c1e21447497177a8cc3a',1,'InquiryResponse']]], ['version_5fhelper_2eh',['version_helper.h',['../version__helper_8h.html',1,'']]], ['vfprintf_5fp',['vfprintf_P',['../version__helper_8h.html#a1c1f6f95b0f654f7c8280065feccf5cf',1,'version_helper.h']]], - ['vid',['vid',['../class_u_s_b_h___m_i_d_i.html#aa578074365d77bb3e41063a18625dfe3',1,'USBH_MIDI::vid()'],['../class_h_i_d_composite.html#acf516cb6242d1659c9bc77fe475c973e',1,'HIDComposite::VID()'],['../class_h_i_d_universal.html#a7f2123d1f20327600bb9e49a1ef5b0c7',1,'HIDUniversal::VID()']]], + ['vid',['VID',['../class_h_i_d_composite.html#acf516cb6242d1659c9bc77fe475c973e',1,'HIDComposite::VID()'],['../class_h_i_d_universal.html#a7f2123d1f20327600bb9e49a1ef5b0c7',1,'HIDUniversal::VID()'],['../class_u_s_b_h___m_i_d_i.html#aa578074365d77bb3e41063a18625dfe3',1,'USBH_MIDI::vid()']]], ['vidpidok',['VIDPIDOK',['../class_a_d_k.html#a9ad9aa3153c4cd1e083251bf42ab536f',1,'ADK::VIDPIDOK()'],['../class_b_t_d.html#ae0808ebf7578fc022b8f05c8779d3102',1,'BTD::VIDPIDOK()'],['../class_x_r21_b1411.html#a20c357d629c6cbb4f5f98211b5555906',1,'XR21B1411::VIDPIDOK()'],['../class_f_t_d_i.html#a534da68bb1ff411b30281fe52e8fec10',1,'FTDI::VIDPIDOK()'],['../class_p_s3_u_s_b.html#a2dd246a86a9d8a0453199a09b495e608',1,'PS3USB::VIDPIDOK()'],['../class_p_s4_u_s_b.html#a991ca2571cbd072749dd754df26faa5a',1,'PS4USB::VIDPIDOK()'],['../class_p_s_buzz.html#ae94840ce88d873664d1f1d8e46928acb',1,'PSBuzz::VIDPIDOK()'],['../class_u_s_b_device_config.html#af920743379d8c133dda4335d11601141',1,'USBDeviceConfig::VIDPIDOK()'],['../class_x_b_o_x_o_l_d.html#a6db4a09978cacebb93d1b4ea5ad676f2',1,'XBOXOLD::VIDPIDOK()'],['../class_x_b_o_x_o_n_e.html#a53082e8413a3e7046b7e96fa3183b0eb',1,'XBOXONE::VIDPIDOK()'],['../class_x_b_o_x_r_e_c_v.html#a119cff07be751ce16d7854fab6dc898c',1,'XBOXRECV::VIDPIDOK()'],['../class_x_b_o_x_u_s_b.html#aad0847615d298e8f65909f467216ca14',1,'XBOXUSB::VIDPIDOK()']]], ['vrtitles0',['vrTitles0',['../class_report_desc_parser_base.html#a42d34a0a49f987c9dcfdd4fb8d42bf0d',1,'ReportDescParserBase']]], ['vrtitles1',['vrTitles1',['../class_report_desc_parser_base.html#a41af57cb0fb0bbed7277bcd04a9e9fe9',1,'ReportDescParserBase']]], diff --git a/search/all_17.html b/search/all_17.html index 6d010fdd..f1e14b63 100644 --- a/search/all_17.html +++ b/search/all_17.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_17.js b/search/all_17.js index 4accb90b..e490cc8a 100644 --- a/search/all_17.js +++ b/search/all_17.js @@ -1,7 +1,7 @@ var searchData= [ - ['wiicamerareadme',['WiiCameraReadme',['../md__Users_Lauszus_Github_USB_Host_Shield_2_0_WiiCameraReadme.html',1,'']]], - ['watingforconnection',['watingForConnection',['../class_b_t_d.html#aa7735da01865bab01b569ee836173737',1,'BTD']]], + ['wiicamerareadme',['WiiCameraReadme',['../md___users_lauszus__github__u_s_b__host__shield_2_0__wii_camera_readme.html',1,'']]], + ['waitingforconnection',['waitingForConnection',['../class_b_t_d.html#a93a522edb2974185c7567b8f83860424',1,'BTD']]], ['wdescriptorlength',['wDescriptorLength',['../struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r.html#a0b160c43f6a6132c0debabd6ef171950',1,'USB_HID_DESCRIPTOR::wDescriptorLength()'],['../struct_h_i_d___c_l_a_s_s___d_e_s_c_r_i_p_t_o_r___l_e_n___a_n_d___t_y_p_e.html#a98251c1867caf1651f6e926952189201',1,'HID_CLASS_DESCRIPTOR_LEN_AND_TYPE::wDescriptorLength()']]], ['white',['WHITE',['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fda283fc479650da98250635b9c3c0e7e50',1,'WHITE(): controllerEnums.h'],['../controller_enums_8h.html#aac6fa7b0395b95cc528deaad0ce884a2ab548046646b36c12aa6ba841de500094',1,'White(): controllerEnums.h']]], ['wi_5fprotocol_5fbt',['WI_PROTOCOL_BT',['../_b_t_d_8h.html#a05903a9351c5ced6b8be27b2869e62af',1,'BTD.h']]], @@ -32,7 +32,7 @@ var searchData= ['windex',['wIndex',['../struct_c_l_a_s_s___n_o_t_i_f_i_c_a_t_i_o_n.html#aae0d299b4d6e5ee396ace3f1b4cc7352',1,'CLASS_NOTIFICATION::wIndex()'],['../struct_s_e_t_u_p___p_k_t.html#a299d9f88d294369ea88b48b5026f4c7e',1,'SETUP_PKT::wIndex()']]], ['wlength',['wLength',['../struct_c_l_a_s_s___n_o_t_i_f_i_c_a_t_i_o_n.html#a7933669f6b6379d7ee0605f50422cbe2',1,'CLASS_NOTIFICATION::wLength()'],['../struct_s_e_t_u_p___p_k_t.html#a1ec9b19c0ed1e66e399ad9cf3c4a6537',1,'SETUP_PKT::wLength()']]], ['wmaxpacketsize',['wMaxPacketSize',['../struct_u_s_b___e_n_d_p_o_i_n_t___d_e_s_c_r_i_p_t_o_r.html#af34105fa6bd0029d9c6b73d85f7853c6',1,'USB_ENDPOINT_DESCRIPTOR']]], - ['write',['Write',['../class_bulk_only.html#a45d327ddf87e01607c3a5b1849936053',1,'BulkOnly::Write()'],['../class_max___l_c_d.html#a43e5618993b77b81773af3a88cdf4c96',1,'Max_LCD::write()'],['../class_s_p_p.html#a6fb231316ca9b1028322d2d2188b27b0',1,'SPP::write(uint8_t data)'],['../class_s_p_p.html#a8bb421b7d948c3ffefc23aef95813192',1,'SPP::write(const uint8_t *data, size_t size)']]], + ['write',['write',['../class_max___l_c_d.html#a43e5618993b77b81773af3a88cdf4c96',1,'Max_LCD::write()'],['../class_s_p_p.html#a6fb231316ca9b1028322d2d2188b27b0',1,'SPP::write(uint8_t data)'],['../class_s_p_p.html#a8bb421b7d948c3ffefc23aef95813192',1,'SPP::write(const uint8_t *data, size_t size)'],['../class_bulk_only.html#a45d327ddf87e01607c3a5b1849936053',1,'BulkOnly::Write()']]], ['write_5fregister',['write_register',['../class_x_r21_b1411.html#acdc8c732d517b2748d3d6643ae5642ee',1,'XR21B1411']]], ['writeok',['WriteOk',['../class_bulk_only.html#af763ffffdd131949322d583fb4cd2737',1,'BulkOnly']]], ['writeprotected',['WriteProtected',['../class_bulk_only.html#a85d034c7da25090c36c9bdeb85338009',1,'BulkOnly']]], diff --git a/search/all_18.html b/search/all_18.html index ebae42c7..2a009025 100644 --- a/search/all_18.html +++ b/search/all_18.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_18.js b/search/all_18.js index ed6fe72f..f0362917 100644 --- a/search/all_18.js +++ b/search/all_18.js @@ -4,26 +4,48 @@ var searchData= ['xbox',['XBOX',['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdad4689acdcdf0e61373d52de14ff07eae',1,'controllerEnums.h']]], ['xbox360connected',['Xbox360Connected',['../class_x_b_o_x_r_e_c_v.html#ac07faada38e159f1e7831d90863ebe3a',1,'XBOXRECV::Xbox360Connected()'],['../class_x_b_o_x_u_s_b.html#a1c779ae5483a2f73426650242a37d868',1,'XBOXUSB::Xbox360Connected()']]], ['xbox_5fbuttons',['XBOX_BUTTONS',['../xbox_enums_8h.html#a35901eab017bd1df5d2361634309adbd',1,'xboxEnums.h']]], - ['xbox_5fcontrol_5fpipe',['XBOX_CONTROL_PIPE',['../_x_b_o_x_o_l_d_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXONE.h'],['../_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXUSB.h']]], - ['xbox_5finput_5fpipe',['XBOX_INPUT_PIPE',['../_x_b_o_x_o_l_d_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXONE.h'],['../_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXUSB.h']]], + ['xbox_5fcontrol_5fpipe',['XBOX_CONTROL_PIPE',['../_x_b_o_x_o_l_d_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXOLD.h'],['../_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXUSB.h']]], + ['xbox_5finput_5fpipe',['XBOX_INPUT_PIPE',['../_x_b_o_x_o_l_d_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXOLD.h'],['../_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXUSB.h']]], ['xbox_5finput_5fpipe_5f1',['XBOX_INPUT_PIPE_1',['../_x_b_o_x_r_e_c_v_8h.html#a2824b25aa9a384c29f27a4e1bb443799',1,'XBOXRECV.h']]], ['xbox_5finput_5fpipe_5f2',['XBOX_INPUT_PIPE_2',['../_x_b_o_x_r_e_c_v_8h.html#aab6feb681a78b190190bcc081868a485',1,'XBOXRECV.h']]], ['xbox_5finput_5fpipe_5f3',['XBOX_INPUT_PIPE_3',['../_x_b_o_x_r_e_c_v_8h.html#a86a3e5765d02bc043d5d1f674a7ffb0f',1,'XBOXRECV.h']]], ['xbox_5finput_5fpipe_5f4',['XBOX_INPUT_PIPE_4',['../_x_b_o_x_r_e_c_v_8h.html#a5acfdaefe74aba1632c71acb79c49671',1,'XBOXRECV.h']]], ['xbox_5fleds',['XBOX_LEDS',['../xbox_enums_8h.html#a0aa7965573ba74b8eecaa43f0543026e',1,'xboxEnums.h']]], - ['xbox_5fmax_5fendpoints',['XBOX_MAX_ENDPOINTS',['../_x_b_o_x_o_l_d_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXONE.h'],['../_x_b_o_x_r_e_c_v_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXUSB.h']]], + ['xbox_5fmax_5fendpoints',['XBOX_MAX_ENDPOINTS',['../_x_b_o_x_o_l_d_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXOLD.h'],['../_x_b_o_x_r_e_c_v_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXUSB.h']]], ['xbox_5fold_5fpid1',['XBOX_OLD_PID1',['../_x_b_o_x_o_l_d_8h.html#a8495cfaf2039ba2399a3c6f3e107c90c',1,'XBOXOLD.h']]], ['xbox_5fold_5fpid2',['XBOX_OLD_PID2',['../_x_b_o_x_o_l_d_8h.html#a9c98134e7ea99b12f7e4724af5b9799c',1,'XBOXOLD.h']]], ['xbox_5fold_5fpid3',['XBOX_OLD_PID3',['../_x_b_o_x_o_l_d_8h.html#a3856d8cf87b39551ed2278691ad891b8',1,'XBOXOLD.h']]], ['xbox_5fold_5fpid4',['XBOX_OLD_PID4',['../_x_b_o_x_o_l_d_8h.html#a3bf8a81e24b9c3df304fdafb06bbeb4e',1,'XBOXOLD.h']]], - ['xbox_5fone_5fpid',['XBOX_ONE_PID',['../_x_b_o_x_o_n_e_8h.html#a2b8eadd23fe690a1f2ecd2421e58682e',1,'XBOXONE.h']]], - ['xbox_5foutput_5fpipe',['XBOX_OUTPUT_PIPE',['../_x_b_o_x_o_l_d_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXONE.h'],['../_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXUSB.h']]], + ['xbox_5fone_5fcontrol_5fpipe',['XBOX_ONE_CONTROL_PIPE',['../_x_b_o_x_o_n_e_8h.html#a916c0ffc31c703da27b5f5cbdabea361',1,'XBOXONE.h']]], + ['xbox_5fone_5fep_5fmaxpktsize',['XBOX_ONE_EP_MAXPKTSIZE',['../_x_b_o_x_o_n_e_8h.html#aee7388a903006047acac4b071a28bd9d',1,'XBOXONE.h']]], + ['xbox_5fone_5finput_5fpipe',['XBOX_ONE_INPUT_PIPE',['../_x_b_o_x_o_n_e_8h.html#a996610ea223dd4c7756ad3af2efa821b',1,'XBOXONE.h']]], + ['xbox_5fone_5fmax_5fendpoints',['XBOX_ONE_MAX_ENDPOINTS',['../_x_b_o_x_o_n_e_8h.html#a8e9bf59d8bc051ff3fa38e2b327ade6e',1,'XBOXONE.h']]], + ['xbox_5fone_5foutput_5fpipe',['XBOX_ONE_OUTPUT_PIPE',['../_x_b_o_x_o_n_e_8h.html#a1a9da90da4584db2de7c84f45bdafc89',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid1',['XBOX_ONE_PID1',['../_x_b_o_x_o_n_e_8h.html#a10b005f24d84af7d10268faabea14c1e',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid10',['XBOX_ONE_PID10',['../_x_b_o_x_o_n_e_8h.html#ad7aedc27b8dfa49a7af8fce89432df0a',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid11',['XBOX_ONE_PID11',['../_x_b_o_x_o_n_e_8h.html#a3692a20fd79bcdfdcdec36b4acae8a76',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid12',['XBOX_ONE_PID12',['../_x_b_o_x_o_n_e_8h.html#a185f8aba65c0c20a1917efa6383d7ab0',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid2',['XBOX_ONE_PID2',['../_x_b_o_x_o_n_e_8h.html#abba090da8fd2707cb996899e798d1bd4',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid3',['XBOX_ONE_PID3',['../_x_b_o_x_o_n_e_8h.html#a6cc79a26eb1b03c3ca320f8adcd1d1bd',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid4',['XBOX_ONE_PID4',['../_x_b_o_x_o_n_e_8h.html#a148021ecf4a60cb1f25d59bb698fa7df',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid5',['XBOX_ONE_PID5',['../_x_b_o_x_o_n_e_8h.html#ae5883d7d1d2cdbbb5604865d67601696',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid6',['XBOX_ONE_PID6',['../_x_b_o_x_o_n_e_8h.html#aede8fa4d1fe42ddc8c48f0bb2bfeee0c',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid7',['XBOX_ONE_PID7',['../_x_b_o_x_o_n_e_8h.html#ad6a957e104a5e50381681e16229c3ced',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid8',['XBOX_ONE_PID8',['../_x_b_o_x_o_n_e_8h.html#ac3ac9e12165117b895d17af5f40ea5dd',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid9',['XBOX_ONE_PID9',['../_x_b_o_x_o_n_e_8h.html#abb2d1e64c4771836476e8aa1ffe46431',1,'XBOXONE.h']]], + ['xbox_5foutput_5fpipe',['XBOX_OUTPUT_PIPE',['../_x_b_o_x_o_l_d_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXOLD.h'],['../_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXUSB.h']]], ['xbox_5foutput_5fpipe_5f1',['XBOX_OUTPUT_PIPE_1',['../_x_b_o_x_r_e_c_v_8h.html#a962be1e740bce25cf37e111bd88be9bf',1,'XBOXRECV.h']]], ['xbox_5foutput_5fpipe_5f2',['XBOX_OUTPUT_PIPE_2',['../_x_b_o_x_r_e_c_v_8h.html#a8ba688a4bdb47869d7ee3f49b6d07b7c',1,'XBOXRECV.h']]], ['xbox_5foutput_5fpipe_5f3',['XBOX_OUTPUT_PIPE_3',['../_x_b_o_x_r_e_c_v_8h.html#afce4154cabb3a0d2c7eeb39b1c15d353',1,'XBOXRECV.h']]], ['xbox_5foutput_5fpipe_5f4',['XBOX_OUTPUT_PIPE_4',['../_x_b_o_x_r_e_c_v_8h.html#a7a74e0ea052831dbbb4a0973fffc8179',1,'XBOXRECV.h']]], - ['xbox_5freport_5fbuffer_5fsize',['XBOX_REPORT_BUFFER_SIZE',['../_x_b_o_x_o_n_e_8h.html#aaa3e91675875fbf14a37369f9513874a',1,'XBOX_REPORT_BUFFER_SIZE(): XBOXONE.h'],['../_x_b_o_x_u_s_b_8h.html#aaa3e91675875fbf14a37369f9513874a',1,'XBOX_REPORT_BUFFER_SIZE(): XBOXUSB.h']]], - ['xbox_5fvid',['XBOX_VID',['../_x_b_o_x_o_l_d_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXONE.h'],['../_x_b_o_x_r_e_c_v_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXUSB.h']]], + ['xbox_5freport_5fbuffer_5fsize',['XBOX_REPORT_BUFFER_SIZE',['../_x_b_o_x_u_s_b_8h.html#aaa3e91675875fbf14a37369f9513874a',1,'XBOXUSB.h']]], + ['xbox_5fvid',['XBOX_VID',['../_x_b_o_x_o_l_d_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXOLD.h'],['../_x_b_o_x_r_e_c_v_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXUSB.h']]], + ['xbox_5fvid1',['XBOX_VID1',['../_x_b_o_x_o_n_e_8h.html#a72296ecd70897c4fcfe4c614bbf2051b',1,'XBOXONE.h']]], + ['xbox_5fvid2',['XBOX_VID2',['../_x_b_o_x_o_n_e_8h.html#a85fb8c87d82f5c49fdb951d41247563f',1,'XBOXONE.h']]], + ['xbox_5fvid3',['XBOX_VID3',['../_x_b_o_x_o_n_e_8h.html#aac92aad3632dc9632d04d90342904b18',1,'XBOXONE.h']]], + ['xbox_5fvid4',['XBOX_VID4',['../_x_b_o_x_o_n_e_8h.html#a17464f5e0fb6afc082555ccb61c29668',1,'XBOXONE.h']]], + ['xbox_5fvid5',['XBOX_VID5',['../_x_b_o_x_o_n_e_8h.html#ade0eb2e0dd4f0c3fe45c82121f31d44d',1,'XBOXONE.h']]], + ['xbox_5fvid6',['XBOX_VID6',['../_x_b_o_x_o_n_e_8h.html#a02fcf09e41a7a1a28fd1bdb28dc098ed',1,'XBOXONE.h']]], ['xbox_5fwired_5fpid',['XBOX_WIRED_PID',['../_x_b_o_x_u_s_b_8h.html#af2ec224ac142016119c418de89470f1f',1,'XBOXUSB.h']]], ['xbox_5fwireless_5fpid',['XBOX_WIRELESS_PID',['../_x_b_o_x_u_s_b_8h.html#a10c2a7a8da78e76d7020c2c347f0a687',1,'XBOXUSB.h']]], ['xbox_5fwireless_5freceiver_5fpid',['XBOX_WIRELESS_RECEIVER_PID',['../_x_b_o_x_r_e_c_v_8h.html#a1a97ce2829a30b96ea6640d387d245a9',1,'XBOX_WIRELESS_RECEIVER_PID(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a1a97ce2829a30b96ea6640d387d245a9',1,'XBOX_WIRELESS_RECEIVER_PID(): XBOXUSB.h']]], @@ -60,7 +82,7 @@ var searchData= ['xr_5freg_5fcustomised_5fint',['XR_REG_CUSTOMISED_INT',['../cdc___x_r21_b1411_8h.html#ad8f26622feeb072c9caa5c5f95f3b6ed',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus',['XR_REG_ERROR_STATUS',['../cdc___x_r21_b1411_8h.html#af50fcb0d47dfcb8dae3020b98b90f5b1',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus_5fbreak',['XR_REG_ERROR_STATUS_BREAK',['../cdc___x_r21_b1411_8h.html#af2eb9c3a6ad7f95fc439139f8c430d74',1,'cdc_XR21B1411.h']]], - ['xr_5freg_5ferror_5fstatus_5fbreak_5fstatus',['XR_REG_ERROR_STATUS_BREAK_STATUS',['../cdc___x_r21_b1411_8h.html#a00ee098551f16993fb6e55c500203e70',1,'cdc_XR21B1411.h']]], + ['xr_5freg_5ferror_5fstatus_5fbreaking',['XR_REG_ERROR_STATUS_BREAKING',['../cdc___x_r21_b1411_8h.html#af7c8d263bd77298510c4e361b52f6fb6',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus_5ferror',['XR_REG_ERROR_STATUS_ERROR',['../cdc___x_r21_b1411_8h.html#aa62ce08310e0d1e091d826bae6a091a0',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus_5fframe',['XR_REG_ERROR_STATUS_FRAME',['../cdc___x_r21_b1411_8h.html#a6d68869ec17604caec0a490cd4e84191',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus_5fmask',['XR_REG_ERROR_STATUS_MASK',['../cdc___x_r21_b1411_8h.html#ae8dbffb7f958e6a5c0c0727dcebe8851',1,'cdc_XR21B1411.h']]], diff --git a/search/all_19.html b/search/all_19.html index 6c3ecee0..4e5b9451 100644 --- a/search/all_19.html +++ b/search/all_19.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_19.js b/search/all_19.js index 383316e2..99687a3e 100644 --- a/search/all_19.js +++ b/search/all_19.js @@ -3,5 +3,5 @@ var searchData= ['y',['y',['../structtouchpad_x_y.html#ac4ceb26c0ebba1c5a2691a1ecdb7dbae',1,'touchpadXY::y()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fda5596231eabd6cf29050967d5ac83ad84',1,'Y(): controllerEnums.h']]], ['yawgyroscale',['yawGyroScale',['../class_w_i_i.html#a0694969a30092b9b1dcb26120c7cff73',1,'WII']]], ['yawgyrospeed',['yawGyroSpeed',['../class_w_i_i.html#a4c373f956eddf2dd3a66d4a000459b85',1,'WII']]], - ['yellow',['yellow',['../union_p_s_b_u_z_z_buttons.html#a57f1a1aee6fd182d91c562140777f396',1,'PSBUZZButtons::yellow()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdae735a848bf82163a19236ead1c3ef2d2',1,'YELLOW(): controllerEnums.h'],['../controller_enums_8h.html#aac6fa7b0395b95cc528deaad0ce884a2abf28513245738599d13e3ce36bd16c82',1,'Yellow(): controllerEnums.h']]] + ['yellow',['yellow',['../union_p_s_b_u_z_z_buttons.html#a57f1a1aee6fd182d91c562140777f396',1,'PSBUZZButtons::yellow()'],['../controller_enums_8h.html#aac6fa7b0395b95cc528deaad0ce884a2abf28513245738599d13e3ce36bd16c82',1,'Yellow(): controllerEnums.h'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdae735a848bf82163a19236ead1c3ef2d2',1,'YELLOW(): controllerEnums.h']]] ]; diff --git a/search/all_1a.html b/search/all_1a.html index 2038d564..984ffe17 100644 --- a/search/all_1a.html +++ b/search/all_1a.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_2.html b/search/all_2.html index d15ac65f..2f17735e 100644 --- a/search/all_2.html +++ b/search/all_2.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_2.js b/search/all_2.js index be2a263d..8e438340 100644 --- a/search/all_2.js +++ b/search/all_2.js @@ -16,7 +16,7 @@ var searchData= ['bcdusb',['bcdUSB',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#a621148cd71148fb15e136010480a34ac',1,'USB_DEVICE_DESCRIPTOR']]], ['bcharformat',['bCharFormat',['../struct_l_i_n_e___c_o_d_i_n_g.html#ae2c35eef8f7e35b5f2a3464225477d3c',1,'LINE_CODING']]], ['bconfigurationvalue',['bConfigurationValue',['../struct_u_s_b___c_o_n_f_i_g_u_r_a_t_i_o_n___d_e_s_c_r_i_p_t_o_r.html#a568d08f2ae98670a707489645a67746b',1,'USB_CONFIGURATION_DESCRIPTOR']]], - ['bconfnum',['bConfNum',['../class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738',1,'ADK::bConfNum()'],['../class_b_t_d.html#a10c34527ae90e95791ac48ac7d1154a2',1,'BTD::bConfNum()'],['../class_a_c_m.html#af1a17c2d77625599da12b26cb0c90d39',1,'ACM::bConfNum()'],['../class_bulk_only.html#ab54f472ec9cd39abdb9f90867943d162',1,'BulkOnly::bConfNum()'],['../class_u_s_b_h___m_i_d_i.html#a441bf3b7bcd3ad8ca4e18f68fd03404c',1,'USBH_MIDI::bConfNum()']]], + ['bconfnum',['bConfNum',['../class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738',1,'ADK::bConfNum()'],['../class_b_t_d.html#a10c34527ae90e95791ac48ac7d1154a2',1,'BTD::bConfNum()'],['../class_a_c_m.html#af1a17c2d77625599da12b26cb0c90d39',1,'ACM::bConfNum()'],['../class_bulk_only.html#ab54f472ec9cd39abdb9f90867943d162',1,'BulkOnly::bConfNum()'],['../class_u_s_b_h___m_i_d_i.html#a441bf3b7bcd3ad8ca4e18f68fd03404c',1,'USBH_MIDI::bConfNum()'],['../class_x_b_o_x_o_n_e.html#ac6c75dcd5dfd5a9685a049f9bb8cb93f',1,'XBOXONE::bConfNum()']]], ['bcontroliface',['bControlIface',['../class_a_c_m.html#a5512d9e8c8c59371f16018fe8ce46b19',1,'ACM']]], ['bcountrycode',['bCountryCode',['../struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r.html#a340e5f812dbf7fe8caa13a1541a51f42',1,'USB_HID_DESCRIPTOR']]], ['bcswstatus',['bCSWStatus',['../struct_command_status_wrapper.html#a7170ed5bc0e2bbe04758e687beef4487',1,'CommandStatusWrapper']]], @@ -31,6 +31,8 @@ var searchData= ['bdeviceprotocol',['bDeviceProtocol',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#af205ea8c5729e0ddbf4dcbdf1636fe57',1,'USB_DEVICE_DESCRIPTOR']]], ['bdevicesubclass',['bDeviceSubClass',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#af01535d145805f4bfae66e21f1fc652d',1,'USB_DEVICE_DESCRIPTOR']]], ['begin',['begin',['../class_max___l_c_d.html#ac8ea275f8e9e27fb98ed21100f10fab7',1,'Max_LCD']]], + ['belkin_5ff8t065bf_5fpid',['BELKIN_F8T065BF_PID',['../_b_t_d_8h.html#ad142141f4e7685e31dce306128eaad5f',1,'BTD.h']]], + ['belkin_5ff8t065bf_5fvid',['BELKIN_F8T065BF_VID',['../_b_t_d_8h.html#a576e49b56b3cfb9d70b22bac8fe6796f',1,'BTD.h']]], ['bendpointaddress',['bEndpointAddress',['../struct_u_s_b___e_n_d_p_o_i_n_t___d_e_s_c_r_i_p_t_o_r.html#a23fbb539d72d10a6cb12efedf7d3457c',1,'USB_ENDPOINT_DESCRIPTOR']]], ['bfieldreplaceableunitcode',['bFieldReplaceableUnitCode',['../struct_request_sense_responce.html#ada14013a7a12b33b5d1ed747a48d5fe0',1,'RequestSenseResponce']]], ['bfunctionlength',['bFunctionLength',['../struct_c_a_l_l___m_g_m_n_t___f_u_n_c___d_e_s_c_r.html#ae5ab7e23e6f5268f042b1cec3986867a',1,'CALL_MGMNT_FUNC_DESCR::bFunctionLength()'],['../struct_a_c_m___f_u_n_c___d_e_s_c_r.html#a46c41dcbc0f3fdc37c0cd411b6b3213e',1,'ACM_FUNC_DESCR::bFunctionLength()'],['../struct_t_e_l___r_i_n_g_e_r___f_u_n_c___d_e_s_c_r.html#afac33a06771f8b063a8330849cb19386',1,'TEL_RINGER_FUNC_DESCR::bFunctionLength()']]], @@ -280,7 +282,7 @@ var searchData= ['bnumconfigurations',['bNumConfigurations',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#ab1b8db3992e0dceb2ba86f3bab1e5bca',1,'USB_DEVICE_DESCRIPTOR']]], ['bnumdescriptors',['bNumDescriptors',['../struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r.html#a05f827473d2eb4e67d1f99bc317b1eba',1,'USB_HID_DESCRIPTOR']]], ['bnumendpoints',['bNumEndpoints',['../struct_u_s_b___i_n_t_e_r_f_a_c_e___d_e_s_c_r_i_p_t_o_r.html#a3268bc05bb0147e19f97e50e702fc141',1,'USB_INTERFACE_DESCRIPTOR']]], - ['bnumep',['bNumEP',['../class_a_d_k.html#adf969d306da15baecd5c59bbb568053e',1,'ADK::bNumEP()'],['../class_b_t_d.html#a893dd35932821cddda7e482a1904af66',1,'BTD::bNumEP()'],['../class_a_c_m.html#a058b4d4a088a002fcde4fb2b75e33f93',1,'ACM::bNumEP()'],['../class_bulk_only.html#a6cb56ebd0307845321340919e2b35952',1,'BulkOnly::bNumEP()'],['../class_u_s_b_h___m_i_d_i.html#ab8b2dd096df7159ce8a09a19812307ca',1,'USBH_MIDI::bNumEP()']]], + ['bnumep',['bNumEP',['../class_a_d_k.html#adf969d306da15baecd5c59bbb568053e',1,'ADK::bNumEP()'],['../class_b_t_d.html#a893dd35932821cddda7e482a1904af66',1,'BTD::bNumEP()'],['../class_a_c_m.html#a058b4d4a088a002fcde4fb2b75e33f93',1,'ACM::bNumEP()'],['../class_bulk_only.html#a6cb56ebd0307845321340919e2b35952',1,'BulkOnly::bNumEP()'],['../class_u_s_b_h___m_i_d_i.html#ab8b2dd096df7159ce8a09a19812307ca',1,'USBH_MIDI::bNumEP()'],['../class_x_b_o_x_o_n_e.html#a958f262ed66dd5bf0ad7dfd54a369659',1,'XBOXONE::bNumEP()']]], ['bnuminterfaces',['bNumInterfaces',['../struct_u_s_b___c_o_n_f_i_g_u_r_a_t_i_o_n___d_e_s_c_r_i_p_t_o_r.html#abd647927a872ac856c9f5aaf624bb99f',1,'USB_CONFIGURATION_DESCRIPTOR']]], ['bnumringerpatterns',['bNumRingerPatterns',['../struct_t_e_l___r_i_n_g_e_r___f_u_n_c___d_e_s_c_r.html#aca65dc577a0dbc13972da9ab26e25918',1,'TEL_RINGER_FUNC_DESCR']]], ['botleft',['BotLeft',['../_wii_8h.html#a1f2e8277faa24c51a9c99f3fbac8d80ba591404ff43c722c0641186be037b181d',1,'Wii.h']]], @@ -325,6 +327,7 @@ var searchData= ['bthid_2ecpp',['BTHID.cpp',['../_b_t_h_i_d_8cpp.html',1,'']]], ['bthid_2eh',['BTHID.h',['../_b_t_h_i_d_8h.html',1,'']]], ['btn',['btn',['../struct_p_s4_data.html#a60c0217c1879e1b16ae5d19a8c8695a3',1,'PS4Data::btn()'],['../union_p_s_b_u_z_z_buttons.html#a92ce392e7a31f155fbdf0fa0c8a5c83e',1,'PSBUZZButtons::btn()']]], + ['btransfertypemask',['bTransferTypeMask',['../class_u_s_b_h___m_i_d_i.html#a16cc26804628e2ea32513b4cce1aa7c3',1,'USBH_MIDI']]], ['btype',['bType',['../struct_hid_item_prefix.html#a16874c73fdb809e4c46407ca83684927',1,'HidItemPrefix']]], ['bulk_5fmaxpktsize',['BULK_MAXPKTSIZE',['../_b_t_d_8h.html#a32d591ef5742a99963130616ef146787',1,'BTD.h']]], ['bulkonly',['BulkOnly',['../class_bulk_only.html',1,'BulkOnly'],['../class_bulk_only.html#a530fb250b0a0c92b48bc57e2957ace25',1,'BulkOnly::BulkOnly()']]], diff --git a/search/all_3.html b/search/all_3.html index 9f526c67..a3e6f7db 100644 --- a/search/all_3.html +++ b/search/all_3.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_3.js b/search/all_3.js index 5972a1fe..5eaca65a 100644 --- a/search/all_3.js +++ b/search/all_3.js @@ -68,7 +68,7 @@ var searchData= ['cdcprolific_2ecpp',['cdcprolific.cpp',['../cdcprolific_8cpp.html',1,'']]], ['cdcprolific_2eh',['cdcprolific.h',['../cdcprolific_8h.html',1,'']]], ['charging',['Charging',['../_p_s3_enums_8h.html#add5c7a32e8138b44244caf07232161aea5a86ae1482947377a116685c168d1773',1,'PS3Enums.h']]], - ['check_5fpid',['CHECK_PID',['../cdcprolific_8h.html#acbcf4352865e074958a6ed3a5ba3f1cd',1,'cdcprolific.h']]], + ['check_5fpid',['CHECK_PID',['../cdcprolific_8h.html#af1a8fea671253f8bb7f124ad159f415a',1,'cdcprolific.h']]], ['checkhcihandle',['checkHciHandle',['../class_bluetooth_service.html#a2a3674a4bb5d409840995eabe07049bd',1,'BluetoothService']]], ['circle',['circle',['../union_p_s4_buttons.html#a95340b24c0846c778d2d8d0c983f4cdb',1,'PS4Buttons::circle()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdaa79c827759ea48f0735386c4b1188911',1,'CIRCLE(): controllerEnums.h']]], ['class_5fnotification',['CLASS_NOTIFICATION',['../struct_c_l_a_s_s___n_o_t_i_f_i_c_a_t_i_o_n.html',1,'']]], @@ -115,7 +115,7 @@ var searchData= ['control_5fscid',['control_scid',['../class_b_t_h_i_d.html#acf6933a4988ed9f48c6e08cc7c9b906c',1,'BTHID']]], ['controllerenums_2eh',['controllerEnums.h',['../controller_enums_8h.html',1,'']]], ['counter',['counter',['../structtouchpad_x_y.html#ae52c34f2e6e66933e06b2f3448badcf0',1,'touchpadXY']]], - ['countsysexdatasize',['countSysExDataSize',['../class_u_s_b_h___m_i_d_i.html#afbb9e1d8440fb282c129ae26bff8d575',1,'USBH_MIDI']]], + ['countsysexdatasize',['countSysExDataSize',['../class_u_s_b_h___m_i_d_i.html#ab3b9ea78a331449802e4ce5a5a9c7f18',1,'USBH_MIDI']]], ['cp_5fmask_5fcompare_5fall',['CP_MASK_COMPARE_ALL',['../confdescparser_8h.html#ad6da11ef61b1efe75758448abeb4cbe7',1,'confdescparser.h']]], ['cp_5fmask_5fcompare_5fclass',['CP_MASK_COMPARE_CLASS',['../confdescparser_8h.html#a97d95efc3446be55adbb1801c356c55c',1,'confdescparser.h']]], ['cp_5fmask_5fcompare_5fprotocol',['CP_MASK_COMPARE_PROTOCOL',['../confdescparser_8h.html#a1e4d3b53bdd61abb61f20d5973e194d7',1,'confdescparser.h']]], diff --git a/search/all_4.html b/search/all_4.html index 7b814aa9..6452295d 100644 --- a/search/all_4.html +++ b/search/all_4.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_5.html b/search/all_5.html index d8de5560..e59e1d53 100644 --- a/search/all_5.html +++ b/search/all_5.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_5.js b/search/all_5.js index 2cc159dd..f137ca3f 100644 --- a/search/all_5.js +++ b/search/all_5.js @@ -7,7 +7,7 @@ var searchData= ['enable_5fuhs_5fdebugging',['ENABLE_UHS_DEBUGGING',['../settings_8h.html#a678b7105847680b596d1b4f9c0b5841c',1,'settings.h']]], ['enable_5fwii_5fir_5fcamera',['ENABLE_WII_IR_CAMERA',['../settings_8h.html#a251a8e974ddd0680dbcefaa3a4ae9ae8',1,'settings.h']]], ['encserv',['ENCSERV',['../struct_inquiry_response.html#a6b4df8c5346c15186c9f200997bfb287',1,'InquiryResponse']]], - ['endpointxtract',['EndpointXtract',['../class_a_d_k.html#aac2fac5410faea0e439b4f7e688b3d75',1,'ADK::EndpointXtract()'],['../class_b_t_d.html#a23928cd0e5711a2433aec763cfa55773',1,'BTD::EndpointXtract()'],['../class_a_c_m.html#af5b411a7ccc82bd77a7c5cfba6cd9a86',1,'ACM::EndpointXtract()'],['../class_f_t_d_i.html#a3e3f771b9f2a99fcedf7ed665b597109',1,'FTDI::EndpointXtract()'],['../class_usb_config_xtracter.html#a7717ea27bb756568e0deb544d8331370',1,'UsbConfigXtracter::EndpointXtract()'],['../class_h_i_d_boot.html#a04475d2cd6d8ae19d4e4149714fa4bef',1,'HIDBoot::EndpointXtract()'],['../class_h_i_d_composite.html#abdae8ebd9c5cc676c91829e41e3984a2',1,'HIDComposite::EndpointXtract()'],['../class_h_i_d_universal.html#ab9b13f27eca16e0accc14fff9bd318e2',1,'HIDUniversal::EndpointXtract()'],['../class_bulk_only.html#a13d33906543d5d6b44620f430dc729ff',1,'BulkOnly::EndpointXtract()']]], + ['endpointxtract',['EndpointXtract',['../class_a_d_k.html#aac2fac5410faea0e439b4f7e688b3d75',1,'ADK::EndpointXtract()'],['../class_b_t_d.html#a23928cd0e5711a2433aec763cfa55773',1,'BTD::EndpointXtract()'],['../class_a_c_m.html#af5b411a7ccc82bd77a7c5cfba6cd9a86',1,'ACM::EndpointXtract()'],['../class_f_t_d_i.html#a3e3f771b9f2a99fcedf7ed665b597109',1,'FTDI::EndpointXtract()'],['../class_usb_config_xtracter.html#a7717ea27bb756568e0deb544d8331370',1,'UsbConfigXtracter::EndpointXtract()'],['../class_h_i_d_boot.html#a04475d2cd6d8ae19d4e4149714fa4bef',1,'HIDBoot::EndpointXtract()'],['../class_h_i_d_composite.html#abdae8ebd9c5cc676c91829e41e3984a2',1,'HIDComposite::EndpointXtract()'],['../class_h_i_d_universal.html#ab9b13f27eca16e0accc14fff9bd318e2',1,'HIDUniversal::EndpointXtract()'],['../class_bulk_only.html#a13d33906543d5d6b44620f430dc729ff',1,'BulkOnly::EndpointXtract()'],['../class_x_b_o_x_o_n_e.html#a499cc378b8ae7d8fd63baa1b4dab97b5',1,'XBOXONE::EndpointXtract()']]], ['enerrorbuffertoosmall',['enErrorBufferTooSmall',['../class_report_desc_parser_base.html#a7d76bc2c7b1e93537bd0321c568dc47caf987a827c15a079e71ad438be18366d4',1,'ReportDescParserBase']]], ['enerrorincomplete',['enErrorIncomplete',['../class_report_desc_parser_base.html#a7d76bc2c7b1e93537bd0321c568dc47ca36c789b01edcb0e3bd8fc74ad6450975',1,'ReportDescParserBase']]], ['enerrorsuccess',['enErrorSuccess',['../class_report_desc_parser_base.html#a7d76bc2c7b1e93537bd0321c568dc47cab24601408ad7a26379df557dab8f073a',1,'ReportDescParserBase']]], @@ -15,7 +15,7 @@ var searchData= ['enhanced_5ffeatures',['enhanced_features',['../class_x_r21_b1411.html#a2f75b9dab539f642a9d6484faf5df767',1,'XR21B1411::enhanced_features()'],['../class_a_c_m.html#a2b7125159dc81b1a896ff23cefc71938',1,'ACM::enhanced_features()']]], ['enhanced_5fstatus',['enhanced_status',['../class_a_c_m.html#a4032d44491e27670c64b23f72f2a810a',1,'ACM']]], ['ep_5fdescr_5flen',['EP_DESCR_LEN',['../usb__ch9_8h.html#a83547c94285cfb215336a3c44aeea1b9',1,'usb_ch9.h']]], - ['ep_5fmaxpktsize',['EP_MAXPKTSIZE',['../_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): PS3USB.h'],['../_x_b_o_x_o_l_d_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXONE.h'],['../_x_b_o_x_r_e_c_v_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXUSB.h']]], + ['ep_5fmaxpktsize',['EP_MAXPKTSIZE',['../_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): PS3USB.h'],['../_x_b_o_x_o_l_d_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXOLD.h'],['../_x_b_o_x_r_e_c_v_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXUSB.h']]], ['epaddr',['epAddr',['../struct_ep_info.html#a9f92be74c75c037b39e2cae1eb49b89b',1,'EpInfo']]], ['epattribs',['epAttribs',['../struct_ep_info.html#a1dea928517c961235eef7b0876e69f10',1,'EpInfo']]], ['epcount',['epcount',['../struct_usb_device.html#a828814f5231b866ac665a24ec5edaa3a',1,'UsbDevice']]], @@ -23,7 +23,7 @@ var searchData= ['epdatainindexvsp',['epDataInIndexVSP',['../class_u_s_b_h___m_i_d_i.html#ac8b7d0994df1a059ccf6be62dd84cc9e',1,'USBH_MIDI']]], ['epdataoutindex',['epDataOutIndex',['../class_a_d_k.html#acfc5a7e45f15bba7ff8cd42552796624',1,'ADK::epDataOutIndex()'],['../class_a_c_m.html#a0dc940bc4f1bed7525bb768e37e6cb61',1,'ACM::epDataOutIndex()'],['../class_bulk_only.html#a8d527bdc285870f3571481a4fd982721',1,'BulkOnly::epDataOutIndex()'],['../class_u_s_b_h___m_i_d_i.html#a2a2e35a5ce5ffc8605837de2587db740',1,'USBH_MIDI::epDataOutIndex()']]], ['epdataoutindexvsp',['epDataOutIndexVSP',['../class_u_s_b_h___m_i_d_i.html#a42685ed17f731d3c8e3062d1e1b52f78',1,'USBH_MIDI']]], - ['epinfo',['EpInfo',['../struct_ep_info.html',1,'EpInfo'],['../struct_usb_device.html#a410d39fb7758157f57794335e990ed02',1,'UsbDevice::epinfo()'],['../class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d',1,'ADK::epInfo()'],['../class_b_t_d.html#a91d92fee94e5a4cbca472bb3fd883e3e',1,'BTD::epInfo()'],['../class_a_c_m.html#a60fb6a365b78fb80a4a9842e364cf1a3',1,'ACM::epInfo()'],['../class_h_i_d_composite.html#a4101c34c5079bd827953368450140a9a',1,'HIDComposite::epInfo()'],['../class_h_i_d_universal.html#ad26d2e63130abac2059154bf5afbf152',1,'HIDUniversal::epInfo()'],['../class_bulk_only.html#aee2247fd0a251e4da36e8c09bbe6917f',1,'BulkOnly::epInfo()'],['../class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1',1,'PS3USB::epInfo()'],['../class_u_s_b_h___m_i_d_i.html#ac947c1e0feea5cc9387c35bbd9bde961',1,'USBH_MIDI::epInfo()'],['../class_x_b_o_x_o_l_d.html#a06a318db8037f25a8d9bb62785dbacb9',1,'XBOXOLD::epInfo()'],['../class_x_b_o_x_o_n_e.html#a1d2fe54c2e3d0471aa4fa2a12bae6931',1,'XBOXONE::epInfo()'],['../class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb',1,'XBOXRECV::epInfo()'],['../class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f',1,'XBOXUSB::epInfo()']]], + ['epinfo',['EpInfo',['../struct_ep_info.html',1,'EpInfo'],['../struct_usb_device.html#a410d39fb7758157f57794335e990ed02',1,'UsbDevice::epinfo()'],['../class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d',1,'ADK::epInfo()'],['../class_b_t_d.html#a91d92fee94e5a4cbca472bb3fd883e3e',1,'BTD::epInfo()'],['../class_a_c_m.html#a60fb6a365b78fb80a4a9842e364cf1a3',1,'ACM::epInfo()'],['../class_h_i_d_composite.html#a4101c34c5079bd827953368450140a9a',1,'HIDComposite::epInfo()'],['../class_h_i_d_universal.html#ad26d2e63130abac2059154bf5afbf152',1,'HIDUniversal::epInfo()'],['../class_bulk_only.html#aee2247fd0a251e4da36e8c09bbe6917f',1,'BulkOnly::epInfo()'],['../class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1',1,'PS3USB::epInfo()'],['../class_u_s_b_h___m_i_d_i.html#ac947c1e0feea5cc9387c35bbd9bde961',1,'USBH_MIDI::epInfo()'],['../class_x_b_o_x_o_l_d.html#a06a318db8037f25a8d9bb62785dbacb9',1,'XBOXOLD::epInfo()'],['../class_x_b_o_x_o_n_e.html#a2915fc1f1f3a9c5333bfd643defa0621',1,'XBOXONE::epInfo()'],['../class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb',1,'XBOXRECV::epInfo()'],['../class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f',1,'XBOXUSB::epInfo()']]], ['epinterruptinindex',['epInterruptInIndex',['../class_a_c_m.html#a9b32207fdf256e5f8553ba4048b64307',1,'ACM::epInterruptInIndex()'],['../class_bulk_only.html#a03cd96b415990821bdce43b4004c85e4',1,'BulkOnly::epInterruptInIndex()'],['../class_u_s_b_h_i_d.html#a722462978813b2154698516b729e834d',1,'USBHID::epInterruptInIndex()']]], ['epinterruptoutindex',['epInterruptOutIndex',['../class_u_s_b_h_i_d.html#af9ae556d2a7a03309db403e45eab96e8',1,'USBHID']]], ['epmul',['epMUL',['../hidboot_8h.html#abbd1564d789b53fcf08fa5c4d9b0121d',1,'hidboot.h']]], @@ -53,5 +53,6 @@ var searchData= ['evtbuff',['evtBuff',['../struct_hub_event.html#a5a8016b368bc8ac993abae3f97b8306f',1,'HubEvent']]], ['ext_5fram',['EXT_RAM',['../settings_8h.html#afdb33d1e651e2cdd5574d3f9336fdb30',1,'settings.h']]], ['extendaddress',['extendAddress',['../_s_p_p_8h.html#af31032289d962bc2408debecc2823b8c',1,'SPP.h']]], - ['external_5fmask',['EXTERNAL_MASK',['../cdcprolific_8h.html#a18bdc379296992f91a263a8aa869cf24',1,'cdcprolific.h']]] + ['external_5fmask',['EXTERNAL_MASK',['../cdcprolific_8h.html#a18bdc379296992f91a263a8aa869cf24',1,'cdcprolific.h']]], + ['extractsysexdata',['extractSysExData',['../class_u_s_b_h___m_i_d_i.html#ab85f9e0da16ffe3ee9809aa27023c94c',1,'USBH_MIDI']]] ]; diff --git a/search/all_6.html b/search/all_6.html index 9ba0cc2b..f75a754e 100644 --- a/search/all_6.html +++ b/search/all_6.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_7.html b/search/all_7.html index 9384ec9b..88acd946 100644 --- a/search/all_7.html +++ b/search/all_7.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_8.html b/search/all_8.html index 37566c5d..b74d5fd8 100644 --- a/search/all_8.html +++ b/search/all_8.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_9.html b/search/all_9.html index c8c51023..95e88dd2 100644 --- a/search/all_9.html +++ b/search/all_9.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_9.js b/search/all_9.js index db4fd6ea..f4898788 100644 --- a/search/all_9.js +++ b/search/all_9.js @@ -2,8 +2,8 @@ var searchData= [ ['iconfiguration',['iConfiguration',['../struct_u_s_b___c_o_n_f_i_g_u_r_a_t_i_o_n___d_e_s_c_r_i_p_t_o_r.html#a488103d763db8744459d2c94995458b0',1,'USB_CONFIGURATION_DESCRIPTOR']]], ['identifier',['identifier',['../class_bluetooth_service.html#ad643db609c7e2e3fae8904dbc7991262',1,'BluetoothService']]], - ['idproduct',['idProduct',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#adaec05748124a104c3d49008433719ba',1,'USB_DEVICE_DESCRIPTOR']]], - ['idvendor',['idVendor',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#ae3c7088fe6f7b521132d8f2b95f958bc',1,'USB_DEVICE_DESCRIPTOR']]], + ['idproduct',['idProduct',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#adaec05748124a104c3d49008433719ba',1,'USB_DEVICE_DESCRIPTOR::idProduct()'],['../class_u_s_b_h___m_i_d_i.html#ac7b56c71f8424ec0175f390264776bdd',1,'USBH_MIDI::idProduct()']]], + ['idvendor',['idVendor',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#ae3c7088fe6f7b521132d8f2b95f958bc',1,'USB_DEVICE_DESCRIPTOR::idVendor()'],['../class_u_s_b_h___m_i_d_i.html#aa7d217e3479a9116f8f2ce90c1177317',1,'USBH_MIDI::idVendor()']]], ['iinterface',['iInterface',['../struct_u_s_b___i_n_t_e_r_f_a_c_e___d_e_s_c_r_i_p_t_o_r.html#a391ad3184a29ddbe1e02ff1feca8f64a',1,'USB_INTERFACE_DESCRIPTOR']]], ['imanufacturer',['iManufacturer',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#ad16528e2a4018962f8d7d97036386eac',1,'USB_DEVICE_DESCRIPTOR']]], ['incominghiddevice',['incomingHIDDevice',['../class_b_t_d.html#a685d6371fb0c950ff6bad4510a8cc85a',1,'BTD']]], @@ -25,7 +25,7 @@ var searchData= ['iserialnumber',['iSerialNumber',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#ac9d321b21797ac7a6190ae9a2ffa1e3e',1,'USB_DEVICE_DESCRIPTOR']]], ['isircameraenabled',['isIRCameraEnabled',['../class_w_i_i.html#a0a444d7e348026e062751cf723877e8f',1,'WII']]], ['ismidifound',['isMidiFound',['../class_u_s_b_h___m_i_d_i.html#a59bedc39ad72d9a11ce040fda96e92ed',1,'USBH_MIDI']]], - ['isready',['isReady',['../class_a_d_k.html#a1dee02856625dfcac4b0cdd4e8672cef',1,'ADK::isReady()'],['../class_b_t_d.html#a1b2440748bdaaeb552a05b0f0902f5d8',1,'BTD::isReady()'],['../class_a_c_m.html#a7161082e88359738596dd12a706ee286',1,'ACM::isReady()'],['../class_h_i_d_boot.html#a9972f402f3141b2d71c0e59602675f68',1,'HIDBoot::isReady()'],['../class_h_i_d_composite.html#a3d12bc7e852944029b1314a95b84d6ce',1,'HIDComposite::isReady()'],['../class_h_i_d_universal.html#aa4be95e8f5164393ea4766f68c5b0ea8',1,'HIDUniversal::isReady()'],['../class_p_s3_u_s_b.html#a02a5b0244665d5a790d1020e51c94479',1,'PS3USB::isReady()'],['../class_x_b_o_x_o_l_d.html#af4d77a5108f2e6812ba00be1b0374829',1,'XBOXOLD::isReady()'],['../class_x_b_o_x_o_n_e.html#a23112f12ed914d1b0128675b1f59aace',1,'XBOXONE::isReady()'],['../class_x_b_o_x_r_e_c_v.html#a570568108edafee8d060aad8fe40db57',1,'XBOXRECV::isReady()'],['../class_x_b_o_x_u_s_b.html#ac2507bfe85896b7fcc772894a7a9f272',1,'XBOXUSB::isReady()']]], + ['isready',['isReady',['../class_a_d_k.html#a1dee02856625dfcac4b0cdd4e8672cef',1,'ADK::isReady()'],['../class_b_t_d.html#a1b2440748bdaaeb552a05b0f0902f5d8',1,'BTD::isReady()'],['../class_a_c_m.html#a7161082e88359738596dd12a706ee286',1,'ACM::isReady()'],['../class_f_t_d_i.html#a0e392f0f49843fa9ab0701950628b47b',1,'FTDI::isReady()'],['../class_h_i_d_boot.html#a9972f402f3141b2d71c0e59602675f68',1,'HIDBoot::isReady()'],['../class_h_i_d_composite.html#a3d12bc7e852944029b1314a95b84d6ce',1,'HIDComposite::isReady()'],['../class_h_i_d_universal.html#aa4be95e8f5164393ea4766f68c5b0ea8',1,'HIDUniversal::isReady()'],['../class_p_s3_u_s_b.html#a02a5b0244665d5a790d1020e51c94479',1,'PS3USB::isReady()'],['../class_x_b_o_x_o_l_d.html#af4d77a5108f2e6812ba00be1b0374829',1,'XBOXOLD::isReady()'],['../class_x_b_o_x_o_n_e.html#a23112f12ed914d1b0128675b1f59aace',1,'XBOXONE::isReady()'],['../class_x_b_o_x_r_e_c_v.html#a570568108edafee8d060aad8fe40db57',1,'XBOXRECV::isReady()'],['../class_x_b_o_x_u_s_b.html#ac2507bfe85896b7fcc772894a7a9f272',1,'XBOXUSB::isReady()']]], ['istouching',['isTouching',['../class_p_s4_parser.html#a6770a72c17062c2e00fb3602435fcade',1,'PS4Parser']]], ['itemparsestate',['itemParseState',['../class_report_desc_parser_base.html#adfc790524e25a7ad715b1e9adff54a25',1,'ReportDescParserBase']]], ['itemprefix',['itemPrefix',['../class_report_desc_parser_base.html#a70693c641100c952022ec5c160de1a8d',1,'ReportDescParserBase']]], diff --git a/search/all_a.html b/search/all_a.html index 4cb31f0c..3148a8e5 100644 --- a/search/all_a.html +++ b/search/all_a.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_b.html b/search/all_b.html index d34a612e..f2a3c8d0 100644 --- a/search/all_b.html +++ b/search/all_b.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_c.html b/search/all_c.html index c1ae2cae..63768107 100644 --- a/search/all_c.html +++ b/search/all_c.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_c.js b/search/all_c.js index 3a04ba86..0568b6d7 100644 --- a/search/all_c.js +++ b/search/all_c.js @@ -121,6 +121,7 @@ var searchData= ['linked',['Linked',['../struct_inquiry_response.html#ac0ee71a9c07b0c1fd9ff09461a81fa0e',1,'InquiryResponse']]], ['lockmedia',['LockMedia',['../class_bulk_only.html#ae7561d686d0b1374b5f9937d6ec8a035',1,'BulkOnly']]], ['logpwrswitchmode',['LogPwrSwitchMode',['../struct_hub_descriptor.html#a68084f6fd86bff9598573ac845be6fe3',1,'HubDescriptor']]], + ['lookupmsgsize',['lookupMsgSize',['../class_u_s_b_h___m_i_d_i.html#a8218ae22033b7d2120df75cfe696070e',1,'USBH_MIDI']]], ['low',['Low',['../_p_s3_enums_8h.html#add5c7a32e8138b44244caf07232161aea7a352a3dd2accc1dd65a4538c3754ee8',1,'PS3Enums.h']]], ['lowspeed',['lowspeed',['../struct_usb_device.html#a86a815577ad7883437d3ca72b32b8e8a',1,'UsbDevice']]], ['lshost',['LSHOST',['../max3421e_8h.html#aa05ee2be883f4b96948e18b0d55ab5c2',1,'max3421e.h']]], diff --git a/search/all_d.html b/search/all_d.html index 712223c6..cc52c79f 100644 --- a/search/all_d.html +++ b/search/all_d.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_d.js b/search/all_d.js index d4991a57..981a4de9 100644 --- a/search/all_d.js +++ b/search/all_d.js @@ -78,9 +78,11 @@ var searchData= ['memrchr_5fp',['memrchr_P',['../version__helper_8h.html#a243235b923ff7a3411ed43653abc727a',1,'version_helper.h']]], ['message_2ecpp',['message.cpp',['../message_8cpp.html',1,'']]], ['message_2eh',['message.h',['../message_8h.html',1,'']]], + ['mfk_5fcastuint8t',['MFK_CASTUINT8T',['../settings_8h.html#ab5a06671af5c2f1154fb653956959838',1,'settings.h']]], ['mic',['mic',['../struct_p_s4_status.html#a1d752bdc67f08a09fbb8feb6a0db5568',1,'PS4Status']]], ['midi_5fevent_5fpacket_5fsize',['MIDI_EVENT_PACKET_SIZE',['../usbh__midi_8h.html#a0cb5d0be715a42f36440b29eaa728c58',1,'usbh_midi.h']]], ['midi_5fmax_5fendpoints',['MIDI_MAX_ENDPOINTS',['../usbh__midi_8h.html#a209d19007c615d3f300a5d3717776a45',1,'usbh_midi.h']]], + ['midi_5fmax_5fsysex_5fsize',['MIDI_MAX_SYSEX_SIZE',['../usbh__midi_8h.html#ac62d581ae088d3699a4f39672ac2ff51',1,'usbh_midi.h']]], ['minus',['MINUS',['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdaf613d73b4e7b570ffd967df4a13c4225',1,'controllerEnums.h']]], ['misc',['Misc',['../struct_c_d_b12.html#af59803ec81c006b7bdefc03d80579d07',1,'CDB12::Misc()'],['../struct_c_d_b___l_b_a32__16.html#a50e5250b635b8782b1a82f4f137feefb',1,'CDB_LBA32_16::Misc()'],['../struct_c_d_b___l_b_a64__16.html#a5f3b9efa508e9e3d79a70414ea5c74ff',1,'CDB_LBA64_16::Misc()']]], ['misc2',['Misc2',['../struct_c_d_b10.html#a26b2c33b7867c33d19e77c6d873d7924',1,'CDB10::Misc2()'],['../struct_c_d_b___l_b_a32__16.html#a3809ba2a5399bd407b50b04b8c83cb9f',1,'CDB_LBA32_16::Misc2()'],['../struct_c_d_b___l_b_a64__16.html#a9a71353cc6ecb838dfd560a3c985e4a6',1,'CDB_LBA64_16::Misc2()']]], diff --git a/search/all_e.html b/search/all_e.html index d553ffa2..85b39bd4 100644 --- a/search/all_e.html +++ b/search/all_e.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_f.html b/search/all_f.html index c77391a0..89fa15a6 100644 --- a/search/all_f.html +++ b/search/all_f.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/all_f.js b/search/all_f.js index 5d17846b..2c6335ff 100644 --- a/search/all_f.js +++ b/search/all_f.js @@ -18,7 +18,7 @@ var searchData= ['onrightbuttondown',['OnRightButtonDown',['../class_mouse_report_parser.html#a6884349e6b2de0cbfedf3e1a77c23870',1,'MouseReportParser']]], ['onrightbuttonup',['OnRightButtonUp',['../class_mouse_report_parser.html#a1bdfee565073cd8b77cbeb9e184c174f',1,'MouseReportParser']]], ['opcode',['Opcode',['../struct_b_a_s_i_c_c_d_b.html#a64d8bea0216a84b8ba8c8f411ceae2c3',1,'BASICCDB::Opcode()'],['../struct_c_d_b6.html#af2b06ea02758f3096f48da306371a7d8',1,'CDB6::Opcode()'],['../struct_c_d_b10.html#af18bbff0fec1a1d31c741c542f2e92d6',1,'CDB10::Opcode()'],['../struct_c_d_b12.html#a75c7fb542c6c0ad6ba4a0e95a49ba1e1',1,'CDB12::Opcode()'],['../struct_c_d_b___l_b_a32__16.html#abc471d94f83905561d961f4f90629521',1,'CDB_LBA32_16::Opcode()'],['../struct_c_d_b___l_b_a64__16.html#a20868e9b945a51e146af8a31cad92977',1,'CDB_LBA64_16::Opcode()']]], - ['operator_20bool',['operator bool',['../class_s_p_p.html#ac90f0765c478bd624cee3b8d493d8432',1,'SPP']]], + ['operator_20bool',['operator bool',['../class_s_p_p.html#ac90f0765c478bd624cee3b8d493d8432',1,'SPP::operator bool()'],['../class_u_s_b_h___m_i_d_i.html#aeac79d834709ecc079551df2e16a7ffe',1,'USBH_MIDI::operator bool()']]], ['options',['options',['../union_p_s4_buttons.html#a27f1b87f473ace3a4465ae999858357b',1,'PS4Buttons::options()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fda1b20f1b4adb6ff9778b284fb46f6f99d',1,'OPTIONS(): controllerEnums.h']]], ['orange',['orange',['../union_p_s_b_u_z_z_buttons.html#a6acaf988a2a5433c539e09dd722398ab',1,'PSBUZZButtons::orange()'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdace9ee4c1a6b777940c7f3a766a9a88d4',1,'ORANGE(): controllerEnums.h']]], ['otg_5ffeature_5fa_5falt_5fhnp_5fsupport',['OTG_FEATURE_A_ALT_HNP_SUPPORT',['../usb__ch9_8h.html#a4c05deae742762f3110366a7bb8bffc2',1,'usb_ch9.h']]], diff --git a/search/classes_0.html b/search/classes_0.html index 025587a7..e935fdf7 100644 --- a/search/classes_0.html +++ b/search/classes_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_1.html b/search/classes_1.html index 86dc4ffe..3df6e80a 100644 --- a/search/classes_1.html +++ b/search/classes_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_10.html b/search/classes_10.html index f306d99d..0477a266 100644 --- a/search/classes_10.html +++ b/search/classes_10.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_2.html b/search/classes_2.html index 014caf80..028694ff 100644 --- a/search/classes_2.html +++ b/search/classes_2.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_3.html b/search/classes_3.html index 2e972011..2b1abe38 100644 --- a/search/classes_3.html +++ b/search/classes_3.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_4.html b/search/classes_4.html index 776fee37..87352149 100644 --- a/search/classes_4.html +++ b/search/classes_4.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_5.html b/search/classes_5.html index 69bbcc8b..ba8b1c69 100644 --- a/search/classes_5.html +++ b/search/classes_5.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_6.html b/search/classes_6.html index 2db08a01..f5850938 100644 --- a/search/classes_6.html +++ b/search/classes_6.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_7.html b/search/classes_7.html index fd67346e..6418529c 100644 --- a/search/classes_7.html +++ b/search/classes_7.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_8.html b/search/classes_8.html index 369fe529..87af6f60 100644 --- a/search/classes_8.html +++ b/search/classes_8.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_9.html b/search/classes_9.html index 188dbb38..f830ae04 100644 --- a/search/classes_9.html +++ b/search/classes_9.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_a.html b/search/classes_a.html index e7610d35..0fd3b7ac 100644 --- a/search/classes_a.html +++ b/search/classes_a.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_b.html b/search/classes_b.html index 4fc0a3f6..886abdfc 100644 --- a/search/classes_b.html +++ b/search/classes_b.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_c.html b/search/classes_c.html index d2a582ec..52ec2676 100644 --- a/search/classes_c.html +++ b/search/classes_c.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_d.html b/search/classes_d.html index 0fa42149..652508df 100644 --- a/search/classes_d.html +++ b/search/classes_d.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_e.html b/search/classes_e.html index 238ea09c..7d4e9a56 100644 --- a/search/classes_e.html +++ b/search/classes_e.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/classes_f.html b/search/classes_f.html index 94d95003..fa6ed25e 100644 --- a/search/classes_f.html +++ b/search/classes_f.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_0.html b/search/defines_0.html index 17cfaa2c..3bffafa9 100644 --- a/search/defines_0.html +++ b/search/defines_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_1.html b/search/defines_1.html index 5c0025e2..ca5bb94e 100644 --- a/search/defines_1.html +++ b/search/defines_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_10.html b/search/defines_10.html index 26f83fac..92fda5b1 100644 --- a/search/defines_10.html +++ b/search/defines_10.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_10.js b/search/defines_10.js index dc97156a..d2f8cc99 100644 --- a/search/defines_10.js +++ b/search/defines_10.js @@ -35,6 +35,7 @@ var searchData= ['ps3move_5fpid',['PS3MOVE_PID',['../_b_t_d_8h.html#afc242b8a1b867f79c49ad78e3a47b37f',1,'PS3MOVE_PID(): BTD.h'],['../_p_s3_u_s_b_8h.html#afc242b8a1b867f79c49ad78e3a47b37f',1,'PS3MOVE_PID(): PS3USB.h']]], ['ps3navigation_5fpid',['PS3NAVIGATION_PID',['../_b_t_d_8h.html#a54903b410722a45f8246653cd4d00632',1,'PS3NAVIGATION_PID(): BTD.h'],['../_p_s3_u_s_b_8h.html#a54903b410722a45f8246653cd4d00632',1,'PS3NAVIGATION_PID(): PS3USB.h']]], ['ps4_5fpid',['PS4_PID',['../_p_s4_u_s_b_8h.html#a776f4d4694166dbe732e585ebb8c816e',1,'PS4USB.h']]], + ['ps4_5fpid_5fslim',['PS4_PID_SLIM',['../_p_s4_u_s_b_8h.html#a7b76473e5da043c7b3ce1eefebe77dbc',1,'PS4USB.h']]], ['ps4_5fvid',['PS4_VID',['../_p_s4_u_s_b_8h.html#ac878fc36cc22549eb8a7ab6371197877',1,'PS4USB.h']]], ['psbuzz_5fpid',['PSBUZZ_PID',['../_p_s_buzz_8h.html#a0dd7a843e3d17c9404bdfa2723b3e1d5',1,'PSBuzz.h']]], ['psbuzz_5fvid',['PSBUZZ_VID',['../_p_s_buzz_8h.html#aa550e9c001056b0ee39428704cde0e5d',1,'PSBuzz.h']]], diff --git a/search/defines_11.html b/search/defines_11.html index 82a22517..54ac8637 100644 --- a/search/defines_11.html +++ b/search/defines_11.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_12.html b/search/defines_12.html index 86e4f322..5681fe26 100644 --- a/search/defines_12.html +++ b/search/defines_12.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_12.js b/search/defines_12.js index 4a89bfb5..e90e499a 100644 --- a/search/defines_12.js +++ b/search/defines_12.js @@ -79,7 +79,7 @@ var searchData= ['sdp_5fservice_5fsearch_5fattribute_5fresponse_5fpdu',['SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU',['../_s_p_p_8h.html#a42a6f00a3828a932bae1509c813b5c98',1,'SPP.h']]], ['se0',['SE0',['../max3421e_8h.html#a3cb02fdd2d36f8a755c4b1946a0b0063',1,'max3421e.h']]], ['se1',['SE1',['../max3421e_8h.html#a5c3d7b0a5b0933cfc0183cd36ea91f16',1,'max3421e.h']]], - ['sendlcdpins',['SENDlcdPins',['../max___l_c_d_8cpp.html#a8b1b918f6a2c50b113737fe4a8e493ed',1,'max_LCD.cpp']]], + ['sendlcdpins',['SENDlcdPins',['../max___l_c_d_8cpp.html#ab9142420ababc8fe568edee4796183ba',1,'max_LCD.cpp']]], ['serial_5fstate',['SERIAL_STATE',['../cdcacm_8h.html#a8e278dbd137d5d873d24e1647be9d4e6',1,'cdcacm.h']]], ['serialport_5fuuid',['SERIALPORT_UUID',['../_s_p_p_8h.html#a677a1fc4883355f7fad87551cc003c1b',1,'SPP.h']]], ['set_5fdcr0',['SET_DCR0',['../cdcprolific_8h.html#a0301d2726a35e10b2e05965cca3a4d3d',1,'cdcprolific.h']]], diff --git a/search/defines_13.html b/search/defines_13.html index 3663f338..bde0e3f4 100644 --- a/search/defines_13.html +++ b/search/defines_13.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_14.html b/search/defines_14.html index 4d32ebc8..e495581e 100644 --- a/search/defines_14.html +++ b/search/defines_14.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_14.js b/search/defines_14.js index ad9c448a..f1993e58 100644 --- a/search/defines_14.js +++ b/search/defines_14.js @@ -98,6 +98,7 @@ var searchData= ['usb_5fsetup_5ftype_5fclass',['USB_SETUP_TYPE_CLASS',['../usb__ch9_8h.html#acf3fd30992e9fe01f1bac9aaa7fea61b',1,'usb_ch9.h']]], ['usb_5fsetup_5ftype_5fstandard',['USB_SETUP_TYPE_STANDARD',['../usb__ch9_8h.html#a3b51a35acaa76cafbb987c07186a7868',1,'usb_ch9.h']]], ['usb_5fsetup_5ftype_5fvendor',['USB_SETUP_TYPE_VENDOR',['../usb__ch9_8h.html#a876bdd74d8bfb072121b9643556271ba',1,'usb_ch9.h']]], + ['usb_5fspi',['USB_SPI',['../settings_8h.html#a00c696e002848a253c812ca2f4509f04',1,'settings.h']]], ['usb_5fstate_5faddressing',['USB_STATE_ADDRESSING',['../_usb_core_8h.html#a474a95baaeb99abd17538c2a1364bf96',1,'UsbCore.h']]], ['usb_5fstate_5fconfiguring',['USB_STATE_CONFIGURING',['../_usb_core_8h.html#aac8c844e6a20f42298d70e4438a029e5',1,'UsbCore.h']]], ['usb_5fstate_5fdetached',['USB_STATE_DETACHED',['../_usb_core_8h.html#ae7fd7c5bb6dc87f44724dde2ad57df87',1,'UsbCore.h']]], diff --git a/search/defines_15.html b/search/defines_15.html index 5cc5b5a3..08482afa 100644 --- a/search/defines_15.html +++ b/search/defines_15.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_16.html b/search/defines_16.html index 7cfe8dda..6f7c2b3f 100644 --- a/search/defines_16.html +++ b/search/defines_16.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_17.html b/search/defines_17.html index 98dc84c6..e43115d6 100644 --- a/search/defines_17.html +++ b/search/defines_17.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_17.js b/search/defines_17.js index e59295c6..11c32048 100644 --- a/search/defines_17.js +++ b/search/defines_17.js @@ -1,24 +1,46 @@ var searchData= [ - ['xbox_5fcontrol_5fpipe',['XBOX_CONTROL_PIPE',['../_x_b_o_x_o_l_d_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXONE.h'],['../_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXUSB.h']]], - ['xbox_5finput_5fpipe',['XBOX_INPUT_PIPE',['../_x_b_o_x_o_l_d_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXONE.h'],['../_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXUSB.h']]], + ['xbox_5fcontrol_5fpipe',['XBOX_CONTROL_PIPE',['../_x_b_o_x_o_l_d_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXOLD.h'],['../_x_b_o_x_r_e_c_v_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a8f4ee68cc0f05690f5f26104c7d9e490',1,'XBOX_CONTROL_PIPE(): XBOXUSB.h']]], + ['xbox_5finput_5fpipe',['XBOX_INPUT_PIPE',['../_x_b_o_x_o_l_d_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXOLD.h'],['../_x_b_o_x_u_s_b_8h.html#a4fd9ad9bf7a7d5767940c2ec224ef5e8',1,'XBOX_INPUT_PIPE(): XBOXUSB.h']]], ['xbox_5finput_5fpipe_5f1',['XBOX_INPUT_PIPE_1',['../_x_b_o_x_r_e_c_v_8h.html#a2824b25aa9a384c29f27a4e1bb443799',1,'XBOXRECV.h']]], ['xbox_5finput_5fpipe_5f2',['XBOX_INPUT_PIPE_2',['../_x_b_o_x_r_e_c_v_8h.html#aab6feb681a78b190190bcc081868a485',1,'XBOXRECV.h']]], ['xbox_5finput_5fpipe_5f3',['XBOX_INPUT_PIPE_3',['../_x_b_o_x_r_e_c_v_8h.html#a86a3e5765d02bc043d5d1f674a7ffb0f',1,'XBOXRECV.h']]], ['xbox_5finput_5fpipe_5f4',['XBOX_INPUT_PIPE_4',['../_x_b_o_x_r_e_c_v_8h.html#a5acfdaefe74aba1632c71acb79c49671',1,'XBOXRECV.h']]], - ['xbox_5fmax_5fendpoints',['XBOX_MAX_ENDPOINTS',['../_x_b_o_x_o_l_d_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXONE.h'],['../_x_b_o_x_r_e_c_v_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXUSB.h']]], + ['xbox_5fmax_5fendpoints',['XBOX_MAX_ENDPOINTS',['../_x_b_o_x_o_l_d_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXOLD.h'],['../_x_b_o_x_r_e_c_v_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#af35f872fc33e690571eb99de648e8e96',1,'XBOX_MAX_ENDPOINTS(): XBOXUSB.h']]], ['xbox_5fold_5fpid1',['XBOX_OLD_PID1',['../_x_b_o_x_o_l_d_8h.html#a8495cfaf2039ba2399a3c6f3e107c90c',1,'XBOXOLD.h']]], ['xbox_5fold_5fpid2',['XBOX_OLD_PID2',['../_x_b_o_x_o_l_d_8h.html#a9c98134e7ea99b12f7e4724af5b9799c',1,'XBOXOLD.h']]], ['xbox_5fold_5fpid3',['XBOX_OLD_PID3',['../_x_b_o_x_o_l_d_8h.html#a3856d8cf87b39551ed2278691ad891b8',1,'XBOXOLD.h']]], ['xbox_5fold_5fpid4',['XBOX_OLD_PID4',['../_x_b_o_x_o_l_d_8h.html#a3bf8a81e24b9c3df304fdafb06bbeb4e',1,'XBOXOLD.h']]], - ['xbox_5fone_5fpid',['XBOX_ONE_PID',['../_x_b_o_x_o_n_e_8h.html#a2b8eadd23fe690a1f2ecd2421e58682e',1,'XBOXONE.h']]], - ['xbox_5foutput_5fpipe',['XBOX_OUTPUT_PIPE',['../_x_b_o_x_o_l_d_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXONE.h'],['../_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXUSB.h']]], + ['xbox_5fone_5fcontrol_5fpipe',['XBOX_ONE_CONTROL_PIPE',['../_x_b_o_x_o_n_e_8h.html#a916c0ffc31c703da27b5f5cbdabea361',1,'XBOXONE.h']]], + ['xbox_5fone_5fep_5fmaxpktsize',['XBOX_ONE_EP_MAXPKTSIZE',['../_x_b_o_x_o_n_e_8h.html#aee7388a903006047acac4b071a28bd9d',1,'XBOXONE.h']]], + ['xbox_5fone_5finput_5fpipe',['XBOX_ONE_INPUT_PIPE',['../_x_b_o_x_o_n_e_8h.html#a996610ea223dd4c7756ad3af2efa821b',1,'XBOXONE.h']]], + ['xbox_5fone_5fmax_5fendpoints',['XBOX_ONE_MAX_ENDPOINTS',['../_x_b_o_x_o_n_e_8h.html#a8e9bf59d8bc051ff3fa38e2b327ade6e',1,'XBOXONE.h']]], + ['xbox_5fone_5foutput_5fpipe',['XBOX_ONE_OUTPUT_PIPE',['../_x_b_o_x_o_n_e_8h.html#a1a9da90da4584db2de7c84f45bdafc89',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid1',['XBOX_ONE_PID1',['../_x_b_o_x_o_n_e_8h.html#a10b005f24d84af7d10268faabea14c1e',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid10',['XBOX_ONE_PID10',['../_x_b_o_x_o_n_e_8h.html#ad7aedc27b8dfa49a7af8fce89432df0a',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid11',['XBOX_ONE_PID11',['../_x_b_o_x_o_n_e_8h.html#a3692a20fd79bcdfdcdec36b4acae8a76',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid12',['XBOX_ONE_PID12',['../_x_b_o_x_o_n_e_8h.html#a185f8aba65c0c20a1917efa6383d7ab0',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid2',['XBOX_ONE_PID2',['../_x_b_o_x_o_n_e_8h.html#abba090da8fd2707cb996899e798d1bd4',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid3',['XBOX_ONE_PID3',['../_x_b_o_x_o_n_e_8h.html#a6cc79a26eb1b03c3ca320f8adcd1d1bd',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid4',['XBOX_ONE_PID4',['../_x_b_o_x_o_n_e_8h.html#a148021ecf4a60cb1f25d59bb698fa7df',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid5',['XBOX_ONE_PID5',['../_x_b_o_x_o_n_e_8h.html#ae5883d7d1d2cdbbb5604865d67601696',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid6',['XBOX_ONE_PID6',['../_x_b_o_x_o_n_e_8h.html#aede8fa4d1fe42ddc8c48f0bb2bfeee0c',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid7',['XBOX_ONE_PID7',['../_x_b_o_x_o_n_e_8h.html#ad6a957e104a5e50381681e16229c3ced',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid8',['XBOX_ONE_PID8',['../_x_b_o_x_o_n_e_8h.html#ac3ac9e12165117b895d17af5f40ea5dd',1,'XBOXONE.h']]], + ['xbox_5fone_5fpid9',['XBOX_ONE_PID9',['../_x_b_o_x_o_n_e_8h.html#abb2d1e64c4771836476e8aa1ffe46431',1,'XBOXONE.h']]], + ['xbox_5foutput_5fpipe',['XBOX_OUTPUT_PIPE',['../_x_b_o_x_o_l_d_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXOLD.h'],['../_x_b_o_x_u_s_b_8h.html#a92d2d844a70224a10c100c0a877aacfe',1,'XBOX_OUTPUT_PIPE(): XBOXUSB.h']]], ['xbox_5foutput_5fpipe_5f1',['XBOX_OUTPUT_PIPE_1',['../_x_b_o_x_r_e_c_v_8h.html#a962be1e740bce25cf37e111bd88be9bf',1,'XBOXRECV.h']]], ['xbox_5foutput_5fpipe_5f2',['XBOX_OUTPUT_PIPE_2',['../_x_b_o_x_r_e_c_v_8h.html#a8ba688a4bdb47869d7ee3f49b6d07b7c',1,'XBOXRECV.h']]], ['xbox_5foutput_5fpipe_5f3',['XBOX_OUTPUT_PIPE_3',['../_x_b_o_x_r_e_c_v_8h.html#afce4154cabb3a0d2c7eeb39b1c15d353',1,'XBOXRECV.h']]], ['xbox_5foutput_5fpipe_5f4',['XBOX_OUTPUT_PIPE_4',['../_x_b_o_x_r_e_c_v_8h.html#a7a74e0ea052831dbbb4a0973fffc8179',1,'XBOXRECV.h']]], - ['xbox_5freport_5fbuffer_5fsize',['XBOX_REPORT_BUFFER_SIZE',['../_x_b_o_x_o_n_e_8h.html#aaa3e91675875fbf14a37369f9513874a',1,'XBOX_REPORT_BUFFER_SIZE(): XBOXONE.h'],['../_x_b_o_x_u_s_b_8h.html#aaa3e91675875fbf14a37369f9513874a',1,'XBOX_REPORT_BUFFER_SIZE(): XBOXUSB.h']]], - ['xbox_5fvid',['XBOX_VID',['../_x_b_o_x_o_l_d_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXONE.h'],['../_x_b_o_x_r_e_c_v_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXUSB.h']]], + ['xbox_5freport_5fbuffer_5fsize',['XBOX_REPORT_BUFFER_SIZE',['../_x_b_o_x_u_s_b_8h.html#aaa3e91675875fbf14a37369f9513874a',1,'XBOXUSB.h']]], + ['xbox_5fvid',['XBOX_VID',['../_x_b_o_x_o_l_d_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXOLD.h'],['../_x_b_o_x_r_e_c_v_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a8e7834e5604c4fb588cceab9258d0568',1,'XBOX_VID(): XBOXUSB.h']]], + ['xbox_5fvid1',['XBOX_VID1',['../_x_b_o_x_o_n_e_8h.html#a72296ecd70897c4fcfe4c614bbf2051b',1,'XBOXONE.h']]], + ['xbox_5fvid2',['XBOX_VID2',['../_x_b_o_x_o_n_e_8h.html#a85fb8c87d82f5c49fdb951d41247563f',1,'XBOXONE.h']]], + ['xbox_5fvid3',['XBOX_VID3',['../_x_b_o_x_o_n_e_8h.html#aac92aad3632dc9632d04d90342904b18',1,'XBOXONE.h']]], + ['xbox_5fvid4',['XBOX_VID4',['../_x_b_o_x_o_n_e_8h.html#a17464f5e0fb6afc082555ccb61c29668',1,'XBOXONE.h']]], + ['xbox_5fvid5',['XBOX_VID5',['../_x_b_o_x_o_n_e_8h.html#ade0eb2e0dd4f0c3fe45c82121f31d44d',1,'XBOXONE.h']]], + ['xbox_5fvid6',['XBOX_VID6',['../_x_b_o_x_o_n_e_8h.html#a02fcf09e41a7a1a28fd1bdb28dc098ed',1,'XBOXONE.h']]], ['xbox_5fwired_5fpid',['XBOX_WIRED_PID',['../_x_b_o_x_u_s_b_8h.html#af2ec224ac142016119c418de89470f1f',1,'XBOXUSB.h']]], ['xbox_5fwireless_5fpid',['XBOX_WIRELESS_PID',['../_x_b_o_x_u_s_b_8h.html#a10c2a7a8da78e76d7020c2c347f0a687',1,'XBOXUSB.h']]], ['xbox_5fwireless_5freceiver_5fpid',['XBOX_WIRELESS_RECEIVER_PID',['../_x_b_o_x_r_e_c_v_8h.html#a1a97ce2829a30b96ea6640d387d245a9',1,'XBOX_WIRELESS_RECEIVER_PID(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#a1a97ce2829a30b96ea6640d387d245a9',1,'XBOX_WIRELESS_RECEIVER_PID(): XBOXUSB.h']]], @@ -37,7 +59,7 @@ var searchData= ['xr_5freg_5fcustomised_5fint',['XR_REG_CUSTOMISED_INT',['../cdc___x_r21_b1411_8h.html#ad8f26622feeb072c9caa5c5f95f3b6ed',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus',['XR_REG_ERROR_STATUS',['../cdc___x_r21_b1411_8h.html#af50fcb0d47dfcb8dae3020b98b90f5b1',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus_5fbreak',['XR_REG_ERROR_STATUS_BREAK',['../cdc___x_r21_b1411_8h.html#af2eb9c3a6ad7f95fc439139f8c430d74',1,'cdc_XR21B1411.h']]], - ['xr_5freg_5ferror_5fstatus_5fbreak_5fstatus',['XR_REG_ERROR_STATUS_BREAK_STATUS',['../cdc___x_r21_b1411_8h.html#a00ee098551f16993fb6e55c500203e70',1,'cdc_XR21B1411.h']]], + ['xr_5freg_5ferror_5fstatus_5fbreaking',['XR_REG_ERROR_STATUS_BREAKING',['../cdc___x_r21_b1411_8h.html#af7c8d263bd77298510c4e361b52f6fb6',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus_5ferror',['XR_REG_ERROR_STATUS_ERROR',['../cdc___x_r21_b1411_8h.html#aa62ce08310e0d1e091d826bae6a091a0',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus_5fframe',['XR_REG_ERROR_STATUS_FRAME',['../cdc___x_r21_b1411_8h.html#a6d68869ec17604caec0a490cd4e84191',1,'cdc_XR21B1411.h']]], ['xr_5freg_5ferror_5fstatus_5fmask',['XR_REG_ERROR_STATUS_MASK',['../cdc___x_r21_b1411_8h.html#ae8dbffb7f958e6a5c0c0727dcebe8851',1,'cdc_XR21B1411.h']]], diff --git a/search/defines_2.html b/search/defines_2.html index a206bfcf..7cc1a74c 100644 --- a/search/defines_2.html +++ b/search/defines_2.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_2.js b/search/defines_2.js index 4234e36f..c84a05a4 100644 --- a/search/defines_2.js +++ b/search/defines_2.js @@ -1,5 +1,7 @@ var searchData= [ + ['belkin_5ff8t065bf_5fpid',['BELKIN_F8T065BF_PID',['../_b_t_d_8h.html#ad142141f4e7685e31dce306128eaad5f',1,'BTD.h']]], + ['belkin_5ff8t065bf_5fvid',['BELKIN_F8T065BF_VID',['../_b_t_d_8h.html#a576e49b56b3cfb9d70b22bac8fe6796f',1,'BTD.h']]], ['bgrab0',['BGRAB0',['../macros_8h.html#a773ca2920fd4808c94e6645a7a8d63d1',1,'macros.h']]], ['bgrab1',['BGRAB1',['../macros_8h.html#a483a8ceb644d44744abff34f61cc5442',1,'macros.h']]], ['bgrab2',['BGRAB2',['../macros_8h.html#a49c9ebd69fbb93bd97f9051f592390c6',1,'macros.h']]], diff --git a/search/defines_3.html b/search/defines_3.html index 3826e1f0..3d0ac123 100644 --- a/search/defines_3.html +++ b/search/defines_3.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_3.js b/search/defines_3.js index f94787bc..2d98b293 100644 --- a/search/defines_3.js +++ b/search/defines_3.js @@ -44,7 +44,7 @@ var searchData= ['cdc_5fsubclass_5fobex',['CDC_SUBCLASS_OBEX',['../cdcacm_8h.html#ab1094071380f381e0b8b88d240aedd03',1,'cdcacm.h']]], ['cdc_5fsubclass_5ftcm',['CDC_SUBCLASS_TCM',['../cdcacm_8h.html#a8e66107828e9b10a8b37823cb4436209',1,'cdcacm.h']]], ['cdc_5fsubclass_5fwireless_5fhandset',['CDC_SUBCLASS_WIRELESS_HANDSET',['../cdcacm_8h.html#ad331bb2702e65696ca33c2d933ab2d73',1,'cdcacm.h']]], - ['check_5fpid',['CHECK_PID',['../cdcprolific_8h.html#acbcf4352865e074958a6ed3a5ba3f1cd',1,'cdcprolific.h']]], + ['check_5fpid',['CHECK_PID',['../cdcprolific_8h.html#af1a8fea671253f8bb7f124ad159f415a',1,'cdcprolific.h']]], ['clr_5fe',['CLR_E',['../max___l_c_d_8cpp.html#a2382451f16ea0f18bf54dba5c7cfb471',1,'max_LCD.cpp']]], ['clr_5frs',['CLR_RS',['../max___l_c_d_8cpp.html#af60058c58ef619d81e5779d74324041e',1,'max_LCD.cpp']]], ['conf_5fdescr_5flen',['CONF_DESCR_LEN',['../usb__ch9_8h.html#a7256578391c91b980eec63daa6e87b6b',1,'usb_ch9.h']]], diff --git a/search/defines_4.html b/search/defines_4.html index c6864f75..201f927f 100644 --- a/search/defines_4.html +++ b/search/defines_4.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_5.html b/search/defines_5.html index eff65510..92d51a58 100644 --- a/search/defines_5.html +++ b/search/defines_5.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_5.js b/search/defines_5.js index 3e54d514..af1bda11 100644 --- a/search/defines_5.js +++ b/search/defines_5.js @@ -4,7 +4,7 @@ var searchData= ['enable_5fuhs_5fdebugging',['ENABLE_UHS_DEBUGGING',['../settings_8h.html#a678b7105847680b596d1b4f9c0b5841c',1,'settings.h']]], ['enable_5fwii_5fir_5fcamera',['ENABLE_WII_IR_CAMERA',['../settings_8h.html#a251a8e974ddd0680dbcefaa3a4ae9ae8',1,'settings.h']]], ['ep_5fdescr_5flen',['EP_DESCR_LEN',['../usb__ch9_8h.html#a83547c94285cfb215336a3c44aeea1b9',1,'usb_ch9.h']]], - ['ep_5fmaxpktsize',['EP_MAXPKTSIZE',['../_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): PS3USB.h'],['../_x_b_o_x_o_l_d_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXOLD.h'],['../_x_b_o_x_o_n_e_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXONE.h'],['../_x_b_o_x_r_e_c_v_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXUSB.h']]], + ['ep_5fmaxpktsize',['EP_MAXPKTSIZE',['../_p_s3_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): PS3USB.h'],['../_x_b_o_x_o_l_d_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXOLD.h'],['../_x_b_o_x_r_e_c_v_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXRECV.h'],['../_x_b_o_x_u_s_b_8h.html#abcb805b13bfd36145e252b0633bbcfc0',1,'EP_MAXPKTSIZE(): XBOXUSB.h']]], ['epmul',['epMUL',['../hidboot_8h.html#abbd1564d789b53fcf08fa5c4d9b0121d',1,'hidboot.h']]], ['ev_5fauthentication_5fcomplete',['EV_AUTHENTICATION_COMPLETE',['../_b_t_d_8h.html#a68b8f78a0e0da80434afb1e6d40eacf4',1,'BTD.h']]], ['ev_5fchange_5fconnection_5flink',['EV_CHANGE_CONNECTION_LINK',['../_b_t_d_8h.html#a3e107e9d07793ca5cfaeea8b2181d4a4',1,'BTD.h']]], diff --git a/search/defines_6.html b/search/defines_6.html index 5782e691..fa5d74ce 100644 --- a/search/defines_6.html +++ b/search/defines_6.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_7.html b/search/defines_7.html index 5911e543..99054085 100644 --- a/search/defines_7.html +++ b/search/defines_7.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_8.html b/search/defines_8.html index 943c11ef..9098e183 100644 --- a/search/defines_8.html +++ b/search/defines_8.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_9.html b/search/defines_9.html index f68b51b1..bdebe602 100644 --- a/search/defines_9.html +++ b/search/defines_9.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_a.html b/search/defines_a.html index 8236596b..d6b491aa 100644 --- a/search/defines_a.html +++ b/search/defines_a.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_b.html b/search/defines_b.html index 06064aaa..48f6b2b3 100644 --- a/search/defines_b.html +++ b/search/defines_b.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_c.html b/search/defines_c.html index 29bd2b34..920a9478 100644 --- a/search/defines_c.html +++ b/search/defines_c.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_d.html b/search/defines_d.html index 977da068..74d8e3d8 100644 --- a/search/defines_d.html +++ b/search/defines_d.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_d.js b/search/defines_d.js index 0824c577..2fe2ec04 100644 --- a/search/defines_d.js +++ b/search/defines_d.js @@ -57,8 +57,10 @@ var searchData= ['memcpy_5fp',['memcpy_P',['../version__helper_8h.html#ae0444ad0cb3250a5778a573dd10f41be',1,'version_helper.h']]], ['memmem_5fp',['memmem_P',['../version__helper_8h.html#afe1e08150140cc176a8d0a5b11081dd0',1,'version_helper.h']]], ['memrchr_5fp',['memrchr_P',['../version__helper_8h.html#a243235b923ff7a3411ed43653abc727a',1,'version_helper.h']]], + ['mfk_5fcastuint8t',['MFK_CASTUINT8T',['../settings_8h.html#ab5a06671af5c2f1154fb653956959838',1,'settings.h']]], ['midi_5fevent_5fpacket_5fsize',['MIDI_EVENT_PACKET_SIZE',['../usbh__midi_8h.html#a0cb5d0be715a42f36440b29eaa728c58',1,'usbh_midi.h']]], ['midi_5fmax_5fendpoints',['MIDI_MAX_ENDPOINTS',['../usbh__midi_8h.html#a209d19007c615d3f300a5d3717776a45',1,'usbh_midi.h']]], + ['midi_5fmax_5fsysex_5fsize',['MIDI_MAX_SYSEX_SIZE',['../usbh__midi_8h.html#ac62d581ae088d3699a4f39672ac2ff51',1,'usbh_midi.h']]], ['mode_5ffs_5fhost',['MODE_FS_HOST',['../max3421e_8h.html#a456c3175b4836ed1d2b276faeba55121',1,'max3421e.h']]], ['mode_5fls_5fhost',['MODE_LS_HOST',['../max3421e_8h.html#ab3da1b5bd1f43ba9f9da604841ba8802',1,'max3421e.h']]], ['mouse_5fparser_5fid',['MOUSE_PARSER_ID',['../_b_t_h_i_d_8h.html#a0b48c93189cf128c1ef13ce86b4fa6be',1,'BTHID.h']]], diff --git a/search/defines_e.html b/search/defines_e.html index bdf8b214..95660283 100644 --- a/search/defines_e.html +++ b/search/defines_e.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/defines_f.html b/search/defines_f.html index 81793366..bd9eb521 100644 --- a/search/defines_f.html +++ b/search/defines_f.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_0.html b/search/enums_0.html index aba8d799..9efcd1b7 100644 --- a/search/enums_0.html +++ b/search/enums_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_1.html b/search/enums_1.html index a8d38430..0edd7796 100644 --- a/search/enums_1.html +++ b/search/enums_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_2.html b/search/enums_2.html index ef7d6329..2b851b64 100644 --- a/search/enums_2.html +++ b/search/enums_2.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_3.html b/search/enums_3.html index 57bac2ef..b29d31c2 100644 --- a/search/enums_3.html +++ b/search/enums_3.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_4.html b/search/enums_4.html index f35d7a79..ad9ec5e9 100644 --- a/search/enums_4.html +++ b/search/enums_4.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_5.html b/search/enums_5.html index b579463d..3b863957 100644 --- a/search/enums_5.html +++ b/search/enums_5.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_6.html b/search/enums_6.html index b21542b1..acd7a542 100644 --- a/search/enums_6.html +++ b/search/enums_6.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_7.html b/search/enums_7.html index 75f8f8c3..ee24b455 100644 --- a/search/enums_7.html +++ b/search/enums_7.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_8.html b/search/enums_8.html index 037ed278..c6b4d24a 100644 --- a/search/enums_8.html +++ b/search/enums_8.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_9.html b/search/enums_9.html index c5aa5173..c7438683 100644 --- a/search/enums_9.html +++ b/search/enums_9.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enums_a.html b/search/enums_a.html index 50f130ae..58694efd 100644 --- a/search/enums_a.html +++ b/search/enums_a.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_0.html b/search/enumvalues_0.html index 83192d35..03fdfad9 100644 --- a/search/enumvalues_0.html +++ b/search/enumvalues_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_1.html b/search/enumvalues_1.html index 0715ef5a..abeea564 100644 --- a/search/enumvalues_1.html +++ b/search/enumvalues_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_10.html b/search/enumvalues_10.html index 62cedc47..f6a557e8 100644 --- a/search/enumvalues_10.html +++ b/search/enumvalues_10.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_11.html b/search/enumvalues_11.html index 23dd373b..12dad5fc 100644 --- a/search/enumvalues_11.html +++ b/search/enumvalues_11.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_12.html b/search/enumvalues_12.html index 6090caf0..e0464c68 100644 --- a/search/enumvalues_12.html +++ b/search/enumvalues_12.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_13.html b/search/enumvalues_13.html index d50ecfb3..38f0e6c2 100644 --- a/search/enumvalues_13.html +++ b/search/enumvalues_13.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_14.html b/search/enumvalues_14.html index 48dc6a50..5e1a6eec 100644 --- a/search/enumvalues_14.html +++ b/search/enumvalues_14.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_15.html b/search/enumvalues_15.html index 609e097a..a92e5199 100644 --- a/search/enumvalues_15.html +++ b/search/enumvalues_15.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_15.js b/search/enumvalues_15.js index 69656740..6fb1ddf4 100644 --- a/search/enumvalues_15.js +++ b/search/enumvalues_15.js @@ -1,5 +1,5 @@ var searchData= [ ['y',['Y',['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fda5596231eabd6cf29050967d5ac83ad84',1,'controllerEnums.h']]], - ['yellow',['YELLOW',['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdae735a848bf82163a19236ead1c3ef2d2',1,'YELLOW(): controllerEnums.h'],['../controller_enums_8h.html#aac6fa7b0395b95cc528deaad0ce884a2abf28513245738599d13e3ce36bd16c82',1,'Yellow(): controllerEnums.h']]] + ['yellow',['Yellow',['../controller_enums_8h.html#aac6fa7b0395b95cc528deaad0ce884a2abf28513245738599d13e3ce36bd16c82',1,'Yellow(): controllerEnums.h'],['../controller_enums_8h.html#a94f7389d205c78830a5441370d7870fdae735a848bf82163a19236ead1c3ef2d2',1,'YELLOW(): controllerEnums.h']]] ]; diff --git a/search/enumvalues_16.html b/search/enumvalues_16.html index 0274f9c6..915a85be 100644 --- a/search/enumvalues_16.html +++ b/search/enumvalues_16.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_2.html b/search/enumvalues_2.html index 0f9b5e9f..90289986 100644 --- a/search/enumvalues_2.html +++ b/search/enumvalues_2.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_3.html b/search/enumvalues_3.html index 9ebb3562..b152efcb 100644 --- a/search/enumvalues_3.html +++ b/search/enumvalues_3.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_4.html b/search/enumvalues_4.html index daa496de..3f50abb8 100644 --- a/search/enumvalues_4.html +++ b/search/enumvalues_4.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_5.html b/search/enumvalues_5.html index bd377935..b6f20f29 100644 --- a/search/enumvalues_5.html +++ b/search/enumvalues_5.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_6.html b/search/enumvalues_6.html index 656e4788..93be1295 100644 --- a/search/enumvalues_6.html +++ b/search/enumvalues_6.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_7.html b/search/enumvalues_7.html index 2c3a1c9d..9fefbd65 100644 --- a/search/enumvalues_7.html +++ b/search/enumvalues_7.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_8.html b/search/enumvalues_8.html index 983dccb5..03f17f86 100644 --- a/search/enumvalues_8.html +++ b/search/enumvalues_8.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_9.html b/search/enumvalues_9.html index a8b553fc..e60fe272 100644 --- a/search/enumvalues_9.html +++ b/search/enumvalues_9.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_a.html b/search/enumvalues_a.html index 5d9b2d68..1ec3a2a8 100644 --- a/search/enumvalues_a.html +++ b/search/enumvalues_a.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_b.html b/search/enumvalues_b.html index e947a47a..bfc2bf3f 100644 --- a/search/enumvalues_b.html +++ b/search/enumvalues_b.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_c.html b/search/enumvalues_c.html index 5da87761..36070b87 100644 --- a/search/enumvalues_c.html +++ b/search/enumvalues_c.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_d.html b/search/enumvalues_d.html index 679c7cec..e15d8c99 100644 --- a/search/enumvalues_d.html +++ b/search/enumvalues_d.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_e.html b/search/enumvalues_e.html index 6e27e153..1b3e388b 100644 --- a/search/enumvalues_e.html +++ b/search/enumvalues_e.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/enumvalues_f.html b/search/enumvalues_f.html index 86a4cd91..eb1f3db3 100644 --- a/search/enumvalues_f.html +++ b/search/enumvalues_f.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_0.html b/search/files_0.html index 0b637cf9..49606c82 100644 --- a/search/files_0.html +++ b/search/files_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_1.html b/search/files_1.html index 1094e74a..c8871748 100644 --- a/search/files_1.html +++ b/search/files_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_2.html b/search/files_2.html index a08dbd36..99bdf21c 100644 --- a/search/files_2.html +++ b/search/files_2.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_3.html b/search/files_3.html index 647fc8d0..f8e543a8 100644 --- a/search/files_3.html +++ b/search/files_3.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_4.html b/search/files_4.html index 186557a6..2ebb46c7 100644 --- a/search/files_4.html +++ b/search/files_4.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_5.html b/search/files_5.html index 671abd34..268b7eb5 100644 --- a/search/files_5.html +++ b/search/files_5.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_6.html b/search/files_6.html index 73aff188..98fc6666 100644 --- a/search/files_6.html +++ b/search/files_6.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_7.html b/search/files_7.html index 364f4202..49507ded 100644 --- a/search/files_7.html +++ b/search/files_7.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_8.html b/search/files_8.html index f9f7943f..12c6630b 100644 --- a/search/files_8.html +++ b/search/files_8.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_9.html b/search/files_9.html index 306f0002..cabcae2f 100644 --- a/search/files_9.html +++ b/search/files_9.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_a.html b/search/files_a.html index 2f6ff8fe..f7402215 100644 --- a/search/files_a.html +++ b/search/files_a.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/files_b.html b/search/files_b.html index 3e51d90e..7be10030 100644 --- a/search/files_b.html +++ b/search/files_b.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_0.html b/search/functions_0.html index 6bc52b61..0539c8ce 100644 --- a/search/functions_0.html +++ b/search/functions_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_1.html b/search/functions_1.html index 648831fd..4878b3d1 100644 --- a/search/functions_1.html +++ b/search/functions_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_10.html b/search/functions_10.html index 8bc4de4a..6f6fbae2 100644 --- a/search/functions_10.html +++ b/search/functions_10.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_10.js b/search/functions_10.js index 54eff75b..b79125d4 100644 --- a/search/functions_10.js +++ b/search/functions_10.js @@ -7,9 +7,10 @@ var searchData= ['selectinterface',['SelectInterface',['../class_h_i_d_composite.html#ada07ab100cb0760ef5641e254cab731d',1,'HIDComposite']]], ['send',['send',['../class_s_p_p.html#ab6c20e303965056403ae5aef1d228858',1,'SPP']]], ['sendbreak',['SendBreak',['../class_a_c_m.html#a2a618cbff52737740e76977db557ddff',1,'ACM']]], - ['senddata',['SendData',['../class_u_s_b_h___m_i_d_i.html#a060bae88a7b5bf358119458362929ffa',1,'USBH_MIDI']]], + ['senddata',['SendData',['../class_u_s_b_h___m_i_d_i.html#a65fd836d11336cce737ec1bdb1d5d4f3',1,'USBH_MIDI']]], ['sendoutputreport',['sendOutputReport',['../class_p_s4_b_t.html#ad3bb50902905677726bd62d5f394b062',1,'PS4BT::sendOutputReport()'],['../class_p_s4_parser.html#a8788530b0c213dedfcf56b78e8ca4879',1,'PS4Parser::sendOutputReport()'],['../class_p_s4_u_s_b.html#a75dc09d15f149e1a1b96b8d2ccbbff89',1,'PS4USB::sendOutputReport()']]], - ['sendsysex',['SendSysEx',['../class_u_s_b_h___m_i_d_i.html#a2ae1ef447bebf00d6f63af5eed4fa859',1,'USBH_MIDI']]], + ['sendrawdata',['SendRawData',['../class_u_s_b_h___m_i_d_i.html#a3005d70999cbf2339c55bcdd6fc77bff',1,'USBH_MIDI']]], + ['sendsysex',['SendSysEx',['../class_u_s_b_h___m_i_d_i.html#aa5506d9556605493d25492ab1f2fe2a8',1,'USBH_MIDI']]], ['serialprinthex',['SerialPrintHex',['../printhex_8h.html#a7ac5c085b9fdf94266b7c273695efa87',1,'printhex.h']]], ['setaddr',['setAddr',['../class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47',1,'USB']]], ['setalloff',['setAllOff',['../class_p_s3_b_t.html#a6ee74242b0c1644496ff04b457f39cd2',1,'PS3BT::setAllOff()'],['../class_p_s3_u_s_b.html#ac7adc7365bb45d15c37e22f26f012498',1,'PS3USB::setAllOff()'],['../class_p_s4_parser.html#adf2b7f2888fb7ebc9c58595a85568d65',1,'PS4Parser::setAllOff()'],['../class_w_i_i.html#a6e97bfcfb134b63d7190ba1bc326e1d3',1,'WII::setAllOff()'],['../class_x_b_o_x_r_e_c_v.html#ad045d22c1e2f0657f72786539f418751',1,'XBOXRECV::setAllOff()'],['../class_x_b_o_x_u_s_b.html#a6200dc185ecb6e0d3ffdb2a9ecf49c40',1,'XBOXUSB::setAllOff()']]], @@ -47,9 +48,10 @@ var searchData= ['setprotocolmode',['setProtocolMode',['../class_b_t_h_i_d.html#afceaafc89581441da40b141170b98595',1,'BTHID']]], ['setreport',['SetReport',['../class_u_s_b_h_i_d.html#a66e217a1d1237239514ce6149e46cc56',1,'USBHID']]], ['setreportparser',['SetReportParser',['../class_b_t_h_i_d.html#a0e903f0b5040f3561e5de6c4431027b1',1,'BTHID::SetReportParser()'],['../class_h_i_d_boot.html#a3e44d340fab7e9eedb357ef61e1c19a5',1,'HIDBoot::SetReportParser()'],['../class_h_i_d_composite.html#a94136774d685b89c5a149c4e4df78087',1,'HIDComposite::SetReportParser()'],['../class_h_i_d_universal.html#afbd599879e9c3cdea382e87afd6ab29a',1,'HIDUniversal::SetReportParser()'],['../class_u_s_b_h_i_d.html#a17a732bbb37d8f21181d02d515f40499',1,'USBHID::SetReportParser()']]], - ['setrumbleoff',['setRumbleOff',['../class_p_s3_b_t.html#a5c87e7db5311a5d56f78c994b5545e4e',1,'PS3BT::setRumbleOff()'],['../class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a',1,'PS3USB::setRumbleOff()'],['../class_p_s4_parser.html#acc9b3be8fb673e8e1f637c56d72f1180',1,'PS4Parser::setRumbleOff()'],['../class_w_i_i.html#a2c5c32841b020b248f757cb793acb936',1,'WII::setRumbleOff()'],['../class_x_b_o_x_o_l_d.html#a8014cc70e141362e09beeedb49428746',1,'XBOXOLD::setRumbleOff()'],['../class_x_b_o_x_r_e_c_v.html#a2931e13960cde2c20adbcaf34cee84c5',1,'XBOXRECV::setRumbleOff()'],['../class_x_b_o_x_u_s_b.html#a5d9ac92da5086409ad864484bdf95871',1,'XBOXUSB::setRumbleOff()']]], - ['setrumbleon',['setRumbleOn',['../class_p_s3_b_t.html#a7a3e593911490538c061e9ccb4273f87',1,'PS3BT::setRumbleOn(RumbleEnum mode)'],['../class_p_s3_b_t.html#ae309556e995afc10b13dfbe4e6c32798',1,'PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)'],['../class_p_s3_u_s_b.html#a77f44b6007cc735c47bdeaf672c7e464',1,'PS3USB::setRumbleOn(RumbleEnum mode)'],['../class_p_s3_u_s_b.html#a0c2015b53aa60081aa28299800509f80',1,'PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)'],['../class_p_s4_parser.html#a44628a8521ef9c19d773347156962cab',1,'PS4Parser::setRumbleOn(RumbleEnum mode)'],['../class_p_s4_parser.html#a8299bdbb9d790e6b2e98e942e9bd154e',1,'PS4Parser::setRumbleOn(uint8_t bigRumble, uint8_t smallRumble)'],['../class_w_i_i.html#a0d9c869bd3677c4488a586c38558a137',1,'WII::setRumbleOn()'],['../class_x_b_o_x_o_l_d.html#ab69673ea316c30268a5eedc893bea3a9',1,'XBOXOLD::setRumbleOn()'],['../class_x_b_o_x_r_e_c_v.html#addf7c0dcfbdb025f2283dcd118b5ab76',1,'XBOXRECV::setRumbleOn()'],['../class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9',1,'XBOXUSB::setRumbleOn()']]], + ['setrumbleoff',['setRumbleOff',['../class_p_s3_b_t.html#a5c87e7db5311a5d56f78c994b5545e4e',1,'PS3BT::setRumbleOff()'],['../class_p_s3_u_s_b.html#aaa1e66d7397be6364d4f76749cbaad5a',1,'PS3USB::setRumbleOff()'],['../class_p_s4_parser.html#acc9b3be8fb673e8e1f637c56d72f1180',1,'PS4Parser::setRumbleOff()'],['../class_w_i_i.html#a2c5c32841b020b248f757cb793acb936',1,'WII::setRumbleOff()'],['../class_x_b_o_x_o_l_d.html#a8014cc70e141362e09beeedb49428746',1,'XBOXOLD::setRumbleOff()'],['../class_x_b_o_x_o_n_e.html#a506e8add57ffac652a28e8c5b7e72e85',1,'XBOXONE::setRumbleOff()'],['../class_x_b_o_x_r_e_c_v.html#a2931e13960cde2c20adbcaf34cee84c5',1,'XBOXRECV::setRumbleOff()'],['../class_x_b_o_x_u_s_b.html#a5d9ac92da5086409ad864484bdf95871',1,'XBOXUSB::setRumbleOff()']]], + ['setrumbleon',['setRumbleOn',['../class_p_s3_b_t.html#a7a3e593911490538c061e9ccb4273f87',1,'PS3BT::setRumbleOn(RumbleEnum mode)'],['../class_p_s3_b_t.html#ae309556e995afc10b13dfbe4e6c32798',1,'PS3BT::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)'],['../class_p_s3_u_s_b.html#a77f44b6007cc735c47bdeaf672c7e464',1,'PS3USB::setRumbleOn(RumbleEnum mode)'],['../class_p_s3_u_s_b.html#a0c2015b53aa60081aa28299800509f80',1,'PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)'],['../class_p_s4_parser.html#a44628a8521ef9c19d773347156962cab',1,'PS4Parser::setRumbleOn(RumbleEnum mode)'],['../class_p_s4_parser.html#a8299bdbb9d790e6b2e98e942e9bd154e',1,'PS4Parser::setRumbleOn(uint8_t bigRumble, uint8_t smallRumble)'],['../class_w_i_i.html#a0d9c869bd3677c4488a586c38558a137',1,'WII::setRumbleOn()'],['../class_x_b_o_x_o_l_d.html#ab69673ea316c30268a5eedc893bea3a9',1,'XBOXOLD::setRumbleOn()'],['../class_x_b_o_x_o_n_e.html#a6586343cacf8705c7a3c2d4f479f2261',1,'XBOXONE::setRumbleOn()'],['../class_x_b_o_x_r_e_c_v.html#addf7c0dcfbdb025f2283dcd118b5ab76',1,'XBOXRECV::setRumbleOn()'],['../class_x_b_o_x_u_s_b.html#ae70ae50ed8188a2bf8c25d0ee17f54d9',1,'XBOXUSB::setRumbleOn()']]], ['setrumbletoggle',['setRumbleToggle',['../class_w_i_i.html#a841396b533cccccb05db37d35f6fef9c',1,'WII']]], + ['setupdevicespecific',['setupDeviceSpecific',['../class_u_s_b_h___m_i_d_i.html#aa9f6790ed10bec5fc5a9ebfc43dacfeb',1,'USBH_MIDI']]], ['setusagepage',['SetUsagePage',['../class_report_desc_parser_base.html#a42fbc8fbccaf67eab88bd98b8d3bdd3f',1,'ReportDescParserBase']]], ['setusbtaskstate',['setUsbTaskState',['../class_u_s_b.html#a8ff697d334dc611720419374acd1e5fb',1,'USB']]], ['sinkparser',['SinkParser',['../class_sink_parser.html#a68caa440ba95a184eb104535f3fffd17',1,'SinkParser']]], diff --git a/search/functions_11.html b/search/functions_11.html index e1e427c1..dd88d8b7 100644 --- a/search/functions_11.html +++ b/search/functions_11.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_12.html b/search/functions_12.html index 8dac9d29..7093d19f 100644 --- a/search/functions_12.html +++ b/search/functions_12.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_13.html b/search/functions_13.html index 54220112..051a1eb8 100644 --- a/search/functions_13.html +++ b/search/functions_13.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_14.html b/search/functions_14.html index cb681fe9..d5fdbda4 100644 --- a/search/functions_14.html +++ b/search/functions_14.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_14.js b/search/functions_14.js index 54c8ec9b..88b446c5 100644 --- a/search/functions_14.js +++ b/search/functions_14.js @@ -2,7 +2,7 @@ var searchData= [ ['wide',['wide',['../class_a_c_m.html#ab171c6eefd542e7d4a7ce555d2f2f389',1,'ACM']]], ['wii',['WII',['../class_w_i_i.html#a6597cb0e240a8ccb4ebdb236daef712e',1,'WII']]], - ['write',['Write',['../class_bulk_only.html#a45d327ddf87e01607c3a5b1849936053',1,'BulkOnly::Write()'],['../class_max___l_c_d.html#a43e5618993b77b81773af3a88cdf4c96',1,'Max_LCD::write()'],['../class_s_p_p.html#a6fb231316ca9b1028322d2d2188b27b0',1,'SPP::write(uint8_t data)'],['../class_s_p_p.html#a8bb421b7d948c3ffefc23aef95813192',1,'SPP::write(const uint8_t *data, size_t size)']]], + ['write',['write',['../class_max___l_c_d.html#a43e5618993b77b81773af3a88cdf4c96',1,'Max_LCD::write()'],['../class_s_p_p.html#a6fb231316ca9b1028322d2d2188b27b0',1,'SPP::write(uint8_t data)'],['../class_s_p_p.html#a8bb421b7d948c3ffefc23aef95813192',1,'SPP::write(const uint8_t *data, size_t size)'],['../class_bulk_only.html#a45d327ddf87e01607c3a5b1849936053',1,'BulkOnly::Write()']]], ['write_5fregister',['write_register',['../class_x_r21_b1411.html#acdc8c732d517b2748d3d6643ae5642ee',1,'XR21B1411']]], ['writeprotected',['WriteProtected',['../class_bulk_only.html#a85d034c7da25090c36c9bdeb85338009',1,'BulkOnly']]] ]; diff --git a/search/functions_15.html b/search/functions_15.html index f3ae6926..546d13e6 100644 --- a/search/functions_15.html +++ b/search/functions_15.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_2.html b/search/functions_2.html index c93d0894..67d2a392 100644 --- a/search/functions_2.html +++ b/search/functions_2.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_2.js b/search/functions_2.js index bdff977e..34c3641f 100644 --- a/search/functions_2.js +++ b/search/functions_2.js @@ -14,7 +14,7 @@ var searchData= ['configuredevice',['ConfigureDevice',['../class_a_d_k.html#a14f24ca8246c5b6126a5aa72cf6ee120',1,'ADK::ConfigureDevice()'],['../class_b_t_d.html#a4f1808a49e9aca397ba829fac16dc5c3',1,'BTD::ConfigureDevice()'],['../class_bulk_only.html#aa8fe167a7af12dce9964fa5a430c53ea',1,'BulkOnly::ConfigureDevice()'],['../class_u_s_b_device_config.html#aef77a1e62f78c04a1aad53e8795ec89e',1,'USBDeviceConfig::ConfigureDevice()'],['../class_x_b_o_x_r_e_c_v.html#a3dd42b9a1351f172fc6e39df2fe99398',1,'XBOXRECV::ConfigureDevice()']]], ['configuring',['Configuring',['../class_u_s_b.html#af4008dfc1c2d15c23cf8a7815cc17765',1,'USB']]], ['connected',['connected',['../class_p_s4_b_t.html#a08a857b8533e59f6eb872e4c8f727405',1,'PS4BT::connected()'],['../class_p_s4_u_s_b.html#a3dd2b4e19516fb76d9442937102ea97f',1,'PS4USB::connected()'],['../class_p_s_buzz.html#a7c791bf7745baae8359d3dcb1d5b86d3',1,'PSBuzz::connected()']]], - ['countsysexdatasize',['countSysExDataSize',['../class_u_s_b_h___m_i_d_i.html#afbb9e1d8440fb282c129ae26bff8d575',1,'USBH_MIDI']]], + ['countsysexdatasize',['countSysExDataSize',['../class_u_s_b_h___m_i_d_i.html#ab3b9ea78a331449802e4ce5a5a9c7f18',1,'USBH_MIDI']]], ['createchar',['createChar',['../class_max___l_c_d.html#a9941a61f5fca781a38f250489245d5e7',1,'Max_LCD']]], ['ctrldata',['ctrlData',['../class_u_s_b.html#a102dab8571035757dd63ed3751993836',1,'USB']]], ['ctrlreq',['ctrlReq',['../class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c',1,'USB']]], diff --git a/search/functions_3.html b/search/functions_3.html index caa48ea2..1f0eedb3 100644 --- a/search/functions_3.html +++ b/search/functions_3.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_4.html b/search/functions_4.html index a9c64adf..c5bf87a4 100644 --- a/search/functions_4.html +++ b/search/functions_4.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_4.js b/search/functions_4.js index d5ca5a7d..0d3f453d 100644 --- a/search/functions_4.js +++ b/search/functions_4.js @@ -3,8 +3,9 @@ var searchData= ['e_5fnotify',['E_Notify',['../message_8cpp.html#a9453192fd38607a494776eb3fb483630',1,'E_Notify(char const *msg, int lvl): message.cpp'],['../message_8cpp.html#a56f28162c49c25d9825f83ce2566535d',1,'E_Notify(uint8_t b, int lvl): message.cpp'],['../message_8cpp.html#a12f95210f9e5d917c23709a3d21c9115',1,'E_Notify(double d, int lvl): message.cpp'],['../message_8h.html#a9453192fd38607a494776eb3fb483630',1,'E_Notify(char const *msg, int lvl): message.cpp'],['../message_8h.html#a56f28162c49c25d9825f83ce2566535d',1,'E_Notify(uint8_t b, int lvl): message.cpp']]], ['e_5fnotifyc',['E_Notifyc',['../message_8cpp.html#ab0e5c13883e60a998bb19346a9474066',1,'E_Notifyc(char c, int lvl): message.cpp'],['../message_8h.html#ab0e5c13883e60a998bb19346a9474066',1,'E_Notifyc(char c, int lvl): message.cpp'],['../printhex_8h.html#ab0e5c13883e60a998bb19346a9474066',1,'E_Notifyc(char c, int lvl): message.cpp']]], ['e_5fnotifystr',['E_NotifyStr',['../message_8cpp.html#a519befe6a36026b8ea81aec9d6a3e532',1,'E_NotifyStr(char const *msg, int lvl): message.cpp'],['../message_8h.html#a519befe6a36026b8ea81aec9d6a3e532',1,'E_NotifyStr(char const *msg, int lvl): message.cpp']]], - ['endpointxtract',['EndpointXtract',['../class_a_d_k.html#aac2fac5410faea0e439b4f7e688b3d75',1,'ADK::EndpointXtract()'],['../class_b_t_d.html#a23928cd0e5711a2433aec763cfa55773',1,'BTD::EndpointXtract()'],['../class_a_c_m.html#af5b411a7ccc82bd77a7c5cfba6cd9a86',1,'ACM::EndpointXtract()'],['../class_f_t_d_i.html#a3e3f771b9f2a99fcedf7ed665b597109',1,'FTDI::EndpointXtract()'],['../class_usb_config_xtracter.html#a7717ea27bb756568e0deb544d8331370',1,'UsbConfigXtracter::EndpointXtract()'],['../class_h_i_d_boot.html#a04475d2cd6d8ae19d4e4149714fa4bef',1,'HIDBoot::EndpointXtract()'],['../class_h_i_d_composite.html#abdae8ebd9c5cc676c91829e41e3984a2',1,'HIDComposite::EndpointXtract()'],['../class_h_i_d_universal.html#ab9b13f27eca16e0accc14fff9bd318e2',1,'HIDUniversal::EndpointXtract()'],['../class_bulk_only.html#a13d33906543d5d6b44620f430dc729ff',1,'BulkOnly::EndpointXtract()']]], + ['endpointxtract',['EndpointXtract',['../class_a_d_k.html#aac2fac5410faea0e439b4f7e688b3d75',1,'ADK::EndpointXtract()'],['../class_b_t_d.html#a23928cd0e5711a2433aec763cfa55773',1,'BTD::EndpointXtract()'],['../class_a_c_m.html#af5b411a7ccc82bd77a7c5cfba6cd9a86',1,'ACM::EndpointXtract()'],['../class_f_t_d_i.html#a3e3f771b9f2a99fcedf7ed665b597109',1,'FTDI::EndpointXtract()'],['../class_usb_config_xtracter.html#a7717ea27bb756568e0deb544d8331370',1,'UsbConfigXtracter::EndpointXtract()'],['../class_h_i_d_boot.html#a04475d2cd6d8ae19d4e4149714fa4bef',1,'HIDBoot::EndpointXtract()'],['../class_h_i_d_composite.html#abdae8ebd9c5cc676c91829e41e3984a2',1,'HIDComposite::EndpointXtract()'],['../class_h_i_d_universal.html#ab9b13f27eca16e0accc14fff9bd318e2',1,'HIDUniversal::EndpointXtract()'],['../class_bulk_only.html#a13d33906543d5d6b44620f430dc729ff',1,'BulkOnly::EndpointXtract()'],['../class_x_b_o_x_o_n_e.html#a499cc378b8ae7d8fd63baa1b4dab97b5',1,'XBOXONE::EndpointXtract()']]], ['enhanced_5ffeatures',['enhanced_features',['../class_x_r21_b1411.html#a2f75b9dab539f642a9d6484faf5df767',1,'XR21B1411::enhanced_features()'],['../class_a_c_m.html#a2b7125159dc81b1a896ff23cefc71938',1,'ACM::enhanced_features()']]], ['enhanced_5fstatus',['enhanced_status',['../class_a_c_m.html#a4032d44491e27670c64b23f72f2a810a',1,'ACM']]], - ['errormessage',['ErrorMessage',['../message_8h.html#a59dd0ba2acd4a416786f45d1e0b0916a',1,'ErrorMessage(uint8_t level, char const *msg, ERROR_TYPE rcode=0): message.h'],['../message_8h.html#a52358bfe833f47f63e7de398847aa2e7',1,'ErrorMessage(char const *msg, ERROR_TYPE rcode=0): message.h']]] + ['errormessage',['ErrorMessage',['../message_8h.html#a59dd0ba2acd4a416786f45d1e0b0916a',1,'ErrorMessage(uint8_t level, char const *msg, ERROR_TYPE rcode=0): message.h'],['../message_8h.html#a52358bfe833f47f63e7de398847aa2e7',1,'ErrorMessage(char const *msg, ERROR_TYPE rcode=0): message.h']]], + ['extractsysexdata',['extractSysExData',['../class_u_s_b_h___m_i_d_i.html#ab85f9e0da16ffe3ee9809aa27023c94c',1,'USBH_MIDI']]] ]; diff --git a/search/functions_5.html b/search/functions_5.html index 9d135fa0..a34446ce 100644 --- a/search/functions_5.html +++ b/search/functions_5.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_6.html b/search/functions_6.html index 5fca897b..6fd4b1f3 100644 --- a/search/functions_6.html +++ b/search/functions_6.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_7.html b/search/functions_7.html index 02631a34..6e09abf1 100644 --- a/search/functions_7.html +++ b/search/functions_7.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_8.html b/search/functions_8.html index ff370959..d59ea971 100644 --- a/search/functions_8.html +++ b/search/functions_8.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_8.js b/search/functions_8.js index fe6d74ce..075eaf61 100644 --- a/search/functions_8.js +++ b/search/functions_8.js @@ -1,11 +1,13 @@ var searchData= [ + ['idproduct',['idProduct',['../class_u_s_b_h___m_i_d_i.html#ac7b56c71f8424ec0175f390264776bdd',1,'USBH_MIDI']]], + ['idvendor',['idVendor',['../class_u_s_b_h___m_i_d_i.html#aa7d217e3479a9116f8f2ce90c1177317',1,'USBH_MIDI']]], ['init',['Init',['../class_a_d_k.html#a8c5c2e212c748966ccd863499d202063',1,'ADK::Init()'],['../class_b_t_d.html#a48608619d8253972dd132edbb3001c5f',1,'BTD::Init()'],['../class_x_r21_b1411.html#adbaf541661c1938fa33a9cedd9e9a4ba',1,'XR21B1411::Init()'],['../class_a_c_m.html#ad3210651d58c77d3ded4b4b83a9476b7',1,'ACM::Init()'],['../class_f_t_d_i.html#a2d40115414dadfee8c284e0f5d397621',1,'FTDI::Init()'],['../class_p_l2303.html#a23c849fb504c1fe6f46c84d04c0a47cf',1,'PL2303::Init()'],['../class_h_i_d_boot.html#aa30d7cf292378153f41d8a13380c6119',1,'HIDBoot::Init()'],['../class_h_i_d_composite.html#ac5d02f2915f83817f2121acdefc7f573',1,'HIDComposite::Init()'],['../class_h_i_d_universal.html#a384b0e219f763e2d6407636bfd4ccea7',1,'HIDUniversal::Init()'],['../class_bulk_only.html#a51870da9badc037166b86da60bcda6ea',1,'BulkOnly::Init()'],['../class_p_s3_u_s_b.html#a0083545cb99fb8786e60281fe7a9050d',1,'PS3USB::Init()'],['../class_u_s_b_device_config.html#a3706cf6b18785aff823171e280bab738',1,'USBDeviceConfig::Init()'],['../class_u_s_b_h___m_i_d_i.html#a9c8d149a823d2b8d1c3579f0f445cf19',1,'USBH_MIDI::Init()'],['../class_m_a_x3421e.html#a2866487c20c832731fd4fb478acb0195',1,'MAX3421e::Init()'],['../class_m_a_x3421e.html#a332ce159a413244be9b95b8e08888bb8',1,'MAX3421e::Init(int mseconds)'],['../class_u_s_b_hub.html#ab2b2e257556e3d59f9258dd84d6f636e',1,'USBHub::Init()'],['../class_x_b_o_x_o_l_d.html#a7260253c704b147e6dfd762e13222434',1,'XBOXOLD::Init()'],['../class_x_b_o_x_o_n_e.html#aeb2d90a3d77fc252a12f5ed54c3f370e',1,'XBOXONE::Init()'],['../class_x_b_o_x_r_e_c_v.html#a07de216bf16a83501d74463c00bf1fc8',1,'XBOXRECV::Init()'],['../class_x_b_o_x_u_s_b.html#a9d2ad06354787bc252058bb28015b56e',1,'XBOXUSB::Init()'],['../class_max___l_c_d.html#a3205e9a432c808422867c1398d665247',1,'Max_LCD::init()'],['../class_s_pi.html#a52c803966a9437caf57d00c267121373',1,'SPi::init()']]], ['initialize',['Initialize',['../class_hex_dumper.html#accd2712258f54a8072eae3d2ad8cceba',1,'HexDumper::Initialize()'],['../class_multi_byte_value_parser.html#a9bd52b4e180d68dbb8f97c059250f4c3',1,'MultiByteValueParser::Initialize()'],['../class_byte_skipper.html#a274a09686d5535e11961d2ccf38ffa08',1,'ByteSkipper::Initialize()'],['../class_p_t_p_list_parser.html#a18f6c785d1ddb51d7e158810644079b7',1,'PTPListParser::Initialize()'],['../class_sink_parser.html#a3c2ac73b459e326e955c26d658733f9f',1,'SinkParser::Initialize()']]], ['inthandler',['IntHandler',['../class_m_a_x3421e.html#af88faea04dd27cf354cf0643cc7acef2',1,'MAX3421e']]], ['intransfer',['inTransfer',['../class_u_s_b.html#aead4d2040c641d55176854b236804088',1,'USB']]], ['irinitialize',['IRinitialize',['../class_w_i_i.html#a3505abbc01c71d134ce301dfb7c0c5b5',1,'WII']]], ['isircameraenabled',['isIRCameraEnabled',['../class_w_i_i.html#a0a444d7e348026e062751cf723877e8f',1,'WII']]], - ['isready',['isReady',['../class_a_d_k.html#a1dee02856625dfcac4b0cdd4e8672cef',1,'ADK::isReady()'],['../class_b_t_d.html#a1b2440748bdaaeb552a05b0f0902f5d8',1,'BTD::isReady()'],['../class_a_c_m.html#a7161082e88359738596dd12a706ee286',1,'ACM::isReady()'],['../class_h_i_d_boot.html#a9972f402f3141b2d71c0e59602675f68',1,'HIDBoot::isReady()'],['../class_h_i_d_composite.html#a3d12bc7e852944029b1314a95b84d6ce',1,'HIDComposite::isReady()'],['../class_h_i_d_universal.html#aa4be95e8f5164393ea4766f68c5b0ea8',1,'HIDUniversal::isReady()'],['../class_p_s3_u_s_b.html#a02a5b0244665d5a790d1020e51c94479',1,'PS3USB::isReady()'],['../class_x_b_o_x_o_l_d.html#af4d77a5108f2e6812ba00be1b0374829',1,'XBOXOLD::isReady()'],['../class_x_b_o_x_o_n_e.html#a23112f12ed914d1b0128675b1f59aace',1,'XBOXONE::isReady()'],['../class_x_b_o_x_r_e_c_v.html#a570568108edafee8d060aad8fe40db57',1,'XBOXRECV::isReady()'],['../class_x_b_o_x_u_s_b.html#ac2507bfe85896b7fcc772894a7a9f272',1,'XBOXUSB::isReady()']]], + ['isready',['isReady',['../class_a_d_k.html#a1dee02856625dfcac4b0cdd4e8672cef',1,'ADK::isReady()'],['../class_b_t_d.html#a1b2440748bdaaeb552a05b0f0902f5d8',1,'BTD::isReady()'],['../class_a_c_m.html#a7161082e88359738596dd12a706ee286',1,'ACM::isReady()'],['../class_f_t_d_i.html#a0e392f0f49843fa9ab0701950628b47b',1,'FTDI::isReady()'],['../class_h_i_d_boot.html#a9972f402f3141b2d71c0e59602675f68',1,'HIDBoot::isReady()'],['../class_h_i_d_composite.html#a3d12bc7e852944029b1314a95b84d6ce',1,'HIDComposite::isReady()'],['../class_h_i_d_universal.html#aa4be95e8f5164393ea4766f68c5b0ea8',1,'HIDUniversal::isReady()'],['../class_p_s3_u_s_b.html#a02a5b0244665d5a790d1020e51c94479',1,'PS3USB::isReady()'],['../class_x_b_o_x_o_l_d.html#af4d77a5108f2e6812ba00be1b0374829',1,'XBOXOLD::isReady()'],['../class_x_b_o_x_o_n_e.html#a23112f12ed914d1b0128675b1f59aace',1,'XBOXONE::isReady()'],['../class_x_b_o_x_r_e_c_v.html#a570568108edafee8d060aad8fe40db57',1,'XBOXRECV::isReady()'],['../class_x_b_o_x_u_s_b.html#ac2507bfe85896b7fcc772894a7a9f272',1,'XBOXUSB::isReady()']]], ['istouching',['isTouching',['../class_p_s4_parser.html#a6770a72c17062c2e00fb3602435fcade',1,'PS4Parser']]] ]; diff --git a/search/functions_9.html b/search/functions_9.html index 1d345831..5ccec429 100644 --- a/search/functions_9.html +++ b/search/functions_9.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_a.html b/search/functions_a.html index 8eb5e562..3958eb7b 100644 --- a/search/functions_a.html +++ b/search/functions_a.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_a.js b/search/functions_a.js index b022de1d..e25e6734 100644 --- a/search/functions_a.js +++ b/search/functions_a.js @@ -10,5 +10,6 @@ var searchData= ['l2cap_5finformation_5fresponse',['l2cap_information_response',['../class_b_t_d.html#a91f61915c503fe7b861c88f5b3e6733c',1,'BTD']]], ['lefttoright',['leftToRight',['../class_max___l_c_d.html#a2814b0a44a6ef3773df74981ab24d382',1,'Max_LCD']]], ['lockmedia',['LockMedia',['../class_bulk_only.html#ae7561d686d0b1374b5f9937d6ec8a035',1,'BulkOnly']]], + ['lookupmsgsize',['lookupMsgSize',['../class_u_s_b_h___m_i_d_i.html#a8218ae22033b7d2120df75cfe696070e',1,'USBH_MIDI']]], ['lunisgood',['LUNIsGood',['../class_bulk_only.html#aa6d74267dc98daeb0552fa234739ab08',1,'BulkOnly']]] ]; diff --git a/search/functions_b.html b/search/functions_b.html index fa9cff56..b99b702d 100644 --- a/search/functions_b.html +++ b/search/functions_b.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_c.html b/search/functions_c.html index fce7a6b1..3a33d874 100644 --- a/search/functions_c.html +++ b/search/functions_c.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_d.html b/search/functions_d.html index 82b2b0cf..31b75b88 100644 --- a/search/functions_d.html +++ b/search/functions_d.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_d.js b/search/functions_d.js index 13cd115d..aaba009f 100644 --- a/search/functions_d.js +++ b/search/functions_d.js @@ -15,6 +15,6 @@ var searchData= ['onrelease',['OnRelease',['../class_f_t_d_i_async_oper.html#a3993597b080c11c8d1d18dd8017a8f82',1,'FTDIAsyncOper']]], ['onrightbuttondown',['OnRightButtonDown',['../class_mouse_report_parser.html#a6884349e6b2de0cbfedf3e1a77c23870',1,'MouseReportParser']]], ['onrightbuttonup',['OnRightButtonUp',['../class_mouse_report_parser.html#a1bdfee565073cd8b77cbeb9e184c174f',1,'MouseReportParser']]], - ['operator_20bool',['operator bool',['../class_s_p_p.html#ac90f0765c478bd624cee3b8d493d8432',1,'SPP']]], + ['operator_20bool',['operator bool',['../class_s_p_p.html#ac90f0765c478bd624cee3b8d493d8432',1,'SPP::operator bool()'],['../class_u_s_b_h___m_i_d_i.html#aeac79d834709ecc079551df2e16a7ffe',1,'USBH_MIDI::operator bool()']]], ['outtransfer',['outTransfer',['../class_u_s_b.html#affbc018973a588995457d535b0ac7ee7',1,'USB']]] ]; diff --git a/search/functions_e.html b/search/functions_e.html index 557ae9a4..cddb9bb5 100644 --- a/search/functions_e.html +++ b/search/functions_e.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_e.js b/search/functions_e.js index 8467ab4f..97ba8cd1 100644 --- a/search/functions_e.js +++ b/search/functions_e.js @@ -5,7 +5,7 @@ var searchData= ['pairwithwiimote',['pairWithWiimote',['../class_b_t_d.html#a6b66a27c0fd359e3129f53451352b55c',1,'BTD']]], ['parse',['Parse',['../class_config_desc_parser.html#a3722ad1dbbfcd4ecf5cbf9caf08cd517',1,'ConfigDescParser::Parse()'],['../class_hex_dumper.html#acaff9c9e5b97bbfe3596c7b7a2e2a78d',1,'HexDumper::Parse()'],['../class_mouse_report_parser.html#aed02196a692f8b633fbbebc76eefd4a1',1,'MouseReportParser::Parse()'],['../class_keyboard_report_parser.html#a122bfa9d4baa9f85010aea8245c2295c',1,'KeyboardReportParser::Parse()'],['../class_report_desc_parser_base.html#a7ecd266cbbbc18460ab8823651225e6b',1,'ReportDescParserBase::Parse()'],['../class_universal_report_parser.html#a77f459e6751a2ca360574e91a89f92b9',1,'UniversalReportParser::Parse()'],['../class_multi_byte_value_parser.html#a9d380bf3ab3fee2c8797883504bcd827',1,'MultiByteValueParser::Parse()'],['../class_p_t_p_list_parser.html#a15ebdbc2ca861bc6e6d051273cf3b66e',1,'PTPListParser::Parse()'],['../class_p_s4_parser.html#a6498fdeb767364e84ce09ef208980622',1,'PS4Parser::Parse()'],['../class_sink_parser.html#ac6cf61bb48d61cb7db178c62c5f86fd0',1,'SinkParser::Parse()'],['../class_u_s_b_read_parser.html#afdb9cea2a2fe18d26f4ec595b86a7f7c',1,'USBReadParser::Parse()'],['../class_h_i_d_report_parser.html#af6c4b832fad296860bae406730e792da',1,'HIDReportParser::Parse()']]], ['parsebthiddata',['ParseBTHIDData',['../class_b_t_h_i_d.html#a4de4a1efd32000a0cf5a884456e52c7d',1,'BTHID::ParseBTHIDData()'],['../class_p_s4_b_t.html#a0d92689d0c24e62ddc7a1b3c4c658512',1,'PS4BT::ParseBTHIDData()']]], - ['parseconfigdescr',['parseConfigDescr',['../class_u_s_b_h___m_i_d_i.html#a92359b023ab411c86af8efb7283c0e9f',1,'USBH_MIDI']]], + ['parseconfigdescr',['parseConfigDescr',['../class_u_s_b_h___m_i_d_i.html#aabe63c64fbcee52e7c724d489cd19394',1,'USBH_MIDI']]], ['parsehiddata',['ParseHIDData',['../class_h_i_d_composite.html#ac01dac60c82bd850509696252cd9b651',1,'HIDComposite::ParseHIDData()'],['../class_h_i_d_universal.html#a5d6e27f817d6d2c67692783a02872939',1,'HIDUniversal::ParseHIDData()'],['../class_p_s4_u_s_b.html#a8222cea2ec47bff310d6e5fbada9e695',1,'PS4USB::ParseHIDData()'],['../class_p_s_buzz.html#a73e7a2f4b5537a692d699dc7c57ca6d6',1,'PSBuzz::ParseHIDData()']]], ['parseitem',['ParseItem',['../class_report_desc_parser_base.html#ac1d6c015d9a2527bb2044e9a96fcaaf9',1,'ReportDescParserBase::ParseItem()'],['../class_report_desc_parser2.html#a84242b62a5d202b5d2d6fe26809bc0e2',1,'ReportDescParser2::ParseItem()']]], ['peek',['peek',['../class_s_p_p.html#a3149d75ba4646ba5b5428c465e983144',1,'SPP']]], @@ -17,7 +17,7 @@ var searchData= ['printbytevalue',['PrintByteValue',['../class_report_desc_parser_base.html#a1af970b456e54342e15a88ffd98ca6cc',1,'ReportDescParserBase']]], ['printconsumerpageusage',['PrintConsumerPageUsage',['../class_report_desc_parser_base.html#a9af1dc144bab9e9864394594be67d2eb',1,'ReportDescParserBase']]], ['printdigitizerpageusage',['PrintDigitizerPageUsage',['../class_report_desc_parser_base.html#aa62d11cfe404ee51ffd26f13c33800a1',1,'ReportDescParserBase']]], - ['printendpointdescriptor',['PrintEndpointDescriptor',['../class_a_d_k.html#ac4bd3303b99921289c3f59e2df219e50',1,'ADK::PrintEndpointDescriptor()'],['../class_b_t_d.html#aa5976eead215a58553aee683d42405a0',1,'BTD::PrintEndpointDescriptor()'],['../class_a_c_m.html#aa05a65487f5e02bab40ccba1018ee5b6',1,'ACM::PrintEndpointDescriptor()'],['../class_bulk_only.html#ac8a1d7b2ef82d9f6da44928c78039964',1,'BulkOnly::PrintEndpointDescriptor()'],['../class_u_s_b_h_i_d.html#a046f84af88dab2e9063db0bf36308cd4',1,'USBHID::PrintEndpointDescriptor()']]], + ['printendpointdescriptor',['PrintEndpointDescriptor',['../class_a_d_k.html#ac4bd3303b99921289c3f59e2df219e50',1,'ADK::PrintEndpointDescriptor()'],['../class_b_t_d.html#aa5976eead215a58553aee683d42405a0',1,'BTD::PrintEndpointDescriptor()'],['../class_a_c_m.html#aa05a65487f5e02bab40ccba1018ee5b6',1,'ACM::PrintEndpointDescriptor()'],['../class_bulk_only.html#ac8a1d7b2ef82d9f6da44928c78039964',1,'BulkOnly::PrintEndpointDescriptor()'],['../class_u_s_b_h_i_d.html#a046f84af88dab2e9063db0bf36308cd4',1,'USBHID::PrintEndpointDescriptor()'],['../class_x_b_o_x_o_n_e.html#a2eea30f2ce47380fc414d4fc4231335b',1,'XBOXONE::PrintEndpointDescriptor()']]], ['printgamecontrolspageusage',['PrintGameControlsPageUsage',['../class_report_desc_parser_base.html#a4e026cfeda7bfe9e07cf247cbcc4a122',1,'ReportDescParserBase']]], ['printgenericdesktoppageusage',['PrintGenericDesktopPageUsage',['../class_report_desc_parser_base.html#a3eff46688f9edbee3a58c43bbf104763',1,'ReportDescParserBase']]], ['printgenericdevicecontrolspageusage',['PrintGenericDeviceControlsPageUsage',['../class_report_desc_parser_base.html#a1b5cb93a83e2212319fe30f1a1636478',1,'ReportDescParserBase']]], diff --git a/search/functions_f.html b/search/functions_f.html index b27fb7d1..49672926 100644 --- a/search/functions_f.html +++ b/search/functions_f.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/functions_f.js b/search/functions_f.js index 2a81af12..4b55dfb0 100644 --- a/search/functions_f.js +++ b/search/functions_f.js @@ -1,10 +1,11 @@ var searchData= [ ['rcvdata',['RcvData',['../class_a_d_k.html#a66b9943dfa89f783a8cdeb655e6fe9b1',1,'ADK::RcvData()'],['../class_a_c_m.html#a7f455b7a649522c29f2e63d668b0ccca',1,'ACM::RcvData()'],['../class_f_t_d_i.html#aa367ae72fbfda931cae8ec751e9dc434',1,'FTDI::RcvData()'],['../class_u_s_b_h___m_i_d_i.html#a1f522c0aca86795e1bfb7575e1759338',1,'USBH_MIDI::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)'],['../class_u_s_b_h___m_i_d_i.html#afa51b7a718728cdc4f25f9abec25be52',1,'USBH_MIDI::RcvData(uint8_t *outBuf)']]], - ['read',['Read',['../class_bulk_only.html#a470a8f0ffd6694d9dfc834da5efa627a',1,'BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf)'],['../class_bulk_only.html#a52f54376dcd7f5baf17718105e8f085d',1,'BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, USBReadParser *prs)'],['../class_s_p_p.html#aae8dc037e845480f582afea57b858b95',1,'SPP::read()']]], + ['read',['read',['../class_s_p_p.html#aae8dc037e845480f582afea57b858b95',1,'SPP::read()'],['../class_bulk_only.html#a470a8f0ffd6694d9dfc834da5efa627a',1,'BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf)'],['../class_bulk_only.html#a52f54376dcd7f5baf17718105e8f085d',1,'BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, USBReadParser *prs)']]], ['read_5fregister',['read_register',['../class_x_r21_b1411.html#adfcc22eba1ec95fe62af960682b8ecbc',1,'XR21B1411']]], - ['readpollinterval',['readPollInterval',['../class_b_t_d.html#a2a9ecb996243e070e70972370e45e4fd',1,'BTD']]], - ['recvdata',['RecvData',['../class_u_s_b_h___m_i_d_i.html#adb10f3867c2171603faa37af3e9fd210',1,'USBH_MIDI::RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)'],['../class_u_s_b_h___m_i_d_i.html#a4cd869ca837db908f283d2f41f3eb608',1,'USBH_MIDI::RecvData(uint8_t *outBuf)']]], + ['readpollinterval',['readPollInterval',['../class_b_t_d.html#a2a9ecb996243e070e70972370e45e4fd',1,'BTD::readPollInterval()'],['../class_x_b_o_x_o_n_e.html#ae606811be2389140b19421aad2cb040f',1,'XBOXONE::readPollInterval()']]], + ['recvdata',['RecvData',['../class_u_s_b_h___m_i_d_i.html#adb10f3867c2171603faa37af3e9fd210',1,'USBH_MIDI::RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)'],['../class_u_s_b_h___m_i_d_i.html#aea89f48a206501ecf09b7d962e1fa688',1,'USBH_MIDI::RecvData(uint8_t *outBuf, bool isRaw=false)']]], + ['recvrawdata',['RecvRawData',['../class_u_s_b_h___m_i_d_i.html#af9f74895deb356da3d1915d9eac24aca',1,'USBH_MIDI']]], ['registerbluetoothservice',['registerBluetoothService',['../class_b_t_d.html#ad00d299e64c1a939e4a781ef39f75684',1,'BTD']]], ['registerdeviceclass',['RegisterDeviceClass',['../class_u_s_b.html#a3f66bf622590413ef2e1864f93a3e0d2',1,'USB']]], ['regrd',['regRd',['../class_m_a_x3421e.html#a508fe70d1983cdaa71cce85ea9c75ec1',1,'MAX3421e']]], @@ -13,7 +14,7 @@ var searchData= ['releasedevice',['ReleaseDevice',['../class_u_s_b.html#ac681c6c98e1641f705bc14d670a2663a',1,'USB']]], ['reportdescparser2',['ReportDescParser2',['../class_report_desc_parser2.html#a6ee7a47ffbc5c2905506c10039fcfaff',1,'ReportDescParser2']]], ['reportdescparserbase',['ReportDescParserBase',['../class_report_desc_parser_base.html#a607a81ff9d8f282298533a1dbf10f8e1',1,'ReportDescParserBase']]], - ['reset',['reset',['../class_m_a_x3421e.html#a15b78912dd4b1c96b6ad141117dcb7ee',1,'MAX3421e::reset()'],['../class_bluetooth_service.html#aa7c81841d4e898e9dc91533da6d7ab64',1,'BluetoothService::Reset()'],['../class_b_t_h_i_d.html#af4c58b81414a037910dd6fb78f97b96e',1,'BTHID::Reset()'],['../class_p_s3_b_t.html#a576d72cdf12af58ae59c8f2a02f99c0f',1,'PS3BT::Reset()'],['../class_p_s4_parser.html#a24640b2362b0f6f51785fbd3dd4f13f9',1,'PS4Parser::Reset()'],['../class_p_s_buzz.html#a5bb4f2ee80ca9d10d87031b57bd09268',1,'PSBuzz::Reset()'],['../class_s_p_p.html#ae2c661bd46cd2d74bd29c4c771cd2ef0',1,'SPP::Reset()'],['../class_w_i_i.html#a769ee2f9a0088da097438bc3cc677f7c',1,'WII::Reset()']]], + ['reset',['Reset',['../class_bluetooth_service.html#aa7c81841d4e898e9dc91533da6d7ab64',1,'BluetoothService::Reset()'],['../class_b_t_h_i_d.html#af4c58b81414a037910dd6fb78f97b96e',1,'BTHID::Reset()'],['../class_p_s3_b_t.html#a576d72cdf12af58ae59c8f2a02f99c0f',1,'PS3BT::Reset()'],['../class_p_s4_parser.html#a24640b2362b0f6f51785fbd3dd4f13f9',1,'PS4Parser::Reset()'],['../class_p_s_buzz.html#a5bb4f2ee80ca9d10d87031b57bd09268',1,'PSBuzz::Reset()'],['../class_s_p_p.html#ae2c661bd46cd2d74bd29c4c771cd2ef0',1,'SPP::Reset()'],['../class_w_i_i.html#a769ee2f9a0088da097438bc3cc677f7c',1,'WII::Reset()'],['../class_m_a_x3421e.html#a15b78912dd4b1c96b6ad141117dcb7ee',1,'MAX3421e::reset()']]], ['resetbthid',['ResetBTHID',['../class_b_t_h_i_d.html#acc22bf5baaa096fe09b72c812c1134f0',1,'BTHID::ResetBTHID()'],['../class_p_s4_b_t.html#a4b1c9e15ccdc7ab24f7fb42fc9b5d827',1,'PS4BT::ResetBTHID()']]], ['resethubport',['ResetHubPort',['../class_u_s_b_device_config.html#a12bb63558ded5bb6661bb173b07ff391',1,'USBDeviceConfig::ResetHubPort()'],['../class_u_s_b_hub.html#ae7e4c1e231ce7cb56bae1688c0e95e58',1,'USBHub::ResetHubPort()']]], ['resethubpremask',['ResetHubPreMask',['../class_u_s_b.html#a5b4de045ea7fefe0fab967ddf44c39b1',1,'USB']]], diff --git a/search/pages_0.html b/search/pages_0.html index 0db7267b..d7528582 100644 --- a/search/pages_0.html +++ b/search/pages_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/pages_1.html b/search/pages_1.html index 2c67a8ef..924fb482 100644 --- a/search/pages_1.html +++ b/search/pages_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/pages_1.js b/search/pages_1.js index ccf30468..88fb4726 100644 --- a/search/pages_1.js +++ b/search/pages_1.js @@ -1,4 +1,4 @@ var searchData= [ - ['wiicamerareadme',['WiiCameraReadme',['../md__Users_Lauszus_Github_USB_Host_Shield_2_0_WiiCameraReadme.html',1,'']]] + ['wiicamerareadme',['WiiCameraReadme',['../md___users_lauszus__github__u_s_b__host__shield_2_0__wii_camera_readme.html',1,'']]] ]; diff --git a/search/search.css b/search/search.css index 4d7612ff..3cf9df94 100644 --- a/search/search.css +++ b/search/search.css @@ -6,14 +6,12 @@ #MSearchBox { white-space : nowrap; - position: absolute; float: none; - display: inline; margin-top: 8px; right: 0px; width: 170px; + height: 24px; z-index: 102; - background-color: white; } #MSearchBox .left @@ -48,12 +46,13 @@ height:19px; background:url('search_m.png') repeat-x; border:none; - width:111px; + width:115px; margin-left:20px; padding-left:4px; color: #909090; outline: none; font: 9pt Arial, Verdana, sans-serif; + -webkit-border-radius: 0px; } #FSearchBox #MSearchField { @@ -64,7 +63,7 @@ display:block; position:absolute; right:10px; - top:0px; + top:8px; width:20px; height:19px; background:url('search_r.png') no-repeat; @@ -102,7 +101,7 @@ left: 0; top: 0; border: 1px solid #90A5CE; background-color: #F9FAFC; - z-index: 1; + z-index: 10001; padding-top: 4px; padding-bottom: 4px; -moz-border-radius: 4px; @@ -165,6 +164,7 @@ iframe#MSearchResults { left: 0; top: 0; border: 1px solid #000; background-color: #EEF1F7; + z-index:10000; } /* ----------------------------------- */ diff --git a/search/search.js b/search/search.js index dedce3bf..a554ab9c 100644 --- a/search/search.js +++ b/search/search.js @@ -1,3 +1,26 @@ +/* + @licstart The following is the entire license notice for the + JavaScript code in this file. + + Copyright (C) 1997-2017 by Dimitri van Heesch + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + @licend The above is the entire license notice + for the JavaScript code in this file + */ function convertToId(search) { var result = ''; @@ -788,4 +811,4 @@ function init_search() } searchBox.OnSelectItem(0); } - +/* @license-end */ diff --git a/search/typedefs_0.html b/search/typedefs_0.html index fb07195c..2a284a94 100644 --- a/search/typedefs_0.html +++ b/search/typedefs_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/typedefs_1.html b/search/typedefs_1.html index 6edac96b..7af807db 100644 --- a/search/typedefs_1.html +++ b/search/typedefs_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/typedefs_2.html b/search/typedefs_2.html index cc5cc404..745d076c 100644 --- a/search/typedefs_2.html +++ b/search/typedefs_2.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/typedefs_3.html b/search/typedefs_3.html index 3fdb8f26..def60a5b 100644 --- a/search/typedefs_3.html +++ b/search/typedefs_3.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/typedefs_4.html b/search/typedefs_4.html index fb508194..ef733ad2 100644 --- a/search/typedefs_4.html +++ b/search/typedefs_4.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/typedefs_5.html b/search/typedefs_5.html index 0ad02a6c..94db6d21 100644 --- a/search/typedefs_5.html +++ b/search/typedefs_5.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/typedefs_6.html b/search/typedefs_6.html index 10007d2c..bda8ea1c 100644 --- a/search/typedefs_6.html +++ b/search/typedefs_6.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_0.html b/search/variables_0.html index 3835278f..51f7bd6b 100644 --- a/search/variables_0.html +++ b/search/variables_0.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_1.html b/search/variables_1.html index 3c65cf26..f46154d8 100644 --- a/search/variables_1.html +++ b/search/variables_1.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_10.html b/search/variables_10.html index 52b5fe87..b62b717e 100644 --- a/search/variables_10.html +++ b/search/variables_10.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_10.js b/search/variables_10.js index c9f0ea5b..404dda09 100644 --- a/search/variables_10.js +++ b/search/variables_10.js @@ -1,4 +1,4 @@ var searchData= [ - ['qnextpolltime',['qNextPollTime',['../class_b_t_d.html#a52d6c7895f6bb01729d01ce28a2f3079',1,'BTD::qNextPollTime()'],['../class_a_c_m.html#a6701d70ae4734e8a81971d9fb8b085f2',1,'ACM::qNextPollTime()'],['../class_bulk_only.html#a2d422ee0745cd7c04afff905278c4233',1,'BulkOnly::qNextPollTime()']]] + ['qnextpolltime',['qNextPollTime',['../class_b_t_d.html#a52d6c7895f6bb01729d01ce28a2f3079',1,'BTD::qNextPollTime()'],['../class_a_c_m.html#a6701d70ae4734e8a81971d9fb8b085f2',1,'ACM::qNextPollTime()'],['../class_bulk_only.html#a2d422ee0745cd7c04afff905278c4233',1,'BulkOnly::qNextPollTime()'],['../class_x_b_o_x_o_n_e.html#a4d0702c6fc0327535d909975670e9284',1,'XBOXONE::qNextPollTime()']]] ]; diff --git a/search/variables_11.html b/search/variables_11.html index 476f36e0..2ce8561a 100644 --- a/search/variables_11.html +++ b/search/variables_11.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_11.js b/search/variables_11.js index b5b6d0c8..82fcf137 100644 --- a/search/variables_11.js +++ b/search/variables_11.js @@ -1,8 +1,8 @@ var searchData= [ ['r',['r',['../struct_p_s4_output.html#a76a85e749899e2e6cb135a6ec6acabb3',1,'PS4Output']]], - ['r1',['R1',['../struct_inquiry_response.html#a72abbdbd399647227ea05cb1cec32b2d',1,'InquiryResponse::R1()'],['../union_p_s4_buttons.html#aba0cb76ee82bd0ebe9872aa7bcbffac6',1,'PS4Buttons::r1()']]], - ['r2',['R2',['../struct_inquiry_response.html#aa635575deb7f984d27142ee2071af5b3',1,'InquiryResponse::R2()'],['../union_p_s4_buttons.html#a416642ff357b1313825fe94e0491b60e',1,'PS4Buttons::r2()']]], + ['r1',['r1',['../union_p_s4_buttons.html#aba0cb76ee82bd0ebe9872aa7bcbffac6',1,'PS4Buttons::r1()'],['../struct_inquiry_response.html#a72abbdbd399647227ea05cb1cec32b2d',1,'InquiryResponse::R1()']]], + ['r2',['r2',['../union_p_s4_buttons.html#a416642ff357b1313825fe94e0491b60e',1,'PS4Buttons::r2()'],['../struct_inquiry_response.html#aa635575deb7f984d27142ee2071af5b3',1,'InquiryResponse::R2()']]], ['r3',['r3',['../union_p_s4_buttons.html#a09805f3bcc362c410d7897792599d61d',1,'PS4Buttons']]], ['readptr',['readPtr',['../class_u_s_b_h___m_i_d_i.html#aad25eeebfe8741afa7a242ec398c846e',1,'USBH_MIDI']]], ['ready',['ready',['../class_a_d_k.html#a135db75b9e8cdd59b89f46c44dd83dd4',1,'ADK::ready()'],['../class_a_c_m.html#ae9a10861da80510a54942a511ce9009e',1,'ACM::ready()']]], diff --git a/search/variables_12.html b/search/variables_12.html index ff143dcb..bba5857f 100644 --- a/search/variables_12.html +++ b/search/variables_12.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_13.html b/search/variables_13.html index f62f946f..c92cbcc3 100644 --- a/search/variables_13.html +++ b/search/variables_13.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_14.html b/search/variables_14.html index edd9b916..2c462043 100644 --- a/search/variables_14.html +++ b/search/variables_14.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_15.html b/search/variables_15.html index 6ee4d58a..c86a5fd6 100644 --- a/search/variables_15.html +++ b/search/variables_15.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_15.js b/search/variables_15.js index 2dfee6cd..04701734 100644 --- a/search/variables_15.js +++ b/search/variables_15.js @@ -6,7 +6,7 @@ var searchData= ['varbuffer',['varBuffer',['../class_report_desc_parser_base.html#a82cde32720eba596e5864fe7d541ea13',1,'ReportDescParserBase']]], ['vendorid',['VendorID',['../struct_inquiry_response.html#acc610ff84bef225f8826585725ad9802',1,'InquiryResponse']]], ['version',['Version',['../struct_inquiry_response.html#a86832a5def98c1e21447497177a8cc3a',1,'InquiryResponse']]], - ['vid',['vid',['../class_u_s_b_h___m_i_d_i.html#aa578074365d77bb3e41063a18625dfe3',1,'USBH_MIDI::vid()'],['../class_h_i_d_composite.html#acf516cb6242d1659c9bc77fe475c973e',1,'HIDComposite::VID()'],['../class_h_i_d_universal.html#a7f2123d1f20327600bb9e49a1ef5b0c7',1,'HIDUniversal::VID()']]], + ['vid',['VID',['../class_h_i_d_composite.html#acf516cb6242d1659c9bc77fe475c973e',1,'HIDComposite::VID()'],['../class_h_i_d_universal.html#a7f2123d1f20327600bb9e49a1ef5b0c7',1,'HIDUniversal::VID()'],['../class_u_s_b_h___m_i_d_i.html#aa578074365d77bb3e41063a18625dfe3',1,'USBH_MIDI::vid()']]], ['vrtitles0',['vrTitles0',['../class_report_desc_parser_base.html#a42d34a0a49f987c9dcfdd4fb8d42bf0d',1,'ReportDescParserBase']]], ['vrtitles1',['vrTitles1',['../class_report_desc_parser_base.html#a41af57cb0fb0bbed7277bcd04a9e9fe9',1,'ReportDescParserBase']]], ['vs',['VS',['../struct_inquiry_response.html#a9a6c47a45be5bd1ce230c9fac3cc9bbd',1,'InquiryResponse']]] diff --git a/search/variables_16.html b/search/variables_16.html index 0f264c90..f6bc6a05 100644 --- a/search/variables_16.html +++ b/search/variables_16.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_16.js b/search/variables_16.js index 28ac20b0..68e9cbd7 100644 --- a/search/variables_16.js +++ b/search/variables_16.js @@ -1,6 +1,6 @@ var searchData= [ - ['watingforconnection',['watingForConnection',['../class_b_t_d.html#aa7735da01865bab01b569ee836173737',1,'BTD']]], + ['waitingforconnection',['waitingForConnection',['../class_b_t_d.html#a93a522edb2974185c7567b8f83860424',1,'BTD']]], ['wdescriptorlength',['wDescriptorLength',['../struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r.html#a0b160c43f6a6132c0debabd6ef171950',1,'USB_HID_DESCRIPTOR::wDescriptorLength()'],['../struct_h_i_d___c_l_a_s_s___d_e_s_c_r_i_p_t_o_r___l_e_n___a_n_d___t_y_p_e.html#a98251c1867caf1651f6e926952189201',1,'HID_CLASS_DESCRIPTOR_LEN_AND_TYPE::wDescriptorLength()']]], ['wide',['wide',['../structtty__features.html#af97f813b49e81e0f89435a07525b3321',1,'tty_features']]], ['widebus16bit',['WideBus16Bit',['../struct_inquiry_response.html#a39a63fd0fd92c50370af9aefe93c13cf',1,'InquiryResponse']]], diff --git a/search/variables_17.html b/search/variables_17.html index 0d82cea8..6a71407b 100644 --- a/search/variables_17.html +++ b/search/variables_17.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_18.html b/search/variables_18.html index 971df6f4..9f6ccdde 100644 --- a/search/variables_18.html +++ b/search/variables_18.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_2.html b/search/variables_2.html index 7b43e0ac..15275b7a 100644 --- a/search/variables_2.html +++ b/search/variables_2.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_2.js b/search/variables_2.js index dd299f04..203636c5 100644 --- a/search/variables_2.js +++ b/search/variables_2.js @@ -12,7 +12,7 @@ var searchData= ['bcdusb',['bcdUSB',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#a621148cd71148fb15e136010480a34ac',1,'USB_DEVICE_DESCRIPTOR']]], ['bcharformat',['bCharFormat',['../struct_l_i_n_e___c_o_d_i_n_g.html#ae2c35eef8f7e35b5f2a3464225477d3c',1,'LINE_CODING']]], ['bconfigurationvalue',['bConfigurationValue',['../struct_u_s_b___c_o_n_f_i_g_u_r_a_t_i_o_n___d_e_s_c_r_i_p_t_o_r.html#a568d08f2ae98670a707489645a67746b',1,'USB_CONFIGURATION_DESCRIPTOR']]], - ['bconfnum',['bConfNum',['../class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738',1,'ADK::bConfNum()'],['../class_b_t_d.html#a10c34527ae90e95791ac48ac7d1154a2',1,'BTD::bConfNum()'],['../class_a_c_m.html#af1a17c2d77625599da12b26cb0c90d39',1,'ACM::bConfNum()'],['../class_bulk_only.html#ab54f472ec9cd39abdb9f90867943d162',1,'BulkOnly::bConfNum()'],['../class_u_s_b_h___m_i_d_i.html#a441bf3b7bcd3ad8ca4e18f68fd03404c',1,'USBH_MIDI::bConfNum()']]], + ['bconfnum',['bConfNum',['../class_a_d_k.html#ae8fcc6a6fccab61116cea10dd1f17738',1,'ADK::bConfNum()'],['../class_b_t_d.html#a10c34527ae90e95791ac48ac7d1154a2',1,'BTD::bConfNum()'],['../class_a_c_m.html#af1a17c2d77625599da12b26cb0c90d39',1,'ACM::bConfNum()'],['../class_bulk_only.html#ab54f472ec9cd39abdb9f90867943d162',1,'BulkOnly::bConfNum()'],['../class_u_s_b_h___m_i_d_i.html#a441bf3b7bcd3ad8ca4e18f68fd03404c',1,'USBH_MIDI::bConfNum()'],['../class_x_b_o_x_o_n_e.html#ac6c75dcd5dfd5a9685a049f9bb8cb93f',1,'XBOXONE::bConfNum()']]], ['bcontroliface',['bControlIface',['../class_a_c_m.html#a5512d9e8c8c59371f16018fe8ce46b19',1,'ACM']]], ['bcountrycode',['bCountryCode',['../struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r.html#a340e5f812dbf7fe8caa13a1541a51f42',1,'USB_HID_DESCRIPTOR']]], ['bcswstatus',['bCSWStatus',['../struct_command_status_wrapper.html#a7170ed5bc0e2bbe04758e687beef4487',1,'CommandStatusWrapper']]], @@ -99,7 +99,7 @@ var searchData= ['bnumconfigurations',['bNumConfigurations',['../struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r.html#ab1b8db3992e0dceb2ba86f3bab1e5bca',1,'USB_DEVICE_DESCRIPTOR']]], ['bnumdescriptors',['bNumDescriptors',['../struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r.html#a05f827473d2eb4e67d1f99bc317b1eba',1,'USB_HID_DESCRIPTOR']]], ['bnumendpoints',['bNumEndpoints',['../struct_u_s_b___i_n_t_e_r_f_a_c_e___d_e_s_c_r_i_p_t_o_r.html#a3268bc05bb0147e19f97e50e702fc141',1,'USB_INTERFACE_DESCRIPTOR']]], - ['bnumep',['bNumEP',['../class_a_d_k.html#adf969d306da15baecd5c59bbb568053e',1,'ADK::bNumEP()'],['../class_b_t_d.html#a893dd35932821cddda7e482a1904af66',1,'BTD::bNumEP()'],['../class_a_c_m.html#a058b4d4a088a002fcde4fb2b75e33f93',1,'ACM::bNumEP()'],['../class_bulk_only.html#a6cb56ebd0307845321340919e2b35952',1,'BulkOnly::bNumEP()'],['../class_u_s_b_h___m_i_d_i.html#ab8b2dd096df7159ce8a09a19812307ca',1,'USBH_MIDI::bNumEP()']]], + ['bnumep',['bNumEP',['../class_a_d_k.html#adf969d306da15baecd5c59bbb568053e',1,'ADK::bNumEP()'],['../class_b_t_d.html#a893dd35932821cddda7e482a1904af66',1,'BTD::bNumEP()'],['../class_a_c_m.html#a058b4d4a088a002fcde4fb2b75e33f93',1,'ACM::bNumEP()'],['../class_bulk_only.html#a6cb56ebd0307845321340919e2b35952',1,'BulkOnly::bNumEP()'],['../class_u_s_b_h___m_i_d_i.html#ab8b2dd096df7159ce8a09a19812307ca',1,'USBH_MIDI::bNumEP()'],['../class_x_b_o_x_o_n_e.html#a958f262ed66dd5bf0ad7dfd54a369659',1,'XBOXONE::bNumEP()']]], ['bnuminterfaces',['bNumInterfaces',['../struct_u_s_b___c_o_n_f_i_g_u_r_a_t_i_o_n___d_e_s_c_r_i_p_t_o_r.html#abd647927a872ac856c9f5aaf624bb99f',1,'USB_CONFIGURATION_DESCRIPTOR']]], ['bnumringerpatterns',['bNumRingerPatterns',['../struct_t_e_l___r_i_n_g_e_r___f_u_n_c___d_e_s_c_r.html#aca65dc577a0dbc13972da9ab26e25918',1,'TEL_RINGER_FUNC_DESCR']]], ['bparitytype',['bParityType',['../struct_l_i_n_e___c_o_d_i_n_g.html#ad14985344c9e31a210999dfa0b4ccc42',1,'LINE_CODING']]], @@ -121,5 +121,6 @@ var searchData= ['btdpin',['btdPin',['../class_b_t_d.html#a215cb939c01ed3ff56db37841224546c',1,'BTD']]], ['bthelun',['bTheLUN',['../class_bulk_only.html#a24c051d401f5f1a9ce65c1bc25ab02dd',1,'BulkOnly']]], ['btn',['btn',['../struct_p_s4_data.html#a60c0217c1879e1b16ae5d19a8c8695a3',1,'PS4Data::btn()'],['../union_p_s_b_u_z_z_buttons.html#a92ce392e7a31f155fbdf0fa0c8a5c83e',1,'PSBUZZButtons::btn()']]], + ['btransfertypemask',['bTransferTypeMask',['../class_u_s_b_h___m_i_d_i.html#a16cc26804628e2ea32513b4cce1aa7c3',1,'USBH_MIDI']]], ['btype',['bType',['../struct_hid_item_prefix.html#a16874c73fdb809e4c46407ca83684927',1,'HidItemPrefix']]] ]; diff --git a/search/variables_3.html b/search/variables_3.html index ea0392df..fbc36712 100644 --- a/search/variables_3.html +++ b/search/variables_3.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_4.html b/search/variables_4.html index 1ed95cb6..8067e67f 100644 --- a/search/variables_4.html +++ b/search/variables_4.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_5.html b/search/variables_5.html index ecc883b5..7e95e946 100644 --- a/search/variables_5.html +++ b/search/variables_5.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_5.js b/search/variables_5.js index f04f1218..6b17486c 100644 --- a/search/variables_5.js +++ b/search/variables_5.js @@ -9,7 +9,7 @@ var searchData= ['epdatainindexvsp',['epDataInIndexVSP',['../class_u_s_b_h___m_i_d_i.html#ac8b7d0994df1a059ccf6be62dd84cc9e',1,'USBH_MIDI']]], ['epdataoutindex',['epDataOutIndex',['../class_a_d_k.html#acfc5a7e45f15bba7ff8cd42552796624',1,'ADK::epDataOutIndex()'],['../class_a_c_m.html#a0dc940bc4f1bed7525bb768e37e6cb61',1,'ACM::epDataOutIndex()'],['../class_bulk_only.html#a8d527bdc285870f3571481a4fd982721',1,'BulkOnly::epDataOutIndex()'],['../class_u_s_b_h___m_i_d_i.html#a2a2e35a5ce5ffc8605837de2587db740',1,'USBH_MIDI::epDataOutIndex()']]], ['epdataoutindexvsp',['epDataOutIndexVSP',['../class_u_s_b_h___m_i_d_i.html#a42685ed17f731d3c8e3062d1e1b52f78',1,'USBH_MIDI']]], - ['epinfo',['epinfo',['../struct_usb_device.html#a410d39fb7758157f57794335e990ed02',1,'UsbDevice::epinfo()'],['../class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d',1,'ADK::epInfo()'],['../class_b_t_d.html#a91d92fee94e5a4cbca472bb3fd883e3e',1,'BTD::epInfo()'],['../class_a_c_m.html#a60fb6a365b78fb80a4a9842e364cf1a3',1,'ACM::epInfo()'],['../class_h_i_d_composite.html#a4101c34c5079bd827953368450140a9a',1,'HIDComposite::epInfo()'],['../class_h_i_d_universal.html#ad26d2e63130abac2059154bf5afbf152',1,'HIDUniversal::epInfo()'],['../class_bulk_only.html#aee2247fd0a251e4da36e8c09bbe6917f',1,'BulkOnly::epInfo()'],['../class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1',1,'PS3USB::epInfo()'],['../class_u_s_b_h___m_i_d_i.html#ac947c1e0feea5cc9387c35bbd9bde961',1,'USBH_MIDI::epInfo()'],['../class_x_b_o_x_o_l_d.html#a06a318db8037f25a8d9bb62785dbacb9',1,'XBOXOLD::epInfo()'],['../class_x_b_o_x_o_n_e.html#a1d2fe54c2e3d0471aa4fa2a12bae6931',1,'XBOXONE::epInfo()'],['../class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb',1,'XBOXRECV::epInfo()'],['../class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f',1,'XBOXUSB::epInfo()']]], + ['epinfo',['epinfo',['../struct_usb_device.html#a410d39fb7758157f57794335e990ed02',1,'UsbDevice::epinfo()'],['../class_a_d_k.html#a6ffc693d731ddeb9499c11e893fc467d',1,'ADK::epInfo()'],['../class_b_t_d.html#a91d92fee94e5a4cbca472bb3fd883e3e',1,'BTD::epInfo()'],['../class_a_c_m.html#a60fb6a365b78fb80a4a9842e364cf1a3',1,'ACM::epInfo()'],['../class_h_i_d_composite.html#a4101c34c5079bd827953368450140a9a',1,'HIDComposite::epInfo()'],['../class_h_i_d_universal.html#ad26d2e63130abac2059154bf5afbf152',1,'HIDUniversal::epInfo()'],['../class_bulk_only.html#aee2247fd0a251e4da36e8c09bbe6917f',1,'BulkOnly::epInfo()'],['../class_p_s3_u_s_b.html#a394dbb0a59b587210e5958f08dac48f1',1,'PS3USB::epInfo()'],['../class_u_s_b_h___m_i_d_i.html#ac947c1e0feea5cc9387c35bbd9bde961',1,'USBH_MIDI::epInfo()'],['../class_x_b_o_x_o_l_d.html#a06a318db8037f25a8d9bb62785dbacb9',1,'XBOXOLD::epInfo()'],['../class_x_b_o_x_o_n_e.html#a2915fc1f1f3a9c5333bfd643defa0621',1,'XBOXONE::epInfo()'],['../class_x_b_o_x_r_e_c_v.html#af97c8d0efc945fa4ba1d120c8a5a9cbb',1,'XBOXRECV::epInfo()'],['../class_x_b_o_x_u_s_b.html#abef4a852d877d8136f198431ce54550f',1,'XBOXUSB::epInfo()']]], ['epinterruptinindex',['epInterruptInIndex',['../class_a_c_m.html#a9b32207fdf256e5f8553ba4048b64307',1,'ACM::epInterruptInIndex()'],['../class_bulk_only.html#a03cd96b415990821bdce43b4004c85e4',1,'BulkOnly::epInterruptInIndex()'],['../class_u_s_b_h_i_d.html#a722462978813b2154698516b729e834d',1,'USBHID::epInterruptInIndex()']]], ['epinterruptoutindex',['epInterruptOutIndex',['../class_u_s_b_h_i_d.html#af9ae556d2a7a03309db403e45eab96e8',1,'USBHID']]], ['evtbuff',['evtBuff',['../struct_hub_event.html#a5a8016b368bc8ac993abae3f97b8306f',1,'HubEvent']]] diff --git a/search/variables_6.html b/search/variables_6.html index 0c1a66ba..3d398e62 100644 --- a/search/variables_6.html +++ b/search/variables_6.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_7.html b/search/variables_7.html index e0da2ef5..7b791460 100644 --- a/search/variables_7.html +++ b/search/variables_7.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_8.html b/search/variables_8.html index 0c3d1df3..8ebc5f6b 100644 --- a/search/variables_8.html +++ b/search/variables_8.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_9.html b/search/variables_9.html index e14a1071..12136613 100644 --- a/search/variables_9.html +++ b/search/variables_9.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_a.html b/search/variables_a.html index 4e38be7c..24819a37 100644 --- a/search/variables_a.html +++ b/search/variables_a.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_b.html b/search/variables_b.html index c98ef41d..b306931e 100644 --- a/search/variables_b.html +++ b/search/variables_b.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_c.html b/search/variables_c.html index d5f44496..75709df8 100644 --- a/search/variables_c.html +++ b/search/variables_c.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_d.html b/search/variables_d.html index a57e383b..34c80a48 100644 --- a/search/variables_d.html +++ b/search/variables_d.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_e.html b/search/variables_e.html index d1502e0e..4a1c8a61 100644 --- a/search/variables_e.html +++ b/search/variables_e.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_f.html b/search/variables_f.html index f777e719..cc86fb59 100644 --- a/search/variables_f.html +++ b/search/variables_f.html @@ -1,7 +1,7 @@ - + @@ -11,15 +11,19 @@
    Loading...
    Searching...
    No Matches
    diff --git a/search/variables_f.js b/search/variables_f.js index b82bb76f..c5e65e30 100644 --- a/search/variables_f.js +++ b/search/variables_f.js @@ -7,7 +7,7 @@ var searchData= ['peripheralqualifier',['PeripheralQualifier',['../struct_inquiry_response.html#a8e8f2cb6b5a0d1ed2c300155bf2b3faa',1,'InquiryResponse']]], ['pfunconinit',['pFuncOnInit',['../class_bluetooth_service.html#a321393d44ce59213fa1c7498c247d5ff',1,'BluetoothService']]], ['pfusage',['pfUsage',['../class_report_desc_parser_base.html#a22006cbf92a3d4008695e53d7f6e2452',1,'ReportDescParserBase']]], - ['pid',['PID',['../class_h_i_d_composite.html#a1402689fc7e633723fca2b6b175c2a18',1,'HIDComposite::PID()'],['../class_h_i_d_universal.html#abc609e49d66fa6260e7cdcd2c4ff0a5a',1,'HIDUniversal::PID()'],['../class_u_s_b_h___m_i_d_i.html#aaf7ec77f0d8cefff1316ae049747e2a7',1,'USBH_MIDI::pid()']]], + ['pid',['pid',['../class_u_s_b_h___m_i_d_i.html#aaf7ec77f0d8cefff1316ae049747e2a7',1,'USBH_MIDI::pid()'],['../class_h_i_d_composite.html#a1402689fc7e633723fca2b6b175c2a18',1,'HIDComposite::PID()'],['../class_h_i_d_universal.html#abc609e49d66fa6260e7cdcd2c4ff0a5a',1,'HIDUniversal::PID()']]], ['pitchgyroscale',['pitchGyroScale',['../class_w_i_i.html#aea6ce6f3222df3e547e9957673c7a07a',1,'WII']]], ['pitchgyrospeed',['pitchGyroSpeed',['../class_w_i_i.html#aa47478ccdfe009dabb7c21232e07bfd5',1,'WII']]], ['portindicatorssupported',['PortIndicatorsSupported',['../struct_hub_descriptor.html#a6478c259c7397e89d50b42f6f3d4f4e4',1,'HubDescriptor']]], diff --git a/settings_8h.html b/settings_8h.html index c7237cc1..9dfa3ac5 100644 --- a/settings_8h.html +++ b/settings_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: settings.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
    + + @@ -132,9 +114,29 @@ Macros + +

    Macros

    #define USB_SPI   SPI
     
    #define ENABLE_UHS_DEBUGGING   0
     
    #define USB_HOST_SERIAL   Serial
     
    #define USING_SPI4TEENSY3   0
     
    #define MFK_CASTUINT8T
     

    Macro Definition Documentation

    - + +

    ◆ USB_SPI

    + +
    +
    + + + + +
    #define USB_SPI   SPI
    +
    + +

    Definition at line 33 of file settings.h.

    + +
    +
    + +

    ◆ ENABLE_UHS_DEBUGGING

    +
    @@ -144,11 +146,13 @@ Macros
    -

    Definition at line 27 of file settings.h.

    +

    Definition at line 42 of file settings.h.

    - + +

    ◆ USB_HOST_SERIAL

    +
    @@ -158,11 +162,13 @@ Macros
    -

    Definition at line 34 of file settings.h.

    +

    Definition at line 49 of file settings.h.

    - + +

    ◆ USE_UHS_MEGA_ADK

    +
    @@ -172,11 +178,13 @@ Macros
    -

    Definition at line 42 of file settings.h.

    +

    Definition at line 57 of file settings.h.

    - + +

    ◆ USE_UHS_BLACK_WIDDOW

    +
    @@ -186,11 +194,13 @@ Macros
    -

    Definition at line 45 of file settings.h.

    +

    Definition at line 60 of file settings.h.

    - + +

    ◆ USE_XMEM_SPI_LOCK

    +
    @@ -200,11 +210,13 @@ Macros
    -

    Definition at line 48 of file settings.h.

    +

    Definition at line 63 of file settings.h.

    - + +

    ◆ ENABLE_WII_IR_CAMERA

    +
    @@ -214,11 +226,13 @@ Macros
    -

    Definition at line 55 of file settings.h.

    +

    Definition at line 70 of file settings.h.

    - + +

    ◆ MASS_MAX_SUPPORTED_LUN

    +
    @@ -228,11 +242,13 @@ Macros
    -

    Definition at line 64 of file settings.h.

    +

    Definition at line 79 of file settings.h.

    - + +

    ◆ USE_SPI4TEENSY3

    +
    @@ -242,11 +258,13 @@ Macros
    -

    Definition at line 71 of file settings.h.

    +

    Definition at line 86 of file settings.h.

    - + +

    ◆ XMEM_ACQUIRE_SPI

    +
    @@ -259,11 +277,13 @@ Macros
    -

    Definition at line 121 of file settings.h.

    +

    Definition at line 136 of file settings.h.

    - + +

    ◆ XMEM_RELEASE_SPI

    +
    @@ -276,11 +296,13 @@ Macros
    -

    Definition at line 122 of file settings.h.

    +

    Definition at line 137 of file settings.h.

    - + +

    ◆ EXT_RAM

    +
    @@ -290,11 +312,13 @@ Macros
    -

    Definition at line 129 of file settings.h.

    +

    Definition at line 144 of file settings.h.

    - + +

    ◆ USING_SPI4TEENSY3

    +
    @@ -304,7 +328,23 @@ Macros
    -

    Definition at line 135 of file settings.h.

    +

    Definition at line 150 of file settings.h.

    + +
    +
    + +

    ◆ MFK_CASTUINT8T

    + +
    +
    + + + + +
    #define MFK_CASTUINT8T
    +
    + +

    Definition at line 196 of file settings.h.

    @@ -313,7 +353,7 @@ Macros diff --git a/settings_8h__incl.md5 b/settings_8h__incl.md5 index 18ee50f6..8973b498 100644 --- a/settings_8h__incl.md5 +++ b/settings_8h__incl.md5 @@ -1 +1 @@ -6b501fa892d974b429099bd7e24cac0c \ No newline at end of file +815da4cea450a9894cad50cdd34ddeef \ No newline at end of file diff --git a/settings_8h__incl.png b/settings_8h__incl.png index 8774d57e..f2ef10d1 100644 Binary files a/settings_8h__incl.png and b/settings_8h__incl.png differ diff --git a/settings_8h_source.html b/settings_8h_source.html index 3e1679f0..282d5e00 100644 --- a/settings_8h_source.html +++ b/settings_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: settings.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    settings.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 #ifndef USB_HOST_SHIELD_SETTINGS_H
    19 #define USB_HOST_SHIELD_SETTINGS_H
    20 #include "macros.h"
    21 
    23 // DEBUGGING
    25 
    26 /* Set this to 1 to activate serial debugging */
    27 #define ENABLE_UHS_DEBUGGING 0
    28 
    29 /* This can be used to select which serial port to use for debugging if
    30  * multiple serial ports are available.
    31  * For example Serial3.
    32  */
    33 #ifndef USB_HOST_SERIAL
    34 #define USB_HOST_SERIAL Serial
    35 #endif
    36 
    38 // Manual board activation
    40 
    41 /* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */
    42 #define USE_UHS_MEGA_ADK 0 // If you are using Arduino 1.5.5 or newer there is no need to do this manually
    43 
    44 /* Set this to 1 if you are using a Black Widdow */
    45 #define USE_UHS_BLACK_WIDDOW 0
    46 
    47 /* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */
    48 #define USE_XMEM_SPI_LOCK 0
    49 
    51 // Wii IR camera
    53 
    54 /* Set this to 1 to activate code for the Wii IR camera */
    55 #define ENABLE_WII_IR_CAMERA 0
    56 
    58 // MASS STORAGE
    60 // <<<<<<<<<<<<<<<< IMPORTANT >>>>>>>>>>>>>>>
    61 // Set this to 1 to support single LUN devices, and save RAM. -- I.E. thumb drives.
    62 // Each LUN needs ~13 bytes to be able to track the state of each unit.
    63 #ifndef MASS_MAX_SUPPORTED_LUN
    64 #define MASS_MAX_SUPPORTED_LUN 8
    65 #endif
    66 
    68 // Set to 1 to use the faster spi4teensy3 driver.
    70 #ifndef USE_SPI4TEENSY3
    71 #define USE_SPI4TEENSY3 1
    72 #endif
    73 
    74 // disabled on the Teensy LC as it is incompatible for now
    75 #if defined(__MKL26Z64__)
    76 #undef USE_SPI4TEENSY3
    77 #define USE_SPI4TEENSY3 0
    78 #endif
    79 
    81 // AUTOMATIC Settings
    83 
    84 // No user serviceable parts below this line.
    85 // DO NOT change anything below here unless you are a developer!
    86 
    87 #include "version_helper.h"
    88 
    89 #if defined(__GNUC__) && defined(__AVR__)
    90 #ifndef GCC_VERSION
    91 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
    92 #endif
    93 #if GCC_VERSION < 40602 // Test for GCC < 4.6.2
    94 #ifdef PROGMEM
    95 #undef PROGMEM
    96 #define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4
    97 #ifdef PSTR
    98 #undef PSTR
    99 #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source
    100 #endif
    101 #endif
    102 #endif
    103 #endif
    104 
    105 #if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING
    106 #define DEBUG_USB_HOST
    107 #endif
    108 
    109 #if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA
    110 #define WIICAMERA
    111 #endif
    112 
    113 // To use some other locking (e.g. freertos),
    114 // define XMEM_ACQUIRE_SPI and XMEM_RELEASE_SPI to point to your lock and unlock.
    115 // NOTE: NO argument is passed. You have to do this within your routine for
    116 // whatever you are using to lock and unlock.
    117 #if !defined(XMEM_ACQUIRE_SPI)
    118 #if USE_XMEM_SPI_LOCK || defined(USE_MULTIPLE_APP_API)
    119 #include <xmem.h>
    120 #else
    121 #define XMEM_ACQUIRE_SPI() (void(0))
    122 #define XMEM_RELEASE_SPI() (void(0))
    123 #endif
    124 #endif
    125 
    126 #if !defined(EXT_RAM) && defined(EXT_RAM_STACK) || defined(EXT_RAM_HEAP)
    127 #include <xmem.h>
    128 #else
    129 #define EXT_RAM 0
    130 #endif
    131 
    132 #if defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__))
    133 #define USING_SPI4TEENSY3 USE_SPI4TEENSY3
    134 #else
    135 #define USING_SPI4TEENSY3 0
    136 #endif
    137 
    138 #if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3
    139 #include <SPI.h> // Use the Arduino SPI library for the Arduino Due, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available
    140 #endif
    141 #ifdef RBL_NRF51822
    142 #include <nrf_gpio.h>
    143 #include <SPI_Master.h>
    144 #define SPI SPI_Master
    145 #endif
    146 #if defined(__PIC32MX__) || defined(__PIC32MZ__)
    147 #include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library
    148 #endif
    149 
    150 #ifdef STM32F4
    151 #include "stm32f4xx_hal.h"
    152 extern SPI_HandleTypeDef SPI_Handle; // Needed to be declared in your main.cpp
    153 #endif
    154 
    155 // Fix defines on Arduino Due
    156 #ifdef ARDUINO_SAM_DUE
    157 #ifdef tokSETUP
    158 #undef tokSETUP
    159 #endif
    160 #ifdef tokIN
    161 #undef tokIN
    162 #endif
    163 #ifdef tokOUT
    164 #undef tokOUT
    165 #endif
    166 #ifdef tokINHS
    167 #undef tokINHS
    168 #endif
    169 #ifdef tokOUTHS
    170 #undef tokOUTHS
    171 #endif
    172 #endif
    173 
    174 #endif /* SETTINGS_H */
    +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 
    25 #ifndef USB_HOST_SHIELD_SETTINGS_H
    26 #define USB_HOST_SHIELD_SETTINGS_H
    27 #include "macros.h"
    28 
    30 // SPI Configuration
    32 #ifndef USB_SPI
    33 #define USB_SPI SPI
    34 //#define USB_SPI SPI1
    35 #endif
    36 
    38 // DEBUGGING
    40 
    41 /* Set this to 1 to activate serial debugging */
    42 #define ENABLE_UHS_DEBUGGING 0
    43 
    44 /* This can be used to select which serial port to use for debugging if
    45  * multiple serial ports are available.
    46  * For example Serial3.
    47  */
    48 #ifndef USB_HOST_SERIAL
    49 #define USB_HOST_SERIAL Serial
    50 #endif
    51 
    53 // Manual board activation
    55 
    56 /* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */
    57 #define USE_UHS_MEGA_ADK 0 // If you are using Arduino 1.5.5 or newer there is no need to do this manually
    58 
    59 /* Set this to 1 if you are using a Black Widdow */
    60 #define USE_UHS_BLACK_WIDDOW 0
    61 
    62 /* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */
    63 #define USE_XMEM_SPI_LOCK 0
    64 
    66 // Wii IR camera
    68 
    69 /* Set this to 1 to activate code for the Wii IR camera */
    70 #define ENABLE_WII_IR_CAMERA 0
    71 
    73 // MASS STORAGE
    75 // <<<<<<<<<<<<<<<< IMPORTANT >>>>>>>>>>>>>>>
    76 // Set this to 1 to support single LUN devices, and save RAM. -- I.E. thumb drives.
    77 // Each LUN needs ~13 bytes to be able to track the state of each unit.
    78 #ifndef MASS_MAX_SUPPORTED_LUN
    79 #define MASS_MAX_SUPPORTED_LUN 8
    80 #endif
    81 
    83 // Set to 1 to use the faster spi4teensy3 driver.
    85 #ifndef USE_SPI4TEENSY3
    86 #define USE_SPI4TEENSY3 1
    87 #endif
    88 
    89 // Disabled on the Teensy LC, as it is incompatible for now
    90 #if defined(__MKL26Z64__)
    91 #undef USE_SPI4TEENSY3
    92 #define USE_SPI4TEENSY3 0
    93 #endif
    94 
    96 // AUTOMATIC Settings
    98 
    99 // No user serviceable parts below this line.
    100 // DO NOT change anything below here unless you are a developer!
    101 
    102 #include "version_helper.h"
    103 
    104 #if defined(__GNUC__) && defined(__AVR__)
    105 #ifndef GCC_VERSION
    106 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
    107 #endif
    108 #if GCC_VERSION < 40602 // Test for GCC < 4.6.2
    109 #ifdef PROGMEM
    110 #undef PROGMEM
    111 #define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4
    112 #ifdef PSTR
    113 #undef PSTR
    114 #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source
    115 #endif
    116 #endif
    117 #endif
    118 #endif
    119 
    120 #if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING
    121 #define DEBUG_USB_HOST
    122 #endif
    123 
    124 #if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA
    125 #define WIICAMERA
    126 #endif
    127 
    128 // To use some other locking (e.g. freertos),
    129 // define XMEM_ACQUIRE_SPI and XMEM_RELEASE_SPI to point to your lock and unlock.
    130 // NOTE: NO argument is passed. You have to do this within your routine for
    131 // whatever you are using to lock and unlock.
    132 #if !defined(XMEM_ACQUIRE_SPI)
    133 #if USE_XMEM_SPI_LOCK || defined(USE_MULTIPLE_APP_API)
    134 #include <xmem.h>
    135 #else
    136 #define XMEM_ACQUIRE_SPI() (void(0))
    137 #define XMEM_RELEASE_SPI() (void(0))
    138 #endif
    139 #endif
    140 
    141 #if !defined(EXT_RAM) && defined(EXT_RAM_STACK) || defined(EXT_RAM_HEAP)
    142 #include <xmem.h>
    143 #else
    144 #define EXT_RAM 0
    145 #endif
    146 
    147 #if defined(CORE_TEENSY) && defined(KINETISK)
    148 #define USING_SPI4TEENSY3 USE_SPI4TEENSY3
    149 #else
    150 #define USING_SPI4TEENSY3 0
    151 #endif
    152 
    153 #if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3
    154 #include <SPI.h> // Use the Arduino SPI library for the Arduino Due, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available
    155 #endif
    156 #ifdef RBL_NRF51822
    157 #include <nrf_gpio.h>
    158 #include <SPI_Master.h>
    159 #define SPI SPI_Master
    160 #define MFK_CASTUINT8T (uint8_t) // RBLs return type for sizeof needs casting to uint8_t
    161 #endif
    162 #if defined(__PIC32MX__) || defined(__PIC32MZ__)
    163 #include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library
    164 #endif
    165 
    166 #if defined(ESP8266) || defined(ESP32)
    167 #define MFK_CASTUINT8T (uint8_t) // ESP return type for sizeof needs casting to uint8_t
    168 #endif
    169 
    170 #ifdef STM32F4
    171 #include "stm32f4xx_hal.h"
    172 extern SPI_HandleTypeDef SPI_Handle; // Needed to be declared in your main.cpp
    173 #endif
    174 
    175 // Fix defines on Arduino Due
    176 #ifdef ARDUINO_SAM_DUE
    177 #ifdef tokSETUP
    178 #undef tokSETUP
    179 #endif
    180 #ifdef tokIN
    181 #undef tokIN
    182 #endif
    183 #ifdef tokOUT
    184 #undef tokOUT
    185 #endif
    186 #ifdef tokINHS
    187 #undef tokINHS
    188 #endif
    189 #ifdef tokOUTHS
    190 #undef tokOUTHS
    191 #endif
    192 #endif
    193 
    194 // Set defaults
    195 #ifndef MFK_CASTUINT8T
    196 #define MFK_CASTUINT8T
    197 #endif
    198 
    199 // Workaround issue: https://github.com/esp8266/Arduino/issues/2078
    200 #ifdef ESP8266
    201 #undef PROGMEM
    202 #define PROGMEM
    203 #undef PSTR
    204 #define PSTR(s) (s)
    205 #undef pgm_read_byte
    206 #define pgm_read_byte(addr) (*reinterpret_cast<const uint8_t*>(addr))
    207 #undef pgm_read_word
    208 #define pgm_read_word(addr) (*reinterpret_cast<const uint16_t*>(addr))
    209 #endif
    210 
    211 #ifdef ARDUINO_ESP8266_WIFIO
    212 #error "This board is currently not supported"
    213 #endif
    214 
    215 #endif /* SETTINGS_H */
    diff --git a/sink__parser_8h.html b/sink__parser_8h.html index 77e661af..eb6fbaae 100644 --- a/sink__parser_8h.html +++ b/sink__parser_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: sink_parser.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
     

    Variable Documentation

    - + +

    ◆ UsbDEBUGlvl

    +
    @@ -117,7 +99,7 @@ Variables
    -

    Definition at line 22 of file message.cpp.

    +

    Definition at line 29 of file message.cpp.

    @@ -126,7 +108,7 @@ Variables diff --git a/sink__parser_8h_source.html b/sink__parser_8h_source.html index 09e782e8..e85b2c9a 100644 --- a/sink__parser_8h_source.html +++ b/sink__parser_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: sink_parser.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    sink_parser.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 #if !defined(_usb_h_) || defined(__SINK_PARSER_H__)
    18 #error "Never include hexdump.h directly; include Usb.h instead"
    19 #else
    20 #define __SINK_PARSER_H__
    21 
    22 extern int UsbDEBUGlvl;
    23 
    24 // This parser does absolutely nothing with the data, just swallows it.
    25 
    26 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
    27 class SinkParser : public BASE_CLASS {
    28 public:
    29 
    31  };
    32 
    33  void Initialize() {
    34  };
    35 
    36  void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) {
    37  };
    38 };
    39 
    40 
    41 #endif // __HEXDUMP_H__
    - -
    void Initialize()
    Definition: sink_parser.h:33
    -
    int UsbDEBUGlvl
    Definition: message.cpp:22
    -
    void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset)
    Definition: sink_parser.h:36
    +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 
    25 #if !defined(_usb_h_) || defined(__SINK_PARSER_H__)
    26 #error "Never include hexdump.h directly; include Usb.h instead"
    27 #else
    28 #define __SINK_PARSER_H__
    29 
    30 extern int UsbDEBUGlvl;
    31 
    32 // This parser does absolutely nothing with the data, just swallows it.
    33 
    34 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
    35 class SinkParser : public BASE_CLASS {
    36 public:
    37 
    39  };
    40 
    41  void Initialize() {
    42  };
    43 
    44  void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) {
    45  };
    46 };
    47 
    48 
    49 #endif // __HEXDUMP_H__
    + +
    void Initialize()
    Definition: sink_parser.h:41
    +
    int UsbDEBUGlvl
    Definition: message.cpp:29
    +
    void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset)
    Definition: sink_parser.h:44
    diff --git a/struct_a_c_m___f_u_n_c___d_e_s_c_r-members.html b/struct_a_c_m___f_u_n_c___d_e_s_c_r-members.html index 87d6f9e4..e7e7b44c 100644 --- a/struct_a_c_m___f_u_n_c___d_e_s_c_r-members.html +++ b/struct_a_c_m___f_u_n_c___d_e_s_c_r-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 94 of file cdcacm.h.

    +

    Definition at line 94 of file cdcacm.h.

    Member Data Documentation

    - + +

    ◆ bFunctionLength

    +
    @@ -119,11 +99,13 @@ Public Attributes
    -

    Definition at line 95 of file cdcacm.h.

    +

    Definition at line 95 of file cdcacm.h.

    - + +

    ◆ bDescriptorType

    +
    @@ -133,11 +115,13 @@ Public Attributes
    -

    Definition at line 96 of file cdcacm.h.

    +

    Definition at line 96 of file cdcacm.h.

    - + +

    ◆ bDescriptorSubtype

    +
    @@ -147,11 +131,13 @@ Public Attributes
    -

    Definition at line 97 of file cdcacm.h.

    +

    Definition at line 97 of file cdcacm.h.

    - + +

    ◆ bmCapabilities

    +
    @@ -161,7 +147,7 @@ Public Attributes
    -

    Definition at line 98 of file cdcacm.h.

    +

    Definition at line 98 of file cdcacm.h.

    @@ -173,7 +159,7 @@ Public Attributes diff --git a/struct_b_a_s_i_c_c_d_b-members.html b/struct_b_a_s_i_c_c_d_b-members.html index 560423b0..751238e0 100644 --- a/struct_b_a_s_i_c_c_d_b-members.html +++ b/struct_b_a_s_i_c_c_d_b-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 185 of file masstorage.h.

    +

    Definition at line 192 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ Opcode

    +
    @@ -119,11 +99,13 @@ Public Attributes
    -

    Definition at line 186 of file masstorage.h.

    +

    Definition at line 193 of file masstorage.h.

    - + +

    ◆ unused

    +
    @@ -133,11 +115,13 @@ Public Attributes
    -

    Definition at line 188 of file masstorage.h.

    +

    Definition at line 195 of file masstorage.h.

    - + +

    ◆ LUN

    +
    @@ -147,11 +131,13 @@ Public Attributes
    -

    Definition at line 189 of file masstorage.h.

    +

    Definition at line 196 of file masstorage.h.

    - + +

    ◆ info

    +
    @@ -161,7 +147,7 @@ Public Attributes
    -

    Definition at line 191 of file masstorage.h.

    +

    Definition at line 198 of file masstorage.h.

    @@ -173,7 +159,7 @@ Public Attributes diff --git a/struct_c_a_l_l___m_g_m_n_t___f_u_n_c___d_e_s_c_r-members.html b/struct_c_a_l_l___m_g_m_n_t___f_u_n_c___d_e_s_c_r-members.html index 69bb5977..66812d68 100644 --- a/struct_c_a_l_l___m_g_m_n_t___f_u_n_c___d_e_s_c_r-members.html +++ b/struct_c_a_l_l___m_g_m_n_t___f_u_n_c___d_e_s_c_r-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 86 of file cdcacm.h.

    +

    Definition at line 86 of file cdcacm.h.

    Member Data Documentation

    - + +

    ◆ bFunctionLength

    +
    @@ -121,11 +101,13 @@ Public Attributes
    -

    Definition at line 87 of file cdcacm.h.

    +

    Definition at line 87 of file cdcacm.h.

    - + +

    ◆ bDescriptorType

    +
    @@ -135,11 +117,13 @@ Public Attributes
    -

    Definition at line 88 of file cdcacm.h.

    +

    Definition at line 88 of file cdcacm.h.

    - + +

    ◆ bDescriptorSubtype

    +
    @@ -149,11 +133,13 @@ Public Attributes
    -

    Definition at line 89 of file cdcacm.h.

    +

    Definition at line 89 of file cdcacm.h.

    - + +

    ◆ bmCapabilities

    +
    @@ -163,11 +149,13 @@ Public Attributes
    -

    Definition at line 90 of file cdcacm.h.

    +

    Definition at line 90 of file cdcacm.h.

    - + +

    ◆ bDataInterface

    +
    @@ -177,7 +165,7 @@ Public Attributes
    -

    Definition at line 91 of file cdcacm.h.

    +

    Definition at line 91 of file cdcacm.h.

    @@ -189,7 +177,7 @@ Public Attributes diff --git a/struct_c_d_b10-members.html b/struct_c_d_b10-members.html index 0daad2eb..12499ef9 100644 --- a/struct_c_d_b10-members.html +++ b/struct_c_d_b10-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 222 of file masstorage.h.

    +

    Definition at line 229 of file masstorage.h.

    Constructor & Destructor Documentation

    - + +

    ◆ CDB10() [1/2]

    +
    @@ -163,11 +143,13 @@ Public Attributes
    -

    Definition at line 241 of file masstorage.h.

    +

    Definition at line 248 of file masstorage.h.

    - + +

    ◆ CDB10() [2/2]

    +
    @@ -211,12 +193,14 @@ Public Attributes
    -

    Definition at line 247 of file masstorage.h.

    +

    Definition at line 254 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ Opcode

    +
    @@ -226,11 +210,13 @@ Public Attributes
    -

    Definition at line 223 of file masstorage.h.

    +

    Definition at line 230 of file masstorage.h.

    - + +

    ◆ Service_Action

    +
    @@ -240,11 +226,13 @@ Public Attributes
    -

    Definition at line 225 of file masstorage.h.

    +

    Definition at line 232 of file masstorage.h.

    - + +

    ◆ LUN

    +
    @@ -254,11 +242,13 @@ Public Attributes
    -

    Definition at line 226 of file masstorage.h.

    +

    Definition at line 233 of file masstorage.h.

    - + +

    ◆ LBA_L_M_MB

    +
    @@ -268,11 +258,13 @@ Public Attributes
    -

    Definition at line 228 of file masstorage.h.

    +

    Definition at line 235 of file masstorage.h.

    - + +

    ◆ LBA_L_M_LB

    +
    @@ -282,11 +274,13 @@ Public Attributes
    -

    Definition at line 229 of file masstorage.h.

    +

    Definition at line 236 of file masstorage.h.

    - + +

    ◆ LBA_L_L_MB

    +
    @@ -296,11 +290,13 @@ Public Attributes
    -

    Definition at line 230 of file masstorage.h.

    +

    Definition at line 237 of file masstorage.h.

    - + +

    ◆ LBA_L_L_LB

    +
    @@ -310,11 +306,13 @@ Public Attributes
    -

    Definition at line 231 of file masstorage.h.

    +

    Definition at line 238 of file masstorage.h.

    - + +

    ◆ Misc2

    +
    @@ -324,11 +322,13 @@ Public Attributes
    -

    Definition at line 233 of file masstorage.h.

    +

    Definition at line 240 of file masstorage.h.

    - + +

    ◆ ALC_MB

    +
    @@ -338,11 +338,13 @@ Public Attributes
    -

    Definition at line 235 of file masstorage.h.

    +

    Definition at line 242 of file masstorage.h.

    - + +

    ◆ ALC_LB

    +
    @@ -352,11 +354,13 @@ Public Attributes
    -

    Definition at line 236 of file masstorage.h.

    +

    Definition at line 243 of file masstorage.h.

    - + +

    ◆ Control

    +
    @@ -366,7 +370,7 @@ Public Attributes
    -

    Definition at line 238 of file masstorage.h.

    +

    Definition at line 245 of file masstorage.h.

    @@ -378,7 +382,7 @@ Public Attributes diff --git a/struct_c_d_b12-members.html b/struct_c_d_b12-members.html index 062d2c9a..cac91bd9 100644 --- a/struct_c_d_b12-members.html +++ b/struct_c_d_b12-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 256 of file masstorage.h.

    +

    Definition at line 263 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ Opcode

    +
    @@ -131,11 +111,13 @@ Public Attributes
    -

    Definition at line 257 of file masstorage.h.

    +

    Definition at line 264 of file masstorage.h.

    - + +

    ◆ Service_Action

    +
    @@ -145,11 +127,13 @@ Public Attributes
    -

    Definition at line 259 of file masstorage.h.

    +

    Definition at line 266 of file masstorage.h.

    - + +

    ◆ Misc

    +
    @@ -159,11 +143,13 @@ Public Attributes
    -

    Definition at line 260 of file masstorage.h.

    +

    Definition at line 267 of file masstorage.h.

    - + +

    ◆ LBA_L_M_LB

    +
    @@ -173,11 +159,13 @@ Public Attributes
    -

    Definition at line 262 of file masstorage.h.

    +

    Definition at line 269 of file masstorage.h.

    - + +

    ◆ LBA_L_L_MB

    +
    @@ -187,11 +175,13 @@ Public Attributes
    -

    Definition at line 263 of file masstorage.h.

    +

    Definition at line 270 of file masstorage.h.

    - + +

    ◆ LBA_L_L_LB

    +
    @@ -201,11 +191,13 @@ Public Attributes
    -

    Definition at line 264 of file masstorage.h.

    +

    Definition at line 271 of file masstorage.h.

    - + +

    ◆ ALC_M_LB

    +
    @@ -215,11 +207,13 @@ Public Attributes
    -

    Definition at line 266 of file masstorage.h.

    +

    Definition at line 273 of file masstorage.h.

    - + +

    ◆ ALC_L_MB

    +
    @@ -229,11 +223,13 @@ Public Attributes
    -

    Definition at line 267 of file masstorage.h.

    +

    Definition at line 274 of file masstorage.h.

    - + +

    ◆ ALC_L_LB

    +
    @@ -243,11 +239,13 @@ Public Attributes
    -

    Definition at line 268 of file masstorage.h.

    +

    Definition at line 275 of file masstorage.h.

    - + +

    ◆ Control

    +
    @@ -257,7 +255,7 @@ Public Attributes
    -

    Definition at line 269 of file masstorage.h.

    +

    Definition at line 276 of file masstorage.h.

    @@ -269,7 +267,7 @@ Public Attributes diff --git a/struct_c_d_b6-members.html b/struct_c_d_b6-members.html index 0c0f3baf..629204ba 100644 --- a/struct_c_d_b6-members.html +++ b/struct_c_d_b6-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 196 of file masstorage.h.

    +

    Definition at line 203 of file masstorage.h.

    Constructor & Destructor Documentation

    - + +

    ◆ CDB6() [1/2]

    +
    @@ -173,11 +153,13 @@ Public Attributes
    -

    Definition at line 209 of file masstorage.h.

    +

    Definition at line 216 of file masstorage.h.

    - + +

    ◆ CDB6() [2/2]

    +
    @@ -221,12 +203,14 @@ Public Attributes
    -

    Definition at line 214 of file masstorage.h.

    +

    Definition at line 221 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ Opcode

    +
    @@ -236,11 +220,13 @@ Public Attributes
    -

    Definition at line 197 of file masstorage.h.

    +

    Definition at line 204 of file masstorage.h.

    - + +

    ◆ LBAMSB

    +
    @@ -250,11 +236,13 @@ Public Attributes
    -

    Definition at line 199 of file masstorage.h.

    +

    Definition at line 206 of file masstorage.h.

    - + +

    ◆ LUN

    +
    @@ -264,11 +252,13 @@ Public Attributes
    -

    Definition at line 200 of file masstorage.h.

    +

    Definition at line 207 of file masstorage.h.

    - + +

    ◆ LBAHB

    +
    @@ -278,11 +268,13 @@ Public Attributes
    -

    Definition at line 202 of file masstorage.h.

    +

    Definition at line 209 of file masstorage.h.

    - + +

    ◆ LBALB

    +
    @@ -292,11 +284,13 @@ Public Attributes
    -

    Definition at line 203 of file masstorage.h.

    +

    Definition at line 210 of file masstorage.h.

    - + +

    ◆ AllocationLength

    +
    @@ -306,11 +300,13 @@ Public Attributes
    -

    Definition at line 204 of file masstorage.h.

    +

    Definition at line 211 of file masstorage.h.

    - + +

    ◆ Control

    +
    @@ -320,7 +316,7 @@ Public Attributes
    -

    Definition at line 205 of file masstorage.h.

    +

    Definition at line 212 of file masstorage.h.

    @@ -332,7 +328,7 @@ Public Attributes diff --git a/struct_c_d_b___l_b_a32__16-members.html b/struct_c_d_b___l_b_a32__16-members.html index 2c2d21d6..3a3c0dfa 100644 --- a/struct_c_d_b___l_b_a32__16-members.html +++ b/struct_c_d_b___l_b_a32__16-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 274 of file masstorage.h.

    +

    Definition at line 281 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ Opcode

    +
    @@ -145,11 +125,13 @@ Public Attributes
    -

    Definition at line 275 of file masstorage.h.

    +

    Definition at line 282 of file masstorage.h.

    - + +

    ◆ Service_Action

    +
    @@ -159,11 +141,13 @@ Public Attributes
    -

    Definition at line 277 of file masstorage.h.

    +

    Definition at line 284 of file masstorage.h.

    - + +

    ◆ Misc

    +
    @@ -173,11 +157,13 @@ Public Attributes
    -

    Definition at line 278 of file masstorage.h.

    +

    Definition at line 285 of file masstorage.h.

    - + +

    ◆ LBA_L_M_MB

    +
    @@ -187,11 +173,13 @@ Public Attributes
    -

    Definition at line 280 of file masstorage.h.

    +

    Definition at line 287 of file masstorage.h.

    - + +

    ◆ LBA_L_M_LB

    +
    @@ -201,11 +189,13 @@ Public Attributes
    -

    Definition at line 281 of file masstorage.h.

    +

    Definition at line 288 of file masstorage.h.

    - + +

    ◆ LBA_L_L_MB

    +
    @@ -215,11 +205,13 @@ Public Attributes
    -

    Definition at line 282 of file masstorage.h.

    +

    Definition at line 289 of file masstorage.h.

    - + +

    ◆ LBA_L_L_LB

    +
    @@ -229,11 +221,13 @@ Public Attributes
    -

    Definition at line 283 of file masstorage.h.

    +

    Definition at line 290 of file masstorage.h.

    - + +

    ◆ A_M_M_MB

    +
    @@ -243,11 +237,13 @@ Public Attributes
    -

    Definition at line 285 of file masstorage.h.

    +

    Definition at line 292 of file masstorage.h.

    - + +

    ◆ A_M_M_LB

    +
    @@ -257,11 +253,13 @@ Public Attributes
    -

    Definition at line 286 of file masstorage.h.

    +

    Definition at line 293 of file masstorage.h.

    - + +

    ◆ A_M_L_MB

    +
    @@ -271,11 +269,13 @@ Public Attributes
    -

    Definition at line 287 of file masstorage.h.

    +

    Definition at line 294 of file masstorage.h.

    - + +

    ◆ A_M_L_LB

    +
    @@ -285,11 +285,13 @@ Public Attributes
    -

    Definition at line 288 of file masstorage.h.

    +

    Definition at line 295 of file masstorage.h.

    - + +

    ◆ ALC_M_MB

    +
    @@ -299,11 +301,13 @@ Public Attributes
    -

    Definition at line 290 of file masstorage.h.

    +

    Definition at line 297 of file masstorage.h.

    - + +

    ◆ ALC_M_LB

    +
    @@ -313,11 +317,13 @@ Public Attributes
    -

    Definition at line 291 of file masstorage.h.

    +

    Definition at line 298 of file masstorage.h.

    - + +

    ◆ ALC_L_MB

    +
    @@ -327,11 +333,13 @@ Public Attributes
    -

    Definition at line 292 of file masstorage.h.

    +

    Definition at line 299 of file masstorage.h.

    - + +

    ◆ ALC_L_LB

    +
    @@ -341,11 +349,13 @@ Public Attributes
    -

    Definition at line 293 of file masstorage.h.

    +

    Definition at line 300 of file masstorage.h.

    - + +

    ◆ Misc2

    +
    @@ -355,11 +365,13 @@ Public Attributes
    -

    Definition at line 295 of file masstorage.h.

    +

    Definition at line 302 of file masstorage.h.

    - + +

    ◆ Control

    +
    @@ -369,7 +381,7 @@ Public Attributes
    -

    Definition at line 296 of file masstorage.h.

    +

    Definition at line 303 of file masstorage.h.

    @@ -381,7 +393,7 @@ Public Attributes diff --git a/struct_c_d_b___l_b_a64__16-members.html b/struct_c_d_b___l_b_a64__16-members.html index 8bce7513..729d39a4 100644 --- a/struct_c_d_b___l_b_a64__16-members.html +++ b/struct_c_d_b___l_b_a64__16-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 299 of file masstorage.h.

    +

    Definition at line 306 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ Opcode

    +
    @@ -143,11 +123,13 @@ Public Attributes
    -

    Definition at line 300 of file masstorage.h.

    +

    Definition at line 307 of file masstorage.h.

    - + +

    ◆ Misc

    +
    @@ -157,11 +139,13 @@ Public Attributes
    -

    Definition at line 301 of file masstorage.h.

    +

    Definition at line 308 of file masstorage.h.

    - + +

    ◆ LBA_M_M_MB

    +
    @@ -171,11 +155,13 @@ Public Attributes
    -

    Definition at line 303 of file masstorage.h.

    +

    Definition at line 310 of file masstorage.h.

    - + +

    ◆ LBA_M_M_LB

    +
    @@ -185,11 +171,13 @@ Public Attributes
    -

    Definition at line 304 of file masstorage.h.

    +

    Definition at line 311 of file masstorage.h.

    - + +

    ◆ LBA_M_L_MB

    +
    @@ -199,11 +187,13 @@ Public Attributes
    -

    Definition at line 305 of file masstorage.h.

    +

    Definition at line 312 of file masstorage.h.

    - + +

    ◆ LBA_M_L_LB

    +
    @@ -213,11 +203,13 @@ Public Attributes
    -

    Definition at line 306 of file masstorage.h.

    +

    Definition at line 313 of file masstorage.h.

    - + +

    ◆ LBA_L_M_MB

    +
    @@ -227,11 +219,13 @@ Public Attributes
    -

    Definition at line 308 of file masstorage.h.

    +

    Definition at line 315 of file masstorage.h.

    - + +

    ◆ LBA_L_M_LB

    +
    @@ -241,11 +235,13 @@ Public Attributes
    -

    Definition at line 309 of file masstorage.h.

    +

    Definition at line 316 of file masstorage.h.

    - + +

    ◆ LBA_L_L_MB

    +
    @@ -255,11 +251,13 @@ Public Attributes
    -

    Definition at line 310 of file masstorage.h.

    +

    Definition at line 317 of file masstorage.h.

    - + +

    ◆ LBA_L_L_LB

    +
    @@ -269,11 +267,13 @@ Public Attributes
    -

    Definition at line 311 of file masstorage.h.

    +

    Definition at line 318 of file masstorage.h.

    - + +

    ◆ ALC_M_MB

    +
    @@ -283,11 +283,13 @@ Public Attributes
    -

    Definition at line 313 of file masstorage.h.

    +

    Definition at line 320 of file masstorage.h.

    - + +

    ◆ ALC_M_LB

    +
    @@ -297,11 +299,13 @@ Public Attributes
    -

    Definition at line 314 of file masstorage.h.

    +

    Definition at line 321 of file masstorage.h.

    - + +

    ◆ ALC_L_MB

    +
    @@ -311,11 +315,13 @@ Public Attributes
    -

    Definition at line 315 of file masstorage.h.

    +

    Definition at line 322 of file masstorage.h.

    - + +

    ◆ ALC_L_LB

    +
    @@ -325,11 +331,13 @@ Public Attributes
    -

    Definition at line 316 of file masstorage.h.

    +

    Definition at line 323 of file masstorage.h.

    - + +

    ◆ Misc2

    +
    @@ -339,11 +347,13 @@ Public Attributes
    -

    Definition at line 318 of file masstorage.h.

    +

    Definition at line 325 of file masstorage.h.

    - + +

    ◆ Control

    +
    @@ -353,7 +363,7 @@ Public Attributes
    -

    Definition at line 319 of file masstorage.h.

    +

    Definition at line 326 of file masstorage.h.

    @@ -365,7 +375,7 @@ Public Attributes diff --git a/struct_c_l_a_s_s___n_o_t_i_f_i_c_a_t_i_o_n-members.html b/struct_c_l_a_s_s___n_o_t_i_f_i_c_a_t_i_o_n-members.html index 5bef2b0e..36d9b3f0 100644 --- a/struct_c_l_a_s_s___n_o_t_i_f_i_c_a_t_i_o_n-members.html +++ b/struct_c_l_a_s_s___n_o_t_i_f_i_c_a_t_i_o_n-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 117 of file cdcacm.h.

    +

    Definition at line 117 of file cdcacm.h.

    Member Data Documentation

    - + +

    ◆ bmRequestType

    +
    @@ -123,11 +103,13 @@ Public Attributes
    -

    Definition at line 118 of file cdcacm.h.

    +

    Definition at line 118 of file cdcacm.h.

    - + +

    ◆ bNotification

    +
    @@ -137,11 +119,13 @@ Public Attributes
    -

    Definition at line 119 of file cdcacm.h.

    +

    Definition at line 119 of file cdcacm.h.

    - + +

    ◆ wValue

    +
    @@ -151,11 +135,13 @@ Public Attributes
    -

    Definition at line 120 of file cdcacm.h.

    +

    Definition at line 120 of file cdcacm.h.

    - + +

    ◆ wIndex

    +
    @@ -165,11 +151,13 @@ Public Attributes
    -

    Definition at line 121 of file cdcacm.h.

    +

    Definition at line 121 of file cdcacm.h.

    - + +

    ◆ wLength

    +
    @@ -179,11 +167,13 @@ Public Attributes
    -

    Definition at line 122 of file cdcacm.h.

    +

    Definition at line 122 of file cdcacm.h.

    - + +

    ◆ bmState

    +
    @@ -193,7 +183,7 @@ Public Attributes
    -

    Definition at line 123 of file cdcacm.h.

    +

    Definition at line 123 of file cdcacm.h.

    @@ -205,7 +195,7 @@ Public Attributes diff --git a/struct_capacity-members.html b/struct_capacity-members.html index ed2227dd..856be512 100644 --- a/struct_capacity-members.html +++ b/struct_capacity-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 179 of file masstorage.h.

    +

    Definition at line 186 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ data

    +
    @@ -113,7 +93,7 @@ Public Attributes
    -

    Definition at line 180 of file masstorage.h.

    +

    Definition at line 187 of file masstorage.h.

    @@ -125,7 +105,7 @@ Public Attributes diff --git a/struct_command_block_wrapper-members.html b/struct_command_block_wrapper-members.html index b6213acf..b5b26b06 100644 --- a/struct_command_block_wrapper-members.html +++ b/struct_command_block_wrapper-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 385 of file masstorage.h.

    +

    Definition at line 392 of file masstorage.h.

    Constructor & Destructor Documentation

    - + +

    ◆ CommandBlockWrapper() [1/4]

    +
    @@ -180,11 +160,13 @@ Public Attributes
    -

    Definition at line 402 of file masstorage.h.

    +

    Definition at line 409 of file masstorage.h.

    - + +

    ◆ CommandBlockWrapper() [2/4]

    +
    @@ -240,11 +222,13 @@ Public Attributes
    -

    Definition at line 409 of file masstorage.h.

    +

    Definition at line 416 of file masstorage.h.

    - + +

    ◆ CommandBlockWrapper() [3/4]

    +
    @@ -288,11 +272,13 @@ Public Attributes
    -

    Definition at line 422 of file masstorage.h.

    +

    Definition at line 429 of file masstorage.h.

    - + +

    ◆ CommandBlockWrapper() [4/4]

    +
    @@ -336,12 +322,14 @@ Public Attributes
    -

    Definition at line 429 of file masstorage.h.

    +

    Definition at line 436 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ bmCBWLUN

    +
    @@ -351,11 +339,13 @@ Public Attributes
    -

    Definition at line 388 of file masstorage.h.

    +

    Definition at line 395 of file masstorage.h.

    - + +

    ◆ bmReserved1

    +
    @@ -365,11 +355,13 @@ Public Attributes
    -

    Definition at line 389 of file masstorage.h.

    +

    Definition at line 396 of file masstorage.h.

    - + +

    ◆ @25

    +
    @@ -381,7 +373,9 @@ Public Attributes - + +

    ◆ bmCBWCBLength

    +
    @@ -391,11 +385,13 @@ Public Attributes
    -

    Definition at line 393 of file masstorage.h.

    +

    Definition at line 400 of file masstorage.h.

    - + +

    ◆ bmReserved2

    +
    @@ -405,11 +401,13 @@ Public Attributes
    -

    Definition at line 394 of file masstorage.h.

    +

    Definition at line 401 of file masstorage.h.

    - + +

    ◆ @27

    +
    @@ -421,7 +419,9 @@ Public Attributes - + +

    ◆ CBWCB

    +
    @@ -431,7 +431,7 @@ Public Attributes
    -

    Definition at line 397 of file masstorage.h.

    +

    Definition at line 404 of file masstorage.h.

    @@ -443,7 +443,7 @@ Public Attributes diff --git a/struct_command_block_wrapper__coll__graph.md5 b/struct_command_block_wrapper__coll__graph.md5 index 4ac6fd00..fb60e9cc 100644 --- a/struct_command_block_wrapper__coll__graph.md5 +++ b/struct_command_block_wrapper__coll__graph.md5 @@ -1 +1 @@ -001476afe02cd749eb9e1c79a3e71cf0 \ No newline at end of file +6d90b23dcd5b35e5632bdbee25cd3da9 \ No newline at end of file diff --git a/struct_command_block_wrapper__coll__graph.png b/struct_command_block_wrapper__coll__graph.png index a6cc179c..e9120cc2 100644 Binary files a/struct_command_block_wrapper__coll__graph.png and b/struct_command_block_wrapper__coll__graph.png differ diff --git a/struct_command_block_wrapper__inherit__graph.md5 b/struct_command_block_wrapper__inherit__graph.md5 index 4ac6fd00..8d8af281 100644 --- a/struct_command_block_wrapper__inherit__graph.md5 +++ b/struct_command_block_wrapper__inherit__graph.md5 @@ -1 +1 @@ -001476afe02cd749eb9e1c79a3e71cf0 \ No newline at end of file +b9cc9b01371ae8feb93fc329b4f2c1c7 \ No newline at end of file diff --git a/struct_command_block_wrapper__inherit__graph.png b/struct_command_block_wrapper__inherit__graph.png index a6cc179c..e9120cc2 100644 Binary files a/struct_command_block_wrapper__inherit__graph.png and b/struct_command_block_wrapper__inherit__graph.png differ diff --git a/struct_command_block_wrapper_base-members.html b/struct_command_block_wrapper_base-members.html index 2bff57a0..6ad4b17f 100644 --- a/struct_command_block_wrapper_base-members.html +++ b/struct_command_block_wrapper_base-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 370 of file masstorage.h.

    +

    Definition at line 377 of file masstorage.h.

    Constructor & Destructor Documentation

    - + +

    ◆ CommandBlockWrapperBase() [1/2]

    +
    @@ -146,11 +126,13 @@ Public Attributes
    -

    Definition at line 377 of file masstorage.h.

    +

    Definition at line 384 of file masstorage.h.

    - + +

    ◆ CommandBlockWrapperBase() [2/2]

    +
    @@ -188,12 +170,14 @@ Public Attributes
    -

    Definition at line 380 of file masstorage.h.

    +

    Definition at line 387 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ dCBWSignature

    +
    @@ -203,11 +187,13 @@ Public Attributes
    -

    Definition at line 371 of file masstorage.h.

    +

    Definition at line 378 of file masstorage.h.

    - + +

    ◆ dCBWTag

    +
    @@ -217,11 +203,13 @@ Public Attributes
    -

    Definition at line 372 of file masstorage.h.

    +

    Definition at line 379 of file masstorage.h.

    - + +

    ◆ dCBWDataTransferLength

    +
    @@ -231,11 +219,13 @@ Public Attributes
    -

    Definition at line 373 of file masstorage.h.

    +

    Definition at line 380 of file masstorage.h.

    - + +

    ◆ bmCBWFlags

    +
    @@ -245,7 +235,7 @@ Public Attributes
    -

    Definition at line 374 of file masstorage.h.

    +

    Definition at line 381 of file masstorage.h.

    @@ -257,7 +247,7 @@ Public Attributes diff --git a/struct_command_block_wrapper_base__inherit__graph.md5 b/struct_command_block_wrapper_base__inherit__graph.md5 index 84b6b492..62af27aa 100644 --- a/struct_command_block_wrapper_base__inherit__graph.md5 +++ b/struct_command_block_wrapper_base__inherit__graph.md5 @@ -1 +1 @@ -661b00c525b61c0779a28cb69f358c68 \ No newline at end of file +260f0d6a8b792d32c45f8b276a0aa1d0 \ No newline at end of file diff --git a/struct_command_block_wrapper_base__inherit__graph.png b/struct_command_block_wrapper_base__inherit__graph.png index e3a9983d..f8121b8d 100644 Binary files a/struct_command_block_wrapper_base__inherit__graph.png and b/struct_command_block_wrapper_base__inherit__graph.png differ diff --git a/struct_command_status_wrapper-members.html b/struct_command_status_wrapper-members.html index 61b0abe3..33dc7a13 100644 --- a/struct_command_status_wrapper-members.html +++ b/struct_command_status_wrapper-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 436 of file masstorage.h.

    +

    Definition at line 443 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ dCSWSignature

    +
    @@ -119,11 +99,13 @@ Public Attributes
    -

    Definition at line 437 of file masstorage.h.

    +

    Definition at line 444 of file masstorage.h.

    - + +

    ◆ dCSWTag

    +
    @@ -133,11 +115,13 @@ Public Attributes
    -

    Definition at line 438 of file masstorage.h.

    +

    Definition at line 445 of file masstorage.h.

    - + +

    ◆ dCSWDataResidue

    +
    @@ -147,11 +131,13 @@ Public Attributes
    -

    Definition at line 439 of file masstorage.h.

    +

    Definition at line 446 of file masstorage.h.

    - + +

    ◆ bCSWStatus

    +
    @@ -161,7 +147,7 @@ Public Attributes
    -

    Definition at line 440 of file masstorage.h.

    +

    Definition at line 447 of file masstorage.h.

    @@ -173,7 +159,7 @@ Public Attributes diff --git a/struct_ep_info-members.html b/struct_ep_info-members.html index de93050f..cc9734ac 100644 --- a/struct_ep_info-members.html +++ b/struct_ep_info-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 32 of file address.h.

    +

    Definition at line 39 of file address.h.

    Member Data Documentation

    - + +

    ◆ epAddr

    +
    @@ -129,11 +109,13 @@ Public Attributes
    -

    Definition at line 33 of file address.h.

    +

    Definition at line 40 of file address.h.

    - + +

    ◆ maxPktSize

    +
    @@ -143,11 +125,13 @@ Public Attributes
    -

    Definition at line 34 of file address.h.

    +

    Definition at line 41 of file address.h.

    - + +

    ◆ epAttribs

    +
    @@ -157,11 +141,13 @@ Public Attributes
    -

    Definition at line 37 of file address.h.

    +

    Definition at line 44 of file address.h.

    - + +

    ◆ bmSndToggle

    +
    @@ -171,11 +157,13 @@ Public Attributes
    -

    Definition at line 40 of file address.h.

    +

    Definition at line 47 of file address.h.

    - + +

    ◆ bmRcvToggle

    +
    @@ -185,11 +173,13 @@ Public Attributes
    -

    Definition at line 41 of file address.h.

    +

    Definition at line 48 of file address.h.

    - + +

    ◆ bmNakPower

    +
    @@ -199,11 +189,13 @@ Public Attributes
    -

    Definition at line 42 of file address.h.

    +

    Definition at line 49 of file address.h.

    - + +

    ◆ @1

    +
    @@ -223,7 +215,7 @@ Public Attributes diff --git a/struct_h_i_d___c_l_a_s_s___d_e_s_c_r_i_p_t_o_r___l_e_n___a_n_d___t_y_p_e-members.html b/struct_h_i_d___c_l_a_s_s___d_e_s_c_r_i_p_t_o_r___l_e_n___a_n_d___t_y_p_e-members.html index 53b1bd5d..2420ea1b 100644 --- a/struct_h_i_d___c_l_a_s_s___d_e_s_c_r_i_p_t_o_r___l_e_n___a_n_d___t_y_p_e-members.html +++ b/struct_h_i_d___c_l_a_s_s___d_e_s_c_r_i_p_t_o_r___l_e_n___a_n_d___t_y_p_e-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 161 of file usb_ch9.h.

    +

    Definition at line 168 of file usb_ch9.h.

    Member Data Documentation

    - + +

    ◆ bDescrType

    +
    @@ -115,11 +95,13 @@ Public Attributes
    -

    Definition at line 162 of file usb_ch9.h.

    +

    Definition at line 169 of file usb_ch9.h.

    - + +

    ◆ wDescriptorLength

    +
    @@ -129,7 +111,7 @@ Public Attributes
    -

    Definition at line 163 of file usb_ch9.h.

    +

    Definition at line 170 of file usb_ch9.h.

    @@ -141,7 +123,7 @@ Public Attributes diff --git a/struct_hid_item_prefix-members.html b/struct_hid_item_prefix-members.html index 8b7ec1bb..2fa38893 100644 --- a/struct_hid_item_prefix-members.html +++ b/struct_hid_item_prefix-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 119 of file usbhid.h.

    +

    Definition at line 119 of file usbhid.h.

    Member Data Documentation

    - + +

    ◆ bSize

    +
    @@ -117,11 +97,13 @@ Public Attributes
    -

    Definition at line 120 of file usbhid.h.

    +

    Definition at line 120 of file usbhid.h.

    - + +

    ◆ bType

    +
    @@ -131,11 +113,13 @@ Public Attributes
    -

    Definition at line 121 of file usbhid.h.

    +

    Definition at line 121 of file usbhid.h.

    - + +

    ◆ bTag

    +
    @@ -145,7 +129,7 @@ Public Attributes
    -

    Definition at line 122 of file usbhid.h.

    +

    Definition at line 122 of file usbhid.h.

    @@ -157,7 +141,7 @@ Public Attributes diff --git a/struct_hub_descriptor-members.html b/struct_hub_descriptor-members.html index d7aca265..59af6d7b 100644 --- a/struct_hub_descriptor-members.html +++ b/struct_hub_descriptor-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 133 of file usbhub.h.

    +

    Definition at line 133 of file usbhub.h.

    Member Data Documentation

    - + +

    ◆ bDescLength

    +
    @@ -136,11 +116,13 @@ Public Attributes
    -

    Definition at line 134 of file usbhub.h.

    +

    Definition at line 134 of file usbhub.h.

    - + +

    ◆ bDescriptorType

    +
    @@ -150,11 +132,13 @@ Public Attributes
    -

    Definition at line 135 of file usbhub.h.

    +

    Definition at line 135 of file usbhub.h.

    - + +

    ◆ bNbrPorts

    +
    @@ -164,11 +148,13 @@ Public Attributes
    -

    Definition at line 136 of file usbhub.h.

    +

    Definition at line 136 of file usbhub.h.

    - + +

    ◆ LogPwrSwitchMode

    +
    @@ -178,11 +164,13 @@ Public Attributes
    -

    Definition at line 139 of file usbhub.h.

    +

    Definition at line 139 of file usbhub.h.

    - + +

    ◆ CompoundDevice

    +
    @@ -192,11 +180,13 @@ Public Attributes
    -

    Definition at line 140 of file usbhub.h.

    +

    Definition at line 140 of file usbhub.h.

    - + +

    ◆ OverCurrentProtectMode

    +
    @@ -206,11 +196,13 @@ Public Attributes
    -

    Definition at line 141 of file usbhub.h.

    +

    Definition at line 141 of file usbhub.h.

    - + +

    ◆ TTThinkTime

    +
    @@ -220,11 +212,13 @@ Public Attributes
    -

    Definition at line 142 of file usbhub.h.

    +

    Definition at line 142 of file usbhub.h.

    - + +

    ◆ PortIndicatorsSupported

    +
    @@ -234,11 +228,13 @@ Public Attributes
    -

    Definition at line 143 of file usbhub.h.

    +

    Definition at line 143 of file usbhub.h.

    - + +

    ◆ Reserved

    +
    @@ -248,11 +244,13 @@ Public Attributes
    -

    Definition at line 144 of file usbhub.h.

    +

    Definition at line 144 of file usbhub.h.

    - + +

    ◆ @39

    +
    @@ -264,7 +262,9 @@ Public Attributes - + +

    ◆ bPwrOn2PwrGood

    +
    @@ -274,11 +274,13 @@ Public Attributes
    -

    Definition at line 147 of file usbhub.h.

    +

    Definition at line 147 of file usbhub.h.

    - + +

    ◆ bHubContrCurrent

    +
    @@ -288,7 +290,7 @@ Public Attributes
    -

    Definition at line 148 of file usbhub.h.

    +

    Definition at line 148 of file usbhub.h.

    @@ -300,7 +302,7 @@ Public Attributes diff --git a/struct_hub_event-members.html b/struct_hub_event-members.html index c4a00eb7..52697a51 100644 --- a/struct_hub_event-members.html +++ b/struct_hub_event-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 151 of file usbhub.h.

    +

    Definition at line 151 of file usbhub.h.

    Member Data Documentation

    - + +

    ◆ bmStatus

    +
    @@ -125,11 +105,13 @@ Public Attributes
    -

    Definition at line 156 of file usbhub.h.

    +

    Definition at line 156 of file usbhub.h.

    - + +

    ◆ bmChange

    +
    @@ -139,11 +121,13 @@ Public Attributes
    -

    Definition at line 157 of file usbhub.h.

    +

    Definition at line 157 of file usbhub.h.

    - + +

    ◆ bmEvent

    +
    @@ -153,11 +137,13 @@ Public Attributes
    -

    Definition at line 159 of file usbhub.h.

    +

    Definition at line 159 of file usbhub.h.

    - + +

    ◆ evtBuff

    +
    @@ -167,11 +153,13 @@ Public Attributes
    -

    Definition at line 160 of file usbhub.h.

    +

    Definition at line 160 of file usbhub.h.

    - + +

    ◆ @41

    +
    @@ -191,7 +179,7 @@ Public Attributes diff --git a/struct_inquiry_response-members.html b/struct_inquiry_response-members.html index 2b274c25..1dd79e69 100644 --- a/struct_inquiry_response-members.html +++ b/struct_inquiry_response-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 322 of file masstorage.h.

    +

    Definition at line 329 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ DeviceType

    +
    @@ -183,11 +163,13 @@ Public Attributes
    -

    Definition at line 323 of file masstorage.h.

    +

    Definition at line 330 of file masstorage.h.

    - + +

    ◆ PeripheralQualifier

    +
    @@ -197,11 +179,13 @@ Public Attributes
    -

    Definition at line 324 of file masstorage.h.

    +

    Definition at line 331 of file masstorage.h.

    - + +

    ◆ Reserved

    +
    @@ -211,11 +195,13 @@ Public Attributes
    -

    Definition at line 326 of file masstorage.h.

    +

    Definition at line 333 of file masstorage.h.

    - + +

    ◆ Removable

    +
    @@ -225,11 +211,13 @@ Public Attributes
    -

    Definition at line 327 of file masstorage.h.

    +

    Definition at line 334 of file masstorage.h.

    - + +

    ◆ Version

    +
    @@ -239,11 +227,13 @@ Public Attributes
    -

    Definition at line 329 of file masstorage.h.

    +

    Definition at line 336 of file masstorage.h.

    - + +

    ◆ ResponseDataFormat

    +
    @@ -253,11 +243,13 @@ Public Attributes
    -

    Definition at line 331 of file masstorage.h.

    +

    Definition at line 338 of file masstorage.h.

    - + +

    ◆ HISUP

    +
    @@ -267,11 +259,13 @@ Public Attributes
    -

    Definition at line 332 of file masstorage.h.

    +

    Definition at line 339 of file masstorage.h.

    - + +

    ◆ NormACA

    +
    @@ -281,11 +275,13 @@ Public Attributes
    -

    Definition at line 333 of file masstorage.h.

    +

    Definition at line 340 of file masstorage.h.

    - + +

    ◆ TrmTsk

    +
    @@ -295,11 +291,13 @@ Public Attributes
    -

    Definition at line 334 of file masstorage.h.

    +

    Definition at line 341 of file masstorage.h.

    - + +

    ◆ AERC

    +
    @@ -309,11 +307,13 @@ Public Attributes
    -

    Definition at line 335 of file masstorage.h.

    +

    Definition at line 342 of file masstorage.h.

    - + +

    ◆ AdditionalLength

    +
    @@ -323,11 +323,13 @@ Public Attributes
    -

    Definition at line 337 of file masstorage.h.

    +

    Definition at line 344 of file masstorage.h.

    - + +

    ◆ PROTECT

    +
    @@ -337,11 +339,13 @@ Public Attributes
    -

    Definition at line 340 of file masstorage.h.

    +

    Definition at line 347 of file masstorage.h.

    - + +

    ◆ Res

    +
    @@ -351,11 +355,13 @@ Public Attributes
    -

    Definition at line 341 of file masstorage.h.

    +

    Definition at line 348 of file masstorage.h.

    - + +

    ◆ ThreePC

    +
    @@ -365,11 +371,13 @@ Public Attributes
    -

    Definition at line 342 of file masstorage.h.

    +

    Definition at line 349 of file masstorage.h.

    - + +

    ◆ TPGS

    +
    @@ -379,11 +387,13 @@ Public Attributes
    -

    Definition at line 343 of file masstorage.h.

    +

    Definition at line 350 of file masstorage.h.

    - + +

    ◆ ACC

    +
    @@ -393,11 +403,13 @@ Public Attributes
    -

    Definition at line 344 of file masstorage.h.

    +

    Definition at line 351 of file masstorage.h.

    - + +

    ◆ SCCS

    +
    @@ -407,11 +419,13 @@ Public Attributes
    -

    Definition at line 345 of file masstorage.h.

    +

    Definition at line 352 of file masstorage.h.

    - + +

    ◆ ADDR16

    +
    @@ -421,11 +435,13 @@ Public Attributes
    -

    Definition at line 347 of file masstorage.h.

    +

    Definition at line 354 of file masstorage.h.

    - + +

    ◆ R1

    +
    @@ -435,11 +451,13 @@ Public Attributes
    -

    Definition at line 348 of file masstorage.h.

    +

    Definition at line 355 of file masstorage.h.

    - + +

    ◆ R2

    +
    @@ -449,11 +467,13 @@ Public Attributes
    -

    Definition at line 349 of file masstorage.h.

    +

    Definition at line 356 of file masstorage.h.

    - + +

    ◆ MCHNGR

    +
    @@ -463,11 +483,13 @@ Public Attributes
    -

    Definition at line 350 of file masstorage.h.

    +

    Definition at line 357 of file masstorage.h.

    - + +

    ◆ MULTIP

    +
    @@ -477,11 +499,13 @@ Public Attributes
    -

    Definition at line 351 of file masstorage.h.

    +

    Definition at line 358 of file masstorage.h.

    - + +

    ◆ VS

    +
    @@ -491,11 +515,13 @@ Public Attributes
    -

    Definition at line 352 of file masstorage.h.

    +

    Definition at line 359 of file masstorage.h.

    - + +

    ◆ ENCSERV

    +
    @@ -505,11 +531,13 @@ Public Attributes
    -

    Definition at line 353 of file masstorage.h.

    +

    Definition at line 360 of file masstorage.h.

    - + +

    ◆ BQUE

    +
    @@ -519,11 +547,13 @@ Public Attributes
    -

    Definition at line 354 of file masstorage.h.

    +

    Definition at line 361 of file masstorage.h.

    - + +

    ◆ SoftReset

    +
    @@ -533,11 +563,13 @@ Public Attributes
    -

    Definition at line 356 of file masstorage.h.

    +

    Definition at line 363 of file masstorage.h.

    - + +

    ◆ CmdQue

    +
    @@ -547,11 +579,13 @@ Public Attributes
    -

    Definition at line 357 of file masstorage.h.

    +

    Definition at line 364 of file masstorage.h.

    - + +

    ◆ Reserved4

    +
    @@ -561,11 +595,13 @@ Public Attributes
    -

    Definition at line 358 of file masstorage.h.

    +

    Definition at line 365 of file masstorage.h.

    - + +

    ◆ Linked

    +
    @@ -575,11 +611,13 @@ Public Attributes
    -

    Definition at line 359 of file masstorage.h.

    +

    Definition at line 366 of file masstorage.h.

    - + +

    ◆ Sync

    +
    @@ -589,11 +627,13 @@ Public Attributes
    -

    Definition at line 360 of file masstorage.h.

    +

    Definition at line 367 of file masstorage.h.

    - + +

    ◆ WideBus16Bit

    +
    @@ -603,11 +643,13 @@ Public Attributes
    -

    Definition at line 361 of file masstorage.h.

    +

    Definition at line 368 of file masstorage.h.

    - + +

    ◆ WideBus32Bit

    +
    @@ -617,11 +659,13 @@ Public Attributes
    -

    Definition at line 362 of file masstorage.h.

    +

    Definition at line 369 of file masstorage.h.

    - + +

    ◆ RelAddr

    +
    @@ -631,11 +675,13 @@ Public Attributes
    -

    Definition at line 363 of file masstorage.h.

    +

    Definition at line 370 of file masstorage.h.

    - + +

    ◆ VendorID

    +
    @@ -645,11 +691,13 @@ Public Attributes
    -

    Definition at line 365 of file masstorage.h.

    +

    Definition at line 372 of file masstorage.h.

    - + +

    ◆ ProductID

    +
    @@ -659,11 +707,13 @@ Public Attributes
    -

    Definition at line 366 of file masstorage.h.

    +

    Definition at line 373 of file masstorage.h.

    - + +

    ◆ RevisionID

    +
    @@ -673,7 +723,7 @@ Public Attributes
    -

    Definition at line 367 of file masstorage.h.

    +

    Definition at line 374 of file masstorage.h.

    @@ -685,7 +735,7 @@ Public Attributes diff --git a/struct_k_b_d_i_n_f_o-members.html b/struct_k_b_d_i_n_f_o-members.html index 4a35e910..fbddf3c7 100644 --- a/struct_k_b_d_i_n_f_o-members.html +++ b/struct_k_b_d_i_n_f_o-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 96 of file hidboot.h.

    +

    Definition at line 96 of file hidboot.h.

    Member Data Documentation

    - + +

    ◆ bmLeftCtrl

    +
    @@ -134,11 +114,13 @@ Public Attributes
    -

    Definition at line 99 of file hidboot.h.

    +

    Definition at line 99 of file hidboot.h.

    - + +

    ◆ bmLeftShift

    +
    @@ -148,11 +130,13 @@ Public Attributes
    -

    Definition at line 100 of file hidboot.h.

    +

    Definition at line 100 of file hidboot.h.

    - + +

    ◆ bmLeftAlt

    +
    @@ -162,11 +146,13 @@ Public Attributes
    -

    Definition at line 101 of file hidboot.h.

    +

    Definition at line 101 of file hidboot.h.

    - + +

    ◆ bmLeftGUI

    +
    @@ -176,11 +162,13 @@ Public Attributes
    -

    Definition at line 102 of file hidboot.h.

    +

    Definition at line 102 of file hidboot.h.

    - + +

    ◆ bmRightCtrl

    +
    @@ -190,11 +178,13 @@ Public Attributes
    -

    Definition at line 103 of file hidboot.h.

    +

    Definition at line 103 of file hidboot.h.

    - + +

    ◆ bmRightShift

    +
    @@ -204,11 +194,13 @@ Public Attributes
    -

    Definition at line 104 of file hidboot.h.

    +

    Definition at line 104 of file hidboot.h.

    - + +

    ◆ bmRightAlt

    +
    @@ -218,11 +210,13 @@ Public Attributes
    -

    Definition at line 105 of file hidboot.h.

    +

    Definition at line 105 of file hidboot.h.

    - + +

    ◆ bmRightGUI

    +
    @@ -232,11 +226,13 @@ Public Attributes
    -

    Definition at line 106 of file hidboot.h.

    +

    Definition at line 106 of file hidboot.h.

    - + +

    ◆ @16

    +
    @@ -248,7 +244,9 @@ Public Attributes - + +

    ◆ bReserved

    +
    @@ -258,11 +256,13 @@ Public Attributes
    -

    Definition at line 108 of file hidboot.h.

    +

    Definition at line 108 of file hidboot.h.

    - + +

    ◆ Keys

    +
    @@ -272,7 +272,7 @@ Public Attributes
    -

    Definition at line 109 of file hidboot.h.

    +

    Definition at line 109 of file hidboot.h.

    @@ -284,7 +284,7 @@ Public Attributes diff --git a/struct_k_b_d_l_e_d_s-members.html b/struct_k_b_d_l_e_d_s-members.html index 1707fb36..cb91650d 100644 --- a/struct_k_b_d_l_e_d_s-members.html +++ b/struct_k_b_d_l_e_d_s-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 112 of file hidboot.h.

    +

    Definition at line 112 of file hidboot.h.

    Member Data Documentation

    - + +

    ◆ bmNumLock

    +
    @@ -123,11 +103,13 @@ Public Attributes
    -

    Definition at line 113 of file hidboot.h.

    +

    Definition at line 113 of file hidboot.h.

    - + +

    ◆ bmCapsLock

    +
    @@ -137,11 +119,13 @@ Public Attributes
    -

    Definition at line 114 of file hidboot.h.

    +

    Definition at line 114 of file hidboot.h.

    - + +

    ◆ bmScrollLock

    +
    @@ -151,11 +135,13 @@ Public Attributes
    -

    Definition at line 115 of file hidboot.h.

    +

    Definition at line 115 of file hidboot.h.

    - + +

    ◆ bmCompose

    +
    @@ -165,11 +151,13 @@ Public Attributes
    -

    Definition at line 116 of file hidboot.h.

    +

    Definition at line 116 of file hidboot.h.

    - + +

    ◆ bmKana

    +
    @@ -179,11 +167,13 @@ Public Attributes
    -

    Definition at line 117 of file hidboot.h.

    +

    Definition at line 117 of file hidboot.h.

    - + +

    ◆ bmReserved

    +
    @@ -193,7 +183,7 @@ Public Attributes
    -

    Definition at line 118 of file hidboot.h.

    +

    Definition at line 118 of file hidboot.h.

    @@ -205,7 +195,7 @@ Public Attributes diff --git a/struct_l_i_n_e___c_o_d_i_n_g-members.html b/struct_l_i_n_e___c_o_d_i_n_g-members.html index 7dafe26a..a938f9b3 100644 --- a/struct_l_i_n_e___c_o_d_i_n_g-members.html +++ b/struct_l_i_n_e___c_o_d_i_n_g-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 110 of file cdcacm.h.

    +

    Definition at line 110 of file cdcacm.h.

    Member Data Documentation

    - + +

    ◆ dwDTERate

    +
    @@ -119,11 +99,13 @@ Public Attributes
    -

    Definition at line 111 of file cdcacm.h.

    +

    Definition at line 111 of file cdcacm.h.

    - + +

    ◆ bCharFormat

    +
    @@ -133,11 +115,13 @@ Public Attributes
    -

    Definition at line 112 of file cdcacm.h.

    +

    Definition at line 112 of file cdcacm.h.

    - + +

    ◆ bParityType

    +
    @@ -147,11 +131,13 @@ Public Attributes
    -

    Definition at line 113 of file cdcacm.h.

    +

    Definition at line 113 of file cdcacm.h.

    - + +

    ◆ bDataBits

    +
    @@ -161,7 +147,7 @@ Public Attributes
    -

    Definition at line 114 of file cdcacm.h.

    +

    Definition at line 114 of file cdcacm.h.

    @@ -173,7 +159,7 @@ Public Attributes diff --git a/struct_m_o_d_i_f_i_e_r_k_e_y_s-members.html b/struct_m_o_d_i_f_i_e_r_k_e_y_s-members.html index 93ea9a8c..d7de6074 100644 --- a/struct_m_o_d_i_f_i_e_r_k_e_y_s-members.html +++ b/struct_m_o_d_i_f_i_e_r_k_e_y_s-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 85 of file hidboot.h.

    +

    Definition at line 85 of file hidboot.h.

    Member Data Documentation

    - + +

    ◆ bmLeftCtrl

    +
    @@ -127,11 +107,13 @@ Public Attributes
    -

    Definition at line 86 of file hidboot.h.

    +

    Definition at line 86 of file hidboot.h.

    - + +

    ◆ bmLeftShift

    +
    @@ -141,11 +123,13 @@ Public Attributes
    -

    Definition at line 87 of file hidboot.h.

    +

    Definition at line 87 of file hidboot.h.

    - + +

    ◆ bmLeftAlt

    +
    @@ -155,11 +139,13 @@ Public Attributes
    -

    Definition at line 88 of file hidboot.h.

    +

    Definition at line 88 of file hidboot.h.

    - + +

    ◆ bmLeftGUI

    +
    @@ -169,11 +155,13 @@ Public Attributes
    -

    Definition at line 89 of file hidboot.h.

    +

    Definition at line 89 of file hidboot.h.

    - + +

    ◆ bmRightCtrl

    +
    @@ -183,11 +171,13 @@ Public Attributes
    -

    Definition at line 90 of file hidboot.h.

    +

    Definition at line 90 of file hidboot.h.

    - + +

    ◆ bmRightShift

    +
    @@ -197,11 +187,13 @@ Public Attributes
    -

    Definition at line 91 of file hidboot.h.

    +

    Definition at line 91 of file hidboot.h.

    - + +

    ◆ bmRightAlt

    +
    @@ -211,11 +203,13 @@ Public Attributes
    -

    Definition at line 92 of file hidboot.h.

    +

    Definition at line 92 of file hidboot.h.

    - + +

    ◆ bmRightGUI

    +
    @@ -225,7 +219,7 @@ Public Attributes
    -

    Definition at line 93 of file hidboot.h.

    +

    Definition at line 93 of file hidboot.h.

    @@ -237,7 +231,7 @@ Public Attributes diff --git a/struct_m_o_u_s_e_i_n_f_o-members.html b/struct_m_o_u_s_e_i_n_f_o-members.html index 7cc47fe9..268ce954 100644 --- a/struct_m_o_u_s_e_i_n_f_o-members.html +++ b/struct_m_o_u_s_e_i_n_f_o-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 39 of file hidboot.h.

    +

    Definition at line 39 of file hidboot.h.

    Member Data Documentation

    - + +

    ◆ bmLeftButton

    +
    @@ -126,11 +106,13 @@ Public Attributes
    -

    Definition at line 42 of file hidboot.h.

    +

    Definition at line 42 of file hidboot.h.

    - + +

    ◆ bmRightButton

    +
    @@ -140,11 +122,13 @@ Public Attributes
    -

    Definition at line 43 of file hidboot.h.

    +

    Definition at line 43 of file hidboot.h.

    - + +

    ◆ bmMiddleButton

    +
    @@ -154,11 +138,13 @@ Public Attributes
    -

    Definition at line 44 of file hidboot.h.

    +

    Definition at line 44 of file hidboot.h.

    - + +

    ◆ bmDummy

    +
    @@ -168,11 +154,13 @@ Public Attributes
    -

    Definition at line 45 of file hidboot.h.

    +

    Definition at line 45 of file hidboot.h.

    - + +

    ◆ @13

    +
    @@ -184,7 +172,9 @@ Public Attributes - + +

    ◆ dX

    +
    @@ -194,11 +184,13 @@ Public Attributes
    -

    Definition at line 47 of file hidboot.h.

    +

    Definition at line 47 of file hidboot.h.

    - + +

    ◆ dY

    +
    @@ -208,7 +200,7 @@ Public Attributes
    -

    Definition at line 48 of file hidboot.h.

    +

    Definition at line 48 of file hidboot.h.

    @@ -220,7 +212,7 @@ Public Attributes diff --git a/struct_main_item_i_o_feature-members.html b/struct_main_item_i_o_feature-members.html index 8108492c..4e7f2c0e 100644 --- a/struct_main_item_i_o_feature-members.html +++ b/struct_main_item_i_o_feature-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 125 of file usbhid.h.

    +

    Definition at line 125 of file usbhid.h.

    Member Data Documentation

    - + +

    ◆ bmIsConstantOrData

    +
    @@ -127,11 +107,13 @@ Public Attributes
    -

    Definition at line 126 of file usbhid.h.

    +

    Definition at line 126 of file usbhid.h.

    - + +

    ◆ bmIsArrayOrVariable

    +
    @@ -141,11 +123,13 @@ Public Attributes
    -

    Definition at line 127 of file usbhid.h.

    +

    Definition at line 127 of file usbhid.h.

    - + +

    ◆ bmIsRelativeOrAbsolute

    +
    @@ -155,11 +139,13 @@ Public Attributes
    -

    Definition at line 128 of file usbhid.h.

    +

    Definition at line 128 of file usbhid.h.

    - + +

    ◆ bmIsWrapOrNoWrap

    +
    @@ -169,11 +155,13 @@ Public Attributes
    -

    Definition at line 129 of file usbhid.h.

    +

    Definition at line 129 of file usbhid.h.

    - + +

    ◆ bmIsNonLonearOrLinear

    +
    @@ -183,11 +171,13 @@ Public Attributes
    -

    Definition at line 130 of file usbhid.h.

    +

    Definition at line 130 of file usbhid.h.

    - + +

    ◆ bmIsNoPreferedOrPrefered

    +
    @@ -197,11 +187,13 @@ Public Attributes
    -

    Definition at line 131 of file usbhid.h.

    +

    Definition at line 131 of file usbhid.h.

    - + +

    ◆ bmIsNullOrNoNull

    +
    @@ -211,11 +203,13 @@ Public Attributes
    -

    Definition at line 132 of file usbhid.h.

    +

    Definition at line 132 of file usbhid.h.

    - + +

    ◆ bmIsVolatileOrNonVolatile

    +
    @@ -225,7 +219,7 @@ Public Attributes
    -

    Definition at line 133 of file usbhid.h.

    +

    Definition at line 133 of file usbhid.h.

    @@ -237,7 +231,7 @@ Public Attributes diff --git a/struct_multi_value_buffer-members.html b/struct_multi_value_buffer-members.html index 4ac32cd4..b27f87f9 100644 --- a/struct_multi_value_buffer-members.html +++ b/struct_multi_value_buffer-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 23 of file parsetools.h.

    +

    Definition at line 30 of file parsetools.h.

    Member Data Documentation

    - + +

    ◆ valueSize

    +
    @@ -115,11 +95,13 @@ Public Attributes
    -

    Definition at line 24 of file parsetools.h.

    +

    Definition at line 31 of file parsetools.h.

    - + +

    ◆ pValue

    +
    @@ -129,7 +111,7 @@ Public Attributes
    -

    Definition at line 25 of file parsetools.h.

    +

    Definition at line 32 of file parsetools.h.

    @@ -141,7 +123,7 @@ Public Attributes diff --git a/struct_p_s4_data-members.html b/struct_p_s4_data-members.html index cf9ff973..00dca17c 100644 --- a/struct_p_s4_data-members.html +++ b/struct_p_s4_data-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 92 of file PS4Parser.h.

    +

    Definition at line 92 of file PS4Parser.h.

    Member Data Documentation

    - + +

    ◆ hatValue

    +
    @@ -149,11 +129,13 @@ Public Attributes
    -

    Definition at line 94 of file PS4Parser.h.

    +

    Definition at line 94 of file PS4Parser.h.

    - + +

    ◆ btn

    +
    @@ -163,11 +145,13 @@ Public Attributes
    -

    Definition at line 95 of file PS4Parser.h.

    +

    Definition at line 95 of file PS4Parser.h.

    - + +

    ◆ trigger

    +
    @@ -177,11 +161,13 @@ Public Attributes
    -

    Definition at line 96 of file PS4Parser.h.

    +

    Definition at line 96 of file PS4Parser.h.

    - + +

    ◆ dummy

    +
    @@ -191,11 +177,13 @@ Public Attributes
    -

    Definition at line 99 of file PS4Parser.h.

    +

    Definition at line 99 of file PS4Parser.h.

    - + +

    ◆ gyroY

    +
    @@ -205,11 +193,13 @@ Public Attributes
    -

    Definition at line 100 of file PS4Parser.h.

    +

    Definition at line 100 of file PS4Parser.h.

    - + +

    ◆ gyroZ

    +
    @@ -219,11 +209,13 @@ Public Attributes
    -

    Definition at line 100 of file PS4Parser.h.

    +

    Definition at line 100 of file PS4Parser.h.

    - + +

    ◆ gyroX

    +
    @@ -233,11 +225,13 @@ Public Attributes
    -

    Definition at line 100 of file PS4Parser.h.

    +

    Definition at line 100 of file PS4Parser.h.

    - + +

    ◆ accX

    +
    @@ -247,11 +241,13 @@ Public Attributes
    -

    Definition at line 101 of file PS4Parser.h.

    +

    Definition at line 101 of file PS4Parser.h.

    - + +

    ◆ accZ

    +
    @@ -261,11 +257,13 @@ Public Attributes
    -

    Definition at line 101 of file PS4Parser.h.

    +

    Definition at line 101 of file PS4Parser.h.

    - + +

    ◆ accY

    +
    @@ -275,11 +273,13 @@ Public Attributes
    -

    Definition at line 101 of file PS4Parser.h.

    +

    Definition at line 101 of file PS4Parser.h.

    - + +

    ◆ dummy2

    +
    @@ -289,11 +289,13 @@ Public Attributes
    -

    Definition at line 103 of file PS4Parser.h.

    +

    Definition at line 103 of file PS4Parser.h.

    - + +

    ◆ status

    +
    @@ -303,11 +305,13 @@ Public Attributes
    -

    Definition at line 104 of file PS4Parser.h.

    +

    Definition at line 104 of file PS4Parser.h.

    - + +

    ◆ dummy3

    +
    @@ -317,11 +321,13 @@ Public Attributes
    -

    Definition at line 105 of file PS4Parser.h.

    +

    Definition at line 105 of file PS4Parser.h.

    - + +

    ◆ xy

    +
    @@ -331,7 +337,7 @@ Public Attributes
    -

    Definition at line 108 of file PS4Parser.h.

    +

    Definition at line 108 of file PS4Parser.h.

    @@ -343,7 +349,7 @@ Public Attributes diff --git a/struct_p_s4_data__coll__graph.png b/struct_p_s4_data__coll__graph.png index e6364653..a5971f9e 100644 Binary files a/struct_p_s4_data__coll__graph.png and b/struct_p_s4_data__coll__graph.png differ diff --git a/struct_p_s4_output-members.html b/struct_p_s4_output-members.html index 382b5f0b..ae475cd0 100644 --- a/struct_p_s4_output-members.html +++ b/struct_p_s4_output-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 116 of file PS4Parser.h.

    +

    Definition at line 116 of file PS4Parser.h.

    Member Data Documentation

    - + +

    ◆ bigRumble

    +
    @@ -127,11 +107,13 @@ Public Attributes
    -

    Definition at line 117 of file PS4Parser.h.

    +

    Definition at line 117 of file PS4Parser.h.

    - + +

    ◆ smallRumble

    +
    @@ -141,11 +123,13 @@ Public Attributes
    -

    Definition at line 117 of file PS4Parser.h.

    +

    Definition at line 117 of file PS4Parser.h.

    - + +

    ◆ r

    +
    @@ -155,11 +139,13 @@ Public Attributes
    -

    Definition at line 118 of file PS4Parser.h.

    +

    Definition at line 118 of file PS4Parser.h.

    - + +

    ◆ g

    +
    @@ -169,11 +155,13 @@ Public Attributes
    -

    Definition at line 118 of file PS4Parser.h.

    +

    Definition at line 118 of file PS4Parser.h.

    - + +

    ◆ b

    +
    @@ -183,11 +171,13 @@ Public Attributes
    -

    Definition at line 118 of file PS4Parser.h.

    +

    Definition at line 118 of file PS4Parser.h.

    - + +

    ◆ flashOn

    +
    @@ -197,11 +187,13 @@ Public Attributes
    -

    Definition at line 119 of file PS4Parser.h.

    +

    Definition at line 119 of file PS4Parser.h.

    - + +

    ◆ flashOff

    +
    @@ -211,11 +203,13 @@ Public Attributes
    -

    Definition at line 119 of file PS4Parser.h.

    +

    Definition at line 119 of file PS4Parser.h.

    - + +

    ◆ reportChanged

    +
    @@ -225,7 +219,7 @@ Public Attributes
    -

    Definition at line 120 of file PS4Parser.h.

    +

    Definition at line 120 of file PS4Parser.h.

    @@ -237,7 +231,7 @@ Public Attributes diff --git a/struct_p_s4_status-members.html b/struct_p_s4_status-members.html index 0e1b1830..71692bef 100644 --- a/struct_p_s4_status-members.html +++ b/struct_p_s4_status-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 84 of file PS4Parser.h.

    +

    Definition at line 84 of file PS4Parser.h.

    Member Data Documentation

    - + +

    ◆ battery

    +
    @@ -121,11 +101,13 @@ Public Attributes
    -

    Definition at line 85 of file PS4Parser.h.

    +

    Definition at line 85 of file PS4Parser.h.

    - + +

    ◆ usb

    +
    @@ -135,11 +117,13 @@ Public Attributes
    -

    Definition at line 86 of file PS4Parser.h.

    +

    Definition at line 86 of file PS4Parser.h.

    - + +

    ◆ audio

    +
    @@ -149,11 +133,13 @@ Public Attributes
    -

    Definition at line 87 of file PS4Parser.h.

    +

    Definition at line 87 of file PS4Parser.h.

    - + +

    ◆ mic

    +
    @@ -163,11 +149,13 @@ Public Attributes
    -

    Definition at line 88 of file PS4Parser.h.

    +

    Definition at line 88 of file PS4Parser.h.

    - + +

    ◆ unknown

    +
    @@ -177,7 +165,7 @@ Public Attributes
    -

    Definition at line 89 of file PS4Parser.h.

    +

    Definition at line 89 of file PS4Parser.h.

    @@ -189,7 +177,7 @@ Public Attributes diff --git a/struct_request_sense_responce-members.html b/struct_request_sense_responce-members.html index bd23f735..dcb05e15 100644 --- a/struct_request_sense_responce-members.html +++ b/struct_request_sense_responce-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 443 of file masstorage.h.

    +

    Definition at line 450 of file masstorage.h.

    Member Data Documentation

    - + +

    ◆ bResponseCode

    +
    @@ -139,11 +119,13 @@ Public Attributes
    -

    Definition at line 444 of file masstorage.h.

    +

    Definition at line 451 of file masstorage.h.

    - + +

    ◆ bSegmentNumber

    +
    @@ -153,11 +135,13 @@ Public Attributes
    -

    Definition at line 445 of file masstorage.h.

    +

    Definition at line 452 of file masstorage.h.

    - + +

    ◆ bmSenseKey

    +
    @@ -167,11 +151,13 @@ Public Attributes
    -

    Definition at line 447 of file masstorage.h.

    +

    Definition at line 454 of file masstorage.h.

    - + +

    ◆ bmReserved

    +
    @@ -181,11 +167,13 @@ Public Attributes
    -

    Definition at line 448 of file masstorage.h.

    +

    Definition at line 455 of file masstorage.h.

    - + +

    ◆ bmILI

    +
    @@ -195,11 +183,13 @@ Public Attributes
    -

    Definition at line 449 of file masstorage.h.

    +

    Definition at line 456 of file masstorage.h.

    - + +

    ◆ bmEOM

    +
    @@ -209,11 +199,13 @@ Public Attributes
    -

    Definition at line 450 of file masstorage.h.

    +

    Definition at line 457 of file masstorage.h.

    - + +

    ◆ bmFileMark

    +
    @@ -223,11 +215,13 @@ Public Attributes
    -

    Definition at line 451 of file masstorage.h.

    +

    Definition at line 458 of file masstorage.h.

    - + +

    ◆ Information

    +
    @@ -237,11 +231,13 @@ Public Attributes
    -

    Definition at line 453 of file masstorage.h.

    +

    Definition at line 460 of file masstorage.h.

    - + +

    ◆ bAdditionalLength

    +
    @@ -251,11 +247,13 @@ Public Attributes
    -

    Definition at line 454 of file masstorage.h.

    +

    Definition at line 461 of file masstorage.h.

    - + +

    ◆ CmdSpecificInformation

    +
    @@ -265,11 +263,13 @@ Public Attributes
    -

    Definition at line 455 of file masstorage.h.

    +

    Definition at line 462 of file masstorage.h.

    - + +

    ◆ bAdditionalSenseCode

    +
    @@ -279,11 +279,13 @@ Public Attributes
    -

    Definition at line 456 of file masstorage.h.

    +

    Definition at line 463 of file masstorage.h.

    - + +

    ◆ bAdditionalSenseQualifier

    +
    @@ -293,11 +295,13 @@ Public Attributes
    -

    Definition at line 457 of file masstorage.h.

    +

    Definition at line 464 of file masstorage.h.

    - + +

    ◆ bFieldReplaceableUnitCode

    +
    @@ -307,11 +311,13 @@ Public Attributes
    -

    Definition at line 458 of file masstorage.h.

    +

    Definition at line 465 of file masstorage.h.

    - + +

    ◆ SenseKeySpecific

    +
    @@ -321,7 +327,7 @@ Public Attributes
    -

    Definition at line 459 of file masstorage.h.

    +

    Definition at line 466 of file masstorage.h.

    @@ -333,7 +339,7 @@ Public Attributes diff --git a/struct_s_e_t_u_p___p_k_t-members.html b/struct_s_e_t_u_p___p_k_t-members.html index 4f1d228b..db5999e2 100644 --- a/struct_s_e_t_u_p___p_k_t-members.html +++ b/struct_s_e_t_u_p___p_k_t-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 163 of file UsbCore.h.

    +

    Definition at line 174 of file UsbCore.h.

    Member Data Documentation

    - + +

    ◆ bmRequestType

    +
    @@ -143,11 +123,13 @@ Public Attributes
    -

    Definition at line 166 of file UsbCore.h.

    +

    Definition at line 177 of file UsbCore.h.

    - + +

    ◆ recipient

    +
    @@ -157,11 +139,13 @@ Public Attributes
    -

    Definition at line 169 of file UsbCore.h.

    +

    Definition at line 180 of file UsbCore.h.

    - + +

    ◆ type

    +
    @@ -171,11 +155,13 @@ Public Attributes
    -

    Definition at line 170 of file UsbCore.h.

    +

    Definition at line 181 of file UsbCore.h.

    - + +

    ◆ direction

    +
    @@ -185,11 +171,13 @@ Public Attributes
    -

    Definition at line 171 of file UsbCore.h.

    +

    Definition at line 182 of file UsbCore.h.

    - + +

    ◆ ReqType_u

    +
    @@ -201,7 +189,9 @@ Public Attributes - + +

    ◆ bRequest

    +
    @@ -211,11 +201,13 @@ Public Attributes
    -

    Definition at line 174 of file UsbCore.h.

    +

    Definition at line 185 of file UsbCore.h.

    - + +

    ◆ wValue

    +
    @@ -225,11 +217,13 @@ Public Attributes
    -

    Definition at line 177 of file UsbCore.h.

    +

    Definition at line 188 of file UsbCore.h.

    - + +

    ◆ wValueLo

    +
    @@ -239,11 +233,13 @@ Public Attributes
    -

    Definition at line 180 of file UsbCore.h.

    +

    Definition at line 191 of file UsbCore.h.

    - + +

    ◆ wValueHi

    +
    @@ -253,11 +249,13 @@ Public Attributes
    -

    Definition at line 181 of file UsbCore.h.

    +

    Definition at line 192 of file UsbCore.h.

    - + +

    ◆ wVal_u

    +
    @@ -269,7 +267,9 @@ Public Attributes - + +

    ◆ wIndex

    +
    @@ -279,11 +279,13 @@ Public Attributes
    -

    Definition at line 184 of file UsbCore.h.

    +

    Definition at line 195 of file UsbCore.h.

    - + +

    ◆ wLength

    +
    @@ -293,7 +295,7 @@ Public Attributes
    -

    Definition at line 185 of file UsbCore.h.

    +

    Definition at line 196 of file UsbCore.h.

    @@ -305,7 +307,7 @@ Public Attributes diff --git a/struct_t_e_l___r_i_n_g_e_r___f_u_n_c___d_e_s_c_r-members.html b/struct_t_e_l___r_i_n_g_e_r___f_u_n_c___d_e_s_c_r-members.html index 6dda9fa1..291e9a2a 100644 --- a/struct_t_e_l___r_i_n_g_e_r___f_u_n_c___d_e_s_c_r-members.html +++ b/struct_t_e_l___r_i_n_g_e_r___f_u_n_c___d_e_s_c_r-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 102 of file cdcacm.h.

    +

    Definition at line 102 of file cdcacm.h.

    Member Data Documentation

    - + +

    ◆ bFunctionLength

    +
    @@ -121,11 +101,13 @@ Public Attributes
    -

    Definition at line 103 of file cdcacm.h.

    +

    Definition at line 103 of file cdcacm.h.

    - + +

    ◆ bDescriptorType

    +
    @@ -135,11 +117,13 @@ Public Attributes
    -

    Definition at line 104 of file cdcacm.h.

    +

    Definition at line 104 of file cdcacm.h.

    - + +

    ◆ bDescriptorSubtype

    +
    @@ -149,11 +133,13 @@ Public Attributes
    -

    Definition at line 105 of file cdcacm.h.

    +

    Definition at line 105 of file cdcacm.h.

    - + +

    ◆ bRingerVolSteps

    +
    @@ -163,11 +149,13 @@ Public Attributes
    -

    Definition at line 106 of file cdcacm.h.

    +

    Definition at line 106 of file cdcacm.h.

    - + +

    ◆ bNumRingerPatterns

    +
    @@ -177,7 +165,7 @@ Public Attributes
    -

    Definition at line 107 of file cdcacm.h.

    +

    Definition at line 107 of file cdcacm.h.

    @@ -189,7 +177,7 @@ Public Attributes diff --git a/struct_u_s_b___c_o_n_f_i_g_u_r_a_t_i_o_n___d_e_s_c_r_i_p_t_o_r-members.html b/struct_u_s_b___c_o_n_f_i_g_u_r_a_t_i_o_n___d_e_s_c_r_i_p_t_o_r-members.html index 59ba9816..c2cb54e3 100644 --- a/struct_u_s_b___c_o_n_f_i_g_u_r_a_t_i_o_n___d_e_s_c_r_i_p_t_o_r-members.html +++ b/struct_u_s_b___c_o_n_f_i_g_u_r_a_t_i_o_n___d_e_s_c_r_i_p_t_o_r-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 116 of file usb_ch9.h.

    +

    Definition at line 123 of file usb_ch9.h.

    Member Data Documentation

    - + +

    ◆ bLength

    +
    @@ -127,11 +107,13 @@ Public Attributes
    -

    Definition at line 117 of file usb_ch9.h.

    +

    Definition at line 124 of file usb_ch9.h.

    - + +

    ◆ bDescriptorType

    +
    @@ -141,11 +123,13 @@ Public Attributes
    -

    Definition at line 118 of file usb_ch9.h.

    +

    Definition at line 125 of file usb_ch9.h.

    - + +

    ◆ wTotalLength

    +
    @@ -155,11 +139,13 @@ Public Attributes
    -

    Definition at line 119 of file usb_ch9.h.

    +

    Definition at line 126 of file usb_ch9.h.

    - + +

    ◆ bNumInterfaces

    +
    @@ -169,11 +155,13 @@ Public Attributes
    -

    Definition at line 120 of file usb_ch9.h.

    +

    Definition at line 127 of file usb_ch9.h.

    - + +

    ◆ bConfigurationValue

    +
    @@ -183,11 +171,13 @@ Public Attributes
    -

    Definition at line 121 of file usb_ch9.h.

    +

    Definition at line 128 of file usb_ch9.h.

    - + +

    ◆ iConfiguration

    +
    @@ -197,11 +187,13 @@ Public Attributes
    -

    Definition at line 122 of file usb_ch9.h.

    +

    Definition at line 129 of file usb_ch9.h.

    - + +

    ◆ bmAttributes

    +
    @@ -211,11 +203,13 @@ Public Attributes
    -

    Definition at line 123 of file usb_ch9.h.

    +

    Definition at line 130 of file usb_ch9.h.

    - + +

    ◆ bMaxPower

    +
    @@ -225,7 +219,7 @@ Public Attributes
    -

    Definition at line 124 of file usb_ch9.h.

    +

    Definition at line 131 of file usb_ch9.h.

    @@ -237,7 +231,7 @@ Public Attributes diff --git a/struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r-members.html b/struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r-members.html index 95ee88f8..63c28fe1 100644 --- a/struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r-members.html +++ b/struct_u_s_b___d_e_v_i_c_e___d_e_s_c_r_i_p_t_o_r-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 98 of file usb_ch9.h.

    +

    Definition at line 105 of file usb_ch9.h.

    Member Data Documentation

    - + +

    ◆ bLength

    +
    @@ -139,11 +119,13 @@ Public Attributes
    -

    Definition at line 99 of file usb_ch9.h.

    +

    Definition at line 106 of file usb_ch9.h.

    - + +

    ◆ bDescriptorType

    +
    @@ -153,11 +135,13 @@ Public Attributes
    -

    Definition at line 100 of file usb_ch9.h.

    +

    Definition at line 107 of file usb_ch9.h.

    - + +

    ◆ bcdUSB

    +
    @@ -167,11 +151,13 @@ Public Attributes
    -

    Definition at line 101 of file usb_ch9.h.

    +

    Definition at line 108 of file usb_ch9.h.

    - + +

    ◆ bDeviceClass

    +
    @@ -181,11 +167,13 @@ Public Attributes
    -

    Definition at line 102 of file usb_ch9.h.

    +

    Definition at line 109 of file usb_ch9.h.

    - + +

    ◆ bDeviceSubClass

    +
    @@ -195,11 +183,13 @@ Public Attributes
    -

    Definition at line 103 of file usb_ch9.h.

    +

    Definition at line 110 of file usb_ch9.h.

    - + +

    ◆ bDeviceProtocol

    +
    @@ -209,11 +199,13 @@ Public Attributes
    -

    Definition at line 104 of file usb_ch9.h.

    +

    Definition at line 111 of file usb_ch9.h.

    - + +

    ◆ bMaxPacketSize0

    +
    @@ -223,11 +215,13 @@ Public Attributes
    -

    Definition at line 105 of file usb_ch9.h.

    +

    Definition at line 112 of file usb_ch9.h.

    - + +

    ◆ idVendor

    +
    @@ -237,11 +231,13 @@ Public Attributes
    -

    Definition at line 106 of file usb_ch9.h.

    +

    Definition at line 113 of file usb_ch9.h.

    - + +

    ◆ idProduct

    +
    @@ -251,11 +247,13 @@ Public Attributes
    -

    Definition at line 107 of file usb_ch9.h.

    +

    Definition at line 114 of file usb_ch9.h.

    - + +

    ◆ bcdDevice

    +
    @@ -265,11 +263,13 @@ Public Attributes
    -

    Definition at line 108 of file usb_ch9.h.

    +

    Definition at line 115 of file usb_ch9.h.

    - + +

    ◆ iManufacturer

    +
    @@ -279,11 +279,13 @@ Public Attributes
    -

    Definition at line 109 of file usb_ch9.h.

    +

    Definition at line 116 of file usb_ch9.h.

    - + +

    ◆ iProduct

    +
    @@ -293,11 +295,13 @@ Public Attributes
    -

    Definition at line 110 of file usb_ch9.h.

    +

    Definition at line 117 of file usb_ch9.h.

    - + +

    ◆ iSerialNumber

    +
    @@ -307,11 +311,13 @@ Public Attributes
    -

    Definition at line 111 of file usb_ch9.h.

    +

    Definition at line 118 of file usb_ch9.h.

    - + +

    ◆ bNumConfigurations

    +
    @@ -321,7 +327,7 @@ Public Attributes
    -

    Definition at line 112 of file usb_ch9.h.

    +

    Definition at line 119 of file usb_ch9.h.

    @@ -333,7 +339,7 @@ Public Attributes diff --git a/struct_u_s_b___e_n_d_p_o_i_n_t___d_e_s_c_r_i_p_t_o_r-members.html b/struct_u_s_b___e_n_d_p_o_i_n_t___d_e_s_c_r_i_p_t_o_r-members.html index b7fce74f..12dad84b 100644 --- a/struct_u_s_b___e_n_d_p_o_i_n_t___d_e_s_c_r_i_p_t_o_r-members.html +++ b/struct_u_s_b___e_n_d_p_o_i_n_t___d_e_s_c_r_i_p_t_o_r-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 141 of file usb_ch9.h.

    +

    Definition at line 148 of file usb_ch9.h.

    Member Data Documentation

    - + +

    ◆ bLength

    +
    @@ -123,11 +103,13 @@ Public Attributes
    -

    Definition at line 142 of file usb_ch9.h.

    +

    Definition at line 149 of file usb_ch9.h.

    - + +

    ◆ bDescriptorType

    +
    @@ -137,11 +119,13 @@ Public Attributes
    -

    Definition at line 143 of file usb_ch9.h.

    +

    Definition at line 150 of file usb_ch9.h.

    - + +

    ◆ bEndpointAddress

    +
    @@ -151,11 +135,13 @@ Public Attributes
    -

    Definition at line 144 of file usb_ch9.h.

    +

    Definition at line 151 of file usb_ch9.h.

    - + +

    ◆ bmAttributes

    +
    @@ -165,11 +151,13 @@ Public Attributes
    -

    Definition at line 145 of file usb_ch9.h.

    +

    Definition at line 152 of file usb_ch9.h.

    - + +

    ◆ wMaxPacketSize

    +
    @@ -179,11 +167,13 @@ Public Attributes
    -

    Definition at line 146 of file usb_ch9.h.

    +

    Definition at line 153 of file usb_ch9.h.

    - + +

    ◆ bInterval

    +
    @@ -193,7 +183,7 @@ Public Attributes
    -

    Definition at line 147 of file usb_ch9.h.

    +

    Definition at line 154 of file usb_ch9.h.

    @@ -205,7 +195,7 @@ Public Attributes diff --git a/struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r-members.html b/struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r-members.html index cdd9ca60..951f6328 100644 --- a/struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r-members.html +++ b/struct_u_s_b___h_i_d___d_e_s_c_r_i_p_t_o_r-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 151 of file usb_ch9.h.

    +

    Definition at line 158 of file usb_ch9.h.

    Member Data Documentation

    - + +

    ◆ bLength

    +
    @@ -125,11 +105,13 @@ Public Attributes
    -

    Definition at line 152 of file usb_ch9.h.

    +

    Definition at line 159 of file usb_ch9.h.

    - + +

    ◆ bDescriptorType

    +
    @@ -139,11 +121,13 @@ Public Attributes
    -

    Definition at line 153 of file usb_ch9.h.

    +

    Definition at line 160 of file usb_ch9.h.

    - + +

    ◆ bcdHID

    +
    @@ -153,11 +137,13 @@ Public Attributes
    -

    Definition at line 154 of file usb_ch9.h.

    +

    Definition at line 161 of file usb_ch9.h.

    - + +

    ◆ bCountryCode

    +
    @@ -167,11 +153,13 @@ Public Attributes
    -

    Definition at line 155 of file usb_ch9.h.

    +

    Definition at line 162 of file usb_ch9.h.

    - + +

    ◆ bNumDescriptors

    +
    @@ -181,11 +169,13 @@ Public Attributes
    -

    Definition at line 156 of file usb_ch9.h.

    +

    Definition at line 163 of file usb_ch9.h.

    - + +

    ◆ bDescrType

    +
    @@ -195,11 +185,13 @@ Public Attributes
    -

    Definition at line 157 of file usb_ch9.h.

    +

    Definition at line 164 of file usb_ch9.h.

    - + +

    ◆ wDescriptorLength

    +
    @@ -209,7 +201,7 @@ Public Attributes
    -

    Definition at line 158 of file usb_ch9.h.

    +

    Definition at line 165 of file usb_ch9.h.

    @@ -221,7 +213,7 @@ Public Attributes diff --git a/struct_u_s_b___i_n_t_e_r_f_a_c_e___d_e_s_c_r_i_p_t_o_r-members.html b/struct_u_s_b___i_n_t_e_r_f_a_c_e___d_e_s_c_r_i_p_t_o_r-members.html index 334d9cae..25f1e624 100644 --- a/struct_u_s_b___i_n_t_e_r_f_a_c_e___d_e_s_c_r_i_p_t_o_r-members.html +++ b/struct_u_s_b___i_n_t_e_r_f_a_c_e___d_e_s_c_r_i_p_t_o_r-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 128 of file usb_ch9.h.

    +

    Definition at line 135 of file usb_ch9.h.

    Member Data Documentation

    - + +

    ◆ bLength

    +
    @@ -129,11 +109,13 @@ Public Attributes
    -

    Definition at line 129 of file usb_ch9.h.

    +

    Definition at line 136 of file usb_ch9.h.

    - + +

    ◆ bDescriptorType

    +
    @@ -143,11 +125,13 @@ Public Attributes
    -

    Definition at line 130 of file usb_ch9.h.

    +

    Definition at line 137 of file usb_ch9.h.

    - + +

    ◆ bInterfaceNumber

    +
    @@ -157,11 +141,13 @@ Public Attributes
    -

    Definition at line 131 of file usb_ch9.h.

    +

    Definition at line 138 of file usb_ch9.h.

    - + +

    ◆ bAlternateSetting

    +
    @@ -171,11 +157,13 @@ Public Attributes
    -

    Definition at line 132 of file usb_ch9.h.

    +

    Definition at line 139 of file usb_ch9.h.

    - + +

    ◆ bNumEndpoints

    +
    @@ -185,11 +173,13 @@ Public Attributes
    -

    Definition at line 133 of file usb_ch9.h.

    +

    Definition at line 140 of file usb_ch9.h.

    - + +

    ◆ bInterfaceClass

    +
    @@ -199,11 +189,13 @@ Public Attributes
    -

    Definition at line 134 of file usb_ch9.h.

    +

    Definition at line 141 of file usb_ch9.h.

    - + +

    ◆ bInterfaceSubClass

    +
    @@ -213,11 +205,13 @@ Public Attributes
    -

    Definition at line 135 of file usb_ch9.h.

    +

    Definition at line 142 of file usb_ch9.h.

    - + +

    ◆ bInterfaceProtocol

    +
    @@ -227,11 +221,13 @@ Public Attributes
    -

    Definition at line 136 of file usb_ch9.h.

    +

    Definition at line 143 of file usb_ch9.h.

    - + +

    ◆ iInterface

    +
    @@ -241,7 +237,7 @@ Public Attributes
    -

    Definition at line 137 of file usb_ch9.h.

    +

    Definition at line 144 of file usb_ch9.h.

    @@ -253,7 +249,7 @@ Public Attributes diff --git a/struct_usb_device-members.html b/struct_usb_device-members.html index 701a10b5..33acd6bc 100644 --- a/struct_usb_device-members.html +++ b/struct_usb_device-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 75 of file address.h.

    +

    Definition at line 82 of file address.h.

    Member Data Documentation

    - + +

    ◆ epinfo

    +
    @@ -128,11 +108,13 @@ Public Attributes
    -

    Definition at line 76 of file address.h.

    +

    Definition at line 83 of file address.h.

    - + +

    ◆ address

    +
    @@ -142,11 +124,13 @@ Public Attributes
    -

    Definition at line 77 of file address.h.

    +

    Definition at line 84 of file address.h.

    - + +

    ◆ epcount

    +
    @@ -156,11 +140,13 @@ Public Attributes
    -

    Definition at line 78 of file address.h.

    +

    Definition at line 85 of file address.h.

    - + +

    ◆ lowspeed

    +
    @@ -170,7 +156,7 @@ Public Attributes
    -

    Definition at line 79 of file address.h.

    +

    Definition at line 86 of file address.h.

    @@ -182,7 +168,7 @@ Public Attributes diff --git a/struct_usb_device__coll__graph.png b/struct_usb_device__coll__graph.png index 69f3c0c5..fd96658c 100644 Binary files a/struct_usb_device__coll__graph.png and b/struct_usb_device__coll__graph.png differ diff --git a/struct_usb_device_address-members.html b/struct_usb_device_address-members.html index 3f257fb2..2723120c 100644 --- a/struct_usb_device_address-members.html +++ b/struct_usb_device_address-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 57 of file address.h.

    +

    Definition at line 64 of file address.h.

    Member Data Documentation

    - + +

    ◆ bmAddress

    +
    @@ -127,11 +107,13 @@ Public Attributes
    -

    Definition at line 62 of file address.h.

    +

    Definition at line 69 of file address.h.

    - + +

    ◆ bmParent

    +
    @@ -141,11 +123,13 @@ Public Attributes
    -

    Definition at line 63 of file address.h.

    +

    Definition at line 70 of file address.h.

    - + +

    ◆ bmHub

    +
    @@ -155,11 +139,13 @@ Public Attributes
    -

    Definition at line 64 of file address.h.

    +

    Definition at line 71 of file address.h.

    - + +

    ◆ bmReserved

    +
    @@ -169,11 +155,13 @@ Public Attributes
    -

    Definition at line 65 of file address.h.

    +

    Definition at line 72 of file address.h.

    - + +

    ◆ devAddress

    +
    @@ -183,11 +171,13 @@ Public Attributes
    -

    Definition at line 67 of file address.h.

    +

    Definition at line 74 of file address.h.

    - + +

    ◆ @5

    +
    @@ -207,7 +197,7 @@ Public Attributes diff --git a/structtouchpad_x_y-members.html b/structtouchpad_x_y-members.html index 151d9062..84e85e5d 100644 --- a/structtouchpad_x_y-members.html +++ b/structtouchpad_x_y-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 74 of file PS4Parser.h.

    +

    Definition at line 74 of file PS4Parser.h.

    Member Data Documentation

    - + +

    ◆ dummy

    +
    @@ -124,11 +104,13 @@ Public Attributes
    -

    Definition at line 75 of file PS4Parser.h.

    +

    Definition at line 75 of file PS4Parser.h.

    - + +

    ◆ counter

    +
    @@ -138,11 +120,13 @@ Public Attributes
    -

    Definition at line 77 of file PS4Parser.h.

    +

    Definition at line 77 of file PS4Parser.h.

    - + +

    ◆ touching

    +
    @@ -152,11 +136,13 @@ Public Attributes
    -

    Definition at line 78 of file PS4Parser.h.

    +

    Definition at line 78 of file PS4Parser.h.

    - + +

    ◆ x

    +
    @@ -166,11 +152,13 @@ Public Attributes
    -

    Definition at line 79 of file PS4Parser.h.

    +

    Definition at line 79 of file PS4Parser.h.

    - + +

    ◆ y

    +
    @@ -180,11 +168,13 @@ Public Attributes
    -

    Definition at line 80 of file PS4Parser.h.

    +

    Definition at line 80 of file PS4Parser.h.

    - + +

    ◆ finger

    +
    @@ -204,7 +194,7 @@ Public Attributes diff --git a/structtty__features-members.html b/structtty__features-members.html index 6d198531..e7a0ff22 100644 --- a/structtty__features-members.html +++ b/structtty__features-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    This structure is used to report the extended capabilities of the connected device. It is also used to report the current status. Regular CDC-ACM reports all as false.

    -

    Definition at line 143 of file cdcacm.h.

    +

    Definition at line 143 of file cdcacm.h.

    Member Data Documentation

    - + +

    ◆ tty

    +
    @@ -132,11 +112,13 @@ Public Attributes
    -

    Definition at line 146 of file cdcacm.h.

    +

    Definition at line 146 of file cdcacm.h.

    - + +

    ◆ enhanced

    +
    @@ -146,11 +128,13 @@ Public Attributes
    -

    Definition at line 149 of file cdcacm.h.

    +

    Definition at line 149 of file cdcacm.h.

    - + +

    ◆ wide

    +
    @@ -160,11 +144,13 @@ Public Attributes
    -

    Definition at line 152 of file cdcacm.h.

    +

    Definition at line 152 of file cdcacm.h.

    - + +

    ◆ autoflow_RTS

    +
    @@ -174,11 +160,13 @@ Public Attributes
    -

    Definition at line 153 of file cdcacm.h.

    +

    Definition at line 153 of file cdcacm.h.

    - + +

    ◆ autoflow_DSR

    +
    @@ -188,11 +176,13 @@ Public Attributes
    -

    Definition at line 154 of file cdcacm.h.

    +

    Definition at line 154 of file cdcacm.h.

    - + +

    ◆ autoflow_XON

    +
    @@ -202,11 +192,13 @@ Public Attributes
    -

    Definition at line 155 of file cdcacm.h.

    +

    Definition at line 155 of file cdcacm.h.

    - + +

    ◆ half_duplex

    +
    @@ -216,11 +208,13 @@ Public Attributes
    -

    Definition at line 156 of file cdcacm.h.

    +

    Definition at line 156 of file cdcacm.h.

    - + +

    ◆ @9

    +
    @@ -240,7 +234,7 @@ Public Attributes diff --git a/tabs.css b/tabs.css index 9cf578f2..a28614b8 100644 --- a/tabs.css +++ b/tabs.css @@ -1,60 +1 @@ -.tabs, .tabs2, .tabs3 { - background-image: url('tab_b.png'); - width: 100%; - z-index: 101; - font-size: 13px; - font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; -} - -.tabs2 { - font-size: 10px; -} -.tabs3 { - font-size: 9px; -} - -.tablist { - margin: 0; - padding: 0; - display: table; -} - -.tablist li { - float: left; - display: table-cell; - background-image: url('tab_b.png'); - line-height: 36px; - list-style: none; -} - -.tablist a { - display: block; - padding: 0 20px; - font-weight: bold; - background-image:url('tab_s.png'); - background-repeat:no-repeat; - background-position:right; - color: #283A5D; - text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); - text-decoration: none; - outline: none; -} - -.tabs3 .tablist a { - padding: 0 10px; -} - -.tablist a:hover { - background-image: url('tab_h.png'); - background-repeat:repeat-x; - color: #fff; - text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); - text-decoration: none; -} - -.tablist li.current a { - background-image: url('tab_a.png'); - background-repeat:repeat-x; - color: #fff; - text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); -} +.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#doc-content{overflow:auto;display:block;padding:0;margin:0;-webkit-overflow-scrolling:touch}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0 1px 1px rgba(255,255,255,0.9);color:#283a5d;outline:0}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace!important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283a5d transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;-moz-border-radius:0!important;-webkit-border-radius:0;border-radius:0!important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;-moz-border-radius:5px!important;-webkit-border-radius:5px;border-radius:5px!important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0!important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px!important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} \ No newline at end of file diff --git a/union_p_s4_buttons-members.html b/union_p_s4_buttons-members.html index 996295eb..b36010c8 100644 --- a/union_p_s4_buttons-members.html +++ b/union_p_s4_buttons-members.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    -

    Definition at line 50 of file PS4Parser.h.

    +

    Definition at line 50 of file PS4Parser.h.

    Member Data Documentation

    - + +

    ◆ dpad

    +
    @@ -148,11 +128,13 @@ Public Attributes
    -

    Definition at line 52 of file PS4Parser.h.

    +

    Definition at line 52 of file PS4Parser.h.

    - + +

    ◆ square

    +
    @@ -162,11 +144,13 @@ Public Attributes
    -

    Definition at line 53 of file PS4Parser.h.

    +

    Definition at line 53 of file PS4Parser.h.

    - + +

    ◆ cross

    +
    @@ -176,11 +160,13 @@ Public Attributes
    -

    Definition at line 54 of file PS4Parser.h.

    +

    Definition at line 54 of file PS4Parser.h.

    - + +

    ◆ circle

    +
    @@ -190,11 +176,13 @@ Public Attributes
    -

    Definition at line 55 of file PS4Parser.h.

    +

    Definition at line 55 of file PS4Parser.h.

    - + +

    ◆ triangle

    +
    @@ -204,11 +192,13 @@ Public Attributes
    -

    Definition at line 56 of file PS4Parser.h.

    +

    Definition at line 56 of file PS4Parser.h.

    - + +

    ◆ l1

    +
    @@ -218,11 +208,13 @@ Public Attributes
    -

    Definition at line 58 of file PS4Parser.h.

    +

    Definition at line 58 of file PS4Parser.h.

    - + +

    ◆ r1

    +
    @@ -232,11 +224,13 @@ Public Attributes
    -

    Definition at line 59 of file PS4Parser.h.

    +

    Definition at line 59 of file PS4Parser.h.

    - + +

    ◆ l2

    +
    @@ -246,11 +240,13 @@ Public Attributes
    -

    Definition at line 60 of file PS4Parser.h.

    +

    Definition at line 60 of file PS4Parser.h.

    - + +

    ◆ r2

    +
    @@ -260,11 +256,13 @@ Public Attributes
    -

    Definition at line 61 of file PS4Parser.h.

    +

    Definition at line 61 of file PS4Parser.h.

    - + +

    ◆ share

    +
    @@ -274,11 +272,13 @@ Public Attributes
    -

    Definition at line 62 of file PS4Parser.h.

    +

    Definition at line 62 of file PS4Parser.h.

    - + +

    ◆ options

    +
    @@ -288,11 +288,13 @@ Public Attributes
    -

    Definition at line 63 of file PS4Parser.h.

    +

    Definition at line 63 of file PS4Parser.h.

    - + +

    ◆ l3

    +
    @@ -302,11 +304,13 @@ Public Attributes
    -

    Definition at line 64 of file PS4Parser.h.

    +

    Definition at line 64 of file PS4Parser.h.

    - + +

    ◆ r3

    +
    @@ -316,11 +320,13 @@ Public Attributes
    -

    Definition at line 65 of file PS4Parser.h.

    +

    Definition at line 65 of file PS4Parser.h.

    - + +

    ◆ ps

    +
    @@ -330,11 +336,13 @@ Public Attributes
    -

    Definition at line 67 of file PS4Parser.h.

    +

    Definition at line 67 of file PS4Parser.h.

    - + +

    ◆ touchpad

    +
    @@ -344,11 +352,13 @@ Public Attributes
    -

    Definition at line 68 of file PS4Parser.h.

    +

    Definition at line 68 of file PS4Parser.h.

    - + +

    ◆ reportCounter

    +
    @@ -358,11 +368,13 @@ Public Attributes
    -

    Definition at line 69 of file PS4Parser.h.

    +

    Definition at line 69 of file PS4Parser.h.

    - + +

    ◆ @29

    +
    @@ -374,7 +386,9 @@ Public Attributes - + +

    ◆ val

    +
    @@ -384,7 +398,7 @@ Public Attributes
    -

    Definition at line 71 of file PS4Parser.h.

    +

    Definition at line 71 of file PS4Parser.h.

    @@ -396,7 +410,7 @@ Public Attributes diff --git a/union_p_s_b_u_z_z_buttons-members.html b/union_p_s_b_u_z_z_buttons-members.html index eb301e6c..4be22b46 100644 --- a/union_p_s_b_u_z_z_buttons-members.html +++ b/union_p_s_b_u_z_z_buttons-members.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: Member List @@ -11,9 +12,6 @@ - @@ -32,42 +30,22 @@
    - + - - + + + + - + - - + + + +

    Detailed Description

    Struct used to easily read the different buttons on the controllers

    -

    Definition at line 28 of file PSBuzz.h.

    +

    Definition at line 28 of file PSBuzz.h.

    Member Data Documentation

    - + +

    ◆ red

    +
    @@ -127,11 +107,13 @@ Public Attributes
    -

    Definition at line 30 of file PSBuzz.h.

    +

    Definition at line 30 of file PSBuzz.h.

    - + +

    ◆ yellow

    +
    @@ -141,11 +123,13 @@ Public Attributes
    -

    Definition at line 31 of file PSBuzz.h.

    +

    Definition at line 31 of file PSBuzz.h.

    - + +

    ◆ green

    +
    @@ -155,11 +139,13 @@ Public Attributes
    -

    Definition at line 32 of file PSBuzz.h.

    +

    Definition at line 32 of file PSBuzz.h.

    - + +

    ◆ orange

    +
    @@ -169,11 +155,13 @@ Public Attributes
    -

    Definition at line 33 of file PSBuzz.h.

    +

    Definition at line 33 of file PSBuzz.h.

    - + +

    ◆ blue

    +
    @@ -183,11 +171,13 @@ Public Attributes
    -

    Definition at line 34 of file PSBuzz.h.

    +

    Definition at line 34 of file PSBuzz.h.

    - + +

    ◆ btn

    +
    @@ -199,7 +189,9 @@ Public Attributes - + +

    ◆ val

    +
    @@ -209,7 +201,7 @@ Public Attributes
    -

    Definition at line 36 of file PSBuzz.h.

    +

    Definition at line 36 of file PSBuzz.h.

    @@ -221,7 +213,7 @@ Public Attributes diff --git a/usb__ch9_8h.html b/usb__ch9_8h.html index 5576dabc..8bb29335 100644 --- a/usb__ch9_8h.html +++ b/usb__ch9_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usb_ch9.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
     

    Macro Definition Documentation

    - + +

    ◆ DEV_DESCR_LEN

    +
    @@ -221,11 +203,13 @@ Macros
    -

    Definition at line 26 of file usb_ch9.h.

    +

    Definition at line 33 of file usb_ch9.h.

    - + +

    ◆ CONF_DESCR_LEN

    +
    @@ -235,11 +219,13 @@ Macros
    -

    Definition at line 27 of file usb_ch9.h.

    +

    Definition at line 34 of file usb_ch9.h.

    - + +

    ◆ INTR_DESCR_LEN

    +
    @@ -249,11 +235,13 @@ Macros
    -

    Definition at line 28 of file usb_ch9.h.

    +

    Definition at line 35 of file usb_ch9.h.

    - + +

    ◆ EP_DESCR_LEN

    +
    @@ -263,11 +251,13 @@ Macros
    -

    Definition at line 29 of file usb_ch9.h.

    +

    Definition at line 36 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_GET_STATUS

    +
    @@ -277,11 +267,13 @@ Macros
    -

    Definition at line 33 of file usb_ch9.h.

    +

    Definition at line 40 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_CLEAR_FEATURE

    +
    @@ -291,11 +283,13 @@ Macros
    -

    Definition at line 34 of file usb_ch9.h.

    +

    Definition at line 41 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_SET_FEATURE

    +
    @@ -305,11 +299,13 @@ Macros
    -

    Definition at line 35 of file usb_ch9.h.

    +

    Definition at line 42 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_SET_ADDRESS

    +
    @@ -319,11 +315,13 @@ Macros
    -

    Definition at line 36 of file usb_ch9.h.

    +

    Definition at line 43 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_GET_DESCRIPTOR

    +
    @@ -333,11 +331,13 @@ Macros
    -

    Definition at line 37 of file usb_ch9.h.

    +

    Definition at line 44 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_SET_DESCRIPTOR

    +
    @@ -347,11 +347,13 @@ Macros
    -

    Definition at line 38 of file usb_ch9.h.

    +

    Definition at line 45 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_GET_CONFIGURATION

    +
    @@ -361,11 +363,13 @@ Macros
    -

    Definition at line 39 of file usb_ch9.h.

    +

    Definition at line 46 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_SET_CONFIGURATION

    +
    @@ -375,11 +379,13 @@ Macros
    -

    Definition at line 40 of file usb_ch9.h.

    +

    Definition at line 47 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_GET_INTERFACE

    +
    @@ -389,11 +395,13 @@ Macros
    -

    Definition at line 41 of file usb_ch9.h.

    +

    Definition at line 48 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_SET_INTERFACE

    +
    @@ -403,11 +411,13 @@ Macros
    -

    Definition at line 42 of file usb_ch9.h.

    +

    Definition at line 49 of file usb_ch9.h.

    - + +

    ◆ USB_REQUEST_SYNCH_FRAME

    +
    @@ -417,11 +427,13 @@ Macros
    -

    Definition at line 43 of file usb_ch9.h.

    +

    Definition at line 50 of file usb_ch9.h.

    - + +

    ◆ USB_FEATURE_ENDPOINT_HALT

    +
    @@ -431,11 +443,13 @@ Macros
    -

    Definition at line 45 of file usb_ch9.h.

    +

    Definition at line 52 of file usb_ch9.h.

    - + +

    ◆ USB_FEATURE_DEVICE_REMOTE_WAKEUP [1/2]

    +
    @@ -445,11 +459,13 @@ Macros
    -

    Definition at line 92 of file usb_ch9.h.

    +

    Definition at line 99 of file usb_ch9.h.

    - + +

    ◆ USB_FEATURE_TEST_MODE [1/2]

    +
    @@ -459,11 +475,13 @@ Macros
    -

    Definition at line 93 of file usb_ch9.h.

    +

    Definition at line 100 of file usb_ch9.h.

    - + +

    ◆ USB_SETUP_HOST_TO_DEVICE

    +
    @@ -473,11 +491,13 @@ Macros
    -

    Definition at line 51 of file usb_ch9.h.

    +

    Definition at line 58 of file usb_ch9.h.

    - + +

    ◆ USB_SETUP_DEVICE_TO_HOST

    +
    @@ -487,11 +507,13 @@ Macros
    -

    Definition at line 52 of file usb_ch9.h.

    +

    Definition at line 59 of file usb_ch9.h.

    - + +

    ◆ USB_SETUP_TYPE_STANDARD

    +
    @@ -501,11 +523,13 @@ Macros
    -

    Definition at line 53 of file usb_ch9.h.

    +

    Definition at line 60 of file usb_ch9.h.

    - + +

    ◆ USB_SETUP_TYPE_CLASS

    +
    @@ -515,11 +539,13 @@ Macros
    -

    Definition at line 54 of file usb_ch9.h.

    +

    Definition at line 61 of file usb_ch9.h.

    - + +

    ◆ USB_SETUP_TYPE_VENDOR

    +
    @@ -529,11 +555,13 @@ Macros
    -

    Definition at line 55 of file usb_ch9.h.

    +

    Definition at line 62 of file usb_ch9.h.

    - + +

    ◆ USB_SETUP_RECIPIENT_DEVICE

    +
    @@ -543,11 +571,13 @@ Macros
    -

    Definition at line 56 of file usb_ch9.h.

    +

    Definition at line 63 of file usb_ch9.h.

    - + +

    ◆ USB_SETUP_RECIPIENT_INTERFACE

    +
    @@ -557,11 +587,13 @@ Macros
    -

    Definition at line 57 of file usb_ch9.h.

    +

    Definition at line 64 of file usb_ch9.h.

    - + +

    ◆ USB_SETUP_RECIPIENT_ENDPOINT

    +
    @@ -571,11 +603,13 @@ Macros
    -

    Definition at line 58 of file usb_ch9.h.

    +

    Definition at line 65 of file usb_ch9.h.

    - + +

    ◆ USB_SETUP_RECIPIENT_OTHER

    +
    @@ -585,11 +619,13 @@ Macros
    -

    Definition at line 59 of file usb_ch9.h.

    +

    Definition at line 66 of file usb_ch9.h.

    - + +

    ◆ USB_DESCRIPTOR_DEVICE

    +
    @@ -599,11 +635,13 @@ Macros
    -

    Definition at line 63 of file usb_ch9.h.

    +

    Definition at line 70 of file usb_ch9.h.

    - + +

    ◆ USB_DESCRIPTOR_CONFIGURATION

    +
    @@ -613,11 +651,13 @@ Macros
    -

    Definition at line 64 of file usb_ch9.h.

    +

    Definition at line 71 of file usb_ch9.h.

    - + +

    ◆ USB_DESCRIPTOR_STRING

    +
    @@ -627,11 +667,13 @@ Macros
    -

    Definition at line 65 of file usb_ch9.h.

    +

    Definition at line 72 of file usb_ch9.h.

    - + +

    ◆ USB_DESCRIPTOR_INTERFACE

    +
    @@ -641,11 +683,13 @@ Macros
    -

    Definition at line 66 of file usb_ch9.h.

    +

    Definition at line 73 of file usb_ch9.h.

    - + +

    ◆ USB_DESCRIPTOR_ENDPOINT

    +
    @@ -655,11 +699,13 @@ Macros
    -

    Definition at line 67 of file usb_ch9.h.

    +

    Definition at line 74 of file usb_ch9.h.

    - + +

    ◆ USB_DESCRIPTOR_DEVICE_QUALIFIER

    +
    @@ -669,11 +715,13 @@ Macros
    -

    Definition at line 68 of file usb_ch9.h.

    +

    Definition at line 75 of file usb_ch9.h.

    - + +

    ◆ USB_DESCRIPTOR_OTHER_SPEED

    +
    @@ -683,11 +731,13 @@ Macros
    -

    Definition at line 69 of file usb_ch9.h.

    +

    Definition at line 76 of file usb_ch9.h.

    - + +

    ◆ USB_DESCRIPTOR_INTERFACE_POWER

    +
    @@ -697,11 +747,13 @@ Macros
    -

    Definition at line 70 of file usb_ch9.h.

    +

    Definition at line 77 of file usb_ch9.h.

    - + +

    ◆ USB_DESCRIPTOR_OTG

    +
    @@ -711,11 +763,13 @@ Macros
    -

    Definition at line 71 of file usb_ch9.h.

    +

    Definition at line 78 of file usb_ch9.h.

    - + +

    ◆ HID_DESCRIPTOR_HID

    +
    @@ -725,11 +779,13 @@ Macros
    -

    Definition at line 73 of file usb_ch9.h.

    +

    Definition at line 80 of file usb_ch9.h.

    - + +

    ◆ OTG_FEATURE_B_HNP_ENABLE

    +
    @@ -739,11 +795,13 @@ Macros
    -

    Definition at line 78 of file usb_ch9.h.

    +

    Definition at line 85 of file usb_ch9.h.

    - + +

    ◆ OTG_FEATURE_A_HNP_SUPPORT

    +
    @@ -753,11 +811,13 @@ Macros
    -

    Definition at line 79 of file usb_ch9.h.

    +

    Definition at line 86 of file usb_ch9.h.

    - + +

    ◆ OTG_FEATURE_A_ALT_HNP_SUPPORT

    +
    @@ -767,11 +827,13 @@ Macros
    -

    Definition at line 80 of file usb_ch9.h.

    +

    Definition at line 87 of file usb_ch9.h.

    - + +

    ◆ USB_TRANSFER_TYPE_CONTROL

    +
    @@ -781,11 +843,13 @@ Macros
    -

    Definition at line 83 of file usb_ch9.h.

    +

    Definition at line 90 of file usb_ch9.h.

    - + +

    ◆ USB_TRANSFER_TYPE_ISOCHRONOUS

    +
    @@ -795,11 +859,13 @@ Macros
    -

    Definition at line 84 of file usb_ch9.h.

    +

    Definition at line 91 of file usb_ch9.h.

    - + +

    ◆ USB_TRANSFER_TYPE_BULK

    +
    @@ -809,11 +875,13 @@ Macros
    -

    Definition at line 85 of file usb_ch9.h.

    +

    Definition at line 92 of file usb_ch9.h.

    - + +

    ◆ USB_TRANSFER_TYPE_INTERRUPT

    +
    @@ -823,11 +891,13 @@ Macros
    -

    Definition at line 86 of file usb_ch9.h.

    +

    Definition at line 93 of file usb_ch9.h.

    - + +

    ◆ bmUSB_TRANSFER_TYPE

    +
    @@ -837,11 +907,13 @@ Macros
    -

    Definition at line 87 of file usb_ch9.h.

    +

    Definition at line 94 of file usb_ch9.h.

    - + +

    ◆ USB_FEATURE_ENDPOINT_STALL

    +
    @@ -851,11 +923,13 @@ Macros
    -

    Definition at line 91 of file usb_ch9.h.

    +

    Definition at line 98 of file usb_ch9.h.

    - + +

    ◆ USB_FEATURE_DEVICE_REMOTE_WAKEUP [2/2]

    +
    @@ -865,11 +939,13 @@ Macros
    -

    Definition at line 92 of file usb_ch9.h.

    +

    Definition at line 99 of file usb_ch9.h.

    - + +

    ◆ USB_FEATURE_TEST_MODE [2/2]

    +
    @@ -879,7 +955,7 @@ Macros
    -

    Definition at line 93 of file usb_ch9.h.

    +

    Definition at line 100 of file usb_ch9.h.

    @@ -888,7 +964,7 @@ Macros diff --git a/usb__ch9_8h_source.html b/usb__ch9_8h_source.html index 483dd4f3..fb5505e6 100644 --- a/usb__ch9_8h_source.html +++ b/usb__ch9_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usb_ch9.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    usb_ch9.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(_usb_h_) || defined(_ch9_h_)
    19 #error "Never include usb_ch9.h directly; include Usb.h instead"
    20 #else
    21 
    22 /* USB chapter 9 structures */
    23 #define _ch9_h_
    24 
    25 /* Misc.USB constants */
    26 #define DEV_DESCR_LEN 18 //device descriptor length
    27 #define CONF_DESCR_LEN 9 //configuration descriptor length
    28 #define INTR_DESCR_LEN 9 //interface descriptor length
    29 #define EP_DESCR_LEN 7 //endpoint descriptor length
    30 
    31 /* Standard Device Requests */
    32 
    33 #define USB_REQUEST_GET_STATUS 0 // Standard Device Request - GET STATUS
    34 #define USB_REQUEST_CLEAR_FEATURE 1 // Standard Device Request - CLEAR FEATURE
    35 #define USB_REQUEST_SET_FEATURE 3 // Standard Device Request - SET FEATURE
    36 #define USB_REQUEST_SET_ADDRESS 5 // Standard Device Request - SET ADDRESS
    37 #define USB_REQUEST_GET_DESCRIPTOR 6 // Standard Device Request - GET DESCRIPTOR
    38 #define USB_REQUEST_SET_DESCRIPTOR 7 // Standard Device Request - SET DESCRIPTOR
    39 #define USB_REQUEST_GET_CONFIGURATION 8 // Standard Device Request - GET CONFIGURATION
    40 #define USB_REQUEST_SET_CONFIGURATION 9 // Standard Device Request - SET CONFIGURATION
    41 #define USB_REQUEST_GET_INTERFACE 10 // Standard Device Request - GET INTERFACE
    42 #define USB_REQUEST_SET_INTERFACE 11 // Standard Device Request - SET INTERFACE
    43 #define USB_REQUEST_SYNCH_FRAME 12 // Standard Device Request - SYNCH FRAME
    44 
    45 #define USB_FEATURE_ENDPOINT_HALT 0 // CLEAR/SET FEATURE - Endpoint Halt
    46 #define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1 // CLEAR/SET FEATURE - Device remote wake-up
    47 #define USB_FEATURE_TEST_MODE 2 // CLEAR/SET FEATURE - Test mode
    48 
    49 /* Setup Data Constants */
    50 
    51 #define USB_SETUP_HOST_TO_DEVICE 0x00 // Device Request bmRequestType transfer direction - host to device transfer
    52 #define USB_SETUP_DEVICE_TO_HOST 0x80 // Device Request bmRequestType transfer direction - device to host transfer
    53 #define USB_SETUP_TYPE_STANDARD 0x00 // Device Request bmRequestType type - standard
    54 #define USB_SETUP_TYPE_CLASS 0x20 // Device Request bmRequestType type - class
    55 #define USB_SETUP_TYPE_VENDOR 0x40 // Device Request bmRequestType type - vendor
    56 #define USB_SETUP_RECIPIENT_DEVICE 0x00 // Device Request bmRequestType recipient - device
    57 #define USB_SETUP_RECIPIENT_INTERFACE 0x01 // Device Request bmRequestType recipient - interface
    58 #define USB_SETUP_RECIPIENT_ENDPOINT 0x02 // Device Request bmRequestType recipient - endpoint
    59 #define USB_SETUP_RECIPIENT_OTHER 0x03 // Device Request bmRequestType recipient - other
    60 
    61 /* USB descriptors */
    62 
    63 #define USB_DESCRIPTOR_DEVICE 0x01 // bDescriptorType for a Device Descriptor.
    64 #define USB_DESCRIPTOR_CONFIGURATION 0x02 // bDescriptorType for a Configuration Descriptor.
    65 #define USB_DESCRIPTOR_STRING 0x03 // bDescriptorType for a String Descriptor.
    66 #define USB_DESCRIPTOR_INTERFACE 0x04 // bDescriptorType for an Interface Descriptor.
    67 #define USB_DESCRIPTOR_ENDPOINT 0x05 // bDescriptorType for an Endpoint Descriptor.
    68 #define USB_DESCRIPTOR_DEVICE_QUALIFIER 0x06 // bDescriptorType for a Device Qualifier.
    69 #define USB_DESCRIPTOR_OTHER_SPEED 0x07 // bDescriptorType for a Other Speed Configuration.
    70 #define USB_DESCRIPTOR_INTERFACE_POWER 0x08 // bDescriptorType for Interface Power.
    71 #define USB_DESCRIPTOR_OTG 0x09 // bDescriptorType for an OTG Descriptor.
    72 
    73 #define HID_DESCRIPTOR_HID 0x21
    74 
    75 
    76 
    77 /* OTG SET FEATURE Constants */
    78 #define OTG_FEATURE_B_HNP_ENABLE 3 // SET FEATURE OTG - Enable B device to perform HNP
    79 #define OTG_FEATURE_A_HNP_SUPPORT 4 // SET FEATURE OTG - A device supports HNP
    80 #define OTG_FEATURE_A_ALT_HNP_SUPPORT 5 // SET FEATURE OTG - Another port on the A device supports HNP
    81 
    82 /* USB Endpoint Transfer Types */
    83 #define USB_TRANSFER_TYPE_CONTROL 0x00 // Endpoint is a control endpoint.
    84 #define USB_TRANSFER_TYPE_ISOCHRONOUS 0x01 // Endpoint is an isochronous endpoint.
    85 #define USB_TRANSFER_TYPE_BULK 0x02 // Endpoint is a bulk endpoint.
    86 #define USB_TRANSFER_TYPE_INTERRUPT 0x03 // Endpoint is an interrupt endpoint.
    87 #define bmUSB_TRANSFER_TYPE 0x03 // bit mask to separate transfer type from ISO attributes
    88 
    89 
    90 /* Standard Feature Selectors for CLEAR_FEATURE Requests */
    91 #define USB_FEATURE_ENDPOINT_STALL 0 // Endpoint recipient
    92 #define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1 // Device recipient
    93 #define USB_FEATURE_TEST_MODE 2 // Device recipient
    94 
    95 /* descriptor data structures */
    96 
    97 /* Device descriptor structure */
    98 typedef struct {
    99  uint8_t bLength; // Length of this descriptor.
    100  uint8_t bDescriptorType; // DEVICE descriptor type (USB_DESCRIPTOR_DEVICE).
    101  uint16_t bcdUSB; // USB Spec Release Number (BCD).
    102  uint8_t bDeviceClass; // Class code (assigned by the USB-IF). 0xFF-Vendor specific.
    103  uint8_t bDeviceSubClass; // Subclass code (assigned by the USB-IF).
    104  uint8_t bDeviceProtocol; // Protocol code (assigned by the USB-IF). 0xFF-Vendor specific.
    105  uint8_t bMaxPacketSize0; // Maximum packet size for endpoint 0.
    106  uint16_t idVendor; // Vendor ID (assigned by the USB-IF).
    107  uint16_t idProduct; // Product ID (assigned by the manufacturer).
    108  uint16_t bcdDevice; // Device release number (BCD).
    109  uint8_t iManufacturer; // Index of String Descriptor describing the manufacturer.
    110  uint8_t iProduct; // Index of String Descriptor describing the product.
    111  uint8_t iSerialNumber; // Index of String Descriptor with the device's serial number.
    112  uint8_t bNumConfigurations; // Number of possible configurations.
    113 } __attribute__((packed)) USB_DEVICE_DESCRIPTOR;
    114 
    115 /* Configuration descriptor structure */
    116 typedef struct {
    117  uint8_t bLength; // Length of this descriptor.
    118  uint8_t bDescriptorType; // CONFIGURATION descriptor type (USB_DESCRIPTOR_CONFIGURATION).
    119  uint16_t wTotalLength; // Total length of all descriptors for this configuration.
    120  uint8_t bNumInterfaces; // Number of interfaces in this configuration.
    121  uint8_t bConfigurationValue; // Value of this configuration (1 based).
    122  uint8_t iConfiguration; // Index of String Descriptor describing the configuration.
    123  uint8_t bmAttributes; // Configuration characteristics.
    124  uint8_t bMaxPower; // Maximum power consumed by this configuration.
    125 } __attribute__((packed)) USB_CONFIGURATION_DESCRIPTOR;
    126 
    127 /* Interface descriptor structure */
    128 typedef struct {
    129  uint8_t bLength; // Length of this descriptor.
    130  uint8_t bDescriptorType; // INTERFACE descriptor type (USB_DESCRIPTOR_INTERFACE).
    131  uint8_t bInterfaceNumber; // Number of this interface (0 based).
    132  uint8_t bAlternateSetting; // Value of this alternate interface setting.
    133  uint8_t bNumEndpoints; // Number of endpoints in this interface.
    134  uint8_t bInterfaceClass; // Class code (assigned by the USB-IF). 0xFF-Vendor specific.
    135  uint8_t bInterfaceSubClass; // Subclass code (assigned by the USB-IF).
    136  uint8_t bInterfaceProtocol; // Protocol code (assigned by the USB-IF). 0xFF-Vendor specific.
    137  uint8_t iInterface; // Index of String Descriptor describing the interface.
    138 } __attribute__((packed)) USB_INTERFACE_DESCRIPTOR;
    139 
    140 /* Endpoint descriptor structure */
    141 typedef struct {
    142  uint8_t bLength; // Length of this descriptor.
    143  uint8_t bDescriptorType; // ENDPOINT descriptor type (USB_DESCRIPTOR_ENDPOINT).
    144  uint8_t bEndpointAddress; // Endpoint address. Bit 7 indicates direction (0=OUT, 1=IN).
    145  uint8_t bmAttributes; // Endpoint transfer type.
    146  uint16_t wMaxPacketSize; // Maximum packet size.
    147  uint8_t bInterval; // Polling interval in frames.
    148 } __attribute__((packed)) USB_ENDPOINT_DESCRIPTOR;
    149 
    150 /* HID descriptor */
    151 typedef struct {
    152  uint8_t bLength;
    154  uint16_t bcdHID; // HID class specification release
    155  uint8_t bCountryCode;
    156  uint8_t bNumDescriptors; // Number of additional class specific descriptors
    157  uint8_t bDescrType; // Type of class descriptor
    158  uint16_t wDescriptorLength; // Total size of the Report descriptor
    159 } __attribute__((packed)) USB_HID_DESCRIPTOR;
    160 
    161 typedef struct {
    162  uint8_t bDescrType; // Type of class descriptor
    163  uint16_t wDescriptorLength; // Total size of the Report descriptor
    164 } __attribute__((packed)) HID_CLASS_DESCRIPTOR_LEN_AND_TYPE;
    165 
    166 #endif // _ch9_h_
    -
    uint8_t iSerialNumber
    Definition: usb_ch9.h:111
    - - -
    uint16_t bcdDevice
    Definition: usb_ch9.h:108
    - - - - -
    uint8_t bMaxPacketSize0
    Definition: usb_ch9.h:105
    - - - -
    uint8_t bLength
    Definition: usb_ch9.h:152
    - - - - - - - - - -
    uint8_t bDeviceSubClass
    Definition: usb_ch9.h:103
    -
    uint16_t wDescriptorLength
    Definition: usb_ch9.h:158
    - -
    uint8_t bCountryCode
    Definition: usb_ch9.h:155
    -
    uint16_t wMaxPacketSize
    Definition: usb_ch9.h:146
    -
    uint8_t iManufacturer
    Definition: usb_ch9.h:109
    - -
    uint8_t bNumDescriptors
    Definition: usb_ch9.h:156
    -
    uint8_t bEndpointAddress
    Definition: usb_ch9.h:144
    -
    uint8_t bDescriptorType
    Definition: usb_ch9.h:153
    -
    uint8_t bDeviceClass
    Definition: usb_ch9.h:102
    - - - - -
    uint16_t idProduct
    Definition: usb_ch9.h:107
    - - -
    uint8_t bNumConfigurations
    Definition: usb_ch9.h:112
    - - -
    uint8_t bDescriptorType
    Definition: usb_ch9.h:100
    -
    uint8_t bInterfaceSubClass
    Definition: usb_ch9.h:135
    -
    uint8_t bDeviceProtocol
    Definition: usb_ch9.h:104
    -
    uint16_t bcdHID
    Definition: usb_ch9.h:154
    -
    uint8_t bInterfaceProtocol
    Definition: usb_ch9.h:136
    -
    uint8_t bDescrType
    Definition: usb_ch9.h:157
    - - +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 
    25 #if !defined(_usb_h_) || defined(_ch9_h_)
    26 #error "Never include usb_ch9.h directly; include Usb.h instead"
    27 #else
    28 
    29 /* USB chapter 9 structures */
    30 #define _ch9_h_
    31 
    32 /* Misc.USB constants */
    33 #define DEV_DESCR_LEN 18 //device descriptor length
    34 #define CONF_DESCR_LEN 9 //configuration descriptor length
    35 #define INTR_DESCR_LEN 9 //interface descriptor length
    36 #define EP_DESCR_LEN 7 //endpoint descriptor length
    37 
    38 /* Standard Device Requests */
    39 
    40 #define USB_REQUEST_GET_STATUS 0 // Standard Device Request - GET STATUS
    41 #define USB_REQUEST_CLEAR_FEATURE 1 // Standard Device Request - CLEAR FEATURE
    42 #define USB_REQUEST_SET_FEATURE 3 // Standard Device Request - SET FEATURE
    43 #define USB_REQUEST_SET_ADDRESS 5 // Standard Device Request - SET ADDRESS
    44 #define USB_REQUEST_GET_DESCRIPTOR 6 // Standard Device Request - GET DESCRIPTOR
    45 #define USB_REQUEST_SET_DESCRIPTOR 7 // Standard Device Request - SET DESCRIPTOR
    46 #define USB_REQUEST_GET_CONFIGURATION 8 // Standard Device Request - GET CONFIGURATION
    47 #define USB_REQUEST_SET_CONFIGURATION 9 // Standard Device Request - SET CONFIGURATION
    48 #define USB_REQUEST_GET_INTERFACE 10 // Standard Device Request - GET INTERFACE
    49 #define USB_REQUEST_SET_INTERFACE 11 // Standard Device Request - SET INTERFACE
    50 #define USB_REQUEST_SYNCH_FRAME 12 // Standard Device Request - SYNCH FRAME
    51 
    52 #define USB_FEATURE_ENDPOINT_HALT 0 // CLEAR/SET FEATURE - Endpoint Halt
    53 #define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1 // CLEAR/SET FEATURE - Device remote wake-up
    54 #define USB_FEATURE_TEST_MODE 2 // CLEAR/SET FEATURE - Test mode
    55 
    56 /* Setup Data Constants */
    57 
    58 #define USB_SETUP_HOST_TO_DEVICE 0x00 // Device Request bmRequestType transfer direction - host to device transfer
    59 #define USB_SETUP_DEVICE_TO_HOST 0x80 // Device Request bmRequestType transfer direction - device to host transfer
    60 #define USB_SETUP_TYPE_STANDARD 0x00 // Device Request bmRequestType type - standard
    61 #define USB_SETUP_TYPE_CLASS 0x20 // Device Request bmRequestType type - class
    62 #define USB_SETUP_TYPE_VENDOR 0x40 // Device Request bmRequestType type - vendor
    63 #define USB_SETUP_RECIPIENT_DEVICE 0x00 // Device Request bmRequestType recipient - device
    64 #define USB_SETUP_RECIPIENT_INTERFACE 0x01 // Device Request bmRequestType recipient - interface
    65 #define USB_SETUP_RECIPIENT_ENDPOINT 0x02 // Device Request bmRequestType recipient - endpoint
    66 #define USB_SETUP_RECIPIENT_OTHER 0x03 // Device Request bmRequestType recipient - other
    67 
    68 /* USB descriptors */
    69 
    70 #define USB_DESCRIPTOR_DEVICE 0x01 // bDescriptorType for a Device Descriptor.
    71 #define USB_DESCRIPTOR_CONFIGURATION 0x02 // bDescriptorType for a Configuration Descriptor.
    72 #define USB_DESCRIPTOR_STRING 0x03 // bDescriptorType for a String Descriptor.
    73 #define USB_DESCRIPTOR_INTERFACE 0x04 // bDescriptorType for an Interface Descriptor.
    74 #define USB_DESCRIPTOR_ENDPOINT 0x05 // bDescriptorType for an Endpoint Descriptor.
    75 #define USB_DESCRIPTOR_DEVICE_QUALIFIER 0x06 // bDescriptorType for a Device Qualifier.
    76 #define USB_DESCRIPTOR_OTHER_SPEED 0x07 // bDescriptorType for a Other Speed Configuration.
    77 #define USB_DESCRIPTOR_INTERFACE_POWER 0x08 // bDescriptorType for Interface Power.
    78 #define USB_DESCRIPTOR_OTG 0x09 // bDescriptorType for an OTG Descriptor.
    79 
    80 #define HID_DESCRIPTOR_HID 0x21
    81 
    82 
    83 
    84 /* OTG SET FEATURE Constants */
    85 #define OTG_FEATURE_B_HNP_ENABLE 3 // SET FEATURE OTG - Enable B device to perform HNP
    86 #define OTG_FEATURE_A_HNP_SUPPORT 4 // SET FEATURE OTG - A device supports HNP
    87 #define OTG_FEATURE_A_ALT_HNP_SUPPORT 5 // SET FEATURE OTG - Another port on the A device supports HNP
    88 
    89 /* USB Endpoint Transfer Types */
    90 #define USB_TRANSFER_TYPE_CONTROL 0x00 // Endpoint is a control endpoint.
    91 #define USB_TRANSFER_TYPE_ISOCHRONOUS 0x01 // Endpoint is an isochronous endpoint.
    92 #define USB_TRANSFER_TYPE_BULK 0x02 // Endpoint is a bulk endpoint.
    93 #define USB_TRANSFER_TYPE_INTERRUPT 0x03 // Endpoint is an interrupt endpoint.
    94 #define bmUSB_TRANSFER_TYPE 0x03 // bit mask to separate transfer type from ISO attributes
    95 
    96 
    97 /* Standard Feature Selectors for CLEAR_FEATURE Requests */
    98 #define USB_FEATURE_ENDPOINT_STALL 0 // Endpoint recipient
    99 #define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1 // Device recipient
    100 #define USB_FEATURE_TEST_MODE 2 // Device recipient
    101 
    102 /* descriptor data structures */
    103 
    104 /* Device descriptor structure */
    105 typedef struct {
    106  uint8_t bLength; // Length of this descriptor.
    107  uint8_t bDescriptorType; // DEVICE descriptor type (USB_DESCRIPTOR_DEVICE).
    108  uint16_t bcdUSB; // USB Spec Release Number (BCD).
    109  uint8_t bDeviceClass; // Class code (assigned by the USB-IF). 0xFF-Vendor specific.
    110  uint8_t bDeviceSubClass; // Subclass code (assigned by the USB-IF).
    111  uint8_t bDeviceProtocol; // Protocol code (assigned by the USB-IF). 0xFF-Vendor specific.
    112  uint8_t bMaxPacketSize0; // Maximum packet size for endpoint 0.
    113  uint16_t idVendor; // Vendor ID (assigned by the USB-IF).
    114  uint16_t idProduct; // Product ID (assigned by the manufacturer).
    115  uint16_t bcdDevice; // Device release number (BCD).
    116  uint8_t iManufacturer; // Index of String Descriptor describing the manufacturer.
    117  uint8_t iProduct; // Index of String Descriptor describing the product.
    118  uint8_t iSerialNumber; // Index of String Descriptor with the device's serial number.
    119  uint8_t bNumConfigurations; // Number of possible configurations.
    120 } __attribute__((packed)) USB_DEVICE_DESCRIPTOR;
    121 
    122 /* Configuration descriptor structure */
    123 typedef struct {
    124  uint8_t bLength; // Length of this descriptor.
    125  uint8_t bDescriptorType; // CONFIGURATION descriptor type (USB_DESCRIPTOR_CONFIGURATION).
    126  uint16_t wTotalLength; // Total length of all descriptors for this configuration.
    127  uint8_t bNumInterfaces; // Number of interfaces in this configuration.
    128  uint8_t bConfigurationValue; // Value of this configuration (1 based).
    129  uint8_t iConfiguration; // Index of String Descriptor describing the configuration.
    130  uint8_t bmAttributes; // Configuration characteristics.
    131  uint8_t bMaxPower; // Maximum power consumed by this configuration.
    132 } __attribute__((packed)) USB_CONFIGURATION_DESCRIPTOR;
    133 
    134 /* Interface descriptor structure */
    135 typedef struct {
    136  uint8_t bLength; // Length of this descriptor.
    137  uint8_t bDescriptorType; // INTERFACE descriptor type (USB_DESCRIPTOR_INTERFACE).
    138  uint8_t bInterfaceNumber; // Number of this interface (0 based).
    139  uint8_t bAlternateSetting; // Value of this alternate interface setting.
    140  uint8_t bNumEndpoints; // Number of endpoints in this interface.
    141  uint8_t bInterfaceClass; // Class code (assigned by the USB-IF). 0xFF-Vendor specific.
    142  uint8_t bInterfaceSubClass; // Subclass code (assigned by the USB-IF).
    143  uint8_t bInterfaceProtocol; // Protocol code (assigned by the USB-IF). 0xFF-Vendor specific.
    144  uint8_t iInterface; // Index of String Descriptor describing the interface.
    145 } __attribute__((packed)) USB_INTERFACE_DESCRIPTOR;
    146 
    147 /* Endpoint descriptor structure */
    148 typedef struct {
    149  uint8_t bLength; // Length of this descriptor.
    150  uint8_t bDescriptorType; // ENDPOINT descriptor type (USB_DESCRIPTOR_ENDPOINT).
    151  uint8_t bEndpointAddress; // Endpoint address. Bit 7 indicates direction (0=OUT, 1=IN).
    152  uint8_t bmAttributes; // Endpoint transfer type.
    153  uint16_t wMaxPacketSize; // Maximum packet size.
    154  uint8_t bInterval; // Polling interval in frames.
    155 } __attribute__((packed)) USB_ENDPOINT_DESCRIPTOR;
    156 
    157 /* HID descriptor */
    158 typedef struct {
    159  uint8_t bLength;
    161  uint16_t bcdHID; // HID class specification release
    162  uint8_t bCountryCode;
    163  uint8_t bNumDescriptors; // Number of additional class specific descriptors
    164  uint8_t bDescrType; // Type of class descriptor
    165  uint16_t wDescriptorLength; // Total size of the Report descriptor
    166 } __attribute__((packed)) USB_HID_DESCRIPTOR;
    167 
    168 typedef struct {
    169  uint8_t bDescrType; // Type of class descriptor
    170  uint16_t wDescriptorLength; // Total size of the Report descriptor
    171 } __attribute__((packed)) HID_CLASS_DESCRIPTOR_LEN_AND_TYPE;
    172 
    173 #endif // _ch9_h_
    +
    uint8_t iSerialNumber
    Definition: usb_ch9.h:118
    + + +
    uint16_t bcdDevice
    Definition: usb_ch9.h:115
    + + + + +
    uint8_t bMaxPacketSize0
    Definition: usb_ch9.h:112
    + + + +
    uint8_t bLength
    Definition: usb_ch9.h:159
    + + + + + + + + + +
    uint8_t bDeviceSubClass
    Definition: usb_ch9.h:110
    +
    uint16_t wDescriptorLength
    Definition: usb_ch9.h:165
    + +
    uint8_t bCountryCode
    Definition: usb_ch9.h:162
    +
    uint16_t wMaxPacketSize
    Definition: usb_ch9.h:153
    +
    uint8_t iManufacturer
    Definition: usb_ch9.h:116
    + +
    uint8_t bNumDescriptors
    Definition: usb_ch9.h:163
    +
    uint8_t bEndpointAddress
    Definition: usb_ch9.h:151
    +
    uint8_t bDescriptorType
    Definition: usb_ch9.h:160
    +
    uint8_t bDeviceClass
    Definition: usb_ch9.h:109
    + + + + +
    uint16_t idProduct
    Definition: usb_ch9.h:114
    + + +
    uint8_t bNumConfigurations
    Definition: usb_ch9.h:119
    + + +
    uint8_t bDescriptorType
    Definition: usb_ch9.h:107
    +
    uint8_t bInterfaceSubClass
    Definition: usb_ch9.h:142
    +
    uint8_t bDeviceProtocol
    Definition: usb_ch9.h:111
    +
    uint16_t bcdHID
    Definition: usb_ch9.h:161
    +
    uint8_t bInterfaceProtocol
    Definition: usb_ch9.h:143
    +
    uint8_t bDescrType
    Definition: usb_ch9.h:164
    + +
    diff --git a/usbh__midi_8cpp.html b/usbh__midi_8cpp.html index 89132932..d1f7ae5f 100644 --- a/usbh__midi_8cpp.html +++ b/usbh__midi_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbh_midi.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    diff --git a/usbh__midi_8cpp__incl.md5 b/usbh__midi_8cpp__incl.md5 index 6ddfc77d..65155a0e 100644 --- a/usbh__midi_8cpp__incl.md5 +++ b/usbh__midi_8cpp__incl.md5 @@ -1 +1 @@ -cf6b83d7ef453c74c82055514ca06b47 \ No newline at end of file +70cb9efaeaec1fbcbedbdc63920456c9 \ No newline at end of file diff --git a/usbh__midi_8cpp__incl.png b/usbh__midi_8cpp__incl.png index 672967f0..f22ee6bb 100644 Binary files a/usbh__midi_8cpp__incl.png and b/usbh__midi_8cpp__incl.png differ diff --git a/usbh__midi_8cpp_source.html b/usbh__midi_8cpp_source.html index dca6d080..5af81072 100644 --- a/usbh__midi_8cpp_source.html +++ b/usbh__midi_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbh_midi.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    usbh_midi.cpp
    -Go to the documentation of this file.
    1 /*
    2  *******************************************************************************
    3  * USB-MIDI class driver for USB Host Shield 2.0 Library
    4  * Copyright (c) 2012-2016 Yuuichi Akagawa
    5  *
    6  * Idea from LPK25 USB-MIDI to Serial MIDI converter
    7  * by Collin Cunningham - makezine.com, narbotic.com
    8  *
    9  * for use with USB Host Shield 2.0 from Circuitsathome.com
    10  * https://github.com/felis/USB_Host_Shield_2.0
    11  *******************************************************************************
    12  * This program is free software; you can redistribute it and/or modify
    13  * it under the terms of the GNU General Public License as published by
    14  * the Free Software Foundation; either version 2 of the License, or
    15  * (at your option) any later version.
    16  *
    17  * This program is distributed in the hope that it will be useful,
    18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20  * GNU General Public License for more details.
    21  *
    22  * You should have received a copy of the GNU General Public License
    23  * along with this program. If not, see <http://www.gnu.org/licenses/>
    24  *******************************************************************************
    25  */
    26 
    27 #include "usbh_midi.h"
    29 // MIDI MESAGES
    30 // midi.org/techspecs/
    32 // STATUS BYTES
    33 // 0x8n == noteOff
    34 // 0x9n == noteOn
    35 // 0xAn == afterTouch
    36 // 0xBn == controlChange
    37 // n == Channel(0x0-0xf)
    39 //DATA BYTE 1
    40 // note# == (0-127)
    41 // or
    42 // control# == (0-119)
    44 // DATA BYTE 2
    45 // velocity == (0-127)
    46 // or
    47 // controlVal == (0-127)
    49 // USB-MIDI Event Packets
    50 // usb.org - Universal Serial Bus Device Class Definition for MIDI Devices 1.0
    52 //+-------------+-------------+-------------+-------------+
    53 //| Byte 0 | Byte 1 | Byte 2 | Byte 3 |
    54 //+------+------+-------------+-------------+-------------+
    55 //|Cable | Code | | | |
    56 //|Number|Index | MIDI_0 | MIDI_1 | MIDI_2 |
    57 //| |Number| | | |
    58 //|(4bit)|(4bit)| (8bit) | (8bit) | (8bit) |
    59 //+------+------+-------------+-------------+-------------+
    60 // CN == 0x0-0xf
    61 //+-----+-----------+-------------------------------------------------------------------
    62 //| CIN |MIDI_x size|Description
    63 //+-----+-----------+-------------------------------------------------------------------
    64 //| 0x0 | 1, 2 or 3 |Miscellaneous function codes. Reserved for future extensions.
    65 //| 0x1 | 1, 2 or 3 |Cable events. Reserved for future expansion.
    66 //| 0x2 | 2 |Two-byte System Common messages like MTC, SongSelect, etc.
    67 //| 0x3 | 3 |Three-byte System Common messages like SPP, etc.
    68 //| 0x4 | 3 |SysEx starts or continues
    69 //| 0x5 | 1 |Single-byte System Common Message or SysEx ends with following single byte.
    70 //| 0x6 | 2 |SysEx ends with following two bytes.
    71 //| 0x7 | 3 |SysEx ends with following three bytes.
    72 //| 0x8 | 3 |Note-off
    73 //| 0x9 | 3 |Note-on
    74 //| 0xA | 3 |Poly-KeyPress
    75 //| 0xB | 3 |Control Change
    76 //| 0xC | 2 |Program Change
    77 //| 0xD | 2 |Channel Pressure
    78 //| 0xE | 3 |PitchBend Change
    79 //| 0xF | 1 |Single Byte
    80 //+-----+-----------+-------------------------------------------------------------------
    81 
    82 const uint8_t USBH_MIDI::epDataInIndex = 1;
    83 const uint8_t USBH_MIDI::epDataOutIndex = 2;
    84 const uint8_t USBH_MIDI::epDataInIndexVSP = 3;
    85 const uint8_t USBH_MIDI::epDataOutIndexVSP = 4;
    86 
    88 pUsb(p),
    89 bAddress(0),
    90 bNumEP(1),
    91 bPollEnable(false),
    92 isMidiFound(false),
    93 readPtr(0) {
    94  // initialize endpoint data structures
    95  for(uint8_t i=0; i<MIDI_MAX_ENDPOINTS; i++) {
    96  epInfo[i].epAddr = 0;
    97  epInfo[i].maxPktSize = (i) ? 0 : 8;
    98  epInfo[i].epAttribs = 0;
    99 // epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
    100  epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : 4;
    101 
    102  }
    103  // register in USB subsystem
    104  if (pUsb) {
    105  pUsb->RegisterDeviceClass(this);
    106  }
    107 }
    108 
    109 /* Connection initialization of an MIDI Device */
    110 uint8_t USBH_MIDI::Init(uint8_t parent, uint8_t port, bool lowspeed)
    111 {
    112  uint8_t buf[DESC_BUFF_SIZE];
    113  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
    114  uint8_t rcode;
    115  UsbDevice *p = NULL;
    116  EpInfo *oldep_ptr = NULL;
    117  uint8_t num_of_conf; // number of configurations
    118 
    119  // get memory address of USB device address pool
    120  AddressPool &addrPool = pUsb->GetAddressPool();
    121 #ifdef DEBUG_USB_HOST
    122  USBTRACE("\rMIDI Init\r\n");
    123 #endif
    124  // check if address has already been assigned to an instance
    125  if (bAddress) {
    127  }
    128  // Get pointer to pseudo device with address 0 assigned
    129  p = addrPool.GetUsbDevicePtr(bAddress);
    130  if (!p) {
    132  }
    133  if (!p->epinfo) {
    135  }
    136 
    137  // Save old pointer to EP_RECORD of address 0
    138  oldep_ptr = p->epinfo;
    139 
    140  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
    141  p->epinfo = epInfo;
    142  p->lowspeed = lowspeed;
    143 
    144  // Get device descriptor
    145  rcode = pUsb->getDevDescr( 0, 0, sizeof(USB_DEVICE_DESCRIPTOR), (uint8_t*)buf );
    146  vid = udd->idVendor;
    147  pid = udd->idProduct;
    148  // Restore p->epinfo
    149  p->epinfo = oldep_ptr;
    150 
    151  if( rcode ){
    152  goto FailGetDevDescr;
    153  }
    154 
    155  // Allocate new address according to device class
    156  bAddress = addrPool.AllocAddress(parent, false, port);
    157  if (!bAddress) {
    159  }
    160 
    161  // Extract Max Packet Size from device descriptor
    163 
    164  // Assign new address to the device
    165  rcode = pUsb->setAddr( 0, 0, bAddress );
    166  if (rcode) {
    167  p->lowspeed = false;
    168  addrPool.FreeAddress(bAddress);
    169  bAddress = 0;
    170  return rcode;
    171  }//if (rcode...
    172 #ifdef DEBUG_USB_HOST
    173  USBTRACE2("Addr:", bAddress);
    174 #endif
    175  p->lowspeed = false;
    176 
    177  //get pointer to assigned address record
    178  p = addrPool.GetUsbDevicePtr(bAddress);
    179  if (!p) {
    181  }
    182  p->lowspeed = lowspeed;
    183 
    184  num_of_conf = udd->bNumConfigurations;
    185 
    186  // Assign epInfo to epinfo pointer
    187  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
    188  if (rcode) {
    189 #ifdef DEBUG_USB_HOST
    190  USBTRACE("setEpInfoEntry failed");
    191 #endif
    192  goto FailSetDevTblEntry;
    193  }
    194 #ifdef DEBUG_USB_HOST
    195  USBTRACE2("NC:", num_of_conf);
    196 #endif
    197  for (uint8_t i=0; i<num_of_conf; i++) {
    199  if (bNumEP > 1)
    200  break;
    201  } // for
    202 #ifdef DEBUG_USB_HOST
    203  USBTRACE2("NumEP:", bNumEP);
    204 #endif
    205  if( bConfNum == 0 ){ //Device not found.
    206  goto FailGetConfDescr;
    207  }
    208 
    209  if( !isMidiFound ){ //MIDI Device not found. Try first Bulk transfer device
    214  }
    215 
    216  // Assign epInfo to epinfo pointer
    218 #ifdef DEBUG_USB_HOST
    219  USBTRACE2("Conf:", bConfNum);
    220 #endif
    221  // Set Configuration Value
    222  rcode = pUsb->setConf(bAddress, 0, bConfNum);
    223  if (rcode) {
    224  goto FailSetConfDescr;
    225  }
    226 #ifdef DEBUG_USB_HOST
    227  USBTRACE("Init done.");
    228 #endif
    229  bPollEnable = true;
    230  return 0;
    231 FailGetDevDescr:
    232 FailSetDevTblEntry:
    233 FailGetConfDescr:
    234 FailSetConfDescr:
    235  Release();
    236  return rcode;
    237 }
    238 
    239 /* get and parse config descriptor */
    240 void USBH_MIDI::parseConfigDescr( byte addr, byte conf )
    241 {
    242  uint8_t buf[ DESC_BUFF_SIZE ];
    243  uint8_t* buf_ptr = buf;
    244  byte rcode;
    245  byte descr_length;
    246  byte descr_type;
    247  unsigned int total_length;
    248  USB_ENDPOINT_DESCRIPTOR *epDesc;
    249  boolean isMidi = false;
    250 
    251  // get configuration descriptor (get descriptor size only)
    252  rcode = pUsb->getConfDescr( addr, 0, 4, conf, buf );
    253  if( rcode ){
    254  return;
    255  }
    256  total_length = buf[2] | ((int)buf[3] << 8);
    257  if( total_length > DESC_BUFF_SIZE ) { //check if total length is larger than buffer
    258  total_length = DESC_BUFF_SIZE;
    259  }
    260 
    261  // get configuration descriptor (all)
    262  rcode = pUsb->getConfDescr( addr, 0, total_length, conf, buf ); //get the whole descriptor
    263  if( rcode ){
    264  return;
    265  }
    266 
    267  //parsing descriptors
    268  while( buf_ptr < buf + total_length ) {
    269  descr_length = *( buf_ptr );
    270  descr_type = *( buf_ptr + 1 );
    271  switch( descr_type ) {
    273  bConfNum = buf_ptr[5];
    274  break;
    276  if( buf_ptr[5] == USB_CLASS_AUDIO && buf_ptr[6] == USB_SUBCLASS_MIDISTREAMING ) { //p[5]; bInterfaceClass = 1(Audio), p[6]; bInterfaceSubClass = 3(MIDI Streaming)
    277  isMidiFound = true; //MIDI device found.
    278  isMidi = true;
    279  }else{
    280 #ifdef DEBUG_USB_HOST
    281  USBTRACE("No MIDI Device\n");
    282 #endif
    283  isMidi = false;
    284  }
    285  break;
    287  epDesc = (USB_ENDPOINT_DESCRIPTOR *)buf_ptr;
    288  if ((epDesc->bmAttributes & 0x02) == 2) {//bulk
    289  uint8_t index;
    290  if( isMidi )
    291  index = ((epDesc->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
    292  else
    293  index = ((epDesc->bEndpointAddress & 0x80) == 0x80) ? epDataInIndexVSP : epDataOutIndexVSP;
    294  epInfo[index].epAddr = (epDesc->bEndpointAddress & 0x0F);
    295  epInfo[index].maxPktSize = (uint8_t)epDesc->wMaxPacketSize;
    296  bNumEP ++;
    297 #ifdef DEBUG_USB_HOST
    298  PrintEndpointDescriptor(epDesc);
    299 #endif
    300  }
    301  break;
    302  default:
    303  break;
    304  }//switch( descr_type
    305  buf_ptr += descr_length; //advance buffer pointer
    306  }//while( buf_ptr <=...
    307 }
    308 
    309 /* Performs a cleanup after failed Init() attempt */
    311 {
    313  bNumEP = 1; //must have to be reset to 1
    314  bAddress = 0;
    315  bPollEnable = false;
    316  readPtr = 0;
    317  return 0;
    318 }
    319 
    320 /* Receive data from MIDI device */
    321 uint8_t USBH_MIDI::RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
    322 {
    323  *bytes_rcvd = (uint16_t)epInfo[epDataInIndex].maxPktSize;
    324  uint8_t r = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
    325 
    326  if( *bytes_rcvd < (MIDI_EVENT_PACKET_SIZE-4)){
    327  dataptr[*bytes_rcvd] = '\0';
    328  dataptr[(*bytes_rcvd)+1] = '\0';
    329  }
    330  return r;
    331 }
    332 
    333 /* Receive data from MIDI device */
    334 uint8_t USBH_MIDI::RecvData(uint8_t *outBuf)
    335 {
    336  byte rcode = 0; //return code
    337  uint16_t rcvd;
    338 
    339  if( bPollEnable == false ) return false;
    340 
    341  //Checking unprocessed message in buffer.
    342  if( readPtr != 0 && readPtr < MIDI_EVENT_PACKET_SIZE ){
    343  if(recvBuf[readPtr] == 0 && recvBuf[readPtr+1] == 0) {
    344  //no unprocessed message left in the buffer.
    345  }else{
    346  goto RecvData_return_from_buffer;
    347  }
    348  }
    349 
    350  readPtr = 0;
    351  rcode = RecvData( &rcvd, recvBuf);
    352  if( rcode != 0 ) {
    353  return 0;
    354  }
    355 
    356  //if all data is zero, no valid data received.
    357  if( recvBuf[0] == 0 && recvBuf[1] == 0 && recvBuf[2] == 0 && recvBuf[3] == 0 ) {
    358  return 0;
    359  }
    360 
    361 RecvData_return_from_buffer:
    362  readPtr++;
    363  outBuf[0] = recvBuf[readPtr];
    364  readPtr++;
    365  outBuf[1] = recvBuf[readPtr];
    366  readPtr++;
    367  outBuf[2] = recvBuf[readPtr];
    368  readPtr++;
    369  return lookupMsgSize(outBuf[0]);
    370 }
    371 
    372 /* Send data to MIDI device */
    373 uint8_t USBH_MIDI::SendData(uint8_t *dataptr, byte nCable)
    374 {
    375  byte buf[4];
    376  byte msg;
    377 
    378  msg = dataptr[0];
    379  // SysEx long message ?
    380  if( msg == 0xf0 )
    381  {
    382  return SendSysEx(dataptr, countSysExDataSize(dataptr), nCable);
    383  }
    384 
    385  buf[0] = (nCable << 4) | (msg >> 4);
    386  if( msg < 0xf0 ) msg = msg & 0xf0;
    387 
    388 
    389  //Building USB-MIDI Event Packets
    390  buf[1] = dataptr[0];
    391  buf[2] = dataptr[1];
    392  buf[3] = dataptr[2];
    393 
    394  switch(lookupMsgSize(msg)) {
    395  //3 bytes message
    396  case 3 :
    397  if(msg == 0xf2) {//system common message(SPP)
    398  buf[0] = (nCable << 4) | 3;
    399  }
    400  break;
    401 
    402  //2 bytes message
    403  case 2 :
    404  if(msg == 0xf1 || msg == 0xf3) {//system common message(MTC/SongSelect)
    405  buf[0] = (nCable << 4) | 2;
    406  }
    407  buf[3] = 0;
    408  break;
    409 
    410  //1 bytes message
    411  case 1 :
    412  default :
    413  buf[2] = 0;
    414  buf[3] = 0;
    415  break;
    416  }
    417  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, 4, buf);
    418 }
    419 
    420 #ifdef DEBUG_USB_HOST
    421 void USBH_MIDI::PrintEndpointDescriptor( const USB_ENDPOINT_DESCRIPTOR* ep_ptr )
    422 {
    423  Notify(PSTR("Endpoint descriptor:"), 0x80);
    424  Notify(PSTR("\r\nLength:\t\t"), 0x80);
    425  PrintHex<uint8_t>(ep_ptr->bLength, 0x80);
    426  Notify(PSTR("\r\nType:\t\t"), 0x80);
    427  PrintHex<uint8_t>(ep_ptr->bDescriptorType, 0x80);
    428  Notify(PSTR("\r\nAddress:\t"), 0x80);
    429  PrintHex<uint8_t>(ep_ptr->bEndpointAddress, 0x80);
    430  Notify(PSTR("\r\nAttributes:\t"), 0x80);
    431  PrintHex<uint8_t>(ep_ptr->bmAttributes, 0x80);
    432  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
    433  PrintHex<uint16_t>(ep_ptr->wMaxPacketSize, 0x80);
    434  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
    435  PrintHex<uint8_t>(ep_ptr->bInterval, 0x80);
    436  Notify(PSTR("\r\n"), 0x80);
    437 }
    438 #endif
    439 
    440 /* look up a MIDI message size from spec */
    441 /*Return */
    442 /* 0 : undefined message */
    443 /* 0<: Vaild message size(1-3) */
    444 uint8_t USBH_MIDI::lookupMsgSize(uint8_t midiMsg)
    445 {
    446  uint8_t msgSize = 0;
    447 
    448  if( midiMsg < 0xf0 ) midiMsg &= 0xf0;
    449  switch(midiMsg) {
    450  //3 bytes messages
    451  case 0xf2 : //system common message(SPP)
    452  case 0x80 : //Note off
    453  case 0x90 : //Note on
    454  case 0xa0 : //Poly KeyPress
    455  case 0xb0 : //Control Change
    456  case 0xe0 : //PitchBend Change
    457  msgSize = 3;
    458  break;
    459 
    460  //2 bytes messages
    461  case 0xf1 : //system common message(MTC)
    462  case 0xf3 : //system common message(SongSelect)
    463  case 0xc0 : //Program Change
    464  case 0xd0 : //Channel Pressure
    465  msgSize = 2;
    466  break;
    467 
    468  //1 bytes messages
    469  case 0xf8 : //system realtime message
    470  case 0xf9 : //system realtime message
    471  case 0xfa : //system realtime message
    472  case 0xfb : //system realtime message
    473  case 0xfc : //system realtime message
    474  case 0xfe : //system realtime message
    475  case 0xff : //system realtime message
    476  msgSize = 1;
    477  break;
    478 
    479  //undefine messages
    480  default :
    481  break;
    482  }
    483  return msgSize;
    484 }
    485 
    486 /* SysEx data size counter */
    487 unsigned int USBH_MIDI::countSysExDataSize(uint8_t *dataptr)
    488 {
    489  unsigned int c = 1;
    490 
    491  if( *dataptr != 0xf0 ){ //not SysEx
    492  return 0;
    493  }
    494 
    495  //Search terminator(0xf7)
    496  while(*dataptr != 0xf7)
    497  {
    498  dataptr++;
    499  c++;
    500 
    501  //Limiter (upto 256 bytes)
    502  if(c > 256){
    503  c = 0;
    504  break;
    505  }
    506  }
    507  return c;
    508 }
    509 
    510 /* Send SysEx message to MIDI device */
    511 uint8_t USBH_MIDI::SendSysEx(uint8_t *dataptr, unsigned int datasize, byte nCable)
    512 {
    513  byte buf[4];
    514  uint8_t rc;
    515  unsigned int n = datasize;
    516 
    517  while(n > 0) {
    518  //Byte 0
    519  buf[0] = (nCable << 4) | 0x4; //x4 SysEx starts or continues
    520 
    521  switch ( n ) {
    522  case 1 :
    523  buf[0] = (nCable << 4) | 0x5; //x5 SysEx ends with following single byte.
    524  buf[1] = *(dataptr++);
    525  buf[2] = 0x00;
    526  buf[3] = 0x00;
    527  n = n - 1;
    528  break;
    529  case 2 :
    530  buf[0] = (nCable << 4) | 0x6; //x6 SysEx ends with following two bytes.
    531  buf[1] = *(dataptr++);
    532  buf[2] = *(dataptr++);
    533  buf[3] = 0x00;
    534  n = n - 2;
    535  break;
    536  case 3 :
    537  buf[0] = (nCable << 4) | 0x7; //x7 SysEx ends with following three bytes.
    538  default :
    539  buf[1] = *(dataptr++);
    540  buf[2] = *(dataptr++);
    541  buf[3] = *(dataptr++);
    542  n = n - 3;
    543  break;
    544  }
    545  rc = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, 4, buf);
    546  if(rc != 0)
    547  break;
    548  }
    549  return(rc);
    550 }
    uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
    Definition: Usb.cpp:771
    - -
    static const uint8_t epDataInIndexVSP
    Definition: usbh_midi.h:45
    -
    EpInfo * epinfo
    Definition: address.h:76
    -
    bool lowspeed
    Definition: address.h:79
    -
    #define USB_ERROR_EPINFO_IS_NULL
    Definition: UsbCore.h:83
    +Go to the documentation of this file.
    1 /*
    2  *******************************************************************************
    3  * USB-MIDI class driver for USB Host Shield 2.0 Library
    4  * Copyright (c) 2012-2018 Yuuichi Akagawa
    5  *
    6  * Idea from LPK25 USB-MIDI to Serial MIDI converter
    7  * by Collin Cunningham - makezine.com, narbotic.com
    8  *
    9  * for use with USB Host Shield 2.0 from Circuitsathome.com
    10  * https://github.com/felis/USB_Host_Shield_2.0
    11  *******************************************************************************
    12  * This program is free software; you can redistribute it and/or modify
    13  * it under the terms of the GNU General Public License as published by
    14  * the Free Software Foundation; either version 2 of the License, or
    15  * (at your option) any later version.
    16  *
    17  * This program is distributed in the hope that it will be useful,
    18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20  * GNU General Public License for more details.
    21  *
    22  * You should have received a copy of the GNU General Public License
    23  * along with this program. If not, see <http://www.gnu.org/licenses/>
    24  *******************************************************************************
    25  */
    26 
    27 #include "usbh_midi.h"
    29 // MIDI MESAGES
    30 // midi.org/techspecs/
    32 // STATUS BYTES
    33 // 0x8n == noteOff
    34 // 0x9n == noteOn
    35 // 0xAn == afterTouch
    36 // 0xBn == controlChange
    37 // n == Channel(0x0-0xf)
    39 //DATA BYTE 1
    40 // note# == (0-127)
    41 // or
    42 // control# == (0-119)
    44 // DATA BYTE 2
    45 // velocity == (0-127)
    46 // or
    47 // controlVal == (0-127)
    49 // USB-MIDI Event Packets
    50 // usb.org - Universal Serial Bus Device Class Definition for MIDI Devices 1.0
    52 //+-------------+-------------+-------------+-------------+
    53 //| Byte 0 | Byte 1 | Byte 2 | Byte 3 |
    54 //+------+------+-------------+-------------+-------------+
    55 //|Cable | Code | | | |
    56 //|Number|Index | MIDI_0 | MIDI_1 | MIDI_2 |
    57 //| |Number| | | |
    58 //|(4bit)|(4bit)| (8bit) | (8bit) | (8bit) |
    59 //+------+------+-------------+-------------+-------------+
    60 // CN == 0x0-0xf
    61 //+-----+-----------+-------------------------------------------------------------------
    62 //| CIN |MIDI_x size|Description
    63 //+-----+-----------+-------------------------------------------------------------------
    64 //| 0x0 | 1, 2 or 3 |Miscellaneous function codes. Reserved for future extensions.
    65 //| 0x1 | 1, 2 or 3 |Cable events. Reserved for future expansion.
    66 //| 0x2 | 2 |Two-byte System Common messages like MTC, SongSelect, etc.
    67 //| 0x3 | 3 |Three-byte System Common messages like SPP, etc.
    68 //| 0x4 | 3 |SysEx starts or continues
    69 //| 0x5 | 1 |Single-byte System Common Message or SysEx ends with following single byte.
    70 //| 0x6 | 2 |SysEx ends with following two bytes.
    71 //| 0x7 | 3 |SysEx ends with following three bytes.
    72 //| 0x8 | 3 |Note-off
    73 //| 0x9 | 3 |Note-on
    74 //| 0xA | 3 |Poly-KeyPress
    75 //| 0xB | 3 |Control Change
    76 //| 0xC | 2 |Program Change
    77 //| 0xD | 2 |Channel Pressure
    78 //| 0xE | 3 |PitchBend Change
    79 //| 0xF | 1 |Single Byte
    80 //+-----+-----------+-------------------------------------------------------------------
    81 
    82 const uint8_t USBH_MIDI::epDataInIndex = 1;
    83 const uint8_t USBH_MIDI::epDataOutIndex = 2;
    84 const uint8_t USBH_MIDI::epDataInIndexVSP = 3;
    85 const uint8_t USBH_MIDI::epDataOutIndexVSP = 4;
    86 
    88 pUsb(p),
    89 bAddress(0),
    90 bNumEP(1),
    91 bPollEnable(false),
    92 isMidiFound(false),
    93 readPtr(0) {
    94  // initialize endpoint data structures
    95  for(uint8_t i=0; i<MIDI_MAX_ENDPOINTS; i++) {
    96  epInfo[i].epAddr = 0;
    97  epInfo[i].maxPktSize = (i) ? 0 : 8;
    99 
    100  }
    101  // register in USB subsystem
    102  if (pUsb) {
    103  pUsb->RegisterDeviceClass(this);
    104  }
    105 }
    106 
    107 /* Connection initialization of an MIDI Device */
    108 uint8_t USBH_MIDI::Init(uint8_t parent, uint8_t port, bool lowspeed)
    109 {
    110  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
    111  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
    112  uint8_t rcode;
    113  UsbDevice *p = NULL;
    114  EpInfo *oldep_ptr = NULL;
    115  uint8_t num_of_conf; // number of configurations
    116 
    117  USBTRACE("\rMIDI Init\r\n");
    118 
    119  //for reconnect
    120  for(uint8_t i=epDataInIndex; i<=epDataOutIndex; i++) {
    121  epInfo[i].epAddr = (i==epDataInIndex) ? 0x81 : 0x01;
    122  epInfo[i].maxPktSize = 0;
    123  epInfo[i].bmSndToggle = 0;
    124  epInfo[i].bmRcvToggle = 0;
    125  }
    126 
    127  // get memory address of USB device address pool
    128  AddressPool &addrPool = pUsb->GetAddressPool();
    129 
    130  // check if address has already been assigned to an instance
    131  if (bAddress) {
    133  }
    134  // Get pointer to pseudo device with address 0 assigned
    135  p = addrPool.GetUsbDevicePtr(bAddress);
    136  if (!p) {
    138  }
    139  if (!p->epinfo) {
    141  }
    142 
    143  // Save old pointer to EP_RECORD of address 0
    144  oldep_ptr = p->epinfo;
    145 
    146  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
    147  p->epinfo = epInfo;
    148  p->lowspeed = lowspeed;
    149 
    150  // Get device descriptor
    151  rcode = pUsb->getDevDescr( 0, 0, sizeof(USB_DEVICE_DESCRIPTOR), (uint8_t*)buf );
    152  vid = udd->idVendor;
    153  pid = udd->idProduct;
    154  // Restore p->epinfo
    155  p->epinfo = oldep_ptr;
    156 
    157  if( rcode ){
    158  goto FailGetDevDescr;
    159  }
    160 
    161  // Allocate new address according to device class
    162  bAddress = addrPool.AllocAddress(parent, false, port);
    163  if (!bAddress) {
    165  }
    166 
    167  // Extract Max Packet Size from device descriptor
    168  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
    169 
    170  // Assign new address to the device
    171  rcode = pUsb->setAddr( 0, 0, bAddress );
    172  if (rcode) {
    173  p->lowspeed = false;
    174  addrPool.FreeAddress(bAddress);
    175  bAddress = 0;
    176  return rcode;
    177  }//if (rcode...
    178  USBTRACE2("Addr:", bAddress);
    179 
    180  p->lowspeed = false;
    181 
    182  //get pointer to assigned address record
    183  p = addrPool.GetUsbDevicePtr(bAddress);
    184  if (!p) {
    186  }
    187  p->lowspeed = lowspeed;
    188 
    189  num_of_conf = udd->bNumConfigurations;
    190 
    191  // Assign epInfo to epinfo pointer
    192  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
    193  if (rcode) {
    194  USBTRACE("setEpInfoEntry failed");
    195  goto FailSetDevTblEntry;
    196  }
    197 
    198  USBTRACE("VID:"), D_PrintHex(vid, 0x80);
    199  USBTRACE(" PID:"), D_PrintHex(pid, 0x80);
    200  USBTRACE2(" #Conf:", num_of_conf);
    201 
    202  //Setup for well known vendor/device specific configuration
    205 
    206  isMidiFound = false;
    207  for (uint8_t i=0; i<num_of_conf; i++) {
    208  rcode = parseConfigDescr(bAddress, i);
    209  if( rcode )
    210  goto FailGetConfDescr;
    211  if (bNumEP > 1)
    212  break;
    213  } // for
    214 
    215  USBTRACE2("\r\nNumEP:", bNumEP);
    216 
    217  if( bNumEP < 2 ){ //Device not found.
    218  rcode = 0xff;
    219  goto FailGetConfDescr;
    220  }
    221 
    222  if( !isMidiFound ){ //MIDI Device not found. Try last Bulk transfer device
    223  USBTRACE("MIDI not found. Attempts bulk device\r\n");
    228  }
    229 
    230  // Assign epInfo to epinfo pointer
    231  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
    232  USBTRACE2("Conf:", bConfNum);
    233  USBTRACE2("EPin :", (uint8_t)(epInfo[epDataInIndex].epAddr + 0x80));
    234  USBTRACE2("EPout:", epInfo[epDataOutIndex].epAddr);
    235 
    236  // Set Configuration Value
    237  rcode = pUsb->setConf(bAddress, 0, bConfNum);
    238  if (rcode) {
    239  goto FailSetConfDescr;
    240  }
    241  bPollEnable = true;
    242  USBTRACE("Init done.\r\n");
    243  return 0;
    244 FailGetDevDescr:
    245 FailSetDevTblEntry:
    246 FailGetConfDescr:
    247 FailSetConfDescr:
    248  Release();
    249  return rcode;
    250 }
    251 
    252 /* get and parse config descriptor */
    253 uint8_t USBH_MIDI::parseConfigDescr( uint8_t addr, uint8_t conf )
    254 {
    255  uint8_t buf[ DESC_BUFF_SIZE ];
    256  uint8_t* buf_ptr = buf;
    257  uint8_t rcode;
    258  uint8_t descr_length;
    259  uint8_t descr_type;
    260  uint16_t total_length;
    261  USB_ENDPOINT_DESCRIPTOR *epDesc;
    262  bool isMidi = false;
    263 
    264  // get configuration descriptor (get descriptor size only)
    265  rcode = pUsb->getConfDescr( addr, 0, 4, conf, buf );
    266  if( rcode ){
    267  return rcode;
    268  }
    269  total_length = buf[2] | ((int)buf[3] << 8);
    270  if( total_length > DESC_BUFF_SIZE ) { //check if total length is larger than buffer
    271  total_length = DESC_BUFF_SIZE;
    272  }
    273 
    274  // get configuration descriptor (all)
    275  rcode = pUsb->getConfDescr( addr, 0, total_length, conf, buf ); //get the whole descriptor
    276  if( rcode ){
    277  return rcode;
    278  }
    279 
    280  //parsing descriptors
    281  while( buf_ptr < buf + total_length ) {
    282  descr_length = *( buf_ptr );
    283  descr_type = *( buf_ptr + 1 );
    284  switch( descr_type ) {
    286  bConfNum = buf_ptr[5];
    287  break;
    289  USBTRACE("\r\nConf:"), D_PrintHex(bConfNum, 0x80);
    290  USBTRACE(" Int:"), D_PrintHex(buf_ptr[2], 0x80);
    291  USBTRACE(" Alt:"), D_PrintHex(buf_ptr[3], 0x80);
    292  USBTRACE(" EPs:"), D_PrintHex(buf_ptr[4], 0x80);
    293  USBTRACE(" IntCl:"), D_PrintHex(buf_ptr[5], 0x80);
    294  USBTRACE(" IntSubCl:"), D_PrintHex(buf_ptr[6], 0x80);
    295  USBTRACE("\r\n");
    296 
    297  if( buf_ptr[5] == USB_CLASS_AUDIO && buf_ptr[6] == USB_SUBCLASS_MIDISTREAMING ) { //p[5]; bInterfaceClass = 1(Audio), p[6]; bInterfaceSubClass = 3(MIDI Streaming)
    298  isMidiFound = true; //MIDI device found.
    299  isMidi = true;
    300  USBTRACE("MIDI Device\r\n");
    301  }else{
    302  isMidi = false;
    303  USBTRACE("No MIDI Device\r\n");
    304  }
    305  break;
    307  epDesc = (USB_ENDPOINT_DESCRIPTOR *)buf_ptr;
    308  USBTRACE("-EPAddr:"), D_PrintHex(epDesc->bEndpointAddress, 0x80);
    309  USBTRACE(" bmAttr:"), D_PrintHex(epDesc->bmAttributes, 0x80);
    310  USBTRACE2(" MaxPktSz:", (uint8_t)epDesc->wMaxPacketSize);
    311  if ((epDesc->bmAttributes & bTransferTypeMask) == USB_TRANSFER_TYPE_BULK) {//bulk
    312  uint8_t index;
    313  if( isMidi )
    314  index = ((epDesc->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
    315  else
    316  index = ((epDesc->bEndpointAddress & 0x80) == 0x80) ? epDataInIndexVSP : epDataOutIndexVSP;
    317  epInfo[index].epAddr = (epDesc->bEndpointAddress & 0x0F);
    318  epInfo[index].maxPktSize = (uint8_t)epDesc->wMaxPacketSize;
    319  bNumEP ++;
    320 #ifdef DEBUG_USB_HOST
    321  PrintEndpointDescriptor(epDesc);
    322 #endif
    323  }
    324  break;
    325  default:
    326  break;
    327  }//switch( descr_type
    328  buf_ptr += descr_length; //advance buffer pointer
    329  }//while( buf_ptr <=...
    330  return 0;
    331 }
    332 
    333 /* Performs a cleanup after failed Init() attempt */
    335 {
    337  bNumEP = 1; //must have to be reset to 1
    338  bAddress = 0;
    339  bPollEnable = false;
    340  readPtr = 0;
    341  return 0;
    342 }
    343 
    344 /* Setup for well known vendor/device specific configuration */
    346 {
    347  // Novation
    348  if( vid == 0x1235 ) {
    349  // LaunchPad's endpoint attirbute is interrupt (0x20:S, 0x36:Mini, 0x51:Pro, 0x69:MK2, 0x7b:Launchkey25 MK2)
    350  if(pid == 0x20 || pid == 0x36 || pid == 0x51 || pid == 0x69 || pid == 0x7b ) {
    351  bTransferTypeMask = 2;
    352  }
    353  }
    354 }
    355 
    356 /* Receive data from MIDI device */
    357 uint8_t USBH_MIDI::RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
    358 {
    359  *bytes_rcvd = (uint16_t)epInfo[epDataInIndex].maxPktSize;
    360  uint8_t r = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
    361 
    362  if( *bytes_rcvd < (MIDI_EVENT_PACKET_SIZE-4)){
    363  dataptr[*bytes_rcvd] = '\0';
    364  dataptr[(*bytes_rcvd)+1] = '\0';
    365  }
    366  return r;
    367 }
    368 
    369 /* Receive data from MIDI device */
    370 uint8_t USBH_MIDI::RecvData(uint8_t *outBuf, bool isRaw)
    371 {
    372  uint8_t rcode = 0; //return code
    373  uint16_t rcvd;
    374 
    375  if( bPollEnable == false ) return 0;
    376 
    377  //Checking unprocessed message in buffer.
    378  if( readPtr != 0 && readPtr < MIDI_EVENT_PACKET_SIZE ){
    379  if(recvBuf[readPtr] == 0 && recvBuf[readPtr+1] == 0) {
    380  //no unprocessed message left in the buffer.
    381  }else{
    382  goto RecvData_return_from_buffer;
    383  }
    384  }
    385 
    386  readPtr = 0;
    387  rcode = RecvData( &rcvd, recvBuf);
    388  if( rcode != 0 ) {
    389  return 0;
    390  }
    391 
    392  //if all data is zero, no valid data received.
    393  if( recvBuf[0] == 0 && recvBuf[1] == 0 && recvBuf[2] == 0 && recvBuf[3] == 0 ) {
    394  return 0;
    395  }
    396 
    397 RecvData_return_from_buffer:
    398  uint8_t m;
    399  uint8_t cin = recvBuf[readPtr];
    400  if( isRaw == true ) {
    401  *(outBuf++) = cin;
    402  }
    403  readPtr++;
    404  *(outBuf++) = m = recvBuf[readPtr++];
    405  *(outBuf++) = recvBuf[readPtr++];
    406  *(outBuf++) = recvBuf[readPtr++];
    407  return lookupMsgSize(m, cin);
    408 }
    409 
    410 /* Receive raw data from MIDI device */
    411 uint8_t USBH_MIDI::RecvRawData(uint8_t *outBuf)
    412 {
    413  return RecvData(outBuf, true);
    414 }
    415 
    416 /* Send data to MIDI device */
    417 uint8_t USBH_MIDI::SendData(uint8_t *dataptr, uint8_t nCable)
    418 {
    419  uint8_t buf[4];
    420  uint8_t msg;
    421 
    422  msg = dataptr[0];
    423  // SysEx long message ?
    424  if( msg == 0xf0 )
    425  {
    426  return SendSysEx(dataptr, countSysExDataSize(dataptr), nCable);
    427  }
    428 
    429  buf[0] = (nCable << 4) | (msg >> 4);
    430  if( msg < 0xf0 ) msg = msg & 0xf0;
    431 
    432 
    433  //Building USB-MIDI Event Packets
    434  buf[1] = dataptr[0];
    435  buf[2] = dataptr[1];
    436  buf[3] = dataptr[2];
    437 
    438  switch(lookupMsgSize(msg)) {
    439  //3 bytes message
    440  case 3 :
    441  if(msg == 0xf2) {//system common message(SPP)
    442  buf[0] = (nCable << 4) | 3;
    443  }
    444  break;
    445 
    446  //2 bytes message
    447  case 2 :
    448  if(msg == 0xf1 || msg == 0xf3) {//system common message(MTC/SongSelect)
    449  buf[0] = (nCable << 4) | 2;
    450  }
    451  buf[3] = 0;
    452  break;
    453 
    454  //1 byte message
    455  case 1 :
    456  default :
    457  buf[2] = 0;
    458  buf[3] = 0;
    459  break;
    460  }
    461  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, 4, buf);
    462 }
    463 
    464 #ifdef DEBUG_USB_HOST
    465 void USBH_MIDI::PrintEndpointDescriptor( const USB_ENDPOINT_DESCRIPTOR* ep_ptr )
    466 {
    467  USBTRACE("Endpoint descriptor:\r\n");
    468  USBTRACE2(" Length:\t", ep_ptr->bLength);
    469  USBTRACE2(" Type:\t\t", ep_ptr->bDescriptorType);
    470  USBTRACE2(" Address:\t", ep_ptr->bEndpointAddress);
    471  USBTRACE2(" Attributes:\t", ep_ptr->bmAttributes);
    472  USBTRACE2(" MaxPktSize:\t", ep_ptr->wMaxPacketSize);
    473  USBTRACE2(" Poll Intrv:\t", ep_ptr->bInterval);
    474 }
    475 #endif
    476 
    477 /* look up a MIDI message size from spec */
    478 /*Return */
    479 /* 0 : undefined message */
    480 /* 0<: Vaild message size(1-3) */
    481 uint8_t USBH_MIDI::lookupMsgSize(uint8_t midiMsg, uint8_t cin)
    482 {
    483  uint8_t msgSize = 0;
    484 
    485  //SysEx message?
    486  cin = cin & 0x0f;
    487  if( (cin & 0xc) == 4 ) {
    488  if( cin == 4 || cin == 7 ) return 3;
    489  if( cin == 6 ) return 2;
    490  if( cin == 5 ) return 1;
    491  }
    492 
    493  if( midiMsg < 0xf0 ) midiMsg &= 0xf0;
    494  switch(midiMsg) {
    495  //3 bytes messages
    496  case 0xf2 : //system common message(SPP)
    497  case 0x80 : //Note off
    498  case 0x90 : //Note on
    499  case 0xa0 : //Poly KeyPress
    500  case 0xb0 : //Control Change
    501  case 0xe0 : //PitchBend Change
    502  msgSize = 3;
    503  break;
    504 
    505  //2 bytes messages
    506  case 0xf1 : //system common message(MTC)
    507  case 0xf3 : //system common message(SongSelect)
    508  case 0xc0 : //Program Change
    509  case 0xd0 : //Channel Pressure
    510  msgSize = 2;
    511  break;
    512 
    513  //1 byte messages
    514  case 0xf8 : //system realtime message
    515  case 0xf9 : //system realtime message
    516  case 0xfa : //system realtime message
    517  case 0xfb : //system realtime message
    518  case 0xfc : //system realtime message
    519  case 0xfe : //system realtime message
    520  case 0xff : //system realtime message
    521  msgSize = 1;
    522  break;
    523 
    524  //undefine messages
    525  default :
    526  break;
    527  }
    528  return msgSize;
    529 }
    530 
    531 /* SysEx data size counter */
    532 uint16_t USBH_MIDI::countSysExDataSize(uint8_t *dataptr)
    533 {
    534  uint16_t c = 1;
    535 
    536  if( *dataptr != 0xf0 ){ //not SysEx
    537  return 0;
    538  }
    539 
    540  //Search terminator(0xf7)
    541  while(*dataptr != 0xf7)
    542  {
    543  dataptr++;
    544  c++;
    545 
    546  //Limiter (default: 256 bytes)
    547  if(c > MIDI_MAX_SYSEX_SIZE){
    548  c = 0;
    549  break;
    550  }
    551  }
    552  return c;
    553 }
    554 
    555 /* Send SysEx message to MIDI device */
    556 uint8_t USBH_MIDI::SendSysEx(uint8_t *dataptr, uint16_t datasize, uint8_t nCable)
    557 {
    558  uint8_t buf[MIDI_EVENT_PACKET_SIZE];
    559  uint8_t rc = 0;
    560  uint16_t n = datasize;
    561  uint16_t pktSize = (n*10/3+7)/10*4; //Calculate total USB MIDI packet size
    562  uint8_t wptr = 0;
    563  uint8_t maxpkt = epInfo[epDataInIndex].maxPktSize;
    564 
    565  if( maxpkt > MIDI_EVENT_PACKET_SIZE ) maxpkt = MIDI_EVENT_PACKET_SIZE;
    566 
    567  USBTRACE("SendSysEx:\r\t");
    568  USBTRACE2(" Length:\t", datasize);
    569  USBTRACE2(" Total pktSize:\t", pktSize);
    570 
    571  while(n > 0) {
    572  //Byte 0
    573  buf[wptr] = (nCable << 4) | 0x4; //x4 SysEx starts or continues
    574 
    575  switch ( n ) {
    576  case 1 :
    577  buf[wptr++] = (nCable << 4) | 0x5; //x5 SysEx ends with following single byte.
    578  buf[wptr++] = *(dataptr++);
    579  buf[wptr++] = 0x00;
    580  buf[wptr++] = 0x00;
    581  n = n - 1;
    582  break;
    583  case 2 :
    584  buf[wptr++] = (nCable << 4) | 0x6; //x6 SysEx ends with following two bytes.
    585  buf[wptr++] = *(dataptr++);
    586  buf[wptr++] = *(dataptr++);
    587  buf[wptr++] = 0x00;
    588  n = n - 2;
    589  break;
    590  case 3 :
    591  buf[wptr] = (nCable << 4) | 0x7; //x7 SysEx ends with following three bytes.
    592  default :
    593  wptr++;
    594  buf[wptr++] = *(dataptr++);
    595  buf[wptr++] = *(dataptr++);
    596  buf[wptr++] = *(dataptr++);
    597  n = n - 3;
    598  break;
    599  }
    600 
    601  if( wptr >= maxpkt || n == 0 ){ //Reach a maxPktSize or data end.
    602  USBTRACE2(" wptr:\t", wptr);
    603  if( (rc = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, wptr, buf)) != 0 ){
    604  break;
    605  }
    606  wptr = 0; //rewind data pointer
    607  }
    608  }
    609  return(rc);
    610 }
    611 
    612 /* Send raw data to MIDI device */
    613 uint8_t USBH_MIDI::SendRawData(uint16_t bytes_send, uint8_t *dataptr)
    614 {
    615  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, bytes_send, dataptr);
    616 
    617 }
    618 
    619 uint8_t USBH_MIDI::extractSysExData(uint8_t *p, uint8_t *buf)
    620 {
    621  uint8_t rc = 0;
    622  uint8_t cin = *(p) & 0x0f;
    623 
    624  //SysEx message?
    625  if( (cin & 0xc) != 4 ) return rc;
    626 
    627  switch(cin) {
    628  case 4:
    629  case 7:
    630  *buf++ = *(p+1);
    631  *buf++ = *(p+2);
    632  *buf++ = *(p+3);
    633  rc = 3;
    634  break;
    635  case 6:
    636  *buf++ = *(p+1);
    637  *buf++ = *(p+2);
    638  rc = 2;
    639  break;
    640  case 5:
    641  *buf++ = *(p+1);
    642  rc = 1;
    643  break;
    644  default:
    645  break;
    646  }
    647  return(rc);
    648 }
    uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
    Definition: Usb.cpp:784
    +
    uint8_t bmRcvToggle
    Definition: address.h:48
    + +
    uint8_t SendSysEx(uint8_t *dataptr, uint16_t datasize, uint8_t nCable=0)
    Definition: usbh_midi.cpp:556
    +
    static const uint8_t epDataInIndexVSP
    Definition: usbh_midi.h:44
    +
    EpInfo * epinfo
    Definition: address.h:83
    +
    bool lowspeed
    Definition: address.h:86
    +
    #define USB_ERROR_EPINFO_IS_NULL
    Definition: UsbCore.h:94
    +
    uint8_t bTransferTypeMask
    Definition: usbh_midi.h:55
    uint8_t readPtr
    Definition: usbh_midi.h:60
    -
    uint8_t bmNakPower
    Definition: address.h:42
    - -
    uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
    Definition: usbh_midi.cpp:321
    - - - - -
    uint8_t bMaxPacketSize0
    Definition: usb_ch9.h:105
    -
    uint16_t vid
    Definition: usbh_midi.h:68
    -
    uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
    Definition: Usb.cpp:810
    -
    virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
    Definition: usbh_midi.cpp:110
    -
    #define USB_DESCRIPTOR_ENDPOINT
    Definition: usb_ch9.h:67
    -
    #define USB_SUBCLASS_MIDISTREAMING
    Definition: usbh_midi.h:32
    -
    uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
    Definition: Usb.cpp:64
    -
    USB * pUsb
    Definition: usbh_midi.h:49
    -
    void parseConfigDescr(byte addr, byte conf)
    Definition: usbh_midi.cpp:240
    +
    uint8_t bmNakPower
    Definition: address.h:49
    + +
    uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
    Definition: usbh_midi.cpp:357
    + + + +
    uint16_t vid
    Definition: usbh_midi.h:54
    +
    uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
    Definition: Usb.cpp:823
    +
    virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
    Definition: usbh_midi.cpp:108
    +
    #define USB_DESCRIPTOR_ENDPOINT
    Definition: usb_ch9.h:74
    +
    #define USB_SUBCLASS_MIDISTREAMING
    Definition: usbh_midi.h:33
    +
    uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
    Definition: Usb.cpp:71
    +
    USB * pUsb
    Definition: usbh_midi.h:48
    +
    uint8_t SendRawData(uint16_t bytes_send, uint8_t *dataptr)
    Definition: usbh_midi.cpp:613
    +
    uint16_t countSysExDataSize(uint8_t *dataptr)
    Definition: usbh_midi.cpp:532
    virtual void FreeAddress(uint8_t addr)=0
    -
    uint8_t epAttribs
    Definition: address.h:37
    -
    static const uint8_t epDataOutIndexVSP
    Definition: usbh_midi.h:46
    -
    #define USB_DESCRIPTOR_CONFIGURATION
    Definition: usb_ch9.h:64
    +
    static const uint8_t epDataOutIndexVSP
    Definition: usbh_midi.h:45
    +
    #define USB_DESCRIPTOR_CONFIGURATION
    Definition: usb_ch9.h:71
    virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
    -
    #define Notify(...)
    Definition: message.h:44
    - -
    #define USBTRACE2(s, r)
    Definition: macros.h:77
    -
    uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
    Definition: Usb.cpp:801
    -
    uint8_t epAddr
    Definition: address.h:33
    -
    uint8_t bNumEP
    Definition: usbh_midi.h:52
    -
    uint8_t bAddress
    Definition: usbh_midi.h:50
    -
    Definition: address.h:32
    -
    uint16_t pid
    Definition: usbh_midi.h:68
    -
    uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
    Definition: Usb.cpp:293
    -
    virtual uint8_t Release()
    Definition: usbh_midi.cpp:310
    -
    uint16_t wMaxPacketSize
    Definition: usb_ch9.h:146
    -
    #define USB_CLASS_AUDIO
    Definition: UsbCore.h:57
    -
    bool isMidiFound
    Definition: usbh_midi.h:55
    -
    unsigned int countSysExDataSize(uint8_t *dataptr)
    Definition: usbh_midi.cpp:487
    -
    bool bPollEnable
    Definition: usbh_midi.h:53
    +
    void setupDeviceSpecific()
    Definition: usbh_midi.cpp:345
    + +
    #define USBTRACE2(s, r)
    Definition: macros.h:84
    +
    uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
    Definition: Usb.cpp:814
    +
    uint8_t epAddr
    Definition: address.h:40
    +
    uint8_t bNumEP
    Definition: usbh_midi.h:51
    +
    #define USB_NAK_MAX_POWER
    Definition: address.h:34
    +
    uint8_t bAddress
    Definition: usbh_midi.h:49
    +
    Definition: address.h:39
    +
    uint16_t pid
    Definition: usbh_midi.h:54
    +
    uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
    Definition: Usb.cpp:300
    +
    virtual uint8_t Release()
    Definition: usbh_midi.cpp:334
    +
    uint8_t RecvRawData(uint8_t *outBuf)
    Definition: usbh_midi.cpp:411
    +
    uint16_t wMaxPacketSize
    Definition: usb_ch9.h:153
    +
    #define bmUSB_TRANSFER_TYPE
    Definition: usb_ch9.h:94
    +
    #define USB_CLASS_AUDIO
    Definition: UsbCore.h:68
    +
    bool isMidiFound
    Definition: usbh_midi.h:53
    +
    bool bPollEnable
    Definition: usbh_midi.h:52
    USBH_MIDI(USB *p)
    Definition: usbh_midi.cpp:87
    virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
    -
    uint8_t bEndpointAddress
    Definition: usb_ch9.h:144
    -
    #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
    Definition: UsbCore.h:85
    -
    #define PSTR(str)
    - -
    static const uint8_t epDataInIndex
    Definition: usbh_midi.h:43
    -
    #define MIDI_EVENT_PACKET_SIZE
    Definition: usbh_midi.h:34
    -
    #define USB_NAK_NOWAIT
    Definition: address.h:29
    -
    uint8_t SendData(uint8_t *dataptr, byte nCable=0)
    Definition: usbh_midi.cpp:373
    +
    uint8_t bEndpointAddress
    Definition: usb_ch9.h:151
    +
    uint8_t bmSndToggle
    Definition: address.h:47
    +
    #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
    Definition: UsbCore.h:96
    + +
    static const uint8_t epDataInIndex
    Definition: usbh_midi.h:42
    +
    #define MIDI_EVENT_PACKET_SIZE
    Definition: usbh_midi.h:35
    +
    uint8_t lookupMsgSize(uint8_t midiMsg, uint8_t cin=0)
    Definition: usbh_midi.cpp:481
    +
    #define USB_NAK_NOWAIT
    Definition: address.h:36
    uint8_t recvBuf[MIDI_EVENT_PACKET_SIZE]
    Definition: usbh_midi.h:59
    -
    #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
    Definition: UsbCore.h:82
    -
    uint16_t idProduct
    Definition: usb_ch9.h:107
    -
    uint8_t bConfNum
    Definition: usbh_midi.h:51
    +
    #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
    Definition: UsbCore.h:93
    +
    #define MIDI_MAX_SYSEX_SIZE
    Definition: usbh_midi.h:36
    +
    uint8_t bConfNum
    Definition: usbh_midi.h:50
    EpInfo epInfo[MIDI_MAX_ENDPOINTS]
    Definition: usbh_midi.h:57
    -
    uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
    Definition: Usb.cpp:206
    -
    uint8_t bNumConfigurations
    Definition: usb_ch9.h:112
    -
    #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
    Definition: UsbCore.h:80
    -
    static const uint8_t epDataOutIndex
    Definition: usbh_midi.h:44
    -
    #define MIDI_MAX_ENDPOINTS
    Definition: usbh_midi.h:31
    -
    uint8_t maxPktSize
    Definition: address.h:34
    -
    AddressPool & GetAddressPool()
    Definition: UsbCore.h:213
    -
    Definition: UsbCore.h:197
    -
    #define DESC_BUFF_SIZE
    Definition: usbh_midi.h:33
    -
    uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
    Definition: UsbCore.h:217
    -
    #define USBTRACE(s)
    Definition: macros.h:75
    -
    uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
    defined(USB_METHODS_INLINE)
    Definition: Usb.cpp:766
    -
    uint8_t SendSysEx(uint8_t *dataptr, unsigned int datasize, byte nCable=0)
    Definition: usbh_midi.cpp:511
    -
    #define USB_DESCRIPTOR_INTERFACE
    Definition: usb_ch9.h:66
    - +
    uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
    Definition: Usb.cpp:213
    +
    #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
    Definition: UsbCore.h:91
    +
    uint8_t extractSysExData(uint8_t *p, uint8_t *buf)
    Definition: usbh_midi.cpp:619
    +
    uint8_t SendData(uint8_t *dataptr, uint8_t nCable=0)
    Definition: usbh_midi.cpp:417
    +
    static const uint8_t epDataOutIndex
    Definition: usbh_midi.h:43
    +
    #define MIDI_MAX_ENDPOINTS
    Definition: usbh_midi.h:32
    +
    uint8_t maxPktSize
    Definition: address.h:41
    +
    AddressPool & GetAddressPool()
    Definition: UsbCore.h:224
    +
    uint8_t parseConfigDescr(uint8_t addr, uint8_t conf)
    Definition: usbh_midi.cpp:253
    +
    Definition: UsbCore.h:208
    +
    #define USB_TRANSFER_TYPE_BULK
    Definition: usb_ch9.h:92
    +
    #define DESC_BUFF_SIZE
    Definition: usbh_midi.h:34
    +
    uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
    Definition: UsbCore.h:228
    +
    void D_PrintHex(T val, int lvl)
    Definition: printhex.h:76
    +
    #define USBTRACE(s)
    Definition: macros.h:82
    +
    uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
    defined(USB_METHODS_INLINE)
    Definition: Usb.cpp:779
    +
    #define USB_DESCRIPTOR_INTERFACE
    Definition: usb_ch9.h:73
    +
    diff --git a/usbh__midi_8h.html b/usbh__midi_8h.html index e8a026c0..ba61cbfd 100644 --- a/usbh__midi_8h.html +++ b/usbh__midi_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbh_midi.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
      #define MIDI_EVENT_PACKET_SIZE   64   +#define MIDI_MAX_SYSEX_SIZE   256 + 

    Macro Definition Documentation

    - + +

    ◆ MIDI_MAX_ENDPOINTS

    +
    @@ -140,11 +124,13 @@ Macros
    -

    Definition at line 31 of file usbh_midi.h.

    +

    Definition at line 32 of file usbh_midi.h.

    - + +

    ◆ USB_SUBCLASS_MIDISTREAMING

    +
    @@ -154,11 +140,13 @@ Macros
    -

    Definition at line 32 of file usbh_midi.h.

    +

    Definition at line 33 of file usbh_midi.h.

    - + +

    ◆ DESC_BUFF_SIZE

    +
    @@ -168,11 +156,13 @@ Macros
    -

    Definition at line 33 of file usbh_midi.h.

    +

    Definition at line 34 of file usbh_midi.h.

    - + +

    ◆ MIDI_EVENT_PACKET_SIZE

    +
    @@ -182,7 +172,23 @@ Macros
    -

    Definition at line 34 of file usbh_midi.h.

    +

    Definition at line 35 of file usbh_midi.h.

    + +
    +
    + +

    ◆ MIDI_MAX_SYSEX_SIZE

    + +
    +
    + + + + +
    #define MIDI_MAX_SYSEX_SIZE   256
    +
    + +

    Definition at line 36 of file usbh_midi.h.

    @@ -191,7 +197,7 @@ Macros diff --git a/usbh__midi_8h__dep__incl.md5 b/usbh__midi_8h__dep__incl.md5 index 01b93705..62ce47bb 100644 --- a/usbh__midi_8h__dep__incl.md5 +++ b/usbh__midi_8h__dep__incl.md5 @@ -1 +1 @@ -18f93b1f2050edc3fe7a66994353dd64 \ No newline at end of file +f5ec6a50010cd002e2eafb0d5a54ad6a \ No newline at end of file diff --git a/usbh__midi_8h__dep__incl.png b/usbh__midi_8h__dep__incl.png index de24bf5e..25f1fe16 100644 Binary files a/usbh__midi_8h__dep__incl.png and b/usbh__midi_8h__dep__incl.png differ diff --git a/usbh__midi_8h__incl.md5 b/usbh__midi_8h__incl.md5 index f21c4e12..bfe96e25 100644 --- a/usbh__midi_8h__incl.md5 +++ b/usbh__midi_8h__incl.md5 @@ -1 +1 @@ -ce525ff2514c62d2d762307071fc4120 \ No newline at end of file +8f0acf129f3eebd9205295e617398c1c \ No newline at end of file diff --git a/usbh__midi_8h__incl.png b/usbh__midi_8h__incl.png index 674d673a..5dc49551 100644 Binary files a/usbh__midi_8h__incl.png and b/usbh__midi_8h__incl.png differ diff --git a/usbh__midi_8h_source.html b/usbh__midi_8h_source.html index 6e0a5604..c3f81026 100644 --- a/usbh__midi_8h_source.html +++ b/usbh__midi_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbh_midi.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    usbh_midi.h
    -Go to the documentation of this file.
    1 /*
    2  *******************************************************************************
    3  * USB-MIDI class driver for USB Host Shield 2.0 Library
    4  * Copyright (c) 2012-2016 Yuuichi Akagawa
    5  *
    6  * Idea from LPK25 USB-MIDI to Serial MIDI converter
    7  * by Collin Cunningham - makezine.com, narbotic.com
    8  *
    9  * for use with USB Host Shield 2.0 from Circuitsathome.com
    10  * https://github.com/felis/USB_Host_Shield_2.0
    11  *******************************************************************************
    12  * This program is free software; you can redistribute it and/or modify
    13  * it under the terms of the GNU General Public License as published by
    14  * the Free Software Foundation; either version 2 of the License, or
    15  * (at your option) any later version.
    16  *
    17  * This program is distributed in the hope that it will be useful,
    18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20  * GNU General Public License for more details.
    21  *
    22  * You should have received a copy of the GNU General Public License
    23  * along with this program. If not, see <http://www.gnu.org/licenses/>
    24  *******************************************************************************
    25  */
    26 
    27 #if !defined(_USBH_MIDI_H_)
    28 #define _USBH_MIDI_H_
    29 #include "Usb.h"
    30 
    31 #define MIDI_MAX_ENDPOINTS 5 //endpoint 0, bulk_IN(MIDI), bulk_OUT(MIDI), bulk_IN(VSP), bulk_OUT(VSP)
    32 #define USB_SUBCLASS_MIDISTREAMING 3
    33 #define DESC_BUFF_SIZE 256
    34 #define MIDI_EVENT_PACKET_SIZE 64
    35 class USBH_MIDI;
    36 
    37 class USBH_MIDI : public USBDeviceConfig
    38 {
    39 private:
    40  uint8_t lookupMsgSize(uint8_t midiMsg);
    41 
    42 protected:
    43  static const uint8_t epDataInIndex; // DataIn endpoint index(MIDI)
    44  static const uint8_t epDataOutIndex; // DataOUT endpoint index(MIDI)
    45  static const uint8_t epDataInIndexVSP; // DataIn endpoint index(Vendor Specific Protocl)
    46  static const uint8_t epDataOutIndexVSP; // DataOUT endpoint index(Vendor Specific Protocl)
    47 
    48  /* mandatory members */
    50  uint8_t bAddress;
    51  uint8_t bConfNum; // configuration number
    52  uint8_t bNumEP; // total number of EP in the configuration
    54 
    56  /* Endpoint data structure */
    58  /* MIDI Event packet buffer */
    60  uint8_t readPtr;
    61 
    62  void parseConfigDescr(byte addr, byte conf);
    63  unsigned int countSysExDataSize(uint8_t *dataptr);
    64 #ifdef DEBUG_USB_HOST
    65  void PrintEndpointDescriptor( const USB_ENDPOINT_DESCRIPTOR* ep_ptr );
    66 #endif
    67 public:
    68  uint16_t pid, vid;
    69  USBH_MIDI(USB *p);
    70  // Methods for recieving and sending data
    71  uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr);
    72  uint8_t RecvData(uint8_t *outBuf);
    73  uint8_t SendData(uint8_t *dataptr, byte nCable=0);
    74  uint8_t SendSysEx(uint8_t *dataptr, unsigned int datasize, byte nCable=0);
    75  // backward compatibility functions
    76  inline uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr){ return RecvData(bytes_rcvd, dataptr); };
    77  inline uint8_t RcvData(uint8_t *outBuf){ return RecvData(outBuf); };
    78 
    79  // USBDeviceConfig implementation
    80  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
    81  virtual uint8_t Release();
    82  virtual uint8_t GetAddress() { return bAddress; };
    83 };
    84 
    85 #endif //_USBH_MIDI_H_
    static const uint8_t epDataInIndexVSP
    Definition: usbh_midi.h:45
    +Go to the documentation of this file.
    1 /*
    2  *******************************************************************************
    3  * USB-MIDI class driver for USB Host Shield 2.0 Library
    4  * Copyright (c) 2012-2018 Yuuichi Akagawa
    5  *
    6  * Idea from LPK25 USB-MIDI to Serial MIDI converter
    7  * by Collin Cunningham - makezine.com, narbotic.com
    8  *
    9  * for use with USB Host Shield 2.0 from Circuitsathome.com
    10  * https://github.com/felis/USB_Host_Shield_2.0
    11  *******************************************************************************
    12  * This program is free software; you can redistribute it and/or modify
    13  * it under the terms of the GNU General Public License as published by
    14  * the Free Software Foundation; either version 2 of the License, or
    15  * (at your option) any later version.
    16  *
    17  * This program is distributed in the hope that it will be useful,
    18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20  * GNU General Public License for more details.
    21  *
    22  * You should have received a copy of the GNU General Public License
    23  * along with this program. If not, see <http://www.gnu.org/licenses/>
    24  *******************************************************************************
    25  */
    26 
    27 #if !defined(_USBH_MIDI_H_)
    28 #define _USBH_MIDI_H_
    29 //#define DEBUG_USB_HOST
    30 #include "Usb.h"
    31 
    32 #define MIDI_MAX_ENDPOINTS 5 //endpoint 0, bulk_IN(MIDI), bulk_OUT(MIDI), bulk_IN(VSP), bulk_OUT(VSP)
    33 #define USB_SUBCLASS_MIDISTREAMING 3
    34 #define DESC_BUFF_SIZE 256
    35 #define MIDI_EVENT_PACKET_SIZE 64
    36 #define MIDI_MAX_SYSEX_SIZE 256
    37 class USBH_MIDI;
    38 
    39 class USBH_MIDI : public USBDeviceConfig
    40 {
    41 protected:
    42  static const uint8_t epDataInIndex; // DataIn endpoint index(MIDI)
    43  static const uint8_t epDataOutIndex; // DataOUT endpoint index(MIDI)
    44  static const uint8_t epDataInIndexVSP; // DataIn endpoint index(Vendor Specific Protocl)
    45  static const uint8_t epDataOutIndexVSP; // DataOUT endpoint index(Vendor Specific Protocl)
    46 
    47  /* mandatory members */
    49  uint8_t bAddress;
    50  uint8_t bConfNum; // configuration number
    51  uint8_t bNumEP; // total number of EP in the configuration
    54  uint16_t pid, vid; // ProductID, VendorID
    56  /* Endpoint data structure */
    58  /* MIDI Event packet buffer */
    60  uint8_t readPtr;
    61 
    62  uint8_t parseConfigDescr(uint8_t addr, uint8_t conf);
    63  uint16_t countSysExDataSize(uint8_t *dataptr);
    64  void setupDeviceSpecific();
    65 #ifdef DEBUG_USB_HOST
    66  void PrintEndpointDescriptor( const USB_ENDPOINT_DESCRIPTOR* ep_ptr );
    67 #endif
    68 public:
    69  USBH_MIDI(USB *p);
    70  // Misc functions
    71  operator bool() { return (pUsb->getUsbTaskState()==USB_STATE_RUNNING); }
    72  uint16_t idVendor() { return vid; }
    73  uint16_t idProduct() { return pid; }
    74  // Methods for recieving and sending data
    75  uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr);
    76  uint8_t RecvData(uint8_t *outBuf, bool isRaw=false);
    77  uint8_t RecvRawData(uint8_t *outBuf);
    78  uint8_t SendData(uint8_t *dataptr, uint8_t nCable=0);
    79  uint8_t lookupMsgSize(uint8_t midiMsg, uint8_t cin=0);
    80  uint8_t SendSysEx(uint8_t *dataptr, uint16_t datasize, uint8_t nCable=0);
    81  uint8_t extractSysExData(uint8_t *p, uint8_t *buf);
    82  uint8_t SendRawData(uint16_t bytes_send, uint8_t *dataptr);
    83  // backward compatibility functions
    84  inline uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) { return RecvData(bytes_rcvd, dataptr); };
    85  inline uint8_t RcvData(uint8_t *outBuf) { return RecvData(outBuf); };
    86 
    87  // USBDeviceConfig implementation
    88  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
    89  virtual uint8_t Release();
    90  virtual uint8_t GetAddress() { return bAddress; };
    91 };
    92 #endif //_USBH_MIDI_H_
    uint8_t SendSysEx(uint8_t *dataptr, uint16_t datasize, uint8_t nCable=0)
    Definition: usbh_midi.cpp:556
    +
    static const uint8_t epDataInIndexVSP
    Definition: usbh_midi.h:44
    +
    uint8_t bTransferTypeMask
    Definition: usbh_midi.h:55
    uint8_t readPtr
    Definition: usbh_midi.h:60
    -
    uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
    Definition: usbh_midi.h:76
    - -
    uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
    Definition: usbh_midi.cpp:321
    - -
    uint16_t vid
    Definition: usbh_midi.h:68
    -
    virtual uint8_t GetAddress()
    Definition: usbh_midi.h:82
    -
    virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
    Definition: usbh_midi.cpp:110
    - +
    uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
    Definition: usbh_midi.h:84
    + +
    uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
    Definition: usbh_midi.cpp:357
    + +
    uint16_t vid
    Definition: usbh_midi.h:54
    +
    virtual uint8_t GetAddress()
    Definition: usbh_midi.h:90
    +
    virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
    Definition: usbh_midi.cpp:108
    + -
    USB * pUsb
    Definition: usbh_midi.h:49
    -
    void parseConfigDescr(byte addr, byte conf)
    Definition: usbh_midi.cpp:240
    -
    static const uint8_t epDataOutIndexVSP
    Definition: usbh_midi.h:46
    -
    uint8_t bNumEP
    Definition: usbh_midi.h:52
    -
    uint8_t bAddress
    Definition: usbh_midi.h:50
    -
    Definition: address.h:32
    -
    uint16_t pid
    Definition: usbh_midi.h:68
    -
    virtual uint8_t Release()
    Definition: usbh_midi.cpp:310
    -
    bool isMidiFound
    Definition: usbh_midi.h:55
    -
    unsigned int countSysExDataSize(uint8_t *dataptr)
    Definition: usbh_midi.cpp:487
    -
    bool bPollEnable
    Definition: usbh_midi.h:53
    +
    USB * pUsb
    Definition: usbh_midi.h:48
    +
    uint8_t SendRawData(uint16_t bytes_send, uint8_t *dataptr)
    Definition: usbh_midi.cpp:613
    +
    uint16_t countSysExDataSize(uint8_t *dataptr)
    Definition: usbh_midi.cpp:532
    +
    static const uint8_t epDataOutIndexVSP
    Definition: usbh_midi.h:45
    +
    void setupDeviceSpecific()
    Definition: usbh_midi.cpp:345
    +
    #define USB_STATE_RUNNING
    Definition: UsbCore.h:129
    +
    uint8_t bNumEP
    Definition: usbh_midi.h:51
    +
    uint8_t bAddress
    Definition: usbh_midi.h:49
    +
    Definition: address.h:39
    +
    uint16_t pid
    Definition: usbh_midi.h:54
    +
    virtual uint8_t Release()
    Definition: usbh_midi.cpp:334
    +
    uint8_t RecvRawData(uint8_t *outBuf)
    Definition: usbh_midi.cpp:411
    +
    bool isMidiFound
    Definition: usbh_midi.h:53
    +
    bool bPollEnable
    Definition: usbh_midi.h:52
    USBH_MIDI(USB *p)
    Definition: usbh_midi.cpp:87
    -
    static const uint8_t epDataInIndex
    Definition: usbh_midi.h:43
    -
    #define MIDI_EVENT_PACKET_SIZE
    Definition: usbh_midi.h:34
    -
    uint8_t SendData(uint8_t *dataptr, byte nCable=0)
    Definition: usbh_midi.cpp:373
    +
    uint16_t idProduct()
    Definition: usbh_midi.h:73
    +
    static const uint8_t epDataInIndex
    Definition: usbh_midi.h:42
    +
    #define MIDI_EVENT_PACKET_SIZE
    Definition: usbh_midi.h:35
    +
    uint8_t lookupMsgSize(uint8_t midiMsg, uint8_t cin=0)
    Definition: usbh_midi.cpp:481
    uint8_t recvBuf[MIDI_EVENT_PACKET_SIZE]
    Definition: usbh_midi.h:59
    -
    uint8_t bConfNum
    Definition: usbh_midi.h:51
    +
    uint8_t getUsbTaskState(void)
    Definition: Usb.cpp:43
    +
    uint8_t bConfNum
    Definition: usbh_midi.h:50
    EpInfo epInfo[MIDI_MAX_ENDPOINTS]
    Definition: usbh_midi.h:57
    -
    uint8_t RcvData(uint8_t *outBuf)
    Definition: usbh_midi.h:77
    -
    static const uint8_t epDataOutIndex
    Definition: usbh_midi.h:44
    -
    #define MIDI_MAX_ENDPOINTS
    Definition: usbh_midi.h:31
    -
    Definition: UsbCore.h:197
    -
    uint8_t SendSysEx(uint8_t *dataptr, unsigned int datasize, byte nCable=0)
    Definition: usbh_midi.cpp:511
    +
    uint16_t idVendor()
    Definition: usbh_midi.h:72
    +
    uint8_t RcvData(uint8_t *outBuf)
    Definition: usbh_midi.h:85
    +
    uint8_t extractSysExData(uint8_t *p, uint8_t *buf)
    Definition: usbh_midi.cpp:619
    +
    uint8_t SendData(uint8_t *dataptr, uint8_t nCable=0)
    Definition: usbh_midi.cpp:417
    +
    static const uint8_t epDataOutIndex
    Definition: usbh_midi.h:43
    +
    #define MIDI_MAX_ENDPOINTS
    Definition: usbh_midi.h:32
    +
    uint8_t parseConfigDescr(uint8_t addr, uint8_t conf)
    Definition: usbh_midi.cpp:253
    +
    Definition: UsbCore.h:208
    diff --git a/usbhid_8cpp.html b/usbhid_8cpp.html index bb15a794..4a931770 100644 --- a/usbhid_8cpp.html +++ b/usbhid_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbhid.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    diff --git a/usbhid_8cpp__incl.md5 b/usbhid_8cpp__incl.md5 index dce4b596..2d07327c 100644 --- a/usbhid_8cpp__incl.md5 +++ b/usbhid_8cpp__incl.md5 @@ -1 +1 @@ -cb0939c5d3af83b28c75aafcf262109b \ No newline at end of file +88b391b4223f85557dbb3c537e743b14 \ No newline at end of file diff --git a/usbhid_8cpp__incl.png b/usbhid_8cpp__incl.png index b536c9b7..90a95206 100644 Binary files a/usbhid_8cpp__incl.png and b/usbhid_8cpp__incl.png differ diff --git a/usbhid_8cpp_source.html b/usbhid_8cpp_source.html index d40fa83c..d880e4c0 100644 --- a/usbhid_8cpp_source.html +++ b/usbhid_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbhid.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    USB * pUsb
    Definition: usbhid.h:145
    #define HID_REQUEST_SET_PROTOCOL
    Definition: usbhid.h:74
    uint8_t GetReportDescr(uint16_t wIndex, USBReadParser *parser=NULL)
    Definition: usbhid.cpp:34
    - - - + + +
    uint8_t GetProtocol(uint8_t iface, uint8_t *dataptr)
    Definition: usbhid.cpp:70
    -
    #define USB_REQUEST_GET_DESCRIPTOR
    Definition: usb_ch9.h:37
    -
    uint8_t bLength
    Definition: usb_ch9.h:152
    +
    #define USB_REQUEST_GET_DESCRIPTOR
    Definition: usb_ch9.h:44
    +
    uint8_t bLength
    Definition: usb_ch9.h:159
    #define bmREQ_HID_OUT
    Definition: usbhid.h:63
    #define bmREQ_HID_REPORT
    Definition: usbhid.h:65
    void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc)
    Definition: usbhid.cpp:90
    uint8_t GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)
    Definition: usbhid.cpp:54
    -
    uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
    Definition: Usb.cpp:126
    +
    uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
    Definition: Usb.cpp:133
    uint8_t SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)
    Definition: usbhid.cpp:62
    -
    #define Notify(...)
    Definition: message.h:44
    - - +
    #define Notify(...)
    Definition: message.h:51
    + +
    void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
    Definition: usbhid.cpp:74
    -
    uint16_t wDescriptorLength
    Definition: usb_ch9.h:158
    +
    uint16_t wDescriptorLength
    Definition: usb_ch9.h:165
    uint8_t GetIdle(uint8_t iface, uint8_t reportID, uint8_t *dataptr)
    Definition: usbhid.cpp:58
    -
    uint8_t bCountryCode
    Definition: usb_ch9.h:155
    +
    uint8_t bCountryCode
    Definition: usb_ch9.h:162
    uint8_t bAddress
    Definition: usbhid.h:146
    -
    uint16_t wMaxPacketSize
    Definition: usb_ch9.h:146
    -
    uint8_t bNumDescriptors
    Definition: usb_ch9.h:156
    -
    uint8_t bEndpointAddress
    Definition: usb_ch9.h:144
    - -
    uint8_t bDescriptorType
    Definition: usb_ch9.h:153
    -
    #define PSTR(str)
    - +
    uint16_t wMaxPacketSize
    Definition: usb_ch9.h:153
    +
    uint8_t bNumDescriptors
    Definition: usb_ch9.h:163
    +
    uint8_t bEndpointAddress
    Definition: usb_ch9.h:151
    + +
    uint8_t bDescriptorType
    Definition: usb_ch9.h:160
    +
    #define PSTR(str)
    +
    uint8_t SetProtocol(uint8_t iface, uint8_t protocol)
    Definition: usbhid.cpp:66
    #define HID_REQUEST_GET_IDLE
    Definition: usbhid.h:70
    @@ -129,15 +109,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    #define HID_DESCRIPTOR_REPORT
    Definition: usbhid.h:78
    #define HID_REQUEST_SET_REPORT
    Definition: usbhid.h:72
    #define HID_REQUEST_GET_REPORT
    Definition: usbhid.h:69
    -
    uint16_t bcdHID
    Definition: usb_ch9.h:154
    -
    uint8_t bDescrType
    Definition: usb_ch9.h:157
    +
    uint16_t bcdHID
    Definition: usb_ch9.h:161
    +
    uint8_t bDescrType
    Definition: usb_ch9.h:164
    #define HID_REQUEST_GET_PROTOCOL
    Definition: usbhid.h:71
    diff --git a/usbhid_8h.html b/usbhid_8h.html index ad48bade..5a7ea2cc 100644 --- a/usbhid_8h.html +++ b/usbhid_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbhid.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    - - - - - - - + + + + + + + - + @@ -296,7 +276,9 @@ Macros  

    Macro Definition Documentation

    - + +

    ◆ MAX_REPORT_PARSERS

    +
    @@ -306,11 +288,13 @@ Macros
    -

    Definition at line 23 of file usbhid.h.

    +

    Definition at line 23 of file usbhid.h.

    - + +

    ◆ HID_MAX_HID_CLASS_DESCRIPTORS

    +
    @@ -320,11 +304,13 @@ Macros
    -

    Definition at line 24 of file usbhid.h.

    +

    Definition at line 24 of file usbhid.h.

    - + +

    ◆ DATA_SIZE_MASK

    +
    @@ -334,11 +320,13 @@ Macros
    -

    Definition at line 26 of file usbhid.h.

    +

    Definition at line 26 of file usbhid.h.

    - + +

    ◆ TYPE_MASK

    +
    @@ -348,11 +336,13 @@ Macros
    -

    Definition at line 27 of file usbhid.h.

    +

    Definition at line 27 of file usbhid.h.

    - + +

    ◆ TAG_MASK

    +
    @@ -362,11 +352,13 @@ Macros
    -

    Definition at line 28 of file usbhid.h.

    +

    Definition at line 28 of file usbhid.h.

    - + +

    ◆ DATA_SIZE_0

    +
    @@ -376,11 +368,13 @@ Macros
    -

    Definition at line 30 of file usbhid.h.

    +

    Definition at line 30 of file usbhid.h.

    - + +

    ◆ DATA_SIZE_1

    +
    @@ -390,11 +384,13 @@ Macros
    -

    Definition at line 31 of file usbhid.h.

    +

    Definition at line 31 of file usbhid.h.

    - + +

    ◆ DATA_SIZE_2

    +
    @@ -404,11 +400,13 @@ Macros
    -

    Definition at line 32 of file usbhid.h.

    +

    Definition at line 32 of file usbhid.h.

    - + +

    ◆ DATA_SIZE_4

    +
    @@ -418,11 +416,13 @@ Macros
    -

    Definition at line 33 of file usbhid.h.

    +

    Definition at line 33 of file usbhid.h.

    - + +

    ◆ TYPE_MAIN

    +
    @@ -432,11 +432,13 @@ Macros
    -

    Definition at line 35 of file usbhid.h.

    +

    Definition at line 35 of file usbhid.h.

    - + +

    ◆ TYPE_GLOBAL

    +
    @@ -446,11 +448,13 @@ Macros
    -

    Definition at line 36 of file usbhid.h.

    +

    Definition at line 36 of file usbhid.h.

    - + +

    ◆ TYPE_LOCAL

    +
    @@ -460,11 +464,13 @@ Macros
    -

    Definition at line 37 of file usbhid.h.

    +

    Definition at line 37 of file usbhid.h.

    - + +

    ◆ TAG_MAIN_INPUT

    +
    @@ -474,11 +480,13 @@ Macros
    -

    Definition at line 39 of file usbhid.h.

    +

    Definition at line 39 of file usbhid.h.

    - + +

    ◆ TAG_MAIN_OUTPUT

    +
    @@ -488,11 +496,13 @@ Macros
    -

    Definition at line 40 of file usbhid.h.

    +

    Definition at line 40 of file usbhid.h.

    - + +

    ◆ TAG_MAIN_COLLECTION

    +
    @@ -502,11 +512,13 @@ Macros
    -

    Definition at line 41 of file usbhid.h.

    +

    Definition at line 41 of file usbhid.h.

    - + +

    ◆ TAG_MAIN_FEATURE

    +
    @@ -516,11 +528,13 @@ Macros
    -

    Definition at line 42 of file usbhid.h.

    +

    Definition at line 42 of file usbhid.h.

    - + +

    ◆ TAG_MAIN_ENDCOLLECTION

    +
    @@ -530,11 +544,13 @@ Macros
    -

    Definition at line 43 of file usbhid.h.

    +

    Definition at line 43 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_USAGEPAGE

    +
    @@ -544,11 +560,13 @@ Macros
    -

    Definition at line 45 of file usbhid.h.

    +

    Definition at line 45 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_LOGICALMIN

    +
    @@ -558,11 +576,13 @@ Macros
    -

    Definition at line 46 of file usbhid.h.

    +

    Definition at line 46 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_LOGICALMAX

    +
    @@ -572,11 +592,13 @@ Macros
    -

    Definition at line 47 of file usbhid.h.

    +

    Definition at line 47 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_PHYSMIN

    +
    @@ -586,11 +608,13 @@ Macros
    -

    Definition at line 48 of file usbhid.h.

    +

    Definition at line 48 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_PHYSMAX

    +
    @@ -600,11 +624,13 @@ Macros
    -

    Definition at line 49 of file usbhid.h.

    +

    Definition at line 49 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_UNITEXP

    +
    @@ -614,11 +640,13 @@ Macros
    -

    Definition at line 50 of file usbhid.h.

    +

    Definition at line 50 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_UNIT

    +
    @@ -628,11 +656,13 @@ Macros
    -

    Definition at line 51 of file usbhid.h.

    +

    Definition at line 51 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_REPORTSIZE

    +
    @@ -642,11 +672,13 @@ Macros
    -

    Definition at line 52 of file usbhid.h.

    +

    Definition at line 52 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_REPORTID

    +
    @@ -656,11 +688,13 @@ Macros
    -

    Definition at line 53 of file usbhid.h.

    +

    Definition at line 53 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_REPORTCOUNT

    +
    @@ -670,11 +704,13 @@ Macros
    -

    Definition at line 54 of file usbhid.h.

    +

    Definition at line 54 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_PUSH

    +
    @@ -684,11 +720,13 @@ Macros
    -

    Definition at line 55 of file usbhid.h.

    +

    Definition at line 55 of file usbhid.h.

    - + +

    ◆ TAG_GLOBAL_POP

    +
    @@ -698,11 +736,13 @@ Macros
    -

    Definition at line 56 of file usbhid.h.

    +

    Definition at line 56 of file usbhid.h.

    - + +

    ◆ TAG_LOCAL_USAGE

    +
    @@ -712,11 +752,13 @@ Macros
    -

    Definition at line 58 of file usbhid.h.

    +

    Definition at line 58 of file usbhid.h.

    - + +

    ◆ TAG_LOCAL_USAGEMIN

    +
    @@ -726,11 +768,13 @@ Macros
    -

    Definition at line 59 of file usbhid.h.

    +

    Definition at line 59 of file usbhid.h.

    - + +

    ◆ TAG_LOCAL_USAGEMAX

    +
    @@ -740,11 +784,13 @@ Macros
    -

    Definition at line 60 of file usbhid.h.

    +

    Definition at line 60 of file usbhid.h.

    - + +

    ◆ bmREQ_HID_OUT

    +
    @@ -754,11 +800,13 @@ Macros
    -

    Definition at line 63 of file usbhid.h.

    +

    Definition at line 63 of file usbhid.h.

    - + +

    ◆ bmREQ_HID_IN

    +
    @@ -768,11 +816,13 @@ Macros
    -

    Definition at line 64 of file usbhid.h.

    +

    Definition at line 64 of file usbhid.h.

    - + +

    ◆ bmREQ_HID_REPORT

    +
    @@ -782,11 +832,13 @@ Macros
    -

    Definition at line 65 of file usbhid.h.

    +

    Definition at line 65 of file usbhid.h.

    - + +

    ◆ HID_REQUEST_GET_REPORT

    +
    @@ -796,11 +848,13 @@ Macros
    -

    Definition at line 69 of file usbhid.h.

    +

    Definition at line 69 of file usbhid.h.

    - + +

    ◆ HID_REQUEST_GET_IDLE

    +
    @@ -810,11 +864,13 @@ Macros
    -

    Definition at line 70 of file usbhid.h.

    +

    Definition at line 70 of file usbhid.h.

    - + +

    ◆ HID_REQUEST_GET_PROTOCOL

    +
    @@ -824,11 +880,13 @@ Macros
    -

    Definition at line 71 of file usbhid.h.

    +

    Definition at line 71 of file usbhid.h.

    - + +

    ◆ HID_REQUEST_SET_REPORT

    +
    @@ -838,11 +896,13 @@ Macros
    -

    Definition at line 72 of file usbhid.h.

    +

    Definition at line 72 of file usbhid.h.

    - + +

    ◆ HID_REQUEST_SET_IDLE

    +
    @@ -852,11 +912,13 @@ Macros
    -

    Definition at line 73 of file usbhid.h.

    +

    Definition at line 73 of file usbhid.h.

    - + +

    ◆ HID_REQUEST_SET_PROTOCOL

    +
    @@ -866,11 +928,13 @@ Macros
    -

    Definition at line 74 of file usbhid.h.

    +

    Definition at line 74 of file usbhid.h.

    - + +

    ◆ HID_DESCRIPTOR_HID

    +
    @@ -880,11 +944,13 @@ Macros
    -

    Definition at line 77 of file usbhid.h.

    +

    Definition at line 77 of file usbhid.h.

    - + +

    ◆ HID_DESCRIPTOR_REPORT

    +
    @@ -894,11 +960,13 @@ Macros
    -

    Definition at line 78 of file usbhid.h.

    +

    Definition at line 78 of file usbhid.h.

    - + +

    ◆ HID_DESRIPTOR_PHY

    +
    @@ -908,11 +976,13 @@ Macros
    -

    Definition at line 79 of file usbhid.h.

    +

    Definition at line 79 of file usbhid.h.

    - + +

    ◆ USB_HID_BOOT_PROTOCOL

    +
    @@ -922,11 +992,13 @@ Macros
    -

    Definition at line 82 of file usbhid.h.

    +

    Definition at line 82 of file usbhid.h.

    - + +

    ◆ HID_RPT_PROTOCOL

    +
    @@ -936,11 +1008,13 @@ Macros
    -

    Definition at line 83 of file usbhid.h.

    +

    Definition at line 83 of file usbhid.h.

    - + +

    ◆ HID_INTF

    +
    @@ -950,11 +1024,13 @@ Macros
    -

    Definition at line 86 of file usbhid.h.

    +

    Definition at line 86 of file usbhid.h.

    - + +

    ◆ HID_BOOT_INTF_SUBCLASS

    +
    @@ -964,11 +1040,13 @@ Macros
    -

    Definition at line 89 of file usbhid.h.

    +

    Definition at line 89 of file usbhid.h.

    - + +

    ◆ USB_HID_PROTOCOL_NONE

    +
    @@ -978,11 +1056,13 @@ Macros
    -

    Definition at line 92 of file usbhid.h.

    +

    Definition at line 92 of file usbhid.h.

    - + +

    ◆ USB_HID_PROTOCOL_KEYBOARD

    +
    @@ -992,11 +1072,13 @@ Macros
    -

    Definition at line 93 of file usbhid.h.

    +

    Definition at line 93 of file usbhid.h.

    - + +

    ◆ USB_HID_PROTOCOL_MOUSE

    +
    @@ -1006,11 +1088,13 @@ Macros
    -

    Definition at line 94 of file usbhid.h.

    +

    Definition at line 94 of file usbhid.h.

    - + +

    ◆ HID_ITEM_TYPE_MAIN

    +
    @@ -1020,11 +1104,13 @@ Macros
    -

    Definition at line 96 of file usbhid.h.

    +

    Definition at line 96 of file usbhid.h.

    - + +

    ◆ HID_ITEM_TYPE_GLOBAL

    +
    @@ -1034,11 +1120,13 @@ Macros
    -

    Definition at line 97 of file usbhid.h.

    +

    Definition at line 97 of file usbhid.h.

    - + +

    ◆ HID_ITEM_TYPE_LOCAL

    +
    @@ -1048,11 +1136,13 @@ Macros
    -

    Definition at line 98 of file usbhid.h.

    +

    Definition at line 98 of file usbhid.h.

    - + +

    ◆ HID_ITEM_TYPE_RESERVED

    +
    @@ -1062,11 +1152,13 @@ Macros
    -

    Definition at line 99 of file usbhid.h.

    +

    Definition at line 99 of file usbhid.h.

    - + +

    ◆ HID_LONG_ITEM_PREFIX

    +
    @@ -1076,11 +1168,13 @@ Macros
    -

    Definition at line 101 of file usbhid.h.

    +

    Definition at line 101 of file usbhid.h.

    - + +

    ◆ bmHID_MAIN_ITEM_TAG

    +
    @@ -1090,11 +1184,13 @@ Macros
    -

    Definition at line 103 of file usbhid.h.

    +

    Definition at line 103 of file usbhid.h.

    - + +

    ◆ bmHID_MAIN_ITEM_INPUT

    +
    @@ -1104,11 +1200,13 @@ Macros
    -

    Definition at line 105 of file usbhid.h.

    +

    Definition at line 105 of file usbhid.h.

    - + +

    ◆ bmHID_MAIN_ITEM_OUTPUT

    +
    @@ -1118,11 +1216,13 @@ Macros
    -

    Definition at line 106 of file usbhid.h.

    +

    Definition at line 106 of file usbhid.h.

    - + +

    ◆ bmHID_MAIN_ITEM_FEATURE

    +
    @@ -1132,11 +1232,13 @@ Macros
    -

    Definition at line 107 of file usbhid.h.

    +

    Definition at line 107 of file usbhid.h.

    - + +

    ◆ bmHID_MAIN_ITEM_COLLECTION

    +
    @@ -1146,11 +1248,13 @@ Macros
    -

    Definition at line 108 of file usbhid.h.

    +

    Definition at line 108 of file usbhid.h.

    - + +

    ◆ bmHID_MAIN_ITEM_END_COLLECTION

    +
    @@ -1160,11 +1264,13 @@ Macros
    -

    Definition at line 109 of file usbhid.h.

    +

    Definition at line 109 of file usbhid.h.

    - + +

    ◆ HID_MAIN_ITEM_COLLECTION_PHYSICAL

    +
    @@ -1174,11 +1280,13 @@ Macros
    -

    Definition at line 111 of file usbhid.h.

    +

    Definition at line 111 of file usbhid.h.

    - + +

    ◆ HID_MAIN_ITEM_COLLECTION_APPLICATION

    +
    @@ -1188,11 +1296,13 @@ Macros
    -

    Definition at line 112 of file usbhid.h.

    +

    Definition at line 112 of file usbhid.h.

    - + +

    ◆ HID_MAIN_ITEM_COLLECTION_LOGICAL

    +
    @@ -1202,11 +1312,13 @@ Macros
    -

    Definition at line 113 of file usbhid.h.

    +

    Definition at line 113 of file usbhid.h.

    - + +

    ◆ HID_MAIN_ITEM_COLLECTION_REPORT

    +
    @@ -1216,11 +1328,13 @@ Macros
    -

    Definition at line 114 of file usbhid.h.

    +

    Definition at line 114 of file usbhid.h.

    - + +

    ◆ HID_MAIN_ITEM_COLLECTION_NAMED_ARRAY

    +
    @@ -1230,11 +1344,13 @@ Macros
    -

    Definition at line 115 of file usbhid.h.

    +

    Definition at line 115 of file usbhid.h.

    - + +

    ◆ HID_MAIN_ITEM_COLLECTION_USAGE_SWITCH

    +
    @@ -1244,11 +1360,13 @@ Macros
    -

    Definition at line 116 of file usbhid.h.

    +

    Definition at line 116 of file usbhid.h.

    - + +

    ◆ HID_MAIN_ITEM_COLLECTION_USAGE_MODIFIER

    +
    @@ -1258,7 +1376,7 @@ Macros
    -

    Definition at line 117 of file usbhid.h.

    +

    Definition at line 117 of file usbhid.h.

    @@ -1267,7 +1385,7 @@ Macros diff --git a/usbhid_8h__dep__incl.map b/usbhid_8h__dep__incl.map index 0bf4f6d6..aad59078 100644 --- a/usbhid_8h__dep__incl.map +++ b/usbhid_8h__dep__incl.map @@ -1,16 +1,16 @@ - - - - - - - + + + + + + + - + diff --git a/usbhid_8h__dep__incl.md5 b/usbhid_8h__dep__incl.md5 index 2d38b0b5..947669f3 100644 --- a/usbhid_8h__dep__incl.md5 +++ b/usbhid_8h__dep__incl.md5 @@ -1 +1 @@ -8f73ae6a8cebb1d7009cf73c1970aa45 \ No newline at end of file +876b5629de44a53591bfdad73eed5881 \ No newline at end of file diff --git a/usbhid_8h__dep__incl.png b/usbhid_8h__dep__incl.png index cda8c4b0..85ea4297 100644 Binary files a/usbhid_8h__dep__incl.png and b/usbhid_8h__dep__incl.png differ diff --git a/usbhid_8h__incl.md5 b/usbhid_8h__incl.md5 index ba8adb10..14c96477 100644 --- a/usbhid_8h__incl.md5 +++ b/usbhid_8h__incl.md5 @@ -1 +1 @@ -4e9e1ed0acf270d1a001d814d2a4228b \ No newline at end of file +ac548c483673afe5ff5ba629fee3d877 \ No newline at end of file diff --git a/usbhid_8h__incl.png b/usbhid_8h__incl.png index 1284896e..dbb23483 100644 Binary files a/usbhid_8h__incl.png and b/usbhid_8h__incl.png differ diff --git a/usbhid_8h_source.html b/usbhid_8h_source.html index d8dd60ef..5043c3b3 100644 --- a/usbhid_8h_source.html +++ b/usbhid_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbhid.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    usbhid.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 #if !defined(__USBHID_H__)
    18 #define __USBHID_H__
    19 
    20 #include "Usb.h"
    21 #include "hidusagestr.h"
    22 
    23 #define MAX_REPORT_PARSERS 2
    24 #define HID_MAX_HID_CLASS_DESCRIPTORS 5
    25 
    26 #define DATA_SIZE_MASK 0x03
    27 #define TYPE_MASK 0x0C
    28 #define TAG_MASK 0xF0
    29 
    30 #define DATA_SIZE_0 0x00
    31 #define DATA_SIZE_1 0x01
    32 #define DATA_SIZE_2 0x02
    33 #define DATA_SIZE_4 0x03
    34 
    35 #define TYPE_MAIN 0x00
    36 #define TYPE_GLOBAL 0x04
    37 #define TYPE_LOCAL 0x08
    38 
    39 #define TAG_MAIN_INPUT 0x80
    40 #define TAG_MAIN_OUTPUT 0x90
    41 #define TAG_MAIN_COLLECTION 0xA0
    42 #define TAG_MAIN_FEATURE 0xB0
    43 #define TAG_MAIN_ENDCOLLECTION 0xC0
    44 
    45 #define TAG_GLOBAL_USAGEPAGE 0x00
    46 #define TAG_GLOBAL_LOGICALMIN 0x10
    47 #define TAG_GLOBAL_LOGICALMAX 0x20
    48 #define TAG_GLOBAL_PHYSMIN 0x30
    49 #define TAG_GLOBAL_PHYSMAX 0x40
    50 #define TAG_GLOBAL_UNITEXP 0x50
    51 #define TAG_GLOBAL_UNIT 0x60
    52 #define TAG_GLOBAL_REPORTSIZE 0x70
    53 #define TAG_GLOBAL_REPORTID 0x80
    54 #define TAG_GLOBAL_REPORTCOUNT 0x90
    55 #define TAG_GLOBAL_PUSH 0xA0
    56 #define TAG_GLOBAL_POP 0xB0
    57 
    58 #define TAG_LOCAL_USAGE 0x00
    59 #define TAG_LOCAL_USAGEMIN 0x10
    60 #define TAG_LOCAL_USAGEMAX 0x20
    61 
    62 /* HID requests */
    63 #define bmREQ_HID_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
    64 #define bmREQ_HID_IN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
    65 #define bmREQ_HID_REPORT USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_INTERFACE
    66 
    67 /* HID constants. Not part of chapter 9 */
    68 /* Class-Specific Requests */
    69 #define HID_REQUEST_GET_REPORT 0x01
    70 #define HID_REQUEST_GET_IDLE 0x02
    71 #define HID_REQUEST_GET_PROTOCOL 0x03
    72 #define HID_REQUEST_SET_REPORT 0x09
    73 #define HID_REQUEST_SET_IDLE 0x0A
    74 #define HID_REQUEST_SET_PROTOCOL 0x0B
    75 
    76 /* Class Descriptor Types */
    77 #define HID_DESCRIPTOR_HID 0x21
    78 #define HID_DESCRIPTOR_REPORT 0x22
    79 #define HID_DESRIPTOR_PHY 0x23
    80 
    81 /* Protocol Selection */
    82 #define USB_HID_BOOT_PROTOCOL 0x00
    83 #define HID_RPT_PROTOCOL 0x01
    84 
    85 /* HID Interface Class Code */
    86 #define HID_INTF 0x03
    87 
    88 /* HID Interface Class SubClass Codes */
    89 #define HID_BOOT_INTF_SUBCLASS 0x01
    90 
    91 /* HID Interface Class Protocol Codes */
    92 #define USB_HID_PROTOCOL_NONE 0x00
    93 #define USB_HID_PROTOCOL_KEYBOARD 0x01
    94 #define USB_HID_PROTOCOL_MOUSE 0x02
    95 
    96 #define HID_ITEM_TYPE_MAIN 0
    97 #define HID_ITEM_TYPE_GLOBAL 1
    98 #define HID_ITEM_TYPE_LOCAL 2
    99 #define HID_ITEM_TYPE_RESERVED 3
    100 
    101 #define HID_LONG_ITEM_PREFIX 0xfe // Long item prefix value
    102 
    103 #define bmHID_MAIN_ITEM_TAG 0xfc // Main item tag mask
    104 
    105 #define bmHID_MAIN_ITEM_INPUT 0x80 // Main item Input tag value
    106 #define bmHID_MAIN_ITEM_OUTPUT 0x90 // Main item Output tag value
    107 #define bmHID_MAIN_ITEM_FEATURE 0xb0 // Main item Feature tag value
    108 #define bmHID_MAIN_ITEM_COLLECTION 0xa0 // Main item Collection tag value
    109 #define bmHID_MAIN_ITEM_END_COLLECTION 0xce // Main item End Collection tag value
    110 
    111 #define HID_MAIN_ITEM_COLLECTION_PHYSICAL 0
    112 #define HID_MAIN_ITEM_COLLECTION_APPLICATION 1
    113 #define HID_MAIN_ITEM_COLLECTION_LOGICAL 2
    114 #define HID_MAIN_ITEM_COLLECTION_REPORT 3
    115 #define HID_MAIN_ITEM_COLLECTION_NAMED_ARRAY 4
    116 #define HID_MAIN_ITEM_COLLECTION_USAGE_SWITCH 5
    117 #define HID_MAIN_ITEM_COLLECTION_USAGE_MODIFIER 6
    118 
    120  uint8_t bSize : 2;
    121  uint8_t bType : 2;
    122  uint8_t bTag : 4;
    123 };
    124 
    126  uint8_t bmIsConstantOrData : 1;
    127  uint8_t bmIsArrayOrVariable : 1;
    128  uint8_t bmIsRelativeOrAbsolute : 1;
    129  uint8_t bmIsWrapOrNoWrap : 1;
    130  uint8_t bmIsNonLonearOrLinear : 1;
    131  uint8_t bmIsNoPreferedOrPrefered : 1;
    132  uint8_t bmIsNullOrNoNull : 1;
    133  uint8_t bmIsVolatileOrNonVolatile : 1;
    134 };
    135 
    136 class USBHID;
    137 
    139 public:
    140  virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) = 0;
    141 };
    142 
    143 class USBHID : public USBDeviceConfig, public UsbConfigXtracter {
    144 protected:
    145  USB *pUsb; // USB class instance pointer
    146  uint8_t bAddress; // address
    147 
    148 protected:
    149  static const uint8_t epInterruptInIndex = 1; // InterruptIN endpoint index
    150  static const uint8_t epInterruptOutIndex = 2; // InterruptOUT endpoint index
    151 
    152  static const uint8_t maxHidInterfaces = 3;
    153  static const uint8_t maxEpPerInterface = 2;
    154  static const uint8_t totalEndpoints = (maxHidInterfaces * maxEpPerInterface + 1);
    155 
    156  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
    157  void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc);
    158 
    159  virtual HIDReportParser* GetReportParser(uint8_t id) {
    160  return NULL;
    161  };
    162 
    163 public:
    164 
    165  USBHID(USB *pusb) : pUsb(pusb) {
    166  };
    167 
    168  const USB* GetUsb() {
    169  return pUsb;
    170  };
    171 
    172  virtual bool SetReportParser(uint8_t id, HIDReportParser *prs) {
    173  return false;
    174  };
    175 
    176  uint8_t SetProtocol(uint8_t iface, uint8_t protocol);
    177  uint8_t GetProtocol(uint8_t iface, uint8_t* dataptr);
    178  uint8_t GetIdle(uint8_t iface, uint8_t reportID, uint8_t* dataptr);
    179  uint8_t SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration);
    180 
    181  uint8_t GetReportDescr(uint16_t wIndex, USBReadParser *parser = NULL);
    182 
    183  uint8_t GetHidDescr(uint8_t ep, uint16_t nbytes, uint8_t* dataptr);
    184  uint8_t GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t* dataptr);
    185  uint8_t SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t* dataptr);
    186 };
    187 
    188 #endif // __USBHID_H__
    Definition: usbhid.h:143
    +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 #if !defined(__USBHID_H__)
    18 #define __USBHID_H__
    19 
    20 #include "Usb.h"
    21 #include "hidusagestr.h"
    22 
    23 #define MAX_REPORT_PARSERS 2
    24 #define HID_MAX_HID_CLASS_DESCRIPTORS 5
    25 
    26 #define DATA_SIZE_MASK 0x03
    27 #define TYPE_MASK 0x0C
    28 #define TAG_MASK 0xF0
    29 
    30 #define DATA_SIZE_0 0x00
    31 #define DATA_SIZE_1 0x01
    32 #define DATA_SIZE_2 0x02
    33 #define DATA_SIZE_4 0x03
    34 
    35 #define TYPE_MAIN 0x00
    36 #define TYPE_GLOBAL 0x04
    37 #define TYPE_LOCAL 0x08
    38 
    39 #define TAG_MAIN_INPUT 0x80
    40 #define TAG_MAIN_OUTPUT 0x90
    41 #define TAG_MAIN_COLLECTION 0xA0
    42 #define TAG_MAIN_FEATURE 0xB0
    43 #define TAG_MAIN_ENDCOLLECTION 0xC0
    44 
    45 #define TAG_GLOBAL_USAGEPAGE 0x00
    46 #define TAG_GLOBAL_LOGICALMIN 0x10
    47 #define TAG_GLOBAL_LOGICALMAX 0x20
    48 #define TAG_GLOBAL_PHYSMIN 0x30
    49 #define TAG_GLOBAL_PHYSMAX 0x40
    50 #define TAG_GLOBAL_UNITEXP 0x50
    51 #define TAG_GLOBAL_UNIT 0x60
    52 #define TAG_GLOBAL_REPORTSIZE 0x70
    53 #define TAG_GLOBAL_REPORTID 0x80
    54 #define TAG_GLOBAL_REPORTCOUNT 0x90
    55 #define TAG_GLOBAL_PUSH 0xA0
    56 #define TAG_GLOBAL_POP 0xB0
    57 
    58 #define TAG_LOCAL_USAGE 0x00
    59 #define TAG_LOCAL_USAGEMIN 0x10
    60 #define TAG_LOCAL_USAGEMAX 0x20
    61 
    62 /* HID requests */
    63 #define bmREQ_HID_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
    64 #define bmREQ_HID_IN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
    65 #define bmREQ_HID_REPORT USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_INTERFACE
    66 
    67 /* HID constants. Not part of chapter 9 */
    68 /* Class-Specific Requests */
    69 #define HID_REQUEST_GET_REPORT 0x01
    70 #define HID_REQUEST_GET_IDLE 0x02
    71 #define HID_REQUEST_GET_PROTOCOL 0x03
    72 #define HID_REQUEST_SET_REPORT 0x09
    73 #define HID_REQUEST_SET_IDLE 0x0A
    74 #define HID_REQUEST_SET_PROTOCOL 0x0B
    75 
    76 /* Class Descriptor Types */
    77 #define HID_DESCRIPTOR_HID 0x21
    78 #define HID_DESCRIPTOR_REPORT 0x22
    79 #define HID_DESRIPTOR_PHY 0x23
    80 
    81 /* Protocol Selection */
    82 #define USB_HID_BOOT_PROTOCOL 0x00
    83 #define HID_RPT_PROTOCOL 0x01
    84 
    85 /* HID Interface Class Code */
    86 #define HID_INTF 0x03
    87 
    88 /* HID Interface Class SubClass Codes */
    89 #define HID_BOOT_INTF_SUBCLASS 0x01
    90 
    91 /* HID Interface Class Protocol Codes */
    92 #define USB_HID_PROTOCOL_NONE 0x00
    93 #define USB_HID_PROTOCOL_KEYBOARD 0x01
    94 #define USB_HID_PROTOCOL_MOUSE 0x02
    95 
    96 #define HID_ITEM_TYPE_MAIN 0
    97 #define HID_ITEM_TYPE_GLOBAL 1
    98 #define HID_ITEM_TYPE_LOCAL 2
    99 #define HID_ITEM_TYPE_RESERVED 3
    100 
    101 #define HID_LONG_ITEM_PREFIX 0xfe // Long item prefix value
    102 
    103 #define bmHID_MAIN_ITEM_TAG 0xfc // Main item tag mask
    104 
    105 #define bmHID_MAIN_ITEM_INPUT 0x80 // Main item Input tag value
    106 #define bmHID_MAIN_ITEM_OUTPUT 0x90 // Main item Output tag value
    107 #define bmHID_MAIN_ITEM_FEATURE 0xb0 // Main item Feature tag value
    108 #define bmHID_MAIN_ITEM_COLLECTION 0xa0 // Main item Collection tag value
    109 #define bmHID_MAIN_ITEM_END_COLLECTION 0xce // Main item End Collection tag value
    110 
    111 #define HID_MAIN_ITEM_COLLECTION_PHYSICAL 0
    112 #define HID_MAIN_ITEM_COLLECTION_APPLICATION 1
    113 #define HID_MAIN_ITEM_COLLECTION_LOGICAL 2
    114 #define HID_MAIN_ITEM_COLLECTION_REPORT 3
    115 #define HID_MAIN_ITEM_COLLECTION_NAMED_ARRAY 4
    116 #define HID_MAIN_ITEM_COLLECTION_USAGE_SWITCH 5
    117 #define HID_MAIN_ITEM_COLLECTION_USAGE_MODIFIER 6
    118 
    120  uint8_t bSize : 2;
    121  uint8_t bType : 2;
    122  uint8_t bTag : 4;
    123 };
    124 
    126  uint8_t bmIsConstantOrData : 1;
    127  uint8_t bmIsArrayOrVariable : 1;
    129  uint8_t bmIsWrapOrNoWrap : 1;
    132  uint8_t bmIsNullOrNoNull : 1;
    134 };
    135 
    136 class USBHID;
    137 
    139 public:
    140  virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) = 0;
    141 };
    142 
    143 class USBHID : public USBDeviceConfig, public UsbConfigXtracter {
    144 protected:
    145  USB *pUsb; // USB class instance pointer
    146  uint8_t bAddress; // address
    147 
    148 protected:
    149  static const uint8_t epInterruptInIndex = 1; // InterruptIN endpoint index
    150  static const uint8_t epInterruptOutIndex = 2; // InterruptOUT endpoint index
    151 
    152  static const uint8_t maxHidInterfaces = 3;
    153  static const uint8_t maxEpPerInterface = 2;
    154  static const uint8_t totalEndpoints = (maxHidInterfaces * maxEpPerInterface + 1);
    155 
    157  void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc);
    158 
    159  virtual HIDReportParser* GetReportParser(uint8_t id __attribute__((unused))) {
    160  return NULL;
    161  };
    162 
    163 public:
    164 
    165  USBHID(USB *pusb) : pUsb(pusb) {
    166  };
    167 
    168  const USB* GetUsb() {
    169  return pUsb;
    170  };
    171 
    172  virtual bool SetReportParser(uint8_t id __attribute__((unused)), HIDReportParser *prs __attribute__((unused))) {
    173  return false;
    174  };
    175 
    176  uint8_t SetProtocol(uint8_t iface, uint8_t protocol);
    177  uint8_t GetProtocol(uint8_t iface, uint8_t* dataptr);
    178  uint8_t GetIdle(uint8_t iface, uint8_t reportID, uint8_t* dataptr);
    179  uint8_t SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration);
    180 
    181  uint8_t GetReportDescr(uint16_t wIndex, USBReadParser *parser = NULL);
    182 
    183  uint8_t GetHidDescr(uint8_t ep, uint16_t nbytes, uint8_t* dataptr);
    184  uint8_t GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t* dataptr);
    185  uint8_t SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t* dataptr);
    186 };
    187 
    188 #endif // __USBHID_H__
    Definition: usbhid.h:143
    USB * pUsb
    Definition: usbhid.h:145
    - - +
    uint8_t GetHidDescr(uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
    +
    uint8_t GetReportDescr(uint16_t wIndex, USBReadParser *parser=NULL)
    Definition: usbhid.cpp:34
    + +
    uint8_t bmIsConstantOrData
    Definition: usbhid.h:126
    +
    uint8_t GetProtocol(uint8_t iface, uint8_t *dataptr)
    Definition: usbhid.cpp:70
    + +
    uint8_t bmIsArrayOrVariable
    Definition: usbhid.h:127
    +
    void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc)
    Definition: usbhid.cpp:90
    +
    uint8_t GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)
    Definition: usbhid.cpp:54
    uint8_t bTag
    Definition: usbhid.h:122
    uint8_t bType
    Definition: usbhid.h:121
    - +
    uint8_t SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)
    Definition: usbhid.cpp:62
    +
    uint8_t bSize
    Definition: usbhid.h:120
    +
    uint8_t bmIsWrapOrNoWrap
    Definition: usbhid.h:129
    const USB * GetUsb()
    Definition: usbhid.h:168
    +
    void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
    Definition: usbhid.cpp:74
    +
    uint8_t bmIsVolatileOrNonVolatile
    Definition: usbhid.h:133
    +
    uint8_t GetIdle(uint8_t iface, uint8_t reportID, uint8_t *dataptr)
    Definition: usbhid.cpp:58
    +
    static const uint8_t epInterruptOutIndex
    Definition: usbhid.h:150
    uint8_t bAddress
    Definition: usbhid.h:146
    +
    static const uint8_t maxEpPerInterface
    Definition: usbhid.h:153
    +
    uint8_t bmIsNullOrNoNull
    Definition: usbhid.h:132
    USBHID(USB *pusb)
    Definition: usbhid.h:165
    - - -
    #define totalEndpoints(p)
    Definition: hidboot.h:33
    +
    static const uint8_t epInterruptInIndex
    Definition: usbhid.h:149
    +
    static const uint8_t maxHidInterfaces
    Definition: usbhid.h:152
    + + +
    uint8_t SetProtocol(uint8_t iface, uint8_t protocol)
    Definition: usbhid.cpp:66
    +
    static const uint8_t totalEndpoints
    Definition: usbhid.h:154
    +
    uint8_t bmIsNonLonearOrLinear
    Definition: usbhid.h:130
    +
    uint8_t SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)
    Definition: usbhid.cpp:50
    -
    Definition: UsbCore.h:197
    +
    Definition: UsbCore.h:208
    +
    uint8_t bmIsNoPreferedOrPrefered
    Definition: usbhid.h:131
    virtual bool SetReportParser(uint8_t id, HIDReportParser *prs)
    Definition: usbhid.h:172
    +
    uint8_t bmIsRelativeOrAbsolute
    Definition: usbhid.h:128
    +
    virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)=0
    virtual HIDReportParser * GetReportParser(uint8_t id)
    Definition: usbhid.h:159
    diff --git a/usbhost_8h.html b/usbhost_8h.html index 59aba258..c5801162 100644 --- a/usbhost_8h.html +++ b/usbhost_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbhost.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
     

    Enumeration Type Documentation

    - + +

    ◆ VBUS_t

    +
    @@ -121,13 +103,11 @@ Enumerations
    - - + +
    Enumerator
    vbus_on  -
    vbus_off  -
    Enumerator
    vbus_on 
    vbus_off 
    -

    Definition at line 104 of file usbhost.h.

    +

    Definition at line 127 of file usbhost.h.

    @@ -136,7 +116,7 @@ Enumerations diff --git a/usbhost_8h_source.html b/usbhost_8h_source.html index a7da24e9..02bed629 100644 --- a/usbhost_8h_source.html +++ b/usbhost_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbhost.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    usbhost.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 /* MAX3421E-based USB Host Library header file */
    18 
    19 
    20 #if !defined(_usb_h_) || defined(_USBHOST_H_)
    21 #error "Never include usbhost.h directly; include Usb.h instead"
    22 #else
    23 #define _USBHOST_H_
    24 
    25 #if USING_SPI4TEENSY3
    26 #include <spi4teensy3.h>
    27 #include <sys/types.h>
    28 #endif
    29 
    30 /* SPI initialization */
    31 template< typename SPI_CLK, typename SPI_MOSI, typename SPI_MISO, typename SPI_SS > class SPi {
    32 public:
    33 #if USING_SPI4TEENSY3
    34  static void init() {
    35  // spi4teensy3 inits everything for us, except /SS
    36  // CLK, MOSI and MISO are hard coded for now.
    37  // spi4teensy3::init(0,0,0); // full speed, cpol 0, cpha 0
    38  spi4teensy3::init(); // full speed, cpol 0, cpha 0
    39  SPI_SS::SetDirWrite();
    40  SPI_SS::Set();
    41  }
    42 #elif SPI_HAS_TRANSACTION
    43  static void init() {
    44  SPI.begin(); // The SPI library with transaction will take care of setting up the pins - settings is set in beginTransaction()
    45  SPI_SS::SetDirWrite();
    46  SPI_SS::Set();
    47  }
    48 #elif defined(STM32F4)
    49 #warning "You need to initialize the SPI interface manually when using the STM32F4 platform"
    50  static void init() {
    51  // Should be initialized by the user manually for now
    52  }
    53 #elif !defined(SPDR)
    54  static void init() {
    55  SPI_SS::SetDirWrite();
    56  SPI_SS::Set();
    57  SPI.begin();
    58 #if defined(__MIPSEL__)
    59  SPI.setClockDivider(1);
    60 #elif defined(__ARDUINO_X86__)
    61  #ifdef SPI_CLOCK_1M // Hack used to check if setClockSpeed is available
    62  SPI.setClockSpeed(12000000); // The MAX3421E can handle up to 26MHz, but in practice this was the maximum that I could reliably use
    63  #else
    64  SPI.setClockDivider(SPI_CLOCK_DIV2); // This will set the SPI frequency to 8MHz - it could be higher, but it is not supported in the old API
    65  #endif
    66 #elif !defined(RBL_NRF51822)
    67  SPI.setClockDivider(4); // Set speed to 84MHz/4=21MHz - the MAX3421E can handle up to 26MHz
    68 #endif
    69  }
    70 #else
    71  static void init() {
    72  //uint8_t tmp;
    73  SPI_CLK::SetDirWrite();
    74  SPI_MOSI::SetDirWrite();
    75  SPI_MISO::SetDirRead();
    76  SPI_SS::SetDirWrite();
    77  /* mode 00 (CPOL=0, CPHA=0) master, fclk/2. Mode 11 (CPOL=11, CPHA=11) is also supported by MAX3421E */
    78  SPCR = 0x50;
    79  SPSR = 0x01; // 0x01
    80 
    81  //tmp = SPSR;
    82  //tmp = SPDR;
    83  }
    84 #endif
    85 };
    86 
    87 /* SPI pin definitions. see avrpins.h */
    88 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__) || defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
    89 typedef SPi< Pb1, Pb2, Pb3, Pb0 > spi;
    90 #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
    91 typedef SPi< Pb5, Pb3, Pb4, Pb2 > spi;
    92 #elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
    93 typedef SPi< Pb7, Pb5, Pb6, Pb4 > spi;
    94 #elif (defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__))) || defined(__ARDUINO_X86__) || defined(__MIPSEL__) || defined(STM32F4)
    95 typedef SPi< P13, P11, P12, P10 > spi;
    96 #elif defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)
    97 typedef SPi< P76, P75, P74, P10 > spi;
    98 #elif defined(RBL_NRF51822)
    99 typedef SPi< P16, P18, P17, P10 > spi;
    100 #else
    101 #error "No SPI entry in usbhost.h"
    102 #endif
    103 
    104 typedef enum {
    105  vbus_on = 0,
    107 } VBUS_t;
    108 
    109 template< typename SPI_SS, typename INTR > class MAX3421e /* : public spi */ {
    110  static uint8_t vbusState;
    111 
    112 public:
    113  MAX3421e();
    114  void regWr(uint8_t reg, uint8_t data);
    115  uint8_t* bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
    116  void gpioWr(uint8_t data);
    117  uint8_t regRd(uint8_t reg);
    118  uint8_t* bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
    119  uint8_t gpioRd();
    120  uint16_t reset();
    121  int8_t Init();
    122  int8_t Init(int mseconds);
    123 
    124  void vbusPower(VBUS_t state) {
    125  regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL | state));
    126  }
    127 
    128  uint8_t getVbusState(void) {
    129  return vbusState;
    130  };
    131  void busprobe();
    132  uint8_t GpxHandler();
    133  uint8_t IntHandler();
    134  uint8_t Task();
    135 };
    136 
    137 template< typename SPI_SS, typename INTR >
    139 
    140 /* constructor */
    141 template< typename SPI_SS, typename INTR >
    143  // Leaving ADK hardware setup in here, for now. This really belongs with the other parts.
    144 #ifdef BOARD_MEGA_ADK
    145  // For Mega ADK, which has a Max3421e on-board, set MAX_RESET to output mode, and then set it to HIGH
    146  P55::SetDirWrite();
    147  P55::Set();
    148 #endif
    149 };
    150 
    151 /* write single byte into MAX3421 register */
    152 template< typename SPI_SS, typename INTR >
    153 void MAX3421e< SPI_SS, INTR >::regWr(uint8_t reg, uint8_t data) {
    155 #if SPI_HAS_TRANSACTION
    156  SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
    157 #endif
    158  SPI_SS::Clear();
    159 
    160 #if USING_SPI4TEENSY3
    161  uint8_t c[2];
    162  c[0] = reg | 0x02;
    163  c[1] = data;
    164  spi4teensy3::send(c, 2);
    165 #elif SPI_HAS_TRANSACTION
    166  uint8_t c[2];
    167  c[0] = reg | 0x02;
    168  c[1] = data;
    169  SPI.transfer(c, 2);
    170 #elif defined(STM32F4)
    171  uint8_t c[2];
    172  c[0] = reg | 0x02;
    173  c[1] = data;
    174  HAL_SPI_Transmit(&SPI_Handle, c, 2, HAL_MAX_DELAY);
    175 #elif !defined(SPDR)
    176  SPI.transfer(reg | 0x02);
    177  SPI.transfer(data);
    178 #else
    179  SPDR = (reg | 0x02);
    180  while(!(SPSR & (1 << SPIF)));
    181  SPDR = data;
    182  while(!(SPSR & (1 << SPIF)));
    183 #endif
    184 
    185  SPI_SS::Set();
    186 #if SPI_HAS_TRANSACTION
    187  SPI.endTransaction();
    188 #endif
    190  return;
    191 };
    192 /* multiple-byte write */
    193 
    194 /* returns a pointer to memory position after last written */
    195 template< typename SPI_SS, typename INTR >
    196 uint8_t* MAX3421e< SPI_SS, INTR >::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
    198 #if SPI_HAS_TRANSACTION
    199  SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
    200 #endif
    201  SPI_SS::Clear();
    202 
    203 #if USING_SPI4TEENSY3
    204  spi4teensy3::send(reg | 0x02);
    205  spi4teensy3::send(data_p, nbytes);
    206  data_p += nbytes;
    207 #elif SPI_HAS_TRANSACTION
    208  SPI.transfer(reg | 0x02);
    209  SPI.transfer(data_p, nbytes);
    210  data_p += nbytes;
    211 #elif defined(__ARDUINO_X86__)
    212  SPI.transfer(reg | 0x02);
    213  SPI.transferBuffer(data_p, NULL, nbytes);
    214  data_p += nbytes;
    215 #elif defined(STM32F4)
    216  uint8_t data = reg | 0x02;
    217  HAL_SPI_Transmit(&SPI_Handle, &data, 1, HAL_MAX_DELAY);
    218  HAL_SPI_Transmit(&SPI_Handle, data_p, nbytes, HAL_MAX_DELAY);
    219  data_p += nbytes;
    220 #elif !defined(SPDR)
    221  SPI.transfer(reg | 0x02);
    222  while(nbytes) {
    223  SPI.transfer(*data_p);
    224  nbytes--;
    225  data_p++; // advance data pointer
    226  }
    227 #else
    228  SPDR = (reg | 0x02); //set WR bit and send register number
    229  while(nbytes) {
    230  while(!(SPSR & (1 << SPIF))); //check if previous byte was sent
    231  SPDR = (*data_p); // send next data byte
    232  nbytes--;
    233  data_p++; // advance data pointer
    234  }
    235  while(!(SPSR & (1 << SPIF)));
    236 #endif
    237 
    238  SPI_SS::Set();
    239 #if SPI_HAS_TRANSACTION
    240  SPI.endTransaction();
    241 #endif
    243  return ( data_p);
    244 }
    245 /* GPIO write */
    246 /*GPIO byte is split between 2 registers, so two writes are needed to write one byte */
    247 
    248 /* GPOUT bits are in the low nibble. 0-3 in IOPINS1, 4-7 in IOPINS2 */
    249 template< typename SPI_SS, typename INTR >
    251  regWr(rIOPINS1, data);
    252  data >>= 4;
    253  regWr(rIOPINS2, data);
    254  return;
    255 }
    256 
    257 /* single host register read */
    258 template< typename SPI_SS, typename INTR >
    259 uint8_t MAX3421e< SPI_SS, INTR >::regRd(uint8_t reg) {
    261 #if SPI_HAS_TRANSACTION
    262  SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
    263 #endif
    264  SPI_SS::Clear();
    265 
    266 #if USING_SPI4TEENSY3
    267  spi4teensy3::send(reg);
    268  uint8_t rv = spi4teensy3::receive();
    269  SPI_SS::Set();
    270 #elif defined(STM32F4)
    271  HAL_SPI_Transmit(&SPI_Handle, &reg, 1, HAL_MAX_DELAY);
    272  uint8_t rv = 0;
    273  HAL_SPI_Receive(&SPI_Handle, &rv, 1, HAL_MAX_DELAY);
    274  SPI_SS::Set();
    275 #elif !defined(SPDR) || SPI_HAS_TRANSACTION
    276  SPI.transfer(reg);
    277  uint8_t rv = SPI.transfer(0); // Send empty byte
    278  SPI_SS::Set();
    279 #else
    280  SPDR = reg;
    281  while(!(SPSR & (1 << SPIF)));
    282  SPDR = 0; // Send empty byte
    283  while(!(SPSR & (1 << SPIF)));
    284  SPI_SS::Set();
    285  uint8_t rv = SPDR;
    286 #endif
    287 
    288 #if SPI_HAS_TRANSACTION
    289  SPI.endTransaction();
    290 #endif
    292  return (rv);
    293 }
    294 /* multiple-byte register read */
    295 
    296 /* returns a pointer to a memory position after last read */
    297 template< typename SPI_SS, typename INTR >
    298 uint8_t* MAX3421e< SPI_SS, INTR >::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
    300 #if SPI_HAS_TRANSACTION
    301  SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
    302 #endif
    303  SPI_SS::Clear();
    304 
    305 #if USING_SPI4TEENSY3
    306  spi4teensy3::send(reg);
    307  spi4teensy3::receive(data_p, nbytes);
    308  data_p += nbytes;
    309 #elif SPI_HAS_TRANSACTION
    310  SPI.transfer(reg);
    311  memset(data_p, 0, nbytes); // Make sure we send out empty bytes
    312  SPI.transfer(data_p, nbytes);
    313  data_p += nbytes;
    314 #elif defined(__ARDUINO_X86__)
    315  SPI.transfer(reg);
    316  SPI.transferBuffer(NULL, data_p, nbytes);
    317  data_p += nbytes;
    318 #elif defined(STM32F4)
    319  HAL_SPI_Transmit(&SPI_Handle, &reg, 1, HAL_MAX_DELAY);
    320  memset(data_p, 0, nbytes); // Make sure we send out empty bytes
    321  HAL_SPI_Receive(&SPI_Handle, data_p, nbytes, HAL_MAX_DELAY);
    322  data_p += nbytes;
    323 #elif !defined(SPDR)
    324  SPI.transfer(reg);
    325  while(nbytes) {
    326  *data_p++ = SPI.transfer(0);
    327  nbytes--;
    328  }
    329 #else
    330  SPDR = reg;
    331  while(!(SPSR & (1 << SPIF))); //wait
    332  while(nbytes) {
    333  SPDR = 0; // Send empty byte
    334  nbytes--;
    335  while(!(SPSR & (1 << SPIF)));
    336 #if 0
    337  {
    338  *data_p = SPDR;
    339  printf("%2.2x ", *data_p);
    340  }
    341  data_p++;
    342  }
    343  printf("\r\n");
    344 #else
    345  *data_p++ = SPDR;
    346  }
    347 #endif
    348 #endif
    349 
    350  SPI_SS::Set();
    351 #if SPI_HAS_TRANSACTION
    352  SPI.endTransaction();
    353 #endif
    355  return ( data_p);
    356 }
    357 /* GPIO read. See gpioWr for explanation */
    358 
    359 /* GPIN pins are in high nibbles of IOPINS1, IOPINS2 */
    360 template< typename SPI_SS, typename INTR >
    362  uint8_t gpin = 0;
    363  gpin = regRd(rIOPINS2); //pins 4-7
    364  gpin &= 0xf0; //clean lower nibble
    365  gpin |= (regRd(rIOPINS1) >> 4); //shift low bits and OR with upper from previous operation.
    366  return ( gpin);
    367 }
    368 
    369 /* reset MAX3421E. Returns number of cycles it took for PLL to stabilize after reset
    370  or zero if PLL haven't stabilized in 65535 cycles */
    371 template< typename SPI_SS, typename INTR >
    373  uint16_t i = 0;
    374  regWr(rUSBCTL, bmCHIPRES);
    375  regWr(rUSBCTL, 0x00);
    376  while(++i) {
    377  if((regRd(rUSBIRQ) & bmOSCOKIRQ)) {
    378  break;
    379  }
    380  }
    381  return ( i);
    382 }
    383 
    384 /* initialize MAX3421E. Set Host mode, pullups, and stuff. Returns 0 if success, -1 if not */
    385 template< typename SPI_SS, typename INTR >
    388  // Moved here.
    389  // you really should not init hardware in the constructor when it involves locks.
    390  // Also avoids the vbus flicker issue confusing some devices.
    391  /* pin and peripheral setup */
    392  SPI_SS::SetDirWrite();
    393  SPI_SS::Set();
    394  spi::init();
    395  INTR::SetDirRead();
    397  /* MAX3421E - full-duplex SPI, level interrupt */
    398  // GPX pin on. Moved here, otherwise we flicker the vbus.
    399  regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL));
    400 
    401  if(reset() == 0) { //OSCOKIRQ hasn't asserted in time
    402  return ( -1);
    403  }
    404 
    405  regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); // set pull-downs, Host
    406 
    407  regWr(rHIEN, bmCONDETIE | bmFRAMEIE); //connection detection
    408 
    409  /* check if device is connected */
    410  regWr(rHCTL, bmSAMPLEBUS); // sample USB bus
    411  while(!(regRd(rHCTL) & bmSAMPLEBUS)); //wait for sample operation to finish
    412 
    413  busprobe(); //check if anything is connected
    414 
    415  regWr(rHIRQ, bmCONDETIRQ); //clear connection detect interrupt
    416  regWr(rCPUCTL, 0x01); //enable interrupt pin
    417 
    418  return ( 0);
    419 }
    420 
    421 /* initialize MAX3421E. Set Host mode, pullups, and stuff. Returns 0 if success, -1 if not */
    422 template< typename SPI_SS, typename INTR >
    423 int8_t MAX3421e< SPI_SS, INTR >::Init(int mseconds) {
    425  // Moved here.
    426  // you really should not init hardware in the constructor when it involves locks.
    427  // Also avoids the vbus flicker issue confusing some devices.
    428  /* pin and peripheral setup */
    429  SPI_SS::SetDirWrite();
    430  SPI_SS::Set();
    431  spi::init();
    432  INTR::SetDirRead();
    434  /* MAX3421E - full-duplex SPI, level interrupt, vbus off */
    435  regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL | GPX_VBDET));
    436 
    437  if(reset() == 0) { //OSCOKIRQ hasn't asserted in time
    438  return ( -1);
    439  }
    440 
    441  // Delay a minimum of 1 second to ensure any capacitors are drained.
    442  // 1 second is required to make sure we do not smoke a Microdrive!
    443  if(mseconds < 1000) mseconds = 1000;
    444  delay(mseconds);
    445 
    446  regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); // set pull-downs, Host
    447 
    448  regWr(rHIEN, bmCONDETIE | bmFRAMEIE); //connection detection
    449 
    450  /* check if device is connected */
    451  regWr(rHCTL, bmSAMPLEBUS); // sample USB bus
    452  while(!(regRd(rHCTL) & bmSAMPLEBUS)); //wait for sample operation to finish
    453 
    454  busprobe(); //check if anything is connected
    455 
    456  regWr(rHIRQ, bmCONDETIRQ); //clear connection detect interrupt
    457  regWr(rCPUCTL, 0x01); //enable interrupt pin
    458 
    459  // GPX pin on. This is done here so that busprobe will fail if we have a switch connected.
    460  regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL));
    461 
    462  return ( 0);
    463 }
    464 
    465 /* probe bus to determine device presence and speed and switch host to this speed */
    466 template< typename SPI_SS, typename INTR >
    468  uint8_t bus_sample;
    469  bus_sample = regRd(rHRSL); //Get J,K status
    470  bus_sample &= (bmJSTATUS | bmKSTATUS); //zero the rest of the byte
    471  switch(bus_sample) { //start full-speed or low-speed host
    472  case( bmJSTATUS):
    473  if((regRd(rMODE) & bmLOWSPEED) == 0) {
    474  regWr(rMODE, MODE_FS_HOST); //start full-speed host
    475  vbusState = FSHOST;
    476  } else {
    477  regWr(rMODE, MODE_LS_HOST); //start low-speed host
    478  vbusState = LSHOST;
    479  }
    480  break;
    481  case( bmKSTATUS):
    482  if((regRd(rMODE) & bmLOWSPEED) == 0) {
    483  regWr(rMODE, MODE_LS_HOST); //start low-speed host
    484  vbusState = LSHOST;
    485  } else {
    486  regWr(rMODE, MODE_FS_HOST); //start full-speed host
    487  vbusState = FSHOST;
    488  }
    489  break;
    490  case( bmSE1): //illegal state
    491  vbusState = SE1;
    492  break;
    493  case( bmSE0): //disconnected state
    494  regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST | bmSEPIRQ);
    495  vbusState = SE0;
    496  break;
    497  }//end switch( bus_sample )
    498 }
    499 
    500 /* MAX3421 state change task and interrupt handler */
    501 template< typename SPI_SS, typename INTR >
    503  uint8_t rcode = 0;
    504  uint8_t pinvalue;
    505  //USB_HOST_SERIAL.print("Vbus state: ");
    506  //USB_HOST_SERIAL.println( vbusState, HEX );
    507  pinvalue = INTR::IsSet(); //Read();
    508  //pinvalue = digitalRead( MAX_INT );
    509  if(pinvalue == 0) {
    510  rcode = IntHandler();
    511  }
    512  // pinvalue = digitalRead( MAX_GPX );
    513  // if( pinvalue == LOW ) {
    514  // GpxHandler();
    515  // }
    516  // usbSM(); //USB state machine
    517  return ( rcode);
    518 }
    519 
    520 template< typename SPI_SS, typename INTR >
    522  uint8_t HIRQ;
    523  uint8_t HIRQ_sendback = 0x00;
    524  HIRQ = regRd(rHIRQ); //determine interrupt source
    525  //if( HIRQ & bmFRAMEIRQ ) { //->1ms SOF interrupt handler
    526  // HIRQ_sendback |= bmFRAMEIRQ;
    527  //}//end FRAMEIRQ handling
    528  if(HIRQ & bmCONDETIRQ) {
    529  busprobe();
    530  HIRQ_sendback |= bmCONDETIRQ;
    531  }
    532  /* End HIRQ interrupts handling, clear serviced IRQs */
    533  regWr(rHIRQ, HIRQ_sendback);
    534  return ( HIRQ_sendback);
    535 }
    536 //template< typename SPI_SS, typename INTR >
    537 //uint8_t MAX3421e< SPI_SS, INTR >::GpxHandler()
    538 //{
    539 // uint8_t GPINIRQ = regRd( rGPINIRQ ); //read GPIN IRQ register
    546 // return( GPINIRQ );
    547 //}
    548 
    549 #endif // _USBHOST_H_
    #define GPX_VBDET
    Definition: max3421e.h:75
    -
    #define rIOPINS1
    Definition: max3421e.h:81
    -
    void busprobe()
    Definition: usbhost.h:467
    -
    #define rHIEN
    Definition: max3421e.h:148
    -
    #define FSHOST
    Definition: max3421e.h:30
    -
    #define rHCTL
    Definition: max3421e.h:174
    -
    #define bmCONDETIRQ
    Definition: max3421e.h:144
    -
    #define bmCONDETIE
    Definition: max3421e.h:156
    -
    #define bmSE1
    Definition: max3421e.h:204
    -
    #define bmCHIPRES
    Definition: max3421e.h:57
    -
    uint8_t getVbusState(void)
    Definition: usbhost.h:128
    - -
    #define rCPUCTL
    Definition: max3421e.h:60
    -
    #define bmJSTATUS
    Definition: max3421e.h:202
    -
    uint16_t reset()
    Definition: usbhost.h:372
    - -
    #define MODE_LS_HOST
    Definition: max3421e.h:225
    -
    #define bmINTLEVEL
    Definition: max3421e.h:69
    -
    void gpioWr(uint8_t data)
    Definition: usbhost.h:250
    -
    uint8_t Task()
    Definition: usbhost.h:502
    -
    #define rUSBCTL
    Definition: max3421e.h:55
    -
    #define bmSE0
    Definition: max3421e.h:203
    -
    #define bmHOST
    Definition: max3421e.h:163
    -
    #define bmSEPIRQ
    Definition: max3421e.h:167
    -
    uint8_t gpioRd()
    Definition: usbhost.h:361
    -
    int8_t Init()
    Definition: usbhost.h:386
    -
    #define LSHOST
    Definition: max3421e.h:31
    -
    #define rMODE
    Definition: max3421e.h:160
    -
    #define MODE_FS_HOST
    Definition: max3421e.h:224
    -
    void vbusPower(VBUS_t state)
    Definition: usbhost.h:124
    -
    #define bmKSTATUS
    Definition: max3421e.h:201
    -
    #define rHRSL
    Definition: max3421e.h:196
    -
    uint8_t * bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
    Definition: usbhost.h:298
    -
    #define XMEM_ACQUIRE_SPI()
    Definition: settings.h:121
    -
    #define bmLOWSPEED
    Definition: max3421e.h:164
    -
    uint8_t * bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
    Definition: usbhost.h:196
    -
    Definition: usbhost.h:31
    -
    #define rHIRQ
    Definition: max3421e.h:137
    -
    #define rUSBIRQ
    Definition: max3421e.h:43
    -
    #define XMEM_RELEASE_SPI()
    Definition: settings.h:122
    -
    #define bmFDUPSPI
    Definition: max3421e.h:68
    -
    #define rPINCTL
    Definition: max3421e.h:66
    -
    VBUS_t
    Definition: usbhost.h:104
    -
    void regWr(uint8_t reg, uint8_t data)
    Definition: usbhost.h:153
    -
    #define bmFRAMEIE
    Definition: max3421e.h:157
    -
    uint8_t IntHandler()
    Definition: usbhost.h:521
    -
    #define bmOSCOKIRQ
    Definition: max3421e.h:47
    -
    uint8_t regRd(uint8_t reg)
    Definition: usbhost.h:259
    -
    MAX3421e()
    Definition: usbhost.h:142
    - -
    #define SE0
    Definition: max3421e.h:28
    -
    #define rIOPINS2
    Definition: max3421e.h:93
    -
    #define bmDMPULLDN
    Definition: max3421e.h:169
    -
    #define SE1
    Definition: max3421e.h:29
    -
    #define bmSAMPLEBUS
    Definition: max3421e.h:178
    -
    static void init()
    Definition: usbhost.h:54
    -
    #define bmDPPULLDN
    Definition: max3421e.h:170
    +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 /* MAX3421E-based USB Host Library header file */
    25 
    26 
    27 #if !defined(_usb_h_) || defined(_USBHOST_H_)
    28 #error "Never include usbhost.h directly; include Usb.h instead"
    29 #else
    30 #define _USBHOST_H_
    31 
    32 #if USING_SPI4TEENSY3
    33 #include <spi4teensy3.h>
    34 #include <sys/types.h>
    35 #endif
    36 
    37 /* SPI initialization */
    38 template< typename SPI_CLK, typename SPI_MOSI, typename SPI_MISO, typename SPI_SS > class SPi {
    39 public:
    40 #if USING_SPI4TEENSY3
    41  static void init() {
    42  // spi4teensy3 inits everything for us, except /SS
    43  // CLK, MOSI and MISO are hard coded for now.
    44  // spi4teensy3::init(0,0,0); // full speed, cpol 0, cpha 0
    45  spi4teensy3::init(); // full speed, cpol 0, cpha 0
    46  SPI_SS::SetDirWrite();
    47  SPI_SS::Set();
    48  }
    49 #elif defined(SPI_HAS_TRANSACTION)
    50  static void init() {
    51  USB_SPI.begin(); // The SPI library with transaction will take care of setting up the pins - settings is set in beginTransaction()
    52  SPI_SS::SetDirWrite();
    53  SPI_SS::Set();
    54  }
    55 #elif defined(STM32F4)
    56 #warning "You need to initialize the SPI interface manually when using the STM32F4 platform"
    57  static void init() {
    58  // Should be initialized by the user manually for now
    59  }
    60 #elif !defined(SPDR)
    61  static void init() {
    62  SPI_SS::SetDirWrite();
    63  SPI_SS::Set();
    64  USB_SPI.begin();
    65 #if defined(__MIPSEL__)
    66  USB_SPI.setClockDivider(1);
    67 #elif defined(__ARDUINO_X86__)
    68  #ifdef SPI_CLOCK_1M // Hack used to check if setClockSpeed is available
    69  USB_SPI.setClockSpeed(12000000); // The MAX3421E can handle up to 26MHz, but in practice this was the maximum that I could reliably use
    70  #else
    71  USB_SPI.setClockDivider(SPI_CLOCK_DIV2); // This will set the SPI frequency to 8MHz - it could be higher, but it is not supported in the old API
    72  #endif
    73 #elif !defined(RBL_NRF51822)
    74  USB_SPI.setClockDivider(4); // Set speed to 84MHz/4=21MHz - the MAX3421E can handle up to 26MHz
    75 #endif
    76  }
    77 #else
    78  static void init() {
    79  //uint8_t tmp;
    80  SPI_CLK::SetDirWrite();
    81  SPI_MOSI::SetDirWrite();
    82  SPI_MISO::SetDirRead();
    83  SPI_SS::SetDirWrite();
    84  /* mode 00 (CPOL=0, CPHA=0) master, fclk/2. Mode 11 (CPOL=11, CPHA=11) is also supported by MAX3421E */
    85  SPCR = 0x50;
    86  SPSR = 0x01; // 0x01
    87 
    88  //tmp = SPSR;
    89  //tmp = SPDR;
    90  }
    91 #endif
    92 };
    93 
    94 /* SPI pin definitions. see avrpins.h */
    95 #if defined(PIN_SPI_SCK) && defined(PIN_SPI_MOSI) && defined(PIN_SPI_MISO) && defined(PIN_SPI_SS)
    96 // Use pin defines: https://github.com/arduino/Arduino/pull/4814
    97 // Based on: https://www.mikeash.com/pyblog/friday-qa-2015-03-20-preprocessor-abuse-and-optional-parentheses.html
    98 #define NOTHING_EXTRACT
    99 #define EXTRACT(...) EXTRACT __VA_ARGS__
    100 #define PASTE(x, ...) x ## __VA_ARGS__
    101 #define EVALUATING_PASTE(x, ...) PASTE(x, __VA_ARGS__)
    102 #define UNPAREN(x) EVALUATING_PASTE(NOTHING_, EXTRACT x)
    103 #define APPEND_PIN(pin) P ## pin // Appends the pin to 'P', e.g. 1 becomes P1
    104 #define MAKE_PIN(x) EVALUATING_PASTE(APPEND_, PIN(UNPAREN(x)))
    106 #undef MAKE_PIN
    107 #elif defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__) || defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
    108 typedef SPi< Pb1, Pb2, Pb3, Pb0 > spi;
    109 #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
    110 typedef SPi< Pb5, Pb3, Pb4, Pb2 > spi;
    111 #elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
    112 typedef SPi< Pb7, Pb5, Pb6, Pb4 > spi;
    113 #elif (defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__MKL26Z64__))) || defined(__ARDUINO_ARC__) || defined(__ARDUINO_X86__) || defined(__MIPSEL__) || defined(STM32F4)
    114 typedef SPi< P13, P11, P12, P10 > spi;
    115 #elif defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)
    116 typedef SPi< P76, P75, P74, P10 > spi;
    117 #elif defined(RBL_NRF51822)
    118 typedef SPi< P16, P18, P17, P10 > spi;
    119 #elif defined(ESP8266)
    120 typedef SPi< P14, P13, P12, P15 > spi;
    121 #elif defined(ESP32)
    122 typedef SPi< P18, P23, P19, P5 > spi;
    123 #else
    124 #error "No SPI entry in usbhost.h"
    125 #endif
    126 
    127 typedef enum {
    128  vbus_on = 0,
    130 } VBUS_t;
    131 
    132 template< typename SPI_SS, typename INTR > class MAX3421e /* : public spi */ {
    133  static uint8_t vbusState;
    134 
    135 public:
    136  MAX3421e();
    137  void regWr(uint8_t reg, uint8_t data);
    138  uint8_t* bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
    139  void gpioWr(uint8_t data);
    140  uint8_t regRd(uint8_t reg);
    141  uint8_t* bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p);
    142  uint8_t gpioRd();
    143  uint16_t reset();
    144  int8_t Init();
    145  int8_t Init(int mseconds);
    146 
    147  void vbusPower(VBUS_t state) {
    148  regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL | state));
    149  }
    150 
    151  uint8_t getVbusState(void) {
    152  return vbusState;
    153  };
    154  void busprobe();
    155  uint8_t GpxHandler();
    156  uint8_t IntHandler();
    157  uint8_t Task();
    158 };
    159 
    160 template< typename SPI_SS, typename INTR >
    162 
    163 /* constructor */
    164 template< typename SPI_SS, typename INTR >
    166  // Leaving ADK hardware setup in here, for now. This really belongs with the other parts.
    167 #ifdef BOARD_MEGA_ADK
    168  // For Mega ADK, which has a Max3421e on-board, set MAX_RESET to output mode, and then set it to HIGH
    169  P55::SetDirWrite();
    170  P55::Set();
    171 #endif
    172 };
    173 
    174 /* write single byte into MAX3421 register */
    175 template< typename SPI_SS, typename INTR >
    176 void MAX3421e< SPI_SS, INTR >::regWr(uint8_t reg, uint8_t data) {
    178 #if defined(SPI_HAS_TRANSACTION)
    179  USB_SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
    180 #endif
    181  SPI_SS::Clear();
    182 
    183 #if USING_SPI4TEENSY3
    184  uint8_t c[2];
    185  c[0] = reg | 0x02;
    186  c[1] = data;
    187  spi4teensy3::send(c, 2);
    188 #elif defined(SPI_HAS_TRANSACTION) && !defined(ESP8266) && !defined(ESP32)
    189  uint8_t c[2];
    190  c[0] = reg | 0x02;
    191  c[1] = data;
    192  USB_SPI.transfer(c, 2);
    193 #elif defined(STM32F4)
    194  uint8_t c[2];
    195  c[0] = reg | 0x02;
    196  c[1] = data;
    197  HAL_SPI_Transmit(&SPI_Handle, c, 2, HAL_MAX_DELAY);
    198 #elif !defined(SPDR) // ESP8266, ESP32
    199  USB_SPI.transfer(reg | 0x02);
    200  USB_SPI.transfer(data);
    201 #else
    202  SPDR = (reg | 0x02);
    203  while(!(SPSR & (1 << SPIF)));
    204  SPDR = data;
    205  while(!(SPSR & (1 << SPIF)));
    206 #endif
    207 
    208  SPI_SS::Set();
    209 #if defined(SPI_HAS_TRANSACTION)
    210  USB_SPI.endTransaction();
    211 #endif
    213  return;
    214 };
    215 /* multiple-byte write */
    216 
    217 /* returns a pointer to memory position after last written */
    218 template< typename SPI_SS, typename INTR >
    219 uint8_t* MAX3421e< SPI_SS, INTR >::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
    221 #if defined(SPI_HAS_TRANSACTION)
    222  USB_SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
    223 #endif
    224  SPI_SS::Clear();
    225 
    226 #if USING_SPI4TEENSY3
    227  spi4teensy3::send(reg | 0x02);
    228  spi4teensy3::send(data_p, nbytes);
    229  data_p += nbytes;
    230 #elif defined(SPI_HAS_TRANSACTION) && !defined(ESP8266) && !defined(ESP32)
    231  USB_SPI.transfer(reg | 0x02);
    232  USB_SPI.transfer(data_p, nbytes);
    233  data_p += nbytes;
    234 #elif defined(__ARDUINO_X86__)
    235  USB_SPI.transfer(reg | 0x02);
    236  USB_SPI.transferBuffer(data_p, NULL, nbytes);
    237  data_p += nbytes;
    238 #elif defined(STM32F4)
    239  uint8_t data = reg | 0x02;
    240  HAL_SPI_Transmit(&SPI_Handle, &data, 1, HAL_MAX_DELAY);
    241  HAL_SPI_Transmit(&SPI_Handle, data_p, nbytes, HAL_MAX_DELAY);
    242  data_p += nbytes;
    243 #elif !defined(SPDR) // ESP8266, ESP32
    244  USB_SPI.transfer(reg | 0x02);
    245  while(nbytes) {
    246  USB_SPI.transfer(*data_p);
    247  nbytes--;
    248  data_p++; // advance data pointer
    249  }
    250 #else
    251  SPDR = (reg | 0x02); //set WR bit and send register number
    252  while(nbytes) {
    253  while(!(SPSR & (1 << SPIF))); //check if previous byte was sent
    254  SPDR = (*data_p); // send next data byte
    255  nbytes--;
    256  data_p++; // advance data pointer
    257  }
    258  while(!(SPSR & (1 << SPIF)));
    259 #endif
    260 
    261  SPI_SS::Set();
    262 #if defined(SPI_HAS_TRANSACTION)
    263  USB_SPI.endTransaction();
    264 #endif
    266  return ( data_p);
    267 }
    268 /* GPIO write */
    269 /*GPIO byte is split between 2 registers, so two writes are needed to write one byte */
    270 
    271 /* GPOUT bits are in the low nibble. 0-3 in IOPINS1, 4-7 in IOPINS2 */
    272 template< typename SPI_SS, typename INTR >
    274  regWr(rIOPINS1, data);
    275  data >>= 4;
    276  regWr(rIOPINS2, data);
    277  return;
    278 }
    279 
    280 /* single host register read */
    281 template< typename SPI_SS, typename INTR >
    282 uint8_t MAX3421e< SPI_SS, INTR >::regRd(uint8_t reg) {
    284 #if defined(SPI_HAS_TRANSACTION)
    285  USB_SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
    286 #endif
    287  SPI_SS::Clear();
    288 
    289 #if USING_SPI4TEENSY3
    290  spi4teensy3::send(reg);
    291  uint8_t rv = spi4teensy3::receive();
    292  SPI_SS::Set();
    293 #elif defined(STM32F4)
    294  HAL_SPI_Transmit(&SPI_Handle, &reg, 1, HAL_MAX_DELAY);
    295  uint8_t rv = 0;
    296  HAL_SPI_Receive(&SPI_Handle, &rv, 1, HAL_MAX_DELAY);
    297  SPI_SS::Set();
    298 #elif !defined(SPDR) || defined(SPI_HAS_TRANSACTION)
    299  USB_SPI.transfer(reg);
    300  uint8_t rv = USB_SPI.transfer(0); // Send empty byte
    301  SPI_SS::Set();
    302 #else
    303  SPDR = reg;
    304  while(!(SPSR & (1 << SPIF)));
    305  SPDR = 0; // Send empty byte
    306  while(!(SPSR & (1 << SPIF)));
    307  SPI_SS::Set();
    308  uint8_t rv = SPDR;
    309 #endif
    310 
    311 #if defined(SPI_HAS_TRANSACTION)
    312  USB_SPI.endTransaction();
    313 #endif
    315  return (rv);
    316 }
    317 /* multiple-byte register read */
    318 
    319 /* returns a pointer to a memory position after last read */
    320 template< typename SPI_SS, typename INTR >
    321 uint8_t* MAX3421e< SPI_SS, INTR >::bytesRd(uint8_t reg, uint8_t nbytes, uint8_t* data_p) {
    323 #if defined(SPI_HAS_TRANSACTION)
    324  USB_SPI.beginTransaction(SPISettings(26000000, MSBFIRST, SPI_MODE0)); // The MAX3421E can handle up to 26MHz, use MSB First and SPI mode 0
    325 #endif
    326  SPI_SS::Clear();
    327 
    328 #if USING_SPI4TEENSY3
    329  spi4teensy3::send(reg);
    330  spi4teensy3::receive(data_p, nbytes);
    331  data_p += nbytes;
    332 #elif defined(SPI_HAS_TRANSACTION) && !defined(ESP8266) && !defined(ESP32)
    333  USB_SPI.transfer(reg);
    334  memset(data_p, 0, nbytes); // Make sure we send out empty bytes
    335  USB_SPI.transfer(data_p, nbytes);
    336  data_p += nbytes;
    337 #elif defined(__ARDUINO_X86__)
    338  USB_SPI.transfer(reg);
    339  USB_SPI.transferBuffer(NULL, data_p, nbytes);
    340  data_p += nbytes;
    341 #elif defined(STM32F4)
    342  HAL_SPI_Transmit(&SPI_Handle, &reg, 1, HAL_MAX_DELAY);
    343  memset(data_p, 0, nbytes); // Make sure we send out empty bytes
    344  HAL_SPI_Receive(&SPI_Handle, data_p, nbytes, HAL_MAX_DELAY);
    345  data_p += nbytes;
    346 #elif !defined(SPDR) // ESP8266, ESP32
    347  USB_SPI.transfer(reg);
    348  while(nbytes) {
    349  *data_p++ = USB_SPI.transfer(0);
    350  nbytes--;
    351  }
    352 #else
    353  SPDR = reg;
    354  while(!(SPSR & (1 << SPIF))); //wait
    355  while(nbytes) {
    356  SPDR = 0; // Send empty byte
    357  nbytes--;
    358  while(!(SPSR & (1 << SPIF)));
    359 #if 0
    360  {
    361  *data_p = SPDR;
    362  printf("%2.2x ", *data_p);
    363  }
    364  data_p++;
    365  }
    366  printf("\r\n");
    367 #else
    368  *data_p++ = SPDR;
    369  }
    370 #endif
    371 #endif
    372 
    373  SPI_SS::Set();
    374 #if defined(SPI_HAS_TRANSACTION)
    375  USB_SPI.endTransaction();
    376 #endif
    378  return ( data_p);
    379 }
    380 /* GPIO read. See gpioWr for explanation */
    381 
    382 /* GPIN pins are in high nibbles of IOPINS1, IOPINS2 */
    383 template< typename SPI_SS, typename INTR >
    385  uint8_t gpin = 0;
    386  gpin = regRd(rIOPINS2); //pins 4-7
    387  gpin &= 0xf0; //clean lower nibble
    388  gpin |= (regRd(rIOPINS1) >> 4); //shift low bits and OR with upper from previous operation.
    389  return ( gpin);
    390 }
    391 
    392 /* reset MAX3421E. Returns number of cycles it took for PLL to stabilize after reset
    393  or zero if PLL haven't stabilized in 65535 cycles */
    394 template< typename SPI_SS, typename INTR >
    396  uint16_t i = 0;
    397  regWr(rUSBCTL, bmCHIPRES);
    398  regWr(rUSBCTL, 0x00);
    399  while(++i) {
    400  if((regRd(rUSBIRQ) & bmOSCOKIRQ)) {
    401  break;
    402  }
    403  }
    404  return ( i);
    405 }
    406 
    407 /* initialize MAX3421E. Set Host mode, pullups, and stuff. Returns 0 if success, -1 if not */
    408 template< typename SPI_SS, typename INTR >
    411  // Moved here.
    412  // you really should not init hardware in the constructor when it involves locks.
    413  // Also avoids the vbus flicker issue confusing some devices.
    414  /* pin and peripheral setup */
    415  SPI_SS::SetDirWrite();
    416  SPI_SS::Set();
    417  spi::init();
    418  INTR::SetDirRead();
    420  /* MAX3421E - full-duplex SPI, level interrupt */
    421  // GPX pin on. Moved here, otherwise we flicker the vbus.
    422  regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL));
    423 
    424  if(reset() == 0) { //OSCOKIRQ hasn't asserted in time
    425  return ( -1);
    426  }
    427 
    428  regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); // set pull-downs, Host
    429 
    430  regWr(rHIEN, bmCONDETIE | bmFRAMEIE); //connection detection
    431 
    432  /* check if device is connected */
    433  regWr(rHCTL, bmSAMPLEBUS); // sample USB bus
    434  while(!(regRd(rHCTL) & bmSAMPLEBUS)); //wait for sample operation to finish
    435 
    436  busprobe(); //check if anything is connected
    437 
    438  regWr(rHIRQ, bmCONDETIRQ); //clear connection detect interrupt
    439  regWr(rCPUCTL, 0x01); //enable interrupt pin
    440 
    441  return ( 0);
    442 }
    443 
    444 /* initialize MAX3421E. Set Host mode, pullups, and stuff. Returns 0 if success, -1 if not */
    445 template< typename SPI_SS, typename INTR >
    446 int8_t MAX3421e< SPI_SS, INTR >::Init(int mseconds) {
    448  // Moved here.
    449  // you really should not init hardware in the constructor when it involves locks.
    450  // Also avoids the vbus flicker issue confusing some devices.
    451  /* pin and peripheral setup */
    452  SPI_SS::SetDirWrite();
    453  SPI_SS::Set();
    454  spi::init();
    455  INTR::SetDirRead();
    457  /* MAX3421E - full-duplex SPI, level interrupt, vbus off */
    458  regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL | GPX_VBDET));
    459 
    460  if(reset() == 0) { //OSCOKIRQ hasn't asserted in time
    461  return ( -1);
    462  }
    463 
    464  // Delay a minimum of 1 second to ensure any capacitors are drained.
    465  // 1 second is required to make sure we do not smoke a Microdrive!
    466  if(mseconds < 1000) mseconds = 1000;
    467  delay(mseconds);
    468 
    469  regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST); // set pull-downs, Host
    470 
    471  regWr(rHIEN, bmCONDETIE | bmFRAMEIE); //connection detection
    472 
    473  /* check if device is connected */
    474  regWr(rHCTL, bmSAMPLEBUS); // sample USB bus
    475  while(!(regRd(rHCTL) & bmSAMPLEBUS)); //wait for sample operation to finish
    476 
    477  busprobe(); //check if anything is connected
    478 
    479  regWr(rHIRQ, bmCONDETIRQ); //clear connection detect interrupt
    480  regWr(rCPUCTL, 0x01); //enable interrupt pin
    481 
    482  // GPX pin on. This is done here so that busprobe will fail if we have a switch connected.
    483  regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL));
    484 
    485  return ( 0);
    486 }
    487 
    488 /* probe bus to determine device presence and speed and switch host to this speed */
    489 template< typename SPI_SS, typename INTR >
    491  uint8_t bus_sample;
    492  bus_sample = regRd(rHRSL); //Get J,K status
    493  bus_sample &= (bmJSTATUS | bmKSTATUS); //zero the rest of the byte
    494  switch(bus_sample) { //start full-speed or low-speed host
    495  case( bmJSTATUS):
    496  if((regRd(rMODE) & bmLOWSPEED) == 0) {
    497  regWr(rMODE, MODE_FS_HOST); //start full-speed host
    498  vbusState = FSHOST;
    499  } else {
    500  regWr(rMODE, MODE_LS_HOST); //start low-speed host
    501  vbusState = LSHOST;
    502  }
    503  break;
    504  case( bmKSTATUS):
    505  if((regRd(rMODE) & bmLOWSPEED) == 0) {
    506  regWr(rMODE, MODE_LS_HOST); //start low-speed host
    507  vbusState = LSHOST;
    508  } else {
    509  regWr(rMODE, MODE_FS_HOST); //start full-speed host
    510  vbusState = FSHOST;
    511  }
    512  break;
    513  case( bmSE1): //illegal state
    514  vbusState = SE1;
    515  break;
    516  case( bmSE0): //disconnected state
    517  regWr(rMODE, bmDPPULLDN | bmDMPULLDN | bmHOST | bmSEPIRQ);
    518  vbusState = SE0;
    519  break;
    520  }//end switch( bus_sample )
    521 }
    522 
    523 /* MAX3421 state change task and interrupt handler */
    524 template< typename SPI_SS, typename INTR >
    526  uint8_t rcode = 0;
    527  uint8_t pinvalue;
    528  //USB_HOST_SERIAL.print("Vbus state: ");
    529  //USB_HOST_SERIAL.println( vbusState, HEX );
    530  pinvalue = INTR::IsSet(); //Read();
    531  //pinvalue = digitalRead( MAX_INT );
    532  if(pinvalue == 0) {
    533  rcode = IntHandler();
    534  }
    535  // pinvalue = digitalRead( MAX_GPX );
    536  // if( pinvalue == LOW ) {
    537  // GpxHandler();
    538  // }
    539  // usbSM(); //USB state machine
    540  return ( rcode);
    541 }
    542 
    543 template< typename SPI_SS, typename INTR >
    545  uint8_t HIRQ;
    546  uint8_t HIRQ_sendback = 0x00;
    547  HIRQ = regRd(rHIRQ); //determine interrupt source
    548  //if( HIRQ & bmFRAMEIRQ ) { //->1ms SOF interrupt handler
    549  // HIRQ_sendback |= bmFRAMEIRQ;
    550  //}//end FRAMEIRQ handling
    551  if(HIRQ & bmCONDETIRQ) {
    552  busprobe();
    553  HIRQ_sendback |= bmCONDETIRQ;
    554  }
    555  /* End HIRQ interrupts handling, clear serviced IRQs */
    556  regWr(rHIRQ, HIRQ_sendback);
    557  return ( HIRQ_sendback);
    558 }
    559 //template< typename SPI_SS, typename INTR >
    560 //uint8_t MAX3421e< SPI_SS, INTR >::GpxHandler()
    561 //{
    562 // uint8_t GPINIRQ = regRd( rGPINIRQ ); //read GPIN IRQ register
    569 // return( GPINIRQ );
    570 //}
    571 
    572 #endif // _USBHOST_H_
    #define GPX_VBDET
    Definition: max3421e.h:82
    +
    #define rIOPINS1
    Definition: max3421e.h:88
    +
    void busprobe()
    Definition: usbhost.h:490
    +
    #define rHIEN
    Definition: max3421e.h:155
    +
    #define FSHOST
    Definition: max3421e.h:37
    +
    #define rHCTL
    Definition: max3421e.h:181
    +
    #define bmCONDETIRQ
    Definition: max3421e.h:151
    +
    #define bmCONDETIE
    Definition: max3421e.h:163
    +
    #define bmSE1
    Definition: max3421e.h:211
    +
    #define bmCHIPRES
    Definition: max3421e.h:64
    +
    uint8_t getVbusState(void)
    Definition: usbhost.h:151
    + +
    #define rCPUCTL
    Definition: max3421e.h:67
    +
    #define bmJSTATUS
    Definition: max3421e.h:209
    +
    uint16_t reset()
    Definition: usbhost.h:395
    + +
    #define MODE_LS_HOST
    Definition: max3421e.h:232
    +
    #define bmINTLEVEL
    Definition: max3421e.h:76
    +
    void gpioWr(uint8_t data)
    Definition: usbhost.h:273
    +
    uint8_t Task()
    Definition: usbhost.h:525
    +
    #define rUSBCTL
    Definition: max3421e.h:62
    +
    #define bmSE0
    Definition: max3421e.h:210
    +
    #define bmHOST
    Definition: max3421e.h:170
    +
    #define bmSEPIRQ
    Definition: max3421e.h:174
    +
    uint8_t gpioRd()
    Definition: usbhost.h:384
    +
    int8_t Init()
    Definition: usbhost.h:409
    +
    uint8_t GpxHandler()
    +
    #define LSHOST
    Definition: max3421e.h:38
    +
    #define rMODE
    Definition: max3421e.h:167
    +
    #define MODE_FS_HOST
    Definition: max3421e.h:231
    +
    void vbusPower(VBUS_t state)
    Definition: usbhost.h:147
    +
    #define bmKSTATUS
    Definition: max3421e.h:208
    +
    #define rHRSL
    Definition: max3421e.h:203
    +
    uint8_t * bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
    Definition: usbhost.h:321
    +
    #define XMEM_ACQUIRE_SPI()
    Definition: settings.h:136
    +
    #define bmLOWSPEED
    Definition: max3421e.h:171
    +
    uint8_t * bytesWr(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
    Definition: usbhost.h:219
    +
    Definition: usbhost.h:38
    +
    #define rHIRQ
    Definition: max3421e.h:144
    +
    #define rUSBIRQ
    Definition: max3421e.h:50
    +
    #define XMEM_RELEASE_SPI()
    Definition: settings.h:137
    +
    #define bmFDUPSPI
    Definition: max3421e.h:75
    +
    #define rPINCTL
    Definition: max3421e.h:73
    +
    VBUS_t
    Definition: usbhost.h:127
    +
    void regWr(uint8_t reg, uint8_t data)
    Definition: usbhost.h:176
    +
    #define bmFRAMEIE
    Definition: max3421e.h:164
    +
    uint8_t IntHandler()
    Definition: usbhost.h:544
    +
    #define bmOSCOKIRQ
    Definition: max3421e.h:54
    +
    uint8_t regRd(uint8_t reg)
    Definition: usbhost.h:282
    +
    MAX3421e()
    Definition: usbhost.h:165
    + +
    #define USB_SPI
    Definition: settings.h:33
    +
    #define SE0
    Definition: max3421e.h:35
    +
    #define rIOPINS2
    Definition: max3421e.h:100
    +
    #define bmDMPULLDN
    Definition: max3421e.h:176
    +
    #define SE1
    Definition: max3421e.h:36
    +
    #define bmSAMPLEBUS
    Definition: max3421e.h:185
    +
    static void init()
    Definition: usbhost.h:61
    +
    #define bmDPPULLDN
    Definition: max3421e.h:177
    diff --git a/usbhub_8cpp.html b/usbhub_8cpp.html index 897d9c34..526db1a9 100644 --- a/usbhub_8cpp.html +++ b/usbhub_8cpp.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbhub.cpp File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
     

    Function Documentation

    - + +

    ◆ PrintHubPortStatus()

    +
    @@ -147,7 +129,7 @@ Functions
    -

    Definition at line 378 of file usbhub.cpp.

    +

    Definition at line 378 of file usbhub.cpp.

    @@ -156,7 +138,7 @@ Functions diff --git a/usbhub_8cpp__incl.md5 b/usbhub_8cpp__incl.md5 index 10f8250c..6fd9e76b 100644 --- a/usbhub_8cpp__incl.md5 +++ b/usbhub_8cpp__incl.md5 @@ -1 +1 @@ -d30f3e0393f05796b3f85b9b895576e7 \ No newline at end of file +a8323666a6dae66b3b7a941f9b7efaa9 \ No newline at end of file diff --git a/usbhub_8cpp__incl.png b/usbhub_8cpp__incl.png index 0f61626c..a2faa176 100644 Binary files a/usbhub_8cpp__incl.png and b/usbhub_8cpp__incl.png differ diff --git a/usbhub_8cpp_source.html b/usbhub_8cpp_source.html index 2383667a..a5d85bff 100644 --- a/usbhub_8cpp_source.html +++ b/usbhub_8cpp_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbhub.cpp Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    usbhub.cpp
    -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 #include "usbhub.h"
    18 
    19 bool USBHub::bResetInitiated = false;
    20 
    22 pUsb(p),
    23 bAddress(0),
    24 bNbrPorts(0),
    25 //bInitState(0),
    26 qNextPollTime(0),
    27 bPollEnable(false) {
    28  epInfo[0].epAddr = 0;
    29  epInfo[0].maxPktSize = 8;
    30  epInfo[0].bmSndToggle = 0;
    31  epInfo[0].bmRcvToggle = 0;
    32  epInfo[0].bmNakPower = USB_NAK_MAX_POWER;
    33 
    34  epInfo[1].epAddr = 1;
    35  epInfo[1].maxPktSize = 8; //kludge
    36  epInfo[1].bmSndToggle = 0;
    37  epInfo[1].bmRcvToggle = 0;
    38  epInfo[1].bmNakPower = USB_NAK_NOWAIT;
    39 
    40  if(pUsb)
    41  pUsb->RegisterDeviceClass(this);
    42 }
    43 
    44 uint8_t USBHub::Init(uint8_t parent, uint8_t port, bool lowspeed) {
    45  uint8_t buf[32];
    46  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
    47  HubDescriptor* hd = reinterpret_cast<HubDescriptor*>(buf);
    48  USB_CONFIGURATION_DESCRIPTOR * ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR*>(buf);
    49  uint8_t rcode;
    50  UsbDevice *p = NULL;
    51  EpInfo *oldep_ptr = NULL;
    52  uint8_t len = 0;
    53  uint16_t cd_len = 0;
    54 
    55  //USBTRACE("\r\nHub Init Start ");
    56  //D_PrintHex<uint8_t > (bInitState, 0x80);
    57 
    58  AddressPool &addrPool = pUsb->GetAddressPool();
    59 
    60  //switch (bInitState) {
    61  // case 0:
    62  if(bAddress)
    64 
    65  // Get pointer to pseudo device with address 0 assigned
    66  p = addrPool.GetUsbDevicePtr(0);
    67 
    68  if(!p)
    70 
    71  if(!p->epinfo)
    73 
    74  // Save old pointer to EP_RECORD of address 0
    75  oldep_ptr = p->epinfo;
    76 
    77  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
    78  p->epinfo = epInfo;
    79 
    80  p->lowspeed = lowspeed;
    81 
    82  // Get device descriptor
    83  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
    84 
    85  p->lowspeed = false;
    86 
    87  if(!rcode)
    88  len = (buf[0] > 32) ? 32 : buf[0];
    89 
    90  if(rcode) {
    91  // Restore p->epinfo
    92  p->epinfo = oldep_ptr;
    93  return rcode;
    94  }
    95 
    96  // Extract device class from device descriptor
    97  // If device class is not a hub return
    98  if(udd->bDeviceClass != 0x09)
    100 
    101  // Allocate new address according to device class
    102  bAddress = addrPool.AllocAddress(parent, (udd->bDeviceClass == 0x09) ? true : false, port);
    103 
    104  if(!bAddress)
    106 
    107  // Extract Max Packet Size from the device descriptor
    108  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
    109 
    110  // Assign new address to the device
    111  rcode = pUsb->setAddr(0, 0, bAddress);
    112 
    113  if(rcode) {
    114  // Restore p->epinfo
    115  p->epinfo = oldep_ptr;
    116  addrPool.FreeAddress(bAddress);
    117  bAddress = 0;
    118  return rcode;
    119  }
    120 
    121  //USBTRACE2("\r\nHub address: ", bAddress );
    122 
    123  // Restore p->epinfo
    124  p->epinfo = oldep_ptr;
    125 
    126  if(len)
    127  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
    128 
    129  if(rcode)
    130  goto FailGetDevDescr;
    131 
    132  // Assign epInfo to epinfo pointer
    133  rcode = pUsb->setEpInfoEntry(bAddress, 2, epInfo);
    134 
    135  if(rcode)
    136  goto FailSetDevTblEntry;
    137 
    138  // bInitState = 1;
    139 
    140  // case 1:
    141  // Get hub descriptor
    142  rcode = GetHubDescriptor(0, 8, buf);
    143 
    144  if(rcode)
    145  goto FailGetHubDescr;
    146 
    147  // Save number of ports for future use
    148  bNbrPorts = hd->bNbrPorts;
    149 
    150  // bInitState = 2;
    151 
    152  // case 2:
    153  // Read configuration Descriptor in Order To Obtain Proper Configuration Value
    154  rcode = pUsb->getConfDescr(bAddress, 0, 8, 0, buf);
    155 
    156  if(!rcode) {
    157  cd_len = ucd->wTotalLength;
    158  rcode = pUsb->getConfDescr(bAddress, 0, cd_len, 0, buf);
    159  }
    160  if(rcode)
    161  goto FailGetConfDescr;
    162 
    163  // The following code is of no practical use in real life applications.
    164  // It only intended for the usb protocol sniffer to properly parse hub-class requests.
    165  {
    166  uint8_t buf2[24];
    167 
    168  rcode = pUsb->getConfDescr(bAddress, 0, buf[0], 0, buf2);
    169 
    170  if(rcode)
    171  goto FailGetConfDescr;
    172  }
    173 
    174  // Set Configuration Value
    175  rcode = pUsb->setConf(bAddress, 0, buf[5]);
    176 
    177  if(rcode)
    178  goto FailSetConfDescr;
    179 
    180  // bInitState = 3;
    181 
    182  // case 3:
    183  // Power on all ports
    184  for(uint8_t j = 1; j <= bNbrPorts; j++)
    185  SetPortFeature(HUB_FEATURE_PORT_POWER, j, 0); //HubPortPowerOn(j);
    186 
    187  pUsb->SetHubPreMask();
    188  bPollEnable = true;
    189  // bInitState = 0;
    190  //}
    191  //bInitState = 0;
    192  //USBTRACE("...OK\r\n");
    193  return 0;
    194 
    195  // Oleg, No debugging?? -- xxxajk
    196 FailGetDevDescr:
    197  goto Fail;
    198 
    199 FailSetDevTblEntry:
    200  goto Fail;
    201 
    202 FailGetHubDescr:
    203  goto Fail;
    204 
    205 FailGetConfDescr:
    206  goto Fail;
    207 
    208 FailSetConfDescr:
    209  goto Fail;
    210 
    211 Fail:
    212  USBTRACE("...FAIL\r\n");
    213  return rcode;
    214 }
    215 
    216 uint8_t USBHub::Release() {
    217  pUsb->GetAddressPool().FreeAddress(bAddress);
    218 
    219  if(bAddress == 0x41)
    220  pUsb->SetHubPreMask();
    221 
    222  bAddress = 0;
    223  bNbrPorts = 0;
    224  qNextPollTime = 0;
    225  bPollEnable = false;
    226  return 0;
    227 }
    228 
    229 uint8_t USBHub::Poll() {
    230  uint8_t rcode = 0;
    231 
    232  if(!bPollEnable)
    233  return 0;
    234 
    235  if(((long)(millis() - qNextPollTime) >= 0L)) {
    236  rcode = CheckHubStatus();
    237  qNextPollTime = millis() + 100;
    238  }
    239  return rcode;
    240 }
    241 
    242 uint8_t USBHub::CheckHubStatus() {
    243  uint8_t rcode;
    244  uint8_t buf[8];
    245  uint16_t read = 1;
    246 
    247  rcode = pUsb->inTransfer(bAddress, 1, &read, buf);
    248 
    249  if(rcode)
    250  return rcode;
    251 
    252  //if (buf[0] & 0x01) // Hub Status Change
    253  //{
    254  // pUsb->PrintHubStatus(addr);
    255  // rcode = GetHubStatus(1, 0, 1, 4, buf);
    256  // if (rcode)
    257  // {
    258  // USB_HOST_SERIAL.print("GetHubStatus Error");
    259  // USB_HOST_SERIAL.println(rcode, HEX);
    260  // return rcode;
    261  // }
    262  //}
    263  for(uint8_t port = 1, mask = 0x02; port < 8; mask <<= 1, port++) {
    264  if(buf[0] & mask) {
    265  HubEvent evt;
    266  evt.bmEvent = 0;
    267 
    268  rcode = GetPortStatus(port, 4, evt.evtBuff);
    269 
    270  if(rcode)
    271  continue;
    272 
    273  rcode = PortStatusChange(port, evt);
    274 
    275  if(rcode == HUB_ERROR_PORT_HAS_BEEN_RESET)
    276  return 0;
    277 
    278  if(rcode)
    279  return rcode;
    280  }
    281  } // for
    282 
    283  for(uint8_t port = 1; port <= bNbrPorts; port++) {
    284  HubEvent evt;
    285  evt.bmEvent = 0;
    286 
    287  rcode = GetPortStatus(port, 4, evt.evtBuff);
    288 
    289  if(rcode)
    290  continue;
    291 
    293  continue;
    294 
    295  // Emulate connection event for the port
    297 
    298  rcode = PortStatusChange(port, evt);
    299 
    300  if(rcode == HUB_ERROR_PORT_HAS_BEEN_RESET)
    301  return 0;
    302 
    303  if(rcode)
    304  return rcode;
    305  } // for
    306  return 0;
    307 }
    308 
    309 void USBHub::ResetHubPort(uint8_t port) {
    310  HubEvent evt;
    311  evt.bmEvent = 0;
    312  uint8_t rcode;
    313 
    317 
    318 
    319  for(int i = 0; i < 3; i++) {
    320  rcode = GetPortStatus(port, 4, evt.evtBuff);
    321  if(rcode) break; // Some kind of error, bail.
    323  break;
    324  }
    325  delay(100); // simulate polling.
    326  }
    329  delay(20);
    330 }
    331 
    332 uint8_t USBHub::PortStatusChange(uint8_t port, HubEvent &evt) {
    333  switch(evt.bmEvent) {
    334  // Device connected event
    337  if(bResetInitiated)
    338  return 0;
    339 
    343  bResetInitiated = true;
    345 
    346  // Device disconnected event
    350  bResetInitiated = false;
    351 
    353  a.devAddress = 0;
    354  a.bmHub = 0;
    355  a.bmParent = bAddress;
    356  a.bmAddress = port;
    357  pUsb->ReleaseDevice(a.devAddress);
    358  return 0;
    359 
    360  // Reset complete event
    365 
    366  delay(20);
    367 
    368  a.devAddress = bAddress;
    369 
    371  bResetInitiated = false;
    372  break;
    373 
    374  } // switch (evt.bmEvent)
    375  return 0;
    376 }
    377 
    378 void PrintHubPortStatus(USBHub *hubptr, uint8_t addr, uint8_t port, bool print_changes) {
    379  uint8_t rcode = 0;
    380  HubEvent evt;
    381 
    382  rcode = hubptr->GetPortStatus(port, 4, evt.evtBuff);
    383 
    384  if(rcode) {
    385  USB_HOST_SERIAL.println("ERROR!");
    386  return;
    387  }
    388  USB_HOST_SERIAL.print("\r\nPort ");
    389  USB_HOST_SERIAL.println(port, DEC);
    390 
    391  USB_HOST_SERIAL.println("Status");
    392  USB_HOST_SERIAL.print("CONNECTION:\t");
    394  USB_HOST_SERIAL.print("ENABLE:\t\t");
    395  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_ENABLE) > 0, DEC);
    396  USB_HOST_SERIAL.print("SUSPEND:\t");
    397  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_SUSPEND) > 0, DEC);
    398  USB_HOST_SERIAL.print("OVER_CURRENT:\t");
    400  USB_HOST_SERIAL.print("RESET:\t\t");
    401  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_RESET) > 0, DEC);
    402  USB_HOST_SERIAL.print("POWER:\t\t");
    403  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_POWER) > 0, DEC);
    404  USB_HOST_SERIAL.print("LOW_SPEED:\t");
    406  USB_HOST_SERIAL.print("HIGH_SPEED:\t");
    408  USB_HOST_SERIAL.print("TEST:\t\t");
    409  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_TEST) > 0, DEC);
    410  USB_HOST_SERIAL.print("INDICATOR:\t");
    412 
    413  if(!print_changes)
    414  return;
    415 
    416  USB_HOST_SERIAL.println("\r\nChange");
    417  USB_HOST_SERIAL.print("CONNECTION:\t");
    419  USB_HOST_SERIAL.print("ENABLE:\t\t");
    420  USB_HOST_SERIAL.println((evt.bmChange & bmHUB_PORT_STATUS_C_PORT_ENABLE) > 0, DEC);
    421  USB_HOST_SERIAL.print("SUSPEND:\t");
    423  USB_HOST_SERIAL.print("OVER_CURRENT:\t");
    425  USB_HOST_SERIAL.print("RESET:\t\t");
    426  USB_HOST_SERIAL.println((evt.bmChange & bmHUB_PORT_STATUS_C_PORT_RESET) > 0, DEC);
    427 }
    uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
    Definition: Usb.cpp:771
    -
    uint8_t bmRcvToggle
    Definition: address.h:41
    +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 #include "usbhub.h"
    18 
    19 bool USBHub::bResetInitiated = false;
    20 
    22 pUsb(p),
    23 bAddress(0),
    24 bNbrPorts(0),
    25 //bInitState(0),
    26 qNextPollTime(0),
    27 bPollEnable(false) {
    28  epInfo[0].epAddr = 0;
    29  epInfo[0].maxPktSize = 8;
    30  epInfo[0].bmSndToggle = 0;
    31  epInfo[0].bmRcvToggle = 0;
    32  epInfo[0].bmNakPower = USB_NAK_MAX_POWER;
    33 
    34  epInfo[1].epAddr = 1;
    35  epInfo[1].maxPktSize = 8; //kludge
    36  epInfo[1].bmSndToggle = 0;
    37  epInfo[1].bmRcvToggle = 0;
    38  epInfo[1].bmNakPower = USB_NAK_NOWAIT;
    39 
    40  if(pUsb)
    41  pUsb->RegisterDeviceClass(this);
    42 }
    43 
    44 uint8_t USBHub::Init(uint8_t parent, uint8_t port, bool lowspeed) {
    45  uint8_t buf[32];
    46  USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR*>(buf);
    47  HubDescriptor* hd = reinterpret_cast<HubDescriptor*>(buf);
    48  USB_CONFIGURATION_DESCRIPTOR * ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR*>(buf);
    49  uint8_t rcode;
    50  UsbDevice *p = NULL;
    51  EpInfo *oldep_ptr = NULL;
    52  uint8_t len = 0;
    53  uint16_t cd_len = 0;
    54 
    55  //USBTRACE("\r\nHub Init Start ");
    56  //D_PrintHex<uint8_t > (bInitState, 0x80);
    57 
    58  AddressPool &addrPool = pUsb->GetAddressPool();
    59 
    60  //switch (bInitState) {
    61  // case 0:
    62  if(bAddress)
    64 
    65  // Get pointer to pseudo device with address 0 assigned
    66  p = addrPool.GetUsbDevicePtr(0);
    67 
    68  if(!p)
    70 
    71  if(!p->epinfo)
    73 
    74  // Save old pointer to EP_RECORD of address 0
    75  oldep_ptr = p->epinfo;
    76 
    77  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
    78  p->epinfo = epInfo;
    79 
    80  p->lowspeed = lowspeed;
    81 
    82  // Get device descriptor
    83  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
    84 
    85  p->lowspeed = false;
    86 
    87  if(!rcode)
    88  len = (buf[0] > 32) ? 32 : buf[0];
    89 
    90  if(rcode) {
    91  // Restore p->epinfo
    92  p->epinfo = oldep_ptr;
    93  return rcode;
    94  }
    95 
    96  // Extract device class from device descriptor
    97  // If device class is not a hub return
    98  if(udd->bDeviceClass != 0x09)
    100 
    101  // Allocate new address according to device class
    102  bAddress = addrPool.AllocAddress(parent, (udd->bDeviceClass == 0x09) ? true : false, port);
    103 
    104  if(!bAddress)
    106 
    107  // Extract Max Packet Size from the device descriptor
    108  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
    109 
    110  // Assign new address to the device
    111  rcode = pUsb->setAddr(0, 0, bAddress);
    112 
    113  if(rcode) {
    114  // Restore p->epinfo
    115  p->epinfo = oldep_ptr;
    116  addrPool.FreeAddress(bAddress);
    117  bAddress = 0;
    118  return rcode;
    119  }
    120 
    121  //USBTRACE2("\r\nHub address: ", bAddress );
    122 
    123  // Restore p->epinfo
    124  p->epinfo = oldep_ptr;
    125 
    126  if(len)
    127  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
    128 
    129  if(rcode)
    130  goto FailGetDevDescr;
    131 
    132  // Assign epInfo to epinfo pointer
    133  rcode = pUsb->setEpInfoEntry(bAddress, 2, epInfo);
    134 
    135  if(rcode)
    136  goto FailSetDevTblEntry;
    137 
    138  // bInitState = 1;
    139 
    140  // case 1:
    141  // Get hub descriptor
    142  rcode = GetHubDescriptor(0, 8, buf);
    143 
    144  if(rcode)
    145  goto FailGetHubDescr;
    146 
    147  // Save number of ports for future use
    148  bNbrPorts = hd->bNbrPorts;
    149 
    150  // bInitState = 2;
    151 
    152  // case 2:
    153  // Read configuration Descriptor in Order To Obtain Proper Configuration Value
    154  rcode = pUsb->getConfDescr(bAddress, 0, 8, 0, buf);
    155 
    156  if(!rcode) {
    157  cd_len = ucd->wTotalLength;
    158  rcode = pUsb->getConfDescr(bAddress, 0, cd_len, 0, buf);
    159  }
    160  if(rcode)
    161  goto FailGetConfDescr;
    162 
    163  // The following code is of no practical use in real life applications.
    164  // It only intended for the usb protocol sniffer to properly parse hub-class requests.
    165  {
    166  uint8_t buf2[24];
    167 
    168  rcode = pUsb->getConfDescr(bAddress, 0, buf[0], 0, buf2);
    169 
    170  if(rcode)
    171  goto FailGetConfDescr;
    172  }
    173 
    174  // Set Configuration Value
    175  rcode = pUsb->setConf(bAddress, 0, buf[5]);
    176 
    177  if(rcode)
    178  goto FailSetConfDescr;
    179 
    180  // bInitState = 3;
    181 
    182  // case 3:
    183  // Power on all ports
    184  for(uint8_t j = 1; j <= bNbrPorts; j++)
    185  SetPortFeature(HUB_FEATURE_PORT_POWER, j, 0); //HubPortPowerOn(j);
    186 
    187  pUsb->SetHubPreMask();
    188  bPollEnable = true;
    189  // bInitState = 0;
    190  //}
    191  //bInitState = 0;
    192  //USBTRACE("...OK\r\n");
    193  return 0;
    194 
    195  // Oleg, No debugging?? -- xxxajk
    196 FailGetDevDescr:
    197  goto Fail;
    198 
    199 FailSetDevTblEntry:
    200  goto Fail;
    201 
    202 FailGetHubDescr:
    203  goto Fail;
    204 
    205 FailGetConfDescr:
    206  goto Fail;
    207 
    208 FailSetConfDescr:
    209  goto Fail;
    210 
    211 Fail:
    212  USBTRACE("...FAIL\r\n");
    213  return rcode;
    214 }
    215 
    216 uint8_t USBHub::Release() {
    217  pUsb->GetAddressPool().FreeAddress(bAddress);
    218 
    219  if(bAddress == 0x41)
    220  pUsb->SetHubPreMask();
    221 
    222  bAddress = 0;
    223  bNbrPorts = 0;
    224  qNextPollTime = 0;
    225  bPollEnable = false;
    226  return 0;
    227 }
    228 
    229 uint8_t USBHub::Poll() {
    230  uint8_t rcode = 0;
    231 
    232  if(!bPollEnable)
    233  return 0;
    234 
    235  if(((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L)) {
    236  rcode = CheckHubStatus();
    237  qNextPollTime = (uint32_t)millis() + 100;
    238  }
    239  return rcode;
    240 }
    241 
    242 uint8_t USBHub::CheckHubStatus() {
    243  uint8_t rcode;
    244  uint8_t buf[8];
    245  uint16_t read = 1;
    246 
    247  rcode = pUsb->inTransfer(bAddress, 1, &read, buf);
    248 
    249  if(rcode)
    250  return rcode;
    251 
    252  //if (buf[0] & 0x01) // Hub Status Change
    253  //{
    254  // pUsb->PrintHubStatus(addr);
    255  // rcode = GetHubStatus(1, 0, 1, 4, buf);
    256  // if (rcode)
    257  // {
    258  // USB_HOST_SERIAL.print("GetHubStatus Error");
    259  // USB_HOST_SERIAL.println(rcode, HEX);
    260  // return rcode;
    261  // }
    262  //}
    263  for(uint8_t port = 1, mask = 0x02; port < 8; mask <<= 1, port++) {
    264  if(buf[0] & mask) {
    265  HubEvent evt;
    266  evt.bmEvent = 0;
    267 
    268  rcode = GetPortStatus(port, 4, evt.evtBuff);
    269 
    270  if(rcode)
    271  continue;
    272 
    273  rcode = PortStatusChange(port, evt);
    274 
    275  if(rcode == HUB_ERROR_PORT_HAS_BEEN_RESET)
    276  return 0;
    277 
    278  if(rcode)
    279  return rcode;
    280  }
    281  } // for
    282 
    283  for(uint8_t port = 1; port <= bNbrPorts; port++) {
    284  HubEvent evt;
    285  evt.bmEvent = 0;
    286 
    287  rcode = GetPortStatus(port, 4, evt.evtBuff);
    288 
    289  if(rcode)
    290  continue;
    291 
    293  continue;
    294 
    295  // Emulate connection event for the port
    297 
    298  rcode = PortStatusChange(port, evt);
    299 
    300  if(rcode == HUB_ERROR_PORT_HAS_BEEN_RESET)
    301  return 0;
    302 
    303  if(rcode)
    304  return rcode;
    305  } // for
    306  return 0;
    307 }
    308 
    309 void USBHub::ResetHubPort(uint8_t port) {
    310  HubEvent evt;
    311  evt.bmEvent = 0;
    312  uint8_t rcode;
    313 
    317 
    318 
    319  for(int i = 0; i < 3; i++) {
    320  rcode = GetPortStatus(port, 4, evt.evtBuff);
    321  if(rcode) break; // Some kind of error, bail.
    323  break;
    324  }
    325  delay(100); // simulate polling.
    326  }
    329  delay(20);
    330 }
    331 
    332 uint8_t USBHub::PortStatusChange(uint8_t port, HubEvent &evt) {
    333  switch(evt.bmEvent) {
    334  // Device connected event
    337  if(bResetInitiated)
    338  return 0;
    339 
    343  bResetInitiated = true;
    345 
    346  // Device disconnected event
    350  bResetInitiated = false;
    351 
    353  a.devAddress = 0;
    354  a.bmHub = 0;
    355  a.bmParent = bAddress;
    356  a.bmAddress = port;
    357  pUsb->ReleaseDevice(a.devAddress);
    358  return 0;
    359 
    360  // Reset complete event
    365 
    366  delay(20);
    367 
    368  a.devAddress = bAddress;
    369 
    371  bResetInitiated = false;
    372  break;
    373 
    374  } // switch (evt.bmEvent)
    375  return 0;
    376 }
    377 
    378 void PrintHubPortStatus(USBHub *hubptr, uint8_t addr __attribute__((unused)), uint8_t port, bool print_changes) {
    379  uint8_t rcode = 0;
    380  HubEvent evt;
    381 
    382  rcode = hubptr->GetPortStatus(port, 4, evt.evtBuff);
    383 
    384  if(rcode) {
    385  USB_HOST_SERIAL.println("ERROR!");
    386  return;
    387  }
    388  USB_HOST_SERIAL.print("\r\nPort ");
    389  USB_HOST_SERIAL.println(port, DEC);
    390 
    391  USB_HOST_SERIAL.println("Status");
    392  USB_HOST_SERIAL.print("CONNECTION:\t");
    394  USB_HOST_SERIAL.print("ENABLE:\t\t");
    395  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_ENABLE) > 0, DEC);
    396  USB_HOST_SERIAL.print("SUSPEND:\t");
    397  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_SUSPEND) > 0, DEC);
    398  USB_HOST_SERIAL.print("OVER_CURRENT:\t");
    400  USB_HOST_SERIAL.print("RESET:\t\t");
    401  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_RESET) > 0, DEC);
    402  USB_HOST_SERIAL.print("POWER:\t\t");
    403  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_POWER) > 0, DEC);
    404  USB_HOST_SERIAL.print("LOW_SPEED:\t");
    406  USB_HOST_SERIAL.print("HIGH_SPEED:\t");
    408  USB_HOST_SERIAL.print("TEST:\t\t");
    409  USB_HOST_SERIAL.println((evt.bmStatus & bmHUB_PORT_STATUS_PORT_TEST) > 0, DEC);
    410  USB_HOST_SERIAL.print("INDICATOR:\t");
    412 
    413  if(!print_changes)
    414  return;
    415 
    416  USB_HOST_SERIAL.println("\r\nChange");
    417  USB_HOST_SERIAL.print("CONNECTION:\t");
    419  USB_HOST_SERIAL.print("ENABLE:\t\t");
    420  USB_HOST_SERIAL.println((evt.bmChange & bmHUB_PORT_STATUS_C_PORT_ENABLE) > 0, DEC);
    421  USB_HOST_SERIAL.print("SUSPEND:\t");
    423  USB_HOST_SERIAL.print("OVER_CURRENT:\t");
    425  USB_HOST_SERIAL.print("RESET:\t\t");
    426  USB_HOST_SERIAL.println((evt.bmChange & bmHUB_PORT_STATUS_C_PORT_RESET) > 0, DEC);
    427 }
    uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
    Definition: Usb.cpp:784
    +
    uint8_t bmRcvToggle
    Definition: address.h:48
    #define bmHUB_PORT_STATE_CHECK_DISABLED
    Definition: usbhub.h:119
    - +
    #define bmHUB_PORT_EVENT_LS_RESET_COMPLETE
    Definition: usbhub.h:130
    #define bmHUB_PORT_STATUS_PORT_CONNECTION
    Definition: usbhub.h:76
    #define bmHUB_PORT_STATUS_C_PORT_SUSPEND
    Definition: usbhub.h:90
    -
    EpInfo * epinfo
    Definition: address.h:76
    -
    bool lowspeed
    Definition: address.h:79
    -
    #define USB_ERROR_EPINFO_IS_NULL
    Definition: UsbCore.h:83
    -
    uint8_t bmNakPower
    Definition: address.h:42
    +
    EpInfo * epinfo
    Definition: address.h:83
    +
    bool lowspeed
    Definition: address.h:86
    +
    #define USB_ERROR_EPINFO_IS_NULL
    Definition: UsbCore.h:94
    +
    uint8_t bmNakPower
    Definition: address.h:49
    uint16_t bmChange
    Definition: usbhub.h:157
    - - + +
    #define HUB_ERROR_PORT_HAS_BEEN_RESET
    Definition: usbhub.h:113
    #define HUB_FEATURE_PORT_POWER
    Definition: usbhub.h:52
    -
    uint8_t bMaxPacketSize0
    Definition: usb_ch9.h:105
    +
    uint8_t bMaxPacketSize0
    Definition: usb_ch9.h:112
    #define bmHUB_PORT_STATUS_PORT_LOW_SPEED
    Definition: usbhub.h:82
    #define bmHUB_PORT_STATUS_PORT_SUSPEND
    Definition: usbhub.h:78
    #define HUB_FEATURE_C_PORT_RESET
    Definition: usbhub.h:58
    #define bmHUB_PORT_STATUS_PORT_OVER_CURRENT
    Definition: usbhub.h:79
    -
    uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
    Definition: Usb.cpp:810
    +
    uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
    Definition: Usb.cpp:823
    void ResetHubPort(uint8_t port)
    Definition: usbhub.cpp:309
    -
    uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
    Definition: Usb.cpp:64
    +
    uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
    Definition: Usb.cpp:71
    virtual void FreeAddress(uint8_t addr)=0
    #define bmHUB_PORT_STATUS_C_PORT_ENABLE
    Definition: usbhub.h:89
    virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
    uint8_t bNbrPorts
    Definition: usbhub.h:136
    -
    uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
    Definition: Usb.cpp:801
    -
    #define USB_HOST_SERIAL
    Definition: settings.h:34
    - -
    uint8_t epAddr
    Definition: address.h:33
    -
    #define USB_NAK_MAX_POWER
    Definition: address.h:27
    +
    uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
    Definition: Usb.cpp:814
    +
    #define USB_HOST_SERIAL
    Definition: settings.h:49
    + +
    uint8_t epAddr
    Definition: address.h:40
    +
    #define USB_NAK_MAX_POWER
    Definition: address.h:34
    #define bmHUB_PORT_STATE_DISABLED
    Definition: usbhub.h:122
    -
    void SetHubPreMask()
    Definition: UsbCore.h:205
    +
    void SetHubPreMask()
    Definition: UsbCore.h:216
    uint8_t GetHubDescriptor(uint8_t index, uint16_t nbytes, uint8_t *dataptr)
    Definition: usbhub.h:221
    #define bmHUB_PORT_STATUS_PORT_POWER
    Definition: usbhub.h:81
    -
    Definition: address.h:32
    +
    Definition: address.h:39
    #define bmHUB_PORT_STATUS_PORT_HIGH_SPEED
    Definition: usbhub.h:83
    uint8_t ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel=0)
    Definition: usbhub.h:216
    #define bmHUB_PORT_STATUS_C_PORT_OVER_CURRENT
    Definition: usbhub.h:91
    uint32_t bmEvent
    Definition: usbhub.h:159
    - +
    virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
    -
    uint8_t bmSndToggle
    Definition: address.h:40
    -
    #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
    Definition: UsbCore.h:85
    +
    uint8_t bmSndToggle
    Definition: address.h:47
    +
    #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
    Definition: UsbCore.h:96
    #define bmHUB_PORT_STATUS_C_PORT_RESET
    Definition: usbhub.h:92
    -
    uint8_t bDeviceClass
    Definition: usb_ch9.h:102
    +
    uint8_t bDeviceClass
    Definition: usb_ch9.h:109
    uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
    Definition: usbhub.cpp:44
    Definition: usbhub.h:164
    uint16_t bmStatus
    Definition: usbhub.h:156
    #define HUB_FEATURE_C_PORT_CONNECTION
    Definition: usbhub.h:54
    void PrintHubPortStatus(USBHub *hubptr, uint8_t addr, uint8_t port, bool print_changes)
    Definition: usbhub.cpp:378
    -
    uint8_t devAddress
    Definition: address.h:67
    -
    uint8_t bmAddress
    Definition: address.h:62
    -
    #define USB_NAK_NOWAIT
    Definition: address.h:29
    +
    uint8_t devAddress
    Definition: address.h:74
    +
    uint8_t bmAddress
    Definition: address.h:69
    +
    #define USB_NAK_NOWAIT
    Definition: address.h:36
    #define bmHUB_PORT_STATUS_PORT_RESET
    Definition: usbhub.h:80
    -
    #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
    Definition: UsbCore.h:82
    -
    #define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
    Definition: UsbCore.h:77
    -
    uint8_t bmParent
    Definition: address.h:63
    +
    #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
    Definition: UsbCore.h:93
    +
    #define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
    Definition: UsbCore.h:88
    +
    uint8_t bmParent
    Definition: address.h:70
    uint8_t GetPortStatus(uint8_t port, uint16_t nbytes, uint8_t *dataptr)
    Definition: usbhub.h:231
    #define bmHUB_PORT_EVENT_CONNECT
    Definition: usbhub.h:125
    -
    uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
    Definition: Usb.cpp:206
    +
    uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
    Definition: Usb.cpp:213
    uint8_t Release()
    Definition: usbhub.cpp:216
    #define HUB_FEATURE_PORT_RESET
    Definition: usbhub.h:51
    -
    #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
    Definition: UsbCore.h:80
    +
    #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
    Definition: UsbCore.h:91
    #define bmHUB_PORT_STATUS_PORT_ENABLE
    Definition: usbhub.h:77
    -
    uint8_t maxPktSize
    Definition: address.h:34
    -
    AddressPool & GetAddressPool()
    Definition: UsbCore.h:213
    -
    uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed)
    Definition: Usb.cpp:653
    -
    Definition: UsbCore.h:197
    +
    uint8_t maxPktSize
    Definition: address.h:41
    +
    AddressPool & GetAddressPool()
    Definition: UsbCore.h:224
    +
    uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed)
    Definition: Usb.cpp:666
    +
    Definition: UsbCore.h:208
    uint8_t evtBuff[4]
    Definition: usbhub.h:160
    #define bmHUB_PORT_STATUS_PORT_INDICATOR
    Definition: usbhub.h:85
    -
    uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
    Definition: UsbCore.h:217
    - +
    uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
    Definition: UsbCore.h:228
    +
    #define bmHUB_PORT_STATUS_PORT_TEST
    Definition: usbhub.h:84
    #define bmHUB_PORT_EVENT_LS_CONNECT
    Definition: usbhub.h:129
    #define bmHUB_PORT_STATUS_C_PORT_CONNECTION
    Definition: usbhub.h:88
    #define bmHUB_PORT_EVENT_RESET_COMPLETE
    Definition: usbhub.h:127
    uint8_t SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel=0)
    Definition: usbhub.h:246
    #define HUB_FEATURE_C_PORT_ENABLE
    Definition: usbhub.h:55
    -
    #define USBTRACE(s)
    Definition: macros.h:75
    -
    uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
    defined(USB_METHODS_INLINE)
    Definition: Usb.cpp:766
    -
    uint8_t bmHub
    Definition: address.h:64
    +
    #define USBTRACE(s)
    Definition: macros.h:82
    +
    uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
    defined(USB_METHODS_INLINE)
    Definition: Usb.cpp:779
    +
    uint8_t bmHub
    Definition: address.h:71
    uint8_t Poll()
    Definition: usbhub.cpp:229
    USBHub(USB *p)
    Definition: usbhub.cpp:21
    -
    uint8_t ReleaseDevice(uint8_t addr)
    Definition: Usb.cpp:751
    +
    uint8_t ReleaseDevice(uint8_t addr)
    Definition: Usb.cpp:764
    #define bmHUB_PORT_EVENT_DISCONNECT
    Definition: usbhub.h:126
    - +
    diff --git a/usbhub_8h.html b/usbhub_8h.html index 1dd534f3..7a4f1d46 100644 --- a/usbhub_8h.html +++ b/usbhub_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: usbhub.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
     

    Macro Definition Documentation

    - + +

    ◆ USB_DESCRIPTOR_HUB

    +
    @@ -298,11 +280,13 @@ Functions
    -

    Definition at line 22 of file usbhub.h.

    +

    Definition at line 22 of file usbhub.h.

    - + +

    ◆ bmREQ_CLEAR_HUB_FEATURE

    +
    @@ -312,11 +296,13 @@ Functions
    -

    Definition at line 25 of file usbhub.h.

    +

    Definition at line 25 of file usbhub.h.

    - + +

    ◆ bmREQ_CLEAR_PORT_FEATURE

    +
    @@ -326,11 +312,13 @@ Functions
    -

    Definition at line 26 of file usbhub.h.

    +

    Definition at line 26 of file usbhub.h.

    - + +

    ◆ bmREQ_CLEAR_TT_BUFFER

    +
    @@ -340,11 +328,13 @@ Functions
    -

    Definition at line 27 of file usbhub.h.

    +

    Definition at line 27 of file usbhub.h.

    - + +

    ◆ bmREQ_GET_HUB_DESCRIPTOR

    +
    @@ -354,11 +344,13 @@ Functions
    -

    Definition at line 28 of file usbhub.h.

    +

    Definition at line 28 of file usbhub.h.

    - + +

    ◆ bmREQ_GET_HUB_STATUS

    +
    @@ -368,11 +360,13 @@ Functions
    -

    Definition at line 29 of file usbhub.h.

    +

    Definition at line 29 of file usbhub.h.

    - + +

    ◆ bmREQ_GET_PORT_STATUS

    +
    @@ -382,11 +376,13 @@ Functions
    -

    Definition at line 30 of file usbhub.h.

    +

    Definition at line 30 of file usbhub.h.

    - + +

    ◆ bmREQ_RESET_TT

    +
    @@ -396,11 +392,13 @@ Functions
    -

    Definition at line 31 of file usbhub.h.

    +

    Definition at line 31 of file usbhub.h.

    - + +

    ◆ bmREQ_SET_HUB_DESCRIPTOR

    +
    @@ -410,11 +408,13 @@ Functions
    -

    Definition at line 32 of file usbhub.h.

    +

    Definition at line 32 of file usbhub.h.

    - + +

    ◆ bmREQ_SET_HUB_FEATURE

    +
    @@ -424,11 +424,13 @@ Functions
    -

    Definition at line 33 of file usbhub.h.

    +

    Definition at line 33 of file usbhub.h.

    - + +

    ◆ bmREQ_SET_PORT_FEATURE

    +
    @@ -438,11 +440,13 @@ Functions
    -

    Definition at line 34 of file usbhub.h.

    +

    Definition at line 34 of file usbhub.h.

    - + +

    ◆ bmREQ_GET_TT_STATE

    +
    @@ -452,11 +456,13 @@ Functions
    -

    Definition at line 35 of file usbhub.h.

    +

    Definition at line 35 of file usbhub.h.

    - + +

    ◆ bmREQ_STOP_TT

    +
    @@ -466,11 +472,13 @@ Functions
    -

    Definition at line 36 of file usbhub.h.

    +

    Definition at line 36 of file usbhub.h.

    - + +

    ◆ HUB_REQUEST_CLEAR_TT_BUFFER

    +
    @@ -480,11 +488,13 @@ Functions
    -

    Definition at line 39 of file usbhub.h.

    +

    Definition at line 39 of file usbhub.h.

    - + +

    ◆ HUB_REQUEST_RESET_TT

    +
    @@ -494,11 +504,13 @@ Functions
    -

    Definition at line 40 of file usbhub.h.

    +

    Definition at line 40 of file usbhub.h.

    - + +

    ◆ HUB_REQUEST_GET_TT_STATE

    +
    @@ -508,11 +520,13 @@ Functions
    -

    Definition at line 41 of file usbhub.h.

    +

    Definition at line 41 of file usbhub.h.

    - + +

    ◆ HUB_REQUEST_STOP_TT

    +
    @@ -522,11 +536,13 @@ Functions
    -

    Definition at line 42 of file usbhub.h.

    +

    Definition at line 42 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_C_HUB_LOCAL_POWER

    +
    @@ -536,11 +552,13 @@ Functions
    -

    Definition at line 45 of file usbhub.h.

    +

    Definition at line 45 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_C_HUB_OVER_CURRENT

    +
    @@ -550,11 +568,13 @@ Functions
    -

    Definition at line 46 of file usbhub.h.

    +

    Definition at line 46 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_PORT_CONNECTION

    +
    @@ -564,11 +584,13 @@ Functions
    -

    Definition at line 47 of file usbhub.h.

    +

    Definition at line 47 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_PORT_ENABLE

    +
    @@ -578,11 +600,13 @@ Functions
    -

    Definition at line 48 of file usbhub.h.

    +

    Definition at line 48 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_PORT_SUSPEND

    +
    @@ -592,11 +616,13 @@ Functions
    -

    Definition at line 49 of file usbhub.h.

    +

    Definition at line 49 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_PORT_OVER_CURRENT

    +
    @@ -606,11 +632,13 @@ Functions
    -

    Definition at line 50 of file usbhub.h.

    +

    Definition at line 50 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_PORT_RESET

    +
    @@ -620,11 +648,13 @@ Functions
    -

    Definition at line 51 of file usbhub.h.

    +

    Definition at line 51 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_PORT_POWER

    +
    @@ -634,11 +664,13 @@ Functions
    -

    Definition at line 52 of file usbhub.h.

    +

    Definition at line 52 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_PORT_LOW_SPEED

    +
    @@ -648,11 +680,13 @@ Functions
    -

    Definition at line 53 of file usbhub.h.

    +

    Definition at line 53 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_C_PORT_CONNECTION

    +
    @@ -662,11 +696,13 @@ Functions
    -

    Definition at line 54 of file usbhub.h.

    +

    Definition at line 54 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_C_PORT_ENABLE

    +
    @@ -676,11 +712,13 @@ Functions
    -

    Definition at line 55 of file usbhub.h.

    +

    Definition at line 55 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_C_PORT_SUSPEND

    +
    @@ -690,11 +728,13 @@ Functions
    -

    Definition at line 56 of file usbhub.h.

    +

    Definition at line 56 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_C_PORT_OVER_CURRENT

    +
    @@ -704,11 +744,13 @@ Functions
    -

    Definition at line 57 of file usbhub.h.

    +

    Definition at line 57 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_C_PORT_RESET

    +
    @@ -718,11 +760,13 @@ Functions
    -

    Definition at line 58 of file usbhub.h.

    +

    Definition at line 58 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_PORT_TEST

    +
    @@ -732,11 +776,13 @@ Functions
    -

    Definition at line 59 of file usbhub.h.

    +

    Definition at line 59 of file usbhub.h.

    - + +

    ◆ HUB_FEATURE_PORT_INDICATOR

    +
    @@ -746,11 +792,13 @@ Functions
    -

    Definition at line 60 of file usbhub.h.

    +

    Definition at line 60 of file usbhub.h.

    - + +

    ◆ HUB_PORT_TEST_MODE_J

    +
    @@ -760,11 +808,13 @@ Functions
    -

    Definition at line 63 of file usbhub.h.

    +

    Definition at line 63 of file usbhub.h.

    - + +

    ◆ HUB_PORT_TEST_MODE_K

    +
    @@ -774,11 +824,13 @@ Functions
    -

    Definition at line 64 of file usbhub.h.

    +

    Definition at line 64 of file usbhub.h.

    - + +

    ◆ HUB_PORT_TEST_MODE_SE0_NAK

    +
    @@ -788,11 +840,13 @@ Functions
    -

    Definition at line 65 of file usbhub.h.

    +

    Definition at line 65 of file usbhub.h.

    - + +

    ◆ HUB_PORT_TEST_MODE_PACKET

    +
    @@ -802,11 +856,13 @@ Functions
    -

    Definition at line 66 of file usbhub.h.

    +

    Definition at line 66 of file usbhub.h.

    - + +

    ◆ HUB_PORT_TEST_MODE_FORCE_ENABLE

    +
    @@ -816,11 +872,13 @@ Functions
    -

    Definition at line 67 of file usbhub.h.

    +

    Definition at line 67 of file usbhub.h.

    - + +

    ◆ HUB_PORT_INDICATOR_AUTO

    +
    @@ -830,11 +888,13 @@ Functions
    -

    Definition at line 70 of file usbhub.h.

    +

    Definition at line 70 of file usbhub.h.

    - + +

    ◆ HUB_PORT_INDICATOR_AMBER

    +
    @@ -844,11 +904,13 @@ Functions
    -

    Definition at line 71 of file usbhub.h.

    +

    Definition at line 71 of file usbhub.h.

    - + +

    ◆ HUB_PORT_INDICATOR_GREEN

    +
    @@ -858,11 +920,13 @@ Functions
    -

    Definition at line 72 of file usbhub.h.

    +

    Definition at line 72 of file usbhub.h.

    - + +

    ◆ HUB_PORT_INDICATOR_OFF

    +
    @@ -872,11 +936,13 @@ Functions
    -

    Definition at line 73 of file usbhub.h.

    +

    Definition at line 73 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_CONNECTION

    +
    @@ -886,11 +952,13 @@ Functions
    -

    Definition at line 76 of file usbhub.h.

    +

    Definition at line 76 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_ENABLE

    +
    @@ -900,11 +968,13 @@ Functions
    -

    Definition at line 77 of file usbhub.h.

    +

    Definition at line 77 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_SUSPEND

    +
    @@ -914,11 +984,13 @@ Functions
    -

    Definition at line 78 of file usbhub.h.

    +

    Definition at line 78 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_OVER_CURRENT

    +
    @@ -928,11 +1000,13 @@ Functions
    -

    Definition at line 79 of file usbhub.h.

    +

    Definition at line 79 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_RESET

    +
    @@ -942,11 +1016,13 @@ Functions
    -

    Definition at line 80 of file usbhub.h.

    +

    Definition at line 80 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_POWER

    +
    @@ -956,11 +1032,13 @@ Functions
    -

    Definition at line 81 of file usbhub.h.

    +

    Definition at line 81 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_LOW_SPEED

    +
    @@ -970,11 +1048,13 @@ Functions
    -

    Definition at line 82 of file usbhub.h.

    +

    Definition at line 82 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_HIGH_SPEED

    +
    @@ -984,11 +1064,13 @@ Functions
    -

    Definition at line 83 of file usbhub.h.

    +

    Definition at line 83 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_TEST

    +
    @@ -998,11 +1080,13 @@ Functions
    -

    Definition at line 84 of file usbhub.h.

    +

    Definition at line 84 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_PORT_INDICATOR

    +
    @@ -1012,11 +1096,13 @@ Functions
    -

    Definition at line 85 of file usbhub.h.

    +

    Definition at line 85 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_C_PORT_CONNECTION

    +
    @@ -1026,11 +1112,13 @@ Functions
    -

    Definition at line 88 of file usbhub.h.

    +

    Definition at line 88 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_C_PORT_ENABLE

    +
    @@ -1040,11 +1128,13 @@ Functions
    -

    Definition at line 89 of file usbhub.h.

    +

    Definition at line 89 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_C_PORT_SUSPEND

    +
    @@ -1054,11 +1144,13 @@ Functions
    -

    Definition at line 90 of file usbhub.h.

    +

    Definition at line 90 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_C_PORT_OVER_CURRENT

    +
    @@ -1068,11 +1160,13 @@ Functions
    -

    Definition at line 91 of file usbhub.h.

    +

    Definition at line 91 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_C_PORT_RESET

    +
    @@ -1082,11 +1176,13 @@ Functions
    -

    Definition at line 92 of file usbhub.h.

    +

    Definition at line 92 of file usbhub.h.

    - + +

    ◆ bmHUB_STATUS_LOCAL_POWER_SOURCE

    +
    @@ -1096,11 +1192,13 @@ Functions
    -

    Definition at line 95 of file usbhub.h.

    +

    Definition at line 95 of file usbhub.h.

    - + +

    ◆ bmHUB_STATUS_OVER_CURRENT

    +
    @@ -1110,11 +1208,13 @@ Functions
    -

    Definition at line 96 of file usbhub.h.

    +

    Definition at line 96 of file usbhub.h.

    - + +

    ◆ bmHUB_STATUS_C_LOCAL_POWER_SOURCE

    +
    @@ -1124,11 +1224,13 @@ Functions
    -

    Definition at line 99 of file usbhub.h.

    +

    Definition at line 99 of file usbhub.h.

    - + +

    ◆ bmHUB_STATUS_C_OVER_CURRENT

    +
    @@ -1138,11 +1240,13 @@ Functions
    -

    Definition at line 100 of file usbhub.h.

    +

    Definition at line 100 of file usbhub.h.

    - + +

    ◆ USB_STATE_HUB_PORT_CONFIGURING

    +
    @@ -1152,11 +1256,13 @@ Functions
    -

    Definition at line 104 of file usbhub.h.

    +

    Definition at line 104 of file usbhub.h.

    - + +

    ◆ USB_STATE_HUB_PORT_POWERED_OFF

    +
    @@ -1166,11 +1272,13 @@ Functions
    -

    Definition at line 105 of file usbhub.h.

    +

    Definition at line 105 of file usbhub.h.

    - + +

    ◆ USB_STATE_HUB_PORT_WAIT_FOR_POWER_GOOD

    +
    @@ -1180,11 +1288,13 @@ Functions
    -

    Definition at line 106 of file usbhub.h.

    +

    Definition at line 106 of file usbhub.h.

    - + +

    ◆ USB_STATE_HUB_PORT_DISCONNECTED

    +
    @@ -1194,11 +1304,13 @@ Functions
    -

    Definition at line 107 of file usbhub.h.

    +

    Definition at line 107 of file usbhub.h.

    - + +

    ◆ USB_STATE_HUB_PORT_DISABLED

    +
    @@ -1208,11 +1320,13 @@ Functions
    -

    Definition at line 108 of file usbhub.h.

    +

    Definition at line 108 of file usbhub.h.

    - + +

    ◆ USB_STATE_HUB_PORT_RESETTING

    +
    @@ -1222,11 +1336,13 @@ Functions
    -

    Definition at line 109 of file usbhub.h.

    +

    Definition at line 109 of file usbhub.h.

    - + +

    ◆ USB_STATE_HUB_PORT_ENABLED

    +
    @@ -1236,11 +1352,13 @@ Functions
    -

    Definition at line 110 of file usbhub.h.

    +

    Definition at line 110 of file usbhub.h.

    - + +

    ◆ HUB_ERROR_PORT_HAS_BEEN_RESET

    +
    @@ -1250,11 +1368,13 @@ Functions
    -

    Definition at line 113 of file usbhub.h.

    +

    Definition at line 113 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATUS_ALL_MAIN

    +
    @@ -1264,11 +1384,13 @@ Functions
    -

    Definition at line 116 of file usbhub.h.

    +

    Definition at line 116 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATE_CHECK_DISABLED

    +
    @@ -1278,11 +1400,13 @@ Functions
    -

    Definition at line 119 of file usbhub.h.

    +

    Definition at line 119 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_STATE_DISABLED

    +
    @@ -1292,11 +1416,13 @@ Functions
    -

    Definition at line 122 of file usbhub.h.

    +

    Definition at line 122 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_EVENT_CONNECT

    +
    @@ -1306,11 +1432,13 @@ Functions
    -

    Definition at line 125 of file usbhub.h.

    +

    Definition at line 125 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_EVENT_DISCONNECT

    +
    @@ -1320,11 +1448,13 @@ Functions
    -

    Definition at line 126 of file usbhub.h.

    +

    Definition at line 126 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_EVENT_RESET_COMPLETE

    +
    @@ -1334,11 +1464,13 @@ Functions
    -

    Definition at line 127 of file usbhub.h.

    +

    Definition at line 127 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_EVENT_LS_CONNECT

    +
    @@ -1348,11 +1480,13 @@ Functions
    -

    Definition at line 129 of file usbhub.h.

    +

    Definition at line 129 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_EVENT_LS_RESET_COMPLETE

    +
    @@ -1362,11 +1496,13 @@ Functions
    -

    Definition at line 130 of file usbhub.h.

    +

    Definition at line 130 of file usbhub.h.

    - + +

    ◆ bmHUB_PORT_EVENT_LS_PORT_ENABLED

    +
    @@ -1376,12 +1512,14 @@ Functions
    -

    Definition at line 131 of file usbhub.h.

    +

    Definition at line 131 of file usbhub.h.

    Function Documentation

    - + +

    ◆ PrintHubPortStatus()

    +
    @@ -1424,7 +1562,7 @@ Functions diff --git a/usbhub_8h__dep__incl.md5 b/usbhub_8h__dep__incl.md5 index f8e4934f..2a0ab857 100644 --- a/usbhub_8h__dep__incl.md5 +++ b/usbhub_8h__dep__incl.md5 @@ -1 +1 @@ -600ba6d376b8fce703e559892c09ebf2 \ No newline at end of file +012c31d1c58937812de7c26d123497db \ No newline at end of file diff --git a/usbhub_8h__dep__incl.png b/usbhub_8h__dep__incl.png index b2b290ca..921dd1df 100644 Binary files a/usbhub_8h__dep__incl.png and b/usbhub_8h__dep__incl.png differ diff --git a/usbhub_8h__incl.md5 b/usbhub_8h__incl.md5 index 2966a465..322c5e47 100644 --- a/usbhub_8h__incl.md5 +++ b/usbhub_8h__incl.md5 @@ -1 +1 @@ -dd1f2b59c87dcda8d5477cdc57930370 \ No newline at end of file +3f1c8341825566abbe941b0f1facccff \ No newline at end of file diff --git a/usbhub_8h__incl.png b/usbhub_8h__incl.png index b289ee9c..20f26f7d 100644 Binary files a/usbhub_8h__incl.png and b/usbhub_8h__incl.png differ diff --git a/usbhub_8h_source.html b/usbhub_8h_source.html index b0f02ed8..6cbf6cf5 100644 --- a/usbhub_8h_source.html +++ b/usbhub_8h_source.html @@ -3,7 +3,8 @@ - + +USB Host Shield 2.0: usbhub.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    usbhub.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 #if !defined(__USBHUB_H__)
    18 #define __USBHUB_H__
    19 
    20 #include "Usb.h"
    21 
    22 #define USB_DESCRIPTOR_HUB 0x09 // Hub descriptor type
    23 
    24 // Hub Requests
    25 #define bmREQ_CLEAR_HUB_FEATURE USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    26 #define bmREQ_CLEAR_PORT_FEATURE USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    27 #define bmREQ_CLEAR_TT_BUFFER USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    28 #define bmREQ_GET_HUB_DESCRIPTOR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    29 #define bmREQ_GET_HUB_STATUS USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    30 #define bmREQ_GET_PORT_STATUS USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    31 #define bmREQ_RESET_TT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    32 #define bmREQ_SET_HUB_DESCRIPTOR USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    33 #define bmREQ_SET_HUB_FEATURE USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    34 #define bmREQ_SET_PORT_FEATURE USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    35 #define bmREQ_GET_TT_STATE USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    36 #define bmREQ_STOP_TT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    37 
    38 // Hub Class Requests
    39 #define HUB_REQUEST_CLEAR_TT_BUFFER 8
    40 #define HUB_REQUEST_RESET_TT 9
    41 #define HUB_REQUEST_GET_TT_STATE 10
    42 #define HUB_REQUEST_STOP_TT 11
    43 
    44 // Hub Features
    45 #define HUB_FEATURE_C_HUB_LOCAL_POWER 0
    46 #define HUB_FEATURE_C_HUB_OVER_CURRENT 1
    47 #define HUB_FEATURE_PORT_CONNECTION 0
    48 #define HUB_FEATURE_PORT_ENABLE 1
    49 #define HUB_FEATURE_PORT_SUSPEND 2
    50 #define HUB_FEATURE_PORT_OVER_CURRENT 3
    51 #define HUB_FEATURE_PORT_RESET 4
    52 #define HUB_FEATURE_PORT_POWER 8
    53 #define HUB_FEATURE_PORT_LOW_SPEED 9
    54 #define HUB_FEATURE_C_PORT_CONNECTION 16
    55 #define HUB_FEATURE_C_PORT_ENABLE 17
    56 #define HUB_FEATURE_C_PORT_SUSPEND 18
    57 #define HUB_FEATURE_C_PORT_OVER_CURRENT 19
    58 #define HUB_FEATURE_C_PORT_RESET 20
    59 #define HUB_FEATURE_PORT_TEST 21
    60 #define HUB_FEATURE_PORT_INDICATOR 22
    61 
    62 // Hub Port Test Modes
    63 #define HUB_PORT_TEST_MODE_J 1
    64 #define HUB_PORT_TEST_MODE_K 2
    65 #define HUB_PORT_TEST_MODE_SE0_NAK 3
    66 #define HUB_PORT_TEST_MODE_PACKET 4
    67 #define HUB_PORT_TEST_MODE_FORCE_ENABLE 5
    68 
    69 // Hub Port Indicator Color
    70 #define HUB_PORT_INDICATOR_AUTO 0
    71 #define HUB_PORT_INDICATOR_AMBER 1
    72 #define HUB_PORT_INDICATOR_GREEN 2
    73 #define HUB_PORT_INDICATOR_OFF 3
    74 
    75 // Hub Port Status Bitmasks
    76 #define bmHUB_PORT_STATUS_PORT_CONNECTION 0x0001
    77 #define bmHUB_PORT_STATUS_PORT_ENABLE 0x0002
    78 #define bmHUB_PORT_STATUS_PORT_SUSPEND 0x0004
    79 #define bmHUB_PORT_STATUS_PORT_OVER_CURRENT 0x0008
    80 #define bmHUB_PORT_STATUS_PORT_RESET 0x0010
    81 #define bmHUB_PORT_STATUS_PORT_POWER 0x0100
    82 #define bmHUB_PORT_STATUS_PORT_LOW_SPEED 0x0200
    83 #define bmHUB_PORT_STATUS_PORT_HIGH_SPEED 0x0400
    84 #define bmHUB_PORT_STATUS_PORT_TEST 0x0800
    85 #define bmHUB_PORT_STATUS_PORT_INDICATOR 0x1000
    86 
    87 // Hub Port Status Change Bitmasks (used one byte instead of two)
    88 #define bmHUB_PORT_STATUS_C_PORT_CONNECTION 0x0001
    89 #define bmHUB_PORT_STATUS_C_PORT_ENABLE 0x0002
    90 #define bmHUB_PORT_STATUS_C_PORT_SUSPEND 0x0004
    91 #define bmHUB_PORT_STATUS_C_PORT_OVER_CURRENT 0x0008
    92 #define bmHUB_PORT_STATUS_C_PORT_RESET 0x0010
    93 
    94 // Hub Status Bitmasks (used one byte instead of two)
    95 #define bmHUB_STATUS_LOCAL_POWER_SOURCE 0x01
    96 #define bmHUB_STATUS_OVER_CURRENT 0x12
    97 
    98 // Hub Status Change Bitmasks (used one byte instead of two)
    99 #define bmHUB_STATUS_C_LOCAL_POWER_SOURCE 0x01
    100 #define bmHUB_STATUS_C_OVER_CURRENT 0x12
    101 
    102 
    103 // Hub Port Configuring Substates
    104 #define USB_STATE_HUB_PORT_CONFIGURING 0xb0
    105 #define USB_STATE_HUB_PORT_POWERED_OFF 0xb1
    106 #define USB_STATE_HUB_PORT_WAIT_FOR_POWER_GOOD 0xb2
    107 #define USB_STATE_HUB_PORT_DISCONNECTED 0xb3
    108 #define USB_STATE_HUB_PORT_DISABLED 0xb4
    109 #define USB_STATE_HUB_PORT_RESETTING 0xb5
    110 #define USB_STATE_HUB_PORT_ENABLED 0xb6
    111 
    112 // Additional Error Codes
    113 #define HUB_ERROR_PORT_HAS_BEEN_RESET 0xb1
    114 
    115 // The bit mask to check for all necessary state bits
    116 #define bmHUB_PORT_STATUS_ALL_MAIN ((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION | bmHUB_PORT_STATUS_C_PORT_ENABLE | bmHUB_PORT_STATUS_C_PORT_SUSPEND | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_SUSPEND)
    117 
    118 // Bit mask to check for DISABLED state in HubEvent::bmStatus field
    119 #define bmHUB_PORT_STATE_CHECK_DISABLED (0x0000 | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_SUSPEND)
    120 
    121 // Hub Port States
    122 #define bmHUB_PORT_STATE_DISABLED (0x0000 | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION)
    123 
    124 // Hub Port Events
    125 #define bmHUB_PORT_EVENT_CONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION)
    126 #define bmHUB_PORT_EVENT_DISCONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER)
    127 #define bmHUB_PORT_EVENT_RESET_COMPLETE (((0UL | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION)
    128 
    129 #define bmHUB_PORT_EVENT_LS_CONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
    130 #define bmHUB_PORT_EVENT_LS_RESET_COMPLETE (((0UL | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
    131 #define bmHUB_PORT_EVENT_LS_PORT_ENABLED (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION | bmHUB_PORT_STATUS_C_PORT_ENABLE) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
    132 
    134  uint8_t bDescLength; // descriptor length
    135  uint8_t bDescriptorType; // descriptor type
    136  uint8_t bNbrPorts; // number of ports a hub equiped with
    137 
    138  struct {
    139  uint16_t LogPwrSwitchMode : 2;
    140  uint16_t CompoundDevice : 1;
    142  uint16_t TTThinkTime : 2;
    144  uint16_t Reserved : 8;
    145  } __attribute__((packed));
    146 
    147  uint8_t bPwrOn2PwrGood;
    149 } __attribute__((packed));
    150 
    151 struct HubEvent {
    152 
    153  union {
    154 
    155  struct {
    156  uint16_t bmStatus; // port status bits
    157  uint16_t bmChange; // port status change bits
    158  } __attribute__((packed));
    159  uint32_t bmEvent;
    160  uint8_t evtBuff[4];
    161  };
    162 } __attribute__((packed));
    163 
    165  static bool bResetInitiated; // True when reset is triggered
    166 
    167  USB *pUsb; // USB class instance pointer
    168 
    169  EpInfo epInfo[2]; // interrupt endpoint info structure
    170 
    171  uint8_t bAddress; // address
    172  uint8_t bNbrPorts; // number of ports
    173  // uint8_t bInitState; // initialization state variable
    174  uint32_t qNextPollTime; // next poll time
    175  bool bPollEnable; // poll enable flag
    176 
    177  uint8_t CheckHubStatus();
    178  uint8_t PortStatusChange(uint8_t port, HubEvent &evt);
    179 
    180 public:
    181  USBHub(USB *p);
    182 
    183  uint8_t ClearHubFeature(uint8_t fid);
    184  uint8_t ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel = 0);
    185  uint8_t GetHubDescriptor(uint8_t index, uint16_t nbytes, uint8_t *dataptr);
    186  uint8_t GetHubStatus(uint16_t nbytes, uint8_t* dataptr);
    187  uint8_t GetPortStatus(uint8_t port, uint16_t nbytes, uint8_t* dataptr);
    188  uint8_t SetHubDescriptor(uint8_t port, uint16_t nbytes, uint8_t* dataptr);
    189  uint8_t SetHubFeature(uint8_t fid);
    190  uint8_t SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel = 0);
    191 
    192  void PrintHubStatus();
    193 
    194  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
    195  uint8_t Release();
    196  uint8_t Poll();
    197  void ResetHubPort(uint8_t port);
    198 
    199  virtual uint8_t GetAddress() {
    200  return bAddress;
    201  };
    202 
    203  virtual bool DEVCLASSOK(uint8_t klass) {
    204  return (klass == 0x09);
    205  }
    206 
    207 };
    208 
    209 // Clear Hub Feature
    210 
    211 inline uint8_t USBHub::ClearHubFeature(uint8_t fid) {
    212  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CLEAR_HUB_FEATURE, USB_REQUEST_CLEAR_FEATURE, fid, 0, 0, 0, 0, NULL, NULL));
    213 }
    214 // Clear Port Feature
    215 
    216 inline uint8_t USBHub::ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel) {
    217  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CLEAR_PORT_FEATURE, USB_REQUEST_CLEAR_FEATURE, fid, 0, ((0x0000 | port) | (sel << 8)), 0, 0, NULL, NULL));
    218 }
    219 // Get Hub Descriptor
    220 
    221 inline uint8_t USBHub::GetHubDescriptor(uint8_t index, uint16_t nbytes, uint8_t *dataptr) {
    222  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_GET_HUB_DESCRIPTOR, USB_REQUEST_GET_DESCRIPTOR, index, 0x29, 0, nbytes, nbytes, dataptr, NULL));
    223 }
    224 // Get Hub Status
    225 
    226 inline uint8_t USBHub::GetHubStatus(uint16_t nbytes, uint8_t* dataptr) {
    227  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_GET_HUB_STATUS, USB_REQUEST_GET_STATUS, 0, 0, 0x0000, nbytes, nbytes, dataptr, NULL));
    228 }
    229 // Get Port Status
    230 
    231 inline uint8_t USBHub::GetPortStatus(uint8_t port, uint16_t nbytes, uint8_t* dataptr) {
    232  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_GET_PORT_STATUS, USB_REQUEST_GET_STATUS, 0, 0, port, nbytes, nbytes, dataptr, NULL));
    233 }
    234 // Set Hub Descriptor
    235 
    236 inline uint8_t USBHub::SetHubDescriptor(uint8_t port, uint16_t nbytes, uint8_t* dataptr) {
    237  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_SET_HUB_DESCRIPTOR, USB_REQUEST_SET_DESCRIPTOR, 0, 0, port, nbytes, nbytes, dataptr, NULL));
    238 }
    239 // Set Hub Feature
    240 
    241 inline uint8_t USBHub::SetHubFeature(uint8_t fid) {
    242  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_SET_HUB_FEATURE, USB_REQUEST_SET_FEATURE, fid, 0, 0, 0, 0, NULL, NULL));
    243 }
    244 // Set Port Feature
    245 
    246 inline uint8_t USBHub::SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel) {
    247  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_SET_PORT_FEATURE, USB_REQUEST_SET_FEATURE, fid, 0, (((0x0000 | sel) << 8) | port), 0, 0, NULL, NULL));
    248 }
    249 
    250 void PrintHubPortStatus(USB *usbptr, uint8_t addr, uint8_t port, bool print_changes = false);
    251 
    252 #endif // __USBHUB_H__
    #define USB_REQUEST_SET_DESCRIPTOR
    Definition: usb_ch9.h:38
    +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 #if !defined(__USBHUB_H__)
    18 #define __USBHUB_H__
    19 
    20 #include "Usb.h"
    21 
    22 #define USB_DESCRIPTOR_HUB 0x09 // Hub descriptor type
    23 
    24 // Hub Requests
    25 #define bmREQ_CLEAR_HUB_FEATURE USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    26 #define bmREQ_CLEAR_PORT_FEATURE USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    27 #define bmREQ_CLEAR_TT_BUFFER USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    28 #define bmREQ_GET_HUB_DESCRIPTOR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    29 #define bmREQ_GET_HUB_STATUS USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    30 #define bmREQ_GET_PORT_STATUS USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    31 #define bmREQ_RESET_TT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    32 #define bmREQ_SET_HUB_DESCRIPTOR USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    33 #define bmREQ_SET_HUB_FEATURE USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_DEVICE
    34 #define bmREQ_SET_PORT_FEATURE USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    35 #define bmREQ_GET_TT_STATE USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    36 #define bmREQ_STOP_TT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_OTHER
    37 
    38 // Hub Class Requests
    39 #define HUB_REQUEST_CLEAR_TT_BUFFER 8
    40 #define HUB_REQUEST_RESET_TT 9
    41 #define HUB_REQUEST_GET_TT_STATE 10
    42 #define HUB_REQUEST_STOP_TT 11
    43 
    44 // Hub Features
    45 #define HUB_FEATURE_C_HUB_LOCAL_POWER 0
    46 #define HUB_FEATURE_C_HUB_OVER_CURRENT 1
    47 #define HUB_FEATURE_PORT_CONNECTION 0
    48 #define HUB_FEATURE_PORT_ENABLE 1
    49 #define HUB_FEATURE_PORT_SUSPEND 2
    50 #define HUB_FEATURE_PORT_OVER_CURRENT 3
    51 #define HUB_FEATURE_PORT_RESET 4
    52 #define HUB_FEATURE_PORT_POWER 8
    53 #define HUB_FEATURE_PORT_LOW_SPEED 9
    54 #define HUB_FEATURE_C_PORT_CONNECTION 16
    55 #define HUB_FEATURE_C_PORT_ENABLE 17
    56 #define HUB_FEATURE_C_PORT_SUSPEND 18
    57 #define HUB_FEATURE_C_PORT_OVER_CURRENT 19
    58 #define HUB_FEATURE_C_PORT_RESET 20
    59 #define HUB_FEATURE_PORT_TEST 21
    60 #define HUB_FEATURE_PORT_INDICATOR 22
    61 
    62 // Hub Port Test Modes
    63 #define HUB_PORT_TEST_MODE_J 1
    64 #define HUB_PORT_TEST_MODE_K 2
    65 #define HUB_PORT_TEST_MODE_SE0_NAK 3
    66 #define HUB_PORT_TEST_MODE_PACKET 4
    67 #define HUB_PORT_TEST_MODE_FORCE_ENABLE 5
    68 
    69 // Hub Port Indicator Color
    70 #define HUB_PORT_INDICATOR_AUTO 0
    71 #define HUB_PORT_INDICATOR_AMBER 1
    72 #define HUB_PORT_INDICATOR_GREEN 2
    73 #define HUB_PORT_INDICATOR_OFF 3
    74 
    75 // Hub Port Status Bitmasks
    76 #define bmHUB_PORT_STATUS_PORT_CONNECTION 0x0001
    77 #define bmHUB_PORT_STATUS_PORT_ENABLE 0x0002
    78 #define bmHUB_PORT_STATUS_PORT_SUSPEND 0x0004
    79 #define bmHUB_PORT_STATUS_PORT_OVER_CURRENT 0x0008
    80 #define bmHUB_PORT_STATUS_PORT_RESET 0x0010
    81 #define bmHUB_PORT_STATUS_PORT_POWER 0x0100
    82 #define bmHUB_PORT_STATUS_PORT_LOW_SPEED 0x0200
    83 #define bmHUB_PORT_STATUS_PORT_HIGH_SPEED 0x0400
    84 #define bmHUB_PORT_STATUS_PORT_TEST 0x0800
    85 #define bmHUB_PORT_STATUS_PORT_INDICATOR 0x1000
    86 
    87 // Hub Port Status Change Bitmasks (used one byte instead of two)
    88 #define bmHUB_PORT_STATUS_C_PORT_CONNECTION 0x0001
    89 #define bmHUB_PORT_STATUS_C_PORT_ENABLE 0x0002
    90 #define bmHUB_PORT_STATUS_C_PORT_SUSPEND 0x0004
    91 #define bmHUB_PORT_STATUS_C_PORT_OVER_CURRENT 0x0008
    92 #define bmHUB_PORT_STATUS_C_PORT_RESET 0x0010
    93 
    94 // Hub Status Bitmasks (used one byte instead of two)
    95 #define bmHUB_STATUS_LOCAL_POWER_SOURCE 0x01
    96 #define bmHUB_STATUS_OVER_CURRENT 0x12
    97 
    98 // Hub Status Change Bitmasks (used one byte instead of two)
    99 #define bmHUB_STATUS_C_LOCAL_POWER_SOURCE 0x01
    100 #define bmHUB_STATUS_C_OVER_CURRENT 0x12
    101 
    102 
    103 // Hub Port Configuring Substates
    104 #define USB_STATE_HUB_PORT_CONFIGURING 0xb0
    105 #define USB_STATE_HUB_PORT_POWERED_OFF 0xb1
    106 #define USB_STATE_HUB_PORT_WAIT_FOR_POWER_GOOD 0xb2
    107 #define USB_STATE_HUB_PORT_DISCONNECTED 0xb3
    108 #define USB_STATE_HUB_PORT_DISABLED 0xb4
    109 #define USB_STATE_HUB_PORT_RESETTING 0xb5
    110 #define USB_STATE_HUB_PORT_ENABLED 0xb6
    111 
    112 // Additional Error Codes
    113 #define HUB_ERROR_PORT_HAS_BEEN_RESET 0xb1
    114 
    115 // The bit mask to check for all necessary state bits
    116 #define bmHUB_PORT_STATUS_ALL_MAIN ((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION | bmHUB_PORT_STATUS_C_PORT_ENABLE | bmHUB_PORT_STATUS_C_PORT_SUSPEND | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_SUSPEND)
    117 
    118 // Bit mask to check for DISABLED state in HubEvent::bmStatus field
    119 #define bmHUB_PORT_STATE_CHECK_DISABLED (0x0000 | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_SUSPEND)
    120 
    121 // Hub Port States
    122 #define bmHUB_PORT_STATE_DISABLED (0x0000 | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION)
    123 
    124 // Hub Port Events
    125 #define bmHUB_PORT_EVENT_CONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION)
    126 #define bmHUB_PORT_EVENT_DISCONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER)
    127 #define bmHUB_PORT_EVENT_RESET_COMPLETE (((0UL | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION)
    128 
    129 #define bmHUB_PORT_EVENT_LS_CONNECT (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
    130 #define bmHUB_PORT_EVENT_LS_RESET_COMPLETE (((0UL | bmHUB_PORT_STATUS_C_PORT_RESET) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
    131 #define bmHUB_PORT_EVENT_LS_PORT_ENABLED (((0UL | bmHUB_PORT_STATUS_C_PORT_CONNECTION | bmHUB_PORT_STATUS_C_PORT_ENABLE) << 16) | bmHUB_PORT_STATUS_PORT_POWER | bmHUB_PORT_STATUS_PORT_ENABLE | bmHUB_PORT_STATUS_PORT_CONNECTION | bmHUB_PORT_STATUS_PORT_LOW_SPEED)
    132 
    134  uint8_t bDescLength; // descriptor length
    135  uint8_t bDescriptorType; // descriptor type
    136  uint8_t bNbrPorts; // number of ports a hub equiped with
    137 
    138  struct {
    139  uint16_t LogPwrSwitchMode : 2;
    140  uint16_t CompoundDevice : 1;
    142  uint16_t TTThinkTime : 2;
    144  uint16_t Reserved : 8;
    145  } __attribute__((packed));
    146 
    147  uint8_t bPwrOn2PwrGood;
    149 } __attribute__((packed));
    150 
    151 struct HubEvent {
    152 
    153  union {
    154 
    155  struct {
    156  uint16_t bmStatus; // port status bits
    157  uint16_t bmChange; // port status change bits
    158  } __attribute__((packed));
    159  uint32_t bmEvent;
    160  uint8_t evtBuff[4];
    161  };
    162 } __attribute__((packed));
    163 
    165  static bool bResetInitiated; // True when reset is triggered
    166 
    167  USB *pUsb; // USB class instance pointer
    168 
    169  EpInfo epInfo[2]; // interrupt endpoint info structure
    170 
    171  uint8_t bAddress; // address
    172  uint8_t bNbrPorts; // number of ports
    173  // uint8_t bInitState; // initialization state variable
    174  uint32_t qNextPollTime; // next poll time
    175  bool bPollEnable; // poll enable flag
    176 
    177  uint8_t CheckHubStatus();
    178  uint8_t PortStatusChange(uint8_t port, HubEvent &evt);
    179 
    180 public:
    181  USBHub(USB *p);
    182 
    183  uint8_t ClearHubFeature(uint8_t fid);
    184  uint8_t ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel = 0);
    185  uint8_t GetHubDescriptor(uint8_t index, uint16_t nbytes, uint8_t *dataptr);
    186  uint8_t GetHubStatus(uint16_t nbytes, uint8_t* dataptr);
    187  uint8_t GetPortStatus(uint8_t port, uint16_t nbytes, uint8_t* dataptr);
    188  uint8_t SetHubDescriptor(uint8_t port, uint16_t nbytes, uint8_t* dataptr);
    189  uint8_t SetHubFeature(uint8_t fid);
    190  uint8_t SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel = 0);
    191 
    192  void PrintHubStatus();
    193 
    194  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
    195  uint8_t Release();
    196  uint8_t Poll();
    197  void ResetHubPort(uint8_t port);
    198 
    199  virtual uint8_t GetAddress() {
    200  return bAddress;
    201  };
    202 
    203  virtual bool DEVCLASSOK(uint8_t klass) {
    204  return (klass == 0x09);
    205  }
    206 
    207 };
    208 
    209 // Clear Hub Feature
    210 
    211 inline uint8_t USBHub::ClearHubFeature(uint8_t fid) {
    212  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CLEAR_HUB_FEATURE, USB_REQUEST_CLEAR_FEATURE, fid, 0, 0, 0, 0, NULL, NULL));
    213 }
    214 // Clear Port Feature
    215 
    216 inline uint8_t USBHub::ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel) {
    217  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CLEAR_PORT_FEATURE, USB_REQUEST_CLEAR_FEATURE, fid, 0, ((0x0000 | port) | (sel << 8)), 0, 0, NULL, NULL));
    218 }
    219 // Get Hub Descriptor
    220 
    221 inline uint8_t USBHub::GetHubDescriptor(uint8_t index, uint16_t nbytes, uint8_t *dataptr) {
    222  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_GET_HUB_DESCRIPTOR, USB_REQUEST_GET_DESCRIPTOR, index, 0x29, 0, nbytes, nbytes, dataptr, NULL));
    223 }
    224 // Get Hub Status
    225 
    226 inline uint8_t USBHub::GetHubStatus(uint16_t nbytes, uint8_t* dataptr) {
    227  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_GET_HUB_STATUS, USB_REQUEST_GET_STATUS, 0, 0, 0x0000, nbytes, nbytes, dataptr, NULL));
    228 }
    229 // Get Port Status
    230 
    231 inline uint8_t USBHub::GetPortStatus(uint8_t port, uint16_t nbytes, uint8_t* dataptr) {
    232  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_GET_PORT_STATUS, USB_REQUEST_GET_STATUS, 0, 0, port, nbytes, nbytes, dataptr, NULL));
    233 }
    234 // Set Hub Descriptor
    235 
    236 inline uint8_t USBHub::SetHubDescriptor(uint8_t port, uint16_t nbytes, uint8_t* dataptr) {
    237  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_SET_HUB_DESCRIPTOR, USB_REQUEST_SET_DESCRIPTOR, 0, 0, port, nbytes, nbytes, dataptr, NULL));
    238 }
    239 // Set Hub Feature
    240 
    241 inline uint8_t USBHub::SetHubFeature(uint8_t fid) {
    242  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_SET_HUB_FEATURE, USB_REQUEST_SET_FEATURE, fid, 0, 0, 0, 0, NULL, NULL));
    243 }
    244 // Set Port Feature
    245 
    246 inline uint8_t USBHub::SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel) {
    247  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_SET_PORT_FEATURE, USB_REQUEST_SET_FEATURE, fid, 0, (((0x0000 | sel) << 8) | port), 0, 0, NULL, NULL));
    248 }
    249 
    250 void PrintHubPortStatus(USB *usbptr, uint8_t addr, uint8_t port, bool print_changes = false);
    251 
    252 #endif // __USBHUB_H__
    #define USB_REQUEST_SET_DESCRIPTOR
    Definition: usb_ch9.h:45
    uint16_t bmChange
    Definition: usbhub.h:157
    uint8_t bDescLength
    Definition: usbhub.h:134
    uint8_t bPwrOn2PwrGood
    Definition: usbhub.h:147
    uint8_t SetHubDescriptor(uint8_t port, uint16_t nbytes, uint8_t *dataptr)
    Definition: usbhub.h:236
    -
    #define USB_REQUEST_CLEAR_FEATURE
    Definition: usb_ch9.h:34
    -
    #define USB_REQUEST_GET_DESCRIPTOR
    Definition: usb_ch9.h:37
    +
    #define USB_REQUEST_CLEAR_FEATURE
    Definition: usb_ch9.h:41
    +
    #define USB_REQUEST_GET_DESCRIPTOR
    Definition: usb_ch9.h:44
    virtual bool DEVCLASSOK(uint8_t klass)
    Definition: usbhub.h:203
    +
    void ResetHubPort(uint8_t port)
    Definition: usbhub.cpp:309
    uint16_t OverCurrentProtectMode
    Definition: usbhub.h:141
    - +
    #define bmREQ_GET_HUB_DESCRIPTOR
    Definition: usbhub.h:28
    uint8_t GetHubStatus(uint16_t nbytes, uint8_t *dataptr)
    Definition: usbhub.h:226
    #define bmREQ_GET_HUB_STATUS
    Definition: usbhub.h:29
    +
    uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
    Definition: Usb.cpp:133
    uint8_t bNbrPorts
    Definition: usbhub.h:136
    uint8_t ClearHubFeature(uint8_t fid)
    Definition: usbhub.h:211
    void PrintHubPortStatus(USB *usbptr, uint8_t addr, uint8_t port, bool print_changes=false)
    uint8_t GetHubDescriptor(uint8_t index, uint16_t nbytes, uint8_t *dataptr)
    Definition: usbhub.h:221
    -
    Definition: address.h:32
    -
    #define USB_REQUEST_GET_STATUS
    Definition: usb_ch9.h:33
    +
    Definition: address.h:39
    +
    #define USB_REQUEST_GET_STATUS
    Definition: usb_ch9.h:40
    uint8_t ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel=0)
    Definition: usbhub.h:216
    -
    #define USB_REQUEST_SET_FEATURE
    Definition: usb_ch9.h:35
    +
    #define USB_REQUEST_SET_FEATURE
    Definition: usb_ch9.h:42
    #define bmREQ_CLEAR_PORT_FEATURE
    Definition: usbhub.h:26
    virtual uint8_t GetAddress()
    Definition: usbhub.h:199
    uint32_t bmEvent
    Definition: usbhub.h:159
    uint8_t bDescriptorType
    Definition: usbhub.h:135
    uint16_t PortIndicatorsSupported
    Definition: usbhub.h:143
    +
    uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
    Definition: usbhub.cpp:44
    Definition: usbhub.h:164
    uint16_t bmStatus
    Definition: usbhub.h:156
    #define bmREQ_SET_HUB_DESCRIPTOR
    Definition: usbhub.h:32
    @@ -129,18 +112,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    uint16_t Reserved
    Definition: usbhub.h:144
    uint8_t GetPortStatus(uint8_t port, uint16_t nbytes, uint8_t *dataptr)
    Definition: usbhub.h:231
    uint16_t TTThinkTime
    Definition: usbhub.h:142
    -
    Definition: UsbCore.h:197
    +
    uint8_t Release()
    Definition: usbhub.cpp:216
    +
    Definition: UsbCore.h:208
    +
    uint8_t evtBuff[4]
    Definition: usbhub.h:160
    uint16_t CompoundDevice
    Definition: usbhub.h:140
    uint16_t LogPwrSwitchMode
    Definition: usbhub.h:139
    #define bmREQ_CLEAR_HUB_FEATURE
    Definition: usbhub.h:25
    +
    void PrintHubStatus()
    #define bmREQ_GET_PORT_STATUS
    Definition: usbhub.h:30
    uint8_t SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel=0)
    Definition: usbhub.h:246
    +
    uint8_t Poll()
    Definition: usbhub.cpp:229
    +
    USBHub(USB *p)
    Definition: usbhub.cpp:21
    diff --git a/version__helper_8h.html b/version__helper_8h.html index e90713d3..c6f5d88e 100644 --- a/version__helper_8h.html +++ b/version__helper_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: version_helper.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    + +
    This graph shows which files directly or indirectly include this file:
    @@ -214,7 +196,9 @@ Macros  

    Macro Definition Documentation

    - + +

    ◆ __PGMSPACE_H_

    +
    @@ -224,11 +208,13 @@ Macros
    -

    Definition at line 36 of file version_helper.h.

    +

    Definition at line 43 of file version_helper.h.

    - + +

    ◆ PGM_P

    +
    @@ -238,11 +224,13 @@ Macros
    -

    Definition at line 44 of file version_helper.h.

    +

    Definition at line 51 of file version_helper.h.

    - + +

    ◆ PSTR

    +
    @@ -256,11 +244,13 @@ Macros
    -

    Definition at line 47 of file version_helper.h.

    +

    Definition at line 54 of file version_helper.h.

    - + +

    ◆ F

    +
    @@ -274,11 +264,13 @@ Macros
    -

    Definition at line 50 of file version_helper.h.

    +

    Definition at line 57 of file version_helper.h.

    - + +

    ◆ _SFR_BYTE

    +
    @@ -292,11 +284,13 @@ Macros
    -

    Definition at line 53 of file version_helper.h.

    +

    Definition at line 60 of file version_helper.h.

    - + +

    ◆ memchr_P

    +
    @@ -326,11 +320,13 @@ Macros
    -

    Definition at line 57 of file version_helper.h.

    +

    Definition at line 64 of file version_helper.h.

    - + +

    ◆ memcmp_P

    +
    @@ -360,11 +356,13 @@ Macros
    -

    Definition at line 60 of file version_helper.h.

    +

    Definition at line 67 of file version_helper.h.

    - + +

    ◆ memcpy_P

    +
    @@ -394,11 +392,13 @@ Macros
    -

    Definition at line 63 of file version_helper.h.

    +

    Definition at line 70 of file version_helper.h.

    - + +

    ◆ memmem_P

    +
    @@ -434,11 +434,13 @@ Macros
    -

    Definition at line 66 of file version_helper.h.

    +

    Definition at line 73 of file version_helper.h.

    - + +

    ◆ memrchr_P

    +
    @@ -468,11 +470,13 @@ Macros
    -

    Definition at line 69 of file version_helper.h.

    +

    Definition at line 76 of file version_helper.h.

    - + +

    ◆ strcat_P

    +
    @@ -496,11 +500,13 @@ Macros
    -

    Definition at line 72 of file version_helper.h.

    +

    Definition at line 79 of file version_helper.h.

    - + +

    ◆ strchr_P

    +
    @@ -524,11 +530,13 @@ Macros
    -

    Definition at line 75 of file version_helper.h.

    +

    Definition at line 82 of file version_helper.h.

    - + +

    ◆ strchrnul_P

    +
    @@ -552,11 +560,13 @@ Macros
    -

    Definition at line 78 of file version_helper.h.

    +

    Definition at line 85 of file version_helper.h.

    - + +

    ◆ strcmp_P

    +
    @@ -580,11 +590,13 @@ Macros
    -

    Definition at line 81 of file version_helper.h.

    +

    Definition at line 88 of file version_helper.h.

    - + +

    ◆ strcpy_P

    +
    @@ -608,11 +620,13 @@ Macros
    -

    Definition at line 84 of file version_helper.h.

    +

    Definition at line 91 of file version_helper.h.

    - + +

    ◆ strcasecmp_P

    +
    @@ -636,11 +650,13 @@ Macros
    -

    Definition at line 87 of file version_helper.h.

    +

    Definition at line 94 of file version_helper.h.

    - + +

    ◆ strcasestr_P

    +
    @@ -664,11 +680,13 @@ Macros
    -

    Definition at line 90 of file version_helper.h.

    +

    Definition at line 97 of file version_helper.h.

    - + +

    ◆ strlcat_P

    +
    @@ -698,11 +716,13 @@ Macros
    -

    Definition at line 93 of file version_helper.h.

    +

    Definition at line 100 of file version_helper.h.

    - + +

    ◆ strlcpy_P

    +
    @@ -732,11 +752,13 @@ Macros
    -

    Definition at line 96 of file version_helper.h.

    +

    Definition at line 103 of file version_helper.h.

    - + +

    ◆ strlen_P

    +
    @@ -750,11 +772,13 @@ Macros
    -

    Definition at line 99 of file version_helper.h.

    +

    Definition at line 106 of file version_helper.h.

    - + +

    ◆ strnlen_P

    +
    @@ -778,11 +802,13 @@ Macros
    -

    Definition at line 102 of file version_helper.h.

    +

    Definition at line 109 of file version_helper.h.

    - + +

    ◆ strncmp_P

    +
    @@ -812,11 +838,13 @@ Macros
    -

    Definition at line 105 of file version_helper.h.

    +

    Definition at line 112 of file version_helper.h.

    - + +

    ◆ strncasecmp_P

    +
    @@ -846,11 +874,13 @@ Macros
    -

    Definition at line 108 of file version_helper.h.

    +

    Definition at line 115 of file version_helper.h.

    - + +

    ◆ strncat_P

    +
    @@ -880,11 +910,13 @@ Macros
    -

    Definition at line 111 of file version_helper.h.

    +

    Definition at line 118 of file version_helper.h.

    - + +

    ◆ strncpy_P

    +
    @@ -914,11 +946,13 @@ Macros
    -

    Definition at line 114 of file version_helper.h.

    +

    Definition at line 121 of file version_helper.h.

    - + +

    ◆ strpbrk_P

    +
    @@ -942,11 +976,13 @@ Macros
    -

    Definition at line 117 of file version_helper.h.

    +

    Definition at line 124 of file version_helper.h.

    - + +

    ◆ strrchr_P

    +
    @@ -970,11 +1006,13 @@ Macros
    -

    Definition at line 120 of file version_helper.h.

    +

    Definition at line 127 of file version_helper.h.

    - + +

    ◆ strsep_P

    +
    @@ -998,11 +1036,13 @@ Macros
    -

    Definition at line 123 of file version_helper.h.

    +

    Definition at line 130 of file version_helper.h.

    - + +

    ◆ strspn_P

    +
    @@ -1026,11 +1066,13 @@ Macros
    -

    Definition at line 126 of file version_helper.h.

    +

    Definition at line 133 of file version_helper.h.

    - + +

    ◆ strstr_P

    +
    @@ -1054,11 +1096,13 @@ Macros
    -

    Definition at line 129 of file version_helper.h.

    +

    Definition at line 136 of file version_helper.h.

    - + +

    ◆ sprintf_P

    +
    @@ -1082,11 +1126,13 @@ Macros
    -

    Definition at line 132 of file version_helper.h.

    +

    Definition at line 139 of file version_helper.h.

    - + +

    ◆ vfprintf_P

    +
    @@ -1110,11 +1156,13 @@ Macros
    -

    Definition at line 135 of file version_helper.h.

    +

    Definition at line 142 of file version_helper.h.

    - + +

    ◆ printf_P

    +
    @@ -1128,11 +1176,13 @@ Macros
    -

    Definition at line 138 of file version_helper.h.

    +

    Definition at line 145 of file version_helper.h.

    - + +

    ◆ snprintf_P

    +
    @@ -1162,11 +1212,13 @@ Macros
    -

    Definition at line 141 of file version_helper.h.

    +

    Definition at line 148 of file version_helper.h.

    - + +

    ◆ vsprintf_P

    +
    @@ -1190,11 +1242,13 @@ Macros
    -

    Definition at line 144 of file version_helper.h.

    +

    Definition at line 151 of file version_helper.h.

    - + +

    ◆ vsnprintf_P

    +
    @@ -1224,11 +1278,13 @@ Macros
    -

    Definition at line 147 of file version_helper.h.

    +

    Definition at line 154 of file version_helper.h.

    - + +

    ◆ fprintf_P

    +
    @@ -1252,11 +1308,13 @@ Macros
    -

    Definition at line 150 of file version_helper.h.

    +

    Definition at line 157 of file version_helper.h.

    - + +

    ◆ pgm_read_byte

    +
    @@ -1270,11 +1328,13 @@ Macros
    -

    Definition at line 154 of file version_helper.h.

    +

    Definition at line 161 of file version_helper.h.

    - + +

    ◆ pgm_read_word

    +
    @@ -1288,11 +1348,13 @@ Macros
    -

    Definition at line 157 of file version_helper.h.

    +

    Definition at line 164 of file version_helper.h.

    - + +

    ◆ pgm_read_dword

    +
    @@ -1306,11 +1368,13 @@ Macros
    -

    Definition at line 160 of file version_helper.h.

    +

    Definition at line 167 of file version_helper.h.

    - + +

    ◆ pgm_read_float

    +
    @@ -1324,11 +1388,13 @@ Macros
    -

    Definition at line 163 of file version_helper.h.

    +

    Definition at line 170 of file version_helper.h.

    - + +

    ◆ pgm_read_byte_near

    +
    @@ -1342,11 +1408,13 @@ Macros
    -

    Definition at line 167 of file version_helper.h.

    +

    Definition at line 174 of file version_helper.h.

    - + +

    ◆ pgm_read_word_near

    +
    @@ -1360,11 +1428,13 @@ Macros
    -

    Definition at line 170 of file version_helper.h.

    +

    Definition at line 177 of file version_helper.h.

    - + +

    ◆ pgm_read_dword_near

    +
    @@ -1378,11 +1448,13 @@ Macros
    -

    Definition at line 173 of file version_helper.h.

    +

    Definition at line 180 of file version_helper.h.

    - + +

    ◆ pgm_read_float_near

    +
    @@ -1396,11 +1468,13 @@ Macros
    -

    Definition at line 176 of file version_helper.h.

    +

    Definition at line 183 of file version_helper.h.

    - + +

    ◆ pgm_read_byte_far

    +
    @@ -1414,11 +1488,13 @@ Macros
    -

    Definition at line 179 of file version_helper.h.

    +

    Definition at line 186 of file version_helper.h.

    - + +

    ◆ pgm_read_word_far

    +
    @@ -1432,11 +1508,13 @@ Macros
    -

    Definition at line 182 of file version_helper.h.

    +

    Definition at line 189 of file version_helper.h.

    - + +

    ◆ pgm_read_dword_far

    +
    @@ -1450,11 +1528,13 @@ Macros
    -

    Definition at line 185 of file version_helper.h.

    +

    Definition at line 192 of file version_helper.h.

    - + +

    ◆ pgm_read_float_far

    +
    @@ -1468,11 +1548,13 @@ Macros
    -

    Definition at line 188 of file version_helper.h.

    +

    Definition at line 195 of file version_helper.h.

    - + +

    ◆ pgm_read_pointer

    +
    @@ -1482,7 +1564,7 @@ Macros
    -

    Definition at line 192 of file version_helper.h.

    +

    Definition at line 199 of file version_helper.h.

    @@ -1491,7 +1573,7 @@ Macros diff --git a/version__helper_8h__dep__incl.md5 b/version__helper_8h__dep__incl.md5 index f62c3636..4ea8a20e 100644 --- a/version__helper_8h__dep__incl.md5 +++ b/version__helper_8h__dep__incl.md5 @@ -1 +1 @@ -7ffd9ab4c1f44f6844779ea69abf203a \ No newline at end of file +389c8fcd3904e10d4462f8ce6cca758f \ No newline at end of file diff --git a/version__helper_8h__dep__incl.png b/version__helper_8h__dep__incl.png index e5506bb5..62dc871b 100644 Binary files a/version__helper_8h__dep__incl.png and b/version__helper_8h__dep__incl.png differ diff --git a/version__helper_8h__incl.md5 b/version__helper_8h__incl.md5 index 9317a64a..2a5355c2 100644 --- a/version__helper_8h__incl.md5 +++ b/version__helper_8h__incl.md5 @@ -1 +1 @@ -b5906582666204e62305ef43411e2ee1 \ No newline at end of file +523b7a7e0fdba972cbd09d8b55ed6d00 \ No newline at end of file diff --git a/version__helper_8h__incl.png b/version__helper_8h__incl.png index d1b650d8..84d4eb06 100644 Binary files a/version__helper_8h__incl.png and b/version__helper_8h__incl.png differ diff --git a/version__helper_8h_source.html b/version__helper_8h_source.html index c715d7ca..89fd3306 100644 --- a/version__helper_8h_source.html +++ b/version__helper_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: version_helper.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +
    version_helper.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 /*
    19  * Universal Arduino(tm) "IDE" fixups.
    20  * Includes fixes for versions as low as 0023, used by Digilent.
    21  */
    22 
    23 #if defined(ARDUINO) && ARDUINO >=100
    24 #include <Arduino.h>
    25 #else
    26 #include <WProgram.h>
    27 #include <pins_arduino.h>
    28 #ifdef __AVR__
    29 #include <avr/pgmspace.h>
    30 #include <avr/io.h>
    31 #else
    32 #endif
    33 #endif
    34 
    35 #ifndef __PGMSPACE_H_
    36 #define __PGMSPACE_H_ 1
    37 
    38 #include <inttypes.h>
    39 
    40 #ifndef PROGMEM
    41 #define PROGMEM
    42 #endif
    43 #ifndef PGM_P
    44 #define PGM_P const char *
    45 #endif
    46 #ifndef PSTR
    47 #define PSTR(str) (str)
    48 #endif
    49 #ifndef F
    50 #define F(str) (str)
    51 #endif
    52 #ifndef _SFR_BYTE
    53 #define _SFR_BYTE(n) (n)
    54 #endif
    55 
    56 #ifndef memchr_P
    57 #define memchr_P(str, c, len) memchr((str), (c), (len))
    58 #endif
    59 #ifndef memcmp_P
    60 #define memcmp_P(a, b, n) memcmp((a), (b), (n))
    61 #endif
    62 #ifndef memcpy_P
    63 #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
    64 #endif
    65 #ifndef memmem_P
    66 #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
    67 #endif
    68 #ifndef memrchr_P
    69 #define memrchr_P(str, val, len) memrchr((str), (val), (len))
    70 #endif
    71 #ifndef strcat_P
    72 #define strcat_P(dest, src) strcat((dest), (src))
    73 #endif
    74 #ifndef strchr_P
    75 #define strchr_P(str, c) strchr((str), (c))
    76 #endif
    77 #ifndef strchrnul_P
    78 #define strchrnul_P(str, c) strchrnul((str), (c))
    79 #endif
    80 #ifndef strcmp_P
    81 #define strcmp_P(a, b) strcmp((a), (b))
    82 #endif
    83 #ifndef strcpy_P
    84 #define strcpy_P(dest, src) strcpy((dest), (src))
    85 #endif
    86 #ifndef strcasecmp_P
    87 #define strcasecmp_P(a, b) strcasecmp((a), (b))
    88 #endif
    89 #ifndef strcasestr_P
    90 #define strcasestr_P(a, b) strcasestr((a), (b))
    91 #endif
    92 #ifndef strlcat_P
    93 #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
    94 #endif
    95 #ifndef strlcpy_P
    96 #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
    97 #endif
    98 #ifndef strlen_P
    99 #define strlen_P(s) strlen((const char *)(s))
    100 #endif
    101 #ifndef strnlen_P
    102 #define strnlen_P(str, len) strnlen((str), (len))
    103 #endif
    104 #ifndef strncmp_P
    105 #define strncmp_P(a, b, n) strncmp((a), (b), (n))
    106 #endif
    107 #ifndef strncasecmp_P
    108 #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
    109 #endif
    110 #ifndef strncat_P
    111 #define strncat_P(a, b, n) strncat((a), (b), (n))
    112 #endif
    113 #ifndef strncpy_P
    114 #define strncpy_P(a, b, n) strncmp((a), (b), (n))
    115 #endif
    116 #ifndef strpbrk_P
    117 #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
    118 #endif
    119 #ifndef strrchr_P
    120 #define strrchr_P(str, c) strrchr((str), (c))
    121 #endif
    122 #ifndef strsep_P
    123 #define strsep_P(strp, delim) strsep((strp), (delim))
    124 #endif
    125 #ifndef strspn_P
    126 #define strspn_P(str, chrs) strspn((str), (chrs))
    127 #endif
    128 #ifndef strstr_P
    129 #define strstr_P(a, b) strstr((a), (b))
    130 #endif
    131 #ifndef sprintf_P
    132 #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
    133 #endif
    134 #ifndef vfprintf_P
    135 #define vfprintf_P(s, ...) vfprintf((s), __VA_ARGS__)
    136 #endif
    137 #ifndef printf_P
    138 #define printf_P(...) printf(__VA_ARGS__)
    139 #endif
    140 #ifndef snprintf_P
    141 #define snprintf_P(s, n, ...) ((s), (n), __VA_ARGS__)
    142 #endif
    143 #ifndef vsprintf_P
    144 #define vsprintf_P(s, ...) ((s),__VA_ARGS__)
    145 #endif
    146 #ifndef vsnprintf_P
    147 #define vsnprintf_P(s, n, ...) ((s), (n),__VA_ARGS__)
    148 #endif
    149 #ifndef fprintf_P
    150 #define fprintf_P(s, ...) ((s), __VA_ARGS__)
    151 #endif
    152 
    153 #ifndef pgm_read_byte
    154 #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
    155 #endif
    156 #ifndef pgm_read_word
    157 #define pgm_read_word(addr) (*(const unsigned short *)(addr))
    158 #endif
    159 #ifndef pgm_read_dword
    160 #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
    161 #endif
    162 #ifndef pgm_read_float
    163 #define pgm_read_float(addr) (*(const float *)(addr))
    164 #endif
    165 
    166 #ifndef pgm_read_byte_near
    167 #define pgm_read_byte_near(addr) pgm_read_byte(addr)
    168 #endif
    169 #ifndef pgm_read_word_near
    170 #define pgm_read_word_near(addr) pgm_read_word(addr)
    171 #endif
    172 #ifndef pgm_read_dword_near
    173 #define pgm_read_dword_near(addr) pgm_read_dword(addr)
    174 #endif
    175 #ifndef pgm_read_float_near
    176 #define pgm_read_float_near(addr) pgm_read_float(addr)
    177 #endif
    178 #ifndef pgm_read_byte_far
    179 #define pgm_read_byte_far(addr) pgm_read_byte(addr)
    180 #endif
    181 #ifndef pgm_read_word_far
    182 #define pgm_read_word_far(addr) pgm_read_word(addr)
    183 #endif
    184 #ifndef pgm_read_dword_far
    185 #define pgm_read_dword_far(addr) pgm_read_dword(addr)
    186 #endif
    187 #ifndef pgm_read_float_far
    188 #define pgm_read_float_far(addr) pgm_read_float(addr)
    189 #endif
    190 
    191 #ifndef pgm_read_pointer
    192 #define pgm_read_pointer
    193 #endif
    194 #endif
    +Go to the documentation of this file.
    1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
    2 
    3 This program is free software; you can redistribute it and/or modify
    4 it under the terms of the GNU General Public License as published by
    5 the Free Software Foundation; either version 2 of the License, or
    6 (at your option) any later version.
    7 
    8 This program is distributed in the hope that it will be useful,
    9 but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11 GNU General Public License for more details.
    12 
    13 You should have received a copy of the GNU General Public License
    14 along with this program; if not, write to the Free Software
    15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    16 
    17 Contact information
    18 -------------------
    19 
    20 Circuits At Home, LTD
    21 Web : http://www.circuitsathome.com
    22 e-mail : support@circuitsathome.com
    23  */
    24 
    25 /*
    26  * Universal Arduino(tm) "IDE" fixups.
    27  * Includes fixes for versions as low as 0023, used by Digilent.
    28  */
    29 
    30 #if defined(ARDUINO) && ARDUINO >=100
    31 #include <Arduino.h>
    32 #else
    33 #include <WProgram.h>
    34 #include <pins_arduino.h>
    35 #ifdef __AVR__
    36 #include <avr/pgmspace.h>
    37 #include <avr/io.h>
    38 #else
    39 #endif
    40 #endif
    41 
    42 #ifndef __PGMSPACE_H_
    43 #define __PGMSPACE_H_ 1
    44 
    45 #include <inttypes.h>
    46 
    47 #ifndef PROGMEM
    48 #define PROGMEM
    49 #endif
    50 #ifndef PGM_P
    51 #define PGM_P const char *
    52 #endif
    53 #ifndef PSTR
    54 #define PSTR(str) (str)
    55 #endif
    56 #ifndef F
    57 #define F(str) (str)
    58 #endif
    59 #ifndef _SFR_BYTE
    60 #define _SFR_BYTE(n) (n)
    61 #endif
    62 
    63 #ifndef memchr_P
    64 #define memchr_P(str, c, len) memchr((str), (c), (len))
    65 #endif
    66 #ifndef memcmp_P
    67 #define memcmp_P(a, b, n) memcmp((a), (b), (n))
    68 #endif
    69 #ifndef memcpy_P
    70 #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
    71 #endif
    72 #ifndef memmem_P
    73 #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
    74 #endif
    75 #ifndef memrchr_P
    76 #define memrchr_P(str, val, len) memrchr((str), (val), (len))
    77 #endif
    78 #ifndef strcat_P
    79 #define strcat_P(dest, src) strcat((dest), (src))
    80 #endif
    81 #ifndef strchr_P
    82 #define strchr_P(str, c) strchr((str), (c))
    83 #endif
    84 #ifndef strchrnul_P
    85 #define strchrnul_P(str, c) strchrnul((str), (c))
    86 #endif
    87 #ifndef strcmp_P
    88 #define strcmp_P(a, b) strcmp((a), (b))
    89 #endif
    90 #ifndef strcpy_P
    91 #define strcpy_P(dest, src) strcpy((dest), (src))
    92 #endif
    93 #ifndef strcasecmp_P
    94 #define strcasecmp_P(a, b) strcasecmp((a), (b))
    95 #endif
    96 #ifndef strcasestr_P
    97 #define strcasestr_P(a, b) strcasestr((a), (b))
    98 #endif
    99 #ifndef strlcat_P
    100 #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
    101 #endif
    102 #ifndef strlcpy_P
    103 #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
    104 #endif
    105 #ifndef strlen_P
    106 #define strlen_P(s) strlen((const char *)(s))
    107 #endif
    108 #ifndef strnlen_P
    109 #define strnlen_P(str, len) strnlen((str), (len))
    110 #endif
    111 #ifndef strncmp_P
    112 #define strncmp_P(a, b, n) strncmp((a), (b), (n))
    113 #endif
    114 #ifndef strncasecmp_P
    115 #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
    116 #endif
    117 #ifndef strncat_P
    118 #define strncat_P(a, b, n) strncat((a), (b), (n))
    119 #endif
    120 #ifndef strncpy_P
    121 #define strncpy_P(a, b, n) strncmp((a), (b), (n))
    122 #endif
    123 #ifndef strpbrk_P
    124 #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
    125 #endif
    126 #ifndef strrchr_P
    127 #define strrchr_P(str, c) strrchr((str), (c))
    128 #endif
    129 #ifndef strsep_P
    130 #define strsep_P(strp, delim) strsep((strp), (delim))
    131 #endif
    132 #ifndef strspn_P
    133 #define strspn_P(str, chrs) strspn((str), (chrs))
    134 #endif
    135 #ifndef strstr_P
    136 #define strstr_P(a, b) strstr((a), (b))
    137 #endif
    138 #ifndef sprintf_P
    139 #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
    140 #endif
    141 #ifndef vfprintf_P
    142 #define vfprintf_P(s, ...) vfprintf((s), __VA_ARGS__)
    143 #endif
    144 #ifndef printf_P
    145 #define printf_P(...) printf(__VA_ARGS__)
    146 #endif
    147 #ifndef snprintf_P
    148 #define snprintf_P(s, n, ...) ((s), (n), __VA_ARGS__)
    149 #endif
    150 #ifndef vsprintf_P
    151 #define vsprintf_P(s, ...) ((s),__VA_ARGS__)
    152 #endif
    153 #ifndef vsnprintf_P
    154 #define vsnprintf_P(s, n, ...) ((s), (n),__VA_ARGS__)
    155 #endif
    156 #ifndef fprintf_P
    157 #define fprintf_P(s, ...) ((s), __VA_ARGS__)
    158 #endif
    159 
    160 #ifndef pgm_read_byte
    161 #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
    162 #endif
    163 #ifndef pgm_read_word
    164 #define pgm_read_word(addr) (*(const unsigned short *)(addr))
    165 #endif
    166 #ifndef pgm_read_dword
    167 #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
    168 #endif
    169 #ifndef pgm_read_float
    170 #define pgm_read_float(addr) (*(const float *)(addr))
    171 #endif
    172 
    173 #ifndef pgm_read_byte_near
    174 #define pgm_read_byte_near(addr) pgm_read_byte(addr)
    175 #endif
    176 #ifndef pgm_read_word_near
    177 #define pgm_read_word_near(addr) pgm_read_word(addr)
    178 #endif
    179 #ifndef pgm_read_dword_near
    180 #define pgm_read_dword_near(addr) pgm_read_dword(addr)
    181 #endif
    182 #ifndef pgm_read_float_near
    183 #define pgm_read_float_near(addr) pgm_read_float(addr)
    184 #endif
    185 #ifndef pgm_read_byte_far
    186 #define pgm_read_byte_far(addr) pgm_read_byte(addr)
    187 #endif
    188 #ifndef pgm_read_word_far
    189 #define pgm_read_word_far(addr) pgm_read_word(addr)
    190 #endif
    191 #ifndef pgm_read_dword_far
    192 #define pgm_read_dword_far(addr) pgm_read_dword(addr)
    193 #endif
    194 #ifndef pgm_read_float_far
    195 #define pgm_read_float_far(addr) pgm_read_float(addr)
    196 #endif
    197 
    198 #ifndef pgm_read_pointer
    199 #define pgm_read_pointer
    200 #endif
    201 #endif
    diff --git a/xbox_enums_8h.html b/xbox_enums_8h.html index 2e24e585..270ecc03 100644 --- a/xbox_enums_8h.html +++ b/xbox_enums_8h.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: xboxEnums.h File Reference @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@ - + - - + + + +
    - + @@ -135,7 +115,9 @@ Variables  

    Enumeration Type Documentation

    - + +

    ◆ LEDModeEnum

    +
    @@ -146,22 +128,20 @@ Variables

    Enum used to set special LED modes supported by the Xbox controller.

    - - - - + + + +
    Enumerator
    ROTATING  -
    FASTBLINK  -
    SLOWBLINK  -
    ALTERNATING  -
    Enumerator
    ROTATING 
    FASTBLINK 
    SLOWBLINK 
    ALTERNATING 
    -

    Definition at line 24 of file xboxEnums.h.

    +

    Definition at line 24 of file xboxEnums.h.

    Variable Documentation

    - + +

    ◆ XBOX_LEDS

    +
    @@ -172,11 +152,13 @@ Variables
    Initial value:
    = {
    0x00,
    0x02,
    0x03,
    0x04,
    0x05,
    0x01,
    }

    Used to set the LEDs on the controllers

    -

    Definition at line 32 of file xboxEnums.h.

    +

    Definition at line 32 of file xboxEnums.h.

    - + +

    ◆ XBOX_BUTTONS

    +
    @@ -187,7 +169,7 @@ Variables
    Initial value:
    = {
    0x0100,
    0x0800,
    0x0200,
    0x0400,
    0x2000,
    0x1000,
    0x4000,
    0x8000,
    0, 0,
    0x0001,
    0x0002,
    0x0020,
    0x0010,
    0x0040,
    0x0080,
    0x0004,
    0x0008,
    }

    Buttons on the controllers

    -

    Definition at line 41 of file xboxEnums.h.

    +

    Definition at line 41 of file xboxEnums.h.

    @@ -196,7 +178,7 @@ Variables diff --git a/xbox_enums_8h__dep__incl.map b/xbox_enums_8h__dep__incl.map index b55e74f3..4f8a4331 100644 --- a/xbox_enums_8h__dep__incl.map +++ b/xbox_enums_8h__dep__incl.map @@ -1,5 +1,5 @@ - + diff --git a/xbox_enums_8h__dep__incl.md5 b/xbox_enums_8h__dep__incl.md5 index 60b9cb6d..c1d05981 100644 --- a/xbox_enums_8h__dep__incl.md5 +++ b/xbox_enums_8h__dep__incl.md5 @@ -1 +1 @@ -37fbd5fbccd0c87996af0449ab2a7de6 \ No newline at end of file +e0dccedacb0e10099ba4ce5a1a80df5c \ No newline at end of file diff --git a/xbox_enums_8h__dep__incl.png b/xbox_enums_8h__dep__incl.png index df456f3f..4a176652 100644 Binary files a/xbox_enums_8h__dep__incl.png and b/xbox_enums_8h__dep__incl.png differ diff --git a/xbox_enums_8h__incl.md5 b/xbox_enums_8h__incl.md5 index 08a549aa..aed3ba34 100644 --- a/xbox_enums_8h__incl.md5 +++ b/xbox_enums_8h__incl.md5 @@ -1 +1 @@ -befff066e79e637de52f84f14ca3f473 \ No newline at end of file +1247936988d82509c3f26208d2b59df8 \ No newline at end of file diff --git a/xbox_enums_8h__incl.png b/xbox_enums_8h__incl.png index 17d1c4e2..6e6b1f4a 100644 Binary files a/xbox_enums_8h__incl.png and b/xbox_enums_8h__incl.png differ diff --git a/xbox_enums_8h_source.html b/xbox_enums_8h_source.html index eff6ab3d..cf0f8bd4 100644 --- a/xbox_enums_8h_source.html +++ b/xbox_enums_8h_source.html @@ -3,7 +3,8 @@ - + + USB Host Shield 2.0: xboxEnums.h Source File @@ -11,9 +12,6 @@ - @@ -32,40 +30,22 @@
    - + - - + + + +