diff --git a/_b_t_d_8cpp.html b/_b_t_d_8cpp.html index 82105023..c652f3a7 100644 --- a/_b_t_d_8cpp.html +++ b/_b_t_d_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTD.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,13 +86,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
BTD.cpp File Reference
-
#include "BTD.h"
+
#include "BTD.h"
Include dependency graph for BTD.cpp:
- + + + + +

Go to the source code of this file.

@@ -100,7 +105,7 @@ Include dependency graph for BTD.cpp:
diff --git a/_b_t_d_8cpp__incl.map b/_b_t_d_8cpp__incl.map index 9ae84451..f7186e4f 100644 --- a/_b_t_d_8cpp__incl.map +++ b/_b_t_d_8cpp__incl.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/_b_t_d_8cpp__incl.md5 b/_b_t_d_8cpp__incl.md5 index 2f6b90ad..a355a3b6 100644 --- a/_b_t_d_8cpp__incl.md5 +++ b/_b_t_d_8cpp__incl.md5 @@ -1 +1 @@ -9e3efe583f76e28914f4f8835557cb98 \ No newline at end of file +958bad8ed4b3f7ba0b3843a14e09d10f \ No newline at end of file diff --git a/_b_t_d_8cpp__incl.png b/_b_t_d_8cpp__incl.png index 3e56e52f..b753a3bf 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 75d85d94..9c94b9d3 100644 --- a/_b_t_d_8cpp_source.html +++ b/_b_t_d_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTD.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,1391 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 __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
-
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  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
+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
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  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:801
uint8_t bmRcvToggle
Definition: address.h:48
bool incomingWii
Definition: BTD.h:474
@@ -1674,7 +291,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_b_t_d_8h.html b/_b_t_d_8h.html index 34a99f99..93cb8f0c 100644 --- a/_b_t_d_8h.html +++ b/_b_t_d_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTD.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,21 +89,34 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
BTD.h File Reference
-
#include "Usb.h"
-#include "usbhid.h"
+
#include "Usb.h"
+#include "usbhid.h"
Include dependency graph for BTD.h:
- + + + +
This graph shows which files directly or indirectly include this file:
- + + + + + + + + + + +

Go to the source code of this file.

@@ -2051,7 +2065,7 @@ Macros diff --git a/_b_t_d_8h__dep__incl.map b/_b_t_d_8h__dep__incl.map index 8d8be02b..d582d1ce 100644 --- a/_b_t_d_8h__dep__incl.map +++ b/_b_t_d_8h__dep__incl.map @@ -1,12 +1,12 @@ - - - - - + + + + + - - - - + + + + diff --git a/_b_t_d_8h__dep__incl.md5 b/_b_t_d_8h__dep__incl.md5 index c136623d..3f896a89 100644 --- a/_b_t_d_8h__dep__incl.md5 +++ b/_b_t_d_8h__dep__incl.md5 @@ -1 +1 @@ -a586d33041837831328e4bd5a24cb1bb \ No newline at end of file +1cf25c5527b32b2a9e530f3758fe7f24 \ 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 4a015f96..a69a37b7 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.map b/_b_t_d_8h__incl.map index 07d46fbb..5dafafca 100644 --- a/_b_t_d_8h__incl.map +++ b/_b_t_d_8h__incl.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/_b_t_d_8h__incl.md5 b/_b_t_d_8h__incl.md5 index 3b7065e7..e21490e4 100644 --- a/_b_t_d_8h__incl.md5 +++ b/_b_t_d_8h__incl.md5 @@ -1 +1 @@ -c23324ec95734679d4f49067f5869150 \ No newline at end of file +197d6a6ff2afdc0a0703304559fc9c13 \ No newline at end of file diff --git a/_b_t_d_8h__incl.png b/_b_t_d_8h__incl.png index 3334808d..914dd3ca 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 d96d5b80..5bea3dd5 100644 --- a/_b_t_d_8h_source.html +++ b/_b_t_d_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTD.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,396 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 // 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
-
void(* pFuncOnInit)(void)
Definition: BTD.h:609
+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:
571  BluetoothService(BTD *p) : pBtd(p) {
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
@@ -511,7 +123,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
BTD(USB *p)
Definition: BTD.cpp:27
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
@@ -527,7 +138,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
#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
-
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
@@ -537,7 +147,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 attachOnInit(void(*funcOnInit)(void))
Definition: BTD.h:591
uint8_t Poll()
Definition: BTD.cpp:382
@@ -559,7 +168,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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
@@ -577,14 +185,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 03981507..7f3b1c76 100644 --- a/_b_t_h_i_d_8cpp.html +++ b/_b_t_h_i_d_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTHID.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,13 +86,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
BTHID.cpp File Reference
-
#include "BTHID.h"
+
#include "BTHID.h"
Include dependency graph for BTHID.cpp:
- + + + + + + +

Go to the source code of this file.

@@ -100,7 +107,7 @@ Include dependency graph for BTHID.cpp:
diff --git a/_b_t_h_i_d_8cpp__incl.map b/_b_t_h_i_d_8cpp__incl.map index abe5c26b..f4a1def3 100644 --- a/_b_t_h_i_d_8cpp__incl.map +++ b/_b_t_h_i_d_8cpp__incl.map @@ -1,8 +1,8 @@ - - - - - - + + + + + + diff --git a/_b_t_h_i_d_8cpp__incl.md5 b/_b_t_h_i_d_8cpp__incl.md5 index d91744b5..457a9283 100644 --- a/_b_t_h_i_d_8cpp__incl.md5 +++ b/_b_t_h_i_d_8cpp__incl.md5 @@ -1 +1 @@ -ffc3552818b1f5c07d20197253d93a66 \ No newline at end of file +2fddcbac34cc48df9a24e3c113c74570 \ 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 fb10c3dc..03e6136e 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 3b5afec4..ee4cb1b6 100644 --- a/_b_t_h_i_d_8cpp_source.html +++ b/_b_t_h_i_d_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTHID.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,406 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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:140
+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
@@ -563,7 +165,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_b_t_h_i_d_8h.html b/_b_t_h_i_d_8h.html index 59ded7ea..7c35c6e3 100644 --- a/_b_t_h_i_d_8h.html +++ b/_b_t_h_i_d_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTHID.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,21 +89,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
BTHID.h File Reference
-
#include "BTD.h"
-#include "hidboot.h"
+
#include "BTD.h"
+#include "hidboot.h"
Include dependency graph for BTHID.h:
- + + + + + +
This graph shows which files directly or indirectly include this file:
- + + +

Go to the source code of this file.

@@ -169,7 +177,7 @@ Macros diff --git a/_b_t_h_i_d_8h__dep__incl.map b/_b_t_h_i_d_8h__dep__incl.map index 4d5dd102..1b72a609 100644 --- a/_b_t_h_i_d_8h__dep__incl.map +++ b/_b_t_h_i_d_8h__dep__incl.map @@ -1,4 +1,4 @@ - + diff --git a/_b_t_h_i_d_8h__dep__incl.md5 b/_b_t_h_i_d_8h__dep__incl.md5 index ca89e4dc..053bda1f 100644 --- a/_b_t_h_i_d_8h__dep__incl.md5 +++ b/_b_t_h_i_d_8h__dep__incl.md5 @@ -1 +1 @@ -98e640defd09cdb6bea449a9af48374c \ No newline at end of file +0205aeed5db75f7b218ba6ecd920ddcd \ 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 2dd5a0d4..6ad24e96 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.map b/_b_t_h_i_d_8h__incl.map index 6e608b91..49aa9685 100644 --- a/_b_t_h_i_d_8h__incl.map +++ b/_b_t_h_i_d_8h__incl.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/_b_t_h_i_d_8h__incl.md5 b/_b_t_h_i_d_8h__incl.md5 index 2da3208f..aefec681 100644 --- a/_b_t_h_i_d_8h__incl.md5 +++ b/_b_t_h_i_d_8h__incl.md5 @@ -1 +1 @@ -bdc3422037e4ec0232315326aaf394cb \ No newline at end of file +d78862557f9f3bddfcdcfa91190beeac \ 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 aa67112c..189bfc76 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 fe9bb25f..fe0e0279 100644 --- a/_b_t_h_i_d_8h_source.html +++ b/_b_t_h_i_d_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTHID.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,107 +86,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 __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
- +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
-
void(* pFuncOnInit)(void)
Definition: BTD.h:609
virtual void OnInitBTHID()
Definition: BTHID.h:129
void ACLData(uint8_t *ACLData)
Definition: BTHID.cpp:56
Definition: BTD.h:201
@@ -200,6 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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:609
BTD * pBtd
Definition: BTD.h:612
void setLeds(struct KBDLEDS data)
Definition: BTHID.h:81
#define NUM_PARSERS
Definition: BTHID.h:26
@@ -216,7 +119,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 6686f87f..4c8fdca9 100644 --- a/_p_s3_b_t_8cpp.html +++ b/_p_s3_b_t_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3BT.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,13 +86,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS3BT.cpp File Reference
-
#include "PS3BT.h"
+
#include "PS3BT.h"
Include dependency graph for PS3BT.cpp:
- + + + + + + + +

Go to the source code of this file.

@@ -100,7 +108,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 38ed14ac..66b9764a 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 b8b94cf7..47f6eaf8 100644 --- a/_p_s3_b_t_8cpp__incl.md5 +++ b/_p_s3_b_t_8cpp__incl.md5 @@ -1 +1 @@ -964b669494a92fbaa23b013c5991517e \ No newline at end of file +50d55f1029d7b23c50d71899212fd03f \ 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 ab96e57b..406ff57f 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 c0155e72..a155fb5b 100644 --- a/_p_s3_b_t_8cpp_source.html +++ b/_p_s3_b_t_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3BT.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,645 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 = (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
-
void(* pFuncOnInit)(void)
Definition: BTD.h:609
+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 = (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
@@ -800,6 +163,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
uint8_t my_bdaddr[6]
Definition: BTD.h:452
void setRumbleOn(RumbleEnum mode)
Definition: PS3BT.cpp:540
+
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:161
@@ -867,7 +231,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s3_b_t_8h.html b/_p_s3_b_t_8h.html index bcfa6707..507e3c7c 100644 --- a/_p_s3_b_t_8h.html +++ b/_p_s3_b_t_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3BT.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,21 +89,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS3BT.h File Reference
-
#include "BTD.h"
-#include "PS3Enums.h"
+
#include "BTD.h"
+#include "PS3Enums.h"
Include dependency graph for PS3BT.h:
- + + + + + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -137,7 +145,7 @@ Macros diff --git a/_p_s3_b_t_8h__dep__incl.md5 b/_p_s3_b_t_8h__dep__incl.md5 index fd5774bf..80c124ec 100644 --- a/_p_s3_b_t_8h__dep__incl.md5 +++ b/_p_s3_b_t_8h__dep__incl.md5 @@ -1 +1 @@ -bb28c7be8b59850aa707116e8edbd78a \ No newline at end of file +eba794dfcd5eea5cd385cf4d1f0cee96 \ 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 e1c830e1..fabe3366 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 71a1bbe7..11d3a286 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 2a9f54b2..dbb83515 100644 --- a/_p_s3_b_t_8h__incl.md5 +++ b/_p_s3_b_t_8h__incl.md5 @@ -1 +1 @@ -fcbf970a34bdbf333c6b320a0d740460 \ No newline at end of file +90cb54a3b8ad4256770707efdc9f2bdc \ 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 6b3dbd49..e2e8bf73 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 53fbf500..45f790a0 100644 --- a/_p_s3_b_t_8h_source.html +++ b/_p_s3_b_t_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3BT.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,114 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS3BT.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 _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
+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:201
@@ -242,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s3_enums_8h.html b/_p_s3_enums_8h.html index 2beaa776..4849fb7d 100644 --- a/_p_s3_enums_8h.html +++ b/_p_s3_enums_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3Enums.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -89,20 +90,25 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS3Enums.h File Reference
-
#include "controllerEnums.h"
+
#include "controllerEnums.h"
Include dependency graph for PS3Enums.h:
- + +
This graph shows which files directly or indirectly include this file:
- + + + + +

Go to the source code of this file.

@@ -116,32 +122,32 @@ Macros -

Enumerations

enum  StatusEnum {
+
enum  StatusEnum {
  Plugged = (38 << 8) | 0x02, Unplugged = (38 << 8) | 0x03, Charging = (39 << 8) | 0xEE, NotCharging = (39 << 8) | 0xF1, -
+
  Shutdown = (39 << 8) | 0x01, Dying = (39 << 8) | 0x02, Low = (39 << 8) | 0x03, High = (39 << 8) | 0x04, -
+
  Full = (39 << 8) | 0x05, MoveCharging = (21 << 8) | 0xEE, MoveNotCharging = (21 << 8) | 0xF1, MoveShutdown = (21 << 8) | 0x01, -
+
  MoveDying = (21 << 8) | 0x02, MoveLow = (21 << 8) | 0x03, MoveHigh = (21 << 8) | 0x04, MoveFull = (21 << 8) | 0x05, -
+
  CableRumble = (40 << 8) | 0x10, Cable = (40 << 8) | 0x12, BluetoothRumble = (40 << 8) | 0x14, Bluetooth = (40 << 8) | 0x16 -
+
}
 
@@ -198,45 +204,45 @@ Variables
- - - - - - - - - - - - - - - - - - - -
Enumerator
Plugged  +
Enumerator
Plugged 
Unplugged  +
Unplugged 
Charging  +
Charging 
NotCharging  +
NotCharging 
Shutdown  +
Shutdown 
Dying  +
Dying 
Low  +
Low 
High  +
High 
Full  +
Full 
MoveCharging  +
MoveCharging 
MoveNotCharging  +
MoveNotCharging 
MoveShutdown  +
MoveShutdown 
MoveDying  +
MoveDying 
MoveLow  +
MoveLow 
MoveHigh  +
MoveHigh 
MoveFull  +
MoveFull 
CableRumble  +
CableRumble 
Cable  +
Cable 
BluetoothRumble  +
BluetoothRumble 
Bluetooth  +
Bluetooth 
@@ -254,18 +260,7 @@ 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

+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.

@@ -280,21 +275,7 @@ Variables
-Initial value:
= {
-
0x00,
-
0x01,
-
0x02,
-
0x04,
-
0x08,
-
-
0x09,
-
0x0A,
-
0x0C,
-
0x0D,
-
0x0E,
-
0x0F,
-
}
-

Used to set the LEDs on the controllers

+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.

@@ -309,32 +290,7 @@ 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.

+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.

@@ -349,27 +305,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.

+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.

@@ -380,7 +316,7 @@ Variables diff --git a/_p_s3_enums_8h__dep__incl.map b/_p_s3_enums_8h__dep__incl.map index e82ffee3..763a7d9c 100644 --- a/_p_s3_enums_8h__dep__incl.map +++ b/_p_s3_enums_8h__dep__incl.map @@ -1,6 +1,6 @@ - - + + - + diff --git a/_p_s3_enums_8h__dep__incl.md5 b/_p_s3_enums_8h__dep__incl.md5 index 1a523eaa..7e6c593e 100644 --- a/_p_s3_enums_8h__dep__incl.md5 +++ b/_p_s3_enums_8h__dep__incl.md5 @@ -1 +1 @@ -632aeb814444892cb4235318575b2052 \ No newline at end of file +2ee6fe4e5f4f5bb8864f711284e44ace \ 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 5397db6c..db1f5fde 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.map b/_p_s3_enums_8h__incl.map index ce53db4e..6913856a 100644 --- a/_p_s3_enums_8h__incl.map +++ b/_p_s3_enums_8h__incl.map @@ -1,3 +1,3 @@ - + diff --git a/_p_s3_enums_8h__incl.md5 b/_p_s3_enums_8h__incl.md5 index 1892a863..a2b68ead 100644 --- a/_p_s3_enums_8h__incl.md5 +++ b/_p_s3_enums_8h__incl.md5 @@ -1 +1 @@ -8cf971386ed8276013189d149241a27d \ No newline at end of file +1b975049347183489796e6dc1da09be9 \ No newline at end of file diff --git a/_p_s3_enums_8h__incl.png b/_p_s3_enums_8h__incl.png index 69fd6970..b70aa1bf 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 593cf160..a57c8678 100644 --- a/_p_s3_enums_8h_source.html +++ b/_p_s3_enums_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3Enums.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,136 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS3Enums.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 _ps3enums_h
-
19 #define _ps3enums_h
-
20 
-
21 #include "controllerEnums.h"
-
22 
-
24 #define PS3_REPORT_BUFFER_SIZE 48
-
25 
-
27 const uint8_t PS3_REPORT_BUFFER[PS3_REPORT_BUFFER_SIZE] PROGMEM = {
-
28  0x00, 0x00, 0x00, 0x00, 0x00,
-
29  0x00, 0x00, 0x00, 0x00, 0x00,
-
30  0xff, 0x27, 0x10, 0x00, 0x32,
-
31  0xff, 0x27, 0x10, 0x00, 0x32,
-
32  0xff, 0x27, 0x10, 0x00, 0x32,
-
33  0xff, 0x27, 0x10, 0x00, 0x32,
-
34  0x00, 0x00, 0x00, 0x00, 0x00,
-
35  0x00, 0x00, 0x00, 0x00, 0x00,
-
36  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-
37 };
-
38 
-
40 #define MOVE_REPORT_BUFFER_SIZE 7
-
41 
-
43 const uint8_t PS3_LEDS[] PROGMEM = {
-
44  0x00, // OFF
-
45  0x01, // LED1
-
46  0x02, // LED2
-
47  0x04, // LED3
-
48  0x08, // LED4
-
49 
-
50  0x09, // LED5
-
51  0x0A, // LED6
-
52  0x0C, // LED7
-
53  0x0D, // LED8
-
54  0x0E, // LED9
-
55  0x0F, // LED10
-
56 };
-
57 
-
62 const uint32_t PS3_BUTTONS[] PROGMEM = {
-
63  0x10, // UP
-
64  0x20, // RIGHT
-
65  0x40, // DOWN
-
66  0x80, // LEFT
-
67 
-
68  0x01, // SELECT
-
69  0x08, // START
-
70  0x02, // L3
-
71  0x04, // R3
-
72 
-
73  0x0100, // L2
-
74  0x0200, // R2
-
75  0x0400, // L1
-
76  0x0800, // R1
-
77 
-
78  0x1000, // TRIANGLE
-
79  0x2000, // CIRCLE
-
80  0x4000, // CROSS
-
81  0x8000, // SQUARE
-
82 
-
83  0x010000, // PS
-
84  0x080000, // MOVE - covers 12 bits - we only need to read the top 8
-
85  0x100000, // T - covers 12 bits - we only need to read the top 8
-
86 };
-
87 
-
92 const uint8_t PS3_ANALOG_BUTTONS[] PROGMEM = {
-
93  23, // UP_ANALOG
-
94  24, // RIGHT_ANALOG
-
95  25, // DOWN_ANALOG
-
96  26, // LEFT_ANALOG
-
97  0, 0, 0, 0, // Skip SELECT, L3, R3 and START
-
98 
-
99  27, // L2_ANALOG
-
100  28, // R2_ANALOG
-
101  29, // L1_ANALOG
-
102  30, // R1_ANALOG
-
103  31, // TRIANGLE_ANALOG
-
104  32, // CIRCLE_ANALOG
-
105  33, // CROSS_ANALOG
-
106  34, // SQUARE_ANALOG
-
107  0, 0, // Skip PS and MOVE
-
108 
-
109  // Playstation Move Controller
-
110  15, // T_ANALOG - Both at byte 14 (last reading) and byte 15 (current reading)
-
111 };
-
112 
- -
114  // Note that the location is shifted 9 when it's connected via USB
-
115  // Byte location | bit location
-
116  Plugged = (38 << 8) | 0x02,
-
117  Unplugged = (38 << 8) | 0x03,
-
118 
-
119  Charging = (39 << 8) | 0xEE,
-
120  NotCharging = (39 << 8) | 0xF1,
-
121  Shutdown = (39 << 8) | 0x01,
-
122  Dying = (39 << 8) | 0x02,
-
123  Low = (39 << 8) | 0x03,
-
124  High = (39 << 8) | 0x04,
-
125  Full = (39 << 8) | 0x05,
-
126 
-
127  MoveCharging = (21 << 8) | 0xEE,
-
128  MoveNotCharging = (21 << 8) | 0xF1,
-
129  MoveShutdown = (21 << 8) | 0x01,
-
130  MoveDying = (21 << 8) | 0x02,
-
131  MoveLow = (21 << 8) | 0x03,
-
132  MoveHigh = (21 << 8) | 0x04,
-
133  MoveFull = (21 << 8) | 0x05,
-
134 
-
135  CableRumble = (40 << 8) | 0x10, // Operating by USB and rumble is turned on
-
136  Cable = (40 << 8) | 0x12, // Operating by USB and rumble is turned off
-
137  BluetoothRumble = (40 << 8) | 0x14, // Operating by Bluetooth and rumble is turned on
-
138  Bluetooth = (40 << 8) | 0x16, // Operating by Bluetooth and rumble is turned off
-
139 };
-
140 
-
141 #endif
-
Definition: PS3Enums.h:124
+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 _ps3enums_h
19 #define _ps3enums_h
20 
21 #include "controllerEnums.h"
22 
24 #define PS3_REPORT_BUFFER_SIZE 48
25 
27 const uint8_t PS3_REPORT_BUFFER[PS3_REPORT_BUFFER_SIZE] PROGMEM = {
28  0x00, 0x00, 0x00, 0x00, 0x00,
29  0x00, 0x00, 0x00, 0x00, 0x00,
30  0xff, 0x27, 0x10, 0x00, 0x32,
31  0xff, 0x27, 0x10, 0x00, 0x32,
32  0xff, 0x27, 0x10, 0x00, 0x32,
33  0xff, 0x27, 0x10, 0x00, 0x32,
34  0x00, 0x00, 0x00, 0x00, 0x00,
35  0x00, 0x00, 0x00, 0x00, 0x00,
36  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
37 };
38 
40 #define MOVE_REPORT_BUFFER_SIZE 7
41 
43 const uint8_t PS3_LEDS[] PROGMEM = {
44  0x00, // OFF
45  0x01, // LED1
46  0x02, // LED2
47  0x04, // LED3
48  0x08, // LED4
49 
50  0x09, // LED5
51  0x0A, // LED6
52  0x0C, // LED7
53  0x0D, // LED8
54  0x0E, // LED9
55  0x0F, // LED10
56 };
57 
62 const uint32_t PS3_BUTTONS[] PROGMEM = {
63  0x10, // UP
64  0x20, // RIGHT
65  0x40, // DOWN
66  0x80, // LEFT
67 
68  0x01, // SELECT
69  0x08, // START
70  0x02, // L3
71  0x04, // R3
72 
73  0x0100, // L2
74  0x0200, // R2
75  0x0400, // L1
76  0x0800, // R1
77 
78  0x1000, // TRIANGLE
79  0x2000, // CIRCLE
80  0x4000, // CROSS
81  0x8000, // SQUARE
82 
83  0x010000, // PS
84  0x080000, // MOVE - covers 12 bits - we only need to read the top 8
85  0x100000, // T - covers 12 bits - we only need to read the top 8
86 };
87 
92 const uint8_t PS3_ANALOG_BUTTONS[] PROGMEM = {
93  23, // UP_ANALOG
94  24, // RIGHT_ANALOG
95  25, // DOWN_ANALOG
96  26, // LEFT_ANALOG
97  0, 0, 0, 0, // Skip SELECT, L3, R3 and START
98 
99  27, // L2_ANALOG
100  28, // R2_ANALOG
101  29, // L1_ANALOG
102  30, // R1_ANALOG
103  31, // TRIANGLE_ANALOG
104  32, // CIRCLE_ANALOG
105  33, // CROSS_ANALOG
106  34, // SQUARE_ANALOG
107  0, 0, // Skip PS and MOVE
108 
109  // Playstation Move Controller
110  15, // T_ANALOG - Both at byte 14 (last reading) and byte 15 (current reading)
111 };
112 
114  // Note that the location is shifted 9 when it's connected via USB
115  // Byte location | bit location
116  Plugged = (38 << 8) | 0x02,
117  Unplugged = (38 << 8) | 0x03,
118 
119  Charging = (39 << 8) | 0xEE,
120  NotCharging = (39 << 8) | 0xF1,
121  Shutdown = (39 << 8) | 0x01,
122  Dying = (39 << 8) | 0x02,
123  Low = (39 << 8) | 0x03,
124  High = (39 << 8) | 0x04,
125  Full = (39 << 8) | 0x05,
126 
127  MoveCharging = (21 << 8) | 0xEE,
128  MoveNotCharging = (21 << 8) | 0xF1,
129  MoveShutdown = (21 << 8) | 0x01,
130  MoveDying = (21 << 8) | 0x02,
131  MoveLow = (21 << 8) | 0x03,
132  MoveHigh = (21 << 8) | 0x04,
133  MoveFull = (21 << 8) | 0x05,
134 
135  CableRumble = (40 << 8) | 0x10, // Operating by USB and rumble is turned on
136  Cable = (40 << 8) | 0x12, // Operating by USB and rumble is turned off
137  BluetoothRumble = (40 << 8) | 0x14, // Operating by Bluetooth and rumble is turned on
138  Bluetooth = (40 << 8) | 0x16, // Operating by Bluetooth and rumble is turned off
139 };
140 
141 #endif
Definition: PS3Enums.h:124
@@ -246,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s3_u_s_b_8cpp.html b/_p_s3_u_s_b_8cpp.html index 0aa48c40..b0864d76 100644 --- a/_p_s3_u_s_b_8cpp.html +++ b/_p_s3_u_s_b_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3USB.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,13 +86,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS3USB.cpp File Reference
-
#include "PS3USB.h"
+
#include "PS3USB.h"
Include dependency graph for PS3USB.cpp:
- + + + + + + +

Go to the source code of this file.

@@ -100,7 +107,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 e7fc8aa1..8125e244 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 2046ae3d..a9693dff 100644 --- a/_p_s3_u_s_b_8cpp__incl.md5 +++ b/_p_s3_u_s_b_8cpp__incl.md5 @@ -1 +1 @@ -a191ea756244e178ed7c52102de0f63b \ No newline at end of file +6fe7e16b5e65f19d54865f8f0649448b \ 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 feac891f..80c55344 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 fae90355..3a4a6c93 100644 --- a/_p_s3_u_s_b_8cpp_source.html +++ b/_p_s3_u_s_b_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3USB.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,581 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 = (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
+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
@@ -790,7 +217,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s3_u_s_b_8h.html b/_p_s3_u_s_b_8h.html index b354d41e..e28bd4dd 100644 --- a/_p_s3_u_s_b_8h.html +++ b/_p_s3_u_s_b_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3USB.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,22 +89,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS3USB.h File Reference
-
#include "Usb.h"
-#include "usbhid.h"
-#include "PS3Enums.h"
+
#include "Usb.h"
+#include "usbhid.h"
+#include "PS3Enums.h"
Include dependency graph for PS3USB.h:
- + + + + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -266,7 +273,7 @@ Macros diff --git a/_p_s3_u_s_b_8h__dep__incl.map b/_p_s3_u_s_b_8h__dep__incl.map index d6176217..667ba04f 100644 --- a/_p_s3_u_s_b_8h__dep__incl.map +++ b/_p_s3_u_s_b_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/_p_s3_u_s_b_8h__dep__incl.md5 b/_p_s3_u_s_b_8h__dep__incl.md5 index b91d38d1..12e5013f 100644 --- a/_p_s3_u_s_b_8h__dep__incl.md5 +++ b/_p_s3_u_s_b_8h__dep__incl.md5 @@ -1 +1 @@ -10cd044b5bf58467538f65c844ab1455 \ No newline at end of file +0475266e9b2a94b52ed82e482fd5e58c \ 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 9f37dc52..3e3167b1 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 10cb6bb5..a496e764 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 41473e73..8fa52d90 100644 --- a/_p_s3_u_s_b_8h__incl.md5 +++ b/_p_s3_u_s_b_8h__incl.md5 @@ -1 +1 @@ -798f542812638555960f82da216a8f12 \ No newline at end of file +6e3e4f5a4587d0eabc83a6049ce6f258 \ 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 70e36f0e..95bbe266 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 660833e5..ca41061e 100644 --- a/_p_s3_u_s_b_8h_source.html +++ b/_p_s3_u_s_b_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3USB.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,137 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS3USB.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 _ps3usb_h_
-
19 #define _ps3usb_h_
-
20 
-
21 #include "Usb.h"
-
22 #include "usbhid.h"
-
23 #include "PS3Enums.h"
-
24 
-
25 /* PS3 data taken from descriptors */
-
26 #define EP_MAXPKTSIZE 64 // max size for data via USB
-
27 
-
28 /* Names we give to the 3 ps3 pipes - this is only used for setting the bluetooth address into the ps3 controllers */
-
29 #define PS3_CONTROL_PIPE 0
-
30 #define PS3_OUTPUT_PIPE 1
-
31 #define PS3_INPUT_PIPE 2
-
32 
-
33 //PID and VID of the different devices
-
34 #define PS3_VID 0x054C // Sony Corporation
-
35 #define PS3_PID 0x0268 // PS3 Controller DualShock 3
-
36 #define PS3NAVIGATION_PID 0x042F // Navigation controller
-
37 #define PS3MOVE_PID 0x03D5 // Motion controller
-
38 
-
39 #define PS3_MAX_ENDPOINTS 3
-
40 
-
49 class PS3USB : public USBDeviceConfig {
-
50 public:
-
58  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);
-
59 
-
68  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
-
73  uint8_t Release();
-
78  uint8_t Poll();
-
79 
-
84  virtual uint8_t GetAddress() {
-
85  return bAddress;
-
86  };
-
87 
-
92  virtual bool isReady() {
-
93  return bPollEnable;
-
94  };
-
95 
-
102  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
-
103  return (vid == PS3_VID && (pid == PS3_PID || pid == PS3NAVIGATION_PID || pid == PS3MOVE_PID));
-
104  };
-
112  void setBdaddr(uint8_t *bdaddr);
-
118  void getBdaddr(uint8_t *bdaddr);
-
119 
-
125  void setMoveBdaddr(uint8_t *bdaddr);
-
131  void getMoveBdaddr(uint8_t *bdaddr);
-
136  void getMoveCalibration(uint8_t *data);
-
137 
-
149  bool getButtonPress(ButtonEnum b);
-
150  bool getButtonClick(ButtonEnum b);
-
161  uint8_t getAnalogButton(ButtonEnum a);
-
167  uint8_t getAnalogHat(AnalogHatEnum a);
-
174  uint16_t getSensor(SensorEnum a);
-
180  float getAngle(AngleEnum a);
-
186  bool getStatus(StatusEnum c);
-
188  void printStatusString();
-
189 
-
191  void setAllOff();
-
193  void setRumbleOff();
-
198  void setRumbleOn(RumbleEnum mode);
-
206  void setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower);
-
207 
-
212  void setLedRaw(uint8_t value);
-
213 
-
215  void setLedOff() {
-
216  setLedRaw(0);
-
217  }
-
222  void setLedOff(LEDEnum a);
-
227  void setLedOn(LEDEnum a);
-
232  void setLedToggle(LEDEnum a);
-
233 
-
238  void moveSetBulb(uint8_t r, uint8_t g, uint8_t b);
-
243  void moveSetBulb(ColorsEnum color);
-
248  void moveSetRumble(uint8_t rumble);
-
249 
-
254  void attachOnInit(void (*funcOnInit)(void)) {
-
255  pFuncOnInit = funcOnInit;
-
256  };
-
260  bool PS3Connected;
- - -
265 
-
266 protected:
- -
270  uint8_t bAddress;
- -
273 
-
274 private:
-
280  void onInit();
-
281  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
-
282 
-
283  bool bPollEnable;
-
284 
-
285  uint32_t timer; // used to continuously set PS3 Move controller Bulb and rumble values
-
286 
-
287  uint32_t ButtonState;
-
288  uint32_t OldButtonState;
-
289  uint32_t ButtonClickState;
-
290 
-
291  uint8_t my_bdaddr[6]; // Change to your dongles Bluetooth address in the constructor
-
292  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
-
293  uint8_t writeBuf[EP_MAXPKTSIZE]; // General purpose buffer for output data
-
294 
-
295  void readReport(); // read incoming data
-
296  void printReport(); // print incoming date - Uncomment for debugging
-
297 
-
298  /* Private commands */
-
299  void PS3_Command(uint8_t *data, uint16_t nbytes);
-
300  void enable_sixaxis(); // Command used to enable the Dualshock 3 and Navigation controller to send data via USB
-
301  void Move_Command(uint8_t *data, uint16_t nbytes);
-
302 };
-
303 #endif
-
void getBdaddr(uint8_t *bdaddr)
Definition: PS3USB.cpp:478
+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 _ps3usb_h_
19 #define _ps3usb_h_
20 
21 #include "Usb.h"
22 #include "usbhid.h"
23 #include "PS3Enums.h"
24 
25 /* PS3 data taken from descriptors */
26 #define EP_MAXPKTSIZE 64 // max size for data via USB
27 
28 /* Names we give to the 3 ps3 pipes - this is only used for setting the bluetooth address into the ps3 controllers */
29 #define PS3_CONTROL_PIPE 0
30 #define PS3_OUTPUT_PIPE 1
31 #define PS3_INPUT_PIPE 2
32 
33 //PID and VID of the different devices
34 #define PS3_VID 0x054C // Sony Corporation
35 #define PS3_PID 0x0268 // PS3 Controller DualShock 3
36 #define PS3NAVIGATION_PID 0x042F // Navigation controller
37 #define PS3MOVE_PID 0x03D5 // Motion controller
38 
39 #define PS3_MAX_ENDPOINTS 3
40 
49 class PS3USB : public USBDeviceConfig {
50 public:
58  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);
59 
68  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
73  uint8_t Release();
78  uint8_t Poll();
79 
84  virtual uint8_t GetAddress() {
85  return bAddress;
86  };
87 
92  virtual bool isReady() {
93  return bPollEnable;
94  };
95 
102  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
103  return (vid == PS3_VID && (pid == PS3_PID || pid == PS3NAVIGATION_PID || pid == PS3MOVE_PID));
104  };
112  void setBdaddr(uint8_t *bdaddr);
118  void getBdaddr(uint8_t *bdaddr);
119 
125  void setMoveBdaddr(uint8_t *bdaddr);
131  void getMoveBdaddr(uint8_t *bdaddr);
136  void getMoveCalibration(uint8_t *data);
137 
149  bool getButtonPress(ButtonEnum b);
150  bool getButtonClick(ButtonEnum b);
161  uint8_t getAnalogButton(ButtonEnum a);
167  uint8_t getAnalogHat(AnalogHatEnum a);
174  uint16_t getSensor(SensorEnum a);
180  float getAngle(AngleEnum a);
186  bool getStatus(StatusEnum c);
188  void printStatusString();
189 
191  void setAllOff();
193  void setRumbleOff();
198  void setRumbleOn(RumbleEnum mode);
206  void setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower);
207 
212  void setLedRaw(uint8_t value);
213 
215  void setLedOff() {
216  setLedRaw(0);
217  }
222  void setLedOff(LEDEnum a);
227  void setLedOn(LEDEnum a);
232  void setLedToggle(LEDEnum a);
233 
238  void moveSetBulb(uint8_t r, uint8_t g, uint8_t b);
243  void moveSetBulb(ColorsEnum color);
248  void moveSetRumble(uint8_t rumble);
249 
254  void attachOnInit(void (*funcOnInit)(void)) {
255  pFuncOnInit = funcOnInit;
256  };
260  bool PS3Connected;
265 
266 protected:
270  uint8_t bAddress;
273 
274 private:
280  void onInit();
281  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
282 
283  bool bPollEnable;
284 
285  uint32_t timer; // used to continuously set PS3 Move controller Bulb and rumble values
286 
287  uint32_t ButtonState;
288  uint32_t OldButtonState;
289  uint32_t ButtonClickState;
290 
291  uint8_t my_bdaddr[6]; // Change to your dongles Bluetooth address in the constructor
292  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
293  uint8_t writeBuf[EP_MAXPKTSIZE]; // General purpose buffer for output data
294 
295  void readReport(); // read incoming data
296  void printReport(); // print incoming date - Uncomment for debugging
297 
298  /* Private commands */
299  void PS3_Command(uint8_t *data, uint16_t nbytes);
300  void enable_sixaxis(); // Command used to enable the Dualshock 3 and Navigation controller to send data via USB
301  void Move_Command(uint8_t *data, uint16_t nbytes);
302 };
303 #endif
void getBdaddr(uint8_t *bdaddr)
Definition: PS3USB.cpp:478
Definition: PS3USB.h:49
void setLedRaw(uint8_t value)
Definition: PS3USB.cpp:441
bool PS3NavigationConnected
Definition: PS3USB.h:264
@@ -277,7 +148,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 dfd82cb9..07a1d372 100644 --- a/_p_s4_b_t_8h.html +++ b/_p_s4_b_t_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4BT.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -87,14 +88,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS4BT.h File Reference
-
#include "BTHID.h"
-#include "PS4Parser.h"
+
#include "BTHID.h"
+#include "PS4Parser.h"
Include dependency graph for PS4BT.h:
- + + + + + + + + +

Go to the source code of this file.

@@ -109,7 +118,7 @@ Classes diff --git a/_p_s4_b_t_8h__incl.map b/_p_s4_b_t_8h__incl.map index 17981d6e..f2f326c3 100644 --- a/_p_s4_b_t_8h__incl.map +++ b/_p_s4_b_t_8h__incl.map @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + diff --git a/_p_s4_b_t_8h__incl.md5 b/_p_s4_b_t_8h__incl.md5 index a743a9b4..13fdf4c6 100644 --- a/_p_s4_b_t_8h__incl.md5 +++ b/_p_s4_b_t_8h__incl.md5 @@ -1 +1 @@ -2d2bb40edda0b80e02c0310684b09c06 \ No newline at end of file +57aad865c1c7b4a544a7eac684f0ffd9 \ 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 218917b8..083220ee 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 717bc654..e877e782 100644 --- a/_p_s4_b_t_8h_source.html +++ b/_p_s4_b_t_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4BT.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,98 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS4BT.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 _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(* pFuncOnInit)(void)
Definition: BTD.h:609
-
void Reset()
Definition: PS4Parser.cpp:130
+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:201
uint8_t b
Definition: PS4Parser.h:118
void setLed(uint8_t r, uint8_t g, uint8_t b)
Definition: PS4Parser.h:320
@@ -193,6 +103,7 @@ 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:609
uint8_t smallRumble
Definition: PS4Parser.h:117
@@ -212,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s4_parser_8cpp.html b/_p_s4_parser_8cpp.html index c37cdde2..1e1b4e32 100644 --- a/_p_s4_parser_8cpp.html +++ b/_p_s4_parser_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4Parser.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -87,32 +88,35 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS4Parser.cpp File Reference
-
#include "PS4Parser.h"
+
#include "PS4Parser.h"
Include dependency graph for PS4Parser.cpp:
- + + + +

Go to the source code of this file.

-

Enumerations

enum  DPADEnum {
+
enum  DPADEnum {
  DPAD_UP = 0x0, DPAD_UP_RIGHT = 0x1, DPAD_RIGHT = 0x2, DPAD_RIGHT_DOWN = 0x3, -
+
  DPAD_DOWN = 0x4, DPAD_DOWN_LEFT = 0x5, DPAD_LEFT = 0x6, DPAD_LEFT_UP = 0x7, -
+
  DPAD_OFF = 0x8 -
+
}
 
@@ -127,23 +131,23 @@ Enumerations
- - - - - - - - -
Enumerator
DPAD_UP  +
Enumerator
DPAD_UP 
DPAD_UP_RIGHT  +
DPAD_UP_RIGHT 
DPAD_RIGHT  +
DPAD_RIGHT 
DPAD_RIGHT_DOWN  +
DPAD_RIGHT_DOWN 
DPAD_DOWN  +
DPAD_DOWN 
DPAD_DOWN_LEFT  +
DPAD_DOWN_LEFT 
DPAD_LEFT  +
DPAD_LEFT 
DPAD_LEFT_UP  +
DPAD_LEFT_UP 
DPAD_OFF  +
DPAD_OFF 
@@ -156,7 +160,7 @@ Enumerations diff --git a/_p_s4_parser_8cpp__incl.map b/_p_s4_parser_8cpp__incl.map index c8ab6336..a426c81a 100644 --- a/_p_s4_parser_8cpp__incl.map +++ b/_p_s4_parser_8cpp__incl.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/_p_s4_parser_8cpp__incl.md5 b/_p_s4_parser_8cpp__incl.md5 index b54e7156..1f9ffe4e 100644 --- a/_p_s4_parser_8cpp__incl.md5 +++ b/_p_s4_parser_8cpp__incl.md5 @@ -1 +1 @@ -7b7a6c8921078ff071fc05959848bb21 \ No newline at end of file +03082f2d3fd4c67e7d5789f05b2dd70a \ No newline at end of file diff --git a/_p_s4_parser_8cpp__incl.png b/_p_s4_parser_8cpp__incl.png index 5db104c4..0daabf52 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 53619c40..de76aec1 100644 --- a/_p_s4_parser_8cpp_source.html +++ b/_p_s4_parser_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4Parser.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,160 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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), 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 
- +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
@@ -290,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s4_parser_8h.html b/_p_s4_parser_8h.html index 207b3451..f3186963 100644 --- a/_p_s4_parser_8h.html +++ b/_p_s4_parser_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4Parser.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,21 +89,26 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS4Parser.h File Reference
-
#include "Usb.h"
-#include "controllerEnums.h"
+
#include "Usb.h"
+#include "controllerEnums.h"
Include dependency graph for PS4Parser.h:
- + + +
This graph shows which files directly or indirectly include this file:
- + + + +

Go to the source code of this file.

@@ -137,31 +143,7 @@ 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,
}
@@ -176,7 +158,7 @@ Variables diff --git a/_p_s4_parser_8h__dep__incl.map b/_p_s4_parser_8h__dep__incl.map index dee1d670..ae9e045f 100644 --- a/_p_s4_parser_8h__dep__incl.map +++ b/_p_s4_parser_8h__dep__incl.map @@ -1,5 +1,5 @@ - - + + diff --git a/_p_s4_parser_8h__dep__incl.md5 b/_p_s4_parser_8h__dep__incl.md5 index 8fd62cc2..2dc29627 100644 --- a/_p_s4_parser_8h__dep__incl.md5 +++ b/_p_s4_parser_8h__dep__incl.md5 @@ -1 +1 @@ -5e56bd64aa04badca5d0648201af05fb \ No newline at end of file +4d5a405a295dec480becbdb408726c5e \ 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 ce787819..a33fed99 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.map b/_p_s4_parser_8h__incl.map index e976f1a4..690dcd55 100644 --- a/_p_s4_parser_8h__incl.map +++ b/_p_s4_parser_8h__incl.map @@ -1,4 +1,4 @@ - - + + diff --git a/_p_s4_parser_8h__incl.md5 b/_p_s4_parser_8h__incl.md5 index 493b39f0..a7437e13 100644 --- a/_p_s4_parser_8h__incl.md5 +++ b/_p_s4_parser_8h__incl.md5 @@ -1 +1 @@ -559da26f56bdca12a84aceb0d7a5a74b \ No newline at end of file +29a4989044a63001a938d41ea83d3491 \ No newline at end of file diff --git a/_p_s4_parser_8h__incl.png b/_p_s4_parser_8h__incl.png index a254877f..98252f49 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 6e73536d..cebe5685 100644 --- a/_p_s4_parser_8h_source.html +++ b/_p_s4_parser_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4Parser.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,256 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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);
-
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
+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
uint32_t val
Definition: PS4Parser.h:71
uint16_t getY(uint8_t finger=0, uint8_t xyId=0)
Definition: PS4Parser.h:182
@@ -348,7 +100,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
void setLed(ColorsEnum color)
Definition: PS4Parser.h:331
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:227
uint8_t flashOn
Definition: PS4Parser.h:119
@@ -368,8 +119,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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:194
-
uint8_t counter
Definition: PS4Parser.h:77
-
uint16_t y
Definition: PS4Parser.h:80
const uint8_t PS4_BUTTONS[]
Definition: PS4Parser.h:25
@@ -384,7 +133,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
void setLedOff()
Definition: PS4Parser.h:312
uint8_t dpad
Definition: PS4Parser.h:52
-
struct touchpadXY::@30 finger[2]
ColorsEnum
int16_t gyroZ
Definition: PS4Parser.h:100
@@ -403,7 +151,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS4Buttons btn
Definition: PS4Parser.h:95
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:340
@@ -417,7 +164,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s4_u_s_b_8h.html b/_p_s4_u_s_b_8h.html index 9ba07cd6..eb7dce74 100644 --- a/_p_s4_u_s_b_8h.html +++ b/_p_s4_u_s_b_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4USB.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,14 +89,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PS4USB.h File Reference
-
#include "hiduniversal.h"
-#include "PS4Parser.h"
+
#include "hiduniversal.h"
+#include "PS4Parser.h"
Include dependency graph for PS4USB.h:
- + + + + + + +

Go to the source code of this file.

@@ -162,7 +169,7 @@ Macros diff --git a/_p_s4_u_s_b_8h__incl.map b/_p_s4_u_s_b_8h__incl.map index 6adb2977..479efdd9 100644 --- a/_p_s4_u_s_b_8h__incl.map +++ b/_p_s4_u_s_b_8h__incl.map @@ -1,8 +1,8 @@ - - - - - - + + + + + + diff --git a/_p_s4_u_s_b_8h__incl.md5 b/_p_s4_u_s_b_8h__incl.md5 index 6f81f265..9a8140ab 100644 --- a/_p_s4_u_s_b_8h__incl.md5 +++ b/_p_s4_u_s_b_8h__incl.md5 @@ -1 +1 @@ -6a42e5c2a682226199a7b2c36de96295 \ No newline at end of file +3d9cec3e6d601d983fe2992427af4c58 \ 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 37e0baf3..126e64cd 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 c3edaee2..c37d3cd4 100644 --- a/_p_s4_u_s_b_8h_source.html +++ b/_p_s4_u_s_b_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4USB.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,95 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 #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() {
-
48  return HIDUniversal::isReady() && HIDUniversal::VID == PS4_VID && (HIDUniversal::PID == PS4_PID || HIDUniversal::PID == PS4_PID_SLIM);
-
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
+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() {
48  return HIDUniversal::isReady() && HIDUniversal::VID == PS4_VID && (HIDUniversal::PID == PS4_PID || HIDUniversal::PID == PS4_PID_SLIM);
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[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
@@ -186,7 +99,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Definition: PS4USB.h:32
uint8_t flashOn
Definition: PS4Parser.h:119
-
HIDInterface hidInterfaces[maxHidInterfaces]
Definition: hiduniversal.h:65
uint16_t VID
Definition: hiduniversal.h:69
uint8_t g
Definition: PS4Parser.h:118
bool reportChanged
Definition: PS4Parser.h:120
@@ -217,7 +129,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s_buzz_8cpp.html b/_p_s_buzz_8cpp.html index cbce8dd8..700d6c01 100644 --- a/_p_s_buzz_8cpp.html +++ b/_p_s_buzz_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PSBuzz.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,13 +86,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PSBuzz.cpp File Reference
-
#include "PSBuzz.h"
+
#include "PSBuzz.h"
Include dependency graph for PSBuzz.cpp:
- + + + + + + +

Go to the source code of this file.

@@ -100,7 +107,7 @@ Include dependency graph for PSBuzz.cpp:
diff --git a/_p_s_buzz_8cpp__incl.map b/_p_s_buzz_8cpp__incl.map index 6b6dca0b..987cb529 100644 --- a/_p_s_buzz_8cpp__incl.map +++ b/_p_s_buzz_8cpp__incl.map @@ -1,8 +1,8 @@ - - - - - - + + + + + + diff --git a/_p_s_buzz_8cpp__incl.md5 b/_p_s_buzz_8cpp__incl.md5 index 12166ef9..b600c9e8 100644 --- a/_p_s_buzz_8cpp__incl.md5 +++ b/_p_s_buzz_8cpp__incl.md5 @@ -1 +1 @@ -e0ea176f5f8a648337d4d3cc906b2e53 \ No newline at end of file +4060fd39043c7564a19c22e4b422acd8 \ No newline at end of file diff --git a/_p_s_buzz_8cpp__incl.png b/_p_s_buzz_8cpp__incl.png index f37d28bc..3f05ab65 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 ede35247..f3a729a4 100644 --- a/_p_s_buzz_8cpp_source.html +++ b/_p_s_buzz_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PSBuzz.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,89 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 __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
+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
@@ -196,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s_buzz_8h.html b/_p_s_buzz_8h.html index 0fbe6830..8af28df2 100644 --- a/_p_s_buzz_8h.html +++ b/_p_s_buzz_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PSBuzz.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,21 +89,27 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
PSBuzz.h File Reference
-
#include "hiduniversal.h"
-#include "controllerEnums.h"
+
#include "hiduniversal.h"
+#include "controllerEnums.h"
Include dependency graph for PSBuzz.h:
- + + + + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -155,7 +162,7 @@ Macros diff --git a/_p_s_buzz_8h__dep__incl.map b/_p_s_buzz_8h__dep__incl.map index 18cbe6ec..4b2f91a5 100644 --- a/_p_s_buzz_8h__dep__incl.map +++ b/_p_s_buzz_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/_p_s_buzz_8h__dep__incl.md5 b/_p_s_buzz_8h__dep__incl.md5 index c02fe703..5caa0d46 100644 --- a/_p_s_buzz_8h__dep__incl.md5 +++ b/_p_s_buzz_8h__dep__incl.md5 @@ -1 +1 @@ -b1edc92eb077ae74eaa6c13520327464 \ No newline at end of file +88928a152c2f379aa7b4a52bc6f3da10 \ 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 22e0e65c..7730f098 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.map b/_p_s_buzz_8h__incl.map index 3b284d68..00d5a656 100644 --- a/_p_s_buzz_8h__incl.map +++ b/_p_s_buzz_8h__incl.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/_p_s_buzz_8h__incl.md5 b/_p_s_buzz_8h__incl.md5 index 581c44ba..801930e6 100644 --- a/_p_s_buzz_8h__incl.md5 +++ b/_p_s_buzz_8h__incl.md5 @@ -1 +1 @@ -9962a3586f77be3d87353d14649331ad \ No newline at end of file +460aa9dc1a3fdb1c5075c5daa680120f \ No newline at end of file diff --git a/_p_s_buzz_8h__incl.png b/_p_s_buzz_8h__incl.png index 71d0ea81..724fcd48 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 20e99ce7..642f24df 100644 --- a/_p_s_buzz_8h_source.html +++ b/_p_s_buzz_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PSBuzz.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,111 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 setLedToggle(uint8_t controller=0)
Definition: PSBuzz.h:132
@@ -224,7 +121,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 5ecda0dd..a5b29531 100644 --- a/_r_e_a_d_m_e_8md.html +++ b/_r_e_a_d_m_e_8md.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: README.md File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -92,7 +93,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_r_e_a_d_m_e_8md_source.html b/_r_e_a_d_m_e_8md_source.html index 471ffb57..087be603 100644 --- a/_r_e_a_d_m_e_8md_source.html +++ b/_r_e_a_d_m_e_8md_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: README.md Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,396 +86,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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?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: <https://felis.github.io/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 Several guides on how to use the PS4 library has been written by Dr. James E. Barger and are available at the following link: <https://sites.google.com/view/vbatc-engineeringtechnology2/control-system-tutorials/ps4-tutorials>.
-
195 
-
196 ### PS3 Library
-
197 
-
198 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.
-
199 
-
200 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.
-
201 
-
202 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.
-
203 
-
204 __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).
-
205 
-
206 For more information about the PS3 protocol see the official wiki: <https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information>.
-
207 
-
208 Also take a look at the blog posts:
-
209 
-
210 * <http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/>
-
211 * <http://www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library>
-
212 * <http://www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb>
-
213 
-
214 A special thanks go to the following people:
-
215 
-
216 1. _Richard Ibbotson_ who made this excellent guide: <http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part>
-
217 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>
-
218 
-
219 Also a big thanks all the people behind these sites about the Motion controller:
-
220 
-
221 * <http://thp.io/2010/psmove/>
-
222 * <http://www.copenhagengamecollective.org/unimove/>
-
223 * <https://github.com/thp/psmoveapi>
-
224 * <http://code.google.com/p/moveonpc/>
-
225 
-
226 ### Xbox Libraries
-
227 
-
228 The library supports both the original Xbox controller via USB and the Xbox 360 controller both via USB and wirelessly.
-
229 
-
230 #### Xbox library
-
231 
-
232 The [XBOXOLD](XBOXOLD.cpp) class implements support for the original Xbox controller via USB.
-
233 
-
234 All the information are from the following sites:
-
235 
-
236 * <https://github.com/torvalds/linux/blob/master/Documentation/input/xpad.txt>
-
237 * <https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c>
-
238 * <http://euc.jp/periphs/xbox-controller.ja.html>
-
239 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL#L15>
-
240 
-
241 #### Xbox 360 Library
-
242 
-
243 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).
-
244 
-
245 To use it via USB use the [XBOXUSB](XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](XBOXRECV.cpp) library.
-
246 
-
247 __Note that a Wireless controller can NOT be used via USB!__
-
248 
-
249 Examples code can be found in the [examples directory](examples/Xbox).
-
250 
-
251 Also see the following blog posts:
-
252 
-
253 * <http://www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library>
-
254 * <http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/>
-
255 * <http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/>
-
256 
-
257 All the information regarding the Xbox 360 controller protocol are form these sites:
-
258 
-
259 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo>
-
260 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo>
-
261 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL>
-
262 
-
263 #### Xbox ONE Library
-
264 
-
265 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:
-
266 
-
267 * <https://github.com/quantus/xbox-one-controller-protocol>
-
268 * <https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c>
-
269 * <https://github.com/kylelemons/xbox/blob/master/xbox.go>
-
270 
-
271 ### [Wii library](Wii.cpp)
-
272 
-
273 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.
-
274 
-
275 First you have to pair with the controller, this is done automatically by the library if you create the instance like so:
-
276 
-
277 ```C++
-
278 WII Wii(&Btd, PAIR);
-
279 ```
-
280 
-
281 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.
-
282 
-
283 After that you can simply create the instance like so:
-
284 
-
285 ```C++
-
286 WII Wii(&Btd);
-
287 ```
-
288 
-
289 Then just press any button on the Wiimote and it will then connect to the dongle.
-
290 
-
291 Take a look at the example for more information: [Wii.ino](examples/Bluetooth/Wii/Wii.ino).
-
292 
-
293 Also take a look at the blog post:
-
294 
-
295 * <http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/>
-
296 
-
297 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).
-
298 
-
299 The [WiiIRCamera.ino](examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino) example shows how it can be used.
-
300 
-
301 All the information about the Wii controllers are from these sites:
-
302 
-
303 * <http://wiibrew.org/wiki/Wiimote>
-
304 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers>
-
305 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck>
-
306 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus>
-
307 * <http://wiibrew.org/wiki/Wii_Balance_Board>
-
308 * The old library created by _Tomoyuki Tanaka_: <https://github.com/moyuchin/WiiRemote_on_Arduino> also helped a lot.
-
309 
-
310 ### [PS Buzz Library](PSBuzz.cpp)
-
311 
-
312 This library implements support for the Playstation Buzz controllers via USB.
-
313 
-
314 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.
-
315 
-
316 The example [PSBuzz.ino](examples/PSBuzz/PSBuzz.ino) shows how one can do this with just a few lines of code.
-
317 
-
318 More information about the controller can be found at the following sites:
-
319 
-
320 * http://www.developerfusion.com/article/84338/making-usb-c-friendly/
-
321 * https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c
-
322 
-
323 ### HID Libraries
-
324 
-
325 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).
-
326 
-
327 ### [MIDI Library](usbh_midi.cpp)
-
328 
-
329 The library support MIDI devices.
-
330 You can convert USB MIDI keyboard to legacy serial MIDI.
-
331 
-
332 * [USB_MIDI_converter.ino](examples/USBH_MIDI/USB_MIDI_converter/USB_MIDI_converter.ino)
-
333 * [USB_MIDI_converter_multi.ino](examples/USBH_MIDI/USB_MIDI_converter_multi/USB_MIDI_converter_multi.ino)
-
334 
-
335 For information see the following page: <http://yuuichiakagawa.github.io/USBH_MIDI/>.
-
336 
-
337 # Interface modifications
-
338 
-
339 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.
-
340 
-
341 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!
-
342 
-
343 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.
-
344 
-
345 After that you need modify the following entry in [UsbCore.h](UsbCore.h):
-
346 
-
347 ```C++
-
348 typedef MAX3421e<P10, P9> MAX3421E;
-
349 ```
-
350 
-
351 For instance if you have rerouted SS to pin 7 it should read:
-
352 
-
353 ```C++
-
354 typedef MAX3421e<P7, P9> MAX3421E;
-
355 ```
-
356 
-
357 See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information.
-
358 
-
359 # FAQ
-
360 
-
361 > When I plug my device into the USB connector nothing happens?
-
362 
-
363 * Try to connect a external power supply to the Arduino - this solves the problem in most cases.
-
364 * 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);```.
-
365 
-
366 > When I connecting my PS3 controller I get a output like this:
-
367 
-
368 ```
-
369 Dualshock 3 Controller Enabled
-
370 
-
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 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
-
375 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
-
376 ```
-
377 
-
378 * 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.
-
379 
-
380 > When compiling I am getting the following error: "fatal error: SPI.h: No such file or directory".
-
381 
-
382 * Please make sure to include the SPI library like so: ```#include <SPI.h>``` in your .ino file.
- -
Definition: UsbCore.h:210
-
+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: <https://felis.github.io/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 Several guides on how to use the PS4 library has been written by Dr. James E. Barger and are available at the following link: <https://sites.google.com/view/vbatc-engineeringtechnology2/control-system-tutorials/ps4-tutorials>.
195 
196 ### PS3 Library
197 
198 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.
199 
200 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.
201 
202 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.
203 
204 __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).
205 
206 For more information about the PS3 protocol see the official wiki: <https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information>.
207 
208 Also take a look at the blog posts:
209 
210 * <http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/>
211 * <http://www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library>
212 * <http://www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb>
213 
214 A special thanks go to the following people:
215 
216 1. _Richard Ibbotson_ who made this excellent guide: <http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part>
217 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>
218 
219 Also a big thanks all the people behind these sites about the Motion controller:
220 
221 * <http://thp.io/2010/psmove/>
222 * <http://www.copenhagengamecollective.org/unimove/>
223 * <https://github.com/thp/psmoveapi>
224 * <http://code.google.com/p/moveonpc/>
225 
226 ### Xbox Libraries
227 
228 The library supports both the original Xbox controller via USB and the Xbox 360 controller both via USB and wirelessly.
229 
230 #### Xbox library
231 
232 The [XBOXOLD](XBOXOLD.cpp) class implements support for the original Xbox controller via USB.
233 
234 All the information are from the following sites:
235 
236 * <https://github.com/torvalds/linux/blob/master/Documentation/input/xpad.txt>
237 * <https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c>
238 * <http://euc.jp/periphs/xbox-controller.ja.html>
239 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL#L15>
240 
241 #### Xbox 360 Library
242 
243 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).
244 
245 To use it via USB use the [XBOXUSB](XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](XBOXRECV.cpp) library.
246 
247 __Note that a Wireless controller can NOT be used via USB!__
248 
249 Examples code can be found in the [examples directory](examples/Xbox).
250 
251 Also see the following blog posts:
252 
253 * <http://www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library>
254 * <http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/>
255 * <http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/>
256 
257 All the information regarding the Xbox 360 controller protocol are form these sites:
258 
259 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo>
260 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo>
261 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL>
262 
263 #### Xbox ONE Library
264 
265 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:
266 
267 * <https://github.com/quantus/xbox-one-controller-protocol>
268 * <https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c>
269 * <https://github.com/kylelemons/xbox/blob/master/xbox.go>
270 
271 ### [Wii library](Wii.cpp)
272 
273 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.
274 
275 First you have to pair with the controller, this is done automatically by the library if you create the instance like so:
276 
277 ```C++
278 WII Wii(&Btd, PAIR);
279 ```
280 
281 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.
282 
283 After that you can simply create the instance like so:
284 
285 ```C++
286 WII Wii(&Btd);
287 ```
288 
289 Then just press any button on the Wiimote and it will then connect to the dongle.
290 
291 Take a look at the example for more information: [Wii.ino](examples/Bluetooth/Wii/Wii.ino).
292 
293 Also take a look at the blog post:
294 
295 * <http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/>
296 
297 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).
298 
299 The [WiiIRCamera.ino](examples/Bluetooth/WiiIRCamera/WiiIRCamera.ino) example shows how it can be used.
300 
301 All the information about the Wii controllers are from these sites:
302 
303 * <http://wiibrew.org/wiki/Wiimote>
304 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers>
305 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck>
306 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus>
307 * <http://wiibrew.org/wiki/Wii_Balance_Board>
308 * The old library created by _Tomoyuki Tanaka_: <https://github.com/moyuchin/WiiRemote_on_Arduino> also helped a lot.
309 
310 ### [PS Buzz Library](PSBuzz.cpp)
311 
312 This library implements support for the Playstation Buzz controllers via USB.
313 
314 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.
315 
316 The example [PSBuzz.ino](examples/PSBuzz/PSBuzz.ino) shows how one can do this with just a few lines of code.
317 
318 More information about the controller can be found at the following sites:
319 
320 * http://www.developerfusion.com/article/84338/making-usb-c-friendly/
321 * https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c
322 
323 ### HID Libraries
324 
325 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).
326 
327 ### [MIDI Library](usbh_midi.cpp)
328 
329 The library support MIDI devices.
330 You can convert USB MIDI keyboard to legacy serial MIDI.
331 
332 * [USB_MIDI_converter.ino](examples/USBH_MIDI/USB_MIDI_converter/USB_MIDI_converter.ino)
333 * [USB_MIDI_converter_multi.ino](examples/USBH_MIDI/USB_MIDI_converter_multi/USB_MIDI_converter_multi.ino)
334 
335 For information see the following page: <http://yuuichiakagawa.github.io/USBH_MIDI/>.
336 
337 # Interface modifications
338 
339 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.
340 
341 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!
342 
343 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.
344 
345 After that you need modify the following entry in [UsbCore.h](UsbCore.h):
346 
347 ```C++
348 typedef MAX3421e<P10, P9> MAX3421E;
349 ```
350 
351 For instance if you have rerouted SS to pin 7 it should read:
352 
353 ```C++
354 typedef MAX3421e<P7, P9> MAX3421E;
355 ```
356 
357 See the "Interface modifications" section in the [hardware manual](https://www.circuitsathome.com/usb-host-shield-hardware-manual) for more information.
358 
359 # FAQ
360 
361 > When I plug my device into the USB connector nothing happens?
362 
363 * Try to connect a external power supply to the Arduino - this solves the problem in most cases.
364 * 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);```.
365 
366 > When I connecting my PS3 controller I get a output like this:
367 
368 ```
369 Dualshock 3 Controller Enabled
370 
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 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
375 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
376 ```
377 
378 * 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.
379 
380 > When compiling I am getting the following error: "fatal error: SPI.h: No such file or directory".
381 
382 * 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 5f65f2b1..0fe47026 100644 --- a/_s_p_p_8cpp.html +++ b/_s_p_p_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: SPP.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -87,13 +88,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
SPP.cpp File Reference
-
#include "SPP.h"
+
#include "SPP.h"
Include dependency graph for SPP.cpp:
- + + + + + +

Go to the source code of this file.

@@ -113,25 +119,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
-
}
-
+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.

@@ -141,7 +129,7 @@ Variables diff --git a/_s_p_p_8cpp__incl.map b/_s_p_p_8cpp__incl.map index 809eca67..1406ed7c 100644 --- a/_s_p_p_8cpp__incl.map +++ b/_s_p_p_8cpp__incl.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/_s_p_p_8cpp__incl.md5 b/_s_p_p_8cpp__incl.md5 index ee84cbbd..2e490ec2 100644 --- a/_s_p_p_8cpp__incl.md5 +++ b/_s_p_p_8cpp__incl.md5 @@ -1 +1 @@ -92b48e8c203cabe9cbc2a2cb2aaccf77 \ No newline at end of file +13ec96c550e18a5b87013a932cc6a9c2 \ No newline at end of file diff --git a/_s_p_p_8cpp__incl.png b/_s_p_p_8cpp__incl.png index 791216ad..1ec1f231 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 e6b994c7..fc9e7d86 100644 --- a/_s_p_p_8cpp_source.html +++ b/_s_p_p_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: SPP.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,837 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 = (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 }
-
void(* pFuncOnInit)(void)
Definition: BTD.h:609
-
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:447
#define BT_RFCOMM_RPN_RSP
Definition: SPP.h:44
@@ -953,6 +124,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
void hci_disconnect(uint16_t handle)
Definition: BTD.cpp:1171
void Reset()
Definition: SPP.cpp:60
+
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
@@ -1001,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_s_p_p_8h.html b/_s_p_p_8h.html index 93cd3779..48c17338 100644 --- a/_s_p_p_8h.html +++ b/_s_p_p_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: SPP.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,20 +89,25 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
SPP.h File Reference
-
#include "BTD.h"
+
#include "BTD.h"
Include dependency graph for SPP.h:
- + + + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -360,7 +366,7 @@ Macros diff --git a/_s_p_p_8h__dep__incl.map b/_s_p_p_8h__dep__incl.map index c9e085c0..3133729f 100644 --- a/_s_p_p_8h__dep__incl.map +++ b/_s_p_p_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/_s_p_p_8h__dep__incl.md5 b/_s_p_p_8h__dep__incl.md5 index 7717c9a2..c4196b87 100644 --- a/_s_p_p_8h__dep__incl.md5 +++ b/_s_p_p_8h__dep__incl.md5 @@ -1 +1 @@ -1f51bc8d7e57994b0706c73aa078945c \ No newline at end of file +8fa503e9bcede23521cf22418b0e794e \ 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 83656373..78a4adfd 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.map b/_s_p_p_8h__incl.map index e0216b1a..93d857c5 100644 --- a/_s_p_p_8h__incl.map +++ b/_s_p_p_8h__incl.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/_s_p_p_8h__incl.md5 b/_s_p_p_8h__incl.md5 index 7a7361a7..f139a88d 100644 --- a/_s_p_p_8h__incl.md5 +++ b/_s_p_p_8h__incl.md5 @@ -1 +1 @@ -cce7880029982b20bba729fb2e78917d \ No newline at end of file +ebaf4a19e87d528fa81f6393cdd2bc87 \ No newline at end of file diff --git a/_s_p_p_8h__incl.png b/_s_p_p_8h__incl.png index 27935b34..d35d49e0 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 427578ba..a9c4d76c 100644 --- a/_s_p_p_8h_source.html +++ b/_s_p_p_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: SPP.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,160 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
SPP.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 _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
+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:201
@@ -262,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_u_h_s2__gpio_8cpp.html b/_u_h_s2__gpio_8cpp.html index d733f2e8..644958d5 100644 --- a/_u_h_s2__gpio_8cpp.html +++ b/_u_h_s2__gpio_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: UHS2_gpio.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,13 +86,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
UHS2_gpio.cpp File Reference
-
#include "UHS2_gpio.h"
+
#include "UHS2_gpio.h"
Include dependency graph for UHS2_gpio.cpp:
- + + +

Go to the source code of this file.

@@ -100,7 +103,7 @@ Include dependency graph for UHS2_gpio.cpp:
diff --git a/_u_h_s2__gpio_8cpp__incl.map b/_u_h_s2__gpio_8cpp__incl.map index be3fc23e..e6dfb4cc 100644 --- a/_u_h_s2__gpio_8cpp__incl.map +++ b/_u_h_s2__gpio_8cpp__incl.map @@ -1,4 +1,4 @@ - - + + diff --git a/_u_h_s2__gpio_8cpp__incl.md5 b/_u_h_s2__gpio_8cpp__incl.md5 index 7486a2d4..495959c8 100644 --- a/_u_h_s2__gpio_8cpp__incl.md5 +++ b/_u_h_s2__gpio_8cpp__incl.md5 @@ -1 +1 @@ -5cebe117c82aae024c0d654d4011616a \ No newline at end of file +5fafb4b045fd272c2cc9ebe047206021 \ No newline at end of file diff --git a/_u_h_s2__gpio_8cpp__incl.png b/_u_h_s2__gpio_8cpp__incl.png index 7cbae3c7..73717f56 100644 Binary files a/_u_h_s2__gpio_8cpp__incl.png and b/_u_h_s2__gpio_8cpp__incl.png differ diff --git a/_u_h_s2__gpio_8cpp_source.html b/_u_h_s2__gpio_8cpp_source.html index 3080c6d0..1c927537 100644 --- a/_u_h_s2__gpio_8cpp_source.html +++ b/_u_h_s2__gpio_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: UHS2_gpio.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,70 +86,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
UHS2_gpio.cpp
-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 UHS2_GPIO implements "wiring" style GPIO access. Implemented by Brian Walton brian@riban.co.uk
-
25  */
-
26 
-
27 #include "UHS2_gpio.h"
-
28 
-
32 UHS2_GPIO::UHS2_GPIO(USB *pUsb) : m_pUsb(pUsb)
-
33 {
-
34 }
-
35 
-
40 void UHS2_GPIO::digitalWrite(uint8_t pin, uint8_t val) {
-
41  if(pin > 7)
-
42  return;
-
43  uint8_t nValue = m_pUsb->gpioRdOutput();
-
44  uint8_t nMask = 1 << pin;
-
45  nValue &= (~nMask);
-
46  if(val)
-
47  nValue |= (nMask);
-
48  m_pUsb->gpioWr(nValue);
-
49 }
-
50 
-
55 int UHS2_GPIO::digitalRead(uint8_t pin) {
-
56  if(pin > 7)
-
57  return -1;
-
58  uint8_t nMask = 1 << pin;
-
59  uint8_t nValue = m_pUsb->gpioRd();
-
60  return ((nValue & nMask)?1:0);
-
61 }
-
62 
-
68 int UHS2_GPIO::digitalReadOutput(uint8_t pin) {
-
69  if(pin > 7)
-
70  return -1;
-
71  uint8_t nMask = 1 << pin;
-
72  uint8_t nValue = m_pUsb->gpioRdOutput();
-
73  return ((nValue & nMask)?1:0);
-
74 }
-
int digitalReadOutput(uint8_t pin)
Read the value from a GPIO output pin.
Definition: UHS2_gpio.cpp:68
+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 UHS2_GPIO implements "wiring" style GPIO access. Implemented by Brian Walton brian@riban.co.uk
25  */
26 
27 #include "UHS2_gpio.h"
28 
32 UHS2_GPIO::UHS2_GPIO(USB *pUsb) : m_pUsb(pUsb)
33 {
34 }
35 
40 void UHS2_GPIO::digitalWrite(uint8_t pin, uint8_t val) {
41  if(pin > 7)
42  return;
43  uint8_t nValue = m_pUsb->gpioRdOutput();
44  uint8_t nMask = 1 << pin;
45  nValue &= (~nMask);
46  if(val)
47  nValue |= (nMask);
48  m_pUsb->gpioWr(nValue);
49 }
50 
55 int UHS2_GPIO::digitalRead(uint8_t pin) {
56  if(pin > 7)
57  return -1;
58  uint8_t nMask = 1 << pin;
59  uint8_t nValue = m_pUsb->gpioRd();
60  return ((nValue & nMask)?1:0);
61 }
62 
68 int UHS2_GPIO::digitalReadOutput(uint8_t pin) {
69  if(pin > 7)
70  return -1;
71  uint8_t nMask = 1 << pin;
72  uint8_t nValue = m_pUsb->gpioRdOutput();
73  return ((nValue & nMask)?1:0);
74 }
int digitalReadOutput(uint8_t pin)
Read the value from a GPIO output pin.
Definition: UHS2_gpio.cpp:68
int digitalRead(uint8_t pin)
Read the value from a GPIO input pin.
Definition: UHS2_gpio.cpp:55
-
uint8_t gpioRdOutput()
Reads the current GPI output values.
Definition: usbhost.h:403
-
void gpioWr(uint8_t data)
Definition: usbhost.h:275
-
uint8_t gpioRd()
Reads the current GPI input values.
Definition: usbhost.h:390
+
uint8_t gpioRdOutput()
Reads the current GPI output values.
Definition: usbhost.h:397
+
void gpioWr(uint8_t data)
Definition: usbhost.h:269
+
uint8_t gpioRd()
Reads the current GPI input values.
Definition: usbhost.h:384
void digitalWrite(uint8_t pin, uint8_t val)
Set a GPIO output value.
Definition: UHS2_gpio.cpp:40
UHS2_GPIO(USB *pUsb)
Implement an instance of a UHS2_GPIO object.
Definition: UHS2_gpio.cpp:32
Definition: UsbCore.h:210
@@ -157,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_u_h_s2__gpio_8h.html b/_u_h_s2__gpio_8h.html index 9e6dad32..77a08868 100644 --- a/_u_h_s2__gpio_8h.html +++ b/_u_h_s2__gpio_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: UHS2_gpio.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -87,20 +88,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
UHS2_gpio.h File Reference
-
#include "Usb.h"
+
#include "Usb.h"
Include dependency graph for UHS2_gpio.h:
- + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -115,7 +118,7 @@ Classes diff --git a/_u_h_s2__gpio_8h__dep__incl.map b/_u_h_s2__gpio_8h__dep__incl.map index 1c7a5990..40c1ea6a 100644 --- a/_u_h_s2__gpio_8h__dep__incl.map +++ b/_u_h_s2__gpio_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/_u_h_s2__gpio_8h__dep__incl.md5 b/_u_h_s2__gpio_8h__dep__incl.md5 index dce6d804..775c25d5 100644 --- a/_u_h_s2__gpio_8h__dep__incl.md5 +++ b/_u_h_s2__gpio_8h__dep__incl.md5 @@ -1 +1 @@ -51334fbe4521a42c144b2eda1f0a1d4e \ No newline at end of file +06938a8200dab1f59b6abb10b81505aa \ No newline at end of file diff --git a/_u_h_s2__gpio_8h__dep__incl.png b/_u_h_s2__gpio_8h__dep__incl.png index 09b087eb..d862a7fb 100644 Binary files a/_u_h_s2__gpio_8h__dep__incl.png and b/_u_h_s2__gpio_8h__dep__incl.png differ diff --git a/_u_h_s2__gpio_8h__incl.map b/_u_h_s2__gpio_8h__incl.map index a1f406df..44170de2 100644 --- a/_u_h_s2__gpio_8h__incl.map +++ b/_u_h_s2__gpio_8h__incl.map @@ -1,3 +1,3 @@ - + diff --git a/_u_h_s2__gpio_8h__incl.md5 b/_u_h_s2__gpio_8h__incl.md5 index 29b3251d..56f165c8 100644 --- a/_u_h_s2__gpio_8h__incl.md5 +++ b/_u_h_s2__gpio_8h__incl.md5 @@ -1 +1 @@ -2c9161c2a6abcd83c0adca7c1b8a33b7 \ No newline at end of file +e72e517fae3443dc9284720e8b3abfc0 \ No newline at end of file diff --git a/_u_h_s2__gpio_8h__incl.png b/_u_h_s2__gpio_8h__incl.png index 3623a86f..c397057d 100644 Binary files a/_u_h_s2__gpio_8h__incl.png and b/_u_h_s2__gpio_8h__incl.png differ diff --git a/_u_h_s2__gpio_8h_source.html b/_u_h_s2__gpio_8h_source.html index 5c5a99ed..6286960b 100644 --- a/_u_h_s2__gpio_8h_source.html +++ b/_u_h_s2__gpio_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: UHS2_gpio.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,51 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
UHS2_gpio.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 UHS2_GPIO implements "wiring" style GPIO access. Implemented by Brian Walton brian@riban.co.uk
-
25  */
-
26 
-
27 #if !defined(__USB2_GPIO_H__)
-
28 #define __USB2_GPIO_H__
-
29 
-
30 #include "Usb.h"
-
31 
-
32 class UHS2_GPIO {
-
33 public:
-
34  UHS2_GPIO(USB *pUsb);
-
35 
-
36  void digitalWrite(uint8_t pin, uint8_t val);
-
37  int digitalRead(uint8_t pin);
-
38  int digitalReadOutput(uint8_t pin);
-
39 
-
40 private:
-
41  USB* m_pUsb;
-
42 };
-
43 
-
44 #endif // __USB2_GPIO_H__
-
int digitalReadOutput(uint8_t pin)
Read the value from a GPIO output pin.
Definition: UHS2_gpio.cpp:68
+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 UHS2_GPIO implements "wiring" style GPIO access. Implemented by Brian Walton brian@riban.co.uk
25  */
26 
27 #if !defined(__USB2_GPIO_H__)
28 #define __USB2_GPIO_H__
29 
30 #include "Usb.h"
31 
32 class UHS2_GPIO {
33 public:
34  UHS2_GPIO(USB *pUsb);
35 
36  void digitalWrite(uint8_t pin, uint8_t val);
37  int digitalRead(uint8_t pin);
38  int digitalReadOutput(uint8_t pin);
39 
40 private:
41  USB* m_pUsb;
42 };
43 
44 #endif // __USB2_GPIO_H__
int digitalReadOutput(uint8_t pin)
Read the value from a GPIO output pin.
Definition: UHS2_gpio.cpp:68
int digitalRead(uint8_t pin)
Read the value from a GPIO input pin.
Definition: UHS2_gpio.cpp:55
void digitalWrite(uint8_t pin, uint8_t val)
Set a GPIO output value.
Definition: UHS2_gpio.cpp:40
@@ -141,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_usb_8cpp.html b/_usb_8cpp.html index c75ed938..e37ba3d0 100644 --- a/_usb_8cpp.html +++ b/_usb_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Usb.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,13 +86,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Usb.cpp File Reference
-
#include "Usb.h"
+
#include "Usb.h"
Include dependency graph for Usb.cpp:
- + +

Go to the source code of this file.

@@ -100,7 +102,7 @@ Include dependency graph for Usb.cpp:
diff --git a/_usb_8cpp__incl.map b/_usb_8cpp__incl.map index 7b104a59..bfb3e69f 100644 --- a/_usb_8cpp__incl.map +++ b/_usb_8cpp__incl.map @@ -1,3 +1,3 @@ - + diff --git a/_usb_8cpp__incl.md5 b/_usb_8cpp__incl.md5 index e440b831..f71e6530 100644 --- a/_usb_8cpp__incl.md5 +++ b/_usb_8cpp__incl.md5 @@ -1 +1 @@ -86d6ea84d3f0ddc03b2836246a892476 \ No newline at end of file +983a9d4c5eeb9a3736dcb2d9192937eb \ No newline at end of file diff --git a/_usb_8cpp__incl.png b/_usb_8cpp__incl.png index bb5ebe33..6eb10631 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 7b185e1f..3a814fb1 100644 --- a/_usb_8cpp_source.html +++ b/_usb_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Usb.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,851 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 #if defined(ESP8266) || defined(ESP32)
-
168  yield(); // needed in order to reset the watchdog timer on the ESP8266
-
169 #endif
-
170  uint16_t read = nbytes;
-
171  //uint16_t read = (left<nbytes) ? left : nbytes;
-
172 
-
173  rcode = InTransfer(pep, nak_limit, &read, dataptr);
-
174  if(rcode == hrTOGERR) {
-
175  // yes, we flip it wrong here so that next time it is actually correct!
-
176  pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
-
177  continue;
-
178  }
-
179 
-
180  if(rcode)
-
181  return rcode;
-
182 
-
183  // Invoke callback function if inTransfer completed successfully and callback function pointer is specified
-
184  if(!rcode && p)
-
185  ((USBReadParser*)p)->Parse(read, dataptr, total - left);
-
186 
-
187  left -= read;
-
188 
-
189  if(read < nbytes)
-
190  break;
-
191  }
-
192  } else //OUT transfer
-
193  {
-
194  pep->bmSndToggle = 1; //bmSNDTOG1;
-
195  rcode = OutTransfer(pep, nak_limit, nbytes, dataptr);
-
196  }
-
197  if(rcode) //return error
-
198  return ( rcode);
-
199  }
-
200  // Status stage
-
201  return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction
-
202 }
-
203 
-
204 /* IN transfer to arbitrary endpoint. Assumes PERADDR is set. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
-
205 /* Keep sending INs and writes data to memory area pointed by 'data' */
-
206 
-
207 /* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error,
-
208  fe USB xfer timeout */
-
209 uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
-
210  EpInfo *pep = NULL;
-
211  uint16_t nak_limit = 0;
-
212 
-
213  uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit);
-
214 
-
215  if(rcode) {
-
216  USBTRACE3("(USB::InTransfer) SetAddress Failed ", rcode, 0x81);
-
217  USBTRACE3("(USB::InTransfer) addr requested ", addr, 0x81);
-
218  USBTRACE3("(USB::InTransfer) ep requested ", ep, 0x81);
-
219  return rcode;
-
220  }
-
221  return InTransfer(pep, nak_limit, nbytesptr, data, bInterval);
-
222 }
-
223 
-
224 uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
-
225  uint8_t rcode = 0;
-
226  uint8_t pktsize;
-
227 
-
228  uint16_t nbytes = *nbytesptr;
-
229  //printf("Requesting %i bytes ", nbytes);
-
230  uint8_t maxpktsize = pep->maxPktSize;
-
231 
-
232  *nbytesptr = 0;
-
233  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
-
234 
-
235  // use a 'break' to exit this loop
-
236  while(1) {
-
237 #if defined(ESP8266) || defined(ESP32)
-
238  yield(); // needed in order to reset the watchdog timer on the ESP8266
-
239 #endif
-
240  rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS.
-
241  if(rcode == hrTOGERR) {
-
242  // yes, we flip it wrong here so that next time it is actually correct!
-
243  pep->bmRcvToggle = (regRd(rHRSL) & bmRCVTOGRD) ? 0 : 1;
-
244  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
-
245  continue;
-
246  }
-
247  if(rcode) {
-
248  //printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
-
249  break; //should be 0, indicating ACK. Else return error code.
-
250  }
-
251  /* check for RCVDAVIRQ and generate error if not present
-
252  * the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred.
-
253  * Need to add handling for that
-
254  *
-
255  * NOTE: I've seen this happen with SPI corruption -- xxxajk
-
256  */
-
257  if((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) {
-
258  //printf(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n");
-
259  rcode = 0xf0; //receive error
-
260  break;
-
261  }
-
262  pktsize = regRd(rRCVBC); //number of received bytes
-
263  //printf("Got %i bytes \r\n", pktsize);
-
264  // This would be OK, but...
-
265  //assert(pktsize <= nbytes);
-
266  if(pktsize > nbytes) {
-
267  // This can happen. Use of assert on Arduino locks up the Arduino.
-
268  // So I will trim the value, and hope for the best.
-
269  //printf(">>>>>>>> Problem! Wanted %i bytes but got %i.\r\n", nbytes, pktsize);
-
270  pktsize = nbytes;
-
271  }
-
272 
-
273  int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr);
-
274 
-
275  if(mem_left < 0)
-
276  mem_left = 0;
-
277 
-
278  data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data);
-
279 
-
280  regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer
-
281  *nbytesptr += pktsize; // add this packet's byte count to total transfer length
-
282 
-
283  /* The transfer is complete under two conditions: */
-
284  /* 1. The device sent a short packet (L.T. maxPacketSize) */
-
285  /* 2. 'nbytes' have been transferred. */
-
286  if((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes?
-
287  {
-
288  // Save toggle value
-
289  pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0;
-
290  //printf("\r\n");
-
291  rcode = 0;
-
292  break;
-
293  } else if(bInterval > 0)
-
294  delay(bInterval); // Delay according to polling interval
-
295  } //while( 1 )
-
296  return ( rcode);
-
297 }
-
298 
-
299 /* OUT transfer to arbitrary endpoint. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
-
300 /* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer */
-
301 
-
302 /* rcode 0 if no errors. rcode 01-0f is relayed from HRSL */
-
303 uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
-
304  EpInfo *pep = NULL;
-
305  uint16_t nak_limit = 0;
-
306 
-
307  uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit);
-
308 
-
309  if(rcode)
-
310  return rcode;
-
311 
-
312  return OutTransfer(pep, nak_limit, nbytes, data);
-
313 }
-
314 
-
315 uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) {
-
316  uint8_t rcode = hrSUCCESS, retry_count;
-
317  uint8_t *data_p = data; //local copy of the data pointer
-
318  uint16_t bytes_tosend, nak_count;
-
319  uint16_t bytes_left = nbytes;
-
320 
-
321  uint8_t maxpktsize = pep->maxPktSize;
-
322 
-
323  if(maxpktsize < 1 || maxpktsize > 64)
- -
325 
-
326  uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT;
-
327 
-
328  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
-
329 
-
330  while(bytes_left) {
-
331 #if defined(ESP8266) || defined(ESP32)
-
332  yield(); // needed in order to reset the watchdog timer on the ESP8266
-
333 #endif
-
334  retry_count = 0;
-
335  nak_count = 0;
-
336  bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left;
-
337  bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO
-
338  regWr(rSNDBC, bytes_tosend); //set number of bytes
-
339  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
-
340  while(!(regRd(rHIRQ) & bmHXFRDNIRQ)){
-
341 #if defined(ESP8266) || defined(ESP32)
-
342  yield(); // needed in order to reset the watchdog timer on the ESP8266
-
343 #endif
-
344  } //wait for the completion IRQ
-
345  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
-
346  rcode = (regRd(rHRSL) & 0x0f);
-
347 
-
348  while(rcode && ((int32_t)((uint32_t)millis() - timeout) < 0L)) {
-
349 #if defined(ESP8266) || defined(ESP32)
-
350  yield(); // needed in order to reset the watchdog timer on the ESP8266
-
351 #endif
-
352  switch(rcode) {
-
353  case hrNAK:
-
354  nak_count++;
-
355  if(nak_limit && (nak_count == nak_limit))
-
356  goto breakout;
-
357  //return ( rcode);
-
358  break;
-
359  case hrTIMEOUT:
-
360  retry_count++;
-
361  if(retry_count == USB_RETRY_LIMIT)
-
362  goto breakout;
-
363  //return ( rcode);
-
364  break;
-
365  case hrTOGERR:
-
366  // yes, we flip it wrong here so that next time it is actually correct!
-
367  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
-
368  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
-
369  break;
-
370  default:
-
371  goto breakout;
-
372  }//switch( rcode
-
373 
-
374  /* process NAK according to Host out NAK bug */
-
375  regWr(rSNDBC, 0);
-
376  regWr(rSNDFIFO, *data_p);
-
377  regWr(rSNDBC, bytes_tosend);
-
378  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
-
379  while(!(regRd(rHIRQ) & bmHXFRDNIRQ)){
-
380 #if defined(ESP8266) || defined(ESP32)
-
381  yield(); // needed in order to reset the watchdog timer on the ESP8266
-
382 #endif
-
383  } //wait for the completion IRQ
-
384  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
-
385  rcode = (regRd(rHRSL) & 0x0f);
-
386  }//while( rcode && ....
-
387  bytes_left -= bytes_tosend;
-
388  data_p += bytes_tosend;
-
389  }//while( bytes_left...
-
390 breakout:
-
391 
-
392  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle
-
393  return ( rcode); //should be 0 in all cases
-
394 }
-
395 /* dispatch USB packet. Assumes peripheral address is set and relevant buffer is loaded/empty */
-
396 /* If NAK, tries to re-send up to nak_limit times */
-
397 /* If nak_limit == 0, do not count NAKs, exit after timeout */
-
398 /* If bus timeout, re-sends up to USB_RETRY_LIMIT times */
-
399 
-
400 /* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout */
-
401 uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
-
402  uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT;
-
403  uint8_t tmpdata;
-
404  uint8_t rcode = hrSUCCESS;
-
405  uint8_t retry_count = 0;
-
406  uint16_t nak_count = 0;
-
407 
-
408  while((int32_t)((uint32_t)millis() - timeout) < 0L) {
-
409 #if defined(ESP8266) || defined(ESP32)
-
410  yield(); // needed in order to reset the watchdog timer on the ESP8266
-
411 #endif
-
412  regWr(rHXFR, (token | ep)); //launch the transfer
- -
414 
-
415  while((int32_t)((uint32_t)millis() - timeout) < 0L) //wait for transfer completion
-
416  {
-
417 #if defined(ESP8266) || defined(ESP32)
-
418  yield(); // needed in order to reset the watchdog timer on the ESP8266
-
419 #endif
-
420  tmpdata = regRd(rHIRQ);
-
421 
-
422  if(tmpdata & bmHXFRDNIRQ) {
-
423  regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt
-
424  rcode = 0x00;
-
425  break;
-
426  }//if( tmpdata & bmHXFRDNIRQ
-
427 
-
428  }//while ( millis() < timeout
-
429 
-
430  //if (rcode != 0x00) //exit if timeout
-
431  // return ( rcode);
-
432 
-
433  rcode = (regRd(rHRSL) & 0x0f); //analyze transfer result
-
434 
-
435  switch(rcode) {
-
436  case hrNAK:
-
437  nak_count++;
-
438  if(nak_limit && (nak_count == nak_limit))
-
439  return (rcode);
-
440  break;
-
441  case hrTIMEOUT:
-
442  retry_count++;
-
443  if(retry_count == USB_RETRY_LIMIT)
-
444  return (rcode);
-
445  break;
-
446  default:
-
447  return (rcode);
-
448  }//switch( rcode
-
449 
-
450  }//while( timeout > millis()
-
451  return ( rcode);
-
452 }
-
453 
-
454 /* USB main task. Performs enumeration/cleanup */
-
455 void USB::Task(void) //USB state machine
-
456 {
-
457  uint8_t rcode;
-
458  uint8_t tmpdata;
-
459  static uint32_t delay = 0;
-
460  //USB_DEVICE_DESCRIPTOR buf;
-
461  bool lowspeed = false;
-
462 
-
463  MAX3421E::Task();
-
464 
-
465  tmpdata = getVbusState();
-
466 
-
467  /* modify USB task state if Vbus changed */
-
468  switch(tmpdata) {
-
469  case SE1: //illegal state
-
470  usb_task_state = USB_DETACHED_SUBSTATE_ILLEGAL;
-
471  lowspeed = false;
-
472  break;
-
473  case SE0: //disconnected
-
474  if((usb_task_state & USB_STATE_MASK) != USB_STATE_DETACHED)
-
475  usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE;
-
476  lowspeed = false;
-
477  break;
-
478  case LSHOST:
-
479 
-
480  lowspeed = true;
-
481  //intentional fallthrough
-
482  case FSHOST: //attached
-
483  if((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
-
484  delay = (uint32_t)millis() + USB_SETTLE_DELAY;
-
485  usb_task_state = USB_ATTACHED_SUBSTATE_SETTLE;
-
486  }
-
487  break;
-
488  }// switch( tmpdata
-
489 
-
490  for(uint8_t i = 0; i < USB_NUMDEVICES; i++)
-
491  if(devConfig[i])
-
492  rcode = devConfig[i]->Poll();
-
493 
-
494  switch(usb_task_state) {
- -
496  init();
-
497 
-
498  for(uint8_t i = 0; i < USB_NUMDEVICES; i++)
-
499  if(devConfig[i])
-
500  rcode = devConfig[i]->Release();
-
501 
-
502  usb_task_state = USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE;
-
503  break;
-
504  case USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE: //just sit here
-
505  break;
-
506  case USB_DETACHED_SUBSTATE_ILLEGAL: //just sit here
-
507  break;
-
508  case USB_ATTACHED_SUBSTATE_SETTLE: //settle time for just attached device
-
509  if((int32_t)((uint32_t)millis() - delay) >= 0L)
-
510  usb_task_state = USB_ATTACHED_SUBSTATE_RESET_DEVICE;
-
511  else break; // don't fall through
- -
513  regWr(rHCTL, bmBUSRST); //issue bus reset
- -
515  break;
- -
517  if((regRd(rHCTL) & bmBUSRST) == 0) {
-
518  tmpdata = regRd(rMODE) | bmSOFKAENAB; //start SOF generation
-
519  regWr(rMODE, tmpdata);
-
520  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_SOF;
-
521  //delay = (uint32_t)millis() + 20; //20ms wait after reset per USB spec
-
522  }
-
523  break;
-
524  case USB_ATTACHED_SUBSTATE_WAIT_SOF: //todo: change check order
-
525  if(regRd(rHIRQ) & bmFRAMEIRQ) {
-
526  //when first SOF received _and_ 20ms has passed we can continue
-
527  /*
-
528  if (delay < (uint32_t)millis()) //20ms passed
-
529  usb_task_state = USB_STATE_CONFIGURING;
-
530  */
-
531  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET;
-
532  delay = (uint32_t)millis() + 20;
-
533  }
-
534  break;
- -
536  if((int32_t)((uint32_t)millis() - delay) >= 0L) usb_task_state = USB_STATE_CONFIGURING;
-
537  else break; // don't fall through
- -
539 
-
540  //Serial.print("\r\nConf.LS: ");
-
541  //Serial.println(lowspeed, HEX);
-
542 
-
543  rcode = Configuring(0, 0, lowspeed);
-
544 
-
545  if(rcode) {
- -
547  usb_error = rcode;
-
548  usb_task_state = USB_STATE_ERROR;
-
549  }
-
550  } else
-
551  usb_task_state = USB_STATE_RUNNING;
-
552  break;
-
553  case USB_STATE_RUNNING:
-
554  break;
-
555  case USB_STATE_ERROR:
-
556  //MAX3421E::Init();
-
557  break;
-
558  } // switch( usb_task_state )
-
559 }
-
560 
-
561 uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
-
562  //uint8_t buf[12];
-
563  uint8_t rcode;
-
564  UsbDevice *p0 = NULL, *p = NULL;
-
565 
-
566  // Get pointer to pseudo device with address 0 assigned
-
567  p0 = addrPool.GetUsbDevicePtr(0);
-
568 
-
569  if(!p0)
- -
571 
-
572  if(!p0->epinfo)
- -
574 
-
575  p0->lowspeed = (lowspeed) ? true : false;
-
576 
-
577  // Allocate new address according to device class
-
578  uint8_t bAddress = addrPool.AllocAddress(parent, false, port);
-
579 
-
580  if(!bAddress)
- -
582 
-
583  p = addrPool.GetUsbDevicePtr(bAddress);
-
584 
-
585  if(!p)
- -
587 
-
588  p->lowspeed = lowspeed;
-
589 
-
590  // Assign new address to the device
-
591  rcode = setAddr(0, 0, bAddress);
-
592 
-
593  if(rcode) {
-
594  addrPool.FreeAddress(bAddress);
-
595  bAddress = 0;
-
596  return rcode;
-
597  }
-
598  return 0;
-
599 };
-
600 
-
601 uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed) {
-
602  //printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port);
-
603  uint8_t retries = 0;
-
604 
-
605 again:
-
606  uint8_t rcode = devConfig[driver]->ConfigureDevice(parent, port, lowspeed);
- -
608  if(parent == 0) {
-
609  // Send a bus reset on the root interface.
-
610  regWr(rHCTL, bmBUSRST); //issue bus reset
-
611  delay(102); // delay 102ms, compensate for clock inaccuracy.
-
612  } else {
-
613  // reset parent port
-
614  devConfig[parent]->ResetHubPort(port);
-
615  }
-
616  } else if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works
-
617  delay(100);
-
618  retries++;
-
619  goto again;
-
620  } else if(rcode)
-
621  return rcode;
-
622 
-
623  rcode = devConfig[driver]->Init(parent, port, lowspeed);
-
624  if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works
-
625  delay(100);
-
626  retries++;
-
627  goto again;
-
628  }
-
629  if(rcode) {
-
630  // Issue a bus reset, because the device may be in a limbo state
-
631  if(parent == 0) {
-
632  // Send a bus reset on the root interface.
-
633  regWr(rHCTL, bmBUSRST); //issue bus reset
-
634  delay(102); // delay 102ms, compensate for clock inaccuracy.
-
635  } else {
-
636  // reset parent port
-
637  devConfig[parent]->ResetHubPort(port);
-
638  }
-
639  }
-
640  return rcode;
-
641 }
-
642 
-
643 /*
-
644  * This is broken. We need to enumerate differently.
-
645  * It causes major problems with several devices if detected in an unexpected order.
-
646  *
-
647  *
-
648  * Oleg - I wouldn't do anything before the newly connected device is considered sane.
-
649  * i.e.(delays are not indicated for brevity):
-
650  * 1. reset
-
651  * 2. GetDevDescr();
-
652  * 3a. If ACK, continue with allocating address, addressing, etc.
-
653  * 3b. Else reset again, count resets, stop at some number (5?).
-
654  * 4. When max.number of resets is reached, toggle power/fail
-
655  * 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()
-
656  * it doesn't need to be reset again
-
657  * New steps proposal:
-
658  * 1: get address pool instance. exit on fail
-
659  * 2: pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf). exit on fail.
-
660  * 3: bus reset, 100ms delay
-
661  * 4: set address
-
662  * 5: pUsb->setEpInfoEntry(bAddress, 1, epInfo), exit on fail
-
663  * 6: while (configurations) {
-
664  * for(each configuration) {
-
665  * for (each driver) {
-
666  * 6a: Ask device if it likes configuration. Returns 0 on OK.
-
667  * If successful, the driver configured device.
-
668  * The driver now owns the endpoints, and takes over managing them.
-
669  * The following will need codes:
-
670  * Everything went well, instance consumed, exit with success.
-
671  * Instance already in use, ignore it, try next driver.
-
672  * Not a supported device, ignore it, try next driver.
-
673  * Not a supported configuration for this device, ignore it, try next driver.
-
674  * Could not configure device, fatal, exit with fail.
-
675  * }
-
676  * }
-
677  * }
-
678  * 7: for(each driver) {
-
679  * 7a: Ask device if it knows this VID/PID. Acts exactly like 6a, but using VID/PID
-
680  * 8: if we get here, no driver likes the device plugged in, so exit failure.
-
681  *
-
682  */
-
683 uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
-
684  //uint8_t bAddress = 0;
-
685  //printf("Configuring: parent = %i, port = %i\r\n", parent, port);
-
686  uint8_t devConfigIndex;
-
687  uint8_t rcode = 0;
-
688  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
-
689  USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
-
690  UsbDevice *p = NULL;
-
691  EpInfo *oldep_ptr = NULL;
-
692  EpInfo epInfo;
-
693 
-
694  epInfo.epAddr = 0;
-
695  epInfo.maxPktSize = 8;
-
696  epInfo.bmSndToggle = 0;
-
697  epInfo.bmRcvToggle = 0;
-
698  epInfo.bmNakPower = USB_NAK_MAX_POWER;
-
699 
-
700  //delay(2000);
-
701  AddressPool &addrPool = GetAddressPool();
-
702  // Get pointer to pseudo device with address 0 assigned
-
703  p = addrPool.GetUsbDevicePtr(0);
-
704  if(!p) {
-
705  //printf("Configuring error: USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL\r\n");
- -
707  }
-
708 
-
709  // Save old pointer to EP_RECORD of address 0
-
710  oldep_ptr = p->epinfo;
-
711 
-
712  // Temporary assign new pointer to epInfo to p->epinfo in order to
-
713  // avoid toggle inconsistence
-
714 
-
715  p->epinfo = &epInfo;
-
716 
-
717  p->lowspeed = lowspeed;
-
718  // Get device descriptor
-
719  rcode = getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
-
720 
-
721  // Restore p->epinfo
-
722  p->epinfo = oldep_ptr;
-
723 
-
724  if(rcode) {
-
725  //printf("Configuring error: Can't get USB_DEVICE_DESCRIPTOR\r\n");
-
726  return rcode;
-
727  }
-
728 
-
729  // to-do?
-
730  // Allocate new address according to device class
-
731  //bAddress = addrPool.AllocAddress(parent, false, port);
-
732 
-
733  uint16_t vid = udd->idVendor;
-
734  uint16_t pid = udd->idProduct;
-
735  uint8_t klass = udd->bDeviceClass;
-
736  uint8_t subklass = udd->bDeviceSubClass;
-
737  // Attempt to configure if VID/PID or device class matches with a driver
-
738  // Qualify with subclass too.
-
739  //
-
740  // VID/PID & class tests default to false for drivers not yet ported
-
741  // subclass defaults to true, so you don't have to define it if you don't have to.
-
742  //
-
743  for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
-
744  if(!devConfig[devConfigIndex]) continue; // no driver
-
745  if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
-
746  if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) {
-
747  rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
- -
749  break;
-
750  }
-
751  }
-
752 
-
753  if(devConfigIndex < USB_NUMDEVICES) {
-
754  return rcode;
-
755  }
-
756 
-
757 
-
758  // blindly attempt to configure
-
759  for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
-
760  if(!devConfig[devConfigIndex]) continue;
-
761  if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
-
762  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
-
763  rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
-
764 
-
765  //printf("ERROR ENUMERATING %2.2x\r\n", rcode);
- -
767  // in case of an error dev_index should be reset to 0
-
768  // in order to start from the very beginning the
-
769  // next time the program gets here
-
770  //if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE)
-
771  // devConfigIndex = 0;
-
772  return rcode;
-
773  }
-
774  }
-
775  // if we get here that means that the device class is not supported by any of registered classes
-
776  rcode = DefaultAddressing(parent, port, lowspeed);
-
777 
-
778  return rcode;
-
779 }
-
780 
-
781 uint8_t USB::ReleaseDevice(uint8_t addr) {
-
782  if(!addr)
-
783  return 0;
-
784 
-
785  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
-
786  if(!devConfig[i]) continue;
-
787  if(devConfig[i]->GetAddress() == addr)
-
788  return devConfig[i]->Release();
-
789  }
-
790  return 0;
-
791 }
-
792 
-
793 #if 1
-
794 //get device descriptor
-
795 
-
796 uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
-
797  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL));
-
798 }
-
799 //get configuration descriptor
-
800 
-
801 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
-
802  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL));
-
803 }
-
804 
-
805 /* 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
-
806  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 */
-
807 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
-
808  const uint8_t bufSize = 64;
-
809  uint8_t buf[bufSize];
-
810  USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
-
811 
-
812  uint8_t ret = getConfDescr(addr, ep, 9, conf, buf);
-
813 
-
814  if(ret)
-
815  return ret;
-
816 
-
817  uint16_t total = ucd->wTotalLength;
-
818 
-
819  //USBTRACE2("\r\ntotal conf.size:", total);
-
820 
-
821  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, total, bufSize, buf, p));
-
822 }
-
823 
-
824 //get string descriptor
-
825 
-
826 uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
-
827  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL));
-
828 }
-
829 //set address
-
830 
-
831 uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
-
832  uint8_t rcode = ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL);
-
833  //delay(2); //per USB 2.0 sect.9.2.6.3
-
834  delay(300); // Older spec says you should wait at least 200ms
-
835  return rcode;
-
836  //return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
-
837 }
-
838 //set configuration
-
839 
-
840 uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
-
841  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
-
842 }
-
843 
-
844 #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:801
+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 #if defined(ESP8266) || defined(ESP32)
168  yield(); // needed in order to reset the watchdog timer on the ESP8266
169 #endif
170  uint16_t read = nbytes;
171  //uint16_t read = (left<nbytes) ? left : nbytes;
172 
173  rcode = InTransfer(pep, nak_limit, &read, dataptr);
174  if(rcode == hrTOGERR) {
175  // yes, we flip it wrong here so that next time it is actually correct!
176  pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
177  continue;
178  }
179 
180  if(rcode)
181  return rcode;
182 
183  // Invoke callback function if inTransfer completed successfully and callback function pointer is specified
184  if(!rcode && p)
185  ((USBReadParser*)p)->Parse(read, dataptr, total - left);
186 
187  left -= read;
188 
189  if(read < nbytes)
190  break;
191  }
192  } else //OUT transfer
193  {
194  pep->bmSndToggle = 1; //bmSNDTOG1;
195  rcode = OutTransfer(pep, nak_limit, nbytes, dataptr);
196  }
197  if(rcode) //return error
198  return ( rcode);
199  }
200  // Status stage
201  return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction
202 }
203 
204 /* IN transfer to arbitrary endpoint. Assumes PERADDR is set. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
205 /* Keep sending INs and writes data to memory area pointed by 'data' */
206 
207 /* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error,
208  fe USB xfer timeout */
209 uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
210  EpInfo *pep = NULL;
211  uint16_t nak_limit = 0;
212 
213  uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit);
214 
215  if(rcode) {
216  USBTRACE3("(USB::InTransfer) SetAddress Failed ", rcode, 0x81);
217  USBTRACE3("(USB::InTransfer) addr requested ", addr, 0x81);
218  USBTRACE3("(USB::InTransfer) ep requested ", ep, 0x81);
219  return rcode;
220  }
221  return InTransfer(pep, nak_limit, nbytesptr, data, bInterval);
222 }
223 
224 uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) {
225  uint8_t rcode = 0;
226  uint8_t pktsize;
227 
228  uint16_t nbytes = *nbytesptr;
229  //printf("Requesting %i bytes ", nbytes);
230  uint8_t maxpktsize = pep->maxPktSize;
231 
232  *nbytesptr = 0;
233  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
234 
235  // use a 'break' to exit this loop
236  while(1) {
237 #if defined(ESP8266) || defined(ESP32)
238  yield(); // needed in order to reset the watchdog timer on the ESP8266
239 #endif
240  rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS.
241  if(rcode == hrTOGERR) {
242  // yes, we flip it wrong here so that next time it is actually correct!
243  pep->bmRcvToggle = (regRd(rHRSL) & bmRCVTOGRD) ? 0 : 1;
244  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
245  continue;
246  }
247  if(rcode) {
248  //printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
249  break; //should be 0, indicating ACK. Else return error code.
250  }
251  /* check for RCVDAVIRQ and generate error if not present
252  * the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred.
253  * Need to add handling for that
254  *
255  * NOTE: I've seen this happen with SPI corruption -- xxxajk
256  */
257  if((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) {
258  //printf(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n");
259  rcode = 0xf0; //receive error
260  break;
261  }
262  pktsize = regRd(rRCVBC); //number of received bytes
263  //printf("Got %i bytes \r\n", pktsize);
264  // This would be OK, but...
265  //assert(pktsize <= nbytes);
266  if(pktsize > nbytes) {
267  // This can happen. Use of assert on Arduino locks up the Arduino.
268  // So I will trim the value, and hope for the best.
269  //printf(">>>>>>>> Problem! Wanted %i bytes but got %i.\r\n", nbytes, pktsize);
270  pktsize = nbytes;
271  }
272 
273  int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr);
274 
275  if(mem_left < 0)
276  mem_left = 0;
277 
278  data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data);
279 
280  regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer
281  *nbytesptr += pktsize; // add this packet's byte count to total transfer length
282 
283  /* The transfer is complete under two conditions: */
284  /* 1. The device sent a short packet (L.T. maxPacketSize) */
285  /* 2. 'nbytes' have been transferred. */
286  if((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes?
287  {
288  // Save toggle value
289  pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0;
290  //printf("\r\n");
291  rcode = 0;
292  break;
293  } else if(bInterval > 0)
294  delay(bInterval); // Delay according to polling interval
295  } //while( 1 )
296  return ( rcode);
297 }
298 
299 /* OUT transfer to arbitrary endpoint. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
300 /* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer */
301 
302 /* rcode 0 if no errors. rcode 01-0f is relayed from HRSL */
303 uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
304  EpInfo *pep = NULL;
305  uint16_t nak_limit = 0;
306 
307  uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit);
308 
309  if(rcode)
310  return rcode;
311 
312  return OutTransfer(pep, nak_limit, nbytes, data);
313 }
314 
315 uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) {
316  uint8_t rcode = hrSUCCESS, retry_count;
317  uint8_t *data_p = data; //local copy of the data pointer
318  uint16_t bytes_tosend, nak_count;
319  uint16_t bytes_left = nbytes;
320 
321  uint8_t maxpktsize = pep->maxPktSize;
322 
323  if(maxpktsize < 1 || maxpktsize > 64)
325 
326  uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT;
327 
328  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
329 
330  while(bytes_left) {
331 #if defined(ESP8266) || defined(ESP32)
332  yield(); // needed in order to reset the watchdog timer on the ESP8266
333 #endif
334  retry_count = 0;
335  nak_count = 0;
336  bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left;
337  bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO
338  regWr(rSNDBC, bytes_tosend); //set number of bytes
339  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
340  while(!(regRd(rHIRQ) & bmHXFRDNIRQ)){
341 #if defined(ESP8266) || defined(ESP32)
342  yield(); // needed in order to reset the watchdog timer on the ESP8266
343 #endif
344  } //wait for the completion IRQ
345  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
346  rcode = (regRd(rHRSL) & 0x0f);
347 
348  while(rcode && ((int32_t)((uint32_t)millis() - timeout) < 0L)) {
349 #if defined(ESP8266) || defined(ESP32)
350  yield(); // needed in order to reset the watchdog timer on the ESP8266
351 #endif
352  switch(rcode) {
353  case hrNAK:
354  nak_count++;
355  if(nak_limit && (nak_count == nak_limit))
356  goto breakout;
357  //return ( rcode);
358  break;
359  case hrTIMEOUT:
360  retry_count++;
361  if(retry_count == USB_RETRY_LIMIT)
362  goto breakout;
363  //return ( rcode);
364  break;
365  case hrTOGERR:
366  // yes, we flip it wrong here so that next time it is actually correct!
367  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
368  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
369  break;
370  default:
371  goto breakout;
372  }//switch( rcode
373 
374  /* process NAK according to Host out NAK bug */
375  regWr(rSNDBC, 0);
376  regWr(rSNDFIFO, *data_p);
377  regWr(rSNDBC, bytes_tosend);
378  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
379  while(!(regRd(rHIRQ) & bmHXFRDNIRQ)){
380 #if defined(ESP8266) || defined(ESP32)
381  yield(); // needed in order to reset the watchdog timer on the ESP8266
382 #endif
383  } //wait for the completion IRQ
384  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
385  rcode = (regRd(rHRSL) & 0x0f);
386  }//while( rcode && ....
387  bytes_left -= bytes_tosend;
388  data_p += bytes_tosend;
389  }//while( bytes_left...
390 breakout:
391 
392  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle
393  return ( rcode); //should be 0 in all cases
394 }
395 /* dispatch USB packet. Assumes peripheral address is set and relevant buffer is loaded/empty */
396 /* If NAK, tries to re-send up to nak_limit times */
397 /* If nak_limit == 0, do not count NAKs, exit after timeout */
398 /* If bus timeout, re-sends up to USB_RETRY_LIMIT times */
399 
400 /* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout */
401 uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
402  uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT;
403  uint8_t tmpdata;
404  uint8_t rcode = hrSUCCESS;
405  uint8_t retry_count = 0;
406  uint16_t nak_count = 0;
407 
408  while((int32_t)((uint32_t)millis() - timeout) < 0L) {
409 #if defined(ESP8266) || defined(ESP32)
410  yield(); // needed in order to reset the watchdog timer on the ESP8266
411 #endif
412  regWr(rHXFR, (token | ep)); //launch the transfer
414 
415  while((int32_t)((uint32_t)millis() - timeout) < 0L) //wait for transfer completion
416  {
417 #if defined(ESP8266) || defined(ESP32)
418  yield(); // needed in order to reset the watchdog timer on the ESP8266
419 #endif
420  tmpdata = regRd(rHIRQ);
421 
422  if(tmpdata & bmHXFRDNIRQ) {
423  regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt
424  rcode = 0x00;
425  break;
426  }//if( tmpdata & bmHXFRDNIRQ
427 
428  }//while ( millis() < timeout
429 
430  //if (rcode != 0x00) //exit if timeout
431  // return ( rcode);
432 
433  rcode = (regRd(rHRSL) & 0x0f); //analyze transfer result
434 
435  switch(rcode) {
436  case hrNAK:
437  nak_count++;
438  if(nak_limit && (nak_count == nak_limit))
439  return (rcode);
440  break;
441  case hrTIMEOUT:
442  retry_count++;
443  if(retry_count == USB_RETRY_LIMIT)
444  return (rcode);
445  break;
446  default:
447  return (rcode);
448  }//switch( rcode
449 
450  }//while( timeout > millis()
451  return ( rcode);
452 }
453 
454 /* USB main task. Performs enumeration/cleanup */
455 void USB::Task(void) //USB state machine
456 {
457  uint8_t rcode;
458  uint8_t tmpdata;
459  static uint32_t delay = 0;
460  //USB_DEVICE_DESCRIPTOR buf;
461  bool lowspeed = false;
462 
463  MAX3421E::Task();
464 
465  tmpdata = getVbusState();
466 
467  /* modify USB task state if Vbus changed */
468  switch(tmpdata) {
469  case SE1: //illegal state
470  usb_task_state = USB_DETACHED_SUBSTATE_ILLEGAL;
471  lowspeed = false;
472  break;
473  case SE0: //disconnected
474  if((usb_task_state & USB_STATE_MASK) != USB_STATE_DETACHED)
475  usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE;
476  lowspeed = false;
477  break;
478  case LSHOST:
479 
480  lowspeed = true;
481  //intentional fallthrough
482  case FSHOST: //attached
483  if((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
484  delay = (uint32_t)millis() + USB_SETTLE_DELAY;
485  usb_task_state = USB_ATTACHED_SUBSTATE_SETTLE;
486  }
487  break;
488  }// switch( tmpdata
489 
490  for(uint8_t i = 0; i < USB_NUMDEVICES; i++)
491  if(devConfig[i])
492  rcode = devConfig[i]->Poll();
493 
494  switch(usb_task_state) {
496  init();
497 
498  for(uint8_t i = 0; i < USB_NUMDEVICES; i++)
499  if(devConfig[i])
500  rcode = devConfig[i]->Release();
501 
502  usb_task_state = USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE;
503  break;
504  case USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE: //just sit here
505  break;
506  case USB_DETACHED_SUBSTATE_ILLEGAL: //just sit here
507  break;
508  case USB_ATTACHED_SUBSTATE_SETTLE: //settle time for just attached device
509  if((int32_t)((uint32_t)millis() - delay) >= 0L)
510  usb_task_state = USB_ATTACHED_SUBSTATE_RESET_DEVICE;
511  else break; // don't fall through
513  regWr(rHCTL, bmBUSRST); //issue bus reset
515  break;
517  if((regRd(rHCTL) & bmBUSRST) == 0) {
518  tmpdata = regRd(rMODE) | bmSOFKAENAB; //start SOF generation
519  regWr(rMODE, tmpdata);
520  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_SOF;
521  //delay = (uint32_t)millis() + 20; //20ms wait after reset per USB spec
522  }
523  break;
524  case USB_ATTACHED_SUBSTATE_WAIT_SOF: //todo: change check order
525  if(regRd(rHIRQ) & bmFRAMEIRQ) {
526  //when first SOF received _and_ 20ms has passed we can continue
527  /*
528  if (delay < (uint32_t)millis()) //20ms passed
529  usb_task_state = USB_STATE_CONFIGURING;
530  */
531  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET;
532  delay = (uint32_t)millis() + 20;
533  }
534  break;
536  if((int32_t)((uint32_t)millis() - delay) >= 0L) usb_task_state = USB_STATE_CONFIGURING;
537  else break; // don't fall through
539 
540  //Serial.print("\r\nConf.LS: ");
541  //Serial.println(lowspeed, HEX);
542 
543  rcode = Configuring(0, 0, lowspeed);
544 
545  if(rcode) {
547  usb_error = rcode;
548  usb_task_state = USB_STATE_ERROR;
549  }
550  } else
551  usb_task_state = USB_STATE_RUNNING;
552  break;
553  case USB_STATE_RUNNING:
554  break;
555  case USB_STATE_ERROR:
556  //MAX3421E::Init();
557  break;
558  } // switch( usb_task_state )
559 }
560 
561 uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
562  //uint8_t buf[12];
563  uint8_t rcode;
564  UsbDevice *p0 = NULL, *p = NULL;
565 
566  // Get pointer to pseudo device with address 0 assigned
567  p0 = addrPool.GetUsbDevicePtr(0);
568 
569  if(!p0)
571 
572  if(!p0->epinfo)
574 
575  p0->lowspeed = (lowspeed) ? true : false;
576 
577  // Allocate new address according to device class
578  uint8_t bAddress = addrPool.AllocAddress(parent, false, port);
579 
580  if(!bAddress)
582 
583  p = addrPool.GetUsbDevicePtr(bAddress);
584 
585  if(!p)
587 
588  p->lowspeed = lowspeed;
589 
590  // Assign new address to the device
591  rcode = setAddr(0, 0, bAddress);
592 
593  if(rcode) {
594  addrPool.FreeAddress(bAddress);
595  bAddress = 0;
596  return rcode;
597  }
598  return 0;
599 };
600 
601 uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed) {
602  //printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port);
603  uint8_t retries = 0;
604 
605 again:
606  uint8_t rcode = devConfig[driver]->ConfigureDevice(parent, port, lowspeed);
608  if(parent == 0) {
609  // Send a bus reset on the root interface.
610  regWr(rHCTL, bmBUSRST); //issue bus reset
611  delay(102); // delay 102ms, compensate for clock inaccuracy.
612  } else {
613  // reset parent port
614  devConfig[parent]->ResetHubPort(port);
615  }
616  } else if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works
617  delay(100);
618  retries++;
619  goto again;
620  } else if(rcode)
621  return rcode;
622 
623  rcode = devConfig[driver]->Init(parent, port, lowspeed);
624  if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works
625  delay(100);
626  retries++;
627  goto again;
628  }
629  if(rcode) {
630  // Issue a bus reset, because the device may be in a limbo state
631  if(parent == 0) {
632  // Send a bus reset on the root interface.
633  regWr(rHCTL, bmBUSRST); //issue bus reset
634  delay(102); // delay 102ms, compensate for clock inaccuracy.
635  } else {
636  // reset parent port
637  devConfig[parent]->ResetHubPort(port);
638  }
639  }
640  return rcode;
641 }
642 
643 /*
644  * This is broken. We need to enumerate differently.
645  * It causes major problems with several devices if detected in an unexpected order.
646  *
647  *
648  * Oleg - I wouldn't do anything before the newly connected device is considered sane.
649  * i.e.(delays are not indicated for brevity):
650  * 1. reset
651  * 2. GetDevDescr();
652  * 3a. If ACK, continue with allocating address, addressing, etc.
653  * 3b. Else reset again, count resets, stop at some number (5?).
654  * 4. When max.number of resets is reached, toggle power/fail
655  * 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()
656  * it doesn't need to be reset again
657  * New steps proposal:
658  * 1: get address pool instance. exit on fail
659  * 2: pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf). exit on fail.
660  * 3: bus reset, 100ms delay
661  * 4: set address
662  * 5: pUsb->setEpInfoEntry(bAddress, 1, epInfo), exit on fail
663  * 6: while (configurations) {
664  * for(each configuration) {
665  * for (each driver) {
666  * 6a: Ask device if it likes configuration. Returns 0 on OK.
667  * If successful, the driver configured device.
668  * The driver now owns the endpoints, and takes over managing them.
669  * The following will need codes:
670  * Everything went well, instance consumed, exit with success.
671  * Instance already in use, ignore it, try next driver.
672  * Not a supported device, ignore it, try next driver.
673  * Not a supported configuration for this device, ignore it, try next driver.
674  * Could not configure device, fatal, exit with fail.
675  * }
676  * }
677  * }
678  * 7: for(each driver) {
679  * 7a: Ask device if it knows this VID/PID. Acts exactly like 6a, but using VID/PID
680  * 8: if we get here, no driver likes the device plugged in, so exit failure.
681  *
682  */
683 uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
684  //uint8_t bAddress = 0;
685  //printf("Configuring: parent = %i, port = %i\r\n", parent, port);
686  uint8_t devConfigIndex;
687  uint8_t rcode = 0;
688  uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
689  USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast<USB_DEVICE_DESCRIPTOR *>(buf);
690  UsbDevice *p = NULL;
691  EpInfo *oldep_ptr = NULL;
692  EpInfo epInfo;
693 
694  epInfo.epAddr = 0;
695  epInfo.maxPktSize = 8;
696  epInfo.bmSndToggle = 0;
697  epInfo.bmRcvToggle = 0;
698  epInfo.bmNakPower = USB_NAK_MAX_POWER;
699 
700  //delay(2000);
701  AddressPool &addrPool = GetAddressPool();
702  // Get pointer to pseudo device with address 0 assigned
703  p = addrPool.GetUsbDevicePtr(0);
704  if(!p) {
705  //printf("Configuring error: USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL\r\n");
707  }
708 
709  // Save old pointer to EP_RECORD of address 0
710  oldep_ptr = p->epinfo;
711 
712  // Temporary assign new pointer to epInfo to p->epinfo in order to
713  // avoid toggle inconsistence
714 
715  p->epinfo = &epInfo;
716 
717  p->lowspeed = lowspeed;
718  // Get device descriptor
719  rcode = getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
720 
721  // Restore p->epinfo
722  p->epinfo = oldep_ptr;
723 
724  if(rcode) {
725  //printf("Configuring error: Can't get USB_DEVICE_DESCRIPTOR\r\n");
726  return rcode;
727  }
728 
729  // to-do?
730  // Allocate new address according to device class
731  //bAddress = addrPool.AllocAddress(parent, false, port);
732 
733  uint16_t vid = udd->idVendor;
734  uint16_t pid = udd->idProduct;
735  uint8_t klass = udd->bDeviceClass;
736  uint8_t subklass = udd->bDeviceSubClass;
737  // Attempt to configure if VID/PID or device class matches with a driver
738  // Qualify with subclass too.
739  //
740  // VID/PID & class tests default to false for drivers not yet ported
741  // subclass defaults to true, so you don't have to define it if you don't have to.
742  //
743  for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
744  if(!devConfig[devConfigIndex]) continue; // no driver
745  if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
746  if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) {
747  rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
749  break;
750  }
751  }
752 
753  if(devConfigIndex < USB_NUMDEVICES) {
754  return rcode;
755  }
756 
757 
758  // blindly attempt to configure
759  for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
760  if(!devConfig[devConfigIndex]) continue;
761  if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
762  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
763  rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
764 
765  //printf("ERROR ENUMERATING %2.2x\r\n", rcode);
767  // in case of an error dev_index should be reset to 0
768  // in order to start from the very beginning the
769  // next time the program gets here
770  //if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE)
771  // devConfigIndex = 0;
772  return rcode;
773  }
774  }
775  // if we get here that means that the device class is not supported by any of registered classes
776  rcode = DefaultAddressing(parent, port, lowspeed);
777 
778  return rcode;
779 }
780 
781 uint8_t USB::ReleaseDevice(uint8_t addr) {
782  if(!addr)
783  return 0;
784 
785  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
786  if(!devConfig[i]) continue;
787  if(devConfig[i]->GetAddress() == addr)
788  return devConfig[i]->Release();
789  }
790  return 0;
791 }
792 
793 #if 1
794 //get device descriptor
795 
796 uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
797  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL));
798 }
799 //get configuration descriptor
800 
801 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
802  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL));
803 }
804 
805 /* 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
806  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 */
807 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
808  const uint8_t bufSize = 64;
809  uint8_t buf[bufSize];
810  USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR *>(buf);
811 
812  uint8_t ret = getConfDescr(addr, ep, 9, conf, buf);
813 
814  if(ret)
815  return ret;
816 
817  uint16_t total = ucd->wTotalLength;
818 
819  //USBTRACE2("\r\ntotal conf.size:", total);
820 
821  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, total, bufSize, buf, p));
822 }
823 
824 //get string descriptor
825 
826 uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
827  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL));
828 }
829 //set address
830 
831 uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
832  uint8_t rcode = ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL);
833  //delay(2); //per USB 2.0 sect.9.2.6.3
834  delay(300); // Older spec says you should wait at least 200ms
835  return rcode;
836  //return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
837 }
838 //set configuration
839 
840 uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
841  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
842 }
843 
844 #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:801
uint8_t bmRcvToggle
Definition: address.h:48
virtual uint8_t Poll()
Definition: UsbCore.h:149
@@ -966,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
#define hrJERR
Definition: max3421e.h:227
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:141
-
uint8_t Task()
Definition: usbhost.h:544
+
uint8_t Task()
Definition: usbhost.h:538
#define hrSUCCESS
Definition: max3421e.h:214
#define USB_STATE_ERROR
Definition: UsbCore.h:132
uint8_t bmRequestType
Definition: UsbCore.h:179
@@ -999,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
#define rSNDBC
Definition: max3421e.h:48
#define rHRSL
Definition: max3421e.h:203
#define USB_ATTACHED_SUBSTATE_RESET_DEVICE
Definition: UsbCore.h:124
-
uint8_t * bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
Definition: usbhost.h:323
+
uint8_t * bytesRd(uint8_t reg, uint8_t nbytes, uint8_t *data_p)
Definition: usbhost.h:317
#define tokINHS
Definition: max3421e.h:198
#define bmLOWSPEED
Definition: max3421e.h:171
virtual void ResetHubPort(uint8_t port)
Definition: UsbCore.h:157
@@ -1036,7 +193,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit)
Definition: Usb.cpp:401
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:137
#define bmSNDTOG0
Definition: max3421e.h:189
-
uint8_t regRd(uint8_t reg)
Definition: usbhost.h:284
+
uint8_t regRd(uint8_t reg)
Definition: usbhost.h:278
uint8_t maxPktSize
Definition: address.h:41
AddressPool & GetAddressPool()
Definition: UsbCore.h:226
#define USB_ERROR_INVALID_ARGUMENT
Definition: UsbCore.h:97
@@ -1072,7 +229,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_usb_8h.html b/_usb_8h.html index 127961a9..7f13d5b2 100644 --- a/_usb_8h.html +++ b/_usb_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Usb.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -90,7 +91,56 @@ This graph shows which files directly or indirectly include this file:
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Go to the source code of this file.

@@ -99,7 +149,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 ecef921b..0318b392 100644 --- a/_usb_8h__dep__incl.map +++ b/_usb_8h__dep__incl.map @@ -1,51 +1,51 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/_usb_8h__dep__incl.md5 b/_usb_8h__dep__incl.md5 index b41a3e43..d05d3dae 100644 --- a/_usb_8h__dep__incl.md5 +++ b/_usb_8h__dep__incl.md5 @@ -1 +1 @@ -03547f0a42b1834a5e9c578b39482572 \ No newline at end of file +02dd4b5bb74a4b06471e56603cb1a320 \ No newline at end of file diff --git a/_usb_8h__dep__incl.png b/_usb_8h__dep__incl.png index c2d3dd81..fb2d7566 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 d2b3c585..0966b20f 100644 --- a/_usb_8h_source.html +++ b/_usb_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Usb.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,55 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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_
- +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_
@@ -151,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_usb_core_8h.html b/_usb_core_8h.html index f0e6f370..97ed3c35 100644 --- a/_usb_core_8h.html +++ b/_usb_core_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: UsbCore.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -1074,7 +1075,7 @@ Typedefs diff --git a/_usb_core_8h_source.html b/_usb_core_8h_source.html index c3babd81..8555e335 100644 --- a/_usb_core_8h_source.html +++ b/_usb_core_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: UsbCore.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,367 +86,42 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
UsbCore.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 #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 #elif (defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__))
-
54 typedef MAX3421e<Pb4, Pb3> MAX3421E; // Sanguino
-
55 #else
-
56 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
-
57 #endif
-
58 
-
59 /* Common setup data constant combinations */
-
60 #define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type
-
61 #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'
-
62 #define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type
-
63 
-
64 // D7 data transfer direction (0 - host-to-device, 1 - device-to-host)
-
65 // D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)
-
66 // D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)
-
67 
-
68 // USB Device Classes
-
69 #define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors
-
70 #define USB_CLASS_AUDIO 0x01 // Audio
-
71 #define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control
-
72 #define USB_CLASS_HID 0x03 // HID
-
73 #define USB_CLASS_PHYSICAL 0x05 // Physical
-
74 #define USB_CLASS_IMAGE 0x06 // Image
-
75 #define USB_CLASS_PRINTER 0x07 // Printer
-
76 #define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage
-
77 #define USB_CLASS_HUB 0x09 // Hub
-
78 #define USB_CLASS_CDC_DATA 0x0a // CDC-Data
-
79 #define USB_CLASS_SMART_CARD 0x0b // Smart-Card
-
80 #define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security
-
81 #define USB_CLASS_VIDEO 0x0e // Video
-
82 #define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare
-
83 #define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device
-
84 #define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller
-
85 #define USB_CLASS_MISC 0xef // Miscellaneous
-
86 #define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific
-
87 #define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific
-
88 
-
89 // Additional Error Codes
-
90 #define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1
-
91 #define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
-
92 #define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
-
93 #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
-
94 #define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5
-
95 #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6
-
96 #define USB_ERROR_EPINFO_IS_NULL 0xD7
-
97 #define USB_ERROR_INVALID_ARGUMENT 0xD8
-
98 #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9
-
99 #define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA
-
100 #define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB
-
101 #define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET 0xE0
-
102 #define USB_ERROR_FailGetDevDescr 0xE1
-
103 #define USB_ERROR_FailSetDevTblEntry 0xE2
-
104 #define USB_ERROR_FailGetConfDescr 0xE3
-
105 #define USB_ERROR_TRANSFER_TIMEOUT 0xFF
-
106 
-
107 #define USB_XFER_TIMEOUT 5000 // (5000) USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec
-
108 //#define USB_NAK_LIMIT 32000 // NAK limit for a transfer. 0 means NAKs are not counted
-
109 #define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer
-
110 #define USB_SETTLE_DELAY 200 // settle delay in milliseconds
-
111 
-
112 #define USB_NUMDEVICES 16 //number of USB devices
-
113 //#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
-
114 #define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
-
115 
-
116 /* USB state machine states */
-
117 #define USB_STATE_MASK 0xf0
-
118 
-
119 #define USB_STATE_DETACHED 0x10
-
120 #define USB_DETACHED_SUBSTATE_INITIALIZE 0x11
-
121 #define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12
-
122 #define USB_DETACHED_SUBSTATE_ILLEGAL 0x13
-
123 #define USB_ATTACHED_SUBSTATE_SETTLE 0x20
-
124 #define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30
-
125 #define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40
-
126 #define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50
-
127 #define USB_ATTACHED_SUBSTATE_WAIT_RESET 0x51
-
128 #define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60
-
129 #define USB_STATE_ADDRESSING 0x70
-
130 #define USB_STATE_CONFIGURING 0x80
-
131 #define USB_STATE_RUNNING 0x90
-
132 #define USB_STATE_ERROR 0xa0
-
133 
- -
135 public:
-
136 
-
137  virtual uint8_t Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed __attribute__((unused))) {
-
138  return 0;
-
139  }
-
140 
-
141  virtual uint8_t ConfigureDevice(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed __attribute__((unused))) {
-
142  return 0;
-
143  }
-
144 
-
145  virtual uint8_t Release() {
-
146  return 0;
-
147  }
-
148 
-
149  virtual uint8_t Poll() {
-
150  return 0;
-
151  }
-
152 
-
153  virtual uint8_t GetAddress() {
-
154  return 0;
-
155  }
-
156 
-
157  virtual void ResetHubPort(uint8_t port __attribute__((unused))) {
-
158  return;
-
159  } // Note used for hubs only!
-
160 
-
161  virtual bool VIDPIDOK(uint16_t vid __attribute__((unused)), uint16_t pid __attribute__((unused))) {
-
162  return false;
-
163  }
-
164 
-
165  virtual bool DEVCLASSOK(uint8_t klass __attribute__((unused))) {
-
166  return false;
-
167  }
-
168 
-
169  virtual bool DEVSUBCLASSOK(uint8_t subklass __attribute__((unused))) {
-
170  return true;
-
171  }
-
172 
-
173 };
-
174 
-
175 /* USB Setup Packet Structure */
-
176 typedef struct {
-
177 
-
178  union { // offset description
-
179  uint8_t bmRequestType; // 0 Bit-map of request type
-
180 
-
181  struct {
-
182  uint8_t recipient : 5; // Recipient of the request
-
183  uint8_t type : 2; // Type of request
-
184  uint8_t direction : 1; // Direction of data X-fer
-
185  } __attribute__((packed));
-
186  } ReqType_u;
-
187  uint8_t bRequest; // 1 Request
-
188 
-
189  union {
-
190  uint16_t wValue; // 2 Depends on bRequest
-
191 
-
192  struct {
-
193  uint8_t wValueLo;
-
194  uint8_t wValueHi;
-
195  } __attribute__((packed));
-
196  } wVal_u;
-
197  uint16_t wIndex; // 4 Depends on bRequest
-
198  uint16_t wLength; // 6 Depends on bRequest
-
199 } __attribute__((packed)) SETUP_PKT, *PSETUP_PKT;
-
200 
-
201 
-
202 
-
203 // Base class for incoming data parser
-
204 
- -
206 public:
-
207  virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) = 0;
-
208 };
-
209 
-
210 class USB : public MAX3421E {
- -
212  USBDeviceConfig* devConfig[USB_NUMDEVICES];
-
213  uint8_t bmHubPre;
-
214 
-
215 public:
-
216  USB(void);
-
217 
-
218  void SetHubPreMask() {
-
219  bmHubPre |= bmHUBPRE;
-
220  };
-
221 
- -
223  bmHubPre &= (~bmHUBPRE);
-
224  };
-
225 
- -
227  return (AddressPool&)addrPool;
-
228  };
-
229 
- -
231  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
-
232  if(!devConfig[i]) {
-
233  devConfig[i] = pdev;
-
234  return 0;
-
235  }
-
236  }
- -
238  };
-
239 
- -
241  addrPool.ForEachUsbDevice(pfunc);
-
242  };
-
243  uint8_t getUsbTaskState(void);
-
244  void setUsbTaskState(uint8_t state);
-
245 
-
246  EpInfo* getEpInfoEntry(uint8_t addr, uint8_t ep);
-
247  uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr);
-
248 
-
249  /* Control requests */
-
250  uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr);
-
251  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr);
-
252 
-
253  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p);
-
254 
-
255  uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr);
-
256  uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr);
-
257  uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value);
-
258 
-
259  uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, bool direction);
-
260  uint8_t ctrlStatus(uint8_t ep, bool direction, uint16_t nak_limit);
-
261  uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval = 0);
-
262  uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
-
263  uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit);
-
264 
-
265  void Task(void);
-
266 
-
267  uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed);
-
268  uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed);
-
269  uint8_t ReleaseDevice(uint8_t addr);
-
270 
-
271  uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
-
272  uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p);
-
273 
-
274 private:
-
275  void init();
-
276  uint8_t SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit);
-
277  uint8_t OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data);
-
278  uint8_t InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval = 0);
-
279  uint8_t AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed);
-
280 };
-
281 
-
282 #if 0 //defined(USB_METHODS_INLINE)
-
283 //get device descriptor
-
284 
-
285 inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
-
286  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, dataptr));
-
287 }
-
288 //get configuration descriptor
-
289 
-
290 inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
-
291  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, dataptr));
-
292 }
-
293 //get string descriptor
-
294 
-
295 inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {
-
296  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, nuint8_ts, dataptr));
-
297 }
-
298 //set address
-
299 
-
300 inline uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
-
301  return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, NULL));
-
302 }
-
303 //set configuration
-
304 
-
305 inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
-
306  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, NULL));
-
307 }
-
308 
-
309 #endif // defined(USB_METHODS_INLINE)
-
310 
-
311 #endif /* USBCORE_H */
-
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:801
+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 #elif (defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__))
54 typedef MAX3421e<Pb4, Pb3> MAX3421E; // Sanguino
55 #else
56 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
57 #endif
58 
59 /* Common setup data constant combinations */
60 #define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type
61 #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'
62 #define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type
63 
64 // D7 data transfer direction (0 - host-to-device, 1 - device-to-host)
65 // D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)
66 // D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)
67 
68 // USB Device Classes
69 #define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors
70 #define USB_CLASS_AUDIO 0x01 // Audio
71 #define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control
72 #define USB_CLASS_HID 0x03 // HID
73 #define USB_CLASS_PHYSICAL 0x05 // Physical
74 #define USB_CLASS_IMAGE 0x06 // Image
75 #define USB_CLASS_PRINTER 0x07 // Printer
76 #define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage
77 #define USB_CLASS_HUB 0x09 // Hub
78 #define USB_CLASS_CDC_DATA 0x0a // CDC-Data
79 #define USB_CLASS_SMART_CARD 0x0b // Smart-Card
80 #define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security
81 #define USB_CLASS_VIDEO 0x0e // Video
82 #define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare
83 #define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device
84 #define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller
85 #define USB_CLASS_MISC 0xef // Miscellaneous
86 #define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific
87 #define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific
88 
89 // Additional Error Codes
90 #define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1
91 #define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
92 #define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
93 #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
94 #define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5
95 #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6
96 #define USB_ERROR_EPINFO_IS_NULL 0xD7
97 #define USB_ERROR_INVALID_ARGUMENT 0xD8
98 #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9
99 #define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA
100 #define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB
101 #define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET 0xE0
102 #define USB_ERROR_FailGetDevDescr 0xE1
103 #define USB_ERROR_FailSetDevTblEntry 0xE2
104 #define USB_ERROR_FailGetConfDescr 0xE3
105 #define USB_ERROR_TRANSFER_TIMEOUT 0xFF
106 
107 #define USB_XFER_TIMEOUT 5000 // (5000) USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec
108 //#define USB_NAK_LIMIT 32000 // NAK limit for a transfer. 0 means NAKs are not counted
109 #define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer
110 #define USB_SETTLE_DELAY 200 // settle delay in milliseconds
111 
112 #define USB_NUMDEVICES 16 //number of USB devices
113 //#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
114 #define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
115 
116 /* USB state machine states */
117 #define USB_STATE_MASK 0xf0
118 
119 #define USB_STATE_DETACHED 0x10
120 #define USB_DETACHED_SUBSTATE_INITIALIZE 0x11
121 #define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12
122 #define USB_DETACHED_SUBSTATE_ILLEGAL 0x13
123 #define USB_ATTACHED_SUBSTATE_SETTLE 0x20
124 #define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30
125 #define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40
126 #define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50
127 #define USB_ATTACHED_SUBSTATE_WAIT_RESET 0x51
128 #define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60
129 #define USB_STATE_ADDRESSING 0x70
130 #define USB_STATE_CONFIGURING 0x80
131 #define USB_STATE_RUNNING 0x90
132 #define USB_STATE_ERROR 0xa0
133 
135 public:
136 
137  virtual uint8_t Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed __attribute__((unused))) {
138  return 0;
139  }
140 
141  virtual uint8_t ConfigureDevice(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed __attribute__((unused))) {
142  return 0;
143  }
144 
145  virtual uint8_t Release() {
146  return 0;
147  }
148 
149  virtual uint8_t Poll() {
150  return 0;
151  }
152 
153  virtual uint8_t GetAddress() {
154  return 0;
155  }
156 
157  virtual void ResetHubPort(uint8_t port __attribute__((unused))) {
158  return;
159  } // Note used for hubs only!
160 
161  virtual bool VIDPIDOK(uint16_t vid __attribute__((unused)), uint16_t pid __attribute__((unused))) {
162  return false;
163  }
164 
165  virtual bool DEVCLASSOK(uint8_t klass __attribute__((unused))) {
166  return false;
167  }
168 
169  virtual bool DEVSUBCLASSOK(uint8_t subklass __attribute__((unused))) {
170  return true;
171  }
172 
173 };
174 
175 /* USB Setup Packet Structure */
176 typedef struct {
177 
178  union { // offset description
179  uint8_t bmRequestType; // 0 Bit-map of request type
180 
181  struct {
182  uint8_t recipient : 5; // Recipient of the request
183  uint8_t type : 2; // Type of request
184  uint8_t direction : 1; // Direction of data X-fer
185  } __attribute__((packed));
186  } ReqType_u;
187  uint8_t bRequest; // 1 Request
188 
189  union {
190  uint16_t wValue; // 2 Depends on bRequest
191 
192  struct {
193  uint8_t wValueLo;
194  uint8_t wValueHi;
195  } __attribute__((packed));
196  } wVal_u;
197  uint16_t wIndex; // 4 Depends on bRequest
198  uint16_t wLength; // 6 Depends on bRequest
199 } __attribute__((packed)) SETUP_PKT, *PSETUP_PKT;
200 
201 
202 
203 // Base class for incoming data parser
204 
206 public:
207  virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) = 0;
208 };
209 
210 class USB : public MAX3421E {
212  USBDeviceConfig* devConfig[USB_NUMDEVICES];
213  uint8_t bmHubPre;
214 
215 public:
216  USB(void);
217 
218  void SetHubPreMask() {
219  bmHubPre |= bmHUBPRE;
220  };
221 
223  bmHubPre &= (~bmHUBPRE);
224  };
225 
227  return (AddressPool&)addrPool;
228  };
229 
231  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
232  if(!devConfig[i]) {
233  devConfig[i] = pdev;
234  return 0;
235  }
236  }
238  };
239 
241  addrPool.ForEachUsbDevice(pfunc);
242  };
243  uint8_t getUsbTaskState(void);
244  void setUsbTaskState(uint8_t state);
245 
246  EpInfo* getEpInfoEntry(uint8_t addr, uint8_t ep);
247  uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr);
248 
249  /* Control requests */
250  uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr);
251  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr);
252 
253  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p);
254 
255  uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr);
256  uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr);
257  uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value);
258 
259  uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, bool direction);
260  uint8_t ctrlStatus(uint8_t ep, bool direction, uint16_t nak_limit);
261  uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval = 0);
262  uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
263  uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit);
264 
265  void Task(void);
266 
267  uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed);
268  uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed);
269  uint8_t ReleaseDevice(uint8_t addr);
270 
271  uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
272  uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p);
273 
274 private:
275  void init();
276  uint8_t SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit);
277  uint8_t OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data);
278  uint8_t InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval = 0);
279  uint8_t AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed);
280 };
281 
282 #if 0 //defined(USB_METHODS_INLINE)
283 //get device descriptor
284 
285 inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
286  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, dataptr));
287 }
288 //get configuration descriptor
289 
290 inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
291  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, dataptr));
292 }
293 //get string descriptor
294 
295 inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {
296  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, nuint8_ts, dataptr));
297 }
298 //set address
299 
300 inline uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
301  return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, NULL));
302 }
303 //set configuration
304 
305 inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
306  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, NULL));
307 }
308 
309 #endif // defined(USB_METHODS_INLINE)
310 
311 #endif /* USBCORE_H */
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:801
uint16_t wValue
Definition: UsbCore.h:190
virtual uint8_t Poll()
Definition: UsbCore.h:149
#define bmHUBPRE
Definition: max3421e.h:172
virtual uint8_t GetAddress()
Definition: UsbCore.h:153
-
EpInfo * getEpInfoEntry(uint8_t addr, uint8_t ep)
Definition: Usb.cpp:44
#define USB_DESCRIPTOR_STRING
Definition: usb_ch9.h:72
uint16_t wLength
Definition: UsbCore.h:198
#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:840
#define USB_NUMDEVICES
Definition: UsbCore.h:112
-
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:141
uint8_t bmRequestType
Definition: UsbCore.h:179
-
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:71
void ResetHubPreMask()
Definition: UsbCore.h:222
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
Definition: Usb.cpp:831
-
USB(void)
Definition: Usb.cpp:25
-
void(* UsbDeviceHandleFunc)(UsbDevice *pdev)
Definition: address.h:97
uint16_t wIndex
Definition: UsbCore.h:197
void SetHubPreMask()
Definition: UsbCore.h:218
Definition: address.h:39
-
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:303
#define bmREQ_GET_DESCR
Definition: UsbCore.h:60
virtual void ResetHubPort(uint8_t port)
Definition: UsbCore.h:157
#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS
Definition: UsbCore.h:92
uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t *dataptr)
Definition: Usb.cpp:826
#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:56
-
uint8_t getUsbTaskState(void)
Definition: Usb.cpp:36
-
void Task(void)
Definition: Usb.cpp:455
virtual bool DEVSUBCLASSOK(uint8_t subklass)
Definition: UsbCore.h:169
-
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
Definition: Usb.cpp:209
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc)
Definition: address.h:199
-
uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit)
Definition: Usb.cpp:401
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
Definition: UsbCore.h:137
AddressPool & GetAddressPool()
Definition: UsbCore.h:226
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: UsbCore.h:161
-
uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed)
Definition: Usb.cpp:683
Definition: UsbCore.h:210
uint8_t bRequest
Definition: UsbCore.h:187
virtual uint8_t Release()
Definition: UsbCore.h:145
@@ -455,16 +131,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc)
Definition: UsbCore.h:240
#define USB_REQUEST_SET_CONFIGURATION
Definition: usb_ch9.h:47
uint8_t wValueHi
Definition: UsbCore.h:194
-
uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed)
Definition: Usb.cpp:561
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
Definition: Usb.cpp:796
uint8_t wValueLo
Definition: UsbCore.h:193
-
uint8_t ReleaseDevice(uint8_t addr)
Definition: Usb.cpp:781
+
void(* UsbDeviceHandleFunc)(UsbDevice *pdev)
Definition: address.h:97
diff --git a/_wii_8cpp.html b/_wii_8cpp.html index 23c6c15c..57d46c5c 100644 --- a/_wii_8cpp.html +++ b/_wii_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Wii.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -87,13 +88,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Wii.cpp File Reference
-
#include "Wii.h"
+
#include "Wii.h"
Include dependency graph for Wii.cpp:
- + + + + + + +

Go to the source code of this file.

@@ -117,21 +124,7 @@ Variables
-Initial value:
= {
-
0x00,
-
0x10,
-
0x20,
-
0x40,
-
0x80,
-
-
0x90,
-
0xA0,
-
0xC0,
-
0xD0,
-
0xE0,
-
0xF0,
-
}
-
+Initial value:
= {
0x00,
0x10,
0x20,
0x40,
0x80,
0x90,
0xA0,
0xC0,
0xD0,
0xE0,
0xF0,
}

Definition at line 25 of file Wii.cpp.

@@ -145,26 +138,7 @@ Variables
-Initial value:
= {
-
0x00008,
-
0x00002,
-
0x00004,
-
0x00001,
-
-
0,
-
0x00010,
-
0x00100,
-
0x00200,
-
-
0x01000,
-
0x08000,
-
0x10000,
-
0x20000,
-
-
0x00400,
-
0x00800,
-
}
-
+Initial value:
= {
0x00008,
0x00002,
0x00004,
0x00001,
0,
0x00010,
0x00100,
0x00200,
0x01000,
0x08000,
0x10000,
0x20000,
0x00400,
0x00800,
}

Definition at line 40 of file Wii.cpp.

@@ -178,32 +152,7 @@ Variables
-Initial value:
= {
-
0x00100,
-
0x00080,
-
0x00040,
-
0x00200,
-
-
0,
-
0x00004,
-
0x20000,
-
0x10000,
-
-
0x00010,
-
0x00008,
-
0, 0,
-
-
0x04000,
-
0x01000,
-
0x00800,
-
0x02000,
-
-
0x00020,
-
0x00002,
-
0x08000,
-
0x00400,
-
}
-
+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.

@@ -213,7 +162,7 @@ Variables diff --git a/_wii_8cpp__incl.map b/_wii_8cpp__incl.map index 1540b5b4..946f5cdc 100644 --- a/_wii_8cpp__incl.map +++ b/_wii_8cpp__incl.map @@ -1,8 +1,8 @@ - - - - - - + + + + + + diff --git a/_wii_8cpp__incl.md5 b/_wii_8cpp__incl.md5 index ede72cbe..90a48635 100644 --- a/_wii_8cpp__incl.md5 +++ b/_wii_8cpp__incl.md5 @@ -1 +1 @@ -aa63a87439bccd881956e23a15da5c5b \ No newline at end of file +38127c822874d8407cb01375c5f2f11b \ No newline at end of file diff --git a/_wii_8cpp__incl.png b/_wii_8cpp__incl.png index 03a40788..f211dcd9 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 cc3ac847..25578cd1 100644 --- a/_wii_8cpp_source.html +++ b/_wii_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Wii.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,1288 +86,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 = (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
+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
-
void(* pFuncOnInit)(void)
Definition: BTD.h:609
bool incomingWii
Definition: BTD.h:474
void onInit()
Definition: Wii.cpp:1139
@@ -1440,6 +161,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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:609
#define WII_FLAG_CALIBRATE_BALANCE_BOARD
Definition: Wii.h:29
#define l2cap_check_flag(flag)
Definition: BTD.h:161
@@ -1510,7 +232,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_wii_8h.html b/_wii_8h.html index cc9217f8..175d749a 100644 --- a/_wii_8h.html +++ b/_wii_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Wii.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -89,21 +90,27 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Wii.h File Reference
-
#include "BTD.h"
-#include "controllerEnums.h"
+
#include "BTD.h"
+#include "controllerEnums.h"
Include dependency graph for Wii.h:
- + + + + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -250,10 +257,10 @@ Enumerations

Enum used to read the joystick on the Nunchuck.

- -
Enumerator
HatX  +
Enumerator
HatX 

Read the x-axis on the Nunchuck joystick.

HatY  +
HatY 

Read the y-axis on the Nunchuck joystick.

@@ -273,13 +280,13 @@ Enumerations

Enum used to read the weight on Wii Balance Board.

- - - -
Enumerator
TopRight  +
Enumerator
TopRight 
BotRight  +
BotRight 
TopLeft  +
TopLeft 
BotLeft  +
BotLeft 
@@ -292,7 +299,7 @@ Enumerations diff --git a/_wii_8h__dep__incl.md5 b/_wii_8h__dep__incl.md5 index 1300a3e5..141f0cf4 100644 --- a/_wii_8h__dep__incl.md5 +++ b/_wii_8h__dep__incl.md5 @@ -1 +1 @@ -4f5ed0d059dbe61d52339b9d9d877c07 \ No newline at end of file +68e486939ecaf1de2be16bf264fe38d3 \ No newline at end of file diff --git a/_wii_8h__dep__incl.png b/_wii_8h__dep__incl.png index 39cb1dfd..ab586489 100644 Binary files a/_wii_8h__dep__incl.png and b/_wii_8h__dep__incl.png differ diff --git a/_wii_8h__incl.map b/_wii_8h__incl.map index c40cf68f..cc608b3a 100644 --- a/_wii_8h__incl.map +++ b/_wii_8h__incl.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/_wii_8h__incl.md5 b/_wii_8h__incl.md5 index 58df1c31..6bc35bec 100644 --- a/_wii_8h__incl.md5 +++ b/_wii_8h__incl.md5 @@ -1 +1 @@ -1bab26d12347d67d2975eed4e0e08f43 \ No newline at end of file +a8d2a81727ce46fe1f181ac702c5895a \ No newline at end of file diff --git a/_wii_8h__incl.png b/_wii_8h__incl.png index 56c18571..b26a29a2 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 cd1c89fd..848e856f 100644 --- a/_wii_8h_source.html +++ b/_wii_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Wii.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,298 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Wii.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  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
+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:1139
int16_t gyroPitchRaw
Definition: Wii.h:265
uint16_t rollGyroScale
Definition: Wii.h:257
@@ -470,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_wii_camera_readme_8md.html b/_wii_camera_readme_8md.html index 2eba6dd0..ff934b29 100644 --- a/_wii_camera_readme_8md.html +++ b/_wii_camera_readme_8md.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: WiiCameraReadme.md File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -92,7 +93,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_wii_camera_readme_8md_source.html b/_wii_camera_readme_8md_source.html index be5d46f5..9d1d4dd9 100644 --- a/_wii_camera_readme_8md_source.html +++ b/_wii_camera_readme_8md_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: WiiCameraReadme.md Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,27 +86,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
WiiCameraReadme.md
-Go to the documentation of this file.
1 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.
-
2 
-
3 This library is large, if you run into memory problems when uploading to the Arduino, disable serial debugging.
-
4 
-
5 To enable the IR camera code, simply set ```ENABLE_WII_IR_CAMERA``` to 1 in [settings.h](settings.h).
-
6 
-
7 This library implements the following settings:
-
8 
-
9 * Report sensitivity mode: 00 00 00 00 00 00 90 00 41 40 00 Suggested by inio (high sensitivity)
-
10 * Data Format: Extended mode (0x03). Full mode is not working yet. The output reports 0x3e and 0x3f need tampering with
-
11  * In this mode the camera outputs x and y coordinates and a size dimension for the 4 brightest points.
-
12 
-
13 Again, read through <http://wiibrew.org/wiki/Wiimote#IR_Camera> to get an understanding of the camera and its settings.
-
#define ENABLE_WII_IR_CAMERA
Definition: settings.h:70
-
Definition: PS3Enums.h:125
-
+Go to the documentation of this file.
1 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.
2 
3 This library is large, if you run into memory problems when uploading to the Arduino, disable serial debugging.
4 
5 To enable the IR camera code, simply set ```ENABLE_WII_IR_CAMERA``` to 1 in [settings.h](settings.h).
6 
7 This library implements the following settings:
8 
9 * Report sensitivity mode: 00 00 00 00 00 00 90 00 41 40 00 Suggested by inio (high sensitivity)
10 * Data Format: Extended mode (0x03). Full mode is not working yet. The output reports 0x3e and 0x3f need tampering with
11  * In this mode the camera outputs x and y coordinates and a size dimension for the 4 brightest points.
12 
13 Again, read through <http://wiibrew.org/wiki/Wiimote#IR_Camera> to get an understanding of the camera and its settings.
diff --git a/_x_b_o_x_o_l_d_8cpp.html b/_x_b_o_x_o_l_d_8cpp.html index b495ff16..fffb6942 100644 --- a/_x_b_o_x_o_l_d_8cpp.html +++ b/_x_b_o_x_o_l_d_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXOLD.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -87,13 +88,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXOLD.cpp File Reference
-
#include "XBOXOLD.h"
+
#include "XBOXOLD.h"
Include dependency graph for XBOXOLD.cpp:
- + + + + + +

Go to the source code of this file.

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

Buttons on the controllers

+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.

@@ -146,7 +130,7 @@ Variables diff --git a/_x_b_o_x_o_l_d_8cpp__incl.map b/_x_b_o_x_o_l_d_8cpp__incl.map index 388f26c8..cc79d3e0 100644 --- a/_x_b_o_x_o_l_d_8cpp__incl.map +++ b/_x_b_o_x_o_l_d_8cpp__incl.map @@ -1,7 +1,7 @@ - - - - - + + + + + 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 2c058871..4e66fc26 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 @@ -1e06a0f3d0d0fe8ad8419d72a053f465 \ No newline at end of file +6e170bd84842a4541b9931c43ed0f42c \ 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 efd10041..a81a9284 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 e8dcdc13..30aa2f45 100644 --- a/_x_b_o_x_o_l_d_8cpp_source.html +++ b/_x_b_o_x_o_l_d_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXOLD.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,344 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 __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 }
- +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
@@ -509,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_x_b_o_x_o_l_d_8h.html b/_x_b_o_x_o_l_d_8h.html index 54a03ecb..1bc4c694 100644 --- a/_x_b_o_x_o_l_d_8h.html +++ b/_x_b_o_x_o_l_d_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXOLD.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,22 +89,27 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXOLD.h File Reference
-
#include "Usb.h"
-#include "usbhid.h"
-#include "controllerEnums.h"
+
#include "Usb.h"
+#include "usbhid.h"
+#include "controllerEnums.h"
Include dependency graph for XBOXOLD.h:
- + + + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -314,7 +320,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 0678f7d2..cc366f2a 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 @@ -4624e3aee3651b0e57e6bf6ae6dd27ec \ No newline at end of file +82c0a98cce5027def9ffaed26c3bac43 \ 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 0fd16d42..cfb8c228 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 4f26bc54..b1091a74 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 38a1f448..00cfe4cd 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 @@ -39fa3dc5976d45480763fa92b986dad2 \ No newline at end of file +6f0fa83f2b72b0b7a7795b417af236ee \ 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 ab135e7c..7f9c4163 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 9f2fb331..d53195d6 100644 --- a/_x_b_o_x_o_l_d_8h_source.html +++ b/_x_b_o_x_o_l_d_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXOLD.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,115 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXOLD.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 _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
+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
virtual uint8_t GetAddress()
Definition: XBOXOLD.h:78
@@ -233,7 +126,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 71c45875..bdf23aa2 100644 --- a/_x_b_o_x_o_n_e_8cpp.html +++ b/_x_b_o_x_o_n_e_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXONE.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,13 +86,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXONE.cpp File Reference
-
#include "XBOXONE.h"
+
#include "XBOXONE.h"
Include dependency graph for XBOXONE.cpp:
- + + + + +

Go to the source code of this file.

@@ -100,7 +105,7 @@ Include dependency graph for XBOXONE.cpp:
diff --git a/_x_b_o_x_o_n_e_8cpp__incl.map b/_x_b_o_x_o_n_e_8cpp__incl.map index 1f1506d7..ffe5640e 100644 --- a/_x_b_o_x_o_n_e_8cpp__incl.map +++ b/_x_b_o_x_o_n_e_8cpp__incl.map @@ -1,6 +1,6 @@ - - - - + + + + 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 4610a8db..adfce4de 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 @@ -0999cb6609525753554c8ffa1f8467d6 \ No newline at end of file +a31c4a2760319c972359266d1c3ccfe5 \ 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 3a7d7bfe..2b11d73f 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 d7b260ed..d5e43b23 100644 --- a/_x_b_o_x_o_n_e_8cpp_source.html +++ b/_x_b_o_x_o_n_e_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXONE.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,499 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 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 
-
165  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
-
166  if(rcode)
-
167  goto FailSetDevTblEntry;
-
168 
-
169  delay(200); // Give time for address change
-
170 
-
171  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_ONE_CONTROL_PIPE ].epAddr, bConfNum);
-
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,
-
240  uint8_t iface __attribute__((unused)),
-
241  uint8_t alt __attribute__((unused)),
-
242  uint8_t proto __attribute__((unused)),
-
243  const USB_ENDPOINT_DESCRIPTOR *pep)
-
244 {
-
245 
-
246  bConfNum = conf;
-
247  uint8_t index;
-
248 
-
249  if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT) { // Interrupt endpoint
-
250  index = (pep->bEndpointAddress & 0x80) == 0x80 ? XBOX_ONE_INPUT_PIPE : XBOX_ONE_OUTPUT_PIPE; // Set the endpoint index
-
251  } else
-
252  return;
-
253 
-
254  // Fill the rest of endpoint data structure
-
255  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
-
256  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
-
257 #ifdef EXTRADEBUG
- -
259 #endif
-
260  if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
-
261  pollInterval = pep->bInterval;
-
262  bNumEP++;
-
263 }
-
264 
- -
266  __attribute__((unused)))
-
267 {
-
268 #ifdef EXTRADEBUG
-
269  Notify(PSTR("\r\nEndpoint descriptor:"), 0x80);
-
270  Notify(PSTR("\r\nLength:\t\t"), 0x80);
-
271  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
-
272  Notify(PSTR("\r\nType:\t\t"), 0x80);
-
273  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
-
274  Notify(PSTR("\r\nAddress:\t"), 0x80);
-
275  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
-
276  Notify(PSTR("\r\nAttributes:\t"), 0x80);
-
277  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
-
278  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
-
279  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
-
280  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
-
281  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
-
282 #endif
-
283 }
-
284 
-
285 /* Performs a cleanup after failed Init() attempt */
-
286 uint8_t XBOXONE::Release() {
-
287  XboxOneConnected = false;
- -
289  bAddress = 0; // Clear device address
-
290  bNumEP = 1; // Must have to be reset to 1
-
291  qNextPollTime = 0; // Reset next poll time
-
292  pollInterval = 0;
-
293  bPollEnable = false;
-
294 #ifdef DEBUG_USB_HOST
-
295  Notify(PSTR("\r\nXbox One Controller Disconnected\r\n"), 0x80);
-
296 #endif
-
297  return 0;
-
298 }
-
299 
-
300 uint8_t XBOXONE::Poll() {
-
301  uint8_t rcode = 0;
-
302 
-
303  if(!bPollEnable)
-
304  return 0;
-
305 
-
306  if((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L) { // Do not poll if shorter than polling interval
-
307  qNextPollTime = (uint32_t)millis() + pollInterval; // Set new poll time
-
308  uint16_t length = (uint16_t)epInfo[ XBOX_ONE_INPUT_PIPE ].maxPktSize; // Read the maximum packet size from the endpoint
-
309  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ XBOX_ONE_INPUT_PIPE ].epAddr, &length, readBuf, pollInterval);
-
310  if(!rcode) {
-
311  readReport();
-
312 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send by the Xbox ONE Controller
-
313  for(uint8_t i = 0; i < length; i++) {
-
314  D_PrintHex<uint8_t > (readBuf[i], 0x80);
-
315  Notify(PSTR(" "), 0x80);
-
316  }
-
317  Notify(PSTR("\r\n"), 0x80);
-
318 #endif
-
319  }
-
320 #ifdef DEBUG_USB_HOST
-
321  else if(rcode != hrNAK) { // Not a matter of no update to send
-
322  Notify(PSTR("\r\nXbox One Poll Failed, error code: "), 0x80);
-
323  NotifyFail(rcode);
-
324  }
-
325 #endif
-
326  }
-
327  return rcode;
-
328 }
-
329 
-
330 void XBOXONE::readReport() {
-
331  if(readBuf[0] == 0x07) {
-
332  // The XBOX button has a separate message
-
333  if(readBuf[4] == 1)
-
334  ButtonState |= pgm_read_word(&XBOX_BUTTONS[XBOX]);
-
335  else
-
336  ButtonState &= ~pgm_read_word(&XBOX_BUTTONS[XBOX]);
-
337 
-
338  if(ButtonState != OldButtonState) {
-
339  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
-
340  OldButtonState = ButtonState;
-
341  }
-
342  }
-
343  if(readBuf[0] != 0x20) { // Check if it's the correct report, otherwise return - the controller also sends different status reports
-
344 #ifdef EXTRADEBUG
-
345  Notify(PSTR("\r\nXbox Poll: "), 0x80);
-
346  D_PrintHex<uint8_t > (readBuf[0], 0x80); // 0x03 is a heart beat report!
-
347 #endif
-
348  return;
-
349  }
-
350 
-
351  uint16_t xbox = ButtonState & pgm_read_word(&XBOX_BUTTONS[XBOX]); // Since the XBOX button is separate, save it and add it back in
-
352  // xbox button from before, dpad, abxy, start/back, sync, stick click, shoulder buttons
-
353  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);
-
354 
-
355  triggerValue[0] = (uint16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
-
356  triggerValue[1] = (uint16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
-
357 
-
358  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
-
359  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
-
360  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
-
361  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
-
362 
-
363  //Notify(PSTR("\r\nButtonState"), 0x80);
-
364  //PrintHex<uint16_t>(ButtonState, 0x80);
-
365 
-
366  if(ButtonState != OldButtonState) {
-
367  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
-
368  OldButtonState = ButtonState;
-
369  }
-
370 
-
371  // Handle click detection for triggers
-
372  if(triggerValue[0] != 0 && triggerValueOld[0] == 0)
-
373  L2Clicked = true;
-
374  triggerValueOld[0] = triggerValue[0];
-
375  if(triggerValue[1] != 0 && triggerValueOld[1] == 0)
-
376  R2Clicked = true;
-
377  triggerValueOld[1] = triggerValue[1];
-
378 }
-
379 
- -
381  if(b == L2) // These are analog buttons
-
382  return triggerValue[0];
-
383  else if(b == R2)
-
384  return triggerValue[1];
-
385  return (bool)(ButtonState & ((uint16_t)pgm_read_word(&XBOX_BUTTONS[(uint8_t)b])));
-
386 }
-
387 
- -
389  if(b == L2) {
-
390  if(L2Clicked) {
-
391  L2Clicked = false;
-
392  return true;
-
393  }
-
394  return false;
-
395  } else if(b == R2) {
-
396  if(R2Clicked) {
-
397  R2Clicked = false;
-
398  return true;
-
399  }
-
400  return false;
-
401  }
-
402  uint16_t button = pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]);
-
403  bool click = (ButtonClickState & button);
-
404  ButtonClickState &= ~button; // Clear "click" event
-
405  return click;
-
406 }
-
407 
- -
409  return hatValue[a];
-
410 }
-
411 
-
412 /* Xbox Controller commands */
-
413 uint8_t XBOXONE::XboxCommand(uint8_t* data, uint16_t nbytes) {
-
414  data[2] = cmdCounter++; // Increment the output command counter
-
415  uint8_t rcode = pUsb->outTransfer(bAddress, epInfo[ XBOX_ONE_OUTPUT_PIPE ].epAddr, nbytes, data);
-
416 #ifdef DEBUG_USB_HOST
-
417  Notify(PSTR("\r\nXboxCommand, Return: "), 0x80);
-
418  D_PrintHex<uint8_t > (rcode, 0x80);
-
419 #endif
-
420  return rcode;
-
421 }
-
422 
-
423 // The Xbox One packets are described at: https://github.com/quantus/xbox-one-controller-protocol
-
424 void XBOXONE::onInit() {
-
425  // A short buzz to show the controller is active
-
426  uint8_t writeBuf[13];
-
427 
-
428  // Activate rumble
-
429  writeBuf[0] = 0x09;
-
430  writeBuf[1] = 0x00;
-
431  // Byte 2 is set in "XboxCommand"
-
432 
-
433  // Single rumble effect
-
434  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
-
435  writeBuf[4] = 0x00; // Mode
-
436  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
-
437  writeBuf[6] = 0x04; // lT force
-
438  writeBuf[7] = 0x04; // rT force
-
439  writeBuf[8] = 0x20; // L force
-
440  writeBuf[9] = 0x20; // R force
-
441  writeBuf[10] = 0x80; // Length of pulse
-
442  writeBuf[11] = 0x00; // Off period
-
443  writeBuf[12] = 0x00; // Repeat count
-
444  XboxCommand(writeBuf, 13);
-
445 
-
446  if(pFuncOnInit)
-
447  pFuncOnInit(); // Call the user function
-
448 }
-
449 
- -
451  uint8_t writeBuf[13];
-
452 
-
453  // Activate rumble
-
454  writeBuf[0] = 0x09;
-
455  writeBuf[1] = 0x00;
-
456  // Byte 2 is set in "XboxCommand"
-
457 
-
458  // Continuous rumble effect
-
459  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
-
460  writeBuf[4] = 0x00; // Mode
-
461  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
-
462  writeBuf[6] = 0x00; // lT force
-
463  writeBuf[7] = 0x00; // rT force
-
464  writeBuf[8] = 0x00; // L force
-
465  writeBuf[9] = 0x00; // R force
-
466  writeBuf[10] = 0x00; // On period
-
467  writeBuf[11] = 0x00; // Off period
-
468  writeBuf[12] = 0x00; // Repeat count
-
469  XboxCommand(writeBuf, 13);
-
470 }
-
471 
-
472 void XBOXONE::setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor) {
-
473  uint8_t writeBuf[13];
-
474 
-
475  // Activate rumble
-
476  writeBuf[0] = 0x09;
-
477  writeBuf[1] = 0x00;
-
478  // Byte 2 is set in "XboxCommand"
-
479 
-
480  // Continuous rumble effect
-
481  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
-
482  writeBuf[4] = 0x00; // Mode
-
483  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
-
484  writeBuf[6] = leftTrigger; // lT force
-
485  writeBuf[7] = rightTrigger; // rT force
-
486  writeBuf[8] = leftMotor; // L force
-
487  writeBuf[9] = rightMotor; // R force
-
488  writeBuf[10] = 0xFF; // On period
-
489  writeBuf[11] = 0x00; // Off period
-
490  writeBuf[12] = 0xFF; // Repeat count
-
491  XboxCommand(writeBuf, 13);
-
492 }
-
uint8_t bConfNum
Definition: XBOXONE.h:186
+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 
165  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
166  if(rcode)
167  goto FailSetDevTblEntry;
168 
169  delay(200); // Give time for address change
170 
171  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_ONE_CONTROL_PIPE ].epAddr, bConfNum);
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,
240  uint8_t iface __attribute__((unused)),
241  uint8_t alt __attribute__((unused)),
242  uint8_t proto __attribute__((unused)),
243  const USB_ENDPOINT_DESCRIPTOR *pep)
244 {
245 
246  bConfNum = conf;
247  uint8_t index;
248 
249  if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT) { // Interrupt endpoint
250  index = (pep->bEndpointAddress & 0x80) == 0x80 ? XBOX_ONE_INPUT_PIPE : XBOX_ONE_OUTPUT_PIPE; // Set the endpoint index
251  } else
252  return;
253 
254  // Fill the rest of endpoint data structure
255  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
256  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
257 #ifdef EXTRADEBUG
259 #endif
260  if(pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
261  pollInterval = pep->bInterval;
262  bNumEP++;
263 }
264 
266  __attribute__((unused)))
267 {
268 #ifdef EXTRADEBUG
269  Notify(PSTR("\r\nEndpoint descriptor:"), 0x80);
270  Notify(PSTR("\r\nLength:\t\t"), 0x80);
271  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
272  Notify(PSTR("\r\nType:\t\t"), 0x80);
273  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
274  Notify(PSTR("\r\nAddress:\t"), 0x80);
275  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
276  Notify(PSTR("\r\nAttributes:\t"), 0x80);
277  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
278  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
279  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
280  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
281  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
282 #endif
283 }
284 
285 /* Performs a cleanup after failed Init() attempt */
286 uint8_t XBOXONE::Release() {
287  XboxOneConnected = false;
289  bAddress = 0; // Clear device address
290  bNumEP = 1; // Must have to be reset to 1
291  qNextPollTime = 0; // Reset next poll time
292  pollInterval = 0;
293  bPollEnable = false;
294 #ifdef DEBUG_USB_HOST
295  Notify(PSTR("\r\nXbox One Controller Disconnected\r\n"), 0x80);
296 #endif
297  return 0;
298 }
299 
300 uint8_t XBOXONE::Poll() {
301  uint8_t rcode = 0;
302 
303  if(!bPollEnable)
304  return 0;
305 
306  if((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L) { // Do not poll if shorter than polling interval
307  qNextPollTime = (uint32_t)millis() + pollInterval; // Set new poll time
308  uint16_t length = (uint16_t)epInfo[ XBOX_ONE_INPUT_PIPE ].maxPktSize; // Read the maximum packet size from the endpoint
309  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ XBOX_ONE_INPUT_PIPE ].epAddr, &length, readBuf, pollInterval);
310  if(!rcode) {
311  readReport();
312 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send by the Xbox ONE Controller
313  for(uint8_t i = 0; i < length; i++) {
314  D_PrintHex<uint8_t > (readBuf[i], 0x80);
315  Notify(PSTR(" "), 0x80);
316  }
317  Notify(PSTR("\r\n"), 0x80);
318 #endif
319  }
320 #ifdef DEBUG_USB_HOST
321  else if(rcode != hrNAK) { // Not a matter of no update to send
322  Notify(PSTR("\r\nXbox One Poll Failed, error code: "), 0x80);
323  NotifyFail(rcode);
324  }
325 #endif
326  }
327  return rcode;
328 }
329 
330 void XBOXONE::readReport() {
331  if(readBuf[0] == 0x07) {
332  // The XBOX button has a separate message
333  if(readBuf[4] == 1)
334  ButtonState |= pgm_read_word(&XBOX_BUTTONS[XBOX]);
335  else
336  ButtonState &= ~pgm_read_word(&XBOX_BUTTONS[XBOX]);
337 
338  if(ButtonState != OldButtonState) {
339  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
340  OldButtonState = ButtonState;
341  }
342  }
343  if(readBuf[0] != 0x20) { // Check if it's the correct report, otherwise return - the controller also sends different status reports
344 #ifdef EXTRADEBUG
345  Notify(PSTR("\r\nXbox Poll: "), 0x80);
346  D_PrintHex<uint8_t > (readBuf[0], 0x80); // 0x03 is a heart beat report!
347 #endif
348  return;
349  }
350 
351  uint16_t xbox = ButtonState & pgm_read_word(&XBOX_BUTTONS[XBOX]); // Since the XBOX button is separate, save it and add it back in
352  // xbox button from before, dpad, abxy, start/back, sync, stick click, shoulder buttons
353  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);
354 
355  triggerValue[0] = (uint16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
356  triggerValue[1] = (uint16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
357 
358  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
359  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
360  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
361  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
362 
363  //Notify(PSTR("\r\nButtonState"), 0x80);
364  //PrintHex<uint16_t>(ButtonState, 0x80);
365 
366  if(ButtonState != OldButtonState) {
367  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
368  OldButtonState = ButtonState;
369  }
370 
371  // Handle click detection for triggers
372  if(triggerValue[0] != 0 && triggerValueOld[0] == 0)
373  L2Clicked = true;
374  triggerValueOld[0] = triggerValue[0];
375  if(triggerValue[1] != 0 && triggerValueOld[1] == 0)
376  R2Clicked = true;
377  triggerValueOld[1] = triggerValue[1];
378 }
379 
381  if(b == L2) // These are analog buttons
382  return triggerValue[0];
383  else if(b == R2)
384  return triggerValue[1];
385  return (bool)(ButtonState & ((uint16_t)pgm_read_word(&XBOX_BUTTONS[(uint8_t)b])));
386 }
387 
389  if(b == L2) {
390  if(L2Clicked) {
391  L2Clicked = false;
392  return true;
393  }
394  return false;
395  } else if(b == R2) {
396  if(R2Clicked) {
397  R2Clicked = false;
398  return true;
399  }
400  return false;
401  }
402  uint16_t button = pgm_read_word(&XBOX_BUTTONS[(uint8_t)b]);
403  bool click = (ButtonClickState & button);
404  ButtonClickState &= ~button; // Clear "click" event
405  return click;
406 }
407 
409  return hatValue[a];
410 }
411 
412 /* Xbox Controller commands */
413 uint8_t XBOXONE::XboxCommand(uint8_t* data, uint16_t nbytes) {
414  data[2] = cmdCounter++; // Increment the output command counter
415  uint8_t rcode = pUsb->outTransfer(bAddress, epInfo[ XBOX_ONE_OUTPUT_PIPE ].epAddr, nbytes, data);
416 #ifdef DEBUG_USB_HOST
417  Notify(PSTR("\r\nXboxCommand, Return: "), 0x80);
418  D_PrintHex<uint8_t > (rcode, 0x80);
419 #endif
420  return rcode;
421 }
422 
423 // The Xbox One packets are described at: https://github.com/quantus/xbox-one-controller-protocol
424 void XBOXONE::onInit() {
425  // A short buzz to show the controller is active
426  uint8_t writeBuf[13];
427 
428  // Activate rumble
429  writeBuf[0] = 0x09;
430  writeBuf[1] = 0x00;
431  // Byte 2 is set in "XboxCommand"
432 
433  // Single rumble effect
434  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
435  writeBuf[4] = 0x00; // Mode
436  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
437  writeBuf[6] = 0x04; // lT force
438  writeBuf[7] = 0x04; // rT force
439  writeBuf[8] = 0x20; // L force
440  writeBuf[9] = 0x20; // R force
441  writeBuf[10] = 0x80; // Length of pulse
442  writeBuf[11] = 0x00; // Off period
443  writeBuf[12] = 0x00; // Repeat count
444  XboxCommand(writeBuf, 13);
445 
446  if(pFuncOnInit)
447  pFuncOnInit(); // Call the user function
448 }
449 
451  uint8_t writeBuf[13];
452 
453  // Activate rumble
454  writeBuf[0] = 0x09;
455  writeBuf[1] = 0x00;
456  // Byte 2 is set in "XboxCommand"
457 
458  // Continuous rumble effect
459  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
460  writeBuf[4] = 0x00; // Mode
461  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
462  writeBuf[6] = 0x00; // lT force
463  writeBuf[7] = 0x00; // rT force
464  writeBuf[8] = 0x00; // L force
465  writeBuf[9] = 0x00; // R force
466  writeBuf[10] = 0x00; // On period
467  writeBuf[11] = 0x00; // Off period
468  writeBuf[12] = 0x00; // Repeat count
469  XboxCommand(writeBuf, 13);
470 }
471 
472 void XBOXONE::setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor) {
473  uint8_t writeBuf[13];
474 
475  // Activate rumble
476  writeBuf[0] = 0x09;
477  writeBuf[1] = 0x00;
478  // Byte 2 is set in "XboxCommand"
479 
480  // Continuous rumble effect
481  writeBuf[3] = 0x09; // Substructure (what substructure rest of this packet has)
482  writeBuf[4] = 0x00; // Mode
483  writeBuf[5] = 0x0F; // Rumble mask (what motors are activated) (0000 lT rT L R)
484  writeBuf[6] = leftTrigger; // lT force
485  writeBuf[7] = rightTrigger; // rT force
486  writeBuf[8] = leftMotor; // L force
487  writeBuf[9] = rightMotor; // R force
488  writeBuf[10] = 0xFF; // On period
489  writeBuf[11] = 0x00; // Off period
490  writeBuf[12] = 0xFF; // Repeat count
491  XboxCommand(writeBuf, 13);
492 }
uint8_t bConfNum
Definition: XBOXONE.h:186
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:801
uint8_t bmRcvToggle
Definition: address.h:48
@@ -667,7 +176,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_x_b_o_x_o_n_e_8h.html b/_x_b_o_x_o_n_e_8h.html index 97cfc60a..b1afb7f6 100644 --- a/_x_b_o_x_o_n_e_8h.html +++ b/_x_b_o_x_o_n_e_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXONE.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,21 +89,25 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXONE.h File Reference
-
#include "Usb.h"
-#include "xboxEnums.h"
+
#include "Usb.h"
+#include "xboxEnums.h"
Include dependency graph for XBOXONE.h:
- + + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -505,7 +510,7 @@ Macros diff --git a/_x_b_o_x_o_n_e_8h__dep__incl.map b/_x_b_o_x_o_n_e_8h__dep__incl.map index 2efde3dd..eb200c31 100644 --- a/_x_b_o_x_o_n_e_8h__dep__incl.map +++ b/_x_b_o_x_o_n_e_8h__dep__incl.map @@ -1,3 +1,3 @@ - + 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 4639e8d1..c13f788f 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 @@ -4f8e8092fb9211eccf14c4eb31202c8c \ No newline at end of file +fd61d6c8f3280fcb7695abf658ecef71 \ 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 4eac9f45..3f0b1842 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.map b/_x_b_o_x_o_n_e_8h__incl.map index d9c4a3b2..05cb8c11 100644 --- a/_x_b_o_x_o_n_e_8h__incl.map +++ b/_x_b_o_x_o_n_e_8h__incl.map @@ -1,5 +1,5 @@ - - - + + + 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 9559824e..14781353 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 @@ -871b5087aaf7d6965a4fb3162dfe2354 \ No newline at end of file +0dde0ce6aa02e651aff1df3147ecf48a \ 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 4c221e0f..0f51394d 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 aa911bc2..75fcb596 100644 --- a/_x_b_o_x_o_n_e_8h_source.html +++ b/_x_b_o_x_o_n_e_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXONE.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,150 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 /* 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 #define XBOX_ONE_PID13 0x0B0A // Microsoft X-Box One Adaptive Controller
-
48 
-
49 // Unofficial controllers
-
50 #define XBOX_VID2 0x0738 // Mad Catz
-
51 #define XBOX_VID3 0x0E6F // Afterglow
-
52 #define XBOX_VID4 0x0F0D // HORIPAD ONE
-
53 #define XBOX_VID5 0x1532 // Razer
-
54 #define XBOX_VID6 0x24C6 // PowerA
-
55 
-
56 #define XBOX_ONE_PID5 0x4A01 // Mad Catz FightStick TE 2 - might have different mapping for triggers?
-
57 #define XBOX_ONE_PID6 0x0139 // Afterglow Prismatic Wired Controller
-
58 #define XBOX_ONE_PID7 0x0146 // Rock Candy Wired Controller for Xbox One
-
59 #define XBOX_ONE_PID8 0x0067 // HORIPAD ONE
-
60 #define XBOX_ONE_PID9 0x0A03 // Razer Wildcat
-
61 #define XBOX_ONE_PID10 0x541A // PowerA Xbox One Mini Wired Controller
-
62 #define XBOX_ONE_PID11 0x542A // Xbox ONE spectra
-
63 #define XBOX_ONE_PID12 0x543A // PowerA Xbox One wired controller
-
64 
-
66 class XBOXONE : public USBDeviceConfig, public UsbConfigXtracter {
-
67 public:
-
72  XBOXONE(USB *pUsb);
-
73 
-
82  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
-
87  virtual uint8_t Release();
-
92  virtual uint8_t Poll();
-
93 
-
98  virtual uint8_t GetAddress() {
-
99  return bAddress;
-
100  };
-
101 
-
106  virtual bool isReady() {
-
107  return bPollEnable;
-
108  };
-
109 
-
114  uint8_t readPollInterval() {
-
115  return pollInterval;
-
116  };
-
117 
-
124  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
-
125  return ((vid == XBOX_VID1 || vid == XBOX_VID2 || vid == XBOX_VID3 || vid == XBOX_VID4 || vid == XBOX_VID5 || vid == XBOX_VID6) &&
-
126  (pid == XBOX_ONE_PID1 || pid == XBOX_ONE_PID2 || pid == XBOX_ONE_PID3 || pid == XBOX_ONE_PID4 ||
-
127  pid == XBOX_ONE_PID5 || pid == XBOX_ONE_PID6 || pid == XBOX_ONE_PID7 || pid == XBOX_ONE_PID8 ||
-
128  pid == XBOX_ONE_PID9 || pid == XBOX_ONE_PID10 || pid == XBOX_ONE_PID11 || pid == XBOX_ONE_PID12 || pid == XBOX_ONE_PID13));
-
129  };
-
143  uint16_t getButtonPress(ButtonEnum b);
-
144  bool getButtonClick(ButtonEnum b);
-
145 
-
151  int16_t getAnalogHat(AnalogHatEnum a);
-
152 
-
157  void attachOnInit(void (*funcOnInit)(void)) {
-
158  pFuncOnInit = funcOnInit;
-
159  };
-
160 
-
162  void setRumbleOff();
-
163 
-
171  void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor);
- -
176 
-
177 protected:
- -
181  uint8_t bAddress;
- -
184 
-
186  uint8_t bConfNum;
-
188  uint8_t bNumEP;
-
190  uint32_t qNextPollTime;
-
191 
-
201  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
- -
209 
-
210 private:
-
215  void onInit();
-
216  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
-
217 
-
218  uint8_t pollInterval;
-
219  bool bPollEnable;
-
220 
-
221  /* Variables to store the buttons */
-
222  uint16_t ButtonState;
-
223  uint16_t OldButtonState;
-
224  uint16_t ButtonClickState;
-
225  int16_t hatValue[4];
-
226  uint16_t triggerValue[2];
-
227  uint16_t triggerValueOld[2];
-
228 
-
229  bool L2Clicked; // These buttons are analog, so we use we use these bools to check if they where clicked or not
-
230  bool R2Clicked;
-
231 
-
232  uint8_t readBuf[XBOX_ONE_EP_MAXPKTSIZE]; // General purpose buffer for input data
-
233  uint8_t cmdCounter;
-
234 
-
235  void readReport(); // Used to read the incoming data
-
236 
-
237  /* Private commands */
-
238  uint8_t XboxCommand(uint8_t* data, uint16_t nbytes);
-
239 };
-
240 #endif
-
uint8_t bConfNum
Definition: XBOXONE.h:186
+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 #define XBOX_ONE_PID13 0x0B0A // Microsoft X-Box One Adaptive Controller
48 
49 // Unofficial controllers
50 #define XBOX_VID2 0x0738 // Mad Catz
51 #define XBOX_VID3 0x0E6F // Afterglow
52 #define XBOX_VID4 0x0F0D // HORIPAD ONE
53 #define XBOX_VID5 0x1532 // Razer
54 #define XBOX_VID6 0x24C6 // PowerA
55 
56 #define XBOX_ONE_PID5 0x4A01 // Mad Catz FightStick TE 2 - might have different mapping for triggers?
57 #define XBOX_ONE_PID6 0x0139 // Afterglow Prismatic Wired Controller
58 #define XBOX_ONE_PID7 0x0146 // Rock Candy Wired Controller for Xbox One
59 #define XBOX_ONE_PID8 0x0067 // HORIPAD ONE
60 #define XBOX_ONE_PID9 0x0A03 // Razer Wildcat
61 #define XBOX_ONE_PID10 0x541A // PowerA Xbox One Mini Wired Controller
62 #define XBOX_ONE_PID11 0x542A // Xbox ONE spectra
63 #define XBOX_ONE_PID12 0x543A // PowerA Xbox One wired controller
64 
66 class XBOXONE : public USBDeviceConfig, public UsbConfigXtracter {
67 public:
72  XBOXONE(USB *pUsb);
73 
82  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
87  virtual uint8_t Release();
92  virtual uint8_t Poll();
93 
98  virtual uint8_t GetAddress() {
99  return bAddress;
100  };
101 
106  virtual bool isReady() {
107  return bPollEnable;
108  };
109 
114  uint8_t readPollInterval() {
115  return pollInterval;
116  };
117 
124  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
125  return ((vid == XBOX_VID1 || vid == XBOX_VID2 || vid == XBOX_VID3 || vid == XBOX_VID4 || vid == XBOX_VID5 || vid == XBOX_VID6) &&
126  (pid == XBOX_ONE_PID1 || pid == XBOX_ONE_PID2 || pid == XBOX_ONE_PID3 || pid == XBOX_ONE_PID4 ||
127  pid == XBOX_ONE_PID5 || pid == XBOX_ONE_PID6 || pid == XBOX_ONE_PID7 || pid == XBOX_ONE_PID8 ||
128  pid == XBOX_ONE_PID9 || pid == XBOX_ONE_PID10 || pid == XBOX_ONE_PID11 || pid == XBOX_ONE_PID12 || pid == XBOX_ONE_PID13));
129  };
143  uint16_t getButtonPress(ButtonEnum b);
144  bool getButtonClick(ButtonEnum b);
145 
151  int16_t getAnalogHat(AnalogHatEnum a);
152 
157  void attachOnInit(void (*funcOnInit)(void)) {
158  pFuncOnInit = funcOnInit;
159  };
160 
162  void setRumbleOff();
163 
171  void setRumbleOn(uint8_t leftTrigger, uint8_t rightTrigger, uint8_t leftMotor, uint8_t rightMotor);
176 
177 protected:
181  uint8_t bAddress;
184 
186  uint8_t bConfNum;
188  uint8_t bNumEP;
190  uint32_t qNextPollTime;
191 
201  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
209 
210 private:
215  void onInit();
216  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
217 
218  uint8_t pollInterval;
219  bool bPollEnable;
220 
221  /* Variables to store the buttons */
222  uint16_t ButtonState;
223  uint16_t OldButtonState;
224  uint16_t ButtonClickState;
225  int16_t hatValue[4];
226  uint16_t triggerValue[2];
227  uint16_t triggerValueOld[2];
228 
229  bool L2Clicked; // These buttons are analog, so we use we use these bools to check if they where clicked or not
230  bool R2Clicked;
231 
232  uint8_t readBuf[XBOX_ONE_EP_MAXPKTSIZE]; // General purpose buffer for input data
233  uint8_t cmdCounter;
234 
235  void readReport(); // Used to read the incoming data
236 
237  /* Private commands */
238  uint8_t XboxCommand(uint8_t* data, uint16_t nbytes);
239 };
240 #endif
uint8_t bConfNum
Definition: XBOXONE.h:186
#define XBOX_ONE_PID5
Definition: XBOXONE.h:56
#define XBOX_ONE_PID10
Definition: XBOXONE.h:61
#define XBOX_ONE_PID9
Definition: XBOXONE.h:60
@@ -287,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); 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 b74d582f..9dbaaf3a 100644 --- a/_x_b_o_x_r_e_c_v_8cpp.html +++ b/_x_b_o_x_r_e_c_v_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXRECV.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,13 +86,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXRECV.cpp File Reference
-
#include "XBOXRECV.h"
+
#include "XBOXRECV.h"
Include dependency graph for XBOXRECV.cpp:
- + + + + +

Go to the source code of this file.

@@ -100,7 +105,7 @@ Include dependency graph for XBOXRECV.cpp:
diff --git a/_x_b_o_x_r_e_c_v_8cpp__incl.map b/_x_b_o_x_r_e_c_v_8cpp__incl.map index 30ae15e4..eec4ecc3 100644 --- a/_x_b_o_x_r_e_c_v_8cpp__incl.map +++ b/_x_b_o_x_r_e_c_v_8cpp__incl.map @@ -1,6 +1,6 @@ - - - - + + + + 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 1c1fdc93..b0488834 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 @@ -bfbd5b9c880d6b279e7fd3a120aaed59 \ No newline at end of file +afd0356fb2e414737dbcea38c7c8282b \ 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 a536b6d2..c5fd77b5 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 b1eb2a55..573b8e3a 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,15 +3,16 @@ - + USB Host Shield 2.0: XBOXRECV.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,591 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 __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
+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
@@ -777,7 +194,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); 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 950ee9e0..dc1bcb21 100644 --- a/_x_b_o_x_r_e_c_v_8h.html +++ b/_x_b_o_x_r_e_c_v_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXRECV.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,21 +89,25 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXRECV.h File Reference
-
#include "Usb.h"
-#include "xboxEnums.h"
+
#include "Usb.h"
+#include "xboxEnums.h"
Include dependency graph for XBOXRECV.h:
- + + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -377,7 +382,7 @@ Macros diff --git a/_x_b_o_x_r_e_c_v_8h__dep__incl.map b/_x_b_o_x_r_e_c_v_8h__dep__incl.map index a5db4122..d385722e 100644 --- a/_x_b_o_x_r_e_c_v_8h__dep__incl.map +++ b/_x_b_o_x_r_e_c_v_8h__dep__incl.map @@ -1,3 +1,3 @@ - + 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 4ca65192..10cd6192 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 @@ -74b9b88b9a5da90f0879a3aae3ebebb6 \ No newline at end of file +1b17ab2dd30a29c1f644e03c41d46777 \ 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 d373695c..1c8a97f5 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.map b/_x_b_o_x_r_e_c_v_8h__incl.map index 9a182676..17cebabe 100644 --- a/_x_b_o_x_r_e_c_v_8h__incl.map +++ b/_x_b_o_x_r_e_c_v_8h__incl.map @@ -1,5 +1,5 @@ - - - + + + 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 59a0ccbc..e4e3f6bf 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 @@ -ce5138122fc59e139125ea0dd172d247 \ No newline at end of file +b243ba8a771536bf11d1fde69b3f7cff \ 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 05d3b362..2511b7ae 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 555f416e..ebd7eb62 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,15 +3,16 @@ - + USB Host Shield 2.0: XBOXRECV.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,143 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXRECV.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  getBatteryLevel and checkStatus functions made by timstamp.co.uk found using BusHound from Perisoft.net
-
18  */
-
19 
-
20 #ifndef _xboxrecv_h_
-
21 #define _xboxrecv_h_
-
22 
-
23 #include "Usb.h"
-
24 #include "xboxEnums.h"
-
25 
-
26 /* Data Xbox 360 taken from descriptors */
-
27 #define EP_MAXPKTSIZE 32 // max size for data via USB
-
28 
-
29 /* Names we give to the 9 Xbox360 pipes */
-
30 #define XBOX_CONTROL_PIPE 0
-
31 #define XBOX_INPUT_PIPE_1 1
-
32 #define XBOX_OUTPUT_PIPE_1 2
-
33 #define XBOX_INPUT_PIPE_2 3
-
34 #define XBOX_OUTPUT_PIPE_2 4
-
35 #define XBOX_INPUT_PIPE_3 5
-
36 #define XBOX_OUTPUT_PIPE_3 6
-
37 #define XBOX_INPUT_PIPE_4 7
-
38 #define XBOX_OUTPUT_PIPE_4 8
-
39 
-
40 // PID and VID of the different devices
-
41 #define XBOX_VID 0x045E // Microsoft Corporation
-
42 #define MADCATZ_VID 0x1BAD // For unofficial Mad Catz receivers
-
43 #define JOYTECH_VID 0x162E // For unofficial Joytech controllers
-
44 
-
45 #define XBOX_WIRELESS_RECEIVER_PID 0x0719 // Microsoft Wireless Gaming Receiver
-
46 #define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID 0x0291 // Third party Wireless Gaming Receiver
-
47 
-
48 #define XBOX_MAX_ENDPOINTS 9
-
49 
-
55 class XBOXRECV : public USBDeviceConfig {
-
56 public:
-
61  XBOXRECV(USB *pUsb);
-
62 
-
71  uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed);
-
79  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
-
84  uint8_t Release();
-
89  uint8_t Poll();
-
90 
-
95  virtual uint8_t GetAddress() {
-
96  return bAddress;
-
97  };
-
98 
-
103  virtual bool isReady() {
-
104  return bPollEnable;
-
105  };
-
106 
-
113  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
-
114  return ((vid == XBOX_VID || vid == MADCATZ_VID || vid == JOYTECH_VID) && (pid == XBOX_WIRELESS_RECEIVER_PID || pid == XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID));
-
115  };
-
130  uint8_t getButtonPress(ButtonEnum b, uint8_t controller = 0);
-
131  bool getButtonClick(ButtonEnum b, uint8_t controller = 0);
-
141  int16_t getAnalogHat(AnalogHatEnum a, uint8_t controller = 0);
-
142 
-
147  void disconnect(uint8_t controller = 0);
-
148 
-
153  void setAllOff(uint8_t controller = 0) {
-
154  setRumbleOn(0, 0, controller);
-
155  setLedOff(controller);
-
156  };
-
157 
-
162  void setRumbleOff(uint8_t controller = 0) {
-
163  setRumbleOn(0, 0, controller);
-
164  };
-
171  void setRumbleOn(uint8_t lValue, uint8_t rValue, uint8_t controller = 0);
-
179  void setLedRaw(uint8_t value, uint8_t controller = 0);
-
180 
-
185  void setLedOff(uint8_t controller = 0) {
-
186  setLedRaw(0, controller);
-
187  };
-
193  void setLedOn(LEDEnum l, uint8_t controller = 0);
-
199  void setLedBlink(LEDEnum l, uint8_t controller = 0);
-
205  void setLedMode(LEDModeEnum lm, uint8_t controller = 0);
-
211  uint8_t getBatteryLevel(uint8_t controller = 0);
-
217  bool buttonChanged(uint8_t controller = 0);
-
218 
-
223  void attachOnInit(void (*funcOnInit)(void)) {
-
224  pFuncOnInit = funcOnInit;
-
225  };
- -
231  uint8_t Xbox360Connected[4];
-
232 
-
233 protected:
- -
237  uint8_t bAddress;
- -
240 
-
241 private:
-
248  void onInit(uint8_t controller);
-
249  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
-
250 
-
251  bool bPollEnable;
-
252 
-
253  /* Variables to store the buttons */
-
254  uint32_t ButtonState[4];
-
255  uint32_t OldButtonState[4];
-
256  uint16_t ButtonClickState[4];
-
257  int16_t hatValue[4][4];
-
258  uint16_t controllerStatus[4];
-
259  bool buttonStateChanged[4]; // True if a button has changed
-
260 
-
261  bool L2Clicked[4]; // These buttons are analog, so we use we use these bools to check if they where clicked or not
-
262  bool R2Clicked[4];
-
263 
-
264  uint32_t checkStatusTimer; // Timing for checkStatus() signals
-
265 
-
266  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
-
267  uint8_t writeBuf[7]; // General purpose buffer for output data
-
268 
-
269  void readReport(uint8_t controller); // read incoming data
-
270  void printReport(uint8_t controller, uint8_t nBytes); // print incoming date - Uncomment for debugging
-
271 
-
272  /* Private commands */
-
273  void XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes);
-
274  void checkStatus();
-
275 };
-
276 #endif
-
#define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID
Definition: XBOXRECV.h:46
+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 #ifndef _xboxrecv_h_
21 #define _xboxrecv_h_
22 
23 #include "Usb.h"
24 #include "xboxEnums.h"
25 
26 /* Data Xbox 360 taken from descriptors */
27 #define EP_MAXPKTSIZE 32 // max size for data via USB
28 
29 /* Names we give to the 9 Xbox360 pipes */
30 #define XBOX_CONTROL_PIPE 0
31 #define XBOX_INPUT_PIPE_1 1
32 #define XBOX_OUTPUT_PIPE_1 2
33 #define XBOX_INPUT_PIPE_2 3
34 #define XBOX_OUTPUT_PIPE_2 4
35 #define XBOX_INPUT_PIPE_3 5
36 #define XBOX_OUTPUT_PIPE_3 6
37 #define XBOX_INPUT_PIPE_4 7
38 #define XBOX_OUTPUT_PIPE_4 8
39 
40 // PID and VID of the different devices
41 #define XBOX_VID 0x045E // Microsoft Corporation
42 #define MADCATZ_VID 0x1BAD // For unofficial Mad Catz receivers
43 #define JOYTECH_VID 0x162E // For unofficial Joytech controllers
44 
45 #define XBOX_WIRELESS_RECEIVER_PID 0x0719 // Microsoft Wireless Gaming Receiver
46 #define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID 0x0291 // Third party Wireless Gaming Receiver
47 
48 #define XBOX_MAX_ENDPOINTS 9
49 
55 class XBOXRECV : public USBDeviceConfig {
56 public:
61  XBOXRECV(USB *pUsb);
62 
71  uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed);
79  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
84  uint8_t Release();
89  uint8_t Poll();
90 
95  virtual uint8_t GetAddress() {
96  return bAddress;
97  };
98 
103  virtual bool isReady() {
104  return bPollEnable;
105  };
106 
113  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
114  return ((vid == XBOX_VID || vid == MADCATZ_VID || vid == JOYTECH_VID) && (pid == XBOX_WIRELESS_RECEIVER_PID || pid == XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID));
115  };
130  uint8_t getButtonPress(ButtonEnum b, uint8_t controller = 0);
131  bool getButtonClick(ButtonEnum b, uint8_t controller = 0);
141  int16_t getAnalogHat(AnalogHatEnum a, uint8_t controller = 0);
142 
147  void disconnect(uint8_t controller = 0);
148 
153  void setAllOff(uint8_t controller = 0) {
154  setRumbleOn(0, 0, controller);
155  setLedOff(controller);
156  };
157 
162  void setRumbleOff(uint8_t controller = 0) {
163  setRumbleOn(0, 0, controller);
164  };
171  void setRumbleOn(uint8_t lValue, uint8_t rValue, uint8_t controller = 0);
179  void setLedRaw(uint8_t value, uint8_t controller = 0);
180 
185  void setLedOff(uint8_t controller = 0) {
186  setLedRaw(0, controller);
187  };
193  void setLedOn(LEDEnum l, uint8_t controller = 0);
199  void setLedBlink(LEDEnum l, uint8_t controller = 0);
205  void setLedMode(LEDModeEnum lm, uint8_t controller = 0);
211  uint8_t getBatteryLevel(uint8_t controller = 0);
217  bool buttonChanged(uint8_t controller = 0);
218 
223  void attachOnInit(void (*funcOnInit)(void)) {
224  pFuncOnInit = funcOnInit;
225  };
231  uint8_t Xbox360Connected[4];
232 
233 protected:
237  uint8_t bAddress;
240 
241 private:
248  void onInit(uint8_t controller);
249  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
250 
251  bool bPollEnable;
252 
253  /* Variables to store the buttons */
254  uint32_t ButtonState[4];
255  uint32_t OldButtonState[4];
256  uint16_t ButtonClickState[4];
257  int16_t hatValue[4][4];
258  uint16_t controllerStatus[4];
259  bool buttonStateChanged[4]; // True if a button has changed
260 
261  bool L2Clicked[4]; // These buttons are analog, so we use we use these bools to check if they where clicked or not
262  bool R2Clicked[4];
263 
264  uint32_t checkStatusTimer; // Timing for checkStatus() signals
265 
266  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
267  uint8_t writeBuf[7]; // General purpose buffer for output data
268 
269  void readReport(uint8_t controller); // read incoming data
270  void printReport(uint8_t controller, uint8_t nBytes); // print incoming date - Uncomment for debugging
271 
272  /* Private commands */
273  void XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes);
274  void checkStatus();
275 };
276 #endif
#define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID
Definition: XBOXRECV.h:46
LEDModeEnum
Definition: xboxEnums.h:24
uint8_t Poll()
Definition: XBOXRECV.cpp:293
void setRumbleOn(uint8_t lValue, uint8_t rValue, uint8_t controller=0)
Definition: XBOXRECV.cpp:557
@@ -271,7 +136,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 45e13b6a..dd1cb8fd 100644 --- a/_x_b_o_x_u_s_b_8cpp.html +++ b/_x_b_o_x_u_s_b_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXUSB.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,13 +86,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXUSB.cpp File Reference
-
#include "XBOXUSB.h"
+
#include "XBOXUSB.h"
Include dependency graph for XBOXUSB.cpp:
- + + + + + + +

Go to the source code of this file.

@@ -100,7 +107,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 94b88c1b..ab21819a 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 48fc7134..56fff921 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 @@ -aeeebf19dc2418ea596d729160939475 \ No newline at end of file +c0796622753a276d2229e35ba1e7b14a \ 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 282d5156..2dc359a1 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 0a288587..e46c8e8b 100644 --- a/_x_b_o_x_u_s_b_8cpp_source.html +++ b/_x_b_o_x_u_s_b_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXUSB.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,369 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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
+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
@@ -545,7 +184,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_x_b_o_x_u_s_b_8h.html b/_x_b_o_x_u_s_b_8h.html index 4b4d2abc..faf62d10 100644 --- a/_x_b_o_x_u_s_b_8h.html +++ b/_x_b_o_x_u_s_b_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXUSB.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,22 +89,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXUSB.h File Reference
-
#include "Usb.h"
-#include "usbhid.h"
-#include "xboxEnums.h"
+
#include "Usb.h"
+#include "usbhid.h"
+#include "xboxEnums.h"
Include dependency graph for XBOXUSB.h:
- + + + + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -410,7 +417,7 @@ Macros diff --git a/_x_b_o_x_u_s_b_8h__dep__incl.map b/_x_b_o_x_u_s_b_8h__dep__incl.map index 4c3784f0..97a167a3 100644 --- a/_x_b_o_x_u_s_b_8h__dep__incl.map +++ b/_x_b_o_x_u_s_b_8h__dep__incl.map @@ -1,3 +1,3 @@ - + 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 03f735e5..ffb0405c 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 @@ -aef1e874621fe82e06208994ca6c31c1 \ No newline at end of file +18da52fa9e2758f5b169a34307b52822 \ 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 28d08df6..4852ab9f 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 0cd83d7f..0c6a4e15 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 e6bc3b00..9ea5abe3 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 @@ -5ffed0cacc144f91cce7ea1833931bf0 \ No newline at end of file +bffb200b269ce5778ffd1fb3cca482e2 \ 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 4f185bb1..8ba28600 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 bc12bfd5..f697a2cc 100644 --- a/_x_b_o_x_u_s_b_8h_source.html +++ b/_x_b_o_x_u_s_b_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXUSB.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,135 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
XBOXUSB.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 _xboxusb_h_
-
19 #define _xboxusb_h_
-
20 
-
21 #include "Usb.h"
-
22 #include "usbhid.h"
-
23 #include "xboxEnums.h"
-
24 
-
25 /* Data Xbox 360 taken from descriptors */
-
26 #define EP_MAXPKTSIZE 32 // max size for data via USB
-
27 
-
28 /* Names we give to the 3 Xbox360 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 #define GAMESTOP_VID 0x0E6F // Gamestop controller
-
38 
-
39 #define XBOX_WIRED_PID 0x028E // Microsoft 360 Wired controller
-
40 #define XBOX_WIRELESS_PID 0x028F // Wireless controller only support charging
-
41 #define XBOX_WIRELESS_RECEIVER_PID 0x0719 // Microsoft Wireless Gaming Receiver
-
42 #define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID 0x0291 // Third party Wireless Gaming Receiver
-
43 #define MADCATZ_WIRED_PID 0xF016 // Mad Catz wired controller
-
44 #define JOYTECH_WIRED_PID 0xBEEF // For Joytech wired controller
-
45 #define GAMESTOP_WIRED_PID 0x0401 // Gamestop wired controller
-
46 #define AFTERGLOW_WIRED_PID 0x0213 // Afterglow wired controller - it uses the same VID as a Gamestop controller
-
47 
-
48 #define XBOX_REPORT_BUFFER_SIZE 14 // Size of the input report buffer
-
49 
-
50 #define XBOX_MAX_ENDPOINTS 3
-
51 
-
53 class XBOXUSB : public USBDeviceConfig {
-
54 public:
-
59  XBOXUSB(USB *pUsb);
-
60 
-
69  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
-
74  uint8_t Release();
-
79  uint8_t Poll();
-
80 
-
85  virtual uint8_t GetAddress() {
-
86  return bAddress;
-
87  };
-
88 
-
93  virtual bool isReady() {
-
94  return bPollEnable;
-
95  };
-
96 
-
103  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
-
104  return ((vid == XBOX_VID || vid == MADCATZ_VID || vid == JOYTECH_VID || vid == GAMESTOP_VID) && (pid == XBOX_WIRED_PID || pid == MADCATZ_WIRED_PID || pid == GAMESTOP_WIRED_PID || pid == AFTERGLOW_WIRED_PID || pid == JOYTECH_WIRED_PID));
-
105  };
-
119  uint8_t getButtonPress(ButtonEnum b);
-
120  bool getButtonClick(ButtonEnum b);
-
129  int16_t getAnalogHat(AnalogHatEnum a);
-
130 
-
132  void setAllOff() {
-
133  setRumbleOn(0, 0);
-
134  setLedRaw(0);
-
135  };
-
136 
-
138  void setRumbleOff() {
-
139  setRumbleOn(0, 0);
-
140  };
-
146  void setRumbleOn(uint8_t lValue, uint8_t rValue);
-
153  void setLedRaw(uint8_t value);
-
154 
-
156  void setLedOff() {
-
157  setLedRaw(0);
-
158  };
-
163  void setLedOn(LEDEnum l);
-
168  void setLedBlink(LEDEnum l);
-
173  void setLedMode(LEDModeEnum lm);
-
174 
-
179  void attachOnInit(void (*funcOnInit)(void)) {
-
180  pFuncOnInit = funcOnInit;
-
181  };
-
185  bool Xbox360Connected;
-
186 
-
187 protected:
- -
191  uint8_t bAddress;
- -
194 
-
195 private:
-
201  void onInit();
-
202  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
-
203 
-
204  bool bPollEnable;
-
205 
-
206  /* Variables to store the buttons */
-
207  uint32_t ButtonState;
-
208  uint32_t OldButtonState;
-
209  uint16_t ButtonClickState;
-
210  int16_t hatValue[4];
-
211  uint16_t controllerStatus;
-
212 
-
213  bool L2Clicked; // These buttons are analog, so we use we use these bools to check if they where clicked or not
-
214  bool R2Clicked;
-
215 
-
216  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
-
217  uint8_t writeBuf[8]; // General purpose buffer for output data
-
218 
-
219  void readReport(); // read incoming data
-
220  void printReport(); // print incoming date - Uncomment for debugging
-
221 
-
222  /* Private commands */
-
223  void XboxCommand(uint8_t* data, uint16_t nbytes);
-
224 };
-
225 #endif
-
#define XBOX_WIRED_PID
Definition: XBOXUSB.h:39
+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 _xboxusb_h_
19 #define _xboxusb_h_
20 
21 #include "Usb.h"
22 #include "usbhid.h"
23 #include "xboxEnums.h"
24 
25 /* Data Xbox 360 taken from descriptors */
26 #define EP_MAXPKTSIZE 32 // max size for data via USB
27 
28 /* Names we give to the 3 Xbox360 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 #define GAMESTOP_VID 0x0E6F // Gamestop controller
38 
39 #define XBOX_WIRED_PID 0x028E // Microsoft 360 Wired controller
40 #define XBOX_WIRELESS_PID 0x028F // Wireless controller only support charging
41 #define XBOX_WIRELESS_RECEIVER_PID 0x0719 // Microsoft Wireless Gaming Receiver
42 #define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID 0x0291 // Third party Wireless Gaming Receiver
43 #define MADCATZ_WIRED_PID 0xF016 // Mad Catz wired controller
44 #define JOYTECH_WIRED_PID 0xBEEF // For Joytech wired controller
45 #define GAMESTOP_WIRED_PID 0x0401 // Gamestop wired controller
46 #define AFTERGLOW_WIRED_PID 0x0213 // Afterglow wired controller - it uses the same VID as a Gamestop controller
47 
48 #define XBOX_REPORT_BUFFER_SIZE 14 // Size of the input report buffer
49 
50 #define XBOX_MAX_ENDPOINTS 3
51 
53 class XBOXUSB : public USBDeviceConfig {
54 public:
59  XBOXUSB(USB *pUsb);
60 
69  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
74  uint8_t Release();
79  uint8_t Poll();
80 
85  virtual uint8_t GetAddress() {
86  return bAddress;
87  };
88 
93  virtual bool isReady() {
94  return bPollEnable;
95  };
96 
103  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
104  return ((vid == XBOX_VID || vid == MADCATZ_VID || vid == JOYTECH_VID || vid == GAMESTOP_VID) && (pid == XBOX_WIRED_PID || pid == MADCATZ_WIRED_PID || pid == GAMESTOP_WIRED_PID || pid == AFTERGLOW_WIRED_PID || pid == JOYTECH_WIRED_PID));
105  };
119  uint8_t getButtonPress(ButtonEnum b);
120  bool getButtonClick(ButtonEnum b);
129  int16_t getAnalogHat(AnalogHatEnum a);
130 
132  void setAllOff() {
133  setRumbleOn(0, 0);
134  setLedRaw(0);
135  };
136 
138  void setRumbleOff() {
139  setRumbleOn(0, 0);
140  };
146  void setRumbleOn(uint8_t lValue, uint8_t rValue);
153  void setLedRaw(uint8_t value);
154 
156  void setLedOff() {
157  setLedRaw(0);
158  };
163  void setLedOn(LEDEnum l);
168  void setLedBlink(LEDEnum l);
173  void setLedMode(LEDModeEnum lm);
174 
179  void attachOnInit(void (*funcOnInit)(void)) {
180  pFuncOnInit = funcOnInit;
181  };
185  bool Xbox360Connected;
186 
187 protected:
191  uint8_t bAddress;
194 
195 private:
201  void onInit();
202  void (*pFuncOnInit)(void); // Pointer to function called in onInit()
203 
204  bool bPollEnable;
205 
206  /* Variables to store the buttons */
207  uint32_t ButtonState;
208  uint32_t OldButtonState;
209  uint16_t ButtonClickState;
210  int16_t hatValue[4];
211  uint16_t controllerStatus;
212 
213  bool L2Clicked; // These buttons are analog, so we use we use these bools to check if they where clicked or not
214  bool R2Clicked;
215 
216  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
217  uint8_t writeBuf[8]; // General purpose buffer for output data
218 
219  void readReport(); // read incoming data
220  void printReport(); // print incoming date - Uncomment for debugging
221 
222  /* Private commands */
223  void XboxCommand(uint8_t* data, uint16_t nbytes);
224 };
225 #endif
#define XBOX_WIRED_PID
Definition: XBOXUSB.h:39
LEDModeEnum
Definition: xboxEnums.h:24
void setLedOn(LEDEnum l)
Definition: XBOXUSB.cpp:329
#define MADCATZ_VID
Definition: XBOXUSB.h:35
@@ -263,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/address_8h.html b/address_8h.html index f3ed321e..7a523b0a 100644 --- a/address_8h.html +++ b/address_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: address.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -128,8 +129,8 @@ Macros - - + +

Typedefs

typedef void(* UsbDeviceHandleFunc )(UsbDevice *pdev)
 
typedef void(* UsbDeviceHandleFunc) (UsbDevice *pdev)
 

Macro Definition Documentation

@@ -259,12 +260,12 @@ Typedefs

Typedef Documentation

- +
- +
typedef void(* UsbDeviceHandleFunc)(UsbDevice *pdev)typedef void(* UsbDeviceHandleFunc) (UsbDevice *pdev)
@@ -278,7 +279,7 @@ Typedefs diff --git a/address_8h_source.html b/address_8h_source.html index 38cf4bb7..eaf1c570 100644 --- a/address_8h_source.html +++ b/address_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: address.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,297 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
address.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 #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
+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
@@ -383,15 +94,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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
-
void(* UsbDeviceHandleFunc)(UsbDevice *pdev)
Definition: address.h:97
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
@@ -405,12 +112,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 18a0ff61..c0a3d423 100644 --- a/adk_8cpp.html +++ b/adk_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: adk.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,13 +86,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
adk.cpp File Reference
-
#include "adk.h"
+
#include "adk.h"
Include dependency graph for adk.cpp:
- + + +

Go to the source code of this file.

@@ -100,7 +103,7 @@ Include dependency graph for adk.cpp:
diff --git a/adk_8cpp__incl.map b/adk_8cpp__incl.map index bbf2b3d1..eb12d3fa 100644 --- a/adk_8cpp__incl.map +++ b/adk_8cpp__incl.map @@ -1,4 +1,4 @@ - - + + diff --git a/adk_8cpp__incl.md5 b/adk_8cpp__incl.md5 index a794ca89..aeb01f6d 100644 --- a/adk_8cpp__incl.md5 +++ b/adk_8cpp__incl.md5 @@ -1 +1 @@ -d6ef7cc264e9225e78397a4cf8f08152 \ No newline at end of file +44064901c7f950ea3e40c91d455ee2ad \ No newline at end of file diff --git a/adk_8cpp__incl.png b/adk_8cpp__incl.png index bfc0e0b8..b1518db0 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 db29b93d..5324ba5f 100644 --- a/adk_8cpp_source.html +++ b/adk_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: adk.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,379 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 __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:801
+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:801
uint8_t bmRcvToggle
Definition: address.h:48
#define ADB_PID
Definition: adk.h:27
@@ -537,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/adk_8h.html b/adk_8h.html index 6aff8e00..56609dfa 100644 --- a/adk_8h.html +++ b/adk_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: adk.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,20 +89,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
adk.h File Reference
-
#include "Usb.h"
+
#include "Usb.h"
Include dependency graph for adk.h:
- + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -376,7 +379,7 @@ Macros diff --git a/adk_8h__dep__incl.map b/adk_8h__dep__incl.map index 3983ea52..2c793cd8 100644 --- a/adk_8h__dep__incl.map +++ b/adk_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/adk_8h__dep__incl.md5 b/adk_8h__dep__incl.md5 index ddb1727d..721031bf 100644 --- a/adk_8h__dep__incl.md5 +++ b/adk_8h__dep__incl.md5 @@ -1 +1 @@ -c99e1b47b64e7d137c66cdf8662c2d34 \ No newline at end of file +e6d0d56c52d3fb6e81b76806cae456b2 \ No newline at end of file diff --git a/adk_8h__dep__incl.png b/adk_8h__dep__incl.png index 31a013a3..b9ff26e3 100644 Binary files a/adk_8h__dep__incl.png and b/adk_8h__dep__incl.png differ diff --git a/adk_8h__incl.map b/adk_8h__incl.map index fcfea7b7..89c23cc9 100644 --- a/adk_8h__incl.map +++ b/adk_8h__incl.map @@ -1,3 +1,3 @@ - + diff --git a/adk_8h__incl.md5 b/adk_8h__incl.md5 index 12b6b5d1..78ab8688 100644 --- a/adk_8h__incl.md5 +++ b/adk_8h__incl.md5 @@ -1 +1 @@ -60a0d9759961c77b6c4712add13727e1 \ No newline at end of file +6316d3a392a1c1e1b044b310cd053323 \ No newline at end of file diff --git a/adk_8h__incl.png b/adk_8h__incl.png index 666a03c5..436fec59 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 dccbbf71..532a0c3a 100644 --- a/adk_8h_source.html +++ b/adk_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: adk.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,147 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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
@@ -267,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/annotated.html b/annotated.html index 775d37a1..f28ee937 100644 --- a/annotated.html +++ b/annotated.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -73,7 +74,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -89,101 +90,101 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Here are the classes, structs, unions and interfaces with brief descriptions:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
oCACM
oCACM_FUNC_DESCR
oCAddressPool
oCAddressPoolImpl
oCADK
oCBASICCDB
oCBluetoothService
oCBTD
oCBTHID
oCBulkOnly
oCByteSkipper
oCCALL_MGMNT_FUNC_DESCR
oCCapacity
oCCDB10
oCCDB12
oCCDB6
oCCDB_LBA32_16
oCCDB_LBA64_16
oCCDCAsyncOper
oCCLASS_NOTIFICATION
oCCommandBlockWrapper
oCCommandBlockWrapperBase
oCCommandStatusWrapper
oCConfigDescParser
oCEpInfo
oCFTDI
oCFTDIAsyncOper
oCHexDumper
oCHID_CLASS_DESCRIPTOR_LEN_AND_TYPE
oCHIDBoot
oCHIDComposite
oCHidItemPrefix
oCHIDReportParser
oCHIDUniversal
oCHubDescriptor
oCHubEvent
oCInquiryResponse
oCKBDINFO
oCKBDLEDS
oCKeyboardReportParser
oCLINE_CODING
oCMainItemIOFeature
oCMAX3421e
oCMax_LCD
oCMODIFIERKEYS
oCMOUSEINFO
oCMouseReportParser
oCMultiByteValueParser
oCMultiValueBuffer
oCPL2303
oCPS3BT
oCPS3USB
oCPS4BT
oCPS4Buttons
oCPS4Data
oCPS4Output
oCPS4Parser
oCPS4Status
oCPS4USB
oCPSBuzz
oCPSBUZZButtons
oCPTPListParser
oCReportDescParser
oCReportDescParser2
oCReportDescParserBase
oCRequestSenseResponce
oCSETUP_PKT
oCSinkParser
oCSPi
oCSPP
oCTEL_RINGER_FUNC_DESCR
oCtouchpadXY
oCtty_features
oCUHS2_GPIO
oCUniversalReportParser
oCUSB
oCUSB_CONFIGURATION_DESCRIPTOR
oCUSB_DEVICE_DESCRIPTOR
oCUSB_ENDPOINT_DESCRIPTOR
oCUSB_HID_DESCRIPTOR
oCUSB_INTERFACE_DESCRIPTOR
oCUsbConfigXtracter
oCUsbDevice
oCUsbDeviceAddress
oCUSBDeviceConfig
oCUSBH_MIDI
oCUSBHID
oCUSBHub
oCUSBReadParser
oCWII
oCXBOXOLD
oCXBOXONE
oCXBOXRECV
oCXBOXUSB
\CXR21B1411
 CACM
 CACM_FUNC_DESCR
 CAddressPool
 CAddressPoolImpl
 CADK
 CBASICCDB
 CBluetoothService
 CBTD
 CBTHID
 CBulkOnly
 CByteSkipper
 CCALL_MGMNT_FUNC_DESCR
 CCapacity
 CCDB10
 CCDB12
 CCDB6
 CCDB_LBA32_16
 CCDB_LBA64_16
 CCDCAsyncOper
 CCLASS_NOTIFICATION
 CCommandBlockWrapper
 CCommandBlockWrapperBase
 CCommandStatusWrapper
 CConfigDescParser
 CEpInfo
 CFTDI
 CFTDIAsyncOper
 CHexDumper
 CHID_CLASS_DESCRIPTOR_LEN_AND_TYPE
 CHIDBoot
 CHIDComposite
 CHidItemPrefix
 CHIDReportParser
 CHIDUniversal
 CHubDescriptor
 CHubEvent
 CInquiryResponse
 CKBDINFO
 CKBDLEDS
 CKeyboardReportParser
 CLINE_CODING
 CMainItemIOFeature
 CMAX3421e
 CMax_LCD
 CMODIFIERKEYS
 CMOUSEINFO
 CMouseReportParser
 CMultiByteValueParser
 CMultiValueBuffer
 CPL2303
 CPS3BT
 CPS3USB
 CPS4BT
 CPS4Buttons
 CPS4Data
 CPS4Output
 CPS4Parser
 CPS4Status
 CPS4USB
 CPSBuzz
 CPSBUZZButtons
 CPTPListParser
 CReportDescParser
 CReportDescParser2
 CReportDescParserBase
 CRequestSenseResponce
 CSETUP_PKT
 CSinkParser
 CSPi
 CSPP
 CTEL_RINGER_FUNC_DESCR
 CtouchpadXY
 Ctty_features
 CUHS2_GPIO
 CUniversalReportParser
 CUSB
 CUSB_CONFIGURATION_DESCRIPTOR
 CUSB_DEVICE_DESCRIPTOR
 CUSB_ENDPOINT_DESCRIPTOR
 CUSB_HID_DESCRIPTOR
 CUSB_INTERFACE_DESCRIPTOR
 CUsbConfigXtracter
 CUsbDevice
 CUsbDeviceAddress
 CUSBDeviceConfig
 CUSBH_MIDI
 CUSBHID
 CUSBHub
 CUSBReadParser
 CWII
 CXBOXOLD
 CXBOXONE
 CXBOXRECV
 CXBOXUSB
 CXR21B1411
@@ -191,7 +192,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ftv2mlastnode.png b/arrowdown.png similarity index 100% rename from ftv2mlastnode.png rename to arrowdown.png diff --git a/ftv2plastnode.png b/arrowright.png similarity index 100% rename from ftv2plastnode.png rename to arrowright.png diff --git a/avrpins_8h.html b/avrpins_8h.html index 3cfec52d..692aaaaa 100644 --- a/avrpins_8h.html +++ b/avrpins_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: avrpins.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -92,7 +93,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/avrpins_8h_source.html b/avrpins_8h_source.html index b1d2dab8..90e3d349 100644 --- a/avrpins_8h_source.html +++ b/avrpins_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: avrpins.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,1507 +86,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 // Workaround the following issue: https://github.com/esp8266/Arduino/pull/5735
-
1399 #undef pgm_read_ptr_aligned
-
1400 #ifdef __cplusplus
-
1401 #define pgm_read_ptr_aligned(addr) (*reinterpret_cast<const void* const*>(addr))
-
1402 #else
-
1403 #define pgm_read_ptr_aligned(addr) (*(const void* const*)(addr))
-
1404 #endif
-
1405 
-
1406 #undef pgm_read_ptr
-
1407 #if PGM_READ_UNALIGNED
-
1408 #define pgm_read_ptr(p) pgm_read_ptr_unaligned(p)
-
1409 #else
-
1410 #define pgm_read_ptr(p) pgm_read_ptr_aligned(p)
-
1411 #endif
-
1412 
-
1413 #ifdef pgm_read_pointer
-
1414 #undef pgm_read_pointer
-
1415 #endif
-
1416 #define pgm_read_pointer(p) pgm_read_ptr(p)
-
1417 
-
1418 // Pinout for ESP-12 module
-
1419 // 0 .. 16 - Digital pins
-
1420 // GPIO 6 to 11 and 16 are not usable in this library.
-
1421 
-
1422 MAKE_PIN(P0, 0);
-
1423 MAKE_PIN(P1, 1); // TX0
-
1424 MAKE_PIN(P2, 2); // TX1
-
1425 MAKE_PIN(P3, 3); // RX0
-
1426 MAKE_PIN(P4, 4); // SDA
-
1427 MAKE_PIN(P5, 5); // SCL
-
1428 MAKE_PIN(P12, 12); // MISO
-
1429 MAKE_PIN(P13, 13); // MOSI
-
1430 MAKE_PIN(P14, 14); // SCK
-
1431 MAKE_PIN(P15, 15); // SS
-
1432 
-
1433 #elif defined(ESP32)
-
1434 
-
1435 // Workaround strict-aliasing warnings
-
1436 #ifdef pgm_read_word
-
1437 #undef pgm_read_word
-
1438 #endif
-
1439 #ifdef pgm_read_dword
-
1440 #undef pgm_read_dword
-
1441 #endif
-
1442 #ifdef pgm_read_float
-
1443 #undef pgm_read_float
-
1444 #endif
-
1445 #ifdef pgm_read_ptr
-
1446 #undef pgm_read_ptr
-
1447 #endif
-
1448 
-
1449 #define pgm_read_word(addr) ({ \
-
1450  typeof(addr) _addr = (addr); \
-
1451  *(const unsigned short *)(_addr); \
-
1452 })
-
1453 #define pgm_read_dword(addr) ({ \
-
1454  typeof(addr) _addr = (addr); \
-
1455  *(const unsigned long *)(_addr); \
-
1456 })
-
1457 #define pgm_read_float(addr) ({ \
-
1458  typeof(addr) _addr = (addr); \
-
1459  *(const float *)(_addr); \
-
1460 })
-
1461 #define pgm_read_ptr(addr) ({ \
-
1462  typeof(addr) _addr = (addr); \
-
1463  *(void * const *)(_addr); \
-
1464 })
-
1465 
-
1466 // Pinout for ESP32 dev module
-
1467 
-
1468 MAKE_PIN(P0, 0);
-
1469 MAKE_PIN(P1, 1); // TX0
-
1470 MAKE_PIN(P10, 10); // TX1
-
1471 MAKE_PIN(P3, 3); // RX0
-
1472 MAKE_PIN(P21, 21); // SDA
-
1473 MAKE_PIN(P22, 22); // SCL
-
1474 MAKE_PIN(P19, 19); // MISO
-
1475 MAKE_PIN(P23, 23); // MOSI
-
1476 MAKE_PIN(P18, 18); // SCK
-
1477 MAKE_PIN(P5, 5); // SS
-
1478 MAKE_PIN(P17, 17); // INT
-
1479 
-
1480 #endif
-
1481 
-
1482 #undef MAKE_PIN
-
1483 
-
1484 // pgm_read_ptr is not defined in the ESP32, so we have to undef the diffinition from version_helper.h
-
1485 #ifdef pgm_read_pointer
-
1486 #undef pgm_read_pointer
-
1487 #endif
-
1488 #define pgm_read_pointer(p) pgm_read_ptr(p)
-
1489 
-
1490 #else
-
1491 #error "Please define board in avrpins.h"
-
1492 
-
1493 #endif
-
1494 
-
1495 #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 // Workaround the following issue: https://github.com/esp8266/Arduino/pull/5735
1399 #undef pgm_read_ptr_aligned
1400 #ifdef __cplusplus
1401 #define pgm_read_ptr_aligned(addr) (*reinterpret_cast<const void* const*>(addr))
1402 #else
1403 #define pgm_read_ptr_aligned(addr) (*(const void* const*)(addr))
1404 #endif
1405 
1406 #undef pgm_read_ptr
1407 #if PGM_READ_UNALIGNED
1408 #define pgm_read_ptr(p) pgm_read_ptr_unaligned(p)
1409 #else
1410 #define pgm_read_ptr(p) pgm_read_ptr_aligned(p)
1411 #endif
1412 
1413 #ifdef pgm_read_pointer
1414 #undef pgm_read_pointer
1415 #endif
1416 #define pgm_read_pointer(p) pgm_read_ptr(p)
1417 
1418 // Pinout for ESP-12 module
1419 // 0 .. 16 - Digital pins
1420 // GPIO 6 to 11 and 16 are not usable in this library.
1421 
1422 MAKE_PIN(P0, 0);
1423 MAKE_PIN(P1, 1); // TX0
1424 MAKE_PIN(P2, 2); // TX1
1425 MAKE_PIN(P3, 3); // RX0
1426 MAKE_PIN(P4, 4); // SDA
1427 MAKE_PIN(P5, 5); // SCL
1428 MAKE_PIN(P12, 12); // MISO
1429 MAKE_PIN(P13, 13); // MOSI
1430 MAKE_PIN(P14, 14); // SCK
1431 MAKE_PIN(P15, 15); // SS
1432 
1433 #elif defined(ESP32)
1434 
1435 // Workaround strict-aliasing warnings
1436 #ifdef pgm_read_word
1437 #undef pgm_read_word
1438 #endif
1439 #ifdef pgm_read_dword
1440 #undef pgm_read_dword
1441 #endif
1442 #ifdef pgm_read_float
1443 #undef pgm_read_float
1444 #endif
1445 #ifdef pgm_read_ptr
1446 #undef pgm_read_ptr
1447 #endif
1448 
1449 #define pgm_read_word(addr) ({ \
1450  typeof(addr) _addr = (addr); \
1451  *(const unsigned short *)(_addr); \
1452 })
1453 #define pgm_read_dword(addr) ({ \
1454  typeof(addr) _addr = (addr); \
1455  *(const unsigned long *)(_addr); \
1456 })
1457 #define pgm_read_float(addr) ({ \
1458  typeof(addr) _addr = (addr); \
1459  *(const float *)(_addr); \
1460 })
1461 #define pgm_read_ptr(addr) ({ \
1462  typeof(addr) _addr = (addr); \
1463  *(void * const *)(_addr); \
1464 })
1465 
1466 // Pinout for ESP32 dev module
1467 
1468 MAKE_PIN(P0, 0);
1469 MAKE_PIN(P1, 1); // TX0
1470 MAKE_PIN(P10, 10); // TX1
1471 MAKE_PIN(P3, 3); // RX0
1472 MAKE_PIN(P21, 21); // SDA
1473 MAKE_PIN(P22, 22); // SCL
1474 MAKE_PIN(P19, 19); // MISO
1475 MAKE_PIN(P23, 23); // MOSI
1476 MAKE_PIN(P18, 18); // SCK
1477 MAKE_PIN(P5, 5); // SS
1478 MAKE_PIN(P17, 17); // INT
1479 
1480 #endif
1481 
1482 #undef MAKE_PIN
1483 
1484 // pgm_read_ptr is not defined in the ESP32, so we have to undef the diffinition from version_helper.h
1485 #ifdef pgm_read_pointer
1486 #undef pgm_read_pointer
1487 #endif
1488 #define pgm_read_pointer(p) pgm_read_ptr(p)
1489 
1490 #else
1491 #error "Please define board in avrpins.h"
1492 
1493 #endif
1494 
1495 #endif //_avrpins_h_
diff --git a/cdc___x_r21_b1411_8cpp.html b/cdc___x_r21_b1411_8cpp.html index 1a5a3bb0..6a714c66 100644 --- a/cdc___x_r21_b1411_8cpp.html +++ b/cdc___x_r21_b1411_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdc_XR21B1411.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,13 +86,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
cdc_XR21B1411.cpp File Reference
-
#include "cdc_XR21B1411.h"
+
#include "cdc_XR21B1411.h"
Include dependency graph for cdc_XR21B1411.cpp:
- + + + +

Go to the source code of this file.

@@ -100,7 +104,7 @@ Include dependency graph for cdc_XR21B1411.cpp:
diff --git a/cdc___x_r21_b1411_8cpp__incl.map b/cdc___x_r21_b1411_8cpp__incl.map index 3a1c1637..b598ec85 100644 --- a/cdc___x_r21_b1411_8cpp__incl.map +++ b/cdc___x_r21_b1411_8cpp__incl.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/cdc___x_r21_b1411_8cpp__incl.md5 b/cdc___x_r21_b1411_8cpp__incl.md5 index e50febbd..488365a4 100644 --- a/cdc___x_r21_b1411_8cpp__incl.md5 +++ b/cdc___x_r21_b1411_8cpp__incl.md5 @@ -1 +1 @@ -fec8759d6350e74a7f80e436ca9d2758 \ No newline at end of file +94c1f3e832d30d1e0699ba30de20f4fa \ 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 5e777a6e..c73f1f3f 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 70ffef18..58d197cc 100644 --- a/cdc___x_r21_b1411_8cpp_source.html +++ b/cdc___x_r21_b1411_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdc_XR21B1411.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,218 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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:71
+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:71
#define USB_CLASS_CDC_DATA
Definition: UsbCore.h:78
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:801
@@ -363,7 +153,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/cdc___x_r21_b1411_8h.html b/cdc___x_r21_b1411_8h.html index 2a396f29..0011869d 100644 --- a/cdc___x_r21_b1411_8h.html +++ b/cdc___x_r21_b1411_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdc_XR21B1411.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,20 +89,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
cdc_XR21B1411.h File Reference
-
#include "cdcacm.h"
+
#include "cdcacm.h"
Include dependency graph for cdc_XR21B1411.h:
- + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -1016,7 +1020,7 @@ Macros diff --git a/cdc___x_r21_b1411_8h__dep__incl.map b/cdc___x_r21_b1411_8h__dep__incl.map index e6c04a61..392b1227 100644 --- a/cdc___x_r21_b1411_8h__dep__incl.map +++ b/cdc___x_r21_b1411_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/cdc___x_r21_b1411_8h__dep__incl.md5 b/cdc___x_r21_b1411_8h__dep__incl.md5 index 5ec00050..d1f48836 100644 --- a/cdc___x_r21_b1411_8h__dep__incl.md5 +++ b/cdc___x_r21_b1411_8h__dep__incl.md5 @@ -1 +1 @@ -7b6d944e95130fac53f28b98c412ca07 \ No newline at end of file +250b78e5b50dfc5c4569c99531678ec3 \ 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 12a1b731..9fed7616 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.map b/cdc___x_r21_b1411_8h__incl.map index fdb92b45..d6f9b68d 100644 --- a/cdc___x_r21_b1411_8h__incl.map +++ b/cdc___x_r21_b1411_8h__incl.map @@ -1,4 +1,4 @@ - - + + diff --git a/cdc___x_r21_b1411_8h__incl.md5 b/cdc___x_r21_b1411_8h__incl.md5 index ecda9e28..8ab25f05 100644 --- a/cdc___x_r21_b1411_8h__incl.md5 +++ b/cdc___x_r21_b1411_8h__incl.md5 @@ -1 +1 @@ -4731940ab085839886908f5c8f5a124c \ No newline at end of file +ab5d3dff2680fe378e5afcfe3049b74b \ 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 b350bf94..a99ae5d3 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 94becee6..e8acb852 100644 --- a/cdc___x_r21_b1411_8h_source.html +++ b/cdc___x_r21_b1411_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdc_XR21B1411.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,271 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 (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)
+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:165
@@ -395,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/cdcacm_8cpp.html b/cdcacm_8cpp.html index 59931cbf..19202142 100644 --- a/cdcacm_8cpp.html +++ b/cdcacm_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcacm.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,13 +86,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
cdcacm.cpp File Reference
-
#include "cdcacm.h"
+
#include "cdcacm.h"
Include dependency graph for cdcacm.cpp:
- + + +

Go to the source code of this file.

@@ -100,7 +103,7 @@ Include dependency graph for cdcacm.cpp:
diff --git a/cdcacm_8cpp__incl.map b/cdcacm_8cpp__incl.map index 9c443aa3..fe3ebf6c 100644 --- a/cdcacm_8cpp__incl.map +++ b/cdcacm_8cpp__incl.map @@ -1,4 +1,4 @@ - - + + diff --git a/cdcacm_8cpp__incl.md5 b/cdcacm_8cpp__incl.md5 index 49395eca..9fd4609d 100644 --- a/cdcacm_8cpp__incl.md5 +++ b/cdcacm_8cpp__incl.md5 @@ -1 +1 @@ -b7b7a67edb342e99305bf84049fe6e3a \ No newline at end of file +8836c5951dac28c739547b666b24d9f8 \ No newline at end of file diff --git a/cdcacm_8cpp__incl.png b/cdcacm_8cpp__incl.png index 805f6b07..b16418d4 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 23772ec5..90689eb2 100644 --- a/cdcacm_8cpp_source.html +++ b/cdcacm_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcacm.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,374 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 __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:71
+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:71
#define USB_CLASS_CDC_DATA
Definition: UsbCore.h:78
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:801
uint8_t bmRcvToggle
Definition: address.h:48
@@ -569,7 +203,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/cdcacm_8h.html b/cdcacm_8h.html index 016e495a..049d0598 100644 --- a/cdcacm_8h.html +++ b/cdcacm_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcacm.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -89,20 +90,26 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
cdcacm.h File Reference
-
#include "Usb.h"
+
#include "Usb.h"
Include dependency graph for cdcacm.h:
- + +
This graph shows which files directly or indirectly include this file:
- + + + + + +

Go to the source code of this file.

@@ -1014,7 +1021,7 @@ Typedefs diff --git a/cdcacm_8h__dep__incl.map b/cdcacm_8h__dep__incl.map index 3c20a863..c9aff920 100644 --- a/cdcacm_8h__dep__incl.map +++ b/cdcacm_8h__dep__incl.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/cdcacm_8h__dep__incl.md5 b/cdcacm_8h__dep__incl.md5 index e52e6481..9355f061 100644 --- a/cdcacm_8h__dep__incl.md5 +++ b/cdcacm_8h__dep__incl.md5 @@ -1 +1 @@ -ceccbf136b10ff86806ba6f6cb3bfe18 \ No newline at end of file +d9684fa8dbbab21f6c77cde6aba312ed \ No newline at end of file diff --git a/cdcacm_8h__dep__incl.png b/cdcacm_8h__dep__incl.png index 52ece943..68f7165a 100644 Binary files a/cdcacm_8h__dep__incl.png and b/cdcacm_8h__dep__incl.png differ diff --git a/cdcacm_8h__incl.map b/cdcacm_8h__incl.map index 4c3a4211..5f0a1aaf 100644 --- a/cdcacm_8h__incl.map +++ b/cdcacm_8h__incl.map @@ -1,3 +1,3 @@ - + diff --git a/cdcacm_8h__incl.md5 b/cdcacm_8h__incl.md5 index d35865e2..ac958164 100644 --- a/cdcacm_8h__incl.md5 +++ b/cdcacm_8h__incl.md5 @@ -1 +1 @@ -a06da110b6401ffa80ac6ba1c8b87e4c \ No newline at end of file +107fd47c127eab19013c78d1f9837064 \ No newline at end of file diff --git a/cdcacm_8h__incl.png b/cdcacm_8h__incl.png index e45ca436..257282e1 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 949cf850..8bfd2068 100644 --- a/cdcacm_8h_source.html +++ b/cdcacm_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcacm.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,256 +86,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 __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
+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 
177  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
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:182
virtual uint8_t GetAddress()
Definition: cdcacm.h:209
@@ -355,7 +109,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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
@@ -366,11 +119,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
uint8_t bNumRingerPatterns
Definition: cdcacm.h:107
uint8_t bDescriptorSubtype
Definition: cdcacm.h:97
uint16_t bmState
Definition: cdcacm.h:123
-
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:244
-
uint8_t GetLineCoding(LINE_CODING *dataptr)
Definition: cdcacm.cpp:328
uint8_t bDescriptorType
Definition: cdcacm.h:96
bool enhanced
Definition: cdcacm.h:149
@@ -378,13 +129,10 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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
-
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
@@ -393,19 +141,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
uint8_t bAddress
Definition: cdcacm.h:167
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 Release()
Definition: cdcacm.cpp:258
uint8_t bConfNum
Definition: cdcacm.h:168
struct ACM_FUNC_DESCR TEL_OPER_MODES_FUNC_DESCR
@@ -414,20 +156,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Definition: cdcacm.h:163
uint8_t bDescriptorType
Definition: cdcacm.h:104
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: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 67133e0a..c35f07cf 100644 --- a/cdcftdi_8cpp.html +++ b/cdcftdi_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcftdi.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,13 +86,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
cdcftdi.cpp File Reference
-
#include "cdcftdi.h"
+
#include "cdcftdi.h"
Include dependency graph for cdcftdi.cpp:
- + + +

Go to the source code of this file.

@@ -100,7 +103,7 @@ Include dependency graph for cdcftdi.cpp:
diff --git a/cdcftdi_8cpp__incl.map b/cdcftdi_8cpp__incl.map index b83c2a5f..3ee0a9ea 100644 --- a/cdcftdi_8cpp__incl.map +++ b/cdcftdi_8cpp__incl.map @@ -1,4 +1,4 @@ - - + + diff --git a/cdcftdi_8cpp__incl.md5 b/cdcftdi_8cpp__incl.md5 index 958e3057..f6dd1fa8 100644 --- a/cdcftdi_8cpp__incl.md5 +++ b/cdcftdi_8cpp__incl.md5 @@ -1 +1 @@ -65fc37f20195417aa899b408712d428a \ No newline at end of file +e865f32d985af2b4d5e2da82e7c52bae \ No newline at end of file diff --git a/cdcftdi_8cpp__incl.png b/cdcftdi_8cpp__incl.png index 12496f72..fe259a22 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 8cc147ef..b5088307 100644 --- a/cdcftdi_8cpp_source.html +++ b/cdcftdi_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcftdi.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,415 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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) {
-
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  USBTRACE("FTDI Init: Product not supported\r\n");
-
91  USBTRACE2("Expected VID:", FTDI_VID);
-
92  USBTRACE2("Found VID:", udd->idVendor);
-
93 
-
94  USBTRACE2("Expected PID:", wIdProduct);
-
95  USBTRACE2("Found PID:", udd->idProduct);
- -
97  }
-
98 
-
99  // Save type of FTDI chip
-
100  wFTDIType = udd->bcdDevice;
-
101 
-
102  // Allocate new address according to device class
-
103  bAddress = addrPool.AllocAddress(parent, false, port);
-
104 
-
105  if(!bAddress)
- -
107 
-
108  // Extract Max Packet Size from the device descriptor
-
109  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
-
110  // Some devices set endpoint lengths to zero, which is incorrect.
-
111  // we should check them, and if zero, set them to 64.
-
112  if(epInfo[0].maxPktSize == 0) epInfo[0].maxPktSize = 64;
-
113 
-
114  // Assign new address to the device
-
115  rcode = pUsb->setAddr(0, 0, bAddress);
-
116 
-
117  if(rcode) {
-
118  p->lowspeed = false;
-
119  addrPool.FreeAddress(bAddress);
-
120  bAddress = 0;
-
121  USBTRACE2("setAddr:", rcode);
-
122  return rcode;
-
123  }
-
124 
-
125  USBTRACE2("Addr:", bAddress);
-
126 
-
127  p->lowspeed = false;
-
128 
-
129  p = addrPool.GetUsbDevicePtr(bAddress);
-
130 
-
131  if(!p)
- -
133 
-
134  p->lowspeed = lowspeed;
-
135 
-
136  num_of_conf = udd->bNumConfigurations;
-
137 
-
138  // Assign epInfo to epinfo pointer
-
139  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
-
140 
-
141  if(rcode)
-
142  goto FailSetDevTblEntry;
-
143 
-
144  USBTRACE2("NC:", num_of_conf);
-
145 
-
146  for(uint8_t i = 0; i < num_of_conf; i++) {
- -
148 
-
149  // This interferes with serial output, and should be opt-in for debugging.
-
150  //HexDumper<USBReadParser, uint16_t, uint16_t> HexDump;
-
151  //rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
-
152  //if(rcode)
-
153  // goto FailGetConfDescr;
-
154 
-
155  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
-
156 
-
157  if(rcode)
-
158  goto FailGetConfDescr;
-
159 
-
160  if(bNumEP > 1)
-
161  break;
-
162  } // for
-
163 
-
164  if(bNumEP < 2)
- -
166 
-
167  USBTRACE2("NumEP:", bNumEP);
-
168 
-
169  // Assign epInfo to epinfo pointer
-
170  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
-
171 
-
172  USBTRACE2("Conf:", bConfNum);
-
173 
-
174  // Set Configuration Value
-
175  rcode = pUsb->setConf(bAddress, 0, bConfNum);
-
176 
-
177  if(rcode)
-
178  goto FailSetConfDescr;
-
179 
-
180  // default latency is 16ms on-chip, reduce it to 1
-
181  rcode = SetLatency(1);
-
182  if(rcode)
-
183  goto FailOnLatency;
-
184 
-
185 
-
186  rcode = pAsync->OnInit(this);
-
187 
-
188  if(rcode)
-
189  goto FailOnInit;
-
190 
-
191  USBTRACE("FTDI configured\r\n");
-
192 
-
193  ready = true;
-
194  return 0;
-
195 
-
196 FailOnLatency:
-
197 #ifdef DEBUG_USB_HOST
-
198  USBTRACE("SetLatency: ");
-
199  goto Fail;
-
200 #endif
-
201 
-
202 FailGetDevDescr:
-
203 #ifdef DEBUG_USB_HOST
- -
205  goto Fail;
-
206 #endif
-
207 
-
208 FailSetDevTblEntry:
-
209 #ifdef DEBUG_USB_HOST
- -
211  goto Fail;
-
212 #endif
-
213 
-
214 FailGetConfDescr:
-
215 #ifdef DEBUG_USB_HOST
- -
217  goto Fail;
-
218 #endif
-
219 
-
220 FailSetConfDescr:
-
221 #ifdef DEBUG_USB_HOST
- -
223  goto Fail;
-
224 #endif
-
225 
-
226 FailOnInit:
-
227 #ifdef DEBUG_USB_HOST
-
228  USBTRACE("OnInit:");
-
229 
-
230 Fail:
-
231  NotifyFail(rcode);
-
232 #endif
-
233  Release();
-
234  return rcode;
-
235 }
-
236 
-
237 void FTDI::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *pep) {
-
238  ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
-
239  ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
-
240  ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
-
241 
-
242  bConfNum = conf;
-
243 
-
244  uint8_t index;
-
245 
-
246  if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
-
247  index = epInterruptInIndex;
- -
249  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
-
250  else
-
251  return;
-
252 
-
253  // Fill in the endpoint info structure
-
254  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
-
255  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
-
256  epInfo[index].bmSndToggle = 0;
-
257  epInfo[index].bmRcvToggle = 0;
-
258  // Some device vendors set endpoint lengths to zero, which is incorrect.
-
259  // Check, and if zero, set to 64.
-
260  if(epInfo[index].maxPktSize == 0) epInfo[index].maxPktSize = 64;
-
261 
-
262  bNumEP++;
-
263 
-
264  PrintEndpointDescriptor(pep);
-
265 }
-
266 
-
267 uint8_t FTDI::Release() {
-
268  pUsb->GetAddressPool().FreeAddress(bAddress);
-
269 
-
270  bAddress = 0;
-
271  bNumEP = 1;
-
272  qNextPollTime = 0;
-
273  bPollEnable = false;
-
274  ready = false;
-
275  return pAsync->OnRelease(this);
-
276 }
-
277 
-
278 uint8_t FTDI::Poll() {
-
279  uint8_t rcode = 0;
-
280 
-
281  //if (!bPollEnable)
-
282  // return 0;
-
283 
-
284  //if (qNextPollTime <= (uint32_t)millis())
-
285  //{
-
286  // USB_HOST_SERIAL.println(bAddress, HEX);
-
287 
-
288  // qNextPollTime = (uint32_t)millis() + 100;
-
289  //}
-
290  return rcode;
-
291 }
-
292 
-
293 uint8_t FTDI::SetBaudRate(uint32_t baud) {
-
294  uint16_t baud_value, baud_index = 0;
-
295  uint32_t divisor3;
-
296  divisor3 = 48000000 / 2 / baud; // divisor shifted 3 bits to the left
-
297 
-
298  if(wFTDIType == FT232AM) {
-
299  if((divisor3 & 0x7) == 7)
-
300  divisor3++; // round x.7/8 up to x+1
-
301 
-
302  baud_value = divisor3 >> 3;
-
303  divisor3 &= 0x7;
-
304 
-
305  if(divisor3 == 1) baud_value |= 0xc000;
-
306  else // 0.125
-
307  if(divisor3 >= 4) baud_value |= 0x4000;
-
308  else // 0.5
-
309  if(divisor3 != 0) baud_value |= 0x8000; // 0.25
-
310  if(baud_value == 1) baud_value = 0; /* special case for maximum baud rate */
-
311  } else {
-
312  static const uint8_t divfrac [8] = {0, 3, 2, 0, 1, 1, 2, 3};
-
313  static const uint8_t divindex[8] = {0, 0, 0, 1, 0, 1, 1, 1};
-
314 
-
315  baud_value = divisor3 >> 3;
-
316  baud_value |= divfrac [divisor3 & 0x7] << 14;
-
317  baud_index = divindex[divisor3 & 0x7];
-
318 
-
319  /* Deal with special cases for highest baud rates. */
-
320  if(baud_value == 1) baud_value = 0;
-
321  else // 1.0
-
322  if(baud_value == 0x4001) baud_value = 1; // 1.5
-
323  }
-
324  USBTRACE2("baud_value:", baud_value);
-
325  USBTRACE2("baud_index:", baud_index);
-
326  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);
-
327  if(rv && rv != hrNAK) {
-
328  Release();
-
329  }
-
330  return rv;
-
331 }
-
332 
-
333 // No docs on if this is 8 or 16 bit, so play it safe, make maximum 255ms
-
334 
-
335 uint8_t FTDI::SetLatency(uint8_t l) {
-
336  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_LATENCY_TIMER, l, 0, 0, 0, 0, NULL, NULL);
-
337  if(rv && rv != hrNAK) {
-
338  Release();
-
339  }
-
340  return rv;
-
341 }
-
342 
-
343 // No docs on if this is 8 or 16 bit, so play it safe, make maximum 255ms
-
344 
-
345 uint8_t FTDI::GetLatency(uint8_t *l) {
-
346  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_GET_LATENCY_TIMER, 0, 0, 0, 0, 1, (uint8_t *)l, NULL);
-
347  if(rv && rv != hrNAK) {
-
348  Release();
-
349  }
-
350  return rv;
-
351 }
-
352 
-
353 uint8_t FTDI::SetModemControl(uint16_t signal) {
-
354  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_MODEM_CTRL, signal & 0xff, signal >> 8, 0, 0, 0, NULL, NULL);
-
355  if(rv && rv != hrNAK) {
-
356  Release();
-
357  }
-
358  return rv;
-
359 }
-
360 
-
361 uint8_t FTDI::SetFlowControl(uint8_t protocol, uint8_t xon, uint8_t xoff) {
-
362  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_FLOW_CTRL, xon, xoff, protocol << 8, 0, 0, NULL, NULL);
-
363  if(rv && rv != hrNAK) {
-
364  Release();
-
365  }
-
366  return rv;
-
367 }
-
368 
-
369 uint8_t FTDI::SetData(uint16_t databm) {
-
370  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_DATA, databm & 0xff, databm >> 8, 0, 0, 0, NULL, NULL);
-
371  if(rv && rv != hrNAK) {
-
372  Release();
-
373  }
-
374  return rv;
-
375 }
-
376 
-
377 uint8_t FTDI::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
-
378  uint8_t rv = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
-
379  if(rv && rv != hrNAK) {
-
380  Release();
-
381  }
-
382  return rv;
-
383 }
-
384 
-
385 uint8_t FTDI::SndData(uint16_t nbytes, uint8_t *dataptr) {
-
386  uint8_t rv = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
-
387  if(rv && rv != hrNAK) {
-
388  Release();
-
389  }
-
390  return rv;
-
391 }
-
392 
-
393 void FTDI::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
-
394  Notify(PSTR("Endpoint descriptor:"), 0x80);
-
395  Notify(PSTR("\r\nLength:\t\t"), 0x80);
-
396  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
-
397  Notify(PSTR("\r\nType:\t\t"), 0x80);
-
398  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
-
399  Notify(PSTR("\r\nAddress:\t"), 0x80);
-
400  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
-
401  Notify(PSTR("\r\nAttributes:\t"), 0x80);
-
402  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
-
403  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
-
404  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
-
405  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
-
406  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
-
407  Notify(PSTR("\r\n"), 0x80);
-
408 }
-
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:801
+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  USBTRACE("FTDI Init: Product not supported\r\n");
91  USBTRACE2("Expected VID:", FTDI_VID);
92  USBTRACE2("Found VID:", udd->idVendor);
93 
94  USBTRACE2("Expected PID:", wIdProduct);
95  USBTRACE2("Found PID:", udd->idProduct);
97  }
98 
99  // Save type of FTDI chip
100  wFTDIType = udd->bcdDevice;
101 
102  // Allocate new address according to device class
103  bAddress = addrPool.AllocAddress(parent, false, port);
104 
105  if(!bAddress)
107 
108  // Extract Max Packet Size from the device descriptor
109  epInfo[0].maxPktSize = udd->bMaxPacketSize0;
110  // Some devices set endpoint lengths to zero, which is incorrect.
111  // we should check them, and if zero, set them to 64.
112  if(epInfo[0].maxPktSize == 0) epInfo[0].maxPktSize = 64;
113 
114  // Assign new address to the device
115  rcode = pUsb->setAddr(0, 0, bAddress);
116 
117  if(rcode) {
118  p->lowspeed = false;
119  addrPool.FreeAddress(bAddress);
120  bAddress = 0;
121  USBTRACE2("setAddr:", rcode);
122  return rcode;
123  }
124 
125  USBTRACE2("Addr:", bAddress);
126 
127  p->lowspeed = false;
128 
129  p = addrPool.GetUsbDevicePtr(bAddress);
130 
131  if(!p)
133 
134  p->lowspeed = lowspeed;
135 
136  num_of_conf = udd->bNumConfigurations;
137 
138  // Assign epInfo to epinfo pointer
139  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
140 
141  if(rcode)
142  goto FailSetDevTblEntry;
143 
144  USBTRACE2("NC:", num_of_conf);
145 
146  for(uint8_t i = 0; i < num_of_conf; i++) {
148 
149  // This interferes with serial output, and should be opt-in for debugging.
150  //HexDumper<USBReadParser, uint16_t, uint16_t> HexDump;
151  //rcode = pUsb->getConfDescr(bAddress, 0, i, &HexDump);
152  //if(rcode)
153  // goto FailGetConfDescr;
154 
155  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
156 
157  if(rcode)
158  goto FailGetConfDescr;
159 
160  if(bNumEP > 1)
161  break;
162  } // for
163 
164  if(bNumEP < 2)
166 
167  USBTRACE2("NumEP:", bNumEP);
168 
169  // Assign epInfo to epinfo pointer
170  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
171 
172  USBTRACE2("Conf:", bConfNum);
173 
174  // Set Configuration Value
175  rcode = pUsb->setConf(bAddress, 0, bConfNum);
176 
177  if(rcode)
178  goto FailSetConfDescr;
179 
180  // default latency is 16ms on-chip, reduce it to 1
181  rcode = SetLatency(1);
182  if(rcode)
183  goto FailOnLatency;
184 
185 
186  rcode = pAsync->OnInit(this);
187 
188  if(rcode)
189  goto FailOnInit;
190 
191  USBTRACE("FTDI configured\r\n");
192 
193  ready = true;
194  return 0;
195 
196 FailOnLatency:
197 #ifdef DEBUG_USB_HOST
198  USBTRACE("SetLatency: ");
199  goto Fail;
200 #endif
201 
202 FailGetDevDescr:
203 #ifdef DEBUG_USB_HOST
205  goto Fail;
206 #endif
207 
208 FailSetDevTblEntry:
209 #ifdef DEBUG_USB_HOST
211  goto Fail;
212 #endif
213 
214 FailGetConfDescr:
215 #ifdef DEBUG_USB_HOST
217  goto Fail;
218 #endif
219 
220 FailSetConfDescr:
221 #ifdef DEBUG_USB_HOST
223  goto Fail;
224 #endif
225 
226 FailOnInit:
227 #ifdef DEBUG_USB_HOST
228  USBTRACE("OnInit:");
229 
230 Fail:
231  NotifyFail(rcode);
232 #endif
233  Release();
234  return rcode;
235 }
236 
237 void FTDI::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *pep) {
238  ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
239  ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
240  ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
241 
242  bConfNum = conf;
243 
244  uint8_t index;
245 
246  if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
247  index = epInterruptInIndex;
249  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
250  else
251  return;
252 
253  // Fill in the endpoint info structure
254  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
255  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
256  epInfo[index].bmSndToggle = 0;
257  epInfo[index].bmRcvToggle = 0;
258  // Some device vendors set endpoint lengths to zero, which is incorrect.
259  // Check, and if zero, set to 64.
260  if(epInfo[index].maxPktSize == 0) epInfo[index].maxPktSize = 64;
261 
262  bNumEP++;
263 
264  PrintEndpointDescriptor(pep);
265 }
266 
267 uint8_t FTDI::Release() {
268  pUsb->GetAddressPool().FreeAddress(bAddress);
269 
270  bAddress = 0;
271  bNumEP = 1;
272  qNextPollTime = 0;
273  bPollEnable = false;
274  ready = false;
275  return pAsync->OnRelease(this);
276 }
277 
278 uint8_t FTDI::Poll() {
279  uint8_t rcode = 0;
280 
281  //if (!bPollEnable)
282  // return 0;
283 
284  //if (qNextPollTime <= (uint32_t)millis())
285  //{
286  // USB_HOST_SERIAL.println(bAddress, HEX);
287 
288  // qNextPollTime = (uint32_t)millis() + 100;
289  //}
290  return rcode;
291 }
292 
293 uint8_t FTDI::SetBaudRate(uint32_t baud) {
294  uint16_t baud_value, baud_index = 0;
295  uint32_t divisor3;
296  divisor3 = 48000000 / 2 / baud; // divisor shifted 3 bits to the left
297 
298  if(wFTDIType == FT232AM) {
299  if((divisor3 & 0x7) == 7)
300  divisor3++; // round x.7/8 up to x+1
301 
302  baud_value = divisor3 >> 3;
303  divisor3 &= 0x7;
304 
305  if(divisor3 == 1) baud_value |= 0xc000;
306  else // 0.125
307  if(divisor3 >= 4) baud_value |= 0x4000;
308  else // 0.5
309  if(divisor3 != 0) baud_value |= 0x8000; // 0.25
310  if(baud_value == 1) baud_value = 0; /* special case for maximum baud rate */
311  } else {
312  static const uint8_t divfrac [8] = {0, 3, 2, 0, 1, 1, 2, 3};
313  static const uint8_t divindex[8] = {0, 0, 0, 1, 0, 1, 1, 1};
314 
315  baud_value = divisor3 >> 3;
316  baud_value |= divfrac [divisor3 & 0x7] << 14;
317  baud_index = divindex[divisor3 & 0x7];
318 
319  /* Deal with special cases for highest baud rates. */
320  if(baud_value == 1) baud_value = 0;
321  else // 1.0
322  if(baud_value == 0x4001) baud_value = 1; // 1.5
323  }
324  USBTRACE2("baud_value:", baud_value);
325  USBTRACE2("baud_index:", baud_index);
326  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);
327  if(rv && rv != hrNAK) {
328  Release();
329  }
330  return rv;
331 }
332 
333 // No docs on if this is 8 or 16 bit, so play it safe, make maximum 255ms
334 
335 uint8_t FTDI::SetLatency(uint8_t l) {
336  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_LATENCY_TIMER, l, 0, 0, 0, 0, NULL, NULL);
337  if(rv && rv != hrNAK) {
338  Release();
339  }
340  return rv;
341 }
342 
343 // No docs on if this is 8 or 16 bit, so play it safe, make maximum 255ms
344 
345 uint8_t FTDI::GetLatency(uint8_t *l) {
346  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_GET_LATENCY_TIMER, 0, 0, 0, 0, 1, (uint8_t *)l, NULL);
347  if(rv && rv != hrNAK) {
348  Release();
349  }
350  return rv;
351 }
352 
353 uint8_t FTDI::SetModemControl(uint16_t signal) {
354  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_MODEM_CTRL, signal & 0xff, signal >> 8, 0, 0, 0, NULL, NULL);
355  if(rv && rv != hrNAK) {
356  Release();
357  }
358  return rv;
359 }
360 
361 uint8_t FTDI::SetFlowControl(uint8_t protocol, uint8_t xon, uint8_t xoff) {
362  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_FLOW_CTRL, xon, xoff, protocol << 8, 0, 0, NULL, NULL);
363  if(rv && rv != hrNAK) {
364  Release();
365  }
366  return rv;
367 }
368 
369 uint8_t FTDI::SetData(uint16_t databm) {
370  uint8_t rv = pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_DATA, databm & 0xff, databm >> 8, 0, 0, 0, NULL, NULL);
371  if(rv && rv != hrNAK) {
372  Release();
373  }
374  return rv;
375 }
376 
377 uint8_t FTDI::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
378  uint8_t rv = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
379  if(rv && rv != hrNAK) {
380  Release();
381  }
382  return rv;
383 }
384 
385 uint8_t FTDI::SndData(uint16_t nbytes, uint8_t *dataptr) {
386  uint8_t rv = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
387  if(rv && rv != hrNAK) {
388  Release();
389  }
390  return rv;
391 }
392 
393 void FTDI::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
394  Notify(PSTR("Endpoint descriptor:"), 0x80);
395  Notify(PSTR("\r\nLength:\t\t"), 0x80);
396  D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
397  Notify(PSTR("\r\nType:\t\t"), 0x80);
398  D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
399  Notify(PSTR("\r\nAddress:\t"), 0x80);
400  D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
401  Notify(PSTR("\r\nAttributes:\t"), 0x80);
402  D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
403  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
404  D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
405  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
406  D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
407  Notify(PSTR("\r\n"), 0x80);
408 }
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
Definition: Usb.cpp:801
uint8_t bmRcvToggle
Definition: address.h:48
#define bmREQ_FTDI_OUT
Definition: cdcftdi.h:22
@@ -583,7 +176,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/cdcftdi_8h.html b/cdcftdi_8h.html index c62730ff..1c375f13 100644 --- a/cdcftdi_8h.html +++ b/cdcftdi_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcftdi.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -88,20 +89,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
cdcftdi.h File Reference
-
#include "Usb.h"
+
#include "Usb.h"
Include dependency graph for cdcftdi.h:
- + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -842,7 +845,7 @@ Macros diff --git a/cdcftdi_8h__dep__incl.map b/cdcftdi_8h__dep__incl.map index 14fc6b83..c9f26512 100644 --- a/cdcftdi_8h__dep__incl.map +++ b/cdcftdi_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/cdcftdi_8h__dep__incl.md5 b/cdcftdi_8h__dep__incl.md5 index 400265fa..d2a73e5f 100644 --- a/cdcftdi_8h__dep__incl.md5 +++ b/cdcftdi_8h__dep__incl.md5 @@ -1 +1 @@ -6df33ccb134496caa17a0ccfb805cc20 \ No newline at end of file +bb94e7e9d10e1bde33f1040736fc690f \ No newline at end of file diff --git a/cdcftdi_8h__dep__incl.png b/cdcftdi_8h__dep__incl.png index 7e9a9643..412bb622 100644 Binary files a/cdcftdi_8h__dep__incl.png and b/cdcftdi_8h__dep__incl.png differ diff --git a/cdcftdi_8h__incl.map b/cdcftdi_8h__incl.map index 61edc9dd..3ce4a3cc 100644 --- a/cdcftdi_8h__incl.map +++ b/cdcftdi_8h__incl.map @@ -1,3 +1,3 @@ - + diff --git a/cdcftdi_8h__incl.md5 b/cdcftdi_8h__incl.md5 index a83f7eac..8f85634d 100644 --- a/cdcftdi_8h__incl.md5 +++ b/cdcftdi_8h__incl.md5 @@ -1 +1 @@ -7d34e76d8855698f6d76eca966d6ea18 \ No newline at end of file +5a325c73b89e2318a59e437a1ca1f735 \ No newline at end of file diff --git a/cdcftdi_8h__incl.png b/cdcftdi_8h__incl.png index 40982571..6e886a96 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 ab96f87d..d50be30e 100644 --- a/cdcftdi_8h_source.html +++ b/cdcftdi_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcftdi.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,195 +86,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 #define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */
-
46 #define FTDI_SIO_GET_LATENCY_TIMER 10 /* Get the latency timer */
-
47 
-
48 #define FTDI_SIO_RESET_SIO 0
-
49 #define FTDI_SIO_RESET_PURGE_RX 1
-
50 #define FTDI_SIO_RESET_PURGE_TX 2
-
51 
-
52 #define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8 )
-
53 #define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8 )
-
54 #define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8 )
-
55 #define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8 )
-
56 #define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8 )
-
57 #define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)
-
58 #define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)
-
59 #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)
-
60 #define FTDI_SIO_SET_BREAK (0x1 << 14)
-
61 
-
62 #define FTDI_SIO_SET_DTR_MASK 0x1
-
63 #define FTDI_SIO_SET_DTR_HIGH ( 1 | ( FTDI_SIO_SET_DTR_MASK << 8))
-
64 #define FTDI_SIO_SET_DTR_LOW ( 0 | ( FTDI_SIO_SET_DTR_MASK << 8))
-
65 #define FTDI_SIO_SET_RTS_MASK 0x2
-
66 #define FTDI_SIO_SET_RTS_HIGH ( 2 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
-
67 #define FTDI_SIO_SET_RTS_LOW ( 0 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
-
68 
-
69  #define FTDI_SIO_DISABLE_FLOW_CTRL 0x0
-
70 #define FTDI_SIO_RTS_CTS_HS (0x1 << 8)
-
71 #define FTDI_SIO_DTR_DSR_HS (0x2 << 8)
-
72 #define FTDI_SIO_XON_XOFF_HS (0x4 << 8)
-
73 
-
74 #define FTDI_SIO_CTS_MASK 0x10
-
75 #define FTDI_SIO_DSR_MASK 0x20
-
76 #define FTDI_SIO_RI_MASK 0x40
-
77 #define FTDI_SIO_RLSD_MASK 0x80
-
78 
-
79 class FTDI;
-
80 
- -
82 public:
-
83 
-
84  virtual uint8_t OnInit(FTDI *pftdi __attribute__((unused))) {
-
85  return 0;
-
86  };
-
87 
-
88  virtual uint8_t OnRelease(FTDI *pftdi __attribute__((unused))) {
-
89  return 0;
-
90  };
-
91 };
-
92 
-
93 
-
94 // Only single port chips are currently supported by the library,
-
95 // so only three endpoints are allocated.
-
96 #define FTDI_MAX_ENDPOINTS 3
-
97 
-
98 class FTDI : public USBDeviceConfig, public UsbConfigXtracter {
-
99  static const uint8_t epDataInIndex; // DataIn endpoint index
-
100  static const uint8_t epDataOutIndex; // DataOUT endpoint index
-
101  static const uint8_t epInterruptInIndex; // InterruptIN endpoint index
-
102 
-
103  FTDIAsyncOper *pAsync;
-
104  USB *pUsb;
-
105  uint8_t bAddress;
-
106  uint8_t bConfNum; // configuration number
-
107  uint8_t bNumIface; // number of interfaces in the configuration
-
108  uint8_t bNumEP; // total number of EP in the configuration
-
109  uint32_t qNextPollTime; // next poll time
-
110  volatile bool bPollEnable; // poll enable flag
-
111  volatile bool ready; //device ready indicator
-
112  uint16_t wFTDIType; // Type of FTDI chip
-
113  uint16_t wIdProduct; // expected PID
-
114 
-
115  EpInfo epInfo[FTDI_MAX_ENDPOINTS];
-
116 
-
117  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
-
118 
-
119 public:
-
120  FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct = FTDI_PID);
-
121 
-
122  uint8_t SetBaudRate(uint32_t baud);
-
123  uint8_t SetModemControl(uint16_t control);
-
124  uint8_t SetFlowControl(uint8_t protocol, uint8_t xon = 0x11, uint8_t xoff = 0x13);
-
125  uint8_t SetData(uint16_t databm);
-
126  uint8_t SetLatency(uint8_t l);
-
127  uint8_t GetLatency(uint8_t *l);
-
128 
-
129  // Methods for receiving and sending data
-
130  uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr);
-
131  uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
-
132 
-
133  // USBDeviceConfig implementation
-
134  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
-
135  uint8_t Release();
-
136  uint8_t Poll();
-
137 
-
138  virtual uint8_t GetAddress() {
-
139  return bAddress;
-
140  };
-
141 
-
142  // UsbConfigXtracter implementation
-
143  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
-
144 
-
145  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
-
146  return (vid == FTDI_VID && pid == FTDI_PID);
-
147  }
-
148  virtual bool isReady() {
-
149  return ready;
-
150  };
-
151 
-
152 };
-
153 
-
154 #endif // __CDCFTDI_H__
-
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: cdcftdi.h:145
-
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
Definition: cdcftdi.cpp:237
-
uint8_t SetBaudRate(uint32_t baud)
Definition: cdcftdi.cpp:293
-
uint8_t SetModemControl(uint16_t control)
Definition: cdcftdi.cpp:353
+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 #define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */
46 #define FTDI_SIO_GET_LATENCY_TIMER 10 /* Get the latency timer */
47 
48 #define FTDI_SIO_RESET_SIO 0
49 #define FTDI_SIO_RESET_PURGE_RX 1
50 #define FTDI_SIO_RESET_PURGE_TX 2
51 
52 #define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8 )
53 #define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8 )
54 #define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8 )
55 #define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8 )
56 #define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8 )
57 #define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)
58 #define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)
59 #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)
60 #define FTDI_SIO_SET_BREAK (0x1 << 14)
61 
62 #define FTDI_SIO_SET_DTR_MASK 0x1
63 #define FTDI_SIO_SET_DTR_HIGH ( 1 | ( FTDI_SIO_SET_DTR_MASK << 8))
64 #define FTDI_SIO_SET_DTR_LOW ( 0 | ( FTDI_SIO_SET_DTR_MASK << 8))
65 #define FTDI_SIO_SET_RTS_MASK 0x2
66 #define FTDI_SIO_SET_RTS_HIGH ( 2 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
67 #define FTDI_SIO_SET_RTS_LOW ( 0 | ( FTDI_SIO_SET_RTS_MASK << 8 ))
68 
69  #define FTDI_SIO_DISABLE_FLOW_CTRL 0x0
70 #define FTDI_SIO_RTS_CTS_HS (0x1 << 8)
71 #define FTDI_SIO_DTR_DSR_HS (0x2 << 8)
72 #define FTDI_SIO_XON_XOFF_HS (0x4 << 8)
73 
74 #define FTDI_SIO_CTS_MASK 0x10
75 #define FTDI_SIO_DSR_MASK 0x20
76 #define FTDI_SIO_RI_MASK 0x40
77 #define FTDI_SIO_RLSD_MASK 0x80
78 
79 class FTDI;
80 
82 public:
83 
84  virtual uint8_t OnInit(FTDI *pftdi __attribute__((unused))) {
85  return 0;
86  };
87 
88  virtual uint8_t OnRelease(FTDI *pftdi __attribute__((unused))) {
89  return 0;
90  };
91 };
92 
93 
94 // Only single port chips are currently supported by the library,
95 // so only three endpoints are allocated.
96 #define FTDI_MAX_ENDPOINTS 3
97 
98 class FTDI : public USBDeviceConfig, public UsbConfigXtracter {
99  static const uint8_t epDataInIndex; // DataIn endpoint index
100  static const uint8_t epDataOutIndex; // DataOUT endpoint index
101  static const uint8_t epInterruptInIndex; // InterruptIN endpoint index
102 
103  FTDIAsyncOper *pAsync;
104  USB *pUsb;
105  uint8_t bAddress;
106  uint8_t bConfNum; // configuration number
107  uint8_t bNumIface; // number of interfaces in the configuration
108  uint8_t bNumEP; // total number of EP in the configuration
109  uint32_t qNextPollTime; // next poll time
110  volatile bool bPollEnable; // poll enable flag
111  volatile bool ready; //device ready indicator
112  uint16_t wFTDIType; // Type of FTDI chip
113  uint16_t wIdProduct; // expected PID
114 
115  EpInfo epInfo[FTDI_MAX_ENDPOINTS];
116 
117  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
118 
119 public:
120  FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct = FTDI_PID);
121 
122  uint8_t SetBaudRate(uint32_t baud);
123  uint8_t SetModemControl(uint16_t control);
124  uint8_t SetFlowControl(uint8_t protocol, uint8_t xon = 0x11, uint8_t xoff = 0x13);
125  uint8_t SetData(uint16_t databm);
126  uint8_t SetLatency(uint8_t l);
127  uint8_t GetLatency(uint8_t *l);
128 
129  // Methods for receiving and sending data
130  uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr);
131  uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
132 
133  // USBDeviceConfig implementation
134  uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
135  uint8_t Release();
136  uint8_t Poll();
137 
138  virtual uint8_t GetAddress() {
139  return bAddress;
140  };
141 
142  // UsbConfigXtracter implementation
143  void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
144 
145  virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
146  return (vid == FTDI_VID && pid == FTDI_PID);
147  }
148  virtual bool isReady() {
149  return ready;
150  };
151 
152 };
153 
154 #endif // __CDCFTDI_H__
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
Definition: cdcftdi.h:145
-
uint8_t SetLatency(uint8_t l)
Definition: cdcftdi.cpp:335
-
uint8_t SetFlowControl(uint8_t protocol, uint8_t xon=0x11, uint8_t xoff=0x13)
Definition: cdcftdi.cpp:361
-
uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
Definition: cdcftdi.cpp:377
-
FTDI(USB *pusb, FTDIAsyncOper *pasync, uint16_t idProduct=FTDI_PID)
Definition: cdcftdi.cpp:23
-
uint8_t Poll()
Definition: cdcftdi.cpp:278
Definition: address.h:39
-
uint8_t GetLatency(uint8_t *l)
Definition: cdcftdi.cpp:345
Definition: cdcftdi.h:98
#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:148
virtual uint8_t OnInit(FTDI *pftdi)
Definition: cdcftdi.h:84
-
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr)
Definition: cdcftdi.cpp:385
virtual uint8_t GetAddress()
Definition: cdcftdi.h:138
virtual uint8_t OnRelease(FTDI *pftdi)
Definition: cdcftdi.h:88
#define FTDI_VID
Definition: cdcftdi.h:28
-
uint8_t Release()
Definition: cdcftdi.cpp:267
Definition: UsbCore.h:210
-
uint8_t SetData(uint16_t databm)
Definition: cdcftdi.cpp:369
#define FTDI_MAX_ENDPOINTS
Definition: cdcftdi.h:96
diff --git a/cdcprolific_8cpp.html b/cdcprolific_8cpp.html index 0d7a56c5..9aeace68 100644 --- a/cdcprolific_8cpp.html +++ b/cdcprolific_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcprolific.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,13 +86,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
cdcprolific.cpp File Reference
-
#include "cdcprolific.h"
+
#include "cdcprolific.h"
Include dependency graph for cdcprolific.cpp:
- + + + +

Go to the source code of this file.

@@ -100,7 +104,7 @@ Include dependency graph for cdcprolific.cpp:
diff --git a/cdcprolific_8cpp__incl.map b/cdcprolific_8cpp__incl.map index 1dfd63f4..8db88071 100644 --- a/cdcprolific_8cpp__incl.map +++ b/cdcprolific_8cpp__incl.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/cdcprolific_8cpp__incl.md5 b/cdcprolific_8cpp__incl.md5 index 44ce861d..1e1ab220 100644 --- a/cdcprolific_8cpp__incl.md5 +++ b/cdcprolific_8cpp__incl.md5 @@ -1 +1 @@ -1b82f3fbedb914a6f7a2686151967527 \ No newline at end of file +a91e5714ebd81502b745c96a64138390 \ No newline at end of file diff --git a/cdcprolific_8cpp__incl.png b/cdcprolific_8cpp__incl.png index b676ce1e..012df5af 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 0486a902..3e3b65c5 100644 --- a/cdcprolific_8cpp_source.html +++ b/cdcprolific_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcprolific.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,254 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 <= (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:801
+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:801
EpInfo * epinfo
Definition: address.h:83
bool lowspeed
Definition: address.h:86
@@ -395,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/cdcprolific_8h.html b/cdcprolific_8h.html index 024c9481..9dd5d9f2 100644 --- a/cdcprolific_8h.html +++ b/cdcprolific_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcprolific.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -89,20 +90,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
cdcprolific.h File Reference
-
#include "cdcacm.h"
+
#include "cdcacm.h"
Include dependency graph for cdcprolific.h:
- + + +
This graph shows which files directly or indirectly include this file:
- + +

Go to the source code of this file.

@@ -235,25 +239,25 @@ Macros - -

Enumerations

enum  tXO_State {
+
enum  tXO_State {
  kXOnSent = -2, kXOffSent = -1, kXO_Idle = 0, kXOffNeeded = 1, -
+
  kXOnNeeded = 2 -
+
}
 
enum  pl2303_type {
+
enum  pl2303_type {
  unknown, type_0, type_1, rev_X, -
+
  rev_HX, rev_H -
+
}
 
@@ -1099,15 +1103,15 @@ Enumerations
- - - - -
Enumerator
kXOnSent  +
Enumerator
kXOnSent 
kXOffSent  +
kXOffSent 
kXO_Idle  +
kXO_Idle 
kXOffNeeded  +
kXOffNeeded 
kXOnNeeded  +
kXOnNeeded 
@@ -1125,17 +1129,17 @@ Enumerations
- - - - - -
Enumerator
unknown  +
Enumerator
unknown 
type_0  +
type_0 
type_1  +
type_1 
rev_X  +
rev_X 
rev_HX  +
rev_HX 
rev_H  +
rev_H 
@@ -1148,7 +1152,7 @@ Enumerations diff --git a/cdcprolific_8h__dep__incl.map b/cdcprolific_8h__dep__incl.map index 28581b5d..83eaf52c 100644 --- a/cdcprolific_8h__dep__incl.map +++ b/cdcprolific_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/cdcprolific_8h__dep__incl.md5 b/cdcprolific_8h__dep__incl.md5 index 6e869c59..3f648651 100644 --- a/cdcprolific_8h__dep__incl.md5 +++ b/cdcprolific_8h__dep__incl.md5 @@ -1 +1 @@ -7e1c0310ccf8e65031fd95168f61528c \ No newline at end of file +5601c68c5c5e913b421194d3f765f64d \ No newline at end of file diff --git a/cdcprolific_8h__dep__incl.png b/cdcprolific_8h__dep__incl.png index ad8ebb48..7680aa9d 100644 Binary files a/cdcprolific_8h__dep__incl.png and b/cdcprolific_8h__dep__incl.png differ diff --git a/cdcprolific_8h__incl.map b/cdcprolific_8h__incl.map index a91fdd98..3c82d573 100644 --- a/cdcprolific_8h__incl.map +++ b/cdcprolific_8h__incl.map @@ -1,4 +1,4 @@ - - + + diff --git a/cdcprolific_8h__incl.md5 b/cdcprolific_8h__incl.md5 index 4016e2b7..e7519a47 100644 --- a/cdcprolific_8h__incl.md5 +++ b/cdcprolific_8h__incl.md5 @@ -1 +1 @@ -e26e4be2e6b8e7c00195ad3f65bee601 \ No newline at end of file +9d9a09dd605ff7c3be8e192a907ecbfe \ No newline at end of file diff --git a/cdcprolific_8h__incl.png b/cdcprolific_8h__incl.png index 476e1615..552068b9 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 d8c041b0..6337d9db 100644 --- a/cdcprolific_8h_source.html +++ b/cdcprolific_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: cdcprolific.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -85,165 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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
@@ -275,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_a_c_m-members.html b/class_a_c_m-members.html index 8d6457f7..4eee237b 100644 --- a/class_a_c_m-members.html +++ b/class_a_c_m-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -141,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_a_c_m.html b/class_a_c_m.html index 7e2973c3..0241b805 100644 --- a/class_a_c_m.html +++ b/class_a_c_m.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: ACM Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -101,14 +102,25 @@ Inheritance diagram for ACM:
Inheritance graph
- + + + + +
[legend]
Collaboration diagram for ACM:
Collaboration graph
- + + + + + + + +
[legend]
diff --git a/class_a_c_m__coll__graph.map b/class_a_c_m__coll__graph.map index 9d14eba9..6520e6af 100644 --- a/class_a_c_m__coll__graph.map +++ b/class_a_c_m__coll__graph.map @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + diff --git a/class_a_c_m__coll__graph.md5 b/class_a_c_m__coll__graph.md5 index 9ed1f38b..f43712cc 100644 --- a/class_a_c_m__coll__graph.md5 +++ b/class_a_c_m__coll__graph.md5 @@ -1 +1 @@ -089a4ea333d638a22683872df0d7f680 \ No newline at end of file +587ce662854a9a2b4677918117ea2d18 \ 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 9ae39b7d..c81a9565 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.map b/class_a_c_m__inherit__graph.map index ba9c16e8..12559e81 100644 --- a/class_a_c_m__inherit__graph.map +++ b/class_a_c_m__inherit__graph.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/class_a_c_m__inherit__graph.md5 b/class_a_c_m__inherit__graph.md5 index 22e96bd7..69d55cdc 100644 --- a/class_a_c_m__inherit__graph.md5 +++ b/class_a_c_m__inherit__graph.md5 @@ -1 +1 @@ -4f719ae038c56dadd97ac48e9a7acff9 \ No newline at end of file +1778af41b23c3b83c73bd88577cd17cc \ 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 c8f58144..2e0b1c04 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 007b8023..13ffc9ca 100644 --- a/class_a_d_k-members.html +++ b/class_a_d_k-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -1276,7 +1288,7 @@ Protected Attributes

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -118,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_a_d_k.html b/class_a_d_k.html index 04618d79..a58cdaa5 100644 --- a/class_a_d_k.html +++ b/class_a_d_k.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: ADK Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -100,14 +101,21 @@ Inheritance diagram for ADK:
Inheritance graph
- + + +
[legend]
Collaboration diagram for ADK:
Collaboration graph
- + + + + + +
[legend]
diff --git a/class_a_d_k__coll__graph.map b/class_a_d_k__coll__graph.map index 7398a53c..72616cf5 100644 --- a/class_a_d_k__coll__graph.map +++ b/class_a_d_k__coll__graph.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/class_a_d_k__coll__graph.md5 b/class_a_d_k__coll__graph.md5 index 2341756e..6e64816d 100644 --- a/class_a_d_k__coll__graph.md5 +++ b/class_a_d_k__coll__graph.md5 @@ -1 +1 @@ -37dc8161587ef9d91ca02f00e06d8d3e \ No newline at end of file +677a6776b852e96bee247fd946d74be2 \ 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 8da06f0b..4176edac 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.map b/class_a_d_k__inherit__graph.map index 07fe2620..a1e35774 100644 --- a/class_a_d_k__inherit__graph.map +++ b/class_a_d_k__inherit__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_a_d_k__inherit__graph.md5 b/class_a_d_k__inherit__graph.md5 index 007981fa..55e30802 100644 --- a/class_a_d_k__inherit__graph.md5 +++ b/class_a_d_k__inherit__graph.md5 @@ -1 +1 @@ -bf61a3a2026b57525489bd4fa1b38220 \ No newline at end of file +bca330dbfb30c1761bf024a703ee6a77 \ 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 821a8092..f9cb31fe 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 80003e58..63250730 100644 --- a/class_address_pool-members.html +++ b/class_address_pool-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -788,7 +796,7 @@ Static Protected Attributes

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_address_pool.html b/class_address_pool.html index d8988b53..11090209 100644 --- a/class_address_pool.html +++ b/class_address_pool.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: AddressPool Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,7 +98,9 @@ Inheritance diagram for AddressPool:
Inheritance graph
- + + +
[legend]
diff --git a/class_address_pool__inherit__graph.map b/class_address_pool__inherit__graph.map index 86eae39c..bb73e640 100644 --- a/class_address_pool__inherit__graph.map +++ b/class_address_pool__inherit__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_address_pool__inherit__graph.md5 b/class_address_pool__inherit__graph.md5 index 208556c0..67a01c56 100644 --- a/class_address_pool__inherit__graph.md5 +++ b/class_address_pool__inherit__graph.md5 @@ -1 +1 @@ -120a062cef01918a52a6cdb4ddb3eba1 \ No newline at end of file +1e8b44e83a78a2dc42bcafc432f2a436 \ No newline at end of file diff --git a/class_address_pool__inherit__graph.png b/class_address_pool__inherit__graph.png index d02e10b1..7d887516 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 69587925..367af086 100644 --- a/class_address_pool_impl-members.html +++ b/class_address_pool_impl-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -215,7 +218,7 @@ Public Member Functions

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -100,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_address_pool_impl.html b/class_address_pool_impl.html index 456fe119..5448bcd2 100644 --- a/class_address_pool_impl.html +++ b/class_address_pool_impl.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: AddressPoolImpl< MAX_DEVICES_ALLOWED > Class Template Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,16 @@ Inheritance diagram for AddressPoolImpl< MAX_DEVICES_ALLOWED >:
Inheritance graph
- + +
[legend]
Collaboration diagram for AddressPoolImpl< MAX_DEVICES_ALLOWED >:
Collaboration graph
- + +
[legend]
- + @@ -121,7 +124,7 @@ Public Member Functions

@@ -113,7 +116,7 @@ Public Member Functions

 
virtual UsbDeviceGetUsbDevicePtr (uint8_t addr)
 
void ForEachUsbDevice (UsbDeviceHandleFunc pfunc)
void ForEachUsbDevice (UsbDeviceHandleFunc pfunc)
 
virtual uint8_t AllocAddress (uint8_t parent, bool is_hub=false, uint8_t port=0)
 
 

Detailed Description

-

template<const uint8_t MAX_DEVICES_ALLOWED>
+

template<const uint8_t MAX_DEVICES_ALLOWED>
class AddressPoolImpl< MAX_DEVICES_ALLOWED >

@@ -197,7 +200,7 @@ template<const uint8_t MAX_DEVICES_ALLOWED>
void AddressPoolImpl< MAX_DEVICES_ALLOWED >::ForEachUsbDevice ( - UsbDeviceHandleFunc  + UsbDeviceHandleFunc  pfunc) @@ -297,7 +300,7 @@ template<const uint8_t MAX_DEVICES_ALLOWED>

diff --git a/class_address_pool_impl__coll__graph.map b/class_address_pool_impl__coll__graph.map index 5bddb0ec..528ab859 100644 --- a/class_address_pool_impl__coll__graph.map +++ b/class_address_pool_impl__coll__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_address_pool_impl__coll__graph.md5 b/class_address_pool_impl__coll__graph.md5 index 3317b219..77f1e07a 100644 --- a/class_address_pool_impl__coll__graph.md5 +++ b/class_address_pool_impl__coll__graph.md5 @@ -1 +1 @@ -4928b921ed421db937e32278788f372b \ No newline at end of file +77bc5e9fa2748d39429df403e8aba060 \ 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 6aca18c8..7f744d8b 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.map b/class_address_pool_impl__inherit__graph.map index 5bddb0ec..528ab859 100644 --- a/class_address_pool_impl__inherit__graph.map +++ b/class_address_pool_impl__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_address_pool_impl__inherit__graph.md5 b/class_address_pool_impl__inherit__graph.md5 index 3317b219..77f1e07a 100644 --- a/class_address_pool_impl__inherit__graph.md5 +++ b/class_address_pool_impl__inherit__graph.md5 @@ -1 +1 @@ -4928b921ed421db937e32278788f372b \ No newline at end of file +77bc5e9fa2748d39429df403e8aba060 \ 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 6aca18c8..7f744d8b 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 4604ec7f..a3adfa40 100644 --- a/class_b_t_d-members.html +++ b/class_b_t_d-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -169,7 +170,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_b_t_d.html b/class_b_t_d.html index bbac697d..5f619ea1 100644 --- a/class_b_t_d.html +++ b/class_b_t_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTD Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -101,14 +102,21 @@ Inheritance diagram for BTD:
Inheritance graph
- + + +
[legend]
Collaboration diagram for BTD:
Collaboration graph
- + + + + + +
[legend]

@@ -297,8 +305,7 @@ Static Protected Attributes

-

Constructor for the BTD class.

-
Parameters
+

Constructor for the BTD class.

Parameters
pPointer to USB class instance.
@@ -347,8 +354,7 @@ Static Protected Attributes
-

Address assignment and basic initialization is done here.

-
Parameters
+

Address assignment and basic initialization is done here.

Parameters
@@ -401,8 +407,7 @@ Static Protected Attributes
parentHub number.
portPort number on the hub.
-

Initialize the Bluetooth dongle.

-
Parameters
+

Initialize the Bluetooth dongle.

Parameters
@@ -438,8 +443,7 @@ Static Protected Attributes
parentHub number.
portPort number on the hub.
-

Release the USB device.

-
Returns
0 on success.
+

Release the USB device.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -467,8 +471,7 @@ Static Protected Attributes
-

Poll the USB Input endpoints and run the state machines.

-
Returns
0 on success.
+

Poll the USB Input endpoints and run the state machines.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -496,8 +499,7 @@ Static Protected Attributes
-

Get the device address.

-
Returns
The device address.
+

Get the device address.

Returns
The device address.

Reimplemented from USBDeviceConfig.

@@ -525,8 +527,7 @@ Static Protected Attributes
-

Used to check if the dongle has been initialized.

-
Returns
True if it's ready.
+

Used to check if the dongle has been initialized.

Returns
True if it's ready.

Definition at line 249 of file BTD.h.

@@ -553,8 +554,7 @@ Static Protected Attributes
-

Used by the USB core to check what this driver support.

-
Parameters
+

Used by the USB core to check what this driver support.

Parameters
klassThe device's USB class.
@@ -599,8 +599,7 @@ Static Protected Attributes
-

Used by the USB core to check what this driver support. Used to set the Bluetooth address into the PS3 controllers.

-
Parameters
+

Used by the USB core to check what this driver support. Used to set the Bluetooth address into the PS3 controllers.

Parameters
@@ -664,8 +663,7 @@ Static Protected Attributes
vidThe device's VID.
pidThe device's PID.
-

UsbConfigXtracter implementation, used to extract endpoint information.

-
Parameters
+

UsbConfigXtracter implementation, used to extract endpoint information.

Parameters
@@ -721,8 +719,7 @@ Static Protected Attributes
confConfiguration value.
ifaceInterface number.
-

Register Bluetooth dongle members/services.

-
Parameters
+

Register Bluetooth dongle members/services.

Parameters
pServicePointer to BluetoothService class instance.
@@ -757,8 +754,7 @@ Static Protected Attributes
-

Used to send a HCI Command.

-
Parameters
+

Used to send a HCI Command.

Parameters
@@ -837,8 +833,7 @@ Static Protected Attributes
dataData to send.
nbytesNumber of bytes to send.
-

Set the local name of the Bluetooth dongle.

-
Parameters
+

Set the local name of the Bluetooth dongle.

Parameters
nameDesired name.
@@ -934,8 +929,7 @@ Static Protected Attributes
-

Disconnect the HCI connection.

-
Parameters
+

Disconnect the HCI connection.

Parameters
handleThe HCI Handle for the connection.
@@ -1085,8 +1079,7 @@ Static Protected Attributes
-

Connect to device.

-
Parameters
+

Connect to device.

Parameters
bdaddrBluetooth address of the device.
@@ -1156,8 +1149,7 @@ Static Protected Attributes
-

Used to send L2CAP Commands.

-
Parameters
+

Used to send L2CAP Commands.

Parameters
@@ -1206,8 +1198,7 @@ Static Protected Attributes
handleHCI Handle.
dataData to send.
-

L2CAP Connection Request.

-
Parameters
+

L2CAP Connection Request.

Parameters
@@ -1262,8 +1253,7 @@ Static Protected Attributes
handleHCI handle.
rxidIdentifier.
-

L2CAP Connection Response.

-
Parameters
+

L2CAP Connection Response.

Parameters
@@ -1307,8 +1297,7 @@ Static Protected Attributes
handleHCI handle.
rxidIdentifier.
-

L2CAP Config Request.

-
Parameters
+

L2CAP Config Request.

Parameters
@@ -1350,8 +1339,7 @@ Static Protected Attributes
handleHCI Handle.
rxidIdentifier.
-

L2CAP Config Response.

-
Parameters
+

L2CAP Config Response.

Parameters
@@ -1399,8 +1387,7 @@ Static Protected Attributes
handleHCI Handle.
rxidIdentifier.
-

L2CAP Disconnection Request.

-
Parameters
+

L2CAP Disconnection Request.

Parameters
@@ -1449,8 +1436,7 @@ Static Protected Attributes
handleHCI Handle.
rxidIdentifier.
-

L2CAP Disconnection Response.

-
Parameters
+

L2CAP Disconnection Response.

Parameters
@@ -1499,8 +1485,7 @@ Static Protected Attributes
handleHCI Handle.
rxidIdentifier.
-

L2CAP Information Response.

-
Parameters
+

L2CAP Information Response.

Parameters
@@ -1585,8 +1570,7 @@ Static Protected Attributes
handleHCI Handle.
rxidIdentifier.
-

Read the poll interval taken from the endpoint descriptors.

-
Returns
The poll interval in ms.
+

Read the poll interval taken from the endpoint descriptors.

Returns
The poll interval in ms.

Definition at line 499 of file BTD.h.

@@ -1613,8 +1597,7 @@ Static Protected Attributes
-

Used to print the USB Endpoint Descriptor.

-
Parameters
+

Used to print the USB Endpoint Descriptor.

Parameters
ep_ptrPointer to USB Endpoint Descriptor.
@@ -2150,7 +2133,7 @@ Static Protected Attributes diff --git a/class_b_t_d__coll__graph.map b/class_b_t_d__coll__graph.map index 60d2263a..faf78d2f 100644 --- a/class_b_t_d__coll__graph.map +++ b/class_b_t_d__coll__graph.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/class_b_t_d__coll__graph.md5 b/class_b_t_d__coll__graph.md5 index 3b9a2e08..7288133e 100644 --- a/class_b_t_d__coll__graph.md5 +++ b/class_b_t_d__coll__graph.md5 @@ -1 +1 @@ -ca95807276f7b79a9da3fd2fb6368499 \ No newline at end of file +e72568841cb2f05e3bfabb29e1ce8457 \ 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 4069a2f6..b553c6ff 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.map b/class_b_t_d__inherit__graph.map index 41d0bc15..ed1c9ace 100644 --- a/class_b_t_d__inherit__graph.map +++ b/class_b_t_d__inherit__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_b_t_d__inherit__graph.md5 b/class_b_t_d__inherit__graph.md5 index 5d318cb2..95bb3a3b 100644 --- a/class_b_t_d__inherit__graph.md5 +++ b/class_b_t_d__inherit__graph.md5 @@ -1 +1 @@ -d46813718d41f5c0027726790fddd324 \ No newline at end of file +36ee382408a95d482da81524513435df \ 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 7fc39e59..0ac39bf3 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 b1426b19..d2b57a60 100644 --- a/class_b_t_h_i_d-members.html +++ b/class_b_t_h_i_d-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -108,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); pair(void)BTHIDinline ParseBTHIDData(uint8_t len, uint8_t *buf)BTHIDinlineprotectedvirtual pBtdBluetoothServiceprotected - pFuncOnInitBluetoothServiceprotected + pFuncOnInitBluetoothServiceprotected Reset()BTHIDprotectedvirtual ResetBTHID()BTHIDinlineprotectedvirtual Run()BTHIDprotectedvirtual @@ -121,7 +122,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_b_t_h_i_d.html b/class_b_t_h_i_d.html index 03a706e3..df129a2a 100644 --- a/class_b_t_h_i_d.html +++ b/class_b_t_h_i_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BTHID Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -99,14 +100,23 @@ Inheritance diagram for BTHID:
Inheritance graph
- + + +
[legend]
Collaboration diagram for BTHID:
Collaboration graph
- + + + + + + + +
[legend]
- - + + @@ -215,8 +225,7 @@ BluetoothService implementation

@@ -157,8 +167,8 @@ Protected Attributes

uint8_t interrupt_scid [2]
 
- Protected Attributes inherited from BluetoothService
void(* pFuncOnInit )(void)
 
void(* pFuncOnInit )(void)
 
BTDpBtd
 
uint16_t hci_handle
-

Constructor for the BTHID class.

-
Parameters
+

Constructor for the BTHID class.

Parameters
@@ -279,8 +288,7 @@ BluetoothService implementation
pPointer to the BTD class instance.
pairSet this to true in order to pair with the device. If the argument is omitted then it will not pair with it. One can use PAIR to set it to true.
-

Get HIDReportParser.

-
Parameters
+

Get HIDReportParser.

Parameters
idID of parser.
@@ -323,8 +331,7 @@ BluetoothService implementation
-

Set HIDReportParser to be used.

-
Parameters
+

Set HIDReportParser to be used.

Parameters
@@ -358,8 +365,7 @@ BluetoothService implementation
idId of parser.
prsPointer to HIDReportParser.
-

Set HID protocol mode.

-
Parameters
+

Set HID protocol mode.

Parameters
modeHID protocol to use. Either USB_HID_BOOT_PROTOCOL or HID_RPT_PROTOCOL.
@@ -391,8 +397,7 @@ BluetoothService implementation
-

Used to set the leds on a keyboard.

-
Parameters
+

Used to set the leds on a keyboard.

Parameters
dataSee KBDLEDS in hidboot.h
@@ -416,8 +421,7 @@ BluetoothService implementation
-

Used to set the leds on a keyboard.

-
Parameters
+

Used to set the leds on a keyboard.

Parameters
dataSee KBDLEDS in hidboot.h
@@ -476,8 +480,7 @@ BluetoothService implementation
-

Used to pass acldata to the services.

-
Parameters
+

Used to pass acldata to the services.

Parameters
ACLDataIncoming acldata.
@@ -605,8 +608,7 @@ BluetoothService implementation
-

Used to parse Bluetooth HID data to any class that inherits this class.

-
Parameters
+

Used to parse Bluetooth HID data to any class that inherits this class.

Parameters
@@ -747,7 +749,7 @@ BluetoothService implementation diff --git a/class_b_t_h_i_d__coll__graph.map b/class_b_t_h_i_d__coll__graph.map index 0a45d54d..3de13548 100644 --- a/class_b_t_h_i_d__coll__graph.map +++ b/class_b_t_h_i_d__coll__graph.map @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + diff --git a/class_b_t_h_i_d__coll__graph.md5 b/class_b_t_h_i_d__coll__graph.md5 index 4dcb5f50..b8a6fc7c 100644 --- a/class_b_t_h_i_d__coll__graph.md5 +++ b/class_b_t_h_i_d__coll__graph.md5 @@ -1 +1 @@ -86d2046e0c112d0f6d219802a3ed4879 \ No newline at end of file +328440863f58d32544996d4a0a7788ae \ 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 7e44047a..8cbed0ca 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.map b/class_b_t_h_i_d__inherit__graph.map index b0540fb3..b8d84de8 100644 --- a/class_b_t_h_i_d__inherit__graph.map +++ b/class_b_t_h_i_d__inherit__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_b_t_h_i_d__inherit__graph.md5 b/class_b_t_h_i_d__inherit__graph.md5 index a07e90bb..d99946b7 100644 --- a/class_b_t_h_i_d__inherit__graph.md5 +++ b/class_b_t_h_i_d__inherit__graph.md5 @@ -1 +1 @@ -84cb6c869d9ec98ca739f6ef702e34ea \ No newline at end of file +0461eab4196d51bce1337c7c83a0da9f \ 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 c87c3735..d19b98d9 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 0e941448..b0a89b3e 100644 --- a/class_bluetooth_service-members.html +++ b/class_bluetooth_service-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@
lenThe length of the incoming data.
bufPointer to the data buffer.
- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -100,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); l2cap_event_flagBluetoothServiceprotected onInit()=0BluetoothServiceprotectedpure virtual pBtdBluetoothServiceprotected - pFuncOnInitBluetoothServiceprotected + pFuncOnInitBluetoothServiceprotected Reset()=0BluetoothServicepure virtual Run()=0BluetoothServicepure virtual
@@ -108,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_bluetooth_service.html b/class_bluetooth_service.html index fa31e275..996a48df 100644 --- a/class_bluetooth_service.html +++ b/class_bluetooth_service.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BluetoothService Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -99,14 +100,25 @@ Inheritance diagram for BluetoothService:
Inheritance graph
- + + + + + +
[legend]
Collaboration diagram for BluetoothService:
Collaboration graph
- + + + + + + +
[legend]

@@ -133,8 +145,8 @@ Protected Member Functions

- - + + @@ -197,8 +209,7 @@ Protected Attributes

Protected Attributes

void(* pFuncOnInit )(void)
 
void(* pFuncOnInit )(void)
 
BTDpBtd
 
uint16_t hci_handle
-

Used to pass acldata to the Bluetooth service.

-
Parameters
+

Used to pass acldata to the Bluetooth service.

Parameters
ACLDataPointer to the incoming acldata.
@@ -308,8 +319,7 @@ Protected Attributes
-

Used to call your own function when the device is successfully initialized.

-
Parameters
+

Used to call your own function when the device is successfully initialized.

Parameters
funcOnInitFunction to call.
@@ -384,7 +394,7 @@ Protected Attributes

Member Data Documentation

- +
@@ -392,7 +402,7 @@ Protected Attributes @@ -507,7 +517,7 @@ Protected Attributes diff --git a/class_bluetooth_service__coll__graph.map b/class_bluetooth_service__coll__graph.map index 908c55cf..6e6676cd 100644 --- a/class_bluetooth_service__coll__graph.map +++ b/class_bluetooth_service__coll__graph.map @@ -1,8 +1,8 @@ - - - - - - + + + + + + diff --git a/class_bluetooth_service__coll__graph.md5 b/class_bluetooth_service__coll__graph.md5 index 60af834e..c59d7e12 100644 --- a/class_bluetooth_service__coll__graph.md5 +++ b/class_bluetooth_service__coll__graph.md5 @@ -1 +1 @@ -db6062ca3a6fb9a2411ed35cc10cfe0c \ No newline at end of file +63004da77f15c2792f7eb5740b2b02f1 \ No newline at end of file diff --git a/class_bluetooth_service__coll__graph.png b/class_bluetooth_service__coll__graph.png index 03c7f0ce..b1863f95 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.map b/class_bluetooth_service__inherit__graph.map index 55cc353d..d4970890 100644 --- a/class_bluetooth_service__inherit__graph.map +++ b/class_bluetooth_service__inherit__graph.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/class_bluetooth_service__inherit__graph.md5 b/class_bluetooth_service__inherit__graph.md5 index d459942e..89adea58 100644 --- a/class_bluetooth_service__inherit__graph.md5 +++ b/class_bluetooth_service__inherit__graph.md5 @@ -1 +1 @@ -649bd2daee1f85302b66a7c86467bc90 \ No newline at end of file +ed04eb4acfc3583220d1627fb69bac21 \ No newline at end of file diff --git a/class_bluetooth_service__inherit__graph.png b/class_bluetooth_service__inherit__graph.png index 573cd5a0..89143e5f 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 33079b23..8fd4e61d 100644 --- a/class_bulk_only-members.html +++ b/class_bulk_only-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@
- +
void(* BluetoothService::pFuncOnInit)(void)void(* BluetoothService::pFuncOnInit) (void)
- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -141,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_bulk_only.html b/class_bulk_only.html index 9df00ceb..099488fe 100644 --- a/class_bulk_only.html +++ b/class_bulk_only.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: BulkOnly Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -100,14 +101,21 @@ Inheritance diagram for BulkOnly:
Inheritance graph
- + + +
[legend]
Collaboration diagram for BulkOnly:
Collaboration graph
- + + + + + +
[legend]
diff --git a/class_bulk_only__coll__graph.map b/class_bulk_only__coll__graph.map index 34e3e187..d56caf34 100644 --- a/class_bulk_only__coll__graph.map +++ b/class_bulk_only__coll__graph.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/class_bulk_only__coll__graph.md5 b/class_bulk_only__coll__graph.md5 index e993d046..65616e8f 100644 --- a/class_bulk_only__coll__graph.md5 +++ b/class_bulk_only__coll__graph.md5 @@ -1 +1 @@ -3d45c6122208407db0c669272fecf2e2 \ No newline at end of file +f9839364bbfdcee0034202ae5496cf49 \ No newline at end of file diff --git a/class_bulk_only__coll__graph.png b/class_bulk_only__coll__graph.png index 8079286b..693683e3 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.map b/class_bulk_only__inherit__graph.map index 464a9840..86773e66 100644 --- a/class_bulk_only__inherit__graph.map +++ b/class_bulk_only__inherit__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_bulk_only__inherit__graph.md5 b/class_bulk_only__inherit__graph.md5 index d585bee0..ab44521f 100644 --- a/class_bulk_only__inherit__graph.md5 +++ b/class_bulk_only__inherit__graph.md5 @@ -1 +1 @@ -56d5764d63044c2fb0319b525dd7bedc \ No newline at end of file +2b66e1860fb7442508174e207255d1ed \ No newline at end of file diff --git a/class_bulk_only__inherit__graph.png b/class_bulk_only__inherit__graph.png index 8ed08fbc..839beb4a 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 a971cceb..a53e8f7c 100644 --- a/class_byte_skipper-members.html +++ b/class_byte_skipper-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -1528,7 +1536,7 @@ Static Protected Attributes

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_byte_skipper.html b/class_byte_skipper.html index a032ffe9..e778dc67 100644 --- a/class_byte_skipper.html +++ b/class_byte_skipper.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: ByteSkipper Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -104,7 +105,7 @@ Public Member Functions

Detailed Description

-

Definition at line 57 of file parsetools.h.

+

Definition at line 62 of file parsetools.h.

Constructor & Destructor Documentation

@@ -127,7 +128,7 @@ Public Member Functions
-

Definition at line 64 of file parsetools.h.

+

Definition at line 69 of file parsetools.h.

@@ -154,7 +155,7 @@ Public Member Functions
-

Definition at line 67 of file parsetools.h.

+

Definition at line 72 of file parsetools.h.

@@ -196,7 +197,7 @@ Public Member Functions
-

Definition at line 72 of file parsetools.h.

+

Definition at line 77 of file parsetools.h.

@@ -208,7 +209,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 fd1905ae..f1af7c38 100644 --- a/class_c_d_c_async_oper-members.html +++ b/class_c_d_c_async_oper-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -96,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_c_d_c_async_oper.html b/class_c_d_c_async_oper.html index a0c45238..5cc4b466 100644 --- a/class_c_d_c_async_oper.html +++ b/class_c_d_c_async_oper.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: CDCAsyncOper Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -136,7 +137,7 @@ Public Member Functions diff --git a/class_config_desc_parser-members.html b/class_config_desc_parser-members.html index 30ef3392..46d3e697 100644 --- a/class_config_desc_parser-members.html +++ b/class_config_desc_parser-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_config_desc_parser.html b/class_config_desc_parser.html index 9bf1d660..936e7742 100644 --- a/class_config_desc_parser.html +++ b/class_config_desc_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: ConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK > Class Template Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,16 @@ Inheritance diagram for ConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID,
Inheritance graph
- + +
[legend]
Collaboration diagram for ConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK >:
Collaboration graph
- + +
[legend]

@@ -117,7 +120,7 @@ Public Member Functions

 

Detailed Description

-

template<const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
+

template<const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
class ConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK >

@@ -226,7 +229,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.map b/class_config_desc_parser__coll__graph.map index beeb8bce..6c292de0 100644 --- a/class_config_desc_parser__coll__graph.map +++ b/class_config_desc_parser__coll__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_config_desc_parser__coll__graph.md5 b/class_config_desc_parser__coll__graph.md5 index d500e5a6..6d67d32a 100644 --- a/class_config_desc_parser__coll__graph.md5 +++ b/class_config_desc_parser__coll__graph.md5 @@ -1 +1 @@ -e7881467fbeaf56de26bf3e709c6ae68 \ No newline at end of file +43e2ececa16e23c2ef0bb98404d9dd99 \ 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 4d34118d..b1e39aab 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.map b/class_config_desc_parser__inherit__graph.map index beeb8bce..6c292de0 100644 --- a/class_config_desc_parser__inherit__graph.map +++ b/class_config_desc_parser__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_config_desc_parser__inherit__graph.md5 b/class_config_desc_parser__inherit__graph.md5 index d500e5a6..6d67d32a 100644 --- a/class_config_desc_parser__inherit__graph.md5 +++ b/class_config_desc_parser__inherit__graph.md5 @@ -1 +1 @@ -e7881467fbeaf56de26bf3e709c6ae68 \ No newline at end of file +43e2ececa16e23c2ef0bb98404d9dd99 \ 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 4d34118d..b1e39aab 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 0a8a17fa..60d0e34a 100644 --- a/class_f_t_d_i-members.html +++ b/class_f_t_d_i-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages

+
@@ -115,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_f_t_d_i.html b/class_f_t_d_i.html index 6dc6163e..d2210531 100644 --- a/class_f_t_d_i.html +++ b/class_f_t_d_i.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: FTDI Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,18 @@ Inheritance diagram for FTDI:
Inheritance graph
- + + +
[legend]
Collaboration diagram for FTDI:
Collaboration graph
- + + +
[legend]
diff --git a/class_f_t_d_i__coll__graph.map b/class_f_t_d_i__coll__graph.map index acbebb33..4dc81904 100644 --- a/class_f_t_d_i__coll__graph.map +++ b/class_f_t_d_i__coll__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_f_t_d_i__coll__graph.md5 b/class_f_t_d_i__coll__graph.md5 index 76857971..8736ae0b 100644 --- a/class_f_t_d_i__coll__graph.md5 +++ b/class_f_t_d_i__coll__graph.md5 @@ -1 +1 @@ -e5e07d3721e783dff0d1e851b88878cf \ No newline at end of file +7639ae03a2a3c77cae9f7ef89dc8dcfd \ 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 d0e6900f..68dacf23 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.map b/class_f_t_d_i__inherit__graph.map index acbebb33..4dc81904 100644 --- a/class_f_t_d_i__inherit__graph.map +++ b/class_f_t_d_i__inherit__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_f_t_d_i__inherit__graph.md5 b/class_f_t_d_i__inherit__graph.md5 index 76857971..8736ae0b 100644 --- a/class_f_t_d_i__inherit__graph.md5 +++ b/class_f_t_d_i__inherit__graph.md5 @@ -1 +1 @@ -e5e07d3721e783dff0d1e851b88878cf \ No newline at end of file +7639ae03a2a3c77cae9f7ef89dc8dcfd \ 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 d0e6900f..68dacf23 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 af78f270..d1083ae9 100644 --- a/class_f_t_d_i_async_oper-members.html +++ b/class_f_t_d_i_async_oper-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -623,7 +628,7 @@ Public Member Functions

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_f_t_d_i_async_oper.html b/class_f_t_d_i_async_oper.html index c617316b..7fa0042c 100644 --- a/class_f_t_d_i_async_oper.html +++ b/class_f_t_d_i_async_oper.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: FTDIAsyncOper Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -164,7 +165,7 @@ Public Member Functions diff --git a/class_h_i_d_boot-members.html b/class_h_i_d_boot-members.html index f6556db0..f1e06336 100644 --- a/class_h_i_d_boot-members.html +++ b/class_h_i_d_boot-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -127,7 +128,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_h_i_d_boot.html b/class_h_i_d_boot.html index d8e0e469..f514e585 100644 --- a/class_h_i_d_boot.html +++ b/class_h_i_d_boot.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: HIDBoot< BOOT_PROTOCOL > Class Template Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,22 @@ Inheritance diagram for HIDBoot< BOOT_PROTOCOL >:
Inheritance graph
- + + + +
[legend]
Collaboration diagram for HIDBoot< BOOT_PROTOCOL >:
Collaboration graph
- + + + + + +
[legend]

@@ -183,7 +192,7 @@ Additional Inherited Members

 

Detailed Description

-

template<const uint8_t BOOT_PROTOCOL>
+

template<const uint8_t BOOT_PROTOCOL>
class HIDBoot< BOOT_PROTOCOL >

@@ -546,7 +555,7 @@ template<const uint8_t BOOT_PROTOCOL>
diff --git a/class_h_i_d_boot__coll__graph.map b/class_h_i_d_boot__coll__graph.map index f0d9592b..ba4eca0e 100644 --- a/class_h_i_d_boot__coll__graph.map +++ b/class_h_i_d_boot__coll__graph.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/class_h_i_d_boot__coll__graph.md5 b/class_h_i_d_boot__coll__graph.md5 index b556e0a1..de81f923 100644 --- a/class_h_i_d_boot__coll__graph.md5 +++ b/class_h_i_d_boot__coll__graph.md5 @@ -1 +1 @@ -868183779e235ca5660a15c86d65f98d \ No newline at end of file +a19c6c2c9e133ec0ee972f6c6da3910c \ 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 5f74dfae..85d7fd8e 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.map b/class_h_i_d_boot__inherit__graph.map index 4ccca983..d6cfb2d8 100644 --- a/class_h_i_d_boot__inherit__graph.map +++ b/class_h_i_d_boot__inherit__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/class_h_i_d_boot__inherit__graph.md5 b/class_h_i_d_boot__inherit__graph.md5 index 956245e7..bb37f2b2 100644 --- a/class_h_i_d_boot__inherit__graph.md5 +++ b/class_h_i_d_boot__inherit__graph.md5 @@ -1 +1 @@ -9b8e08f2bc01815670cb73cf2c382113 \ No newline at end of file +0163fec2b92b9cadecd0eed3ad26c28f \ 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 b698cfc2..357fd5a2 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 9413af43..e1e1749d 100644 --- a/class_h_i_d_composite-members.html +++ b/class_h_i_d_composite-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0

- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -137,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_h_i_d_composite.html b/class_h_i_d_composite.html index 5c5020e7..3193ba15 100644 --- a/class_h_i_d_composite.html +++ b/class_h_i_d_composite.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: HIDComposite Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -100,14 +101,23 @@ Inheritance diagram for HIDComposite:
Inheritance graph
- + + + +
[legend]
Collaboration diagram for HIDComposite:
Collaboration graph
- + + + + + + +
[legend]
diff --git a/class_h_i_d_composite__coll__graph.map b/class_h_i_d_composite__coll__graph.map index 4952d2a3..7bad2110 100644 --- a/class_h_i_d_composite__coll__graph.map +++ b/class_h_i_d_composite__coll__graph.map @@ -1,8 +1,8 @@ - - - - - - + + + + + + diff --git a/class_h_i_d_composite__coll__graph.md5 b/class_h_i_d_composite__coll__graph.md5 index 406d78bf..cb51ec95 100644 --- a/class_h_i_d_composite__coll__graph.md5 +++ b/class_h_i_d_composite__coll__graph.md5 @@ -1 +1 @@ -f46fdbe0b11cb8a564678045e363d26e \ No newline at end of file +cb1afeb4ef0790903388054fd3bdbf40 \ 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 8518c712..f1ac41c2 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.map b/class_h_i_d_composite__inherit__graph.map index e49b73d6..0b42aee7 100644 --- a/class_h_i_d_composite__inherit__graph.map +++ b/class_h_i_d_composite__inherit__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/class_h_i_d_composite__inherit__graph.md5 b/class_h_i_d_composite__inherit__graph.md5 index 3688f3bf..9ac7faab 100644 --- a/class_h_i_d_composite__inherit__graph.md5 +++ b/class_h_i_d_composite__inherit__graph.md5 @@ -1 +1 @@ -39148cc7f4ccf37138052f091ef97263 \ No newline at end of file +7bba052169c3e9cd86fb29246bed4535 \ 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 7fbc18d1..dbd01da4 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 ae6c4bfa..a8dfd0a0 100644 --- a/class_h_i_d_report_parser-members.html +++ b/class_h_i_d_report_parser-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -767,7 +777,7 @@ Additional Inherited Members

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -96,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_h_i_d_report_parser.html b/class_h_i_d_report_parser.html index 08bf2beb..dc10f396 100644 --- a/class_h_i_d_report_parser.html +++ b/class_h_i_d_report_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: HIDReportParser Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,7 +98,10 @@ Inheritance diagram for HIDReportParser:
Inheritance graph
- + + + +
[legend]
diff --git a/class_h_i_d_report_parser__inherit__graph.map b/class_h_i_d_report_parser__inherit__graph.map index 55a28d8a..23a666ea 100644 --- a/class_h_i_d_report_parser__inherit__graph.map +++ b/class_h_i_d_report_parser__inherit__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/class_h_i_d_report_parser__inherit__graph.md5 b/class_h_i_d_report_parser__inherit__graph.md5 index 44e50d86..25b71fe2 100644 --- a/class_h_i_d_report_parser__inherit__graph.md5 +++ b/class_h_i_d_report_parser__inherit__graph.md5 @@ -1 +1 @@ -c82eb64e4e9d8248b32e0db32cbfa973 \ No newline at end of file +8be112e5d3300b51cf0649c53a258712 \ 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 e037995b..a9296e70 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 48c7e3a9..61c1b3c4 100644 --- a/class_h_i_d_universal-members.html +++ b/class_h_i_d_universal-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -165,7 +169,7 @@ Public Member Functions

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -136,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_h_i_d_universal.html b/class_h_i_d_universal.html index 7067c7f3..def76353 100644 --- a/class_h_i_d_universal.html +++ b/class_h_i_d_universal.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: HIDUniversal Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -100,14 +101,25 @@ Inheritance diagram for HIDUniversal:
Inheritance graph
- + + + + + +
[legend]
Collaboration diagram for HIDUniversal:
Collaboration graph
- + + + + + + +
[legend]
diff --git a/class_h_i_d_universal__coll__graph.map b/class_h_i_d_universal__coll__graph.map index 4588b823..659c6197 100644 --- a/class_h_i_d_universal__coll__graph.map +++ b/class_h_i_d_universal__coll__graph.map @@ -1,8 +1,8 @@ - - - - - - + + + + + + diff --git a/class_h_i_d_universal__coll__graph.md5 b/class_h_i_d_universal__coll__graph.md5 index 370d1617..5c56aa71 100644 --- a/class_h_i_d_universal__coll__graph.md5 +++ b/class_h_i_d_universal__coll__graph.md5 @@ -1 +1 @@ -b5cef4f8f34c289be8a5e9593bd7b560 \ No newline at end of file +9798e993ef1d49a2c1f0b1530f49b8e4 \ 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 7b074476..90af5ab0 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.map b/class_h_i_d_universal__inherit__graph.map index 1987c81a..2aa0c95e 100644 --- a/class_h_i_d_universal__inherit__graph.map +++ b/class_h_i_d_universal__inherit__graph.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/class_h_i_d_universal__inherit__graph.md5 b/class_h_i_d_universal__inherit__graph.md5 index 4f8c9fa1..2e820cab 100644 --- a/class_h_i_d_universal__inherit__graph.md5 +++ b/class_h_i_d_universal__inherit__graph.md5 @@ -1 +1 @@ -b9ffbf171d867d2aeb5470758673129e \ No newline at end of file +1ce1a5f9211e70eba63ba823d3663601 \ 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 5c4ffa99..c1f7f48e 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 32e29571..8d952b32 100644 --- a/class_hex_dumper-members.html +++ b/class_hex_dumper-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -729,7 +741,7 @@ Additional Inherited Members

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_hex_dumper.html b/class_hex_dumper.html index bb050db2..b93b2e51 100644 --- a/class_hex_dumper.html +++ b/class_hex_dumper.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE > Class Template Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -117,7 +118,7 @@ Public Member Functions  

Detailed Description

-

template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
+

template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
class HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >

@@ -222,7 +223,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 8c6445be..c9f3f213 100644 --- a/class_hex_dumper__coll__graph.md5 +++ b/class_hex_dumper__coll__graph.md5 @@ -1 +1 @@ -6b19c97018ed43d19b0cb24ee29f2b87 \ No newline at end of file +5be5e99ec5970ed3fe98ca3cc812cd40 \ No newline at end of file diff --git a/class_hex_dumper__coll__graph.png b/class_hex_dumper__coll__graph.png index 4cca44df..f6ec58a4 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 8c6445be..c9f3f213 100644 --- a/class_hex_dumper__inherit__graph.md5 +++ b/class_hex_dumper__inherit__graph.md5 @@ -1 +1 @@ -6b19c97018ed43d19b0cb24ee29f2b87 \ No newline at end of file +5be5e99ec5970ed3fe98ca3cc812cd40 \ No newline at end of file diff --git a/class_hex_dumper__inherit__graph.png b/class_hex_dumper__inherit__graph.png index 4cca44df..f6ec58a4 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 125913ff..6fdc420b 100644 --- a/class_keyboard_report_parser-members.html +++ b/class_keyboard_report_parser-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0

- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_keyboard_report_parser.html b/class_keyboard_report_parser.html index 5662f0d5..86420a84 100644 --- a/class_keyboard_report_parser.html +++ b/class_keyboard_report_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: KeyboardReportParser Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -99,14 +100,18 @@ Inheritance diagram for KeyboardReportParser:
Inheritance graph
- + +
[legend]
Collaboration diagram for KeyboardReportParser:
Collaboration graph
- + + + +
[legend]
diff --git a/class_keyboard_report_parser__coll__graph.map b/class_keyboard_report_parser__coll__graph.map index 69750bcd..27581ba7 100644 --- a/class_keyboard_report_parser__coll__graph.map +++ b/class_keyboard_report_parser__coll__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/class_keyboard_report_parser__coll__graph.md5 b/class_keyboard_report_parser__coll__graph.md5 index dbd84d99..b3538af0 100644 --- a/class_keyboard_report_parser__coll__graph.md5 +++ b/class_keyboard_report_parser__coll__graph.md5 @@ -1 +1 @@ -de31ab1b6045c46c724624d2f45ecd22 \ No newline at end of file +bb7b1a74ec2625233c79c3d3448ef47a \ 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 87a9e3ee..580a325f 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.map b/class_keyboard_report_parser__inherit__graph.map index f2451a79..0ab483c0 100644 --- a/class_keyboard_report_parser__inherit__graph.map +++ b/class_keyboard_report_parser__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_keyboard_report_parser__inherit__graph.md5 b/class_keyboard_report_parser__inherit__graph.md5 index 4f094571..5b9658e5 100644 --- a/class_keyboard_report_parser__inherit__graph.md5 +++ b/class_keyboard_report_parser__inherit__graph.md5 @@ -1 +1 @@ -ea9cb8a4a1aab693a56a91401236d24e \ No newline at end of file +c874e74f72d0db473ce869577e6f92d6 \ 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 969df594..cdf473ef 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 c4d5f703..001a8a17 100644 --- a/class_m_a_x3421e-members.html +++ b/class_m_a_x3421e-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -604,7 +609,7 @@ Protected Attributes

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_m_a_x3421e.html b/class_m_a_x3421e.html index eec06e85..2f6b8217 100644 --- a/class_m_a_x3421e.html +++ b/class_m_a_x3421e.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: MAX3421e< SPI_SS, INTR > Class Template Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,7 +98,8 @@ Inheritance diagram for MAX3421e< SPI_SS, INTR >:
Inheritance graph
- + +
[legend]
- + - + @@ -140,7 +142,7 @@ Public Member Functions

@@ -115,10 +117,10 @@ Public Member Functions

uint8_t * bytesRd (uint8_t reg, uint8_t nbytes, uint8_t *data_p)
 
uint8_t gpioRd ()
 Reads the current GPI input values. More...
 Reads the current GPI input values. More...
 
uint8_t gpioRdOutput ()
 Reads the current GPI output values. More...
 Reads the current GPI output values. More...
 
uint16_t reset ()
 
 

Detailed Description

-

template<typename SPI_SS, typename INTR>
+

template<typename SPI_SS, typename INTR>
class MAX3421e< SPI_SS, INTR >

@@ -248,7 +250,7 @@ template<typename SPI_SS , typename INTR >

-

Definition at line 275 of file usbhost.h.

+

Definition at line 269 of file usbhost.h.

@@ -268,7 +270,7 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 284 of file usbhost.h.

+

Definition at line 278 of file usbhost.h.

@@ -304,7 +306,7 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 323 of file usbhost.h.

+

Definition at line 317 of file usbhost.h.

@@ -331,7 +333,7 @@ template<typename SPI_SS , typename INTR > -

Definition at line 390 of file usbhost.h.

+

Definition at line 384 of file usbhost.h.

@@ -358,7 +360,7 @@ template<typename SPI_SS , typename INTR > -

Definition at line 403 of file usbhost.h.

+

Definition at line 397 of file usbhost.h.

@@ -377,7 +379,7 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 414 of file usbhost.h.

+

Definition at line 408 of file usbhost.h.

@@ -396,7 +398,7 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 428 of file usbhost.h.

+

Definition at line 422 of file usbhost.h.

@@ -416,7 +418,7 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 465 of file usbhost.h.

+

Definition at line 459 of file usbhost.h.

@@ -491,7 +493,7 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 509 of file usbhost.h.

+

Definition at line 503 of file usbhost.h.

@@ -527,7 +529,7 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 563 of file usbhost.h.

+

Definition at line 557 of file usbhost.h.

@@ -547,7 +549,7 @@ template<typename SPI_SS , typename INTR >
-

Definition at line 544 of file usbhost.h.

+

Definition at line 538 of file usbhost.h.

@@ -559,7 +561,7 @@ template<typename SPI_SS , typename INTR > diff --git a/class_m_a_x3421e__inherit__graph.map b/class_m_a_x3421e__inherit__graph.map index 39655a20..ef6587aa 100644 --- a/class_m_a_x3421e__inherit__graph.map +++ b/class_m_a_x3421e__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_m_a_x3421e__inherit__graph.md5 b/class_m_a_x3421e__inherit__graph.md5 index 9c6ebd2d..e9dc0389 100644 --- a/class_m_a_x3421e__inherit__graph.md5 +++ b/class_m_a_x3421e__inherit__graph.md5 @@ -1 +1 @@ -77bb5e0b002d7306a86fd50983493adb \ No newline at end of file +6b7dcdcf5b00fbf00c69a08de5fc301c \ 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 f7425878..9d8cb8d8 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 8ff62221..c2da4d08 100644 --- a/class_max___l_c_d-members.html +++ b/class_max___l_c_d-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -116,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_max___l_c_d.html b/class_max___l_c_d.html index 5fca6a88..dbe9e03c 100644 --- a/class_max___l_c_d.html +++ b/class_max___l_c_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Max_LCD Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -587,7 +588,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 687ddba5..8d049f39 100644 --- a/class_max___l_c_d__coll__graph.md5 +++ b/class_max___l_c_d__coll__graph.md5 @@ -1 +1 @@ -25074a74d69adb1d486aa8133e08ae69 \ No newline at end of file +14cf14911886c71d7e91596c82a5010c \ 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 1ea31750..400d5204 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 687ddba5..8d049f39 100644 --- a/class_max___l_c_d__inherit__graph.md5 +++ b/class_max___l_c_d__inherit__graph.md5 @@ -1 +1 @@ -25074a74d69adb1d486aa8133e08ae69 \ No newline at end of file +14cf14911886c71d7e91596c82a5010c \ 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 1ea31750..400d5204 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 a38bf23e..56bbe033 100644 --- a/class_mouse_report_parser-members.html +++ b/class_mouse_report_parser-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -105,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_mouse_report_parser.html b/class_mouse_report_parser.html index 3b8720ef..172cd8ef 100644 --- a/class_mouse_report_parser.html +++ b/class_mouse_report_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: MouseReportParser Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,14 +99,17 @@ Inheritance diagram for MouseReportParser:
Inheritance graph
- + +
[legend]
Collaboration diagram for MouseReportParser:
Collaboration graph
- + + +
[legend]
diff --git a/class_mouse_report_parser__coll__graph.map b/class_mouse_report_parser__coll__graph.map index 2d2572e1..fd308ae3 100644 --- a/class_mouse_report_parser__coll__graph.map +++ b/class_mouse_report_parser__coll__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_mouse_report_parser__coll__graph.md5 b/class_mouse_report_parser__coll__graph.md5 index f830f24d..0d410a43 100644 --- a/class_mouse_report_parser__coll__graph.md5 +++ b/class_mouse_report_parser__coll__graph.md5 @@ -1 +1 @@ -53fbe637398f71f4437285858e2dc022 \ No newline at end of file +405a7d8e938e10b74a7c678fcf2f2523 \ 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 0f34915d..82ca8ea2 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.map b/class_mouse_report_parser__inherit__graph.map index 2abdf8bc..10699d49 100644 --- a/class_mouse_report_parser__inherit__graph.map +++ b/class_mouse_report_parser__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_mouse_report_parser__inherit__graph.md5 b/class_mouse_report_parser__inherit__graph.md5 index 621cb958..6dbeddc2 100644 --- a/class_mouse_report_parser__inherit__graph.md5 +++ b/class_mouse_report_parser__inherit__graph.md5 @@ -1 +1 @@ -7e59901244ab319897b579870a1fbeaf \ No newline at end of file +06cbf9c7fbacf4aaec1bcdfdc9d69628 \ 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 ea99e56c..7881c6df 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 81c44c73..915006af 100644 --- a/class_multi_byte_value_parser-members.html +++ b/class_multi_byte_value_parser-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -404,7 +408,7 @@ Protected Member Functions

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -99,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_multi_byte_value_parser.html b/class_multi_byte_value_parser.html index a8845f3d..54c46c12 100644 --- a/class_multi_byte_value_parser.html +++ b/class_multi_byte_value_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: MultiByteValueParser Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -106,7 +107,7 @@ Public Member Functions

Detailed Description

-

Definition at line 35 of file parsetools.h.

+

Definition at line 40 of file parsetools.h.

Constructor & Destructor Documentation

@@ -129,7 +130,7 @@ Public Member Functions
-

Definition at line 42 of file parsetools.h.

+

Definition at line 47 of file parsetools.h.

@@ -155,7 +156,7 @@ Public Member Functions
-

Definition at line 45 of file parsetools.h.

+

Definition at line 50 of file parsetools.h.

@@ -181,7 +182,7 @@ Public Member Functions
-

Definition at line 49 of file parsetools.h.

+

Definition at line 54 of file parsetools.h.

@@ -222,7 +223,7 @@ Public Member Functions diff --git a/class_p_l2303-members.html b/class_p_l2303-members.html index 5ff340c5..7086003f 100644 --- a/class_p_l2303-members.html +++ b/class_p_l2303-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -142,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_p_l2303.html b/class_p_l2303.html index 11fea741..4efafead 100644 --- a/class_p_l2303.html +++ b/class_p_l2303.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PL2303 Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,25 @@ Inheritance diagram for PL2303:
Inheritance graph
- + + + +
[legend]
Collaboration diagram for PL2303:
Collaboration graph
- + + + + + + + + +
[legend]
diff --git a/class_p_l2303__coll__graph.map b/class_p_l2303__coll__graph.map index 3043a7ed..37a260cf 100644 --- a/class_p_l2303__coll__graph.map +++ b/class_p_l2303__coll__graph.map @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + diff --git a/class_p_l2303__coll__graph.md5 b/class_p_l2303__coll__graph.md5 index 82068a93..3fccb2c3 100644 --- a/class_p_l2303__coll__graph.md5 +++ b/class_p_l2303__coll__graph.md5 @@ -1 +1 @@ -3158246e7ebbf9ad610bcf22883daab8 \ No newline at end of file +da3590f8b39ab5267484ef72f2899a2c \ No newline at end of file diff --git a/class_p_l2303__coll__graph.png b/class_p_l2303__coll__graph.png index 4c9fffe5..07644dcb 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.map b/class_p_l2303__inherit__graph.map index 3312ea75..82470977 100644 --- a/class_p_l2303__inherit__graph.map +++ b/class_p_l2303__inherit__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/class_p_l2303__inherit__graph.md5 b/class_p_l2303__inherit__graph.md5 index fbefc7d1..8fff62d8 100644 --- a/class_p_l2303__inherit__graph.md5 +++ b/class_p_l2303__inherit__graph.md5 @@ -1 +1 @@ -24eddf3115f9a78b418b7d29835285a2 \ No newline at end of file +dd455d55317b48c08e2327d045dafb04 \ No newline at end of file diff --git a/class_p_l2303__inherit__graph.png b/class_p_l2303__inherit__graph.png index 2c503056..455cd550 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 628ef969..dfaa9f75 100644 --- a/class_p_s3_b_t-members.html +++ b/class_p_s3_b_t-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -299,7 +311,7 @@ Additional Inherited Members

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -113,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); moveSetRumble(uint8_t rumble)PS3BT onInit()PS3BTprotectedvirtual pBtdBluetoothServiceprotected - pFuncOnInitBluetoothServiceprotected + pFuncOnInitBluetoothServiceprotected printStatusString()PS3BT 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)PS3BT PS3ConnectedPS3BT @@ -135,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_p_s3_b_t.html b/class_p_s3_b_t.html index d0d8b8ab..7910a7c9 100644 --- a/class_p_s3_b_t.html +++ b/class_p_s3_b_t.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3BT Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,14 +99,22 @@ Inheritance diagram for PS3BT:
Inheritance graph
- + +
[legend]
Collaboration diagram for PS3BT:
Collaboration graph
- + + + + + + + +
[legend]
- - + + @@ -263,8 +272,7 @@ Additional Inherited Members

@@ -193,8 +202,8 @@ Additional Inherited Members

bool checkHciHandle (uint8_t *buf, uint16_t handle)
 
- Protected Attributes inherited from BluetoothService
void(* pFuncOnInit )(void)
 
void(* pFuncOnInit )(void)
 
BTDpBtd
 
uint16_t hci_handle
-

Constructor for the PS3BT class.

-
Parameters
+

Constructor for the PS3BT class.

Parameters
@@ -320,8 +328,7 @@ Additional Inherited Members

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
pBtdPointer to BTD class instance.
btadr5,btadr4,btadr3,btadr2,btadr1,btadr0Pass your dongles Bluetooth address into the constructor, This will set BTD::my_bdaddr, so you don't have to plug in the dongle before pairing with your controller.
bButtonEnum to read.
@@ -348,8 +355,7 @@ Additional Inherited Members

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
bButtonEnum to read.
@@ -374,8 +380,7 @@ Additional Inherited Members
-

Used to get the analog value from button presses.

-
Parameters
+

Used to get the analog value from button presses.

Parameters
aThe ButtonEnum to read. The supported buttons are: UP, RIGHT, DOWN, LEFT, L1, L2, R1, R2, TRIANGLE, CIRCLE, CROSS, SQUARE, and T.
@@ -400,8 +405,7 @@ Additional Inherited Members
-

Used to read the analog joystick.

-
Parameters
+

Used to read the analog joystick.

Parameters
aLeftHatX, LeftHatY, RightHatX, and RightHatY.
@@ -426,8 +430,7 @@ Additional Inherited Members
-

Used to read the sensors inside the Dualshock 3 and Move controller.

-
Parameters
+

Used to read the sensors inside the Dualshock 3 and Move controller.

Parameters
aThe Dualshock 3 has a 3-axis accelerometer and a 1-axis gyro inside. The Move controller has a 3-axis accelerometer, a 3-axis gyro, a 3-axis magnetometer and a temperature sensor inside.
@@ -452,8 +455,7 @@ Additional Inherited Members
-

Use this to get Pitch and Roll calculated using the accelerometer.

-
Parameters
+

Use this to get Pitch and Roll calculated using the accelerometer.

Parameters
aEither Pitch or Roll.
@@ -478,8 +480,7 @@ Additional Inherited Members
-

Read the sensors inside the Move controller.

-
Parameters
+

Read the sensors inside the Move controller.

Parameters
aaXmove, aYmove, aZmove, gXmove, gYmove, gZmove, mXmove, mYmove, and mXmove.
@@ -504,8 +505,7 @@ Additional Inherited Members
-

Get the status from the controller.

-
Parameters
+

Get the status from the controller.

Parameters
cThe StatusEnum you want to read.
@@ -547,8 +547,7 @@ Additional Inherited Members
-

Read the temperature from the Move controller.

-
Returns
The temperature in degrees Celsius.
+

Read the temperature from the Move controller.

Returns
The temperature in degrees Celsius.

Definition at line 141 of file PS3BT.cpp.

@@ -603,8 +602,7 @@ Additional Inherited Members
-

Turn on rumble.

-
Parameters
+

Turn on rumble.

Parameters
modeEither RumbleHigh or RumbleLow.
@@ -650,8 +648,7 @@ Additional Inherited Members
-

Turn on rumble using custom duration and power.

-
Parameters
+

Turn on rumble using custom duration and power.

Parameters
@@ -678,8 +675,7 @@ Additional Inherited Members
rightDurationThe duration of the right/low rumble effect.
rightPowerThe intensity of the right/low rumble effect.
-

Set LED value without using LEDEnum.

-
Parameters
+

Set LED value without using LEDEnum.

Parameters
valueSee: LEDEnum.
@@ -729,8 +725,7 @@ Additional Inherited Members
-

Turn the specific LED off.

-
Parameters
+

Turn the specific LED off.

Parameters
aThe LEDEnum to turn off.
@@ -754,8 +749,7 @@ Additional Inherited Members
-

Turn the specific LED on.

-
Parameters
+

Turn the specific LED on.

Parameters
aThe LEDEnum to turn on.
@@ -779,8 +773,7 @@ Additional Inherited Members
-

Toggle the specific LED.

-
Parameters
+

Toggle the specific LED.

Parameters
aThe LEDEnum to toggle.
@@ -820,8 +813,7 @@ Additional Inherited Members
-

Use this to set the Color using RGB values.

-
Parameters
+

Use this to set the Color using RGB values.

Parameters
r,g,bRGB value.
@@ -845,8 +837,7 @@ Additional Inherited Members
-

Use this to set the color using the predefined colors in ColorsEnum.

-
Parameters
+

Use this to set the color using the predefined colors in ColorsEnum.

Parameters
colorThe desired color.
@@ -870,8 +861,7 @@ Additional Inherited Members
-

Set the rumble value inside the Move controller.

-
Parameters
+

Set the rumble value inside the Move controller.

Parameters
rumbleThe desired value in the range from 64-255.
@@ -929,8 +919,7 @@ Additional Inherited Members
-

Used to pass acldata to the services.

-
Parameters
+

Used to pass acldata to the services.

Parameters
ACLDataIncoming acldata.
@@ -1082,7 +1071,7 @@ Additional Inherited Members diff --git a/class_p_s3_b_t__coll__graph.map b/class_p_s3_b_t__coll__graph.map index 63da0a89..25410a78 100644 --- a/class_p_s3_b_t__coll__graph.map +++ b/class_p_s3_b_t__coll__graph.map @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + diff --git a/class_p_s3_b_t__coll__graph.md5 b/class_p_s3_b_t__coll__graph.md5 index ed91eb65..9944a07a 100644 --- a/class_p_s3_b_t__coll__graph.md5 +++ b/class_p_s3_b_t__coll__graph.md5 @@ -1 +1 @@ -5301c89dcc5affb5b1bdbd34899da060 \ No newline at end of file +7cded78e6e9cacc4756734b2d8e3a17f \ 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 257b1f69..22ebb4ff 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.map b/class_p_s3_b_t__inherit__graph.map index 66a5329e..94a99870 100644 --- a/class_p_s3_b_t__inherit__graph.map +++ b/class_p_s3_b_t__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_p_s3_b_t__inherit__graph.md5 b/class_p_s3_b_t__inherit__graph.md5 index 12c7deaf..c4a47a9b 100644 --- a/class_p_s3_b_t__inherit__graph.md5 +++ b/class_p_s3_b_t__inherit__graph.md5 @@ -1 +1 @@ -06c1c66f64f4c39618a1d5ab9446b806 \ No newline at end of file +af123ea0ba1b2bc2c3a6775f7cb65fa0 \ 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 a176f53e..e425f895 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 8fc48ff6..61040b73 100644 --- a/class_p_s3_u_s_b-members.html +++ b/class_p_s3_u_s_b-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -138,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_p_s3_u_s_b.html b/class_p_s3_u_s_b.html index 1418b7b6..bc96d000 100644 --- a/class_p_s3_u_s_b.html +++ b/class_p_s3_u_s_b.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS3USB Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -99,14 +100,19 @@ Inheritance diagram for PS3USB:
Inheritance graph
- + +
[legend]
Collaboration diagram for PS3USB:
Collaboration graph
- + + + + +
[legend]

@@ -267,8 +273,7 @@ Protected Attributes

-

Constructor for the PS3USB class.

-
Parameters
+

Constructor for the PS3USB class.

Parameters
@@ -318,8 +323,7 @@ Protected Attributes
pUsbPointer to USB class instance.
btadr5,btadr4,btadr3,btadr2,btadr1,btadr0Pass your dongles Bluetooth address into the constructor, so you are able to pair the controller with a Bluetooth dongle.
-

Initialize the PS3 Controller.

-
Parameters
+

Initialize the PS3 Controller.

Parameters
@@ -355,8 +359,7 @@ Protected Attributes
parentHub number.
portPort number on the hub.
-

Release the USB device.

-
Returns
0 on success.
+

Release the USB device.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -384,8 +387,7 @@ Protected Attributes
-

Poll the USB Input endpoins and run the state machines.

-
Returns
0 on success.
+

Poll the USB Input endpoins and run the state machines.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -413,8 +415,7 @@ Protected Attributes
-

Get the device address.

-
Returns
The device address.
+

Get the device address.

Returns
The device address.

Reimplemented from USBDeviceConfig.

@@ -442,8 +443,7 @@ Protected Attributes
-

Used to check if the controller has been initialized.

-
Returns
True if it's ready.
+

Used to check if the controller has been initialized.

Returns
True if it's ready.

Definition at line 92 of file PS3USB.h.

@@ -480,8 +480,7 @@ Protected Attributes
-

Used by the USB core to check what this driver support.

-
Parameters
+

Used by the USB core to check what this driver support.

Parameters
@@ -509,8 +508,7 @@ Protected Attributes
vidThe device's VID.
pidThe device's PID.
-

Used to set the Bluetooth address inside the Dualshock 3 and Navigation controller. Set using LSB first.

-
Parameters
+

Used to set the Bluetooth address inside the Dualshock 3 and Navigation controller. Set using LSB first.

Parameters
bdaddrYour dongles Bluetooth address.
@@ -534,8 +532,7 @@ Protected Attributes
-

Used to get the Bluetooth address inside the Dualshock 3 and Navigation controller. Will return LSB first.

-
Parameters
+

Used to get the Bluetooth address inside the Dualshock 3 and Navigation controller. Will return LSB first.

Parameters
bdaddrYour dongles Bluetooth address.
@@ -559,8 +556,7 @@ Protected Attributes
-

Used to set the Bluetooth address inside the Move controller. Set using LSB first.

-
Parameters
+

Used to set the Bluetooth address inside the Move controller. Set using LSB first.

Parameters
bdaddrYour dongles Bluetooth address.
@@ -584,8 +580,7 @@ Protected Attributes
-

Used to get the Bluetooth address inside the Move controller. Will return LSB first.

-
Parameters
+

Used to get the Bluetooth address inside the Move controller. Will return LSB first.

Parameters
bdaddrYour dongles Bluetooth address.
@@ -609,8 +604,7 @@ Protected Attributes
-

Used to get the calibration data inside the Move controller.

-
Parameters
+

Used to get the calibration data inside the Move controller.

Parameters
dataBuffer to store data in. Must be at least 147 bytes
@@ -636,8 +630,7 @@ Protected Attributes

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
bButtonEnum to read.
@@ -664,8 +657,7 @@ Protected Attributes

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
bButtonEnum to read.
@@ -690,8 +682,7 @@ Protected Attributes
-

Used to get the analog value from button presses.

-
Parameters
+

Used to get the analog value from button presses.

Parameters
aThe ButtonEnum to read. The supported buttons are: UP, RIGHT, DOWN, LEFT, L1, L2, R1, R2, TRIANGLE, CIRCLE, CROSS, SQUARE, and T.
@@ -716,8 +707,7 @@ Protected Attributes
-

Used to read the analog joystick.

-
Parameters
+

Used to read the analog joystick.

Parameters
aLeftHatX, LeftHatY, RightHatX, and RightHatY.
@@ -742,8 +732,7 @@ Protected Attributes
-

Used to read the sensors inside the Dualshock 3 controller.

-
Parameters
+

Used to read the sensors inside the Dualshock 3 controller.

Parameters
aThe Dualshock 3 has a 3-axis accelerometer and a 1-axis gyro inside.
@@ -768,8 +757,7 @@ Protected Attributes
-

Use this to get Pitch and Roll calculated using the accelerometer.

-
Parameters
+

Use this to get Pitch and Roll calculated using the accelerometer.

Parameters
aEither Pitch or Roll.
@@ -794,8 +782,7 @@ Protected Attributes
-

Get the StatusEnum from the controller.

-
Parameters
+

Get the StatusEnum from the controller.

Parameters
cThe StatusEnum you want to read.
@@ -874,8 +861,7 @@ Protected Attributes
-

Turn on rumble.

-
Parameters
+

Turn on rumble.

Parameters
modeEither RumbleHigh or RumbleLow.
@@ -921,8 +907,7 @@ Protected Attributes
-

Turn on rumble using custom duration and power.

-
Parameters
+

Turn on rumble using custom duration and power.

Parameters
@@ -949,8 +934,7 @@ Protected Attributes
rightDurationThe duration of the right/low rumble effect.
rightPowerThe intensity of the right/low rumble effect.
-

Set LED value without using the LEDEnum.

-
Parameters
+

Set LED value without using the LEDEnum.

Parameters
valueSee: LEDEnum.
@@ -1000,8 +984,7 @@ Protected Attributes
-

Turn the specific LEDEnum off.

-
Parameters
+

Turn the specific LEDEnum off.

Parameters
aThe LEDEnum to turn off.
@@ -1025,8 +1008,7 @@ Protected Attributes
-

Turn the specific LEDEnum on.

-
Parameters
+

Turn the specific LEDEnum on.

Parameters
aThe LEDEnum to turn on.
@@ -1050,8 +1032,7 @@ Protected Attributes
-

Toggle the specific LEDEnum.

-
Parameters
+

Toggle the specific LEDEnum.

Parameters
aThe LEDEnum to toggle.
@@ -1091,8 +1072,7 @@ Protected Attributes
-

Use this to set the Color using RGB values.

-
Parameters
+

Use this to set the Color using RGB values.

Parameters
r,g,bRGB value.
@@ -1116,8 +1096,7 @@ Protected Attributes
-

Use this to set the color using the predefined colors in ColorsEnum.

-
Parameters
+

Use this to set the color using the predefined colors in ColorsEnum.

Parameters
colorThe desired color.
@@ -1141,8 +1120,7 @@ Protected Attributes
-

Set the rumble value inside the Move controller.

-
Parameters
+

Set the rumble value inside the Move controller.

Parameters
rumbleThe desired value in the range from 64-255.
@@ -1174,8 +1152,7 @@ Protected Attributes
-

Used to call your own function when the controller is successfully initialized.

-
Parameters
+

Used to call your own function when the controller is successfully initialized.

Parameters
funcOnInitFunction to call.
@@ -1310,7 +1287,7 @@ Protected Attributes diff --git a/class_p_s3_u_s_b__coll__graph.map b/class_p_s3_u_s_b__coll__graph.map index 2ccd7cf3..3e75fdd3 100644 --- a/class_p_s3_u_s_b__coll__graph.map +++ b/class_p_s3_u_s_b__coll__graph.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/class_p_s3_u_s_b__coll__graph.md5 b/class_p_s3_u_s_b__coll__graph.md5 index 4a94ee41..1aae81d3 100644 --- a/class_p_s3_u_s_b__coll__graph.md5 +++ b/class_p_s3_u_s_b__coll__graph.md5 @@ -1 +1 @@ -9e8c5435724f7c7e70dfbe754d4e9919 \ No newline at end of file +06f5f28fefcd0973f7f3cf5ab5f01033 \ 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 ba028929..3def6455 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.map b/class_p_s3_u_s_b__inherit__graph.map index 230069e3..33940989 100644 --- a/class_p_s3_u_s_b__inherit__graph.map +++ b/class_p_s3_u_s_b__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_p_s3_u_s_b__inherit__graph.md5 b/class_p_s3_u_s_b__inherit__graph.md5 index 44086750..b241da78 100644 --- a/class_p_s3_u_s_b__inherit__graph.md5 +++ b/class_p_s3_u_s_b__inherit__graph.md5 @@ -1 +1 @@ -d6728a689bb029a7cd4f4e23b5bf2c3c \ No newline at end of file +77f7ca570be060c1a40a0845510a4a59 \ 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 e7e61d27..b1442de3 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 b7a8d0bd..d6fb78d6 100644 --- a/class_p_s4_b_t-members.html +++ b/class_p_s4_b_t-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -124,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); Parse(uint8_t len, uint8_t *buf)PS4Parserprotected ParseBTHIDData(uint8_t len, uint8_t *buf)PS4BTinlineprotectedvirtual pBtdBluetoothServiceprotected - pFuncOnInitBluetoothServiceprotected + pFuncOnInitBluetoothServiceprotected PS4BT(BTD *p, bool pair=false, const char *pin="0000")PS4BTinline PS4Parser()PS4Parserinline BTHID::Reset()BTHIDprotectedvirtual @@ -149,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_p_s4_b_t.html b/class_p_s4_b_t.html index d39fc3a4..acf0c132 100644 --- a/class_p_s4_b_t.html +++ b/class_p_s4_b_t.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4BT Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,26 @@ Inheritance diagram for PS4BT:
Inheritance graph
- + + + +
[legend]
Collaboration diagram for PS4BT:
Collaboration graph
- + + + + + + + + + +
[legend]
- - + + @@ -277,8 +290,7 @@ Additional Inherited Members

@@ -224,8 +237,8 @@ Additional Inherited Members

uint8_t interrupt_scid [2]
 
- Protected Attributes inherited from BluetoothService
void(* pFuncOnInit )(void)
 
void(* pFuncOnInit )(void)
 
BTDpBtd
 
uint16_t hci_handle
-

Constructor for the PS4BT class.

-
Parameters
+

Constructor for the PS4BT class.

Parameters
@@ -312,8 +324,7 @@ Additional Inherited Members
pPointer to the BTD class instance.
pairSet this to true in order to pair with the device. If the argument is omitted then it will not pair with it. One can use PAIR to set it to true.
-

Used to check if a PS4 controller is connected.

-
Returns
Returns true if it is connected.
+

Used to check if a PS4 controller is connected.

Returns
Returns true if it is connected.

Definition at line 45 of file PS4BT.h.

@@ -350,8 +361,7 @@ Additional Inherited Members
-

Used to parse Bluetooth HID data.

-
Parameters
+

Used to parse Bluetooth HID data.

Parameters
@@ -442,8 +452,7 @@ Additional Inherited Members
lenThe length of the incoming data.
bufPointer to the data buffer.
-

Send the output to the PS4 controller. This is implemented in PS4BT.h and PS4USB.h.

-
Parameters
+

Send the output to the PS4 controller. This is implemented in PS4BT.h and PS4USB.h.

Parameters
outputPointer to PS4Output buffer;
@@ -464,7 +473,7 @@ Additional Inherited Members diff --git a/class_p_s4_b_t__coll__graph.map b/class_p_s4_b_t__coll__graph.map index bfad127e..d2126a78 100644 --- a/class_p_s4_b_t__coll__graph.map +++ b/class_p_s4_b_t__coll__graph.map @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + diff --git a/class_p_s4_b_t__coll__graph.md5 b/class_p_s4_b_t__coll__graph.md5 index a9ddb1a5..57a44763 100644 --- a/class_p_s4_b_t__coll__graph.md5 +++ b/class_p_s4_b_t__coll__graph.md5 @@ -1 +1 @@ -8ce481092eac2c035d9bd45d31696dc3 \ No newline at end of file +4bb85a2b4d5163f1d591f32b835727dc \ 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 70ca4717..56e8eaf2 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.map b/class_p_s4_b_t__inherit__graph.map index 47fcf307..b5de590c 100644 --- a/class_p_s4_b_t__inherit__graph.map +++ b/class_p_s4_b_t__inherit__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/class_p_s4_b_t__inherit__graph.md5 b/class_p_s4_b_t__inherit__graph.md5 index 732559f1..22e73541 100644 --- a/class_p_s4_b_t__inherit__graph.md5 +++ b/class_p_s4_b_t__inherit__graph.md5 @@ -1 +1 @@ -6968257051e0d345ab838bb416a09380 \ No newline at end of file +405752bfa16040ed3832aa96d3e4fa2f \ 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 abfa7d30..cfb58080 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 27e63e48..baa936ec 100644 --- a/class_p_s4_parser-members.html +++ b/class_p_s4_parser-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -121,7 +122,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_p_s4_parser.html b/class_p_s4_parser.html index e2ef0ee0..24e41110 100644 --- a/class_p_s4_parser.html +++ b/class_p_s4_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4Parser Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,7 +99,9 @@ Inheritance diagram for PS4Parser:
Inheritance graph
- + + +
[legend]

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters

@@ -207,8 +210,7 @@ Protected Member Functions

bButtonEnum to read.
@@ -235,8 +237,7 @@ Protected Member Functions

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
bButtonEnum to read.
@@ -261,8 +262,7 @@ Protected Member Functions
-

Used to get the analog value from button presses.

-
Parameters
+

Used to get the analog value from button presses.

Parameters
bThe ButtonEnum to read. The supported buttons are: L2 and R2.
@@ -287,8 +287,7 @@ Protected Member Functions
-

Used to read the analog joystick.

-
Parameters
+

Used to read the analog joystick.

Parameters
aLeftHatX, LeftHatY, RightHatX, and RightHatY.
@@ -331,8 +330,7 @@ Protected Member Functions
-

Get the x-coordinate of the touchpad. Position 0 is in the top left.

-
Parameters
+

Get the x-coordinate of the touchpad. Position 0 is in the top left.

Parameters
@@ -376,8 +374,7 @@ Protected Member Functions
finger0 = first finger, 1 = second finger. If omitted, then 0 will be used.
xyIdThe controller sends out three packets with the same structure. The third one will contain the last measure, but if you read from the controller then there is only be data in the first one. For that reason it will be set to 0 if the argument is omitted.
-

Get the y-coordinate of the touchpad. Position 0 is in the top left.

-
Parameters
+

Get the y-coordinate of the touchpad. Position 0 is in the top left.

Parameters
@@ -421,8 +418,7 @@ Protected Member Functions
finger0 = first finger, 1 = second finger. If omitted, then 0 will be used.
xyIdThe controller sends out three packets with the same structure. The third one will contain the last measure, but if you read from the controller then there is only be data in the first one. For that reason it will be set to 0 if the argument is omitted.
-

Returns whenever the user is toucing the touchpad.

-
Parameters
+

Returns whenever the user is toucing the touchpad.

Parameters
@@ -466,8 +462,7 @@ Protected Member Functions
finger0 = first finger, 1 = second finger. If omitted, then 0 will be used.
xyIdThe controller sends out three packets with the same structure. The third one will contain the last measure, but if you read from the controller then there is only be data in the first one. For that reason it will be set to 0 if the argument is omitted.
-

This counter increments every time a finger touches the touchpad.

-
Parameters
+

This counter increments every time a finger touches the touchpad.

Parameters
@@ -501,8 +496,7 @@ Protected Member Functions
finger0 = first finger, 1 = second finger. If omitted, then 0 will be used.
xyIdThe controller sends out three packets with the same structure. The third one will contain the last measure, but if you read from the controller then there is only be data in the first one. For that reason it will be set to 0 if the argument is omitted.
-

Get the angle of the controller calculated using the accelerometer.

-
Parameters
+

Get the angle of the controller calculated using the accelerometer.

Parameters
aEither Pitch or Roll.
@@ -535,8 +529,7 @@ Protected Member Functions
-

Used to get the raw values from the 3-axis gyroscope and 3-axis accelerometer inside the PS4 controller.

-
Parameters
+

Used to get the raw values from the 3-axis gyroscope and 3-axis accelerometer inside the PS4 controller.

Parameters
sThe sensor to read.
@@ -568,8 +561,7 @@ Protected Member Functions
-

Return the battery level of the PS4 controller.

-
Returns
The battery level in the range 0-15.
+

Return the battery level of the PS4 controller.

Returns
The battery level in the range 0-15.

Definition at line 250 of file PS4Parser.h.

@@ -595,8 +587,7 @@ 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.
+

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 258 of file PS4Parser.h.

@@ -622,8 +613,7 @@ 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.
+

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 266 of file PS4Parser.h.

@@ -649,8 +639,7 @@ Protected Member Functions
-

Use this to check if a microphone is connected to the PS4 controller.

-
Returns
Returns true if a microphone is connected.
+

Use this to check if a microphone is connected to the PS4 controller.

Returns
Returns true if a microphone is connected.

Definition at line 274 of file PS4Parser.h.

@@ -729,8 +718,7 @@ Protected Member Functions
-

Turn on rumble.

-
Parameters
+

Turn on rumble.

Parameters
modeEither RumbleHigh or RumbleLow.
@@ -772,8 +760,7 @@ Protected Member Functions
-

Turn on rumble.

-
Parameters
+

Turn on rumble.

Parameters
@@ -848,8 +835,7 @@ Protected Member Functions
bigRumbleValue for big motor.
smallRumbleValue for small motor.
-

Use this to set the color using RGB values.

-
Parameters
+

Use this to set the color using RGB values.

Parameters
r,g,bRGB value.
@@ -881,8 +867,7 @@ Protected Member Functions
-

Use this to set the color using the predefined colors in ColorsEnum.

-
Parameters
+

Use this to set the color using the predefined colors in ColorsEnum.

Parameters
colorThe desired color.
@@ -924,8 +909,7 @@ Protected Member Functions
-

Set the LEDs flash time.

-
Parameters
+

Set the LEDs flash time.

Parameters
@@ -968,8 +952,7 @@ Protected Member Functions
flashOnTime to flash bright (255 = 2.5 seconds).
flashOffTime to flash dark (255 = 2.5 seconds).
-

Used to parse data sent from the PS4 controller.

-
Parameters
+

Used to parse data sent from the PS4 controller.

Parameters
@@ -1028,8 +1011,7 @@ Protected Member Functions
lenLength of the data.
bufPointer to the data buffer.
-

Send the output to the PS4 controller. This is implemented in PS4BT.h and PS4USB.h.

-
Parameters
+

Send the output to the PS4 controller. This is implemented in PS4BT.h and PS4USB.h.

Parameters
outputPointer to PS4Output buffer;
@@ -1049,7 +1031,7 @@ Protected Member Functions diff --git a/class_p_s4_parser__inherit__graph.map b/class_p_s4_parser__inherit__graph.map index 04e73c20..5b3ff389 100644 --- a/class_p_s4_parser__inherit__graph.map +++ b/class_p_s4_parser__inherit__graph.map @@ -1,4 +1,4 @@ - + diff --git a/class_p_s4_parser__inherit__graph.md5 b/class_p_s4_parser__inherit__graph.md5 index 3664c5e9..7d6cd78a 100644 --- a/class_p_s4_parser__inherit__graph.md5 +++ b/class_p_s4_parser__inherit__graph.md5 @@ -1 +1 @@ -3640c7e8714d328b9cdd367ff0a243af \ No newline at end of file +b842fe07d690c9e08045bf8e0d96d45b \ 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 d77be108..76bde1ff 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 d3de14c0..8bea55cc 100644 --- a/class_p_s4_u_s_b-members.html +++ b/class_p_s4_u_s_b-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -165,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_p_s4_u_s_b.html b/class_p_s4_u_s_b.html index 3ecc7762..91fed20d 100644 --- a/class_p_s4_u_s_b.html +++ b/class_p_s4_u_s_b.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PS4USB Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,27 @@ Inheritance diagram for PS4USB:
Inheritance graph
- + + + + + +
[legend]
Collaboration diagram for PS4USB:
Collaboration graph
- + + + + + + + + +
[legend]

@@ -295,8 +309,7 @@ Additional Inherited Members

-

Constructor for the PS4USB class.

-
Parameters
+

Constructor for the PS4USB class.

Parameters
pPointer to the USB class instance.
@@ -328,8 +341,7 @@ Additional Inherited Members
-

Used to check if a PS4 controller is connected.

-
Returns
Returns true if it is connected.
+

Used to check if a PS4 controller is connected.

Returns
Returns true if it is connected.

Definition at line 47 of file PS4USB.h.

@@ -356,8 +368,7 @@ Additional Inherited Members
-

Used to call your own function when the device is successfully initialized.

-
Parameters
+

Used to call your own function when the device is successfully initialized.

Parameters
funcOnInitFunction to call.
@@ -411,8 +422,7 @@ Additional Inherited Members
-

Used to parse USB HID data.

-
Parameters
+

Used to parse USB HID data.

Parameters
@@ -477,8 +487,7 @@ Additional Inherited Members
hidPointer to the HID class.
is_rpt_idOnly used for Hubs.
-

Send the output to the PS4 controller. This is implemented in PS4BT.h and PS4USB.h.

-
Parameters
+

Send the output to the PS4 controller. This is implemented in PS4BT.h and PS4USB.h.

Parameters
outputPointer to PS4Output buffer;
@@ -522,8 +531,7 @@ Additional Inherited Members
-

Used by the USB core to check what this driver support.

-
Parameters
+

Used by the USB core to check what this driver support.

Parameters
@@ -546,7 +554,7 @@ Additional Inherited Members diff --git a/class_p_s4_u_s_b__coll__graph.map b/class_p_s4_u_s_b__coll__graph.map index 33493e46..e7c3c37e 100644 --- a/class_p_s4_u_s_b__coll__graph.map +++ b/class_p_s4_u_s_b__coll__graph.map @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + diff --git a/class_p_s4_u_s_b__coll__graph.md5 b/class_p_s4_u_s_b__coll__graph.md5 index 45eec9e0..31d2a590 100644 --- a/class_p_s4_u_s_b__coll__graph.md5 +++ b/class_p_s4_u_s_b__coll__graph.md5 @@ -1 +1 @@ -cba83f8ab42c9ce0150fe14cf09d4533 \ No newline at end of file +6510784396c1c05ff338806741b9ed6c \ 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 ad50e007..cfbf5f0e 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.map b/class_p_s4_u_s_b__inherit__graph.map index 1a3c6473..fb842e03 100644 --- a/class_p_s4_u_s_b__inherit__graph.map +++ b/class_p_s4_u_s_b__inherit__graph.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/class_p_s4_u_s_b__inherit__graph.md5 b/class_p_s4_u_s_b__inherit__graph.md5 index 15d56256..da6b8966 100644 --- a/class_p_s4_u_s_b__inherit__graph.md5 +++ b/class_p_s4_u_s_b__inherit__graph.md5 @@ -1 +1 @@ -25315e0b7172add06990f260c65e7e95 \ No newline at end of file +cb813f5f3004b0786d96c27613056cb9 \ 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 7d7f2a06..58495758 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 6b43add9..1c84c0fe 100644 --- a/class_p_s_buzz-members.html +++ b/class_p_s_buzz-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@
vidThe device's VID.
pidThe device's PID.
- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -148,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_p_s_buzz.html b/class_p_s_buzz.html index adef170d..bf19d377 100644 --- a/class_p_s_buzz.html +++ b/class_p_s_buzz.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PSBuzz Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,14 +99,25 @@ Inheritance diagram for PSBuzz:
Inheritance graph
- + + + + +
[legend]
Collaboration diagram for PSBuzz:
Collaboration graph
- + + + + + + + +
[legend]

@@ -260,8 +272,7 @@ Additional Inherited Members

-

Constructor for the PSBuzz class.

-
Parameters
+

Constructor for the PSBuzz class.

Parameters
pPointer to the USB class instance.
@@ -293,8 +304,7 @@ Additional Inherited Members
-

Used to check if a PS Buzz controller is connected.

-
Returns
Returns true if it is connected.
+

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.

@@ -321,8 +331,7 @@ Additional Inherited Members
-

Used to call your own function when the device is successfully initialized.

-
Parameters
+

Used to call your own function when the device is successfully initialized.

Parameters
funcOnInitFunction to call.
@@ -358,8 +367,7 @@ Additional Inherited Members

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
@@ -397,8 +405,7 @@ Additional Inherited Members

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
bButtonEnum to read.
controllerThe controller to read from. Default to 0.
@@ -434,8 +441,7 @@ Additional Inherited Members
bButtonEnum to read.
controllerThe controller to read from. Default to 0.
-

Set LED value without using LEDEnum.

-
Parameters
+

Set LED value without using LEDEnum.

Parameters
@@ -495,8 +501,7 @@ Additional Inherited Members
valueSee: LEDEnum. Set LED values directly.
valueUsed to set whenever the LED should be on or off
-

Turn the LED off on a specific controller.

-
Parameters
+

Turn the LED off on a specific controller.

Parameters
controllerThe controller to turn off. Defaults to 0.
@@ -554,8 +559,7 @@ Additional Inherited Members
-

Turn the LED on on a specific controller.

-
Parameters
+

Turn the LED on on a specific controller.

Parameters
controllerThe controller to turn off. Defaults to 0.
@@ -587,8 +591,7 @@ Additional Inherited Members
-

Toggle the LED on a specific controller.

-
Parameters
+

Toggle the LED on a specific controller.

Parameters
controllerThe controller to turn off. Defaults to 0.
@@ -642,8 +645,7 @@ Additional Inherited Members
-

Used to parse USB HID data.

-
Parameters
+

Used to parse USB HID data.

Parameters
@@ -744,8 +746,7 @@ Additional Inherited Members
hidPointer to the HID class.
is_rpt_idOnly used for Hubs.
-

Used by the USB core to check what this driver support.

-
Parameters
+

Used by the USB core to check what this driver support.

Parameters
@@ -769,7 +770,7 @@ Additional Inherited Members diff --git a/class_p_s_buzz__coll__graph.map b/class_p_s_buzz__coll__graph.map index 6a4c2e11..f195bd2c 100644 --- a/class_p_s_buzz__coll__graph.map +++ b/class_p_s_buzz__coll__graph.map @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + diff --git a/class_p_s_buzz__coll__graph.md5 b/class_p_s_buzz__coll__graph.md5 index a8e7946f..babb5e21 100644 --- a/class_p_s_buzz__coll__graph.md5 +++ b/class_p_s_buzz__coll__graph.md5 @@ -1 +1 @@ -1990f23158dc6c12f0fde0f9bcb72213 \ No newline at end of file +fea9ba05db96f5aefabee7a11c9c9f52 \ 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 73ef750a..788f51c9 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.map b/class_p_s_buzz__inherit__graph.map index b6779443..86a7f79c 100644 --- a/class_p_s_buzz__inherit__graph.map +++ b/class_p_s_buzz__inherit__graph.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/class_p_s_buzz__inherit__graph.md5 b/class_p_s_buzz__inherit__graph.md5 index 6907892a..f6913f03 100644 --- a/class_p_s_buzz__inherit__graph.md5 +++ b/class_p_s_buzz__inherit__graph.md5 @@ -1 +1 @@ -3bfe0bd89aeb71800737cc565a54b628 \ No newline at end of file +044341a0d1db5d69a79fcdf68e3f63aa \ 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 05db1e2f..35c3aa8d 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 ff6d8c73..20cd64dd 100644 --- a/class_p_t_p_list_parser-members.html +++ b/class_p_t_p_list_parser-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@
vidThe device's VID.
pidThe device's PID.
- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -101,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_p_t_p_list_parser.html b/class_p_t_p_list_parser.html index ee46d68d..28947f18 100644 --- a/class_p_t_p_list_parser.html +++ b/class_p_t_p_list_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: PTPListParser Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -107,12 +108,12 @@ Public Member Functions   void Initialize (const uint8_t len_size, const uint8_t val_size, MultiValueBuffer *const p, const uint8_t mode=modeArray)   -bool Parse (uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me=NULL) +bool Parse (uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me=NULL)  

Detailed Description

-

Definition at line 90 of file parsetools.h.

+

Definition at line 95 of file parsetools.h.

Member Enumeration Documentation

@@ -124,13 +125,13 @@ Public Member Functions
- -
Enumerator
modeArray  +
Enumerator
modeArray 
modeRange  +
modeRange 
-

Definition at line 93 of file parsetools.h.

+

Definition at line 98 of file parsetools.h.

@@ -156,7 +157,7 @@ Public Member Functions
-

Definition at line 116 of file parsetools.h.

+

Definition at line 121 of file parsetools.h.

@@ -205,7 +206,7 @@ Public Member Functions
-

Definition at line 127 of file parsetools.h.

+

Definition at line 132 of file parsetools.h.

@@ -228,7 +229,7 @@ Public Member Functions - PTP_ARRAY_EL_FUNC  + PTP_ARRAY_EL_FUNC  pf, @@ -258,7 +259,7 @@ Public Member Functions diff --git a/class_report_desc_parser-members.html b/class_report_desc_parser-members.html index 7ea994e2..84967627 100644 --- a/class_report_desc_parser-members.html +++ b/class_report_desc_parser-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -171,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); theBufferReportDescParserBaseprotected theSkipperReportDescParserBaseprotected totalSizeReportDescParserBaseprotected - UsagePageFunc typedefReportDescParserBase + UsagePageFunc typedefReportDescParserBase usagePageFunctionsReportDescParserBaseprotectedstatic usagePageTitles0ReportDescParserBasestatic usagePageTitles1ReportDescParserBasestatic @@ -184,7 +185,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_report_desc_parser.html b/class_report_desc_parser.html index 5cf4d900..57f1aed5 100644 --- a/class_report_desc_parser.html +++ b/class_report_desc_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: ReportDescParser Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -96,14 +97,21 @@ Inheritance diagram for ReportDescParser:
Inheritance graph
- + + +
[legend]
Collaboration diagram for ReportDescParser:
Collaboration graph
- + + + + + +
[legend]
enErrorBufferTooSmall } - - + + @@ -288,10 +296,10 @@ Additional Inherited Members - + - +

@@ -114,8 +122,8 @@ Additional Inherited Members

 
typedef void(* UsagePageFunc )(uint16_t usage)
 
typedef void(* UsagePageFunc) (uint16_t usage)
 
- Public Member Functions inherited from ReportDescParserBase
 ReportDescParserBase ()
 
 
uint16_t totalSize
 
UsagePageFunc pfUsage
UsagePageFunc pfUsage
 
- Static Protected Attributes inherited from ReportDescParserBase
static UsagePageFunc usagePageFunctions []
static UsagePageFunc usagePageFunctions []
 

Detailed Description

@@ -305,7 +313,7 @@ Additional Inherited Members diff --git a/class_report_desc_parser2-members.html b/class_report_desc_parser2-members.html index 8a846094..2f4844f5 100644 --- a/class_report_desc_parser2-members.html +++ b/class_report_desc_parser2-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -172,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); theBufferReportDescParserBaseprotected theSkipperReportDescParserBaseprotected totalSizeReportDescParserBaseprotected - UsagePageFunc typedefReportDescParserBase + UsagePageFunc typedefReportDescParserBase usagePageFunctionsReportDescParserBaseprotectedstatic usagePageTitles0ReportDescParserBasestatic usagePageTitles1ReportDescParserBasestatic @@ -185,7 +186,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_report_desc_parser2.html b/class_report_desc_parser2.html index 7d0cb156..b09d4fdf 100644 --- a/class_report_desc_parser2.html +++ b/class_report_desc_parser2.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: ReportDescParser2 Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,14 +99,21 @@ Inheritance diagram for ReportDescParser2:
Inheritance graph
- + + +
[legend]
Collaboration diagram for ReportDescParser2:
Collaboration graph
- + + + + + +
[legend]
enErrorBufferTooSmall } - - + + @@ -298,10 +306,10 @@ Additional Inherited Members - + - +

@@ -134,8 +142,8 @@ Additional Inherited Members

 
typedef void(* UsagePageFunc )(uint16_t usage)
 
typedef void(* UsagePageFunc) (uint16_t usage)
 
- Static Public Member Functions inherited from ReportDescParserBase
static void PrintGenericDesktopPageUsage (uint16_t usage)
 
 
uint16_t totalSize
 
UsagePageFunc pfUsage
UsagePageFunc pfUsage
 
- Static Protected Attributes inherited from ReportDescParserBase
static UsagePageFunc usagePageFunctions []
static UsagePageFunc usagePageFunctions []
 

Detailed Description

@@ -392,7 +400,7 @@ Additional Inherited Members diff --git a/class_report_desc_parser2__coll__graph.map b/class_report_desc_parser2__coll__graph.map index aa96289f..8f0cb1a5 100644 --- a/class_report_desc_parser2__coll__graph.map +++ b/class_report_desc_parser2__coll__graph.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/class_report_desc_parser2__coll__graph.md5 b/class_report_desc_parser2__coll__graph.md5 index d407d228..af9db977 100644 --- a/class_report_desc_parser2__coll__graph.md5 +++ b/class_report_desc_parser2__coll__graph.md5 @@ -1 +1 @@ -e88568f5fec50e92ab94f403c7de23cd \ No newline at end of file +27a80771267ed2f61d1a7277c51beb79 \ 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 978d49c6..9196dd1b 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.map b/class_report_desc_parser2__inherit__graph.map index 1d00cb79..77e43e20 100644 --- a/class_report_desc_parser2__inherit__graph.map +++ b/class_report_desc_parser2__inherit__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_report_desc_parser2__inherit__graph.md5 b/class_report_desc_parser2__inherit__graph.md5 index 2edb6da6..5a0ef029 100644 --- a/class_report_desc_parser2__inherit__graph.md5 +++ b/class_report_desc_parser2__inherit__graph.md5 @@ -1 +1 @@ -a90860eeadb8724d3f4a2fd3d74642dc \ No newline at end of file +28f3942ed411cf191d1a779af42e8bd4 \ 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 7ad2e268..d7a61232 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.map b/class_report_desc_parser__coll__graph.map index e2c1f312..a53f7c5b 100644 --- a/class_report_desc_parser__coll__graph.map +++ b/class_report_desc_parser__coll__graph.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/class_report_desc_parser__coll__graph.md5 b/class_report_desc_parser__coll__graph.md5 index 8bc859ff..60356562 100644 --- a/class_report_desc_parser__coll__graph.md5 +++ b/class_report_desc_parser__coll__graph.md5 @@ -1 +1 @@ -98068a7aa912a8da28e63e8afb9a1494 \ No newline at end of file +4eeff98c7d713241096fda58cb34b342 \ 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 5a35805a..71e7d2d8 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.map b/class_report_desc_parser__inherit__graph.map index a2706207..9f5e893c 100644 --- a/class_report_desc_parser__inherit__graph.map +++ b/class_report_desc_parser__inherit__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/class_report_desc_parser__inherit__graph.md5 b/class_report_desc_parser__inherit__graph.md5 index 643203cd..f89c23d6 100644 --- a/class_report_desc_parser__inherit__graph.md5 +++ b/class_report_desc_parser__inherit__graph.md5 @@ -1 +1 @@ -365ba2bc5b9634b96848151575c7bc86 \ No newline at end of file +d91197785a3b88c599def77d68a6ee2e \ 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 36469a09..06451a5d 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 7134efa6..65eb99e4 100644 --- a/class_report_desc_parser_base-members.html +++ b/class_report_desc_parser_base-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -171,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); theBufferReportDescParserBaseprotected theSkipperReportDescParserBaseprotected totalSizeReportDescParserBaseprotected - UsagePageFunc typedefReportDescParserBase + UsagePageFunc typedefReportDescParserBase usagePageFunctionsReportDescParserBaseprotectedstatic usagePageTitles0ReportDescParserBasestatic usagePageTitles1ReportDescParserBasestatic @@ -184,7 +185,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_report_desc_parser_base.html b/class_report_desc_parser_base.html index 41758c09..38370a9a 100644 --- a/class_report_desc_parser_base.html +++ b/class_report_desc_parser_base.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: ReportDescParserBase Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -104,14 +105,21 @@ Inheritance diagram for ReportDescParserBase:
Inheritance graph
- + + + +
[legend]
Collaboration diagram for ReportDescParserBase:
Collaboration graph
- + + + + +
[legend]
enErrorBufferTooSmall } - - + +

@@ -121,8 +129,8 @@ Public Types

 
typedef void(* UsagePageFunc )(uint16_t usage)
 
typedef void(* UsagePageFunc) (uint16_t usage)
 
@@ -307,24 +315,24 @@ Protected Attributes - +

Public Member Functions

 
uint16_t totalSize
 
UsagePageFunc pfUsage
UsagePageFunc pfUsage
 
- +

Static Protected Attributes

static UsagePageFunc usagePageFunctions []
static UsagePageFunc usagePageFunctions []
 

Detailed Description

Definition at line 22 of file hidescriptorparser.h.

Member Typedef Documentation

- +
- +
typedef void(* ReportDescParserBase::UsagePageFunc)(uint16_t usage)typedef void(* ReportDescParserBase::UsagePageFunc) (uint16_t usage)
@@ -344,11 +352,11 @@ Static Protected Attributes
- - -
Enumerator
enErrorSuccess  +
Enumerator
enErrorSuccess 
enErrorIncomplete  +
enErrorIncomplete 
enErrorBufferTooSmall  +
enErrorBufferTooSmall 
@@ -987,24 +995,7 @@ Static Protected Attributes
-Initial value: +Initial value:

Definition at line 46 of file hidescriptorparser.h.

@@ -1026,15 +1017,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - -
}
-
+Initial value:
= {
}

Definition at line 47 of file hidescriptorparser.h.

@@ -1056,18 +1039,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - -
-
}
-
+Initial value:
= {
}

Definition at line 48 of file hidescriptorparser.h.

@@ -1089,34 +1061,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 49 of file hidescriptorparser.h.

@@ -1138,29 +1083,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 50 of file hidescriptorparser.h.

@@ -1182,18 +1105,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 51 of file hidescriptorparser.h.

@@ -1215,17 +1127,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 52 of file hidescriptorparser.h.

@@ -1247,21 +1149,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 53 of file hidescriptorparser.h.

@@ -1283,15 +1171,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - -
}
-
+Initial value:
= {
}

Definition at line 54 of file hidescriptorparser.h.

@@ -1335,19 +1215,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 56 of file hidescriptorparser.h.

@@ -1369,11 +1237,7 @@ Static Protected Attributes
-Initial value:
= {
- - -
}
-
+Initial value:
= {
}

Definition at line 57 of file hidescriptorparser.h.

@@ -1395,13 +1259,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - -
}
-
+Initial value:
= {
}

Definition at line 58 of file hidescriptorparser.h.

@@ -1423,19 +1281,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 59 of file hidescriptorparser.h.

@@ -1457,29 +1303,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 60 of file hidescriptorparser.h.

@@ -1501,12 +1325,7 @@ Static Protected Attributes
-Initial value:
= {
- - - -
}
-
+Initial value:
= {
}

Definition at line 61 of file hidescriptorparser.h.

@@ -1528,34 +1347,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 62 of file hidescriptorparser.h.

@@ -1577,16 +1369,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 63 of file hidescriptorparser.h.

@@ -1630,16 +1413,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 65 of file hidescriptorparser.h.

@@ -1661,27 +1435,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 66 of file hidescriptorparser.h.

@@ -1703,13 +1457,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - -
}
-
+Initial value:
= {
}

Definition at line 67 of file hidescriptorparser.h.

@@ -1731,14 +1479,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - -
}
-
+Initial value:
= {
}

Definition at line 68 of file hidescriptorparser.h.

@@ -1760,24 +1501,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 69 of file hidescriptorparser.h.

@@ -1799,25 +1523,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 70 of file hidescriptorparser.h.

@@ -1839,15 +1545,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - -
}
-
+Initial value:
= {
}

Definition at line 71 of file hidescriptorparser.h.

@@ -1869,12 +1567,7 @@ Static Protected Attributes
-Initial value:
= {
- - - -
}
-
+Initial value:
= {
}

Definition at line 72 of file hidescriptorparser.h.

@@ -1896,17 +1589,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - -
-
}
-
+Initial value:
= {
}

Definition at line 73 of file hidescriptorparser.h.

@@ -1928,18 +1611,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 74 of file hidescriptorparser.h.

@@ -1961,16 +1633,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 75 of file hidescriptorparser.h.

@@ -2036,20 +1699,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 78 of file hidescriptorparser.h.

@@ -2071,15 +1721,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - -
}
-
+Initial value:
= {
}

Definition at line 79 of file hidescriptorparser.h.

@@ -2101,23 +1743,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 80 of file hidescriptorparser.h.

@@ -2139,15 +1765,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - -
}
-
+Initial value:
= {
}

Definition at line 81 of file hidescriptorparser.h.

@@ -2169,20 +1787,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 82 of file hidescriptorparser.h.

@@ -2204,14 +1809,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - -
}
-
+Initial value:
= {
}

Definition at line 83 of file hidescriptorparser.h.

@@ -2277,22 +1875,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 86 of file hidescriptorparser.h.

@@ -2314,13 +1897,7 @@ Static Protected Attributes
-Initial value:
= {
- - - -
-
}
-
+Initial value:
= {
}

Definition at line 87 of file hidescriptorparser.h.

@@ -2342,32 +1919,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 88 of file hidescriptorparser.h.

@@ -2389,11 +1941,7 @@ Static Protected Attributes
-Initial value:
= {
- - -
}
-
+Initial value:
= {
}

Definition at line 89 of file hidescriptorparser.h.

@@ -2437,30 +1985,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - - - - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 91 of file hidescriptorparser.h.

@@ -2482,17 +2007,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 92 of file hidescriptorparser.h.

@@ -2514,14 +2029,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - -
}
-
+Initial value:
= {
}

Definition at line 93 of file hidescriptorparser.h.

@@ -2543,11 +2051,7 @@ Static Protected Attributes
-Initial value:
= {
- - -
}
-
+Initial value:
= {
}

Definition at line 94 of file hidescriptorparser.h.

@@ -2569,19 +2073,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - - - - - -
}
-
+Initial value:
= {
}

Definition at line 95 of file hidescriptorparser.h.

@@ -2603,11 +2095,7 @@ Static Protected Attributes
-Initial value:
= {
- - -
}
-
+Initial value:
= {
}

Definition at line 96 of file hidescriptorparser.h.

@@ -2620,7 +2108,7 @@ Static Protected Attributes - +
ReportDescParserBase::UsagePageFunc ReportDescParserBase::usagePageFunctionsReportDescParserBase::UsagePageFunc ReportDescParserBase::usagePageFunctions
@@ -2629,25 +2117,7 @@ Static Protected Attributes
-Initial value:
= {
- - - - - - -
NULL,
- - - - - - -
NULL,
-
NULL,
-
NULL
-
}
-
+Initial value:
= {
NULL,
NULL,
NULL,
NULL
}

Definition at line 99 of file hidescriptorparser.h.

@@ -2880,7 +2350,7 @@ Static Protected Attributes - +
UsagePageFunc ReportDescParserBase::pfUsageUsagePageFunc ReportDescParserBase::pfUsage
@@ -2903,7 +2373,7 @@ Static Protected Attributes diff --git a/class_report_desc_parser_base__coll__graph.map b/class_report_desc_parser_base__coll__graph.map index 3da1e2fc..b2e067a7 100644 --- a/class_report_desc_parser_base__coll__graph.map +++ b/class_report_desc_parser_base__coll__graph.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/class_report_desc_parser_base__coll__graph.md5 b/class_report_desc_parser_base__coll__graph.md5 index 4ccc7df1..668df278 100644 --- a/class_report_desc_parser_base__coll__graph.md5 +++ b/class_report_desc_parser_base__coll__graph.md5 @@ -1 +1 @@ -3aaf77127ccb15eb053d63ecd209b92d \ No newline at end of file +b9d3bd37562883d7bba8b8814d6dc468 \ 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 b8eb41b1..6eea22d6 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.map b/class_report_desc_parser_base__inherit__graph.map index 16c8c751..5372b1fb 100644 --- a/class_report_desc_parser_base__inherit__graph.map +++ b/class_report_desc_parser_base__inherit__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/class_report_desc_parser_base__inherit__graph.md5 b/class_report_desc_parser_base__inherit__graph.md5 index f0e80d19..92049196 100644 --- a/class_report_desc_parser_base__inherit__graph.md5 +++ b/class_report_desc_parser_base__inherit__graph.md5 @@ -1 +1 @@ -0cd654ef024537560fb4e09bdd02d877 \ No newline at end of file +e17b83123517010d14d04955e7bfd25a \ 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 82a92684..4ceac2e4 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 5e31fd60..e4f89282 100644 --- a/class_s_p_p-members.html +++ b/class_s_p_p-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -106,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); operator bool()SPPinline pBtdBluetoothServiceprotected peek(void)SPP - pFuncOnInitBluetoothServiceprotected + pFuncOnInitBluetoothServiceprotected read(void)SPP Reset()SPPprotectedvirtual Run()SPPprotectedvirtual @@ -119,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_s_p_p.html b/class_s_p_p.html index 52d2fce4..4c649780 100644 --- a/class_s_p_p.html +++ b/class_s_p_p.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: SPP Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,14 +99,22 @@ Inheritance diagram for SPP:
Inheritance graph
- + +
[legend]
Collaboration diagram for SPP:
Collaboration graph
- + + + + + + + +
[legend]
- - + + @@ -206,8 +215,7 @@ Additional Inherited Members

@@ -161,8 +170,8 @@ Additional Inherited Members

bool checkHciHandle (uint8_t *buf, uint16_t handle)
 
- Protected Attributes inherited from BluetoothService
void(* pFuncOnInit )(void)
 
void(* pFuncOnInit )(void)
 
BTDpBtd
 
uint16_t hci_handle
-

Constructor for the SPP class.

-
Parameters
+

Constructor for the SPP class.

Parameters
@@ -269,8 +277,7 @@ Additional Inherited Members
pPointer to BTD class instance.
nameSet the name to BTD::btdName. If argument is omitted, then "Arduino" will be used.
-

Used to provide Boolean tests for the class.

-
Returns
Return true if SPP communication is connected.
+

Used to provide Boolean tests for the class.

Returns
Return true if SPP communication is connected.

Definition at line 80 of file SPP.h.

@@ -289,8 +296,7 @@ Additional Inherited Members
-

Get number of bytes waiting to be read.

-
Returns
Return the number of bytes ready to be read.
+

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.

@@ -336,8 +342,7 @@ 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.
+

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.

@@ -356,8 +361,7 @@ Additional Inherited Members
-

Used to read the buffer.

-
Returns
Return the byte. Will return -1 if no bytes are available.
+

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.

@@ -376,8 +380,7 @@ Additional Inherited Members
-

Writes the byte to send to a buffer. The message is send when either send() or after Usb.Task() is called.

-
Parameters
+

Writes the byte to send to a buffer. The message is send when either send() or after Usb.Task() is called.

Parameters
dataThe byte to write.
@@ -412,8 +415,7 @@ Additional Inherited Members
-

Writes the bytes to send to a buffer. The message is send when either send() or after Usb.Task() is called.

-
Parameters
+

Writes the bytes to send to a buffer. The message is send when either send() or after Usb.Task() is called.

Parameters
@@ -485,8 +487,7 @@ Additional Inherited Members
dataThe data array to send.
sizeSize of the data.
-

Used to pass acldata to the services.

-
Parameters
+

Used to pass acldata to the services.

Parameters
ACLDataIncoming acldata.
@@ -608,7 +609,7 @@ Additional Inherited Members diff --git a/class_s_p_p__coll__graph.map b/class_s_p_p__coll__graph.map index b28515dd..1a07ec6a 100644 --- a/class_s_p_p__coll__graph.map +++ b/class_s_p_p__coll__graph.map @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + diff --git a/class_s_p_p__coll__graph.md5 b/class_s_p_p__coll__graph.md5 index e502c303..7a218c80 100644 --- a/class_s_p_p__coll__graph.md5 +++ b/class_s_p_p__coll__graph.md5 @@ -1 +1 @@ -a1450c75115ffac08811bb784fe195ac \ No newline at end of file +cad9aa3d2819cbf714312820a38ed5ae \ 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 8800b61a..3184888a 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.map b/class_s_p_p__inherit__graph.map index cd7e2aa1..a070f5d4 100644 --- a/class_s_p_p__inherit__graph.map +++ b/class_s_p_p__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_s_p_p__inherit__graph.md5 b/class_s_p_p__inherit__graph.md5 index e973d10c..57b548e0 100644 --- a/class_s_p_p__inherit__graph.md5 +++ b/class_s_p_p__inherit__graph.md5 @@ -1 +1 @@ -ad43f67ad3955f71f35444c1f7c5f2b9 \ No newline at end of file +c60255fca3d4c819dfb05175121e3419 \ 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 7bf8e874..99ed458c 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 f1abf91e..f5815981 100644 --- a/class_s_pi-members.html +++ b/class_s_pi-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -96,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_s_pi.html b/class_s_pi.html index d185c1ba..d51635b5 100644 --- a/class_s_pi.html +++ b/class_s_pi.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: SPi< SPI_CLK, SPI_MOSI, SPI_MISO, SPI_SS > Class Template Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -99,7 +100,7 @@ Static Public Member Functions  

Detailed Description

-

template<typename SPI_CLK, typename SPI_MOSI, typename SPI_MISO, typename SPI_SS>
+

template<typename SPI_CLK, typename SPI_MOSI, typename SPI_MISO, typename SPI_SS>
class SPi< SPI_CLK, SPI_MOSI, SPI_MISO, SPI_SS >

@@ -140,7 +141,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 b7373427..c7f21334 100644 --- a/class_sink_parser-members.html +++ b/class_sink_parser-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages

+
@@ -98,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_sink_parser.html b/class_sink_parser.html index 342b79eb..81c5c344 100644 --- a/class_sink_parser.html +++ b/class_sink_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: SinkParser< BASE_CLASS, LEN_TYPE, OFFSET_TYPE > Class Template Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -117,7 +118,7 @@ Public Member Functions  

Detailed Description

-

template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
+

template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
class SinkParser< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >

@@ -230,7 +231,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 94441a8f..1a5a95f4 100644 --- a/class_sink_parser__coll__graph.md5 +++ b/class_sink_parser__coll__graph.md5 @@ -1 +1 @@ -3490c81dd23a588a195411cd35b073eb \ No newline at end of file +d02f7fd8d26a0375ade46df3226bf199 \ No newline at end of file diff --git a/class_sink_parser__coll__graph.png b/class_sink_parser__coll__graph.png index 9db25e6b..f51849ae 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 94441a8f..1a5a95f4 100644 --- a/class_sink_parser__inherit__graph.md5 +++ b/class_sink_parser__inherit__graph.md5 @@ -1 +1 @@ -3490c81dd23a588a195411cd35b073eb \ No newline at end of file +d02f7fd8d26a0375ade46df3226bf199 \ No newline at end of file diff --git a/class_sink_parser__inherit__graph.png b/class_sink_parser__inherit__graph.png index 9db25e6b..f51849ae 100644 Binary files a/class_sink_parser__inherit__graph.png and b/class_sink_parser__inherit__graph.png differ diff --git a/class_u_h_s2___g_p_i_o-members.html b/class_u_h_s2___g_p_i_o-members.html index 197e8e0b..cf87533a 100644 --- a/class_u_h_s2___g_p_i_o-members.html +++ b/class_u_h_s2___g_p_i_o-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0

- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -99,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_u_h_s2___g_p_i_o.html b/class_u_h_s2___g_p_i_o.html index e5dc6118..44d7cbe9 100644 --- a/class_u_h_s2___g_p_i_o.html +++ b/class_u_h_s2___g_p_i_o.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: UHS2_GPIO Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -96,16 +97,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

Public Member Functions

 UHS2_GPIO (USB *pUsb) - Implement an instance of a UHS2_GPIO object. More...
+ Implement an instance of a UHS2_GPIO object. More...
  void digitalWrite (uint8_t pin, uint8_t val) - Set a GPIO output value. More...
+ Set a GPIO output value. More...
  int digitalRead (uint8_t pin) - Read the value from a GPIO input pin. More...
+ Read the value from a GPIO input pin. More...
  int digitalReadOutput (uint8_t pin) - Read the value from a GPIO output pin. More...
+ Read the value from a GPIO output pin. More...
 

Detailed Description

@@ -250,7 +251,7 @@ Public Member Functions diff --git a/class_u_s_b-members.html b/class_u_s_b-members.html index 65869663..252d8aa0 100644 --- a/class_u_s_b-members.html +++ b/class_u_s_b-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -137,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_u_s_b.html b/class_u_s_b.html index 689019ae..d9e7b69a 100644 --- a/class_u_s_b.html +++ b/class_u_s_b.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: USB Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,16 @@ Inheritance diagram for USB:
Inheritance graph
- + +
[legend]
Collaboration diagram for USB:
Collaboration graph
- + +
[legend]
- + @@ -130,7 +133,7 @@ Public Member Functions - + @@ -176,10 +179,10 @@ Public Member Functions - + - + @@ -334,7 +337,7 @@ Public Member Functions - + @@ -1087,7 +1090,7 @@ Public Member Functions diff --git a/class_u_s_b__coll__graph.map b/class_u_s_b__coll__graph.map index 4b63da77..e0772ba6 100644 --- a/class_u_s_b__coll__graph.map +++ b/class_u_s_b__coll__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_u_s_b__coll__graph.md5 b/class_u_s_b__coll__graph.md5 index 7e9ee7c6..2b3a8617 100644 --- a/class_u_s_b__coll__graph.md5 +++ b/class_u_s_b__coll__graph.md5 @@ -1 +1 @@ -958d3d033294f8997a9a06c6fc924cb4 \ No newline at end of file +48f1f6d22e8ca875c8c73c2869a63fbd \ 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 f1524275..b64f8fc0 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.map b/class_u_s_b__inherit__graph.map index 4b63da77..e0772ba6 100644 --- a/class_u_s_b__inherit__graph.map +++ b/class_u_s_b__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_u_s_b__inherit__graph.md5 b/class_u_s_b__inherit__graph.md5 index 7e9ee7c6..2b3a8617 100644 --- a/class_u_s_b__inherit__graph.md5 +++ b/class_u_s_b__inherit__graph.md5 @@ -1 +1 @@ -958d3d033294f8997a9a06c6fc924cb4 \ No newline at end of file +48f1f6d22e8ca875c8c73c2869a63fbd \ 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 f1524275..b64f8fc0 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 38d3a721..a7627f28 100644 --- a/class_u_s_b_device_config-members.html +++ b/class_u_s_b_device_config-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -119,7 +122,7 @@ Public Member Functions

 
uint8_t RegisterDeviceClass (USBDeviceConfig *pdev)
 
void ForEachUsbDevice (UsbDeviceHandleFunc pfunc)
void ForEachUsbDevice (UsbDeviceHandleFunc pfunc)
 
uint8_t getUsbTaskState (void)
 
uint8_t setEpInfoEntry (uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
 
uint8_t getDevDescr (uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
 defined(USB_METHODS_INLINE) More...
 defined(USB_METHODS_INLINE) More...
 
uint8_t getConfDescr (uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
 
uint8_t * bytesRd (uint8_t reg, uint8_t nbytes, uint8_t *data_p)
 
uint8_t gpioRd ()
 Reads the current GPI input values. More...
 Reads the current GPI input values. More...
 
uint8_t gpioRdOutput ()
 Reads the current GPI output values. More...
 Reads the current GPI output values. More...
 
uint16_t reset ()
 
void USB::ForEachUsbDevice (UsbDeviceHandleFunc UsbDeviceHandleFunc  pfunc)
- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -104,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_u_s_b_device_config.html b/class_u_s_b_device_config.html index 36f38d28..be5460ba 100644 --- a/class_u_s_b_device_config.html +++ b/class_u_s_b_device_config.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: USBDeviceConfig Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,7 +98,27 @@ Inheritance diagram for USBDeviceConfig:
Inheritance graph
- + + + + + + + + + + + + + + + + + + + + +
[legend]
diff --git a/class_u_s_b_device_config__inherit__graph.map b/class_u_s_b_device_config__inherit__graph.map index 998c1098..775c2aa6 100644 --- a/class_u_s_b_device_config__inherit__graph.map +++ b/class_u_s_b_device_config__inherit__graph.map @@ -1,22 +1,22 @@ - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/class_u_s_b_device_config__inherit__graph.md5 b/class_u_s_b_device_config__inherit__graph.md5 index 29a31cc3..336e2e81 100644 --- a/class_u_s_b_device_config__inherit__graph.md5 +++ b/class_u_s_b_device_config__inherit__graph.md5 @@ -1 +1 @@ -3280a2ebb71f0bd5bed8ce5a1b6dbb14 \ No newline at end of file +fd915a8e1b72b3dd4dec81d6c1c419c0 \ 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 62c29c2a..255f7b9e 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 9973f63f..2d0ecd04 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,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -424,7 +445,7 @@ Public Member Functions

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -137,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); 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 aed255d8..a8c64f7b 100644 --- a/class_u_s_b_h___m_i_d_i.html +++ b/class_u_s_b_h___m_i_d_i.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: USBH_MIDI Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -100,14 +101,19 @@ Inheritance diagram for USBH_MIDI:
Inheritance graph
- + +
[legend]
Collaboration diagram for USBH_MIDI:
Collaboration graph
- + + + + +
[legend]
diff --git a/class_u_s_b_h___m_i_d_i__coll__graph.map b/class_u_s_b_h___m_i_d_i__coll__graph.map index 360aa69e..d89c496f 100644 --- a/class_u_s_b_h___m_i_d_i__coll__graph.map +++ b/class_u_s_b_h___m_i_d_i__coll__graph.map @@ -1,6 +1,6 @@ - - - - + + + + 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 65b58e95..9672b222 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 @@ -2b10003f5c57b927b786c124f8c44f19 \ No newline at end of file +25cb7fd7fbb45243f203aae31cb09034 \ 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 3ee2abed..52eb917a 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.map b/class_u_s_b_h___m_i_d_i__inherit__graph.map index a1374a41..490a48c9 100644 --- a/class_u_s_b_h___m_i_d_i__inherit__graph.map +++ b/class_u_s_b_h___m_i_d_i__inherit__graph.map @@ -1,3 +1,3 @@ - + 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 05aed325..3e6af39f 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 @@ -99e202ea033838e96ca94d5d12aaee82 \ No newline at end of file +040098623cab6b270fc5a8a159a31c5e \ 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 4c86103e..f27a71f3 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 8869ec2a..cfecbb96 100644 --- a/class_u_s_b_h_i_d-members.html +++ b/class_u_s_b_h_i_d-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -1134,7 +1140,7 @@ Static Protected Attributes

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -126,7 +127,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_u_s_b_h_i_d.html b/class_u_s_b_h_i_d.html index ac35a14f..c9c01f1f 100644 --- a/class_u_s_b_h_i_d.html +++ b/class_u_s_b_h_i_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: USBHID Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -100,14 +101,25 @@ Inheritance diagram for USBHID:
Inheritance graph
- + + + + + + + +
[legend]
Collaboration diagram for USBHID:
Collaboration graph
- + + + + +
[legend]
diff --git a/class_u_s_b_h_i_d__coll__graph.map b/class_u_s_b_h_i_d__coll__graph.map index 4d1618b4..e856d868 100644 --- a/class_u_s_b_h_i_d__coll__graph.map +++ b/class_u_s_b_h_i_d__coll__graph.map @@ -1,6 +1,6 @@ - - - - + + + + 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 285c8d6a..92be9460 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 @@ -767fb560f11b07b654dc68978e6c2cf1 \ No newline at end of file +cf485acf15d75bd6f1697dfca03233cb \ 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 adb4bbdc..a5eb0f3f 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.map b/class_u_s_b_h_i_d__inherit__graph.map index 45219d91..ee28546d 100644 --- a/class_u_s_b_h_i_d__inherit__graph.map +++ b/class_u_s_b_h_i_d__inherit__graph.map @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + 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 dac1f34a..1094a598 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 @@ -34ecb2ebf9e94987932320aed138a257 \ No newline at end of file +fd1ceed8df188748cafb6f9910104e67 \ 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 22ec8cfa..7bbcf2d5 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 6a8d347e..9c2d71ce 100644 --- a/class_u_s_b_hub-members.html +++ b/class_u_s_b_hub-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -812,7 +824,7 @@ Static Protected Attributes

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -114,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_u_s_b_hub.html b/class_u_s_b_hub.html index 02d38872..95d7890f 100644 --- a/class_u_s_b_hub.html +++ b/class_u_s_b_hub.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: USBHub Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,16 @@ Inheritance diagram for USBHub:
Inheritance graph
- + +
[legend]
Collaboration diagram for USBHub:
Collaboration graph
- + +
[legend]
diff --git a/class_u_s_b_hub__coll__graph.map b/class_u_s_b_hub__coll__graph.map index f805bc02..04f84c15 100644 --- a/class_u_s_b_hub__coll__graph.map +++ b/class_u_s_b_hub__coll__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_u_s_b_hub__coll__graph.md5 b/class_u_s_b_hub__coll__graph.md5 index b9529b44..5328fe8d 100644 --- a/class_u_s_b_hub__coll__graph.md5 +++ b/class_u_s_b_hub__coll__graph.md5 @@ -1 +1 @@ -829d383fdf38e9eac95bde2714eaf868 \ No newline at end of file +bf8ca3c3b9277566d37448eda78dfa47 \ 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 35e507e6..921bd62a 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.map b/class_u_s_b_hub__inherit__graph.map index f805bc02..04f84c15 100644 --- a/class_u_s_b_hub__inherit__graph.map +++ b/class_u_s_b_hub__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_u_s_b_hub__inherit__graph.md5 b/class_u_s_b_hub__inherit__graph.md5 index b9529b44..5328fe8d 100644 --- a/class_u_s_b_hub__inherit__graph.md5 +++ b/class_u_s_b_hub__inherit__graph.md5 @@ -1 +1 @@ -829d383fdf38e9eac95bde2714eaf868 \ No newline at end of file +bf8ca3c3b9277566d37448eda78dfa47 \ 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 35e507e6..921bd62a 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 a3799a11..5b07368b 100644 --- a/class_u_s_b_read_parser-members.html +++ b/class_u_s_b_read_parser-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -668,7 +671,7 @@ Public Member Functions

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -96,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_u_s_b_read_parser.html b/class_u_s_b_read_parser.html index 2447aa6e..0663dc83 100644 --- a/class_u_s_b_read_parser.html +++ b/class_u_s_b_read_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: USBReadParser Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,7 +98,11 @@ Inheritance diagram for USBReadParser:
Inheritance graph
- + + + + +
[legend]
diff --git a/class_u_s_b_read_parser__inherit__graph.map b/class_u_s_b_read_parser__inherit__graph.map index ff980704..aa62913b 100644 --- a/class_u_s_b_read_parser__inherit__graph.map +++ b/class_u_s_b_read_parser__inherit__graph.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/class_u_s_b_read_parser__inherit__graph.md5 b/class_u_s_b_read_parser__inherit__graph.md5 index 3e81e179..b9ca8675 100644 --- a/class_u_s_b_read_parser__inherit__graph.md5 +++ b/class_u_s_b_read_parser__inherit__graph.md5 @@ -1 +1 @@ -a4a6a1be4628303ad484eca83de7cecb \ No newline at end of file +ec3e429c5021a90ad76c1c993c8aa8bc \ 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 df420af1..6aec8228 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 b033beb5..f6dd7f79 100644 --- a/class_universal_report_parser-members.html +++ b/class_universal_report_parser-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -159,7 +164,7 @@ Public Member Functions

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -96,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_universal_report_parser.html b/class_universal_report_parser.html index 7965ef6f..e9d420e0 100644 --- a/class_universal_report_parser.html +++ b/class_universal_report_parser.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: UniversalReportParser Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,16 @@ Inheritance diagram for UniversalReportParser:
Inheritance graph
- + +
[legend]
Collaboration diagram for UniversalReportParser:
Collaboration graph
- + +
[legend]
diff --git a/class_universal_report_parser__coll__graph.map b/class_universal_report_parser__coll__graph.map index 4ebb20b6..c873c83a 100644 --- a/class_universal_report_parser__coll__graph.map +++ b/class_universal_report_parser__coll__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_universal_report_parser__coll__graph.md5 b/class_universal_report_parser__coll__graph.md5 index 84a58c13..18ce6809 100644 --- a/class_universal_report_parser__coll__graph.md5 +++ b/class_universal_report_parser__coll__graph.md5 @@ -1 +1 @@ -53ad9438e520f79d9514bd51ffe26f67 \ No newline at end of file +6ae2ae36eea0ce9a020916893890ce48 \ 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 4f9827b6..85f3c95a 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.map b/class_universal_report_parser__inherit__graph.map index 4ebb20b6..c873c83a 100644 --- a/class_universal_report_parser__inherit__graph.map +++ b/class_universal_report_parser__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_universal_report_parser__inherit__graph.md5 b/class_universal_report_parser__inherit__graph.md5 index 84a58c13..18ce6809 100644 --- a/class_universal_report_parser__inherit__graph.md5 +++ b/class_universal_report_parser__inherit__graph.md5 @@ -1 +1 @@ -53ad9438e520f79d9514bd51ffe26f67 \ No newline at end of file +6ae2ae36eea0ce9a020916893890ce48 \ 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 4f9827b6..85f3c95a 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 2000bf67..7d758e70 100644 --- a/class_usb_config_xtracter-members.html +++ b/class_usb_config_xtracter-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -175,7 +178,7 @@ Public Member Functions

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -96,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_usb_config_xtracter.html b/class_usb_config_xtracter.html index 4fc3d701..e5b786a4 100644 --- a/class_usb_config_xtracter.html +++ b/class_usb_config_xtracter.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: UsbConfigXtracter Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,7 +98,21 @@ Inheritance diagram for UsbConfigXtracter:
Inheritance graph
- + + + + + + + + + + + + + + +
[legend]
diff --git a/class_usb_config_xtracter__inherit__graph.map b/class_usb_config_xtracter__inherit__graph.map index 57c0b04e..a95fdf96 100644 --- a/class_usb_config_xtracter__inherit__graph.map +++ b/class_usb_config_xtracter__inherit__graph.map @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/class_usb_config_xtracter__inherit__graph.md5 b/class_usb_config_xtracter__inherit__graph.md5 index 2b5f463a..1d61e3cd 100644 --- a/class_usb_config_xtracter__inherit__graph.md5 +++ b/class_usb_config_xtracter__inherit__graph.md5 @@ -1 +1 @@ -699e6fd4f8e537ad0e6ab8402783f3d7 \ No newline at end of file +8b41492a27286a05ac2d4683d2b4d6c6 \ 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 3b1bdad6..7cb16ff6 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 72f37106..3bc3840c 100644 --- a/class_w_i_i-members.html +++ b/class_w_i_i-members.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@

@@ -173,7 +188,7 @@ Public Member Functions

- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -148,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onInit()WIIprotectedvirtual pair(void)WIIinline pBtdBluetoothServiceprotected - pFuncOnInitBluetoothServiceprotected + pFuncOnInitBluetoothServiceprotected pitchGyroScaleWII pitchGyroSpeedWII Reset()WIIprotectedvirtual @@ -176,7 +177,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_w_i_i.html b/class_w_i_i.html index de0536f1..9de683d6 100644 --- a/class_w_i_i.html +++ b/class_w_i_i.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: WII Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -98,14 +99,22 @@ Inheritance diagram for WII:
Inheritance graph
- + +
[legend]
Collaboration diagram for WII:
Collaboration graph
- + + + + + + + +
[legend]
- - + + @@ -327,8 +336,7 @@ Additional Inherited Members

@@ -287,8 +296,8 @@ Additional Inherited Members

bool checkHciHandle (uint8_t *buf, uint16_t handle)
 
- Protected Attributes inherited from BluetoothService
void(* pFuncOnInit )(void)
 
void(* pFuncOnInit )(void)
 
BTDpBtd
 
uint16_t hci_handle
-

Constructor for the WII class.

-
Parameters
+

Constructor for the WII class.

Parameters
@@ -384,8 +392,7 @@ Additional Inherited Members

getButtonPress(Button b) will return true as long as the button is held down.

While getButtonClick(Button b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).

Parameters
pPointer to BTD class instance.
pairSet this to true in order to pair with the Wiimote. If the argument is omitted then it won't pair with it. One can use PAIR to set it to true.
bButtonEnum to read.
@@ -412,8 +419,7 @@ Additional Inherited Members

getButtonPress(Button b) will return true as long as the button is held down.

While getButtonClick(Button b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).

Parameters
bButtonEnum to read.
@@ -465,8 +471,7 @@ Additional Inherited Members
-

Used to read the joystick of the Nunchuck.

-
Parameters
+

Used to read the joystick of the Nunchuck.

Parameters
aEither HatX or HatY.
@@ -491,8 +496,7 @@ Additional Inherited Members
-

Used to read the joystick of the Wii U Pro Controller.

-
Parameters
+

Used to read the joystick of the Wii U Pro Controller.

Parameters
aEither LeftHatX, LeftHatY, RightHatX or RightHatY.
@@ -524,8 +528,7 @@ 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.
+

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.

@@ -551,8 +554,7 @@ 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.
+

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.

@@ -579,8 +581,7 @@ 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.
+

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.

@@ -671,8 +672,7 @@ Additional Inherited Members
-

Set LED value without using the LEDEnum.

-
Parameters
+

Set LED value without using the LEDEnum.

Parameters
valueSee: LEDEnum.
@@ -722,8 +722,7 @@ Additional Inherited Members
-

Turn the specific LEDEnum off.

-
Parameters
+

Turn the specific LEDEnum off.

Parameters
aThe LEDEnum to turn off.
@@ -747,8 +746,7 @@ Additional Inherited Members
-

Turn the specific LEDEnum on.

-
Parameters
+

Turn the specific LEDEnum on.

Parameters
aThe LEDEnum to turn on.
@@ -772,8 +770,7 @@ Additional Inherited Members
-

Toggle the specific LEDEnum.

-
Parameters
+

Toggle the specific LEDEnum.

Parameters
aThe LEDEnum to toggle.
@@ -815,8 +812,7 @@ Additional Inherited Members
-

Return the battery level of the Wiimote.

-
Returns
The battery level in the range 0-255.
+

Return the battery level of the Wiimote.

Returns
The battery level in the range 0-255.

Definition at line 968 of file Wii.cpp.

@@ -842,8 +838,7 @@ Additional Inherited Members
-

Return the Wiimote state.

-
Returns
See: http://wiibrew.org/wiki/Wiimote#0x20:_Status.
+

Return the Wiimote state.

Returns
See: http://wiibrew.org/wiki/Wiimote#0x20:_Status.

Definition at line 189 of file Wii.h.

@@ -966,8 +961,7 @@ Additional Inherited Members
-

Used to get the weight at the specific position on the Wii Balance Board.

-
Parameters
+

Used to get the weight at the specific position on the Wii Balance Board.

Parameters
posBalanceBoardEnum to read from.
@@ -991,8 +985,7 @@ Additional Inherited Members
-

Used to get total weight on the Wii Balance Board.

-
Returns
Returns the weight in kg.
+

Used to get total weight on the Wii Balance Board.

Returns
Returns the weight in kg.

Definition at line 1163 of file Wii.cpp.

@@ -1019,8 +1012,7 @@ Additional Inherited Members
-

Used to get the raw reading at the specific position on the Wii Balance Board.

-
Parameters
+

Used to get the raw reading at the specific position on the Wii Balance Board.

Parameters
posBalanceBoardEnum to read from.
@@ -1070,8 +1062,7 @@ 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.
+

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.

@@ -1097,8 +1088,7 @@ 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.
+

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.

@@ -1124,8 +1114,7 @@ Additional Inherited Members
-

IR object 1 size read from the Wii IR camera.

-
Returns
The size of the object in the range 0-15.
+

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.

@@ -1151,8 +1140,7 @@ 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.
+

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.

@@ -1178,8 +1166,7 @@ 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.
+

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.

@@ -1205,8 +1192,7 @@ Additional Inherited Members
-

IR object 2 size read from the Wii IR camera.

-
Returns
The size of the object in the range 0-15.
+

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.

@@ -1232,8 +1218,7 @@ 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.
+

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.

@@ -1259,8 +1244,7 @@ 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.
+

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.

@@ -1286,8 +1270,7 @@ Additional Inherited Members
-

IR object 3 size read from the Wii IR camera.

-
Returns
The size of the object in the range 0-15.
+

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.

@@ -1313,8 +1296,7 @@ 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.
+

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.

@@ -1340,8 +1322,7 @@ 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.
+

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.

@@ -1367,8 +1348,7 @@ Additional Inherited Members
-

IR object 4 size read from the Wii IR camera.

-
Returns
The size of the object in the range 0-15.
+

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.

@@ -1394,8 +1374,7 @@ 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.
+

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.

@@ -1422,8 +1401,7 @@ Additional Inherited Members
-

Used to pass acldata to the services.

-
Parameters
+

Used to pass acldata to the services.

Parameters
ACLDataIncoming acldata.
@@ -1920,7 +1898,7 @@ Additional Inherited Members diff --git a/class_w_i_i__coll__graph.map b/class_w_i_i__coll__graph.map index 3ea08067..d3abf026 100644 --- a/class_w_i_i__coll__graph.map +++ b/class_w_i_i__coll__graph.map @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + diff --git a/class_w_i_i__coll__graph.md5 b/class_w_i_i__coll__graph.md5 index ba3e4081..32ea2769 100644 --- a/class_w_i_i__coll__graph.md5 +++ b/class_w_i_i__coll__graph.md5 @@ -1 +1 @@ -1b7a2243a1298a76ff060f7fa6c3bddf \ No newline at end of file +e2fa40aab171687d763b41a969505c68 \ 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 49cffc9b..6928eefc 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.map b/class_w_i_i__inherit__graph.map index baab75bc..95a09884 100644 --- a/class_w_i_i__inherit__graph.map +++ b/class_w_i_i__inherit__graph.map @@ -1,3 +1,3 @@ - + diff --git a/class_w_i_i__inherit__graph.md5 b/class_w_i_i__inherit__graph.md5 index 082665f3..6b41428e 100644 --- a/class_w_i_i__inherit__graph.md5 +++ b/class_w_i_i__inherit__graph.md5 @@ -1 +1 @@ -274c2668d752a02d95ef3bcfd0e20596 \ No newline at end of file +0f2ab569d0b7006cfff8d64fe9f9fda1 \ 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 5c0b4aa1..5f2cbe2d 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 749880b7..d04599e4 100644 --- a/class_x_b_o_x_o_l_d-members.html +++ b/class_x_b_o_x_o_l_d-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -116,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_x_b_o_x_o_l_d.html b/class_x_b_o_x_o_l_d.html index 47a0113d..92761fa1 100644 --- a/class_x_b_o_x_o_l_d.html +++ b/class_x_b_o_x_o_l_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXOLD Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -99,14 +100,19 @@ Inheritance diagram for XBOXOLD:
Inheritance graph
- + +
[legend]
Collaboration diagram for XBOXOLD:
Collaboration graph
- + + + + +
[legend]

@@ -181,8 +187,7 @@ Protected Attributes

-

Constructor for the XBOXOLD class.

-
Parameters
+

Constructor for the XBOXOLD class.

Parameters
pUsbPointer to USB class instance.
@@ -231,8 +236,7 @@ Protected Attributes
-

Initialize the Xbox Controller.

-
Parameters
+

Initialize the Xbox Controller.

Parameters
@@ -268,8 +272,7 @@ Protected Attributes
parentHub number.
portPort number on the hub.
-

Release the USB device.

-
Returns
0 on success.
+

Release the USB device.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -297,8 +300,7 @@ Protected Attributes
-

Poll the USB Input endpoins and run the state machines.

-
Returns
0 on success.
+

Poll the USB Input endpoins and run the state machines.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -326,8 +328,7 @@ Protected Attributes
-

Get the device address.

-
Returns
The device address.
+

Get the device address.

Returns
The device address.

Reimplemented from USBDeviceConfig.

@@ -355,8 +356,7 @@ Protected Attributes
-

Used to check if the controller has been initialized.

-
Returns
True if it's ready.
+

Used to check if the controller has been initialized.

Returns
True if it's ready.

Definition at line 86 of file XBOXOLD.h.

@@ -393,8 +393,7 @@ Protected Attributes
-

Used by the USB core to check what this driver support.

-
Parameters
+

Used by the USB core to check what this driver support.

Parameters
@@ -424,8 +423,7 @@ Protected Attributes

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
vidThe device's VID.
pidThe device's PID.
bButtonEnum to read.
@@ -452,8 +450,7 @@ Protected Attributes

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
bButtonEnum to read.
@@ -478,8 +475,7 @@ Protected Attributes
-

Return the analog value from the joysticks on the controller.

-
Parameters
+

Return the analog value from the joysticks on the controller.

Parameters
aEither LeftHatX, LeftHatY, RightHatX or RightHatY.
@@ -540,8 +536,7 @@ Protected Attributes
-

Turn rumble on.

-
Parameters
+

Turn rumble on.

Parameters
@@ -574,8 +569,7 @@ Protected Attributes
lValueLeft motor (big weight) inside the controller.
rValueRight motor (small weight) inside the controller.
-

Used to call your own function when the controller is successfully initialized.

-
Parameters
+

Used to call your own function when the controller is successfully initialized.

Parameters
funcOnInitFunction to call.
@@ -680,7 +674,7 @@ Protected Attributes diff --git a/class_x_b_o_x_o_l_d__coll__graph.map b/class_x_b_o_x_o_l_d__coll__graph.map index a3decc59..d42fe55d 100644 --- a/class_x_b_o_x_o_l_d__coll__graph.map +++ b/class_x_b_o_x_o_l_d__coll__graph.map @@ -1,6 +1,6 @@ - - - - + + + + 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 080b0529..c02a188a 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 @@ -c19d30d5e649c9f2f16f4d7e601bbf7f \ No newline at end of file +3285ca35607fc26fc3c6347499cd29e6 \ 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 52ef466f..e1f1ed8b 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.map b/class_x_b_o_x_o_l_d__inherit__graph.map index 0a6c6876..aadd3be4 100644 --- a/class_x_b_o_x_o_l_d__inherit__graph.map +++ b/class_x_b_o_x_o_l_d__inherit__graph.map @@ -1,3 +1,3 @@ - + 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 037a1214..73dafbc3 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 @@ -98da7f9bfeb2fdd99a2d7ac6d8b06832 \ No newline at end of file +1eeb2bcd708d5b17ef18f534c5633a29 \ 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 c002bacc..3a601a30 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 cb872e21..96c22c5e 100644 --- a/class_x_b_o_x_o_n_e-members.html +++ b/class_x_b_o_x_o_n_e-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -122,7 +123,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 39e29ae9..29d09fce 100644 --- a/class_x_b_o_x_o_n_e.html +++ b/class_x_b_o_x_o_n_e.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXONE Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -100,14 +101,21 @@ Inheritance diagram for XBOXONE:
Inheritance graph
- + + +
[legend]
Collaboration diagram for XBOXONE:
Collaboration graph
- + + + + + +
[legend]

@@ -198,8 +206,7 @@ Protected Attributes

-

Constructor for the XBOXONE class.

-
Parameters
+

Constructor for the XBOXONE class.

Parameters
pUsbPointer to USB class instance.
@@ -248,8 +255,7 @@ Protected Attributes
-

Initialize the Xbox Controller.

-
Parameters
+

Initialize the Xbox Controller.

Parameters
@@ -285,8 +291,7 @@ Protected Attributes
parentHub number.
portPort number on the hub.
-

Release the USB device.

-
Returns
0 on success.
+

Release the USB device.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -314,8 +319,7 @@ Protected Attributes
-

Poll the USB Input endpoins and run the state machines.

-
Returns
0 on success.
+

Poll the USB Input endpoins and run the state machines.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -343,8 +347,7 @@ Protected Attributes
-

Get the device address.

-
Returns
The device address.
+

Get the device address.

Returns
The device address.

Reimplemented from USBDeviceConfig.

@@ -372,8 +375,7 @@ Protected Attributes
-

Used to check if the controller has been initialized.

-
Returns
True if it's ready.
+

Used to check if the controller has been initialized.

Returns
True if it's ready.

Definition at line 106 of file XBOXONE.h.

@@ -399,8 +401,7 @@ Protected Attributes
-

Read the poll interval taken from the endpoint descriptors.

-
Returns
The poll interval in ms.
+

Read the poll interval taken from the endpoint descriptors.

Returns
The poll interval in ms.

Definition at line 114 of file XBOXONE.h.

@@ -437,8 +438,7 @@ Protected Attributes
-

Used by the USB core to check what this driver support.

-
Parameters
+

Used by the USB core to check what this driver support.

Parameters
@@ -468,8 +468,7 @@ Protected Attributes

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
vidThe device's VID.
pidThe device's PID.
bButtonEnum to read.
@@ -496,8 +495,7 @@ Protected Attributes

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
bButtonEnum to read.
@@ -522,8 +520,7 @@ Protected Attributes
-

Return the analog value from the joysticks on the controller.

-
Parameters
+

Return the analog value from the joysticks on the controller.

Parameters
aEither LeftHatX, LeftHatY, RightHatX or RightHatY.
@@ -556,8 +553,7 @@ Protected Attributes
-

Used to call your own function when the controller is successfully initialized.

-
Parameters
+

Used to call your own function when the controller is successfully initialized.

Parameters
funcOnInitFunction to call.
@@ -621,8 +617,7 @@ Protected Attributes
-

Used to turn on rumble continuously.

-
Parameters
+

Used to turn on rumble continuously.

Parameters
@@ -685,8 +680,7 @@ Protected Attributes
leftTriggerLeft trigger force.
rightTriggerRight trigger force.
-

UsbConfigXtracter implementation, used to extract endpoint information.

-
Parameters
+

UsbConfigXtracter implementation, used to extract endpoint information.

Parameters
@@ -724,8 +718,7 @@ Protected Attributes
confConfiguration value.
ifaceInterface number.
-

Used to print the USB Endpoint Descriptor.

-
Parameters
+

Used to print the USB Endpoint Descriptor.

Parameters
ep_ptrPointer to USB Endpoint Descriptor.
@@ -899,7 +892,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 07c04fec..81ce6aa5 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,7 +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 4e46bb6d..d3362d25 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 @@ -3ff30ab51b384a684db22c90c649e6d7 \ No newline at end of file +ab6103dfda6af6e334c7e58ac7721ece \ 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 3fb98f13..e7222c5b 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 9a89ecb8..44cd7708 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,4 +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 7731d309..5e155b32 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 @@ -f97bd0ce30f14001d202618b7e6da6e4 \ No newline at end of file +d14ff9b240aab210984df810f6df378d \ 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 3f418d5e..36068495 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 2d31cb42..8204172e 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,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -126,7 +127,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_x_b_o_x_r_e_c_v.html b/class_x_b_o_x_r_e_c_v.html index de0b7c44..0e339a17 100644 --- a/class_x_b_o_x_r_e_c_v.html +++ b/class_x_b_o_x_r_e_c_v.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXRECV Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -99,14 +100,19 @@ Inheritance diagram for XBOXRECV:
Inheritance graph
- + +
[legend]
Collaboration diagram for XBOXRECV:
Collaboration graph
- + + + + +
[legend]

@@ -202,8 +208,7 @@ Protected Attributes

-

Constructor for the XBOXRECV class.

-
Parameters
+

Constructor for the XBOXRECV class.

Parameters
pUsbPointer to USB class instance.
@@ -252,8 +257,7 @@ Protected Attributes
-

Address assignment and basic initilization is done here.

-
Parameters
+

Address assignment and basic initilization is done here.

Parameters
@@ -306,8 +310,7 @@ Protected Attributes
parentHub number.
portPort number on the hub.
-

Initialize the Xbox wireless receiver.

-
Parameters
+

Initialize the Xbox wireless receiver.

Parameters
@@ -343,8 +346,7 @@ Protected Attributes
parentHub number.
portPort number on the hub.
-

Release the USB device.

-
Returns
0 on success.
+

Release the USB device.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -372,8 +374,7 @@ Protected Attributes
-

Poll the USB Input endpoins and run the state machines.

-
Returns
0 on success.
+

Poll the USB Input endpoins and run the state machines.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -401,8 +402,7 @@ Protected Attributes
-

Get the device address.

-
Returns
The device address.
+

Get the device address.

Returns
The device address.

Reimplemented from USBDeviceConfig.

@@ -430,8 +430,7 @@ Protected Attributes
-

Used to check if the controller has been initialized.

-
Returns
True if it's ready.
+

Used to check if the controller has been initialized.

Returns
True if it's ready.

Definition at line 103 of file XBOXRECV.h.

@@ -468,8 +467,7 @@ Protected Attributes
-

Used by the USB core to check what this driver support.

-
Parameters
+

Used by the USB core to check what this driver support.

Parameters
@@ -509,8 +507,7 @@ Protected Attributes

getButtonPress(uint8_t controller, ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(uint8_t controller, ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(uint8_t controller, ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(uint8_t controller, ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(uint8_t controller, ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(uint8_t controller, ButtonEnum b).

Parameters
vidThe device's VID.
pidThe device's PID.
@@ -548,8 +545,7 @@ Protected Attributes

getButtonPress(uint8_t controller, ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(uint8_t controller, ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(uint8_t controller, ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(uint8_t controller, ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(uint8_t controller, ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(uint8_t controller, ButtonEnum b).

Parameters
bButtonEnum to read.
controllerThe controller to read from. Default to 0.
@@ -585,8 +581,7 @@ Protected Attributes
bButtonEnum to read.
controllerThe controller to read from. Default to 0.
-

Return the analog value from the joysticks on the controller.

-
Parameters
+

Return the analog value from the joysticks on the controller.

Parameters
@@ -612,8 +607,7 @@ Protected Attributes
aEither LeftHatX, LeftHatY, RightHatX or RightHatY.
controllerThe controller to read from. Default to 0.
-

Used to disconnect any of the controllers.

-
Parameters
+

Used to disconnect any of the controllers.

Parameters
controllerThe controller to disconnect. Default to 0.
@@ -645,8 +639,7 @@ Protected Attributes
-

Turn rumble off and all the LEDs on the specific controller.

-
Parameters
+

Turn rumble off and all the LEDs on the specific controller.

Parameters
controllerThe controller to write to. Default to 0.
@@ -678,8 +671,7 @@ Protected Attributes
-

Turn rumble off the specific controller.

-
Parameters
+

Turn rumble off the specific controller.

Parameters
controllerThe controller to write to. Default to 0.
@@ -719,8 +711,7 @@ Protected Attributes
-

Turn rumble on.

-
Parameters
+

Turn rumble on.

Parameters
@@ -756,8 +747,7 @@ Protected Attributes
lValueLeft motor (big weight) inside the controller.
rValueRight motor (small weight) inside the controller.
-

Set LED value. Without using the LEDEnum or LEDModeEnum.

-
Parameters
+

Set LED value. Without using the LEDEnum or LEDModeEnum.

Parameters
@@ -790,8 +780,7 @@ Protected Attributes
valueSee: setLedOff(uint8_t controller), setLedOn(uint8_t controller, LED l), setLedBlink(uint8_t controller, LED l), and setLedMode(uint8_t controller, LEDMode lm).
controllerThe controller to write to. Default to 0.
-

Turn all LEDs off the specific controller.

-
Parameters
+

Turn all LEDs off the specific controller.

Parameters
controllerThe controller to write to. Default to 0.
@@ -825,8 +814,7 @@ Protected Attributes
-

Turn on a LED by using LEDEnum.

-
Parameters
+

Turn on a LED by using LEDEnum.

Parameters
@@ -861,8 +849,7 @@ Protected Attributes
lOFF, LED1, LED2, LED3 and LED4 is supported by the Xbox controller.
controllerThe controller to write to. Default to 0.
-

Turn on a LED by using LEDEnum.

-
Parameters
+

Turn on a LED by using LEDEnum.

Parameters
@@ -897,8 +884,7 @@ Protected Attributes
lALL, LED1, LED2, LED3 and LED4 is supported by the Xbox controller.
controllerThe controller to write to. Default to 0.
-

Used to set special LED modes supported by the Xbox controller.

-
Parameters
+

Used to set special LED modes supported by the Xbox controller.

Parameters
@@ -923,8 +909,7 @@ Protected Attributes
lmSee LEDModeEnum.
controllerThe controller to write to. Default to 0.
-

Used to get the battery level from the controller.

-
Parameters
+

Used to get the battery level from the controller.

Parameters
controllerThe controller to read from. Default to 0.
@@ -949,8 +934,7 @@ Protected Attributes
-

Used to check if a button has changed.

-
Parameters
+

Used to check if a button has changed.

Parameters
controllerThe controller to read from. Default to 0.
@@ -983,8 +967,7 @@ Protected Attributes
-

Used to call your own function when the controller is successfully initialized.

-
Parameters
+

Used to call your own function when the controller is successfully initialized.

Parameters
funcOnInitFunction to call.
@@ -1104,7 +1087,7 @@ Protected Attributes diff --git a/class_x_b_o_x_r_e_c_v__coll__graph.map b/class_x_b_o_x_r_e_c_v__coll__graph.map index ada3f9e4..4f9b5ac7 100644 --- a/class_x_b_o_x_r_e_c_v__coll__graph.map +++ b/class_x_b_o_x_r_e_c_v__coll__graph.map @@ -1,6 +1,6 @@ - - - - + + + + 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 eca497ab..bb538112 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 @@ -ed9aab39c26cf617dcffaf5cd6075f83 \ No newline at end of file +2d7f0ed5a487b4ea4ec343e72841b2c4 \ 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 49cb01d1..dcada608 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.map b/class_x_b_o_x_r_e_c_v__inherit__graph.map index a22e3395..21b8422b 100644 --- a/class_x_b_o_x_r_e_c_v__inherit__graph.map +++ b/class_x_b_o_x_r_e_c_v__inherit__graph.map @@ -1,3 +1,3 @@ - + 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 9c40d748..b6ad7df6 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 @@ -65afe7bd4794abb7f38cbc4be13ce865 \ No newline at end of file +f7208ed6bda886c3efbb05f7e1cbd52d \ 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 05270098..71d28ecd 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 73b2718f..ff22878d 100644 --- a/class_x_b_o_x_u_s_b-members.html +++ b/class_x_b_o_x_u_s_b-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -122,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_x_b_o_x_u_s_b.html b/class_x_b_o_x_u_s_b.html index add28585..48a4ac5f 100644 --- a/class_x_b_o_x_u_s_b.html +++ b/class_x_b_o_x_u_s_b.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XBOXUSB Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -99,14 +100,19 @@ Inheritance diagram for XBOXUSB:
Inheritance graph
- + +
[legend]
Collaboration diagram for XBOXUSB:
Collaboration graph
- + + + + +
[legend]

@@ -193,8 +199,7 @@ Protected Attributes

-

Constructor for the XBOXUSB class.

-
Parameters
+

Constructor for the XBOXUSB class.

Parameters
pUsbPointer to USB class instance.
@@ -243,8 +248,7 @@ Protected Attributes
-

Initialize the Xbox Controller.

-
Parameters
+

Initialize the Xbox Controller.

Parameters
@@ -280,8 +284,7 @@ Protected Attributes
parentHub number.
portPort number on the hub.
-

Release the USB device.

-
Returns
0 on success.
+

Release the USB device.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -309,8 +312,7 @@ Protected Attributes
-

Poll the USB Input endpoins and run the state machines.

-
Returns
0 on success.
+

Poll the USB Input endpoins and run the state machines.

Returns
0 on success.

Reimplemented from USBDeviceConfig.

@@ -338,8 +340,7 @@ Protected Attributes
-

Get the device address.

-
Returns
The device address.
+

Get the device address.

Returns
The device address.

Reimplemented from USBDeviceConfig.

@@ -367,8 +368,7 @@ Protected Attributes
-

Used to check if the controller has been initialized.

-
Returns
True if it's ready.
+

Used to check if the controller has been initialized.

Returns
True if it's ready.

Definition at line 93 of file XBOXUSB.h.

@@ -405,8 +405,7 @@ Protected Attributes
-

Used by the USB core to check what this driver support.

-
Parameters
+

Used by the USB core to check what this driver support.

Parameters
@@ -436,8 +435,7 @@ Protected Attributes

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
vidThe device's VID.
pidThe device's PID.
bButtonEnum to read.
@@ -464,8 +462,7 @@ Protected Attributes

getButtonPress(ButtonEnum b) will return true as long as the button is held down.

While getButtonClick(ButtonEnum b) will only return it once.

-

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

-
Parameters
+

So you instance if you need to increase a variable once you would use getButtonClick(ButtonEnum b), but if you need to drive a robot forward you would use getButtonPress(ButtonEnum b).

Parameters
bButtonEnum to read.
@@ -490,8 +487,7 @@ Protected Attributes
-

Return the analog value from the joysticks on the controller.

-
Parameters
+

Return the analog value from the joysticks on the controller.

Parameters
aEither LeftHatX, LeftHatY, RightHatX or RightHatY.
@@ -578,8 +574,7 @@ Protected Attributes
-

Turn rumble on.

-
Parameters
+

Turn rumble on.

Parameters
@@ -604,8 +599,7 @@ Protected Attributes
lValueLeft motor (big weight) inside the controller.
rValueRight motor (small weight) inside the controller.
-

Set LED value. Without using the LEDEnum or LEDModeEnum.

-
Parameters
+

Set LED value. Without using the LEDEnum or LEDModeEnum.

Parameters
valueSee: setLedOff(), setLedOn(LEDEnum l), setLedBlink(LEDEnum l), and setLedMode(LEDModeEnum lm).
@@ -655,8 +649,7 @@ Protected Attributes
-

Turn on a LED by using LEDEnum.

-
Parameters
+

Turn on a LED by using LEDEnum.

Parameters
lOFF, LED1, LED2, LED3 and LED4 is supported by the Xbox controller.
@@ -680,8 +673,7 @@ Protected Attributes
-

Turn on a LED by using LEDEnum.

-
Parameters
+

Turn on a LED by using LEDEnum.

Parameters
lALL, LED1, LED2, LED3 and LED4 is supported by the Xbox controller.
@@ -705,8 +697,7 @@ Protected Attributes
-

Used to set special LED modes supported by the Xbox controller.

-
Parameters
+

Used to set special LED modes supported by the Xbox controller.

Parameters
lmSee LEDModeEnum.
@@ -738,8 +729,7 @@ Protected Attributes
-

Used to call your own function when the controller is successfully initialized.

-
Parameters
+

Used to call your own function when the controller is successfully initialized.

Parameters
funcOnInitFunction to call.
@@ -844,7 +834,7 @@ Protected Attributes diff --git a/class_x_b_o_x_u_s_b__coll__graph.map b/class_x_b_o_x_u_s_b__coll__graph.map index ec5cb1c2..5ea7e477 100644 --- a/class_x_b_o_x_u_s_b__coll__graph.map +++ b/class_x_b_o_x_u_s_b__coll__graph.map @@ -1,6 +1,6 @@ - - - - + + + + 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 bd1c0e53..d2631857 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 @@ -dee322f84a53a66ca571152698f981be \ No newline at end of file +654de9f0f1b78cafbc20482878c5abaf \ 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 6c66272a..deacbb47 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.map b/class_x_b_o_x_u_s_b__inherit__graph.map index e43218e9..f9dd3b82 100644 --- a/class_x_b_o_x_u_s_b__inherit__graph.map +++ b/class_x_b_o_x_u_s_b__inherit__graph.map @@ -1,3 +1,3 @@ - + 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 7e11e2c0..816edbfb 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 @@ -0686bddb1558a264c6860f5ed66959a5 \ No newline at end of file +f856eb1a72c58d28a6481d6c3bc6012d \ 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 638e5a2f..8e473b7d 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 6c40a023..5974918f 100644 --- a/class_x_r21_b1411-members.html +++ b/class_x_r21_b1411-members.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Member List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -144,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_x_r21_b1411.html b/class_x_r21_b1411.html index b2c2ea42..a76544ca 100644 --- a/class_x_r21_b1411.html +++ b/class_x_r21_b1411.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: XR21B1411 Class Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -72,7 +73,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -97,14 +98,25 @@ Inheritance diagram for XR21B1411:
Inheritance graph
- + + + +
[legend]
Collaboration diagram for XR21B1411:
Collaboration graph
- + + + + + + + + +
[legend]

@@ -283,8 +295,7 @@ Additional Inherited Members

-

Used by the USB core to check what this driver support.

-
Parameters
+

Used by the USB core to check what this driver support.

Parameters
@@ -564,7 +575,7 @@ Additional Inherited Members diff --git a/class_x_r21_b1411__coll__graph.map b/class_x_r21_b1411__coll__graph.map index 37aa64f7..ef7794b0 100644 --- a/class_x_r21_b1411__coll__graph.map +++ b/class_x_r21_b1411__coll__graph.map @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + diff --git a/class_x_r21_b1411__coll__graph.md5 b/class_x_r21_b1411__coll__graph.md5 index 0d8faeb4..f6a09260 100644 --- a/class_x_r21_b1411__coll__graph.md5 +++ b/class_x_r21_b1411__coll__graph.md5 @@ -1 +1 @@ -72959291e5999b6654259d712972e335 \ No newline at end of file +2dbccd1b011c53b5f85709ffafe012c5 \ 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 13c0dfb6..b0212e1a 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.map b/class_x_r21_b1411__inherit__graph.map index b9a1966a..71b4bc43 100644 --- a/class_x_r21_b1411__inherit__graph.map +++ b/class_x_r21_b1411__inherit__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/class_x_r21_b1411__inherit__graph.md5 b/class_x_r21_b1411__inherit__graph.md5 index 0ace9433..b61794d2 100644 --- a/class_x_r21_b1411__inherit__graph.md5 +++ b/class_x_r21_b1411__inherit__graph.md5 @@ -1 +1 @@ -a1c5af5cd37a264683d377979a9eabed \ No newline at end of file +b90701a331346260b7eefd76bf910398 \ 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 27611390..19b7e439 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 e1fd9f9d..3b0c3853 100644 --- a/classes.html +++ b/classes.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: Class Index + @@ -22,7 +23,7 @@
vidThe device's VID.
pidThe device's PID.
- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -73,7 +74,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -88,7 +89,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
A | B | C | E | F | H | I | K | L | M | P | R | S | T | U | W | X
- +
@@ -143,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/confdescparser_8h.html b/confdescparser_8h.html index 4e638b0c..0cad4899 100644 --- a/confdescparser_8h.html +++ b/confdescparser_8h.html @@ -3,15 +3,16 @@ - +USB Host Shield 2.0: confdescparser.h File Reference + @@ -22,7 +23,7 @@
  A  
CommandBlockWrapper   KBDLEDS   PS4USB   USB_ENDPOINT_DESCRIPTOR   
CommandBlockWrapperBase   KeyboardReportParser   PSBuzz   USB_HID_DESCRIPTOR   
- @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -171,7 +172,7 @@ Macros diff --git a/confdescparser_8h_source.html b/confdescparser_8h_source.html index 1eff6c88..47afebdc 100644 --- a/confdescparser_8h_source.html +++ b/confdescparser_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: confdescparser.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,229 +86,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
confdescparser.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 #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
+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
@@ -322,21 +106,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); -
void Initialize(MultiValueBuffer *pbuf)
Definition: parsetools.h:67
+
bool Skip(uint8_t **pp, uint16_t *pcntdn, uint16_t bytes_to_skip)
Definition: parsetools.h:77
+
void Initialize(MultiValueBuffer *pbuf)
Definition: parsetools.h:72
uint8_t bCountryCode
Definition: usb_ch9.h:162
- +
#define CP_MASK_COMPARE_SUBCLASS
void SetOR(void)
uint8_t bNumDescriptors
Definition: usb_ch9.h:163
+
bool Parse(uint8_t **pp, uint16_t *pcntdn)
Definition: parsetools.cpp:26
uint8_t bDescriptorType
Definition: usb_ch9.h:160
#define PSTR(str)
#define HID_DESCRIPTOR_HID
Definition: usb_ch9.h:80
+
uint8_t valueSize
Definition: parsetools.h:31
ConfigDescParser(UsbConfigXtracter *xtractor)
-
void Initialize(MultiValueBuffer *const pbuf)
Definition: parsetools.h:49
+
void Initialize(MultiValueBuffer *const pbuf)
Definition: parsetools.h:54
uint8_t bInterfaceSubClass
Definition: usb_ch9.h:142
uint16_t bcdHID
Definition: usb_ch9.h:161
@@ -348,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/controller_enums_8h.html b/controller_enums_8h.html index 59f0b70e..96eaff77 100644 --- a/controller_enums_8h.html +++ b/controller_enums_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: controllerEnums.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -92,110 +93,132 @@ This graph shows which files directly or indirectly include this file:
- + + + + + + + + + + + + + + + + + + + + + + +

Go to the source code of this file.

- - -RightHatY = 3 } -

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.

Enumerations

enum  LEDEnum {
+
enum  LEDEnum {
  OFF = 0, LED1 = 1, LED2 = 2, LED3 = 3, -
+
  LED4 = 4, LED5 = 5, LED6 = 6, LED7 = 7, -
+
  LED8 = 8, LED9 = 9, LED10 = 10, ALL = 5 -
+
}
 
enum  ColorsEnum {
+
enum  ColorsEnum {
  Red = 0xFF0000, Green = 0xFF00, Blue = 0xFF, Yellow = 0xFFEB04, -
+
  Lightblue = 0xFFFF, Purple = 0xFF00FF, Purble = 0xFF00FF, White = 0xFFFFFF, -
+
  Off = 0x00 -
+
}
 
enum  RumbleEnum { RumbleHigh = 0x10, RumbleLow = 0x20 }
 
enum  ButtonEnum {
+
enum  ButtonEnum {
  UP = 0, RIGHT = 1, DOWN = 2, LEFT = 3, -
+
  PLUS = 5, TWO = 6, ONE = 7, MINUS = 8, -
+
  HOME = 9, Z = 10, C = 11, B = 12, -
+
  A = 13, L = 16, R = 17, ZL = 18, -
+
  ZR = 19, SELECT = 4, START = 5, L3 = 6, -
+
  R3 = 7, L2 = 8, R2 = 9, L1 = 10, -
+
  R1 = 11, TRIANGLE = 12, CIRCLE = 13, CROSS = 14, -
+
  SQUARE = 15, PS = 16, MOVE = 17, T = 18, -
+
  SHARE = 4, OPTIONS = 5, TOUCHPAD = 17, BACK = 4, -
+
  X = 14, Y = 15, XBOX = 16, SYNC = 17, -
+
  BLACK = 8, WHITE = 9, RED = 0, YELLOW = 1, -
+
  GREEN = 2, ORANGE = 3, BLUE = 4 -
+
}
 
enum  AnalogHatEnum { LeftHatX = 0, @@ -204,27 +227,27 @@ Enumerations
 
enum  SensorEnum {
+
enum  SensorEnum {
  aX = 50, aY = 52, aZ = 54, gZ = 56, -
+
  gX, gY, aXmove = 28, aZmove = 30, -
+
  aYmove = 32, gXmove = 40, gZmove = 42, gYmove = 44, -
+
  tempMove = 46, mXmove = 47, mZmove = 49, mYmove = 50 -
+
}
 
enum  AngleEnum { Pitch = 0x01, @@ -244,29 +267,29 @@ Enumerations
- - - - - - - - - - - -
Enumerator
OFF  +
Enumerator
OFF 
LED1  +
LED1 
LED2  +
LED2 
LED3  +
LED3 
LED4  +
LED4 
LED5  +
LED5 
LED6  +
LED6 
LED7  +
LED7 
LED8  +
LED8 
LED9  +
LED9 
LED10  +
LED10 
ALL  +
ALL 

Used to blink all LEDs on the Xbox controller

@@ -286,30 +309,30 @@ Enumerations

Used to set the colors of the Move and PS4 controller.

- - - - - - - - -
Enumerator
Red  +
Enumerator
Red 

r = 255, g = 0, b = 0

Green  +
Green 

r = 0, g = 255, b = 0

Blue  +
Blue 

r = 0, g = 0, b = 255

Yellow  +
Yellow 

r = 255, g = 235, b = 4

Lightblue  +
Lightblue 

r = 0, g = 255, b = 255

Purple  +
Purple 

r = 255, g = 0, b = 255

Purble  +
Purble 
White  +
White 

r = 255, g = 255, b = 255

Off  +
Off 

r = 0, g = 0, b = 0

@@ -328,9 +351,9 @@ Enumerations
- -
Enumerator
RumbleHigh  +
Enumerator
RumbleHigh 
RumbleLow  +
RumbleLow 
@@ -349,140 +372,140 @@ Enumerations

This enum is used to read all the different buttons on the different controllers

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Enumerator
UP  +
Enumerator
UP 

These buttons are available on all the the controllers

RIGHT  +
RIGHT 

These buttons are available on all the the controllers

DOWN  +
DOWN 

These buttons are available on all the the controllers

LEFT  +
LEFT 

These buttons are available on all the the controllers

PLUS  +
PLUS 

Wii buttons

TWO  +
TWO 

Wii buttons

ONE  +
ONE 

Wii buttons

MINUS  +
MINUS 

Wii buttons

HOME  +
HOME 

Wii buttons

Z  +

Wii buttons

C  +

Wii buttons

B  +

Wii buttons

A  +

Wii buttons

L  +

These are only available on the Wii U Pro Controller

R  +

These are only available on the Wii U Pro Controller

ZL  +
ZL 

These are only available on the Wii U Pro Controller

ZR  +
ZR 

These are only available on the Wii U Pro Controller

SELECT  +
SELECT 

PS3 controllers buttons

START  +
START 

PS3 controllers buttons

L3  +
L3 

PS3 controllers buttons

R3  +
R3 

PS3 controllers buttons

L2  +
L2 

PS3 controllers buttons

R2  +
R2 

PS3 controllers buttons

L1  +
L1 

PS3 controllers buttons

R1  +
R1 

PS3 controllers buttons

TRIANGLE  +
TRIANGLE 

PS3 controllers buttons

CIRCLE  +
CIRCLE 

PS3 controllers buttons

CROSS  +
CROSS 

PS3 controllers buttons

SQUARE  +
SQUARE 

PS3 controllers buttons

PS  +
PS 

PS3 controllers buttons

MOVE  +
MOVE 

PS3 controllers buttons

T  +

PS3 controllers buttons

SHARE  +
SHARE 

PS4 controllers buttons - SHARE and OPTIONS are present instead of SELECT and START

OPTIONS  +
OPTIONS 
TOUCHPAD  +
TOUCHPAD 
BACK  +
BACK 

Xbox buttons

X  +

Xbox buttons

Y  +

Xbox buttons

XBOX  +
XBOX 

Xbox buttons

SYNC  +
SYNC 

Xbox buttons

BLACK  +
BLACK 

Xbox buttons

WHITE  +
WHITE 

Xbox buttons

RED  +
RED 

PS Buzz controllers

YELLOW  +
YELLOW 
GREEN  +
GREEN 
ORANGE  +
ORANGE 
BLUE  +
BLUE 
@@ -501,16 +524,16 @@ Enumerations

Joysticks on the PS3 and Xbox controllers.

- - - -
Enumerator
LeftHatX  +
Enumerator
LeftHatX 

Left joystick x-axis

LeftHatY  +
LeftHatY 

Left joystick y-axis

RightHatX  +
RightHatX 

Right joystick x-axis

RightHatY  +
RightHatY 

Right joystick y-axis

@@ -530,48 +553,48 @@ 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  +
Enumerator
aX 

Accelerometer values

aY  +
aY 
aZ  +
aZ 
gZ  +
gZ 

Gyro z-axis

gX  +
gX 
gY  +
gY 
aXmove  +
aXmove 

Accelerometer x-axis

aZmove  +
aZmove 

Accelerometer z-axis

aYmove  +
aYmove 

Accelerometer y-axis

gXmove  +
gXmove 

Gyro x-axis

gZmove  +
gZmove 

Gyro z-axis

gYmove  +
gYmove 

Gyro y-axis

tempMove  +
tempMove 

Temperature sensor

mXmove  +
mXmove 

Magnetometer x-axis

mZmove  +
mZmove 

Magnetometer z-axis

mYmove  +
mYmove 

Magnetometer y-axis

@@ -591,9 +614,9 @@ Enumerations

Used to get the angle calculated using the PS3 controller and PS4 controller.

- -
Enumerator
Pitch  +
Enumerator
Pitch 
Roll  +
Roll 
@@ -606,7 +629,7 @@ Enumerations diff --git a/controller_enums_8h__dep__incl.map b/controller_enums_8h__dep__incl.map index 7b221b52..2a9c267e 100644 --- a/controller_enums_8h__dep__incl.map +++ b/controller_enums_8h__dep__incl.map @@ -1,24 +1,24 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/controller_enums_8h__dep__incl.md5 b/controller_enums_8h__dep__incl.md5 index 6d1dc032..a454f8ea 100644 --- a/controller_enums_8h__dep__incl.md5 +++ b/controller_enums_8h__dep__incl.md5 @@ -1 +1 @@ -ce160d3aed3cc5b63b417a471188bc0b \ No newline at end of file +4fdabf04235560d8eaef94d5795a6445 \ No newline at end of file diff --git a/controller_enums_8h__dep__incl.png b/controller_enums_8h__dep__incl.png index ddacc2bb..3ef77701 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 ea960c39..6a60e3ef 100644 --- a/controller_enums_8h_source.html +++ b/controller_enums_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: controllerEnums.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -85,153 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 
-
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
- +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
@@ -335,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ftv2doc.png b/doc.png similarity index 100% rename from ftv2doc.png rename to doc.png diff --git a/doxygen.css b/doxygen.css index f0f36f89..1425ec53 100644 --- a/doxygen.css +++ b/doxygen.css @@ -1,4 +1,4 @@ -/* The standard CSS for doxygen 1.8.6 */ +/* The standard CSS for doxygen 1.8.11 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; @@ -206,6 +206,11 @@ div.line { transition-duration: 0.5s; } +div.line:after { + content:"\000A"; + white-space: pre; +} + div.line.glow { background-color: cyan; box-shadow: 0 0 10px cyan; @@ -227,7 +232,7 @@ span.lineno a:hover { background-color: #C8C8C8; } -div.ah { +div.ah, span.ah { background-color: black; font-weight: bold; color: #ffffff; @@ -242,7 +247,16 @@ div.ah { -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); - background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%); +} + +div.classindex ul { + list-style: none; + padding-left: 0; +} + +div.classindex span.ai { + display: inline-block; } div.groupHeader { @@ -670,12 +684,12 @@ span.mlabel { /* @end */ -/* these are for tree view when not used as main index */ +/* these are for tree view inside a (index) page */ div.directory { margin: 10px 0px; - border-top: 1px solid #A8B8D9; - border-bottom: 1px solid #A8B8D9; + border-top: 1px solid #9CAFD4; + border-bottom: 1px solid #9CAFD4; width: 100%; } @@ -734,6 +748,80 @@ div.directory { color: #3D578C; } +.arrow { + color: #9CAFD4; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; +} + +.icon { + font-family: Arial, Helvetica; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: #728DC1; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderopen.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderclosed.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('doc.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +table.directory { + font: 400 14px Roboto,sans-serif; +} + +/* @end */ + div.dynheader { margin-top: 8px; -webkit-touch-callout: none; @@ -749,6 +837,10 @@ address { color: #2A3D61; } +table.doxtable caption { + caption-side: top; +} + table.doxtable { border-collapse:collapse; margin-top: 4px; @@ -914,6 +1006,18 @@ div.summary a white-space: nowrap; } +table.classindex +{ + margin: 10px; + white-space: nowrap; + margin-left: 3%; + margin-right: 3%; + width: 94%; + border: 0; + border-spacing: 0; + padding: 0; +} + div.ingroups { font-size: 8pt; @@ -1025,6 +1129,11 @@ dl.section dd { border: 0px none; } +#projectalign +{ + vertical-align: middle; +} + #projectname { font: 300% Tahoma, Arial,sans-serif; @@ -1108,7 +1217,7 @@ div.toc { border-radius: 7px 7px 7px 7px; float: right; height: auto; - margin: 0 20px 10px 10px; + margin: 0 8px 10px 10px; width: 200px; } diff --git a/dynsections.js b/dynsections.js index 2f15470d..1e6bf07f 100644 --- a/dynsections.js +++ b/dynsections.js @@ -24,19 +24,20 @@ function updateStripes() $('table.directory tr'). removeClass('even').filter(':visible:even').addClass('even'); } + function toggleLevel(level) { - $('table.directory tr').each(function(){ + $('table.directory tr').each(function() { var l = this.id.split('_').length-1; var i = $('#img'+this.id.substring(3)); var a = $('#arr'+this.id.substring(3)); if (l - + USB Host Shield 2.0: File List + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+
@@ -87,86 +88,86 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Here is a list of all files with brief descriptions:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
o*address.h
o*adk.cpp
o*adk.h
o*avrpins.h
o*BTD.cpp
o*BTD.h
o*BTHID.cpp
o*BTHID.h
o*cdc_XR21B1411.cpp
o*cdc_XR21B1411.h
o*cdcacm.cpp
o*cdcacm.h
o*cdcftdi.cpp
o*cdcftdi.h
o*cdcprolific.cpp
o*cdcprolific.h
o*confdescparser.h
o*controllerEnums.h
o*hexdump.h
o*hidboot.cpp
o*hidboot.h
o*hidcomposite.cpp
o*hidcomposite.h
o*hidescriptorparser.cpp
o*hidescriptorparser.h
o*hiduniversal.cpp
o*hiduniversal.h
o*hidusagestr.h
o*hidusagetitlearrays.cpp
o*macros.h
o*masstorage.cpp
o*masstorage.h
o*max3421e.h
o*max_LCD.cpp
o*max_LCD.h
o*message.cpp
o*message.h
o*parsetools.cpp
o*parsetools.h
o*printhex.h
o*PS3BT.cpp
o*PS3BT.h
o*PS3Enums.h
o*PS3USB.cpp
o*PS3USB.h
o*PS4BT.h
o*PS4Parser.cpp
o*PS4Parser.h
o*PS4USB.h
o*PSBuzz.cpp
o*PSBuzz.h
o*settings.h
o*sink_parser.h
o*SPP.cpp
o*SPP.h
o*UHS2_gpio.cpp
o*UHS2_gpio.h
o*Usb.cpp
o*Usb.h
o*usb_ch9.h
o*UsbCore.h
o*usbh_midi.cpp
o*usbh_midi.h
o*usbhid.cpp
o*usbhid.h
o*usbhost.h
o*usbhub.cpp
o*usbhub.h
o*version_helper.h
o*Wii.cpp
o*Wii.h
o*xboxEnums.h
o*XBOXOLD.cpp
o*XBOXOLD.h
o*XBOXONE.cpp
o*XBOXONE.h
o*XBOXRECV.cpp
o*XBOXRECV.h
o*XBOXUSB.cpp
\*XBOXUSB.h
 address.h
 adk.cpp
 adk.h
 avrpins.h
 BTD.cpp
 BTD.h
 BTHID.cpp
 BTHID.h
 cdc_XR21B1411.cpp
 cdc_XR21B1411.h
 cdcacm.cpp
 cdcacm.h
 cdcftdi.cpp
 cdcftdi.h
 cdcprolific.cpp
 cdcprolific.h
 confdescparser.h
 controllerEnums.h
 hexdump.h
 hidboot.cpp
 hidboot.h
 hidcomposite.cpp
 hidcomposite.h
 hidescriptorparser.cpp
 hidescriptorparser.h
 hiduniversal.cpp
 hiduniversal.h
 hidusagestr.h
 hidusagetitlearrays.cpp
 macros.h
 masstorage.cpp
 masstorage.h
 max3421e.h
 max_LCD.cpp
 max_LCD.h
 message.cpp
 message.h
 parsetools.cpp
 parsetools.h
 printhex.h
 PS3BT.cpp
 PS3BT.h
 PS3Enums.h
 PS3USB.cpp
 PS3USB.h
 PS4BT.h
 PS4Parser.cpp
 PS4Parser.h
 PS4USB.h
 PSBuzz.cpp
 PSBuzz.h
 settings.h
 sink_parser.h
 SPP.cpp
 SPP.h
 UHS2_gpio.cpp
 UHS2_gpio.h
 Usb.cpp
 Usb.h
 usb_ch9.h
 UsbCore.h
 usbh_midi.cpp
 usbh_midi.h
 usbhid.cpp
 usbhid.h
 usbhost.h
 usbhub.cpp
 usbhub.h
 version_helper.h
 Wii.cpp
 Wii.h
 xboxEnums.h
 XBOXOLD.cpp
 XBOXOLD.h
 XBOXONE.cpp
 XBOXONE.h
 XBOXRECV.cpp
 XBOXRECV.h
 XBOXUSB.cpp
 XBOXUSB.h
@@ -174,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ftv2folderclosed.png b/folderclosed.png similarity index 100% rename from ftv2folderclosed.png rename to folderclosed.png diff --git a/ftv2folderopen.png b/folderopen.png similarity index 100% rename from ftv2folderopen.png rename to folderopen.png diff --git a/ftv2blank.png b/ftv2blank.png deleted file mode 100644 index 63c605bb..00000000 Binary files a/ftv2blank.png and /dev/null differ diff --git a/ftv2cl.png b/ftv2cl.png deleted file mode 100644 index 132f6577..00000000 Binary files a/ftv2cl.png and /dev/null differ diff --git a/ftv2lastnode.png b/ftv2lastnode.png deleted file mode 100644 index 63c605bb..00000000 Binary files a/ftv2lastnode.png and /dev/null differ diff --git a/ftv2link.png b/ftv2link.png deleted file mode 100644 index 17edabff..00000000 Binary files a/ftv2link.png and /dev/null differ diff --git a/ftv2mnode.png b/ftv2mnode.png deleted file mode 100644 index 0b63f6d3..00000000 Binary files a/ftv2mnode.png and /dev/null differ diff --git a/ftv2mo.png b/ftv2mo.png deleted file mode 100644 index 4bfb80f7..00000000 Binary files a/ftv2mo.png and /dev/null differ diff --git a/ftv2node.png b/ftv2node.png deleted file mode 100644 index 63c605bb..00000000 Binary files a/ftv2node.png and /dev/null differ diff --git a/ftv2ns.png b/ftv2ns.png deleted file mode 100644 index 72e3d71c..00000000 Binary files a/ftv2ns.png and /dev/null differ diff --git a/ftv2pnode.png b/ftv2pnode.png deleted file mode 100644 index c6ee22f9..00000000 Binary files a/ftv2pnode.png and /dev/null differ diff --git a/ftv2vertline.png b/ftv2vertline.png deleted file mode 100644 index 63c605bb..00000000 Binary files a/ftv2vertline.png and /dev/null differ diff --git a/functions.html b/functions.html index 34f01eb9..50f9e151 100644 --- a/functions.html +++ b/functions.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -134,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_a.html b/functions_a.html index 1327361c..64860fc6 100644 --- a/functions_a.html +++ b/functions_a.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -283,7 +284,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_b.html b/functions_b.html index 87c484c2..8df6b68e 100644 --- a/functions_b.html +++ b/functions_b.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -588,7 +589,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_c.html b/functions_c.html index 2ce0526e..3a78c960 100644 --- a/functions_c.html +++ b/functions_c.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -287,7 +288,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_d.html b/functions_d.html index 5b888eef..0a2e7589 100644 --- a/functions_d.html +++ b/functions_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -237,7 +238,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_e.html b/functions_e.html index a8231723..64a4dd8c 100644 --- a/functions_e.html +++ b/functions_e.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -225,7 +226,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_enum.html b/functions_enum.html index d32f381a..1fe022a9 100644 --- a/functions_enum.html +++ b/functions_enum.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Enumerations + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -83,7 +84,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -103,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_eval.html b/functions_eval.html index 3459fcd8..064524f4 100644 --- a/functions_eval.html +++ b/functions_eval.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Enumerator + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -83,7 +84,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -115,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_f.html b/functions_f.html index 1c950e9c..26048460 100644 --- a/functions_f.html +++ b/functions_f.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -154,7 +155,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func.html b/functions_func.html index d1ffc72b..27a2cbc6 100644 --- a/functions_func.html +++ b/functions_func.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -177,7 +178,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_b.html b/functions_func_b.html index 3e0899cd..6168a012 100644 --- a/functions_func_b.html +++ b/functions_func_b.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -161,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_c.html b/functions_func_c.html index a9c5b758..0e95f032 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -194,7 +195,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_d.html b/functions_func_d.html index 57eaf9c4..4596f009 100644 --- a/functions_func_d.html +++ b/functions_func_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -169,7 +170,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_e.html b/functions_func_e.html index 5bb37440..9ca6ab89 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -150,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_f.html b/functions_func_f.html index 8ec58130..8d9b4b3a 100644 --- a/functions_func_f.html +++ b/functions_func_f.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -142,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_g.html b/functions_func_g.html index 386aed72..f5401132 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -419,7 +420,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_h.html b/functions_func_h.html index 6badf818..797287f1 100644 --- a/functions_func_h.html +++ b/functions_func_h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -204,7 +205,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_i.html b/functions_func_i.html index 8c86102d..2646330d 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -201,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_k.html b/functions_func_k.html index 37bd8146..41c2ae86 100644 --- a/functions_func_k.html +++ b/functions_func_k.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -131,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_l.html b/functions_func_l.html index c7080b8e..f63b1242 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -164,7 +165,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_m.html b/functions_func_m.html index 1d3a12a0..73197d51 100644 --- a/functions_func_m.html +++ b/functions_func_m.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
+
USB Host Shield 2.0
- + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
@@ -142,13 +143,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MultiByteValueParser() : MultiByteValueParser
  • +
  • MultiValueBuffer() +: MultiValueBuffer +
  • diff --git a/functions_func_n.html b/functions_func_n.html index e1f1cb41..66c14028 100644 --- a/functions_func_n.html +++ b/functions_func_n.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -140,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_o.html b/functions_func_o.html index 8e7f4d68..066f1613 100644 --- a/functions_func_o.html +++ b/functions_func_o.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -195,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_p.html b/functions_func_p.html index eb4b5b06..eeaa7a30 100644 --- a/functions_func_p.html +++ b/functions_func_p.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -285,7 +286,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_r.html b/functions_func_r.html index 17ca4793..ee48b9e7 100644 --- a/functions_func_r.html +++ b/functions_func_r.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -227,7 +228,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_s.html b/functions_func_s.html index d731322b..4651c195 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -354,7 +355,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_t.html b/functions_func_t.html index 8c42fc6c..426eec73 100644 --- a/functions_func_t.html +++ b/functions_func_t.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -132,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_u.html b/functions_func_u.html index 37a2b67e..dcfd4e94 100644 --- a/functions_func_u.html +++ b/functions_func_u.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -143,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_v.html b/functions_func_v.html index 3f9fad1e..b2f6f0ba 100644 --- a/functions_func_v.html +++ b/functions_func_v.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -145,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_w.html b/functions_func_w.html index d625e38b..bd112bdb 100644 --- a/functions_func_w.html +++ b/functions_func_w.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -133,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • write() : Max_LCD -, SPP +, SPP
  • write_register() : XR21B1411 @@ -147,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_x.html b/functions_func_x.html index 3e21e61e..56e144ba 100644 --- a/functions_func_x.html +++ b/functions_func_x.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Functions + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
  • - + @@ -109,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -143,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_g.html b/functions_g.html index 8d35d6c8..d1583c93 100644 --- a/functions_g.html +++ b/functions_g.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -488,7 +489,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_h.html b/functions_h.html index cfcceb46..943b9baf 100644 --- a/functions_h.html +++ b/functions_h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -225,7 +226,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_i.html b/functions_i.html index acabe3a6..14226382 100644 --- a/functions_i.html +++ b/functions_i.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -251,7 +252,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_k.html b/functions_k.html index 383dff4d..5d6317cb 100644 --- a/functions_k.html +++ b/functions_k.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -146,7 +147,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_l.html b/functions_l.html index f9d6eb70..bdd0eb4b 100644 --- a/functions_l.html +++ b/functions_l.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -246,7 +247,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_m.html b/functions_m.html index 9faf7123..f95a07ab 100644 --- a/functions_m.html +++ b/functions_m.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -190,7 +191,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : MouseReportParser
  • moveSetBulb() -: PS3BT +: PS3BT , PS3USB
  • moveSetRumble() @@ -203,6 +204,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MULTIP : InquiryResponse
  • +
  • MultiValueBuffer() +: MultiValueBuffer +
  • my_bdaddr : BTD
  • @@ -212,7 +216,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_n.html b/functions_n.html index 7700c3af..4ac2463d 100644 --- a/functions_n.html +++ b/functions_n.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -149,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_o.html b/functions_o.html index 16cfcaf8..230ad970 100644 --- a/functions_o.html +++ b/functions_o.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -215,7 +216,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_p.html b/functions_p.html index cf7bc334..cb6b1a8b 100644 --- a/functions_p.html +++ b/functions_p.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -188,7 +189,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : InquiryResponse
  • pFuncOnInit -: BluetoothService +: BluetoothService
  • pfUsage : ReportDescParserBase @@ -368,7 +369,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_q.html b/functions_q.html index 6624e6ed..4986d3d2 100644 --- a/functions_q.html +++ b/functions_q.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
  • - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -137,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_r.html b/functions_r.html index eb4d6829..71b57598 100644 --- a/functions_r.html +++ b/functions_r.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -313,7 +314,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_s.html b/functions_s.html index 8ca381b3..769c161a 100644 --- a/functions_s.html +++ b/functions_s.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -407,7 +408,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_t.html b/functions_t.html index 147faa47..2341537c 100644 --- a/functions_t.html +++ b/functions_t.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -195,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_type.html b/functions_type.html index ca0cbf58..d8e38b4d 100644 --- a/functions_type.html +++ b/functions_type.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Typedefs + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -83,7 +84,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -95,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
     
    @@ -103,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_u.html b/functions_u.html index 03526181..e8853f83 100644 --- a/functions_u.html +++ b/functions_u.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -135,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : BASICCDB
  • UsagePageFunc -: ReportDescParserBase +: ReportDescParserBase
  • usagePageFunctions : ReportDescParserBase @@ -167,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_v.html b/functions_v.html index bb2549b6..390db6a2 100644 --- a/functions_v.html +++ b/functions_v.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
  • - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -183,7 +184,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars.html b/functions_vars.html index 8d1ae6af..f14710c9 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -134,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_a.html b/functions_vars_a.html index 369deaa0..d064ddf0 100644 --- a/functions_vars_a.html +++ b/functions_vars_a.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -234,7 +235,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_b.html b/functions_vars_b.html index add14dce..cc81830f 100644 --- a/functions_vars_b.html +++ b/functions_vars_b.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -555,7 +556,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_c.html b/functions_vars_c.html index 09e97f2c..a9604282 100644 --- a/functions_vars_c.html +++ b/functions_vars_c.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -223,7 +224,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_d.html b/functions_vars_d.html index 0712fb18..5097d1fb 100644 --- a/functions_vars_d.html +++ b/functions_vars_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -196,7 +197,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_e.html b/functions_vars_e.html index ba92b558..2498811f 100644 --- a/functions_vars_e.html +++ b/functions_vars_e.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -194,7 +195,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_f.html b/functions_vars_f.html index c843318b..405759df 100644 --- a/functions_vars_f.html +++ b/functions_vars_f.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -140,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_g.html b/functions_vars_g.html index 8df03970..7bff218f 100644 --- a/functions_vars_g.html +++ b/functions_vars_g.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -197,7 +198,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_h.html b/functions_vars_h.html index 418c8895..b62ea80f 100644 --- a/functions_vars_h.html +++ b/functions_vars_h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -151,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_i.html b/functions_vars_i.html index 803e8a7b..16f01c46 100644 --- a/functions_vars_i.html +++ b/functions_vars_i.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -182,7 +183,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_k.html b/functions_vars_k.html index 944f5b20..e3dc6971 100644 --- a/functions_vars_k.html +++ b/functions_vars_k.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -143,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_l.html b/functions_vars_l.html index 59c66a0b..e8293802 100644 --- a/functions_vars_l.html +++ b/functions_vars_l.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -210,7 +211,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_m.html b/functions_vars_m.html index 9717195b..c03cf671 100644 --- a/functions_vars_m.html +++ b/functions_vars_m.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -186,7 +187,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_n.html b/functions_vars_n.html index 97978991..148a7b8c 100644 --- a/functions_vars_n.html +++ b/functions_vars_n.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -137,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_o.html b/functions_vars_o.html index 9ec2f927..d0330d0c 100644 --- a/functions_vars_o.html +++ b/functions_vars_o.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -148,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_p.html b/functions_vars_p.html index 96f7fef4..3bb23e09 100644 --- a/functions_vars_p.html +++ b/functions_vars_p.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -141,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : InquiryResponse
  • pFuncOnInit -: BluetoothService +: BluetoothService
  • pfUsage : ReportDescParserBase @@ -208,7 +209,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_q.html b/functions_vars_q.html index 7d50e057..266f3d63 100644 --- a/functions_vars_q.html +++ b/functions_vars_q.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
  • - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -137,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_r.html b/functions_vars_r.html index 6c60cbef..dc4bc2e5 100644 --- a/functions_vars_r.html +++ b/functions_vars_r.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -214,7 +215,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_s.html b/functions_vars_s.html index d6fc2f4e..e1291860 100644 --- a/functions_vars_s.html +++ b/functions_vars_s.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -181,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_t.html b/functions_vars_t.html index 7ca309f9..8dad6e32 100644 --- a/functions_vars_t.html +++ b/functions_vars_t.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -191,7 +192,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_u.html b/functions_vars_u.html index 043398df..52b34c5a 100644 --- a/functions_vars_u.html +++ b/functions_vars_u.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -149,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_v.html b/functions_vars_v.html index fec20b81..c905ddb4 100644 --- a/functions_vars_v.html +++ b/functions_vars_v.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -166,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_w.html b/functions_vars_w.html index 0a566003..af3ba86a 100644 --- a/functions_vars_w.html +++ b/functions_vars_w.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -189,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_x.html b/functions_vars_x.html index 6b6a4595..5d30e8e9 100644 --- a/functions_vars_x.html +++ b/functions_vars_x.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -150,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_y.html b/functions_vars_y.html index 3ea9dd62..d43cabfa 100644 --- a/functions_vars_y.html +++ b/functions_vars_y.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members - Variables + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -143,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_w.html b/functions_w.html index ba0a2d3c..32e2da03 100644 --- a/functions_w.html +++ b/functions_w.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -173,7 +174,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • write() : Max_LCD -, SPP +, SPP
  • write_register() : XR21B1411 @@ -206,7 +207,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_x.html b/functions_x.html index 2cf2824e..0892a591 100644 --- a/functions_x.html +++ b/functions_x.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
  • - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -165,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_y.html b/functions_y.html index ca5661a6..1620b9cc 100644 --- a/functions_y.html +++ b/functions_y.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -143,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals.html b/globals.html index b72470ad..d5b5be40 100644 --- a/globals.html +++ b/globals.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -143,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_a.html b/globals_a.html index aa546c5b..6751d7d2 100644 --- a/globals_a.html +++ b/globals_a.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -218,7 +219,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_b.html b/globals_b.html index d0e77d15..74daae89 100644 --- a/globals_b.html +++ b/globals_b.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -734,7 +735,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_c.html b/globals_c.html index d3cb5349..fed02220 100644 --- a/globals_c.html +++ b/globals_c.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -323,7 +324,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_d.html b/globals_d.html index 297affe9..e80befea 100644 --- a/globals_d.html +++ b/globals_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -227,7 +228,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs.html b/globals_defs.html index 3ffad5cc..c0031b25 100644 --- a/globals_defs.html +++ b/globals_defs.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -141,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_a.html b/globals_defs_a.html index b41b3de1..0d9811e3 100644 --- a/globals_defs_a.html +++ b/globals_defs_a.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -183,7 +184,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_b.html b/globals_defs_b.html index ac331abc..7af7af52 100644 --- a/globals_defs_b.html +++ b/globals_defs_b.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -696,7 +697,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_c.html b/globals_defs_c.html index 8bae2701..5d9c451e 100644 --- a/globals_defs_c.html +++ b/globals_defs_c.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -291,7 +292,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_d.html b/globals_defs_d.html index 046ef4b0..cfcdf8dd 100644 --- a/globals_defs_d.html +++ b/globals_defs_d.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -180,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_e.html b/globals_defs_e.html index 3cde902e..afd88d89 100644 --- a/globals_defs_e.html +++ b/globals_defs_e.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -225,7 +226,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_f.html b/globals_defs_f.html index 5503b4c9..82893b0b 100644 --- a/globals_defs_f.html +++ b/globals_defs_f.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -273,7 +274,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_g.html b/globals_defs_g.html index 84e123b4..fef623d1 100644 --- a/globals_defs_g.html +++ b/globals_defs_g.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -156,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_h.html b/globals_defs_h.html index f0070b67..9ad60fae 100644 --- a/globals_defs_h.html +++ b/globals_defs_h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -442,7 +443,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_i.html b/globals_defs_i.html index f5bb2edf..ceb3d51c 100644 --- a/globals_defs_i.html +++ b/globals_defs_i.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -141,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_j.html b/globals_defs_j.html index 0e2216cf..2ebc593b 100644 --- a/globals_defs_j.html +++ b/globals_defs_j.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -137,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_k.html b/globals_defs_k.html index 0788a45d..858f036b 100644 --- a/globals_defs_k.html +++ b/globals_defs_k.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -189,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_l.html b/globals_defs_l.html index c33fcaa0..a17ba478 100644 --- a/globals_defs_l.html +++ b/globals_defs_l.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -354,7 +355,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_m.html b/globals_defs_m.html index d8516b84..2d0417a9 100644 --- a/globals_defs_m.html +++ b/globals_defs_m.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -329,7 +330,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_n.html b/globals_defs_n.html index 34961e56..81f868d1 100644 --- a/globals_defs_n.html +++ b/globals_defs_n.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -162,7 +163,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_o.html b/globals_defs_o.html index 55c8bd46..841b096b 100644 --- a/globals_defs_o.html +++ b/globals_defs_o.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -144,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_p.html b/globals_defs_p.html index 1dd12dee..be407f85 100644 --- a/globals_defs_p.html +++ b/globals_defs_p.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -253,7 +254,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_r.html b/globals_defs_r.html index 0f1b2fba..602b2524 100644 --- a/globals_defs_r.html +++ b/globals_defs_r.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -228,7 +229,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_s.html b/globals_defs_s.html index 030d2553..a280214a 100644 --- a/globals_defs_s.html +++ b/globals_defs_s.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -471,7 +472,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_t.html b/globals_defs_t.html index 0c53cc9e..dc5a04e1 100644 --- a/globals_defs_t.html +++ b/globals_defs_t.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -231,7 +232,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_u.html b/globals_defs_u.html index c31236ff..7d1329c5 100644 --- a/globals_defs_u.html +++ b/globals_defs_u.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -510,7 +511,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_v.html b/globals_defs_v.html index 094660ac..21c8341e 100644 --- a/globals_defs_v.html +++ b/globals_defs_v.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -156,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_w.html b/globals_defs_w.html index e29a3fef..c9eaf168 100644 --- a/globals_defs_w.html +++ b/globals_defs_w.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -162,7 +163,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_x.html b/globals_defs_x.html index 15904b46..968b34df 100644 --- a/globals_defs_x.html +++ b/globals_defs_x.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -110,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -454,7 +455,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_e.html b/globals_e.html index 4c1ddbc9..70f423f4 100644 --- a/globals_e.html +++ b/globals_e.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -245,7 +246,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_enum.html b/globals_enum.html index 6f9c7d54..c0712ad2 100644 --- a/globals_enum.html +++ b/globals_enum.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -82,7 +83,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -144,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_eval.html b/globals_eval.html index 07d5a77c..849bb8e8 100644 --- a/globals_eval.html +++ b/globals_eval.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -108,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -643,7 +644,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_f.html b/globals_f.html index 3ca59d38..0d898b8d 100644 --- a/globals_f.html +++ b/globals_f.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -281,7 +282,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_func.html b/globals_func.html index 53b2256d..1c2c4d9b 100644 --- a/globals_func.html +++ b/globals_func.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -82,7 +83,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -138,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_g.html b/globals_g.html index 4b58f95f..da799219 100644 --- a/globals_g.html +++ b/globals_g.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -182,7 +183,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_h.html b/globals_h.html index 9cde1802..c1f4ca31 100644 --- a/globals_h.html +++ b/globals_h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -459,7 +460,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_i.html b/globals_i.html index b4761fdb..08e29c18 100644 --- a/globals_i.html +++ b/globals_i.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -143,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_j.html b/globals_j.html index 4f436c83..184df601 100644 --- a/globals_j.html +++ b/globals_j.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -139,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_k.html b/globals_k.html index f2b75a33..9084689a 100644 --- a/globals_k.html +++ b/globals_k.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -206,7 +207,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_l.html b/globals_l.html index be8e0ae2..ce6cc461 100644 --- a/globals_l.html +++ b/globals_l.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -419,7 +420,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_m.html b/globals_m.html index d81de219..ff17f52c 100644 --- a/globals_m.html +++ b/globals_m.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -370,7 +371,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_n.html b/globals_n.html index 144481b8..b5be5f00 100644 --- a/globals_n.html +++ b/globals_n.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -167,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_o.html b/globals_o.html index 6caf939a..5d58b012 100644 --- a/globals_o.html +++ b/globals_o.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -161,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_p.html b/globals_p.html index f699b068..97cd1ee2 100644 --- a/globals_p.html +++ b/globals_p.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -2873,7 +2874,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : hidusagestr.h
  • PTP_ARRAY_EL_FUNC -: parsetools.h +: parsetools.h
  • Purble : controllerEnums.h @@ -2887,7 +2888,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_r.html b/globals_r.html index 827cb6bb..9700cd0a 100644 --- a/globals_r.html +++ b/globals_r.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
  • - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -284,7 +285,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_s.html b/globals_s.html index 5d8e2378..1c669884 100644 --- a/globals_s.html +++ b/globals_s.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -503,7 +504,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_t.html b/globals_t.html index e3fadeca..07692099 100644 --- a/globals_t.html +++ b/globals_t.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -269,7 +270,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_type.html b/globals_type.html index 01c72d03..abec4bc2 100644 --- a/globals_type.html +++ b/globals_type.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -82,7 +83,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -115,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : UsbCore.h
  • PTP_ARRAY_EL_FUNC -: parsetools.h +: parsetools.h
  • TEL_CALL_STATE_REP_CPBL_FUNC_DESCR : cdcacm.h @@ -124,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : cdcacm.h
  • UsbDeviceHandleFunc -: address.h +: address.h
  • @@ -132,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_u.html b/globals_u.html index 92452b4b..d3b4b3e4 100644 --- a/globals_u.html +++ b/globals_u.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -495,7 +496,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , message.h
  • UsbDeviceHandleFunc -: address.h +: address.h
  • USBTRACE : macros.h @@ -530,7 +531,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_v.html b/globals_v.html index 30c1bce8..ea4c70f9 100644 --- a/globals_v.html +++ b/globals_v.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
  • - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -167,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars.html b/globals_vars.html index eed35483..dee4ead6 100644 --- a/globals_vars.html +++ b/globals_vars.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -91,7 +92,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -2702,7 +2703,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_r.html b/globals_vars_r.html index c195acee..dd11cf81 100644 --- a/globals_vars_r.html +++ b/globals_vars_r.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -91,7 +92,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -113,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_u.html b/globals_vars_u.html index 0758b4d9..0e912ac4 100644 --- a/globals_vars_u.html +++ b/globals_vars_u.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -91,7 +92,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -116,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_w.html b/globals_vars_w.html index 00619463..c9085b94 100644 --- a/globals_vars_w.html +++ b/globals_vars_w.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -91,7 +92,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -119,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_x.html b/globals_vars_x.html index 04b32281..07ea6983 100644 --- a/globals_vars_x.html +++ b/globals_vars_x.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -91,7 +92,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -119,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_w.html b/globals_w.html index 8651e719..20cef34d 100644 --- a/globals_w.html +++ b/globals_w.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -179,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_x.html b/globals_x.html index 1ba74d68..27195a03 100644 --- a/globals_x.html +++ b/globals_x.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -471,7 +472,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_y.html b/globals_y.html index e2d37cb0..aecdee83 100644 --- a/globals_y.html +++ b/globals_y.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -140,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_z.html b/globals_z.html index 4c242daa..ed5c1026 100644 --- a/globals_z.html +++ b/globals_z.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: File Members + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -112,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -140,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/graph_legend.html b/graph_legend.html index 21731ae5..75dbee35 100644 --- a/graph_legend.html +++ b/graph_legend.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Graph Legend + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -65,7 +66,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -80,42 +81,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    This page explains how to interpret the graphs that are generated by doxygen.

    -

    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:

    +

    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:

    @@ -126,7 +92,7 @@ A filled gray box represents the struct or class for which the graph is generate
  • A box with a black border denotes a documented struct or class.
  • -A box with a grey border denotes an undocumented struct or class.
  • +A box with a gray border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
  • @@ -148,7 +114,7 @@ A yellow dashed arrow denotes a relation between a template instance and the tem diff --git a/graph_legend.png b/graph_legend.png index 6c1d0c23..ab7a9c06 100644 Binary files a/graph_legend.png and b/graph_legend.png differ diff --git a/hexdump_8h.html b/hexdump_8h.html index c850b488..29838106 100644 --- a/hexdump_8h.html +++ b/hexdump_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hexdump.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -121,7 +122,7 @@ Variables diff --git a/hexdump_8h_source.html b/hexdump_8h_source.html index b275b7d8..13b381c5 100644 --- a/hexdump_8h_source.html +++ b/hexdump_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hexdump.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -85,76 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hexdump.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 #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__
    - +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)
    @@ -166,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidboot_8cpp.html b/hidboot_8cpp.html index f70fea1c..21509952 100644 --- a/hidboot_8cpp.html +++ b/hidboot_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidboot.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -85,13 +86,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidboot.cpp File Reference
    -
    #include "hidboot.h"
    +
    #include "hidboot.h"
    Include dependency graph for hidboot.cpp:
    - + + + + +

    Go to the source code of this file.

    @@ -100,7 +105,7 @@ Include dependency graph for hidboot.cpp:
    diff --git a/hidboot_8cpp__incl.map b/hidboot_8cpp__incl.map index adae936a..92e244b0 100644 --- a/hidboot_8cpp__incl.map +++ b/hidboot_8cpp__incl.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/hidboot_8cpp__incl.md5 b/hidboot_8cpp__incl.md5 index 4ad8868c..8925fe78 100644 --- a/hidboot_8cpp__incl.md5 +++ b/hidboot_8cpp__incl.md5 @@ -1 +1 @@ -5d131e21992c85b9a719c57fd1d1fdd1 \ No newline at end of file +fd9ffd5fbb0339f5a30f2cdb6ce0f03f \ No newline at end of file diff --git a/hidboot_8cpp__incl.png b/hidboot_8cpp__incl.png index a61506b5..1fb992f9 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 7e281784..f253b4a7 100644 --- a/hidboot_8cpp_source.html +++ b/hidboot_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidboot.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -85,238 +86,27 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __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 = {'/', '*', '-', '+', '\r'};
    -
    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 ('\r'); // Carriage return (0x0D)
    -
    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 = {'/', '*', '-', '+', '\r'};
    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 ('\r'); // Carriage return (0x0D)
    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 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: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
    @@ -326,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidboot_8h.html b/hidboot_8h.html index 988300c5..df7d7360 100644 --- a/hidboot_8h.html +++ b/hidboot_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidboot.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -88,20 +89,27 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidboot.h File Reference
    -
    #include "usbhid.h"
    +
    #include "usbhid.h"
    Include dependency graph for hidboot.h:
    - + + + +
    This graph shows which files directly or indirectly include this file:
    - + + + + +

    Go to the source code of this file.

    @@ -320,7 +328,7 @@ Macros diff --git a/hidboot_8h__dep__incl.map b/hidboot_8h__dep__incl.map index 72d411bb..d6eb5645 100644 --- a/hidboot_8h__dep__incl.map +++ b/hidboot_8h__dep__incl.map @@ -1,6 +1,6 @@ - - + + - + diff --git a/hidboot_8h__dep__incl.md5 b/hidboot_8h__dep__incl.md5 index fde1084f..4ec250d7 100644 --- a/hidboot_8h__dep__incl.md5 +++ b/hidboot_8h__dep__incl.md5 @@ -1 +1 @@ -6ab61eb2435ebc69d824293cce425db4 \ No newline at end of file +eb017a1dbabb14c916b6c609ad0b5f09 \ No newline at end of file diff --git a/hidboot_8h__dep__incl.png b/hidboot_8h__dep__incl.png index a9a7f5ff..21776426 100644 Binary files a/hidboot_8h__dep__incl.png and b/hidboot_8h__dep__incl.png differ diff --git a/hidboot_8h__incl.map b/hidboot_8h__incl.map index 2faa7fb8..710046fa 100644 --- a/hidboot_8h__incl.map +++ b/hidboot_8h__incl.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/hidboot_8h__incl.md5 b/hidboot_8h__incl.md5 index 482ec312..0cf8d499 100644 --- a/hidboot_8h__incl.md5 +++ b/hidboot_8h__incl.md5 @@ -1 +1 @@ -c217720e2e0320f12e9b0a4a9cbc5ef3 \ No newline at end of file +8dee61608a93687c155ca4b339d92198 \ No newline at end of file diff --git a/hidboot_8h__incl.png b/hidboot_8h__incl.png index a13c28f7..62f0a421 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 5feed2ba..83e8a8d5 100644 --- a/hidboot_8h_source.html +++ b/hidboot_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidboot.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -85,643 +86,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __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__
    +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>
    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__
    uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
    Definition: Usb.cpp:801
    +
    uint8_t bmRcvToggle
    Definition: address.h:48
    #define CP_MASK_COMPARE_ALL
    Definition: usbhid.h:143
    USB * pUsb
    Definition: usbhid.h:145
    -
    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:86
    @@ -729,127 +103,114 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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:49
    +
    uint8_t GetReportDescr(uint16_t wIndex, USBReadParser *parser=NULL)
    Definition: usbhid.cpp:34
    uint8_t Poll()
    Definition: hidboot.h:578
    -
    uint8_t bmLeftCtrl
    Definition: hidboot.h:99
    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:840
    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:57
    +
    uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
    Definition: Usb.cpp:64
    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:29
    -
    uint8_t bmLeftGUI
    Definition: hidboot.h:102
    #define USB_CLASS_HID
    Definition: UsbCore.h:72
    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:84
    +
    uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
    Definition: Usb.cpp:831
    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:40
    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: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:39
    virtual void OnMouseMove(MOUSEINFO *mi)
    Definition: hidboot.h:63
    #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:153
    #define bmUSB_TRANSFER_TYPE
    Definition: usb_ch9.h:94
    virtual void OnMiddleButtonDown(MOUSEINFO *mi)
    Definition: hidboot.h:81
    -
    uint8_t bmRightCtrl
    Definition: hidboot.h:90
    +
    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:151
    -
    uint8_t bmRightGUI
    Definition: hidboot.h:93
    #define UHS_HID_BOOT_KEY_NUM_LOCK
    Definition: hidboot.h:27
    -
    uint8_t bmScrollLock
    Definition: hidboot.h:115
    +
    uint8_t bmSndToggle
    Definition: address.h:47
    #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
    Definition: UsbCore.h:98
    #define USB_HID_PROTOCOL_KEYBOARD
    Definition: usbhid.h:93
    #define totalEndpoints(p)
    Definition: hidboot.h:33
    -
    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
    +
    uint8_t SetProtocol(uint8_t iface, uint8_t protocol)
    Definition: usbhid.cpp:66
    #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
    Definition: UsbCore.h:95
    -
    union KeyboardReportParser::@17 prevState
    int8_t dX
    Definition: hidboot.h:47
    #define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
    Definition: UsbCore.h:90
    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: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:209
    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
    uint8_t bNumConfigurations
    Definition: usb_ch9.h:119
    -
    union KeyboardReportParser::@18 kbdLockingKeys
    #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
    Definition: UsbCore.h:93
    -
    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 bmRightAlt
    Definition: hidboot.h:92
    +
    uint8_t maxPktSize
    Definition: address.h:41
    +
    AddressPool & GetAddressPool()
    Definition: UsbCore.h:226
    int8_t dY
    Definition: hidboot.h:48
    Definition: UsbCore.h:210
    -
    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
    -
    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:230
    #define NotifyFailSetConfDescr(...)
    Definition: message.h:60
    -
    uint8_t bmCompose
    Definition: hidboot.h:116
    +
    virtual void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)=0
    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:82
    -
    uint8_t OemToAscii(uint8_t mod, uint8_t key)
    Definition: hidboot.cpp:165
    +
    uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
    defined(USB_METHODS_INLINE)
    Definition: Usb.cpp:796
    diff --git a/hidcomposite_8cpp.html b/hidcomposite_8cpp.html index a560b75f..8e5a65c5 100644 --- a/hidcomposite_8cpp.html +++ b/hidcomposite_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidcomposite.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -85,13 +86,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidcomposite.cpp File Reference
    -
    #include "hidcomposite.h"
    +
    #include "hidcomposite.h"
    Include dependency graph for hidcomposite.cpp:
    - + + + + +

    Go to the source code of this file.

    @@ -100,7 +105,7 @@ Include dependency graph for hidcomposite.cpp:
    diff --git a/hidcomposite_8cpp__incl.map b/hidcomposite_8cpp__incl.map index 8b5c4c50..393fd223 100644 --- a/hidcomposite_8cpp__incl.map +++ b/hidcomposite_8cpp__incl.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/hidcomposite_8cpp__incl.md5 b/hidcomposite_8cpp__incl.md5 index abb71c09..26f07e87 100644 --- a/hidcomposite_8cpp__incl.md5 +++ b/hidcomposite_8cpp__incl.md5 @@ -1 +1 @@ -341241fdb5e0a04ee66c435fd0cc2341 \ No newline at end of file +5165af043119ae7e1520852120f4b3a4 \ No newline at end of file diff --git a/hidcomposite_8cpp__incl.png b/hidcomposite_8cpp__incl.png index 46e55ce8..765a5ae1 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 f433a8d1..f234883b 100644 --- a/hidcomposite_8cpp_source.html +++ b/hidcomposite_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidcomposite.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -85,422 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 
    - -
    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:801
    +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:801
    uint8_t bmRcvToggle
    Definition: address.h:48
    Definition: usbhid.h:143
    @@ -595,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidcomposite_8h.html b/hidcomposite_8h.html index 460db7e4..6c3bb837 100644 --- a/hidcomposite_8h.html +++ b/hidcomposite_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidcomposite.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -87,20 +88,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidcomposite.h File Reference
    -
    #include "usbhid.h"
    +
    #include "usbhid.h"
    Include dependency graph for hidcomposite.h:
    - + + + +
    This graph shows which files directly or indirectly include this file:
    - + +

    Go to the source code of this file.

    @@ -115,7 +120,7 @@ Classes diff --git a/hidcomposite_8h__dep__incl.map b/hidcomposite_8h__dep__incl.map index 318d9d48..68b4ce9c 100644 --- a/hidcomposite_8h__dep__incl.map +++ b/hidcomposite_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/hidcomposite_8h__dep__incl.md5 b/hidcomposite_8h__dep__incl.md5 index 1c808cef..fa654d6e 100644 --- a/hidcomposite_8h__dep__incl.md5 +++ b/hidcomposite_8h__dep__incl.md5 @@ -1 +1 @@ -1cbc34f3a978d88778b887a180658967 \ No newline at end of file +e5cefe8e10450dabf59c09b38501c8d9 \ No newline at end of file diff --git a/hidcomposite_8h__dep__incl.png b/hidcomposite_8h__dep__incl.png index 8ac30846..14502198 100644 Binary files a/hidcomposite_8h__dep__incl.png and b/hidcomposite_8h__dep__incl.png differ diff --git a/hidcomposite_8h__incl.map b/hidcomposite_8h__incl.map index 096b857f..71782bd9 100644 --- a/hidcomposite_8h__incl.map +++ b/hidcomposite_8h__incl.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/hidcomposite_8h__incl.md5 b/hidcomposite_8h__incl.md5 index cde410e3..a69ff5ec 100644 --- a/hidcomposite_8h__incl.md5 +++ b/hidcomposite_8h__incl.md5 @@ -1 +1 @@ -bef4c3d13e94ee692266da2ec008db60 \ No newline at end of file +dbac9dbca596a8ac61230cf0b5b0afd8 \ No newline at end of file diff --git a/hidcomposite_8h__incl.png b/hidcomposite_8h__incl.png index 5bc98627..fe23c57a 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 9fb990fb..45b6dff7 100644 --- a/hidcomposite_8h_source.html +++ b/hidcomposite_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidcomposite.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -85,115 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __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
    +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
    @@ -230,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidescriptorparser_8cpp.html b/hidescriptorparser_8cpp.html index ae145d90..477d87d1 100644 --- a/hidescriptorparser_8cpp.html +++ b/hidescriptorparser_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidescriptorparser.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -85,13 +86,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidescriptorparser.cpp File Reference
    -
    #include "hidescriptorparser.h"
    +
    Include dependency graph for hidescriptorparser.cpp:
    - + + + + +

    Go to the source code of this file.

    @@ -100,7 +105,7 @@ Include dependency graph for hidescriptorparser.cpp:
    diff --git a/hidescriptorparser_8cpp__incl.map b/hidescriptorparser_8cpp__incl.map index 3096ee75..2af760a8 100644 --- a/hidescriptorparser_8cpp__incl.map +++ b/hidescriptorparser_8cpp__incl.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/hidescriptorparser_8cpp__incl.md5 b/hidescriptorparser_8cpp__incl.md5 index e85359ea..d9090345 100644 --- a/hidescriptorparser_8cpp__incl.md5 +++ b/hidescriptorparser_8cpp__incl.md5 @@ -1 +1 @@ -8db4f477c2427eb53875d040bd816992 \ No newline at end of file +ae4f9bfa13694d05aed5bfbb544f5ac5 \ No newline at end of file diff --git a/hidescriptorparser_8cpp__incl.png b/hidescriptorparser_8cpp__incl.png index 2792a435..852671a8 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 2f057914..7f690c23 100644 --- a/hidescriptorparser_8cpp_source.html +++ b/hidescriptorparser_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidescriptorparser.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -85,1595 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __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
    +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[]
    @@ -1690,7 +103,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    const char pstrUsageSystemColdRestart[]
    Definition: hidusagestr.h:105
    const char pstrUsageSecurityCodeCharEntered[]
    Definition: hidusagestr.h:267
    Definition: usbhid.h:143
    -
    void(* UsagePageFunc)(uint16_t usage)
    const char pstrUsageRearBrake[]
    Definition: hidusagestr.h:180
    const char pstrUsageACSort[]
    Definition: hidusagestr.h:747
    const char pstrUsageSelectedIndicator[]
    Definition: hidusagestr.h:329
    @@ -1974,6 +386,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    static void PrintItemTitle(uint8_t prefix)
    const char pstrUsageACDistributeVerticaly[]
    Definition: hidusagestr.h:781
    const char pstrUsageVolumeDecrement[]
    Definition: hidusagestr.h:527
    +
    void(* UsagePageFunc)(uint16_t usage)
    const char pstrUsageTabletPick[]
    Definition: hidusagestr.h:822
    @@ -2429,7 +842,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:49
    +
    void Initialize(MultiValueBuffer *const pbuf)
    Definition: parsetools.h:54
    const char pstrUsageStickFaceAngle[]
    Definition: hidusagestr.h:205
    const char pstrUsageBarrelPressure[]
    Definition: hidusagestr.h:801
    const char pstrUsageACReply[]
    Definition: hidusagestr.h:762
    @@ -2661,7 +1074,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidescriptorparser_8h.html b/hidescriptorparser_8h.html index 5f11a2bc..83773e59 100644 --- a/hidescriptorparser_8h.html +++ b/hidescriptorparser_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidescriptorparser.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -87,20 +88,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidescriptorparser.h File Reference
    -
    #include "usbhid.h"
    +
    #include "usbhid.h"
    Include dependency graph for hidescriptorparser.h:
    - + + + +
    This graph shows which files directly or indirectly include this file:
    - + +

    Go to the source code of this file.

    @@ -121,7 +126,7 @@ Classes diff --git a/hidescriptorparser_8h__dep__incl.map b/hidescriptorparser_8h__dep__incl.map index d00ba5c1..5e966f16 100644 --- a/hidescriptorparser_8h__dep__incl.map +++ b/hidescriptorparser_8h__dep__incl.map @@ -1,3 +1,3 @@ - + diff --git a/hidescriptorparser_8h__dep__incl.md5 b/hidescriptorparser_8h__dep__incl.md5 index 991feb0f..e086c781 100644 --- a/hidescriptorparser_8h__dep__incl.md5 +++ b/hidescriptorparser_8h__dep__incl.md5 @@ -1 +1 @@ -6d9c0da3c50e6ec2d2e9f7e12ac51f93 \ No newline at end of file +f9ba94ed99ad5905f056e92fce988411 \ No newline at end of file diff --git a/hidescriptorparser_8h__dep__incl.png b/hidescriptorparser_8h__dep__incl.png index cc56844d..475e2ace 100644 Binary files a/hidescriptorparser_8h__dep__incl.png and b/hidescriptorparser_8h__dep__incl.png differ diff --git a/hidescriptorparser_8h__incl.map b/hidescriptorparser_8h__incl.map index 4c7957ae..7559fe1b 100644 --- a/hidescriptorparser_8h__incl.map +++ b/hidescriptorparser_8h__incl.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/hidescriptorparser_8h__incl.md5 b/hidescriptorparser_8h__incl.md5 index 02cbee93..bfc34772 100644 --- a/hidescriptorparser_8h__incl.md5 +++ b/hidescriptorparser_8h__incl.md5 @@ -1 +1 @@ -2382220084014d620cb10cb5c8677e7e \ No newline at end of file +fe5843698cf13b222c52c15fd3ff6cda \ No newline at end of file diff --git a/hidescriptorparser_8h__incl.png b/hidescriptorparser_8h__incl.png index b54bb553..8836b9d1 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 46fefbb4..f2a50902 100644 --- a/hidescriptorparser_8h_source.html +++ b/hidescriptorparser_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidescriptorparser.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -85,191 +86,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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) {
    - - - -
    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) {
    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[]
    static const char *const usagePageTitles0[]
    static const char *const telTitles1[]
    Definition: usbhid.h:143
    -
    void(* UsagePageFunc)(uint16_t usage)
    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[]
    @@ -280,7 +103,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)
    @@ -291,6 +114,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    static void PrintButtonPageUsage(uint16_t usage)
    static void PrintConsumerPageUsage(uint16_t usage)
    static void PrintItemTitle(uint8_t prefix)
    +
    void(* UsagePageFunc)(uint16_t usage)
    static const char *const medInstrTitles1[]
    @@ -315,9 +139,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:67
    +
    void Initialize(MultiValueBuffer *pbuf)
    Definition: parsetools.h:72
    static void PrintVRControlsPageUsage(uint16_t usage)
    - +
    static const char *const medInstrTitles4[]
    ReportDescParser2(uint16_t len, uint8_t *pbuf)
    static const char *const telTitles3[]
    @@ -346,7 +170,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:49
    +
    void Initialize(MultiValueBuffer *const pbuf)
    Definition: parsetools.h:54
    static const char *const gameTitles0[]
    void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset)
    static const char *const consTitlesA[]
    @@ -354,7 +178,6 @@ 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[]
    @@ -373,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hiduniversal_8cpp.html b/hiduniversal_8cpp.html index c432ef31..5e4751e0 100644 --- a/hiduniversal_8cpp.html +++ b/hiduniversal_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hiduniversal.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -85,13 +86,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hiduniversal.cpp File Reference
    -
    #include "hiduniversal.h"
    +
    #include "hiduniversal.h"
    Include dependency graph for hiduniversal.cpp:
    - + + + + +

    Go to the source code of this file.

    @@ -100,7 +105,7 @@ Include dependency graph for hiduniversal.cpp:
    diff --git a/hiduniversal_8cpp__incl.map b/hiduniversal_8cpp__incl.map index 82a77cd7..1478dbe7 100644 --- a/hiduniversal_8cpp__incl.map +++ b/hiduniversal_8cpp__incl.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/hiduniversal_8cpp__incl.md5 b/hiduniversal_8cpp__incl.md5 index 8e45e3e1..c3ad3b07 100644 --- a/hiduniversal_8cpp__incl.md5 +++ b/hiduniversal_8cpp__incl.md5 @@ -1 +1 @@ -5e19e49afecd77985a9ff2fa2deea298 \ No newline at end of file +1e66e5231753075199ca54c70eb24f20 \ No newline at end of file diff --git a/hiduniversal_8cpp__incl.png b/hiduniversal_8cpp__incl.png index aa7fcfc5..0cdf0ede 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 d9a98c2d..1702fb76 100644 --- a/hiduniversal_8cpp_source.html +++ b/hiduniversal_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hiduniversal.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -85,432 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 
    - -
    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
    +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:801
    uint8_t bmRcvToggle
    Definition: address.h:48
    uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
    @@ -604,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hiduniversal_8h.html b/hiduniversal_8h.html index 2f9e384f..56ec4ff1 100644 --- a/hiduniversal_8h.html +++ b/hiduniversal_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hiduniversal.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -87,20 +88,27 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hiduniversal.h File Reference
    -
    #include "usbhid.h"
    +
    #include "usbhid.h"
    Include dependency graph for hiduniversal.h:
    - + + + +
    This graph shows which files directly or indirectly include this file:
    - + + + + +

    Go to the source code of this file.

    @@ -115,7 +123,7 @@ Classes diff --git a/hiduniversal_8h__dep__incl.map b/hiduniversal_8h__dep__incl.map index 7eddfb93..cc31424c 100644 --- a/hiduniversal_8h__dep__incl.map +++ b/hiduniversal_8h__dep__incl.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/hiduniversal_8h__dep__incl.md5 b/hiduniversal_8h__dep__incl.md5 index 436cf0d0..8b07bcbb 100644 --- a/hiduniversal_8h__dep__incl.md5 +++ b/hiduniversal_8h__dep__incl.md5 @@ -1 +1 @@ -a86212bae843e45e600441e77f5c34e5 \ No newline at end of file +6079ba5023de3a9bc19938f024e95433 \ No newline at end of file diff --git a/hiduniversal_8h__dep__incl.png b/hiduniversal_8h__dep__incl.png index cd29ea34..00e1012a 100644 Binary files a/hiduniversal_8h__dep__incl.png and b/hiduniversal_8h__dep__incl.png differ diff --git a/hiduniversal_8h__incl.map b/hiduniversal_8h__incl.map index e77ab2fb..630ff149 100644 --- a/hiduniversal_8h__incl.map +++ b/hiduniversal_8h__incl.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/hiduniversal_8h__incl.md5 b/hiduniversal_8h__incl.md5 index 6ace9d0f..649b21d3 100644 --- a/hiduniversal_8h__incl.md5 +++ b/hiduniversal_8h__incl.md5 @@ -1 +1 @@ -fb3e74c833bbe1057e984a28f1832b9d \ No newline at end of file +f268788864ba2a6e059e34b990a9ae71 \ No newline at end of file diff --git a/hiduniversal_8h__incl.png b/hiduniversal_8h__incl.png index f62a9d4f..0fb7eb20 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 4c07d6ec..7372d04e 100644 --- a/hiduniversal_8h_source.html +++ b/hiduniversal_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hiduniversal.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -85,115 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    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 __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
    +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 + 1]; // We need to make room for the control endpoint as well
    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
    @@ -229,7 +122,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidusagestr_8h.html b/hidusagestr_8h.html index 7118f969..ed33ba30 100644 --- a/hidusagestr_8h.html +++ b/hidusagestr_8h.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidusagestr.h File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -87,20 +88,52 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidusagestr.h File Reference
    -
    #include "Usb.h"
    +
    #include "Usb.h"
    Include dependency graph for hidusagestr.h:
    - + +
    This graph shows which files directly or indirectly include this file:
    - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    Go to the source code of this file.

    @@ -13858,7 +13891,7 @@ Variables diff --git a/hidusagestr_8h__dep__incl.map b/hidusagestr_8h__dep__incl.map index c9590f4e..85f03829 100644 --- a/hidusagestr_8h__dep__incl.map +++ b/hidusagestr_8h__dep__incl.map @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/hidusagestr_8h__dep__incl.md5 b/hidusagestr_8h__dep__incl.md5 index 0eb2ff23..62d46b1e 100644 --- a/hidusagestr_8h__dep__incl.md5 +++ b/hidusagestr_8h__dep__incl.md5 @@ -1 +1 @@ -d260f18106a148a4ad3a8a96cfefe555 \ No newline at end of file +44208c2c5892f1cc422f061692d78636 \ No newline at end of file diff --git a/hidusagestr_8h__dep__incl.png b/hidusagestr_8h__dep__incl.png index fc429719..9d83c9d0 100644 Binary files a/hidusagestr_8h__dep__incl.png and b/hidusagestr_8h__dep__incl.png differ diff --git a/hidusagestr_8h__incl.map b/hidusagestr_8h__incl.map index 6fae6dd8..95ce7f8f 100644 --- a/hidusagestr_8h__incl.map +++ b/hidusagestr_8h__incl.map @@ -1,3 +1,3 @@ - + diff --git a/hidusagestr_8h__incl.md5 b/hidusagestr_8h__incl.md5 index 98b0c93e..bc04b8cf 100644 --- a/hidusagestr_8h__incl.md5 +++ b/hidusagestr_8h__incl.md5 @@ -1 +1 @@ -5c963a7b7fd1884b649a89fdccf4c385 \ No newline at end of file +794eccf037bd4feb00fd840fe0fc37b3 \ No newline at end of file diff --git a/hidusagestr_8h__incl.png b/hidusagestr_8h__incl.png index 5d04bb69..d4a993ef 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 44a39dff..e152ebbf 100644 --- a/hidusagestr_8h_source.html +++ b/hidusagestr_8h_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidusagestr.h Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -85,984 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidusagestr.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( __HIDUSAGESTR_H__)
    -
    18 #define __HIDUSAGESTR_H__
    -
    19 
    -
    20 #include "Usb.h"
    -
    21 
    -
    22 const char pstrSpace [] PROGMEM = " ";
    -
    23 const char pstrCRLF [] PROGMEM = "\r\n";
    -
    24 const char pstrSingleTab [] PROGMEM = "\t";
    -
    25 const char pstrDoubleTab [] PROGMEM = "\t\t";
    -
    26 const char pstrTripleTab [] PROGMEM = "\t\t\t";
    -
    27 
    -
    28 // Usage Page String Titles
    -
    29 const char pstrUsagePageUndefined [] PROGMEM = "Undef";
    -
    30 const char pstrUsagePageGenericDesktopControls [] PROGMEM = "Gen Desktop Ctrls";
    -
    31 const char pstrUsagePageSimulationControls [] PROGMEM = "Simu Ctrls";
    -
    32 const char pstrUsagePageVRControls [] PROGMEM = "VR Ctrls";
    -
    33 const char pstrUsagePageSportControls [] PROGMEM = "Sport Ctrls";
    -
    34 const char pstrUsagePageGameControls [] PROGMEM = "Game Ctrls";
    -
    35 const char pstrUsagePageGenericDeviceControls [] PROGMEM = "Gen Dev Ctrls";
    -
    36 const char pstrUsagePageKeyboardKeypad [] PROGMEM = "Kbrd/Keypad";
    -
    37 const char pstrUsagePageLEDs [] PROGMEM = "LEDs";
    -
    38 const char pstrUsagePageButton [] PROGMEM = "Button";
    -
    39 const char pstrUsagePageOrdinal [] PROGMEM = "Ordinal";
    -
    40 const char pstrUsagePageTelephone [] PROGMEM = "Tel";
    -
    41 const char pstrUsagePageConsumer [] PROGMEM = "Consumer";
    -
    42 const char pstrUsagePageDigitizer [] PROGMEM = "Digitizer";
    -
    43 const char pstrUsagePagePID [] PROGMEM = "PID";
    -
    44 const char pstrUsagePageUnicode [] PROGMEM = "Unicode";
    -
    45 const char pstrUsagePageAlphaNumericDisplay [] PROGMEM = "Alpha Num Disp";
    -
    46 const char pstrUsagePageMedicalInstruments [] PROGMEM = "Medical Instr";
    -
    47 const char pstrUsagePageMonitor [] PROGMEM = "Monitor";
    -
    48 const char pstrUsagePagePower [] PROGMEM = "Power";
    -
    49 const char pstrUsagePageBarCodeScanner [] PROGMEM = "Bar Code Scan";
    -
    50 const char pstrUsagePageScale [] PROGMEM = "Scale";
    -
    51 const char pstrUsagePageMSRDevices [] PROGMEM = "Magn Stripe Read Dev";
    -
    52 const char pstrUsagePagePointOfSale [] PROGMEM = "POS";
    -
    53 const char pstrUsagePageCameraControl [] PROGMEM = "Cam Ctrl";
    -
    54 const char pstrUsagePageArcade [] PROGMEM = "Arcade";
    -
    55 const char pstrUsagePageReserved [] PROGMEM = "Reserved";
    -
    56 const char pstrUsagePageVendorDefined [] PROGMEM = "Vendor Def";
    -
    57 
    -
    58 // Generic Desktop Controls Page
    -
    59 const char pstrUsagePointer [] PROGMEM = "Pointer";
    -
    60 const char pstrUsageMouse [] PROGMEM = "Mouse";
    -
    61 const char pstrUsageJoystick [] PROGMEM = "Joystick";
    -
    62 const char pstrUsageGamePad [] PROGMEM = "Game Pad";
    -
    63 const char pstrUsageKeyboard [] PROGMEM = "Kbrd";
    -
    64 const char pstrUsageKeypad [] PROGMEM = "Keypad";
    -
    65 const char pstrUsageMultiAxisController [] PROGMEM = "Multi-axis Ctrl";
    -
    66 const char pstrUsageTabletPCSystemControls [] PROGMEM = "Tablet PC Sys Ctrls";
    -
    67 const char pstrUsageX [] PROGMEM = "X";
    -
    68 const char pstrUsageY [] PROGMEM = "Y";
    -
    69 const char pstrUsageZ [] PROGMEM = "Z";
    -
    70 const char pstrUsageRx [] PROGMEM = "Rx";
    -
    71 const char pstrUsageRy [] PROGMEM = "Ry";
    -
    72 const char pstrUsageRz [] PROGMEM = "Rz";
    -
    73 const char pstrUsageSlider [] PROGMEM = "Slider";
    -
    74 const char pstrUsageDial [] PROGMEM = "Dial";
    -
    75 const char pstrUsageWheel [] PROGMEM = "Wheel";
    -
    76 const char pstrUsageHatSwitch [] PROGMEM = "Hat Switch";
    -
    77 const char pstrUsageCountedBuffer [] PROGMEM = "Counted Buf";
    -
    78 const char pstrUsageByteCount [] PROGMEM = "Byte Count";
    -
    79 const char pstrUsageMotionWakeup [] PROGMEM = "Motion Wakeup";
    -
    80 const char pstrUsageStart [] PROGMEM = "Start";
    -
    81 const char pstrUsageSelect [] PROGMEM = "Sel";
    -
    82 const char pstrUsageVx [] PROGMEM = "Vx";
    -
    83 const char pstrUsageVy [] PROGMEM = "Vy";
    -
    84 const char pstrUsageVz [] PROGMEM = "Vz";
    -
    85 const char pstrUsageVbrx [] PROGMEM = "Vbrx";
    -
    86 const char pstrUsageVbry [] PROGMEM = "Vbry";
    -
    87 const char pstrUsageVbrz [] PROGMEM = "Vbrz";
    -
    88 const char pstrUsageVno [] PROGMEM = "Vno";
    -
    89 const char pstrUsageFeatureNotification [] PROGMEM = "Feature Notif";
    -
    90 const char pstrUsageResolutionMultiplier [] PROGMEM = "Res Mult";
    -
    91 const char pstrUsageSystemControl [] PROGMEM = "Sys Ctrl";
    -
    92 const char pstrUsageSystemPowerDown [] PROGMEM = "Sys Pwr Down";
    -
    93 const char pstrUsageSystemSleep [] PROGMEM = "Sys Sleep";
    -
    94 const char pstrUsageSystemWakeup [] PROGMEM = "Sys Wakeup";
    -
    95 const char pstrUsageSystemContextMenu [] PROGMEM = "Sys Context Menu";
    -
    96 const char pstrUsageSystemMainMenu [] PROGMEM = "Sys Main Menu";
    -
    97 const char pstrUsageSystemAppMenu [] PROGMEM = "Sys App Menu";
    -
    98 const char pstrUsageSystemMenuHelp [] PROGMEM = "Sys Menu Help";
    -
    99 const char pstrUsageSystemMenuExit [] PROGMEM = "Sys Menu Exit";
    -
    100 const char pstrUsageSystemMenuSelect [] PROGMEM = "Sys Menu Select";
    -
    101 const char pstrUsageSystemMenuRight [] PROGMEM = "Sys Menu Right";
    -
    102 const char pstrUsageSystemMenuLeft [] PROGMEM = "Sys Menu Left";
    -
    103 const char pstrUsageSystemMenuUp [] PROGMEM = "Sys Menu Up";
    -
    104 const char pstrUsageSystemMenuDown [] PROGMEM = "Sys Menu Down";
    -
    105 const char pstrUsageSystemColdRestart [] PROGMEM = "Sys Cold Restart";
    -
    106 const char pstrUsageSystemWarmRestart [] PROGMEM = "Sys Warm Restart";
    -
    107 const char pstrUsageDPadUp [] PROGMEM = "D-pad Up";
    -
    108 const char pstrUsageDPadDown [] PROGMEM = "D-pad Down";
    -
    109 const char pstrUsageDPadRight [] PROGMEM = "D-pad Right";
    -
    110 const char pstrUsageDPadLeft [] PROGMEM = "D-pad Left";
    -
    111 const char pstrUsageSystemDock [] PROGMEM = "Sys Dock";
    -
    112 const char pstrUsageSystemUndock [] PROGMEM = "Sys Undock";
    -
    113 const char pstrUsageSystemSetup [] PROGMEM = "Sys Setup";
    -
    114 const char pstrUsageSystemBreak [] PROGMEM = "Sys Break";
    -
    115 const char pstrUsageSystemDebuggerBreak [] PROGMEM = "Sys Dbg Brk";
    -
    116 const char pstrUsageApplicationBreak [] PROGMEM = "App Break";
    -
    117 const char pstrUsageApplicationDebuggerBreak [] PROGMEM = "App Dbg Brk";
    -
    118 const char pstrUsageSystemSpeakerMute [] PROGMEM = "Sys Spk Mute";
    -
    119 const char pstrUsageSystemHibernate [] PROGMEM = "Sys Hiber";
    -
    120 const char pstrUsageSystemDisplayInvert [] PROGMEM = "Sys Disp Inv";
    -
    121 const char pstrUsageSystemDisplayInternal [] PROGMEM = "Sys Disp Int";
    -
    122 const char pstrUsageSystemDisplayExternal [] PROGMEM = "Sys Disp Ext";
    -
    123 const char pstrUsageSystemDisplayBoth [] PROGMEM = "Sys Disp Both";
    -
    124 const char pstrUsageSystemDisplayDual [] PROGMEM = "Sys Disp Dual";
    -
    125 const char pstrUsageSystemDisplayToggleIntExt [] PROGMEM = "Sys Disp Tgl Int/Ext";
    -
    126 const char pstrUsageSystemDisplaySwapPriSec [] PROGMEM = "Sys Disp Swap Pri/Sec";
    -
    127 const char pstrUsageSystemDisplayLCDAutoscale [] PROGMEM = "Sys Disp LCD Autoscale";
    -
    128 
    -
    129 // Simulation Controls Page
    -
    130 const char pstrUsageFlightSimulationDevice [] PROGMEM = "Flight Simu Dev";
    -
    131 const char pstrUsageAutomobileSimulationDevice [] PROGMEM = "Auto Simu Dev";
    -
    132 const char pstrUsageTankSimulationDevice [] PROGMEM = "Tank Simu Dev";
    -
    133 const char pstrUsageSpaceshipSimulationDevice [] PROGMEM = "Space Simu Dev";
    -
    134 const char pstrUsageSubmarineSimulationDevice [] PROGMEM = "Subm Simu Dev";
    -
    135 const char pstrUsageSailingSimulationDevice [] PROGMEM = "Sail Simu Dev";
    -
    136 const char pstrUsageMotocicleSimulationDevice [] PROGMEM = "Moto Simu Dev";
    -
    137 const char pstrUsageSportsSimulationDevice [] PROGMEM = "Sport Simu Dev";
    -
    138 const char pstrUsageAirplaneSimulationDevice [] PROGMEM = "Airp Simu Dev";
    -
    139 const char pstrUsageHelicopterSimulationDevice [] PROGMEM = "Heli Simu Dev";
    -
    140 const char pstrUsageMagicCarpetSimulationDevice [] PROGMEM = "Magic Carpet Simu Dev";
    -
    141 const char pstrUsageBicycleSimulationDevice [] PROGMEM = "Bike Simu Dev";
    -
    142 const char pstrUsageFlightControlStick [] PROGMEM = "Flight Ctrl Stick";
    -
    143 const char pstrUsageFlightStick [] PROGMEM = "Flight Stick";
    -
    144 const char pstrUsageCyclicControl [] PROGMEM = "Cyclic Ctrl";
    -
    145 const char pstrUsageCyclicTrim [] PROGMEM = "Cyclic Trim";
    -
    146 const char pstrUsageFlightYoke [] PROGMEM = "Flight Yoke";
    -
    147 const char pstrUsageTrackControl [] PROGMEM = "Track Ctrl";
    -
    148 const char pstrUsageAileron [] PROGMEM = "Aileron";
    -
    149 const char pstrUsageAileronTrim [] PROGMEM = "Aileron Trim";
    -
    150 const char pstrUsageAntiTorqueControl [] PROGMEM = "Anti-Torque Ctrl";
    -
    151 const char pstrUsageAutopilotEnable [] PROGMEM = "Autopilot Enable";
    -
    152 const char pstrUsageChaffRelease [] PROGMEM = "Chaff Release";
    -
    153 const char pstrUsageCollectiveControl [] PROGMEM = "Collective Ctrl";
    -
    154 const char pstrUsageDiveBrake [] PROGMEM = "Dive Brake";
    -
    155 const char pstrUsageElectronicCountermeasures [] PROGMEM = "El Countermeasures";
    -
    156 const char pstrUsageElevator [] PROGMEM = "Elevator";
    -
    157 const char pstrUsageElevatorTrim [] PROGMEM = "Elevator Trim";
    -
    158 const char pstrUsageRudder [] PROGMEM = "Rudder";
    -
    159 const char pstrUsageThrottle [] PROGMEM = "Throttle";
    -
    160 const char pstrUsageFlightCommunications [] PROGMEM = "Flight Comm";
    -
    161 const char pstrUsageFlareRelease [] PROGMEM = "Flare Release";
    -
    162 const char pstrUsageLandingGear [] PROGMEM = "Landing Gear";
    -
    163 const char pstrUsageToeBrake [] PROGMEM = "Toe Brake";
    -
    164 const char pstrUsageTrigger [] PROGMEM = "Trigger";
    -
    165 const char pstrUsageWeaponsArm [] PROGMEM = "Weapons Arm";
    -
    166 const char pstrUsageWeaponsSelect [] PROGMEM = "Weapons Sel";
    -
    167 const char pstrUsageWingFlaps [] PROGMEM = "Wing Flaps";
    -
    168 const char pstrUsageAccelerator [] PROGMEM = "Accel";
    -
    169 const char pstrUsageBrake [] PROGMEM = "Brake";
    -
    170 const char pstrUsageClutch [] PROGMEM = "Clutch";
    -
    171 const char pstrUsageShifter [] PROGMEM = "Shifter";
    -
    172 const char pstrUsageSteering [] PROGMEM = "Steering";
    -
    173 const char pstrUsageTurretDirection [] PROGMEM = "Turret Dir";
    -
    174 const char pstrUsageBarrelElevation [] PROGMEM = "Barrel Ele";
    -
    175 const char pstrUsageDivePlane [] PROGMEM = "Dive Plane";
    -
    176 const char pstrUsageBallast [] PROGMEM = "Ballast";
    -
    177 const char pstrUsageBicycleCrank [] PROGMEM = "Bicycle Crank";
    -
    178 const char pstrUsageHandleBars [] PROGMEM = "Handle Bars";
    -
    179 const char pstrUsageFrontBrake [] PROGMEM = "Front Brake";
    -
    180 const char pstrUsageRearBrake [] PROGMEM = "Rear Brake";
    -
    181 
    -
    182 // VR Controls Page
    -
    183 const char pstrUsageBelt [] PROGMEM = "Belt";
    -
    184 const char pstrUsageBodySuit [] PROGMEM = "Body Suit";
    -
    185 const char pstrUsageFlexor [] PROGMEM = "Flexor";
    -
    186 const char pstrUsageGlove [] PROGMEM = "Glove";
    -
    187 const char pstrUsageHeadTracker [] PROGMEM = "Head Track";
    -
    188 const char pstrUsageHeadMountedDisplay [] PROGMEM = "Head Disp";
    -
    189 const char pstrUsageHandTracker [] PROGMEM = "Hand Track";
    -
    190 const char pstrUsageOculometer [] PROGMEM = "Oculometer";
    -
    191 const char pstrUsageVest [] PROGMEM = "Vest";
    -
    192 const char pstrUsageAnimatronicDevice [] PROGMEM = "Animat Dev";
    -
    193 const char pstrUsageStereoEnable [] PROGMEM = "Stereo Enbl";
    -
    194 const char pstrUsageDisplayEnable [] PROGMEM = "Display Enbl";
    -
    195 
    -
    196 // Sport Controls Page
    -
    197 const char pstrUsageBaseballBat [] PROGMEM = "Baseball Bat";
    -
    198 const char pstrUsageGolfClub [] PROGMEM = "Golf Club";
    -
    199 const char pstrUsageRowingMachine [] PROGMEM = "Rowing Mach";
    -
    200 const char pstrUsageTreadmill [] PROGMEM = "Treadmill";
    -
    201 const char pstrUsageOar [] PROGMEM = "Oar";
    -
    202 const char pstrUsageSlope [] PROGMEM = "Slope";
    -
    203 const char pstrUsageRate [] PROGMEM = "Rate";
    -
    204 const char pstrUsageStickSpeed [] PROGMEM = "Stick Speed";
    -
    205 const char pstrUsageStickFaceAngle [] PROGMEM = "Stick Face Ang";
    -
    206 const char pstrUsageStickHeelToe [] PROGMEM = "Stick Heel/Toe";
    -
    207 const char pstrUsageStickFollowThough [] PROGMEM = "Stick Flw Thru";
    -
    208 const char pstrUsageStickTempo [] PROGMEM = "Stick Tempo";
    -
    209 const char pstrUsageStickType [] PROGMEM = "Stick Type";
    -
    210 const char pstrUsageStickHeight [] PROGMEM = "Stick Hght";
    -
    211 const char pstrUsagePutter [] PROGMEM = "Putter";
    -
    212 const char pstrUsage1Iron [] PROGMEM = "1 Iron";
    -
    213 const char pstrUsage2Iron [] PROGMEM = "2 Iron";
    -
    214 const char pstrUsage3Iron [] PROGMEM = "3 Iron";
    -
    215 const char pstrUsage4Iron [] PROGMEM = "4 Iron";
    -
    216 const char pstrUsage5Iron [] PROGMEM = "5 Iron";
    -
    217 const char pstrUsage6Iron [] PROGMEM = "6 Iron";
    -
    218 const char pstrUsage7Iron [] PROGMEM = "7 Iron";
    -
    219 const char pstrUsage8Iron [] PROGMEM = "8 Iron";
    -
    220 const char pstrUsage9Iron [] PROGMEM = "9 Iron";
    -
    221 const char pstrUsage10Iron [] PROGMEM = "10 Iron";
    -
    222 const char pstrUsage11Iron [] PROGMEM = "11 Iron";
    -
    223 const char pstrUsageSandWedge [] PROGMEM = "Sand Wedge";
    -
    224 const char pstrUsageLoftWedge [] PROGMEM = "Loft Wedge";
    -
    225 const char pstrUsagePowerWedge [] PROGMEM = "Pwr Wedge";
    -
    226 const char pstrUsage1Wood [] PROGMEM = "1 Wood";
    -
    227 const char pstrUsage3Wood [] PROGMEM = "3 Wood";
    -
    228 const char pstrUsage5Wood [] PROGMEM = "5 Wood";
    -
    229 const char pstrUsage7Wood [] PROGMEM = "7 Wood";
    -
    230 const char pstrUsage9Wood [] PROGMEM = "9 Wood";
    -
    231 
    -
    232 // Game Controls Page
    -
    233 const char pstrUsage3DGameController [] PROGMEM = "3D Game Ctrl";
    -
    234 const char pstrUsagePinballDevice [] PROGMEM = "Pinball Dev";
    -
    235 const char pstrUsageGunDevice [] PROGMEM = "Gun Dev";
    -
    236 const char pstrUsagePointOfView [] PROGMEM = "POV";
    -
    237 const char pstrUsageTurnRightLeft [] PROGMEM = "Turn Right Left";
    -
    238 const char pstrUsagePitchForwardBackward [] PROGMEM = "Pitch Fwd/Back";
    -
    239 const char pstrUsageRollRightLeft [] PROGMEM = "Roll Right/Left";
    -
    240 const char pstrUsageMoveRightLeft [] PROGMEM = "Move Right/Left";
    -
    241 const char pstrUsageMoveForwardBackward [] PROGMEM = "Move Fwd/Back";
    -
    242 const char pstrUsageMoveUpDown [] PROGMEM = "Move Up/Down";
    -
    243 const char pstrUsageLeanRightLeft [] PROGMEM = "Lean Right/Left";
    -
    244 const char pstrUsageLeanForwardBackward [] PROGMEM = "Lean Fwd/Back";
    -
    245 const char pstrUsageHeightOfPOV [] PROGMEM = "Height of POV";
    -
    246 const char pstrUsageFlipper [] PROGMEM = "Flipper";
    -
    247 const char pstrUsageSecondaryFlipper [] PROGMEM = "Second Flipper";
    -
    248 const char pstrUsageBump [] PROGMEM = "Bump";
    -
    249 const char pstrUsageNewGame [] PROGMEM = "New Game";
    -
    250 const char pstrUsageShootBall [] PROGMEM = "Shoot Ball";
    -
    251 const char pstrUsagePlayer [] PROGMEM = "Player";
    -
    252 const char pstrUsageGunBolt [] PROGMEM = "Gun Bolt";
    -
    253 const char pstrUsageGunClip [] PROGMEM = "Gun Clip";
    -
    254 const char pstrUsageGunSelector [] PROGMEM = "Gun Sel";
    -
    255 const char pstrUsageGunSingleShot [] PROGMEM = "Gun Sngl Shot";
    -
    256 const char pstrUsageGunBurst [] PROGMEM = "Gun Burst";
    -
    257 const char pstrUsageGunAutomatic [] PROGMEM = "Gun Auto";
    -
    258 const char pstrUsageGunSafety [] PROGMEM = "Gun Safety";
    -
    259 const char pstrUsageGamepadFireJump [] PROGMEM = "Gamepad Fire/Jump";
    -
    260 const char pstrUsageGamepadTrigger [] PROGMEM = "Gamepad Trig";
    -
    261 
    -
    262 // Generic Device Controls Page
    -
    263 const char pstrUsageBatteryStrength [] PROGMEM = "Bat Strength";
    -
    264 const char pstrUsageWirelessChannel [] PROGMEM = "Wireless Ch";
    -
    265 const char pstrUsageWirelessID [] PROGMEM = "Wireless ID";
    -
    266 const char pstrUsageDiscoverWirelessControl [] PROGMEM = "Discover Wireless Ctrl";
    -
    267 const char pstrUsageSecurityCodeCharEntered [] PROGMEM = "Sec Code Char Entrd";
    -
    268 const char pstrUsageSecurityCodeCharErased [] PROGMEM = "Sec Code Char Erased";
    -
    269 const char pstrUsageSecurityCodeCleared [] PROGMEM = "Sec Code Cleared";
    -
    270 
    -
    271 // LED Page
    -
    272 const char pstrUsageNumLock [] PROGMEM = "Num Lock";
    -
    273 const char pstrUsageCapsLock [] PROGMEM = "Caps Lock";
    -
    274 const char pstrUsageScrollLock [] PROGMEM = "Scroll Lock";
    -
    275 const char pstrUsageCompose [] PROGMEM = "Compose";
    -
    276 const char pstrUsageKana [] PROGMEM = "Kana";
    -
    277 const char pstrUsagePower [] PROGMEM = "Pwr";
    -
    278 const char pstrUsageShift [] PROGMEM = "Shift";
    -
    279 const char pstrUsageDoNotDisturb [] PROGMEM = "DND";
    -
    280 const char pstrUsageMute [] PROGMEM = "Mute";
    -
    281 const char pstrUsageToneEnable [] PROGMEM = "Tone Enbl";
    -
    282 const char pstrUsageHighCutFilter [] PROGMEM = "High Cut Fltr";
    -
    283 const char pstrUsageLowCutFilter [] PROGMEM = "Low Cut Fltr";
    -
    284 const char pstrUsageEqualizerEnable [] PROGMEM = "Eq Enbl";
    -
    285 const char pstrUsageSoundFieldOn [] PROGMEM = "Sound Field On";
    -
    286 const char pstrUsageSurroundOn [] PROGMEM = "Surround On";
    -
    287 const char pstrUsageRepeat [] PROGMEM = "Repeat";
    -
    288 const char pstrUsageStereo [] PROGMEM = "Stereo";
    -
    289 const char pstrUsageSamplingRateDetect [] PROGMEM = "Smpl Rate Detect";
    -
    290 const char pstrUsageSpinning [] PROGMEM = "Spinning";
    -
    291 const char pstrUsageCAV [] PROGMEM = "CAV";
    -
    292 const char pstrUsageCLV [] PROGMEM = "CLV";
    -
    293 const char pstrUsageRecordingFormatDetect [] PROGMEM = "Rec Format Detect";
    -
    294 const char pstrUsageOffHook [] PROGMEM = "Off Hook";
    -
    295 const char pstrUsageRing [] PROGMEM = "Ring";
    -
    296 const char pstrUsageMessageWaiting [] PROGMEM = "Msg Wait";
    -
    297 const char pstrUsageDataMode [] PROGMEM = "Data Mode";
    -
    298 const char pstrUsageBatteryOperation [] PROGMEM = "Bat Op";
    -
    299 const char pstrUsageBatteryOK [] PROGMEM = "Bat OK";
    -
    300 const char pstrUsageBatteryLow [] PROGMEM = "Bat Low";
    -
    301 const char pstrUsageSpeaker [] PROGMEM = "Speaker";
    -
    302 const char pstrUsageHeadSet [] PROGMEM = "Head Set";
    -
    303 const char pstrUsageHold [] PROGMEM = "Hold";
    -
    304 const char pstrUsageMicrophone [] PROGMEM = "Mic";
    -
    305 const char pstrUsageCoverage [] PROGMEM = "Coverage";
    -
    306 const char pstrUsageNightMode [] PROGMEM = "Night Mode";
    -
    307 const char pstrUsageSendCalls [] PROGMEM = "Send Calls";
    -
    308 const char pstrUsageCallPickup [] PROGMEM = "Call Pickup";
    -
    309 const char pstrUsageConference [] PROGMEM = "Conf";
    -
    310 const char pstrUsageStandBy [] PROGMEM = "Stand-by";
    -
    311 const char pstrUsageCameraOn [] PROGMEM = "Cam On";
    -
    312 const char pstrUsageCameraOff [] PROGMEM = "Cam Off";
    -
    313 const char pstrUsageOnLine [] PROGMEM = "On-Line";
    -
    314 const char pstrUsageOffLine [] PROGMEM = "Off-Line";
    -
    315 const char pstrUsageBusy [] PROGMEM = "Busy";
    -
    316 const char pstrUsageReady [] PROGMEM = "Ready";
    -
    317 const char pstrUsagePaperOut [] PROGMEM = "Paper Out";
    -
    318 const char pstrUsagePaperJam [] PROGMEM = "Paper Jam";
    -
    319 const char pstrUsageRemote [] PROGMEM = "Remote";
    -
    320 const char pstrUsageForward [] PROGMEM = "Fwd";
    -
    321 const char pstrUsageReverse [] PROGMEM = "Rev";
    -
    322 const char pstrUsageStop [] PROGMEM = "Stop";
    -
    323 const char pstrUsageRewind [] PROGMEM = "Rewind";
    -
    324 const char pstrUsageFastForward [] PROGMEM = "Fast Fwd";
    -
    325 const char pstrUsagePlay [] PROGMEM = "Play";
    -
    326 const char pstrUsagePause [] PROGMEM = "Pause";
    -
    327 const char pstrUsageRecord [] PROGMEM = "Rec";
    -
    328 const char pstrUsageError [] PROGMEM = "Error";
    -
    329 const char pstrUsageSelectedIndicator [] PROGMEM = "Usage Sel Ind";
    -
    330 const char pstrUsageInUseIndicator [] PROGMEM = "Usage In Use Ind";
    -
    331 const char pstrUsageMultiModeIndicator [] PROGMEM = "Usage Multi Mode Ind";
    -
    332 const char pstrUsageIndicatorOn [] PROGMEM = "Ind On";
    -
    333 const char pstrUsageIndicatorFlash [] PROGMEM = "Ind Flash";
    -
    334 const char pstrUsageIndicatorSlowBlink [] PROGMEM = "Ind Slow Blk";
    -
    335 const char pstrUsageIndicatorFastBlink [] PROGMEM = "Ind Fast Blk";
    -
    336 const char pstrUsageIndicatorOff [] PROGMEM = "Ind Off";
    -
    337 const char pstrUsageFlashOnTime [] PROGMEM = "Flash On Time";
    -
    338 const char pstrUsageSlowBlinkOnTime [] PROGMEM = "Slow Blk On Time";
    -
    339 const char pstrUsageSlowBlinkOffTime [] PROGMEM = "Slow Blk Off Time";
    -
    340 const char pstrUsageFastBlinkOnTime [] PROGMEM = "Fast Blk On Time";
    -
    341 const char pstrUsageFastBlinkOffTime [] PROGMEM = "Fast Blk Off Time";
    -
    342 const char pstrUsageIndicatorColor [] PROGMEM = "Usage Ind Color";
    -
    343 const char pstrUsageIndicatorRed [] PROGMEM = "Ind Red";
    -
    344 const char pstrUsageIndicatorGreen [] PROGMEM = "Ind Green";
    -
    345 const char pstrUsageIndicatorAmber [] PROGMEM = "Ind Amber";
    -
    346 const char pstrUsageGenericIndicator [] PROGMEM = "Gen Ind";
    -
    347 const char pstrUsageSystemSuspend [] PROGMEM = "Sys Suspend";
    -
    348 const char pstrUsageExternalPowerConnected [] PROGMEM = "Ext Pwr Conn";
    -
    349 
    -
    350 // Telephony Usage Page
    -
    351 const char pstrUsagePhone [] PROGMEM = "Phone";
    -
    352 const char pstrUsageAnsweringMachine [] PROGMEM = "Answ Mach";
    -
    353 const char pstrUsageMessageControls [] PROGMEM = "Msg Ctrls";
    -
    354 const char pstrUsageHandset [] PROGMEM = "Handset";
    -
    355 const char pstrUsageHeadset [] PROGMEM = "Headset";
    -
    356 const char pstrUsageTelephonyKeyPad [] PROGMEM = "Tel Key Pad";
    -
    357 const char pstrUsageProgrammableButton [] PROGMEM = "Prog Button";
    -
    358 const char pstrUsageHookSwitch [] PROGMEM = "Hook Sw";
    -
    359 const char pstrUsageFlash [] PROGMEM = "Flash";
    -
    360 const char pstrUsageFeature [] PROGMEM = "Feature";
    -
    361 //const char pstrUsageHold [] PROGMEM = "Hold";
    -
    362 const char pstrUsageRedial [] PROGMEM = "Redial";
    -
    363 const char pstrUsageTransfer [] PROGMEM = "Transfer";
    -
    364 const char pstrUsageDrop [] PROGMEM = "Drop";
    -
    365 const char pstrUsagePark [] PROGMEM = "Park";
    -
    366 const char pstrUsageForwardCalls [] PROGMEM = "Fwd Calls";
    -
    367 const char pstrUsageAlternateFunction [] PROGMEM = "Alt Func";
    -
    368 const char pstrUsageLine [] PROGMEM = "Line";
    -
    369 const char pstrUsageSpeakerPhone [] PROGMEM = "Spk Phone";
    -
    370 //const char pstrUsageConference [] PROGMEM = "Conference";
    -
    371 const char pstrUsageRingEnable [] PROGMEM = "Ring Enbl";
    -
    372 const char pstrUsageRingSelect [] PROGMEM = "Ring Sel";
    -
    373 const char pstrUsagePhoneMute [] PROGMEM = "Phone Mute";
    -
    374 const char pstrUsageCallerID [] PROGMEM = "Caller ID";
    -
    375 const char pstrUsageSend [] PROGMEM = "Send";
    -
    376 const char pstrUsageSpeedDial [] PROGMEM = "Speed Dial";
    -
    377 const char pstrUsageStoreNumber [] PROGMEM = "Store Num";
    -
    378 const char pstrUsageRecallNumber [] PROGMEM = "Recall Num";
    -
    379 const char pstrUsagePhoneDirectory [] PROGMEM = "Phone Dir";
    -
    380 const char pstrUsageVoiceMail [] PROGMEM = "Voice Mail";
    -
    381 const char pstrUsageScreenCalls [] PROGMEM = "Screen Calls";
    -
    382 //const char pstrUsageDoNotDisturb [] PROGMEM = "Do Not Disturb";
    -
    383 const char pstrUsageMessage [] PROGMEM = "Msg";
    -
    384 const char pstrUsageAnswerOnOff [] PROGMEM = "Answer On/Off";
    -
    385 const char pstrUsageInsideDialTone [] PROGMEM = "Inside Dial Tone";
    -
    386 const char pstrUsageOutsideDialTone [] PROGMEM = "Outside Dial Tone";
    -
    387 const char pstrUsageInsideRingTone [] PROGMEM = "Inside Ring Tone";
    -
    388 const char pstrUsageOutsideRingTone [] PROGMEM = "Outside Ring Tone";
    -
    389 const char pstrUsagePriorityRingTone [] PROGMEM = "Prior Ring Tone";
    -
    390 const char pstrUsageInsideRingback [] PROGMEM = "Inside Ringback";
    -
    391 const char pstrUsagePriorityRingback [] PROGMEM = "Priority Ringback";
    -
    392 const char pstrUsageLineBusyTone [] PROGMEM = "Ln Busy Tone";
    -
    393 const char pstrUsageReorderTone [] PROGMEM = "Reorder Tone";
    -
    394 const char pstrUsageCallWaitingTone [] PROGMEM = "Call Wait Tone";
    -
    395 const char pstrUsageConfirmationTone1 [] PROGMEM = "Cnfrm Tone1";
    -
    396 const char pstrUsageConfirmationTone2 [] PROGMEM = "Cnfrm Tone2";
    -
    397 const char pstrUsageTonesOff [] PROGMEM = "Tones Off";
    -
    398 const char pstrUsageOutsideRingback [] PROGMEM = "Outside Ringback";
    -
    399 const char pstrUsageRinger [] PROGMEM = "Ringer";
    -
    400 const char pstrUsagePhoneKey0 [] PROGMEM = "0";
    -
    401 const char pstrUsagePhoneKey1 [] PROGMEM = "1";
    -
    402 const char pstrUsagePhoneKey2 [] PROGMEM = "2";
    -
    403 const char pstrUsagePhoneKey3 [] PROGMEM = "3";
    -
    404 const char pstrUsagePhoneKey4 [] PROGMEM = "4";
    -
    405 const char pstrUsagePhoneKey5 [] PROGMEM = "5";
    -
    406 const char pstrUsagePhoneKey6 [] PROGMEM = "6";
    -
    407 const char pstrUsagePhoneKey7 [] PROGMEM = "7";
    -
    408 const char pstrUsagePhoneKey8 [] PROGMEM = "8";
    -
    409 const char pstrUsagePhoneKey9 [] PROGMEM = "9";
    -
    410 const char pstrUsagePhoneKeyStar [] PROGMEM = "*";
    -
    411 const char pstrUsagePhoneKeyPound [] PROGMEM = "#";
    -
    412 const char pstrUsagePhoneKeyA [] PROGMEM = "A";
    -
    413 const char pstrUsagePhoneKeyB [] PROGMEM = "B";
    -
    414 const char pstrUsagePhoneKeyC [] PROGMEM = "C";
    -
    415 const char pstrUsagePhoneKeyD [] PROGMEM = "D";
    -
    416 
    -
    417 // Consumer Usage Page
    -
    418 const char pstrUsageConsumerControl [] PROGMEM = "Consumer Ctrl";
    -
    419 const char pstrUsageNumericKeyPad [] PROGMEM = "Num Key Pad";
    -
    420 //const char pstrUsageProgrammableButton [] PROGMEM = "Prog Btn";
    -
    421 //const char pstrUsageMicrophone [] PROGMEM = "Mic";
    -
    422 const char pstrUsageHeadphone [] PROGMEM = "Headphone";
    -
    423 const char pstrUsageGraphicEqualizer [] PROGMEM = "Graph Eq";
    -
    424 const char pstrUsagePlus10 [] PROGMEM = "+10";
    -
    425 const char pstrUsagePlus100 [] PROGMEM = "+100";
    -
    426 const char pstrUsageAMPM [] PROGMEM = "AM/PM";
    -
    427 //const char pstrUsagePower [] PROGMEM = "Pwr";
    -
    428 const char pstrUsageReset [] PROGMEM = "Reset";
    -
    429 const char pstrUsageSleep [] PROGMEM = "Sleep";
    -
    430 const char pstrUsageSleepAfter [] PROGMEM = "Sleep After";
    -
    431 const char pstrUsageSleepMode [] PROGMEM = "Sleep Mode";
    -
    432 const char pstrUsageIllumination [] PROGMEM = "Illumin";
    -
    433 const char pstrUsageFunctionButtons [] PROGMEM = "Func Btns";
    -
    434 const char pstrUsageMenu [] PROGMEM = "Menu";
    -
    435 const char pstrUsageMenuPick [] PROGMEM = "Menu Pick";
    -
    436 const char pstrUsageMenuUp [] PROGMEM = "Menu Up";
    -
    437 const char pstrUsageMenuDown [] PROGMEM = "Menu Down";
    -
    438 const char pstrUsageMenuLeft [] PROGMEM = "Menu Left";
    -
    439 const char pstrUsageMenuRight [] PROGMEM = "Menu Right";
    -
    440 const char pstrUsageMenuEscape [] PROGMEM = "Menu Esc";
    -
    441 const char pstrUsageMenuValueIncrease [] PROGMEM = "Menu Val Inc";
    -
    442 const char pstrUsageMenuValueDecrease [] PROGMEM = "Menu Val Dec";
    -
    443 const char pstrUsageDataOnScreen [] PROGMEM = "Data On Scr";
    -
    444 const char pstrUsageClosedCaption [] PROGMEM = "Closed Cptn";
    -
    445 const char pstrUsageClosedCaptionSelect [] PROGMEM = "Closed Cptn Sel";
    -
    446 const char pstrUsageVCRTV [] PROGMEM = "VCR/TV";
    -
    447 const char pstrUsageBroadcastMode [] PROGMEM = "Brdcast Mode";
    -
    448 const char pstrUsageSnapshot [] PROGMEM = "Snapshot";
    -
    449 const char pstrUsageStill [] PROGMEM = "Still";
    -
    450 const char pstrUsageSelection [] PROGMEM = "Sel";
    -
    451 const char pstrUsageAssignSelection [] PROGMEM = "Assign Sel";
    -
    452 const char pstrUsageModeStep [] PROGMEM = "Mode Step";
    -
    453 const char pstrUsageRecallLast [] PROGMEM = "Recall Last";
    -
    454 const char pstrUsageEnterChannel [] PROGMEM = "Entr Channel";
    -
    455 const char pstrUsageOrderMovie [] PROGMEM = "Ord Movie";
    -
    456 const char pstrUsageChannel [] PROGMEM = "Channel";
    -
    457 const char pstrUsageMediaSelection [] PROGMEM = "Med Sel";
    -
    458 const char pstrUsageMediaSelectComputer [] PROGMEM = "Med Sel Comp";
    -
    459 const char pstrUsageMediaSelectTV [] PROGMEM = "Med Sel TV";
    -
    460 const char pstrUsageMediaSelectWWW [] PROGMEM = "Med Sel WWW";
    -
    461 const char pstrUsageMediaSelectDVD [] PROGMEM = "Med Sel DVD";
    -
    462 const char pstrUsageMediaSelectTelephone [] PROGMEM = "Med Sel Tel";
    -
    463 const char pstrUsageMediaSelectProgramGuide [] PROGMEM = "Med Sel PG";
    -
    464 const char pstrUsageMediaSelectVideoPhone [] PROGMEM = "Med Sel Vid";
    -
    465 const char pstrUsageMediaSelectGames [] PROGMEM = "Med Sel Games";
    -
    466 const char pstrUsageMediaSelectMessages [] PROGMEM = "Med Sel Msg";
    -
    467 const char pstrUsageMediaSelectCD [] PROGMEM = "Med Sel CD";
    -
    468 const char pstrUsageMediaSelectVCR [] PROGMEM = "Med Sel VCR";
    -
    469 const char pstrUsageMediaSelectTuner [] PROGMEM = "Med Sel Tuner";
    -
    470 const char pstrUsageQuit [] PROGMEM = "Quit";
    -
    471 const char pstrUsageHelp [] PROGMEM = "Help";
    -
    472 const char pstrUsageMediaSelectTape [] PROGMEM = "Med Sel Tape";
    -
    473 const char pstrUsageMediaSelectCable [] PROGMEM = "Med Sel Cbl";
    -
    474 const char pstrUsageMediaSelectSatellite [] PROGMEM = "Med Sel Sat";
    -
    475 const char pstrUsageMediaSelectSecurity [] PROGMEM = "Med Sel Secur";
    -
    476 const char pstrUsageMediaSelectHome [] PROGMEM = "Med Sel Home";
    -
    477 const char pstrUsageMediaSelectCall [] PROGMEM = "Med Sel Call";
    -
    478 const char pstrUsageChannelIncrement [] PROGMEM = "Ch Inc";
    -
    479 const char pstrUsageChannelDecrement [] PROGMEM = "Ch Dec";
    -
    480 const char pstrUsageMediaSelectSAP [] PROGMEM = "Med Sel SAP";
    -
    481 const char pstrUsageVCRPlus [] PROGMEM = "VCR+";
    -
    482 const char pstrUsageOnce [] PROGMEM = "Once";
    -
    483 const char pstrUsageDaily [] PROGMEM = "Daily";
    -
    484 const char pstrUsageWeekly [] PROGMEM = "Weekly";
    -
    485 const char pstrUsageMonthly [] PROGMEM = "Monthly";
    -
    486 //const char pstrUsagePlay [] PROGMEM = "Play";
    -
    487 //const char pstrUsagePause [] PROGMEM = "Pause";
    -
    488 //const char pstrUsageRecord [] PROGMEM = "Rec";
    -
    489 //const char pstrUsageFastForward [] PROGMEM = "FF";
    -
    490 //const char pstrUsageRewind [] PROGMEM = "Rewind";
    -
    491 const char pstrUsageScanNextTrack [] PROGMEM = "Next Track";
    -
    492 const char pstrUsageScanPreviousTrack [] PROGMEM = "Prev Track";
    -
    493 //const char pstrUsageStop [] PROGMEM = "Stop";
    -
    494 const char pstrUsageEject [] PROGMEM = "Eject";
    -
    495 const char pstrUsageRandomPlay [] PROGMEM = "Random";
    -
    496 const char pstrUsageSelectDisk [] PROGMEM = "Sel Disk";
    -
    497 const char pstrUsageEnterDisk [] PROGMEM = "Ent Disk";
    -
    498 //const char pstrUsageRepeat [] PROGMEM = "Repeat";
    -
    499 const char pstrUsageTracking [] PROGMEM = "Tracking";
    -
    500 const char pstrUsageTrackNormal [] PROGMEM = "Trk Norm";
    -
    501 const char pstrUsageSlowTracking [] PROGMEM = "Slow Trk";
    -
    502 const char pstrUsageFrameForward [] PROGMEM = "Frm Fwd";
    -
    503 const char pstrUsageFrameBackwards [] PROGMEM = "Frm Back";
    -
    504 const char pstrUsageMark [] PROGMEM = "Mark";
    -
    505 const char pstrUsageClearMark [] PROGMEM = "Clr Mark";
    -
    506 const char pstrUsageRepeatFromMark [] PROGMEM = "Rpt Mark";
    -
    507 const char pstrUsageReturnToMark [] PROGMEM = "Ret to Mark";
    -
    508 const char pstrUsageSearchMarkForward [] PROGMEM = "Search Mark Fwd";
    -
    509 const char pstrUsageSearchMarkBackwards [] PROGMEM = "Search Mark Back";
    -
    510 const char pstrUsageCounterReset [] PROGMEM = "Counter Reset";
    -
    511 const char pstrUsageShowCounter [] PROGMEM = "Show Counter";
    -
    512 const char pstrUsageTrackingIncrement [] PROGMEM = "Track Inc";
    -
    513 const char pstrUsageTrackingDecrement [] PROGMEM = "Track Dec";
    -
    514 const char pstrUsageStopEject [] PROGMEM = "Stop/Eject";
    -
    515 const char pstrUsagePlayPause [] PROGMEM = "Play/Pause";
    -
    516 const char pstrUsagePlaySkip [] PROGMEM = "Play/Skip";
    -
    517 const char pstrUsageVolume [] PROGMEM = "Vol";
    -
    518 const char pstrUsageBalance [] PROGMEM = "Balance";
    -
    519 //const char pstrUsageMute [] PROGMEM = "Mute";
    -
    520 const char pstrUsageBass [] PROGMEM = "Bass";
    -
    521 const char pstrUsageTreble [] PROGMEM = "Treble";
    -
    522 const char pstrUsageBassBoost [] PROGMEM = "Bass Boost";
    -
    523 const char pstrUsageSurroundMode [] PROGMEM = "Surround";
    -
    524 const char pstrUsageLoudness [] PROGMEM = "Loud";
    -
    525 const char pstrUsageMPX [] PROGMEM = "MPX";
    -
    526 const char pstrUsageVolumeIncrement [] PROGMEM = "Vol Inc";
    -
    527 const char pstrUsageVolumeDecrement [] PROGMEM = "Vol Dec";
    -
    528 const char pstrUsageSpeedSelect [] PROGMEM = "Speed";
    -
    529 const char pstrUsagePlaybackSpeed [] PROGMEM = "Play Speed";
    -
    530 const char pstrUsageStandardPlay [] PROGMEM = "Std Play";
    -
    531 const char pstrUsageLongPlay [] PROGMEM = "Long Play";
    -
    532 const char pstrUsageExtendedPlay [] PROGMEM = "Ext Play";
    -
    533 const char pstrUsageSlow [] PROGMEM = "Slow";
    -
    534 const char pstrUsageFanEnable [] PROGMEM = "Fan Enbl";
    -
    535 const char pstrUsageFanSpeed [] PROGMEM = "Fan Speed";
    -
    536 const char pstrUsageLightEnable [] PROGMEM = "Light Enbl";
    -
    537 const char pstrUsageLightIlluminationLevel [] PROGMEM = "Light Illum Lev";
    -
    538 const char pstrUsageClimateControlEnable [] PROGMEM = "Climate Enbl";
    -
    539 const char pstrUsageRoomTemperature [] PROGMEM = "Room Temp";
    -
    540 const char pstrUsageSecurityEnable [] PROGMEM = "Secur Enbl";
    -
    541 const char pstrUsageFireAlarm [] PROGMEM = "Fire Alm";
    -
    542 const char pstrUsagePoliceAlarm [] PROGMEM = "Police Alm";
    -
    543 const char pstrUsageProximity [] PROGMEM = "Prox";
    -
    544 const char pstrUsageMotion [] PROGMEM = "Motion";
    -
    545 const char pstrUsageDuresAlarm [] PROGMEM = "Dures Alm";
    -
    546 const char pstrUsageHoldupAlarm [] PROGMEM = "Holdup Alm";
    -
    547 const char pstrUsageMedicalAlarm [] PROGMEM = "Med Alm";
    -
    548 const char pstrUsageBalanceRight [] PROGMEM = "Balance Right";
    -
    549 const char pstrUsageBalanceLeft [] PROGMEM = "Balance Left";
    -
    550 const char pstrUsageBassIncrement [] PROGMEM = "Bass Inc";
    -
    551 const char pstrUsageBassDecrement [] PROGMEM = "Bass Dec";
    -
    552 const char pstrUsageTrebleIncrement [] PROGMEM = "Treble Inc";
    -
    553 const char pstrUsageTrebleDecrement [] PROGMEM = "Treble Dec";
    -
    554 const char pstrUsageSpeakerSystem [] PROGMEM = "Spk Sys";
    -
    555 const char pstrUsageChannelLeft [] PROGMEM = "Ch Left";
    -
    556 const char pstrUsageChannelRight [] PROGMEM = "Ch Right";
    -
    557 const char pstrUsageChannelCenter [] PROGMEM = "Ch Center";
    -
    558 const char pstrUsageChannelFront [] PROGMEM = "Ch Front";
    -
    559 const char pstrUsageChannelCenterFront [] PROGMEM = "Ch Cntr Front";
    -
    560 const char pstrUsageChannelSide [] PROGMEM = "Ch Side";
    -
    561 const char pstrUsageChannelSurround [] PROGMEM = "Ch Surround";
    -
    562 const char pstrUsageChannelLowFreqEnhancement [] PROGMEM = "Ch Low Freq Enh";
    -
    563 const char pstrUsageChannelTop [] PROGMEM = "Ch Top";
    -
    564 const char pstrUsageChannelUnknown [] PROGMEM = "Ch Unk";
    -
    565 const char pstrUsageSubChannel [] PROGMEM = "Sub-ch";
    -
    566 const char pstrUsageSubChannelIncrement [] PROGMEM = "Sub-ch Inc";
    -
    567 const char pstrUsageSubChannelDecrement [] PROGMEM = "Sub-ch Dec";
    -
    568 const char pstrUsageAlternateAudioIncrement [] PROGMEM = "Alt Aud Inc";
    -
    569 const char pstrUsageAlternateAudioDecrement [] PROGMEM = "Alt Aud Dec";
    -
    570 const char pstrUsageApplicationLaunchButtons [] PROGMEM = "App Launch Btns";
    -
    571 const char pstrUsageALLaunchButtonConfigTool [] PROGMEM = "AL Launch Conf Tl";
    -
    572 const char pstrUsageALProgrammableButton [] PROGMEM = "AL Pgm Btn";
    -
    573 const char pstrUsageALConsumerControlConfig [] PROGMEM = "AL Cons Ctrl Cfg";
    -
    574 const char pstrUsageALWordProcessor [] PROGMEM = "AL Word Proc";
    -
    575 const char pstrUsageALTextEditor [] PROGMEM = "AL Txt Edtr";
    -
    576 const char pstrUsageALSpreadsheet [] PROGMEM = "AL Sprdsheet";
    -
    577 const char pstrUsageALGraphicsEditor [] PROGMEM = "AL Graph Edtr";
    -
    578 const char pstrUsageALPresentationApp [] PROGMEM = "AL Present App";
    -
    579 const char pstrUsageALDatabaseApp [] PROGMEM = "AL DB App";
    -
    580 const char pstrUsageALEmailReader [] PROGMEM = "AL E-mail Rdr";
    -
    581 const char pstrUsageALNewsreader [] PROGMEM = "AL Newsrdr";
    -
    582 const char pstrUsageALVoicemail [] PROGMEM = "AL Voicemail";
    -
    583 const char pstrUsageALContactsAddressBook [] PROGMEM = "AL Addr Book";
    -
    584 const char pstrUsageALCalendarSchedule [] PROGMEM = "AL Clndr/Schdlr";
    -
    585 const char pstrUsageALTaskProjectManager [] PROGMEM = "AL Task/Prj Mgr";
    -
    586 const char pstrUsageALLogJournalTimecard [] PROGMEM = "AL Log/Jrnl/Tmcrd";
    -
    587 const char pstrUsageALCheckbookFinance [] PROGMEM = "AL Chckbook/Fin";
    -
    588 const char pstrUsageALCalculator [] PROGMEM = "AL Calc";
    -
    589 const char pstrUsageALAVCapturePlayback [] PROGMEM = "AL A/V Capt/Play";
    -
    590 const char pstrUsageALLocalMachineBrowser [] PROGMEM = "AL Loc Mach Brow";
    -
    591 const char pstrUsageALLANWANBrow [] PROGMEM = "AL LAN/WAN Brow";
    -
    592 const char pstrUsageALInternetBrowser [] PROGMEM = "AL I-net Brow";
    -
    593 const char pstrUsageALRemoteNetISPConnect [] PROGMEM = "AL Rem Net Con";
    -
    594 const char pstrUsageALNetworkConference [] PROGMEM = "AL Net Conf";
    -
    595 const char pstrUsageALNetworkChat [] PROGMEM = "AL Net Chat";
    -
    596 const char pstrUsageALTelephonyDialer [] PROGMEM = "AL Tel/Dial";
    -
    597 const char pstrUsageALLogon [] PROGMEM = "AL Logon";
    -
    598 const char pstrUsageALLogoff [] PROGMEM = "AL Logoff";
    -
    599 const char pstrUsageALLogonLogoff [] PROGMEM = "AL Logon/Logoff";
    -
    600 const char pstrUsageALTermLockScrSav [] PROGMEM = "AL Term Lock/Scr Sav";
    -
    601 const char pstrUsageALControlPannel [] PROGMEM = "AL Ctrl Pan";
    -
    602 const char pstrUsageALCommandLineProcessorRun [] PROGMEM = "AL Cmd/Run";
    -
    603 const char pstrUsageALProcessTaskManager [] PROGMEM = "AL Task Mgr";
    -
    604 const char pstrUsageALSelectTaskApplication [] PROGMEM = "AL Sel App";
    -
    605 const char pstrUsageALNextTaskApplication [] PROGMEM = "AL Next App";
    -
    606 const char pstrUsageALPreviousTaskApplication [] PROGMEM = "AL Prev App";
    -
    607 const char pstrUsageALPreemptiveHaltTaskApp [] PROGMEM = "AL Prmpt Halt App";
    -
    608 const char pstrUsageALIntegratedHelpCenter [] PROGMEM = "AL Hlp Cntr";
    -
    609 const char pstrUsageALDocuments [] PROGMEM = "AL Docs";
    -
    610 const char pstrUsageALThesaurus [] PROGMEM = "AL Thsrs";
    -
    611 const char pstrUsageALDictionary [] PROGMEM = "AL Dict";
    -
    612 const char pstrUsageALDesktop [] PROGMEM = "AL Desktop";
    -
    613 const char pstrUsageALSpellCheck [] PROGMEM = "AL Spell Chk";
    -
    614 const char pstrUsageALGrammarCheck [] PROGMEM = "AL Gram Chk";
    -
    615 const char pstrUsageALWirelessStatus [] PROGMEM = "AL Wireless Sts";
    -
    616 const char pstrUsageALKeyboardLayout [] PROGMEM = "AL Kbd Layout";
    -
    617 const char pstrUsageALVirusProtection [] PROGMEM = "AL Vir Protect";
    -
    618 const char pstrUsageALEncryption [] PROGMEM = "AL Encrypt";
    -
    619 const char pstrUsageALScreenSaver [] PROGMEM = "AL Scr Sav";
    -
    620 const char pstrUsageALAlarms [] PROGMEM = "AL Alarms";
    -
    621 const char pstrUsageALClock [] PROGMEM = "AL Clock";
    -
    622 const char pstrUsageALFileBrowser [] PROGMEM = "AL File Brow";
    -
    623 const char pstrUsageALPowerStatus [] PROGMEM = "AL Pwr Sts";
    -
    624 const char pstrUsageALImageBrowser [] PROGMEM = "AL Img Brow";
    -
    625 const char pstrUsageALAudioBrowser [] PROGMEM = "AL Aud Brow";
    -
    626 const char pstrUsageALMovieBrowser [] PROGMEM = "AL Mov Brow";
    -
    627 const char pstrUsageALDigitalRightsManager [] PROGMEM = "AL Dig Rights Mgr";
    -
    628 const char pstrUsageALDigitalWallet [] PROGMEM = "AL Dig Wallet";
    -
    629 const char pstrUsageALInstantMessaging [] PROGMEM = "AL Inst Msg";
    -
    630 const char pstrUsageALOEMFeaturesBrowser [] PROGMEM = "AL OEM Tips Brow";
    -
    631 const char pstrUsageALOEMHelp [] PROGMEM = "AL OEM Hlp";
    -
    632 const char pstrUsageALOnlineCommunity [] PROGMEM = "AL Online Com";
    -
    633 const char pstrUsageALEntertainmentContentBrow [] PROGMEM = "AL Ent Cont Brow";
    -
    634 const char pstrUsageALOnlineShoppingBrowser [] PROGMEM = "AL Online Shop Brow";
    -
    635 const char pstrUsageALSmartCardInfoHelp [] PROGMEM = "AL SmartCard Inf";
    -
    636 const char pstrUsageALMarketMonitorFinBrowser [] PROGMEM = "AL Market Brow";
    -
    637 const char pstrUsageALCustomCorpNewsBrowser [] PROGMEM = "AL Cust Corp News Brow";
    -
    638 const char pstrUsageALOnlineActivityBrowser [] PROGMEM = "AL Online Act Brow";
    -
    639 const char pstrUsageALResearchSearchBrowser [] PROGMEM = "AL Search Brow";
    -
    640 const char pstrUsageALAudioPlayer [] PROGMEM = "AL Aud Player";
    -
    641 const char pstrUsageGenericGUIAppControls [] PROGMEM = "Gen GUI App Ctrl";
    -
    642 const char pstrUsageACNew [] PROGMEM = "AC New";
    -
    643 const char pstrUsageACOpen [] PROGMEM = "AC Open";
    -
    644 const char pstrUsageACClose [] PROGMEM = "AC Close";
    -
    645 const char pstrUsageACExit [] PROGMEM = "AC Exit";
    -
    646 const char pstrUsageACMaximize [] PROGMEM = "AC Max";
    -
    647 const char pstrUsageACMinimize [] PROGMEM = "AC Min";
    -
    648 const char pstrUsageACSave [] PROGMEM = "AC Save";
    -
    649 const char pstrUsageACPrint [] PROGMEM = "AC Print";
    -
    650 const char pstrUsageACProperties [] PROGMEM = "AC Prop";
    -
    651 const char pstrUsageACUndo [] PROGMEM = "AC Undo";
    -
    652 const char pstrUsageACCopy [] PROGMEM = "AC Copy";
    -
    653 const char pstrUsageACCut [] PROGMEM = "AC Cut";
    -
    654 const char pstrUsageACPaste [] PROGMEM = "AC Paste";
    -
    655 const char pstrUsageACSelectAll [] PROGMEM = "AC Sel All";
    -
    656 const char pstrUsageACFind [] PROGMEM = "AC Find";
    -
    657 const char pstrUsageACFindAndReplace [] PROGMEM = "AC Find/Replace";
    -
    658 const char pstrUsageACSearch [] PROGMEM = "AC Search";
    -
    659 const char pstrUsageACGoto [] PROGMEM = "AC Goto";
    -
    660 const char pstrUsageACHome [] PROGMEM = "AC Home";
    -
    661 const char pstrUsageACBack [] PROGMEM = "AC Back";
    -
    662 const char pstrUsageACForward [] PROGMEM = "AC Fwd";
    -
    663 const char pstrUsageACStop [] PROGMEM = "AC Stop";
    -
    664 const char pstrUsageACRefresh [] PROGMEM = "AC Refresh";
    -
    665 const char pstrUsageACPreviousLink [] PROGMEM = "AC Prev Link";
    -
    666 const char pstrUsageACNextLink [] PROGMEM = "AC Next Link";
    -
    667 const char pstrUsageACBookmarks [] PROGMEM = "AC Bkmarks";
    -
    668 const char pstrUsageACHistory [] PROGMEM = "AC Hist";
    -
    669 const char pstrUsageACSubscriptions [] PROGMEM = "AC Subscr";
    -
    670 const char pstrUsageACZoomIn [] PROGMEM = "AC Zoom In";
    -
    671 const char pstrUsageACZoomOut [] PROGMEM = "AC Zoom Out";
    -
    672 const char pstrUsageACZoom [] PROGMEM = "AC Zoom";
    -
    673 const char pstrUsageACFullScreenView [] PROGMEM = "AC Full Scr";
    -
    674 const char pstrUsageACNormalView [] PROGMEM = "AC Norm View";
    -
    675 const char pstrUsageACViewToggle [] PROGMEM = "AC View Tgl";
    -
    676 const char pstrUsageACScrollUp [] PROGMEM = "AC Scroll Up";
    -
    677 const char pstrUsageACScrollDown [] PROGMEM = "AC Scroll Down";
    -
    678 const char pstrUsageACScroll [] PROGMEM = "AC Scroll";
    -
    679 const char pstrUsageACPanLeft [] PROGMEM = "AC Pan Left";
    -
    680 const char pstrUsageACPanRight [] PROGMEM = "AC Pan Right";
    -
    681 const char pstrUsageACPan [] PROGMEM = "AC Pan";
    -
    682 const char pstrUsageACNewWindow [] PROGMEM = "AC New Wnd";
    -
    683 const char pstrUsageACTileHoriz [] PROGMEM = "AC Tile Horiz";
    -
    684 const char pstrUsageACTileVert [] PROGMEM = "AC Tile Vert";
    -
    685 const char pstrUsageACFormat [] PROGMEM = "AC Frmt";
    -
    686 const char pstrUsageACEdit [] PROGMEM = "AC Edit";
    -
    687 const char pstrUsageACBold [] PROGMEM = "AC Bold";
    -
    688 const char pstrUsageACItalics [] PROGMEM = "AC Ital";
    -
    689 const char pstrUsageACUnderline [] PROGMEM = "AC Under";
    -
    690 const char pstrUsageACStrikethrough [] PROGMEM = "AC Strike";
    -
    691 const char pstrUsageACSubscript [] PROGMEM = "AC Sub";
    -
    692 const char pstrUsageACSuperscript [] PROGMEM = "AC Super";
    -
    693 const char pstrUsageACAllCaps [] PROGMEM = "AC All Caps";
    -
    694 const char pstrUsageACRotate [] PROGMEM = "AC Rotate";
    -
    695 const char pstrUsageACResize [] PROGMEM = "AC Resize";
    -
    696 const char pstrUsageACFlipHorizontal [] PROGMEM = "AC Flp H";
    -
    697 const char pstrUsageACFlipVertical [] PROGMEM = "AC Flp V";
    -
    698 const char pstrUsageACMirrorHorizontal [] PROGMEM = "AC Mir H";
    -
    699 const char pstrUsageACMirrorVertical [] PROGMEM = "AC Mir V";
    -
    700 const char pstrUsageACFontSelect [] PROGMEM = "AC Fnt Sel";
    -
    701 const char pstrUsageACFontColor [] PROGMEM = "AC Fnt Clr";
    -
    702 const char pstrUsageACFontSize [] PROGMEM = "AC Fnt Size";
    -
    703 const char pstrUsageACJustifyLeft [] PROGMEM = "AC Just Left";
    -
    704 const char pstrUsageACJustifyCenterH [] PROGMEM = "AC Just Cent H";
    -
    705 const char pstrUsageACJustifyRight [] PROGMEM = "AC Just Right";
    -
    706 const char pstrUsageACJustifyBlockH [] PROGMEM = "AC Just Block H";
    -
    707 const char pstrUsageACJustifyTop [] PROGMEM = "AC Just Top";
    -
    708 const char pstrUsageACJustifyCenterV [] PROGMEM = "AC Just Cent V";
    -
    709 const char pstrUsageACJustifyBottom [] PROGMEM = "AC Just Bot";
    -
    710 const char pstrUsageACJustifyBlockV [] PROGMEM = "AC Just Block V";
    -
    711 const char pstrUsageACIndentDecrease [] PROGMEM = "AC Indent Dec";
    -
    712 const char pstrUsageACIndentIncrease [] PROGMEM = "AC Indent Inc";
    -
    713 const char pstrUsageACNumberedList [] PROGMEM = "AC Num List";
    -
    714 const char pstrUsageACRestartNumbering [] PROGMEM = "AC Res Num";
    -
    715 const char pstrUsageACBulletedList [] PROGMEM = "AC Blt List";
    -
    716 const char pstrUsageACPromote [] PROGMEM = "AC Promote";
    -
    717 const char pstrUsageACDemote [] PROGMEM = "AC Demote";
    -
    718 const char pstrUsageACYes [] PROGMEM = "AC Yes";
    -
    719 const char pstrUsageACNo [] PROGMEM = "AC No";
    -
    720 const char pstrUsageACCancel [] PROGMEM = "AC Cancel";
    -
    721 const char pstrUsageACCatalog [] PROGMEM = "AC Ctlg";
    -
    722 const char pstrUsageACBuyChkout [] PROGMEM = "AC Buy";
    -
    723 const char pstrUsageACAddToCart [] PROGMEM = "AC Add2Cart";
    -
    724 const char pstrUsageACExpand [] PROGMEM = "AC Xpnd";
    -
    725 const char pstrUsageACExpandAll [] PROGMEM = "AC Xpand All";
    -
    726 const char pstrUsageACCollapse [] PROGMEM = "AC Collapse";
    -
    727 const char pstrUsageACCollapseAll [] PROGMEM = "AC Collapse All";
    -
    728 const char pstrUsageACPrintPreview [] PROGMEM = "AC Prn Prevw";
    -
    729 const char pstrUsageACPasteSpecial [] PROGMEM = "AC Paste Spec";
    -
    730 const char pstrUsageACInsertMode [] PROGMEM = "AC Ins Mode";
    -
    731 const char pstrUsageACDelete [] PROGMEM = "AC Del";
    -
    732 const char pstrUsageACLock [] PROGMEM = "AC Lock";
    -
    733 const char pstrUsageACUnlock [] PROGMEM = "AC Unlock";
    -
    734 const char pstrUsageACProtect [] PROGMEM = "AC Prot";
    -
    735 const char pstrUsageACUnprotect [] PROGMEM = "AC Unprot";
    -
    736 const char pstrUsageACAttachComment [] PROGMEM = "AC Attach Cmnt";
    -
    737 const char pstrUsageACDeleteComment [] PROGMEM = "AC Del Cmnt";
    -
    738 const char pstrUsageACViewComment [] PROGMEM = "AC View Cmnt";
    -
    739 const char pstrUsageACSelectWord [] PROGMEM = "AC Sel Word";
    -
    740 const char pstrUsageACSelectSentence [] PROGMEM = "AC Sel Sntc";
    -
    741 const char pstrUsageACSelectParagraph [] PROGMEM = "AC Sel Para";
    -
    742 const char pstrUsageACSelectColumn [] PROGMEM = "AC Sel Col";
    -
    743 const char pstrUsageACSelectRow [] PROGMEM = "AC Sel Row";
    -
    744 const char pstrUsageACSelectTable [] PROGMEM = "AC Sel Tbl";
    -
    745 const char pstrUsageACSelectObject [] PROGMEM = "AC Sel Obj";
    -
    746 const char pstrUsageACRedoRepeat [] PROGMEM = "AC Redo";
    -
    747 const char pstrUsageACSort [] PROGMEM = "AC Sort";
    -
    748 const char pstrUsageACSortAscending [] PROGMEM = "AC Sort Asc";
    -
    749 const char pstrUsageACSortDescending [] PROGMEM = "AC Sort Desc";
    -
    750 const char pstrUsageACFilter [] PROGMEM = "AC Filt";
    -
    751 const char pstrUsageACSetClock [] PROGMEM = "AC Set Clk";
    -
    752 const char pstrUsageACViewClock [] PROGMEM = "AC View Clk";
    -
    753 const char pstrUsageACSelectTimeZone [] PROGMEM = "AC Sel Time Z";
    -
    754 const char pstrUsageACEditTimeZone [] PROGMEM = "AC Edt Time Z";
    -
    755 const char pstrUsageACSetAlarm [] PROGMEM = "AC Set Alm";
    -
    756 const char pstrUsageACClearAlarm [] PROGMEM = "AC Clr Alm";
    -
    757 const char pstrUsageACSnoozeAlarm [] PROGMEM = "AC Snz Alm";
    -
    758 const char pstrUsageACResetAlarm [] PROGMEM = "AC Rst Alm";
    -
    759 const char pstrUsageACSyncronize [] PROGMEM = "AC Sync";
    -
    760 const char pstrUsageACSendReceive [] PROGMEM = "AC Snd/Rcv";
    -
    761 const char pstrUsageACSendTo [] PROGMEM = "AC Snd To";
    -
    762 const char pstrUsageACReply [] PROGMEM = "AC Reply";
    -
    763 const char pstrUsageACReplyAll [] PROGMEM = "AC Reply All";
    -
    764 const char pstrUsageACForwardMessage [] PROGMEM = "AC Fwd Msg";
    -
    765 const char pstrUsageACSend [] PROGMEM = "AC Snd";
    -
    766 const char pstrUsageACAttachFile [] PROGMEM = "AC Att File";
    -
    767 const char pstrUsageACUpload [] PROGMEM = "AC Upld";
    -
    768 const char pstrUsageACDownload [] PROGMEM = "AC Dnld";
    -
    769 const char pstrUsageACSetBorders [] PROGMEM = "AC Set Brd";
    -
    770 const char pstrUsageACInsertRow [] PROGMEM = "AC Ins Row";
    -
    771 const char pstrUsageACInsertColumn [] PROGMEM = "AC Ins Col";
    -
    772 const char pstrUsageACInsertFile [] PROGMEM = "AC Ins File";
    -
    773 const char pstrUsageACInsertPicture [] PROGMEM = "AC Ins Pic";
    -
    774 const char pstrUsageACInsertObject [] PROGMEM = "AC Ins Obj";
    -
    775 const char pstrUsageACInsertSymbol [] PROGMEM = "AC Ins Sym";
    -
    776 const char pstrUsageACSaveAndClose [] PROGMEM = "AC Sav&Cls";
    -
    777 const char pstrUsageACRename [] PROGMEM = "AC Rename";
    -
    778 const char pstrUsageACMerge [] PROGMEM = "AC Merge";
    -
    779 const char pstrUsageACSplit [] PROGMEM = "AC Split";
    -
    780 const char pstrUsageACDistributeHorizontaly [] PROGMEM = "AC Dist Hor";
    -
    781 const char pstrUsageACDistributeVerticaly [] PROGMEM = "AC Dist Ver";
    -
    782 
    -
    783 // Digitaizers
    -
    784 const char pstrUsageDigitizer [] PROGMEM = "Digitizer";
    -
    785 const char pstrUsagePen [] PROGMEM = "Pen";
    -
    786 const char pstrUsageLightPen [] PROGMEM = "Light Pen";
    -
    787 const char pstrUsageTouchScreen [] PROGMEM = "Touch Scr";
    -
    788 const char pstrUsageTouchPad [] PROGMEM = "Touch Pad";
    -
    789 const char pstrUsageWhiteBoard [] PROGMEM = "White Brd";
    -
    790 const char pstrUsageCoordinateMeasuringMachine [] PROGMEM = "Coord Meas Mach";
    -
    791 const char pstrUsage3DDigitizer [] PROGMEM = "3D Dgtz";
    -
    792 const char pstrUsageStereoPlotter [] PROGMEM = "Stereo Plot";
    -
    793 const char pstrUsageArticulatedArm [] PROGMEM = "Art Arm";
    -
    794 const char pstrUsageArmature [] PROGMEM = "Armature";
    -
    795 const char pstrUsageMultiplePointDigitizer [] PROGMEM = "Multi Point Dgtz";
    -
    796 const char pstrUsageFreeSpaceWand [] PROGMEM = "Free Space Wand";
    -
    797 const char pstrUsageStylus [] PROGMEM = "Stylus";
    -
    798 const char pstrUsagePuck [] PROGMEM = "Puck";
    -
    799 const char pstrUsageFinger [] PROGMEM = "Finger";
    -
    800 const char pstrUsageTipPressure [] PROGMEM = "Tip Press";
    -
    801 const char pstrUsageBarrelPressure [] PROGMEM = "Brl Press";
    -
    802 const char pstrUsageInRange [] PROGMEM = "In Range";
    -
    803 const char pstrUsageTouch [] PROGMEM = "Touch";
    -
    804 const char pstrUsageUntouch [] PROGMEM = "Untouch";
    -
    805 const char pstrUsageTap [] PROGMEM = "Tap";
    -
    806 const char pstrUsageQuality [] PROGMEM = "Qlty";
    -
    807 const char pstrUsageDataValid [] PROGMEM = "Data Valid";
    -
    808 const char pstrUsageTransducerIndex [] PROGMEM = "Transducer Ind";
    -
    809 const char pstrUsageTabletFunctionKeys [] PROGMEM = "Tabl Func Keys";
    -
    810 const char pstrUsageProgramChangeKeys [] PROGMEM = "Pgm Chng Keys";
    -
    811 //const char pstrUsageBatteryStrength [] PROGMEM = "Bat Strength";
    -
    812 const char pstrUsageInvert [] PROGMEM = "Invert";
    -
    813 const char pstrUsageXTilt [] PROGMEM = "X Tilt";
    -
    814 const char pstrUsageYTilt [] PROGMEM = "Y Tilt";
    -
    815 const char pstrUsageAzimuth [] PROGMEM = "Azimuth";
    -
    816 const char pstrUsageAltitude [] PROGMEM = "Altitude";
    -
    817 const char pstrUsageTwist [] PROGMEM = "Twist";
    -
    818 const char pstrUsageTipSwitch [] PROGMEM = "Tip Sw";
    -
    819 const char pstrUsageSecondaryTipSwitch [] PROGMEM = "Scnd Tip Sw";
    -
    820 const char pstrUsageBarrelSwitch [] PROGMEM = "Brl Sw";
    -
    821 const char pstrUsageEraser [] PROGMEM = "Eraser";
    -
    822 const char pstrUsageTabletPick [] PROGMEM = "Tbl Pick";
    -
    823 
    -
    824 // Alphanumeric Display Page
    -
    825 const char pstrUsageAlphanumericDisplay [] PROGMEM = "Alphanum Disp";
    -
    826 const char pstrUsageBitmappedDisplay [] PROGMEM = "Bmp Disp";
    -
    827 const char pstrUsageDisplayAttributesReport [] PROGMEM = "Disp Attr Rpt";
    -
    828 const char pstrUsageASCIICharacterSet [] PROGMEM = "ASCII chset";
    -
    829 const char pstrUsageDataReadBack [] PROGMEM = "Data Rd Back";
    -
    830 const char pstrUsageFontReadBack [] PROGMEM = "Fnt Rd Back";
    -
    831 const char pstrUsageDisplayControlReport [] PROGMEM = "Disp Ctrl Rpt";
    -
    832 const char pstrUsageClearDisplay [] PROGMEM = "Clr Disp";
    -
    833 //const char pstrUsageDisplayEnable [] PROGMEM = "Disp Enbl";
    -
    834 const char pstrUsageScreenSaverDelay [] PROGMEM = "Scr Sav Delay";
    -
    835 const char pstrUsageScreenSaverEnable [] PROGMEM = "Scr Sav Enbl";
    -
    836 const char pstrUsageVerticalScroll [] PROGMEM = "V Scroll";
    -
    837 const char pstrUsageHorizontalScroll [] PROGMEM = "H Scroll";
    -
    838 const char pstrUsageCharacterReport [] PROGMEM = "Char Rpt";
    -
    839 const char pstrUsageDisplayData [] PROGMEM = "Disp Data";
    -
    840 const char pstrUsageDisplayStatus [] PROGMEM = "Disp Stat";
    -
    841 const char pstrUsageStatusNotReady [] PROGMEM = "Stat !Ready";
    -
    842 const char pstrUsageStatusReady [] PROGMEM = "Stat Ready";
    -
    843 const char pstrUsageErrorNotALoadableCharacter [] PROGMEM = "Err Not Ld Char";
    -
    844 const char pstrUsageErrorFotDataCanNotBeRead [] PROGMEM = "Fnt Data Rd Err";
    -
    845 const char pstrUsageCursorPositionReport [] PROGMEM = "Cur Pos Rpt";
    -
    846 const char pstrUsageRow [] PROGMEM = "Row";
    -
    847 const char pstrUsageColumn [] PROGMEM = "Col";
    -
    848 const char pstrUsageRows [] PROGMEM = "Rows";
    -
    849 const char pstrUsageColumns [] PROGMEM = "Cols";
    -
    850 const char pstrUsageCursorPixelPosition [] PROGMEM = "Cur Pix Pos";
    -
    851 const char pstrUsageCursorMode [] PROGMEM = "Cur Mode";
    -
    852 const char pstrUsageCursorEnable [] PROGMEM = "Cur Enbl";
    -
    853 const char pstrUsageCursorBlink [] PROGMEM = "Cur Blnk";
    -
    854 const char pstrUsageFontReport [] PROGMEM = "Fnt Rpt";
    -
    855 const char pstrUsageFontData [] PROGMEM = "Fnt Data";
    -
    856 const char pstrUsageCharacterWidth [] PROGMEM = "Char Wdth";
    -
    857 const char pstrUsageCharacterHeight [] PROGMEM = "Char Hght";
    -
    858 const char pstrUsageCharacterSpacingHorizontal [] PROGMEM = "Char Space H";
    -
    859 const char pstrUsageCharacterSpacingVertical [] PROGMEM = "Char Space V";
    -
    860 const char pstrUsageUnicodeCharset [] PROGMEM = "Unicode Char";
    -
    861 const char pstrUsageFont7Segment [] PROGMEM = "Fnt 7-seg";
    -
    862 const char pstrUsage7SegmentDirectMap [] PROGMEM = "7-seg map";
    -
    863 const char pstrUsageFont14Segment [] PROGMEM = "Fnt 14-seg";
    -
    864 const char pstrUsage14SegmentDirectMap [] PROGMEM = "14-seg map";
    -
    865 const char pstrUsageDisplayBrightness [] PROGMEM = "Disp Bright";
    -
    866 const char pstrUsageDisplayContrast [] PROGMEM = "Disp Cntrst";
    -
    867 const char pstrUsageCharacterAttribute [] PROGMEM = "Char Attr";
    -
    868 const char pstrUsageAttributeReadback [] PROGMEM = "Attr Readbk";
    -
    869 const char pstrUsageAttributeData [] PROGMEM = "Attr Data";
    -
    870 const char pstrUsageCharAttributeEnhance [] PROGMEM = "Char Attr Enh";
    -
    871 const char pstrUsageCharAttributeUnderline [] PROGMEM = "Char Attr Undl";
    -
    872 const char pstrUsageCharAttributeBlink [] PROGMEM = "Char Attr Blnk";
    -
    873 const char pstrUsageBitmapSizeX [] PROGMEM = "Bmp Size X";
    -
    874 const char pstrUsageBitmapSizeY [] PROGMEM = "Bmp Size Y";
    -
    875 const char pstrUsageBitDepthFormat [] PROGMEM = "Bit Dpth Fmt";
    -
    876 const char pstrUsageDisplayOrientation [] PROGMEM = "Disp Ornt";
    -
    877 const char pstrUsagePaletteReport [] PROGMEM = "Pal Rpt";
    -
    878 const char pstrUsagePaletteDataSize [] PROGMEM = "Pal Data Size";
    -
    879 const char pstrUsagePaletteDataOffset [] PROGMEM = "Pal Data Off";
    -
    880 const char pstrUsagePaletteData [] PROGMEM = "Pal Data";
    -
    881 const char pstrUsageBlitReport [] PROGMEM = "Blit Rpt";
    -
    882 const char pstrUsageBlitRectangleX1 [] PROGMEM = "Blit Rect X1";
    -
    883 const char pstrUsageBlitRectangleY1 [] PROGMEM = "Blit Rect Y1";
    -
    884 const char pstrUsageBlitRectangleX2 [] PROGMEM = "Blit Rect X2";
    -
    885 const char pstrUsageBlitRectangleY2 [] PROGMEM = "Blit Rect Y2";
    -
    886 const char pstrUsageBlitData [] PROGMEM = "Blit Data";
    -
    887 const char pstrUsageSoftButton [] PROGMEM = "Soft Btn";
    -
    888 const char pstrUsageSoftButtonID [] PROGMEM = "Soft Btn ID";
    -
    889 const char pstrUsageSoftButtonSide [] PROGMEM = "Soft Btn Side";
    -
    890 const char pstrUsageSoftButtonOffset1 [] PROGMEM = "Soft Btn Off1";
    -
    891 const char pstrUsageSoftButtonOffset2 [] PROGMEM = "Soft Btn Off2";
    -
    892 const char pstrUsageSoftButtonReport [] PROGMEM = "Soft Btn Rpt";
    -
    893 
    -
    894 // Medical Instrument Page
    -
    895 const char pstrUsageMedicalUltrasound [] PROGMEM = "Med Ultrasnd";
    -
    896 const char pstrUsageVCRAcquisition [] PROGMEM = "VCR/Acq";
    -
    897 const char pstrUsageFreezeThaw [] PROGMEM = "Freeze";
    -
    898 const char pstrUsageClipStore [] PROGMEM = "Clip Store";
    -
    899 const char pstrUsageUpdate [] PROGMEM = "Update";
    -
    900 const char pstrUsageNext [] PROGMEM = "Next";
    -
    901 const char pstrUsageSave [] PROGMEM = "Save";
    -
    902 const char pstrUsagePrint [] PROGMEM = "Print";
    -
    903 const char pstrUsageMicrophoneEnable [] PROGMEM = "Mic Enbl";
    -
    904 const char pstrUsageCine [] PROGMEM = "Cine";
    -
    905 const char pstrUsageTransmitPower [] PROGMEM = "Trans Pwr";
    -
    906 //const char pstrUsageVolume [] PROGMEM = "Vol";
    -
    907 const char pstrUsageFocus [] PROGMEM = "Focus";
    -
    908 const char pstrUsageDepth [] PROGMEM = "Depth";
    -
    909 const char pstrUsageSoftStepPrimary [] PROGMEM = "Soft Stp-Pri";
    -
    910 const char pstrUsageSoftStepSecondary [] PROGMEM = "Soft Stp-Sec";
    -
    911 const char pstrUsageDepthGainCompensation [] PROGMEM = "Dpth Gain Comp";
    -
    912 const char pstrUsageZoomSelect [] PROGMEM = "Zoom Sel";
    -
    913 const char pstrUsageZoomAdjust [] PROGMEM = "Zoom Adj";
    -
    914 const char pstrUsageSpectralDopplerModeSelect [] PROGMEM = "Spec Dop Mode Sel";
    -
    915 const char pstrUsageSpectralDopplerModeAdjust [] PROGMEM = "Spec Dop Mode Adj";
    -
    916 const char pstrUsageColorDopplerModeSelect [] PROGMEM = "Color Dop Mode Sel";
    -
    917 const char pstrUsageColorDopplerModeAdjust [] PROGMEM = "Color Dop Mode Adj";
    -
    918 const char pstrUsageMotionModeSelect [] PROGMEM = "Motion Mode Sel";
    -
    919 const char pstrUsageMotionModeAdjust [] PROGMEM = "Motion Mode Adj";
    -
    920 const char pstrUsage2DModeSelect [] PROGMEM = "2D Mode Sel";
    -
    921 const char pstrUsage2DModeAdjust [] PROGMEM = "2D Mode Adj";
    -
    922 const char pstrUsageSoftControlSelect [] PROGMEM = "Soft Ctrl Sel";
    -
    923 const char pstrUsageSoftControlAdjust [] PROGMEM = "Soft Ctrl Adj";
    -
    924 
    -
    925 //extern const char *usagePageTitles0[15];
    -
    926 //const char *usagePageTitles1[];
    -
    927 //const char *genDesktopTitles0[];
    -
    928 //const char *genDesktopTitles1[];
    -
    929 //const char *genDesktopTitles2[];
    -
    930 //const char *genDesktopTitles3[];
    -
    931 //const char *genDesktopTitles4[];
    -
    932 //const char *simuTitles0[];
    -
    933 //const char *simuTitles1[];
    -
    934 //const char *simuTitles2[];
    -
    935 //const char *vrTitles0[];
    -
    936 //const char *vrTitles1[];
    -
    937 //const char *sportsCtrlTitles0[];
    -
    938 //const char *sportsCtrlTitles1[];
    -
    939 //const char *sportsCtrlTitles2[];
    -
    940 //const char *gameTitles0[];
    -
    941 //const char *gameTitles1[];
    -
    942 //const char *genDevCtrlTitles[];
    -
    943 //const char *ledTitles[];
    -
    944 //const char *telTitles0[];
    -
    945 //const char *telTitles1[];
    -
    946 //const char *telTitles2[];
    -
    947 //const char *telTitles3[];
    -
    948 //const char *telTitles4[];
    -
    949 //const char *telTitles5[];
    -
    950 //const char *consTitles0[];
    -
    951 //const char *consTitles1[];
    -
    952 //const char *consTitles2[];
    -
    953 //const char *consTitles3[];
    -
    954 //const char *consTitles4[];
    -
    955 //const char *consTitles5[];
    -
    956 //const char *consTitles6[];
    -
    957 //const char *consTitles7[];
    -
    958 //const char *consTitles8[];
    -
    959 //const char *consTitles9[];
    -
    960 //const char *consTitlesA[];
    -
    961 //const char *consTitlesB[];
    -
    962 //const char *consTitlesC[];
    -
    963 //const char *consTitlesD[];
    -
    964 //const char *consTitlesE[];
    -
    965 //const char *digitTitles0[];
    -
    966 //const char *digitTitles1[];
    -
    967 //const char *digitTitles2[];
    -
    968 //const char *aplphanumTitles0[];
    -
    969 //const char *aplphanumTitles1[];
    -
    970 //const char *aplphanumTitles2[];
    -
    971 //const char *medInstrTitles0[];
    -
    972 //const char *medInstrTitles1[];
    -
    973 //const char *medInstrTitles2[];
    -
    974 //const char *medInstrTitles3[];
    -
    975 //const char *medInstrTitles4[];
    -
    976 
    -
    977 #endif //__HIDUSAGESTR_H__
    -
    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 #if !defined( __HIDUSAGESTR_H__)
    18 #define __HIDUSAGESTR_H__
    19 
    20 #include "Usb.h"
    21 
    22 const char pstrSpace [] PROGMEM = " ";
    23 const char pstrCRLF [] PROGMEM = "\r\n";
    24 const char pstrSingleTab [] PROGMEM = "\t";
    25 const char pstrDoubleTab [] PROGMEM = "\t\t";
    26 const char pstrTripleTab [] PROGMEM = "\t\t\t";
    27 
    28 // Usage Page String Titles
    29 const char pstrUsagePageUndefined [] PROGMEM = "Undef";
    30 const char pstrUsagePageGenericDesktopControls [] PROGMEM = "Gen Desktop Ctrls";
    31 const char pstrUsagePageSimulationControls [] PROGMEM = "Simu Ctrls";
    32 const char pstrUsagePageVRControls [] PROGMEM = "VR Ctrls";
    33 const char pstrUsagePageSportControls [] PROGMEM = "Sport Ctrls";
    34 const char pstrUsagePageGameControls [] PROGMEM = "Game Ctrls";
    35 const char pstrUsagePageGenericDeviceControls [] PROGMEM = "Gen Dev Ctrls";
    36 const char pstrUsagePageKeyboardKeypad [] PROGMEM = "Kbrd/Keypad";
    37 const char pstrUsagePageLEDs [] PROGMEM = "LEDs";
    38 const char pstrUsagePageButton [] PROGMEM = "Button";
    39 const char pstrUsagePageOrdinal [] PROGMEM = "Ordinal";
    40 const char pstrUsagePageTelephone [] PROGMEM = "Tel";
    41 const char pstrUsagePageConsumer [] PROGMEM = "Consumer";
    42 const char pstrUsagePageDigitizer [] PROGMEM = "Digitizer";
    43 const char pstrUsagePagePID [] PROGMEM = "PID";
    44 const char pstrUsagePageUnicode [] PROGMEM = "Unicode";
    45 const char pstrUsagePageAlphaNumericDisplay [] PROGMEM = "Alpha Num Disp";
    46 const char pstrUsagePageMedicalInstruments [] PROGMEM = "Medical Instr";
    47 const char pstrUsagePageMonitor [] PROGMEM = "Monitor";
    48 const char pstrUsagePagePower [] PROGMEM = "Power";
    49 const char pstrUsagePageBarCodeScanner [] PROGMEM = "Bar Code Scan";
    50 const char pstrUsagePageScale [] PROGMEM = "Scale";
    51 const char pstrUsagePageMSRDevices [] PROGMEM = "Magn Stripe Read Dev";
    52 const char pstrUsagePagePointOfSale [] PROGMEM = "POS";
    53 const char pstrUsagePageCameraControl [] PROGMEM = "Cam Ctrl";
    54 const char pstrUsagePageArcade [] PROGMEM = "Arcade";
    55 const char pstrUsagePageReserved [] PROGMEM = "Reserved";
    56 const char pstrUsagePageVendorDefined [] PROGMEM = "Vendor Def";
    57 
    58 // Generic Desktop Controls Page
    59 const char pstrUsagePointer [] PROGMEM = "Pointer";
    60 const char pstrUsageMouse [] PROGMEM = "Mouse";
    61 const char pstrUsageJoystick [] PROGMEM = "Joystick";
    62 const char pstrUsageGamePad [] PROGMEM = "Game Pad";
    63 const char pstrUsageKeyboard [] PROGMEM = "Kbrd";
    64 const char pstrUsageKeypad [] PROGMEM = "Keypad";
    65 const char pstrUsageMultiAxisController [] PROGMEM = "Multi-axis Ctrl";
    66 const char pstrUsageTabletPCSystemControls [] PROGMEM = "Tablet PC Sys Ctrls";
    67 const char pstrUsageX [] PROGMEM = "X";
    68 const char pstrUsageY [] PROGMEM = "Y";
    69 const char pstrUsageZ [] PROGMEM = "Z";
    70 const char pstrUsageRx [] PROGMEM = "Rx";
    71 const char pstrUsageRy [] PROGMEM = "Ry";
    72 const char pstrUsageRz [] PROGMEM = "Rz";
    73 const char pstrUsageSlider [] PROGMEM = "Slider";
    74 const char pstrUsageDial [] PROGMEM = "Dial";
    75 const char pstrUsageWheel [] PROGMEM = "Wheel";
    76 const char pstrUsageHatSwitch [] PROGMEM = "Hat Switch";
    77 const char pstrUsageCountedBuffer [] PROGMEM = "Counted Buf";
    78 const char pstrUsageByteCount [] PROGMEM = "Byte Count";
    79 const char pstrUsageMotionWakeup [] PROGMEM = "Motion Wakeup";
    80 const char pstrUsageStart [] PROGMEM = "Start";
    81 const char pstrUsageSelect [] PROGMEM = "Sel";
    82 const char pstrUsageVx [] PROGMEM = "Vx";
    83 const char pstrUsageVy [] PROGMEM = "Vy";
    84 const char pstrUsageVz [] PROGMEM = "Vz";
    85 const char pstrUsageVbrx [] PROGMEM = "Vbrx";
    86 const char pstrUsageVbry [] PROGMEM = "Vbry";
    87 const char pstrUsageVbrz [] PROGMEM = "Vbrz";
    88 const char pstrUsageVno [] PROGMEM = "Vno";
    89 const char pstrUsageFeatureNotification [] PROGMEM = "Feature Notif";
    90 const char pstrUsageResolutionMultiplier [] PROGMEM = "Res Mult";
    91 const char pstrUsageSystemControl [] PROGMEM = "Sys Ctrl";
    92 const char pstrUsageSystemPowerDown [] PROGMEM = "Sys Pwr Down";
    93 const char pstrUsageSystemSleep [] PROGMEM = "Sys Sleep";
    94 const char pstrUsageSystemWakeup [] PROGMEM = "Sys Wakeup";
    95 const char pstrUsageSystemContextMenu [] PROGMEM = "Sys Context Menu";
    96 const char pstrUsageSystemMainMenu [] PROGMEM = "Sys Main Menu";
    97 const char pstrUsageSystemAppMenu [] PROGMEM = "Sys App Menu";
    98 const char pstrUsageSystemMenuHelp [] PROGMEM = "Sys Menu Help";
    99 const char pstrUsageSystemMenuExit [] PROGMEM = "Sys Menu Exit";
    100 const char pstrUsageSystemMenuSelect [] PROGMEM = "Sys Menu Select";
    101 const char pstrUsageSystemMenuRight [] PROGMEM = "Sys Menu Right";
    102 const char pstrUsageSystemMenuLeft [] PROGMEM = "Sys Menu Left";
    103 const char pstrUsageSystemMenuUp [] PROGMEM = "Sys Menu Up";
    104 const char pstrUsageSystemMenuDown [] PROGMEM = "Sys Menu Down";
    105 const char pstrUsageSystemColdRestart [] PROGMEM = "Sys Cold Restart";
    106 const char pstrUsageSystemWarmRestart [] PROGMEM = "Sys Warm Restart";
    107 const char pstrUsageDPadUp [] PROGMEM = "D-pad Up";
    108 const char pstrUsageDPadDown [] PROGMEM = "D-pad Down";
    109 const char pstrUsageDPadRight [] PROGMEM = "D-pad Right";
    110 const char pstrUsageDPadLeft [] PROGMEM = "D-pad Left";
    111 const char pstrUsageSystemDock [] PROGMEM = "Sys Dock";
    112 const char pstrUsageSystemUndock [] PROGMEM = "Sys Undock";
    113 const char pstrUsageSystemSetup [] PROGMEM = "Sys Setup";
    114 const char pstrUsageSystemBreak [] PROGMEM = "Sys Break";
    115 const char pstrUsageSystemDebuggerBreak [] PROGMEM = "Sys Dbg Brk";
    116 const char pstrUsageApplicationBreak [] PROGMEM = "App Break";
    117 const char pstrUsageApplicationDebuggerBreak [] PROGMEM = "App Dbg Brk";
    118 const char pstrUsageSystemSpeakerMute [] PROGMEM = "Sys Spk Mute";
    119 const char pstrUsageSystemHibernate [] PROGMEM = "Sys Hiber";
    120 const char pstrUsageSystemDisplayInvert [] PROGMEM = "Sys Disp Inv";
    121 const char pstrUsageSystemDisplayInternal [] PROGMEM = "Sys Disp Int";
    122 const char pstrUsageSystemDisplayExternal [] PROGMEM = "Sys Disp Ext";
    123 const char pstrUsageSystemDisplayBoth [] PROGMEM = "Sys Disp Both";
    124 const char pstrUsageSystemDisplayDual [] PROGMEM = "Sys Disp Dual";
    125 const char pstrUsageSystemDisplayToggleIntExt [] PROGMEM = "Sys Disp Tgl Int/Ext";
    126 const char pstrUsageSystemDisplaySwapPriSec [] PROGMEM = "Sys Disp Swap Pri/Sec";
    127 const char pstrUsageSystemDisplayLCDAutoscale [] PROGMEM = "Sys Disp LCD Autoscale";
    128 
    129 // Simulation Controls Page
    130 const char pstrUsageFlightSimulationDevice [] PROGMEM = "Flight Simu Dev";
    131 const char pstrUsageAutomobileSimulationDevice [] PROGMEM = "Auto Simu Dev";
    132 const char pstrUsageTankSimulationDevice [] PROGMEM = "Tank Simu Dev";
    133 const char pstrUsageSpaceshipSimulationDevice [] PROGMEM = "Space Simu Dev";
    134 const char pstrUsageSubmarineSimulationDevice [] PROGMEM = "Subm Simu Dev";
    135 const char pstrUsageSailingSimulationDevice [] PROGMEM = "Sail Simu Dev";
    136 const char pstrUsageMotocicleSimulationDevice [] PROGMEM = "Moto Simu Dev";
    137 const char pstrUsageSportsSimulationDevice [] PROGMEM = "Sport Simu Dev";
    138 const char pstrUsageAirplaneSimulationDevice [] PROGMEM = "Airp Simu Dev";
    139 const char pstrUsageHelicopterSimulationDevice [] PROGMEM = "Heli Simu Dev";
    140 const char pstrUsageMagicCarpetSimulationDevice [] PROGMEM = "Magic Carpet Simu Dev";
    141 const char pstrUsageBicycleSimulationDevice [] PROGMEM = "Bike Simu Dev";
    142 const char pstrUsageFlightControlStick [] PROGMEM = "Flight Ctrl Stick";
    143 const char pstrUsageFlightStick [] PROGMEM = "Flight Stick";
    144 const char pstrUsageCyclicControl [] PROGMEM = "Cyclic Ctrl";
    145 const char pstrUsageCyclicTrim [] PROGMEM = "Cyclic Trim";
    146 const char pstrUsageFlightYoke [] PROGMEM = "Flight Yoke";
    147 const char pstrUsageTrackControl [] PROGMEM = "Track Ctrl";
    148 const char pstrUsageAileron [] PROGMEM = "Aileron";
    149 const char pstrUsageAileronTrim [] PROGMEM = "Aileron Trim";
    150 const char pstrUsageAntiTorqueControl [] PROGMEM = "Anti-Torque Ctrl";
    151 const char pstrUsageAutopilotEnable [] PROGMEM = "Autopilot Enable";
    152 const char pstrUsageChaffRelease [] PROGMEM = "Chaff Release";
    153 const char pstrUsageCollectiveControl [] PROGMEM = "Collective Ctrl";
    154 const char pstrUsageDiveBrake [] PROGMEM = "Dive Brake";
    155 const char pstrUsageElectronicCountermeasures [] PROGMEM = "El Countermeasures";
    156 const char pstrUsageElevator [] PROGMEM = "Elevator";
    157 const char pstrUsageElevatorTrim [] PROGMEM = "Elevator Trim";
    158 const char pstrUsageRudder [] PROGMEM = "Rudder";
    159 const char pstrUsageThrottle [] PROGMEM = "Throttle";
    160 const char pstrUsageFlightCommunications [] PROGMEM = "Flight Comm";
    161 const char pstrUsageFlareRelease [] PROGMEM = "Flare Release";
    162 const char pstrUsageLandingGear [] PROGMEM = "Landing Gear";
    163 const char pstrUsageToeBrake [] PROGMEM = "Toe Brake";
    164 const char pstrUsageTrigger [] PROGMEM = "Trigger";
    165 const char pstrUsageWeaponsArm [] PROGMEM = "Weapons Arm";
    166 const char pstrUsageWeaponsSelect [] PROGMEM = "Weapons Sel";
    167 const char pstrUsageWingFlaps [] PROGMEM = "Wing Flaps";
    168 const char pstrUsageAccelerator [] PROGMEM = "Accel";
    169 const char pstrUsageBrake [] PROGMEM = "Brake";
    170 const char pstrUsageClutch [] PROGMEM = "Clutch";
    171 const char pstrUsageShifter [] PROGMEM = "Shifter";
    172 const char pstrUsageSteering [] PROGMEM = "Steering";
    173 const char pstrUsageTurretDirection [] PROGMEM = "Turret Dir";
    174 const char pstrUsageBarrelElevation [] PROGMEM = "Barrel Ele";
    175 const char pstrUsageDivePlane [] PROGMEM = "Dive Plane";
    176 const char pstrUsageBallast [] PROGMEM = "Ballast";
    177 const char pstrUsageBicycleCrank [] PROGMEM = "Bicycle Crank";
    178 const char pstrUsageHandleBars [] PROGMEM = "Handle Bars";
    179 const char pstrUsageFrontBrake [] PROGMEM = "Front Brake";
    180 const char pstrUsageRearBrake [] PROGMEM = "Rear Brake";
    181 
    182 // VR Controls Page
    183 const char pstrUsageBelt [] PROGMEM = "Belt";
    184 const char pstrUsageBodySuit [] PROGMEM = "Body Suit";
    185 const char pstrUsageFlexor [] PROGMEM = "Flexor";
    186 const char pstrUsageGlove [] PROGMEM = "Glove";
    187 const char pstrUsageHeadTracker [] PROGMEM = "Head Track";
    188 const char pstrUsageHeadMountedDisplay [] PROGMEM = "Head Disp";
    189 const char pstrUsageHandTracker [] PROGMEM = "Hand Track";
    190 const char pstrUsageOculometer [] PROGMEM = "Oculometer";
    191 const char pstrUsageVest [] PROGMEM = "Vest";
    192 const char pstrUsageAnimatronicDevice [] PROGMEM = "Animat Dev";
    193 const char pstrUsageStereoEnable [] PROGMEM = "Stereo Enbl";
    194 const char pstrUsageDisplayEnable [] PROGMEM = "Display Enbl";
    195 
    196 // Sport Controls Page
    197 const char pstrUsageBaseballBat [] PROGMEM = "Baseball Bat";
    198 const char pstrUsageGolfClub [] PROGMEM = "Golf Club";
    199 const char pstrUsageRowingMachine [] PROGMEM = "Rowing Mach";
    200 const char pstrUsageTreadmill [] PROGMEM = "Treadmill";
    201 const char pstrUsageOar [] PROGMEM = "Oar";
    202 const char pstrUsageSlope [] PROGMEM = "Slope";
    203 const char pstrUsageRate [] PROGMEM = "Rate";
    204 const char pstrUsageStickSpeed [] PROGMEM = "Stick Speed";
    205 const char pstrUsageStickFaceAngle [] PROGMEM = "Stick Face Ang";
    206 const char pstrUsageStickHeelToe [] PROGMEM = "Stick Heel/Toe";
    207 const char pstrUsageStickFollowThough [] PROGMEM = "Stick Flw Thru";
    208 const char pstrUsageStickTempo [] PROGMEM = "Stick Tempo";
    209 const char pstrUsageStickType [] PROGMEM = "Stick Type";
    210 const char pstrUsageStickHeight [] PROGMEM = "Stick Hght";
    211 const char pstrUsagePutter [] PROGMEM = "Putter";
    212 const char pstrUsage1Iron [] PROGMEM = "1 Iron";
    213 const char pstrUsage2Iron [] PROGMEM = "2 Iron";
    214 const char pstrUsage3Iron [] PROGMEM = "3 Iron";
    215 const char pstrUsage4Iron [] PROGMEM = "4 Iron";
    216 const char pstrUsage5Iron [] PROGMEM = "5 Iron";
    217 const char pstrUsage6Iron [] PROGMEM = "6 Iron";
    218 const char pstrUsage7Iron [] PROGMEM = "7 Iron";
    219 const char pstrUsage8Iron [] PROGMEM = "8 Iron";
    220 const char pstrUsage9Iron [] PROGMEM = "9 Iron";
    221 const char pstrUsage10Iron [] PROGMEM = "10 Iron";
    222 const char pstrUsage11Iron [] PROGMEM = "11 Iron";
    223 const char pstrUsageSandWedge [] PROGMEM = "Sand Wedge";
    224 const char pstrUsageLoftWedge [] PROGMEM = "Loft Wedge";
    225 const char pstrUsagePowerWedge [] PROGMEM = "Pwr Wedge";
    226 const char pstrUsage1Wood [] PROGMEM = "1 Wood";
    227 const char pstrUsage3Wood [] PROGMEM = "3 Wood";
    228 const char pstrUsage5Wood [] PROGMEM = "5 Wood";
    229 const char pstrUsage7Wood [] PROGMEM = "7 Wood";
    230 const char pstrUsage9Wood [] PROGMEM = "9 Wood";
    231 
    232 // Game Controls Page
    233 const char pstrUsage3DGameController [] PROGMEM = "3D Game Ctrl";
    234 const char pstrUsagePinballDevice [] PROGMEM = "Pinball Dev";
    235 const char pstrUsageGunDevice [] PROGMEM = "Gun Dev";
    236 const char pstrUsagePointOfView [] PROGMEM = "POV";
    237 const char pstrUsageTurnRightLeft [] PROGMEM = "Turn Right Left";
    238 const char pstrUsagePitchForwardBackward [] PROGMEM = "Pitch Fwd/Back";
    239 const char pstrUsageRollRightLeft [] PROGMEM = "Roll Right/Left";
    240 const char pstrUsageMoveRightLeft [] PROGMEM = "Move Right/Left";
    241 const char pstrUsageMoveForwardBackward [] PROGMEM = "Move Fwd/Back";
    242 const char pstrUsageMoveUpDown [] PROGMEM = "Move Up/Down";
    243 const char pstrUsageLeanRightLeft [] PROGMEM = "Lean Right/Left";
    244 const char pstrUsageLeanForwardBackward [] PROGMEM = "Lean Fwd/Back";
    245 const char pstrUsageHeightOfPOV [] PROGMEM = "Height of POV";
    246 const char pstrUsageFlipper [] PROGMEM = "Flipper";
    247 const char pstrUsageSecondaryFlipper [] PROGMEM = "Second Flipper";
    248 const char pstrUsageBump [] PROGMEM = "Bump";
    249 const char pstrUsageNewGame [] PROGMEM = "New Game";
    250 const char pstrUsageShootBall [] PROGMEM = "Shoot Ball";
    251 const char pstrUsagePlayer [] PROGMEM = "Player";
    252 const char pstrUsageGunBolt [] PROGMEM = "Gun Bolt";
    253 const char pstrUsageGunClip [] PROGMEM = "Gun Clip";
    254 const char pstrUsageGunSelector [] PROGMEM = "Gun Sel";
    255 const char pstrUsageGunSingleShot [] PROGMEM = "Gun Sngl Shot";
    256 const char pstrUsageGunBurst [] PROGMEM = "Gun Burst";
    257 const char pstrUsageGunAutomatic [] PROGMEM = "Gun Auto";
    258 const char pstrUsageGunSafety [] PROGMEM = "Gun Safety";
    259 const char pstrUsageGamepadFireJump [] PROGMEM = "Gamepad Fire/Jump";
    260 const char pstrUsageGamepadTrigger [] PROGMEM = "Gamepad Trig";
    261 
    262 // Generic Device Controls Page
    263 const char pstrUsageBatteryStrength [] PROGMEM = "Bat Strength";
    264 const char pstrUsageWirelessChannel [] PROGMEM = "Wireless Ch";
    265 const char pstrUsageWirelessID [] PROGMEM = "Wireless ID";
    266 const char pstrUsageDiscoverWirelessControl [] PROGMEM = "Discover Wireless Ctrl";
    267 const char pstrUsageSecurityCodeCharEntered [] PROGMEM = "Sec Code Char Entrd";
    268 const char pstrUsageSecurityCodeCharErased [] PROGMEM = "Sec Code Char Erased";
    269 const char pstrUsageSecurityCodeCleared [] PROGMEM = "Sec Code Cleared";
    270 
    271 // LED Page
    272 const char pstrUsageNumLock [] PROGMEM = "Num Lock";
    273 const char pstrUsageCapsLock [] PROGMEM = "Caps Lock";
    274 const char pstrUsageScrollLock [] PROGMEM = "Scroll Lock";
    275 const char pstrUsageCompose [] PROGMEM = "Compose";
    276 const char pstrUsageKana [] PROGMEM = "Kana";
    277 const char pstrUsagePower [] PROGMEM = "Pwr";
    278 const char pstrUsageShift [] PROGMEM = "Shift";
    279 const char pstrUsageDoNotDisturb [] PROGMEM = "DND";
    280 const char pstrUsageMute [] PROGMEM = "Mute";
    281 const char pstrUsageToneEnable [] PROGMEM = "Tone Enbl";
    282 const char pstrUsageHighCutFilter [] PROGMEM = "High Cut Fltr";
    283 const char pstrUsageLowCutFilter [] PROGMEM = "Low Cut Fltr";
    284 const char pstrUsageEqualizerEnable [] PROGMEM = "Eq Enbl";
    285 const char pstrUsageSoundFieldOn [] PROGMEM = "Sound Field On";
    286 const char pstrUsageSurroundOn [] PROGMEM = "Surround On";
    287 const char pstrUsageRepeat [] PROGMEM = "Repeat";
    288 const char pstrUsageStereo [] PROGMEM = "Stereo";
    289 const char pstrUsageSamplingRateDetect [] PROGMEM = "Smpl Rate Detect";
    290 const char pstrUsageSpinning [] PROGMEM = "Spinning";
    291 const char pstrUsageCAV [] PROGMEM = "CAV";
    292 const char pstrUsageCLV [] PROGMEM = "CLV";
    293 const char pstrUsageRecordingFormatDetect [] PROGMEM = "Rec Format Detect";
    294 const char pstrUsageOffHook [] PROGMEM = "Off Hook";
    295 const char pstrUsageRing [] PROGMEM = "Ring";
    296 const char pstrUsageMessageWaiting [] PROGMEM = "Msg Wait";
    297 const char pstrUsageDataMode [] PROGMEM = "Data Mode";
    298 const char pstrUsageBatteryOperation [] PROGMEM = "Bat Op";
    299 const char pstrUsageBatteryOK [] PROGMEM = "Bat OK";
    300 const char pstrUsageBatteryLow [] PROGMEM = "Bat Low";
    301 const char pstrUsageSpeaker [] PROGMEM = "Speaker";
    302 const char pstrUsageHeadSet [] PROGMEM = "Head Set";
    303 const char pstrUsageHold [] PROGMEM = "Hold";
    304 const char pstrUsageMicrophone [] PROGMEM = "Mic";
    305 const char pstrUsageCoverage [] PROGMEM = "Coverage";
    306 const char pstrUsageNightMode [] PROGMEM = "Night Mode";
    307 const char pstrUsageSendCalls [] PROGMEM = "Send Calls";
    308 const char pstrUsageCallPickup [] PROGMEM = "Call Pickup";
    309 const char pstrUsageConference [] PROGMEM = "Conf";
    310 const char pstrUsageStandBy [] PROGMEM = "Stand-by";
    311 const char pstrUsageCameraOn [] PROGMEM = "Cam On";
    312 const char pstrUsageCameraOff [] PROGMEM = "Cam Off";
    313 const char pstrUsageOnLine [] PROGMEM = "On-Line";
    314 const char pstrUsageOffLine [] PROGMEM = "Off-Line";
    315 const char pstrUsageBusy [] PROGMEM = "Busy";
    316 const char pstrUsageReady [] PROGMEM = "Ready";
    317 const char pstrUsagePaperOut [] PROGMEM = "Paper Out";
    318 const char pstrUsagePaperJam [] PROGMEM = "Paper Jam";
    319 const char pstrUsageRemote [] PROGMEM = "Remote";
    320 const char pstrUsageForward [] PROGMEM = "Fwd";
    321 const char pstrUsageReverse [] PROGMEM = "Rev";
    322 const char pstrUsageStop [] PROGMEM = "Stop";
    323 const char pstrUsageRewind [] PROGMEM = "Rewind";
    324 const char pstrUsageFastForward [] PROGMEM = "Fast Fwd";
    325 const char pstrUsagePlay [] PROGMEM = "Play";
    326 const char pstrUsagePause [] PROGMEM = "Pause";
    327 const char pstrUsageRecord [] PROGMEM = "Rec";
    328 const char pstrUsageError [] PROGMEM = "Error";
    329 const char pstrUsageSelectedIndicator [] PROGMEM = "Usage Sel Ind";
    330 const char pstrUsageInUseIndicator [] PROGMEM = "Usage In Use Ind";
    331 const char pstrUsageMultiModeIndicator [] PROGMEM = "Usage Multi Mode Ind";
    332 const char pstrUsageIndicatorOn [] PROGMEM = "Ind On";
    333 const char pstrUsageIndicatorFlash [] PROGMEM = "Ind Flash";
    334 const char pstrUsageIndicatorSlowBlink [] PROGMEM = "Ind Slow Blk";
    335 const char pstrUsageIndicatorFastBlink [] PROGMEM = "Ind Fast Blk";
    336 const char pstrUsageIndicatorOff [] PROGMEM = "Ind Off";
    337 const char pstrUsageFlashOnTime [] PROGMEM = "Flash On Time";
    338 const char pstrUsageSlowBlinkOnTime [] PROGMEM = "Slow Blk On Time";
    339 const char pstrUsageSlowBlinkOffTime [] PROGMEM = "Slow Blk Off Time";
    340 const char pstrUsageFastBlinkOnTime [] PROGMEM = "Fast Blk On Time";
    341 const char pstrUsageFastBlinkOffTime [] PROGMEM = "Fast Blk Off Time";
    342 const char pstrUsageIndicatorColor [] PROGMEM = "Usage Ind Color";
    343 const char pstrUsageIndicatorRed [] PROGMEM = "Ind Red";
    344 const char pstrUsageIndicatorGreen [] PROGMEM = "Ind Green";
    345 const char pstrUsageIndicatorAmber [] PROGMEM = "Ind Amber";
    346 const char pstrUsageGenericIndicator [] PROGMEM = "Gen Ind";
    347 const char pstrUsageSystemSuspend [] PROGMEM = "Sys Suspend";
    348 const char pstrUsageExternalPowerConnected [] PROGMEM = "Ext Pwr Conn";
    349 
    350 // Telephony Usage Page
    351 const char pstrUsagePhone [] PROGMEM = "Phone";
    352 const char pstrUsageAnsweringMachine [] PROGMEM = "Answ Mach";
    353 const char pstrUsageMessageControls [] PROGMEM = "Msg Ctrls";
    354 const char pstrUsageHandset [] PROGMEM = "Handset";
    355 const char pstrUsageHeadset [] PROGMEM = "Headset";
    356 const char pstrUsageTelephonyKeyPad [] PROGMEM = "Tel Key Pad";
    357 const char pstrUsageProgrammableButton [] PROGMEM = "Prog Button";
    358 const char pstrUsageHookSwitch [] PROGMEM = "Hook Sw";
    359 const char pstrUsageFlash [] PROGMEM = "Flash";
    360 const char pstrUsageFeature [] PROGMEM = "Feature";
    361 //const char pstrUsageHold [] PROGMEM = "Hold";
    362 const char pstrUsageRedial [] PROGMEM = "Redial";
    363 const char pstrUsageTransfer [] PROGMEM = "Transfer";
    364 const char pstrUsageDrop [] PROGMEM = "Drop";
    365 const char pstrUsagePark [] PROGMEM = "Park";
    366 const char pstrUsageForwardCalls [] PROGMEM = "Fwd Calls";
    367 const char pstrUsageAlternateFunction [] PROGMEM = "Alt Func";
    368 const char pstrUsageLine [] PROGMEM = "Line";
    369 const char pstrUsageSpeakerPhone [] PROGMEM = "Spk Phone";
    370 //const char pstrUsageConference [] PROGMEM = "Conference";
    371 const char pstrUsageRingEnable [] PROGMEM = "Ring Enbl";
    372 const char pstrUsageRingSelect [] PROGMEM = "Ring Sel";
    373 const char pstrUsagePhoneMute [] PROGMEM = "Phone Mute";
    374 const char pstrUsageCallerID [] PROGMEM = "Caller ID";
    375 const char pstrUsageSend [] PROGMEM = "Send";
    376 const char pstrUsageSpeedDial [] PROGMEM = "Speed Dial";
    377 const char pstrUsageStoreNumber [] PROGMEM = "Store Num";
    378 const char pstrUsageRecallNumber [] PROGMEM = "Recall Num";
    379 const char pstrUsagePhoneDirectory [] PROGMEM = "Phone Dir";
    380 const char pstrUsageVoiceMail [] PROGMEM = "Voice Mail";
    381 const char pstrUsageScreenCalls [] PROGMEM = "Screen Calls";
    382 //const char pstrUsageDoNotDisturb [] PROGMEM = "Do Not Disturb";
    383 const char pstrUsageMessage [] PROGMEM = "Msg";
    384 const char pstrUsageAnswerOnOff [] PROGMEM = "Answer On/Off";
    385 const char pstrUsageInsideDialTone [] PROGMEM = "Inside Dial Tone";
    386 const char pstrUsageOutsideDialTone [] PROGMEM = "Outside Dial Tone";
    387 const char pstrUsageInsideRingTone [] PROGMEM = "Inside Ring Tone";
    388 const char pstrUsageOutsideRingTone [] PROGMEM = "Outside Ring Tone";
    389 const char pstrUsagePriorityRingTone [] PROGMEM = "Prior Ring Tone";
    390 const char pstrUsageInsideRingback [] PROGMEM = "Inside Ringback";
    391 const char pstrUsagePriorityRingback [] PROGMEM = "Priority Ringback";
    392 const char pstrUsageLineBusyTone [] PROGMEM = "Ln Busy Tone";
    393 const char pstrUsageReorderTone [] PROGMEM = "Reorder Tone";
    394 const char pstrUsageCallWaitingTone [] PROGMEM = "Call Wait Tone";
    395 const char pstrUsageConfirmationTone1 [] PROGMEM = "Cnfrm Tone1";
    396 const char pstrUsageConfirmationTone2 [] PROGMEM = "Cnfrm Tone2";
    397 const char pstrUsageTonesOff [] PROGMEM = "Tones Off";
    398 const char pstrUsageOutsideRingback [] PROGMEM = "Outside Ringback";
    399 const char pstrUsageRinger [] PROGMEM = "Ringer";
    400 const char pstrUsagePhoneKey0 [] PROGMEM = "0";
    401 const char pstrUsagePhoneKey1 [] PROGMEM = "1";
    402 const char pstrUsagePhoneKey2 [] PROGMEM = "2";
    403 const char pstrUsagePhoneKey3 [] PROGMEM = "3";
    404 const char pstrUsagePhoneKey4 [] PROGMEM = "4";
    405 const char pstrUsagePhoneKey5 [] PROGMEM = "5";
    406 const char pstrUsagePhoneKey6 [] PROGMEM = "6";
    407 const char pstrUsagePhoneKey7 [] PROGMEM = "7";
    408 const char pstrUsagePhoneKey8 [] PROGMEM = "8";
    409 const char pstrUsagePhoneKey9 [] PROGMEM = "9";
    410 const char pstrUsagePhoneKeyStar [] PROGMEM = "*";
    411 const char pstrUsagePhoneKeyPound [] PROGMEM = "#";
    412 const char pstrUsagePhoneKeyA [] PROGMEM = "A";
    413 const char pstrUsagePhoneKeyB [] PROGMEM = "B";
    414 const char pstrUsagePhoneKeyC [] PROGMEM = "C";
    415 const char pstrUsagePhoneKeyD [] PROGMEM = "D";
    416 
    417 // Consumer Usage Page
    418 const char pstrUsageConsumerControl [] PROGMEM = "Consumer Ctrl";
    419 const char pstrUsageNumericKeyPad [] PROGMEM = "Num Key Pad";
    420 //const char pstrUsageProgrammableButton [] PROGMEM = "Prog Btn";
    421 //const char pstrUsageMicrophone [] PROGMEM = "Mic";
    422 const char pstrUsageHeadphone [] PROGMEM = "Headphone";
    423 const char pstrUsageGraphicEqualizer [] PROGMEM = "Graph Eq";
    424 const char pstrUsagePlus10 [] PROGMEM = "+10";
    425 const char pstrUsagePlus100 [] PROGMEM = "+100";
    426 const char pstrUsageAMPM [] PROGMEM = "AM/PM";
    427 //const char pstrUsagePower [] PROGMEM = "Pwr";
    428 const char pstrUsageReset [] PROGMEM = "Reset";
    429 const char pstrUsageSleep [] PROGMEM = "Sleep";
    430 const char pstrUsageSleepAfter [] PROGMEM = "Sleep After";
    431 const char pstrUsageSleepMode [] PROGMEM = "Sleep Mode";
    432 const char pstrUsageIllumination [] PROGMEM = "Illumin";
    433 const char pstrUsageFunctionButtons [] PROGMEM = "Func Btns";
    434 const char pstrUsageMenu [] PROGMEM = "Menu";
    435 const char pstrUsageMenuPick [] PROGMEM = "Menu Pick";
    436 const char pstrUsageMenuUp [] PROGMEM = "Menu Up";
    437 const char pstrUsageMenuDown [] PROGMEM = "Menu Down";
    438 const char pstrUsageMenuLeft [] PROGMEM = "Menu Left";
    439 const char pstrUsageMenuRight [] PROGMEM = "Menu Right";
    440 const char pstrUsageMenuEscape [] PROGMEM = "Menu Esc";
    441 const char pstrUsageMenuValueIncrease [] PROGMEM = "Menu Val Inc";
    442 const char pstrUsageMenuValueDecrease [] PROGMEM = "Menu Val Dec";
    443 const char pstrUsageDataOnScreen [] PROGMEM = "Data On Scr";
    444 const char pstrUsageClosedCaption [] PROGMEM = "Closed Cptn";
    445 const char pstrUsageClosedCaptionSelect [] PROGMEM = "Closed Cptn Sel";
    446 const char pstrUsageVCRTV [] PROGMEM = "VCR/TV";
    447 const char pstrUsageBroadcastMode [] PROGMEM = "Brdcast Mode";
    448 const char pstrUsageSnapshot [] PROGMEM = "Snapshot";
    449 const char pstrUsageStill [] PROGMEM = "Still";
    450 const char pstrUsageSelection [] PROGMEM = "Sel";
    451 const char pstrUsageAssignSelection [] PROGMEM = "Assign Sel";
    452 const char pstrUsageModeStep [] PROGMEM = "Mode Step";
    453 const char pstrUsageRecallLast [] PROGMEM = "Recall Last";
    454 const char pstrUsageEnterChannel [] PROGMEM = "Entr Channel";
    455 const char pstrUsageOrderMovie [] PROGMEM = "Ord Movie";
    456 const char pstrUsageChannel [] PROGMEM = "Channel";
    457 const char pstrUsageMediaSelection [] PROGMEM = "Med Sel";
    458 const char pstrUsageMediaSelectComputer [] PROGMEM = "Med Sel Comp";
    459 const char pstrUsageMediaSelectTV [] PROGMEM = "Med Sel TV";
    460 const char pstrUsageMediaSelectWWW [] PROGMEM = "Med Sel WWW";
    461 const char pstrUsageMediaSelectDVD [] PROGMEM = "Med Sel DVD";
    462 const char pstrUsageMediaSelectTelephone [] PROGMEM = "Med Sel Tel";
    463 const char pstrUsageMediaSelectProgramGuide [] PROGMEM = "Med Sel PG";
    464 const char pstrUsageMediaSelectVideoPhone [] PROGMEM = "Med Sel Vid";
    465 const char pstrUsageMediaSelectGames [] PROGMEM = "Med Sel Games";
    466 const char pstrUsageMediaSelectMessages [] PROGMEM = "Med Sel Msg";
    467 const char pstrUsageMediaSelectCD [] PROGMEM = "Med Sel CD";
    468 const char pstrUsageMediaSelectVCR [] PROGMEM = "Med Sel VCR";
    469 const char pstrUsageMediaSelectTuner [] PROGMEM = "Med Sel Tuner";
    470 const char pstrUsageQuit [] PROGMEM = "Quit";
    471 const char pstrUsageHelp [] PROGMEM = "Help";
    472 const char pstrUsageMediaSelectTape [] PROGMEM = "Med Sel Tape";
    473 const char pstrUsageMediaSelectCable [] PROGMEM = "Med Sel Cbl";
    474 const char pstrUsageMediaSelectSatellite [] PROGMEM = "Med Sel Sat";
    475 const char pstrUsageMediaSelectSecurity [] PROGMEM = "Med Sel Secur";
    476 const char pstrUsageMediaSelectHome [] PROGMEM = "Med Sel Home";
    477 const char pstrUsageMediaSelectCall [] PROGMEM = "Med Sel Call";
    478 const char pstrUsageChannelIncrement [] PROGMEM = "Ch Inc";
    479 const char pstrUsageChannelDecrement [] PROGMEM = "Ch Dec";
    480 const char pstrUsageMediaSelectSAP [] PROGMEM = "Med Sel SAP";
    481 const char pstrUsageVCRPlus [] PROGMEM = "VCR+";
    482 const char pstrUsageOnce [] PROGMEM = "Once";
    483 const char pstrUsageDaily [] PROGMEM = "Daily";
    484 const char pstrUsageWeekly [] PROGMEM = "Weekly";
    485 const char pstrUsageMonthly [] PROGMEM = "Monthly";
    486 //const char pstrUsagePlay [] PROGMEM = "Play";
    487 //const char pstrUsagePause [] PROGMEM = "Pause";
    488 //const char pstrUsageRecord [] PROGMEM = "Rec";
    489 //const char pstrUsageFastForward [] PROGMEM = "FF";
    490 //const char pstrUsageRewind [] PROGMEM = "Rewind";
    491 const char pstrUsageScanNextTrack [] PROGMEM = "Next Track";
    492 const char pstrUsageScanPreviousTrack [] PROGMEM = "Prev Track";
    493 //const char pstrUsageStop [] PROGMEM = "Stop";
    494 const char pstrUsageEject [] PROGMEM = "Eject";
    495 const char pstrUsageRandomPlay [] PROGMEM = "Random";
    496 const char pstrUsageSelectDisk [] PROGMEM = "Sel Disk";
    497 const char pstrUsageEnterDisk [] PROGMEM = "Ent Disk";
    498 //const char pstrUsageRepeat [] PROGMEM = "Repeat";
    499 const char pstrUsageTracking [] PROGMEM = "Tracking";
    500 const char pstrUsageTrackNormal [] PROGMEM = "Trk Norm";
    501 const char pstrUsageSlowTracking [] PROGMEM = "Slow Trk";
    502 const char pstrUsageFrameForward [] PROGMEM = "Frm Fwd";
    503 const char pstrUsageFrameBackwards [] PROGMEM = "Frm Back";
    504 const char pstrUsageMark [] PROGMEM = "Mark";
    505 const char pstrUsageClearMark [] PROGMEM = "Clr Mark";
    506 const char pstrUsageRepeatFromMark [] PROGMEM = "Rpt Mark";
    507 const char pstrUsageReturnToMark [] PROGMEM = "Ret to Mark";
    508 const char pstrUsageSearchMarkForward [] PROGMEM = "Search Mark Fwd";
    509 const char pstrUsageSearchMarkBackwards [] PROGMEM = "Search Mark Back";
    510 const char pstrUsageCounterReset [] PROGMEM = "Counter Reset";
    511 const char pstrUsageShowCounter [] PROGMEM = "Show Counter";
    512 const char pstrUsageTrackingIncrement [] PROGMEM = "Track Inc";
    513 const char pstrUsageTrackingDecrement [] PROGMEM = "Track Dec";
    514 const char pstrUsageStopEject [] PROGMEM = "Stop/Eject";
    515 const char pstrUsagePlayPause [] PROGMEM = "Play/Pause";
    516 const char pstrUsagePlaySkip [] PROGMEM = "Play/Skip";
    517 const char pstrUsageVolume [] PROGMEM = "Vol";
    518 const char pstrUsageBalance [] PROGMEM = "Balance";
    519 //const char pstrUsageMute [] PROGMEM = "Mute";
    520 const char pstrUsageBass [] PROGMEM = "Bass";
    521 const char pstrUsageTreble [] PROGMEM = "Treble";
    522 const char pstrUsageBassBoost [] PROGMEM = "Bass Boost";
    523 const char pstrUsageSurroundMode [] PROGMEM = "Surround";
    524 const char pstrUsageLoudness [] PROGMEM = "Loud";
    525 const char pstrUsageMPX [] PROGMEM = "MPX";
    526 const char pstrUsageVolumeIncrement [] PROGMEM = "Vol Inc";
    527 const char pstrUsageVolumeDecrement [] PROGMEM = "Vol Dec";
    528 const char pstrUsageSpeedSelect [] PROGMEM = "Speed";
    529 const char pstrUsagePlaybackSpeed [] PROGMEM = "Play Speed";
    530 const char pstrUsageStandardPlay [] PROGMEM = "Std Play";
    531 const char pstrUsageLongPlay [] PROGMEM = "Long Play";
    532 const char pstrUsageExtendedPlay [] PROGMEM = "Ext Play";
    533 const char pstrUsageSlow [] PROGMEM = "Slow";
    534 const char pstrUsageFanEnable [] PROGMEM = "Fan Enbl";
    535 const char pstrUsageFanSpeed [] PROGMEM = "Fan Speed";
    536 const char pstrUsageLightEnable [] PROGMEM = "Light Enbl";
    537 const char pstrUsageLightIlluminationLevel [] PROGMEM = "Light Illum Lev";
    538 const char pstrUsageClimateControlEnable [] PROGMEM = "Climate Enbl";
    539 const char pstrUsageRoomTemperature [] PROGMEM = "Room Temp";
    540 const char pstrUsageSecurityEnable [] PROGMEM = "Secur Enbl";
    541 const char pstrUsageFireAlarm [] PROGMEM = "Fire Alm";
    542 const char pstrUsagePoliceAlarm [] PROGMEM = "Police Alm";
    543 const char pstrUsageProximity [] PROGMEM = "Prox";
    544 const char pstrUsageMotion [] PROGMEM = "Motion";
    545 const char pstrUsageDuresAlarm [] PROGMEM = "Dures Alm";
    546 const char pstrUsageHoldupAlarm [] PROGMEM = "Holdup Alm";
    547 const char pstrUsageMedicalAlarm [] PROGMEM = "Med Alm";
    548 const char pstrUsageBalanceRight [] PROGMEM = "Balance Right";
    549 const char pstrUsageBalanceLeft [] PROGMEM = "Balance Left";
    550 const char pstrUsageBassIncrement [] PROGMEM = "Bass Inc";
    551 const char pstrUsageBassDecrement [] PROGMEM = "Bass Dec";
    552 const char pstrUsageTrebleIncrement [] PROGMEM = "Treble Inc";
    553 const char pstrUsageTrebleDecrement [] PROGMEM = "Treble Dec";
    554 const char pstrUsageSpeakerSystem [] PROGMEM = "Spk Sys";
    555 const char pstrUsageChannelLeft [] PROGMEM = "Ch Left";
    556 const char pstrUsageChannelRight [] PROGMEM = "Ch Right";
    557 const char pstrUsageChannelCenter [] PROGMEM = "Ch Center";
    558 const char pstrUsageChannelFront [] PROGMEM = "Ch Front";
    559 const char pstrUsageChannelCenterFront [] PROGMEM = "Ch Cntr Front";
    560 const char pstrUsageChannelSide [] PROGMEM = "Ch Side";
    561 const char pstrUsageChannelSurround [] PROGMEM = "Ch Surround";
    562 const char pstrUsageChannelLowFreqEnhancement [] PROGMEM = "Ch Low Freq Enh";
    563 const char pstrUsageChannelTop [] PROGMEM = "Ch Top";
    564 const char pstrUsageChannelUnknown [] PROGMEM = "Ch Unk";
    565 const char pstrUsageSubChannel [] PROGMEM = "Sub-ch";
    566 const char pstrUsageSubChannelIncrement [] PROGMEM = "Sub-ch Inc";
    567 const char pstrUsageSubChannelDecrement [] PROGMEM = "Sub-ch Dec";
    568 const char pstrUsageAlternateAudioIncrement [] PROGMEM = "Alt Aud Inc";
    569 const char pstrUsageAlternateAudioDecrement [] PROGMEM = "Alt Aud Dec";
    570 const char pstrUsageApplicationLaunchButtons [] PROGMEM = "App Launch Btns";
    571 const char pstrUsageALLaunchButtonConfigTool [] PROGMEM = "AL Launch Conf Tl";
    572 const char pstrUsageALProgrammableButton [] PROGMEM = "AL Pgm Btn";
    573 const char pstrUsageALConsumerControlConfig [] PROGMEM = "AL Cons Ctrl Cfg";
    574 const char pstrUsageALWordProcessor [] PROGMEM = "AL Word Proc";
    575 const char pstrUsageALTextEditor [] PROGMEM = "AL Txt Edtr";
    576 const char pstrUsageALSpreadsheet [] PROGMEM = "AL Sprdsheet";
    577 const char pstrUsageALGraphicsEditor [] PROGMEM = "AL Graph Edtr";
    578 const char pstrUsageALPresentationApp [] PROGMEM = "AL Present App";
    579 const char pstrUsageALDatabaseApp [] PROGMEM = "AL DB App";
    580 const char pstrUsageALEmailReader [] PROGMEM = "AL E-mail Rdr";
    581 const char pstrUsageALNewsreader [] PROGMEM = "AL Newsrdr";
    582 const char pstrUsageALVoicemail [] PROGMEM = "AL Voicemail";
    583 const char pstrUsageALContactsAddressBook [] PROGMEM = "AL Addr Book";
    584 const char pstrUsageALCalendarSchedule [] PROGMEM = "AL Clndr/Schdlr";
    585 const char pstrUsageALTaskProjectManager [] PROGMEM = "AL Task/Prj Mgr";
    586 const char pstrUsageALLogJournalTimecard [] PROGMEM = "AL Log/Jrnl/Tmcrd";
    587 const char pstrUsageALCheckbookFinance [] PROGMEM = "AL Chckbook/Fin";
    588 const char pstrUsageALCalculator [] PROGMEM = "AL Calc";
    589 const char pstrUsageALAVCapturePlayback [] PROGMEM = "AL A/V Capt/Play";
    590 const char pstrUsageALLocalMachineBrowser [] PROGMEM = "AL Loc Mach Brow";
    591 const char pstrUsageALLANWANBrow [] PROGMEM = "AL LAN/WAN Brow";
    592 const char pstrUsageALInternetBrowser [] PROGMEM = "AL I-net Brow";
    593 const char pstrUsageALRemoteNetISPConnect [] PROGMEM = "AL Rem Net Con";
    594 const char pstrUsageALNetworkConference [] PROGMEM = "AL Net Conf";
    595 const char pstrUsageALNetworkChat [] PROGMEM = "AL Net Chat";
    596 const char pstrUsageALTelephonyDialer [] PROGMEM = "AL Tel/Dial";
    597 const char pstrUsageALLogon [] PROGMEM = "AL Logon";
    598 const char pstrUsageALLogoff [] PROGMEM = "AL Logoff";
    599 const char pstrUsageALLogonLogoff [] PROGMEM = "AL Logon/Logoff";
    600 const char pstrUsageALTermLockScrSav [] PROGMEM = "AL Term Lock/Scr Sav";
    601 const char pstrUsageALControlPannel [] PROGMEM = "AL Ctrl Pan";
    602 const char pstrUsageALCommandLineProcessorRun [] PROGMEM = "AL Cmd/Run";
    603 const char pstrUsageALProcessTaskManager [] PROGMEM = "AL Task Mgr";
    604 const char pstrUsageALSelectTaskApplication [] PROGMEM = "AL Sel App";
    605 const char pstrUsageALNextTaskApplication [] PROGMEM = "AL Next App";
    606 const char pstrUsageALPreviousTaskApplication [] PROGMEM = "AL Prev App";
    607 const char pstrUsageALPreemptiveHaltTaskApp [] PROGMEM = "AL Prmpt Halt App";
    608 const char pstrUsageALIntegratedHelpCenter [] PROGMEM = "AL Hlp Cntr";
    609 const char pstrUsageALDocuments [] PROGMEM = "AL Docs";
    610 const char pstrUsageALThesaurus [] PROGMEM = "AL Thsrs";
    611 const char pstrUsageALDictionary [] PROGMEM = "AL Dict";
    612 const char pstrUsageALDesktop [] PROGMEM = "AL Desktop";
    613 const char pstrUsageALSpellCheck [] PROGMEM = "AL Spell Chk";
    614 const char pstrUsageALGrammarCheck [] PROGMEM = "AL Gram Chk";
    615 const char pstrUsageALWirelessStatus [] PROGMEM = "AL Wireless Sts";
    616 const char pstrUsageALKeyboardLayout [] PROGMEM = "AL Kbd Layout";
    617 const char pstrUsageALVirusProtection [] PROGMEM = "AL Vir Protect";
    618 const char pstrUsageALEncryption [] PROGMEM = "AL Encrypt";
    619 const char pstrUsageALScreenSaver [] PROGMEM = "AL Scr Sav";
    620 const char pstrUsageALAlarms [] PROGMEM = "AL Alarms";
    621 const char pstrUsageALClock [] PROGMEM = "AL Clock";
    622 const char pstrUsageALFileBrowser [] PROGMEM = "AL File Brow";
    623 const char pstrUsageALPowerStatus [] PROGMEM = "AL Pwr Sts";
    624 const char pstrUsageALImageBrowser [] PROGMEM = "AL Img Brow";
    625 const char pstrUsageALAudioBrowser [] PROGMEM = "AL Aud Brow";
    626 const char pstrUsageALMovieBrowser [] PROGMEM = "AL Mov Brow";
    627 const char pstrUsageALDigitalRightsManager [] PROGMEM = "AL Dig Rights Mgr";
    628 const char pstrUsageALDigitalWallet [] PROGMEM = "AL Dig Wallet";
    629 const char pstrUsageALInstantMessaging [] PROGMEM = "AL Inst Msg";
    630 const char pstrUsageALOEMFeaturesBrowser [] PROGMEM = "AL OEM Tips Brow";
    631 const char pstrUsageALOEMHelp [] PROGMEM = "AL OEM Hlp";
    632 const char pstrUsageALOnlineCommunity [] PROGMEM = "AL Online Com";
    633 const char pstrUsageALEntertainmentContentBrow [] PROGMEM = "AL Ent Cont Brow";
    634 const char pstrUsageALOnlineShoppingBrowser [] PROGMEM = "AL Online Shop Brow";
    635 const char pstrUsageALSmartCardInfoHelp [] PROGMEM = "AL SmartCard Inf";
    636 const char pstrUsageALMarketMonitorFinBrowser [] PROGMEM = "AL Market Brow";
    637 const char pstrUsageALCustomCorpNewsBrowser [] PROGMEM = "AL Cust Corp News Brow";
    638 const char pstrUsageALOnlineActivityBrowser [] PROGMEM = "AL Online Act Brow";
    639 const char pstrUsageALResearchSearchBrowser [] PROGMEM = "AL Search Brow";
    640 const char pstrUsageALAudioPlayer [] PROGMEM = "AL Aud Player";
    641 const char pstrUsageGenericGUIAppControls [] PROGMEM = "Gen GUI App Ctrl";
    642 const char pstrUsageACNew [] PROGMEM = "AC New";
    643 const char pstrUsageACOpen [] PROGMEM = "AC Open";
    644 const char pstrUsageACClose [] PROGMEM = "AC Close";
    645 const char pstrUsageACExit [] PROGMEM = "AC Exit";
    646 const char pstrUsageACMaximize [] PROGMEM = "AC Max";
    647 const char pstrUsageACMinimize [] PROGMEM = "AC Min";
    648 const char pstrUsageACSave [] PROGMEM = "AC Save";
    649 const char pstrUsageACPrint [] PROGMEM = "AC Print";
    650 const char pstrUsageACProperties [] PROGMEM = "AC Prop";
    651 const char pstrUsageACUndo [] PROGMEM = "AC Undo";
    652 const char pstrUsageACCopy [] PROGMEM = "AC Copy";
    653 const char pstrUsageACCut [] PROGMEM = "AC Cut";
    654 const char pstrUsageACPaste [] PROGMEM = "AC Paste";
    655 const char pstrUsageACSelectAll [] PROGMEM = "AC Sel All";
    656 const char pstrUsageACFind [] PROGMEM = "AC Find";
    657 const char pstrUsageACFindAndReplace [] PROGMEM = "AC Find/Replace";
    658 const char pstrUsageACSearch [] PROGMEM = "AC Search";
    659 const char pstrUsageACGoto [] PROGMEM = "AC Goto";
    660 const char pstrUsageACHome [] PROGMEM = "AC Home";
    661 const char pstrUsageACBack [] PROGMEM = "AC Back";
    662 const char pstrUsageACForward [] PROGMEM = "AC Fwd";
    663 const char pstrUsageACStop [] PROGMEM = "AC Stop";
    664 const char pstrUsageACRefresh [] PROGMEM = "AC Refresh";
    665 const char pstrUsageACPreviousLink [] PROGMEM = "AC Prev Link";
    666 const char pstrUsageACNextLink [] PROGMEM = "AC Next Link";
    667 const char pstrUsageACBookmarks [] PROGMEM = "AC Bkmarks";
    668 const char pstrUsageACHistory [] PROGMEM = "AC Hist";
    669 const char pstrUsageACSubscriptions [] PROGMEM = "AC Subscr";
    670 const char pstrUsageACZoomIn [] PROGMEM = "AC Zoom In";
    671 const char pstrUsageACZoomOut [] PROGMEM = "AC Zoom Out";
    672 const char pstrUsageACZoom [] PROGMEM = "AC Zoom";
    673 const char pstrUsageACFullScreenView [] PROGMEM = "AC Full Scr";
    674 const char pstrUsageACNormalView [] PROGMEM = "AC Norm View";
    675 const char pstrUsageACViewToggle [] PROGMEM = "AC View Tgl";
    676 const char pstrUsageACScrollUp [] PROGMEM = "AC Scroll Up";
    677 const char pstrUsageACScrollDown [] PROGMEM = "AC Scroll Down";
    678 const char pstrUsageACScroll [] PROGMEM = "AC Scroll";
    679 const char pstrUsageACPanLeft [] PROGMEM = "AC Pan Left";
    680 const char pstrUsageACPanRight [] PROGMEM = "AC Pan Right";
    681 const char pstrUsageACPan [] PROGMEM = "AC Pan";
    682 const char pstrUsageACNewWindow [] PROGMEM = "AC New Wnd";
    683 const char pstrUsageACTileHoriz [] PROGMEM = "AC Tile Horiz";
    684 const char pstrUsageACTileVert [] PROGMEM = "AC Tile Vert";
    685 const char pstrUsageACFormat [] PROGMEM = "AC Frmt";
    686 const char pstrUsageACEdit [] PROGMEM = "AC Edit";
    687 const char pstrUsageACBold [] PROGMEM = "AC Bold";
    688 const char pstrUsageACItalics [] PROGMEM = "AC Ital";
    689 const char pstrUsageACUnderline [] PROGMEM = "AC Under";
    690 const char pstrUsageACStrikethrough [] PROGMEM = "AC Strike";
    691 const char pstrUsageACSubscript [] PROGMEM = "AC Sub";
    692 const char pstrUsageACSuperscript [] PROGMEM = "AC Super";
    693 const char pstrUsageACAllCaps [] PROGMEM = "AC All Caps";
    694 const char pstrUsageACRotate [] PROGMEM = "AC Rotate";
    695 const char pstrUsageACResize [] PROGMEM = "AC Resize";
    696 const char pstrUsageACFlipHorizontal [] PROGMEM = "AC Flp H";
    697 const char pstrUsageACFlipVertical [] PROGMEM = "AC Flp V";
    698 const char pstrUsageACMirrorHorizontal [] PROGMEM = "AC Mir H";
    699 const char pstrUsageACMirrorVertical [] PROGMEM = "AC Mir V";
    700 const char pstrUsageACFontSelect [] PROGMEM = "AC Fnt Sel";
    701 const char pstrUsageACFontColor [] PROGMEM = "AC Fnt Clr";
    702 const char pstrUsageACFontSize [] PROGMEM = "AC Fnt Size";
    703 const char pstrUsageACJustifyLeft [] PROGMEM = "AC Just Left";
    704 const char pstrUsageACJustifyCenterH [] PROGMEM = "AC Just Cent H";
    705 const char pstrUsageACJustifyRight [] PROGMEM = "AC Just Right";
    706 const char pstrUsageACJustifyBlockH [] PROGMEM = "AC Just Block H";
    707 const char pstrUsageACJustifyTop [] PROGMEM = "AC Just Top";
    708 const char pstrUsageACJustifyCenterV [] PROGMEM = "AC Just Cent V";
    709 const char pstrUsageACJustifyBottom [] PROGMEM = "AC Just Bot";
    710 const char pstrUsageACJustifyBlockV [] PROGMEM = "AC Just Block V";
    711 const char pstrUsageACIndentDecrease [] PROGMEM = "AC Indent Dec";
    712 const char pstrUsageACIndentIncrease [] PROGMEM = "AC Indent Inc";
    713 const char pstrUsageACNumberedList [] PROGMEM = "AC Num List";
    714 const char pstrUsageACRestartNumbering [] PROGMEM = "AC Res Num";
    715 const char pstrUsageACBulletedList [] PROGMEM = "AC Blt List";
    716 const char pstrUsageACPromote [] PROGMEM = "AC Promote";
    717 const char pstrUsageACDemote [] PROGMEM = "AC Demote";
    718 const char pstrUsageACYes [] PROGMEM = "AC Yes";
    719 const char pstrUsageACNo [] PROGMEM = "AC No";
    720 const char pstrUsageACCancel [] PROGMEM = "AC Cancel";
    721 const char pstrUsageACCatalog [] PROGMEM = "AC Ctlg";
    722 const char pstrUsageACBuyChkout [] PROGMEM = "AC Buy";
    723 const char pstrUsageACAddToCart [] PROGMEM = "AC Add2Cart";
    724 const char pstrUsageACExpand [] PROGMEM = "AC Xpnd";
    725 const char pstrUsageACExpandAll [] PROGMEM = "AC Xpand All";
    726 const char pstrUsageACCollapse [] PROGMEM = "AC Collapse";
    727 const char pstrUsageACCollapseAll [] PROGMEM = "AC Collapse All";
    728 const char pstrUsageACPrintPreview [] PROGMEM = "AC Prn Prevw";
    729 const char pstrUsageACPasteSpecial [] PROGMEM = "AC Paste Spec";
    730 const char pstrUsageACInsertMode [] PROGMEM = "AC Ins Mode";
    731 const char pstrUsageACDelete [] PROGMEM = "AC Del";
    732 const char pstrUsageACLock [] PROGMEM = "AC Lock";
    733 const char pstrUsageACUnlock [] PROGMEM = "AC Unlock";
    734 const char pstrUsageACProtect [] PROGMEM = "AC Prot";
    735 const char pstrUsageACUnprotect [] PROGMEM = "AC Unprot";
    736 const char pstrUsageACAttachComment [] PROGMEM = "AC Attach Cmnt";
    737 const char pstrUsageACDeleteComment [] PROGMEM = "AC Del Cmnt";
    738 const char pstrUsageACViewComment [] PROGMEM = "AC View Cmnt";
    739 const char pstrUsageACSelectWord [] PROGMEM = "AC Sel Word";
    740 const char pstrUsageACSelectSentence [] PROGMEM = "AC Sel Sntc";
    741 const char pstrUsageACSelectParagraph [] PROGMEM = "AC Sel Para";
    742 const char pstrUsageACSelectColumn [] PROGMEM = "AC Sel Col";
    743 const char pstrUsageACSelectRow [] PROGMEM = "AC Sel Row";
    744 const char pstrUsageACSelectTable [] PROGMEM = "AC Sel Tbl";
    745 const char pstrUsageACSelectObject [] PROGMEM = "AC Sel Obj";
    746 const char pstrUsageACRedoRepeat [] PROGMEM = "AC Redo";
    747 const char pstrUsageACSort [] PROGMEM = "AC Sort";
    748 const char pstrUsageACSortAscending [] PROGMEM = "AC Sort Asc";
    749 const char pstrUsageACSortDescending [] PROGMEM = "AC Sort Desc";
    750 const char pstrUsageACFilter [] PROGMEM = "AC Filt";
    751 const char pstrUsageACSetClock [] PROGMEM = "AC Set Clk";
    752 const char pstrUsageACViewClock [] PROGMEM = "AC View Clk";
    753 const char pstrUsageACSelectTimeZone [] PROGMEM = "AC Sel Time Z";
    754 const char pstrUsageACEditTimeZone [] PROGMEM = "AC Edt Time Z";
    755 const char pstrUsageACSetAlarm [] PROGMEM = "AC Set Alm";
    756 const char pstrUsageACClearAlarm [] PROGMEM = "AC Clr Alm";
    757 const char pstrUsageACSnoozeAlarm [] PROGMEM = "AC Snz Alm";
    758 const char pstrUsageACResetAlarm [] PROGMEM = "AC Rst Alm";
    759 const char pstrUsageACSyncronize [] PROGMEM = "AC Sync";
    760 const char pstrUsageACSendReceive [] PROGMEM = "AC Snd/Rcv";
    761 const char pstrUsageACSendTo [] PROGMEM = "AC Snd To";
    762 const char pstrUsageACReply [] PROGMEM = "AC Reply";
    763 const char pstrUsageACReplyAll [] PROGMEM = "AC Reply All";
    764 const char pstrUsageACForwardMessage [] PROGMEM = "AC Fwd Msg";
    765 const char pstrUsageACSend [] PROGMEM = "AC Snd";
    766 const char pstrUsageACAttachFile [] PROGMEM = "AC Att File";
    767 const char pstrUsageACUpload [] PROGMEM = "AC Upld";
    768 const char pstrUsageACDownload [] PROGMEM = "AC Dnld";
    769 const char pstrUsageACSetBorders [] PROGMEM = "AC Set Brd";
    770 const char pstrUsageACInsertRow [] PROGMEM = "AC Ins Row";
    771 const char pstrUsageACInsertColumn [] PROGMEM = "AC Ins Col";
    772 const char pstrUsageACInsertFile [] PROGMEM = "AC Ins File";
    773 const char pstrUsageACInsertPicture [] PROGMEM = "AC Ins Pic";
    774 const char pstrUsageACInsertObject [] PROGMEM = "AC Ins Obj";
    775 const char pstrUsageACInsertSymbol [] PROGMEM = "AC Ins Sym";
    776 const char pstrUsageACSaveAndClose [] PROGMEM = "AC Sav&Cls";
    777 const char pstrUsageACRename [] PROGMEM = "AC Rename";
    778 const char pstrUsageACMerge [] PROGMEM = "AC Merge";
    779 const char pstrUsageACSplit [] PROGMEM = "AC Split";
    780 const char pstrUsageACDistributeHorizontaly [] PROGMEM = "AC Dist Hor";
    781 const char pstrUsageACDistributeVerticaly [] PROGMEM = "AC Dist Ver";
    782 
    783 // Digitaizers
    784 const char pstrUsageDigitizer [] PROGMEM = "Digitizer";
    785 const char pstrUsagePen [] PROGMEM = "Pen";
    786 const char pstrUsageLightPen [] PROGMEM = "Light Pen";
    787 const char pstrUsageTouchScreen [] PROGMEM = "Touch Scr";
    788 const char pstrUsageTouchPad [] PROGMEM = "Touch Pad";
    789 const char pstrUsageWhiteBoard [] PROGMEM = "White Brd";
    790 const char pstrUsageCoordinateMeasuringMachine [] PROGMEM = "Coord Meas Mach";
    791 const char pstrUsage3DDigitizer [] PROGMEM = "3D Dgtz";
    792 const char pstrUsageStereoPlotter [] PROGMEM = "Stereo Plot";
    793 const char pstrUsageArticulatedArm [] PROGMEM = "Art Arm";
    794 const char pstrUsageArmature [] PROGMEM = "Armature";
    795 const char pstrUsageMultiplePointDigitizer [] PROGMEM = "Multi Point Dgtz";
    796 const char pstrUsageFreeSpaceWand [] PROGMEM = "Free Space Wand";
    797 const char pstrUsageStylus [] PROGMEM = "Stylus";
    798 const char pstrUsagePuck [] PROGMEM = "Puck";
    799 const char pstrUsageFinger [] PROGMEM = "Finger";
    800 const char pstrUsageTipPressure [] PROGMEM = "Tip Press";
    801 const char pstrUsageBarrelPressure [] PROGMEM = "Brl Press";
    802 const char pstrUsageInRange [] PROGMEM = "In Range";
    803 const char pstrUsageTouch [] PROGMEM = "Touch";
    804 const char pstrUsageUntouch [] PROGMEM = "Untouch";
    805 const char pstrUsageTap [] PROGMEM = "Tap";
    806 const char pstrUsageQuality [] PROGMEM = "Qlty";
    807 const char pstrUsageDataValid [] PROGMEM = "Data Valid";
    808 const char pstrUsageTransducerIndex [] PROGMEM = "Transducer Ind";
    809 const char pstrUsageTabletFunctionKeys [] PROGMEM = "Tabl Func Keys";
    810 const char pstrUsageProgramChangeKeys [] PROGMEM = "Pgm Chng Keys";
    811 //const char pstrUsageBatteryStrength [] PROGMEM = "Bat Strength";
    812 const char pstrUsageInvert [] PROGMEM = "Invert";
    813 const char pstrUsageXTilt [] PROGMEM = "X Tilt";
    814 const char pstrUsageYTilt [] PROGMEM = "Y Tilt";
    815 const char pstrUsageAzimuth [] PROGMEM = "Azimuth";
    816 const char pstrUsageAltitude [] PROGMEM = "Altitude";
    817 const char pstrUsageTwist [] PROGMEM = "Twist";
    818 const char pstrUsageTipSwitch [] PROGMEM = "Tip Sw";
    819 const char pstrUsageSecondaryTipSwitch [] PROGMEM = "Scnd Tip Sw";
    820 const char pstrUsageBarrelSwitch [] PROGMEM = "Brl Sw";
    821 const char pstrUsageEraser [] PROGMEM = "Eraser";
    822 const char pstrUsageTabletPick [] PROGMEM = "Tbl Pick";
    823 
    824 // Alphanumeric Display Page
    825 const char pstrUsageAlphanumericDisplay [] PROGMEM = "Alphanum Disp";
    826 const char pstrUsageBitmappedDisplay [] PROGMEM = "Bmp Disp";
    827 const char pstrUsageDisplayAttributesReport [] PROGMEM = "Disp Attr Rpt";
    828 const char pstrUsageASCIICharacterSet [] PROGMEM = "ASCII chset";
    829 const char pstrUsageDataReadBack [] PROGMEM = "Data Rd Back";
    830 const char pstrUsageFontReadBack [] PROGMEM = "Fnt Rd Back";
    831 const char pstrUsageDisplayControlReport [] PROGMEM = "Disp Ctrl Rpt";
    832 const char pstrUsageClearDisplay [] PROGMEM = "Clr Disp";
    833 //const char pstrUsageDisplayEnable [] PROGMEM = "Disp Enbl";
    834 const char pstrUsageScreenSaverDelay [] PROGMEM = "Scr Sav Delay";
    835 const char pstrUsageScreenSaverEnable [] PROGMEM = "Scr Sav Enbl";
    836 const char pstrUsageVerticalScroll [] PROGMEM = "V Scroll";
    837 const char pstrUsageHorizontalScroll [] PROGMEM = "H Scroll";
    838 const char pstrUsageCharacterReport [] PROGMEM = "Char Rpt";
    839 const char pstrUsageDisplayData [] PROGMEM = "Disp Data";
    840 const char pstrUsageDisplayStatus [] PROGMEM = "Disp Stat";
    841 const char pstrUsageStatusNotReady [] PROGMEM = "Stat !Ready";
    842 const char pstrUsageStatusReady [] PROGMEM = "Stat Ready";
    843 const char pstrUsageErrorNotALoadableCharacter [] PROGMEM = "Err Not Ld Char";
    844 const char pstrUsageErrorFotDataCanNotBeRead [] PROGMEM = "Fnt Data Rd Err";
    845 const char pstrUsageCursorPositionReport [] PROGMEM = "Cur Pos Rpt";
    846 const char pstrUsageRow [] PROGMEM = "Row";
    847 const char pstrUsageColumn [] PROGMEM = "Col";
    848 const char pstrUsageRows [] PROGMEM = "Rows";
    849 const char pstrUsageColumns [] PROGMEM = "Cols";
    850 const char pstrUsageCursorPixelPosition [] PROGMEM = "Cur Pix Pos";
    851 const char pstrUsageCursorMode [] PROGMEM = "Cur Mode";
    852 const char pstrUsageCursorEnable [] PROGMEM = "Cur Enbl";
    853 const char pstrUsageCursorBlink [] PROGMEM = "Cur Blnk";
    854 const char pstrUsageFontReport [] PROGMEM = "Fnt Rpt";
    855 const char pstrUsageFontData [] PROGMEM = "Fnt Data";
    856 const char pstrUsageCharacterWidth [] PROGMEM = "Char Wdth";
    857 const char pstrUsageCharacterHeight [] PROGMEM = "Char Hght";
    858 const char pstrUsageCharacterSpacingHorizontal [] PROGMEM = "Char Space H";
    859 const char pstrUsageCharacterSpacingVertical [] PROGMEM = "Char Space V";
    860 const char pstrUsageUnicodeCharset [] PROGMEM = "Unicode Char";
    861 const char pstrUsageFont7Segment [] PROGMEM = "Fnt 7-seg";
    862 const char pstrUsage7SegmentDirectMap [] PROGMEM = "7-seg map";
    863 const char pstrUsageFont14Segment [] PROGMEM = "Fnt 14-seg";
    864 const char pstrUsage14SegmentDirectMap [] PROGMEM = "14-seg map";
    865 const char pstrUsageDisplayBrightness [] PROGMEM = "Disp Bright";
    866 const char pstrUsageDisplayContrast [] PROGMEM = "Disp Cntrst";
    867 const char pstrUsageCharacterAttribute [] PROGMEM = "Char Attr";
    868 const char pstrUsageAttributeReadback [] PROGMEM = "Attr Readbk";
    869 const char pstrUsageAttributeData [] PROGMEM = "Attr Data";
    870 const char pstrUsageCharAttributeEnhance [] PROGMEM = "Char Attr Enh";
    871 const char pstrUsageCharAttributeUnderline [] PROGMEM = "Char Attr Undl";
    872 const char pstrUsageCharAttributeBlink [] PROGMEM = "Char Attr Blnk";
    873 const char pstrUsageBitmapSizeX [] PROGMEM = "Bmp Size X";
    874 const char pstrUsageBitmapSizeY [] PROGMEM = "Bmp Size Y";
    875 const char pstrUsageBitDepthFormat [] PROGMEM = "Bit Dpth Fmt";
    876 const char pstrUsageDisplayOrientation [] PROGMEM = "Disp Ornt";
    877 const char pstrUsagePaletteReport [] PROGMEM = "Pal Rpt";
    878 const char pstrUsagePaletteDataSize [] PROGMEM = "Pal Data Size";
    879 const char pstrUsagePaletteDataOffset [] PROGMEM = "Pal Data Off";
    880 const char pstrUsagePaletteData [] PROGMEM = "Pal Data";
    881 const char pstrUsageBlitReport [] PROGMEM = "Blit Rpt";
    882 const char pstrUsageBlitRectangleX1 [] PROGMEM = "Blit Rect X1";
    883 const char pstrUsageBlitRectangleY1 [] PROGMEM = "Blit Rect Y1";
    884 const char pstrUsageBlitRectangleX2 [] PROGMEM = "Blit Rect X2";
    885 const char pstrUsageBlitRectangleY2 [] PROGMEM = "Blit Rect Y2";
    886 const char pstrUsageBlitData [] PROGMEM = "Blit Data";
    887 const char pstrUsageSoftButton [] PROGMEM = "Soft Btn";
    888 const char pstrUsageSoftButtonID [] PROGMEM = "Soft Btn ID";
    889 const char pstrUsageSoftButtonSide [] PROGMEM = "Soft Btn Side";
    890 const char pstrUsageSoftButtonOffset1 [] PROGMEM = "Soft Btn Off1";
    891 const char pstrUsageSoftButtonOffset2 [] PROGMEM = "Soft Btn Off2";
    892 const char pstrUsageSoftButtonReport [] PROGMEM = "Soft Btn Rpt";
    893 
    894 // Medical Instrument Page
    895 const char pstrUsageMedicalUltrasound [] PROGMEM = "Med Ultrasnd";
    896 const char pstrUsageVCRAcquisition [] PROGMEM = "VCR/Acq";
    897 const char pstrUsageFreezeThaw [] PROGMEM = "Freeze";
    898 const char pstrUsageClipStore [] PROGMEM = "Clip Store";
    899 const char pstrUsageUpdate [] PROGMEM = "Update";
    900 const char pstrUsageNext [] PROGMEM = "Next";
    901 const char pstrUsageSave [] PROGMEM = "Save";
    902 const char pstrUsagePrint [] PROGMEM = "Print";
    903 const char pstrUsageMicrophoneEnable [] PROGMEM = "Mic Enbl";
    904 const char pstrUsageCine [] PROGMEM = "Cine";
    905 const char pstrUsageTransmitPower [] PROGMEM = "Trans Pwr";
    906 //const char pstrUsageVolume [] PROGMEM = "Vol";
    907 const char pstrUsageFocus [] PROGMEM = "Focus";
    908 const char pstrUsageDepth [] PROGMEM = "Depth";
    909 const char pstrUsageSoftStepPrimary [] PROGMEM = "Soft Stp-Pri";
    910 const char pstrUsageSoftStepSecondary [] PROGMEM = "Soft Stp-Sec";
    911 const char pstrUsageDepthGainCompensation [] PROGMEM = "Dpth Gain Comp";
    912 const char pstrUsageZoomSelect [] PROGMEM = "Zoom Sel";
    913 const char pstrUsageZoomAdjust [] PROGMEM = "Zoom Adj";
    914 const char pstrUsageSpectralDopplerModeSelect [] PROGMEM = "Spec Dop Mode Sel";
    915 const char pstrUsageSpectralDopplerModeAdjust [] PROGMEM = "Spec Dop Mode Adj";
    916 const char pstrUsageColorDopplerModeSelect [] PROGMEM = "Color Dop Mode Sel";
    917 const char pstrUsageColorDopplerModeAdjust [] PROGMEM = "Color Dop Mode Adj";
    918 const char pstrUsageMotionModeSelect [] PROGMEM = "Motion Mode Sel";
    919 const char pstrUsageMotionModeAdjust [] PROGMEM = "Motion Mode Adj";
    920 const char pstrUsage2DModeSelect [] PROGMEM = "2D Mode Sel";
    921 const char pstrUsage2DModeAdjust [] PROGMEM = "2D Mode Adj";
    922 const char pstrUsageSoftControlSelect [] PROGMEM = "Soft Ctrl Sel";
    923 const char pstrUsageSoftControlAdjust [] PROGMEM = "Soft Ctrl Adj";
    924 
    925 //extern const char *usagePageTitles0[15];
    926 //const char *usagePageTitles1[];
    927 //const char *genDesktopTitles0[];
    928 //const char *genDesktopTitles1[];
    929 //const char *genDesktopTitles2[];
    930 //const char *genDesktopTitles3[];
    931 //const char *genDesktopTitles4[];
    932 //const char *simuTitles0[];
    933 //const char *simuTitles1[];
    934 //const char *simuTitles2[];
    935 //const char *vrTitles0[];
    936 //const char *vrTitles1[];
    937 //const char *sportsCtrlTitles0[];
    938 //const char *sportsCtrlTitles1[];
    939 //const char *sportsCtrlTitles2[];
    940 //const char *gameTitles0[];
    941 //const char *gameTitles1[];
    942 //const char *genDevCtrlTitles[];
    943 //const char *ledTitles[];
    944 //const char *telTitles0[];
    945 //const char *telTitles1[];
    946 //const char *telTitles2[];
    947 //const char *telTitles3[];
    948 //const char *telTitles4[];
    949 //const char *telTitles5[];
    950 //const char *consTitles0[];
    951 //const char *consTitles1[];
    952 //const char *consTitles2[];
    953 //const char *consTitles3[];
    954 //const char *consTitles4[];
    955 //const char *consTitles5[];
    956 //const char *consTitles6[];
    957 //const char *consTitles7[];
    958 //const char *consTitles8[];
    959 //const char *consTitles9[];
    960 //const char *consTitlesA[];
    961 //const char *consTitlesB[];
    962 //const char *consTitlesC[];
    963 //const char *consTitlesD[];
    964 //const char *consTitlesE[];
    965 //const char *digitTitles0[];
    966 //const char *digitTitles1[];
    967 //const char *digitTitles2[];
    968 //const char *aplphanumTitles0[];
    969 //const char *aplphanumTitles1[];
    970 //const char *aplphanumTitles2[];
    971 //const char *medInstrTitles0[];
    972 //const char *medInstrTitles1[];
    973 //const char *medInstrTitles2[];
    974 //const char *medInstrTitles3[];
    975 //const char *medInstrTitles4[];
    976 
    977 #endif //__HIDUSAGESTR_H__
    const char pstrUsageYTilt[]
    Definition: hidusagestr.h:814
    const char pstrUsageRewind[]
    Definition: hidusagestr.h:323
    const char pstrUsageACDistributeHorizontaly[]
    Definition: hidusagestr.h:780
    const char pstrUsageALNetworkConference[]
    Definition: hidusagestr.h:594
    @@ -1927,7 +951,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidusagetitlearrays_8cpp.html b/hidusagetitlearrays_8cpp.html index 061f38e2..3a614b11 100644 --- a/hidusagetitlearrays_8cpp.html +++ b/hidusagetitlearrays_8cpp.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidusagetitlearrays.cpp File Reference + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -70,7 +71,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -87,13 +88,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidusagetitlearrays.cpp File Reference
    -
    #include "hidusagestr.h"
    +
    #include "hidusagestr.h"
    Include dependency graph for hidusagetitlearrays.cpp:
    - + + +

    Go to the source code of this file.

    @@ -123,7 +126,7 @@ Macros diff --git a/hidusagetitlearrays_8cpp__incl.map b/hidusagetitlearrays_8cpp__incl.map index 33965387..b1cb20e7 100644 --- a/hidusagetitlearrays_8cpp__incl.map +++ b/hidusagetitlearrays_8cpp__incl.map @@ -1,4 +1,4 @@ - - + + diff --git a/hidusagetitlearrays_8cpp__incl.md5 b/hidusagetitlearrays_8cpp__incl.md5 index 94a0dbe2..4e28641f 100644 --- a/hidusagetitlearrays_8cpp__incl.md5 +++ b/hidusagetitlearrays_8cpp__incl.md5 @@ -1 +1 @@ -f05b4297843c24e9f050bb654365b3db \ No newline at end of file +24f4b9fff6ebcb53f983ea5749309c1d \ No newline at end of file diff --git a/hidusagetitlearrays_8cpp__incl.png b/hidusagetitlearrays_8cpp__incl.png index d6e47a72..0fd8000a 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 ca1731c8..350f8b8c 100644 --- a/hidusagetitlearrays_8cpp_source.html +++ b/hidusagetitlearrays_8cpp_source.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: hidusagetitlearrays.cpp Source File + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -71,7 +72,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -85,1061 +86,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    hidusagetitlearrays.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 #if !defined(__HIDUSAGETITLEARRAYS_H__)
    -
    18 #define __HIDUSAGETITLEARRAYS_H__
    -
    19 
    -
    20 #include "hidusagestr.h"
    -
    21 
    -
    22 // This is here why?
    -
    23 
    -
    24 //const char *usagePageTitles0[] PROGMEM =
    -
    25 //{
    -
    26 // pstrUsagePageGenericDesktopControls ,
    -
    27 // pstrUsagePageSimulationControls ,
    -
    28 // pstrUsagePageVRControls ,
    -
    29 // pstrUsagePageSportControls ,
    -
    30 // pstrUsagePageGameControls ,
    -
    31 // pstrUsagePageGenericDeviceControls ,
    -
    32 // pstrUsagePageKeyboardKeypad ,
    -
    33 // pstrUsagePageLEDs ,
    -
    34 // pstrUsagePageButton ,
    -
    35 // pstrUsagePageOrdinal ,
    -
    36 // pstrUsagePageTelephone ,
    -
    37 // pstrUsagePageConsumer ,
    -
    38 // pstrUsagePageDigitizer ,
    -
    39 // pstrUsagePagePID ,
    -
    40 // pstrUsagePageUnicode
    -
    41 //};
    -
    42 //
    -
    43 //const char *usagePageTitles1[] PROGMEM =
    -
    44 //{
    -
    45 // pstrUsagePageBarCodeScanner ,
    -
    46 // pstrUsagePageScale ,
    -
    47 // pstrUsagePageMSRDevices ,
    -
    48 // pstrUsagePagePointOfSale ,
    -
    49 // pstrUsagePageCameraControl ,
    -
    50 // pstrUsagePageArcade
    -
    51 //};
    -
    52 //const char *genDesktopTitles0[] PROGMEM =
    -
    53 //{
    -
    54 // pstrUsagePointer ,
    -
    55 // pstrUsageMouse ,
    -
    56 // pstrUsageJoystick ,
    -
    57 // pstrUsageGamePad ,
    -
    58 // pstrUsageKeyboard ,
    -
    59 // pstrUsageKeypad ,
    -
    60 // pstrUsageMultiAxisController ,
    -
    61 // pstrUsageTabletPCSystemControls
    -
    62 //
    -
    63 //};
    -
    64 //const char *genDesktopTitles1[] PROGMEM =
    -
    65 //{
    -
    66 // pstrUsageX ,
    -
    67 // pstrUsageY ,
    -
    68 // pstrUsageZ ,
    -
    69 // pstrUsageRx ,
    -
    70 // pstrUsageRy ,
    -
    71 // pstrUsageRz ,
    -
    72 // pstrUsageSlider ,
    -
    73 // pstrUsageDial ,
    -
    74 // pstrUsageWheel ,
    -
    75 // pstrUsageHatSwitch ,
    -
    76 // pstrUsageCountedBuffer ,
    -
    77 // pstrUsageByteCount ,
    -
    78 // pstrUsageMotionWakeup ,
    -
    79 // pstrUsageStart ,
    -
    80 // pstrUsageSelect ,
    -
    81 // pstrUsagePageReserved ,
    -
    82 // pstrUsageVx ,
    -
    83 // pstrUsageVy ,
    -
    84 // pstrUsageVz ,
    -
    85 // pstrUsageVbrx ,
    -
    86 // pstrUsageVbry ,
    -
    87 // pstrUsageVbrz ,
    -
    88 // pstrUsageVno ,
    -
    89 // pstrUsageFeatureNotification ,
    -
    90 // pstrUsageResolutionMultiplier
    -
    91 //};
    -
    92 //const char *genDesktopTitles2[] PROGMEM =
    -
    93 //{
    -
    94 // pstrUsageSystemControl ,
    -
    95 // pstrUsageSystemPowerDown ,
    -
    96 // pstrUsageSystemSleep ,
    -
    97 // pstrUsageSystemWakeup ,
    -
    98 // pstrUsageSystemContextMenu ,
    -
    99 // pstrUsageSystemMainMenu ,
    -
    100 // pstrUsageSystemAppMenu ,
    -
    101 // pstrUsageSystemMenuHelp ,
    -
    102 // pstrUsageSystemMenuExit ,
    -
    103 // pstrUsageSystemMenuSelect ,
    -
    104 // pstrUsageSystemMenuRight ,
    -
    105 // pstrUsageSystemMenuLeft ,
    -
    106 // pstrUsageSystemMenuUp ,
    -
    107 // pstrUsageSystemMenuDown ,
    -
    108 // pstrUsageSystemColdRestart ,
    -
    109 // pstrUsageSystemWarmRestart ,
    -
    110 // pstrUsageDPadUp ,
    -
    111 // pstrUsageDPadDown ,
    -
    112 // pstrUsageDPadRight ,
    -
    113 // pstrUsageDPadLeft
    -
    114 //};
    -
    115 //const char *genDesktopTitles3[] PROGMEM =
    -
    116 //{
    -
    117 // pstrUsageSystemDock ,
    -
    118 // pstrUsageSystemUndock ,
    -
    119 // pstrUsageSystemSetup ,
    -
    120 // pstrUsageSystemBreak ,
    -
    121 // pstrUsageSystemDebuggerBreak ,
    -
    122 // pstrUsageApplicationBreak ,
    -
    123 // pstrUsageApplicationDebuggerBreak,
    -
    124 // pstrUsageSystemSpeakerMute ,
    -
    125 // pstrUsageSystemHibernate
    -
    126 //};
    -
    127 //const char *genDesktopTitles4[] PROGMEM =
    -
    128 //{
    -
    129 // pstrUsageSystemDisplayInvert ,
    -
    130 // pstrUsageSystemDisplayInternal ,
    -
    131 // pstrUsageSystemDisplayExternal ,
    -
    132 // pstrUsageSystemDisplayBoth ,
    -
    133 // pstrUsageSystemDisplayDual ,
    -
    134 // pstrUsageSystemDisplayToggleIntExt ,
    -
    135 // pstrUsageSystemDisplaySwapPriSec ,
    -
    136 // pstrUsageSystemDisplayLCDAutoscale
    -
    137 //};
    -
    138 //const char *simuTitles0[] PROGMEM =
    -
    139 //{
    -
    140 // pstrUsageFlightSimulationDevice ,
    -
    141 // pstrUsageAutomobileSimulationDevice ,
    -
    142 // pstrUsageTankSimulationDevice ,
    -
    143 // pstrUsageSpaceshipSimulationDevice ,
    -
    144 // pstrUsageSubmarineSimulationDevice ,
    -
    145 // pstrUsageSailingSimulationDevice ,
    -
    146 // pstrUsageMotocicleSimulationDevice ,
    -
    147 // pstrUsageSportsSimulationDevice ,
    -
    148 // pstrUsageAirplaneSimulationDevice ,
    -
    149 // pstrUsageHelicopterSimulationDevice ,
    -
    150 // pstrUsageMagicCarpetSimulationDevice,
    -
    151 // pstrUsageBicycleSimulationDevice
    -
    152 //};
    -
    153 //const char *simuTitles1[] PROGMEM =
    -
    154 //{
    -
    155 // pstrUsageFlightControlStick ,
    -
    156 // pstrUsageFlightStick ,
    -
    157 // pstrUsageCyclicControl ,
    -
    158 // pstrUsageCyclicTrim ,
    -
    159 // pstrUsageFlightYoke ,
    -
    160 // pstrUsageTrackControl
    -
    161 //};
    -
    162 //const char *simuTitles2[] PROGMEM =
    -
    163 //{
    -
    164 // pstrUsageAileron ,
    -
    165 // pstrUsageAileronTrim ,
    -
    166 // pstrUsageAntiTorqueControl ,
    -
    167 // pstrUsageAutopilotEnable ,
    -
    168 // pstrUsageChaffRelease ,
    -
    169 // pstrUsageCollectiveControl ,
    -
    170 // pstrUsageDiveBrake ,
    -
    171 // pstrUsageElectronicCountermeasures ,
    -
    172 // pstrUsageElevator ,
    -
    173 // pstrUsageElevatorTrim ,
    -
    174 // pstrUsageRudder ,
    -
    175 // pstrUsageThrottle ,
    -
    176 // pstrUsageFlightCommunications ,
    -
    177 // pstrUsageFlareRelease ,
    -
    178 // pstrUsageLandingGear ,
    -
    179 // pstrUsageToeBrake ,
    -
    180 // pstrUsageTrigger ,
    -
    181 // pstrUsageWeaponsArm ,
    -
    182 // pstrUsageWeaponsSelect ,
    -
    183 // pstrUsageWingFlaps ,
    -
    184 // pstrUsageAccelerator ,
    -
    185 // pstrUsageBrake ,
    -
    186 // pstrUsageClutch ,
    -
    187 // pstrUsageShifter ,
    -
    188 // pstrUsageSteering ,
    -
    189 // pstrUsageTurretDirection ,
    -
    190 // pstrUsageBarrelElevation ,
    -
    191 // pstrUsageDivePlane ,
    -
    192 // pstrUsageBallast ,
    -
    193 // pstrUsageBicycleCrank ,
    -
    194 // pstrUsageHandleBars ,
    -
    195 // pstrUsageFrontBrake ,
    -
    196 // pstrUsageRearBrake
    -
    197 //};
    -
    198 //const char *vrTitles0[] PROGMEM =
    -
    199 //{
    -
    200 // pstrUsageBelt ,
    -
    201 // pstrUsageBodySuit ,
    -
    202 // pstrUsageFlexor ,
    -
    203 // pstrUsageGlove ,
    -
    204 // pstrUsageHeadTracker ,
    -
    205 // pstrUsageHeadMountedDisplay ,
    -
    206 // pstrUsageHandTracker ,
    -
    207 // pstrUsageOculometer ,
    -
    208 // pstrUsageVest ,
    -
    209 // pstrUsageAnimatronicDevice
    -
    210 //};
    -
    211 //const char *vrTitles1[] PROGMEM =
    -
    212 //{
    -
    213 // pstrUsageStereoEnable ,
    -
    214 // pstrUsageDisplayEnable
    -
    215 //};
    -
    216 //const char *sportsCtrlTitles0[] PROGMEM =
    -
    217 //{
    -
    218 // pstrUsageBaseballBat ,
    -
    219 // pstrUsageGolfClub ,
    -
    220 // pstrUsageRowingMachine ,
    -
    221 // pstrUsageTreadmill
    -
    222 //};
    -
    223 //const char *sportsCtrlTitles1[] PROGMEM =
    -
    224 //{
    -
    225 // pstrUsageOar ,
    -
    226 // pstrUsageSlope ,
    -
    227 // pstrUsageRate ,
    -
    228 // pstrUsageStickSpeed ,
    -
    229 // pstrUsageStickFaceAngle ,
    -
    230 // pstrUsageStickHeelToe ,
    -
    231 // pstrUsageStickFollowThough ,
    -
    232 // pstrUsageStickTempo ,
    -
    233 // pstrUsageStickType ,
    -
    234 // pstrUsageStickHeight
    -
    235 //};
    -
    236 //const char *sportsCtrlTitles2[] PROGMEM =
    -
    237 //{
    -
    238 // pstrUsagePutter ,
    -
    239 // pstrUsage1Iron ,
    -
    240 // pstrUsage2Iron ,
    -
    241 // pstrUsage3Iron ,
    -
    242 // pstrUsage4Iron ,
    -
    243 // pstrUsage5Iron ,
    -
    244 // pstrUsage6Iron ,
    -
    245 // pstrUsage7Iron ,
    -
    246 // pstrUsage8Iron ,
    -
    247 // pstrUsage9Iron ,
    -
    248 // pstrUsage10Iron ,
    -
    249 // pstrUsage11Iron ,
    -
    250 // pstrUsageSandWedge ,
    -
    251 // pstrUsageLoftWedge ,
    -
    252 // pstrUsagePowerWedge ,
    -
    253 // pstrUsage1Wood ,
    -
    254 // pstrUsage3Wood ,
    -
    255 // pstrUsage5Wood ,
    -
    256 // pstrUsage7Wood ,
    -
    257 // pstrUsage9Wood
    -
    258 //};
    -
    259 //const char *gameTitles0[] PROGMEM =
    -
    260 //{
    -
    261 // pstrUsage3DGameController ,
    -
    262 // pstrUsagePinballDevice ,
    -
    263 // pstrUsageGunDevice
    -
    264 //};
    -
    265 //const char *gameTitles1[] PROGMEM =
    -
    266 //{
    -
    267 // pstrUsagePointOfView ,
    -
    268 // pstrUsageTurnRightLeft ,
    -
    269 // pstrUsagePitchForwardBackward ,
    -
    270 // pstrUsageRollRightLeft ,
    -
    271 // pstrUsageMoveRightLeft ,
    -
    272 // pstrUsageMoveForwardBackward ,
    -
    273 // pstrUsageMoveUpDown ,
    -
    274 // pstrUsageLeanRightLeft ,
    -
    275 // pstrUsageLeanForwardBackward ,
    -
    276 // pstrUsageHeightOfPOV ,
    -
    277 // pstrUsageFlipper ,
    -
    278 // pstrUsageSecondaryFlipper ,
    -
    279 // pstrUsageBump ,
    -
    280 // pstrUsageNewGame ,
    -
    281 // pstrUsageShootBall ,
    -
    282 // pstrUsagePlayer ,
    -
    283 // pstrUsageGunBolt ,
    -
    284 // pstrUsageGunClip ,
    -
    285 // pstrUsageGunSelector ,
    -
    286 // pstrUsageGunSingleShot ,
    -
    287 // pstrUsageGunBurst ,
    -
    288 // pstrUsageGunAutomatic ,
    -
    289 // pstrUsageGunSafety ,
    -
    290 // pstrUsageGamepadFireJump ,
    -
    291 // pstrUsageGamepadTrigger
    -
    292 //};
    -
    293 //const char *genDevCtrlTitles[] PROGMEM =
    -
    294 //{
    -
    295 // pstrUsageBatteryStrength,
    -
    296 // pstrUsageWirelessChannel,
    -
    297 // pstrUsageWirelessID,
    -
    298 // pstrUsageDiscoverWirelessControl,
    -
    299 // pstrUsageSecurityCodeCharEntered,
    -
    300 // pstrUsageSecurityCodeCharErased,
    -
    301 // pstrUsageSecurityCodeCleared
    -
    302 //};
    -
    303 //const char *ledTitles[] PROGMEM =
    -
    304 //{
    -
    305 // pstrUsageNumLock ,
    -
    306 // pstrUsageCapsLock ,
    -
    307 // pstrUsageScrollLock ,
    -
    308 // pstrUsageCompose ,
    -
    309 // pstrUsageKana ,
    -
    310 // pstrUsagePower ,
    -
    311 // pstrUsageShift ,
    -
    312 // pstrUsageDoNotDisturb ,
    -
    313 // pstrUsageMute ,
    -
    314 // pstrUsageToneEnable ,
    -
    315 // pstrUsageHighCutFilter ,
    -
    316 // pstrUsageLowCutFilter ,
    -
    317 // pstrUsageEqualizerEnable ,
    -
    318 // pstrUsageSoundFieldOn ,
    -
    319 // pstrUsageSurroundOn ,
    -
    320 // pstrUsageRepeat ,
    -
    321 // pstrUsageStereo ,
    -
    322 // pstrUsageSamplingRateDetect ,
    -
    323 // pstrUsageSpinning ,
    -
    324 // pstrUsageCAV ,
    -
    325 // pstrUsageCLV ,
    -
    326 // pstrUsageRecordingFormatDetect ,
    -
    327 // pstrUsageOffHook ,
    -
    328 // pstrUsageRing ,
    -
    329 // pstrUsageMessageWaiting ,
    -
    330 // pstrUsageDataMode ,
    -
    331 // pstrUsageBatteryOperation ,
    -
    332 // pstrUsageBatteryOK ,
    -
    333 // pstrUsageBatteryLow ,
    -
    334 // pstrUsageSpeaker ,
    -
    335 // pstrUsageHeadSet ,
    -
    336 // pstrUsageHold ,
    -
    337 // pstrUsageMicrophone ,
    -
    338 // pstrUsageCoverage ,
    -
    339 // pstrUsageNightMode ,
    -
    340 // pstrUsageSendCalls ,
    -
    341 // pstrUsageCallPickup ,
    -
    342 // pstrUsageConference ,
    -
    343 // pstrUsageStandBy ,
    -
    344 // pstrUsageCameraOn ,
    -
    345 // pstrUsageCameraOff ,
    -
    346 // pstrUsageOnLine ,
    -
    347 // pstrUsageOffLine ,
    -
    348 // pstrUsageBusy ,
    -
    349 // pstrUsageReady ,
    -
    350 // pstrUsagePaperOut ,
    -
    351 // pstrUsagePaperJam ,
    -
    352 // pstrUsageRemote ,
    -
    353 // pstrUsageForward ,
    -
    354 // pstrUsageReverse ,
    -
    355 // pstrUsageStop ,
    -
    356 // pstrUsageRewind ,
    -
    357 // pstrUsageFastForward ,
    -
    358 // pstrUsagePlay ,
    -
    359 // pstrUsagePause ,
    -
    360 // pstrUsageRecord ,
    -
    361 // pstrUsageError ,
    -
    362 // pstrUsageSelectedIndicator ,
    -
    363 // pstrUsageInUseIndicator ,
    -
    364 // pstrUsageMultiModeIndicator ,
    -
    365 // pstrUsageIndicatorOn ,
    -
    366 // pstrUsageIndicatorFlash ,
    -
    367 // pstrUsageIndicatorSlowBlink ,
    -
    368 // pstrUsageIndicatorFastBlink ,
    -
    369 // pstrUsageIndicatorOff ,
    -
    370 // pstrUsageFlashOnTime ,
    -
    371 // pstrUsageSlowBlinkOnTime ,
    -
    372 // pstrUsageSlowBlinkOffTime ,
    -
    373 // pstrUsageFastBlinkOnTime ,
    -
    374 // pstrUsageFastBlinkOffTime ,
    -
    375 // pstrUsageIndicatorColor ,
    -
    376 // pstrUsageIndicatorRed ,
    -
    377 // pstrUsageIndicatorGreen ,
    -
    378 // pstrUsageIndicatorAmber ,
    -
    379 // pstrUsageGenericIndicator ,
    -
    380 // pstrUsageSystemSuspend ,
    -
    381 // pstrUsageExternalPowerConnected
    -
    382 //};
    -
    383 //const char *telTitles0 [] PROGMEM =
    -
    384 //{
    -
    385 // pstrUsagePhone ,
    -
    386 // pstrUsageAnsweringMachine ,
    -
    387 // pstrUsageMessageControls ,
    -
    388 // pstrUsageHandset ,
    -
    389 // pstrUsageHeadset ,
    -
    390 // pstrUsageTelephonyKeyPad ,
    -
    391 // pstrUsageProgrammableButton
    -
    392 //};
    -
    393 //const char *telTitles1 [] PROGMEM =
    -
    394 //{
    -
    395 // pstrUsageHookSwitch ,
    -
    396 // pstrUsageFlash ,
    -
    397 // pstrUsageFeature ,
    -
    398 // pstrUsageHold ,
    -
    399 // pstrUsageRedial ,
    -
    400 // pstrUsageTransfer ,
    -
    401 // pstrUsageDrop ,
    -
    402 // pstrUsagePark ,
    -
    403 // pstrUsageForwardCalls ,
    -
    404 // pstrUsageAlternateFunction ,
    -
    405 // pstrUsageLine ,
    -
    406 // pstrUsageSpeakerPhone ,
    -
    407 // pstrUsageConference ,
    -
    408 // pstrUsageRingEnable ,
    -
    409 // pstrUsageRingSelect ,
    -
    410 // pstrUsagePhoneMute ,
    -
    411 // pstrUsageCallerID ,
    -
    412 // pstrUsageSend
    -
    413 //};
    -
    414 //const char *telTitles2 [] PROGMEM =
    -
    415 //{
    -
    416 // pstrUsageSpeedDial ,
    -
    417 // pstrUsageStoreNumber ,
    -
    418 // pstrUsageRecallNumber ,
    -
    419 // pstrUsagePhoneDirectory
    -
    420 //};
    -
    421 //const char *telTitles3 [] PROGMEM =
    -
    422 //{
    -
    423 // pstrUsageVoiceMail ,
    -
    424 // pstrUsageScreenCalls ,
    -
    425 // pstrUsageDoNotDisturb ,
    -
    426 // pstrUsageMessage ,
    -
    427 // pstrUsageAnswerOnOff
    -
    428 //};
    -
    429 //const char *telTitles4 [] PROGMEM =
    -
    430 //{
    -
    431 // pstrUsageInsideDialTone ,
    -
    432 // pstrUsageOutsideDialTone ,
    -
    433 // pstrUsageInsideRingTone ,
    -
    434 // pstrUsageOutsideRingTone ,
    -
    435 // pstrUsagePriorityRingTone ,
    -
    436 // pstrUsageInsideRingback ,
    -
    437 // pstrUsagePriorityRingback ,
    -
    438 // pstrUsageLineBusyTone ,
    -
    439 // pstrUsageReorderTone ,
    -
    440 // pstrUsageCallWaitingTone ,
    -
    441 // pstrUsageConfirmationTone1 ,
    -
    442 // pstrUsageConfirmationTone2 ,
    -
    443 // pstrUsageTonesOff ,
    -
    444 // pstrUsageOutsideRingback ,
    -
    445 // pstrUsageRinger
    -
    446 //};
    -
    447 //const char *telTitles5 [] PROGMEM =
    -
    448 //{
    -
    449 // pstrUsagePhoneKey0 ,
    -
    450 // pstrUsagePhoneKey1 ,
    -
    451 // pstrUsagePhoneKey2 ,
    -
    452 // pstrUsagePhoneKey3 ,
    -
    453 // pstrUsagePhoneKey4 ,
    -
    454 // pstrUsagePhoneKey5 ,
    -
    455 // pstrUsagePhoneKey6 ,
    -
    456 // pstrUsagePhoneKey7 ,
    -
    457 // pstrUsagePhoneKey8 ,
    -
    458 // pstrUsagePhoneKey9 ,
    -
    459 // pstrUsagePhoneKeyStar ,
    -
    460 // pstrUsagePhoneKeyPound ,
    -
    461 // pstrUsagePhoneKeyA ,
    -
    462 // pstrUsagePhoneKeyB ,
    -
    463 // pstrUsagePhoneKeyC ,
    -
    464 // pstrUsagePhoneKeyD
    -
    465 //};
    -
    466 //const char *consTitles0[] PROGMEM =
    -
    467 //{
    -
    468 // pstrUsageConsumerControl,
    -
    469 // pstrUsageNumericKeyPad,
    -
    470 // pstrUsageProgrammableButton,
    -
    471 // pstrUsageMicrophone,
    -
    472 // pstrUsageHeadphone,
    -
    473 // pstrUsageGraphicEqualizer
    -
    474 //};
    -
    475 //const char *consTitles1[] PROGMEM =
    -
    476 //{
    -
    477 // pstrUsagePlus10 ,
    -
    478 // pstrUsagePlus100,
    -
    479 // pstrUsageAMPM
    -
    480 //};
    -
    481 //const char *consTitles2[] PROGMEM =
    -
    482 //{
    -
    483 // pstrUsagePower ,
    -
    484 // pstrUsageReset ,
    -
    485 // pstrUsageSleep ,
    -
    486 // pstrUsageSleepAfter ,
    -
    487 // pstrUsageSleepMode ,
    -
    488 // pstrUsageIllumination ,
    -
    489 // pstrUsageFunctionButtons
    -
    490 //
    -
    491 //};
    -
    492 //const char *consTitles3[] PROGMEM =
    -
    493 //{
    -
    494 // pstrUsageMenu ,
    -
    495 // pstrUsageMenuPick ,
    -
    496 // pstrUsageMenuUp ,
    -
    497 // pstrUsageMenuDown ,
    -
    498 // pstrUsageMenuLeft ,
    -
    499 // pstrUsageMenuRight ,
    -
    500 // pstrUsageMenuEscape ,
    -
    501 // pstrUsageMenuValueIncrease,
    -
    502 // pstrUsageMenuValueDecrease
    -
    503 //};
    -
    504 //const char *consTitles4[] PROGMEM =
    -
    505 //{
    -
    506 // pstrUsageDataOnScreen ,
    -
    507 // pstrUsageClosedCaption ,
    -
    508 // pstrUsageClosedCaptionSelect,
    -
    509 // pstrUsageVCRTV ,
    -
    510 // pstrUsageBroadcastMode ,
    -
    511 // pstrUsageSnapshot ,
    -
    512 // pstrUsageStill
    -
    513 //};
    -
    514 //const char *consTitles5[] PROGMEM =
    -
    515 //{
    -
    516 // pstrUsageSelection ,
    -
    517 // pstrUsageAssignSelection ,
    -
    518 // pstrUsageModeStep ,
    -
    519 // pstrUsageRecallLast ,
    -
    520 // pstrUsageEnterChannel ,
    -
    521 // pstrUsageOrderMovie ,
    -
    522 // pstrUsageChannel ,
    -
    523 // pstrUsageMediaSelection ,
    -
    524 // pstrUsageMediaSelectComputer ,
    -
    525 // pstrUsageMediaSelectTV ,
    -
    526 // pstrUsageMediaSelectWWW ,
    -
    527 // pstrUsageMediaSelectDVD ,
    -
    528 // pstrUsageMediaSelectTelephone ,
    -
    529 // pstrUsageMediaSelectProgramGuide ,
    -
    530 // pstrUsageMediaSelectVideoPhone ,
    -
    531 // pstrUsageMediaSelectGames ,
    -
    532 // pstrUsageMediaSelectMessages ,
    -
    533 // pstrUsageMediaSelectCD ,
    -
    534 // pstrUsageMediaSelectVCR ,
    -
    535 // pstrUsageMediaSelectTuner ,
    -
    536 // pstrUsageQuit ,
    -
    537 // pstrUsageHelp ,
    -
    538 // pstrUsageMediaSelectTape ,
    -
    539 // pstrUsageMediaSelectCable ,
    -
    540 // pstrUsageMediaSelectSatellite ,
    -
    541 // pstrUsageMediaSelectSecurity ,
    -
    542 // pstrUsageMediaSelectHome ,
    -
    543 // pstrUsageMediaSelectCall ,
    -
    544 // pstrUsageChannelIncrement ,
    -
    545 // pstrUsageChannelDecrement ,
    -
    546 // pstrUsageMediaSelectSAP ,
    -
    547 // pstrUsagePageReserved ,
    -
    548 // pstrUsageVCRPlus ,
    -
    549 // pstrUsageOnce ,
    -
    550 // pstrUsageDaily ,
    -
    551 // pstrUsageWeekly ,
    -
    552 // pstrUsageMonthly
    -
    553 //};
    -
    554 //const char *consTitles6[] PROGMEM =
    -
    555 //{
    -
    556 // pstrUsagePlay ,
    -
    557 // pstrUsagePause ,
    -
    558 // pstrUsageRecord ,
    -
    559 // pstrUsageFastForward ,
    -
    560 // pstrUsageRewind ,
    -
    561 // pstrUsageScanNextTrack ,
    -
    562 // pstrUsageScanPreviousTrack ,
    -
    563 // pstrUsageStop ,
    -
    564 // pstrUsageEject ,
    -
    565 // pstrUsageRandomPlay ,
    -
    566 // pstrUsageSelectDisk ,
    -
    567 // pstrUsageEnterDisk ,
    -
    568 // pstrUsageRepeat ,
    -
    569 // pstrUsageTracking ,
    -
    570 // pstrUsageTrackNormal ,
    -
    571 // pstrUsageSlowTracking ,
    -
    572 // pstrUsageFrameForward ,
    -
    573 // pstrUsageFrameBackwards ,
    -
    574 // pstrUsageMark ,
    -
    575 // pstrUsageClearMark ,
    -
    576 // pstrUsageRepeatFromMark ,
    -
    577 // pstrUsageReturnToMark ,
    -
    578 // pstrUsageSearchMarkForward ,
    -
    579 // pstrUsageSearchMarkBackwards ,
    -
    580 // pstrUsageCounterReset ,
    -
    581 // pstrUsageShowCounter ,
    -
    582 // pstrUsageTrackingIncrement ,
    -
    583 // pstrUsageTrackingDecrement ,
    -
    584 // pstrUsageStopEject ,
    -
    585 // pstrUsagePlayPause ,
    -
    586 // pstrUsagePlaySkip
    -
    587 //};
    -
    588 //const char *consTitles7[] PROGMEM =
    -
    589 //{
    -
    590 // pstrUsageVolume ,
    -
    591 // pstrUsageBalance ,
    -
    592 // pstrUsageMute ,
    -
    593 // pstrUsageBass ,
    -
    594 // pstrUsageTreble ,
    -
    595 // pstrUsageBassBoost ,
    -
    596 // pstrUsageSurroundMode ,
    -
    597 // pstrUsageLoudness ,
    -
    598 // pstrUsageMPX ,
    -
    599 // pstrUsageVolumeIncrement ,
    -
    600 // pstrUsageVolumeDecrement
    -
    601 //};
    -
    602 //const char *consTitles8[] PROGMEM =
    -
    603 //{
    -
    604 // pstrUsageSpeedSelect ,
    -
    605 // pstrUsagePlaybackSpeed ,
    -
    606 // pstrUsageStandardPlay ,
    -
    607 // pstrUsageLongPlay ,
    -
    608 // pstrUsageExtendedPlay ,
    -
    609 // pstrUsageSlow
    -
    610 //};
    -
    611 //const char *consTitles9[] PROGMEM =
    -
    612 //{
    -
    613 // pstrUsageFanEnable ,
    -
    614 // pstrUsageFanSpeed ,
    -
    615 // pstrUsageLightEnable ,
    -
    616 // pstrUsageLightIlluminationLevel ,
    -
    617 // pstrUsageClimateControlEnable ,
    -
    618 // pstrUsageRoomTemperature ,
    -
    619 // pstrUsageSecurityEnable ,
    -
    620 // pstrUsageFireAlarm ,
    -
    621 // pstrUsagePoliceAlarm ,
    -
    622 // pstrUsageProximity ,
    -
    623 // pstrUsageMotion ,
    -
    624 // pstrUsageDuresAlarm ,
    -
    625 // pstrUsageHoldupAlarm ,
    -
    626 // pstrUsageMedicalAlarm
    -
    627 //};
    -
    628 //const char *consTitlesA[] PROGMEM =
    -
    629 //{
    -
    630 // pstrUsageBalanceRight ,
    -
    631 // pstrUsageBalanceLeft ,
    -
    632 // pstrUsageBassIncrement ,
    -
    633 // pstrUsageBassDecrement ,
    -
    634 // pstrUsageTrebleIncrement ,
    -
    635 // pstrUsageTrebleDecrement
    -
    636 //};
    -
    637 //const char *consTitlesB[] PROGMEM =
    -
    638 //{
    -
    639 // pstrUsageSpeakerSystem ,
    -
    640 // pstrUsageChannelLeft ,
    -
    641 // pstrUsageChannelRight ,
    -
    642 // pstrUsageChannelCenter ,
    -
    643 // pstrUsageChannelFront ,
    -
    644 // pstrUsageChannelCenterFront ,
    -
    645 // pstrUsageChannelSide ,
    -
    646 // pstrUsageChannelSurround ,
    -
    647 // pstrUsageChannelLowFreqEnhancement ,
    -
    648 // pstrUsageChannelTop ,
    -
    649 // pstrUsageChannelUnknown
    -
    650 //};
    -
    651 //const char *consTitlesC[] PROGMEM =
    -
    652 //{
    -
    653 // pstrUsageSubChannel ,
    -
    654 // pstrUsageSubChannelIncrement ,
    -
    655 // pstrUsageSubChannelDecrement ,
    -
    656 // pstrUsageAlternateAudioIncrement ,
    -
    657 // pstrUsageAlternateAudioDecrement
    -
    658 //};
    -
    659 //const char *consTitlesD[] PROGMEM =
    -
    660 //{
    -
    661 // pstrUsageApplicationLaunchButtons ,
    -
    662 // pstrUsageALLaunchButtonConfigTool ,
    -
    663 // pstrUsageALProgrammableButton ,
    -
    664 // pstrUsageALConsumerControlConfig ,
    -
    665 // pstrUsageALWordProcessor ,
    -
    666 // pstrUsageALTextEditor ,
    -
    667 // pstrUsageALSpreadsheet ,
    -
    668 // pstrUsageALGraphicsEditor ,
    -
    669 // pstrUsageALPresentationApp ,
    -
    670 // pstrUsageALDatabaseApp ,
    -
    671 // pstrUsageALEmailReader ,
    -
    672 // pstrUsageALNewsreader ,
    -
    673 // pstrUsageALVoicemail ,
    -
    674 // pstrUsageALContactsAddressBook ,
    -
    675 // pstrUsageALCalendarSchedule ,
    -
    676 // pstrUsageALTaskProjectManager ,
    -
    677 // pstrUsageALLogJournalTimecard ,
    -
    678 // pstrUsageALCheckbookFinance ,
    -
    679 // pstrUsageALCalculator ,
    -
    680 // pstrUsageALAVCapturePlayback ,
    -
    681 // pstrUsageALLocalMachineBrowser ,
    -
    682 // pstrUsageALLANWANBrow ,
    -
    683 // pstrUsageALInternetBrowser ,
    -
    684 // pstrUsageALRemoteNetISPConnect ,
    -
    685 // pstrUsageALNetworkConference ,
    -
    686 // pstrUsageALNetworkChat ,
    -
    687 // pstrUsageALTelephonyDialer ,
    -
    688 // pstrUsageALLogon ,
    -
    689 // pstrUsageALLogoff ,
    -
    690 // pstrUsageALLogonLogoff ,
    -
    691 // pstrUsageALTermLockScrSav ,
    -
    692 // pstrUsageALControlPannel ,
    -
    693 // pstrUsageALCommandLineProcessorRun ,
    -
    694 // pstrUsageALProcessTaskManager ,
    -
    695 // pstrUsageALSelectTaskApplication ,
    -
    696 // pstrUsageALNextTaskApplication ,
    -
    697 // pstrUsageALPreviousTaskApplication ,
    -
    698 // pstrUsageALPreemptiveHaltTaskApp ,
    -
    699 // pstrUsageALIntegratedHelpCenter ,
    -
    700 // pstrUsageALDocuments ,
    -
    701 // pstrUsageALThesaurus ,
    -
    702 // pstrUsageALDictionary ,
    -
    703 // pstrUsageALDesktop ,
    -
    704 // pstrUsageALSpellCheck ,
    -
    705 // pstrUsageALGrammarCheck ,
    -
    706 // pstrUsageALWirelessStatus ,
    -
    707 // pstrUsageALKeyboardLayout ,
    -
    708 // pstrUsageALVirusProtection ,
    -
    709 // pstrUsageALEncryption ,
    -
    710 // pstrUsageALScreenSaver ,
    -
    711 // pstrUsageALAlarms ,
    -
    712 // pstrUsageALClock ,
    -
    713 // pstrUsageALFileBrowser ,
    -
    714 // pstrUsageALPowerStatus ,
    -
    715 // pstrUsageALImageBrowser ,
    -
    716 // pstrUsageALAudioBrowser ,
    -
    717 // pstrUsageALMovieBrowser ,
    -
    718 // pstrUsageALDigitalRightsManager ,
    -
    719 // pstrUsageALDigitalWallet ,
    -
    720 // pstrUsagePageReserved ,
    -
    721 // pstrUsageALInstantMessaging ,
    -
    722 // pstrUsageALOEMFeaturesBrowser ,
    -
    723 // pstrUsageALOEMHelp ,
    -
    724 // pstrUsageALOnlineCommunity ,
    -
    725 // pstrUsageALEntertainmentContentBrow ,
    -
    726 // pstrUsageALOnlineShoppingBrowser ,
    -
    727 // pstrUsageALSmartCardInfoHelp ,
    -
    728 // pstrUsageALMarketMonitorFinBrowser ,
    -
    729 // pstrUsageALCustomCorpNewsBrowser ,
    -
    730 // pstrUsageALOnlineActivityBrowser ,
    -
    731 // pstrUsageALResearchSearchBrowser ,
    -
    732 // pstrUsageALAudioPlayer
    -
    733 //};
    -
    734 //const char *consTitlesE[] PROGMEM =
    -
    735 //{
    -
    736 // pstrUsageGenericGUIAppControls ,
    -
    737 // pstrUsageACNew ,
    -
    738 // pstrUsageACOpen ,
    -
    739 // pstrUsageACClose ,
    -
    740 // pstrUsageACExit ,
    -
    741 // pstrUsageACMaximize ,
    -
    742 // pstrUsageACMinimize ,
    -
    743 // pstrUsageACSave ,
    -
    744 // pstrUsageACPrint ,
    -
    745 // pstrUsageACProperties ,
    -
    746 // pstrUsageACUndo ,
    -
    747 // pstrUsageACCopy ,
    -
    748 // pstrUsageACCut ,
    -
    749 // pstrUsageACPaste ,
    -
    750 // pstrUsageACSelectAll ,
    -
    751 // pstrUsageACFind ,
    -
    752 // pstrUsageACFindAndReplace ,
    -
    753 // pstrUsageACSearch ,
    -
    754 // pstrUsageACGoto ,
    -
    755 // pstrUsageACHome ,
    -
    756 // pstrUsageACBack ,
    -
    757 // pstrUsageACForward ,
    -
    758 // pstrUsageACStop ,
    -
    759 // pstrUsageACRefresh ,
    -
    760 // pstrUsageACPreviousLink ,
    -
    761 // pstrUsageACNextLink ,
    -
    762 // pstrUsageACBookmarks ,
    -
    763 // pstrUsageACHistory ,
    -
    764 // pstrUsageACSubscriptions ,
    -
    765 // pstrUsageACZoomIn ,
    -
    766 // pstrUsageACZoomOut ,
    -
    767 // pstrUsageACZoom ,
    -
    768 // pstrUsageACFullScreenView ,
    -
    769 // pstrUsageACNormalView ,
    -
    770 // pstrUsageACViewToggle ,
    -
    771 // pstrUsageACScrollUp ,
    -
    772 // pstrUsageACScrollDown ,
    -
    773 // pstrUsageACScroll ,
    -
    774 // pstrUsageACPanLeft ,
    -
    775 // pstrUsageACPanRight ,
    -
    776 // pstrUsageACPan ,
    -
    777 // pstrUsageACNewWindow ,
    -
    778 // pstrUsageACTileHoriz ,
    -
    779 // pstrUsageACTileVert ,
    -
    780 // pstrUsageACFormat ,
    -
    781 // pstrUsageACEdit ,
    -
    782 // pstrUsageACBold ,
    -
    783 // pstrUsageACItalics ,
    -
    784 // pstrUsageACUnderline ,
    -
    785 // pstrUsageACStrikethrough ,
    -
    786 // pstrUsageACSubscript ,
    -
    787 // pstrUsageACSuperscript ,
    -
    788 // pstrUsageACAllCaps ,
    -
    789 // pstrUsageACRotate ,
    -
    790 // pstrUsageACResize ,
    -
    791 // pstrUsageACFlipHorizontal ,
    -
    792 // pstrUsageACFlipVertical ,
    -
    793 // pstrUsageACMirrorHorizontal ,
    -
    794 // pstrUsageACMirrorVertical ,
    -
    795 // pstrUsageACFontSelect ,
    -
    796 // pstrUsageACFontColor ,
    -
    797 // pstrUsageACFontSize ,
    -
    798 // pstrUsageACJustifyLeft ,
    -
    799 // pstrUsageACJustifyCenterH ,
    -
    800 // pstrUsageACJustifyRight ,
    -
    801 // pstrUsageACJustifyBlockH ,
    -
    802 // pstrUsageACJustifyTop ,
    -
    803 // pstrUsageACJustifyCenterV ,
    -
    804 // pstrUsageACJustifyBottom ,
    -
    805 // pstrUsageACJustifyBlockV ,
    -
    806 // pstrUsageACIndentDecrease ,
    -
    807 // pstrUsageACIndentIncrease ,
    -
    808 // pstrUsageACNumberedList ,
    -
    809 // pstrUsageACRestartNumbering ,
    -
    810 // pstrUsageACBulletedList ,
    -
    811 // pstrUsageACPromote ,
    -
    812 // pstrUsageACDemote ,
    -
    813 // pstrUsageACYes ,
    -
    814 // pstrUsageACNo ,
    -
    815 // pstrUsageACCancel ,
    -
    816 // pstrUsageACCatalog ,
    -
    817 // pstrUsageACBuyChkout ,
    -
    818 // pstrUsageACAddToCart ,
    -
    819 // pstrUsageACExpand ,
    -
    820 // pstrUsageACExpandAll ,
    -
    821 // pstrUsageACCollapse ,
    -
    822 // pstrUsageACCollapseAll ,
    -
    823 // pstrUsageACPrintPreview ,
    -
    824 // pstrUsageACPasteSpecial ,
    -
    825 // pstrUsageACInsertMode ,
    -
    826 // pstrUsageACDelete ,
    -
    827 // pstrUsageACLock ,
    -
    828 // pstrUsageACUnlock ,
    -
    829 // pstrUsageACProtect ,
    -
    830 // pstrUsageACUnprotect ,
    -
    831 // pstrUsageACAttachComment ,
    -
    832 // pstrUsageACDeleteComment ,
    -
    833 // pstrUsageACViewComment ,
    -
    834 // pstrUsageACSelectWord ,
    -
    835 // pstrUsageACSelectSentence ,
    -
    836 // pstrUsageACSelectParagraph ,
    -
    837 // pstrUsageACSelectColumn ,
    -
    838 // pstrUsageACSelectRow ,
    -
    839 // pstrUsageACSelectTable ,
    -
    840 // pstrUsageACSelectObject ,
    -
    841 // pstrUsageACRedoRepeat ,
    -
    842 // pstrUsageACSort ,
    -
    843 // pstrUsageACSortAscending ,
    -
    844 // pstrUsageACSortDescending ,
    -
    845 // pstrUsageACFilter ,
    -
    846 // pstrUsageACSetClock ,
    -
    847 // pstrUsageACViewClock ,
    -
    848 // pstrUsageACSelectTimeZone ,
    -
    849 // pstrUsageACEditTimeZone ,
    -
    850 // pstrUsageACSetAlarm ,
    -
    851 // pstrUsageACClearAlarm ,
    -
    852 // pstrUsageACSnoozeAlarm ,
    -
    853 // pstrUsageACResetAlarm ,
    -
    854 // pstrUsageACSyncronize ,
    -
    855 // pstrUsageACSendReceive ,
    -
    856 // pstrUsageACSendTo ,
    -
    857 // pstrUsageACReply ,
    -
    858 // pstrUsageACReplyAll ,
    -
    859 // pstrUsageACForwardMessage ,
    -
    860 // pstrUsageACSend ,
    -
    861 // pstrUsageACAttachFile ,
    -
    862 // pstrUsageACUpload ,
    -
    863 // pstrUsageACDownload ,
    -
    864 // pstrUsageACSetBorders ,
    -
    865 // pstrUsageACInsertRow ,
    -
    866 // pstrUsageACInsertColumn ,
    -
    867 // pstrUsageACInsertFile ,
    -
    868 // pstrUsageACInsertPicture ,
    -
    869 // pstrUsageACInsertObject ,
    -
    870 // pstrUsageACInsertSymbol ,
    -
    871 // pstrUsageACSaveAndClose ,
    -
    872 // pstrUsageACRename ,
    -
    873 // pstrUsageACMerge ,
    -
    874 // pstrUsageACSplit ,
    -
    875 // pstrUsageACDistributeHorizontaly ,
    -
    876 // pstrUsageACDistributeVerticaly
    -
    877 //};
    -
    878 //const char *digitTitles0[] PROGMEM =
    -
    879 //{
    -
    880 // pstrUsageDigitizer ,
    -
    881 // pstrUsagePen ,
    -
    882 // pstrUsageLightPen ,
    -
    883 // pstrUsageTouchScreen ,
    -
    884 // pstrUsageTouchPad ,
    -
    885 // pstrUsageWhiteBoard ,
    -
    886 // pstrUsageCoordinateMeasuringMachine ,
    -
    887 // pstrUsage3DDigitizer ,
    -
    888 // pstrUsageStereoPlotter ,
    -
    889 // pstrUsageArticulatedArm ,
    -
    890 // pstrUsageArmature ,
    -
    891 // pstrUsageMultiplePointDigitizer ,
    -
    892 // pstrUsageFreeSpaceWand
    -
    893 //};
    -
    894 //const char *digitTitles1[] PROGMEM =
    -
    895 //{
    -
    896 // pstrUsageStylus ,
    -
    897 // pstrUsagePuck ,
    -
    898 // pstrUsageFinger
    -
    899 //
    -
    900 //};
    -
    901 //const char *digitTitles2[] PROGMEM =
    -
    902 //{
    -
    903 // pstrUsageTipPressure ,
    -
    904 // pstrUsageBarrelPressure ,
    -
    905 // pstrUsageInRange ,
    -
    906 // pstrUsageTouch ,
    -
    907 // pstrUsageUntouch ,
    -
    908 // pstrUsageTap ,
    -
    909 // pstrUsageQuality ,
    -
    910 // pstrUsageDataValid ,
    -
    911 // pstrUsageTransducerIndex ,
    -
    912 // pstrUsageTabletFunctionKeys ,
    -
    913 // pstrUsageProgramChangeKeys ,
    -
    914 // pstrUsageBatteryStrength ,
    -
    915 // pstrUsageInvert ,
    -
    916 // pstrUsageXTilt ,
    -
    917 // pstrUsageYTilt ,
    -
    918 // pstrUsageAzimuth ,
    -
    919 // pstrUsageAltitude ,
    -
    920 // pstrUsageTwist ,
    -
    921 // pstrUsageTipSwitch ,
    -
    922 // pstrUsageSecondaryTipSwitch ,
    -
    923 // pstrUsageBarrelSwitch ,
    -
    924 // pstrUsageEraser ,
    -
    925 // pstrUsageTabletPick
    -
    926 //};
    -
    927 //const char *aplphanumTitles0[] PROGMEM =
    -
    928 //{
    -
    929 // pstrUsageAlphanumericDisplay,
    -
    930 // pstrUsageBitmappedDisplay
    -
    931 //};
    -
    932 //const char *aplphanumTitles1[] PROGMEM =
    -
    933 //{
    -
    934 // pstrUsageDisplayAttributesReport ,
    -
    935 // pstrUsageASCIICharacterSet ,
    -
    936 // pstrUsageDataReadBack ,
    -
    937 // pstrUsageFontReadBack ,
    -
    938 // pstrUsageDisplayControlReport ,
    -
    939 // pstrUsageClearDisplay ,
    -
    940 // pstrUsageDisplayEnable ,
    -
    941 // pstrUsageScreenSaverDelay ,
    -
    942 // pstrUsageScreenSaverEnable ,
    -
    943 // pstrUsageVerticalScroll ,
    -
    944 // pstrUsageHorizontalScroll ,
    -
    945 // pstrUsageCharacterReport ,
    -
    946 // pstrUsageDisplayData ,
    -
    947 // pstrUsageDisplayStatus ,
    -
    948 // pstrUsageStatusNotReady ,
    -
    949 // pstrUsageStatusReady ,
    -
    950 // pstrUsageErrorNotALoadableCharacter ,
    -
    951 // pstrUsageErrorFotDataCanNotBeRead ,
    -
    952 // pstrUsageCursorPositionReport ,
    -
    953 // pstrUsageRow ,
    -
    954 // pstrUsageColumn ,
    -
    955 // pstrUsageRows ,
    -
    956 // pstrUsageColumns ,
    -
    957 // pstrUsageCursorPixelPosition ,
    -
    958 // pstrUsageCursorMode ,
    -
    959 // pstrUsageCursorEnable ,
    -
    960 // pstrUsageCursorBlink ,
    -
    961 // pstrUsageFontReport ,
    -
    962 // pstrUsageFontData ,
    -
    963 // pstrUsageCharacterWidth ,
    -
    964 // pstrUsageCharacterHeight ,
    -
    965 // pstrUsageCharacterSpacingHorizontal ,
    -
    966 // pstrUsageCharacterSpacingVertical ,
    -
    967 // pstrUsageUnicodeCharset ,
    -
    968 // pstrUsageFont7Segment ,
    -
    969 // pstrUsage7SegmentDirectMap ,
    -
    970 // pstrUsageFont14Segment ,
    -
    971 // pstrUsage14SegmentDirectMap ,
    -
    972 // pstrUsageDisplayBrightness ,
    -
    973 // pstrUsageDisplayContrast ,
    -
    974 // pstrUsageCharacterAttribute ,
    -
    975 // pstrUsageAttributeReadback ,
    -
    976 // pstrUsageAttributeData ,
    -
    977 // pstrUsageCharAttributeEnhance ,
    -
    978 // pstrUsageCharAttributeUnderline ,
    -
    979 // pstrUsageCharAttributeBlink
    -
    980 //};
    -
    981 //const char *aplphanumTitles2[] PROGMEM =
    -
    982 //{
    -
    983 // pstrUsageBitmapSizeX ,
    -
    984 // pstrUsageBitmapSizeY ,
    -
    985 // pstrUsagePageReserved ,
    -
    986 // pstrUsageBitDepthFormat ,
    -
    987 // pstrUsageDisplayOrientation ,
    -
    988 // pstrUsagePaletteReport ,
    -
    989 // pstrUsagePaletteDataSize ,
    -
    990 // pstrUsagePaletteDataOffset ,
    -
    991 // pstrUsagePaletteData ,
    -
    992 // pstrUsageBlitReport ,
    -
    993 // pstrUsageBlitRectangleX1 ,
    -
    994 // pstrUsageBlitRectangleY1 ,
    -
    995 // pstrUsageBlitRectangleX2 ,
    -
    996 // pstrUsageBlitRectangleY2 ,
    -
    997 // pstrUsageBlitData ,
    -
    998 // pstrUsageSoftButton ,
    -
    999 // pstrUsageSoftButtonID ,
    -
    1000 // pstrUsageSoftButtonSide ,
    -
    1001 // pstrUsageSoftButtonOffset1 ,
    -
    1002 // pstrUsageSoftButtonOffset2 ,
    -
    1003 // pstrUsageSoftButtonReport
    -
    1004 //};
    -
    1005 //const char *medInstrTitles0[] PROGMEM =
    -
    1006 //{
    -
    1007 // pstrUsageVCRAcquisition ,
    -
    1008 // pstrUsageFreezeThaw ,
    -
    1009 // pstrUsageClipStore ,
    -
    1010 // pstrUsageUpdate ,
    -
    1011 // pstrUsageNext ,
    -
    1012 // pstrUsageSave ,
    -
    1013 // pstrUsagePrint ,
    -
    1014 // pstrUsageMicrophoneEnable
    -
    1015 //};
    -
    1016 //const char *medInstrTitles1[] PROGMEM =
    -
    1017 //{
    -
    1018 // pstrUsageCine ,
    -
    1019 // pstrUsageTransmitPower ,
    -
    1020 // pstrUsageVolume ,
    -
    1021 // pstrUsageFocus ,
    -
    1022 // pstrUsageDepth
    -
    1023 //};
    -
    1024 //const char *medInstrTitles2[] PROGMEM =
    -
    1025 //{
    -
    1026 // pstrUsageSoftStepPrimary ,
    -
    1027 // pstrUsageSoftStepSecondary
    -
    1028 //};
    -
    1029 //const char *medInstrTitles3[] PROGMEM =
    -
    1030 //{
    -
    1031 // pstrUsageZoomSelect ,
    -
    1032 // pstrUsageZoomAdjust ,
    -
    1033 // pstrUsageSpectralDopplerModeSelect ,
    -
    1034 // pstrUsageSpectralDopplerModeAdjust ,
    -
    1035 // pstrUsageColorDopplerModeSelect ,
    -
    1036 // pstrUsageColorDopplerModeAdjust ,
    -
    1037 // pstrUsageMotionModeSelect ,
    -
    1038 // pstrUsageMotionModeAdjust ,
    -
    1039 // pstrUsage2DModeSelect ,
    -
    1040 // pstrUsage2DModeAdjust
    -
    1041 //};
    -
    1042 //const char *medInstrTitles4[] PROGMEM =
    -
    1043 //{
    -
    1044 // pstrUsageSoftControlSelect ,
    -
    1045 // pstrUsageSoftControlAdjust
    -
    1046 //};
    -
    1047 
    -
    1048 #endif // __HIDUSAGETITLEARRAYS_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(__HIDUSAGETITLEARRAYS_H__)
    18 #define __HIDUSAGETITLEARRAYS_H__
    19 
    20 #include "hidusagestr.h"
    21 
    22 // This is here why?
    23 
    24 //const char *usagePageTitles0[] PROGMEM =
    25 //{
    26 // pstrUsagePageGenericDesktopControls ,
    27 // pstrUsagePageSimulationControls ,
    28 // pstrUsagePageVRControls ,
    29 // pstrUsagePageSportControls ,
    30 // pstrUsagePageGameControls ,
    31 // pstrUsagePageGenericDeviceControls ,
    32 // pstrUsagePageKeyboardKeypad ,
    33 // pstrUsagePageLEDs ,
    34 // pstrUsagePageButton ,
    35 // pstrUsagePageOrdinal ,
    36 // pstrUsagePageTelephone ,
    37 // pstrUsagePageConsumer ,
    38 // pstrUsagePageDigitizer ,
    39 // pstrUsagePagePID ,
    40 // pstrUsagePageUnicode
    41 //};
    42 //
    43 //const char *usagePageTitles1[] PROGMEM =
    44 //{
    45 // pstrUsagePageBarCodeScanner ,
    46 // pstrUsagePageScale ,
    47 // pstrUsagePageMSRDevices ,
    48 // pstrUsagePagePointOfSale ,
    49 // pstrUsagePageCameraControl ,
    50 // pstrUsagePageArcade
    51 //};
    52 //const char *genDesktopTitles0[] PROGMEM =
    53 //{
    54 // pstrUsagePointer ,
    55 // pstrUsageMouse ,
    56 // pstrUsageJoystick ,
    57 // pstrUsageGamePad ,
    58 // pstrUsageKeyboard ,
    59 // pstrUsageKeypad ,
    60 // pstrUsageMultiAxisController ,
    61 // pstrUsageTabletPCSystemControls
    62 //
    63 //};
    64 //const char *genDesktopTitles1[] PROGMEM =
    65 //{
    66 // pstrUsageX ,
    67 // pstrUsageY ,
    68 // pstrUsageZ ,
    69 // pstrUsageRx ,
    70 // pstrUsageRy ,
    71 // pstrUsageRz ,
    72 // pstrUsageSlider ,
    73 // pstrUsageDial ,
    74 // pstrUsageWheel ,
    75 // pstrUsageHatSwitch ,
    76 // pstrUsageCountedBuffer ,
    77 // pstrUsageByteCount ,
    78 // pstrUsageMotionWakeup ,
    79 // pstrUsageStart ,
    80 // pstrUsageSelect ,
    81 // pstrUsagePageReserved ,
    82 // pstrUsageVx ,
    83 // pstrUsageVy ,
    84 // pstrUsageVz ,
    85 // pstrUsageVbrx ,
    86 // pstrUsageVbry ,
    87 // pstrUsageVbrz ,
    88 // pstrUsageVno ,
    89 // pstrUsageFeatureNotification ,
    90 // pstrUsageResolutionMultiplier
    91 //};
    92 //const char *genDesktopTitles2[] PROGMEM =
    93 //{
    94 // pstrUsageSystemControl ,
    95 // pstrUsageSystemPowerDown ,
    96 // pstrUsageSystemSleep ,
    97 // pstrUsageSystemWakeup ,
    98 // pstrUsageSystemContextMenu ,
    99 // pstrUsageSystemMainMenu ,
    100 // pstrUsageSystemAppMenu ,
    101 // pstrUsageSystemMenuHelp ,
    102 // pstrUsageSystemMenuExit ,
    103 // pstrUsageSystemMenuSelect ,
    104 // pstrUsageSystemMenuRight ,
    105 // pstrUsageSystemMenuLeft ,
    106 // pstrUsageSystemMenuUp ,
    107 // pstrUsageSystemMenuDown ,
    108 // pstrUsageSystemColdRestart ,
    109 // pstrUsageSystemWarmRestart ,
    110 // pstrUsageDPadUp ,
    111 // pstrUsageDPadDown ,
    112 // pstrUsageDPadRight ,
    113 // pstrUsageDPadLeft
    114 //};
    115 //const char *genDesktopTitles3[] PROGMEM =
    116 //{
    117 // pstrUsageSystemDock ,
    118 // pstrUsageSystemUndock ,
    119 // pstrUsageSystemSetup ,
    120 // pstrUsageSystemBreak ,
    121 // pstrUsageSystemDebuggerBreak ,
    122 // pstrUsageApplicationBreak ,
    123 // pstrUsageApplicationDebuggerBreak,
    124 // pstrUsageSystemSpeakerMute ,
    125 // pstrUsageSystemHibernate
    126 //};
    127 //const char *genDesktopTitles4[] PROGMEM =
    128 //{
    129 // pstrUsageSystemDisplayInvert ,
    130 // pstrUsageSystemDisplayInternal ,
    131 // pstrUsageSystemDisplayExternal ,
    132 // pstrUsageSystemDisplayBoth ,
    133 // pstrUsageSystemDisplayDual ,
    134 // pstrUsageSystemDisplayToggleIntExt ,
    135 // pstrUsageSystemDisplaySwapPriSec ,
    136 // pstrUsageSystemDisplayLCDAutoscale
    137 //};
    138 //const char *simuTitles0[] PROGMEM =
    139 //{
    140 // pstrUsageFlightSimulationDevice ,
    141 // pstrUsageAutomobileSimulationDevice ,
    142 // pstrUsageTankSimulationDevice ,
    143 // pstrUsageSpaceshipSimulationDevice ,
    144 // pstrUsageSubmarineSimulationDevice ,
    145 // pstrUsageSailingSimulationDevice ,
    146 // pstrUsageMotocicleSimulationDevice ,
    147 // pstrUsageSportsSimulationDevice ,
    148 // pstrUsageAirplaneSimulationDevice ,
    149 // pstrUsageHelicopterSimulationDevice ,
    150 // pstrUsageMagicCarpetSimulationDevice,
    151 // pstrUsageBicycleSimulationDevice
    152 //};
    153 //const char *simuTitles1[] PROGMEM =
    154 //{
    155 // pstrUsageFlightControlStick ,
    156 // pstrUsageFlightStick ,
    157 // pstrUsageCyclicControl ,
    158 // pstrUsageCyclicTrim ,
    159 // pstrUsageFlightYoke ,
    160 // pstrUsageTrackControl
    161 //};
    162 //const char *simuTitles2[] PROGMEM =
    163 //{
    164 // pstrUsageAileron ,
    165 // pstrUsageAileronTrim ,
    166 // pstrUsageAntiTorqueControl ,
    167 // pstrUsageAutopilotEnable ,
    168 // pstrUsageChaffRelease ,
    169 // pstrUsageCollectiveControl ,
    170 // pstrUsageDiveBrake ,
    171 // pstrUsageElectronicCountermeasures ,
    172 // pstrUsageElevator ,
    173 // pstrUsageElevatorTrim ,
    174 // pstrUsageRudder ,
    175 // pstrUsageThrottle ,
    176 // pstrUsageFlightCommunications ,
    177 // pstrUsageFlareRelease ,
    178 // pstrUsageLandingGear ,
    179 // pstrUsageToeBrake ,
    180 // pstrUsageTrigger ,
    181 // pstrUsageWeaponsArm ,
    182 // pstrUsageWeaponsSelect ,
    183 // pstrUsageWingFlaps ,
    184 // pstrUsageAccelerator ,
    185 // pstrUsageBrake ,
    186 // pstrUsageClutch ,
    187 // pstrUsageShifter ,
    188 // pstrUsageSteering ,
    189 // pstrUsageTurretDirection ,
    190 // pstrUsageBarrelElevation ,
    191 // pstrUsageDivePlane ,
    192 // pstrUsageBallast ,
    193 // pstrUsageBicycleCrank ,
    194 // pstrUsageHandleBars ,
    195 // pstrUsageFrontBrake ,
    196 // pstrUsageRearBrake
    197 //};
    198 //const char *vrTitles0[] PROGMEM =
    199 //{
    200 // pstrUsageBelt ,
    201 // pstrUsageBodySuit ,
    202 // pstrUsageFlexor ,
    203 // pstrUsageGlove ,
    204 // pstrUsageHeadTracker ,
    205 // pstrUsageHeadMountedDisplay ,
    206 // pstrUsageHandTracker ,
    207 // pstrUsageOculometer ,
    208 // pstrUsageVest ,
    209 // pstrUsageAnimatronicDevice
    210 //};
    211 //const char *vrTitles1[] PROGMEM =
    212 //{
    213 // pstrUsageStereoEnable ,
    214 // pstrUsageDisplayEnable
    215 //};
    216 //const char *sportsCtrlTitles0[] PROGMEM =
    217 //{
    218 // pstrUsageBaseballBat ,
    219 // pstrUsageGolfClub ,
    220 // pstrUsageRowingMachine ,
    221 // pstrUsageTreadmill
    222 //};
    223 //const char *sportsCtrlTitles1[] PROGMEM =
    224 //{
    225 // pstrUsageOar ,
    226 // pstrUsageSlope ,
    227 // pstrUsageRate ,
    228 // pstrUsageStickSpeed ,
    229 // pstrUsageStickFaceAngle ,
    230 // pstrUsageStickHeelToe ,
    231 // pstrUsageStickFollowThough ,
    232 // pstrUsageStickTempo ,
    233 // pstrUsageStickType ,
    234 // pstrUsageStickHeight
    235 //};
    236 //const char *sportsCtrlTitles2[] PROGMEM =
    237 //{
    238 // pstrUsagePutter ,
    239 // pstrUsage1Iron ,
    240 // pstrUsage2Iron ,
    241 // pstrUsage3Iron ,
    242 // pstrUsage4Iron ,
    243 // pstrUsage5Iron ,
    244 // pstrUsage6Iron ,
    245 // pstrUsage7Iron ,
    246 // pstrUsage8Iron ,
    247 // pstrUsage9Iron ,
    248 // pstrUsage10Iron ,
    249 // pstrUsage11Iron ,
    250 // pstrUsageSandWedge ,
    251 // pstrUsageLoftWedge ,
    252 // pstrUsagePowerWedge ,
    253 // pstrUsage1Wood ,
    254 // pstrUsage3Wood ,
    255 // pstrUsage5Wood ,
    256 // pstrUsage7Wood ,
    257 // pstrUsage9Wood
    258 //};
    259 //const char *gameTitles0[] PROGMEM =
    260 //{
    261 // pstrUsage3DGameController ,
    262 // pstrUsagePinballDevice ,
    263 // pstrUsageGunDevice
    264 //};
    265 //const char *gameTitles1[] PROGMEM =
    266 //{
    267 // pstrUsagePointOfView ,
    268 // pstrUsageTurnRightLeft ,
    269 // pstrUsagePitchForwardBackward ,
    270 // pstrUsageRollRightLeft ,
    271 // pstrUsageMoveRightLeft ,
    272 // pstrUsageMoveForwardBackward ,
    273 // pstrUsageMoveUpDown ,
    274 // pstrUsageLeanRightLeft ,
    275 // pstrUsageLeanForwardBackward ,
    276 // pstrUsageHeightOfPOV ,
    277 // pstrUsageFlipper ,
    278 // pstrUsageSecondaryFlipper ,
    279 // pstrUsageBump ,
    280 // pstrUsageNewGame ,
    281 // pstrUsageShootBall ,
    282 // pstrUsagePlayer ,
    283 // pstrUsageGunBolt ,
    284 // pstrUsageGunClip ,
    285 // pstrUsageGunSelector ,
    286 // pstrUsageGunSingleShot ,
    287 // pstrUsageGunBurst ,
    288 // pstrUsageGunAutomatic ,
    289 // pstrUsageGunSafety ,
    290 // pstrUsageGamepadFireJump ,
    291 // pstrUsageGamepadTrigger
    292 //};
    293 //const char *genDevCtrlTitles[] PROGMEM =
    294 //{
    295 // pstrUsageBatteryStrength,
    296 // pstrUsageWirelessChannel,
    297 // pstrUsageWirelessID,
    298 // pstrUsageDiscoverWirelessControl,
    299 // pstrUsageSecurityCodeCharEntered,
    300 // pstrUsageSecurityCodeCharErased,
    301 // pstrUsageSecurityCodeCleared
    302 //};
    303 //const char *ledTitles[] PROGMEM =
    304 //{
    305 // pstrUsageNumLock ,
    306 // pstrUsageCapsLock ,
    307 // pstrUsageScrollLock ,
    308 // pstrUsageCompose ,
    309 // pstrUsageKana ,
    310 // pstrUsagePower ,
    311 // pstrUsageShift ,
    312 // pstrUsageDoNotDisturb ,
    313 // pstrUsageMute ,
    314 // pstrUsageToneEnable ,
    315 // pstrUsageHighCutFilter ,
    316 // pstrUsageLowCutFilter ,
    317 // pstrUsageEqualizerEnable ,
    318 // pstrUsageSoundFieldOn ,
    319 // pstrUsageSurroundOn ,
    320 // pstrUsageRepeat ,
    321 // pstrUsageStereo ,
    322 // pstrUsageSamplingRateDetect ,
    323 // pstrUsageSpinning ,
    324 // pstrUsageCAV ,
    325 // pstrUsageCLV ,
    326 // pstrUsageRecordingFormatDetect ,
    327 // pstrUsageOffHook ,
    328 // pstrUsageRing ,
    329 // pstrUsageMessageWaiting ,
    330 // pstrUsageDataMode ,
    331 // pstrUsageBatteryOperation ,
    332 // pstrUsageBatteryOK ,
    333 // pstrUsageBatteryLow ,
    334 // pstrUsageSpeaker ,
    335 // pstrUsageHeadSet ,
    336 // pstrUsageHold ,
    337 // pstrUsageMicrophone ,
    338 // pstrUsageCoverage ,
    339 // pstrUsageNightMode ,
    340 // pstrUsageSendCalls ,
    341 // pstrUsageCallPickup ,
    342 // pstrUsageConference ,
    343 // pstrUsageStandBy ,
    344 // pstrUsageCameraOn ,
    345 // pstrUsageCameraOff ,
    346 // pstrUsageOnLine ,
    347 // pstrUsageOffLine ,
    348 // pstrUsageBusy ,
    349 // pstrUsageReady ,
    350 // pstrUsagePaperOut ,
    351 // pstrUsagePaperJam ,
    352 // pstrUsageRemote ,
    353 // pstrUsageForward ,
    354 // pstrUsageReverse ,
    355 // pstrUsageStop ,
    356 // pstrUsageRewind ,
    357 // pstrUsageFastForward ,
    358 // pstrUsagePlay ,
    359 // pstrUsagePause ,
    360 // pstrUsageRecord ,
    361 // pstrUsageError ,
    362 // pstrUsageSelectedIndicator ,
    363 // pstrUsageInUseIndicator ,
    364 // pstrUsageMultiModeIndicator ,
    365 // pstrUsageIndicatorOn ,
    366 // pstrUsageIndicatorFlash ,
    367 // pstrUsageIndicatorSlowBlink ,
    368 // pstrUsageIndicatorFastBlink ,
    369 // pstrUsageIndicatorOff ,
    370 // pstrUsageFlashOnTime ,
    371 // pstrUsageSlowBlinkOnTime ,
    372 // pstrUsageSlowBlinkOffTime ,
    373 // pstrUsageFastBlinkOnTime ,
    374 // pstrUsageFastBlinkOffTime ,
    375 // pstrUsageIndicatorColor ,
    376 // pstrUsageIndicatorRed ,
    377 // pstrUsageIndicatorGreen ,
    378 // pstrUsageIndicatorAmber ,
    379 // pstrUsageGenericIndicator ,
    380 // pstrUsageSystemSuspend ,
    381 // pstrUsageExternalPowerConnected
    382 //};
    383 //const char *telTitles0 [] PROGMEM =
    384 //{
    385 // pstrUsagePhone ,
    386 // pstrUsageAnsweringMachine ,
    387 // pstrUsageMessageControls ,
    388 // pstrUsageHandset ,
    389 // pstrUsageHeadset ,
    390 // pstrUsageTelephonyKeyPad ,
    391 // pstrUsageProgrammableButton
    392 //};
    393 //const char *telTitles1 [] PROGMEM =
    394 //{
    395 // pstrUsageHookSwitch ,
    396 // pstrUsageFlash ,
    397 // pstrUsageFeature ,
    398 // pstrUsageHold ,
    399 // pstrUsageRedial ,
    400 // pstrUsageTransfer ,
    401 // pstrUsageDrop ,
    402 // pstrUsagePark ,
    403 // pstrUsageForwardCalls ,
    404 // pstrUsageAlternateFunction ,
    405 // pstrUsageLine ,
    406 // pstrUsageSpeakerPhone ,
    407 // pstrUsageConference ,
    408 // pstrUsageRingEnable ,
    409 // pstrUsageRingSelect ,
    410 // pstrUsagePhoneMute ,
    411 // pstrUsageCallerID ,
    412 // pstrUsageSend
    413 //};
    414 //const char *telTitles2 [] PROGMEM =
    415 //{
    416 // pstrUsageSpeedDial ,
    417 // pstrUsageStoreNumber ,
    418 // pstrUsageRecallNumber ,
    419 // pstrUsagePhoneDirectory
    420 //};
    421 //const char *telTitles3 [] PROGMEM =
    422 //{
    423 // pstrUsageVoiceMail ,
    424 // pstrUsageScreenCalls ,
    425 // pstrUsageDoNotDisturb ,
    426 // pstrUsageMessage ,
    427 // pstrUsageAnswerOnOff
    428 //};
    429 //const char *telTitles4 [] PROGMEM =
    430 //{
    431 // pstrUsageInsideDialTone ,
    432 // pstrUsageOutsideDialTone ,
    433 // pstrUsageInsideRingTone ,
    434 // pstrUsageOutsideRingTone ,
    435 // pstrUsagePriorityRingTone ,
    436 // pstrUsageInsideRingback ,
    437 // pstrUsagePriorityRingback ,
    438 // pstrUsageLineBusyTone ,
    439 // pstrUsageReorderTone ,
    440 // pstrUsageCallWaitingTone ,
    441 // pstrUsageConfirmationTone1 ,
    442 // pstrUsageConfirmationTone2 ,
    443 // pstrUsageTonesOff ,
    444 // pstrUsageOutsideRingback ,
    445 // pstrUsageRinger
    446 //};
    447 //const char *telTitles5 [] PROGMEM =
    448 //{
    449 // pstrUsagePhoneKey0 ,
    450 // pstrUsagePhoneKey1 ,
    451 // pstrUsagePhoneKey2 ,
    452 // pstrUsagePhoneKey3 ,
    453 // pstrUsagePhoneKey4 ,
    454 // pstrUsagePhoneKey5 ,
    455 // pstrUsagePhoneKey6 ,
    456 // pstrUsagePhoneKey7 ,
    457 // pstrUsagePhoneKey8 ,
    458 // pstrUsagePhoneKey9 ,
    459 // pstrUsagePhoneKeyStar ,
    460 // pstrUsagePhoneKeyPound ,
    461 // pstrUsagePhoneKeyA ,
    462 // pstrUsagePhoneKeyB ,
    463 // pstrUsagePhoneKeyC ,
    464 // pstrUsagePhoneKeyD
    465 //};
    466 //const char *consTitles0[] PROGMEM =
    467 //{
    468 // pstrUsageConsumerControl,
    469 // pstrUsageNumericKeyPad,
    470 // pstrUsageProgrammableButton,
    471 // pstrUsageMicrophone,
    472 // pstrUsageHeadphone,
    473 // pstrUsageGraphicEqualizer
    474 //};
    475 //const char *consTitles1[] PROGMEM =
    476 //{
    477 // pstrUsagePlus10 ,
    478 // pstrUsagePlus100,
    479 // pstrUsageAMPM
    480 //};
    481 //const char *consTitles2[] PROGMEM =
    482 //{
    483 // pstrUsagePower ,
    484 // pstrUsageReset ,
    485 // pstrUsageSleep ,
    486 // pstrUsageSleepAfter ,
    487 // pstrUsageSleepMode ,
    488 // pstrUsageIllumination ,
    489 // pstrUsageFunctionButtons
    490 //
    491 //};
    492 //const char *consTitles3[] PROGMEM =
    493 //{
    494 // pstrUsageMenu ,
    495 // pstrUsageMenuPick ,
    496 // pstrUsageMenuUp ,
    497 // pstrUsageMenuDown ,
    498 // pstrUsageMenuLeft ,
    499 // pstrUsageMenuRight ,
    500 // pstrUsageMenuEscape ,
    501 // pstrUsageMenuValueIncrease,
    502 // pstrUsageMenuValueDecrease
    503 //};
    504 //const char *consTitles4[] PROGMEM =
    505 //{
    506 // pstrUsageDataOnScreen ,
    507 // pstrUsageClosedCaption ,
    508 // pstrUsageClosedCaptionSelect,
    509 // pstrUsageVCRTV ,
    510 // pstrUsageBroadcastMode ,
    511 // pstrUsageSnapshot ,
    512 // pstrUsageStill
    513 //};
    514 //const char *consTitles5[] PROGMEM =
    515 //{
    516 // pstrUsageSelection ,
    517 // pstrUsageAssignSelection ,
    518 // pstrUsageModeStep ,
    519 // pstrUsageRecallLast ,
    520 // pstrUsageEnterChannel ,
    521 // pstrUsageOrderMovie ,
    522 // pstrUsageChannel ,
    523 // pstrUsageMediaSelection ,
    524 // pstrUsageMediaSelectComputer ,
    525 // pstrUsageMediaSelectTV ,
    526 // pstrUsageMediaSelectWWW ,
    527 // pstrUsageMediaSelectDVD ,
    528 // pstrUsageMediaSelectTelephone ,
    529 // pstrUsageMediaSelectProgramGuide ,
    530 // pstrUsageMediaSelectVideoPhone ,
    531 // pstrUsageMediaSelectGames ,
    532 // pstrUsageMediaSelectMessages ,
    533 // pstrUsageMediaSelectCD ,
    534 // pstrUsageMediaSelectVCR ,
    535 // pstrUsageMediaSelectTuner ,
    536 // pstrUsageQuit ,
    537 // pstrUsageHelp ,
    538 // pstrUsageMediaSelectTape ,
    539 // pstrUsageMediaSelectCable ,
    540 // pstrUsageMediaSelectSatellite ,
    541 // pstrUsageMediaSelectSecurity ,
    542 // pstrUsageMediaSelectHome ,
    543 // pstrUsageMediaSelectCall ,
    544 // pstrUsageChannelIncrement ,
    545 // pstrUsageChannelDecrement ,
    546 // pstrUsageMediaSelectSAP ,
    547 // pstrUsagePageReserved ,
    548 // pstrUsageVCRPlus ,
    549 // pstrUsageOnce ,
    550 // pstrUsageDaily ,
    551 // pstrUsageWeekly ,
    552 // pstrUsageMonthly
    553 //};
    554 //const char *consTitles6[] PROGMEM =
    555 //{
    556 // pstrUsagePlay ,
    557 // pstrUsagePause ,
    558 // pstrUsageRecord ,
    559 // pstrUsageFastForward ,
    560 // pstrUsageRewind ,
    561 // pstrUsageScanNextTrack ,
    562 // pstrUsageScanPreviousTrack ,
    563 // pstrUsageStop ,
    564 // pstrUsageEject ,
    565 // pstrUsageRandomPlay ,
    566 // pstrUsageSelectDisk ,
    567 // pstrUsageEnterDisk ,
    568 // pstrUsageRepeat ,
    569 // pstrUsageTracking ,
    570 // pstrUsageTrackNormal ,
    571 // pstrUsageSlowTracking ,
    572 // pstrUsageFrameForward ,
    573 // pstrUsageFrameBackwards ,
    574 // pstrUsageMark ,
    575 // pstrUsageClearMark ,
    576 // pstrUsageRepeatFromMark ,
    577 // pstrUsageReturnToMark ,
    578 // pstrUsageSearchMarkForward ,
    579 // pstrUsageSearchMarkBackwards ,
    580 // pstrUsageCounterReset ,
    581 // pstrUsageShowCounter ,
    582 // pstrUsageTrackingIncrement ,
    583 // pstrUsageTrackingDecrement ,
    584 // pstrUsageStopEject ,
    585 // pstrUsagePlayPause ,
    586 // pstrUsagePlaySkip
    587 //};
    588 //const char *consTitles7[] PROGMEM =
    589 //{
    590 // pstrUsageVolume ,
    591 // pstrUsageBalance ,
    592 // pstrUsageMute ,
    593 // pstrUsageBass ,
    594 // pstrUsageTreble ,
    595 // pstrUsageBassBoost ,
    596 // pstrUsageSurroundMode ,
    597 // pstrUsageLoudness ,
    598 // pstrUsageMPX ,
    599 // pstrUsageVolumeIncrement ,
    600 // pstrUsageVolumeDecrement
    601 //};
    602 //const char *consTitles8[] PROGMEM =
    603 //{
    604 // pstrUsageSpeedSelect ,
    605 // pstrUsagePlaybackSpeed ,
    606 // pstrUsageStandardPlay ,
    607 // pstrUsageLongPlay ,
    608 // pstrUsageExtendedPlay ,
    609 // pstrUsageSlow
    610 //};
    611 //const char *consTitles9[] PROGMEM =
    612 //{
    613 // pstrUsageFanEnable ,
    614 // pstrUsageFanSpeed ,
    615 // pstrUsageLightEnable ,
    616 // pstrUsageLightIlluminationLevel ,
    617 // pstrUsageClimateControlEnable ,
    618 // pstrUsageRoomTemperature ,
    619 // pstrUsageSecurityEnable ,
    620 // pstrUsageFireAlarm ,
    621 // pstrUsagePoliceAlarm ,
    622 // pstrUsageProximity ,
    623 // pstrUsageMotion ,
    624 // pstrUsageDuresAlarm ,
    625 // pstrUsageHoldupAlarm ,
    626 // pstrUsageMedicalAlarm
    627 //};
    628 //const char *consTitlesA[] PROGMEM =
    629 //{
    630 // pstrUsageBalanceRight ,
    631 // pstrUsageBalanceLeft ,
    632 // pstrUsageBassIncrement ,
    633 // pstrUsageBassDecrement ,
    634 // pstrUsageTrebleIncrement ,
    635 // pstrUsageTrebleDecrement
    636 //};
    637 //const char *consTitlesB[] PROGMEM =
    638 //{
    639 // pstrUsageSpeakerSystem ,
    640 // pstrUsageChannelLeft ,
    641 // pstrUsageChannelRight ,
    642 // pstrUsageChannelCenter ,
    643 // pstrUsageChannelFront ,
    644 // pstrUsageChannelCenterFront ,
    645 // pstrUsageChannelSide ,
    646 // pstrUsageChannelSurround ,
    647 // pstrUsageChannelLowFreqEnhancement ,
    648 // pstrUsageChannelTop ,
    649 // pstrUsageChannelUnknown
    650 //};
    651 //const char *consTitlesC[] PROGMEM =
    652 //{
    653 // pstrUsageSubChannel ,
    654 // pstrUsageSubChannelIncrement ,
    655 // pstrUsageSubChannelDecrement ,
    656 // pstrUsageAlternateAudioIncrement ,
    657 // pstrUsageAlternateAudioDecrement
    658 //};
    659 //const char *consTitlesD[] PROGMEM =
    660 //{
    661 // pstrUsageApplicationLaunchButtons ,
    662 // pstrUsageALLaunchButtonConfigTool ,
    663 // pstrUsageALProgrammableButton ,
    664 // pstrUsageALConsumerControlConfig ,
    665 // pstrUsageALWordProcessor ,
    666 // pstrUsageALTextEditor ,
    667 // pstrUsageALSpreadsheet ,
    668 // pstrUsageALGraphicsEditor ,
    669 // pstrUsageALPresentationApp ,
    670 // pstrUsageALDatabaseApp ,
    671 // pstrUsageALEmailReader ,
    672 // pstrUsageALNewsreader ,
    673 // pstrUsageALVoicemail ,
    674 // pstrUsageALContactsAddressBook ,
    675 // pstrUsageALCalendarSchedule ,
    676 // pstrUsageALTaskProjectManager ,
    677 // pstrUsageALLogJournalTimecard ,
    678 // pstrUsageALCheckbookFinance ,
    679 // pstrUsageALCalculator ,
    680 // pstrUsageALAVCapturePlayback ,
    681 // pstrUsageALLocalMachineBrowser ,
    682 // pstrUsageALLANWANBrow ,
    683 // pstrUsageALInternetBrowser ,
    684 // pstrUsageALRemoteNetISPConnect ,
    685 // pstrUsageALNetworkConference ,
    686 // pstrUsageALNetworkChat ,
    687 // pstrUsageALTelephonyDialer ,
    688 // pstrUsageALLogon ,
    689 // pstrUsageALLogoff ,
    690 // pstrUsageALLogonLogoff ,
    691 // pstrUsageALTermLockScrSav ,
    692 // pstrUsageALControlPannel ,
    693 // pstrUsageALCommandLineProcessorRun ,
    694 // pstrUsageALProcessTaskManager ,
    695 // pstrUsageALSelectTaskApplication ,
    696 // pstrUsageALNextTaskApplication ,
    697 // pstrUsageALPreviousTaskApplication ,
    698 // pstrUsageALPreemptiveHaltTaskApp ,
    699 // pstrUsageALIntegratedHelpCenter ,
    700 // pstrUsageALDocuments ,
    701 // pstrUsageALThesaurus ,
    702 // pstrUsageALDictionary ,
    703 // pstrUsageALDesktop ,
    704 // pstrUsageALSpellCheck ,
    705 // pstrUsageALGrammarCheck ,
    706 // pstrUsageALWirelessStatus ,
    707 // pstrUsageALKeyboardLayout ,
    708 // pstrUsageALVirusProtection ,
    709 // pstrUsageALEncryption ,
    710 // pstrUsageALScreenSaver ,
    711 // pstrUsageALAlarms ,
    712 // pstrUsageALClock ,
    713 // pstrUsageALFileBrowser ,
    714 // pstrUsageALPowerStatus ,
    715 // pstrUsageALImageBrowser ,
    716 // pstrUsageALAudioBrowser ,
    717 // pstrUsageALMovieBrowser ,
    718 // pstrUsageALDigitalRightsManager ,
    719 // pstrUsageALDigitalWallet ,
    720 // pstrUsagePageReserved ,
    721 // pstrUsageALInstantMessaging ,
    722 // pstrUsageALOEMFeaturesBrowser ,
    723 // pstrUsageALOEMHelp ,
    724 // pstrUsageALOnlineCommunity ,
    725 // pstrUsageALEntertainmentContentBrow ,
    726 // pstrUsageALOnlineShoppingBrowser ,
    727 // pstrUsageALSmartCardInfoHelp ,
    728 // pstrUsageALMarketMonitorFinBrowser ,
    729 // pstrUsageALCustomCorpNewsBrowser ,
    730 // pstrUsageALOnlineActivityBrowser ,
    731 // pstrUsageALResearchSearchBrowser ,
    732 // pstrUsageALAudioPlayer
    733 //};
    734 //const char *consTitlesE[] PROGMEM =
    735 //{
    736 // pstrUsageGenericGUIAppControls ,
    737 // pstrUsageACNew ,
    738 // pstrUsageACOpen ,
    739 // pstrUsageACClose ,
    740 // pstrUsageACExit ,
    741 // pstrUsageACMaximize ,
    742 // pstrUsageACMinimize ,
    743 // pstrUsageACSave ,
    744 // pstrUsageACPrint ,
    745 // pstrUsageACProperties ,
    746 // pstrUsageACUndo ,
    747 // pstrUsageACCopy ,
    748 // pstrUsageACCut ,
    749 // pstrUsageACPaste ,
    750 // pstrUsageACSelectAll ,
    751 // pstrUsageACFind ,
    752 // pstrUsageACFindAndReplace ,
    753 // pstrUsageACSearch ,
    754 // pstrUsageACGoto ,
    755 // pstrUsageACHome ,
    756 // pstrUsageACBack ,
    757 // pstrUsageACForward ,
    758 // pstrUsageACStop ,
    759 // pstrUsageACRefresh ,
    760 // pstrUsageACPreviousLink ,
    761 // pstrUsageACNextLink ,
    762 // pstrUsageACBookmarks ,
    763 // pstrUsageACHistory ,
    764 // pstrUsageACSubscriptions ,
    765 // pstrUsageACZoomIn ,
    766 // pstrUsageACZoomOut ,
    767 // pstrUsageACZoom ,
    768 // pstrUsageACFullScreenView ,
    769 // pstrUsageACNormalView ,
    770 // pstrUsageACViewToggle ,
    771 // pstrUsageACScrollUp ,
    772 // pstrUsageACScrollDown ,
    773 // pstrUsageACScroll ,
    774 // pstrUsageACPanLeft ,
    775 // pstrUsageACPanRight ,
    776 // pstrUsageACPan ,
    777 // pstrUsageACNewWindow ,
    778 // pstrUsageACTileHoriz ,
    779 // pstrUsageACTileVert ,
    780 // pstrUsageACFormat ,
    781 // pstrUsageACEdit ,
    782 // pstrUsageACBold ,
    783 // pstrUsageACItalics ,
    784 // pstrUsageACUnderline ,
    785 // pstrUsageACStrikethrough ,
    786 // pstrUsageACSubscript ,
    787 // pstrUsageACSuperscript ,
    788 // pstrUsageACAllCaps ,
    789 // pstrUsageACRotate ,
    790 // pstrUsageACResize ,
    791 // pstrUsageACFlipHorizontal ,
    792 // pstrUsageACFlipVertical ,
    793 // pstrUsageACMirrorHorizontal ,
    794 // pstrUsageACMirrorVertical ,
    795 // pstrUsageACFontSelect ,
    796 // pstrUsageACFontColor ,
    797 // pstrUsageACFontSize ,
    798 // pstrUsageACJustifyLeft ,
    799 // pstrUsageACJustifyCenterH ,
    800 // pstrUsageACJustifyRight ,
    801 // pstrUsageACJustifyBlockH ,
    802 // pstrUsageACJustifyTop ,
    803 // pstrUsageACJustifyCenterV ,
    804 // pstrUsageACJustifyBottom ,
    805 // pstrUsageACJustifyBlockV ,
    806 // pstrUsageACIndentDecrease ,
    807 // pstrUsageACIndentIncrease ,
    808 // pstrUsageACNumberedList ,
    809 // pstrUsageACRestartNumbering ,
    810 // pstrUsageACBulletedList ,
    811 // pstrUsageACPromote ,
    812 // pstrUsageACDemote ,
    813 // pstrUsageACYes ,
    814 // pstrUsageACNo ,
    815 // pstrUsageACCancel ,
    816 // pstrUsageACCatalog ,
    817 // pstrUsageACBuyChkout ,
    818 // pstrUsageACAddToCart ,
    819 // pstrUsageACExpand ,
    820 // pstrUsageACExpandAll ,
    821 // pstrUsageACCollapse ,
    822 // pstrUsageACCollapseAll ,
    823 // pstrUsageACPrintPreview ,
    824 // pstrUsageACPasteSpecial ,
    825 // pstrUsageACInsertMode ,
    826 // pstrUsageACDelete ,
    827 // pstrUsageACLock ,
    828 // pstrUsageACUnlock ,
    829 // pstrUsageACProtect ,
    830 // pstrUsageACUnprotect ,
    831 // pstrUsageACAttachComment ,
    832 // pstrUsageACDeleteComment ,
    833 // pstrUsageACViewComment ,
    834 // pstrUsageACSelectWord ,
    835 // pstrUsageACSelectSentence ,
    836 // pstrUsageACSelectParagraph ,
    837 // pstrUsageACSelectColumn ,
    838 // pstrUsageACSelectRow ,
    839 // pstrUsageACSelectTable ,
    840 // pstrUsageACSelectObject ,
    841 // pstrUsageACRedoRepeat ,
    842 // pstrUsageACSort ,
    843 // pstrUsageACSortAscending ,
    844 // pstrUsageACSortDescending ,
    845 // pstrUsageACFilter ,
    846 // pstrUsageACSetClock ,
    847 // pstrUsageACViewClock ,
    848 // pstrUsageACSelectTimeZone ,
    849 // pstrUsageACEditTimeZone ,
    850 // pstrUsageACSetAlarm ,
    851 // pstrUsageACClearAlarm ,
    852 // pstrUsageACSnoozeAlarm ,
    853 // pstrUsageACResetAlarm ,
    854 // pstrUsageACSyncronize ,
    855 // pstrUsageACSendReceive ,
    856 // pstrUsageACSendTo ,
    857 // pstrUsageACReply ,
    858 // pstrUsageACReplyAll ,
    859 // pstrUsageACForwardMessage ,
    860 // pstrUsageACSend ,
    861 // pstrUsageACAttachFile ,
    862 // pstrUsageACUpload ,
    863 // pstrUsageACDownload ,
    864 // pstrUsageACSetBorders ,
    865 // pstrUsageACInsertRow ,
    866 // pstrUsageACInsertColumn ,
    867 // pstrUsageACInsertFile ,
    868 // pstrUsageACInsertPicture ,
    869 // pstrUsageACInsertObject ,
    870 // pstrUsageACInsertSymbol ,
    871 // pstrUsageACSaveAndClose ,
    872 // pstrUsageACRename ,
    873 // pstrUsageACMerge ,
    874 // pstrUsageACSplit ,
    875 // pstrUsageACDistributeHorizontaly ,
    876 // pstrUsageACDistributeVerticaly
    877 //};
    878 //const char *digitTitles0[] PROGMEM =
    879 //{
    880 // pstrUsageDigitizer ,
    881 // pstrUsagePen ,
    882 // pstrUsageLightPen ,
    883 // pstrUsageTouchScreen ,
    884 // pstrUsageTouchPad ,
    885 // pstrUsageWhiteBoard ,
    886 // pstrUsageCoordinateMeasuringMachine ,
    887 // pstrUsage3DDigitizer ,
    888 // pstrUsageStereoPlotter ,
    889 // pstrUsageArticulatedArm ,
    890 // pstrUsageArmature ,
    891 // pstrUsageMultiplePointDigitizer ,
    892 // pstrUsageFreeSpaceWand
    893 //};
    894 //const char *digitTitles1[] PROGMEM =
    895 //{
    896 // pstrUsageStylus ,
    897 // pstrUsagePuck ,
    898 // pstrUsageFinger
    899 //
    900 //};
    901 //const char *digitTitles2[] PROGMEM =
    902 //{
    903 // pstrUsageTipPressure ,
    904 // pstrUsageBarrelPressure ,
    905 // pstrUsageInRange ,
    906 // pstrUsageTouch ,
    907 // pstrUsageUntouch ,
    908 // pstrUsageTap ,
    909 // pstrUsageQuality ,
    910 // pstrUsageDataValid ,
    911 // pstrUsageTransducerIndex ,
    912 // pstrUsageTabletFunctionKeys ,
    913 // pstrUsageProgramChangeKeys ,
    914 // pstrUsageBatteryStrength ,
    915 // pstrUsageInvert ,
    916 // pstrUsageXTilt ,
    917 // pstrUsageYTilt ,
    918 // pstrUsageAzimuth ,
    919 // pstrUsageAltitude ,
    920 // pstrUsageTwist ,
    921 // pstrUsageTipSwitch ,
    922 // pstrUsageSecondaryTipSwitch ,
    923 // pstrUsageBarrelSwitch ,
    924 // pstrUsageEraser ,
    925 // pstrUsageTabletPick
    926 //};
    927 //const char *aplphanumTitles0[] PROGMEM =
    928 //{
    929 // pstrUsageAlphanumericDisplay,
    930 // pstrUsageBitmappedDisplay
    931 //};
    932 //const char *aplphanumTitles1[] PROGMEM =
    933 //{
    934 // pstrUsageDisplayAttributesReport ,
    935 // pstrUsageASCIICharacterSet ,
    936 // pstrUsageDataReadBack ,
    937 // pstrUsageFontReadBack ,
    938 // pstrUsageDisplayControlReport ,
    939 // pstrUsageClearDisplay ,
    940 // pstrUsageDisplayEnable ,
    941 // pstrUsageScreenSaverDelay ,
    942 // pstrUsageScreenSaverEnable ,
    943 // pstrUsageVerticalScroll ,
    944 // pstrUsageHorizontalScroll ,
    945 // pstrUsageCharacterReport ,
    946 // pstrUsageDisplayData ,
    947 // pstrUsageDisplayStatus ,
    948 // pstrUsageStatusNotReady ,
    949 // pstrUsageStatusReady ,
    950 // pstrUsageErrorNotALoadableCharacter ,
    951 // pstrUsageErrorFotDataCanNotBeRead ,
    952 // pstrUsageCursorPositionReport ,
    953 // pstrUsageRow ,
    954 // pstrUsageColumn ,
    955 // pstrUsageRows ,
    956 // pstrUsageColumns ,
    957 // pstrUsageCursorPixelPosition ,
    958 // pstrUsageCursorMode ,
    959 // pstrUsageCursorEnable ,
    960 // pstrUsageCursorBlink ,
    961 // pstrUsageFontReport ,
    962 // pstrUsageFontData ,
    963 // pstrUsageCharacterWidth ,
    964 // pstrUsageCharacterHeight ,
    965 // pstrUsageCharacterSpacingHorizontal ,
    966 // pstrUsageCharacterSpacingVertical ,
    967 // pstrUsageUnicodeCharset ,
    968 // pstrUsageFont7Segment ,
    969 // pstrUsage7SegmentDirectMap ,
    970 // pstrUsageFont14Segment ,
    971 // pstrUsage14SegmentDirectMap ,
    972 // pstrUsageDisplayBrightness ,
    973 // pstrUsageDisplayContrast ,
    974 // pstrUsageCharacterAttribute ,
    975 // pstrUsageAttributeReadback ,
    976 // pstrUsageAttributeData ,
    977 // pstrUsageCharAttributeEnhance ,
    978 // pstrUsageCharAttributeUnderline ,
    979 // pstrUsageCharAttributeBlink
    980 //};
    981 //const char *aplphanumTitles2[] PROGMEM =
    982 //{
    983 // pstrUsageBitmapSizeX ,
    984 // pstrUsageBitmapSizeY ,
    985 // pstrUsagePageReserved ,
    986 // pstrUsageBitDepthFormat ,
    987 // pstrUsageDisplayOrientation ,
    988 // pstrUsagePaletteReport ,
    989 // pstrUsagePaletteDataSize ,
    990 // pstrUsagePaletteDataOffset ,
    991 // pstrUsagePaletteData ,
    992 // pstrUsageBlitReport ,
    993 // pstrUsageBlitRectangleX1 ,
    994 // pstrUsageBlitRectangleY1 ,
    995 // pstrUsageBlitRectangleX2 ,
    996 // pstrUsageBlitRectangleY2 ,
    997 // pstrUsageBlitData ,
    998 // pstrUsageSoftButton ,
    999 // pstrUsageSoftButtonID ,
    1000 // pstrUsageSoftButtonSide ,
    1001 // pstrUsageSoftButtonOffset1 ,
    1002 // pstrUsageSoftButtonOffset2 ,
    1003 // pstrUsageSoftButtonReport
    1004 //};
    1005 //const char *medInstrTitles0[] PROGMEM =
    1006 //{
    1007 // pstrUsageVCRAcquisition ,
    1008 // pstrUsageFreezeThaw ,
    1009 // pstrUsageClipStore ,
    1010 // pstrUsageUpdate ,
    1011 // pstrUsageNext ,
    1012 // pstrUsageSave ,
    1013 // pstrUsagePrint ,
    1014 // pstrUsageMicrophoneEnable
    1015 //};
    1016 //const char *medInstrTitles1[] PROGMEM =
    1017 //{
    1018 // pstrUsageCine ,
    1019 // pstrUsageTransmitPower ,
    1020 // pstrUsageVolume ,
    1021 // pstrUsageFocus ,
    1022 // pstrUsageDepth
    1023 //};
    1024 //const char *medInstrTitles2[] PROGMEM =
    1025 //{
    1026 // pstrUsageSoftStepPrimary ,
    1027 // pstrUsageSoftStepSecondary
    1028 //};
    1029 //const char *medInstrTitles3[] PROGMEM =
    1030 //{
    1031 // pstrUsageZoomSelect ,
    1032 // pstrUsageZoomAdjust ,
    1033 // pstrUsageSpectralDopplerModeSelect ,
    1034 // pstrUsageSpectralDopplerModeAdjust ,
    1035 // pstrUsageColorDopplerModeSelect ,
    1036 // pstrUsageColorDopplerModeAdjust ,
    1037 // pstrUsageMotionModeSelect ,
    1038 // pstrUsageMotionModeAdjust ,
    1039 // pstrUsage2DModeSelect ,
    1040 // pstrUsage2DModeAdjust
    1041 //};
    1042 //const char *medInstrTitles4[] PROGMEM =
    1043 //{
    1044 // pstrUsageSoftControlSelect ,
    1045 // pstrUsageSoftControlAdjust
    1046 //};
    1047 
    1048 #endif // __HIDUSAGETITLEARRAYS_H__
    diff --git a/hierarchy.html b/hierarchy.html index 201dad93..646d4f6a 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Hierarchy + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -73,7 +74,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -91,115 +92,115 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    Go to the graphical class hierarchy

    This inheritance list is sorted roughly, but not completely, alphabetically:
    [detail level 1234]
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    oCACM_FUNC_DESCR
    oCAddressPool
    |oCAddressPoolImpl< MAX_DEVICES_ALLOWED >
    |\CAddressPoolImpl< USB_NUMDEVICES >
    oCBASE_CLASS
    |oCHexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >
    |\CSinkParser< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >
    oCBASICCDB
    oCBluetoothService
    |oCBTHID
    |oCPS3BT
    |oCSPP
    |\CWII
    oCByteSkipper
    oCCALL_MGMNT_FUNC_DESCR
    oCCapacity
    oCCDB10
    oCCDB12
    oCCDB6
    oCCDB_LBA32_16
    oCCDB_LBA64_16
    oCCDCAsyncOper
    oCCLASS_NOTIFICATION
    oCCommandBlockWrapperBase
    |\CCommandBlockWrapper
    oCCommandStatusWrapper
    oCEpInfo
    oCFTDIAsyncOper
    oCHID_CLASS_DESCRIPTOR_LEN_AND_TYPE
    oCHidItemPrefix
    oCHIDReportParser
    |oCKeyboardReportParser
    |oCMouseReportParser
    |\CUniversalReportParser
    oCHubDescriptor
    oCHubEvent
    oCInquiryResponse
    oCKBDINFO
    oCKBDLEDS
    oCLINE_CODING
    oCMainItemIOFeature
    oCMAX3421e< SPI_SS, INTR >
    |\CUSB
    oCMODIFIERKEYS
    oCMOUSEINFO
    oCMultiByteValueParser
    oCMultiValueBuffer
    oCPrint
    |\CMax_LCD
    oCPS4Buttons
    oCPS4Data
    oCPS4Output
    oCPS4Parser
    |oCPS4BT
    |\CPS4USB
    oCPS4Status
    oCPSBUZZButtons
    oCPTPListParser
    oCRequestSenseResponce
    oCSETUP_PKT
    oCSPi< SPI_CLK, SPI_MOSI, SPI_MISO, SPI_SS >
    oCStream
    |\CSPP
    oCTEL_RINGER_FUNC_DESCR
    oCtouchpadXY
    oCtty_features
    oCUHS2_GPIO
    oCUSB_CONFIGURATION_DESCRIPTOR
    oCUSB_DEVICE_DESCRIPTOR
    oCUSB_ENDPOINT_DESCRIPTOR
    oCUSB_HID_DESCRIPTOR
    oCUSB_INTERFACE_DESCRIPTOR
    oCUsbConfigXtracter
    |oCACM
    |oCADK
    |oCBTD
    |oCBulkOnly
    |oCFTDI
    |oCUSBHID
    |\CXBOXONE
    oCUsbDevice
    oCUsbDeviceAddress
    oCUSBDeviceConfig
    |oCACM
    |oCADK
    |oCBTD
    |oCBulkOnly
    |oCFTDI
    |oCPS3USB
    |oCUSBH_MIDI
    |oCUSBHID
    |oCUSBHub
    |oCXBOXOLD
    |oCXBOXONE
    |oCXBOXRECV
    |\CXBOXUSB
    \CUSBReadParser
     oCConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK >
     \CReportDescParserBase
     CACM_FUNC_DESCR
     CAddressPool
     CAddressPoolImpl< MAX_DEVICES_ALLOWED >
     CAddressPoolImpl< USB_NUMDEVICES >
     CBASE_CLASS
     CHexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >
     CSinkParser< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >
     CBASICCDB
     CBluetoothService
     CBTHID
     CPS3BT
     CSPP
     CWII
     CByteSkipper
     CCALL_MGMNT_FUNC_DESCR
     CCapacity
     CCDB10
     CCDB12
     CCDB6
     CCDB_LBA32_16
     CCDB_LBA64_16
     CCDCAsyncOper
     CCLASS_NOTIFICATION
     CCommandBlockWrapperBase
     CCommandBlockWrapper
     CCommandStatusWrapper
     CEpInfo
     CFTDIAsyncOper
     CHID_CLASS_DESCRIPTOR_LEN_AND_TYPE
     CHidItemPrefix
     CHIDReportParser
     CKeyboardReportParser
     CMouseReportParser
     CUniversalReportParser
     CHubDescriptor
     CHubEvent
     CInquiryResponse
     CKBDINFO
     CKBDLEDS
     CLINE_CODING
     CMainItemIOFeature
     CMAX3421e< SPI_SS, INTR >
     CUSB
     CMODIFIERKEYS
     CMOUSEINFO
     CMultiByteValueParser
     CMultiValueBuffer
     CPrint
     CMax_LCD
     CPS4Buttons
     CPS4Data
     CPS4Output
     CPS4Parser
     CPS4BT
     CPS4USB
     CPS4Status
     CPSBUZZButtons
     CPTPListParser
     CRequestSenseResponce
     CSETUP_PKT
     CSPi< SPI_CLK, SPI_MOSI, SPI_MISO, SPI_SS >
     CStream
     CSPP
     CTEL_RINGER_FUNC_DESCR
     CtouchpadXY
     Ctty_features
     CUHS2_GPIO
     CUSB_CONFIGURATION_DESCRIPTOR
     CUSB_DEVICE_DESCRIPTOR
     CUSB_ENDPOINT_DESCRIPTOR
     CUSB_HID_DESCRIPTOR
     CUSB_INTERFACE_DESCRIPTOR
     CUsbConfigXtracter
     CACM
     CADK
     CBTD
     CBulkOnly
     CFTDI
     CUSBHID
     CXBOXONE
     CUsbDevice
     CUsbDeviceAddress
     CUSBDeviceConfig
     CACM
     CADK
     CBTD
     CBulkOnly
     CFTDI
     CPS3USB
     CUSBH_MIDI
     CUSBHID
     CUSBHub
     CXBOXOLD
     CXBOXONE
     CXBOXRECV
     CXBOXUSB
     CUSBReadParser
     CConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK >
     CReportDescParserBase
    @@ -207,7 +208,7 @@ This inheritance list is sorted roughly, but not completely, alphabetically: diff --git a/index.html b/index.html index 140bcbbd..052dac6d 100644 --- a/index.html +++ b/index.html @@ -3,15 +3,16 @@ - -USB Host Shield 2.0: Main Page + +USB Host Shield 2.0: USB Host Library Rev.2.0 + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
    +
    USB Host Shield 2.0
    - + @@ -65,7 +66,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages +
    @@ -76,12 +77,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    -
    USB Host Shield 2.0 Documentation
    +
    USB Host Library Rev.2.0
    -

    The code is released under the GNU General Public License.

    -
    -

    ![Build Status](https://travis-ci.org/felis/USB_Host_Shield_2.0.svg?branch=master)

    +

    The code is released under the GNU General Public License.


    +

    Summary

    This is Revision 2.0 of MAX3421E-based USB Host Shield Library for AVR's.

    Project main web site is: http://www.circuitsathome.com.

    @@ -175,8 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    Documentation for the library can be found at the following link: https://felis.github.io/USB_Host_Shield_2.0/.

    Enable debugging

    By default serial debugging is disabled. To turn it on simply change ENABLE_UHS_DEBUGGING to 1 in settings.h like so:

    -

    ```C++ #define ENABLE_UHS_DEBUGGING 1 ```

    -

    Boards

    +
    1 {C++}
    2 #define ENABLE_UHS_DEBUGGING 1

    Boards

    Currently the following boards are supported by the library:

    • All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.)
    • @@ -313,11 +312,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

      Wii library

      The Wii 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.

      First you have to pair with the controller, this is done automatically by the library if you create the instance like so:

      -

      ```C++ WII Wii(&Btd, PAIR); ```

      -

      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.

      +
      1 {C++}
      2 WII Wii(&Btd, PAIR);

      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.

      After that you can simply create the instance like so:

      -

      ```C++ WII Wii(&Btd); ```

      -

      Then just press any button on the Wiimote and it will then connect to the dongle.

      +
      1 {C++}
      2 WII Wii(&Btd);

      Then just press any button on the Wiimote and it will then connect to the dongle.

      Take a look at the example for more information: Wii.ino.

      Also take a look at the blog post:

        @@ -357,31 +354,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

        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!

        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.

        After that you need modify the following entry in UsbCore.h:

        -

        ```C++ typedef MAX3421e<P10, P9> MAX3421E; ```

        -

        For instance if you have rerouted SS to pin 7 it should read:

        -

        ```C++ typedef MAX3421e<P7, P9> MAX3421E; ```

        -

        See the "Interface modifications" section in the hardware manual for more information.

        +
        1 {C++}
        2 typedef MAX3421e<P10, P9> MAX3421E;

        For instance if you have rerouted SS to pin 7 it should read:

        +
        1 {C++}
        2 typedef MAX3421e<P7, P9> MAX3421E;

        See the "Interface modifications" section in the hardware manual for more information.

        FAQ

        -

        When I plug my device into the USB connector nothing happens?

        -

        +

        When I plug my device into the USB connector nothing happens?

        • Try to connect a external power supply to the Arduino - this solves the problem in most cases.
        • 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);.
        -

        When I connecting my PS3 controller I get a output like this:

        -

        +

        When I connecting my PS3 controller I get a output like this:

        -

        ``` Dualshock 3 Controller Enabled

        -

        LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0 ```

        -
          +
          1 Dualshock 3 Controller Enabled
          2 
          3 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
          4 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
          5 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
          6 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
          7 LeftHatX: 0 LeftHatY: 0 RightHatX: 0 RightHatY: 0
          • This means that your dongle does not support 2.0+EDR, so you will need another dongle. Please see the following list for tested working dongles.
          -

          When compiling I am getting the following error: "fatal error: SPI.h: No such file or directory".

          -

          +

          When compiling I am getting the following error: "fatal error: SPI.h: No such file or directory".

          • Please make sure to include the SPI library like so: #include <SPI.h> in your .ino file.
          • @@ -391,7 +381,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/inherit_graph_0.map b/inherit_graph_0.map index daf7b9d5..6ffd86b2 100644 --- a/inherit_graph_0.map +++ b/inherit_graph_0.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_0.png b/inherit_graph_0.png index 66f22f3a..9342406d 100644 Binary files a/inherit_graph_0.png and b/inherit_graph_0.png differ diff --git a/inherit_graph_1.map b/inherit_graph_1.map index a4df4e15..c98bdc5d 100644 --- a/inherit_graph_1.map +++ b/inherit_graph_1.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/inherit_graph_1.png b/inherit_graph_1.png index 8c01b68e..de1f348b 100644 Binary files a/inherit_graph_1.png and b/inherit_graph_1.png differ diff --git a/inherit_graph_10.map b/inherit_graph_10.map index bb68b067..d0a7cecd 100644 --- a/inherit_graph_10.map +++ b/inherit_graph_10.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_10.png b/inherit_graph_10.png index 75db89b7..e99ec9e0 100644 Binary files a/inherit_graph_10.png and b/inherit_graph_10.png differ diff --git a/inherit_graph_11.map b/inherit_graph_11.map index 7a781615..18022101 100644 --- a/inherit_graph_11.map +++ b/inherit_graph_11.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_11.png b/inherit_graph_11.png index 35cb4506..1c1af84e 100644 Binary files a/inherit_graph_11.png and b/inherit_graph_11.png differ diff --git a/inherit_graph_12.map b/inherit_graph_12.map index ea4e3d89..ddb1cecb 100644 --- a/inherit_graph_12.map +++ b/inherit_graph_12.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_12.png b/inherit_graph_12.png index d152e43d..ad9652c1 100644 Binary files a/inherit_graph_12.png and b/inherit_graph_12.png differ diff --git a/inherit_graph_13.map b/inherit_graph_13.map index 6e6a4998..f1a5a480 100644 --- a/inherit_graph_13.map +++ b/inherit_graph_13.map @@ -1,4 +1,4 @@ - - + + diff --git a/inherit_graph_13.png b/inherit_graph_13.png index b0292e37..68f24fbd 100644 Binary files a/inherit_graph_13.png and b/inherit_graph_13.png differ diff --git a/inherit_graph_14.map b/inherit_graph_14.map index 017f7e62..61557dd3 100644 --- a/inherit_graph_14.map +++ b/inherit_graph_14.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_14.png b/inherit_graph_14.png index 87ecaf8f..4fc26864 100644 Binary files a/inherit_graph_14.png and b/inherit_graph_14.png differ diff --git a/inherit_graph_15.map b/inherit_graph_15.map index 693a8a30..a2a2c0f5 100644 --- a/inherit_graph_15.map +++ b/inherit_graph_15.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_15.png b/inherit_graph_15.png index 4e5173a4..3dd952fc 100644 Binary files a/inherit_graph_15.png and b/inherit_graph_15.png differ diff --git a/inherit_graph_16.map b/inherit_graph_16.map index 3de9c461..8eb0dcd3 100644 --- a/inherit_graph_16.map +++ b/inherit_graph_16.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_16.png b/inherit_graph_16.png index 89261855..18e15744 100644 Binary files a/inherit_graph_16.png and b/inherit_graph_16.png differ diff --git a/inherit_graph_17.map b/inherit_graph_17.map index 874914f9..09b7d183 100644 --- a/inherit_graph_17.map +++ b/inherit_graph_17.map @@ -1,4 +1,4 @@ - - + + diff --git a/inherit_graph_17.png b/inherit_graph_17.png index e285e328..149c9f7f 100644 Binary files a/inherit_graph_17.png and b/inherit_graph_17.png differ diff --git a/inherit_graph_18.map b/inherit_graph_18.map index 352d5c9e..4ad9234c 100644 --- a/inherit_graph_18.map +++ b/inherit_graph_18.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_18.png b/inherit_graph_18.png index 3e17ea74..1447e42e 100644 Binary files a/inherit_graph_18.png and b/inherit_graph_18.png differ diff --git a/inherit_graph_19.map b/inherit_graph_19.map index 3455dfe9..ef9d16b3 100644 --- a/inherit_graph_19.map +++ b/inherit_graph_19.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_19.png b/inherit_graph_19.png index 497ad62a..90dee24c 100644 Binary files a/inherit_graph_19.png and b/inherit_graph_19.png differ diff --git a/inherit_graph_2.map b/inherit_graph_2.map index 5ff9425b..0850ca72 100644 --- a/inherit_graph_2.map +++ b/inherit_graph_2.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_2.png b/inherit_graph_2.png index acba6d79..9bbbb8a3 100644 Binary files a/inherit_graph_2.png and b/inherit_graph_2.png differ diff --git a/inherit_graph_20.map b/inherit_graph_20.map index 756e671f..34561d94 100644 --- a/inherit_graph_20.map +++ b/inherit_graph_20.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/inherit_graph_20.png b/inherit_graph_20.png index 2759860f..4ff7ff1e 100644 Binary files a/inherit_graph_20.png and b/inherit_graph_20.png differ diff --git a/inherit_graph_21.map b/inherit_graph_21.map index 28c66850..9ee5efb9 100644 --- a/inherit_graph_21.map +++ b/inherit_graph_21.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_21.png b/inherit_graph_21.png index 6da8ccb6..f42ba746 100644 Binary files a/inherit_graph_21.png and b/inherit_graph_21.png differ diff --git a/inherit_graph_22.map b/inherit_graph_22.map index 1e73abad..4269efb9 100644 --- a/inherit_graph_22.map +++ b/inherit_graph_22.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_22.png b/inherit_graph_22.png index 247867f0..54b0a0b5 100644 Binary files a/inherit_graph_22.png and b/inherit_graph_22.png differ diff --git a/inherit_graph_23.map b/inherit_graph_23.map index 0d97d2cc..104352c1 100644 --- a/inherit_graph_23.map +++ b/inherit_graph_23.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_23.png b/inherit_graph_23.png index 073aaf1a..6888cd40 100644 Binary files a/inherit_graph_23.png and b/inherit_graph_23.png differ diff --git a/inherit_graph_24.map b/inherit_graph_24.map index 6c18c9be..49704a3e 100644 --- a/inherit_graph_24.map +++ b/inherit_graph_24.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_24.png b/inherit_graph_24.png index 52e9ac56..9f46752f 100644 Binary files a/inherit_graph_24.png and b/inherit_graph_24.png differ diff --git a/inherit_graph_25.map b/inherit_graph_25.map index f8919481..212162d4 100644 --- a/inherit_graph_25.map +++ b/inherit_graph_25.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_25.png b/inherit_graph_25.png index 287bcb6b..61988f56 100644 Binary files a/inherit_graph_25.png and b/inherit_graph_25.png differ diff --git a/inherit_graph_26.map b/inherit_graph_26.map index 61e53bb5..20e6b032 100644 --- a/inherit_graph_26.map +++ b/inherit_graph_26.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_26.png b/inherit_graph_26.png index 7aad54c9..959eef66 100644 Binary files a/inherit_graph_26.png and b/inherit_graph_26.png differ diff --git a/inherit_graph_27.map b/inherit_graph_27.map index 99d2bed6..4392f2f2 100644 --- a/inherit_graph_27.map +++ b/inherit_graph_27.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_27.png b/inherit_graph_27.png index 57c43bf0..b7d1f280 100644 Binary files a/inherit_graph_27.png and b/inherit_graph_27.png differ diff --git a/inherit_graph_28.map b/inherit_graph_28.map index 9bd461fa..15e536de 100644 --- a/inherit_graph_28.map +++ b/inherit_graph_28.map @@ -1,4 +1,4 @@ - - + + diff --git a/inherit_graph_28.png b/inherit_graph_28.png index f6463ec5..88ce146d 100644 Binary files a/inherit_graph_28.png and b/inherit_graph_28.png differ diff --git a/inherit_graph_29.map b/inherit_graph_29.map index ca8636a5..564b2d10 100644 --- a/inherit_graph_29.map +++ b/inherit_graph_29.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_29.png b/inherit_graph_29.png index 3edb127d..9d2d3372 100644 Binary files a/inherit_graph_29.png and b/inherit_graph_29.png differ diff --git a/inherit_graph_3.map b/inherit_graph_3.map index 1adb4990..58bbc248 100644 --- a/inherit_graph_3.map +++ b/inherit_graph_3.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_3.png b/inherit_graph_3.png index ab22287c..c6f059ee 100644 Binary files a/inherit_graph_3.png and b/inherit_graph_3.png differ diff --git a/inherit_graph_30.map b/inherit_graph_30.map index 2999d64d..d7b57793 100644 --- a/inherit_graph_30.map +++ b/inherit_graph_30.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_30.png b/inherit_graph_30.png index b7c24872..adb885d6 100644 Binary files a/inherit_graph_30.png and b/inherit_graph_30.png differ diff --git a/inherit_graph_31.map b/inherit_graph_31.map index a3f9f326..bad5ccf1 100644 --- a/inherit_graph_31.map +++ b/inherit_graph_31.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_31.png b/inherit_graph_31.png index 839f7bf3..35c06983 100644 Binary files a/inherit_graph_31.png and b/inherit_graph_31.png differ diff --git a/inherit_graph_32.map b/inherit_graph_32.map index 8cff5956..e27d0c42 100644 --- a/inherit_graph_32.map +++ b/inherit_graph_32.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_32.png b/inherit_graph_32.png index e9808722..012c3534 100644 Binary files a/inherit_graph_32.png and b/inherit_graph_32.png differ diff --git a/inherit_graph_33.map b/inherit_graph_33.map index 990d939f..5a94172a 100644 --- a/inherit_graph_33.map +++ b/inherit_graph_33.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_33.png b/inherit_graph_33.png index fcef7131..540675ad 100644 Binary files a/inherit_graph_33.png and b/inherit_graph_33.png differ diff --git a/inherit_graph_34.map b/inherit_graph_34.map index 4be7087f..e7659185 100644 --- a/inherit_graph_34.map +++ b/inherit_graph_34.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_34.png b/inherit_graph_34.png index 7569d125..a448422e 100644 Binary files a/inherit_graph_34.png and b/inherit_graph_34.png differ diff --git a/inherit_graph_35.map b/inherit_graph_35.map index f7fb5267..cfb3057b 100644 --- a/inherit_graph_35.map +++ b/inherit_graph_35.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_35.png b/inherit_graph_35.png index edeb23ca..71eb256c 100644 Binary files a/inherit_graph_35.png and b/inherit_graph_35.png differ diff --git a/inherit_graph_36.map b/inherit_graph_36.map index 52b78824..2ff4bcd4 100644 --- a/inherit_graph_36.map +++ b/inherit_graph_36.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_36.png b/inherit_graph_36.png index 152b4193..7d549be3 100644 Binary files a/inherit_graph_36.png and b/inherit_graph_36.png differ diff --git a/inherit_graph_37.map b/inherit_graph_37.map index 8caf8ba6..957b5054 100644 --- a/inherit_graph_37.map +++ b/inherit_graph_37.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_37.png b/inherit_graph_37.png index 8a0d55bf..88311685 100644 Binary files a/inherit_graph_37.png and b/inherit_graph_37.png differ diff --git a/inherit_graph_38.map b/inherit_graph_38.map index f0a99600..249b9a93 100644 --- a/inherit_graph_38.map +++ b/inherit_graph_38.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_38.png b/inherit_graph_38.png index c056ffe2..6c98556f 100644 Binary files a/inherit_graph_38.png and b/inherit_graph_38.png differ diff --git a/inherit_graph_39.png b/inherit_graph_39.png index 81034c33..61f90436 100644 Binary files a/inherit_graph_39.png and b/inherit_graph_39.png differ diff --git a/inherit_graph_4.map b/inherit_graph_4.map index 8b74270a..3009f4dd 100644 --- a/inherit_graph_4.map +++ b/inherit_graph_4.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_4.png b/inherit_graph_4.png index 0eb02f59..a2d9f739 100644 Binary files a/inherit_graph_4.png and b/inherit_graph_4.png differ diff --git a/inherit_graph_40.map b/inherit_graph_40.map index e7b1b906..570c0bd0 100644 --- a/inherit_graph_40.map +++ b/inherit_graph_40.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_40.png b/inherit_graph_40.png index 40717754..3593ab74 100644 Binary files a/inherit_graph_40.png and b/inherit_graph_40.png differ diff --git a/inherit_graph_41.map b/inherit_graph_41.map index a133b685..9f170229 100644 --- a/inherit_graph_41.map +++ b/inherit_graph_41.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_41.png b/inherit_graph_41.png index 61f14ad0..d336339a 100644 Binary files a/inherit_graph_41.png and b/inherit_graph_41.png differ diff --git a/inherit_graph_42.map b/inherit_graph_42.map index 6b586994..0829f7be 100644 --- a/inherit_graph_42.map +++ b/inherit_graph_42.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_42.png b/inherit_graph_42.png index 71ca585d..77f020a3 100644 Binary files a/inherit_graph_42.png and b/inherit_graph_42.png differ diff --git a/inherit_graph_43.map b/inherit_graph_43.map index 4731a3b5..5afe7bec 100644 --- a/inherit_graph_43.map +++ b/inherit_graph_43.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_43.png b/inherit_graph_43.png index d7d4e99d..c5cc6203 100644 Binary files a/inherit_graph_43.png and b/inherit_graph_43.png differ diff --git a/inherit_graph_44.map b/inherit_graph_44.map index 92fd90d0..95ae6d26 100644 --- a/inherit_graph_44.map +++ b/inherit_graph_44.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_44.png b/inherit_graph_44.png index 4039083b..d55f4f4c 100644 Binary files a/inherit_graph_44.png and b/inherit_graph_44.png differ diff --git a/inherit_graph_45.map b/inherit_graph_45.map index fdd37523..783bc8ec 100644 --- a/inherit_graph_45.map +++ b/inherit_graph_45.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_45.png b/inherit_graph_45.png index fdd839a8..ed7a02cb 100644 Binary files a/inherit_graph_45.png and b/inherit_graph_45.png differ diff --git a/inherit_graph_46.map b/inherit_graph_46.map index 1aa2a4ba..dc09fe38 100644 --- a/inherit_graph_46.map +++ b/inherit_graph_46.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_46.png b/inherit_graph_46.png index 4f386ec4..73149860 100644 Binary files a/inherit_graph_46.png and b/inherit_graph_46.png differ diff --git a/inherit_graph_47.map b/inherit_graph_47.map index fff0b32e..a4fd8469 100644 --- a/inherit_graph_47.map +++ b/inherit_graph_47.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_47.png b/inherit_graph_47.png index fe03149e..5c085f50 100644 Binary files a/inherit_graph_47.png and b/inherit_graph_47.png differ diff --git a/inherit_graph_48.map b/inherit_graph_48.map index 97c6512e..f93eb75f 100644 --- a/inherit_graph_48.map +++ b/inherit_graph_48.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_48.png b/inherit_graph_48.png index 33bfb16d..274b244c 100644 Binary files a/inherit_graph_48.png and b/inherit_graph_48.png differ diff --git a/inherit_graph_49.map b/inherit_graph_49.map index b6d9f21e..4bd3ca66 100644 --- a/inherit_graph_49.map +++ b/inherit_graph_49.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_49.png b/inherit_graph_49.png index 3d406cd4..f75296de 100644 Binary files a/inherit_graph_49.png and b/inherit_graph_49.png differ diff --git a/inherit_graph_5.map b/inherit_graph_5.map index fbb8e988..ae27b27a 100644 --- a/inherit_graph_5.map +++ b/inherit_graph_5.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_5.png b/inherit_graph_5.png index 9dd0c6ef..b38f4e56 100644 Binary files a/inherit_graph_5.png and b/inherit_graph_5.png differ diff --git a/inherit_graph_50.map b/inherit_graph_50.map index 02022663..2fa63592 100644 --- a/inherit_graph_50.map +++ b/inherit_graph_50.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_50.png b/inherit_graph_50.png index df48ffb3..62f07546 100644 Binary files a/inherit_graph_50.png and b/inherit_graph_50.png differ diff --git a/inherit_graph_51.map b/inherit_graph_51.map index 368c46e4..8d245233 100644 --- a/inherit_graph_51.map +++ b/inherit_graph_51.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_51.png b/inherit_graph_51.png index bec0e1ca..9fb87f9c 100644 Binary files a/inherit_graph_51.png and b/inherit_graph_51.png differ diff --git a/inherit_graph_52.map b/inherit_graph_52.map index 9b40ae87..21765097 100644 --- a/inherit_graph_52.map +++ b/inherit_graph_52.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_52.png b/inherit_graph_52.png index 125c650f..da941f30 100644 Binary files a/inherit_graph_52.png and b/inherit_graph_52.png differ diff --git a/inherit_graph_53.map b/inherit_graph_53.map index aa49c7ee..b06a230c 100644 --- a/inherit_graph_53.map +++ b/inherit_graph_53.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_53.png b/inherit_graph_53.png index 8414a9fa..928b5a63 100644 Binary files a/inherit_graph_53.png and b/inherit_graph_53.png differ diff --git a/inherit_graph_54.map b/inherit_graph_54.map index 1bb031f2..21ead85e 100644 --- a/inherit_graph_54.map +++ b/inherit_graph_54.map @@ -1,31 +1,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inherit_graph_54.png b/inherit_graph_54.png index 81ade397..5659c9ca 100644 Binary files a/inherit_graph_54.png and b/inherit_graph_54.png differ diff --git a/inherit_graph_55.map b/inherit_graph_55.map index 6a682805..4b5d011c 100644 --- a/inherit_graph_55.map +++ b/inherit_graph_55.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/inherit_graph_55.png b/inherit_graph_55.png index 2497f358..7b548a89 100644 Binary files a/inherit_graph_55.png and b/inherit_graph_55.png differ diff --git a/inherit_graph_6.map b/inherit_graph_6.map index 13f67773..0f67a081 100644 --- a/inherit_graph_6.map +++ b/inherit_graph_6.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_6.png b/inherit_graph_6.png index 6f37ed67..4b6786be 100644 Binary files a/inherit_graph_6.png and b/inherit_graph_6.png differ diff --git a/inherit_graph_7.map b/inherit_graph_7.map index 6e354317..cbaf2a1c 100644 --- a/inherit_graph_7.map +++ b/inherit_graph_7.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_7.png b/inherit_graph_7.png index 31865b67..a20a1b10 100644 Binary files a/inherit_graph_7.png and b/inherit_graph_7.png differ diff --git a/inherit_graph_8.png b/inherit_graph_8.png index c1a2e082..952641ae 100644 Binary files a/inherit_graph_8.png and b/inherit_graph_8.png differ diff --git a/inherit_graph_9.map b/inherit_graph_9.map index 163b3c26..edf85980 100644 --- a/inherit_graph_9.map +++ b/inherit_graph_9.map @@ -1,3 +1,3 @@ - + diff --git a/inherit_graph_9.png b/inherit_graph_9.png index 1816f96f..266165e4 100644 Binary files a/inherit_graph_9.png and b/inherit_graph_9.png differ diff --git a/inherits.html b/inherits.html index c3baef90..73c319bb 100644 --- a/inherits.html +++ b/inherits.html @@ -3,15 +3,16 @@ - + USB Host Shield 2.0: Class Hierarchy + @@ -22,7 +23,7 @@ - @@ -31,7 +32,7 @@
            +
            USB Host Shield 2.0
    - + @@ -73,7 +74,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
    +
    @@ -92,227 +93,323 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - + +
    - + + + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + + +
    - + +
    - + +
    - + +
    - + + +
    - + +
    - + +
    - + + + + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + +
    - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    - + + + + + +
    @@ -320,7 +417,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/jquery.js b/jquery.js index 6aa2e4c2..d52a1c77 100644 --- a/jquery.js +++ b/jquery.js @@ -1,4 +1,4 @@ -/*! +/* * jQuery JavaScript Library v1.7.1 * http://jquery.com/ * @@ -13,27 +13,56 @@ * * Date: Mon Nov 21 21:11:03 2011 -0500 */ -(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b40){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b40&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b21?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv
    a";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="
    ";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="
    t
    ";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="
    ";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType; -if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bCbA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}}); -/*! +(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b40){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b40&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b21?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv
    a";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="
    ";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="
    t
    ";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="
    ";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType;if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bCbA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}}); +/* * Sizzle CSS Selector Engine * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ -(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1 -},lt:function(bS,bR,e){return bRe[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="

    ";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="
    ";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT0){for(bB=bA;bB=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},ac=a(av); -ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div
    ","
    "]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1>");try{for(var bw=0,bv=this.length;bw1&&bw0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]===""&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length; -if(bA>0){if(bv!=="border"){for(;bx)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("
    ").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"":"")+"");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b -})}})(window); -/*! +(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1},lt:function(bS,bR,e){return bRe[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="

    ";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="
    ";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT0){for(bB=bA;bB=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/
    ",""],legend:[1,"
    ","
    "],thead:[1,"
    ","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},ac=a(av);ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div
    ","
    "]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1>");try{for(var bw=0,bv=this.length;bw1&&bw0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]===""&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length;if(bA>0){if(bv!=="border"){for(;bx)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("
    ").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"":"")+"");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b})}})(window);/* + * jQuery UI 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function(a,d){a.ui=a.ui||{};if(a.ui.version){return}a.extend(a.ui,{version:"1.8.18",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(e,f){return typeof e==="number"?this.each(function(){var g=this;setTimeout(function(){a(g).focus();if(f){f.call(g)}},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){e=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{e=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!e.length?a(document):e},zIndex:function(h){if(h!==d){return this.css("zIndex",h)}if(this.length){var f=a(this[0]),e,g;while(f.length&&f[0]!==document){e=f.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){g=parseInt(f.css("zIndex"),10);if(!isNaN(g)&&g!==0){return g}}f=f.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});a.each(["Width","Height"],function(g,e){var f=e==="Width"?["Left","Right"]:["Top","Bottom"],h=e.toLowerCase(),k={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function j(m,l,i,n){a.each(f,function(){l-=parseFloat(a.curCSS(m,"padding"+this,true))||0;if(i){l-=parseFloat(a.curCSS(m,"border"+this+"Width",true))||0}if(n){l-=parseFloat(a.curCSS(m,"margin"+this,true))||0}});return l}a.fn["inner"+e]=function(i){if(i===d){return k["inner"+e].call(this)}return this.each(function(){a(this).css(h,j(this,i)+"px")})};a.fn["outer"+e]=function(i,l){if(typeof i!=="number"){return k["outer"+e].call(this,i)}return this.each(function(){a(this).css(h,j(this,i,true,l)+"px")})}});function c(g,e){var j=g.nodeName.toLowerCase();if("area"===j){var i=g.parentNode,h=i.name,f;if(!g.href||!h||i.nodeName.toLowerCase()!=="map"){return false}f=a("img[usemap=#"+h+"]")[0];return !!f&&b(f)}return(/input|select|textarea|button|object/.test(j)?!g.disabled:"a"==j?g.href||e:e)&&b(g)}function b(e){return !a(e).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.extend(a.expr[":"],{data:function(g,f,e){return !!a.data(g,e[3])},focusable:function(e){return c(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(g){var e=a.attr(g,"tabindex"),f=isNaN(e);return(f||e>=0)&&c(g,!f)}});a(function(){var e=document.body,f=e.appendChild(f=document.createElement("div"));f.offsetHeight;a.extend(f.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=f.offsetHeight===100;a.support.selectstart="onselectstart" in f;e.removeChild(f).style.display="none"});a.extend(a.ui,{plugin:{add:function(f,g,j){var h=a.ui[f].prototype;for(var e in j){h.plugins[e]=h.plugins[e]||[];h.plugins[e].push([g,j[e]])}},call:function(e,g,f){var j=e.plugins[g];if(!j||!e.element[0].parentNode){return}for(var h=0;h0){return true}h[e]=1;g=(h[e]>0);h[e]=0;return g},isOverAxis:function(f,e,g){return(f>e)&&(f<(e+g))},isOver:function(j,f,i,h,e,g){return a.ui.isOverAxis(j,i,e)&&a.ui.isOverAxis(f,h,g)}})})(jQuery);/* + * jQuery UI Widget 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Widget + */ +(function(b,d){if(b.cleanData){var c=b.cleanData;b.cleanData=function(f){for(var g=0,h;(h=f[g])!=null;g++){try{b(h).triggerHandler("remove")}catch(j){}}c(f)}}else{var a=b.fn.remove;b.fn.remove=function(e,f){return this.each(function(){if(!f){if(!e||b.filter(e,[this]).length){b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(g){}})}}return a.call(b(this),e,f)})}}b.widget=function(f,h,e){var g=f.split(".")[0],j;f=f.split(".")[1];j=g+"-"+f;if(!e){e=h;h=b.Widget}b.expr[":"][j]=function(k){return !!b.data(k,f)};b[g]=b[g]||{};b[g][f]=function(k,l){if(arguments.length){this._createWidget(k,l)}};var i=new h();i.options=b.extend(true,{},i.options);b[g][f].prototype=b.extend(true,i,{namespace:g,widgetName:f,widgetEventPrefix:b[g][f].prototype.widgetEventPrefix||f,widgetBaseClass:j},e);b.widget.bridge(f,b[g][f])};b.widget.bridge=function(f,e){b.fn[f]=function(i){var g=typeof i==="string",h=Array.prototype.slice.call(arguments,1),j=this;i=!g&&h.length?b.extend.apply(null,[true,i].concat(h)):i;if(g&&i.charAt(0)==="_"){return j}if(g){this.each(function(){var k=b.data(this,f),l=k&&b.isFunction(k[i])?k[i].apply(k,h):k;if(l!==k&&l!==d){j=l;return false}})}else{this.each(function(){var k=b.data(this,f);if(k){k.option(i||{})._init()}else{b.data(this,f,new e(i,this))}})}return j}};b.Widget=function(e,f){if(arguments.length){this._createWidget(e,f)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(f,g){b.data(g,this.widgetName,this);this.element=b(g);this.options=b.extend(true,{},this.options,this._getCreateOptions(),f);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(f,g){var e=f;if(arguments.length===0){return b.extend({},this.options)}if(typeof f==="string"){if(g===d){return this.options[f]}e={};e[f]=g}this._setOptions(e);return this},_setOptions:function(f){var e=this;b.each(f,function(g,h){e._setOption(g,h)});return this},_setOption:function(e,f){this.options[e]=f;if(e==="disabled"){this.widget()[f?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",f)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(e,f,g){var j,i,h=this.options[e];g=g||{};f=b.Event(f);f.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase();f.target=this.element[0];i=f.originalEvent;if(i){for(j in i){if(!(j in f)){f[j]=i[j]}}}this.element.trigger(f,g);return !(b.isFunction(h)&&h.call(this.element[0],f,g)===false||f.isDefaultPrevented())}}})(jQuery);/* + * jQuery UI Mouse 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Mouse + * + * Depends: + * jquery.ui.widget.js + */ +(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/ + */ +(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('