diff --git a/README.md b/README.md index 8dc69313..1ee40e52 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ This is the documentation for the USB Host Library. It is generated using [Doxygen](http://www.stack.nl/~dimitri/doxygen/) and hosted using [Github Pages](https://help.github.com/categories/20/articles). -In order to build the documentation you will need the [Doxyfile](Doxyfile) and [imageStyle.css](imageStyle.css) files. +In order to build the documentation you will need the [Doxyfile](Doxyfile) and [imageStyle.css](imageStyle.css) file. Also since there is a bug in Doxygen you will need to add \ in front of the @-sign in [Circuits@Home](https://github.com/felis/USB_Host_Shield_2.0#developed-by) in the [README.md](https://github.com/felis/USB_Host_Shield_2.0#developed-by) file. -Also please uncomment \#define WIICAMERA in [Wii.h](https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.h). \ No newline at end of file +Also please uncomment \#define DEBUG in [message.h](https://github.com/felis/USB_Host_Shield_2.0/blob/master/message.h) and \#define WIICAMERA in [Wii.h](https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.h). \ No newline at end of file diff --git a/_b_t_d_8cpp.html b/_b_t_d_8cpp.html index d3529d81..0f9bcbf4 100644 --- a/_b_t_d_8cpp.html +++ b/_b_t_d_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: BTD.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -85,8 +85,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
-Macros
BTD.cpp File Reference
@@ -97,37 +95,16 @@ Include dependency graph for BTD.cpp:
- +

Go to the source code of this file.

- - - - -

-Macros

#define DEBUG
 
-

Macro Definition Documentation

- -
-
- - - - -
#define DEBUG
-
- -

Definition at line 19 of file BTD.cpp.

- -
-
diff --git a/_b_t_d_8cpp__incl.map b/_b_t_d_8cpp__incl.map index f0eebee1..7011a812 100644 --- a/_b_t_d_8cpp__incl.map +++ b/_b_t_d_8cpp__incl.map @@ -1,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/_b_t_d_8cpp__incl.md5 b/_b_t_d_8cpp__incl.md5 index 157ce03b..304dc71f 100644 --- a/_b_t_d_8cpp__incl.md5 +++ b/_b_t_d_8cpp__incl.md5 @@ -1 +1 @@ -944056a1501ac9eff0011e11046b8aea \ No newline at end of file +15e2215b6f2299b5052df2f131ec60f8 \ No newline at end of file diff --git a/_b_t_d_8cpp__incl.png b/_b_t_d_8cpp__incl.png index f8867828..8fefb090 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 9c47405d..b6a74956 100644 --- a/_b_t_d_8cpp_source.html +++ b/_b_t_d_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: BTD.cpp Source File @@ -31,7 +31,7 @@ - + @@ -107,8 +107,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
16  */
17 
18 #include "BTD.h"
-
19 #define DEBUG // Uncomment to print data for debugging
-
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
+
19 // To enable serial debugging uncomment "#define DEBUG_USB_HOST" in message.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;
@@ -145,12 +145,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
54  // get memory address of USB device address pool
55  AddressPool &addrPool = pUsb->GetAddressPool();
56 #ifdef EXTRADEBUG
-
57  Notify(PSTR("\r\nBTD Init"), 0x80);
+
57  Notify(PSTR("\r\nBTD Init"), 0x80);
58 #endif
59  // check if address has already been assigned to an instance
60  if (bAddress) {
-
61 #ifdef DEBUG
-
62  Notify(PSTR("\r\nAddress in use"), 0x80);
+
61 #ifdef DEBUG_USB_HOST
+
62  Notify(PSTR("\r\nAddress in use"), 0x80);
63 #endif
64  return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
65  }
@@ -159,15 +159,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
68  p = addrPool.GetUsbDevicePtr(0);
69 
70  if (!p) {
-
71 #ifdef DEBUG
-
72  Notify(PSTR("\r\nAddress not found"), 0x80);
+
71 #ifdef DEBUG_USB_HOST
+
72  Notify(PSTR("\r\nAddress not found"), 0x80);
73 #endif
74  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
75  }
76 
77  if (!p->epinfo) {
-
78 #ifdef DEBUG
-
79  Notify(PSTR("\r\nepinfo is null"), 0x80);
+
78 #ifdef DEBUG_USB_HOST
+
79  Notify(PSTR("\r\nepinfo is null"), 0x80);
80 #endif
81  return USB_ERROR_EPINFO_IS_NULL;
82  }
@@ -181,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
90  p->lowspeed = lowspeed;
91 
92  // Get device descriptor
-
93  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
+
93  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
94 
95  // Restore p->epinfo
96  p->epinfo = oldep_ptr;
@@ -204,14 +204,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
113  p->lowspeed = false;
114  addrPool.FreeAddress(bAddress);
115  bAddress = 0;
-
116 #ifdef DEBUG
-
117  Notify(PSTR("\r\nsetAddr: "), 0x80);
+
116 #ifdef DEBUG_USB_HOST
+
117  Notify(PSTR("\r\nsetAddr: "), 0x80);
118 #endif
119  PrintHex<uint8_t > (rcode, 0x80);
120  return rcode;
121  }
122 #ifdef EXTRADEBUG
-
123  Notify(PSTR("\r\nAddr: "), 0x80);
+
123  Notify(PSTR("\r\nAddr: "), 0x80);
124  PrintHex<uint8_t > (bAddress, 0x80);
125 #endif
126  p->lowspeed = false;
@@ -236,843 +236,843 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
145  if (rcode)
146  goto FailSetConfDescr;
147 
-
148  if (PID == PS3_PID || PID == PS3NAVIGATION_PID) {
-
149 #ifdef DEBUG
-
150  if (PID == PS3_PID)
-
151  Notify(PSTR("\r\nDualshock 3 Controller Connected"), 0x80);
-
152  else // must be a navigation controller
-
153  Notify(PSTR("\r\nNavigation Controller Connected"), 0x80);
-
154 #endif
-
155  /* Set internal Bluetooth address */
-
156  setBdaddr(my_bdaddr);
-
157  } else { // It must be a Motion controller
-
158 #ifdef DEBUG
-
159  Notify(PSTR("\r\nMotion Controller Connected"), 0x80);
-
160 #endif
-
161  setMoveBdaddr(my_bdaddr);
-
162  }
-
163 #ifdef DEBUG
-
164  Notify(PSTR("\r\nBluetooth Address was set to: "), 0x80);
-
165  for (int8_t i = 5; i > 0; i--) {
-
166  PrintHex<uint8_t > (my_bdaddr[i], 0x80);
-
167  Notify(PSTR(":"), 0x80);
-
168  }
-
169  PrintHex<uint8_t > (my_bdaddr[0], 0x80);
-
170 #endif
-
171  rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 0); // Reset configuration value
-
172  pUsb->setAddr(bAddress, 0, 0); // Reset address
-
173  Release(); // Release device
-
174  return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED; // return
-
175  } else {
-
176  num_of_conf = ((USB_DEVICE_DESCRIPTOR*)buf)->bNumConfigurations;
-
177 
-
178  // check if attached device is a Bluetooth dongle and fill endpoint data structure
-
179  // first interface in the configuration must have Bluetooth assigned Class/Subclass/Protocol
-
180  // and 3 endpoints - interrupt-IN, bulk-IN, bulk-OUT,
-
181  // not necessarily in this order
-
182  for (uint8_t i = 0; i < num_of_conf; i++) {
-
183  ConfigDescParser<USB_CLASS_WIRELESS_CTRL, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this);
-
184  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
-
185  if (rcode)
-
186  goto FailGetConfDescr;
-
187  if (bNumEP >= BTD_MAX_ENDPOINTS) // All endpoints extracted
-
188  break;
-
189  }
-
190 
-
191  if (bNumEP < BTD_MAX_ENDPOINTS)
-
192  goto FailUnknownDevice;
-
193 
-
194  // Assign epInfo to epinfo pointer - this time all 3 endpoins
-
195  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
-
196  if (rcode)
-
197  goto FailSetDevTblEntry;
+
148 #ifdef DEBUG_USB_HOST
+
149  if (PID == PS3_PID || PID == PS3NAVIGATION_PID) {
+
150  if (PID == PS3_PID)
+
151  Notify(PSTR("\r\nDualshock 3 Controller Connected"), 0x80);
+
152  else // It must be a navigation controller
+
153  Notify(PSTR("\r\nNavigation Controller Connected"), 0x80);
+
154  } else // It must be a Motion controller
+
155  Notify(PSTR("\r\nMotion Controller Connected"), 0x80);
+
156 #endif
+
157 
+
158  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) {
+
159 #ifdef DEBUG_USB_HOST
+
160  Notify(PSTR("\r\nPlease plug in the dongle before trying to pair with the PS3 Controller\n\rOr set the Bluetooth address in the constructor of the PS3BT class"), 0x80);
+
161 #endif
+
162  } else {
+
163  if (PID == PS3_PID || PID == PS3NAVIGATION_PID)
+
164  setBdaddr(my_bdaddr); // Set internal Bluetooth address
+
165  else
+
166  setMoveBdaddr(my_bdaddr); // Set internal Bluetooth address
+
167 #ifdef DEBUG_USB_HOST
+
168  Notify(PSTR("\r\nBluetooth Address was set to: "), 0x80);
+
169  for (int8_t i = 5; i > 0; i--) {
+
170  PrintHex<uint8_t > (my_bdaddr[i], 0x80);
+
171  Notify(PSTR(":"), 0x80);
+
172  }
+
173  PrintHex<uint8_t > (my_bdaddr[0], 0x80);
+
174 #endif
+
175  }
+
176 
+
177  rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 0); // Reset configuration value
+
178  pUsb->setAddr(bAddress, 0, 0); // Reset address
+
179  Release(); // Release device
+
180  return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED; // Return
+
181  } else {
+
182  num_of_conf = ((USB_DEVICE_DESCRIPTOR*)buf)->bNumConfigurations;
+
183 
+
184  // Check if attached device is a Bluetooth dongle and fill endpoint data structure
+
185  // First interface in the configuration must have Bluetooth assigned Class/Subclass/Protocol
+
186  // And 3 endpoints - interrupt-IN, bulk-IN, bulk-OUT, not necessarily in this order
+
187  for (uint8_t i = 0; i < num_of_conf; i++) {
+
188  ConfigDescParser<USB_CLASS_WIRELESS_CTRL, WI_SUBCLASS_RF, WI_PROTOCOL_BT, CP_MASK_COMPARE_ALL> confDescrParser(this);
+
189  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
+
190  if (rcode)
+
191  goto FailGetConfDescr;
+
192  if (bNumEP >= BTD_MAX_ENDPOINTS) // All endpoints extracted
+
193  break;
+
194  }
+
195 
+
196  if (bNumEP < BTD_MAX_ENDPOINTS)
+
197  goto FailUnknownDevice;
198 
-
199  delay(200); // Give time for address change
-
200 
-
201  // Set Configuration Value
-
202  rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum);
-
203  if (rcode)
-
204  goto FailSetConfDescr;
+
199  // Assign epInfo to epinfo pointer - this time all 3 endpoins
+
200  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
+
201  if (rcode)
+
202  goto FailSetDevTblEntry;
+
203 
+
204  delay(200); // Give time for address change
205 
-
206  hci_num_reset_loops = 100; // only loop 100 times before trying to send the hci reset command
-
207  hci_counter = 0;
-
208  hci_state = HCI_INIT_STATE;
-
209  watingForConnection = false;
-
210  bPollEnable = true;
-
211 
-
212 #ifdef DEBUG
-
213  Notify(PSTR("\r\nBluetooth Dongle Initialized"), 0x80);
-
214 #endif
-
215  }
-
216  return 0; // Successful configuration
-
217 
-
218  /* diagnostic messages */
-
219 FailGetDevDescr:
-
220  NotifyFailGetDevDescr();
-
221  goto Fail;
+
206  // Set Configuration Value
+
207  rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum);
+
208  if (rcode)
+
209  goto FailSetConfDescr;
+
210 
+
211  hci_num_reset_loops = 100; // only loop 100 times before trying to send the hci reset command
+
212  hci_counter = 0;
+
213  hci_state = HCI_INIT_STATE;
+
214  watingForConnection = false;
+
215  bPollEnable = true;
+
216 
+
217 #ifdef DEBUG_USB_HOST
+
218  Notify(PSTR("\r\nBluetooth Dongle Initialized"), 0x80);
+
219 #endif
+
220  }
+
221  return 0; // Successful configuration
222 
-
223 FailSetDevTblEntry:
-
224  NotifyFailSetDevTblEntry();
-
225  goto Fail;
-
226 
-
227 FailGetConfDescr:
-
228  NotifyFailGetConfDescr();
-
229  goto Fail;
-
230 
-
231 FailSetConfDescr:
-
232  NotifyFailSetConfDescr();
+
223  /* diagnostic messages */
+
224 FailGetDevDescr:
+
225 #ifdef DEBUG_USB_HOST
+
226  NotifyFailGetDevDescr();
+
227  goto Fail;
+
228 #endif
+
229 
+
230 FailSetDevTblEntry:
+
231 #ifdef DEBUG_USB_HOST
+
232  NotifyFailSetDevTblEntry();
233  goto Fail;
-
234 
-
235 FailUnknownDevice:
-
236  NotifyFailUnknownDevice(VID,PID);
-
237  pUsb->setAddr(bAddress, 0, 0); // Reset address
-
238  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
-
239 Fail:
-
240 #ifdef DEBUG
-
241  Notify(PSTR("\r\nBTD Init Failed, error code: "), 0x80);
-
242 #endif
-
243  NotifyFail(rcode);
-
244  Release();
-
245  return rcode;
-
246 }
+
234 #endif
+
235 
+
236 FailGetConfDescr:
+
237 #ifdef DEBUG_USB_HOST
+
238  NotifyFailGetConfDescr();
+
239  goto Fail;
+
240 #endif
+
241 
+
242 FailSetConfDescr:
+
243 #ifdef DEBUG_USB_HOST
+
244  NotifyFailSetConfDescr();
+
245 #endif
+
246  goto Fail;
247 
-
248 /* Extracts interrupt-IN, bulk-IN, bulk-OUT endpoint information from config descriptor */
-
249 void BTD::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
-
250  //ErrorMessage<uint8_t>(PSTR("Conf.Val"),conf);
-
251  //ErrorMessage<uint8_t>(PSTR("Iface Num"),iface);
-
252  //ErrorMessage<uint8_t>(PSTR("Alt.Set"),alt);
-
253 
-
254  if (alt) // wrong interface - by BT spec, no alt setting
-
255  return;
-
256 
-
257  bConfNum = conf;
-
258  uint8_t index;
-
259 
-
260  if ((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) // Interrupt In endpoint found
-
261  index = BTD_EVENT_PIPE;
+
248 FailUnknownDevice:
+
249 #ifdef DEBUG_USB_HOST
+
250  NotifyFailUnknownDevice(VID, PID);
+
251 #endif
+
252  pUsb->setAddr(bAddress, 0, 0); // Reset address
+
253  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
+
254 Fail:
+
255 #ifdef DEBUG_USB_HOST
+
256  Notify(PSTR("\r\nBTD Init Failed, error code: "), 0x80);
+
257  NotifyFail(rcode);
+
258 #endif
+
259  Release();
+
260  return rcode;
+
261 }
262 
-
263  else {
-
264  if ((pep->bmAttributes & 0x02) == 2) // bulk endpoint found
-
265  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? BTD_DATAIN_PIPE : BTD_DATAOUT_PIPE;
-
266  else
-
267  return;
-
268  }
-
269 
-
270  // Fill the rest of endpoint data structure
-
271  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
-
272  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
-
273 #ifdef EXTRADEBUG
-
274  PrintEndpointDescriptor(pep);
-
275 #endif
-
276  if (pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
-
277  pollInterval = pep->bInterval;
-
278  bNumEP++;
-
279 }
-
280 
-
281 void BTD::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
-
282 #ifdef EXTRADEBUG
-
283  Notify(PSTR("\r\nEndpoint descriptor:"), 0x80);
-
284  Notify(PSTR("\r\nLength:\t\t"), 0x80);
-
285  PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
-
286  Notify(PSTR("\r\nType:\t\t"), 0x80);
-
287  PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
-
288  Notify(PSTR("\r\nAddress:\t"), 0x80);
-
289  PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
-
290  Notify(PSTR("\r\nAttributes:\t"), 0x80);
-
291  PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
-
292  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
-
293  PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
-
294  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
-
295  PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
-
296 #endif
-
297 }
-
298 
-
299 /* Performs a cleanup after failed Init() attempt */
-
300 uint8_t BTD::Release() {
-
301  for (uint8_t i = 0; i < BTD_NUMSERVICES; i++) {
-
302  if (btService[i])
-
303  btService[i]->Reset(); // Reset all Bluetooth services
-
304  }
-
305 
-
306  pUsb->GetAddressPool().FreeAddress(bAddress);
-
307  bAddress = 0;
-
308  bPollEnable = false;
-
309  bNumEP = 1; // must have to be reset to 1
-
310  return 0;
-
311 }
-
312 
-
313 uint8_t BTD::Poll() {
-
314  if (!bPollEnable)
-
315  return 0;
-
316  if (qNextPollTime <= millis()) { // Don't poll if shorter than polling interval
-
317  qNextPollTime = millis() + pollInterval; // Set new poll time
-
318  HCI_event_task(); // poll the HCI event pipe
-
319  ACL_event_task(); // start polling the ACL input pipe too, though discard data until connected
-
320  }
-
321  return 0;
-
322 }
-
323 
-
324 void BTD::HCI_event_task() {
-
325  /* check the event pipe*/
-
326  uint16_t MAX_BUFFER_SIZE = BULK_MAXPKTSIZE; // Request more than 16 bytes anyway, the inTransfer routine will take care of this
-
327  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_EVENT_PIPE ].epAddr, &MAX_BUFFER_SIZE, hcibuf); // input on endpoint 1
-
328  if (!rcode) // Check for errors
-
329  {
-
330  switch (hcibuf[0]) //switch on event type
-
331  {
-
332  case EV_COMMAND_COMPLETE:
-
333  if (!hcibuf[5]) { // Check if command succeeded
-
334  hci_event_flag |= HCI_FLAG_CMD_COMPLETE; // set command complete flag
-
335  if ((hcibuf[3] == 0x01) && (hcibuf[4] == 0x10)) { // parameters from read local version information
-
336  hci_version = hcibuf[6]; // Used to check if it supports 2.0+EDR - see http://www.bluetooth.org/Technical/AssignedNumbers/hci.htm
-
337  hci_event_flag |= HCI_FLAG_READ_VERSION;
-
338  } else if ((hcibuf[3] == 0x09) && (hcibuf[4] == 0x10)) { // parameters from read local bluetooth address
-
339  for (uint8_t i = 0; i < 6; i++)
-
340  my_bdaddr[i] = hcibuf[6 + i];
-
341  hci_event_flag |= HCI_FLAG_READ_BDADDR;
-
342  }
-
343  }
-
344  break;
-
345 
-
346  case EV_COMMAND_STATUS:
-
347  if (hcibuf[2]) { // show status on serial if not OK
-
348 #ifdef DEBUG
-
349  Notify(PSTR("\r\nHCI Command Failed: "), 0x80);
-
350  PrintHex<uint8_t > (hcibuf[2], 0x80);
-
351  Notify(PSTR(" "), 0x80);
-
352  PrintHex<uint8_t > (hcibuf[4], 0x80);
-
353  Notify(PSTR(" "), 0x80);
-
354  PrintHex<uint8_t > (hcibuf[5], 0x80);
-
355 #endif
-
356  }
-
357  break;
-
358 
-
359  case EV_INQUIRY_COMPLETE:
-
360  if (inquiry_counter >= 5) {
-
361  inquiry_counter = 0;
-
362 #ifdef DEBUG
-
363  Notify(PSTR("\r\nCouldn't find Wiimote"), 0x80);
-
364 #endif
-
365  connectToWii = false;
-
366  pairWithWii = false;
-
367  hci_state = HCI_SCANNING_STATE;
-
368  }
-
369  inquiry_counter++;
-
370  break;
-
371 
-
372  case EV_INQUIRY_RESULT:
-
373  if (hcibuf[2]) { // Check that there is more than zero responses
-
374 #ifdef EXTRADEBUG
-
375  Notify(PSTR("\r\nNumber of responses: "), 0x80);
-
376  Notify(hcibuf[2], 0x80);
-
377 #endif
-
378  for (uint8_t i = 0; i < hcibuf[2]; i++) {
-
379  if ((hcibuf[4 + 8 * hcibuf[2] + 3 * i] == 0x04 && hcibuf[5 + 8 * hcibuf[2] + 3 * i] == 0x25 && hcibuf[6 + 8 * hcibuf[2] + 3 * i] == 0x00) || (hcibuf[4 + 8 * hcibuf[2] + 3 * i] == 0x08 && hcibuf[5 + 8 * hcibuf[2] + 3 * i] == 0x05 && hcibuf[6 + 8 * hcibuf[2] + 3 * i] == 0x00)) { // See http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html and http://wiibrew.org/wiki/Wiimote#SDP_information
-
380  if (hcibuf[4 + 8 * hcibuf[2] + 3 * i] == 0x08) // Check if it's the new Wiimote with motion plus inside that was detected
-
381  motionPlusInside = true;
-
382  else
-
383  motionPlusInside = false;
-
384  disc_bdaddr[0] = hcibuf[3 + 6 * i];
-
385  disc_bdaddr[1] = hcibuf[4 + 6 * i];
-
386  disc_bdaddr[2] = hcibuf[5 + 6 * i];
-
387  disc_bdaddr[3] = hcibuf[6 + 6 * i];
-
388  disc_bdaddr[4] = hcibuf[7 + 6 * i];
-
389  disc_bdaddr[5] = hcibuf[8 + 6 * i];
-
390  hci_event_flag |= HCI_FLAG_WII_FOUND;
-
391  break;
-
392  }
-
393 #ifdef EXTRADEBUG
-
394  else {
-
395  Notify(PSTR("\r\nClass of device: "), 0x80);
-
396  PrintHex<uint8_t > (hcibuf[6 + 8 * hcibuf[2] + 3 * i], 0x80);
-
397  Notify(PSTR(" "), 0x80);
-
398  PrintHex<uint8_t > (hcibuf[5 + 8 * hcibuf[2] + 3 * i], 0x80);
-
399  Notify(PSTR(" "), 0x80);
-
400  PrintHex<uint8_t > (hcibuf[4 + 8 * hcibuf[2] + 3 * i], 0x80);
-
401  }
-
402 #endif
-
403  }
-
404  }
-
405  break;
-
406 
-
407  case EV_CONNECT_COMPLETE:
-
408  hci_event_flag |= HCI_FLAG_CONNECT_EVENT;
-
409  if (!hcibuf[2]) { // check if connected OK
-
410  hci_handle = hcibuf[3] | ((hcibuf[4] & 0x0F) << 8); // store the handle for the ACL connection
-
411  hci_event_flag |= HCI_FLAG_CONN_COMPLETE; // set connection complete flag
-
412  }
-
413 #ifdef EXTRADEBUG
-
414  else {
-
415  Notify(PSTR("\r\nConnection Failed"), 0x80);
-
416  hci_state = HCI_CHECK_WII_SERVICE;
-
417  }
-
418 #endif
-
419  break;
-
420 
-
421  case EV_DISCONNECT_COMPLETE:
-
422  if (!hcibuf[2]) { // check if disconnected OK
-
423  hci_event_flag |= HCI_FLAG_DISCONN_COMPLETE; // set disconnect command complete flag
-
424  hci_event_flag &= ~HCI_FLAG_CONN_COMPLETE; // clear connection complete flag
-
425  }
-
426  break;
-
427 
-
428  case EV_REMOTE_NAME_COMPLETE:
-
429  if (!hcibuf[2]) { // check if reading is OK
-
430  for (uint8_t i = 0; i < min(sizeof(remote_name),sizeof(hcibuf)-9); i++)
-
431  remote_name[i] = hcibuf[9 + i];
-
432  hci_event_flag |= HCI_FLAG_REMOTE_NAME_COMPLETE;
-
433  }
-
434  break;
+
263 /* Extracts interrupt-IN, bulk-IN, bulk-OUT endpoint information from config descriptor */
+
264 void BTD::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
+
265  //ErrorMessage<uint8_t>(PSTR("Conf.Val"),conf);
+
266  //ErrorMessage<uint8_t>(PSTR("Iface Num"),iface);
+
267  //ErrorMessage<uint8_t>(PSTR("Alt.Set"),alt);
+
268 
+
269  if (alt) // Wrong interface - by BT spec, no alt setting
+
270  return;
+
271 
+
272  bConfNum = conf;
+
273  uint8_t index;
+
274 
+
275  if ((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) { // Interrupt In endpoint found
+
276  index = BTD_EVENT_PIPE;
+
277  epInfo[index].bmNakPower = USB_NAK_NOWAIT;
+
278  } else {
+
279  if ((pep->bmAttributes & 0x02) == 2) // Bulk endpoint found
+
280  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? BTD_DATAIN_PIPE : BTD_DATAOUT_PIPE;
+
281  else
+
282  return;
+
283  }
+
284 
+
285  // Fill the rest of endpoint data structure
+
286  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
+
287  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
+
288 #ifdef EXTRADEBUG
+
289  PrintEndpointDescriptor(pep);
+
290 #endif
+
291  if (pollInterval < pep->bInterval) // Set the polling interval as the largest polling interval obtained from endpoints
+
292  pollInterval = pep->bInterval;
+
293  bNumEP++;
+
294 }
+
295 
+
296 void BTD::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
+
297 #ifdef EXTRADEBUG
+
298  Notify(PSTR("\r\nEndpoint descriptor:"), 0x80);
+
299  Notify(PSTR("\r\nLength:\t\t"), 0x80);
+
300  PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
+
301  Notify(PSTR("\r\nType:\t\t"), 0x80);
+
302  PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
+
303  Notify(PSTR("\r\nAddress:\t"), 0x80);
+
304  PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
+
305  Notify(PSTR("\r\nAttributes:\t"), 0x80);
+
306  PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
+
307  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
+
308  PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
+
309  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
+
310  PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
+
311 #endif
+
312 }
+
313 
+
314 /* Performs a cleanup after failed Init() attempt */
+
315 uint8_t BTD::Release() {
+
316  for (uint8_t i = 0; i < BTD_NUMSERVICES; i++) {
+
317  if (btService[i])
+
318  btService[i]->Reset(); // Reset all Bluetooth services
+
319  }
+
320 
+
321  pUsb->GetAddressPool().FreeAddress(bAddress);
+
322  bAddress = 0;
+
323  bPollEnable = false;
+
324  bNumEP = 1; // must have to be reset to 1
+
325  return 0;
+
326 }
+
327 
+
328 uint8_t BTD::Poll() {
+
329  if (!bPollEnable)
+
330  return 0;
+
331  if (qNextPollTime <= millis()) { // Don't poll if shorter than polling interval
+
332  qNextPollTime = millis() + pollInterval; // Set new poll time
+
333  HCI_event_task(); // poll the HCI event pipe
+
334  ACL_event_task(); // start polling the ACL input pipe too, though discard data until connected
+
335  }
+
336  return 0;
+
337 }
+
338 
+
339 void BTD::HCI_event_task() {
+
340  /* check the event pipe*/
+
341  uint16_t MAX_BUFFER_SIZE = BULK_MAXPKTSIZE; // Request more than 16 bytes anyway, the inTransfer routine will take care of this
+
342  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_EVENT_PIPE ].epAddr, &MAX_BUFFER_SIZE, hcibuf); // input on endpoint 1
+
343  if (!rcode) // Check for errors
+
344  {
+
345  switch (hcibuf[0]) //switch on event type
+
346  {
+
347  case EV_COMMAND_COMPLETE:
+
348  if (!hcibuf[5]) { // Check if command succeeded
+
349  hci_event_flag |= HCI_FLAG_CMD_COMPLETE; // set command complete flag
+
350  if ((hcibuf[3] == 0x01) && (hcibuf[4] == 0x10)) { // parameters from read local version information
+
351  hci_version = hcibuf[6]; // Used to check if it supports 2.0+EDR - see http://www.bluetooth.org/Technical/AssignedNumbers/hci.htm
+
352  hci_event_flag |= HCI_FLAG_READ_VERSION;
+
353  } else if ((hcibuf[3] == 0x09) && (hcibuf[4] == 0x10)) { // parameters from read local bluetooth address
+
354  for (uint8_t i = 0; i < 6; i++)
+
355  my_bdaddr[i] = hcibuf[6 + i];
+
356  hci_event_flag |= HCI_FLAG_READ_BDADDR;
+
357  }
+
358  }
+
359  break;
+
360 
+
361  case EV_COMMAND_STATUS:
+
362  if (hcibuf[2]) { // show status on serial if not OK
+
363 #ifdef DEBUG_USB_HOST
+
364  Notify(PSTR("\r\nHCI Command Failed: "), 0x80);
+
365  PrintHex<uint8_t > (hcibuf[2], 0x80);
+
366  Notify(PSTR(" "), 0x80);
+
367  PrintHex<uint8_t > (hcibuf[4], 0x80);
+
368  Notify(PSTR(" "), 0x80);
+
369  PrintHex<uint8_t > (hcibuf[5], 0x80);
+
370 #endif
+
371  }
+
372  break;
+
373 
+
374  case EV_INQUIRY_COMPLETE:
+
375  if (inquiry_counter >= 5) {
+
376  inquiry_counter = 0;
+
377 #ifdef DEBUG_USB_HOST
+
378  Notify(PSTR("\r\nCouldn't find Wiimote"), 0x80);
+
379 #endif
+
380  connectToWii = false;
+
381  pairWithWii = false;
+
382  hci_state = HCI_SCANNING_STATE;
+
383  }
+
384  inquiry_counter++;
+
385  break;
+
386 
+
387  case EV_INQUIRY_RESULT:
+
388  if (hcibuf[2]) { // Check that there is more than zero responses
+
389 #ifdef EXTRADEBUG
+
390  Notify(PSTR("\r\nNumber of responses: "), 0x80);
+
391  Notify(hcibuf[2], 0x80);
+
392 #endif
+
393  for (uint8_t i = 0; i < hcibuf[2]; i++) {
+
394  if ((hcibuf[4 + 8 * hcibuf[2] + 3 * i] == 0x04 && hcibuf[5 + 8 * hcibuf[2] + 3 * i] == 0x25 && hcibuf[6 + 8 * hcibuf[2] + 3 * i] == 0x00) || (hcibuf[4 + 8 * hcibuf[2] + 3 * i] == 0x08 && hcibuf[5 + 8 * hcibuf[2] + 3 * i] == 0x05 && hcibuf[6 + 8 * hcibuf[2] + 3 * i] == 0x00)) { // See http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html and http://wiibrew.org/wiki/Wiimote#SDP_information
+
395  if (hcibuf[4 + 8 * hcibuf[2] + 3 * i] == 0x08) // Check if it's the new Wiimote with motion plus inside that was detected
+
396  motionPlusInside = true;
+
397  else
+
398  motionPlusInside = false;
+
399  disc_bdaddr[0] = hcibuf[3 + 6 * i];
+
400  disc_bdaddr[1] = hcibuf[4 + 6 * i];
+
401  disc_bdaddr[2] = hcibuf[5 + 6 * i];
+
402  disc_bdaddr[3] = hcibuf[6 + 6 * i];
+
403  disc_bdaddr[4] = hcibuf[7 + 6 * i];
+
404  disc_bdaddr[5] = hcibuf[8 + 6 * i];
+
405  hci_event_flag |= HCI_FLAG_WII_FOUND;
+
406  break;
+
407  }
+
408 #ifdef EXTRADEBUG
+
409  else {
+
410  Notify(PSTR("\r\nClass of device: "), 0x80);
+
411  PrintHex<uint8_t > (hcibuf[6 + 8 * hcibuf[2] + 3 * i], 0x80);
+
412  Notify(PSTR(" "), 0x80);
+
413  PrintHex<uint8_t > (hcibuf[5 + 8 * hcibuf[2] + 3 * i], 0x80);
+
414  Notify(PSTR(" "), 0x80);
+
415  PrintHex<uint8_t > (hcibuf[4 + 8 * hcibuf[2] + 3 * i], 0x80);
+
416  }
+
417 #endif
+
418  }
+
419  }
+
420  break;
+
421 
+
422  case EV_CONNECT_COMPLETE:
+
423  hci_event_flag |= HCI_FLAG_CONNECT_EVENT;
+
424  if (!hcibuf[2]) { // check if connected OK
+
425  hci_handle = hcibuf[3] | ((hcibuf[4] & 0x0F) << 8); // store the handle for the ACL connection
+
426  hci_event_flag |= HCI_FLAG_CONN_COMPLETE; // set connection complete flag
+
427  }
+
428 #ifdef EXTRADEBUG
+
429  else {
+
430  Notify(PSTR("\r\nConnection Failed"), 0x80);
+
431  hci_state = HCI_CHECK_WII_SERVICE;
+
432  }
+
433 #endif
+
434  break;
435 
-
436  case EV_INCOMING_CONNECT:
-
437  disc_bdaddr[0] = hcibuf[2];
-
438  disc_bdaddr[1] = hcibuf[3];
-
439  disc_bdaddr[2] = hcibuf[4];
-
440  disc_bdaddr[3] = hcibuf[5];
-
441  disc_bdaddr[4] = hcibuf[6];
-
442  disc_bdaddr[5] = hcibuf[7];
-
443 #ifdef EXTRADEBUG
-
444  Notify(PSTR("\r\nClass of device: "), 0x80);
-
445  PrintHex<uint8_t > (hcibuf[10], 0x80);
-
446  Notify(PSTR(" "), 0x80);
-
447  PrintHex<uint8_t > (hcibuf[9], 0x80);
-
448  Notify(PSTR(" "), 0x80);
-
449  PrintHex<uint8_t > (hcibuf[8], 0x80);
-
450 #endif
-
451  hci_event_flag |= HCI_FLAG_INCOMING_REQUEST;
-
452  break;
-
453 
-
454  case EV_PIN_CODE_REQUEST:
-
455  if (pairWithWii) {
-
456 #ifdef DEBUG
-
457  Notify(PSTR("\r\nPairing with wiimote"), 0x80);
-
458 #endif
-
459  hci_pin_code_request_reply();
-
460  } else if (btdPin != NULL) {
-
461 #ifdef DEBUG
-
462  Notify(PSTR("\r\nBluetooth pin is set too: "), 0x80);
-
463  NotifyStr(btdPin, 0x80);
-
464 #endif
-
465  hci_pin_code_request_reply();
-
466  } else {
-
467 #ifdef DEBUG
-
468  Notify(PSTR("\r\nNo pin was set"), 0x80);
-
469 #endif
-
470  hci_pin_code_negative_request_reply();
-
471  }
-
472  break;
-
473 
-
474  case EV_LINK_KEY_REQUEST:
-
475 #ifdef DEBUG
-
476  Notify(PSTR("\r\nReceived Key Request"), 0x80);
-
477 #endif
-
478  hci_link_key_request_negative_reply();
-
479  break;
-
480 
-
481  case EV_AUTHENTICATION_COMPLETE:
-
482  if (pairWithWii && !connectToWii) {
-
483 #ifdef DEBUG
-
484  Notify(PSTR("\r\nPairing successful"), 0x80);
-
485 #endif
-
486  connectToWii = true; // Only send the ACL data to the Wii service
-
487  }
-
488  break;
-
489  /* We will just ignore the following events */
-
490  case EV_NUM_COMPLETE_PKT:
-
491  case EV_ROLE_CHANGED:
-
492  case EV_PAGE_SCAN_REP_MODE:
-
493  case EV_LOOPBACK_COMMAND:
-
494  case EV_DATA_BUFFER_OVERFLOW:
-
495  case EV_CHANGE_CONNECTION_LINK:
-
496  case EV_MAX_SLOTS_CHANGE:
-
497  case EV_QOS_SETUP_COMPLETE:
-
498  case EV_LINK_KEY_NOTIFICATION:
-
499  case EV_ENCRYPTION_CHANGE:
-
500  case EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE:
-
501  break;
-
502 #ifdef EXTRADEBUG
-
503  default:
-
504  if (hcibuf[0] != 0x00) {
-
505  Notify(PSTR("\r\nUnmanaged HCI Event: "), 0x80);
-
506  PrintHex<uint8_t > (hcibuf[0], 0x80);
-
507  }
-
508  break;
-
509 #endif
-
510  } // switch
-
511  }
-
512 #ifdef EXTRADEBUG
-
513  else if (rcode != hrNAK) {
-
514  Notify(PSTR("\r\nHCI event error: "), 0x80);
-
515  PrintHex<uint8_t > (rcode, 0x80);
-
516  }
-
517 #endif
-
518  HCI_task();
-
519 }
-
520 
-
521 /* Poll Bluetooth and print result */
-
522 void BTD::HCI_task() {
-
523  switch (hci_state) {
-
524  case HCI_INIT_STATE:
-
525  hci_counter++;
-
526  if (hci_counter > hci_num_reset_loops) { // wait until we have looped x times to clear any old events
-
527  hci_reset();
-
528  hci_state = HCI_RESET_STATE;
-
529  hci_counter = 0;
-
530  }
-
531  break;
-
532 
-
533  case HCI_RESET_STATE:
-
534  hci_counter++;
-
535  if (hci_cmd_complete) {
-
536  hci_counter = 0;
-
537 #ifdef DEBUG
-
538  Notify(PSTR("\r\nHCI Reset complete"), 0x80);
-
539 #endif
-
540  hci_state = HCI_CLASS_STATE;
-
541  hci_write_class_of_device();
-
542  } else if (hci_counter > hci_num_reset_loops) {
-
543  hci_num_reset_loops *= 10;
-
544  if (hci_num_reset_loops > 2000)
-
545  hci_num_reset_loops = 2000;
-
546 #ifdef DEBUG
-
547  Notify(PSTR("\r\nNo response to HCI Reset"), 0x80);
-
548 #endif
-
549  hci_state = HCI_INIT_STATE;
-
550  hci_counter = 0;
-
551  }
-
552  break;
-
553 
-
554  case HCI_CLASS_STATE:
-
555  if (hci_cmd_complete) {
-
556 #ifdef DEBUG
-
557  Notify(PSTR("\r\nWrite class of device"), 0x80);
-
558 #endif
-
559  hci_state = HCI_BDADDR_STATE;
-
560  hci_read_bdaddr();
-
561  }
-
562  break;
-
563 
-
564  case HCI_BDADDR_STATE:
-
565  if (hci_read_bdaddr_complete) {
-
566 #ifdef DEBUG
-
567  Notify(PSTR("\r\nLocal Bluetooth Address: "), 0x80);
-
568  for (int8_t i = 5; i > 0; i--) {
-
569  PrintHex<uint8_t > (my_bdaddr[i], 0x80);
-
570  Notify(PSTR(":"), 0x80);
-
571  }
-
572  PrintHex<uint8_t > (my_bdaddr[0], 0x80);
+
436  case EV_DISCONNECT_COMPLETE:
+
437  if (!hcibuf[2]) { // check if disconnected OK
+
438  hci_event_flag |= HCI_FLAG_DISCONN_COMPLETE; // set disconnect command complete flag
+
439  hci_event_flag &= ~HCI_FLAG_CONN_COMPLETE; // clear connection complete flag
+
440  }
+
441  break;
+
442 
+
443  case EV_REMOTE_NAME_COMPLETE:
+
444  if (!hcibuf[2]) { // check if reading is OK
+
445  for (uint8_t i = 0; i < min(sizeof (remote_name), sizeof (hcibuf) - 9); i++)
+
446  remote_name[i] = hcibuf[9 + i];
+
447  hci_event_flag |= HCI_FLAG_REMOTE_NAME_COMPLETE;
+
448  }
+
449  break;
+
450 
+
451  case EV_INCOMING_CONNECT:
+
452  disc_bdaddr[0] = hcibuf[2];
+
453  disc_bdaddr[1] = hcibuf[3];
+
454  disc_bdaddr[2] = hcibuf[4];
+
455  disc_bdaddr[3] = hcibuf[5];
+
456  disc_bdaddr[4] = hcibuf[6];
+
457  disc_bdaddr[5] = hcibuf[7];
+
458 #ifdef EXTRADEBUG
+
459  Notify(PSTR("\r\nClass of device: "), 0x80);
+
460  PrintHex<uint8_t > (hcibuf[10], 0x80);
+
461  Notify(PSTR(" "), 0x80);
+
462  PrintHex<uint8_t > (hcibuf[9], 0x80);
+
463  Notify(PSTR(" "), 0x80);
+
464  PrintHex<uint8_t > (hcibuf[8], 0x80);
+
465 #endif
+
466  hci_event_flag |= HCI_FLAG_INCOMING_REQUEST;
+
467  break;
+
468 
+
469  case EV_PIN_CODE_REQUEST:
+
470  if (pairWithWii) {
+
471 #ifdef DEBUG_USB_HOST
+
472  Notify(PSTR("\r\nPairing with wiimote"), 0x80);
+
473 #endif
+
474  hci_pin_code_request_reply();
+
475  } else if (btdPin != NULL) {
+
476 #ifdef DEBUG_USB_HOST
+
477  Notify(PSTR("\r\nBluetooth pin is set too: "), 0x80);
+
478  NotifyStr(btdPin, 0x80);
+
479 #endif
+
480  hci_pin_code_request_reply();
+
481  } else {
+
482 #ifdef DEBUG_USB_HOST
+
483  Notify(PSTR("\r\nNo pin was set"), 0x80);
+
484 #endif
+
485  hci_pin_code_negative_request_reply();
+
486  }
+
487  break;
+
488 
+
489  case EV_LINK_KEY_REQUEST:
+
490 #ifdef DEBUG_USB_HOST
+
491  Notify(PSTR("\r\nReceived Key Request"), 0x80);
+
492 #endif
+
493  hci_link_key_request_negative_reply();
+
494  break;
+
495 
+
496  case EV_AUTHENTICATION_COMPLETE:
+
497  if (pairWithWii && !connectToWii) {
+
498 #ifdef DEBUG_USB_HOST
+
499  Notify(PSTR("\r\nPairing successful"), 0x80);
+
500 #endif
+
501  connectToWii = true; // Only send the ACL data to the Wii service
+
502  }
+
503  break;
+
504  /* We will just ignore the following events */
+
505  case EV_NUM_COMPLETE_PKT:
+
506  case EV_ROLE_CHANGED:
+
507  case EV_PAGE_SCAN_REP_MODE:
+
508  case EV_LOOPBACK_COMMAND:
+
509  case EV_DATA_BUFFER_OVERFLOW:
+
510  case EV_CHANGE_CONNECTION_LINK:
+
511  case EV_MAX_SLOTS_CHANGE:
+
512  case EV_QOS_SETUP_COMPLETE:
+
513  case EV_LINK_KEY_NOTIFICATION:
+
514  case EV_ENCRYPTION_CHANGE:
+
515  case EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE:
+
516  break;
+
517 #ifdef EXTRADEBUG
+
518  default:
+
519  if (hcibuf[0] != 0x00) {
+
520  Notify(PSTR("\r\nUnmanaged HCI Event: "), 0x80);
+
521  PrintHex<uint8_t > (hcibuf[0], 0x80);
+
522  }
+
523  break;
+
524 #endif
+
525  } // switch
+
526  }
+
527 #ifdef EXTRADEBUG
+
528  else if (rcode != hrNAK) {
+
529  Notify(PSTR("\r\nHCI event error: "), 0x80);
+
530  PrintHex<uint8_t > (rcode, 0x80);
+
531  }
+
532 #endif
+
533  HCI_task();
+
534 }
+
535 
+
536 /* Poll Bluetooth and print result */
+
537 void BTD::HCI_task() {
+
538  switch (hci_state) {
+
539  case HCI_INIT_STATE:
+
540  hci_counter++;
+
541  if (hci_counter > hci_num_reset_loops) { // wait until we have looped x times to clear any old events
+
542  hci_reset();
+
543  hci_state = HCI_RESET_STATE;
+
544  hci_counter = 0;
+
545  }
+
546  break;
+
547 
+
548  case HCI_RESET_STATE:
+
549  hci_counter++;
+
550  if (hci_cmd_complete) {
+
551  hci_counter = 0;
+
552 #ifdef DEBUG_USB_HOST
+
553  Notify(PSTR("\r\nHCI Reset complete"), 0x80);
+
554 #endif
+
555  hci_state = HCI_CLASS_STATE;
+
556  hci_write_class_of_device();
+
557  } else if (hci_counter > hci_num_reset_loops) {
+
558  hci_num_reset_loops *= 10;
+
559  if (hci_num_reset_loops > 2000)
+
560  hci_num_reset_loops = 2000;
+
561 #ifdef DEBUG_USB_HOST
+
562  Notify(PSTR("\r\nNo response to HCI Reset"), 0x80);
+
563 #endif
+
564  hci_state = HCI_INIT_STATE;
+
565  hci_counter = 0;
+
566  }
+
567  break;
+
568 
+
569  case HCI_CLASS_STATE:
+
570  if (hci_cmd_complete) {
+
571 #ifdef DEBUG_USB_HOST
+
572  Notify(PSTR("\r\nWrite class of device"), 0x80);
573 #endif
-
574  hci_read_local_version_information();
-
575  hci_state = HCI_LOCAL_VERSION_STATE;
+
574  hci_state = HCI_BDADDR_STATE;
+
575  hci_read_bdaddr();
576  }
577  break;
578 
-
579  case HCI_LOCAL_VERSION_STATE: // The local version is used by the PS3BT class
-
580  if (hci_read_version_complete) {
-
581  if (btdName != NULL) {
-
582  hci_set_local_name(btdName);
-
583  hci_state = HCI_SET_NAME_STATE;
-
584  } else
-
585  hci_state = HCI_CHECK_WII_SERVICE;
-
586  }
-
587  break;
-
588 
-
589  case HCI_SET_NAME_STATE:
-
590  if (hci_cmd_complete) {
-
591 #ifdef DEBUG
-
592  Notify(PSTR("\r\nThe name is set to: "), 0x80);
-
593  NotifyStr(btdName, 0x80);
-
594 #endif
-
595  hci_state = HCI_CHECK_WII_SERVICE;
-
596  }
-
597  break;
-
598 
-
599  case HCI_CHECK_WII_SERVICE:
-
600  if (pairWithWii) { // Check if it should try to connect to a wiimote
-
601 #ifdef DEBUG
-
602  Notify(PSTR("\r\nStarting inquiry\r\nPress 1 & 2 on the Wiimote\r\nOr press sync if you are using a Wii U Pro Controller"), 0x80);
-
603 #endif
-
604  hci_inquiry();
-
605  hci_state = HCI_INQUIRY_STATE;
-
606  } else
-
607  hci_state = HCI_SCANNING_STATE; // Don't try to connect to a Wiimote
-
608  break;
-
609 
-
610  case HCI_INQUIRY_STATE:
-
611  if (hci_wii_found) {
-
612  hci_inquiry_cancel(); // Stop inquiry
-
613 #ifdef DEBUG
-
614  Notify(PSTR("\r\nWiimote found"), 0x80);
-
615  Notify(PSTR("\r\nNow just create the instance like so:"), 0x80);
-
616  Notify(PSTR("\r\nWII Wii(&Btd);"), 0x80);
-
617  Notify(PSTR("\r\nAnd then press any button on the Wiimote"), 0x80);
+
579  case HCI_BDADDR_STATE:
+
580  if (hci_read_bdaddr_complete) {
+
581 #ifdef DEBUG_USB_HOST
+
582  Notify(PSTR("\r\nLocal Bluetooth Address: "), 0x80);
+
583  for (int8_t i = 5; i > 0; i--) {
+
584  PrintHex<uint8_t > (my_bdaddr[i], 0x80);
+
585  Notify(PSTR(":"), 0x80);
+
586  }
+
587  PrintHex<uint8_t > (my_bdaddr[0], 0x80);
+
588 #endif
+
589  hci_read_local_version_information();
+
590  hci_state = HCI_LOCAL_VERSION_STATE;
+
591  }
+
592  break;
+
593 
+
594  case HCI_LOCAL_VERSION_STATE: // The local version is used by the PS3BT class
+
595  if (hci_read_version_complete) {
+
596  if (btdName != NULL) {
+
597  hci_set_local_name(btdName);
+
598  hci_state = HCI_SET_NAME_STATE;
+
599  } else
+
600  hci_state = HCI_CHECK_WII_SERVICE;
+
601  }
+
602  break;
+
603 
+
604  case HCI_SET_NAME_STATE:
+
605  if (hci_cmd_complete) {
+
606 #ifdef DEBUG_USB_HOST
+
607  Notify(PSTR("\r\nThe name is set to: "), 0x80);
+
608  NotifyStr(btdName, 0x80);
+
609 #endif
+
610  hci_state = HCI_CHECK_WII_SERVICE;
+
611  }
+
612  break;
+
613 
+
614  case HCI_CHECK_WII_SERVICE:
+
615  if (pairWithWii) { // Check if it should try to connect to a wiimote
+
616 #ifdef DEBUG_USB_HOST
+
617  Notify(PSTR("\r\nStarting inquiry\r\nPress 1 & 2 on the Wiimote\r\nOr press sync if you are using a Wii U Pro Controller"), 0x80);
618 #endif
-
619  if (motionPlusInside) {
-
620  hci_remote_name(); // We need to know the name to distinguish between a Wiimote and a Wii U Pro Controller
-
621  hci_state = HCI_REMOTE_NAME_STATE;
-
622  } else
-
623  hci_state = HCI_CONNECT_WII_STATE;
-
624  }
-
625  break;
-
626 
-
627  case HCI_CONNECT_WII_STATE:
-
628  if (hci_cmd_complete) {
-
629 #ifdef DEBUG
-
630  Notify(PSTR("\r\nConnecting to Wiimote"), 0x80);
-
631 #endif
-
632  hci_connect();
-
633  hci_state = HCI_CONNECTED_WII_STATE;
-
634  }
-
635  break;
-
636 
-
637  case HCI_CONNECTED_WII_STATE:
-
638  if (hci_connect_event) {
-
639  if (hci_connect_complete) {
-
640 #ifdef DEBUG
-
641  Notify(PSTR("\r\nConnected to Wiimote"), 0x80);
-
642 #endif
-
643  hci_authentication_request(); // This will start the pairing with the wiimote
-
644  hci_state = HCI_SCANNING_STATE;
-
645  } else {
-
646 #ifdef DEBUG
-
647  Notify(PSTR("\r\nTrying to connect one more time..."), 0x80);
-
648 #endif
-
649  hci_connect(); // Try to connect one more time
-
650  }
-
651  }
-
652  break;
-
653 
-
654  case HCI_SCANNING_STATE:
-
655  if (!connectToWii && !pairWithWii) {
-
656 #ifdef DEBUG
-
657  Notify(PSTR("\r\nWait For Incoming Connection Request"), 0x80);
-
658 #endif
-
659  hci_write_scan_enable();
-
660  watingForConnection = true;
-
661  hci_state = HCI_CONNECT_IN_STATE;
-
662  }
-
663  break;
-
664 
-
665  case HCI_CONNECT_IN_STATE:
-
666  if (hci_incoming_connect_request) {
-
667  watingForConnection = false;
-
668 #ifdef DEBUG
-
669  Notify(PSTR("\r\nIncoming Connection Request"), 0x80);
-
670 #endif
-
671  hci_remote_name();
-
672  hci_state = HCI_REMOTE_NAME_STATE;
-
673  } else if (hci_disconnect_complete)
-
674  hci_state = HCI_DISCONNECT_STATE;
-
675  break;
-
676 
-
677  case HCI_REMOTE_NAME_STATE:
-
678  if (hci_remote_name_complete) {
-
679 #ifdef DEBUG
-
680  Notify(PSTR("\r\nRemote Name: "), 0x80);
-
681  for (uint8_t i = 0; i < 30; i++) {
-
682  if (remote_name[i] == NULL)
-
683  break;
-
684  Notifyc(remote_name[i], 0x80);
-
685  }
-
686 #endif
-
687  if (strncmp((const char*)remote_name, "Nintendo", 8) == 0) {
-
688  incomingWii = true;
-
689 #ifdef DEBUG
-
690  Notify(PSTR("\r\nWiimote is connecting"), 0x80);
-
691 #endif
-
692  if (strncmp((const char*)remote_name, "Nintendo RVL-CNT-01-TR", 22) == 0) {
-
693 #ifdef DEBUG
-
694  Notify(PSTR(" with Motion Plus Inside"), 0x80);
-
695 #endif
-
696  motionPlusInside = true;
-
697  } else if (strncmp((const char*)remote_name, "Nintendo RVL-CNT-01-UC", 22) == 0) {
-
698 #ifdef DEBUG
-
699  Notify(PSTR(" - Wii U Pro Controller"), 0x80);
-
700 #endif
-
701  motionPlusInside = true;
-
702  wiiUProController = true;
-
703  } else {
-
704  motionPlusInside = false;
-
705  wiiUProController = false;
-
706  }
-
707  }
-
708  if (pairWithWii && motionPlusInside)
-
709  hci_state = HCI_CONNECT_WII_STATE;
-
710  else {
-
711  hci_accept_connection();
-
712  hci_state = HCI_CONNECTED_STATE;
-
713  }
-
714  }
-
715  break;
-
716 
-
717  case HCI_CONNECTED_STATE:
-
718  if (hci_connect_complete) {
-
719 #ifdef DEBUG
-
720  Notify(PSTR("\r\nConnected to Device: "), 0x80);
-
721  for (int8_t i = 5; i > 0; i--) {
-
722  PrintHex<uint8_t > (disc_bdaddr[i], 0x80);
-
723  Notify(PSTR(":"), 0x80);
-
724  }
-
725  PrintHex<uint8_t > (disc_bdaddr[0], 0x80);
-
726 #endif
-
727  // Clear these flags for a new connection
-
728  l2capConnectionClaimed = false;
-
729  sdpConnectionClaimed = false;
-
730  rfcommConnectionClaimed = false;
+
619  hci_inquiry();
+
620  hci_state = HCI_INQUIRY_STATE;
+
621  } else
+
622  hci_state = HCI_SCANNING_STATE; // Don't try to connect to a Wiimote
+
623  break;
+
624 
+
625  case HCI_INQUIRY_STATE:
+
626  if (hci_wii_found) {
+
627  hci_inquiry_cancel(); // Stop inquiry
+
628 #ifdef DEBUG_USB_HOST
+
629  Notify(PSTR("\r\nWiimote found"), 0x80);
+
630  Notify(PSTR("\r\nNow just create the instance like so:"), 0x80);
+
631  Notify(PSTR("\r\nWII Wii(&Btd);"), 0x80);
+
632  Notify(PSTR("\r\nAnd then press any button on the Wiimote"), 0x80);
+
633 #endif
+
634  if (motionPlusInside) {
+
635  hci_remote_name(); // We need to know the name to distinguish between a Wiimote and a Wii U Pro Controller
+
636  hci_state = HCI_REMOTE_NAME_STATE;
+
637  } else
+
638  hci_state = HCI_CONNECT_WII_STATE;
+
639  }
+
640  break;
+
641 
+
642  case HCI_CONNECT_WII_STATE:
+
643  if (hci_cmd_complete) {
+
644 #ifdef DEBUG_USB_HOST
+
645  Notify(PSTR("\r\nConnecting to Wiimote"), 0x80);
+
646 #endif
+
647  hci_connect();
+
648  hci_state = HCI_CONNECTED_WII_STATE;
+
649  }
+
650  break;
+
651 
+
652  case HCI_CONNECTED_WII_STATE:
+
653  if (hci_connect_event) {
+
654  if (hci_connect_complete) {
+
655 #ifdef DEBUG_USB_HOST
+
656  Notify(PSTR("\r\nConnected to Wiimote"), 0x80);
+
657 #endif
+
658  hci_authentication_request(); // This will start the pairing with the wiimote
+
659  hci_state = HCI_SCANNING_STATE;
+
660  } else {
+
661 #ifdef DEBUG_USB_HOST
+
662  Notify(PSTR("\r\nTrying to connect one more time..."), 0x80);
+
663 #endif
+
664  hci_connect(); // Try to connect one more time
+
665  }
+
666  }
+
667  break;
+
668 
+
669  case HCI_SCANNING_STATE:
+
670  if (!connectToWii && !pairWithWii) {
+
671 #ifdef DEBUG_USB_HOST
+
672  Notify(PSTR("\r\nWait For Incoming Connection Request"), 0x80);
+
673 #endif
+
674  hci_write_scan_enable();
+
675  watingForConnection = true;
+
676  hci_state = HCI_CONNECT_IN_STATE;
+
677  }
+
678  break;
+
679 
+
680  case HCI_CONNECT_IN_STATE:
+
681  if (hci_incoming_connect_request) {
+
682  watingForConnection = false;
+
683 #ifdef DEBUG_USB_HOST
+
684  Notify(PSTR("\r\nIncoming Connection Request"), 0x80);
+
685 #endif
+
686  hci_remote_name();
+
687  hci_state = HCI_REMOTE_NAME_STATE;
+
688  } else if (hci_disconnect_complete)
+
689  hci_state = HCI_DISCONNECT_STATE;
+
690  break;
+
691 
+
692  case HCI_REMOTE_NAME_STATE:
+
693  if (hci_remote_name_complete) {
+
694 #ifdef DEBUG_USB_HOST
+
695  Notify(PSTR("\r\nRemote Name: "), 0x80);
+
696  for (uint8_t i = 0; i < 30; i++) {
+
697  if (remote_name[i] == NULL)
+
698  break;
+
699  Notifyc(remote_name[i], 0x80);
+
700  }
+
701 #endif
+
702  if (strncmp((const char*)remote_name, "Nintendo", 8) == 0) {
+
703  incomingWii = true;
+
704 #ifdef DEBUG_USB_HOST
+
705  Notify(PSTR("\r\nWiimote is connecting"), 0x80);
+
706 #endif
+
707  if (strncmp((const char*)remote_name, "Nintendo RVL-CNT-01-TR", 22) == 0) {
+
708 #ifdef DEBUG_USB_HOST
+
709  Notify(PSTR(" with Motion Plus Inside"), 0x80);
+
710 #endif
+
711  motionPlusInside = true;
+
712  } else if (strncmp((const char*)remote_name, "Nintendo RVL-CNT-01-UC", 22) == 0) {
+
713 #ifdef DEBUG_USB_HOST
+
714  Notify(PSTR(" - Wii U Pro Controller"), 0x80);
+
715 #endif
+
716  motionPlusInside = true;
+
717  wiiUProController = true;
+
718  } else {
+
719  motionPlusInside = false;
+
720  wiiUProController = false;
+
721  }
+
722  }
+
723  if (pairWithWii && motionPlusInside)
+
724  hci_state = HCI_CONNECT_WII_STATE;
+
725  else {
+
726  hci_accept_connection();
+
727  hci_state = HCI_CONNECTED_STATE;
+
728  }
+
729  }
+
730  break;
731 
-
732  hci_event_flag = 0;
-
733  hci_state = HCI_DONE_STATE;
-
734  }
-
735  break;
-
736 
-
737  case HCI_DONE_STATE:
-
738  hci_counter++;
-
739  if (hci_counter > 1000) { // Wait until we have looped 1000 times to make sure that the L2CAP connection has been started
-
740  hci_counter = 0;
-
741  hci_state = HCI_SCANNING_STATE;
-
742  }
-
743  break;
-
744 
-
745  case HCI_DISCONNECT_STATE:
-
746  if (hci_disconnect_complete) {
-
747 #ifdef DEBUG
-
748  Notify(PSTR("\r\nHCI Disconnected from Device"), 0x80);
-
749 #endif
-
750  hci_event_flag = 0; // Clear all flags
+
732  case HCI_CONNECTED_STATE:
+
733  if (hci_connect_complete) {
+
734 #ifdef DEBUG_USB_HOST
+
735  Notify(PSTR("\r\nConnected to Device: "), 0x80);
+
736  for (int8_t i = 5; i > 0; i--) {
+
737  PrintHex<uint8_t > (disc_bdaddr[i], 0x80);
+
738  Notify(PSTR(":"), 0x80);
+
739  }
+
740  PrintHex<uint8_t > (disc_bdaddr[0], 0x80);
+
741 #endif
+
742  // Clear these flags for a new connection
+
743  l2capConnectionClaimed = false;
+
744  sdpConnectionClaimed = false;
+
745  rfcommConnectionClaimed = false;
+
746 
+
747  hci_event_flag = 0;
+
748  hci_state = HCI_DONE_STATE;
+
749  }
+
750  break;
751 
-
752  // Reset all buffers
-
753  for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)
-
754  hcibuf[i] = 0;
-
755  for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)
-
756  l2capinbuf[i] = 0;
-
757 
-
758  hci_state = HCI_SCANNING_STATE;
-
759  }
-
760  break;
-
761  default:
-
762  break;
-
763  }
-
764 }
-
765 
-
766 void BTD::ACL_event_task() {
-
767  uint16_t MAX_BUFFER_SIZE = BULK_MAXPKTSIZE;
-
768  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_DATAIN_PIPE ].epAddr, &MAX_BUFFER_SIZE, l2capinbuf); // input on endpoint 2
-
769  if (!rcode) { // Check for errors
-
770  for (uint8_t i = 0; i < BTD_NUMSERVICES; i++)
-
771  if (btService[i])
-
772  btService[i]->ACLData(l2capinbuf);
-
773  }
-
774 #ifdef EXTRADEBUG
-
775  else if (rcode != hrNAK) {
-
776  Notify(PSTR("\r\nACL data in error: "), 0x80);
-
777  PrintHex<uint8_t > (rcode, 0x80);
+
752  case HCI_DONE_STATE:
+
753  hci_counter++;
+
754  if (hci_counter > 1000) { // Wait until we have looped 1000 times to make sure that the L2CAP connection has been started
+
755  hci_counter = 0;
+
756  hci_state = HCI_SCANNING_STATE;
+
757  }
+
758  break;
+
759 
+
760  case HCI_DISCONNECT_STATE:
+
761  if (hci_disconnect_complete) {
+
762 #ifdef DEBUG_USB_HOST
+
763  Notify(PSTR("\r\nHCI Disconnected from Device"), 0x80);
+
764 #endif
+
765  hci_event_flag = 0; // Clear all flags
+
766 
+
767  // Reset all buffers
+
768  for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)
+
769  hcibuf[i] = 0;
+
770  for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)
+
771  l2capinbuf[i] = 0;
+
772 
+
773  hci_state = HCI_SCANNING_STATE;
+
774  }
+
775  break;
+
776  default:
+
777  break;
778  }
-
779 #endif
-
780  for (uint8_t i = 0; i < BTD_NUMSERVICES; i++)
-
781  if (btService[i])
-
782  btService[i]->Run();
-
783 }
-
784 
-
785 /************************************************************/
-
786 /* HCI Commands */
-
787 
-
788 /************************************************************/
-
789 void BTD::HCI_Command(uint8_t* data, uint16_t nbytes) {
-
790  hci_event_flag &= ~HCI_FLAG_CMD_COMPLETE;
-
791  pUsb->ctrlReq(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bmREQ_HCI_OUT, 0x00, 0x00, 0x00, 0x00, nbytes, nbytes, data, NULL);
-
792 }
-
793 
-
794 void BTD::hci_reset() {
-
795  hci_event_flag = 0; // Clear all the flags
-
796  hcibuf[0] = 0x03; // HCI OCF = 3
-
797  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
-
798  hcibuf[2] = 0x00;
+
779 }
+
780 
+
781 void BTD::ACL_event_task() {
+
782  uint16_t MAX_BUFFER_SIZE = BULK_MAXPKTSIZE;
+
783  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[ BTD_DATAIN_PIPE ].epAddr, &MAX_BUFFER_SIZE, l2capinbuf); // input on endpoint 2
+
784  if (!rcode) { // Check for errors
+
785  for (uint8_t i = 0; i < BTD_NUMSERVICES; i++)
+
786  if (btService[i])
+
787  btService[i]->ACLData(l2capinbuf);
+
788  }
+
789 #ifdef EXTRADEBUG
+
790  else if (rcode != hrNAK) {
+
791  Notify(PSTR("\r\nACL data in error: "), 0x80);
+
792  PrintHex<uint8_t > (rcode, 0x80);
+
793  }
+
794 #endif
+
795  for (uint8_t i = 0; i < BTD_NUMSERVICES; i++)
+
796  if (btService[i])
+
797  btService[i]->Run();
+
798 }
799 
-
800  HCI_Command(hcibuf, 3);
-
801 }
+
800 /************************************************************/
+
801 /* HCI Commands */
802 
-
803 void BTD::hci_write_scan_enable() {
-
804  hci_event_flag &= ~HCI_FLAG_INCOMING_REQUEST;
-
805  hcibuf[0] = 0x1A; // HCI OCF = 1A
-
806  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
-
807  hcibuf[2] = 0x01; // parameter length = 1
-
808  if (btdName != NULL)
-
809  hcibuf[3] = 0x03; // Inquiry Scan enabled. Page Scan enabled.
-
810  else
-
811  hcibuf[3] = 0x02; // Inquiry Scan disabled. Page Scan enabled.
-
812 
-
813  HCI_Command(hcibuf, 4);
-
814 }
-
815 
-
816 void BTD::hci_write_scan_disable() {
-
817  hcibuf[0] = 0x1A; // HCI OCF = 1A
-
818  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
-
819  hcibuf[2] = 0x01; // parameter length = 1
-
820  hcibuf[3] = 0x00; // Inquiry Scan disabled. Page Scan disabled.
-
821 
-
822  HCI_Command(hcibuf, 4);
-
823 }
-
824 
-
825 void BTD::hci_read_bdaddr() {
-
826  hcibuf[0] = 0x09; // HCI OCF = 9
-
827  hcibuf[1] = 0x04 << 2; // HCI OGF = 4
-
828  hcibuf[2] = 0x00;
-
829 
-
830  HCI_Command(hcibuf, 3);
-
831 }
-
832 
-
833 void BTD::hci_read_local_version_information() {
-
834  hcibuf[0] = 0x01; // HCI OCF = 1
-
835  hcibuf[1] = 0x04 << 2; // HCI OGF = 4
-
836  hcibuf[2] = 0x00;
-
837 
-
838  HCI_Command(hcibuf, 3);
-
839 }
-
840 
-
841 void BTD::hci_accept_connection() {
-
842  hci_event_flag &= ~HCI_FLAG_CONN_COMPLETE;
-
843  hcibuf[0] = 0x09; // HCI OCF = 9
-
844  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
-
845  hcibuf[2] = 0x07; // parameter length 7
-
846  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
-
847  hcibuf[4] = disc_bdaddr[1];
-
848  hcibuf[5] = disc_bdaddr[2];
-
849  hcibuf[6] = disc_bdaddr[3];
-
850  hcibuf[7] = disc_bdaddr[4];
-
851  hcibuf[8] = disc_bdaddr[5];
-
852  hcibuf[9] = 0x00; //switch role to master
-
853 
-
854  HCI_Command(hcibuf, 10);
-
855 }
-
856 
-
857 void BTD::hci_remote_name() {
-
858  hci_event_flag &= ~HCI_FLAG_REMOTE_NAME_COMPLETE;
-
859  hcibuf[0] = 0x19; // HCI OCF = 19
-
860  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
-
861  hcibuf[2] = 0x0A; // parameter length = 10
-
862  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
-
863  hcibuf[4] = disc_bdaddr[1];
-
864  hcibuf[5] = disc_bdaddr[2];
-
865  hcibuf[6] = disc_bdaddr[3];
-
866  hcibuf[7] = disc_bdaddr[4];
-
867  hcibuf[8] = disc_bdaddr[5];
-
868  hcibuf[9] = 0x01; //Page Scan Repetition Mode
-
869  hcibuf[10] = 0x00; //Reserved
-
870  hcibuf[11] = 0x00; //Clock offset - low byte
-
871  hcibuf[12] = 0x00; //Clock offset - high byte
-
872 
-
873  HCI_Command(hcibuf, 13);
-
874 }
-
875 
-
876 void BTD::hci_set_local_name(const char* name) {
-
877  hcibuf[0] = 0x13; // HCI OCF = 13
-
878  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
-
879  hcibuf[2] = strlen(name) + 1; // parameter length = the length of the string + end byte
-
880  uint8_t i;
-
881  for (i = 0; i < strlen(name); i++)
-
882  hcibuf[i + 3] = name[i];
-
883  hcibuf[i + 3] = 0x00; // End of string
-
884 
-
885  HCI_Command(hcibuf, 4 + strlen(name));
-
886 }
+
803 /************************************************************/
+
804 void BTD::HCI_Command(uint8_t* data, uint16_t nbytes) {
+
805  hci_event_flag &= ~HCI_FLAG_CMD_COMPLETE;
+
806  pUsb->ctrlReq(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bmREQ_HCI_OUT, 0x00, 0x00, 0x00, 0x00, nbytes, nbytes, data, NULL);
+
807 }
+
808 
+
809 void BTD::hci_reset() {
+
810  hci_event_flag = 0; // Clear all the flags
+
811  hcibuf[0] = 0x03; // HCI OCF = 3
+
812  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
+
813  hcibuf[2] = 0x00;
+
814 
+
815  HCI_Command(hcibuf, 3);
+
816 }
+
817 
+
818 void BTD::hci_write_scan_enable() {
+
819  hci_event_flag &= ~HCI_FLAG_INCOMING_REQUEST;
+
820  hcibuf[0] = 0x1A; // HCI OCF = 1A
+
821  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
+
822  hcibuf[2] = 0x01; // parameter length = 1
+
823  if (btdName != NULL)
+
824  hcibuf[3] = 0x03; // Inquiry Scan enabled. Page Scan enabled.
+
825  else
+
826  hcibuf[3] = 0x02; // Inquiry Scan disabled. Page Scan enabled.
+
827 
+
828  HCI_Command(hcibuf, 4);
+
829 }
+
830 
+
831 void BTD::hci_write_scan_disable() {
+
832  hcibuf[0] = 0x1A; // HCI OCF = 1A
+
833  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
+
834  hcibuf[2] = 0x01; // parameter length = 1
+
835  hcibuf[3] = 0x00; // Inquiry Scan disabled. Page Scan disabled.
+
836 
+
837  HCI_Command(hcibuf, 4);
+
838 }
+
839 
+
840 void BTD::hci_read_bdaddr() {
+
841  hcibuf[0] = 0x09; // HCI OCF = 9
+
842  hcibuf[1] = 0x04 << 2; // HCI OGF = 4
+
843  hcibuf[2] = 0x00;
+
844 
+
845  HCI_Command(hcibuf, 3);
+
846 }
+
847 
+
848 void BTD::hci_read_local_version_information() {
+
849  hcibuf[0] = 0x01; // HCI OCF = 1
+
850  hcibuf[1] = 0x04 << 2; // HCI OGF = 4
+
851  hcibuf[2] = 0x00;
+
852 
+
853  HCI_Command(hcibuf, 3);
+
854 }
+
855 
+
856 void BTD::hci_accept_connection() {
+
857  hci_event_flag &= ~HCI_FLAG_CONN_COMPLETE;
+
858  hcibuf[0] = 0x09; // HCI OCF = 9
+
859  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
+
860  hcibuf[2] = 0x07; // parameter length 7
+
861  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
+
862  hcibuf[4] = disc_bdaddr[1];
+
863  hcibuf[5] = disc_bdaddr[2];
+
864  hcibuf[6] = disc_bdaddr[3];
+
865  hcibuf[7] = disc_bdaddr[4];
+
866  hcibuf[8] = disc_bdaddr[5];
+
867  hcibuf[9] = 0x00; //switch role to master
+
868 
+
869  HCI_Command(hcibuf, 10);
+
870 }
+
871 
+
872 void BTD::hci_remote_name() {
+
873  hci_event_flag &= ~HCI_FLAG_REMOTE_NAME_COMPLETE;
+
874  hcibuf[0] = 0x19; // HCI OCF = 19
+
875  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
+
876  hcibuf[2] = 0x0A; // parameter length = 10
+
877  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
+
878  hcibuf[4] = disc_bdaddr[1];
+
879  hcibuf[5] = disc_bdaddr[2];
+
880  hcibuf[6] = disc_bdaddr[3];
+
881  hcibuf[7] = disc_bdaddr[4];
+
882  hcibuf[8] = disc_bdaddr[5];
+
883  hcibuf[9] = 0x01; //Page Scan Repetition Mode
+
884  hcibuf[10] = 0x00; //Reserved
+
885  hcibuf[11] = 0x00; //Clock offset - low byte
+
886  hcibuf[12] = 0x00; //Clock offset - high byte
887 
-
888 void BTD::hci_inquiry() {
-
889  hci_event_flag &= ~HCI_FLAG_WII_FOUND;
-
890  hcibuf[0] = 0x01;
-
891  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
-
892  hcibuf[2] = 0x05; // Parameter Total Length = 5
-
893  hcibuf[3] = 0x33; // LAP: Genera/Unlimited Inquiry Access Code (GIAC = 0x9E8B33) - see https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
-
894  hcibuf[4] = 0x8B;
-
895  hcibuf[5] = 0x9E;
-
896  hcibuf[6] = 0x30; // Inquiry time = 61.44 sec (maximum)
-
897  hcibuf[7] = 0x0A; // 10 number of responses
-
898 
-
899  HCI_Command(hcibuf, 8);
-
900 }
-
901 
-
902 void BTD::hci_inquiry_cancel() {
-
903  hcibuf[0] = 0x02;
-
904  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
-
905  hcibuf[2] = 0x00; // Parameter Total Length = 0
-
906 
-
907  HCI_Command(hcibuf, 3);
-
908 }
-
909 
-
910 void BTD::hci_connect() {
-
911  hci_event_flag &= ~(HCI_FLAG_CONN_COMPLETE | HCI_FLAG_CONNECT_EVENT);
-
912  hcibuf[0] = 0x05;
-
913  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
-
914  hcibuf[2] = 0x0D; // parameter Total Length = 13
-
915  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
-
916  hcibuf[4] = disc_bdaddr[1];
-
917  hcibuf[5] = disc_bdaddr[2];
-
918  hcibuf[6] = disc_bdaddr[3];
-
919  hcibuf[7] = disc_bdaddr[4];
-
920  hcibuf[8] = disc_bdaddr[5];
-
921  hcibuf[9] = 0x18; // DM1 or DH1 may be used
-
922  hcibuf[10] = 0xCC; // DM3, DH3, DM5, DH5 may be used
-
923  hcibuf[11] = 0x01; // Page repetition mode R1
-
924  hcibuf[12] = 0x00; // Reserved
-
925  hcibuf[13] = 0x00; // Clock offset
-
926  hcibuf[14] = 0x00; // Invalid clock offset
-
927  hcibuf[15] = 0x00; // Do not allow role switch
-
928 
-
929  HCI_Command(hcibuf, 16);
-
930 }
-
931 
-
932 void BTD::hci_pin_code_request_reply() {
-
933  hcibuf[0] = 0x0D; // HCI OCF = 0D
-
934  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
-
935  hcibuf[2] = 0x17; // parameter length 23
-
936  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
-
937  hcibuf[4] = disc_bdaddr[1];
-
938  hcibuf[5] = disc_bdaddr[2];
-
939  hcibuf[6] = disc_bdaddr[3];
-
940  hcibuf[7] = disc_bdaddr[4];
-
941  hcibuf[8] = disc_bdaddr[5];
-
942  if (pairWithWii) {
-
943  hcibuf[9] = 6; // Pin length is the length of the Bluetooth address
-
944  if(wiiUProController) {
-
945 #ifdef DEBUG
-
946  Notify(PSTR("\r\nParing with Wii U Pro Controller"), 0x80);
-
947 #endif
-
948  for(uint8_t i = 0; i < 6; i++)
-
949  hcibuf[10 + i] = my_bdaddr[i]; // The pin is the Bluetooth dongles Bluetooth address backwards
-
950  }
-
951  else {
-
952  for(uint8_t i = 0; i < 6; i++)
-
953  hcibuf[10 + i] = disc_bdaddr[i]; // The pin is the Wiimote's Bluetooth address backwards
-
954  }
-
955  for (uint8_t i = 16; i < 26; i++)
-
956  hcibuf[i] = 0x00; // The rest should be 0
-
957  } else {
-
958  hcibuf[9] = strlen(btdPin); // Length of pin
-
959  uint8_t i;
-
960  for (i = 0; i < strlen(btdPin); i++) // The maximum size of the pin is 16
-
961  hcibuf[i + 10] = btdPin[i];
-
962  for (; i < 16; i++)
-
963  hcibuf[i + 10] = 0x00; // The rest should be 0
-
964  }
-
965 
-
966  HCI_Command(hcibuf, 26);
-
967 }
-
968 
-
969 void BTD::hci_pin_code_negative_request_reply() {
-
970  hcibuf[0] = 0x0E; // HCI OCF = 0E
-
971  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
-
972  hcibuf[2] = 0x06; // parameter length 6
-
973  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
-
974  hcibuf[4] = disc_bdaddr[1];
-
975  hcibuf[5] = disc_bdaddr[2];
-
976  hcibuf[6] = disc_bdaddr[3];
-
977  hcibuf[7] = disc_bdaddr[4];
-
978  hcibuf[8] = disc_bdaddr[5];
+
888  HCI_Command(hcibuf, 13);
+
889 }
+
890 
+
891 void BTD::hci_set_local_name(const char* name) {
+
892  hcibuf[0] = 0x13; // HCI OCF = 13
+
893  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
+
894  hcibuf[2] = strlen(name) + 1; // parameter length = the length of the string + end byte
+
895  uint8_t i;
+
896  for (i = 0; i < strlen(name); i++)
+
897  hcibuf[i + 3] = name[i];
+
898  hcibuf[i + 3] = 0x00; // End of string
+
899 
+
900  HCI_Command(hcibuf, 4 + strlen(name));
+
901 }
+
902 
+
903 void BTD::hci_inquiry() {
+
904  hci_event_flag &= ~HCI_FLAG_WII_FOUND;
+
905  hcibuf[0] = 0x01;
+
906  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
+
907  hcibuf[2] = 0x05; // Parameter Total Length = 5
+
908  hcibuf[3] = 0x33; // LAP: Genera/Unlimited Inquiry Access Code (GIAC = 0x9E8B33) - see https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
+
909  hcibuf[4] = 0x8B;
+
910  hcibuf[5] = 0x9E;
+
911  hcibuf[6] = 0x30; // Inquiry time = 61.44 sec (maximum)
+
912  hcibuf[7] = 0x0A; // 10 number of responses
+
913 
+
914  HCI_Command(hcibuf, 8);
+
915 }
+
916 
+
917 void BTD::hci_inquiry_cancel() {
+
918  hcibuf[0] = 0x02;
+
919  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
+
920  hcibuf[2] = 0x00; // Parameter Total Length = 0
+
921 
+
922  HCI_Command(hcibuf, 3);
+
923 }
+
924 
+
925 void BTD::hci_connect() {
+
926  hci_event_flag &= ~(HCI_FLAG_CONN_COMPLETE | HCI_FLAG_CONNECT_EVENT);
+
927  hcibuf[0] = 0x05;
+
928  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
+
929  hcibuf[2] = 0x0D; // parameter Total Length = 13
+
930  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
+
931  hcibuf[4] = disc_bdaddr[1];
+
932  hcibuf[5] = disc_bdaddr[2];
+
933  hcibuf[6] = disc_bdaddr[3];
+
934  hcibuf[7] = disc_bdaddr[4];
+
935  hcibuf[8] = disc_bdaddr[5];
+
936  hcibuf[9] = 0x18; // DM1 or DH1 may be used
+
937  hcibuf[10] = 0xCC; // DM3, DH3, DM5, DH5 may be used
+
938  hcibuf[11] = 0x01; // Page repetition mode R1
+
939  hcibuf[12] = 0x00; // Reserved
+
940  hcibuf[13] = 0x00; // Clock offset
+
941  hcibuf[14] = 0x00; // Invalid clock offset
+
942  hcibuf[15] = 0x00; // Do not allow role switch
+
943 
+
944  HCI_Command(hcibuf, 16);
+
945 }
+
946 
+
947 void BTD::hci_pin_code_request_reply() {
+
948  hcibuf[0] = 0x0D; // HCI OCF = 0D
+
949  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
+
950  hcibuf[2] = 0x17; // parameter length 23
+
951  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
+
952  hcibuf[4] = disc_bdaddr[1];
+
953  hcibuf[5] = disc_bdaddr[2];
+
954  hcibuf[6] = disc_bdaddr[3];
+
955  hcibuf[7] = disc_bdaddr[4];
+
956  hcibuf[8] = disc_bdaddr[5];
+
957  if (pairWithWii) {
+
958  hcibuf[9] = 6; // Pin length is the length of the Bluetooth address
+
959  if (wiiUProController) {
+
960 #ifdef DEBUG_USB_HOST
+
961  Notify(PSTR("\r\nParing with Wii U Pro Controller"), 0x80);
+
962 #endif
+
963  for (uint8_t i = 0; i < 6; i++)
+
964  hcibuf[10 + i] = my_bdaddr[i]; // The pin is the Bluetooth dongles Bluetooth address backwards
+
965  } else {
+
966  for (uint8_t i = 0; i < 6; i++)
+
967  hcibuf[10 + i] = disc_bdaddr[i]; // The pin is the Wiimote's Bluetooth address backwards
+
968  }
+
969  for (uint8_t i = 16; i < 26; i++)
+
970  hcibuf[i] = 0x00; // The rest should be 0
+
971  } else {
+
972  hcibuf[9] = strlen(btdPin); // Length of pin
+
973  uint8_t i;
+
974  for (i = 0; i < strlen(btdPin); i++) // The maximum size of the pin is 16
+
975  hcibuf[i + 10] = btdPin[i];
+
976  for (; i < 16; i++)
+
977  hcibuf[i + 10] = 0x00; // The rest should be 0
+
978  }
979 
-
980  HCI_Command(hcibuf, 9);
+
980  HCI_Command(hcibuf, 26);
981 }
982 
-
983 void BTD::hci_link_key_request_negative_reply() {
-
984  hcibuf[0] = 0x0C; // HCI OCF = 0C
+
983 void BTD::hci_pin_code_negative_request_reply() {
+
984  hcibuf[0] = 0x0E; // HCI OCF = 0E
985  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
986  hcibuf[2] = 0x06; // parameter length 6
987  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
@@ -1085,236 +1085,250 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
994  HCI_Command(hcibuf, 9);
995 }
996 
-
997 void BTD::hci_authentication_request() {
-
998  hcibuf[0] = 0x11; // HCI OCF = 11
+
997 void BTD::hci_link_key_request_negative_reply() {
+
998  hcibuf[0] = 0x0C; // HCI OCF = 0C
999  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
-
1000  hcibuf[2] = 0x02; // parameter length = 2
-
1001  hcibuf[3] = (uint8_t)(hci_handle & 0xFF); //connection handle - low byte
-
1002  hcibuf[4] = (uint8_t)((hci_handle >> 8) & 0x0F); //connection handle - high byte
-
1003 
-
1004  HCI_Command(hcibuf, 5);
-
1005 }
-
1006 
-
1007 void BTD::hci_disconnect(uint16_t handle) { // This is called by the different services
-
1008  hci_event_flag &= ~HCI_FLAG_DISCONN_COMPLETE;
-
1009  hcibuf[0] = 0x06; // HCI OCF = 6
-
1010  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
-
1011  hcibuf[2] = 0x03; // parameter length = 3
-
1012  hcibuf[3] = (uint8_t)(handle & 0xFF); //connection handle - low byte
-
1013  hcibuf[4] = (uint8_t)((handle >> 8) & 0x0F); //connection handle - high byte
-
1014  hcibuf[5] = 0x13; // reason
-
1015 
-
1016  HCI_Command(hcibuf, 6);
-
1017 }
-
1018 
-
1019 void BTD::hci_write_class_of_device() { // See http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html
-
1020  hcibuf[0] = 0x24; // HCI OCF = 3
-
1021  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
-
1022  hcibuf[2] = 0x03; // parameter length = 3
-
1023  hcibuf[3] = 0x04; // Robot
-
1024  hcibuf[4] = 0x08; // Toy
-
1025  hcibuf[5] = 0x00;
-
1026 
-
1027  HCI_Command(hcibuf, 6);
-
1028 }
-
1029 /*******************************************************************
-
1030  * *
-
1031  * HCI ACL Data Packet *
-
1032  * *
-
1033  * buf[0] buf[1] buf[2] buf[3]
-
1034  * 0 4 8 11 12 16 24 31 MSB
-
1035  * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
-
1036  * | HCI Handle |PB |BC | Data Total Length | HCI ACL Data Packet
-
1037  * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
-
1038  *
-
1039  * buf[4] buf[5] buf[6] buf[7]
-
1040  * 0 8 16 31 MSB
-
1041  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
-
1042  * | Length | Channel ID | Basic L2CAP header
-
1043  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
-
1044  *
-
1045  * buf[8] buf[9] buf[10] buf[11]
-
1046  * 0 8 16 31 MSB
-
1047  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
-
1048  * | Code | Identifier | Length | Control frame (C-frame)
-
1049  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. (signaling packet format)
-
1050  */
-
1051 /************************************************************/
-
1052 /* L2CAP Commands */
-
1053 
-
1054 /************************************************************/
-
1055 void BTD::L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow, uint8_t channelHigh) {
-
1056  uint8_t buf[8 + nbytes];
-
1057  buf[0] = (uint8_t)(handle & 0xff); // HCI handle with PB,BC flag
-
1058  buf[1] = (uint8_t)(((handle >> 8) & 0x0f) | 0x20);
-
1059  buf[2] = (uint8_t)((4 + nbytes) & 0xff); // HCI ACL total data length
-
1060  buf[3] = (uint8_t)((4 + nbytes) >> 8);
-
1061  buf[4] = (uint8_t)(nbytes & 0xff); // L2CAP header: Length
-
1062  buf[5] = (uint8_t)(nbytes >> 8);
-
1063  buf[6] = channelLow;
-
1064  buf[7] = channelHigh;
-
1065 
-
1066  for (uint16_t i = 0; i < nbytes; i++) // L2CAP C-frame
-
1067  buf[8 + i] = data[i];
-
1068 
-
1069  uint8_t rcode = pUsb->outTransfer(bAddress, epInfo[ BTD_DATAOUT_PIPE ].epAddr, (8 + nbytes), buf);
-
1070  if (rcode) {
-
1071  delay(100); // This small delay prevents it from overflowing if it fails
-
1072 #ifdef DEBUG
-
1073  Notify(PSTR("\r\nError sending L2CAP message: 0x"), 0x80);
-
1074  PrintHex<uint8_t > (rcode, 0x80);
-
1075  Notify(PSTR(" - Channel ID: "), 0x80);
-
1076  PrintHex<uint8_t > (channelHigh, 0x80);
-
1077  Notify(PSTR(" "), 0x80);
-
1078  PrintHex<uint8_t > (channelLow, 0x80);
-
1079 #endif
-
1080  }
-
1081 }
+
1000  hcibuf[2] = 0x06; // parameter length 6
+
1001  hcibuf[3] = disc_bdaddr[0]; // 6 octet bdaddr
+
1002  hcibuf[4] = disc_bdaddr[1];
+
1003  hcibuf[5] = disc_bdaddr[2];
+
1004  hcibuf[6] = disc_bdaddr[3];
+
1005  hcibuf[7] = disc_bdaddr[4];
+
1006  hcibuf[8] = disc_bdaddr[5];
+
1007 
+
1008  HCI_Command(hcibuf, 9);
+
1009 }
+
1010 
+
1011 void BTD::hci_authentication_request() {
+
1012  hcibuf[0] = 0x11; // HCI OCF = 11
+
1013  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
+
1014  hcibuf[2] = 0x02; // parameter length = 2
+
1015  hcibuf[3] = (uint8_t)(hci_handle & 0xFF); //connection handle - low byte
+
1016  hcibuf[4] = (uint8_t)((hci_handle >> 8) & 0x0F); //connection handle - high byte
+
1017 
+
1018  HCI_Command(hcibuf, 5);
+
1019 }
+
1020 
+
1021 void BTD::hci_disconnect(uint16_t handle) { // This is called by the different services
+
1022  hci_event_flag &= ~HCI_FLAG_DISCONN_COMPLETE;
+
1023  hcibuf[0] = 0x06; // HCI OCF = 6
+
1024  hcibuf[1] = 0x01 << 2; // HCI OGF = 1
+
1025  hcibuf[2] = 0x03; // parameter length = 3
+
1026  hcibuf[3] = (uint8_t)(handle & 0xFF); //connection handle - low byte
+
1027  hcibuf[4] = (uint8_t)((handle >> 8) & 0x0F); //connection handle - high byte
+
1028  hcibuf[5] = 0x13; // reason
+
1029 
+
1030  HCI_Command(hcibuf, 6);
+
1031 }
+
1032 
+
1033 void BTD::hci_write_class_of_device() { // See http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html
+
1034  hcibuf[0] = 0x24; // HCI OCF = 3
+
1035  hcibuf[1] = 0x03 << 2; // HCI OGF = 3
+
1036  hcibuf[2] = 0x03; // parameter length = 3
+
1037  hcibuf[3] = 0x04; // Robot
+
1038  hcibuf[4] = 0x08; // Toy
+
1039  hcibuf[5] = 0x00;
+
1040 
+
1041  HCI_Command(hcibuf, 6);
+
1042 }
+
1043 /*******************************************************************
+
1044  * *
+
1045  * HCI ACL Data Packet *
+
1046  * *
+
1047  * buf[0] buf[1] buf[2] buf[3]
+
1048  * 0 4 8 11 12 16 24 31 MSB
+
1049  * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
+
1050  * | HCI Handle |PB |BC | Data Total Length | HCI ACL Data Packet
+
1051  * .-+-+-+-+-+-+-+-|-+-+-+-|-+-|-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
+
1052  *
+
1053  * buf[4] buf[5] buf[6] buf[7]
+
1054  * 0 8 16 31 MSB
+
1055  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
+
1056  * | Length | Channel ID | Basic L2CAP header
+
1057  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
+
1058  *
+
1059  * buf[8] buf[9] buf[10] buf[11]
+
1060  * 0 8 16 31 MSB
+
1061  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-.
+
1062  * | Code | Identifier | Length | Control frame (C-frame)
+
1063  * .-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-. (signaling packet format)
+
1064  */
+
1065 /************************************************************/
+
1066 /* L2CAP Commands */
+
1067 
+
1068 /************************************************************/
+
1069 void BTD::L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow, uint8_t channelHigh) {
+
1070  uint8_t buf[8 + nbytes];
+
1071  buf[0] = (uint8_t)(handle & 0xff); // HCI handle with PB,BC flag
+
1072  buf[1] = (uint8_t)(((handle >> 8) & 0x0f) | 0x20);
+
1073  buf[2] = (uint8_t)((4 + nbytes) & 0xff); // HCI ACL total data length
+
1074  buf[3] = (uint8_t)((4 + nbytes) >> 8);
+
1075  buf[4] = (uint8_t)(nbytes & 0xff); // L2CAP header: Length
+
1076  buf[5] = (uint8_t)(nbytes >> 8);
+
1077  buf[6] = channelLow;
+
1078  buf[7] = channelHigh;
+
1079 
+
1080  for (uint16_t i = 0; i < nbytes; i++) // L2CAP C-frame
+
1081  buf[8 + i] = data[i];
1082 
-
1083 void BTD::l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t* scid, uint16_t psm) {
-
1084  l2capoutbuf[0] = L2CAP_CMD_CONNECTION_REQUEST; // Code
-
1085  l2capoutbuf[1] = rxid; // Identifier
-
1086  l2capoutbuf[2] = 0x04; // Length
-
1087  l2capoutbuf[3] = 0x00;
-
1088  l2capoutbuf[4] = (uint8_t)(psm & 0xff); // PSM
-
1089  l2capoutbuf[5] = (uint8_t)(psm >> 8);
-
1090  l2capoutbuf[6] = scid[0]; // Source CID
-
1091  l2capoutbuf[7] = scid[1];
-
1092 
-
1093  L2CAP_Command(handle, l2capoutbuf, 8);
-
1094 }
-
1095 
-
1096 void BTD::l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid, uint8_t result) {
-
1097  l2capoutbuf[0] = L2CAP_CMD_CONNECTION_RESPONSE; // Code
-
1098  l2capoutbuf[1] = rxid; // Identifier
-
1099  l2capoutbuf[2] = 0x08; // Length
-
1100  l2capoutbuf[3] = 0x00;
-
1101  l2capoutbuf[4] = dcid[0]; // Destination CID
-
1102  l2capoutbuf[5] = dcid[1];
-
1103  l2capoutbuf[6] = scid[0]; // Source CID
-
1104  l2capoutbuf[7] = scid[1];
-
1105  l2capoutbuf[8] = result; // Result: Pending or Success
-
1106  l2capoutbuf[9] = 0x00;
-
1107  l2capoutbuf[10] = 0x00; // No further information
-
1108  l2capoutbuf[11] = 0x00;
+
1083  uint8_t rcode = pUsb->outTransfer(bAddress, epInfo[ BTD_DATAOUT_PIPE ].epAddr, (8 + nbytes), buf);
+
1084  if (rcode) {
+
1085  delay(100); // This small delay prevents it from overflowing if it fails
+
1086 #ifdef DEBUG_USB_HOST
+
1087  Notify(PSTR("\r\nError sending L2CAP message: 0x"), 0x80);
+
1088  PrintHex<uint8_t > (rcode, 0x80);
+
1089  Notify(PSTR(" - Channel ID: "), 0x80);
+
1090  PrintHex<uint8_t > (channelHigh, 0x80);
+
1091  Notify(PSTR(" "), 0x80);
+
1092  PrintHex<uint8_t > (channelLow, 0x80);
+
1093 #endif
+
1094  }
+
1095 }
+
1096 
+
1097 void BTD::l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t* scid, uint16_t psm) {
+
1098  l2capoutbuf[0] = L2CAP_CMD_CONNECTION_REQUEST; // Code
+
1099  l2capoutbuf[1] = rxid; // Identifier
+
1100  l2capoutbuf[2] = 0x04; // Length
+
1101  l2capoutbuf[3] = 0x00;
+
1102  l2capoutbuf[4] = (uint8_t)(psm & 0xff); // PSM
+
1103  l2capoutbuf[5] = (uint8_t)(psm >> 8);
+
1104  l2capoutbuf[6] = scid[0]; // Source CID
+
1105  l2capoutbuf[7] = scid[1];
+
1106 
+
1107  L2CAP_Command(handle, l2capoutbuf, 8);
+
1108 }
1109 
-
1110  L2CAP_Command(handle, l2capoutbuf, 12);
-
1111 }
-
1112 
-
1113 void BTD::l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t* dcid) {
-
1114  l2capoutbuf[0] = L2CAP_CMD_CONFIG_REQUEST; // Code
-
1115  l2capoutbuf[1] = rxid; // Identifier
-
1116  l2capoutbuf[2] = 0x08; // Length
-
1117  l2capoutbuf[3] = 0x00;
-
1118  l2capoutbuf[4] = dcid[0]; // Destination CID
-
1119  l2capoutbuf[5] = dcid[1];
-
1120  l2capoutbuf[6] = 0x00; // Flags
-
1121  l2capoutbuf[7] = 0x00;
-
1122  l2capoutbuf[8] = 0x01; // Config Opt: type = MTU (Maximum Transmission Unit) - Hint
-
1123  l2capoutbuf[9] = 0x02; // Config Opt: length
-
1124  l2capoutbuf[10] = 0xFF; // MTU
-
1125  l2capoutbuf[11] = 0xFF;
+
1110 void BTD::l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid, uint8_t result) {
+
1111  l2capoutbuf[0] = L2CAP_CMD_CONNECTION_RESPONSE; // Code
+
1112  l2capoutbuf[1] = rxid; // Identifier
+
1113  l2capoutbuf[2] = 0x08; // Length
+
1114  l2capoutbuf[3] = 0x00;
+
1115  l2capoutbuf[4] = dcid[0]; // Destination CID
+
1116  l2capoutbuf[5] = dcid[1];
+
1117  l2capoutbuf[6] = scid[0]; // Source CID
+
1118  l2capoutbuf[7] = scid[1];
+
1119  l2capoutbuf[8] = result; // Result: Pending or Success
+
1120  l2capoutbuf[9] = 0x00;
+
1121  l2capoutbuf[10] = 0x00; // No further information
+
1122  l2capoutbuf[11] = 0x00;
+
1123 
+
1124  L2CAP_Command(handle, l2capoutbuf, 12);
+
1125 }
1126 
-
1127  L2CAP_Command(handle, l2capoutbuf, 12);
-
1128 }
-
1129 
-
1130 void BTD::l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t* scid) {
-
1131  l2capoutbuf[0] = L2CAP_CMD_CONFIG_RESPONSE; // Code
-
1132  l2capoutbuf[1] = rxid; // Identifier
-
1133  l2capoutbuf[2] = 0x0A; // Length
-
1134  l2capoutbuf[3] = 0x00;
-
1135  l2capoutbuf[4] = scid[0]; // Source CID
-
1136  l2capoutbuf[5] = scid[1];
-
1137  l2capoutbuf[6] = 0x00; // Flag
-
1138  l2capoutbuf[7] = 0x00;
-
1139  l2capoutbuf[8] = 0x00; // Result
-
1140  l2capoutbuf[9] = 0x00;
-
1141  l2capoutbuf[10] = 0x01; // Config
-
1142  l2capoutbuf[11] = 0x02;
-
1143  l2capoutbuf[12] = 0xA0;
-
1144  l2capoutbuf[13] = 0x02;
-
1145 
-
1146  L2CAP_Command(handle, l2capoutbuf, 14);
-
1147 }
-
1148 
-
1149 void BTD::l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid) {
-
1150  l2capoutbuf[0] = L2CAP_CMD_DISCONNECT_REQUEST; // Code
-
1151  l2capoutbuf[1] = rxid; // Identifier
-
1152  l2capoutbuf[2] = 0x04; // Length
-
1153  l2capoutbuf[3] = 0x00;
-
1154  l2capoutbuf[4] = dcid[0];
-
1155  l2capoutbuf[5] = dcid[1];
-
1156  l2capoutbuf[6] = scid[0];
-
1157  l2capoutbuf[7] = scid[1];
-
1158 
-
1159  L2CAP_Command(handle, l2capoutbuf, 8);
-
1160 }
-
1161 
-
1162 void BTD::l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid) {
-
1163  l2capoutbuf[0] = L2CAP_CMD_DISCONNECT_RESPONSE; // Code
-
1164  l2capoutbuf[1] = rxid; // Identifier
-
1165  l2capoutbuf[2] = 0x04; // Length
-
1166  l2capoutbuf[3] = 0x00;
-
1167  l2capoutbuf[4] = dcid[0];
-
1168  l2capoutbuf[5] = dcid[1];
-
1169  l2capoutbuf[6] = scid[0];
-
1170  l2capoutbuf[7] = scid[1];
-
1171 
-
1172  L2CAP_Command(handle, l2capoutbuf, 8);
-
1173 }
-
1174 
-
1175 void BTD::l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh) {
-
1176  l2capoutbuf[0] = L2CAP_CMD_INFORMATION_RESPONSE; // Code
-
1177  l2capoutbuf[1] = rxid; // Identifier
-
1178  l2capoutbuf[2] = 0x08; // Length
-
1179  l2capoutbuf[3] = 0x00;
-
1180  l2capoutbuf[4] = infoTypeLow;
-
1181  l2capoutbuf[5] = infoTypeHigh;
-
1182  l2capoutbuf[6] = 0x00; // Result = success
-
1183  l2capoutbuf[7] = 0x00; // Result = success
-
1184  l2capoutbuf[8] = 0x00;
-
1185  l2capoutbuf[9] = 0x00;
-
1186  l2capoutbuf[10] = 0x00;
-
1187  l2capoutbuf[11] = 0x00;
+
1127 void BTD::l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t* dcid) {
+
1128  l2capoutbuf[0] = L2CAP_CMD_CONFIG_REQUEST; // Code
+
1129  l2capoutbuf[1] = rxid; // Identifier
+
1130  l2capoutbuf[2] = 0x08; // Length
+
1131  l2capoutbuf[3] = 0x00;
+
1132  l2capoutbuf[4] = dcid[0]; // Destination CID
+
1133  l2capoutbuf[5] = dcid[1];
+
1134  l2capoutbuf[6] = 0x00; // Flags
+
1135  l2capoutbuf[7] = 0x00;
+
1136  l2capoutbuf[8] = 0x01; // Config Opt: type = MTU (Maximum Transmission Unit) - Hint
+
1137  l2capoutbuf[9] = 0x02; // Config Opt: length
+
1138  l2capoutbuf[10] = 0xFF; // MTU
+
1139  l2capoutbuf[11] = 0xFF;
+
1140 
+
1141  L2CAP_Command(handle, l2capoutbuf, 12);
+
1142 }
+
1143 
+
1144 void BTD::l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t* scid) {
+
1145  l2capoutbuf[0] = L2CAP_CMD_CONFIG_RESPONSE; // Code
+
1146  l2capoutbuf[1] = rxid; // Identifier
+
1147  l2capoutbuf[2] = 0x0A; // Length
+
1148  l2capoutbuf[3] = 0x00;
+
1149  l2capoutbuf[4] = scid[0]; // Source CID
+
1150  l2capoutbuf[5] = scid[1];
+
1151  l2capoutbuf[6] = 0x00; // Flag
+
1152  l2capoutbuf[7] = 0x00;
+
1153  l2capoutbuf[8] = 0x00; // Result
+
1154  l2capoutbuf[9] = 0x00;
+
1155  l2capoutbuf[10] = 0x01; // Config
+
1156  l2capoutbuf[11] = 0x02;
+
1157  l2capoutbuf[12] = 0xA0;
+
1158  l2capoutbuf[13] = 0x02;
+
1159 
+
1160  L2CAP_Command(handle, l2capoutbuf, 14);
+
1161 }
+
1162 
+
1163 void BTD::l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid) {
+
1164  l2capoutbuf[0] = L2CAP_CMD_DISCONNECT_REQUEST; // Code
+
1165  l2capoutbuf[1] = rxid; // Identifier
+
1166  l2capoutbuf[2] = 0x04; // Length
+
1167  l2capoutbuf[3] = 0x00;
+
1168  l2capoutbuf[4] = dcid[0];
+
1169  l2capoutbuf[5] = dcid[1];
+
1170  l2capoutbuf[6] = scid[0];
+
1171  l2capoutbuf[7] = scid[1];
+
1172 
+
1173  L2CAP_Command(handle, l2capoutbuf, 8);
+
1174 }
+
1175 
+
1176 void BTD::l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t* dcid, uint8_t* scid) {
+
1177  l2capoutbuf[0] = L2CAP_CMD_DISCONNECT_RESPONSE; // Code
+
1178  l2capoutbuf[1] = rxid; // Identifier
+
1179  l2capoutbuf[2] = 0x04; // Length
+
1180  l2capoutbuf[3] = 0x00;
+
1181  l2capoutbuf[4] = dcid[0];
+
1182  l2capoutbuf[5] = dcid[1];
+
1183  l2capoutbuf[6] = scid[0];
+
1184  l2capoutbuf[7] = scid[1];
+
1185 
+
1186  L2CAP_Command(handle, l2capoutbuf, 8);
+
1187 }
1188 
-
1189  L2CAP_Command(handle, l2capoutbuf, 12);
-
1190 }
-
1191 
-
1192 /* PS3 Commands - only set Bluetooth address is implemented in this library */
-
1193 void BTD::setBdaddr(uint8_t* bdaddr) {
-
1194  /* Set the internal Bluetooth address */
-
1195  uint8_t buf[8];
-
1196  buf[0] = 0x01;
-
1197  buf[1] = 0x00;
-
1198 
-
1199  for (uint8_t i = 0; i < 6; i++)
-
1200  buf[i + 2] = bdaddr[5 - i]; // Copy into buffer, has to be written reversed
-
1201 
-
1202  // 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)
-
1203  pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
+
1189 void BTD::l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh) {
+
1190  l2capoutbuf[0] = L2CAP_CMD_INFORMATION_RESPONSE; // Code
+
1191  l2capoutbuf[1] = rxid; // Identifier
+
1192  l2capoutbuf[2] = 0x08; // Length
+
1193  l2capoutbuf[3] = 0x00;
+
1194  l2capoutbuf[4] = infoTypeLow;
+
1195  l2capoutbuf[5] = infoTypeHigh;
+
1196  l2capoutbuf[6] = 0x00; // Result = success
+
1197  l2capoutbuf[7] = 0x00; // Result = success
+
1198  l2capoutbuf[8] = 0x00;
+
1199  l2capoutbuf[9] = 0x00;
+
1200  l2capoutbuf[10] = 0x00;
+
1201  l2capoutbuf[11] = 0x00;
+
1202 
+
1203  L2CAP_Command(handle, l2capoutbuf, 12);
1204 }
1205 
-
1206 void BTD::setMoveBdaddr(uint8_t* bdaddr) {
-
1207  /* Set the internal Bluetooth address */
-
1208  uint8_t buf[11];
-
1209  buf[0] = 0x05;
-
1210  buf[7] = 0x10;
-
1211  buf[8] = 0x01;
-
1212  buf[9] = 0x02;
-
1213  buf[10] = 0x12;
-
1214 
-
1215  for (uint8_t i = 0; i < 6; i++)
-
1216  buf[i + 1] = bdaddr[i];
-
1217 
-
1218  // 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)
-
1219  pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
-
1220 }
+
1206 /* PS3 Commands - only set Bluetooth address is implemented in this library */
+
1207 void BTD::setBdaddr(uint8_t* bdaddr) {
+
1208  /* Set the internal Bluetooth address */
+
1209  uint8_t buf[8];
+
1210  buf[0] = 0x01;
+
1211  buf[1] = 0x00;
+
1212 
+
1213  for (uint8_t i = 0; i < 6; i++)
+
1214  buf[i + 2] = bdaddr[5 - i]; // Copy into buffer, has to be written reversed
+
1215 
+
1216  // 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)
+
1217  pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
+
1218 }
+
1219 
+
1220 void BTD::setMoveBdaddr(uint8_t* bdaddr) {
+
1221  /* Set the internal Bluetooth address */
+
1222  uint8_t buf[11];
+
1223  buf[0] = 0x05;
+
1224  buf[7] = 0x10;
+
1225  buf[8] = 0x01;
+
1226  buf[9] = 0x02;
+
1227  buf[10] = 0x12;
+
1228 
+
1229  for (uint8_t i = 0; i < 6; i++)
+
1230  buf[i + 1] = bdaddr[i];
+
1231 
+
1232  // 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)
+
1233  pUsb->ctrlReq(bAddress, epInfo[BTD_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
+
1234 }
diff --git a/_b_t_d_8h.html b/_b_t_d_8h.html index 3618fcaf..54c808bc 100644 --- a/_b_t_d_8h.html +++ b/_b_t_d_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: BTD.h File Reference @@ -31,7 +31,7 @@ - + @@ -99,7 +99,7 @@ Include dependency graph for BTD.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -1471,7 +1471,7 @@ Macros diff --git a/_b_t_d_8h__incl.map b/_b_t_d_8h__incl.map index b1b5ac88..8a52951b 100644 --- a/_b_t_d_8h__incl.map +++ b/_b_t_d_8h__incl.map @@ -1,13 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/_b_t_d_8h__incl.md5 b/_b_t_d_8h__incl.md5 index 382c02d0..d987e4ae 100644 --- a/_b_t_d_8h__incl.md5 +++ b/_b_t_d_8h__incl.md5 @@ -1 +1 @@ -5127aae891f6acd678ae45f8beb12100 \ No newline at end of file +7590baa2d3759abe3fcc949b887c64ce \ No newline at end of file diff --git a/_b_t_d_8h__incl.png b/_b_t_d_8h__incl.png index b2bb9022..731cb4c9 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 29f33bd9..98170bb6 100644 --- a/_b_t_d_8h_source.html +++ b/_b_t_d_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: BTD.h Source File @@ -31,7 +31,7 @@
- + @@ -220,7 +220,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
129 #define WI_PROTOCOL_BT 0x01 // Bluetooth Programming Interface
130 
131 #define BTD_MAX_ENDPOINTS 4
-
132 #define BTD_NUMSERVICES 4 // Max number of Bluetooth services
+
132 #define BTD_NUMSERVICES 4 // Max number of Bluetooth services - if you need more than four simply increase this number
133 
135 class BluetoothService {
136 public:
@@ -364,7 +364,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 629ed785..dbf1f81a 100644 --- a/_p_s3_b_t_8cpp.html +++ b/_p_s3_b_t_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3BT.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -85,8 +85,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
-Macros
PS3BT.cpp File Reference
@@ -97,37 +95,16 @@ Include dependency graph for PS3BT.cpp:
- +

Go to the source code of this file.

- - - - -

-Macros

#define DEBUG
 
-

Macro Definition Documentation

- -
-
- - - - -
#define DEBUG
-
- -

Definition at line 19 of file PS3BT.cpp.

- -
-
diff --git a/_p_s3_b_t_8cpp__incl.map b/_p_s3_b_t_8cpp__incl.map index ce2a3059..40e4f610 100644 --- a/_p_s3_b_t_8cpp__incl.map +++ b/_p_s3_b_t_8cpp__incl.map @@ -1,17 +1,17 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/_p_s3_b_t_8cpp__incl.md5 b/_p_s3_b_t_8cpp__incl.md5 index a94f55d0..cf2a8d92 100644 --- a/_p_s3_b_t_8cpp__incl.md5 +++ b/_p_s3_b_t_8cpp__incl.md5 @@ -1 +1 @@ -aee95b9f8dc4f9ab59f10b0141c407bb \ No newline at end of file +b3ed17f5aee67e9e9bf7a1eeff08c5fa \ 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 45dbeeef..1f951600 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 55094f6a..b6239ae1 100644 --- a/_p_s3_b_t_8cpp_source.html +++ b/_p_s3_b_t_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3BT.cpp Source File @@ -31,7 +31,7 @@ - + @@ -107,8 +107,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
16  */
17 
18 #include "PS3BT.h"
-
19 #define DEBUG // Uncomment to print data for debugging
-
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
+
19 // To enable serial debugging uncomment "#define DEBUG_USB_HOST" in message.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) :
@@ -346,11 +346,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
255  l2cap_state = L2CAP_WAIT;
256  for (uint8_t i = 0; i < 30; i++)
257  remote_name[i] = pBtd->remote_name[i]; // Store the remote name for the connection
-
258 #ifdef DEBUG
+
258 #ifdef DEBUG_USB_HOST
259  if (pBtd->hci_version < 3) { // Check the HCI Version of the Bluetooth dongle
-
260  Notify(PSTR("\r\nYour dongle may not support reading the analog buttons, sensors and status\r\nYour HCI Version is: "), 0x80);
-
261  Notify(pBtd->hci_version, 0x80);
-
262  Notify(PSTR("\r\nBut should be at least 3\r\nThis means that it doesn't support Bluetooth Version 2.0+EDR"), 0x80);
+
260  Notify(PSTR("\r\nYour dongle may not support reading the analog buttons, sensors and status\r\nYour HCI Version is: "), 0x80);
+
261  Notify(pBtd->hci_version, 0x80);
+
262  Notify(PSTR("\r\nBut should be at least 3\r\nThis means that it doesn't support Bluetooth Version 2.0+EDR"), 0x80);
263  }
264 #endif
265  }
@@ -361,31 +361,31 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
270  l2capinbuf[i] = ACLData[i];
271  if ((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001) { //l2cap_control - Channel ID for ACL-U
272  if (l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
-
273 #ifdef DEBUG
-
274  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
+
273 #ifdef DEBUG_USB_HOST
+
274  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
275  PrintHex<uint8_t > (l2capinbuf[13], 0x80);
-
276  Notify(PSTR(" "), 0x80);
+
276  Notify(PSTR(" "), 0x80);
277  PrintHex<uint8_t > (l2capinbuf[12], 0x80);
-
278  Notify(PSTR(" Data: "), 0x80);
+
278  Notify(PSTR(" Data: "), 0x80);
279  PrintHex<uint8_t > (l2capinbuf[17], 0x80);
-
280  Notify(PSTR(" "), 0x80);
+
280  Notify(PSTR(" "), 0x80);
281  PrintHex<uint8_t > (l2capinbuf[16], 0x80);
-
282  Notify(PSTR(" "), 0x80);
+
282  Notify(PSTR(" "), 0x80);
283  PrintHex<uint8_t > (l2capinbuf[15], 0x80);
-
284  Notify(PSTR(" "), 0x80);
+
284  Notify(PSTR(" "), 0x80);
285  PrintHex<uint8_t > (l2capinbuf[14], 0x80);
286 #endif
287  } else if (l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
288 #ifdef EXTRADEBUG
-
289  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
+
289  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
290  PrintHex<uint8_t > (l2capinbuf[13], 0x80);
-
291  Notify(PSTR(" "), 0x80);
+
291  Notify(PSTR(" "), 0x80);
292  PrintHex<uint8_t > (l2capinbuf[12], 0x80);
-
293  Notify(PSTR(" SCID: "), 0x80);
+
293  Notify(PSTR(" SCID: "), 0x80);
294  PrintHex<uint8_t > (l2capinbuf[15], 0x80);
-
295  Notify(PSTR(" "), 0x80);
+
295  Notify(PSTR(" "), 0x80);
296  PrintHex<uint8_t > (l2capinbuf[14], 0x80);
-
297  Notify(PSTR(" Identifier: "), 0x80);
+
297  Notify(PSTR(" Identifier: "), 0x80);
298  PrintHex<uint8_t > (l2capinbuf[9], 0x80);
299 #endif
300  if ((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
@@ -421,15 +421,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
330  }
331  } else if (l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
332  if (l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
-
333 #ifdef DEBUG
-
334  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
+
333 #ifdef DEBUG_USB_HOST
+
334  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
335 #endif
336  identifier = l2capinbuf[9];
337  pBtd->l2cap_disconnection_response(hci_handle, identifier, control_dcid, control_scid);
338  Reset();
339  } else if (l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
-
340 #ifdef DEBUG
-
341  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
+
340 #ifdef DEBUG_USB_HOST
+
341  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
342 #endif
343  identifier = l2capinbuf[9];
344  pBtd->l2cap_disconnection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid);
@@ -448,7 +448,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
357  }
358 #ifdef EXTRADEBUG
359  else {
-
360  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
+
360  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
361  PrintHex<uint8_t > (l2capinbuf[8], 0x80);
362  }
363 #endif
@@ -473,9 +473,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
382 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
383  for (uint8_t i = 10; i < 58; i++) {
384  PrintHex<uint8_t > (l2capinbuf[i], 0x80);
-
385  Notify(PSTR(" "), 0x80);
+
385  Notify(PSTR(" "), 0x80);
386  }
-
387  Notify(PSTR("\r\n"), 0x80);
+
387  Notify(PSTR("\r\n"), 0x80);
388 #endif
389  }
390  }
@@ -488,8 +488,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
397  switch (l2cap_state) {
398  case L2CAP_WAIT:
399  if (l2cap_connection_request_control_flag) {
-
400 #ifdef DEBUG
-
401  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
+
400 #ifdef DEBUG_USB_HOST
+
401  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
402 #endif
403  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, PENDING);
404  delay(1);
@@ -502,8 +502,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
411  break;
412  case L2CAP_CONTROL_REQUEST:
413  if (l2cap_config_request_control_flag) {
-
414 #ifdef DEBUG
-
415  Notify(PSTR("\r\nHID Control Configuration Request"), 0x80);
+
414 #ifdef DEBUG_USB_HOST
+
415  Notify(PSTR("\r\nHID Control Configuration Request"), 0x80);
416 #endif
417  pBtd->l2cap_config_response(hci_handle, identifier, control_scid);
418  l2cap_state = L2CAP_CONTROL_SUCCESS;
@@ -512,16 +512,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
421 
422  case L2CAP_CONTROL_SUCCESS:
423  if (l2cap_config_success_control_flag) {
-
424 #ifdef DEBUG
-
425  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
+
424 #ifdef DEBUG_USB_HOST
+
425  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
426 #endif
427  l2cap_state = L2CAP_INTERRUPT_SETUP;
428  }
429  break;
430  case L2CAP_INTERRUPT_SETUP:
431  if (l2cap_connection_request_interrupt_flag) {
-
432 #ifdef DEBUG
-
433  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
+
432 #ifdef DEBUG_USB_HOST
+
433  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
434 #endif
435  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, PENDING);
436  delay(1);
@@ -535,8 +535,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
444  break;
445  case L2CAP_INTERRUPT_REQUEST:
446  if (l2cap_config_request_interrupt_flag) {
-
447 #ifdef DEBUG
-
448  Notify(PSTR("\r\nHID Interrupt Configuration Request"), 0x80);
+
447 #ifdef DEBUG_USB_HOST
+
448  Notify(PSTR("\r\nHID Interrupt Configuration Request"), 0x80);
449 #endif
450  pBtd->l2cap_config_response(hci_handle, identifier, interrupt_scid);
451  l2cap_state = L2CAP_INTERRUPT_SUCCESS;
@@ -544,8 +544,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
453  break;
454  case L2CAP_INTERRUPT_SUCCESS:
455  if (l2cap_config_success_interrupt_flag) {
-
456 #ifdef DEBUG
-
457  Notify(PSTR("\r\nHID Interrupt Successfully Configured"), 0x80);
+
456 #ifdef DEBUG_USB_HOST
+
457  Notify(PSTR("\r\nHID Interrupt Successfully Configured"), 0x80);
458 #endif
459  if (remote_name[0] == 'M') { // First letter in Motion Controller ('M')
460  for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++) // Reset l2cap in buffer as it sometimes read it as a button has been pressed
@@ -564,8 +564,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
473 
474  case L2CAP_INTERRUPT_DISCONNECT:
475  if (l2cap_disconnect_response_interrupt_flag) {
-
476 #ifdef DEBUG
-
477  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
+
476 #ifdef DEBUG_USB_HOST
+
477  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
478 #endif
479  identifier++;
480  pBtd->l2cap_disconnection_request(hci_handle, identifier, control_scid, control_dcid);
@@ -575,8 +575,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
484 
485  case L2CAP_CONTROL_DISCONNECT:
486  if (l2cap_disconnect_response_control_flag) {
-
487 #ifdef DEBUG
-
488  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
+
487 #ifdef DEBUG_USB_HOST
+
488  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
489 #endif
490  pBtd->hci_disconnect(hci_handle);
491  hci_handle = -1; // Reset handle
@@ -608,21 +608,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
517  if (millis() - timer > 1000) { // loop 1 second before sending the command
518  if (remote_name[0] == 'P') { // First letter in PLAYSTATION(R)3 Controller ('P')
519  setLedOn(LED1);
-
520 #ifdef DEBUG
-
521  Notify(PSTR("\r\nDualshock 3 Controller Enabled\r\n"), 0x80);
+
520 #ifdef DEBUG_USB_HOST
+
521  Notify(PSTR("\r\nDualshock 3 Controller Enabled\r\n"), 0x80);
522 #endif
523  PS3Connected = true;
524  } else if (remote_name[0] == 'N') { // First letter in Navigation Controller ('N')
525  setLedOn(LED1); // This just turns LED constantly on, on the Navigation controller
-
526 #ifdef DEBUG
-
527  Notify(PSTR("\r\nNavigation Controller Enabled\r\n"), 0x80);
+
526 #ifdef DEBUG_USB_HOST
+
527  Notify(PSTR("\r\nNavigation Controller Enabled\r\n"), 0x80);
528 #endif
529  PS3NavigationConnected = true;
530  } else if (remote_name[0] == 'M') { // First letter in Motion Controller ('M')
531  moveSetBulb(Red);
532  timerBulbRumble = millis();
-
533 #ifdef DEBUG
-
534  Notify(PSTR("\r\nMotion Controller Enabled\r\n"), 0x80);
+
533 #ifdef DEBUG_USB_HOST
+
534  Notify(PSTR("\r\nMotion Controller Enabled\r\n"), 0x80);
535 #endif
536  PS3MoveConnected = true;
537  }
@@ -688,7 +688,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
597 }
598 
599 void PS3BT::setLedRaw(uint8_t value) {
-
600  HIDBuffer[11] = value;
+
600  HIDBuffer[11] = value << 1;
601  HID_Command(HIDBuffer, HID_BUFFERSIZE);
602 }
603 void PS3BT::setLedOff(LED a) {
@@ -741,9 +741,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
650 }
651 
652 void PS3BT::moveSetRumble(uint8_t rumble) {
-
653 #ifdef DEBUG
+
653 #ifdef DEBUG_USB_HOST
654  if (rumble < 64 && rumble != 0) // The rumble value has to at least 64, or approximately 25% (64/255*100)
-
655  Notify(PSTR("\r\nThe rumble value has to at least 64, or approximately 25%"), 0x80);
+
655  Notify(PSTR("\r\nThe rumble value has to at least 64, or approximately 25%"), 0x80);
656 #endif
657  //set the rumble value into the write buffer
658  HIDMoveBuffer[7] = rumble;
@@ -755,7 +755,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 c31e17e5..a65b6f80 100644 --- a/_p_s3_b_t_8h.html +++ b/_p_s3_b_t_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3BT.h File Reference @@ -31,7 +31,7 @@ - + @@ -99,7 +99,7 @@ Include dependency graph for PS3BT.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -573,7 +573,7 @@ Macros diff --git a/_p_s3_b_t_8h__incl.map b/_p_s3_b_t_8h__incl.map index 77eeae89..8f7161cd 100644 --- a/_p_s3_b_t_8h__incl.map +++ b/_p_s3_b_t_8h__incl.map @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/_p_s3_b_t_8h__incl.md5 b/_p_s3_b_t_8h__incl.md5 index ea355d38..16a92273 100644 --- a/_p_s3_b_t_8h__incl.md5 +++ b/_p_s3_b_t_8h__incl.md5 @@ -1 +1 @@ -6630a4e7e61f93b1abda0bc89fee8c54 \ No newline at end of file +142644e07dee613f168dcc68a8cb7912 \ 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 80a16ad5..3c2f839d 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 a9048781..e2c860d0 100644 --- a/_p_s3_b_t_8h_source.html +++ b/_p_s3_b_t_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3BT.h Source File @@ -31,7 +31,7 @@
- + @@ -229,7 +229,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_p_s3_enums_8h.html b/_p_s3_enums_8h.html index b7261314..5a9dc140 100644 --- a/_p_s3_enums_8h.html +++ b/_p_s3_enums_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3Enums.h File Reference @@ -31,7 +31,7 @@ - + @@ -569,7 +569,7 @@ Variables diff --git a/_p_s3_enums_8h_source.html b/_p_s3_enums_8h_source.html index d6245315..3cdd69a9 100644 --- a/_p_s3_enums_8h_source.html +++ b/_p_s3_enums_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3Enums.h Source File @@ -31,7 +31,7 @@ - + @@ -266,7 +266,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 536f6e5d..ce2c7565 100644 --- a/_p_s3_u_s_b_8cpp.html +++ b/_p_s3_u_s_b_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3USB.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -85,8 +85,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
-Macros
PS3USB.cpp File Reference
@@ -97,37 +95,16 @@ Include dependency graph for PS3USB.cpp:
- +

Go to the source code of this file.

- - - - -

-Macros

#define DEBUG
 
-

Macro Definition Documentation

- -
-
- - - - -
#define DEBUG
-
- -

Definition at line 19 of file PS3USB.cpp.

- -
-
diff --git a/_p_s3_u_s_b_8cpp__incl.map b/_p_s3_u_s_b_8cpp__incl.map index b5e1fedb..f7009202 100644 --- a/_p_s3_u_s_b_8cpp__incl.map +++ b/_p_s3_u_s_b_8cpp__incl.map @@ -1,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/_p_s3_u_s_b_8cpp__incl.md5 b/_p_s3_u_s_b_8cpp__incl.md5 index d5ccb6e6..ab466f1e 100644 --- a/_p_s3_u_s_b_8cpp__incl.md5 +++ b/_p_s3_u_s_b_8cpp__incl.md5 @@ -1 +1 @@ -9291913c3b181df51a6c28b65d6f85e4 \ No newline at end of file +f5ae29b491763e0d6c2c12dc912b90be \ 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 1f474f6b..cee2a2ef 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 e756f560..d63e3e0d 100644 --- a/_p_s3_u_s_b_8cpp_source.html +++ b/_p_s3_u_s_b_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3USB.cpp Source File @@ -31,7 +31,7 @@ - + @@ -107,8 +107,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
16  */
17 
18 #include "PS3USB.h"
-
19 #define DEBUG // Uncomment to print data for debugging
-
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
+
19 // To enable serial debugging uncomment "#define DEBUG_USB_HOST" in message.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) :
@@ -145,12 +145,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
54  // get memory address of USB device address pool
55  AddressPool &addrPool = pUsb->GetAddressPool();
56 #ifdef EXTRADEBUG
-
57  Notify(PSTR("\r\nPS3USB Init"), 0x80);
+
57  Notify(PSTR("\r\nPS3USB Init"), 0x80);
58 #endif
59  // check if address has already been assigned to an instance
60  if (bAddress) {
-
61 #ifdef DEBUG
-
62  Notify(PSTR("\r\nAddress in use"), 0x80);
+
61 #ifdef DEBUG_USB_HOST
+
62  Notify(PSTR("\r\nAddress in use"), 0x80);
63 #endif
64  return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
65  }
@@ -159,15 +159,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
68  p = addrPool.GetUsbDevicePtr(0);
69 
70  if (!p) {
-
71 #ifdef DEBUG
-
72  Notify(PSTR("\r\nAddress not found"), 0x80);
+
71 #ifdef DEBUG_USB_HOST
+
72  Notify(PSTR("\r\nAddress not found"), 0x80);
73 #endif
74  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
75  }
76 
77  if (!p->epinfo) {
-
78 #ifdef DEBUG
-
79  Notify(PSTR("\r\nepinfo is null"), 0x80);
+
78 #ifdef DEBUG_USB_HOST
+
79  Notify(PSTR("\r\nepinfo is null"), 0x80);
80 #endif
81  return USB_ERROR_EPINFO_IS_NULL;
82  }
@@ -181,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
90  p->lowspeed = lowspeed;
91 
92  // Get device descriptor
-
93  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
+
93  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
94  // Restore p->epinfo
95  p->epinfo = oldep_ptr;
96 
@@ -209,14 +209,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
118  p->lowspeed = false;
119  addrPool.FreeAddress(bAddress);
120  bAddress = 0;
-
121 #ifdef DEBUG
-
122  Notify(PSTR("\r\nsetAddr: "), 0x80);
+
121 #ifdef DEBUG_USB_HOST
+
122  Notify(PSTR("\r\nsetAddr: "), 0x80);
123 #endif
124  PrintHex<uint8_t > (rcode, 0x80);
125  return rcode;
126  }
127 #ifdef EXTRADEBUG
-
128  Notify(PSTR("\r\nAddr: "), 0x80);
+
128  Notify(PSTR("\r\nAddr: "), 0x80);
129  PrintHex<uint8_t > (bAddress, 0x80);
130 #endif
131  p->lowspeed = false;
@@ -264,13 +264,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
173 
174  if (PID == PS3_PID || PID == PS3NAVIGATION_PID) {
175  if (PID == PS3_PID) {
-
176 #ifdef DEBUG
-
177  Notify(PSTR("\r\nDualshock 3 Controller Connected"), 0x80);
+
176 #ifdef DEBUG_USB_HOST
+
177  Notify(PSTR("\r\nDualshock 3 Controller Connected"), 0x80);
178 #endif
179  PS3Connected = true;
180  } else { // must be a navigation controller
-
181 #ifdef DEBUG
-
182  Notify(PSTR("\r\nNavigation Controller Connected"), 0x80);
+
181 #ifdef DEBUG_USB_HOST
+
182  Notify(PSTR("\r\nNavigation Controller Connected"), 0x80);
183 #endif
184  PS3NavigationConnected = true;
185  }
@@ -286,8 +286,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
195  for (uint8_t i = 6; i < 10; i++)
196  readBuf[i] = 0x7F; // Set the analog joystick values to center position
197  } else { // must be a Motion controller
-
198 #ifdef DEBUG
-
199  Notify(PSTR("\r\nMotion Controller Connected"), 0x80);
+
198 #ifdef DEBUG_USB_HOST
+
199  Notify(PSTR("\r\nMotion Controller Connected"), 0x80);
200 #endif
201  PS3MoveConnected = true;
202  setMoveBdaddr(my_bdaddr); // Set internal bluetooth address
@@ -296,335 +296,345 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
205  writeBuf[0] = 0x02; // Set report ID, this is needed for Move commands to work
206  }
207 
-
208 #ifdef DEBUG
-
209  Notify(PSTR("\r\nBluetooth Address was set to: "), 0x80);
+
208 #ifdef DEBUG_USB_HOST
+
209  Notify(PSTR("\r\nBluetooth Address was set to: "), 0x80);
210  for (int8_t i = 5; i > 0; i--) {
211  PrintHex<uint8_t > (my_bdaddr[i], 0x80);
-
212  Notify(PSTR(":"), 0x80);
+
212  Notify(PSTR(":"), 0x80);
213  }
214  PrintHex<uint8_t > (my_bdaddr[0], 0x80);
215 #endif
216 
217  bPollEnable = true;
-
218  Notify(PSTR("\r\n"), 0x80);
+
218  Notify(PSTR("\r\n"), 0x80);
219  timer = millis();
220  return 0; // successful configuration
221 
222  /* diagnostic messages */
223 FailGetDevDescr:
-
224  NotifyFailGetDevDescr();
-
225  goto Fail;
-
226 
-
227 FailSetDevTblEntry:
-
228  NotifyFailSetDevTblEntry();
-
229  goto Fail;
-
230 
-
231 FailSetConfDescr:
-
232  NotifyFailSetConfDescr();
-
233  goto Fail;
-
234 FailUnknownDevice:
-
235  NotifyFailUnknownDevice(VID,PID);
-
236  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
-
237  Fail:
-
238 
-
239 #ifdef DEBUG
-
240  Notify(PSTR("\r\nPS3 Init Failed, error code: "), 0x80);
-
241 #endif
-
242  NotifyFail(rcode);
-
243  Release();
-
244  return rcode;
-
245 }
-
246 
-
247 /* Performs a cleanup after failed Init() attempt */
-
248 uint8_t PS3USB::Release() {
-
249  PS3Connected = false;
-
250  PS3MoveConnected = false;
-
251  PS3NavigationConnected = false;
-
252  pUsb->GetAddressPool().FreeAddress(bAddress);
-
253  bAddress = 0;
-
254  bPollEnable = false;
-
255  return 0;
-
256 }
-
257 
-
258 uint8_t PS3USB::Poll() {
-
259  if (!bPollEnable)
-
260  return 0;
-
261 
-
262  if (PS3Connected || PS3NavigationConnected) {
-
263  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
-
264  pUsb->inTransfer(bAddress, epInfo[ PS3_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
-
265  if (millis() - timer > 100) { // Loop 100ms before processing data
-
266  readReport();
-
267 #ifdef PRINTREPORT
-
268  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
-
269 #endif
-
270  }
-
271  } 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
-
272  if (millis() - timer > 4000) // Send at least every 4th second
-
273  {
-
274  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
-
275  timer = millis();
-
276  }
-
277  }
-
278  return 0;
-
279 }
-
280 
-
281 void PS3USB::readReport() {
-
282  if (readBuf == NULL)
-
283  return;
-
284 
-
285  ButtonState = (uint32_t)(readBuf[2] | ((uint16_t)readBuf[3] << 8) | ((uint32_t)readBuf[4] << 16));
-
286 
-
287  //Notify(PSTR("\r\nButtonState", 0x80);
-
288  //PrintHex<uint32_t>(ButtonState, 0x80);
-
289 
-
290  if (ButtonState != OldButtonState) {
-
291  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
-
292  OldButtonState = ButtonState;
-
293  }
-
294 }
-
295 
-
296 void PS3USB::printReport() { //Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
-
297 #ifdef PRINTREPORT
-
298  if (readBuf == NULL)
-
299  return;
-
300  for (uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++) {
-
301  PrintHex<uint8_t > (readBuf[i], 0x80);
-
302  Notify(PSTR(" "), 0x80);
-
303  }
-
304  Notify(PSTR("\r\n"), 0x80);
-
305 #endif
-
306 }
-
307 
-
308 bool PS3USB::getButtonPress(Button b) {
-
309  return (ButtonState & pgm_read_dword(&BUTTONS[(uint8_t)b]));
-
310 }
-
311 
-
312 bool PS3USB::getButtonClick(Button b) {
-
313  uint32_t button = pgm_read_dword(&BUTTONS[(uint8_t)b]);
-
314  bool click = (ButtonClickState & button);
-
315  ButtonClickState &= ~button; // clear "click" event
-
316  return click;
+
224 #ifdef DEBUG_USB_HOST
+
225  NotifyFailGetDevDescr();
+
226  goto Fail;
+
227 #endif
+
228 FailSetDevTblEntry:
+
229 #ifdef DEBUG_USB_HOST
+
230  NotifyFailSetDevTblEntry();
+
231  goto Fail;
+
232 #endif
+
233 
+
234 FailSetConfDescr:
+
235 #ifdef DEBUG_USB_HOST
+
236  NotifyFailSetConfDescr();
+
237 #endif
+
238  goto Fail;
+
239 FailUnknownDevice:
+
240 #ifdef DEBUG_USB_HOST
+
241  NotifyFailUnknownDevice(VID, PID);
+
242 #endif
+
243  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
+
244 Fail:
+
245 
+
246 #ifdef DEBUG_USB_HOST
+
247  Notify(PSTR("\r\nPS3 Init Failed, error code: "), 0x80);
+
248  NotifyFail(rcode);
+
249 #endif
+
250  Release();
+
251  return rcode;
+
252 }
+
253 
+
254 /* Performs a cleanup after failed Init() attempt */
+
255 uint8_t PS3USB::Release() {
+
256  PS3Connected = false;
+
257  PS3MoveConnected = false;
+
258  PS3NavigationConnected = false;
+
259  pUsb->GetAddressPool().FreeAddress(bAddress);
+
260  bAddress = 0;
+
261  bPollEnable = false;
+
262  return 0;
+
263 }
+
264 
+
265 uint8_t PS3USB::Poll() {
+
266  if (!bPollEnable)
+
267  return 0;
+
268 
+
269  if (PS3Connected || PS3NavigationConnected) {
+
270  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
+
271  pUsb->inTransfer(bAddress, epInfo[ PS3_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
+
272  if (millis() - timer > 100) { // Loop 100ms before processing data
+
273  readReport();
+
274 #ifdef PRINTREPORT
+
275  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
+
276 #endif
+
277  }
+
278  } 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
+
279  if (millis() - timer > 4000) // Send at least every 4th second
+
280  {
+
281  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
+
282  timer = millis();
+
283  }
+
284  }
+
285  return 0;
+
286 }
+
287 
+
288 void PS3USB::readReport() {
+
289  if (readBuf == NULL)
+
290  return;
+
291 
+
292  ButtonState = (uint32_t)(readBuf[2] | ((uint16_t)readBuf[3] << 8) | ((uint32_t)readBuf[4] << 16));
+
293 
+
294  //Notify(PSTR("\r\nButtonState", 0x80);
+
295  //PrintHex<uint32_t>(ButtonState, 0x80);
+
296 
+
297  if (ButtonState != OldButtonState) {
+
298  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
+
299  OldButtonState = ButtonState;
+
300  }
+
301 }
+
302 
+
303 void PS3USB::printReport() { //Uncomment "#define PRINTREPORT" to print the report send by the PS3 Controllers
+
304 #ifdef PRINTREPORT
+
305  if (readBuf == NULL)
+
306  return;
+
307  for (uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++) {
+
308  PrintHex<uint8_t > (readBuf[i], 0x80);
+
309  Notify(PSTR(" "), 0x80);
+
310  }
+
311  Notify(PSTR("\r\n"), 0x80);
+
312 #endif
+
313 }
+
314 
+
315 bool PS3USB::getButtonPress(Button b) {
+
316  return (ButtonState & pgm_read_dword(&BUTTONS[(uint8_t)b]));
317 }
318 
-
319 uint8_t PS3USB::getAnalogButton(Button a) {
-
320  if (readBuf == NULL)
-
321  return 0;
-
322  return (uint8_t)(readBuf[(pgm_read_byte(&ANALOGBUTTONS[(uint8_t)a])) - 9]);
-
323 }
-
324 
-
325 uint8_t PS3USB::getAnalogHat(AnalogHat a) {
-
326  if (readBuf == NULL)
-
327  return 0;
-
328  return (uint8_t)(readBuf[((uint8_t)a + 6)]);
-
329 }
-
330 
-
331 uint16_t PS3USB::getSensor(Sensor a) {
-
332  if (readBuf == NULL)
-
333  return 0;
-
334  return ((readBuf[((uint16_t)a) - 9] << 8) | readBuf[((uint16_t)a + 1) - 9]);
-
335 }
-
336 
-
337 double PS3USB::getAngle(Angle a) {
-
338  if (PS3Connected) {
-
339  double accXval;
-
340  double accYval;
-
341  double accZval;
-
342 
-
343  // Data for the Kionix KXPC4 used in the DualShock 3
-
344  const double zeroG = 511.5; // 1.65/3.3*1023 (1,65V)
-
345  accXval = -((double)getSensor(aX) - zeroG);
-
346  accYval = -((double)getSensor(aY) - zeroG);
-
347  accZval = -((double)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  double angle = (atan2(accYval, accZval) + PI) * RAD_TO_DEG;
-
354  return angle;
-
355  } else {
-
356  double angle = (atan2(accXval, accZval) + PI) * RAD_TO_DEG;
-
357  return angle;
-
358  }
-
359  } else
-
360  return 0;
-
361 }
-
362 
-
363 bool PS3USB::getStatus(Status c) {
-
364  if (readBuf == NULL)
-
365  return false;
-
366  if (readBuf[((uint16_t)c >> 8) - 9] == ((uint8_t)c & 0xff))
-
367  return true;
-
368  return false;
-
369 }
-
370 
-
371 String PS3USB::getStatusString() {
-
372  if (PS3Connected || PS3NavigationConnected) {
-
373  char statusOutput[100];
-
374 
-
375  strcpy(statusOutput, "ConnectionStatus: ");
-
376 
-
377  if (getStatus(Plugged)) strcat(statusOutput, "Plugged");
-
378  else if (getStatus(Unplugged)) strcat(statusOutput, "Unplugged");
-
379  else strcat(statusOutput, "Error");
-
380 
+
319 bool PS3USB::getButtonClick(Button b) {
+
320  uint32_t button = pgm_read_dword(&BUTTONS[(uint8_t)b]);
+
321  bool click = (ButtonClickState & button);
+
322  ButtonClickState &= ~button; // clear "click" event
+
323  return click;
+
324 }
+
325 
+
326 uint8_t PS3USB::getAnalogButton(Button a) {
+
327  if (readBuf == NULL)
+
328  return 0;
+
329  return (uint8_t)(readBuf[(pgm_read_byte(&ANALOGBUTTONS[(uint8_t)a])) - 9]);
+
330 }
+
331 
+
332 uint8_t PS3USB::getAnalogHat(AnalogHat a) {
+
333  if (readBuf == NULL)
+
334  return 0;
+
335  return (uint8_t)(readBuf[((uint8_t)a + 6)]);
+
336 }
+
337 
+
338 uint16_t PS3USB::getSensor(Sensor a) {
+
339  if (readBuf == NULL)
+
340  return 0;
+
341  return ((readBuf[((uint16_t)a) - 9] << 8) | readBuf[((uint16_t)a + 1) - 9]);
+
342 }
+
343 
+
344 double PS3USB::getAngle(Angle a) {
+
345  if (PS3Connected) {
+
346  double accXval;
+
347  double accYval;
+
348  double accZval;
+
349 
+
350  // Data for the Kionix KXPC4 used in the DualShock 3
+
351  const double zeroG = 511.5; // 1.65/3.3*1023 (1,65V)
+
352  accXval = -((double)getSensor(aX) - zeroG);
+
353  accYval = -((double)getSensor(aY) - zeroG);
+
354  accZval = -((double)getSensor(aZ) - zeroG);
+
355 
+
356  // Convert to 360 degrees resolution
+
357  // atan2 outputs the value of -Ï€ to Ï€ (radians)
+
358  // We are then converting it to 0 to 2Ï€ and then to degrees
+
359  if (a == Pitch) {
+
360  double angle = (atan2(accYval, accZval) + PI) * RAD_TO_DEG;
+
361  return angle;
+
362  } else {
+
363  double angle = (atan2(accXval, accZval) + PI) * RAD_TO_DEG;
+
364  return angle;
+
365  }
+
366  } else
+
367  return 0;
+
368 }
+
369 
+
370 bool PS3USB::getStatus(Status c) {
+
371  if (readBuf == NULL)
+
372  return false;
+
373  if (readBuf[((uint16_t)c >> 8) - 9] == ((uint8_t)c & 0xff))
+
374  return true;
+
375  return false;
+
376 }
+
377 
+
378 String PS3USB::getStatusString() {
+
379  if (PS3Connected || PS3NavigationConnected) {
+
380  char statusOutput[100];
381 
-
382  strcat(statusOutput, " - PowerRating: ");
+
382  strcpy(statusOutput, "ConnectionStatus: ");
383 
-
384  if (getStatus(Charging)) strcat(statusOutput, "Charging");
-
385  else if (getStatus(NotCharging)) strcat(statusOutput, "Not Charging");
-
386  else if (getStatus(Shutdown)) strcat(statusOutput, "Shutdown");
-
387  else if (getStatus(Dying)) strcat(statusOutput, "Dying");
-
388  else if (getStatus(Low)) strcat(statusOutput, "Low");
-
389  else if (getStatus(High)) strcat(statusOutput, "High");
-
390  else if (getStatus(Full)) strcat(statusOutput, "Full");
-
391  else strcat(statusOutput, "Error");
-
392 
-
393  strcat(statusOutput, " - WirelessStatus: ");
-
394 
-
395  if (getStatus(CableRumble)) strcat(statusOutput, "Cable - Rumble is on");
-
396  else if (getStatus(Cable)) strcat(statusOutput, "Cable - Rumble is off");
-
397  else if (getStatus(BluetoothRumble)) strcat(statusOutput, "Bluetooth - Rumble is on");
-
398  else if (getStatus(Bluetooth)) strcat(statusOutput, "Bluetooth - Rumble is off");
-
399  else strcat(statusOutput, "Error");
-
400 
-
401  return statusOutput;
-
402  } else
-
403  return "Error";
-
404 }
-
405 
-
406 /* Playstation Sixaxis Dualshock and Navigation Controller commands */
-
407 void PS3USB::PS3_Command(uint8_t* data, uint16_t nbytes) {
-
408  //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)
-
409  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x01, 0x02, 0x00, nbytes, nbytes, data, NULL);
-
410 }
-
411 
-
412 void PS3USB::setAllOff() {
-
413  for (uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
-
414  writeBuf[i] = pgm_read_byte(&PS3_REPORT_BUFFER[i]); // Reset buffer
-
415 
-
416  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
+
384  if (getStatus(Plugged)) strcat(statusOutput, "Plugged");
+
385  else if (getStatus(Unplugged)) strcat(statusOutput, "Unplugged");
+
386  else strcat(statusOutput, "Error");
+
387 
+
388 
+
389  strcat(statusOutput, " - PowerRating: ");
+
390 
+
391  if (getStatus(Charging)) strcat(statusOutput, "Charging");
+
392  else if (getStatus(NotCharging)) strcat(statusOutput, "Not Charging");
+
393  else if (getStatus(Shutdown)) strcat(statusOutput, "Shutdown");
+
394  else if (getStatus(Dying)) strcat(statusOutput, "Dying");
+
395  else if (getStatus(Low)) strcat(statusOutput, "Low");
+
396  else if (getStatus(High)) strcat(statusOutput, "High");
+
397  else if (getStatus(Full)) strcat(statusOutput, "Full");
+
398  else strcat(statusOutput, "Error");
+
399 
+
400  strcat(statusOutput, " - WirelessStatus: ");
+
401 
+
402  if (getStatus(CableRumble)) strcat(statusOutput, "Cable - Rumble is on");
+
403  else if (getStatus(Cable)) strcat(statusOutput, "Cable - Rumble is off");
+
404  else if (getStatus(BluetoothRumble)) strcat(statusOutput, "Bluetooth - Rumble is on");
+
405  else if (getStatus(Bluetooth)) strcat(statusOutput, "Bluetooth - Rumble is off");
+
406  else strcat(statusOutput, "Error");
+
407 
+
408  return statusOutput;
+
409  } else
+
410  return "Error";
+
411 }
+
412 
+
413 /* Playstation Sixaxis Dualshock and Navigation Controller commands */
+
414 void PS3USB::PS3_Command(uint8_t* data, uint16_t nbytes) {
+
415  //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)
+
416  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x01, 0x02, 0x00, nbytes, nbytes, data, NULL);
417 }
418 
-
419 void PS3USB::setRumbleOff() {
-
420  writeBuf[1] = 0x00;
-
421  writeBuf[2] = 0x00; //low mode off
-
422  writeBuf[3] = 0x00;
-
423  writeBuf[4] = 0x00; //high mode off
-
424 
-
425  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
-
426 }
-
427 
-
428 void PS3USB::setRumbleOn(Rumble mode) {
-
429  if ((mode & 0x30) > 0x00) {
-
430  uint8_t power[2] = { 0xff, 0x00 }; // Defaults to RumbleLow
-
431  if (mode == RumbleHigh) {
-
432  power[0] = 0x00;
-
433  power[1] = 0xff;
-
434  }
-
435  setRumbleOn(0xfe, power[0], 0xfe, power[1]);
-
436  }
-
437 }
-
438 
-
439 void PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
-
440  writeBuf[1] = rightDuration;
-
441  writeBuf[2] = rightPower;
-
442  writeBuf[3] = leftDuration;
-
443  writeBuf[4] = leftPower;
-
444  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
-
445 }
-
446 
-
447 void PS3USB::setLedRaw(uint8_t value) {
-
448  writeBuf[9] = value;
-
449  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
-
450 }
-
451 void PS3USB::setLedOff(LED a) {
-
452  writeBuf[9] &= ~((uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1));
-
453  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
-
454 }
-
455 void PS3USB::setLedOn(LED a) {
-
456  writeBuf[9] |= (uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1);
-
457  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
-
458 }
-
459 void PS3USB::setLedToggle(LED a) {
-
460  writeBuf[9] ^= (uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1);
+
419 void PS3USB::setAllOff() {
+
420  for (uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
+
421  writeBuf[i] = pgm_read_byte(&PS3_REPORT_BUFFER[i]); // Reset buffer
+
422 
+
423  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
+
424 }
+
425 
+
426 void PS3USB::setRumbleOff() {
+
427  writeBuf[1] = 0x00;
+
428  writeBuf[2] = 0x00; //low mode off
+
429  writeBuf[3] = 0x00;
+
430  writeBuf[4] = 0x00; //high mode off
+
431 
+
432  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
+
433 }
+
434 
+
435 void PS3USB::setRumbleOn(Rumble mode) {
+
436  if ((mode & 0x30) > 0x00) {
+
437  uint8_t power[2] = {0xff, 0x00}; // Defaults to RumbleLow
+
438  if (mode == RumbleHigh) {
+
439  power[0] = 0x00;
+
440  power[1] = 0xff;
+
441  }
+
442  setRumbleOn(0xfe, power[0], 0xfe, power[1]);
+
443  }
+
444 }
+
445 
+
446 void PS3USB::setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower) {
+
447  writeBuf[1] = rightDuration;
+
448  writeBuf[2] = rightPower;
+
449  writeBuf[3] = leftDuration;
+
450  writeBuf[4] = leftPower;
+
451  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
+
452 }
+
453 
+
454 void PS3USB::setLedRaw(uint8_t value) {
+
455  writeBuf[9] = value << 1;
+
456  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
+
457 }
+
458 
+
459 void PS3USB::setLedOff(LED a) {
+
460  writeBuf[9] &= ~((uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1));
461  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
462 }
463 
-
464 void PS3USB::setBdaddr(uint8_t* BDADDR) {
-
465  /* Set the internal bluetooth address */
-
466  uint8_t buf[8];
-
467  buf[0] = 0x01;
-
468  buf[1] = 0x00;
-
469  for (uint8_t i = 0; i < 6; i++)
-
470  buf[i + 2] = BDADDR[5 - i]; //Copy into buffer, has to be written reversed
-
471 
-
472  //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)
-
473  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
-
474 }
-
475 
-
476 void PS3USB::enable_sixaxis() { //Command used to enable the Dualshock 3 and Navigation controller to send data via USB
-
477  uint8_t cmd_buf[4];
-
478  cmd_buf[0] = 0x42; // Special PS3 Controller enable commands
-
479  cmd_buf[1] = 0x0c;
-
480  cmd_buf[2] = 0x00;
-
481  cmd_buf[3] = 0x00;
-
482 
-
483  //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)
-
484  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF4, 0x03, 0x00, 4, 4, cmd_buf, NULL);
-
485 }
-
486 
-
487 /* Playstation Move Controller commands */
-
488 void PS3USB::Move_Command(uint8_t* data, uint16_t nbytes) {
-
489  pUsb->outTransfer(bAddress, epInfo[ PS3_OUTPUT_PIPE ].epAddr, nbytes, data);
-
490 }
-
491 
-
492 void PS3USB::moveSetBulb(uint8_t r, uint8_t g, uint8_t b) { //Use this to set the Color using RGB values
-
493  // set the Bulb's values into the write buffer
-
494  writeBuf[2] = r;
-
495  writeBuf[3] = g;
-
496  writeBuf[4] = b;
-
497 
-
498  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE);
-
499 }
-
500 
-
501 void PS3USB::moveSetBulb(Colors color) { //Use this to set the Color using the predefined colors in "enums.h"
-
502  moveSetBulb((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color));
-
503 }
-
504 
-
505 void PS3USB::moveSetRumble(uint8_t rumble) {
-
506 #ifdef DEBUG
-
507  if (rumble < 64 && rumble != 0) // The rumble value has to at least 64, or approximately 25% (64/255*100)
-
508  Notify(PSTR("\r\nThe rumble value has to at least 64, or approximately 25%"), 0x80);
-
509 #endif
-
510  //set the rumble value into the write buffer
-
511  writeBuf[6] = rumble;
-
512 
-
513  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE);
-
514 }
-
515 
-
516 void PS3USB::setMoveBdaddr(uint8_t* BDADDR) {
-
517  /* Set the internal bluetooth address */
-
518  uint8_t buf[11];
-
519  buf[0] = 0x05;
-
520  buf[7] = 0x10;
-
521  buf[8] = 0x01;
-
522  buf[9] = 0x02;
-
523  buf[10] = 0x12;
-
524 
-
525  for (uint8_t i = 0; i < 6; i++)
-
526  buf[i + 1] = BDADDR[i];
-
527 
-
528  //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)
-
529  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
-
530 }
+
464 void PS3USB::setLedOn(LED a) {
+
465  writeBuf[9] |= (uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1);
+
466  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
+
467 }
+
468 
+
469 void PS3USB::setLedToggle(LED a) {
+
470  writeBuf[9] ^= (uint8_t)((pgm_read_byte(&LEDS[(uint8_t)a]) & 0x0f) << 1);
+
471  PS3_Command(writeBuf, PS3_REPORT_BUFFER_SIZE);
+
472 }
+
473 
+
474 void PS3USB::setBdaddr(uint8_t* BDADDR) {
+
475  /* Set the internal bluetooth address */
+
476  uint8_t buf[8];
+
477  buf[0] = 0x01;
+
478  buf[1] = 0x00;
+
479  for (uint8_t i = 0; i < 6; i++)
+
480  buf[i + 2] = BDADDR[5 - i]; //Copy into buffer, has to be written reversed
+
481 
+
482  //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)
+
483  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
+
484 }
+
485 
+
486 void PS3USB::enable_sixaxis() { //Command used to enable the Dualshock 3 and Navigation controller to send data via USB
+
487  uint8_t cmd_buf[4];
+
488  cmd_buf[0] = 0x42; // Special PS3 Controller enable commands
+
489  cmd_buf[1] = 0x0c;
+
490  cmd_buf[2] = 0x00;
+
491  cmd_buf[3] = 0x00;
+
492 
+
493  //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)
+
494  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0xF4, 0x03, 0x00, 4, 4, cmd_buf, NULL);
+
495 }
+
496 
+
497 /* Playstation Move Controller commands */
+
498 void PS3USB::Move_Command(uint8_t* data, uint16_t nbytes) {
+
499  pUsb->outTransfer(bAddress, epInfo[ PS3_OUTPUT_PIPE ].epAddr, nbytes, data);
+
500 }
+
501 
+
502 void PS3USB::moveSetBulb(uint8_t r, uint8_t g, uint8_t b) { //Use this to set the Color using RGB values
+
503  // set the Bulb's values into the write buffer
+
504  writeBuf[2] = r;
+
505  writeBuf[3] = g;
+
506  writeBuf[4] = b;
+
507 
+
508  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE);
+
509 }
+
510 
+
511 void PS3USB::moveSetBulb(Colors color) { //Use this to set the Color using the predefined colors in "enums.h"
+
512  moveSetBulb((uint8_t)(color >> 16), (uint8_t)(color >> 8), (uint8_t)(color));
+
513 }
+
514 
+
515 void PS3USB::moveSetRumble(uint8_t rumble) {
+
516 #ifdef DEBUG_USB_HOST
+
517  if (rumble < 64 && rumble != 0) // The rumble value has to at least 64, or approximately 25% (64/255*100)
+
518  Notify(PSTR("\r\nThe rumble value has to at least 64, or approximately 25%"), 0x80);
+
519 #endif
+
520  //set the rumble value into the write buffer
+
521  writeBuf[6] = rumble;
+
522 
+
523  Move_Command(writeBuf, MOVE_REPORT_BUFFER_SIZE);
+
524 }
+
525 
+
526 void PS3USB::setMoveBdaddr(uint8_t* BDADDR) {
+
527  /* Set the internal bluetooth address */
+
528  uint8_t buf[11];
+
529  buf[0] = 0x05;
+
530  buf[7] = 0x10;
+
531  buf[8] = 0x01;
+
532  buf[9] = 0x02;
+
533  buf[10] = 0x12;
+
534 
+
535  for (uint8_t i = 0; i < 6; i++)
+
536  buf[i + 1] = BDADDR[i];
+
537 
+
538  //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)
+
539  pUsb->ctrlReq(bAddress, epInfo[PS3_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
+
540 }
diff --git a/_p_s3_u_s_b_8h.html b/_p_s3_u_s_b_8h.html index 3f068788..2c9f4ec2 100644 --- a/_p_s3_u_s_b_8h.html +++ b/_p_s3_u_s_b_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3USB.h File Reference @@ -31,7 +31,7 @@ - + @@ -100,7 +100,7 @@ Include dependency graph for PS3USB.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -318,7 +318,7 @@ Macros diff --git a/_p_s3_u_s_b_8h__incl.map b/_p_s3_u_s_b_8h__incl.map index c4289502..b5f947f5 100644 --- a/_p_s3_u_s_b_8h__incl.map +++ b/_p_s3_u_s_b_8h__incl.map @@ -1,13 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/_p_s3_u_s_b_8h__incl.md5 b/_p_s3_u_s_b_8h__incl.md5 index 01117966..6b0654d7 100644 --- a/_p_s3_u_s_b_8h__incl.md5 +++ b/_p_s3_u_s_b_8h__incl.md5 @@ -1 +1 @@ -6cea3eaa38742a521814c303ac3dc51a \ No newline at end of file +0ac75f726e2de3191352863394f83430 \ 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 ec3c72cc..7521746b 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 0ac17cc0..fc9cfffd 100644 --- a/_p_s3_u_s_b_8h_source.html +++ b/_p_s3_u_s_b_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3USB.h Source File @@ -31,7 +31,7 @@
- + @@ -217,7 +217,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 bce5751e..218f02d3 100644 --- a/_r_e_a_d_m_e_8md.html +++ b/_r_e_a_d_m_e_8md.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: README.md File Reference @@ -31,7 +31,7 @@ - + @@ -92,7 +92,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 134c09da..dc28aa80 100644 --- a/_r_e_a_d_m_e_8md_source.html +++ b/_r_e_a_d_m_e_8md_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: README.md Source File @@ -31,7 +31,7 @@ - + @@ -105,162 +105,165 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
18 
19 # Developed By
20 
-
21 * <b>Oleg Mazurov, Circuits\@Home</b> - <mazurov@circuitsathome.com>
-
22  * Developer of the USB Core, HID, FTDI, ADK, ACM, and PL2303 libraries
-
23 * <b>Kristian Lauszus, TKJ Electronics</b> - <kristianl@tkjelectronics.com>
-
24  * Developer of the BTD, SPP, PS3, Wii, and Xbox libraries
-
25 
-
26 # How to include the library
-
27 
-
28 First download the library by clicking on the following link: <https://github.com/felis/USB_Host_Shield_2.0/archive/master.zip>.
-
29 
-
30 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.
-
31 
-
32 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.
-
33 Now move the "USB\_Host\_Shield\_20" directory to the "libraries" directory.
+
21 * __Oleg Mazurov, Circuits\@Home__ - <mazurov@circuitsathome.com>
+
22 * __Alexei Glushchenko, Circuits\@Home__ - <alex-gl@mail.ru>
+
23  * Developers of the USB Core, HID, FTDI, ADK, ACM, and PL2303 libraries
+
24 * __Kristian Lauszus, TKJ Electronics__ - <kristianl@tkjelectronics.com>
+
25  * Developer of the BTD, SPP, PS3, Wii, and Xbox libraries
+
26 * __Andrew Kroll__ - <xxxajk@gmail.com>
+
27  * Major contributor to mass storage code
+
28 
+
29 # How to include the library
+
30 
+
31 First download the library by clicking on the following link: <https://github.com/felis/USB_Host_Shield_2.0/archive/master.zip>.
+
32 
+
33 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.
34 
-
35 The final structure should look like this:
-
36 
-
37 * Arduino/
-
38  * libraries/
-
39  * USB\_Host\_Shield\_20/
-
40 
-
41 Now quit the Arduino IDE and reopen it.
-
42 
-
43 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.
-
44 
-
45 For more information visit the following site: <http://arduino.cc/en/Guide/Libraries>.
-
46 
-
47 # How to use the library
-
48 
-
49 ### Documentation
-
50 
-
51 Documentation for the library can be found at the following link: <http://felis.github.com/USB_Host_Shield_2.0/>.
-
52 
-
53 ### Arduino ADK
-
54 To use this library with the official [Arduino ADK](http://arduino.cc/en/Main/ArduinoBoardADK) uncomment the following line in [avrpins.h](https://github.com/felis/USB_Host_Shield_2.0/blob/master/avrpins.h):
+
35 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.
+
36 Now move the "USB\_Host\_Shield\_20" directory to the "libraries" directory.
+
37 
+
38 The final structure should look like this:
+
39 
+
40 * Arduino/
+
41  * libraries/
+
42  * USB\_Host\_Shield\_20/
+
43 
+
44 Now quit the Arduino IDE and reopen it.
+
45 
+
46 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.
+
47 
+
48 For more information visit the following site: <http://arduino.cc/en/Guide/Libraries>.
+
49 
+
50 # How to use the library
+
51 
+
52 ### Documentation
+
53 
+
54 Documentation for the library can be found at the following link: <http://felis.github.com/USB_Host_Shield_2.0/>.
55 
-
56 <code>
-
57 \#define BOARD\_MEGA_ADK
-
58 </code>
-
59 
-
60 ### [Bluetooth libraries](https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp)
-
61 
-
62 The [BTD library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp) is a general purpose library for an ordinary Bluetooth dongle.
-
63 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.
-
64 Some different examples can be found in the [example directory](https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Bluetooth).
-
65 
-
66 The BTD library will also make it possible to use multiple services at once, the following example sketch is an example of this:
-
67 <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3SPP/PS3SPP.ino>
+
56 ### Arduino ADK
+
57 To use this library with the official [Arduino ADK](http://arduino.cc/en/Main/ArduinoBoardADK) uncomment the following line in [avrpins.h](https://github.com/felis/USB_Host_Shield_2.0/blob/master/avrpins.h):
+
58 
+
59 <code>
+
60 \#define BOARD\_MEGA_ADK
+
61 </code>
+
62 
+
63 ### [Bluetooth libraries](https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp)
+
64 
+
65 The [BTD library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/BTD.cpp) is a general purpose library for an ordinary Bluetooth dongle.
+
66 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.
+
67 Some different examples can be found in the [example directory](https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Bluetooth).
68 
-
69 ### [SPP library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/SPP.cpp)
-
70 
-
71 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.
-
72 It has been tested successfully on Windows, Mac OS X, Linux, and Android.
+
69 The BTD library will also make it possible to use multiple services at once, the following example sketch is an example of this:
+
70 <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3SPP/PS3SPP.ino>
+
71 
+
72 ### [SPP library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/SPP.cpp)
73 
-
74 More information can be found at these blog posts:
-
75 
-
76 * <http://www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released>
-
77 * <http://blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/>
+
74 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.
+
75 It has been tested successfully on Windows, Mac OS X, Linux, and Android.
+
76 
+
77 More information can be found at these blog posts:
78 
-
79 To implement the SPP protocol I used a Bluetooth sniffing tool called [PacketLogger](http://www.tkjelectronics.com/uploads/PacketLogger.zip) developed by Apple.
-
80 It enables me to see the Bluetooth communication between my Mac and any device.
+
79 * <http://www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released>
+
80 * <http://blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/>
81 
-
82 ### PS3 Library
-
83 
-
84 These libraries consist of the [PS3BT](https://github.com/felis/USB_Host_Shield_2.0/blob/master/PS3BT.cpp) and [PS3USB](https://github.com/felis/USB_Host_Shield_2.0/blob/master/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.
-
85 
-
86 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 plugging the controller in via USB and letting the library set it automatically.
-
87 
-
88 __Note:__ To obtain the address you have to plug in the Bluetooth dongle before connecting the controller, or alternatively you could set it in code like so: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L12>.
-
89 
-
90 For more information about the PS3 protocol see the official wiki: <https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information>.
-
91 
-
92 Also take a look at the blog posts:
-
93 
-
94 * <http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/>
-
95 * <http://www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library>
-
96 * <http://www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb>
-
97 
-
98 A special thanks go to the following people:
-
99 
-
100 1. _Richard Ibbotson_ who made this excellent guide: <http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part>
-
101 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>
+
82 To implement the SPP protocol I used a Bluetooth sniffing tool called [PacketLogger](http://www.tkjelectronics.com/uploads/PacketLogger.zip) developed by Apple.
+
83 It enables me to see the Bluetooth communication between my Mac and any device.
+
84 
+
85 ### PS3 Library
+
86 
+
87 These libraries consist of the [PS3BT](https://github.com/felis/USB_Host_Shield_2.0/blob/master/PS3BT.cpp) and [PS3USB](https://github.com/felis/USB_Host_Shield_2.0/blob/master/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.
+
88 
+
89 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 plugging the controller in via USB and letting the library set it automatically.
+
90 
+
91 __Note:__ To obtain the address you have to plug in the Bluetooth dongle before connecting the controller, or alternatively you could set it in code like so: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L12>.
+
92 
+
93 For more information about the PS3 protocol see the official wiki: <https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information>.
+
94 
+
95 Also take a look at the blog posts:
+
96 
+
97 * <http://blog.tkjelectronics.dk/2012/01/ps3-controller-bt-library-for-arduino/>
+
98 * <http://www.circuitsathome.com/mcu/sony-ps3-controller-support-added-to-usb-host-library>
+
99 * <http://www.circuitsathome.com/mcu/arduino/interfacing-ps3-controllers-via-usb>
+
100 
+
101 A special thanks go to the following people:
102 
-
103 Also a big thanks all the people behind these sites about the Motion controller:
-
104 
-
105 * <http://thp.io/2010/psmove/>
-
106 * <http://www.copenhagengamecollective.org/unimove/>
-
107 * <https://github.com/thp/psmoveapi>
-
108 * <http://code.google.com/p/moveonpc/>
-
109 
-
110 ### Xbox 360 Library
-
111 
-
112 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).
-
113 
-
114 To use it via USB use the [XBOXUSB](https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXRECV.cpp) library.
-
115 
-
116 __Note that a Wireless controller can NOT be used via USB!__
-
117 
-
118 Examples code can be found in the [examples directory](https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Xbox).
-
119 
-
120 Also see the following blog posts:
-
121 
-
122 * <http://www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library>
-
123 * <http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/>
-
124 * <http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/>
-
125 
-
126 All the information regarding the Xbox 360 controller protocol are form these sites:
-
127 
-
128 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo>
-
129 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo>
-
130 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL>
-
131 
-
132 ### [Wii library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp)
-
133 
-
134 The [Wii](https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp) library support the Wiimote, but also the Nunchuch and Motion Plus extensions via Bluetooth. The Wii U Pro Controller is also supported via Bluetooth.
-
135 
-
136 First you have to pair with the controller, this is done automatically by the library if you create the instance like so:
-
137 
-
138 <code>
-
139 WII Wii(&Btd,PAIR);
-
140 </code>
-
141 
-
142 And then press 1 & 2 at once on the Wiimote or press sync if you are using a Wii U Pro Controller.
-
143 
-
144 After that you can simply create the instance like so:
-
145 
-
146 <code>
-
147 WII Wii(&Btd);
-
148 </code>
-
149 
-
150 Then just press any button any button on the Wiimote and it will connect to the dongle.
-
151 
-
152 Take a look at the example for more information: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/Wii/Wii.ino>.
-
153 
-
154 Also take a look at the blog post:
-
155 
-
156 * <http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/>
-
157 
-
158 All the information about the Wii controllers are from these sites:
-
159 
-
160 * <http://wiibrew.org/wiki/Wiimote>
-
161 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers>
-
162 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck>
-
163 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus>
-
164 * The old library created by _Tomoyuki Tanaka_: <https://github.com/moyuchin/WiiRemote_on_Arduino> also helped a lot.
-
165 
-
166 # FAQ
-
167 
-
168 > When I plug my device into the USB connector nothing happens?
-
169 
-
170 Try to connect a external power supply to the Arduino - this solves the problem in most cases.
+
103 1. _Richard Ibbotson_ who made this excellent guide: <http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part>
+
104 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>
+
105 
+
106 Also a big thanks all the people behind these sites about the Motion controller:
+
107 
+
108 * <http://thp.io/2010/psmove/>
+
109 * <http://www.copenhagengamecollective.org/unimove/>
+
110 * <https://github.com/thp/psmoveapi>
+
111 * <http://code.google.com/p/moveonpc/>
+
112 
+
113 ### Xbox 360 Library
+
114 
+
115 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).
+
116 
+
117 To use it via USB use the [XBOXUSB](https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXUSB.cpp) library or to use it wirelessly use the [XBOXRECV](https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXRECV.cpp) library.
+
118 
+
119 __Note that a Wireless controller can NOT be used via USB!__
+
120 
+
121 Examples code can be found in the [examples directory](https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/Xbox).
+
122 
+
123 Also see the following blog posts:
+
124 
+
125 * <http://www.circuitsathome.com/mcu/xbox360-controller-support-added-to-usb-host-shield-2-0-library>
+
126 * <http://blog.tkjelectronics.dk/2012/07/xbox-360-controller-support-added-to-the-usb-host-library/>
+
127 * <http://blog.tkjelectronics.dk/2012/12/xbox-360-receiver-added-to-the-usb-host-library/>
+
128 
+
129 All the information regarding the Xbox 360 controller protocol are form these sites:
+
130 
+
131 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/UsbInfo>
+
132 * <http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo>
+
133 * <https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL>
+
134 
+
135 ### [Wii library](https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp)
+
136 
+
137 The [Wii](https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.cpp) library support the Wiimote, but also the Nunchuch and Motion Plus extensions via Bluetooth. The Wii U Pro Controller is also supported via Bluetooth.
+
138 
+
139 First you have to pair with the controller, this is done automatically by the library if you create the instance like so:
+
140 
+
141 <code>
+
142 WII Wii(&Btd,PAIR);
+
143 </code>
+
144 
+
145 And then press 1 & 2 at once on the Wiimote or press sync if you are using a Wii U Pro Controller.
+
146 
+
147 After that you can simply create the instance like so:
+
148 
+
149 <code>
+
150 WII Wii(&Btd);
+
151 </code>
+
152 
+
153 Then just press any button any button on the Wiimote and it will connect to the dongle.
+
154 
+
155 Take a look at the example for more information: <https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/Wii/Wii.ino>.
+
156 
+
157 Also take a look at the blog post:
+
158 
+
159 * <http://blog.tkjelectronics.dk/2012/08/wiimote-added-to-usb-host-library/>
+
160 
+
161 All the information about the Wii controllers are from these sites:
+
162 
+
163 * <http://wiibrew.org/wiki/Wiimote>
+
164 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers>
+
165 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck>
+
166 * <http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus>
+
167 * The old library created by _Tomoyuki Tanaka_: <https://github.com/moyuchin/WiiRemote_on_Arduino> also helped a lot.
+
168 
+
169 # FAQ
+
170 
+
171 > When I plug my device into the USB connector nothing happens?
+
172 
+
173 Try to connect a external power supply to the Arduino - this solves the problem in most cases.
diff --git a/_s_p_p_8cpp.html b/_s_p_p_8cpp.html index 11e0b76d..2114da51 100644 --- a/_s_p_p_8cpp.html +++ b/_s_p_p_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: SPP.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -86,7 +86,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Macros | Variables
SPP.cpp File Reference
@@ -98,36 +97,16 @@ Include dependency graph for SPP.cpp:
- +

Go to the source code of this file.

- - - -

-Macros

#define DEBUG
 

Variables

const uint8_t rfcomm_crc_table [256]
 
-

Macro Definition Documentation

- -
-
- - - - -
#define DEBUG
-
- -

Definition at line 19 of file SPP.cpp.

- -
-

Variable Documentation

@@ -166,7 +145,7 @@ Variables diff --git a/_s_p_p_8cpp__incl.map b/_s_p_p_8cpp__incl.map index 04750fb1..e61b4269 100644 --- a/_s_p_p_8cpp__incl.map +++ b/_s_p_p_8cpp__incl.map @@ -1,15 +1,15 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/_s_p_p_8cpp__incl.md5 b/_s_p_p_8cpp__incl.md5 index 25b0c0ec..cfaeb16e 100644 --- a/_s_p_p_8cpp__incl.md5 +++ b/_s_p_p_8cpp__incl.md5 @@ -1 +1 @@ -33aa8c0c9a2d418a2bf5751b5cad51a2 \ No newline at end of file +dee9d985871f3cf1594d8314992ecce9 \ No newline at end of file diff --git a/_s_p_p_8cpp__incl.png b/_s_p_p_8cpp__incl.png index ffea6eb2..089db0dc 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 97d4a7fd..e0fff753 100644 --- a/_s_p_p_8cpp_source.html +++ b/_s_p_p_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: SPP.cpp Source File @@ -31,7 +31,7 @@
- + @@ -107,8 +107,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
16  */
17 
18 #include "SPP.h"
-
19 #define DEBUG // Uncomment to print data for debugging
-
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
+
19 // To enable serial debugging uncomment "#define DEBUG_USB_HOST" in message.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 /*
@@ -190,31 +190,31 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
99  if (((l2capinbuf[0] | (l2capinbuf[1] << 8)) == (hci_handle | 0x2000))) { // acl_handle_ok
100  if ((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001) { //l2cap_control - Channel ID for ACL-U
101  if (l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
-
102 #ifdef DEBUG
-
103  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
+
102 #ifdef DEBUG_USB_HOST
+
103  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
104  PrintHex<uint8_t > (l2capinbuf[13], 0x80);
-
105  Notify(PSTR(" "), 0x80);
+
105  Notify(PSTR(" "), 0x80);
106  PrintHex<uint8_t > (l2capinbuf[12], 0x80);
-
107  Notify(PSTR(" Data: "), 0x80);
+
107  Notify(PSTR(" Data: "), 0x80);
108  PrintHex<uint8_t > (l2capinbuf[17], 0x80);
-
109  Notify(PSTR(" "), 0x80);
+
109  Notify(PSTR(" "), 0x80);
110  PrintHex<uint8_t > (l2capinbuf[16], 0x80);
-
111  Notify(PSTR(" "), 0x80);
+
111  Notify(PSTR(" "), 0x80);
112  PrintHex<uint8_t > (l2capinbuf[15], 0x80);
-
113  Notify(PSTR(" "), 0x80);
+
113  Notify(PSTR(" "), 0x80);
114  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);
+
118  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
119  PrintHex<uint8_t > (l2capinbuf[13], 0x80);
-
120  Notify(PSTR(" "), 0x80);
+
120  Notify(PSTR(" "), 0x80);
121  PrintHex<uint8_t > (l2capinbuf[12], 0x80);
-
122  Notify(PSTR(" SCID: "), 0x80);
+
122  Notify(PSTR(" SCID: "), 0x80);
123  PrintHex<uint8_t > (l2capinbuf[15], 0x80);
-
124  Notify(PSTR(" "), 0x80);
+
124  Notify(PSTR(" "), 0x80);
125  PrintHex<uint8_t > (l2capinbuf[14], 0x80);
-
126  Notify(PSTR(" Identifier: "), 0x80);
+
126  Notify(PSTR(" Identifier: "), 0x80);
127  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
@@ -269,15 +269,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
178  l2cap_event_flag |= L2CAP_FLAG_DISCONNECT_RESPONSE;
179  }
180  } else if (l2capinbuf[8] == L2CAP_CMD_INFORMATION_REQUEST) {
-
181 #ifdef DEBUG
-
182  Notify(PSTR("\r\nInformation request"), 0x80);
+
181 #ifdef DEBUG_USB_HOST
+
182  Notify(PSTR("\r\nInformation request"), 0x80);
183 #endif
184  identifier = l2capinbuf[9];
185  pBtd->l2cap_information_response(hci_handle, identifier, l2capinbuf[12], l2capinbuf[13]);
186  }
187 #ifdef EXTRADEBUG
188  else {
-
189  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
+
189  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
190  PrintHex<uint8_t > (l2capinbuf[8], 0x80);
191  }
192 #endif
@@ -302,7 +302,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
211  } else
212  serviceNotSupported(l2capinbuf[9], l2capinbuf[10]); // The service is not supported
213 #ifdef EXTRADEBUG
-
214  Notify(PSTR("\r\nUUID: "), 0x80);
+
214  Notify(PSTR("\r\nUUID: "), 0x80);
215  uint16_t uuid;
216  if((l2capinbuf[16] << 8 | l2capinbuf[17]) == 0x0000) // Check if it's sending the UUID as a 128-bit UUID
217  uuid = (l2capinbuf[18] << 8 | l2capinbuf[19]);
@@ -310,596 +310,602 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
219  uuid = (l2capinbuf[16] << 8 | l2capinbuf[17]);
220  PrintHex<uint16_t> (uuid, 0x80);
221 
-
222  Notify(PSTR("\r\nLength: "), 0x80);
+
222  Notify(PSTR("\r\nLength: "), 0x80);
223  uint16_t length = l2capinbuf[11] << 8 | l2capinbuf[12];
224  PrintHex<uint16_t> (length, 0x80);
-
225  Notify(PSTR("\r\nData: "), 0x80);
+
225  Notify(PSTR("\r\nData: "), 0x80);
226  for (uint8_t i = 0; i < length; i++) {
227  PrintHex<uint8_t> (l2capinbuf[13+i], 0x80);
-
228  Notify(PSTR(" "), 0x80);
+
228  Notify(PSTR(" "), 0x80);
229  }
230 #endif
231  }
-
232  } else if (l2capinbuf[6] == rfcomm_dcid[0] && l2capinbuf[7] == rfcomm_dcid[1]) { // RFCOMM
-
233  rfcommChannel = l2capinbuf[8] & 0xF8;
-
234  rfcommDirection = l2capinbuf[8] & 0x04;
-
235  rfcommCommandResponse = l2capinbuf[8] & 0x02;
-
236  rfcommChannelType = l2capinbuf[9] & 0xEF;
-
237  rfcommPfBit = l2capinbuf[9] & 0x10;
-
238 
-
239  if (rfcommChannel >> 3 != 0x00)
-
240  rfcommChannelConnection = rfcommChannel;
-
241 
-
242 #ifdef EXTRADEBUG
-
243  Notify(PSTR("\r\nRFCOMM Channel: "), 0x80);
-
244  PrintHex<uint8_t > (rfcommChannel >> 3, 0x80);
-
245  Notify(PSTR(" Direction: "), 0x80);
-
246  PrintHex<uint8_t > (rfcommDirection >> 2, 0x80);
-
247  Notify(PSTR(" CommandResponse: "), 0x80);
-
248  PrintHex<uint8_t > (rfcommCommandResponse >> 1, 0x80);
-
249  Notify(PSTR(" ChannelType: "), 0x80);
-
250  PrintHex<uint8_t > (rfcommChannelType, 0x80);
-
251  Notify(PSTR(" PF_BIT: "), 0x80);
-
252  PrintHex<uint8_t > (rfcommPfBit, 0x80);
-
253 #endif
-
254  if (rfcommChannelType == RFCOMM_DISC) {
-
255 #ifdef DEBUG
-
256  Notify(PSTR("\r\nReceived Disconnect RFCOMM Command on channel: "), 0x80);
-
257  PrintHex<uint8_t > (rfcommChannel >> 3, 0x80);
-
258 #endif
-
259  connected = false;
-
260  sendRfcomm(rfcommChannel, rfcommDirection, rfcommCommandResponse, RFCOMM_UA, rfcommPfBit, rfcommbuf, 0x00); // UA Command
-
261  }
-
262  if (connected) {
-
263  /* Read the incoming message */
-
264  if (rfcommChannelType == RFCOMM_UIH && rfcommChannel == rfcommChannelConnection) {
-
265  uint8_t length = l2capinbuf[10] >> 1; // Get length
-
266  uint8_t offset = l2capinbuf[4] - length - 4; // See if there is credit
-
267  if (rfcommAvailable + length <= sizeof (rfcommDataBuffer)) { // Don't add data to buffer if it would be full
-
268  for (uint8_t i = 0; i < length; i++)
-
269  rfcommDataBuffer[rfcommAvailable + i] = l2capinbuf[11 + i + offset];
-
270  rfcommAvailable += length;
-
271  }
-
272 #ifdef EXTRADEBUG
-
273  Notify(PSTR("\r\nRFCOMM Data Available: "), 0x80);
-
274  Notify(rfcommAvailable, 0x80);
-
275  if (offset) {
-
276  Notify(PSTR(" - Credit: 0x"), 0x80);
-
277  PrintHex<uint8_t > (l2capinbuf[11], 0x80);
-
278  }
-
279 #endif
-
280 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send to the Arduino via Bluetooth
-
281  for (uint8_t i = 0; i < length; i++)
-
282  Notifyc(l2capinbuf[i + 11 + offset], 0x80);
-
283 #endif
-
284  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_RPN_CMD) { // UIH Remote Port Negotiation Command
-
285 #ifdef DEBUG
-
286  Notify(PSTR("\r\nReceived UIH Remote Port Negotiation Command"), 0x80);
-
287 #endif
-
288  rfcommbuf[0] = BT_RFCOMM_RPN_RSP; // Command
-
289  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
-
290  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
-
291  rfcommbuf[3] = l2capinbuf[14]; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
-
292  rfcommbuf[4] = l2capinbuf[15]; // Priority
-
293  rfcommbuf[5] = l2capinbuf[16]; // Timer
-
294  rfcommbuf[6] = l2capinbuf[17]; // Max Fram Size LSB
-
295  rfcommbuf[7] = l2capinbuf[18]; // Max Fram Size MSB
-
296  rfcommbuf[8] = l2capinbuf[19]; // MaxRatransm.
-
297  rfcommbuf[9] = l2capinbuf[20]; // Number of Frames
-
298  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A); // UIH Remote Port Negotiation Response
-
299  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_CMD) { // UIH Modem Status Command
-
300 #ifdef DEBUG
-
301  Notify(PSTR("\r\nSend UIH Modem Status Response"), 0x80);
-
302 #endif
-
303  rfcommbuf[0] = BT_RFCOMM_MSC_RSP; // UIH Modem Status Response
-
304  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
-
305  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
-
306  rfcommbuf[3] = l2capinbuf[14];
-
307  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
-
308  }
-
309  } else {
-
310  if (rfcommChannelType == RFCOMM_SABM) { // SABM Command - this is sent twice: once for channel 0 and then for the channel to establish
-
311 #ifdef DEBUG
-
312  Notify(PSTR("\r\nReceived SABM Command"), 0x80);
-
313 #endif
-
314  sendRfcomm(rfcommChannel, rfcommDirection, rfcommCommandResponse, RFCOMM_UA, rfcommPfBit, rfcommbuf, 0x00); // UA Command
-
315  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_PN_CMD) { // UIH Parameter Negotiation Command
-
316 #ifdef DEBUG
-
317  Notify(PSTR("\r\nReceived UIH Parameter Negotiation Command"), 0x80);
-
318 #endif
-
319  rfcommbuf[0] = BT_RFCOMM_PN_RSP; // UIH Parameter Negotiation Response
-
320  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
-
321  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
-
322  rfcommbuf[3] = 0xE0; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
-
323  rfcommbuf[4] = 0x00; // Priority
-
324  rfcommbuf[5] = 0x00; // Timer
-
325  rfcommbuf[6] = BULK_MAXPKTSIZE - 14; // Max Fram Size LSB - set to the size of received data (50)
-
326  rfcommbuf[7] = 0x00; // Max Fram Size MSB
-
327  rfcommbuf[8] = 0x00; // MaxRatransm.
-
328  rfcommbuf[9] = 0x00; // Number of Frames
-
329  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A);
-
330  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_CMD) { // UIH Modem Status Command
-
331 #ifdef DEBUG
-
332  Notify(PSTR("\r\nSend UIH Modem Status Response"), 0x80);
-
333 #endif
-
334  rfcommbuf[0] = BT_RFCOMM_MSC_RSP; // UIH Modem Status Response
-
335  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
-
336  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
-
337  rfcommbuf[3] = l2capinbuf[14];
-
338  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
-
339 
-
340  delay(1);
-
341 #ifdef DEBUG
-
342  Notify(PSTR("\r\nSend UIH Modem Status Command"), 0x80);
-
343 #endif
-
344  rfcommbuf[0] = BT_RFCOMM_MSC_CMD; // UIH Modem Status Command
-
345  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
-
346  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
-
347  rfcommbuf[3] = 0x8D; // Can receive frames (YES), Ready to Communicate (YES), Ready to Receive (YES), Incomig Call (NO), Data is Value (YES)
-
348 
-
349  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
-
350  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_RSP) { // UIH Modem Status Response
-
351  if (!creditSent) {
-
352 #ifdef DEBUG
-
353  Notify(PSTR("\r\nSend UIH Command with credit"), 0x80);
-
354 #endif
-
355  sendRfcommCredit(rfcommChannelConnection, rfcommDirection, 0, RFCOMM_UIH, 0x10, sizeof (rfcommDataBuffer)); // Send credit
-
356  creditSent = true;
-
357  timer = millis();
-
358  waitForLastCommand = true;
-
359  }
-
360  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[10] == 0x01) { // UIH Command with credit
-
361 #ifdef DEBUG
-
362  Notify(PSTR("\r\nReceived UIH Command with credit"), 0x80);
-
363 #endif
-
364  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_RPN_CMD) { // UIH Remote Port Negotiation Command
-
365 #ifdef DEBUG
-
366  Notify(PSTR("\r\nReceived UIH Remote Port Negotiation Command"), 0x80);
-
367 #endif
-
368  rfcommbuf[0] = BT_RFCOMM_RPN_RSP; // Command
-
369  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
-
370  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
-
371  rfcommbuf[3] = l2capinbuf[14]; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
-
372  rfcommbuf[4] = l2capinbuf[15]; // Priority
-
373  rfcommbuf[5] = l2capinbuf[16]; // Timer
-
374  rfcommbuf[6] = l2capinbuf[17]; // Max Fram Size LSB
-
375  rfcommbuf[7] = l2capinbuf[18]; // Max Fram Size MSB
-
376  rfcommbuf[8] = l2capinbuf[19]; // MaxRatransm.
-
377  rfcommbuf[9] = l2capinbuf[20]; // Number of Frames
-
378  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A); // UIH Remote Port Negotiation Response
-
379 #ifdef DEBUG
-
380  Notify(PSTR("\r\nRFCOMM Connection is now established\r\n"), 0x80);
-
381 #endif
-
382  waitForLastCommand = false;
-
383  creditSent = false;
-
384  connected = true; // The RFCOMM channel is now established
-
385  sppIndex = 0;
-
386  }
-
387 #ifdef DEBUG
-
388  else if (rfcommChannelType != RFCOMM_DISC) {
-
389  Notify(PSTR("\r\nUnsupported RFCOMM Data - ChannelType: "), 0x80);
-
390  PrintHex<uint8_t > (rfcommChannelType, 0x80);
-
391  Notify(PSTR(" Command: "), 0x80);
-
392  PrintHex<uint8_t > (l2capinbuf[11], 0x80);
-
393  }
-
394 #endif
-
395  }
-
396  }
-
397 #ifdef EXTRADEBUG
-
398  else {
-
399  Notify(PSTR("\r\nUnsupported L2CAP Data - Channel ID: "), 0x80);
-
400  PrintHex<uint8_t > (l2capinbuf[7], 0x80);
-
401  Notify(PSTR(" "), 0x80);
-
402  PrintHex<uint8_t > (l2capinbuf[6], 0x80);
-
403  }
-
404 #endif
-
405  SDP_task();
-
406  RFCOMM_task();
-
407  }
-
408 }
-
409 
-
410 void SPP::Run() {
-
411  if (waitForLastCommand && (millis() - timer) > 100) { // We will only wait 100ms and see if the UIH Remote Port Negotiation Command is send, as some deviced don't send it
-
412 #ifdef DEBUG
-
413  Notify(PSTR("\r\nRFCOMM Connection is now established - Automatic\r\n"), 0x80);
-
414 #endif
-
415  creditSent = false;
-
416  waitForLastCommand = false;
-
417  connected = true; // The RFCOMM channel is now established
-
418  sppIndex = 0;
-
419  }
-
420  send(); // Send all bytes currently in the buffer
-
421 }
-
422 
-
423 void SPP::SDP_task() {
-
424  switch (l2cap_sdp_state) {
-
425  case L2CAP_SDP_WAIT:
-
426  if (l2cap_connection_request_sdp_flag) {
-
427  l2cap_event_flag &= ~L2CAP_FLAG_CONNECTION_SDP_REQUEST; // Clear flag
-
428 #ifdef DEBUG
-
429  Notify(PSTR("\r\nSDP Incoming Connection Request"), 0x80);
-
430 #endif
-
431  pBtd->l2cap_connection_response(hci_handle, identifier, sdp_dcid, sdp_scid, PENDING);
-
432  delay(1);
-
433  pBtd->l2cap_connection_response(hci_handle, identifier, sdp_dcid, sdp_scid, SUCCESSFUL);
-
434  identifier++;
-
435  delay(1);
-
436  pBtd->l2cap_config_request(hci_handle, identifier, sdp_scid);
-
437  l2cap_sdp_state = L2CAP_SDP_REQUEST;
-
438  }
-
439  break;
-
440  case L2CAP_SDP_REQUEST:
-
441  if (l2cap_config_request_sdp_flag) {
-
442  l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_SDP_REQUEST; // Clear flag
-
443 #ifdef DEBUG
-
444  Notify(PSTR("\r\nSDP Configuration Request"), 0x80);
-
445 #endif
-
446  pBtd->l2cap_config_response(hci_handle, identifier, sdp_scid);
-
447  l2cap_sdp_state = L2CAP_SDP_SUCCESS;
-
448  }
-
449  break;
-
450  case L2CAP_SDP_SUCCESS:
-
451  if (l2cap_config_success_sdp_flag) {
-
452  l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_SDP_SUCCESS; // Clear flag
-
453 #ifdef DEBUG
-
454  Notify(PSTR("\r\nSDP Successfully Configured"), 0x80);
-
455 #endif
-
456  firstMessage = true; // Reset bool
-
457  SDPConnected = true;
-
458  l2cap_sdp_state = L2CAP_SDP_DONE;
-
459  }
-
460  break;
-
461  case L2CAP_SDP_DONE:
-
462  if (l2cap_disconnect_request_sdp_flag) {
-
463  l2cap_event_flag &= ~L2CAP_FLAG_DISCONNECT_SDP_REQUEST; // Clear flag
-
464  SDPConnected = false;
-
465 #ifdef DEBUG
-
466  Notify(PSTR("\r\nDisconnected SDP Channel"), 0x80);
-
467 #endif
-
468  pBtd->l2cap_disconnection_response(hci_handle, identifier, sdp_dcid, sdp_scid);
-
469  l2cap_sdp_state = L2CAP_SDP_WAIT;
-
470  } else if (l2cap_connection_request_sdp_flag)
-
471  l2cap_rfcomm_state = L2CAP_SDP_WAIT;
-
472  break;
-
473  case L2CAP_DISCONNECT_RESPONSE: // This is for both disconnection response from the RFCOMM and SDP channel if they were connected
-
474  if (l2cap_disconnect_response_flag) {
-
475 #ifdef DEBUG
-
476  Notify(PSTR("\r\nDisconnected L2CAP Connection"), 0x80);
-
477 #endif
-
478  RFCOMMConnected = false;
-
479  SDPConnected = false;
-
480  pBtd->hci_disconnect(hci_handle);
-
481  hci_handle = -1; // Reset handle
-
482  l2cap_event_flag = 0; // Reset flags
-
483  l2cap_sdp_state = L2CAP_SDP_WAIT;
-
484  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
-
485  }
-
486  break;
-
487  }
-
488 }
-
489 
-
490 void SPP::RFCOMM_task() {
-
491  switch (l2cap_rfcomm_state) {
-
492  case L2CAP_RFCOMM_WAIT:
-
493  if (l2cap_connection_request_rfcomm_flag) {
-
494  l2cap_event_flag &= ~L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST; // Clear flag
-
495 #ifdef DEBUG
-
496  Notify(PSTR("\r\nRFCOMM Incoming Connection Request"), 0x80);
-
497 #endif
-
498  pBtd->l2cap_connection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid, PENDING);
-
499  delay(1);
-
500  pBtd->l2cap_connection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid, SUCCESSFUL);
-
501  identifier++;
-
502  delay(1);
-
503  pBtd->l2cap_config_request(hci_handle, identifier, rfcomm_scid);
-
504  l2cap_rfcomm_state = L2CAP_RFCOMM_REQUEST;
-
505  }
-
506  break;
-
507  case L2CAP_RFCOMM_REQUEST:
-
508  if (l2cap_config_request_rfcomm_flag) {
-
509  l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_RFCOMM_REQUEST; // Clear flag
-
510 #ifdef DEBUG
-
511  Notify(PSTR("\r\nRFCOMM Configuration Request"), 0x80);
-
512 #endif
-
513  pBtd->l2cap_config_response(hci_handle, identifier, rfcomm_scid);
-
514  l2cap_rfcomm_state = L2CAP_RFCOMM_SUCCESS;
-
515  }
-
516  break;
-
517  case L2CAP_RFCOMM_SUCCESS:
-
518  if (l2cap_config_success_rfcomm_flag) {
-
519  l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS; // Clear flag
-
520 #ifdef DEBUG
-
521  Notify(PSTR("\r\nRFCOMM Successfully Configured"), 0x80);
-
522 #endif
-
523  rfcommAvailable = 0; // Reset number of bytes available
-
524  bytesRead = 0; // Reset number of bytes received
-
525  RFCOMMConnected = true;
-
526  l2cap_rfcomm_state = L2CAP_RFCOMM_DONE;
-
527  }
-
528  break;
-
529  case L2CAP_RFCOMM_DONE:
-
530  if (l2cap_disconnect_request_rfcomm_flag) {
-
531  l2cap_event_flag &= ~L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST; // Clear flag
-
532  RFCOMMConnected = false;
-
533  connected = false;
-
534 #ifdef DEBUG
-
535  Notify(PSTR("\r\nDisconnected RFCOMM Channel"), 0x80);
-
536 #endif
-
537  pBtd->l2cap_disconnection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid);
-
538  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
-
539  } else if (l2cap_connection_request_rfcomm_flag)
-
540  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
-
541  break;
-
542  }
-
543 }
-
544 /************************************************************/
-
545 /* SDP Commands */
-
546 
-
547 /************************************************************/
-
548 void SPP::SDP_Command(uint8_t* data, uint8_t nbytes) { // See page 223 in the Bluetooth specs
-
549  pBtd->L2CAP_Command(hci_handle, data, nbytes, sdp_scid[0], sdp_scid[1]);
-
550 }
-
551 
-
552 void SPP::serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow) { // See page 235 in the Bluetooth specs
-
553  l2capoutbuf[0] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
-
554  l2capoutbuf[1] = transactionIDHigh;
-
555  l2capoutbuf[2] = transactionIDLow;
-
556  l2capoutbuf[3] = 0x00; // Parameter Length
-
557  l2capoutbuf[4] = 0x05; // Parameter Length
-
558  l2capoutbuf[5] = 0x00; // AttributeListsByteCount
-
559  l2capoutbuf[6] = 0x02; // AttributeListsByteCount
-
560 
-
561  /* Attribute ID/Value Sequence: */
-
562  l2capoutbuf[7] = 0x35;
-
563  l2capoutbuf[8] = 0x00;
-
564  l2capoutbuf[9] = 0x00;
-
565 
-
566  SDP_Command(l2capoutbuf, 10);
-
567 }
-
568 
-
569 void SPP::serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
-
570  l2capoutbuf[0] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
-
571  l2capoutbuf[1] = transactionIDHigh;
-
572  l2capoutbuf[2] = transactionIDLow;
-
573  l2capoutbuf[3] = 0x00; // Parameter Length
-
574  l2capoutbuf[4] = 0x2B; // Parameter Length
-
575  l2capoutbuf[5] = 0x00; // AttributeListsByteCount
-
576  l2capoutbuf[6] = 0x26; // AttributeListsByteCount
-
577 
-
578  /* Attribute ID/Value Sequence: */
-
579  l2capoutbuf[7] = 0x36;
-
580  l2capoutbuf[8] = 0x00;
-
581  l2capoutbuf[9] = 0x3C;
-
582  l2capoutbuf[10] = 0x36;
-
583  l2capoutbuf[11] = 0x00;
-
584 
-
585  l2capoutbuf[12] = 0x39;
-
586  l2capoutbuf[13] = 0x09;
-
587  l2capoutbuf[14] = 0x00;
-
588  l2capoutbuf[15] = 0x00;
-
589  l2capoutbuf[16] = 0x0A;
-
590  l2capoutbuf[17] = 0x00;
-
591  l2capoutbuf[18] = 0x01;
-
592  l2capoutbuf[19] = 0x00;
-
593  l2capoutbuf[20] = 0x06;
-
594  l2capoutbuf[21] = 0x09;
-
595  l2capoutbuf[22] = 0x00;
-
596  l2capoutbuf[23] = 0x01;
-
597  l2capoutbuf[24] = 0x35;
-
598  l2capoutbuf[25] = 0x03;
-
599  l2capoutbuf[26] = 0x19;
-
600  l2capoutbuf[27] = 0x11;
-
601 
-
602  l2capoutbuf[28] = 0x01;
-
603  l2capoutbuf[29] = 0x09;
-
604  l2capoutbuf[30] = 0x00;
-
605  l2capoutbuf[31] = 0x04;
-
606  l2capoutbuf[32] = 0x35;
-
607  l2capoutbuf[33] = 0x0C;
-
608  l2capoutbuf[34] = 0x35;
-
609  l2capoutbuf[35] = 0x03;
-
610  l2capoutbuf[36] = 0x19;
-
611  l2capoutbuf[37] = 0x01;
-
612  l2capoutbuf[38] = 0x00;
-
613  l2capoutbuf[39] = 0x35;
-
614  l2capoutbuf[40] = 0x05;
-
615  l2capoutbuf[41] = 0x19;
-
616  l2capoutbuf[42] = 0x00;
-
617  l2capoutbuf[43] = 0x03;
-
618 
-
619  l2capoutbuf[44] = 0x08;
-
620  l2capoutbuf[45] = 0x02; // Two extra bytes
-
621  l2capoutbuf[46] = 0x00; // 25 (0x19) more bytes to come
-
622  l2capoutbuf[47] = 0x19;
-
623 
-
624  SDP_Command(l2capoutbuf, 48);
-
625 }
-
626 
-
627 void SPP::serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
-
628  l2capoutbuf[0] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
-
629  l2capoutbuf[1] = transactionIDHigh;
-
630  l2capoutbuf[2] = transactionIDLow;
-
631  l2capoutbuf[3] = 0x00; // Parameter Length
-
632  l2capoutbuf[4] = 0x1C; // Parameter Length
-
633  l2capoutbuf[5] = 0x00; // AttributeListsByteCount
-
634  l2capoutbuf[6] = 0x19; // AttributeListsByteCount
-
635 
-
636  /* Attribute ID/Value Sequence: */
-
637  l2capoutbuf[7] = 0x01;
-
638  l2capoutbuf[8] = 0x09;
-
639  l2capoutbuf[9] = 0x00;
-
640  l2capoutbuf[10] = 0x06;
-
641  l2capoutbuf[11] = 0x35;
-
642 
-
643  l2capoutbuf[12] = 0x09;
-
644  l2capoutbuf[13] = 0x09;
-
645  l2capoutbuf[14] = 0x65;
-
646  l2capoutbuf[15] = 0x6E;
-
647  l2capoutbuf[16] = 0x09;
-
648  l2capoutbuf[17] = 0x00;
-
649  l2capoutbuf[18] = 0x6A;
-
650  l2capoutbuf[19] = 0x09;
-
651  l2capoutbuf[20] = 0x01;
-
652  l2capoutbuf[21] = 0x00;
-
653  l2capoutbuf[22] = 0x09;
-
654  l2capoutbuf[23] = 0x01;
-
655  l2capoutbuf[24] = 0x00;
-
656  l2capoutbuf[25] = 0x25;
-
657 
-
658  l2capoutbuf[26] = 0x05; // Name length
-
659  l2capoutbuf[27] = 'T';
-
660  l2capoutbuf[28] = 'K';
-
661  l2capoutbuf[29] = 'J';
-
662  l2capoutbuf[30] = 'S';
-
663  l2capoutbuf[31] = 'P';
-
664  l2capoutbuf[32] = 0x00; // No more data
-
665 
-
666  SDP_Command(l2capoutbuf, 33);
-
667 }
-
668 
-
669 void SPP::l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
-
670  serialPortResponse1(transactionIDHigh, transactionIDLow); // These has to send all the supported functions, since it only supports virtual serialport it just sends the message again
-
671 }
-
672 
-
673 void SPP::l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
-
674  serialPortResponse2(transactionIDHigh, transactionIDLow); // Same data as serialPortResponse2
-
675 }
-
676 /************************************************************/
-
677 /* RFCOMM Commands */
+
232 #ifdef EXTRADEBUG
+
233  else {
+
234  Notify(PSTR("\r\nUnknown PDU: "));
+
235  PrintHex<uint8_t > (l2capinbuf[8], 0x80);
+
236  }
+
237 #endif
+
238  } else if (l2capinbuf[6] == rfcomm_dcid[0] && l2capinbuf[7] == rfcomm_dcid[1]) { // RFCOMM
+
239  rfcommChannel = l2capinbuf[8] & 0xF8;
+
240  rfcommDirection = l2capinbuf[8] & 0x04;
+
241  rfcommCommandResponse = l2capinbuf[8] & 0x02;
+
242  rfcommChannelType = l2capinbuf[9] & 0xEF;
+
243  rfcommPfBit = l2capinbuf[9] & 0x10;
+
244 
+
245  if (rfcommChannel >> 3 != 0x00)
+
246  rfcommChannelConnection = rfcommChannel;
+
247 
+
248 #ifdef EXTRADEBUG
+
249  Notify(PSTR("\r\nRFCOMM Channel: "), 0x80);
+
250  PrintHex<uint8_t > (rfcommChannel >> 3, 0x80);
+
251  Notify(PSTR(" Direction: "), 0x80);
+
252  PrintHex<uint8_t > (rfcommDirection >> 2, 0x80);
+
253  Notify(PSTR(" CommandResponse: "), 0x80);
+
254  PrintHex<uint8_t > (rfcommCommandResponse >> 1, 0x80);
+
255  Notify(PSTR(" ChannelType: "), 0x80);
+
256  PrintHex<uint8_t > (rfcommChannelType, 0x80);
+
257  Notify(PSTR(" PF_BIT: "), 0x80);
+
258  PrintHex<uint8_t > (rfcommPfBit, 0x80);
+
259 #endif
+
260  if (rfcommChannelType == RFCOMM_DISC) {
+
261 #ifdef DEBUG_USB_HOST
+
262  Notify(PSTR("\r\nReceived Disconnect RFCOMM Command on channel: "), 0x80);
+
263  PrintHex<uint8_t > (rfcommChannel >> 3, 0x80);
+
264 #endif
+
265  connected = false;
+
266  sendRfcomm(rfcommChannel, rfcommDirection, rfcommCommandResponse, RFCOMM_UA, rfcommPfBit, rfcommbuf, 0x00); // UA Command
+
267  }
+
268  if (connected) {
+
269  /* Read the incoming message */
+
270  if (rfcommChannelType == RFCOMM_UIH && rfcommChannel == rfcommChannelConnection) {
+
271  uint8_t length = l2capinbuf[10] >> 1; // Get length
+
272  uint8_t offset = l2capinbuf[4] - length - 4; // See if there is credit
+
273  if (rfcommAvailable + length <= sizeof (rfcommDataBuffer)) { // Don't add data to buffer if it would be full
+
274  for (uint8_t i = 0; i < length; i++)
+
275  rfcommDataBuffer[rfcommAvailable + i] = l2capinbuf[11 + i + offset];
+
276  rfcommAvailable += length;
+
277  }
+
278 #ifdef EXTRADEBUG
+
279  Notify(PSTR("\r\nRFCOMM Data Available: "), 0x80);
+
280  Notify(rfcommAvailable, 0x80);
+
281  if (offset) {
+
282  Notify(PSTR(" - Credit: 0x"), 0x80);
+
283  PrintHex<uint8_t > (l2capinbuf[11], 0x80);
+
284  }
+
285 #endif
+
286 #ifdef PRINTREPORT // Uncomment "#define PRINTREPORT" to print the report send to the Arduino via Bluetooth
+
287  for (uint8_t i = 0; i < length; i++)
+
288  Notifyc(l2capinbuf[i + 11 + offset], 0x80);
+
289 #endif
+
290  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_RPN_CMD) { // UIH Remote Port Negotiation Command
+
291 #ifdef DEBUG_USB_HOST
+
292  Notify(PSTR("\r\nReceived UIH Remote Port Negotiation Command"), 0x80);
+
293 #endif
+
294  rfcommbuf[0] = BT_RFCOMM_RPN_RSP; // Command
+
295  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
+
296  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
+
297  rfcommbuf[3] = l2capinbuf[14]; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
+
298  rfcommbuf[4] = l2capinbuf[15]; // Priority
+
299  rfcommbuf[5] = l2capinbuf[16]; // Timer
+
300  rfcommbuf[6] = l2capinbuf[17]; // Max Fram Size LSB
+
301  rfcommbuf[7] = l2capinbuf[18]; // Max Fram Size MSB
+
302  rfcommbuf[8] = l2capinbuf[19]; // MaxRatransm.
+
303  rfcommbuf[9] = l2capinbuf[20]; // Number of Frames
+
304  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A); // UIH Remote Port Negotiation Response
+
305  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_CMD) { // UIH Modem Status Command
+
306 #ifdef DEBUG_USB_HOST
+
307  Notify(PSTR("\r\nSend UIH Modem Status Response"), 0x80);
+
308 #endif
+
309  rfcommbuf[0] = BT_RFCOMM_MSC_RSP; // UIH Modem Status Response
+
310  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
+
311  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
+
312  rfcommbuf[3] = l2capinbuf[14];
+
313  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
+
314  }
+
315  } else {
+
316  if (rfcommChannelType == RFCOMM_SABM) { // SABM Command - this is sent twice: once for channel 0 and then for the channel to establish
+
317 #ifdef DEBUG_USB_HOST
+
318  Notify(PSTR("\r\nReceived SABM Command"), 0x80);
+
319 #endif
+
320  sendRfcomm(rfcommChannel, rfcommDirection, rfcommCommandResponse, RFCOMM_UA, rfcommPfBit, rfcommbuf, 0x00); // UA Command
+
321  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_PN_CMD) { // UIH Parameter Negotiation Command
+
322 #ifdef DEBUG_USB_HOST
+
323  Notify(PSTR("\r\nReceived UIH Parameter Negotiation Command"), 0x80);
+
324 #endif
+
325  rfcommbuf[0] = BT_RFCOMM_PN_RSP; // UIH Parameter Negotiation Response
+
326  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
+
327  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
+
328  rfcommbuf[3] = 0xE0; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
+
329  rfcommbuf[4] = 0x00; // Priority
+
330  rfcommbuf[5] = 0x00; // Timer
+
331  rfcommbuf[6] = BULK_MAXPKTSIZE - 14; // Max Fram Size LSB - set to the size of received data (50)
+
332  rfcommbuf[7] = 0x00; // Max Fram Size MSB
+
333  rfcommbuf[8] = 0x00; // MaxRatransm.
+
334  rfcommbuf[9] = 0x00; // Number of Frames
+
335  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A);
+
336  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_CMD) { // UIH Modem Status Command
+
337 #ifdef DEBUG_USB_HOST
+
338  Notify(PSTR("\r\nSend UIH Modem Status Response"), 0x80);
+
339 #endif
+
340  rfcommbuf[0] = BT_RFCOMM_MSC_RSP; // UIH Modem Status Response
+
341  rfcommbuf[1] = 2 << 1 | 1; // Length and shiftet like so: length << 1 | 1
+
342  rfcommbuf[2] = l2capinbuf[13]; // Channel: (1 << 0) | (1 << 1) | (0 << 2) | (channel << 3)
+
343  rfcommbuf[3] = l2capinbuf[14];
+
344  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
+
345 
+
346  delay(1);
+
347 #ifdef DEBUG_USB_HOST
+
348  Notify(PSTR("\r\nSend UIH Modem Status Command"), 0x80);
+
349 #endif
+
350  rfcommbuf[0] = BT_RFCOMM_MSC_CMD; // UIH Modem Status Command
+
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] = 0x8D; // Can receive frames (YES), Ready to Communicate (YES), Ready to Receive (YES), Incomig Call (NO), Data is Value (YES)
+
354 
+
355  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x04);
+
356  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_MSC_RSP) { // UIH Modem Status Response
+
357  if (!creditSent) {
+
358 #ifdef DEBUG_USB_HOST
+
359  Notify(PSTR("\r\nSend UIH Command with credit"), 0x80);
+
360 #endif
+
361  sendRfcommCredit(rfcommChannelConnection, rfcommDirection, 0, RFCOMM_UIH, 0x10, sizeof (rfcommDataBuffer)); // Send credit
+
362  creditSent = true;
+
363  timer = millis();
+
364  waitForLastCommand = true;
+
365  }
+
366  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[10] == 0x01) { // UIH Command with credit
+
367 #ifdef DEBUG_USB_HOST
+
368  Notify(PSTR("\r\nReceived UIH Command with credit"), 0x80);
+
369 #endif
+
370  } else if (rfcommChannelType == RFCOMM_UIH && l2capinbuf[11] == BT_RFCOMM_RPN_CMD) { // UIH Remote Port Negotiation Command
+
371 #ifdef DEBUG_USB_HOST
+
372  Notify(PSTR("\r\nReceived UIH Remote Port Negotiation Command"), 0x80);
+
373 #endif
+
374  rfcommbuf[0] = BT_RFCOMM_RPN_RSP; // Command
+
375  rfcommbuf[1] = l2capinbuf[12]; // Length and shiftet like so: length << 1 | 1
+
376  rfcommbuf[2] = l2capinbuf[13]; // Channel: channel << 1 | 1
+
377  rfcommbuf[3] = l2capinbuf[14]; // Pre difined for Bluetooth, see 5.5.3 of TS 07.10 Adaption for RFCOMM
+
378  rfcommbuf[4] = l2capinbuf[15]; // Priority
+
379  rfcommbuf[5] = l2capinbuf[16]; // Timer
+
380  rfcommbuf[6] = l2capinbuf[17]; // Max Fram Size LSB
+
381  rfcommbuf[7] = l2capinbuf[18]; // Max Fram Size MSB
+
382  rfcommbuf[8] = l2capinbuf[19]; // MaxRatransm.
+
383  rfcommbuf[9] = l2capinbuf[20]; // Number of Frames
+
384  sendRfcomm(rfcommChannel, rfcommDirection, 0, RFCOMM_UIH, rfcommPfBit, rfcommbuf, 0x0A); // UIH Remote Port Negotiation Response
+
385 #ifdef DEBUG_USB_HOST
+
386  Notify(PSTR("\r\nRFCOMM Connection is now established\r\n"), 0x80);
+
387 #endif
+
388  waitForLastCommand = false;
+
389  creditSent = false;
+
390  connected = true; // The RFCOMM channel is now established
+
391  sppIndex = 0;
+
392  }
+
393 #ifdef DEBUG_USB_HOST
+
394  else if (rfcommChannelType != RFCOMM_DISC) {
+
395  Notify(PSTR("\r\nUnsupported RFCOMM Data - ChannelType: "), 0x80);
+
396  PrintHex<uint8_t > (rfcommChannelType, 0x80);
+
397  Notify(PSTR(" Command: "), 0x80);
+
398  PrintHex<uint8_t > (l2capinbuf[11], 0x80);
+
399  }
+
400 #endif
+
401  }
+
402  }
+
403 #ifdef EXTRADEBUG
+
404  else {
+
405  Notify(PSTR("\r\nUnsupported L2CAP Data - Channel ID: "), 0x80);
+
406  PrintHex<uint8_t > (l2capinbuf[7], 0x80);
+
407  Notify(PSTR(" "), 0x80);
+
408  PrintHex<uint8_t > (l2capinbuf[6], 0x80);
+
409  }
+
410 #endif
+
411  SDP_task();
+
412  RFCOMM_task();
+
413  }
+
414 }
+
415 
+
416 void SPP::Run() {
+
417  if (waitForLastCommand && (millis() - timer) > 100) { // We will only wait 100ms and see if the UIH Remote Port Negotiation Command is send, as some deviced don't send it
+
418 #ifdef DEBUG_USB_HOST
+
419  Notify(PSTR("\r\nRFCOMM Connection is now established - Automatic\r\n"), 0x80);
+
420 #endif
+
421  creditSent = false;
+
422  waitForLastCommand = false;
+
423  connected = true; // The RFCOMM channel is now established
+
424  sppIndex = 0;
+
425  }
+
426  send(); // Send all bytes currently in the buffer
+
427 }
+
428 
+
429 void SPP::SDP_task() {
+
430  switch (l2cap_sdp_state) {
+
431  case L2CAP_SDP_WAIT:
+
432  if (l2cap_connection_request_sdp_flag) {
+
433  l2cap_event_flag &= ~L2CAP_FLAG_CONNECTION_SDP_REQUEST; // Clear flag
+
434 #ifdef DEBUG_USB_HOST
+
435  Notify(PSTR("\r\nSDP Incoming Connection Request"), 0x80);
+
436 #endif
+
437  pBtd->l2cap_connection_response(hci_handle, identifier, sdp_dcid, sdp_scid, PENDING);
+
438  delay(1);
+
439  pBtd->l2cap_connection_response(hci_handle, identifier, sdp_dcid, sdp_scid, SUCCESSFUL);
+
440  identifier++;
+
441  delay(1);
+
442  pBtd->l2cap_config_request(hci_handle, identifier, sdp_scid);
+
443  l2cap_sdp_state = L2CAP_SDP_REQUEST;
+
444  }
+
445  break;
+
446  case L2CAP_SDP_REQUEST:
+
447  if (l2cap_config_request_sdp_flag) {
+
448  l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_SDP_REQUEST; // Clear flag
+
449 #ifdef DEBUG_USB_HOST
+
450  Notify(PSTR("\r\nSDP Configuration Request"), 0x80);
+
451 #endif
+
452  pBtd->l2cap_config_response(hci_handle, identifier, sdp_scid);
+
453  l2cap_sdp_state = L2CAP_SDP_SUCCESS;
+
454  }
+
455  break;
+
456  case L2CAP_SDP_SUCCESS:
+
457  if (l2cap_config_success_sdp_flag) {
+
458  l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_SDP_SUCCESS; // Clear flag
+
459 #ifdef DEBUG_USB_HOST
+
460  Notify(PSTR("\r\nSDP Successfully Configured"), 0x80);
+
461 #endif
+
462  firstMessage = true; // Reset bool
+
463  SDPConnected = true;
+
464  l2cap_sdp_state = L2CAP_SDP_DONE;
+
465  }
+
466  break;
+
467  case L2CAP_SDP_DONE:
+
468  if (l2cap_disconnect_request_sdp_flag) {
+
469  l2cap_event_flag &= ~L2CAP_FLAG_DISCONNECT_SDP_REQUEST; // Clear flag
+
470  SDPConnected = false;
+
471 #ifdef DEBUG_USB_HOST
+
472  Notify(PSTR("\r\nDisconnected SDP Channel"), 0x80);
+
473 #endif
+
474  pBtd->l2cap_disconnection_response(hci_handle, identifier, sdp_dcid, sdp_scid);
+
475  l2cap_sdp_state = L2CAP_SDP_WAIT;
+
476  } else if (l2cap_connection_request_sdp_flag)
+
477  l2cap_rfcomm_state = L2CAP_SDP_WAIT;
+
478  break;
+
479  case L2CAP_DISCONNECT_RESPONSE: // This is for both disconnection response from the RFCOMM and SDP channel if they were connected
+
480  if (l2cap_disconnect_response_flag) {
+
481 #ifdef DEBUG_USB_HOST
+
482  Notify(PSTR("\r\nDisconnected L2CAP Connection"), 0x80);
+
483 #endif
+
484  RFCOMMConnected = false;
+
485  SDPConnected = false;
+
486  pBtd->hci_disconnect(hci_handle);
+
487  hci_handle = -1; // Reset handle
+
488  l2cap_event_flag = 0; // Reset flags
+
489  l2cap_sdp_state = L2CAP_SDP_WAIT;
+
490  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
+
491  }
+
492  break;
+
493  }
+
494 }
+
495 
+
496 void SPP::RFCOMM_task() {
+
497  switch (l2cap_rfcomm_state) {
+
498  case L2CAP_RFCOMM_WAIT:
+
499  if (l2cap_connection_request_rfcomm_flag) {
+
500  l2cap_event_flag &= ~L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST; // Clear flag
+
501 #ifdef DEBUG_USB_HOST
+
502  Notify(PSTR("\r\nRFCOMM Incoming Connection Request"), 0x80);
+
503 #endif
+
504  pBtd->l2cap_connection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid, PENDING);
+
505  delay(1);
+
506  pBtd->l2cap_connection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid, SUCCESSFUL);
+
507  identifier++;
+
508  delay(1);
+
509  pBtd->l2cap_config_request(hci_handle, identifier, rfcomm_scid);
+
510  l2cap_rfcomm_state = L2CAP_RFCOMM_REQUEST;
+
511  }
+
512  break;
+
513  case L2CAP_RFCOMM_REQUEST:
+
514  if (l2cap_config_request_rfcomm_flag) {
+
515  l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_RFCOMM_REQUEST; // Clear flag
+
516 #ifdef DEBUG_USB_HOST
+
517  Notify(PSTR("\r\nRFCOMM Configuration Request"), 0x80);
+
518 #endif
+
519  pBtd->l2cap_config_response(hci_handle, identifier, rfcomm_scid);
+
520  l2cap_rfcomm_state = L2CAP_RFCOMM_SUCCESS;
+
521  }
+
522  break;
+
523  case L2CAP_RFCOMM_SUCCESS:
+
524  if (l2cap_config_success_rfcomm_flag) {
+
525  l2cap_event_flag &= ~L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS; // Clear flag
+
526 #ifdef DEBUG_USB_HOST
+
527  Notify(PSTR("\r\nRFCOMM Successfully Configured"), 0x80);
+
528 #endif
+
529  rfcommAvailable = 0; // Reset number of bytes available
+
530  bytesRead = 0; // Reset number of bytes received
+
531  RFCOMMConnected = true;
+
532  l2cap_rfcomm_state = L2CAP_RFCOMM_DONE;
+
533  }
+
534  break;
+
535  case L2CAP_RFCOMM_DONE:
+
536  if (l2cap_disconnect_request_rfcomm_flag) {
+
537  l2cap_event_flag &= ~L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST; // Clear flag
+
538  RFCOMMConnected = false;
+
539  connected = false;
+
540 #ifdef DEBUG_USB_HOST
+
541  Notify(PSTR("\r\nDisconnected RFCOMM Channel"), 0x80);
+
542 #endif
+
543  pBtd->l2cap_disconnection_response(hci_handle, identifier, rfcomm_dcid, rfcomm_scid);
+
544  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
+
545  } else if (l2cap_connection_request_rfcomm_flag)
+
546  l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
+
547  break;
+
548  }
+
549 }
+
550 /************************************************************/
+
551 /* SDP Commands */
+
552 
+
553 /************************************************************/
+
554 void SPP::SDP_Command(uint8_t* data, uint8_t nbytes) { // See page 223 in the Bluetooth specs
+
555  pBtd->L2CAP_Command(hci_handle, data, nbytes, sdp_scid[0], sdp_scid[1]);
+
556 }
+
557 
+
558 void SPP::serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow) { // See page 235 in the Bluetooth specs
+
559  l2capoutbuf[0] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
+
560  l2capoutbuf[1] = transactionIDHigh;
+
561  l2capoutbuf[2] = transactionIDLow;
+
562  l2capoutbuf[3] = 0x00; // Parameter Length
+
563  l2capoutbuf[4] = 0x05; // Parameter Length
+
564  l2capoutbuf[5] = 0x00; // AttributeListsByteCount
+
565  l2capoutbuf[6] = 0x02; // AttributeListsByteCount
+
566 
+
567  /* Attribute ID/Value Sequence: */
+
568  l2capoutbuf[7] = 0x35;
+
569  l2capoutbuf[8] = 0x00;
+
570  l2capoutbuf[9] = 0x00;
+
571 
+
572  SDP_Command(l2capoutbuf, 10);
+
573 }
+
574 
+
575 void SPP::serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
+
576  l2capoutbuf[0] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
+
577  l2capoutbuf[1] = transactionIDHigh;
+
578  l2capoutbuf[2] = transactionIDLow;
+
579  l2capoutbuf[3] = 0x00; // Parameter Length
+
580  l2capoutbuf[4] = 0x2B; // Parameter Length
+
581  l2capoutbuf[5] = 0x00; // AttributeListsByteCount
+
582  l2capoutbuf[6] = 0x26; // AttributeListsByteCount
+
583 
+
584  /* Attribute ID/Value Sequence: */
+
585  l2capoutbuf[7] = 0x36;
+
586  l2capoutbuf[8] = 0x00;
+
587  l2capoutbuf[9] = 0x3C;
+
588  l2capoutbuf[10] = 0x36;
+
589  l2capoutbuf[11] = 0x00;
+
590 
+
591  l2capoutbuf[12] = 0x39;
+
592  l2capoutbuf[13] = 0x09;
+
593  l2capoutbuf[14] = 0x00;
+
594  l2capoutbuf[15] = 0x00;
+
595  l2capoutbuf[16] = 0x0A;
+
596  l2capoutbuf[17] = 0x00;
+
597  l2capoutbuf[18] = 0x01;
+
598  l2capoutbuf[19] = 0x00;
+
599  l2capoutbuf[20] = 0x06;
+
600  l2capoutbuf[21] = 0x09;
+
601  l2capoutbuf[22] = 0x00;
+
602  l2capoutbuf[23] = 0x01;
+
603  l2capoutbuf[24] = 0x35;
+
604  l2capoutbuf[25] = 0x03;
+
605  l2capoutbuf[26] = 0x19;
+
606  l2capoutbuf[27] = 0x11;
+
607 
+
608  l2capoutbuf[28] = 0x01;
+
609  l2capoutbuf[29] = 0x09;
+
610  l2capoutbuf[30] = 0x00;
+
611  l2capoutbuf[31] = 0x04;
+
612  l2capoutbuf[32] = 0x35;
+
613  l2capoutbuf[33] = 0x0C;
+
614  l2capoutbuf[34] = 0x35;
+
615  l2capoutbuf[35] = 0x03;
+
616  l2capoutbuf[36] = 0x19;
+
617  l2capoutbuf[37] = 0x01;
+
618  l2capoutbuf[38] = 0x00;
+
619  l2capoutbuf[39] = 0x35;
+
620  l2capoutbuf[40] = 0x05;
+
621  l2capoutbuf[41] = 0x19;
+
622  l2capoutbuf[42] = 0x00;
+
623  l2capoutbuf[43] = 0x03;
+
624 
+
625  l2capoutbuf[44] = 0x08;
+
626  l2capoutbuf[45] = 0x02; // Two extra bytes
+
627  l2capoutbuf[46] = 0x00; // 25 (0x19) more bytes to come
+
628  l2capoutbuf[47] = 0x19;
+
629 
+
630  SDP_Command(l2capoutbuf, 48);
+
631 }
+
632 
+
633 void SPP::serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
+
634  l2capoutbuf[0] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
+
635  l2capoutbuf[1] = transactionIDHigh;
+
636  l2capoutbuf[2] = transactionIDLow;
+
637  l2capoutbuf[3] = 0x00; // Parameter Length
+
638  l2capoutbuf[4] = 0x1C; // Parameter Length
+
639  l2capoutbuf[5] = 0x00; // AttributeListsByteCount
+
640  l2capoutbuf[6] = 0x19; // AttributeListsByteCount
+
641 
+
642  /* Attribute ID/Value Sequence: */
+
643  l2capoutbuf[7] = 0x01;
+
644  l2capoutbuf[8] = 0x09;
+
645  l2capoutbuf[9] = 0x00;
+
646  l2capoutbuf[10] = 0x06;
+
647  l2capoutbuf[11] = 0x35;
+
648 
+
649  l2capoutbuf[12] = 0x09;
+
650  l2capoutbuf[13] = 0x09;
+
651  l2capoutbuf[14] = 0x65;
+
652  l2capoutbuf[15] = 0x6E;
+
653  l2capoutbuf[16] = 0x09;
+
654  l2capoutbuf[17] = 0x00;
+
655  l2capoutbuf[18] = 0x6A;
+
656  l2capoutbuf[19] = 0x09;
+
657  l2capoutbuf[20] = 0x01;
+
658  l2capoutbuf[21] = 0x00;
+
659  l2capoutbuf[22] = 0x09;
+
660  l2capoutbuf[23] = 0x01;
+
661  l2capoutbuf[24] = 0x00;
+
662  l2capoutbuf[25] = 0x25;
+
663 
+
664  l2capoutbuf[26] = 0x05; // Name length
+
665  l2capoutbuf[27] = 'T';
+
666  l2capoutbuf[28] = 'K';
+
667  l2capoutbuf[29] = 'J';
+
668  l2capoutbuf[30] = 'S';
+
669  l2capoutbuf[31] = 'P';
+
670  l2capoutbuf[32] = 0x00; // No more data
+
671 
+
672  SDP_Command(l2capoutbuf, 33);
+
673 }
+
674 
+
675 void SPP::l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
+
676  serialPortResponse1(transactionIDHigh, transactionIDLow); // These has to send all the supported functions, since it only supports virtual serialport it just sends the message again
+
677 }
678 
-
679 /************************************************************/
-
680 void SPP::RFCOMM_Command(uint8_t* data, uint8_t nbytes) {
-
681  pBtd->L2CAP_Command(hci_handle, data, nbytes, rfcomm_scid[0], rfcomm_scid[1]);
-
682 }
-
683 
-
684 void SPP::sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t* data, uint8_t length) {
-
685  l2capoutbuf[0] = channel | direction | CR | extendAddress; // RFCOMM Address
-
686  l2capoutbuf[1] = channelType | pfBit; // RFCOMM Control
-
687  l2capoutbuf[2] = length << 1 | 0x01; // Length and format (always 0x01 bytes format)
-
688  uint8_t i = 0;
-
689  for (; i < length; i++)
-
690  l2capoutbuf[i + 3] = data[i];
-
691  l2capoutbuf[i + 3] = calcFcs(l2capoutbuf);
-
692 #ifdef EXTRADEBUG
-
693  Notify(PSTR(" - RFCOMM Data: "), 0x80);
-
694  for (i = 0; i < length + 4; i++) {
-
695  PrintHex<uint8_t > (l2capoutbuf[i], 0x80);
-
696  Notify(PSTR(" "), 0x80);
-
697  }
-
698 #endif
-
699  RFCOMM_Command(l2capoutbuf, length + 4);
-
700 }
-
701 
-
702 void SPP::sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit) {
-
703  l2capoutbuf[0] = channel | direction | CR | extendAddress; // RFCOMM Address
-
704  l2capoutbuf[1] = channelType | pfBit; // RFCOMM Control
-
705  l2capoutbuf[2] = 0x01; // Length = 0
-
706  l2capoutbuf[3] = credit; // Credit
-
707  l2capoutbuf[4] = calcFcs(l2capoutbuf);
-
708 #ifdef EXTRADEBUG
-
709  Notify(PSTR(" - RFCOMM Credit Data: "), 0x80);
-
710  for (uint8_t i = 0; i < 5; i++) {
-
711  PrintHex<uint8_t > (l2capoutbuf[i], 0x80);
-
712  Notify(PSTR(" "), 0x80);
-
713  }
-
714 #endif
-
715  RFCOMM_Command(l2capoutbuf, 5);
-
716 }
-
717 
-
718 /* CRC on 2 bytes */
-
719 uint8_t SPP::__crc(uint8_t* data) {
-
720  return (pgm_read_byte(&rfcomm_crc_table[pgm_read_byte(&rfcomm_crc_table[0xff ^ data[0]]) ^ data[1]]));
-
721 }
-
722 
-
723 /* Calculate FCS - we never actually check if the host sends correct FCS to the Arduino */
-
724 uint8_t SPP::calcFcs(uint8_t *data) {
-
725  if ((data[1] & 0xEF) == RFCOMM_UIH)
-
726  return (0xff - __crc(data)); // FCS on 2 bytes
-
727  else
-
728  return (0xff - pgm_read_byte(&rfcomm_crc_table[__crc(data) ^ data[2]])); // FCS on 3 bytes
-
729 }
-
730 
-
731 /* Serial commands */
-
732 size_t SPP::write(uint8_t data) {
-
733  return write(&data,1);
-
734 }
-
735 
-
736 size_t SPP::write(const uint8_t* data, size_t size) {
-
737  for(uint8_t i = 0; i < size; i++) {
-
738  if(sppIndex >= sizeof(sppOutputBuffer)/sizeof(sppOutputBuffer[0]))
-
739  send(); // Send the current data in the buffer
-
740  sppOutputBuffer[sppIndex++] = data[i]; // All the bytes are put into a buffer and then send using the send() function
-
741  }
-
742  return size;
-
743 }
-
744 
-
745 void SPP::send() {
-
746  if (!connected || !sppIndex)
-
747  return;
-
748  uint8_t length; // This is the length of the string we are sending
-
749  uint8_t offset = 0; // This is used to keep track of where we are in the string
+
679 void SPP::l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow) {
+
680  serialPortResponse2(transactionIDHigh, transactionIDLow); // Same data as serialPortResponse2
+
681 }
+
682 /************************************************************/
+
683 /* RFCOMM Commands */
+
684 
+
685 /************************************************************/
+
686 void SPP::RFCOMM_Command(uint8_t* data, uint8_t nbytes) {
+
687  pBtd->L2CAP_Command(hci_handle, data, nbytes, rfcomm_scid[0], rfcomm_scid[1]);
+
688 }
+
689 
+
690 void SPP::sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t* data, uint8_t length) {
+
691  l2capoutbuf[0] = channel | direction | CR | extendAddress; // RFCOMM Address
+
692  l2capoutbuf[1] = channelType | pfBit; // RFCOMM Control
+
693  l2capoutbuf[2] = length << 1 | 0x01; // Length and format (always 0x01 bytes format)
+
694  uint8_t i = 0;
+
695  for (; i < length; i++)
+
696  l2capoutbuf[i + 3] = data[i];
+
697  l2capoutbuf[i + 3] = calcFcs(l2capoutbuf);
+
698 #ifdef EXTRADEBUG
+
699  Notify(PSTR(" - RFCOMM Data: "), 0x80);
+
700  for (i = 0; i < length + 4; i++) {
+
701  PrintHex<uint8_t > (l2capoutbuf[i], 0x80);
+
702  Notify(PSTR(" "), 0x80);
+
703  }
+
704 #endif
+
705  RFCOMM_Command(l2capoutbuf, length + 4);
+
706 }
+
707 
+
708 void SPP::sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit) {
+
709  l2capoutbuf[0] = channel | direction | CR | extendAddress; // RFCOMM Address
+
710  l2capoutbuf[1] = channelType | pfBit; // RFCOMM Control
+
711  l2capoutbuf[2] = 0x01; // Length = 0
+
712  l2capoutbuf[3] = credit; // Credit
+
713  l2capoutbuf[4] = calcFcs(l2capoutbuf);
+
714 #ifdef EXTRADEBUG
+
715  Notify(PSTR(" - RFCOMM Credit Data: "), 0x80);
+
716  for (uint8_t i = 0; i < 5; i++) {
+
717  PrintHex<uint8_t > (l2capoutbuf[i], 0x80);
+
718  Notify(PSTR(" "), 0x80);
+
719  }
+
720 #endif
+
721  RFCOMM_Command(l2capoutbuf, 5);
+
722 }
+
723 
+
724 /* CRC on 2 bytes */
+
725 uint8_t SPP::__crc(uint8_t* data) {
+
726  return (pgm_read_byte(&rfcomm_crc_table[pgm_read_byte(&rfcomm_crc_table[0xff ^ data[0]]) ^ data[1]]));
+
727 }
+
728 
+
729 /* Calculate FCS - we never actually check if the host sends correct FCS to the Arduino */
+
730 uint8_t SPP::calcFcs(uint8_t *data) {
+
731  if ((data[1] & 0xEF) == RFCOMM_UIH)
+
732  return (0xff - __crc(data)); // FCS on 2 bytes
+
733  else
+
734  return (0xff - pgm_read_byte(&rfcomm_crc_table[__crc(data) ^ data[2]])); // FCS on 3 bytes
+
735 }
+
736 
+
737 /* Serial commands */
+
738 size_t SPP::write(uint8_t data) {
+
739  return write(&data,1);
+
740 }
+
741 
+
742 size_t SPP::write(const uint8_t* data, size_t size) {
+
743  for(uint8_t i = 0; i < size; i++) {
+
744  if(sppIndex >= sizeof(sppOutputBuffer)/sizeof(sppOutputBuffer[0]))
+
745  send(); // Send the current data in the buffer
+
746  sppOutputBuffer[sppIndex++] = data[i]; // All the bytes are put into a buffer and then send using the send() function
+
747  }
+
748  return size;
+
749 }
750 
-
751  l2capoutbuf[0] = rfcommChannelConnection | 0 | 0 | extendAddress; // RFCOMM Address
-
752  l2capoutbuf[1] = RFCOMM_UIH; // RFCOMM Control
-
753 
-
754  while (sppIndex) { // We will run this while loop until this variable is 0
-
755  if (sppIndex > (sizeof (l2capoutbuf) - 4)) // Check if the string is larger than the outgoing buffer
-
756  length = sizeof (l2capoutbuf) - 4;
-
757  else
-
758  length = sppIndex;
+
751 void SPP::send() {
+
752  if (!connected || !sppIndex)
+
753  return;
+
754  uint8_t length; // This is the length of the string we are sending
+
755  uint8_t offset = 0; // This is used to keep track of where we are in the string
+
756 
+
757  l2capoutbuf[0] = rfcommChannelConnection | 0 | 0 | extendAddress; // RFCOMM Address
+
758  l2capoutbuf[1] = RFCOMM_UIH; // RFCOMM Control
759 
-
760  l2capoutbuf[2] = length << 1 | 1; // Length
-
761  uint8_t i = 0;
-
762  for (; i < length; i++)
-
763  l2capoutbuf[i + 3] = sppOutputBuffer[i + offset];
-
764  l2capoutbuf[i + 3] = calcFcs(l2capoutbuf); // Calculate checksum
+
760  while (sppIndex) { // We will run this while loop until this variable is 0
+
761  if (sppIndex > (sizeof (l2capoutbuf) - 4)) // Check if the string is larger than the outgoing buffer
+
762  length = sizeof (l2capoutbuf) - 4;
+
763  else
+
764  length = sppIndex;
765 
-
766  RFCOMM_Command(l2capoutbuf, length + 4);
-
767 
-
768  sppIndex -= length;
-
769  offset += length; // Increment the offset
-
770  }
-
771 }
-
772 
-
773 int SPP::available(void) {
-
774  return rfcommAvailable;
-
775 };
-
776 
-
777 void SPP::flush(void) {
-
778  rfcommAvailable = 0;
-
779 }
-
780 
-
781 int SPP::peek(void) {
-
782  if (rfcommAvailable == 0) // Don't read if there is nothing in the buffer
-
783  return -1;
-
784  return rfcommDataBuffer[0];
+
766  l2capoutbuf[2] = length << 1 | 1; // Length
+
767  uint8_t i = 0;
+
768  for (; i < length; i++)
+
769  l2capoutbuf[i + 3] = sppOutputBuffer[i + offset];
+
770  l2capoutbuf[i + 3] = calcFcs(l2capoutbuf); // Calculate checksum
+
771 
+
772  RFCOMM_Command(l2capoutbuf, length + 4);
+
773 
+
774  sppIndex -= length;
+
775  offset += length; // Increment the offset
+
776  }
+
777 }
+
778 
+
779 int SPP::available(void) {
+
780  return rfcommAvailable;
+
781 };
+
782 
+
783 void SPP::flush(void) {
+
784  rfcommAvailable = 0;
785 }
786 
-
787 int SPP::read(void) {
+
787 int SPP::peek(void) {
788  if (rfcommAvailable == 0) // Don't read if there is nothing in the buffer
789  return -1;
-
790  uint8_t output = rfcommDataBuffer[0];
-
791  for (uint8_t i = 1; i < rfcommAvailable; i++)
-
792  rfcommDataBuffer[i - 1] = rfcommDataBuffer[i]; // Shift the buffer one left
-
793  rfcommAvailable--;
-
794  bytesRead++;
-
795  if (bytesRead > (sizeof (rfcommDataBuffer) - 5)) { // We will send the command just before it runs out of credit
-
796  bytesRead = 0;
-
797  sendRfcommCredit(rfcommChannelConnection, rfcommDirection, 0, RFCOMM_UIH, 0x10, sizeof (rfcommDataBuffer)); // Send more credit
-
798 #ifdef EXTRADEBUG
-
799  Notify(PSTR("\r\nSent "), 0x80);
-
800  Notify((uint8_t)sizeof (rfcommDataBuffer), 0x80);
-
801  Notify(PSTR(" more credit"), 0x80);
-
802 #endif
-
803  }
-
804  return output;
-
805 }
+
790  return rfcommDataBuffer[0];
+
791 }
+
792 
+
793 int SPP::read(void) {
+
794  if (rfcommAvailable == 0) // Don't read if there is nothing in the buffer
+
795  return -1;
+
796  uint8_t output = rfcommDataBuffer[0];
+
797  for (uint8_t i = 1; i < rfcommAvailable; i++)
+
798  rfcommDataBuffer[i - 1] = rfcommDataBuffer[i]; // Shift the buffer one left
+
799  rfcommAvailable--;
+
800  bytesRead++;
+
801  if (bytesRead > (sizeof (rfcommDataBuffer) - 5)) { // We will send the command just before it runs out of credit
+
802  bytesRead = 0;
+
803  sendRfcommCredit(rfcommChannelConnection, rfcommDirection, 0, RFCOMM_UIH, 0x10, sizeof (rfcommDataBuffer)); // Send more credit
+
804 #ifdef EXTRADEBUG
+
805  Notify(PSTR("\r\nSent "), 0x80);
+
806  Notify((uint8_t)sizeof (rfcommDataBuffer), 0x80);
+
807  Notify(PSTR(" more credit"), 0x80);
+
808 #endif
+
809  }
+
810  return output;
+
811 }
diff --git a/_s_p_p_8h.html b/_s_p_p_8h.html index b77936ab..e2af9292 100644 --- a/_s_p_p_8h.html +++ b/_s_p_p_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: SPP.h File Reference @@ -31,7 +31,7 @@ - + @@ -98,7 +98,7 @@ Include dependency graph for SPP.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -796,7 +796,7 @@ Macros diff --git a/_s_p_p_8h__incl.map b/_s_p_p_8h__incl.map index 7ec02648..1c727fd5 100644 --- a/_s_p_p_8h__incl.map +++ b/_s_p_p_8h__incl.map @@ -1,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/_s_p_p_8h__incl.md5 b/_s_p_p_8h__incl.md5 index e9e72fb3..b82d8c93 100644 --- a/_s_p_p_8h__incl.md5 +++ b/_s_p_p_8h__incl.md5 @@ -1 +1 @@ -b0ceda8ab8c0919f8856bd5609fd1ff0 \ No newline at end of file +2a91f81d018fc0d1ae460ca8166764ff \ No newline at end of file diff --git a/_s_p_p_8h__incl.png b/_s_p_p_8h__incl.png index c1663933..4308f2f6 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 bf75978c..942a2c4d 100644 --- a/_s_p_p_8h_source.html +++ b/_s_p_p_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: SPP.h Source File @@ -31,7 +31,7 @@
- + @@ -271,7 +271,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_usb_8cpp.html b/_usb_8cpp.html index 18ad1a5e..ab1a7b79 100644 --- a/_usb_8cpp.html +++ b/_usb_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Usb.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -99,7 +99,7 @@ Include dependency graph for Usb.cpp:
- +

Go to the source code of this file.

@@ -108,7 +108,7 @@ Include dependency graph for Usb.cpp: diff --git a/_usb_8cpp__incl.map b/_usb_8cpp__incl.map index de749835..b9cf6c66 100644 --- a/_usb_8cpp__incl.map +++ b/_usb_8cpp__incl.map @@ -1,11 +1,11 @@ - - - - - - - - + + + + + + + + diff --git a/_usb_8cpp__incl.md5 b/_usb_8cpp__incl.md5 index e9325fbc..dca4d25c 100644 --- a/_usb_8cpp__incl.md5 +++ b/_usb_8cpp__incl.md5 @@ -1 +1 @@ -76414eb5b333c825182eee0402948c94 \ No newline at end of file +1100db60c4ff669cb9f00b8be1d4b8fb \ No newline at end of file diff --git a/_usb_8cpp__incl.png b/_usb_8cpp__incl.png index c517412b..14e2953c 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 f6e1a444..ff9f1d27 100644 --- a/_usb_8cpp_source.html +++ b/_usb_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Usb.cpp Source File @@ -31,7 +31,7 @@ - + @@ -223,7 +223,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
132  SETUP_PKT setup_pkt;
133 
134  EpInfo *pep = NULL;
-
135  uint16_t nak_limit;
+
135  uint16_t nak_limit = 0;
136 
137  rcode = SetAddress(addr, ep, &pep, nak_limit);
138 
@@ -261,458 +261,545 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
170  //uint16_t read = (left<nbytes) ? left : nbytes;
171 
172  rcode = InTransfer(pep, nak_limit, &read, dataptr);
-
173 
-
174  if (rcode)
-
175  return rcode;
-
176 
-
177  // Invoke callback function if inTransfer completed successfuly and callback function pointer is specified
-
178  if (!rcode && p)
-
179  ((USBReadParser*)p)->Parse(read, dataptr, total - left);
-
180 
-
181  left -= read;
-
182 
-
183  if (read < nbytes)
-
184  break;
-
185  }
-
186  } else //OUT transfer
-
187  {
-
188  pep->bmSndToggle = 1; //bmSNDTOG1;
-
189  rcode = OutTransfer(pep, nak_limit, nbytes, dataptr);
-
190  }
-
191  if (rcode) //return error
-
192  return ( rcode);
-
193  }
-
194  // Status stage
-
195  return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction
-
196 }
-
197 
-
198 /* IN transfer to arbitrary endpoint. Assumes PERADDR is set. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
-
199 /* Keep sending INs and writes data to memory area pointed by 'data' */
-
200 
-
201 /* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error,
-
202  fe USB xfer timeout */
-
203 uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data) {
-
204  EpInfo *pep = NULL;
-
205  uint16_t nak_limit = 0;
-
206 
-
207  uint8_t rcode = SetAddress(addr, ep, &pep, nak_limit);
-
208 
-
209  if (rcode) {
-
210  //printf("SetAddress Failed");
-
211  return rcode;
-
212  }
-
213  return InTransfer(pep, nak_limit, nbytesptr, data);
-
214 }
-
215 
-
216 uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data) {
-
217  uint8_t rcode = 0;
-
218  uint8_t pktsize;
-
219 
-
220  uint16_t nbytes = *nbytesptr;
-
221  //printf("Requesting %i bytes ", nbytes);
-
222  uint8_t maxpktsize = pep->maxPktSize;
-
223 
-
224  *nbytesptr = 0;
-
225  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
-
226 
-
227  while (1) // use a 'return' to exit this loop
-
228  {
-
229  rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS.
-
230 
-
231  if (rcode) {
-
232  //printf("Problem! %i\r\n", rcode);
-
233  break; //should be 0, indicating ACK. Else return error code.
-
234  }
-
235  /* check for RCVDAVIRQ and generate error if not present */
-
236  /* the only case when absense of RCVDAVIRQ makes sense is when toggle error occured. Need to add handling for that */
-
237  if ((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) {
-
238  //printf("Problem! NO RCVDAVIRQ!\r\n");
-
239  rcode = 0xf0; //receive error
-
240  break;
-
241  }
-
242  pktsize = regRd(rRCVBC); //number of received bytes
-
243  //printf("Got %i bytes ", pktsize);
-
244  assert(pktsize <= nbytes);
-
245 
-
246  int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr);
-
247 
-
248  if (mem_left < 0)
-
249  mem_left = 0;
-
250 
-
251  data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data);
-
252 
-
253  regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer
-
254  *nbytesptr += pktsize; // add this packet's byte count to total transfer length
-
255 
-
256  /* The transfer is complete under two conditions: */
-
257  /* 1. The device sent a short packet (L.T. maxPacketSize) */
-
258  /* 2. 'nbytes' have been transferred. */
-
259  if ((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes?
-
260  {
-
261  // Save toggle value
-
262  pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0;
-
263  //printf("\r\n");
-
264  rcode = 0;
-
265  break;
-
266  } // if
-
267  } //while( 1 )
-
268  return ( rcode);
-
269 }
-
270 
-
271 /* OUT transfer to arbitrary endpoint. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
-
272 /* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer */
-
273 
-
274 /* rcode 0 if no errors. rcode 01-0f is relayed from HRSL */
-
275 uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
-
276  EpInfo *pep = NULL;
-
277  uint16_t nak_limit;
-
278 
-
279  uint8_t rcode = SetAddress(addr, ep, &pep, nak_limit);
-
280 
-
281  if (rcode)
-
282  return rcode;
-
283 
-
284  return OutTransfer(pep, nak_limit, nbytes, data);
-
285 }
-
286 
-
287 uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) {
-
288  uint8_t rcode = hrSUCCESS, retry_count;
-
289  uint8_t *data_p = data; //local copy of the data pointer
-
290  uint16_t bytes_tosend, nak_count;
-
291  uint16_t bytes_left = nbytes;
-
292 
-
293  uint8_t maxpktsize = pep->maxPktSize;
-
294 
-
295  if (maxpktsize < 1 || maxpktsize > 64)
-
296  return USB_ERROR_INVALID_MAX_PKT_SIZE;
+
173  if (rcode == hrTOGERR) {
+
174  // yes, we flip it wrong here so that next time it is actually correct!
+
175  pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
+
176  continue;
+
177  }
+
178 
+
179  if (rcode)
+
180  return rcode;
+
181 
+
182  // Invoke callback function if inTransfer completed successfully and callback function pointer is specified
+
183  if (!rcode && p)
+
184  ((USBReadParser*)p)->Parse(read, dataptr, total - left);
+
185 
+
186  left -= read;
+
187 
+
188  if (read < nbytes)
+
189  break;
+
190  }
+
191  } else //OUT transfer
+
192  {
+
193  pep->bmSndToggle = 1; //bmSNDTOG1;
+
194  rcode = OutTransfer(pep, nak_limit, nbytes, dataptr);
+
195  }
+
196  if (rcode) //return error
+
197  return ( rcode);
+
198  }
+
199  // Status stage
+
200  return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction
+
201 }
+
202 
+
203 /* IN transfer to arbitrary endpoint. Assumes PERADDR is set. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
+
204 /* Keep sending INs and writes data to memory area pointed by 'data' */
+
205 
+
206 /* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error,
+
207  fe USB xfer timeout */
+
208 uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data) {
+
209  EpInfo *pep = NULL;
+
210  uint16_t nak_limit = 0;
+
211 
+
212  uint8_t rcode = SetAddress(addr, ep, &pep, nak_limit);
+
213 
+
214  if (rcode) {
+
215  //printf("SetAddress Failed");
+
216  return rcode;
+
217  }
+
218  return InTransfer(pep, nak_limit, nbytesptr, data);
+
219 }
+
220 
+
221 uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data) {
+
222  uint8_t rcode = 0;
+
223  uint8_t pktsize;
+
224 
+
225  uint16_t nbytes = *nbytesptr;
+
226  //printf("Requesting %i bytes ", nbytes);
+
227  uint8_t maxpktsize = pep->maxPktSize;
+
228 
+
229  *nbytesptr = 0;
+
230  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
+
231 
+
232  while (1) // use a 'return' to exit this loop
+
233  {
+
234  rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS.
+
235  if (rcode == hrTOGERR) {
+
236  // yes, we flip it wrong here so that next time it is actually correct!
+
237  pep->bmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
+
238  regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
+
239  continue;
+
240  }
+
241  if (rcode) {
+
242  //printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
+
243  break; //should be 0, indicating ACK. Else return error code.
+
244  }
+
245  /* check for RCVDAVIRQ and generate error if not present */
+
246  /* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */
+
247  if ((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) {
+
248  //printf(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n");
+
249  rcode = 0xf0; //receive error
+
250  break;
+
251  }
+
252  pktsize = regRd(rRCVBC); //number of received bytes
+
253  //printf("Got %i bytes \r\n", pktsize);
+
254  // This would be OK, but...
+
255  //assert(pktsize <= nbytes);
+
256  if (pktsize > nbytes) {
+
257  // This can happen. Use of assert on Arduino locks up the Arduino.
+
258  // So I will trim the value, and hope for the best.
+
259  //printf(">>>>>>>> Problem! Wanted %i bytes but got %i.\r\n", nbytes, pktsize);
+
260  pktsize = nbytes;
+
261  }
+
262 
+
263  int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr);
+
264 
+
265  if (mem_left < 0)
+
266  mem_left = 0;
+
267 
+
268  data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data);
+
269 
+
270  regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer
+
271  *nbytesptr += pktsize; // add this packet's byte count to total transfer length
+
272 
+
273  /* The transfer is complete under two conditions: */
+
274  /* 1. The device sent a short packet (L.T. maxPacketSize) */
+
275  /* 2. 'nbytes' have been transferred. */
+
276  if ((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes?
+
277  {
+
278  // Save toggle value
+
279  pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0;
+
280  //printf("\r\n");
+
281  rcode = 0;
+
282  break;
+
283  } // if
+
284  } //while( 1 )
+
285  return ( rcode);
+
286 }
+
287 
+
288 /* OUT transfer to arbitrary endpoint. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */
+
289 /* Handles NAK bug per Maxim Application Note 4000 for single buffer transfer */
+
290 
+
291 /* rcode 0 if no errors. rcode 01-0f is relayed from HRSL */
+
292 uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) {
+
293  EpInfo *pep = NULL;
+
294  uint16_t nak_limit = 0;
+
295 
+
296  uint8_t rcode = SetAddress(addr, ep, &pep, nak_limit);
297 
-
298  unsigned long timeout = millis() + USB_XFER_TIMEOUT;
-
299 
-
300  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
-
301 
-
302  while (bytes_left) {
-
303  retry_count = 0;
-
304  nak_count = 0;
-
305  bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left;
-
306  bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO
-
307  regWr(rSNDBC, bytes_tosend); //set number of bytes
-
308  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
-
309  while (!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ
-
310  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
-
311  rcode = (regRd(rHRSL) & 0x0f);
-
312 
-
313  while (rcode && (timeout > millis())) {
-
314  switch (rcode) {
-
315  case hrNAK:
-
316  nak_count++;
-
317  if (nak_limit && (nak_count == nak_limit))
-
318  return ( rcode);
-
319  break;
-
320  case hrTIMEOUT:
-
321  retry_count++;
-
322  if (retry_count == USB_RETRY_LIMIT)
-
323  return ( rcode);
-
324  break;
-
325  default:
-
326  return ( rcode);
-
327  }//switch( rcode
-
328 
-
329  /* process NAK according to Host out NAK bug */
-
330  regWr(rSNDBC, 0);
-
331  regWr(rSNDFIFO, *data_p);
-
332  regWr(rSNDBC, bytes_tosend);
-
333  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
-
334  while (!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ
-
335  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
-
336  rcode = (regRd(rHRSL) & 0x0f);
-
337  }//while( rcode && ....
-
338  bytes_left -= bytes_tosend;
-
339  data_p += bytes_tosend;
-
340  }//while( bytes_left...
-
341  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle
-
342  return ( rcode); //should be 0 in all cases
-
343 }
-
344 /* dispatch usb packet. Assumes peripheral address is set and relevant buffer is loaded/empty */
-
345 /* If NAK, tries to re-send up to nak_limit times */
-
346 /* If nak_limit == 0, do not count NAKs, exit after timeout */
-
347 /* If bus timeout, re-sends up to USB_RETRY_LIMIT times */
-
348 
-
349 /* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout */
-
350 uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
-
351  unsigned long timeout = millis() + USB_XFER_TIMEOUT;
-
352  uint8_t tmpdata;
-
353  uint8_t rcode = hrSUCCESS;
-
354  uint8_t retry_count = 0;
-
355  uint16_t nak_count = 0;
-
356 
-
357  while (timeout > millis()) {
-
358  regWr(rHXFR, (token | ep)); //launch the transfer
-
359  rcode = USB_ERROR_TRANSFER_TIMEOUT;
-
360 
-
361  while (millis() < timeout) //wait for transfer completion
-
362  {
-
363  tmpdata = regRd(rHIRQ);
-
364 
-
365  if (tmpdata & bmHXFRDNIRQ) {
-
366  regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt
-
367  rcode = 0x00;
-
368  break;
-
369  }//if( tmpdata & bmHXFRDNIRQ
-
370 
-
371  }//while ( millis() < timeout
-
372 
-
373  if (rcode != 0x00) //exit if timeout
-
374  return ( rcode);
-
375 
-
376  rcode = (regRd(rHRSL) & 0x0f); //analyze transfer result
-
377 
-
378  switch (rcode) {
-
379  case hrNAK:
-
380  nak_count++;
-
381  if (nak_limit && (nak_count == nak_limit))
-
382  return ( rcode);
-
383  break;
-
384  case hrTIMEOUT:
-
385  retry_count++;
-
386  if (retry_count == USB_RETRY_LIMIT)
-
387  return ( rcode);
-
388  break;
-
389  default:
-
390  return ( rcode);
-
391  }//switch( rcode
-
392 
-
393  }//while( timeout > millis()
-
394  return ( rcode);
-
395 }
+
298  if (rcode)
+
299  return rcode;
+
300 
+
301  return OutTransfer(pep, nak_limit, nbytes, data);
+
302 }
+
303 
+
304 uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) {
+
305  uint8_t rcode = hrSUCCESS, retry_count;
+
306  uint8_t *data_p = data; //local copy of the data pointer
+
307  uint16_t bytes_tosend, nak_count;
+
308  uint16_t bytes_left = nbytes;
+
309 
+
310  uint8_t maxpktsize = pep->maxPktSize;
+
311 
+
312  if (maxpktsize < 1 || maxpktsize > 64)
+
313  return USB_ERROR_INVALID_MAX_PKT_SIZE;
+
314 
+
315  unsigned long timeout = millis() + USB_XFER_TIMEOUT;
+
316 
+
317  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
+
318 
+
319  while (bytes_left) {
+
320  retry_count = 0;
+
321  nak_count = 0;
+
322  bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left;
+
323  bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO
+
324  regWr(rSNDBC, bytes_tosend); //set number of bytes
+
325  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
+
326  while (!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ
+
327  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
+
328  rcode = (regRd(rHRSL) & 0x0f);
+
329 
+
330  while (rcode && (timeout > millis())) {
+
331  switch (rcode) {
+
332  case hrNAK:
+
333  nak_count++;
+
334  if (nak_limit && (nak_count == nak_limit))
+
335  goto breakout;
+
336  //return ( rcode);
+
337  break;
+
338  case hrTIMEOUT:
+
339  retry_count++;
+
340  if (retry_count == USB_RETRY_LIMIT)
+
341  goto breakout;
+
342  //return ( rcode);
+
343  break;
+
344  case hrTOGERR:
+
345  // yes, we flip it wrong here so that next time it is actually correct!
+
346  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1;
+
347  regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value
+
348  break;
+
349  default:
+
350  goto breakout;
+
351  }//switch( rcode
+
352 
+
353  /* process NAK according to Host out NAK bug */
+
354  regWr(rSNDBC, 0);
+
355  regWr(rSNDFIFO, *data_p);
+
356  regWr(rSNDBC, bytes_tosend);
+
357  regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet
+
358  while (!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ
+
359  regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ
+
360  rcode = (regRd(rHRSL) & 0x0f);
+
361  }//while( rcode && ....
+
362  bytes_left -= bytes_tosend;
+
363  data_p += bytes_tosend;
+
364  }//while( bytes_left...
+
365 breakout:
+
366 
+
367  pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle
+
368  return ( rcode); //should be 0 in all cases
+
369 }
+
370 /* dispatch USB packet. Assumes peripheral address is set and relevant buffer is loaded/empty */
+
371 /* If NAK, tries to re-send up to nak_limit times */
+
372 /* If nak_limit == 0, do not count NAKs, exit after timeout */
+
373 /* If bus timeout, re-sends up to USB_RETRY_LIMIT times */
+
374 
+
375 /* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout */
+
376 uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) {
+
377  unsigned long timeout = millis() + USB_XFER_TIMEOUT;
+
378  uint8_t tmpdata;
+
379  uint8_t rcode = hrSUCCESS;
+
380  uint8_t retry_count = 0;
+
381  uint16_t nak_count = 0;
+
382 
+
383  while (timeout > millis()) {
+
384  regWr(rHXFR, (token | ep)); //launch the transfer
+
385  rcode = USB_ERROR_TRANSFER_TIMEOUT;
+
386 
+
387  while (timeout > millis()) //wait for transfer completion
+
388  {
+
389  tmpdata = regRd(rHIRQ);
+
390 
+
391  if (tmpdata & bmHXFRDNIRQ) {
+
392  regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt
+
393  rcode = 0x00;
+
394  break;
+
395  }//if( tmpdata & bmHXFRDNIRQ
396 
-
397 /* USB main task. Performs enumeration/cleanup */
-
398 void USB::Task(void) //USB state machine
-
399 {
-
400  uint8_t rcode;
-
401  uint8_t tmpdata;
-
402  static unsigned long delay = 0;
-
403  //USB_DEVICE_DESCRIPTOR buf;
-
404  bool lowspeed = false;
-
405 
-
406  MAX3421E::Task();
-
407 
-
408  tmpdata = getVbusState();
-
409 
-
410  /* modify USB task state if Vbus changed */
-
411  switch (tmpdata) {
-
412  case SE1: //illegal state
-
413  usb_task_state = USB_DETACHED_SUBSTATE_ILLEGAL;
-
414  lowspeed = false;
-
415  break;
-
416  case SE0: //disconnected
-
417  if ((usb_task_state & USB_STATE_MASK) != USB_STATE_DETACHED)
-
418  usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE;
-
419  lowspeed = false;
-
420  break;
-
421  case LSHOST:
-
422  lowspeed = true;
-
423  case FSHOST: //attached
-
424  if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
-
425  delay = millis() + USB_SETTLE_DELAY;
-
426  usb_task_state = USB_ATTACHED_SUBSTATE_SETTLE;
-
427  }
-
428  break;
-
429  }// switch( tmpdata
-
430 
-
431  for (uint8_t i = 0; i < USB_NUMDEVICES; i++)
-
432  if (devConfig[i])
-
433  rcode = devConfig[i]->Poll();
-
434 
-
435  switch (usb_task_state) {
-
436  case USB_DETACHED_SUBSTATE_INITIALIZE:
-
437  init();
-
438 
-
439  for (uint8_t i = 0; i < USB_NUMDEVICES; i++)
-
440  if (devConfig[i])
-
441  rcode = devConfig[i]->Release();
-
442 
-
443  usb_task_state = USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE;
-
444  break;
-
445  case USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE: //just sit here
+
397  }//while ( millis() < timeout
+
398 
+
399  //if (rcode != 0x00) //exit if timeout
+
400  // return ( rcode);
+
401 
+
402  rcode = (regRd(rHRSL) & 0x0f); //analyze transfer result
+
403 
+
404  switch (rcode) {
+
405  case hrNAK:
+
406  nak_count++;
+
407  if (nak_limit && (nak_count == nak_limit))
+
408  return (rcode);
+
409  break;
+
410  case hrTIMEOUT:
+
411  retry_count++;
+
412  if (retry_count == USB_RETRY_LIMIT)
+
413  return (rcode);
+
414  break;
+
415  default:
+
416  return (rcode);
+
417  }//switch( rcode
+
418 
+
419  }//while( timeout > millis()
+
420  return ( rcode);
+
421 }
+
422 
+
423 /* USB main task. Performs enumeration/cleanup */
+
424 void USB::Task(void) //USB state machine
+
425 {
+
426  uint8_t rcode;
+
427  uint8_t tmpdata;
+
428  static unsigned long delay = 0;
+
429  //USB_DEVICE_DESCRIPTOR buf;
+
430  bool lowspeed = false;
+
431 
+
432  MAX3421E::Task();
+
433 
+
434  tmpdata = getVbusState();
+
435 
+
436  /* modify USB task state if Vbus changed */
+
437  switch (tmpdata) {
+
438  case SE1: //illegal state
+
439  usb_task_state = USB_DETACHED_SUBSTATE_ILLEGAL;
+
440  lowspeed = false;
+
441  break;
+
442  case SE0: //disconnected
+
443  if ((usb_task_state & USB_STATE_MASK) != USB_STATE_DETACHED)
+
444  usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE;
+
445  lowspeed = false;
446  break;
-
447  case USB_DETACHED_SUBSTATE_ILLEGAL: //just sit here
-
448  break;
-
449  case USB_ATTACHED_SUBSTATE_SETTLE: //settle time for just attached device
-
450  if (delay < millis())
-
451  usb_task_state = USB_ATTACHED_SUBSTATE_RESET_DEVICE;
-
452  break;
-
453  case USB_ATTACHED_SUBSTATE_RESET_DEVICE:
-
454  regWr(rHCTL, bmBUSRST); //issue bus reset
-
455  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE;
+
447  case LSHOST:
+
448  if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
+
449  lowspeed = true;
+
450  }
+
451  case FSHOST: //attached
+
452  if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
+
453  delay = millis() + USB_SETTLE_DELAY;
+
454  usb_task_state = USB_ATTACHED_SUBSTATE_SETTLE;
+
455  }
456  break;
-
457  case USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE:
-
458  if ((regRd(rHCTL) & bmBUSRST) == 0) {
-
459  tmpdata = regRd(rMODE) | bmSOFKAENAB; //start SOF generation
-
460  regWr(rMODE, tmpdata);
-
461  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_SOF;
-
462  delay = millis() + 20; //20ms wait after reset per USB spec
-
463  }
-
464  break;
-
465  case USB_ATTACHED_SUBSTATE_WAIT_SOF: //todo: change check order
-
466  if (regRd(rHIRQ) & bmFRAMEIRQ) //when first SOF received we can continue
-
467  {
-
468  if (delay < millis()) //20ms passed
-
469  usb_task_state = USB_STATE_CONFIGURING;
-
470  }
-
471  break;
-
472  case USB_STATE_CONFIGURING:
-
473  rcode = Configuring(0, 0, lowspeed);
-
474 
-
475  if (rcode) {
-
476  if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE) {
-
477  usb_error = rcode;
-
478  usb_task_state = USB_STATE_ERROR;
-
479  }
-
480  } else
-
481  usb_task_state = USB_STATE_RUNNING;
-
482  break;
-
483  case USB_STATE_RUNNING:
+
457  }// switch( tmpdata
+
458 
+
459  for (uint8_t i = 0; i < USB_NUMDEVICES; i++)
+
460  if (devConfig[i])
+
461  rcode = devConfig[i]->Poll();
+
462 
+
463  switch (usb_task_state) {
+
464  case USB_DETACHED_SUBSTATE_INITIALIZE:
+
465  init();
+
466 
+
467  for (uint8_t i = 0; i < USB_NUMDEVICES; i++)
+
468  if (devConfig[i])
+
469  rcode = devConfig[i]->Release();
+
470 
+
471  usb_task_state = USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE;
+
472  break;
+
473  case USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE: //just sit here
+
474  break;
+
475  case USB_DETACHED_SUBSTATE_ILLEGAL: //just sit here
+
476  break;
+
477  case USB_ATTACHED_SUBSTATE_SETTLE: //settle time for just attached device
+
478  if (delay < millis())
+
479  usb_task_state = USB_ATTACHED_SUBSTATE_RESET_DEVICE;
+
480  break;
+
481  case USB_ATTACHED_SUBSTATE_RESET_DEVICE:
+
482  regWr(rHCTL, bmBUSRST); //issue bus reset
+
483  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE;
484  break;
-
485  case USB_STATE_ERROR:
-
486  break;
-
487  } // switch( usb_task_state )
-
488 }
-
489 
-
490 uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
-
491  //uint8_t buf[12];
-
492  uint8_t rcode;
-
493  UsbDevice *p0 = NULL, *p = NULL;
-
494 
-
495  // Get pointer to pseudo device with address 0 assigned
-
496  p0 = addrPool.GetUsbDevicePtr(0);
-
497 
-
498  if (!p0)
-
499  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
-
500 
-
501  if (!p0->epinfo)
-
502  return USB_ERROR_EPINFO_IS_NULL;
-
503 
-
504  p0->lowspeed = (lowspeed) ? true : false;
-
505 
-
506  // Allocate new address according to device class
-
507  uint8_t bAddress = addrPool.AllocAddress(parent, false, port);
-
508 
-
509  if (!bAddress)
-
510  return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
-
511 
-
512  p = addrPool.GetUsbDevicePtr(bAddress);
-
513 
-
514  if (!p)
-
515  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
-
516 
-
517  p->lowspeed = lowspeed;
-
518 
-
519  // Assign new address to the device
-
520  rcode = setAddr(0, 0, bAddress);
-
521 
-
522  if (rcode) {
-
523  addrPool.FreeAddress(bAddress);
-
524  bAddress = 0;
-
525  return rcode;
-
526  }
-
527  return 0;
-
528 };
-
529 
-
530 uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
-
531  //static uint8_t dev_index = 0;
-
532  uint8_t rcode = 0;
+
485  case USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE:
+
486  if ((regRd(rHCTL) & bmBUSRST) == 0) {
+
487  tmpdata = regRd(rMODE) | bmSOFKAENAB; //start SOF generation
+
488  regWr(rMODE, tmpdata);
+
489  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_SOF;
+
490  //delay = millis() + 20; //20ms wait after reset per USB spec
+
491  }
+
492  break;
+
493  case USB_ATTACHED_SUBSTATE_WAIT_SOF: //todo: change check order
+
494  if (regRd(rHIRQ) & bmFRAMEIRQ) {
+
495  //when first SOF received _and_ 20ms has passed we can continue
+
496  /*
+
497  if (delay < millis()) //20ms passed
+
498  usb_task_state = USB_STATE_CONFIGURING;
+
499  */
+
500  usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET;
+
501  delay = millis() + 20;
+
502  }
+
503  break;
+
504  case USB_ATTACHED_SUBSTATE_WAIT_RESET:
+
505  if (delay < millis()) usb_task_state = USB_STATE_CONFIGURING;
+
506  break;
+
507  case USB_STATE_CONFIGURING:
+
508  rcode = Configuring(0, 0, lowspeed);
+
509 
+
510  if (rcode) {
+
511  if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE) {
+
512  usb_error = rcode;
+
513  usb_task_state = USB_STATE_ERROR;
+
514  }
+
515  } else
+
516  usb_task_state = USB_STATE_RUNNING;
+
517  break;
+
518  case USB_STATE_RUNNING:
+
519  break;
+
520  case USB_STATE_ERROR:
+
521  //MAX3421E::Init();
+
522  break;
+
523  } // switch( usb_task_state )
+
524 }
+
525 
+
526 uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
+
527  //uint8_t buf[12];
+
528  uint8_t rcode;
+
529  UsbDevice *p0 = NULL, *p = NULL;
+
530 
+
531  // Get pointer to pseudo device with address 0 assigned
+
532  p0 = addrPool.GetUsbDevicePtr(0);
533 
-
534  for (; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
-
535  if (!devConfig[devConfigIndex])
-
536  continue;
-
537 
-
538  rcode = devConfig[devConfigIndex]->Init(parent, port, lowspeed);
+
534  if (!p0)
+
535  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
+
536 
+
537  if (!p0->epinfo)
+
538  return USB_ERROR_EPINFO_IS_NULL;
539 
-
540  if (!rcode) {
-
541  devConfigIndex = 0;
-
542  return 0;
-
543  }
-
544  if (!(rcode == USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED || rcode == USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE)) {
-
545  // in case of an error dev_index should be reset to 0
-
546  // in order to start from the very beginning the
-
547  // next time the program gets here
-
548  if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE)
-
549  devConfigIndex = 0;
-
550 
-
551  return rcode;
-
552  }
-
553  }
-
554  // if we get here that means that the device class is not supported by any of registered classes
-
555  devConfigIndex = 0;
-
556 
-
557  rcode = DefaultAddressing(parent, port, lowspeed);
-
558 
-
559  return rcode;
-
560 }
-
561 
-
562 uint8_t USB::ReleaseDevice(uint8_t addr) {
-
563  if (!addr)
-
564  return 0;
+
540  p0->lowspeed = (lowspeed) ? true : false;
+
541 
+
542  // Allocate new address according to device class
+
543  uint8_t bAddress = addrPool.AllocAddress(parent, false, port);
+
544 
+
545  if (!bAddress)
+
546  return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
+
547 
+
548  p = addrPool.GetUsbDevicePtr(bAddress);
+
549 
+
550  if (!p)
+
551  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
+
552 
+
553  p->lowspeed = lowspeed;
+
554 
+
555  // Assign new address to the device
+
556  rcode = setAddr(0, 0, bAddress);
+
557 
+
558  if (rcode) {
+
559  addrPool.FreeAddress(bAddress);
+
560  bAddress = 0;
+
561  return rcode;
+
562  }
+
563  return 0;
+
564 };
565 
-
566  for (uint8_t i = 0; i < USB_NUMDEVICES; i++)
-
567  if (devConfig[i]->GetAddress() == addr)
-
568  return devConfig[i]->Release();
-
569 
-
570  return 0;
-
571 }
-
572 
-
573 #if 1
-
574 //get device descriptor
-
575 
-
576 uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
-
577  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL));
-
578 }
-
579 //get configuration descriptor
-
580 
-
581 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
-
582  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL));
-
583 }
-
584 
-
585 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
-
586  const uint8_t bufSize = 64;
-
587  uint8_t buf[bufSize];
-
588 
-
589  uint8_t ret = getConfDescr(addr, ep, 8, conf, buf);
-
590 
-
591  if (ret)
-
592  return ret;
-
593 
-
594  uint16_t total = ((USB_CONFIGURATION_DESCRIPTOR*)buf)->wTotalLength;
-
595 
-
596  //USBTRACE2("\r\ntotal conf.size:", total);
-
597 
-
598  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, total, bufSize, buf, p));
-
599 }
-
600 
-
601 //get string descriptor
-
602 
-
603 uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
-
604  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL));
-
605 }
-
606 //set address
-
607 
-
608 uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
-
609  return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
-
610 }
-
611 //set configuration
+
566 /*
+
567  * This is broken. We need to enumerate differently.
+
568  * It causes major problems with several devices if detected in an unexpected order.
+
569  *
+
570  *
+
571  * Oleg - I wouldn't do anything before the newly connected device is considered sane.
+
572  * i.e.(delays are not indicated for brevity):
+
573  * 1. reset
+
574  * 2. GetDevDescr();
+
575  * 3a. If ACK, continue with allocating address, addressing, etc.
+
576  * 3b. Else reset again, count resets, stop at some number (5?).
+
577  * 4. When max.number of resets is reached, toggle power/fail
+
578  * 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()
+
579  * it doesn't need to be reset again
+
580  * New steps proposal:
+
581  * 1: get address pool instance. exit on fail
+
582  * 2: pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf). exit on fail.
+
583  * 3: bus reset, 100ms delay
+
584  * 4: set address
+
585  * 5: pUsb->setEpInfoEntry(bAddress, 1, epInfo), exit on fail
+
586  * 6: while (configurations) {
+
587  * for(each configuration) {
+
588  * for (each driver) {
+
589  * 6a: Ask device if it likes configuration. Returns 0 on OK.
+
590  * If successful, the driver configured device.
+
591  * The driver now owns the endpoints, and takes over managing them.
+
592  * The following will need codes:
+
593  * Everything went well, instance consumed, exit with success.
+
594  * Instance already in use, ignore it, try next driver.
+
595  * Not a supported device, ignore it, try next driver.
+
596  * Not a supported configuration for this device, ignore it, try next driver.
+
597  * Could not configure device, fatal, exit with fail.
+
598  * }
+
599  * }
+
600  * }
+
601  * 7: for(each driver) {
+
602  * 7a: Ask device if it knows this VID/PID. Acts exactly like 6a, but using VID/PID
+
603  * 8: if we get here, no driver likes the device plugged in, so exit failure.
+
604  *
+
605  */
+
606 uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
+
607  uint8_t rcode = 0;
+
608 
+
609  for (; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
+
610  if (!devConfig[devConfigIndex])
+
611  continue;
612 
-
613 uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
-
614  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
-
615 }
-
616 
-
617 #endif // defined(USB_METHODS_INLINE)
-
618 
+
613  rcode = devConfig[devConfigIndex]->ConfigureDevice(parent, port, lowspeed);
+
614  if (rcode == USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET) {
+
615  if (parent == 0) {
+
616  // Send a bus reset on the root interface.
+
617  regWr(rHCTL, bmBUSRST); //issue bus reset
+
618  delay(102); // delay 102ms, compensate for clock inaccuracy.
+
619  } /* else {
+
620  * @Oleg
+
621  * TO-DO:
+
622  * How do we do an individual bus reset on a child interface?
+
623  * Is that even possible with the current code?
+
624  */
+
625  }
+
626  rcode = devConfig[devConfigIndex]->Init(parent, port, lowspeed);
+
627  if (!rcode) {
+
628  devConfigIndex = 0;
+
629  return 0;
+
630  }
+
631  //printf("ERROR ENUMERATING %2.2x\r\n", rcode);
+
632  if (!(rcode == USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED || rcode == USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE)) {
+
633  // in case of an error dev_index should be reset to 0
+
634  // in order to start from the very beginning the
+
635  // next time the program gets here
+
636  if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE)
+
637  devConfigIndex = 0;
+
638  return rcode;
+
639  }
+
640  }
+
641  // if we get here that means that the device class is not supported by any of registered classes
+
642  devConfigIndex = 0;
+
643 
+
644  rcode = DefaultAddressing(parent, port, lowspeed);
+
645 
+
646  return rcode;
+
647 }
+
648 
+
649 uint8_t USB::ReleaseDevice(uint8_t addr) {
+
650  if (!addr)
+
651  return 0;
+
652 
+
653  for (uint8_t i = 0; i < USB_NUMDEVICES; i++)
+
654  if (devConfig[i]->GetAddress() == addr)
+
655  return devConfig[i]->Release();
+
656 
+
657  return 0;
+
658 }
+
659 
+
660 #if 1
+
661 //get device descriptor
+
662 
+
663 uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
+
664  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL));
+
665 }
+
666 //get configuration descriptor
+
667 
+
668 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
+
669  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL));
+
670 }
+
671 
+
672 uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) {
+
673  const uint8_t bufSize = 64;
+
674  uint8_t buf[bufSize];
+
675 
+
676  uint8_t ret = getConfDescr(addr, ep, 8, conf, buf);
+
677 
+
678  if (ret)
+
679  return ret;
+
680 
+
681  uint16_t total = ((USB_CONFIGURATION_DESCRIPTOR*)buf)->wTotalLength;
+
682 
+
683  //USBTRACE2("\r\ntotal conf.size:", total);
+
684 
+
685  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, total, bufSize, buf, p));
+
686 }
+
687 
+
688 //get string descriptor
+
689 
+
690 uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) {
+
691  return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL));
+
692 }
+
693 //set address
+
694 
+
695 uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
+
696  return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
+
697 }
+
698 //set configuration
+
699 
+
700 uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
+
701  return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL));
+
702 }
+
703 
+
704 #endif // defined(USB_METHODS_INLINE)
+
705 
diff --git a/_usb_8h.html b/_usb_8h.html index cdf53c8e..e84722f8 100644 --- a/_usb_8h.html +++ b/_usb_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Usb.h File Reference @@ -31,7 +31,7 @@ - + @@ -107,7 +107,7 @@ Include dependency graph for Usb.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -132,11 +132,9 @@ Classes - - - + - + @@ -204,9 +202,17 @@ Macros + + + + + + + + - + @@ -234,6 +240,8 @@ Macros + + @@ -253,20 +261,6 @@ Typedefs

Macros

#define USB_METHODS_INLINE
 
#define USBTRACE(s)   (Notify(PSTR(s), 0x80))
#define USBTRACE(s)   (Notify(PSTR(s), 0x80))
 
#define USBTRACE2(s, r)   (Notify(PSTR(s), 0x80), PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80))
#define USBTRACE2(s, r)   (Notify(PSTR(s), 0x80), PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80))
 
#define bmREQ_GET_DESCR   USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE
 
 
#define USB_ERROR_EP_NOT_FOUND_IN_TBL   0xDB
 
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET   0xE0
 
#define USB_ERROR_FailGetDevDescr   0xE1
 
#define USB_ERROR_FailSetDevTblEntry   0xE2
 
#define USB_ERROR_FailGetConfDescr   0xE3
 
#define USB_ERROR_TRANSFER_TIMEOUT   0xFF
 
#define USB_XFER_TIMEOUT   5000
#define USB_XFER_TIMEOUT   10000
 
#define USB_RETRY_LIMIT   3
 
 
#define USB_ATTACHED_SUBSTATE_WAIT_SOF   0x50
 
#define USB_ATTACHED_SUBSTATE_WAIT_RESET   0x51
 
#define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE   0x60
 
#define USB_STATE_ADDRESSING   0x70
 

Macro Definition Documentation

- -
-
- - - - -
#define USB_METHODS_INLINE
-
- -

Definition at line 23 of file Usb.h.

- -
-
@@ -275,13 +269,13 @@ Typedefs #define USBTRACE (   - s) -    (Notify(PSTR(s), 0x80)) + s) +    (Notify(PSTR(s), 0x80))
-

Definition at line 61 of file Usb.h.

+

Definition at line 62 of file Usb.h.

@@ -304,12 +298,12 @@ Typedefs ) -    (Notify(PSTR(s), 0x80), PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80)) +    (Notify(PSTR(s), 0x80), PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80))
-

Definition at line 62 of file Usb.h.

+

Definition at line 63 of file Usb.h.

@@ -323,7 +317,7 @@ Typedefs
-

Definition at line 67 of file Usb.h.

+

Definition at line 68 of file Usb.h.

@@ -337,7 +331,7 @@ Typedefs
-

Definition at line 68 of file Usb.h.

+

Definition at line 69 of file Usb.h.

@@ -351,7 +345,7 @@ Typedefs
-

Definition at line 69 of file Usb.h.

+

Definition at line 70 of file Usb.h.

@@ -365,7 +359,7 @@ Typedefs
-

Definition at line 76 of file Usb.h.

+

Definition at line 77 of file Usb.h.

@@ -379,7 +373,7 @@ Typedefs
-

Definition at line 77 of file Usb.h.

+

Definition at line 78 of file Usb.h.

@@ -393,7 +387,7 @@ Typedefs
-

Definition at line 78 of file Usb.h.

+

Definition at line 79 of file Usb.h.

@@ -407,7 +401,7 @@ Typedefs
-

Definition at line 79 of file Usb.h.

+

Definition at line 80 of file Usb.h.

@@ -421,7 +415,7 @@ Typedefs
-

Definition at line 80 of file Usb.h.

+

Definition at line 81 of file Usb.h.

@@ -435,7 +429,7 @@ Typedefs
-

Definition at line 81 of file Usb.h.

+

Definition at line 82 of file Usb.h.

@@ -449,7 +443,7 @@ Typedefs
-

Definition at line 82 of file Usb.h.

+

Definition at line 83 of file Usb.h.

@@ -463,7 +457,7 @@ Typedefs
-

Definition at line 83 of file Usb.h.

+

Definition at line 84 of file Usb.h.

@@ -477,7 +471,7 @@ Typedefs
-

Definition at line 84 of file Usb.h.

+

Definition at line 85 of file Usb.h.

@@ -491,7 +485,7 @@ Typedefs
-

Definition at line 85 of file Usb.h.

+

Definition at line 86 of file Usb.h.

@@ -505,7 +499,7 @@ Typedefs
-

Definition at line 86 of file Usb.h.

+

Definition at line 87 of file Usb.h.

@@ -519,7 +513,7 @@ Typedefs
-

Definition at line 87 of file Usb.h.

+

Definition at line 88 of file Usb.h.

@@ -533,7 +527,7 @@ Typedefs
-

Definition at line 88 of file Usb.h.

+

Definition at line 89 of file Usb.h.

@@ -547,7 +541,7 @@ Typedefs
-

Definition at line 89 of file Usb.h.

+

Definition at line 90 of file Usb.h.

@@ -561,7 +555,7 @@ Typedefs
-

Definition at line 90 of file Usb.h.

+

Definition at line 91 of file Usb.h.

@@ -575,7 +569,7 @@ Typedefs
-

Definition at line 91 of file Usb.h.

+

Definition at line 92 of file Usb.h.

@@ -589,7 +583,7 @@ Typedefs
-

Definition at line 92 of file Usb.h.

+

Definition at line 93 of file Usb.h.

@@ -603,7 +597,7 @@ Typedefs
-

Definition at line 93 of file Usb.h.

+

Definition at line 94 of file Usb.h.

@@ -617,7 +611,7 @@ Typedefs
-

Definition at line 94 of file Usb.h.

+

Definition at line 95 of file Usb.h.

@@ -631,7 +625,7 @@ Typedefs
-

Definition at line 97 of file Usb.h.

+

Definition at line 98 of file Usb.h.

@@ -645,7 +639,7 @@ Typedefs
-

Definition at line 98 of file Usb.h.

+

Definition at line 99 of file Usb.h.

@@ -659,7 +653,7 @@ Typedefs
-

Definition at line 99 of file Usb.h.

+

Definition at line 100 of file Usb.h.

@@ -673,7 +667,7 @@ Typedefs
-

Definition at line 100 of file Usb.h.

+

Definition at line 101 of file Usb.h.

@@ -687,7 +681,7 @@ Typedefs
-

Definition at line 101 of file Usb.h.

+

Definition at line 102 of file Usb.h.

@@ -701,7 +695,7 @@ Typedefs
-

Definition at line 102 of file Usb.h.

+

Definition at line 103 of file Usb.h.

@@ -715,7 +709,7 @@ Typedefs
-

Definition at line 103 of file Usb.h.

+

Definition at line 104 of file Usb.h.

@@ -729,7 +723,7 @@ Typedefs
-

Definition at line 104 of file Usb.h.

+

Definition at line 105 of file Usb.h.

@@ -743,7 +737,7 @@ Typedefs
-

Definition at line 105 of file Usb.h.

+

Definition at line 106 of file Usb.h.

@@ -757,7 +751,7 @@ Typedefs
-

Definition at line 106 of file Usb.h.

+

Definition at line 107 of file Usb.h.

@@ -771,7 +765,63 @@ Typedefs
-

Definition at line 107 of file Usb.h.

+

Definition at line 108 of file Usb.h.

+ +
+ + +
+
+ + + + +
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET   0xE0
+
+ +

Definition at line 109 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_FailGetDevDescr   0xE1
+
+ +

Definition at line 110 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_FailSetDevTblEntry   0xE2
+
+ +

Definition at line 111 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_FailGetConfDescr   0xE3
+
+ +

Definition at line 112 of file Usb.h.

@@ -785,7 +835,7 @@ Typedefs
-

Definition at line 108 of file Usb.h.

+

Definition at line 113 of file Usb.h.

@@ -794,12 +844,12 @@ Typedefs
- +
#define USB_XFER_TIMEOUT   5000#define USB_XFER_TIMEOUT   10000
-

Definition at line 118 of file Usb.h.

+

Definition at line 115 of file Usb.h.

@@ -813,7 +863,7 @@ Typedefs
-

Definition at line 120 of file Usb.h.

+

Definition at line 117 of file Usb.h.

@@ -827,7 +877,7 @@ Typedefs
-

Definition at line 121 of file Usb.h.

+

Definition at line 118 of file Usb.h.

@@ -841,7 +891,7 @@ Typedefs
-

Definition at line 123 of file Usb.h.

+

Definition at line 120 of file Usb.h.

@@ -855,7 +905,7 @@ Typedefs
-

Definition at line 125 of file Usb.h.

+

Definition at line 122 of file Usb.h.

@@ -869,7 +919,7 @@ Typedefs
-

Definition at line 128 of file Usb.h.

+

Definition at line 125 of file Usb.h.

@@ -883,7 +933,7 @@ Typedefs
-

Definition at line 130 of file Usb.h.

+

Definition at line 127 of file Usb.h.

@@ -897,7 +947,7 @@ Typedefs
-

Definition at line 131 of file Usb.h.

+

Definition at line 128 of file Usb.h.

@@ -911,7 +961,7 @@ Typedefs
-

Definition at line 132 of file Usb.h.

+

Definition at line 129 of file Usb.h.

@@ -925,7 +975,7 @@ Typedefs
-

Definition at line 133 of file Usb.h.

+

Definition at line 130 of file Usb.h.

@@ -939,7 +989,7 @@ Typedefs
-

Definition at line 134 of file Usb.h.

+

Definition at line 131 of file Usb.h.

@@ -953,7 +1003,7 @@ Typedefs
-

Definition at line 135 of file Usb.h.

+

Definition at line 132 of file Usb.h.

@@ -967,7 +1017,7 @@ Typedefs
-

Definition at line 136 of file Usb.h.

+

Definition at line 133 of file Usb.h.

@@ -981,7 +1031,21 @@ Typedefs
-

Definition at line 137 of file Usb.h.

+

Definition at line 134 of file Usb.h.

+ +
+ + +
+
+ + + + +
#define USB_ATTACHED_SUBSTATE_WAIT_RESET   0x51
+
+ +

Definition at line 135 of file Usb.h.

@@ -995,7 +1059,7 @@ Typedefs
-

Definition at line 138 of file Usb.h.

+

Definition at line 136 of file Usb.h.

@@ -1009,7 +1073,7 @@ Typedefs
-

Definition at line 139 of file Usb.h.

+

Definition at line 137 of file Usb.h.

@@ -1023,7 +1087,7 @@ Typedefs
-

Definition at line 140 of file Usb.h.

+

Definition at line 138 of file Usb.h.

@@ -1037,7 +1101,7 @@ Typedefs
-

Definition at line 141 of file Usb.h.

+

Definition at line 139 of file Usb.h.

@@ -1051,7 +1115,7 @@ Typedefs
-

Definition at line 142 of file Usb.h.

+

Definition at line 140 of file Usb.h.

@@ -1066,7 +1130,7 @@ Typedefs
-

Definition at line 57 of file Usb.h.

+

Definition at line 58 of file Usb.h.

@@ -1087,7 +1151,7 @@ Typedefs diff --git a/_usb_8h__incl.map b/_usb_8h__incl.map index 6701487a..a87e2ed4 100644 --- a/_usb_8h__incl.map +++ b/_usb_8h__incl.map @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + diff --git a/_usb_8h__incl.md5 b/_usb_8h__incl.md5 index facc9ed1..3d2243d5 100644 --- a/_usb_8h__incl.md5 +++ b/_usb_8h__incl.md5 @@ -1 +1 @@ -d7e3042d71e752f1afbf6b063abdad3f \ No newline at end of file +bbd5bd64f5e628b380c990e35c15c364 \ No newline at end of file diff --git a/_usb_8h__incl.png b/_usb_8h__incl.png index 2f5008c4..58bfd5c1 100644 Binary files a/_usb_8h__incl.png and b/_usb_8h__incl.png differ diff --git a/_usb_8h_source.html b/_usb_8h_source.html index b46c641d..2b80902c 100644 --- a/_usb_8h_source.html +++ b/_usb_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Usb.h Source File @@ -31,7 +31,7 @@ - + @@ -111,272 +111,279 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
20 
21 //#define BOARD_BLACK_WIDDOW
22 
-
23 #define USB_METHODS_INLINE
-
24 
-
25 #include <inttypes.h>
-
26 
-
27 #include <assert.h>
-
28 
-
29 #include "avrpins.h"
-
30 #include "max3421e.h"
-
31 #include "usbhost.h"
-
32 #include "usb_ch9.h"
-
33 #include "address.h"
-
34 
-
35 #if defined(ARDUINO) && ARDUINO >=100
-
36 #include "Arduino.h"
-
37 #else
-
38 #include <WProgram.h>
-
39 #endif
-
40 #include "message.h"
-
41 
-
42 /* shield pins. First parameter - SS pin, second parameter - INT pin */
-
43 
-
44 #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
-
45 #define BOARD_TEENSY_PLUS_PLUS
-
46 #endif
-
47 
-
48 #ifdef BOARD_BLACK_WIDDOW
-
49 typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
-
50 #elif defined(BOARD_TEENSY_PLUS_PLUS)
-
51 typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 2.0 & 1.0
-
52 #elif defined(BOARD_MEGA_ADK)
-
53 typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
-
54 #elif defined(BOARD_BALANDUINO)
-
55 typedef MAX3421e<P20, P19> MAX3421E; // Balanduino
-
56 #else
-
57 typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo etc.)
-
58 #endif
-
59 
-
60 //Debug macros. In 1.0 it is possible to move strings to PROGMEM by defining USBTRACE (Serial.print(F(s)))
-
61 #define USBTRACE(s) (Notify(PSTR(s), 0x80))
-
62 #define USBTRACE2(s,r) (Notify(PSTR(s), 0x80), PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80))
-
63 
-
64 
+
23 // Not used anymore?
+
24 //#define USB_METHODS_INLINE
+
25 
+
26 #include <inttypes.h>
+
27 
+
28 #include <assert.h>
+
29 
+
30 #include "avrpins.h"
+
31 #include "max3421e.h"
+
32 #include "usbhost.h"
+
33 #include "usb_ch9.h"
+
34 #include "address.h"
+
35 
+
36 #if defined(ARDUINO) && ARDUINO >=100
+
37 #include "Arduino.h"
+
38 #else
+
39 #include <WProgram.h>
+
40 #endif
+
41 #include "message.h"
+
42 
+
43 /* shield pins. First parameter - SS pin, second parameter - INT pin */
+
44 
+
45 #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
+
46 #define BOARD_TEENSY_PLUS_PLUS
+
47 #endif
+
48 
+
49 #ifdef BOARD_BLACK_WIDDOW
+
50 typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
+
51 #elif defined(BOARD_TEENSY_PLUS_PLUS)
+
52 typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 2.0 & 1.0
+
53 #elif defined(BOARD_MEGA_ADK)
+
54 typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
+
55 #elif defined(BOARD_BALANDUINO)
+
56 typedef MAX3421e<P20, P19> MAX3421E; // Balanduino
+
57 #else
+
58 typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo etc.)
+
59 #endif
+
60 
+
61 //Debug macros. In 1.0 it is possible to move strings to PROGMEM by defining USBTRACE (USB_HOST_SERIAL.print(F(s)))
+
62 #define USBTRACE(s) (Notify(PSTR(s), 0x80))
+
63 #define USBTRACE2(s,r) (Notify(PSTR(s), 0x80), PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80))
+
64 
65 
-
66 /* Common setup data constant combinations */
-
67 #define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type
-
68 #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'
-
69 #define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type
-
70 
-
71 // D7 data transfer direction (0 - host-to-device, 1 - device-to-host)
-
72 // D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)
-
73 // D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)
-
74 
-
75 // USB Device Classes
-
76 #define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors
-
77 #define USB_CLASS_AUDIO 0x01 // Audio
-
78 #define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control
-
79 #define USB_CLASS_HID 0x03 // HID
-
80 #define USB_CLASS_PHYSICAL 0x05 // Physical
-
81 #define USB_CLASS_IMAGE 0x06 // Image
-
82 #define USB_CLASS_PRINTER 0x07 // Printer
-
83 #define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage
-
84 #define USB_CLASS_HUB 0x09 // Hub
-
85 #define USB_CLASS_CDC_DATA 0x0a // CDC-Data
-
86 #define USB_CLASS_SMART_CARD 0x0b // Smart-Card
-
87 #define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security
-
88 #define USB_CLASS_VIDEO 0x0e // Video
-
89 #define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare
-
90 #define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device
-
91 #define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller
-
92 #define USB_CLASS_MISC 0xef // Miscellaneous
-
93 #define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific
-
94 #define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific
-
95 
-
96 // Additional Error Codes
-
97 #define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1
-
98 #define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
-
99 #define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
-
100 #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
-
101 #define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5
-
102 #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6
-
103 #define USB_ERROR_EPINFO_IS_NULL 0xD7
-
104 #define USB_ERROR_INVALID_ARGUMENT 0xD8
-
105 #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9
-
106 #define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA
-
107 #define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB
-
108 #define USB_ERROR_TRANSFER_TIMEOUT 0xFF
-
109 
-
110 class USBDeviceConfig {
-
111 public:
-
112  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed) = 0;
-
113  virtual uint8_t Release() = 0;
-
114  virtual uint8_t Poll() = 0;
-
115  virtual uint8_t GetAddress() = 0;
-
116 };
-
117 
-
118 #define USB_XFER_TIMEOUT 5000 //USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec
-
119 //#define USB_NAK_LIMIT 32000 //NAK limit for a transfer. 0 means NAKs are not counted
-
120 #define USB_RETRY_LIMIT 3 //retry limit for a transfer
-
121 #define USB_SETTLE_DELAY 200 //settle delay in milliseconds
-
122 
-
123 #define USB_NUMDEVICES 16 //number of USB devices
-
124 //#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
-
125 #define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
+
66 
+
67 /* Common setup data constant combinations */
+
68 #define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type
+
69 #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'
+
70 #define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type
+
71 
+
72 // D7 data transfer direction (0 - host-to-device, 1 - device-to-host)
+
73 // D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)
+
74 // D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)
+
75 
+
76 // USB Device Classes
+
77 #define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors
+
78 #define USB_CLASS_AUDIO 0x01 // Audio
+
79 #define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control
+
80 #define USB_CLASS_HID 0x03 // HID
+
81 #define USB_CLASS_PHYSICAL 0x05 // Physical
+
82 #define USB_CLASS_IMAGE 0x06 // Image
+
83 #define USB_CLASS_PRINTER 0x07 // Printer
+
84 #define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage
+
85 #define USB_CLASS_HUB 0x09 // Hub
+
86 #define USB_CLASS_CDC_DATA 0x0a // CDC-Data
+
87 #define USB_CLASS_SMART_CARD 0x0b // Smart-Card
+
88 #define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security
+
89 #define USB_CLASS_VIDEO 0x0e // Video
+
90 #define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare
+
91 #define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device
+
92 #define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller
+
93 #define USB_CLASS_MISC 0xef // Miscellaneous
+
94 #define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific
+
95 #define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific
+
96 
+
97 // Additional Error Codes
+
98 #define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1
+
99 #define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
+
100 #define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
+
101 #define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
+
102 #define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5
+
103 #define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6
+
104 #define USB_ERROR_EPINFO_IS_NULL 0xD7
+
105 #define USB_ERROR_INVALID_ARGUMENT 0xD8
+
106 #define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9
+
107 #define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA
+
108 #define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB
+
109 #define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET 0xE0
+
110 #define USB_ERROR_FailGetDevDescr 0xE1
+
111 #define USB_ERROR_FailSetDevTblEntry 0xE2
+
112 #define USB_ERROR_FailGetConfDescr 0xE3
+
113 #define USB_ERROR_TRANSFER_TIMEOUT 0xFF
+
114 
+
115 #define USB_XFER_TIMEOUT 10000 //30000 // (5000) USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec
+
116 //#define USB_NAK_LIMIT 32000 //NAK limit for a transfer. 0 means NAKs are not counted
+
117 #define USB_RETRY_LIMIT 3 // 3 retry limit for a transfer
+
118 #define USB_SETTLE_DELAY 200 //settle delay in milliseconds
+
119 
+
120 #define USB_NUMDEVICES 16 //number of USB devices
+
121 //#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
+
122 #define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
+
123 
+
124 /* USB state machine states */
+
125 #define USB_STATE_MASK 0xf0
126 
-
127 /* USB state machine states */
-
128 #define USB_STATE_MASK 0xf0
-
129 
-
130 #define USB_STATE_DETACHED 0x10
-
131 #define USB_DETACHED_SUBSTATE_INITIALIZE 0x11
-
132 #define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12
-
133 #define USB_DETACHED_SUBSTATE_ILLEGAL 0x13
-
134 #define USB_ATTACHED_SUBSTATE_SETTLE 0x20
-
135 #define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30
-
136 #define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40
-
137 #define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50
-
138 #define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60
-
139 #define USB_STATE_ADDRESSING 0x70
-
140 #define USB_STATE_CONFIGURING 0x80
-
141 #define USB_STATE_RUNNING 0x90
-
142 #define USB_STATE_ERROR 0xa0
-
143 
-
144 /* USB Setup Packet Structure */
-
145 typedef struct {
-
146 
-
147  union { // offset description
-
148  uint8_t bmRequestType; // 0 Bit-map of request type
-
149 
-
150  struct {
-
151  uint8_t recipient : 5; // Recipient of the request
-
152  uint8_t type : 2; // Type of request
-
153  uint8_t direction : 1; // Direction of data X-fer
-
154  } __attribute__((packed));
-
155  } ReqType_u;
-
156  uint8_t bRequest; // 1 Request
-
157 
-
158  union {
-
159  uint16_t wValue; // 2 Depends on bRequest
-
160 
-
161  struct {
-
162  uint8_t wValueLo;
-
163  uint8_t wValueHi;
-
164  } __attribute__((packed));
-
165  } wVal_u;
-
166  uint16_t wIndex; // 4 Depends on bRequest
-
167  uint16_t wLength; // 6 Depends on bRequest
-
168 } SETUP_PKT, *PSETUP_PKT __attribute__((packed));
-
169 
-
170 
-
171 
-
172 // Base class for incomming data parser
-
173 
-
174 class USBReadParser {
-
175 public:
-
176  virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) = 0;
-
177 };
+
127 #define USB_STATE_DETACHED 0x10
+
128 #define USB_DETACHED_SUBSTATE_INITIALIZE 0x11
+
129 #define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12
+
130 #define USB_DETACHED_SUBSTATE_ILLEGAL 0x13
+
131 #define USB_ATTACHED_SUBSTATE_SETTLE 0x20
+
132 #define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30
+
133 #define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40
+
134 #define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50
+
135 #define USB_ATTACHED_SUBSTATE_WAIT_RESET 0x51
+
136 #define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60
+
137 #define USB_STATE_ADDRESSING 0x70
+
138 #define USB_STATE_CONFIGURING 0x80
+
139 #define USB_STATE_RUNNING 0x90
+
140 #define USB_STATE_ERROR 0xa0
+
141 
+
142 class USBDeviceConfig {
+
143 public:
+
144  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed) = 0;
+
145  virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {return 0; }
+
146  virtual uint8_t Release() = 0;
+
147  virtual uint8_t Poll() = 0;
+
148  virtual uint8_t GetAddress() = 0;
+
149 };
+
150 
+
151 /* USB Setup Packet Structure */
+
152 typedef struct {
+
153 
+
154  union { // offset description
+
155  uint8_t bmRequestType; // 0 Bit-map of request type
+
156 
+
157  struct {
+
158  uint8_t recipient : 5; // Recipient of the request
+
159  uint8_t type : 2; // Type of request
+
160  uint8_t direction : 1; // Direction of data X-fer
+
161  } __attribute__((packed));
+
162  } ReqType_u;
+
163  uint8_t bRequest; // 1 Request
+
164 
+
165  union {
+
166  uint16_t wValue; // 2 Depends on bRequest
+
167 
+
168  struct {
+
169  uint8_t wValueLo;
+
170  uint8_t wValueHi;
+
171  } __attribute__((packed));
+
172  } wVal_u;
+
173  uint16_t wIndex; // 4 Depends on bRequest
+
174  uint16_t wLength; // 6 Depends on bRequest
+
175 } SETUP_PKT, *PSETUP_PKT __attribute__((packed));
+
176 
+
177 
178 
-
179 class USB : public MAX3421E {
-
180  AddressPoolImpl<USB_NUMDEVICES> addrPool;
-
181  USBDeviceConfig* devConfig[USB_NUMDEVICES];
-
182  uint8_t devConfigIndex;
-
183  uint8_t bmHubPre;
-
184 
-
185 public:
-
186  USB(void);
-
187 
-
188  void SetHubPreMask() {
-
189  bmHubPre |= bmHUBPRE;
-
190  };
+
179 // Base class for incoming data parser
+
180 
+
181 class USBReadParser {
+
182 public:
+
183  virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) = 0;
+
184 };
+
185 
+
186 class USB : public MAX3421E {
+
187  AddressPoolImpl<USB_NUMDEVICES> addrPool;
+
188  USBDeviceConfig* devConfig[USB_NUMDEVICES];
+
189  uint8_t devConfigIndex;
+
190  uint8_t bmHubPre;
191 
-
192  void ResetHubPreMask() {
-
193  bmHubPre &= (~bmHUBPRE);
-
194  };
-
195 
-
196  AddressPool& GetAddressPool() {
-
197  return(AddressPool&) addrPool;
-
198  };
-
199 
-
200  uint8_t RegisterDeviceClass(USBDeviceConfig *pdev) {
-
201  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
-
202  if(!devConfig[i]) {
-
203  devConfig[i] = pdev;
-
204  return 0;
-
205  }
-
206  }
-
207  return USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS;
-
208  };
-
209 
-
210  void ForEachUsbDevice(UsbDeviceHandleFunc pfunc) {
-
211  addrPool.ForEachUsbDevice(pfunc);
-
212  };
-
213  uint8_t getUsbTaskState(void);
-
214  void setUsbTaskState(uint8_t state);
-
215 
-
216  EpInfo* getEpInfoEntry(uint8_t addr, uint8_t ep);
-
217  uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr);
-
218 
-
219  //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 nbytes, uint8_t* dataptr);
-
220 
-
221  /* Control requests */
-
222  uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr);
-
223  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr);
-
224 
-
225  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p);
-
226 
-
227  uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr);
-
228  uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr);
-
229  uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value);
-
230 
-
231  uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, boolean direction);
-
232  uint8_t ctrlStatus(uint8_t ep, boolean direction, uint16_t nak_limit);
-
233  uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data);
-
234  uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
-
235  uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit);
-
236 
-
237  void Task(void);
-
238 
-
239  uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed);
-
240  uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed);
-
241  uint8_t ReleaseDevice(uint8_t addr);
-
242 
-
243  uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
-
244  uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p);
+
192 public:
+
193  USB(void);
+
194 
+
195  void SetHubPreMask() {
+
196  bmHubPre |= bmHUBPRE;
+
197  };
+
198 
+
199  void ResetHubPreMask() {
+
200  bmHubPre &= (~bmHUBPRE);
+
201  };
+
202 
+
203  AddressPool& GetAddressPool() {
+
204  return(AddressPool&) addrPool;
+
205  };
+
206 
+
207  uint8_t RegisterDeviceClass(USBDeviceConfig *pdev) {
+
208  for(uint8_t i = 0; i < USB_NUMDEVICES; i++) {
+
209  if(!devConfig[i]) {
+
210  devConfig[i] = pdev;
+
211  return 0;
+
212  }
+
213  }
+
214  return USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS;
+
215  };
+
216 
+
217  void ForEachUsbDevice(UsbDeviceHandleFunc pfunc) {
+
218  addrPool.ForEachUsbDevice(pfunc);
+
219  };
+
220  uint8_t getUsbTaskState(void);
+
221  void setUsbTaskState(uint8_t state);
+
222 
+
223  EpInfo* getEpInfoEntry(uint8_t addr, uint8_t ep);
+
224  uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr);
+
225 
+
226  //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 nbytes, uint8_t* dataptr);
+
227 
+
228  /* Control requests */
+
229  uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr);
+
230  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr);
+
231 
+
232  uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p);
+
233 
+
234  uint8_t getStrDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr);
+
235  uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr);
+
236  uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value);
+
237 
+
238  uint8_t ctrlData(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, boolean direction);
+
239  uint8_t ctrlStatus(uint8_t ep, boolean direction, uint16_t nak_limit);
+
240  uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data);
+
241  uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data);
+
242  uint8_t dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit);
+
243 
+
244  void Task(void);
245 
-
246 private:
-
247  void init();
-
248  uint8_t SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t &nak_limit);
-
249  uint8_t OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data);
-
250  uint8_t InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data);
-
251 };
+
246  uint8_t DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed);
+
247  uint8_t Configuring(uint8_t parent, uint8_t port, bool lowspeed);
+
248  uint8_t ReleaseDevice(uint8_t addr);
+
249 
+
250  uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
+
251  uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p);
252 
-
253 #if 0 //defined(USB_METHODS_INLINE)
-
254 //get device descriptor
-
255 
-
256 inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
-
257  return( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, dataptr));
-
258 }
-
259 //get configuration descriptor
-
260 
-
261 inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
-
262  return( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, dataptr));
-
263 }
-
264 //get string descriptor
-
265 
-
266 inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {
-
267  return( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, nuint8_ts, dataptr));
-
268 }
-
269 //set address
-
270 
-
271 inline uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
-
272  return( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, NULL));
-
273 }
-
274 //set configuration
-
275 
-
276 inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
-
277  return( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, NULL));
-
278 }
-
279 
-
280 #endif // defined(USB_METHODS_INLINE)
-
281 
-
282 #endif //_usb_h_
+
253 private:
+
254  void init();
+
255  uint8_t SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t &nak_limit);
+
256  uint8_t OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data);
+
257  uint8_t InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data);
+
258 };
+
259 
+
260 #if 0 //defined(USB_METHODS_INLINE)
+
261 //get device descriptor
+
262 
+
263 inline uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) {
+
264  return( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, dataptr));
+
265 }
+
266 //get configuration descriptor
+
267 
+
268 inline uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) {
+
269  return( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, dataptr));
+
270 }
+
271 //get string descriptor
+
272 
+
273 inline uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr) {
+
274  return( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, nuint8_ts, dataptr));
+
275 }
+
276 //set address
+
277 
+
278 inline uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) {
+
279  return( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, NULL));
+
280 }
+
281 //set configuration
+
282 
+
283 inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
+
284  return( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, NULL));
+
285 }
+
286 
+
287 #endif // defined(USB_METHODS_INLINE)
+
288 
+
289 #endif //_usb_h_
diff --git a/_wii_8cpp.html b/_wii_8cpp.html index f2ef5d08..05d2678f 100644 --- a/_wii_8cpp.html +++ b/_wii_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Wii.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -86,7 +86,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Macros | Variables
Wii.cpp File Reference
@@ -98,16 +97,11 @@ Include dependency graph for Wii.cpp:
- +

Go to the source code of this file.

- - - -

-Macros

#define DEBUG
 
@@ -117,21 +111,6 @@ Variables

Variables

const uint8_t LEDS []
const uint32_t PROCONTROLLERBUTTONS []
 
-

Macro Definition Documentation

- -
-
- - - - -
#define DEBUG
-
- -

Definition at line 23 of file Wii.cpp.

- -
-

Variable Documentation

@@ -237,7 +216,7 @@ Variables diff --git a/_wii_8cpp__incl.map b/_wii_8cpp__incl.map index 3f84c8a9..32bf75a5 100644 --- a/_wii_8cpp__incl.map +++ b/_wii_8cpp__incl.map @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/_wii_8cpp__incl.md5 b/_wii_8cpp__incl.md5 index 1b6b4afc..4f3fe88c 100644 --- a/_wii_8cpp__incl.md5 +++ b/_wii_8cpp__incl.md5 @@ -1 +1 @@ -92196a68a2e7066e730ae6e063a43a10 \ No newline at end of file +1b6e9f6e4815a9341cfa67dd5f9e34dc \ No newline at end of file diff --git a/_wii_8cpp__incl.png b/_wii_8cpp__incl.png index 6700fed3..063e8dae 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 0ff7fd49..449bd049 100644 --- a/_wii_8cpp_source.html +++ b/_wii_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Wii.cpp Source File @@ -31,7 +31,7 @@
- + @@ -111,8 +111,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
20  */
21 
22 #include "Wii.h"
-
23 #define DEBUG // Uncomment to print data for debugging
-
24 //#define EXTRADEBUG // Uncomment to get even more debugging data
+
23 // To enable serial debugging uncomment "#define DEBUG_USB_HOST" in message.h
+
24 //#define EXTRADEBUG // Uncomment to get even more debugging data
25 //#define PRINTREPORT // Uncomment to print the report send by the Wii controllers
26 
27 const uint8_t LEDS[] PROGMEM = {
@@ -209,8 +209,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
118 
119 void WII::disconnect() { // Use this void to disconnect any of the controllers
120  if (motionPlusConnected && !pBtd->motionPlusInside) { // Disable the Motion Plus extension
-
121 #ifdef DEBUG
-
122  Notify(PSTR("\r\nDeactivating Motion Plus"), 0x80);
+
121 #ifdef DEBUG_USB_HOST
+
122  Notify(PSTR("\r\nDeactivating Motion Plus"), 0x80);
123 #endif
124  initExtension1(); // This will disable the Motion Plus extension
125  }
@@ -235,18 +235,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
144  if ((l2capinbuf[0] | (l2capinbuf[1] << 8)) == (hci_handle | 0x2000)) { // acl_handle_ok or it's a new connection
145  if ((l2capinbuf[6] | (l2capinbuf[7] << 8)) == 0x0001) { //l2cap_control - Channel ID for ACL-U
146  if (l2capinbuf[8] == L2CAP_CMD_COMMAND_REJECT) {
-
147 #ifdef DEBUG
-
148  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
+
147 #ifdef DEBUG_USB_HOST
+
148  Notify(PSTR("\r\nL2CAP Command Rejected - Reason: "), 0x80);
149  PrintHex<uint8_t > (l2capinbuf[13], 0x80);
-
150  Notify(PSTR(" "), 0x80);
+
150  Notify(PSTR(" "), 0x80);
151  PrintHex<uint8_t > (l2capinbuf[12], 0x80);
-
152  Notify(PSTR(" "), 0x80);
+
152  Notify(PSTR(" "), 0x80);
153  PrintHex<uint8_t > (l2capinbuf[17], 0x80);
-
154  Notify(PSTR(" "), 0x80);
+
154  Notify(PSTR(" "), 0x80);
155  PrintHex<uint8_t > (l2capinbuf[16], 0x80);
-
156  Notify(PSTR(" "), 0x80);
+
156  Notify(PSTR(" "), 0x80);
157  PrintHex<uint8_t > (l2capinbuf[15], 0x80);
-
158  Notify(PSTR(" "), 0x80);
+
158  Notify(PSTR(" "), 0x80);
159  PrintHex<uint8_t > (l2capinbuf[14], 0x80);
160 #endif
161  } else if (l2capinbuf[8] == L2CAP_CMD_CONNECTION_RESPONSE) {
@@ -267,15 +267,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
176  }
177  } else if (l2capinbuf[8] == L2CAP_CMD_CONNECTION_REQUEST) {
178 #ifdef EXTRADEBUG
-
179  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
+
179  Notify(PSTR("\r\nL2CAP Connection Request - PSM: "), 0x80);
180  PrintHex<uint8_t > (l2capinbuf[13], 0x80);
-
181  Notify(PSTR(" "), 0x80);
+
181  Notify(PSTR(" "), 0x80);
182  PrintHex<uint8_t > (l2capinbuf[12], 0x80);
-
183  Notify(PSTR(" SCID: "), 0x80);
+
183  Notify(PSTR(" SCID: "), 0x80);
184  PrintHex<uint8_t > (l2capinbuf[15], 0x80);
-
185  Notify(PSTR(" "), 0x80);
+
185  Notify(PSTR(" "), 0x80);
186  PrintHex<uint8_t > (l2capinbuf[14], 0x80);
-
187  Notify(PSTR(" Identifier: "), 0x80);
+
187  Notify(PSTR(" Identifier: "), 0x80);
188  PrintHex<uint8_t > (l2capinbuf[9], 0x80);
189 #endif
190  if ((l2capinbuf[12] | (l2capinbuf[13] << 8)) == HID_CTRL_PSM) {
@@ -311,15 +311,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
220  }
221  } else if (l2capinbuf[8] == L2CAP_CMD_DISCONNECT_REQUEST) {
222  if (l2capinbuf[12] == control_dcid[0] && l2capinbuf[13] == control_dcid[1]) {
-
223 #ifdef DEBUG
-
224  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
+
223 #ifdef DEBUG_USB_HOST
+
224  Notify(PSTR("\r\nDisconnect Request: Control Channel"), 0x80);
225 #endif
226  identifier = l2capinbuf[9];
227  pBtd->l2cap_disconnection_response(hci_handle, identifier, control_dcid, control_scid);
228  Reset();
229  } else if (l2capinbuf[12] == interrupt_dcid[0] && l2capinbuf[13] == interrupt_dcid[1]) {
-
230 #ifdef DEBUG
-
231  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
+
230 #ifdef DEBUG_USB_HOST
+
231  Notify(PSTR("\r\nDisconnect Request: Interrupt Channel"), 0x80);
232 #endif
233  identifier = l2capinbuf[9];
234  pBtd->l2cap_disconnection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid);
@@ -339,7 +339,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
248 #ifdef EXTRADEBUG
249  else {
250  identifier = l2capinbuf[9];
-
251  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
+
251  Notify(PSTR("\r\nL2CAP Unknown Signaling Command: "), 0x80);
252  PrintHex<uint8_t > (l2capinbuf[8], 0x80);
253  }
254 #endif
@@ -364,9 +364,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
273  else if (!unknownExtensionConnected)
274  ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8));
275 #ifdef PRINTREPORT
-
276  Notify(PSTR("ButtonState: "), 0x80);
+
276  Notify(PSTR("ButtonState: "), 0x80);
277  PrintHex<uint32_t > (ButtonState, 0x80);
-
278  Notify(PSTR("\r\n"), 0x80);
+
278  Notify(PSTR("\r\n"), 0x80);
279 #endif
280  if (ButtonState != OldButtonState) {
281  ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
@@ -385,14 +385,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
294  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)
295  batteryLevel = l2capinbuf[15]; // Update battery level
296  if (l2capinbuf[12] & 0x01) {
-
297 #ifdef DEBUG
-
298  Notify(PSTR("\r\nWARNING: Battery is nearly empty"), 0x80);
+
297 #ifdef DEBUG_USB_HOST
+
298  Notify(PSTR("\r\nWARNING: Battery is nearly empty"), 0x80);
299 #endif
300  }
301  if (l2capinbuf[12] & 0x02) { // Check if a extension is connected
-
302 #ifdef DEBUG
+
302 #ifdef DEBUG_USB_HOST
303  if (!unknownExtensionConnected)
-
304  Notify(PSTR("\r\nExtension connected"), 0x80);
+
304  Notify(PSTR("\r\nExtension connected"), 0x80);
305 #endif
306  unknownExtensionConnected = true;
307 #ifdef WIICAMERA
@@ -400,20 +400,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
309 #endif
310  setReportMode(false, 0x35); // Also read the extension
311  } else {
-
312 #ifdef DEBUG
-
313  Notify(PSTR("\r\nExtension disconnected"), 0x80);
+
312 #ifdef DEBUG_USB_HOST
+
313  Notify(PSTR("\r\nExtension disconnected"), 0x80);
314 #endif
315  if (motionPlusConnected) {
-
316 #ifdef DEBUG
-
317  Notify(PSTR(" - from Motion Plus"), 0x80);
+
316 #ifdef DEBUG_USB_HOST
+
317  Notify(PSTR(" - from Motion Plus"), 0x80);
318 #endif
319  l2cap_event_flag &= ~WII_FLAG_NUNCHUCK_CONNECTED;
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
-
325  Notify(PSTR(" - Nunchuck"), 0x80);
+
324 #ifdef DEBUG_USB_HOST
+
325  Notify(PSTR(" - Nunchuck"), 0x80);
326 #endif
327  nunchuckConnected = false; // It must be the Nunchuck controller then
328  l2cap_event_flag &= ~WII_FLAG_NUNCHUCK_CONNECTED;
@@ -428,64 +428,64 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
337  if ((l2capinbuf[12] & 0x0F) == 0) { // No error
338  // See: http://wiibrew.org/wiki/Wiimote/Extension_Controllers
339  if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x00 && l2capinbuf[20] == 0x00) {
-
340 #ifdef DEBUG
-
341  Notify(PSTR("\r\nNunchuck connected"), 0x80);
+
340 #ifdef DEBUG_USB_HOST
+
341  Notify(PSTR("\r\nNunchuck connected"), 0x80);
342 #endif
343  l2cap_event_flag |= WII_FLAG_NUNCHUCK_CONNECTED;
344  } else if (l2capinbuf[16] == 0x00 && (l2capinbuf[17] == 0xA6 || l2capinbuf[17] == 0xA4) && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x00 && l2capinbuf[20] == 0x05) {
-
345 #ifdef DEBUG
-
346  Notify(PSTR("\r\nMotion Plus connected"), 0x80);
+
345 #ifdef DEBUG_USB_HOST
+
346  Notify(PSTR("\r\nMotion Plus connected"), 0x80);
347 #endif
348  l2cap_event_flag |= WII_FLAG_MOTION_PLUS_CONNECTED;
349  } else if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x04 && l2capinbuf[20] == 0x05) {
-
350 #ifdef DEBUG
-
351  Notify(PSTR("\r\nMotion Plus activated in normal mode"), 0x80);
+
350 #ifdef DEBUG_USB_HOST
+
351  Notify(PSTR("\r\nMotion Plus activated in normal mode"), 0x80);
352 #endif
353  motionPlusConnected = true;
354  } else if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x05 && l2capinbuf[20] == 0x05) {
-
355 #ifdef DEBUG
-
356  Notify(PSTR("\r\nMotion Plus activated in Nunchuck pass-through mode"), 0x80);
+
355 #ifdef DEBUG_USB_HOST
+
356  Notify(PSTR("\r\nMotion Plus activated in Nunchuck pass-through mode"), 0x80);
357 #endif
358  activateNunchuck = false;
359  motionPlusConnected = true;
360  nunchuckConnected = true;
361  } 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) {
-
362 #ifdef DEBUG
-
363  Notify(PSTR("\r\nInactive Wii Motion Plus"), 0x80);
-
364  Notify(PSTR("\r\nPlease unplug the Motion Plus, disconnect the Wiimote and then replug the Motion Plus Extension"), 0x80);
+
362 #ifdef DEBUG_USB_HOST
+
363  Notify(PSTR("\r\nInactive Wii Motion Plus"), 0x80);
+
364  Notify(PSTR("\r\nPlease unplug the Motion Plus, disconnect the Wiimote and then replug the Motion Plus Extension"), 0x80);
365 #endif
366  stateCounter = 300; // Skip the rest in "L2CAP_CHECK_MOTION_PLUS_STATE"
367  } else if (l2capinbuf[16] == 0x00 && l2capinbuf[17] == 0xA4 && l2capinbuf[18] == 0x20 && l2capinbuf[19] == 0x01 && l2capinbuf[20] == 0x20) {
-
368 #ifdef DEBUG
-
369  Notify(PSTR("\r\nWii U Pro Controller connected"), 0x80);
+
368 #ifdef DEBUG_USB_HOST
+
369  Notify(PSTR("\r\nWii U Pro Controller connected"), 0x80);
370 #endif
371  wiiUProControllerConnected = true;
372  }
-
373 #ifdef DEBUG
+
373 #ifdef DEBUG_USB_HOST
374  else {
-
375  Notify(PSTR("\r\nUnknown Device: "), 0x80);
+
375  Notify(PSTR("\r\nUnknown Device: "), 0x80);
376  PrintHex<uint8_t > (l2capinbuf[13], 0x80);
377  PrintHex<uint8_t > (l2capinbuf[14], 0x80);
-
378  Notify(PSTR("\r\nData: "), 0x80);
+
378  Notify(PSTR("\r\nData: "), 0x80);
379  for (uint8_t i = 0; i < ((l2capinbuf[12] >> 4) + 1); i++) { // bit 4-7 is the length-1
380  PrintHex<uint8_t > (l2capinbuf[15 + i], 0x80);
-
381  Notify(PSTR(" "), 0x80);
+
381  Notify(PSTR(" "), 0x80);
382  }
383  }
384 #endif
385  }
386 #ifdef EXTRADEBUG
387  else {
-
388  Notify(PSTR("\r\nReport Error: "), 0x80);
+
388  Notify(PSTR("\r\nReport Error: "), 0x80);
389  PrintHex<uint8_t > (l2capinbuf[13], 0x80);
390  PrintHex<uint8_t > (l2capinbuf[14], 0x80);
391  }
392 #endif
393  break;
394  case 0x22: // Acknowledge output report, return function result
-
395 #ifdef DEBUG
+
395 #ifdef DEBUG_USB_HOST
396  if (l2capinbuf[13] != 0x00) { // Check if there is an error
-
397  Notify(PSTR("\r\nCommand failed: "), 0x80);
+
397  Notify(PSTR("\r\nCommand failed: "), 0x80);
398  PrintHex<uint8_t > (l2capinbuf[12], 0x80);
399  }
400 #endif
@@ -587,8 +587,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
496  */
497  } else {
498  if ((micros() - timer) > 1000000) { // Loop for 1 sec before resetting the values
-
499 #ifdef DEBUG
-
500  Notify(PSTR("\r\nThe gyro values has been reset"), 0x80);
+
499 #ifdef DEBUG_USB_HOST
+
500  Notify(PSTR("\r\nThe gyro values has been reset"), 0x80);
501 #endif
502  gyroYawZero = (l2capinbuf[15] | ((l2capinbuf[18] & 0xFC) << 6));
503  gyroRollZero = (l2capinbuf[16] | ((l2capinbuf[19] & 0xFC) << 6));
@@ -622,16 +622,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
531  if (!extensionConnected) {
532  extensionConnected = true;
533  unknownExtensionConnected = true;
-
534 #ifdef DEBUG
-
535  Notify(PSTR("\r\nExtension connected to Motion Plus"), 0x80);
+
534 #ifdef DEBUG_USB_HOST
+
535  Notify(PSTR("\r\nExtension connected to Motion Plus"), 0x80);
536 #endif
537  }
538  } else {
539  if (extensionConnected && !unknownExtensionConnected) {
540  extensionConnected = false;
541  unknownExtensionConnected = true;
-
542 #ifdef DEBUG
-
543  Notify(PSTR("\r\nExtension disconnected from Motion Plus"), 0x80);
+
542 #ifdef DEBUG_USB_HOST
+
543  Notify(PSTR("\r\nExtension disconnected from Motion Plus"), 0x80);
544 #endif
545  nunchuckConnected = false; // There is no extension connected to the Motion Plus if this report is sent
546  }
@@ -655,9 +655,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
564  hatValues[RightHatY] = (l2capinbuf[21] | l2capinbuf[22] << 8);
565  }
566  break;
-
567 #ifdef DEBUG
+
567 #ifdef DEBUG_USB_HOST
568  default:
-
569  Notify(PSTR("\r\nUnknown Report type: "), 0x80);
+
569  Notify(PSTR("\r\nUnknown Report type: "), 0x80);
570  PrintHex<uint8_t > (l2capinbuf[9], 0x80);
571  break;
572 #endif
@@ -674,8 +674,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
583  /* These states are used if the Wiimote is the host */
584  case L2CAP_CONTROL_SUCCESS:
585  if (l2cap_config_success_control_flag) {
-
586 #ifdef DEBUG
-
587  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
+
586 #ifdef DEBUG_USB_HOST
+
587  Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
588 #endif
589  l2cap_state = L2CAP_INTERRUPT_SETUP;
590  }
@@ -683,8 +683,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
592 
593  case L2CAP_INTERRUPT_SETUP:
594  if (l2cap_connection_request_interrupt_flag) {
-
595 #ifdef DEBUG
-
596  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
+
595 #ifdef DEBUG_USB_HOST
+
596  Notify(PSTR("\r\nHID Interrupt Incoming Connection Request"), 0x80);
597 #endif
598  pBtd->l2cap_connection_response(hci_handle, identifier, interrupt_dcid, interrupt_scid, PENDING);
599  delay(1);
@@ -700,8 +700,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
609  /* These states are used if the Arduino is the host */
610  case L2CAP_CONTROL_CONNECT_REQUEST:
611  if (l2cap_connected_control_flag) {
-
612 #ifdef DEBUG
-
613  Notify(PSTR("\r\nSend HID Control Config Request"), 0x80);
+
612 #ifdef DEBUG_USB_HOST
+
613  Notify(PSTR("\r\nSend HID Control Config Request"), 0x80);
614 #endif
615  identifier++;
616  pBtd->l2cap_config_request(hci_handle, identifier, control_scid);
@@ -711,8 +711,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
620 
621  case L2CAP_CONTROL_CONFIG_REQUEST:
622  if (l2cap_config_success_control_flag) {
-
623 #ifdef DEBUG
-
624  Notify(PSTR("\r\nSend HID Interrupt Connection Request"), 0x80);
+
623 #ifdef DEBUG_USB_HOST
+
624  Notify(PSTR("\r\nSend HID Interrupt Connection Request"), 0x80);
625 #endif
626  identifier++;
627  pBtd->l2cap_connection_request(hci_handle, identifier, interrupt_dcid, HID_INTR_PSM);
@@ -722,8 +722,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
631 
632  case L2CAP_INTERRUPT_CONNECT_REQUEST:
633  if (l2cap_connected_interrupt_flag) {
-
634 #ifdef DEBUG
-
635  Notify(PSTR("\r\nSend HID Interrupt Config Request"), 0x80);
+
634 #ifdef DEBUG_USB_HOST
+
635  Notify(PSTR("\r\nSend HID Interrupt Config Request"), 0x80);
636 #endif
637  identifier++;
638  pBtd->l2cap_config_request(hci_handle, identifier, interrupt_scid);
@@ -733,8 +733,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
642 
643  case L2CAP_INTERRUPT_CONFIG_REQUEST:
644  if (l2cap_config_success_interrupt_flag) { // Now the HID channels is established
-
645 #ifdef DEBUG
-
646  Notify(PSTR("\r\nHID Channels Established"), 0x80);
+
645 #ifdef DEBUG_USB_HOST
+
646  Notify(PSTR("\r\nHID Channels Established"), 0x80);
647 #endif
648  pBtd->connectToWii = false;
649  pBtd->pairWithWii = false;
@@ -748,8 +748,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
657 
658  case L2CAP_INTERRUPT_DISCONNECT:
659  if (l2cap_disconnect_response_interrupt_flag) {
-
660 #ifdef DEBUG
-
661  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
+
660 #ifdef DEBUG_USB_HOST
+
661  Notify(PSTR("\r\nDisconnected Interrupt Channel"), 0x80);
662 #endif
663  identifier++;
664  pBtd->l2cap_disconnection_request(hci_handle, identifier, control_scid, control_dcid);
@@ -759,8 +759,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
668 
669  case L2CAP_CONTROL_DISCONNECT:
670  if (l2cap_disconnect_response_control_flag) {
-
671 #ifdef DEBUG
-
672  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
+
671 #ifdef DEBUG_USB_HOST
+
672  Notify(PSTR("\r\nDisconnected Control Channel"), 0x80);
673 #endif
674  pBtd->hci_disconnect(hci_handle);
675  hci_handle = -1; // Reset handle
@@ -777,8 +777,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
686  if (pBtd->connectToWii && !pBtd->l2capConnectionClaimed && !wiimoteConnected && !activeConnection) {
687  pBtd->l2capConnectionClaimed = true;
688  activeConnection = true;
-
689 #ifdef DEBUG
-
690  Notify(PSTR("\r\nSend HID Control Connection Request"), 0x80);
+
689 #ifdef DEBUG_USB_HOST
+
690  Notify(PSTR("\r\nSend HID Control Connection Request"), 0x80);
691 #endif
692  hci_handle = pBtd->hci_handle; // Store the HCI Handle for the connection
693  l2cap_event_flag = 0; // Reset flags
@@ -786,8 +786,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
695  pBtd->l2cap_connection_request(hci_handle, identifier, control_dcid, HID_CTRL_PSM);
696  l2cap_state = L2CAP_CONTROL_CONNECT_REQUEST;
697  } else if (l2cap_connection_request_control_flag) {
-
698 #ifdef DEBUG
-
699  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
+
698 #ifdef DEBUG_USB_HOST
+
699  Notify(PSTR("\r\nHID Control Incoming Connection Request"), 0x80);
700 #endif
701  pBtd->l2cap_connection_response(hci_handle, identifier, control_dcid, control_scid, PENDING);
702  delay(1);
@@ -800,9 +800,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
709  break;
710 
711  case L2CAP_CHECK_MOTION_PLUS_STATE:
-
712 #ifdef DEBUG
+
712 #ifdef DEBUG_USB_HOST
713  if (stateCounter == 0) // Only print onnce
-
714  Notify(PSTR("\r\nChecking if a Motion Plus is connected"), 0x80);
+
714  Notify(PSTR("\r\nChecking if a Motion Plus is connected"), 0x80);
715 #endif
716  stateCounter++;
717  if (stateCounter % 200 == 0)
@@ -813,15 +813,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
722  timer = micros();
723 
724  if (unknownExtensionConnected) {
-
725 #ifdef DEBUG
-
726  Notify(PSTR("\r\nA extension is also connected"), 0x80);
+
725 #ifdef DEBUG_USB_HOST
+
726  Notify(PSTR("\r\nA extension is also connected"), 0x80);
727 #endif
728  activateNunchuck = true; // For we will just set this to true as this the only extension supported so far
729  }
730 
731  } else if (stateCounter == 601) { // We will try three times to check for the motion plus
-
732 #ifdef DEBUG
-
733  Notify(PSTR("\r\nNo Motion Plus was detected"), 0x80);
+
732 #ifdef DEBUG_USB_HOST
+
733  Notify(PSTR("\r\nNo Motion Plus was detected"), 0x80);
734 #endif
735  stateCounter = 0;
736  l2cap_state = L2CAP_CHECK_EXTENSION_STATE;
@@ -829,9 +829,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
738  break;
739 
740  case L2CAP_CHECK_EXTENSION_STATE: // This is used to check if there is anything plugged in to the extension port
-
741 #ifdef DEBUG
+
741 #ifdef DEBUG_USB_HOST
742  if (stateCounter == 0) // Only print onnce
-
743  Notify(PSTR("\r\nChecking if there is any extension connected"), 0x80);
+
743  Notify(PSTR("\r\nChecking if there is any extension connected"), 0x80);
744 #endif
745  stateCounter++; // We use this counter as there has to be a short delay between the commands
746  if (stateCounter == 1)
@@ -876,9 +876,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
785 
786  case L2CAP_DONE:
787  if (unknownExtensionConnected) {
-
788 #ifdef DEBUG
+
788 #ifdef DEBUG_USB_HOST
789  if (stateCounter == 0) // Only print once
-
790  Notify(PSTR("\r\nChecking extension port"), 0x80);
+
790  Notify(PSTR("\r\nChecking extension port"), 0x80);
791 #endif
792  stateCounter++; // We will use this counter as there has to be a short delay between the commands
793  if (stateCounter == 50)
@@ -894,8 +894,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
803  readExtensionType();
804  else if (stateCounter == 250) {
805  if (nunchuck_connected_flag) {
-
806 #ifdef DEBUG
-
807  Notify(PSTR("\r\nNunchuck was reconnected"), 0x80);
+
806 #ifdef DEBUG_USB_HOST
+
807  Notify(PSTR("\r\nNunchuck was reconnected"), 0x80);
808 #endif
809  activateNunchuck = true;
810  nunchuckConnected = true;
@@ -904,8 +904,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
813  stateCounter = 449;
814  } else if (stateCounter == 300) {
815  if (motionPlusConnected) {
-
816 #ifdef DEBUG
-
817  Notify(PSTR("\r\nReactivating the Motion Plus"), 0x80);
+
816 #ifdef DEBUG_USB_HOST
+
817  Notify(PSTR("\r\nReactivating the Motion Plus"), 0x80);
818 #endif
819  initMotionPlus();
820  } else
@@ -1058,20 +1058,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
967 void WII::activateMotionPlus() {
968  uint8_t buf[1];
969  if (pBtd->wiiUProController) {
-
970 #ifdef DEBUG
-
971  Notify(PSTR("\r\nActivating Wii U Pro Controller"), 0x80);
+
970 #ifdef DEBUG_USB_HOST
+
971  Notify(PSTR("\r\nActivating Wii U Pro Controller"), 0x80);
972 #endif
973  buf[0] = 0x00; // It seems like you can send anything but 0x04, 0x05, and 0x07
974  } else if (activateNunchuck) {
-
975 #ifdef DEBUG
-
976  Notify(PSTR("\r\nActivating Motion Plus in pass-through mode"), 0x80);
+
975 #ifdef DEBUG_USB_HOST
+
976  Notify(PSTR("\r\nActivating Motion Plus in pass-through mode"), 0x80);
977 #endif
978  buf[0] = 0x05; // Activate nunchuck pass-through mode
979  } //else if(classicControllerConnected && extensionConnected)
980  //buf[0] = 0x07;
981  else {
-
982 #ifdef DEBUG
-
983  Notify(PSTR("\r\nActivating Motion Plus in normal mode"), 0x80);
+
982 #ifdef DEBUG_USB_HOST
+
983  Notify(PSTR("\r\nActivating Motion Plus in normal mode"), 0x80);
984 #endif
985  buf[0] = 0x04; // Don't use any extension
986  }
@@ -1162,59 +1162,59 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
1071 void WII::IRinitialize() { // Turns on and initialises the IR camera
1072 
1073  enableIRCamera1();
-
1074 #ifdef DEBUG
-
1075  Notify(PSTR("\r\nEnable IR Camera1 Complete"), 0x80);
+
1074 #ifdef DEBUG_USB_HOST
+
1075  Notify(PSTR("\r\nEnable IR Camera1 Complete"), 0x80);
1076 #endif
1077  delay(80);
1078 
1079  enableIRCamera2();
-
1080 #ifdef DEBUG
-
1081  Notify(PSTR("\r\nEnable IR Camera2 Complete"), 0x80);
+
1080 #ifdef DEBUG_USB_HOST
+
1081  Notify(PSTR("\r\nEnable IR Camera2 Complete"), 0x80);
1082 #endif
1083  delay(80);
1084 
1085  write0x08Value();
-
1086 #ifdef DEBUG
-
1087  Notify(PSTR("\r\nWrote hex number 0x08"), 0x80);
+
1086 #ifdef DEBUG_USB_HOST
+
1087  Notify(PSTR("\r\nWrote hex number 0x08"), 0x80);
1088 #endif
1089  delay(80);
1090 
1091  writeSensitivityBlock1();
-
1092 #ifdef DEBUG
-
1093  Notify(PSTR("\r\nWrote Sensitivity Block 1"), 0x80);
+
1092 #ifdef DEBUG_USB_HOST
+
1093  Notify(PSTR("\r\nWrote Sensitivity Block 1"), 0x80);
1094 #endif
1095  delay(80);
1096 
1097  writeSensitivityBlock2();
-
1098 #ifdef DEBUG
-
1099  Notify(PSTR("\r\nWrote Sensitivity Block 2"), 0x80);
+
1098 #ifdef DEBUG_USB_HOST
+
1099  Notify(PSTR("\r\nWrote Sensitivity Block 2"), 0x80);
1100 #endif
1101  delay(80);
1102 
1103  uint8_t mode_num = 0x03;
1104  setWiiModeNumber(mode_num); // Change input for whatever mode you want i.e. 0x01, 0x03, or 0x05
-
1105 #ifdef DEBUG
-
1106  Notify(PSTR("\r\nSet Wii Mode Number To 0x"), 0x80);
+
1105 #ifdef DEBUG_USB_HOST
+
1106  Notify(PSTR("\r\nSet Wii Mode Number To 0x"), 0x80);
1107  PrintHex<uint8_t > (mode_num, 0x80);
1108 #endif
1109  delay(80);
1110 
1111  write0x08Value();
-
1112 #ifdef DEBUG
-
1113  Notify(PSTR("\r\nWrote Hex Number 0x08"), 0x80);
+
1112 #ifdef DEBUG_USB_HOST
+
1113  Notify(PSTR("\r\nWrote Hex Number 0x08"), 0x80);
1114 #endif
1115  delay(80);
1116 
1117  setReportMode(false, 0x33);
1118  //setReportMode(false, 0x3f); // For full reporting mode, doesn't work yet
-
1119 #ifdef DEBUG
-
1120  Notify(PSTR("\r\nSet Report Mode to 0x33"), 0x80);
+
1119 #ifdef DEBUG_USB_HOST
+
1120  Notify(PSTR("\r\nSet Report Mode to 0x33"), 0x80);
1121 #endif
1122  delay(80);
1123 
1124  statusRequest(); // Used to update wiiState - call isIRCameraEnabled() afterwards to check if it actually worked
-
1125 #ifdef DEBUG
-
1126  Notify(PSTR("\r\nIR Initialized"), 0x80);
+
1125 #ifdef DEBUG_USB_HOST
+
1126  Notify(PSTR("\r\nIR Initialized"), 0x80);
1127 #endif
1128 }
1129 
@@ -1271,7 +1271,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_wii_8h.html b/_wii_8h.html index 11e973b6..131b969f 100644 --- a/_wii_8h.html +++ b/_wii_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Wii.h File Reference @@ -31,7 +31,7 @@ - + @@ -100,7 +100,7 @@ Include dependency graph for Wii.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -734,7 +734,7 @@ Enumerations diff --git a/_wii_8h__incl.map b/_wii_8h__incl.map index b9c5acf4..d325ecff 100644 --- a/_wii_8h__incl.map +++ b/_wii_8h__incl.map @@ -1,15 +1,15 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/_wii_8h__incl.md5 b/_wii_8h__incl.md5 index 021eba9c..cea6b215 100644 --- a/_wii_8h__incl.md5 +++ b/_wii_8h__incl.md5 @@ -1 +1 @@ -209252d4e5b8261066f58eb78ab79741 \ No newline at end of file +380938360619b3d9afcd74c5043e5627 \ No newline at end of file diff --git a/_wii_8h__incl.png b/_wii_8h__incl.png index 93562938..b31cd659 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 68afd1a0..b6f00bb3 100644 --- a/_wii_8h_source.html +++ b/_wii_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Wii.h Source File @@ -31,7 +31,7 @@
- + @@ -396,7 +396,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/_wii_camera_readme_8md.html b/_wii_camera_readme_8md.html index 2212bfe2..843f27a6 100644 --- a/_wii_camera_readme_8md.html +++ b/_wii_camera_readme_8md.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: WiiCameraReadme.md File Reference @@ -31,7 +31,7 @@ - + @@ -92,7 +92,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 ac4620d2..d869e3b2 100644 --- a/_wii_camera_readme_8md_source.html +++ b/_wii_camera_readme_8md_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: WiiCameraReadme.md Source File @@ -31,7 +31,7 @@ - + @@ -89,7 +89,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
2 
3 Must omit the "." in the name of the USB\_Host\_Shiled\_2.0 library folder when inserting into the Arudino library folder.
4 
-
5 This library is large, if you run into memory problems when uploading to the Arduino, comment out the \#define DEBUG in the BTD.cpp and Wii.cpp files.
+
5 This library is large, if you run into memory problems when uploading to the Arduino, comment out the \#define DEBUG in the BTD.cpp and Wii.cpp files.
6 
7 To enable the IR camera code, uncomment \#define WIICAMERA in Wii.h.
8 
@@ -105,7 +105,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 3f6049c6..229754ca 100644 --- a/_x_b_o_x_r_e_c_v_8cpp.html +++ b/_x_b_o_x_r_e_c_v_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXRECV.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -85,8 +85,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
-Macros
XBOXRECV.cpp File Reference
@@ -97,37 +95,16 @@ Include dependency graph for XBOXRECV.cpp:
- +

Go to the source code of this file.

- - - - -

-Macros

#define DEBUG
 
-

Macro Definition Documentation

- -
-
- - - - -
#define DEBUG
-
- -

Definition at line 21 of file 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 880b61ed..0349b950 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,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + 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 f6f2ad1f..977f94a8 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 @@ -3012a27875f68523ad5eb7ea0dd0b724 \ No newline at end of file +aa22d4482e816e4553f3f0e12625c189 \ 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 f2bc3984..7fb5deea 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 530b9131..5ed97471 100644 --- a/_x_b_o_x_r_e_c_v_8cpp_source.html +++ b/_x_b_o_x_r_e_c_v_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXRECV.cpp Source File @@ -31,7 +31,7 @@ - + @@ -109,8 +109,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
18  */
19 
20 #include "XBOXRECV.h"
-
21 #define DEBUG // Uncomment to print data for debugging
-
22 //#define EXTRADEBUG // Uncomment to get even more debugging data
+
21 // To enable serial debugging uncomment "#define DEBUG_USB_HOST" in message.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 
25 XBOXRECV::XBOXRECV(USB *p) :
@@ -139,12 +139,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
48  // get memory address of USB device address pool
49  AddressPool &addrPool = pUsb->GetAddressPool();
50 #ifdef EXTRADEBUG
-
51  Notify(PSTR("\r\nXBOXRECV Init"), 0x80);
+
51  Notify(PSTR("\r\nXBOXRECV Init"), 0x80);
52 #endif
53  // check if address has already been assigned to an instance
54  if (bAddress) {
-
55 #ifdef DEBUG
-
56  Notify(PSTR("\r\nAddress in use"), 0x80);
+
55 #ifdef DEBUG_USB_HOST
+
56  Notify(PSTR("\r\nAddress in use"), 0x80);
57 #endif
58  return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
59  }
@@ -153,15 +153,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
62  p = addrPool.GetUsbDevicePtr(0);
63 
64  if (!p) {
-
65 #ifdef DEBUG
-
66  Notify(PSTR("\r\nAddress not found"), 0x80);
+
65 #ifdef DEBUG_USB_HOST
+
66  Notify(PSTR("\r\nAddress not found"), 0x80);
67 #endif
68  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
69  }
70 
71  if (!p->epinfo) {
-
72 #ifdef DEBUG
-
73  Notify(PSTR("\r\nepinfo is null"), 0x80);
+
72 #ifdef DEBUG_USB_HOST
+
73  Notify(PSTR("\r\nepinfo is null"), 0x80);
74 #endif
75  return USB_ERROR_EPINFO_IS_NULL;
76  }
@@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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
+
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 
@@ -188,8 +188,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
97  if (VID != XBOX_VID && VID != MADCATZ_VID) // We just check if it's a xbox receiver using the Vendor ID
98  goto FailUnknownDevice;
99  else if (PID != XBOX_WIRELESS_RECEIVER_PID && PID != XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID) {
-
100 #ifdef DEBUG
-
101  Notify(PSTR("\r\nYou'll need a wireless receiver for this libary to work"), 0x80);
+
100 #ifdef DEBUG_USB_HOST
+
101  Notify(PSTR("\r\nYou'll need a wireless receiver for this libary to work"), 0x80);
102 #endif
103  goto FailUnknownDevice;
104  }
@@ -209,14 +209,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
118  p->lowspeed = false;
119  addrPool.FreeAddress(bAddress);
120  bAddress = 0;
-
121 #ifdef DEBUG
-
122  Notify(PSTR("\r\nsetAddr: "), 0x80);
-
123 #endif
-
124  PrintHex<uint8_t > (rcode, 0x80);
-
125  return rcode;
+
121 #ifdef DEBUG_USB_HOST
+
122  Notify(PSTR("\r\nsetAddr: "), 0x80);
+
123  PrintHex<uint8_t > (rcode, 0x80);
+
124 #endif
+
125  return rcode;
126  }
127 #ifdef EXTRADEBUG
-
128  Notify(PSTR("\r\nAddr: "), 0x80);
+
128  Notify(PSTR("\r\nAddr: "), 0x80);
129  PrintHex<uint8_t > (bAddress, 0x80);
130 #endif
131  p->lowspeed = false;
@@ -300,8 +300,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
209  if (rcode)
210  goto FailSetConfDescr;
211 
-
212 #ifdef DEBUG
-
213  Notify(PSTR("\r\nXbox Wireless Receiver Connected\r\n"), 0x80);
+
212 #ifdef DEBUG_USB_HOST
+
213  Notify(PSTR("\r\nXbox Wireless Receiver Connected\r\n"), 0x80);
214 #endif
215  XboxReceiverConnected = true;
216  bPollEnable = true;
@@ -309,315 +309,323 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
218 
219  /* diagnostic messages */
220 FailGetDevDescr:
-
221  NotifyFailGetDevDescr();
-
222  goto Fail;
-
223 
-
224 FailSetDevTblEntry:
-
225  NotifyFailSetDevTblEntry();
-
226  goto Fail;
-
227 
-
228 FailSetConfDescr:
-
229  NotifyFailSetConfDescr();
-
230  goto Fail;
-
231 
-
232 FailUnknownDevice:
-
233  NotifyFailUnknownDevice(VID,PID);
-
234  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
-
235 
-
236 Fail:
-
237 #ifdef DEBUG
-
238  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
-
239 #endif
-
240  NotifyFail(rcode);
-
241  Release();
-
242  return rcode;
-
243 }
-
244 
-
245 /* Performs a cleanup after failed Init() attempt */
-
246 uint8_t XBOXRECV::Release() {
-
247  XboxReceiverConnected = false;
-
248  for (uint8_t i = 0; i < 4; i++)
-
249  Xbox360Connected[i] = 0x00;
-
250  pUsb->GetAddressPool().FreeAddress(bAddress);
-
251  bAddress = 0;
-
252  bPollEnable = false;
-
253  return 0;
-
254 }
-
255 
-
256 uint8_t XBOXRECV::Poll() {
-
257  if (!bPollEnable)
-
258  return 0;
-
259  if (!timer || ((millis() - timer) > 3000)) { // Run checkStatus every 3 seconds
-
260  timer = millis();
-
261  checkStatus();
-
262  }
-
263  uint8_t inputPipe;
-
264  uint16_t bufferSize;
-
265  for (uint8_t i = 0; i < 4; i++) {
-
266  switch (i) {
-
267  case 0: inputPipe = XBOX_INPUT_PIPE_1;
-
268  break;
-
269  case 1: inputPipe = XBOX_INPUT_PIPE_2;
-
270  break;
-
271  case 2: inputPipe = XBOX_INPUT_PIPE_3;
-
272  break;
-
273  case 3: inputPipe = XBOX_INPUT_PIPE_4;
-
274  break;
-
275  }
-
276  bufferSize = EP_MAXPKTSIZE; // This is the maximum number of bytes we want to receive
-
277  pUsb->inTransfer(bAddress, epInfo[ inputPipe ].epAddr, &bufferSize, readBuf);
-
278  if (bufferSize > 0) { // The number of received bytes
-
279 #ifdef EXTRADEBUG
-
280  Notify(PSTR("Bytes Received: "), 0x80);
-
281  PrintHex<uint16_t > (bufferSize, 0x80);
-
282  Notify(PSTR("\r\n"), 0x80);
-
283 #endif
-
284  readReport(i);
-
285 #ifdef PRINTREPORT
-
286  printReport(i, bufferSize); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
-
287 #endif
-
288  }
-
289  }
-
290  return 0;
-
291 }
-
292 
-
293 void XBOXRECV::readReport(uint8_t controller) {
-
294  if (readBuf == NULL)
-
295  return;
-
296  // This report is send when a controller is connected and disconnected
-
297  if (readBuf[0] == 0x08 && readBuf[1] != Xbox360Connected[controller]) {
-
298  Xbox360Connected[controller] = readBuf[1];
-
299 #ifdef DEBUG
-
300  Notify(PSTR("Controller "), 0x80);
-
301  Notify(controller, 0x80);
-
302 #endif
-
303  if (Xbox360Connected[controller]) {
-
304 #ifdef DEBUG
-
305  char* str = 0;
-
306  switch (readBuf[1]) {
-
307  case 0x80: str = PSTR(" as controller\r\n");
-
308  break;
-
309  case 0x40: str = PSTR(" as headset\r\n");
-
310  break;
-
311  case 0xC0: str = PSTR(" as controller+headset\r\n");
-
312  break;
-
313  }
-
314  Notify(PSTR(": connected"), 0x80);
-
315  Notify(str, 0x80);
-
316 #endif
-
317  LED led;
-
318  switch (controller) {
-
319  case 0: led = LED1;
+
221 #ifdef DEBUG_USB_HOST
+
222  NotifyFailGetDevDescr();
+
223  goto Fail;
+
224 #endif
+
225 
+
226 FailSetDevTblEntry:
+
227 #ifdef DEBUG_USB_HOST
+
228  NotifyFailSetDevTblEntry();
+
229  goto Fail;
+
230 #endif
+
231 
+
232 FailSetConfDescr:
+
233 #ifdef DEBUG_USB_HOST
+
234  NotifyFailSetConfDescr();
+
235 #endif
+
236  goto Fail;
+
237 
+
238 FailUnknownDevice:
+
239 #ifdef DEBUG_USB_HOST
+
240  NotifyFailUnknownDevice(VID,PID);
+
241 #endif
+
242  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
+
243 
+
244 Fail:
+
245 #ifdef DEBUG_USB_HOST
+
246  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
+
247  NotifyFail(rcode);
+
248 #endif
+
249  Release();
+
250  return rcode;
+
251 }
+
252 
+
253 /* Performs a cleanup after failed Init() attempt */
+
254 uint8_t XBOXRECV::Release() {
+
255  XboxReceiverConnected = false;
+
256  for (uint8_t i = 0; i < 4; i++)
+
257  Xbox360Connected[i] = 0x00;
+
258  pUsb->GetAddressPool().FreeAddress(bAddress);
+
259  bAddress = 0;
+
260  bPollEnable = false;
+
261  return 0;
+
262 }
+
263 
+
264 uint8_t XBOXRECV::Poll() {
+
265  if (!bPollEnable)
+
266  return 0;
+
267  if (!timer || ((millis() - timer) > 3000)) { // Run checkStatus every 3 seconds
+
268  timer = millis();
+
269  checkStatus();
+
270  }
+
271  uint8_t inputPipe;
+
272  uint16_t bufferSize;
+
273  for (uint8_t i = 0; i < 4; i++) {
+
274  switch (i) {
+
275  case 0: inputPipe = XBOX_INPUT_PIPE_1;
+
276  break;
+
277  case 1: inputPipe = XBOX_INPUT_PIPE_2;
+
278  break;
+
279  case 2: inputPipe = XBOX_INPUT_PIPE_3;
+
280  break;
+
281  case 3: inputPipe = XBOX_INPUT_PIPE_4;
+
282  break;
+
283  }
+
284  bufferSize = EP_MAXPKTSIZE; // This is the maximum number of bytes we want to receive
+
285  pUsb->inTransfer(bAddress, epInfo[ inputPipe ].epAddr, &bufferSize, readBuf);
+
286  if (bufferSize > 0) { // The number of received bytes
+
287 #ifdef EXTRADEBUG
+
288  Notify(PSTR("Bytes Received: "), 0x80);
+
289  PrintHex<uint16_t > (bufferSize, 0x80);
+
290  Notify(PSTR("\r\n"), 0x80);
+
291 #endif
+
292  readReport(i);
+
293 #ifdef PRINTREPORT
+
294  printReport(i, bufferSize); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
+
295 #endif
+
296  }
+
297  }
+
298  return 0;
+
299 }
+
300 
+
301 void XBOXRECV::readReport(uint8_t controller) {
+
302  if (readBuf == NULL)
+
303  return;
+
304  // This report is send when a controller is connected and disconnected
+
305  if (readBuf[0] == 0x08 && readBuf[1] != Xbox360Connected[controller]) {
+
306  Xbox360Connected[controller] = readBuf[1];
+
307 #ifdef DEBUG_USB_HOST
+
308  Notify(PSTR("Controller "), 0x80);
+
309  Notify(controller, 0x80);
+
310 #endif
+
311  if (Xbox360Connected[controller]) {
+
312 #ifdef DEBUG_USB_HOST
+
313  char* str = 0;
+
314  switch (readBuf[1]) {
+
315  case 0x80: str = PSTR(" as controller\r\n");
+
316  break;
+
317  case 0x40: str = PSTR(" as headset\r\n");
+
318  break;
+
319  case 0xC0: str = PSTR(" as controller+headset\r\n");
320  break;
-
321  case 1: led = LED2;
-
322  break;
-
323  case 2: led = LED3;
-
324  break;
-
325  case 3: led = LED4;
-
326  break;
-
327  }
-
328  setLedOn(controller, led);
-
329  }
-
330 #ifdef DEBUG
-
331  else
-
332  Notify(PSTR(": disconnected\r\n"), 0x80);
-
333 #endif
-
334  return;
-
335  }
-
336  // Controller status report
-
337  if (readBuf[1] == 0x00 && readBuf[3] & 0x13 && readBuf[4] >= 0x22) {
-
338  controllerStatus[controller] = ((uint16_t)readBuf[3] << 8) | readBuf[4];
-
339  return;
-
340  }
-
341  if (readBuf[1] != 0x01) // Check if it's the correct report - the receiver also sends different status reports
-
342  return;
-
343 
-
344  // A controller must be connected if it's sending data
-
345  if (!Xbox360Connected[controller])
-
346  Xbox360Connected[controller] |= 0x80;
-
347 
-
348  ButtonState[controller] = (uint32_t)(readBuf[9] | ((uint16_t)readBuf[8] << 8) | ((uint32_t)readBuf[7] << 16) | ((uint32_t)readBuf[6] << 24));
-
349 
-
350  hatValue[controller][LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
-
351  hatValue[controller][LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
-
352  hatValue[controller][RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
-
353  hatValue[controller][RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
-
354 
-
355  //Notify(PSTR("\r\nButtonState: "), 0x80);
-
356  //PrintHex<uint32_t>(ButtonState[controller], 0x80);
+
321  }
+
322  Notify(PSTR(": connected"), 0x80);
+
323  Notify(str, 0x80);
+
324 #endif
+
325  LED led;
+
326  switch (controller) {
+
327  case 0: led = LED1;
+
328  break;
+
329  case 1: led = LED2;
+
330  break;
+
331  case 2: led = LED3;
+
332  break;
+
333  case 3: led = LED4;
+
334  break;
+
335  }
+
336  setLedOn(led, controller);
+
337  }
+
338 #ifdef DEBUG_USB_HOST
+
339  else
+
340  Notify(PSTR(": disconnected\r\n"), 0x80);
+
341 #endif
+
342  return;
+
343  }
+
344  // Controller status report
+
345  if (readBuf[1] == 0x00 && readBuf[3] & 0x13 && readBuf[4] >= 0x22) {
+
346  controllerStatus[controller] = ((uint16_t)readBuf[3] << 8) | readBuf[4];
+
347  return;
+
348  }
+
349  if (readBuf[1] != 0x01) // Check if it's the correct report - the receiver also sends different status reports
+
350  return;
+
351 
+
352  // A controller must be connected if it's sending data
+
353  if (!Xbox360Connected[controller])
+
354  Xbox360Connected[controller] |= 0x80;
+
355 
+
356  ButtonState[controller] = (uint32_t)(readBuf[9] | ((uint16_t)readBuf[8] << 8) | ((uint32_t)readBuf[7] << 16) | ((uint32_t)readBuf[6] << 24));
357 
-
358  if (ButtonState[controller] != OldButtonState[controller]) {
-
359  buttonStateChanged[controller] = true;
-
360  ButtonClickState[controller] = (ButtonState[controller] >> 16) & ((~OldButtonState[controller]) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
-
361  if (((uint8_t)OldButtonState[controller]) == 0 && ((uint8_t)ButtonState[controller]) != 0) // The L2 and R2 buttons are special as they are analog buttons
-
362  R2Clicked[controller] = true;
-
363  if ((uint8_t)(OldButtonState[controller] >> 8) == 0 && (uint8_t)(ButtonState[controller] >> 8) != 0)
-
364  L2Clicked[controller] = true;
-
365  OldButtonState[controller] = ButtonState[controller];
-
366  }
-
367 }
-
368 
-
369 void XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
-
370 #ifdef PRINTREPORT
-
371  if (readBuf == NULL)
-
372  return;
-
373  Notify(PSTR("Controller "), 0x80);
-
374  Notify(controller, 0x80);
-
375  Notify(PSTR(": "), 0x80);
-
376  for (uint8_t i = 0; i < nBytes; i++) {
-
377  PrintHex<uint8_t > (readBuf[i], 0x80);
-
378  Notify(PSTR(" "), 0x80);
-
379  }
-
380  Notify(PSTR("\r\n"), 0x80);
-
381 #endif
-
382 }
-
383 
-
384 uint8_t XBOXRECV::getButtonPress(uint8_t controller, Button b) {
-
385  if (b == L2) // These are analog buttons
-
386  return (uint8_t)(ButtonState[controller] >> 8);
-
387  else if (b == R2)
-
388  return (uint8_t)ButtonState[controller];
-
389  return (bool)(ButtonState[controller] & ((uint32_t)pgm_read_word(&XBOXBUTTONS[(uint8_t)b]) << 16));
-
390 }
+
358  hatValue[controller][LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
+
359  hatValue[controller][LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
+
360  hatValue[controller][RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
+
361  hatValue[controller][RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
+
362 
+
363  //Notify(PSTR("\r\nButtonState: "), 0x80);
+
364  //PrintHex<uint32_t>(ButtonState[controller], 0x80);
+
365 
+
366  if (ButtonState[controller] != OldButtonState[controller]) {
+
367  buttonStateChanged[controller] = true;
+
368  ButtonClickState[controller] = (ButtonState[controller] >> 16) & ((~OldButtonState[controller]) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
+
369  if (((uint8_t)OldButtonState[controller]) == 0 && ((uint8_t)ButtonState[controller]) != 0) // The L2 and R2 buttons are special as they are analog buttons
+
370  R2Clicked[controller] = true;
+
371  if ((uint8_t)(OldButtonState[controller] >> 8) == 0 && (uint8_t)(ButtonState[controller] >> 8) != 0)
+
372  L2Clicked[controller] = true;
+
373  OldButtonState[controller] = ButtonState[controller];
+
374  }
+
375 }
+
376 
+
377 void XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
+
378 #ifdef PRINTREPORT
+
379  if (readBuf == NULL)
+
380  return;
+
381  Notify(PSTR("Controller "), 0x80);
+
382  Notify(controller, 0x80);
+
383  Notify(PSTR(": "), 0x80);
+
384  for (uint8_t i = 0; i < nBytes; i++) {
+
385  PrintHex<uint8_t > (readBuf[i], 0x80);
+
386  Notify(PSTR(" "), 0x80);
+
387  }
+
388  Notify(PSTR("\r\n"), 0x80);
+
389 #endif
+
390 }
391 
-
392 bool XBOXRECV::getButtonClick(uint8_t controller, Button b) {
-
393  if (b == L2) {
-
394  if (L2Clicked[controller]) {
-
395  L2Clicked[controller] = false;
-
396  return true;
-
397  }
-
398  return false;
-
399  } else if (b == R2) {
-
400  if (R2Clicked[controller]) {
-
401  R2Clicked[controller] = false;
-
402  return true;
-
403  }
-
404  return false;
-
405  }
-
406  uint16_t button = pgm_read_word(&XBOXBUTTONS[(uint8_t)b]);
-
407  bool click = (ButtonClickState[controller] & button);
-
408  ButtonClickState[controller] &= ~button; // clear "click" event
-
409  return click;
-
410 }
-
411 
-
412 int16_t XBOXRECV::getAnalogHat(uint8_t controller, AnalogHat a) {
-
413  return hatValue[controller][a];
-
414 }
-
415 
-
416 bool XBOXRECV::buttonChanged(uint8_t controller) {
-
417  bool state = buttonStateChanged[controller];
-
418  buttonStateChanged[controller] = false;
-
419  return state;
-
420 }
-
421 
-
422 /*
-
423 ControllerStatus Breakdown
-
424  ControllerStatus[controller] & 0x0001 // 0
-
425  ControllerStatus[controller] & 0x0002 // normal batteries, no rechargeable battery pack
-
426  ControllerStatus[controller] & 0x0004 // controller starting up / settling
-
427  ControllerStatus[controller] & 0x0008 // headset adapter plugged in, but no headphones connected (mute?)
-
428  ControllerStatus[controller] & 0x0010 // 0
-
429  ControllerStatus[controller] & 0x0020 // 1
-
430  ControllerStatus[controller] & 0x0040 // battery level (high bit)
-
431  ControllerStatus[controller] & 0x0080 // battery level (low bit)
-
432  ControllerStatus[controller] & 0x0100 // 1
-
433  ControllerStatus[controller] & 0x0200 // 1
-
434  ControllerStatus[controller] & 0x0400 // headset adapter plugged in
-
435  ControllerStatus[controller] & 0x0800 // 0
-
436  ControllerStatus[controller] & 0x1000 // 1
-
437  ControllerStatus[controller] & 0x2000 // 0
-
438  ControllerStatus[controller] & 0x4000 // 0
-
439  ControllerStatus[controller] & 0x8000 // 0
-
440  */
-
441 uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
-
442  return ((controllerStatus[controller] & 0x00C0) >> 6);
-
443 }
-
444 
-
445 void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
-
446  uint8_t rcode;
-
447  uint8_t outputPipe;
-
448  switch (controller) {
-
449  case 0: outputPipe = XBOX_OUTPUT_PIPE_1;
-
450  break;
-
451  case 1: outputPipe = XBOX_OUTPUT_PIPE_2;
-
452  break;
-
453  case 2: outputPipe = XBOX_OUTPUT_PIPE_3;
-
454  break;
-
455  case 3: outputPipe = XBOX_OUTPUT_PIPE_4;
-
456  break;
-
457  }
-
458  rcode = pUsb->outTransfer(bAddress, epInfo[ outputPipe ].epAddr, nbytes, data);
-
459 #ifdef EXTRADEBUG
-
460  if (rcode)
-
461  Notify(PSTR("Error sending Xbox message\r\n"), 0x80);
-
462 #endif
-
463 }
-
464 
-
465 void XBOXRECV::setLedRaw(uint8_t controller, uint8_t value) {
-
466  writeBuf[0] = 0x00;
-
467  writeBuf[1] = 0x00;
-
468  writeBuf[2] = 0x08;
-
469  writeBuf[3] = value | 0x40;
-
470 
-
471  XboxCommand(controller, writeBuf, 4);
-
472 }
-
473 
-
474 void XBOXRECV::setLedOn(uint8_t controller, LED led) {
-
475  if (led != ALL) // All LEDs can't be on a the same time
-
476  setLedRaw(controller, (pgm_read_byte(&XBOXLEDS[(uint8_t)led])) + 4);
-
477 }
+
392 uint8_t XBOXRECV::getButtonPress(Button b, uint8_t controller) {
+
393  if (b == L2) // These are analog buttons
+
394  return (uint8_t)(ButtonState[controller] >> 8);
+
395  else if (b == R2)
+
396  return (uint8_t)ButtonState[controller];
+
397  return (bool)(ButtonState[controller] & ((uint32_t)pgm_read_word(&XBOXBUTTONS[(uint8_t)b]) << 16));
+
398 }
+
399 
+
400 bool XBOXRECV::getButtonClick(Button b, uint8_t controller) {
+
401  if (b == L2) {
+
402  if (L2Clicked[controller]) {
+
403  L2Clicked[controller] = false;
+
404  return true;
+
405  }
+
406  return false;
+
407  } else if (b == R2) {
+
408  if (R2Clicked[controller]) {
+
409  R2Clicked[controller] = false;
+
410  return true;
+
411  }
+
412  return false;
+
413  }
+
414  uint16_t button = pgm_read_word(&XBOXBUTTONS[(uint8_t)b]);
+
415  bool click = (ButtonClickState[controller] & button);
+
416  ButtonClickState[controller] &= ~button; // clear "click" event
+
417  return click;
+
418 }
+
419 
+
420 int16_t XBOXRECV::getAnalogHat(AnalogHat a, uint8_t controller) {
+
421  return hatValue[controller][a];
+
422 }
+
423 
+
424 bool XBOXRECV::buttonChanged(uint8_t controller) {
+
425  bool state = buttonStateChanged[controller];
+
426  buttonStateChanged[controller] = false;
+
427  return state;
+
428 }
+
429 
+
430 /*
+
431 ControllerStatus Breakdown
+
432  ControllerStatus[controller] & 0x0001 // 0
+
433  ControllerStatus[controller] & 0x0002 // normal batteries, no rechargeable battery pack
+
434  ControllerStatus[controller] & 0x0004 // controller starting up / settling
+
435  ControllerStatus[controller] & 0x0008 // headset adapter plugged in, but no headphones connected (mute?)
+
436  ControllerStatus[controller] & 0x0010 // 0
+
437  ControllerStatus[controller] & 0x0020 // 1
+
438  ControllerStatus[controller] & 0x0040 // battery level (high bit)
+
439  ControllerStatus[controller] & 0x0080 // battery level (low bit)
+
440  ControllerStatus[controller] & 0x0100 // 1
+
441  ControllerStatus[controller] & 0x0200 // 1
+
442  ControllerStatus[controller] & 0x0400 // headset adapter plugged in
+
443  ControllerStatus[controller] & 0x0800 // 0
+
444  ControllerStatus[controller] & 0x1000 // 1
+
445  ControllerStatus[controller] & 0x2000 // 0
+
446  ControllerStatus[controller] & 0x4000 // 0
+
447  ControllerStatus[controller] & 0x8000 // 0
+
448  */
+
449 uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
+
450  return ((controllerStatus[controller] & 0x00C0) >> 6);
+
451 }
+
452 
+
453 void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
+
454  uint8_t rcode;
+
455  uint8_t outputPipe;
+
456  switch (controller) {
+
457  case 0: outputPipe = XBOX_OUTPUT_PIPE_1;
+
458  break;
+
459  case 1: outputPipe = XBOX_OUTPUT_PIPE_2;
+
460  break;
+
461  case 2: outputPipe = XBOX_OUTPUT_PIPE_3;
+
462  break;
+
463  case 3: outputPipe = XBOX_OUTPUT_PIPE_4;
+
464  break;
+
465  }
+
466  rcode = pUsb->outTransfer(bAddress, epInfo[ outputPipe ].epAddr, nbytes, data);
+
467 #ifdef EXTRADEBUG
+
468  if (rcode)
+
469  Notify(PSTR("Error sending Xbox message\r\n"), 0x80);
+
470 #endif
+
471 }
+
472 
+
473 void XBOXRECV::setLedRaw(uint8_t value, uint8_t controller) {
+
474  writeBuf[0] = 0x00;
+
475  writeBuf[1] = 0x00;
+
476  writeBuf[2] = 0x08;
+
477  writeBuf[3] = value | 0x40;
478 
-
479 void XBOXRECV::setLedBlink(uint8_t controller, LED led) {
-
480  setLedRaw(controller, pgm_read_byte(&XBOXLEDS[(uint8_t)led]));
-
481 }
-
482 
-
483 void XBOXRECV::setLedMode(uint8_t controller, LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports
-
484  setLedRaw(controller, (uint8_t)ledMode);
+
479  XboxCommand(controller, writeBuf, 4);
+
480 }
+
481 
+
482 void XBOXRECV::setLedOn(LED led, uint8_t controller) {
+
483  if (led != ALL) // All LEDs can't be on a the same time
+
484  setLedRaw(pgm_read_byte(&XBOXLEDS[(uint8_t)led]) + 4, controller);
485 }
486 
-
487 /* PC runs this at interval of approx 2 seconds
-
488 Thanks to BusHound from Perisoft.net for the Windows USB Analysis output
-
489 Found by timstamp.co.uk
-
490  */
-
491 void XBOXRECV::checkStatus() {
-
492  if (!bPollEnable)
-
493  return;
-
494  // Get controller info
-
495  writeBuf[0] = 0x08;
-
496  writeBuf[1] = 0x00;
-
497  writeBuf[2] = 0x0f;
-
498  writeBuf[3] = 0xc0;
-
499  for (uint8_t i = 0; i < 4; i++) {
-
500  XboxCommand(i, writeBuf, 4);
-
501  }
-
502  // Get battery status
-
503  writeBuf[0] = 0x00;
+
487 void XBOXRECV::setLedBlink(LED led, uint8_t controller) {
+
488  setLedRaw(pgm_read_byte(&XBOXLEDS[(uint8_t)led]), controller);
+
489 }
+
490 
+
491 void XBOXRECV::setLedMode(LEDMode ledMode, uint8_t controller) { // This function is used to do some speciel LED stuff the controller supports
+
492  setLedRaw((uint8_t)ledMode, controller);
+
493 }
+
494 
+
495 /* PC runs this at interval of approx 2 seconds
+
496 Thanks to BusHound from Perisoft.net for the Windows USB Analysis output
+
497 Found by timstamp.co.uk
+
498  */
+
499 void XBOXRECV::checkStatus() {
+
500  if (!bPollEnable)
+
501  return;
+
502  // Get controller info
+
503  writeBuf[0] = 0x08;
504  writeBuf[1] = 0x00;
-
505  writeBuf[2] = 0x00;
-
506  writeBuf[3] = 0x40;
+
505  writeBuf[2] = 0x0f;
+
506  writeBuf[3] = 0xc0;
507  for (uint8_t i = 0; i < 4; i++) {
-
508  if (Xbox360Connected[i])
-
509  XboxCommand(i, writeBuf, 4);
-
510  }
-
511 }
-
512 
-
513 void XBOXRECV::setRumbleOn(uint8_t controller, uint8_t lValue, uint8_t rValue) {
-
514  writeBuf[0] = 0x00;
-
515  writeBuf[1] = 0x01;
-
516  writeBuf[2] = 0x0f;
-
517  writeBuf[3] = 0xc0;
-
518  writeBuf[4] = 0x00;
-
519  writeBuf[5] = lValue; // big weight
-
520  writeBuf[6] = rValue; // small weight
-
521 
-
522  XboxCommand(controller, writeBuf, 7);
-
523 }
+
508  XboxCommand(i, writeBuf, 4);
+
509  }
+
510  // Get battery status
+
511  writeBuf[0] = 0x00;
+
512  writeBuf[1] = 0x00;
+
513  writeBuf[2] = 0x00;
+
514  writeBuf[3] = 0x40;
+
515  for (uint8_t i = 0; i < 4; i++) {
+
516  if (Xbox360Connected[i])
+
517  XboxCommand(i, writeBuf, 4);
+
518  }
+
519 }
+
520 
+
521 void XBOXRECV::setRumbleOn(uint8_t lValue, uint8_t rValue, uint8_t controller) {
+
522  writeBuf[0] = 0x00;
+
523  writeBuf[1] = 0x01;
+
524  writeBuf[2] = 0x0f;
+
525  writeBuf[3] = 0xc0;
+
526  writeBuf[4] = 0x00;
+
527  writeBuf[5] = lValue; // big weight
+
528  writeBuf[6] = rValue; // small weight
+
529 
+
530  XboxCommand(controller, writeBuf, 7);
+
531 }
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 b1780e92..657507dc 100644 --- a/_x_b_o_x_r_e_c_v_8h.html +++ b/_x_b_o_x_r_e_c_v_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXRECV.h File Reference @@ -31,7 +31,7 @@ - + @@ -100,7 +100,7 @@ Include dependency graph for XBOXRECV.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -382,7 +382,7 @@ Macros 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 51fe7fab..a858bdd8 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,13 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + 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 7fd44fde..27d58d22 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 @@ -4ba38c24b020d5cb04bd0339f7b48ca5 \ No newline at end of file +17a0a5cb3f51c98b8fdd7b345f1ab613 \ 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 06452ac4..69deeb3e 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 9e8a992b..4edaf0ce 100644 --- a/_x_b_o_x_r_e_c_v_8h_source.html +++ b/_x_b_o_x_r_e_c_v_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXRECV.h Source File @@ -31,7 +31,7 @@
- + @@ -161,29 +161,29 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
103  virtual bool isReady() {
104  return bPollEnable;
105  };
-
121  uint8_t getButtonPress(uint8_t controller, Button b);
-
122  bool getButtonClick(uint8_t controller, Button b);
-
132  int16_t getAnalogHat(uint8_t controller, AnalogHat a);
+
121  uint8_t getButtonPress(Button b, uint8_t controller = 0);
+
122  bool getButtonClick(Button b, uint8_t controller = 0);
+
132  int16_t getAnalogHat(AnalogHat a, uint8_t controller = 0);
133 
-
138  void setAllOff(uint8_t controller) {
-
139  setRumbleOn(controller, 0, 0);
-
140  setLedOff(controller);
+
138  void setAllOff(uint8_t controller = 0) {
+
139  setRumbleOn(0, 0, controller);
+
140  setLedOff(controller);
141  };
142 
-
147  void setRumbleOff(uint8_t controller) {
-
148  setRumbleOn(controller, 0, 0);
+
147  void setRumbleOff(uint8_t controller = 0) {
+
148  setRumbleOn(0, 0, controller);
149  };
-
156  void setRumbleOn(uint8_t controller, uint8_t lValue, uint8_t rValue);
-
164  void setLedRaw(uint8_t controller, uint8_t value);
+
156  void setRumbleOn(uint8_t lValue, uint8_t rValue, uint8_t controller = 0);
+
164  void setLedRaw(uint8_t value, uint8_t controller = 0);
165 
-
170  void setLedOff(uint8_t controller) {
-
171  setLedRaw(controller, 0);
+
170  void setLedOff(uint8_t controller = 0) {
+
171  setLedRaw(0, controller);
172  };
-
178  void setLedOn(uint8_t controller, LED l);
-
184  void setLedBlink(uint8_t controller, LED l);
-
190  void setLedMode(uint8_t controller, LEDMode lm);
-
196  uint8_t getBatteryLevel(uint8_t controller);
-
202  bool buttonChanged(uint8_t controller);
+
178  void setLedOn(LED l, uint8_t controller = 0);
+
184  void setLedBlink(LED l, uint8_t controller = 0);
+
190  void setLedMode(LEDMode lm, uint8_t controller = 0);
+
196  uint8_t getBatteryLevel(uint8_t controller = 0);
+
202  bool buttonChanged(uint8_t controller = 0);
206  bool XboxReceiverConnected;
208  uint8_t Xbox360Connected[4];
209 
@@ -224,7 +224,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 4d0b06e9..5f8cba41 100644 --- a/_x_b_o_x_u_s_b_8cpp.html +++ b/_x_b_o_x_u_s_b_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXUSB.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -85,8 +85,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-
-Macros
XBOXUSB.cpp File Reference
@@ -97,37 +95,16 @@ Include dependency graph for XBOXUSB.cpp:
- +

Go to the source code of this file.

- - - - -

-Macros

#define DEBUG
 
-

Macro Definition Documentation

- -
-
- - - - -
#define DEBUG
-
- -

Definition at line 19 of file 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 7cf274d5..90a49e45 100644 --- a/_x_b_o_x_u_s_b_8cpp__incl.map +++ b/_x_b_o_x_u_s_b_8cpp__incl.map @@ -1,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + 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 2364c827..a7f32812 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 @@ -1b8350cfc5b0ac72ce377d1cdd1d6c17 \ No newline at end of file +e0b5f50a0597a1ef535805e8be65fdb4 \ 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 b6309cc6..ac689eb2 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 c44e6ef6..69622a26 100644 --- a/_x_b_o_x_u_s_b_8cpp_source.html +++ b/_x_b_o_x_u_s_b_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXUSB.cpp Source File @@ -31,7 +31,7 @@ - + @@ -107,8 +107,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
16  */
17 
18 #include "XBOXUSB.h"
-
19 #define DEBUG // Uncomment to print data for debugging
-
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
+
19 // To enable serial debugging uncomment "#define DEBUG_USB_HOST" in message.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 
23 XBOXUSB::XBOXUSB(USB *p) :
@@ -137,12 +137,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
46  // get memory address of USB device address pool
47  AddressPool &addrPool = pUsb->GetAddressPool();
48 #ifdef EXTRADEBUG
-
49  Notify(PSTR("\r\nXBOXUSB Init"), 0x80);
+
49  Notify(PSTR("\r\nXBOXUSB Init"), 0x80);
50 #endif
51  // check if address has already been assigned to an instance
52  if (bAddress) {
-
53 #ifdef DEBUG
-
54  Notify(PSTR("\r\nAddress in use"), 0x80);
+
53 #ifdef DEBUG_USB_HOST
+
54  Notify(PSTR("\r\nAddress in use"), 0x80);
55 #endif
56  return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
57  }
@@ -151,15 +151,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
60  p = addrPool.GetUsbDevicePtr(0);
61 
62  if (!p) {
-
63 #ifdef DEBUG
-
64  Notify(PSTR("\r\nAddress not found"), 0x80);
+
63 #ifdef DEBUG_USB_HOST
+
64  Notify(PSTR("\r\nAddress not found"), 0x80);
65 #endif
66  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
67  }
68 
69  if (!p->epinfo) {
-
70 #ifdef DEBUG
-
71  Notify(PSTR("\r\nepinfo is null"), 0x80);
+
70 #ifdef DEBUG_USB_HOST
+
71  Notify(PSTR("\r\nepinfo is null"), 0x80);
72 #endif
73  return USB_ERROR_EPINFO_IS_NULL;
74  }
@@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
82  p->lowspeed = lowspeed;
83 
84  // Get device descriptor
-
85  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
+
85  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
86  // Restore p->epinfo
87  p->epinfo = oldep_ptr;
88 
@@ -186,13 +186,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
95  if (VID != XBOX_VID && VID != MADCATZ_VID && VID != JOYTECH_VID) // We just check if it's a xbox controller using the Vendor ID
96  goto FailUnknownDevice;
97  if (PID == XBOX_WIRELESS_PID) {
-
98 #ifdef DEBUG
-
99  Notify(PSTR("\r\nYou have plugged in a wireless Xbox 360 controller - it doesn't support USB communication"), 0x80);
+
98 #ifdef DEBUG_USB_HOST
+
99  Notify(PSTR("\r\nYou have plugged in a wireless Xbox 360 controller - it doesn't support USB communication"), 0x80);
100 #endif
101  goto FailUnknownDevice;
102  } else if (PID == XBOX_WIRELESS_RECEIVER_PID || PID == XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID) {
-
103 #ifdef DEBUG
-
104  Notify(PSTR("\r\nThis library only supports Xbox 360 controllers via USB"), 0x80);
+
103 #ifdef DEBUG_USB_HOST
+
104  Notify(PSTR("\r\nThis library only supports Xbox 360 controllers via USB"), 0x80);
105 #endif
106  goto FailUnknownDevice;
107  }
@@ -212,14 +212,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
121  p->lowspeed = false;
122  addrPool.FreeAddress(bAddress);
123  bAddress = 0;
-
124 #ifdef DEBUG
-
125  Notify(PSTR("\r\nsetAddr: "), 0x80);
+
124 #ifdef DEBUG_USB_HOST
+
125  Notify(PSTR("\r\nsetAddr: "), 0x80);
126 #endif
127  PrintHex<uint8_t > (rcode, 0x80);
128  return rcode;
129  }
130 #ifdef EXTRADEBUG
-
131  Notify(PSTR("\r\nAddr: "), 0x80);
+
131  Notify(PSTR("\r\nAddr: "), 0x80);
132  PrintHex<uint8_t > (bAddress, 0x80);
133 #endif
134  p->lowspeed = false;
@@ -264,8 +264,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
173  if (rcode)
174  goto FailSetConfDescr;
175 
-
176 #ifdef DEBUG
-
177  Notify(PSTR("\r\nXbox 360 Controller Connected\r\n"), 0x80);
+
176 #ifdef DEBUG_USB_HOST
+
177  Notify(PSTR("\r\nXbox 360 Controller Connected\r\n"), 0x80);
178 #endif
179  setLedOn(LED1);
180  Xbox360Connected = true;
@@ -274,166 +274,174 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
183 
184  /* diagnostic messages */
185 FailGetDevDescr:
-
186  NotifyFailGetDevDescr();
-
187  goto Fail;
-
188 
-
189 FailSetDevTblEntry:
-
190  NotifyFailSetDevTblEntry();
-
191  goto Fail;
-
192 
-
193 FailSetConfDescr:
-
194  NotifyFailSetConfDescr();
-
195  goto Fail;
-
196 FailUnknownDevice:
-
197  NotifyFailUnknownDevice(VID,PID);
-
198  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
-
199 
-
200 Fail:
-
201 #ifdef DEBUG
-
202  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
-
203 #endif
-
204  NotifyFail(rcode);
-
205  Release();
-
206  return rcode;
-
207 }
-
208 
-
209 /* Performs a cleanup after failed Init() attempt */
-
210 uint8_t XBOXUSB::Release() {
-
211  Xbox360Connected = false;
-
212  pUsb->GetAddressPool().FreeAddress(bAddress);
-
213  bAddress = 0;
-
214  bPollEnable = false;
-
215  return 0;
-
216 }
-
217 
-
218 uint8_t XBOXUSB::Poll() {
-
219  if (!bPollEnable)
-
220  return 0;
-
221  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
-
222  pUsb->inTransfer(bAddress, epInfo[ XBOX_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
-
223  readReport();
-
224 #ifdef PRINTREPORT
-
225  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
-
226 #endif
-
227  return 0;
-
228 }
-
229 
-
230 void XBOXUSB::readReport() {
-
231  if (readBuf == NULL)
-
232  return;
-
233  if (readBuf[0] != 0x00 || readBuf[1] != 0x14) { // Check if it's the correct report - the controller also sends different status reports
-
234  return;
-
235  }
-
236 
-
237  ButtonState = (uint32_t)(readBuf[5] | ((uint16_t)readBuf[4] << 8) | ((uint32_t)readBuf[3] << 16) | ((uint32_t)readBuf[2] << 24));
-
238 
-
239  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
-
240  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
-
241  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
-
242  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
-
243 
-
244  //Notify(PSTR("\r\nButtonState"), 0x80);
-
245  //PrintHex<uint32_t>(ButtonState, 0x80);
+
186 #ifdef DEBUG_USB_HOST
+
187  NotifyFailGetDevDescr();
+
188  goto Fail;
+
189 #endif
+
190 
+
191 FailSetDevTblEntry:
+
192 #ifdef DEBUG_USB_HOST
+
193  NotifyFailSetDevTblEntry();
+
194  goto Fail;
+
195 #endif
+
196 
+
197 FailSetConfDescr:
+
198 #ifdef DEBUG_USB_HOST
+
199  NotifyFailSetConfDescr();
+
200  goto Fail;
+
201 #endif
+
202 FailUnknownDevice:
+
203 #ifdef DEBUG_USB_HOST
+
204  NotifyFailUnknownDevice(VID, PID);
+
205 #endif
+
206  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
+
207 
+
208 Fail:
+
209 #ifdef DEBUG_USB_HOST
+
210  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "), 0x80);
+
211  NotifyFail(rcode);
+
212 #endif
+
213  Release();
+
214  return rcode;
+
215 }
+
216 
+
217 /* Performs a cleanup after failed Init() attempt */
+
218 uint8_t XBOXUSB::Release() {
+
219  Xbox360Connected = false;
+
220  pUsb->GetAddressPool().FreeAddress(bAddress);
+
221  bAddress = 0;
+
222  bPollEnable = false;
+
223  return 0;
+
224 }
+
225 
+
226 uint8_t XBOXUSB::Poll() {
+
227  if (!bPollEnable)
+
228  return 0;
+
229  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
+
230  pUsb->inTransfer(bAddress, epInfo[ XBOX_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
+
231  readReport();
+
232 #ifdef PRINTREPORT
+
233  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
+
234 #endif
+
235  return 0;
+
236 }
+
237 
+
238 void XBOXUSB::readReport() {
+
239  if (readBuf == NULL)
+
240  return;
+
241  if (readBuf[0] != 0x00 || readBuf[1] != 0x14) { // Check if it's the correct report - the controller also sends different status reports
+
242  return;
+
243  }
+
244 
+
245  ButtonState = (uint32_t)(readBuf[5] | ((uint16_t)readBuf[4] << 8) | ((uint32_t)readBuf[3] << 16) | ((uint32_t)readBuf[2] << 24));
246 
-
247  if (ButtonState != OldButtonState) {
-
248  ButtonClickState = (ButtonState >> 16) & ((~OldButtonState) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
-
249  if (((uint8_t)OldButtonState) == 0 && ((uint8_t)ButtonState) != 0) // The L2 and R2 buttons are special as they are analog buttons
-
250  R2Clicked = true;
-
251  if ((uint8_t)(OldButtonState >> 8) == 0 && (uint8_t)(ButtonState >> 8) != 0)
-
252  L2Clicked = true;
-
253  OldButtonState = ButtonState;
-
254  }
-
255 }
-
256 
-
257 void XBOXUSB::printReport() { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
-
258 #ifdef PRINTREPORT
-
259  if (readBuf == NULL)
-
260  return;
-
261  for (uint8_t i = 0; i < XBOX_REPORT_BUFFER_SIZE; i++) {
-
262  PrintHex<uint8_t > (readBuf[i], 0x80);
-
263  Notify(PSTR(" "), 0x80);
-
264  }
-
265  Notify(PSTR("\r\n"), 0x80);
-
266 #endif
-
267 }
-
268 
-
269 uint8_t XBOXUSB::getButtonPress(Button b) {
-
270  if (b == L2) // These are analog buttons
-
271  return (uint8_t)(ButtonState >> 8);
-
272  else if (b == R2)
-
273  return (uint8_t)ButtonState;
-
274  return (ButtonState & ((uint32_t)pgm_read_word(&XBOXBUTTONS[(uint8_t)b]) << 16));
-
275 }
+
247  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
+
248  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
+
249  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
+
250  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
+
251 
+
252  //Notify(PSTR("\r\nButtonState"), 0x80);
+
253  //PrintHex<uint32_t>(ButtonState, 0x80);
+
254 
+
255  if (ButtonState != OldButtonState) {
+
256  ButtonClickState = (ButtonState >> 16) & ((~OldButtonState) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
+
257  if (((uint8_t)OldButtonState) == 0 && ((uint8_t)ButtonState) != 0) // The L2 and R2 buttons are special as they are analog buttons
+
258  R2Clicked = true;
+
259  if ((uint8_t)(OldButtonState >> 8) == 0 && (uint8_t)(ButtonState >> 8) != 0)
+
260  L2Clicked = true;
+
261  OldButtonState = ButtonState;
+
262  }
+
263 }
+
264 
+
265 void XBOXUSB::printReport() { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
+
266 #ifdef PRINTREPORT
+
267  if (readBuf == NULL)
+
268  return;
+
269  for (uint8_t i = 0; i < XBOX_REPORT_BUFFER_SIZE; i++) {
+
270  PrintHex<uint8_t > (readBuf[i], 0x80);
+
271  Notify(PSTR(" "), 0x80);
+
272  }
+
273  Notify(PSTR("\r\n"), 0x80);
+
274 #endif
+
275 }
276 
-
277 bool XBOXUSB::getButtonClick(Button b) {
-
278  if (b == L2) {
-
279  if (L2Clicked) {
-
280  L2Clicked = false;
-
281  return true;
-
282  }
-
283  return false;
-
284  } else if (b == R2) {
-
285  if (R2Clicked) {
-
286  R2Clicked = false;
-
287  return true;
-
288  }
-
289  return false;
-
290  }
-
291  uint16_t button = pgm_read_word(&XBOXBUTTONS[(uint8_t)b]);
-
292  bool click = (ButtonClickState & button);
-
293  ButtonClickState &= ~button; // clear "click" event
-
294  return click;
-
295 }
-
296 
-
297 int16_t XBOXUSB::getAnalogHat(AnalogHat a) {
-
298  return hatValue[a];
-
299 }
-
300 
-
301 /* Xbox Controller commands */
-
302 void XBOXUSB::XboxCommand(uint8_t* data, uint16_t nbytes) {
-
303  //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)
-
304  pUsb->ctrlReq(bAddress, epInfo[XBOX_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);
-
305 }
-
306 
-
307 void XBOXUSB::setLedRaw(uint8_t value) {
-
308  writeBuf[0] = 0x01;
-
309  writeBuf[1] = 0x03;
-
310  writeBuf[2] = value;
-
311 
-
312  XboxCommand(writeBuf, 3);
+
277 uint8_t XBOXUSB::getButtonPress(Button b) {
+
278  if (b == L2) // These are analog buttons
+
279  return (uint8_t)(ButtonState >> 8);
+
280  else if (b == R2)
+
281  return (uint8_t)ButtonState;
+
282  return (ButtonState & ((uint32_t)pgm_read_word(&XBOXBUTTONS[(uint8_t)b]) << 16));
+
283 }
+
284 
+
285 bool XBOXUSB::getButtonClick(Button b) {
+
286  if (b == L2) {
+
287  if (L2Clicked) {
+
288  L2Clicked = false;
+
289  return true;
+
290  }
+
291  return false;
+
292  } else if (b == R2) {
+
293  if (R2Clicked) {
+
294  R2Clicked = false;
+
295  return true;
+
296  }
+
297  return false;
+
298  }
+
299  uint16_t button = pgm_read_word(&XBOXBUTTONS[(uint8_t)b]);
+
300  bool click = (ButtonClickState & button);
+
301  ButtonClickState &= ~button; // clear "click" event
+
302  return click;
+
303 }
+
304 
+
305 int16_t XBOXUSB::getAnalogHat(AnalogHat a) {
+
306  return hatValue[a];
+
307 }
+
308 
+
309 /* Xbox Controller commands */
+
310 void XBOXUSB::XboxCommand(uint8_t* data, uint16_t nbytes) {
+
311  //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)
+
312  pUsb->ctrlReq(bAddress, epInfo[XBOX_CONTROL_PIPE].epAddr, bmREQ_HID_OUT, HID_REQUEST_SET_REPORT, 0x00, 0x02, 0x00, nbytes, nbytes, data, NULL);
313 }
314 
-
315 void XBOXUSB::setLedOn(LED led) {
-
316  if (led != ALL) // All LEDs can't be on a the same time
-
317  setLedRaw((pgm_read_byte(&XBOXLEDS[(uint8_t)led])) + 4);
-
318 }
+
315 void XBOXUSB::setLedRaw(uint8_t value) {
+
316  writeBuf[0] = 0x01;
+
317  writeBuf[1] = 0x03;
+
318  writeBuf[2] = value;
319 
-
320 void XBOXUSB::setLedBlink(LED led) {
-
321  setLedRaw(pgm_read_byte(&XBOXLEDS[(uint8_t)led]));
-
322 }
-
323 
-
324 void XBOXUSB::setLedMode(LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports
-
325  setLedRaw((uint8_t)ledMode);
+
320  XboxCommand(writeBuf, 3);
+
321 }
+
322 
+
323 void XBOXUSB::setLedOn(LED led) {
+
324  if (led != ALL) // All LEDs can't be on a the same time
+
325  setLedRaw((pgm_read_byte(&XBOXLEDS[(uint8_t)led])) + 4);
326 }
327 
-
328 void XBOXUSB::setRumbleOn(uint8_t lValue, uint8_t rValue) {
-
329  writeBuf[0] = 0x00;
-
330  writeBuf[1] = 0x08;
-
331  writeBuf[2] = 0x00;
-
332  writeBuf[3] = lValue; // big weight
-
333  writeBuf[4] = rValue; // small weight
-
334  writeBuf[5] = 0x00;
-
335  writeBuf[6] = 0x00;
-
336  writeBuf[7] = 0x00;
-
337 
-
338  XboxCommand(writeBuf, 8);
-
339 }
+
328 void XBOXUSB::setLedBlink(LED led) {
+
329  setLedRaw(pgm_read_byte(&XBOXLEDS[(uint8_t)led]));
+
330 }
+
331 
+
332 void XBOXUSB::setLedMode(LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports
+
333  setLedRaw((uint8_t)ledMode);
+
334 }
+
335 
+
336 void XBOXUSB::setRumbleOn(uint8_t lValue, uint8_t rValue) {
+
337  writeBuf[0] = 0x00;
+
338  writeBuf[1] = 0x08;
+
339  writeBuf[2] = 0x00;
+
340  writeBuf[3] = lValue; // big weight
+
341  writeBuf[4] = rValue; // small weight
+
342  writeBuf[5] = 0x00;
+
343  writeBuf[6] = 0x00;
+
344  writeBuf[7] = 0x00;
+
345 
+
346  XboxCommand(writeBuf, 8);
+
347 }
diff --git a/_x_b_o_x_u_s_b_8h.html b/_x_b_o_x_u_s_b_8h.html index 093816d4..7c54ffdf 100644 --- a/_x_b_o_x_u_s_b_8h.html +++ b/_x_b_o_x_u_s_b_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXUSB.h File Reference @@ -31,7 +31,7 @@ - + @@ -100,7 +100,7 @@ Include dependency graph for XBOXUSB.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -366,7 +366,7 @@ Macros 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 0ba3691e..175fea19 100644 --- a/_x_b_o_x_u_s_b_8h__incl.map +++ b/_x_b_o_x_u_s_b_8h__incl.map @@ -1,13 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + 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 f67e5a1d..3522abe1 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 @@ -1c6119f96994343efe9cd25fa3e34665 \ No newline at end of file +5d51cb4fe0c3c9ec85174b689556eadf \ 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 de45bee7..abb885f6 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 c26d82de..ad89be93 100644 --- a/_x_b_o_x_u_s_b_8h_source.html +++ b/_x_b_o_x_u_s_b_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXUSB.h Source File @@ -31,7 +31,7 @@
- + @@ -217,7 +217,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/address_8h.html b/address_8h.html index e9ecf80f..62f30d2b 100644 --- a/address_8h.html +++ b/address_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: address.h File Reference @@ -31,7 +31,7 @@ - + @@ -299,7 +299,7 @@ Typedefs diff --git a/address_8h_source.html b/address_8h_source.html index 5bbf1d0f..3613f1a8 100644 --- a/address_8h_source.html +++ b/address_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: address.h Source File @@ -31,7 +31,7 @@ - + @@ -161,7 +161,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
70 
71 #define bmUSB_DEV_ADDR_ADDRESS 0x07
72 #define bmUSB_DEV_ADDR_PARENT 0x38
-
73 #define bmUSB_DEV_ADDR_HUB 0x40
+
73 #define bmUSB_DEV_ADDR_HUB 0x40
74 
75 struct UsbDevice {
76  EpInfo *epinfo; // endpoint info pointer
@@ -285,7 +285,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
194 
195  virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) {
196  /* if (parent != 0 && port == 0)
-
197  Serial.println("PRT:0"); */
+
197  USB_HOST_SERIAL.println("PRT:0"); */
198 
199  if(parent > 127 || port > 7)
200  return 0;
@@ -322,12 +322,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
231  }
232  thePool[index].address = *((uint8_t*) & addr);
233  /*
-
234  Serial.print("Addr:");
-
235  Serial.print(addr.bmHub, HEX);
-
236  Serial.print(".");
-
237  Serial.print(addr.bmParent, HEX);
-
238  Serial.print(".");
-
239  Serial.println(addr.bmAddress, HEX);
+
234  USB_HOST_SERIAL.print("Addr:");
+
235  USB_HOST_SERIAL.print(addr.bmHub, HEX);
+
236  USB_HOST_SERIAL.print(".");
+
237  USB_HOST_SERIAL.print(addr.bmParent, HEX);
+
238  USB_HOST_SERIAL.print(".");
+
239  USB_HOST_SERIAL.println(addr.bmAddress, HEX);
240  */
241  return thePool[index].address;
242  };
@@ -366,7 +366,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/adk_8cpp.html b/adk_8cpp.html index 5b25718b..f514e579 100644 --- a/adk_8cpp.html +++ b/adk_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: adk.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -95,7 +95,7 @@ Include dependency graph for adk.cpp:
- +

Go to the source code of this file.

@@ -104,7 +104,7 @@ Include dependency graph for adk.cpp: diff --git a/adk_8cpp__incl.map b/adk_8cpp__incl.map index 7e7a39d1..4d6f55d0 100644 --- a/adk_8cpp__incl.map +++ b/adk_8cpp__incl.map @@ -1,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/adk_8cpp__incl.md5 b/adk_8cpp__incl.md5 index e5dd02dc..3c631c79 100644 --- a/adk_8cpp__incl.md5 +++ b/adk_8cpp__incl.md5 @@ -1 +1 @@ -8e1a236ca758d488357f4e29241421de \ No newline at end of file +d603c7922054a57e1c948cf326e52d12 \ No newline at end of file diff --git a/adk_8cpp__incl.png b/adk_8cpp__incl.png index d714a367..663e1088 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 d84292f9..1e9edf1c 100644 --- a/adk_8cpp_source.html +++ b/adk_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: adk.cpp Source File @@ -31,7 +31,7 @@ - + @@ -191,7 +191,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
100  p->lowspeed = lowspeed;
101 
102  // Get device descriptor
-
103  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
+
103  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
104 
105  // Restore p->epinfo
106  p->epinfo = oldep_ptr;
@@ -318,115 +318,127 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
227 
228  /* diagnostic messages */
229 FailGetDevDescr:
-
230  NotifyFailGetDevDescr();
-
231  goto Fail;
-
232 
-
233 FailSetDevTblEntry:
-
234  NotifyFailSetDevTblEntry();
-
235  goto Fail;
-
236 
-
237 FailGetConfDescr:
-
238  NotifyFailGetConfDescr();
-
239  goto Fail;
-
240 
-
241 FailSetConfDescr:
-
242  NotifyFailSetConfDescr();
-
243  goto Fail;
-
244 
-
245 FailGetProto:
-
246  USBTRACE("\r\ngetProto:");
-
247  goto Fail;
-
248 
-
249 FailSwAcc:
-
250  USBTRACE("\r\nswAcc:");
-
251  goto Fail;
-
252 
-
253 SwAttempt:
-
254  USBTRACE("\r\nAccessory mode switch attempt");
-
255  // goto Fail;
-
256 
-
257 //FailOnInit:
-
258  // USBTRACE("OnInit:");
-
259  // goto Fail;
-
260  //
-
261 Fail:
-
262  //USBTRACE2("\r\nADK Init Failed, error code: ", rcode);
-
263  //NotifyFail(rcode);
-
264  Release();
-
265  return rcode;
-
266 }
-
267 
-
268 /* Extracts bulk-IN and bulk-OUT endpoint information from config descriptor */
-
269 void ADK::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
-
270  //ErrorMessage<uint8_t>(PSTR("Conf.Val"), conf);
-
271  //ErrorMessage<uint8_t>(PSTR("Iface Num"),iface);
-
272  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
-
273 
-
274  //added by Yuuichi Akagawa
-
275  if (bNumEP == 3) {
-
276  return;
-
277  }
-
278 
-
279  bConfNum = conf;
-
280 
-
281  uint8_t index;
-
282 
-
283  // if ((pep->bmAttributes & 0x02) == 2) {
-
284  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
-
285  // }
-
286 
-
287  // Fill in the endpoint info structure
-
288  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
-
289  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
+
230 #ifdef DEBUG_USB_HOST
+
231  NotifyFailGetDevDescr();
+
232  goto Fail;
+
233 #endif
+
234 
+
235 FailSetDevTblEntry:
+
236 #ifdef DEBUG_USB_HOST
+
237  NotifyFailSetDevTblEntry();
+
238  goto Fail;
+
239 #endif
+
240 
+
241 FailGetConfDescr:
+
242 #ifdef DEBUG_USB_HOST
+
243  NotifyFailGetConfDescr();
+
244  goto Fail;
+
245 #endif
+
246 
+
247 FailSetConfDescr:
+
248 #ifdef DEBUG_USB_HOST
+
249  NotifyFailSetConfDescr();
+
250  goto Fail;
+
251 #endif
+
252 
+
253 FailGetProto:
+
254 #ifdef DEBUG_USB_HOST
+
255  USBTRACE("\r\ngetProto:");
+
256  goto Fail;
+
257 #endif
+
258 
+
259 FailSwAcc:
+
260 #ifdef DEBUG_USB_HOST
+
261  USBTRACE("\r\nswAcc:");
+
262  goto Fail;
+
263 #endif
+
264 
+
265 SwAttempt:
+
266 #ifdef DEBUG_USB_HOST
+
267  USBTRACE("\r\nAccessory mode switch attempt");
+
268 #endif
+
269 //FailOnInit:
+
270  // USBTRACE("OnInit:");
+
271  // goto Fail;
+
272  //
+
273 Fail:
+
274  //USBTRACE2("\r\nADK Init Failed, error code: ", rcode);
+
275  //NotifyFail(rcode);
+
276  Release();
+
277  return rcode;
+
278 }
+
279 
+
280 /* Extracts bulk-IN and bulk-OUT endpoint information from config descriptor */
+
281 void ADK::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
+
282  //ErrorMessage<uint8_t>(PSTR("Conf.Val"), conf);
+
283  //ErrorMessage<uint8_t>(PSTR("Iface Num"),iface);
+
284  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
+
285 
+
286  //added by Yuuichi Akagawa
+
287  if (bNumEP == 3) {
+
288  return;
+
289  }
290 
-
291  bNumEP++;
+
291  bConfNum = conf;
292 
-
293  //PrintEndpointDescriptor(pep);
-
294 }
-
295 
-
296 /* Performs a cleanup after failed Init() attempt */
-
297 uint8_t ADK::Release() {
-
298  pUsb->GetAddressPool().FreeAddress(bAddress);
-
299 
-
300  bNumEP = 1; //must have to be reset to 1
-
301 
-
302  bAddress = 0;
-
303  ready = false;
-
304  return 0;
-
305 }
-
306 
-
307 uint8_t ADK::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
-
308  //USBTRACE2("\r\nAddr: ", bAddress );
-
309  //USBTRACE2("\r\nEP: ",epInfo[epDataInIndex].epAddr);
-
310  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
-
311 }
-
312 
-
313 uint8_t ADK::SndData(uint16_t nbytes, uint8_t *dataptr) {
-
314  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
-
315 }
-
316 
-
317 void ADK::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
-
318  Notify(PSTR("Endpoint descriptor:"), 0x80);
-
319  Notify(PSTR("\r\nLength:\t\t"), 0x80);
-
320  PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
-
321  Notify(PSTR("\r\nType:\t\t"), 0x80);
-
322  PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
-
323  Notify(PSTR("\r\nAddress:\t"), 0x80);
-
324  PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
-
325  Notify(PSTR("\r\nAttributes:\t"), 0x80);
-
326  PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
-
327  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
-
328  PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
-
329  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
-
330  PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
-
331  Notify(PSTR("\r\n"), 0x80);
-
332 }
+
293  uint8_t index;
+
294 
+
295  // if ((pep->bmAttributes & 0x02) == 2) {
+
296  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
+
297  // }
+
298 
+
299  // Fill in the endpoint info structure
+
300  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
+
301  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
+
302 
+
303  bNumEP++;
+
304 
+
305  //PrintEndpointDescriptor(pep);
+
306 }
+
307 
+
308 /* Performs a cleanup after failed Init() attempt */
+
309 uint8_t ADK::Release() {
+
310  pUsb->GetAddressPool().FreeAddress(bAddress);
+
311 
+
312  bNumEP = 1; //must have to be reset to 1
+
313 
+
314  bAddress = 0;
+
315  ready = false;
+
316  return 0;
+
317 }
+
318 
+
319 uint8_t ADK::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
+
320  //USBTRACE2("\r\nAddr: ", bAddress );
+
321  //USBTRACE2("\r\nEP: ",epInfo[epDataInIndex].epAddr);
+
322  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
+
323 }
+
324 
+
325 uint8_t ADK::SndData(uint16_t nbytes, uint8_t *dataptr) {
+
326  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
+
327 }
+
328 
+
329 void ADK::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
+
330  Notify(PSTR("Endpoint descriptor:"), 0x80);
+
331  Notify(PSTR("\r\nLength:\t\t"), 0x80);
+
332  PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
+
333  Notify(PSTR("\r\nType:\t\t"), 0x80);
+
334  PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
+
335  Notify(PSTR("\r\nAddress:\t"), 0x80);
+
336  PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
+
337  Notify(PSTR("\r\nAttributes:\t"), 0x80);
+
338  PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
+
339  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
+
340  PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
+
341  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
+
342  PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
+
343  Notify(PSTR("\r\n"), 0x80);
+
344 }
diff --git a/adk_8h.html b/adk_8h.html index ddd5f0c7..6f662adc 100644 --- a/adk_8h.html +++ b/adk_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: adk.h File Reference @@ -31,7 +31,7 @@ - + @@ -109,7 +109,7 @@ Include dependency graph for adk.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -375,7 +375,7 @@ Macros diff --git a/adk_8h__incl.map b/adk_8h__incl.map index cb9e5b2f..6262c084 100644 --- a/adk_8h__incl.map +++ b/adk_8h__incl.map @@ -1,13 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/adk_8h__incl.md5 b/adk_8h__incl.md5 index 3d2aefa0..6a26a71e 100644 --- a/adk_8h__incl.md5 +++ b/adk_8h__incl.md5 @@ -1 +1 @@ -22f03cde536a29beee865eef188aa9b8 \ No newline at end of file +fd763d9bb78c79172d4443cb1b77180d \ No newline at end of file diff --git a/adk_8h__incl.png b/adk_8h__incl.png index 115feeb1..7289efe5 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 a113b6a5..9510fee8 100644 --- a/adk_8h_source.html +++ b/adk_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: adk.h Source File @@ -31,7 +31,7 @@
- + @@ -243,7 +243,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/annotated.html b/annotated.html index d0396f77..c085be84 100644 --- a/annotated.html +++ b/annotated.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class List @@ -31,7 +31,7 @@ - + @@ -169,7 +169,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/avrpins_8h.html b/avrpins_8h.html index a85f4933..41b81c5a 100644 --- a/avrpins_8h.html +++ b/avrpins_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: avrpins.h File Reference @@ -31,7 +31,7 @@ - + @@ -97,6 +97,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); Include dependency graph for avrpins.h:
+ +
This graph shows which files directly or indirectly include this file:
@@ -235,7 +237,7 @@ Macros diff --git a/avrpins_8h_source.html b/avrpins_8h_source.html index 1e7da53a..1c7d2982 100644 --- a/avrpins_8h_source.html +++ b/avrpins_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: avrpins.h Source File @@ -31,7 +31,7 @@
- + @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
20 #ifndef _avrpins_h_
21 #define _avrpins_h_
22 
-
23 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
+
23 #if defined(__AVR_ATmega2560__)
24 /* Uncomment the following if you have Arduino Mega ADK board with MAX3421e built-in */
25 //#define BOARD_MEGA_ADK
26 #endif
@@ -539,7 +539,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
448 //typedef Tp_Tc<Pb3, Tc2a> P11; //Arduino pin 11
449 
450 /* Arduino pin definitions */
-
451 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
+
451 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
452 
453 // "Mega" Arduino pin numbers
454 
@@ -603,7 +603,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
512 #define P53 Pb0
513 #define P54 Pe6 // INT on Arduino ADK
514 
-
515 #endif //"Mega" pin numbers
+
515 #endif // "Mega" pin numbers
516 
517 #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
518 //"Classic" Arduino pin numbers
@@ -835,7 +835,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/cdcacm_8cpp.html b/cdcacm_8cpp.html index d08bc2d9..3fc38314 100644 --- a/cdcacm_8cpp.html +++ b/cdcacm_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcacm.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -95,7 +95,7 @@ Include dependency graph for cdcacm.cpp:
- +

Go to the source code of this file.

@@ -104,7 +104,7 @@ Include dependency graph for cdcacm.cpp: diff --git a/cdcacm_8cpp__incl.map b/cdcacm_8cpp__incl.map index 6a00dfc8..5fb98642 100644 --- a/cdcacm_8cpp__incl.map +++ b/cdcacm_8cpp__incl.map @@ -1,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/cdcacm_8cpp__incl.md5 b/cdcacm_8cpp__incl.md5 index 9e1c32df..41425d30 100644 --- a/cdcacm_8cpp__incl.md5 +++ b/cdcacm_8cpp__incl.md5 @@ -1 +1 @@ -06b568c2cbe42b7234583a58f23eb1cd \ No newline at end of file +da4ed9c8c18f286bf74151dda08ae337 \ No newline at end of file diff --git a/cdcacm_8cpp__incl.png b/cdcacm_8cpp__incl.png index a78dc676..2e2591ae 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 1887e448..d04389a2 100644 --- a/cdcacm_8cpp_source.html +++ b/cdcacm_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcacm.cpp Source File @@ -31,7 +31,7 @@ - + @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
80  p->lowspeed = lowspeed;
81 
82  // Get device descriptor
-
83  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf);
+
83  rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf);
84 
85  // Restore p->epinfo
86  p->epinfo = oldep_ptr;
@@ -265,7 +265,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
174  goto FailOnInit;
175 
176  USBTRACE("ACM configured\r\n");
-
177 
+
177 
178  ready = true;
179 
180  //bPollEnable = true;
@@ -274,164 +274,176 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
183  return 0;
184 
185 FailGetDevDescr:
-
186  NotifyFailGetDevDescr();
-
187  goto Fail;
-
188 
-
189 FailSetDevTblEntry:
-
190  NotifyFailSetDevTblEntry();
-
191  goto Fail;
-
192 
-
193 FailGetConfDescr:
-
194  NotifyFailGetConfDescr();
-
195  goto Fail;
-
196 
-
197 FailSetConfDescr:
-
198  NotifyFailSetConfDescr();
-
199  goto Fail;
-
200 
-
201 FailOnInit:
-
202  USBTRACE("OnInit:");
-
203 
-
204 Fail:
-
205  NotifyFail(rcode);
-
206  Release();
-
207  return rcode;
-
208 }
-
209 
-
210 void ACM::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
-
211  ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
-
212  ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
-
213  ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
-
214 
-
215  bConfNum = conf;
-
216 
-
217  uint8_t index;
-
218 
-
219  if ((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
-
220  index = epInterruptInIndex;
-
221  else
-
222  if ((pep->bmAttributes & 0x02) == 2)
-
223  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
-
224  else
-
225  return;
+
186 #ifdef DEBUG_USB_HOST
+
187  NotifyFailGetDevDescr();
+
188  goto Fail;
+
189 #endif
+
190 
+
191 FailSetDevTblEntry:
+
192 #ifdef DEBUG_USB_HOST
+
193  NotifyFailSetDevTblEntry();
+
194  goto Fail;
+
195 #endif
+
196 
+
197 FailGetConfDescr:
+
198 #ifdef DEBUG_USB_HOST
+
199  NotifyFailGetConfDescr();
+
200  goto Fail;
+
201 #endif
+
202 
+
203 FailSetConfDescr:
+
204 #ifdef DEBUG_USB_HOST
+
205  NotifyFailSetConfDescr();
+
206  goto Fail;
+
207 #endif
+
208 
+
209 FailOnInit:
+
210 #ifdef DEBUG_USB_HOST
+
211  USBTRACE("OnInit:");
+
212 #endif
+
213 
+
214 Fail:
+
215 #ifdef DEBUG_USB_HOST
+
216  NotifyFail(rcode);
+
217 #endif
+
218  Release();
+
219  return rcode;
+
220 }
+
221 
+
222 void ACM::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
+
223  ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
+
224  ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
+
225  ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
226 
-
227  // Fill in the endpoint info structure
-
228  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
-
229  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
-
230  epInfo[index].epAttribs = 0;
-
231 
-
232  bNumEP++;
-
233 
-
234  PrintEndpointDescriptor(pep);
-
235 }
-
236 
-
237 uint8_t ACM::Release() {
-
238  pUsb->GetAddressPool().FreeAddress(bAddress);
-
239 
-
240  bControlIface = 0;
-
241  bDataIface = 0;
-
242  bNumEP = 1;
+
227  bConfNum = conf;
+
228 
+
229  uint8_t index;
+
230 
+
231  if ((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
+
232  index = epInterruptInIndex;
+
233  else
+
234  if ((pep->bmAttributes & 0x02) == 2)
+
235  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
+
236  else
+
237  return;
+
238 
+
239  // Fill in the endpoint info structure
+
240  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
+
241  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
+
242  epInfo[index].epAttribs = 0;
243 
-
244  bAddress = 0;
-
245  qNextPollTime = 0;
-
246  bPollEnable = false;
-
247  return 0;
-
248 }
-
249 
-
250 uint8_t ACM::Poll() {
-
251  uint8_t rcode = 0;
-
252 
-
253  if (!bPollEnable)
-
254  return 0;
+
244  bNumEP++;
+
245 
+
246  PrintEndpointDescriptor(pep);
+
247 }
+
248 
+
249 uint8_t ACM::Release() {
+
250  pUsb->GetAddressPool().FreeAddress(bAddress);
+
251 
+
252  bControlIface = 0;
+
253  bDataIface = 0;
+
254  bNumEP = 1;
255 
-
256  //uint32_t time_now = millis();
-
257 
-
258  //if (qNextPollTime <= time_now)
-
259  //{
-
260  // qNextPollTime = time_now + 100;
+
256  bAddress = 0;
+
257  qNextPollTime = 0;
+
258  bPollEnable = false;
+
259  return 0;
+
260 }
261 
-
262  // uint8_t rcode;
-
263  // const uint8_t constBufSize = 16;
-
264  // uint8_t buf[constBufSize];
-
265 
-
266  // for (uint8_t i=0; i<constBufSize; i++)
-
267  // buf[i] = 0;
-
268 
-
269  // uint16_t read = (constBufSize > epInfo[epInterruptInIndex].maxPktSize)
-
270  // ? epInfo[epInterruptInIndex].maxPktSize : constBufSize;
-
271  // rcode = pUsb->inTransfer(bAddress, epInfo[epInterruptInIndex].epAddr, &read, buf);
-
272 
-
273  // if (rcode)
-
274  // return rcode;
-
275 
-
276  // for (uint8_t i=0; i<read; i++)
-
277  // {
-
278  // PrintHex<uint8_t>(buf[i]);
-
279  // Serial.print(" ");
-
280  // }
-
281  // USBTRACE("\r\n");
-
282  //}
-
283  return rcode;
-
284 }
-
285 
-
286 uint8_t ACM::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
-
287  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
-
288 }
-
289 
-
290 uint8_t ACM::SndData(uint16_t nbytes, uint8_t *dataptr) {
-
291  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
-
292 }
-
293 
-
294 uint8_t ACM::SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr) {
-
295  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, nbytes, nbytes, dataptr, NULL));
+
262 uint8_t ACM::Poll() {
+
263  uint8_t rcode = 0;
+
264 
+
265  if (!bPollEnable)
+
266  return 0;
+
267 
+
268  //uint32_t time_now = millis();
+
269 
+
270  //if (qNextPollTime <= time_now)
+
271  //{
+
272  // qNextPollTime = time_now + 100;
+
273 
+
274  // uint8_t rcode;
+
275  // const uint8_t constBufSize = 16;
+
276  // uint8_t buf[constBufSize];
+
277 
+
278  // for (uint8_t i=0; i<constBufSize; i++)
+
279  // buf[i] = 0;
+
280 
+
281  // uint16_t read = (constBufSize > epInfo[epInterruptInIndex].maxPktSize)
+
282  // ? epInfo[epInterruptInIndex].maxPktSize : constBufSize;
+
283  // rcode = pUsb->inTransfer(bAddress, epInfo[epInterruptInIndex].epAddr, &read, buf);
+
284 
+
285  // if (rcode)
+
286  // return rcode;
+
287 
+
288  // for (uint8_t i=0; i<read; i++)
+
289  // {
+
290  // PrintHex<uint8_t>(buf[i]);
+
291  // USB_HOST_SERIAL.print(" ");
+
292  // }
+
293  // USBTRACE("\r\n");
+
294  //}
+
295  return rcode;
296 }
297 
-
298 uint8_t ACM::GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr) {
-
299  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCIN, CDC_GET_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, nbytes, nbytes, dataptr, NULL));
+
298 uint8_t ACM::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
+
299  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
300 }
301 
-
302 uint8_t ACM::ClearCommFeature(uint16_t fid) {
-
303  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_CLEAR_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, 0, 0, NULL, NULL));
+
302 uint8_t ACM::SndData(uint16_t nbytes, uint8_t *dataptr) {
+
303  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
304 }
305 
-
306 uint8_t ACM::SetLineCoding(const LINE_CODING *dataptr) {
-
307  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_LINE_CODING, 0x00, 0x00, bControlIface, sizeof (LINE_CODING), sizeof (LINE_CODING), (uint8_t*)dataptr, NULL));
+
306 uint8_t ACM::SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr) {
+
307  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, nbytes, nbytes, dataptr, NULL));
308 }
309 
-
310 uint8_t ACM::GetLineCoding(LINE_CODING *dataptr) {
-
311  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCIN, CDC_GET_LINE_CODING, 0x00, 0x00, bControlIface, sizeof (LINE_CODING), sizeof (LINE_CODING), (uint8_t*)dataptr, NULL));
+
310 uint8_t ACM::GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr) {
+
311  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCIN, CDC_GET_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, nbytes, nbytes, dataptr, NULL));
312 }
313 
-
314 uint8_t ACM::SetControlLineState(uint8_t state) {
-
315  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_CONTROL_LINE_STATE, state, 0, bControlIface, 0, 0, NULL, NULL));
+
314 uint8_t ACM::ClearCommFeature(uint16_t fid) {
+
315  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_CLEAR_COMM_FEATURE, (fid & 0xff), (fid >> 8), bControlIface, 0, 0, NULL, NULL));
316 }
317 
-
318 uint8_t ACM::SendBreak(uint16_t duration) {
-
319  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SEND_BREAK, (duration & 0xff), (duration >> 8), bControlIface, 0, 0, NULL, NULL));
+
318 uint8_t ACM::SetLineCoding(const LINE_CODING *dataptr) {
+
319  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_LINE_CODING, 0x00, 0x00, bControlIface, sizeof (LINE_CODING), sizeof (LINE_CODING), (uint8_t*)dataptr, NULL));
320 }
321 
-
322 void ACM::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
-
323  Notify(PSTR("Endpoint descriptor:"), 0x80);
-
324  Notify(PSTR("\r\nLength:\t\t"), 0x80);
-
325  PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
-
326  Notify(PSTR("\r\nType:\t\t"), 0x80);
-
327  PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
-
328  Notify(PSTR("\r\nAddress:\t"), 0x80);
-
329  PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
-
330  Notify(PSTR("\r\nAttributes:\t"), 0x80);
-
331  PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
-
332  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
-
333  PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
-
334  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
-
335  PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
-
336  Notify(PSTR("\r\n"), 0x80);
-
337 }
+
322 uint8_t ACM::GetLineCoding(LINE_CODING *dataptr) {
+
323  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCIN, CDC_GET_LINE_CODING, 0x00, 0x00, bControlIface, sizeof (LINE_CODING), sizeof (LINE_CODING), (uint8_t*)dataptr, NULL));
+
324 }
+
325 
+
326 uint8_t ACM::SetControlLineState(uint8_t state) {
+
327  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SET_CONTROL_LINE_STATE, state, 0, bControlIface, 0, 0, NULL, NULL));
+
328 }
+
329 
+
330 uint8_t ACM::SendBreak(uint16_t duration) {
+
331  return ( pUsb->ctrlReq(bAddress, 0, bmREQ_CDCOUT, CDC_SEND_BREAK, (duration & 0xff), (duration >> 8), bControlIface, 0, 0, NULL, NULL));
+
332 }
+
333 
+
334 void ACM::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
+
335  Notify(PSTR("Endpoint descriptor:"), 0x80);
+
336  Notify(PSTR("\r\nLength:\t\t"), 0x80);
+
337  PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
+
338  Notify(PSTR("\r\nType:\t\t"), 0x80);
+
339  PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
+
340  Notify(PSTR("\r\nAddress:\t"), 0x80);
+
341  PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
+
342  Notify(PSTR("\r\nAttributes:\t"), 0x80);
+
343  PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
+
344  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
+
345  PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
+
346  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
+
347  PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
+
348  Notify(PSTR("\r\n"), 0x80);
+
349 }
diff --git a/cdcacm_8h.html b/cdcacm_8h.html index a17ad96e..db96ae9c 100644 --- a/cdcacm_8h.html +++ b/cdcacm_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcacm.h File Reference @@ -31,7 +31,7 @@ - + @@ -110,7 +110,7 @@ Include dependency graph for cdcacm.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -1027,7 +1027,7 @@ Typedefs diff --git a/cdcacm_8h__incl.map b/cdcacm_8h__incl.map index 82aa99a5..7b55bc83 100644 --- a/cdcacm_8h__incl.map +++ b/cdcacm_8h__incl.map @@ -1,13 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/cdcacm_8h__incl.md5 b/cdcacm_8h__incl.md5 index c90cce9c..2533129a 100644 --- a/cdcacm_8h__incl.md5 +++ b/cdcacm_8h__incl.md5 @@ -1 +1 @@ -c3b7e9b7b9f30d1d12bd7db19201be7c \ No newline at end of file +910727a770e78a54f0bcb38ab57aae22 \ No newline at end of file diff --git a/cdcacm_8h__incl.png b/cdcacm_8h__incl.png index c9e3060b..f3960ad4 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 d5923a15..19114a91 100644 --- a/cdcacm_8h_source.html +++ b/cdcacm_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcacm.h Source File @@ -31,7 +31,7 @@
- + @@ -305,7 +305,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/cdcftdi_8cpp.html b/cdcftdi_8cpp.html index db1b660d..7ab0999c 100644 --- a/cdcftdi_8cpp.html +++ b/cdcftdi_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcftdi.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -95,7 +95,7 @@ Include dependency graph for cdcftdi.cpp:
- +

Go to the source code of this file.

@@ -104,7 +104,7 @@ Include dependency graph for cdcftdi.cpp: diff --git a/cdcftdi_8cpp__incl.map b/cdcftdi_8cpp__incl.map index 89b50310..3aff51e2 100644 --- a/cdcftdi_8cpp__incl.map +++ b/cdcftdi_8cpp__incl.map @@ -1,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/cdcftdi_8cpp__incl.md5 b/cdcftdi_8cpp__incl.md5 index f0b73ba6..8a2fb992 100644 --- a/cdcftdi_8cpp__incl.md5 +++ b/cdcftdi_8cpp__incl.md5 @@ -1 +1 @@ -a7a189fd81bd21e1ebe63c35730448cf \ No newline at end of file +561c31be3a7439a3317dd8f5b836e461 \ No newline at end of file diff --git a/cdcftdi_8cpp__incl.png b/cdcftdi_8cpp__incl.png index 9ea318f2..3873e630 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 2d383048..bec1bbef 100644 --- a/cdcftdi_8cpp_source.html +++ b/cdcftdi_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcftdi.cpp Source File @@ -31,7 +31,7 @@ - + @@ -169,7 +169,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
78  p->lowspeed = lowspeed;
79 
80  // Get device descriptor
-
81  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
+
81  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
82 
83  // Restore p->epinfo
84  p->epinfo = oldep_ptr;
@@ -269,161 +269,173 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
178  return 0;
179 
180 FailGetDevDescr:
-
181  NotifyFailGetDevDescr();
-
182  goto Fail;
-
183 
-
184 FailSetDevTblEntry:
-
185  NotifyFailSetDevTblEntry();
-
186  goto Fail;
-
187 
-
188 FailGetConfDescr:
-
189  NotifyFailGetConfDescr();
-
190  goto Fail;
-
191 
-
192 FailSetConfDescr:
-
193  NotifyFailSetConfDescr();
-
194  goto Fail;
-
195 
-
196 FailOnInit:
-
197  USBTRACE("OnInit:");
-
198 
-
199 Fail:
-
200  NotifyFail(rcode);
-
201  Release();
-
202  return rcode;
-
203 }
-
204 
-
205 void FTDI::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
-
206  ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
-
207  ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
-
208  ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
-
209 
-
210  bConfNum = conf;
-
211 
-
212  uint8_t index;
-
213 
-
214  if ((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
-
215  index = epInterruptInIndex;
-
216  else
-
217  if ((pep->bmAttributes & 0x02) == 2)
-
218  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
-
219  else
-
220  return;
+
181 #ifdef DEBUG_USB_HOST
+
182  NotifyFailGetDevDescr();
+
183  goto Fail;
+
184 #endif
+
185 
+
186 FailSetDevTblEntry:
+
187 #ifdef DEBUG_USB_HOST
+
188  NotifyFailSetDevTblEntry();
+
189  goto Fail;
+
190 #endif
+
191 
+
192 FailGetConfDescr:
+
193 #ifdef DEBUG_USB_HOST
+
194  NotifyFailGetConfDescr();
+
195  goto Fail;
+
196 #endif
+
197 
+
198 FailSetConfDescr:
+
199 #ifdef DEBUG_USB_HOST
+
200  NotifyFailSetConfDescr();
+
201  goto Fail;
+
202 #endif
+
203 
+
204 FailOnInit:
+
205 #ifdef DEBUG_USB_HOST
+
206  USBTRACE("OnInit:");
+
207 #endif
+
208 
+
209 Fail:
+
210 #ifdef DEBUG_USB_HOST
+
211  NotifyFail(rcode);
+
212 #endif
+
213  Release();
+
214  return rcode;
+
215 }
+
216 
+
217 void FTDI::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
+
218  ErrorMessage<uint8_t > (PSTR("Conf.Val"), conf);
+
219  ErrorMessage<uint8_t > (PSTR("Iface Num"), iface);
+
220  ErrorMessage<uint8_t > (PSTR("Alt.Set"), alt);
221 
-
222  // Fill in the endpoint info structure
-
223  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
-
224  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
-
225  epInfo[index].epAttribs = 0;
-
226 
-
227  bNumEP++;
-
228 
-
229  PrintEndpointDescriptor(pep);
-
230 }
-
231 
-
232 uint8_t FTDI::Release() {
-
233  pUsb->GetAddressPool().FreeAddress(bAddress);
-
234 
-
235  bAddress = 0;
-
236  bNumEP = 1;
-
237  qNextPollTime = 0;
-
238  bPollEnable = false;
-
239  return 0;
-
240 }
-
241 
-
242 uint8_t FTDI::Poll() {
-
243  uint8_t rcode = 0;
-
244 
-
245  //if (!bPollEnable)
-
246  // return 0;
-
247 
-
248  //if (qNextPollTime <= millis())
-
249  //{
-
250  // Serial.println(bAddress, HEX);
-
251 
-
252  // qNextPollTime = millis() + 100;
-
253  //}
-
254  return rcode;
-
255 }
+
222  bConfNum = conf;
+
223 
+
224  uint8_t index;
+
225 
+
226  if ((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
+
227  index = epInterruptInIndex;
+
228  else
+
229  if ((pep->bmAttributes & 0x02) == 2)
+
230  index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
+
231  else
+
232  return;
+
233 
+
234  // Fill in the endpoint info structure
+
235  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
+
236  epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize;
+
237  epInfo[index].epAttribs = 0;
+
238 
+
239  bNumEP++;
+
240 
+
241  PrintEndpointDescriptor(pep);
+
242 }
+
243 
+
244 uint8_t FTDI::Release() {
+
245  pUsb->GetAddressPool().FreeAddress(bAddress);
+
246 
+
247  bAddress = 0;
+
248  bNumEP = 1;
+
249  qNextPollTime = 0;
+
250  bPollEnable = false;
+
251  return 0;
+
252 }
+
253 
+
254 uint8_t FTDI::Poll() {
+
255  uint8_t rcode = 0;
256 
-
257 uint8_t FTDI::SetBaudRate(uint32_t baud) {
-
258  uint16_t baud_value, baud_index = 0;
-
259  uint32_t divisor3;
-
260 
-
261  divisor3 = 48000000 / 2 / baud; // divisor shifted 3 bits to the left
-
262 
-
263  if (wFTDIType == FT232AM) {
-
264  if ((divisor3 & 0x7) == 7)
-
265  divisor3++; // round x.7/8 up to x+1
-
266 
-
267  baud_value = divisor3 >> 3;
-
268  divisor3 &= 0x7;
-
269 
-
270  if (divisor3 == 1) baud_value |= 0xc000;
-
271  else // 0.125
-
272  if (divisor3 >= 4) baud_value |= 0x4000;
-
273  else // 0.5
-
274  if (divisor3 != 0) baud_value |= 0x8000; // 0.25
-
275  if (baud_value == 1) baud_value = 0; /* special case for maximum baud rate */
-
276  } else {
-
277  static const unsigned char divfrac [8] = {0, 3, 2, 0, 1, 1, 2, 3};
-
278  static const unsigned char divindex[8] = {0, 0, 0, 1, 0, 1, 1, 1};
-
279 
-
280  baud_value = divisor3 >> 3;
-
281  baud_value |= divfrac [divisor3 & 0x7] << 14;
-
282  baud_index = divindex[divisor3 & 0x7];
-
283 
-
284  /* Deal with special cases for highest baud rates. */
-
285  if (baud_value == 1) baud_value = 0;
-
286  else // 1.0
-
287  if (baud_value == 0x4001) baud_value = 1; // 1.5
-
288  }
-
289  USBTRACE2("baud_value:", baud_value);
-
290  USBTRACE2("baud_index:", baud_index);
-
291  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_BAUD_RATE, baud_value & 0xff, baud_value >> 8, baud_index, 0, 0, NULL, NULL);
-
292 }
-
293 
-
294 uint8_t FTDI::SetModemControl(uint16_t signal) {
-
295  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_MODEM_CTRL, signal & 0xff, signal >> 8, 0, 0, 0, NULL, NULL);
-
296 }
-
297 
-
298 uint8_t FTDI::SetFlowControl(uint8_t protocol, uint8_t xon, uint8_t xoff) {
-
299  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_FLOW_CTRL, xon, xoff, protocol << 8, 0, 0, NULL, NULL);
-
300 }
-
301 
-
302 uint8_t FTDI::SetData(uint16_t databm) {
-
303  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_DATA, databm & 0xff, databm >> 8, 0, 0, 0, NULL, NULL);
+
257  //if (!bPollEnable)
+
258  // return 0;
+
259 
+
260  //if (qNextPollTime <= millis())
+
261  //{
+
262  // USB_HOST_SERIAL.println(bAddress, HEX);
+
263 
+
264  // qNextPollTime = millis() + 100;
+
265  //}
+
266  return rcode;
+
267 }
+
268 
+
269 uint8_t FTDI::SetBaudRate(uint32_t baud) {
+
270  uint16_t baud_value, baud_index = 0;
+
271  uint32_t divisor3;
+
272 
+
273  divisor3 = 48000000 / 2 / baud; // divisor shifted 3 bits to the left
+
274 
+
275  if (wFTDIType == FT232AM) {
+
276  if ((divisor3 & 0x7) == 7)
+
277  divisor3++; // round x.7/8 up to x+1
+
278 
+
279  baud_value = divisor3 >> 3;
+
280  divisor3 &= 0x7;
+
281 
+
282  if (divisor3 == 1) baud_value |= 0xc000;
+
283  else // 0.125
+
284  if (divisor3 >= 4) baud_value |= 0x4000;
+
285  else // 0.5
+
286  if (divisor3 != 0) baud_value |= 0x8000; // 0.25
+
287  if (baud_value == 1) baud_value = 0; /* special case for maximum baud rate */
+
288  } else {
+
289  static const unsigned char divfrac [8] = {0, 3, 2, 0, 1, 1, 2, 3};
+
290  static const unsigned char divindex[8] = {0, 0, 0, 1, 0, 1, 1, 1};
+
291 
+
292  baud_value = divisor3 >> 3;
+
293  baud_value |= divfrac [divisor3 & 0x7] << 14;
+
294  baud_index = divindex[divisor3 & 0x7];
+
295 
+
296  /* Deal with special cases for highest baud rates. */
+
297  if (baud_value == 1) baud_value = 0;
+
298  else // 1.0
+
299  if (baud_value == 0x4001) baud_value = 1; // 1.5
+
300  }
+
301  USBTRACE2("baud_value:", baud_value);
+
302  USBTRACE2("baud_index:", baud_index);
+
303  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_BAUD_RATE, baud_value & 0xff, baud_value >> 8, baud_index, 0, 0, NULL, NULL);
304 }
305 
-
306 uint8_t FTDI::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
-
307  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
+
306 uint8_t FTDI::SetModemControl(uint16_t signal) {
+
307  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_MODEM_CTRL, signal & 0xff, signal >> 8, 0, 0, 0, NULL, NULL);
308 }
309 
-
310 uint8_t FTDI::SndData(uint16_t nbytes, uint8_t *dataptr) {
-
311  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
+
310 uint8_t FTDI::SetFlowControl(uint8_t protocol, uint8_t xon, uint8_t xoff) {
+
311  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_FLOW_CTRL, xon, xoff, protocol << 8, 0, 0, NULL, NULL);
312 }
313 
-
314 void FTDI::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
-
315  Notify(PSTR("Endpoint descriptor:"), 0x80);
-
316  Notify(PSTR("\r\nLength:\t\t"), 0x80);
-
317  PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
-
318  Notify(PSTR("\r\nType:\t\t"), 0x80);
-
319  PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
-
320  Notify(PSTR("\r\nAddress:\t"), 0x80);
-
321  PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
-
322  Notify(PSTR("\r\nAttributes:\t"), 0x80);
-
323  PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
-
324  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
-
325  PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
-
326  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
-
327  PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
-
328  Notify(PSTR("\r\n"), 0x80);
-
329 }
+
314 uint8_t FTDI::SetData(uint16_t databm) {
+
315  return pUsb->ctrlReq(bAddress, 0, bmREQ_FTDI_OUT, FTDI_SIO_SET_DATA, databm & 0xff, databm >> 8, 0, 0, 0, NULL, NULL);
+
316 }
+
317 
+
318 uint8_t FTDI::RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr) {
+
319  return pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, bytes_rcvd, dataptr);
+
320 }
+
321 
+
322 uint8_t FTDI::SndData(uint16_t nbytes, uint8_t *dataptr) {
+
323  return pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, nbytes, dataptr);
+
324 }
+
325 
+
326 void FTDI::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
+
327  Notify(PSTR("Endpoint descriptor:"), 0x80);
+
328  Notify(PSTR("\r\nLength:\t\t"), 0x80);
+
329  PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
+
330  Notify(PSTR("\r\nType:\t\t"), 0x80);
+
331  PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
+
332  Notify(PSTR("\r\nAddress:\t"), 0x80);
+
333  PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
+
334  Notify(PSTR("\r\nAttributes:\t"), 0x80);
+
335  PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
+
336  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
+
337  PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
+
338  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
+
339  PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
+
340  Notify(PSTR("\r\n"), 0x80);
+
341 }
diff --git a/cdcftdi_8h.html b/cdcftdi_8h.html index 65167c42..25421a50 100644 --- a/cdcftdi_8h.html +++ b/cdcftdi_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcftdi.h File Reference @@ -31,7 +31,7 @@ - + @@ -109,7 +109,7 @@ Include dependency graph for cdcftdi.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -825,7 +825,7 @@ Macros diff --git a/cdcftdi_8h__incl.map b/cdcftdi_8h__incl.map index 471fa10a..43a434b9 100644 --- a/cdcftdi_8h__incl.map +++ b/cdcftdi_8h__incl.map @@ -1,13 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/cdcftdi_8h__incl.md5 b/cdcftdi_8h__incl.md5 index 72db0a89..876ddc29 100644 --- a/cdcftdi_8h__incl.md5 +++ b/cdcftdi_8h__incl.md5 @@ -1 +1 @@ -48f80169de9beb599e9adee12f29e81f \ No newline at end of file +03d89d9d68beacd8992439fbda4581a6 \ No newline at end of file diff --git a/cdcftdi_8h__incl.png b/cdcftdi_8h__incl.png index 89e37ba8..b2151b94 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 b86b0d7f..1b8bf266 100644 --- a/cdcftdi_8h_source.html +++ b/cdcftdi_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcftdi.h Source File @@ -31,7 +31,7 @@
- + @@ -245,7 +245,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/cdcprolific_8cpp.html b/cdcprolific_8cpp.html index 711572f9..e2d19c81 100644 --- a/cdcprolific_8cpp.html +++ b/cdcprolific_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcprolific.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -95,7 +95,7 @@ Include dependency graph for cdcprolific.cpp:
- +

Go to the source code of this file.

@@ -104,7 +104,7 @@ Include dependency graph for cdcprolific.cpp: diff --git a/cdcprolific_8cpp__incl.map b/cdcprolific_8cpp__incl.map index 3ff227ab..8f490bf2 100644 --- a/cdcprolific_8cpp__incl.map +++ b/cdcprolific_8cpp__incl.map @@ -1,15 +1,15 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/cdcprolific_8cpp__incl.md5 b/cdcprolific_8cpp__incl.md5 index 2c44f1ff..8fb10428 100644 --- a/cdcprolific_8cpp__incl.md5 +++ b/cdcprolific_8cpp__incl.md5 @@ -1 +1 @@ -2c506d385ebbffbbf09c5261f1c3ee29 \ No newline at end of file +3e7c1a1e7f929a1e88ff41b4e9eee5ae \ No newline at end of file diff --git a/cdcprolific_8cpp__incl.png b/cdcprolific_8cpp__incl.png index 09cf0167..76a9a5d1 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 a157787a..e7b0a44c 100644 --- a/cdcprolific_8cpp_source.html +++ b/cdcprolific_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcprolific.cpp Source File @@ -31,7 +31,7 @@ - + @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
57  p->lowspeed = lowspeed;
58 
59  // Get device descriptor
-
60  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
+
60  rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);
61 
62  // Restore p->epinfo
63  p->epinfo = oldep_ptr;
@@ -246,53 +246,65 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
155  return 0;
156 
157 FailGetDevDescr:
-
158  NotifyFailGetDevDescr();
-
159  goto Fail;
-
160 
-
161 FailSetDevTblEntry:
-
162  NotifyFailSetDevTblEntry();
-
163  goto Fail;
-
164 
-
165 FailGetConfDescr:
-
166  NotifyFailGetConfDescr();
-
167  goto Fail;
-
168 
-
169 FailSetConfDescr:
-
170  NotifyFailSetConfDescr();
-
171  goto Fail;
-
172 
-
173 FailOnInit:
-
174  USBTRACE("OnInit:");
-
175 
-
176 Fail:
-
177  NotifyFail(rcode);
-
178  Release();
-
179  return rcode;
-
180 }
-
181 
-
182 //uint8_t PL::Poll()
-
183 //{
-
184 // uint8_t rcode = 0;
-
185 //
-
186 // //if (!bPollEnable)
-
187 // // return 0;
-
188 //
-
189 // //if (qNextPollTime <= millis())
-
190 // //{
-
191 // // Serial.println(bAddress, HEX);
-
192 //
-
193 // // qNextPollTime = millis() + 100;
-
194 // //}
-
195 // return rcode;
-
196 //}
-
197 
-
198 
+
158 #ifdef DEBUG_USB_HOST
+
159  NotifyFailGetDevDescr();
+
160  goto Fail;
+
161 #endif
+
162 
+
163 FailSetDevTblEntry:
+
164 #ifdef DEBUG_USB_HOST
+
165  NotifyFailSetDevTblEntry();
+
166  goto Fail;
+
167 #endif
+
168 
+
169 FailGetConfDescr:
+
170 #ifdef DEBUG_USB_HOST
+
171  NotifyFailGetConfDescr();
+
172  goto Fail;
+
173 #endif
+
174 
+
175 FailSetConfDescr:
+
176 #ifdef DEBUG_USB_HOST
+
177  NotifyFailSetConfDescr();
+
178  goto Fail;
+
179 #endif
+
180 
+
181 FailOnInit:
+
182 #ifdef DEBUG_USB_HOST
+
183  USBTRACE("OnInit:");
+
184 #endif
+
185 
+
186 Fail:
+
187 #ifdef DEBUG_USB_HOST
+
188  NotifyFail(rcode);
+
189 #endif
+
190  Release();
+
191  return rcode;
+
192 }
+
193 
+
194 //uint8_t PL::Poll()
+
195 //{
+
196 // uint8_t rcode = 0;
+
197 //
+
198 // //if (!bPollEnable)
+
199 // // return 0;
+
200 //
+
201 // //if (qNextPollTime <= millis())
+
202 // //{
+
203 // // USB_HOST_SERIAL.println(bAddress, HEX);
+
204 //
+
205 // // qNextPollTime = millis() + 100;
+
206 // //}
+
207 // return rcode;
+
208 //}
+
209 
+
210 
diff --git a/cdcprolific_8h.html b/cdcprolific_8h.html index fa13bacd..38837f7f 100644 --- a/cdcprolific_8h.html +++ b/cdcprolific_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcprolific.h File Reference @@ -31,7 +31,7 @@ - + @@ -111,7 +111,7 @@ Include dependency graph for cdcprolific.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -1157,7 +1157,7 @@ Enumerations diff --git a/cdcprolific_8h__incl.map b/cdcprolific_8h__incl.map index 3e149cd7..03aa03db 100644 --- a/cdcprolific_8h__incl.map +++ b/cdcprolific_8h__incl.map @@ -1,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/cdcprolific_8h__incl.md5 b/cdcprolific_8h__incl.md5 index 0253b66a..96177f7e 100644 --- a/cdcprolific_8h__incl.md5 +++ b/cdcprolific_8h__incl.md5 @@ -1 +1 @@ -820a501c028ad0d6f70ff96551b81cdc \ No newline at end of file +2f68091ad17e872810880b12ce6242da \ No newline at end of file diff --git a/cdcprolific_8h__incl.png b/cdcprolific_8h__incl.png index 56535ca9..d0400648 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 3ef6a902..1ee1029f 100644 --- a/cdcprolific_8h_source.html +++ b/cdcprolific_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: cdcprolific.h Source File @@ -31,7 +31,7 @@
- + @@ -246,7 +246,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 978ee1ba..c002486b 100644 --- a/class_a_c_m-members.html +++ b/class_a_c_m-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -98,36 +98,37 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); bNumEPACMprotected bPollEnableACMprotected ClearCommFeature(uint16_t fid)ACM - EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)ACMvirtual - epDataInIndexACMprotectedstatic - epDataOutIndexACMprotectedstatic - epInfoACMprotected - epInterruptInIndexACMprotectedstatic - GetAddress()ACMinlinevirtual - GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM - GetLineCoding(LINE_CODING *dataptr)ACM - GetNotif(uint16_t *bytes_rcvd, uint8_t *dataptr)ACM - Init(uint8_t parent, uint8_t port, bool lowspeed)ACMvirtual - isReady()ACMinlinevirtual - pAsyncACMprotected - Poll()ACMvirtual - PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)ACMprotected - pUsbACMprotected - qNextPollTimeACMprotected - RcvData(uint16_t *nbytesptr, uint8_t *dataptr)ACM - readyACMprotected - Release()ACMvirtual - SendBreak(uint16_t duration)ACM - SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM - SetControlLineState(uint8_t state)ACM - SetLineCoding(const LINE_CODING *dataptr)ACM - SndData(uint16_t nbytes, uint8_t *dataptr)ACM + ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual + EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)ACMvirtual + epDataInIndexACMprotectedstatic + epDataOutIndexACMprotectedstatic + epInfoACMprotected + epInterruptInIndexACMprotectedstatic + GetAddress()ACMinlinevirtual + GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM + GetLineCoding(LINE_CODING *dataptr)ACM + GetNotif(uint16_t *bytes_rcvd, uint8_t *dataptr)ACM + Init(uint8_t parent, uint8_t port, bool lowspeed)ACMvirtual + isReady()ACMinlinevirtual + pAsyncACMprotected + Poll()ACMvirtual + PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)ACMprotected + pUsbACMprotected + qNextPollTimeACMprotected + RcvData(uint16_t *nbytesptr, uint8_t *dataptr)ACM + readyACMprotected + Release()ACMvirtual + SendBreak(uint16_t duration)ACM + SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM + SetControlLineState(uint8_t state)ACM + SetLineCoding(const LINE_CODING *dataptr)ACM + SndData(uint16_t nbytes, uint8_t *dataptr)ACM diff --git a/class_a_c_m.html b/class_a_c_m.html index 2d51f4c6..4c7796e0 100644 --- a/class_a_c_m.html +++ b/class_a_c_m.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: ACM Class Reference @@ -31,7 +31,7 @@ - + @@ -146,6 +146,9 @@ Public Member Functions   virtual void EndpointXtract (uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)   +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  @@ -230,7 +233,7 @@ Static Protected Attributes - +

Protected Member Functions

void ACM::PrintEndpointDescriptor ( const USB_ENDPOINT_DESCRIPTORep_ptr)ep_ptr)
@@ -241,7 +244,7 @@ Static Protected Attributes
-

Definition at line 322 of file cdcacm.cpp.

+

Definition at line 334 of file cdcacm.cpp.

@@ -275,7 +278,7 @@ Static Protected Attributes
-

Definition at line 294 of file cdcacm.cpp.

+

Definition at line 306 of file cdcacm.cpp.

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

Definition at line 298 of file cdcacm.cpp.

+

Definition at line 310 of file cdcacm.cpp.

@@ -321,13 +324,13 @@ Static Protected Attributes uint8_t ACM::ClearCommFeature ( uint16_t  - fid) + fid)
-

Definition at line 302 of file cdcacm.cpp.

+

Definition at line 314 of file cdcacm.cpp.

@@ -339,13 +342,13 @@ Static Protected Attributes uint8_t ACM::SetLineCoding ( const LINE_CODING *  - dataptr) + dataptr)
-

Definition at line 306 of file cdcacm.cpp.

+

Definition at line 318 of file cdcacm.cpp.

@@ -357,13 +360,13 @@ Static Protected Attributes uint8_t ACM::GetLineCoding ( LINE_CODING *  - dataptr) + dataptr)
-

Definition at line 310 of file cdcacm.cpp.

+

Definition at line 322 of file cdcacm.cpp.

@@ -375,13 +378,13 @@ Static Protected Attributes uint8_t ACM::SetControlLineState ( uint8_t  - state) + state)
-

Definition at line 314 of file cdcacm.cpp.

+

Definition at line 326 of file cdcacm.cpp.

@@ -393,13 +396,13 @@ Static Protected Attributes uint8_t ACM::SendBreak ( uint16_t  - duration) + duration)
-

Definition at line 318 of file cdcacm.cpp.

+

Definition at line 330 of file cdcacm.cpp.

@@ -453,7 +456,7 @@ Static Protected Attributes
-

Definition at line 286 of file cdcacm.cpp.

+

Definition at line 298 of file cdcacm.cpp.

@@ -481,7 +484,7 @@ Static Protected Attributes
-

Definition at line 290 of file cdcacm.cpp.

+

Definition at line 302 of file cdcacm.cpp.

@@ -541,7 +544,7 @@ Static Protected Attributes uint8_t ACM::Release ( - ) + ) @@ -554,7 +557,7 @@ Static Protected Attributes

Implements USBDeviceConfig.

-

Definition at line 237 of file cdcacm.cpp.

+

Definition at line 249 of file cdcacm.cpp.

@@ -568,7 +571,7 @@ Static Protected Attributes uint8_t ACM::Poll ( - ) + ) @@ -581,7 +584,7 @@ Static Protected Attributes

Implements USBDeviceConfig.

-

Definition at line 250 of file cdcacm.cpp.

+

Definition at line 262 of file cdcacm.cpp.

@@ -595,7 +598,7 @@ Static Protected Attributes virtual uint8_t ACM::GetAddress ( - ) + ) @@ -622,7 +625,7 @@ Static Protected Attributes virtual bool ACM::isReady ( - ) + ) @@ -689,7 +692,7 @@ Static Protected Attributes

Implements UsbConfigXtracter.

-

Definition at line 210 of file cdcacm.cpp.

+

Definition at line 222 of file cdcacm.cpp.

@@ -1011,7 +1014,7 @@ Static Protected Attributes diff --git a/class_a_d_k-members.html b/class_a_d_k-members.html index 380409b0..8aa26418 100644 --- a/class_a_d_k-members.html +++ b/class_a_d_k-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -94,26 +94,27 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); bAddressADKprotected bConfNumADKprotected bNumEPADKprotected - EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)ADKvirtual - epDataInIndexADKprotectedstatic - epDataOutIndexADKprotectedstatic - epInfoADKprotected - GetAddress()ADKinlinevirtual - Init(uint8_t parent, uint8_t port, bool lowspeed)ADKvirtual - isReady()ADKinlinevirtual - Poll()ADKinlinevirtual - PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)ADKprotected - pUsbADKprotected - RcvData(uint16_t *nbytesptr, uint8_t *dataptr)ADK - readyADKprotected - Release()ADKvirtual - SndData(uint16_t nbytes, uint8_t *dataptr)ADK + ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual + EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)ADKvirtual + epDataInIndexADKprotectedstatic + epDataOutIndexADKprotectedstatic + epInfoADKprotected + GetAddress()ADKinlinevirtual + Init(uint8_t parent, uint8_t port, bool lowspeed)ADKvirtual + isReady()ADKinlinevirtual + Poll()ADKinlinevirtual + PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)ADKprotected + pUsbADKprotected + RcvData(uint16_t *nbytesptr, uint8_t *dataptr)ADK + readyADKprotected + Release()ADKvirtual + SndData(uint16_t nbytes, uint8_t *dataptr)ADK diff --git a/class_a_d_k.html b/class_a_d_k.html index ad3aaa32..38e95406 100644 --- a/class_a_d_k.html +++ b/class_a_d_k.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: ADK Class Reference @@ -31,7 +31,7 @@ - + @@ -130,6 +130,9 @@ Public Member Functions   virtual void EndpointXtract (uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)   +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  @@ -232,7 +235,7 @@ Static Protected Attributes - +

Protected Member Functions

void ADK::PrintEndpointDescriptor ( const USB_ENDPOINT_DESCRIPTORep_ptr)ep_ptr)
@@ -243,7 +246,7 @@ Static Protected Attributes
-

Definition at line 317 of file adk.cpp.

+

Definition at line 329 of file adk.cpp.

@@ -271,7 +274,7 @@ Static Protected Attributes
-

Definition at line 307 of file adk.cpp.

+

Definition at line 319 of file adk.cpp.

@@ -299,7 +302,7 @@ Static Protected Attributes
-

Definition at line 313 of file adk.cpp.

+

Definition at line 325 of file adk.cpp.

@@ -357,7 +360,7 @@ Static Protected Attributes uint8_t ADK::Release ( - ) + ) @@ -370,7 +373,7 @@ Static Protected Attributes

Implements USBDeviceConfig.

-

Definition at line 297 of file adk.cpp.

+

Definition at line 309 of file adk.cpp.

@@ -384,7 +387,7 @@ Static Protected Attributes virtual uint8_t ADK::Poll ( - ) + ) @@ -411,7 +414,7 @@ Static Protected Attributes virtual uint8_t ADK::GetAddress ( - ) + ) @@ -438,7 +441,7 @@ Static Protected Attributes virtual bool ADK::isReady ( - ) + ) @@ -505,7 +508,7 @@ Static Protected Attributes

Implements UsbConfigXtracter.

-

Definition at line 269 of file adk.cpp.

+

Definition at line 281 of file adk.cpp.

@@ -695,7 +698,7 @@ Static Protected Attributes diff --git a/class_address_pool-members.html b/class_address_pool-members.html index 91c2f397..97d3cafc 100644 --- a/class_address_pool-members.html +++ b/class_address_pool-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_address_pool.html b/class_address_pool.html index efa270c8..c012fdf1 100644 --- a/class_address_pool.html +++ b/class_address_pool.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: AddressPool Class Reference @@ -31,7 +31,7 @@ - + @@ -124,7 +124,7 @@ Public Member Functions virtual UsbDevice* AddressPool::GetUsbDevicePtr ( uint8_t  - addr) + addr) @@ -192,7 +192,7 @@ Public Member Functions virtual void AddressPool::FreeAddress ( uint8_t  - addr) + addr) @@ -215,7 +215,7 @@ Public Member Functions diff --git a/class_address_pool_impl-members.html b/class_address_pool_impl-members.html index a54b7f1e..3a981cc9 100644 --- a/class_address_pool_impl-members.html +++ b/class_address_pool_impl-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_address_pool_impl.html b/class_address_pool_impl.html index e35151ed..08129cab 100644 --- a/class_address_pool_impl.html +++ b/class_address_pool_impl.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: AddressPoolImpl< MAX_DEVICES_ALLOWED > Class Template Reference @@ -31,7 +31,7 @@ - + @@ -139,7 +139,7 @@ template<const uint8_t MAX_DEVICES_ALLOWED> AddressPoolImpl< MAX_DEVICES_ALLOWED >::AddressPoolImpl ( - ) + ) @@ -168,7 +168,7 @@ template<const uint8_t MAX_DEVICES_ALLOWED> virtual UsbDevice* AddressPoolImpl< MAX_DEVICES_ALLOWED >::GetUsbDevicePtr ( uint8_t  - addr) + addr) @@ -198,7 +198,7 @@ template<const uint8_t MAX_DEVICES_ALLOWED> void AddressPoolImpl< MAX_DEVICES_ALLOWED >::ForEachUsbDevice ( UsbDeviceHandleFunc  - pfunc) + pfunc) @@ -272,7 +272,7 @@ template<const uint8_t MAX_DEVICES_ALLOWED> virtual void AddressPoolImpl< MAX_DEVICES_ALLOWED >::FreeAddress ( uint8_t  - addr) + addr) @@ -297,7 +297,7 @@ template<const uint8_t MAX_DEVICES_ALLOWED> diff --git a/class_b_t_d-members.html b/class_b_t_d-members.html index 8fdf03b0..59e2cd1f 100644 --- a/class_b_t_d-members.html +++ b/class_b_t_d-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -100,66 +100,67 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); BTD_EVENT_PIPEBTDprotectedstatic btdNameBTD btdPinBTD - connectToWiiBTD - disc_bdaddrBTD - disconnect()BTDinline - EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)BTDvirtual - epInfoBTDprotected - GetAddress()BTDinlinevirtual - hci_accept_connection()BTD - hci_authentication_request()BTD - HCI_Command(uint8_t *data, uint16_t nbytes)BTD - hci_connect()BTD - hci_disconnect(uint16_t handle)BTD - hci_handleBTD - hci_inquiry()BTD - hci_inquiry_cancel()BTD - hci_link_key_request_negative_reply()BTD - hci_pin_code_negative_request_reply()BTD - hci_pin_code_request_reply()BTD - hci_read_bdaddr()BTD - hci_read_local_version_information()BTD - hci_remote_name()BTD - hci_reset()BTD - hci_set_local_name(const char *name)BTD - hci_versionBTD - hci_write_class_of_device()BTD - hci_write_scan_disable()BTD - hci_write_scan_enable()BTD - incomingWiiBTD - Init(uint8_t parent, uint8_t port, bool lowspeed)BTDvirtual - isReady()BTDinlinevirtual - L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)BTD - l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)BTD - l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)BTD - l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)BTD - l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)BTD - l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)BTD - l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)BTD - l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)BTD - l2capConnectionClaimedBTD - motionPlusInsideBTD - my_bdaddrBTD - pairWithWiiBTD - pairWithWiimote()BTDinline - Poll()BTDvirtual - PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)BTDprotected - pUsbBTDprotected - qNextPollTimeBTDprotected - readPollInterval()BTDinline - registerServiceClass(BluetoothService *pService)BTDinline - Release()BTDvirtual - remote_nameBTD - rfcommConnectionClaimedBTD - sdpConnectionClaimedBTD - watingForConnectionBTD - wiiUProControllerBTD + ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual + connectToWiiBTD + disc_bdaddrBTD + disconnect()BTDinline + EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)BTDvirtual + epInfoBTDprotected + GetAddress()BTDinlinevirtual + hci_accept_connection()BTD + hci_authentication_request()BTD + HCI_Command(uint8_t *data, uint16_t nbytes)BTD + hci_connect()BTD + hci_disconnect(uint16_t handle)BTD + hci_handleBTD + hci_inquiry()BTD + hci_inquiry_cancel()BTD + hci_link_key_request_negative_reply()BTD + hci_pin_code_negative_request_reply()BTD + hci_pin_code_request_reply()BTD + hci_read_bdaddr()BTD + hci_read_local_version_information()BTD + hci_remote_name()BTD + hci_reset()BTD + hci_set_local_name(const char *name)BTD + hci_versionBTD + hci_write_class_of_device()BTD + hci_write_scan_disable()BTD + hci_write_scan_enable()BTD + incomingWiiBTD + Init(uint8_t parent, uint8_t port, bool lowspeed)BTDvirtual + isReady()BTDinlinevirtual + L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)BTD + l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)BTD + l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)BTD + l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)BTD + l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)BTD + l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)BTD + l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)BTD + l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)BTD + l2capConnectionClaimedBTD + motionPlusInsideBTD + my_bdaddrBTD + pairWithWiiBTD + pairWithWiimote()BTDinline + Poll()BTDvirtual + PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)BTDprotected + pUsbBTDprotected + qNextPollTimeBTDprotected + readPollInterval()BTDinline + registerServiceClass(BluetoothService *pService)BTDinline + Release()BTDvirtual + remote_nameBTD + rfcommConnectionClaimedBTD + sdpConnectionClaimedBTD + watingForConnectionBTD + wiiUProControllerBTD diff --git a/class_b_t_d.html b/class_b_t_d.html index d928ba1f..03000b0e 100644 --- a/class_b_t_d.html +++ b/class_b_t_d.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: BTD Class Reference @@ -31,7 +31,7 @@ - + @@ -191,6 +191,9 @@ Public Member Functions   void l2cap_information_response (uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)   +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  @@ -271,7 +274,7 @@ Static Protected Attributes - +

Public Attributes

BTD::BTD ( USBp)p)
@@ -353,7 +356,7 @@ Static Protected Attributes uint8_t BTD::Release ( - ) + ) @@ -368,7 +371,7 @@ Static Protected Attributes

Implements USBDeviceConfig.

-

Definition at line 300 of file BTD.cpp.

+

Definition at line 315 of file BTD.cpp.

@@ -382,7 +385,7 @@ Static Protected Attributes uint8_t BTD::Poll ( - ) + ) @@ -397,7 +400,7 @@ Static Protected Attributes

Implements USBDeviceConfig.

-

Definition at line 313 of file BTD.cpp.

+

Definition at line 328 of file BTD.cpp.

@@ -411,7 +414,7 @@ Static Protected Attributes virtual uint8_t BTD::GetAddress ( - ) + ) @@ -440,7 +443,7 @@ Static Protected Attributes virtual bool BTD::isReady ( - ) + ) @@ -520,7 +523,7 @@ Static Protected Attributes

Implements UsbConfigXtracter.

-

Definition at line 249 of file BTD.cpp.

+

Definition at line 264 of file BTD.cpp.

@@ -534,7 +537,7 @@ Static Protected Attributes void BTD::disconnect ( - ) + ) @@ -561,7 +564,7 @@ Static Protected Attributes int8_t BTD::registerServiceClass ( BluetoothService *  - pService) + pService) @@ -616,7 +619,7 @@ Static Protected Attributes -

Definition at line 789 of file BTD.cpp.

+

Definition at line 804 of file BTD.cpp.

@@ -627,14 +630,14 @@ Static Protected Attributes void BTD::hci_reset ( - ) + )

Reset the Bluetooth dongle.

-

Definition at line 794 of file BTD.cpp.

+

Definition at line 809 of file BTD.cpp.

@@ -645,14 +648,14 @@ Static Protected Attributes void BTD::hci_read_bdaddr ( - ) + )

Read the Bluetooth address of the dongle.

-

Definition at line 825 of file BTD.cpp.

+

Definition at line 840 of file BTD.cpp.

@@ -663,14 +666,14 @@ Static Protected Attributes void BTD::hci_read_local_version_information ( - ) + )

Read the HCI Version of the Bluetooth dongle.

-

Definition at line 833 of file BTD.cpp.

+

Definition at line 848 of file BTD.cpp.

@@ -682,7 +685,7 @@ Static Protected Attributes void BTD::hci_set_local_name ( const char *  - name) + name) @@ -695,7 +698,7 @@ Static Protected Attributes -

Definition at line 876 of file BTD.cpp.

+

Definition at line 891 of file BTD.cpp.

@@ -706,14 +709,14 @@ Static Protected Attributes void BTD::hci_write_scan_enable ( - ) + )

Enable visibility to other Bluetooth devices.

-

Definition at line 803 of file BTD.cpp.

+

Definition at line 818 of file BTD.cpp.

@@ -724,14 +727,14 @@ Static Protected Attributes void BTD::hci_write_scan_disable ( - ) + )

Disable visibility to other Bluetooth devices.

-

Definition at line 816 of file BTD.cpp.

+

Definition at line 831 of file BTD.cpp.

@@ -742,14 +745,14 @@ Static Protected Attributes void BTD::hci_remote_name ( - ) + )

Read the remote devices name.

-

Definition at line 857 of file BTD.cpp.

+

Definition at line 872 of file BTD.cpp.

@@ -760,14 +763,14 @@ Static Protected Attributes void BTD::hci_accept_connection ( - ) + )

Accept the connection with the Bluetooth device.

-

Definition at line 841 of file BTD.cpp.

+

Definition at line 856 of file BTD.cpp.

@@ -779,7 +782,7 @@ Static Protected Attributes void BTD::hci_disconnect ( uint16_t  - handle) + handle) @@ -792,7 +795,7 @@ Static Protected Attributes -

Definition at line 1007 of file BTD.cpp.

+

Definition at line 1021 of file BTD.cpp.

@@ -803,14 +806,14 @@ Static Protected Attributes void BTD::hci_pin_code_request_reply ( - ) + )

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

-

Definition at line 932 of file BTD.cpp.

+

Definition at line 947 of file BTD.cpp.

@@ -821,14 +824,14 @@ Static Protected Attributes void BTD::hci_pin_code_negative_request_reply ( - ) + )

Respons when no pin was set.

-

Definition at line 969 of file BTD.cpp.

+

Definition at line 983 of file BTD.cpp.

@@ -839,14 +842,14 @@ Static Protected Attributes void BTD::hci_link_key_request_negative_reply ( - ) + )

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

-

Definition at line 983 of file BTD.cpp.

+

Definition at line 997 of file BTD.cpp.

@@ -857,14 +860,14 @@ Static Protected Attributes void BTD::hci_authentication_request ( - ) + )

Used to try to authenticate with the remote device.

-

Definition at line 997 of file BTD.cpp.

+

Definition at line 1011 of file BTD.cpp.

@@ -875,14 +878,14 @@ Static Protected Attributes void BTD::hci_inquiry ( - ) + )

Start a HCI inquiry.

-

Definition at line 888 of file BTD.cpp.

+

Definition at line 903 of file BTD.cpp.

@@ -893,14 +896,14 @@ Static Protected Attributes void BTD::hci_inquiry_cancel ( - ) + )

Cancel a HCI inquiry.

-

Definition at line 902 of file BTD.cpp.

+

Definition at line 917 of file BTD.cpp.

@@ -911,14 +914,14 @@ Static Protected Attributes void BTD::hci_connect ( - ) + )

Connect to a device.

-

Definition at line 910 of file BTD.cpp.

+

Definition at line 925 of file BTD.cpp.

@@ -929,14 +932,14 @@ Static Protected Attributes void BTD::hci_write_class_of_device ( - ) + )

Used to a set the class of the device.

-

Definition at line 1019 of file BTD.cpp.

+

Definition at line 1033 of file BTD.cpp.

@@ -992,7 +995,7 @@ Static Protected Attributes -

Definition at line 1055 of file BTD.cpp.

+

Definition at line 1069 of file BTD.cpp.

@@ -1042,7 +1045,7 @@ Static Protected Attributes -

Definition at line 1083 of file BTD.cpp.

+

Definition at line 1097 of file BTD.cpp.

@@ -1099,7 +1102,7 @@ Static Protected Attributes -

Definition at line 1096 of file BTD.cpp.

+

Definition at line 1110 of file BTD.cpp.

@@ -1142,7 +1145,7 @@ Static Protected Attributes -

Definition at line 1113 of file BTD.cpp.

+

Definition at line 1127 of file BTD.cpp.

@@ -1185,7 +1188,7 @@ Static Protected Attributes -

Definition at line 1130 of file BTD.cpp.

+

Definition at line 1144 of file BTD.cpp.

@@ -1235,7 +1238,7 @@ Static Protected Attributes -

Definition at line 1149 of file BTD.cpp.

+

Definition at line 1163 of file BTD.cpp.

@@ -1285,7 +1288,7 @@ Static Protected Attributes -

Definition at line 1162 of file BTD.cpp.

+

Definition at line 1176 of file BTD.cpp.

@@ -1334,7 +1337,7 @@ Static Protected Attributes -

Definition at line 1175 of file BTD.cpp.

+

Definition at line 1189 of file BTD.cpp.

@@ -1348,7 +1351,7 @@ Static Protected Attributes void BTD::pairWithWiimote ( - ) + ) @@ -1374,7 +1377,7 @@ Static Protected Attributes uint8_t BTD::readPollInterval ( - ) + ) @@ -1402,7 +1405,7 @@ Static Protected Attributes void BTD::PrintEndpointDescriptor ( const USB_ENDPOINT_DESCRIPTOR *  - ep_ptr) + ep_ptr) @@ -1420,7 +1423,7 @@ Static Protected Attributes -

Definition at line 281 of file BTD.cpp.

+

Definition at line 296 of file BTD.cpp.

@@ -1904,7 +1907,7 @@ Static Protected Attributes diff --git a/class_bluetooth_service-members.html b/class_bluetooth_service-members.html index d6095c3b..61170133 100644 --- a/class_bluetooth_service-members.html +++ b/class_bluetooth_service-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_bluetooth_service.html b/class_bluetooth_service.html index 8f4f2159..71162c53 100644 --- a/class_bluetooth_service.html +++ b/class_bluetooth_service.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: BluetoothService Class Reference @@ -31,7 +31,7 @@ - + @@ -127,7 +127,7 @@ Public Member Functions virtual void BluetoothService::ACLData ( uint8_t *  - ACLData) + ACLData) @@ -159,7 +159,7 @@ Public Member Functions virtual void BluetoothService::Run ( - ) + ) @@ -185,7 +185,7 @@ Public Member Functions virtual void BluetoothService::Reset ( - ) + ) @@ -211,7 +211,7 @@ Public Member Functions virtual void BluetoothService::disconnect ( - ) + ) @@ -235,7 +235,7 @@ Public Member Functions diff --git a/class_bulk_only-members.html b/class_bulk_only-members.html index 4562d59e..00a848bf 100644 --- a/class_bulk_only-members.html +++ b/class_bulk_only-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -99,7 +99,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); bPollEnableBulkOnlyprotected bTheLUNBulkOnlyprotected BulkOnly(USB *p)BulkOnly - ClearEpHalt(uint8_t index)BulkOnlyprotected + ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)BulkOnlyvirtual + CurrentCapacityBulkOnlyprotected + CurrentSectorSizeBulkOnlyprotected dCBWDataTransferLengthBulkOnlyprotected dCBWTagBulkOnlyprotected EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)BulkOnlyvirtual @@ -110,39 +112,31 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); GetAddress()BulkOnlyinlinevirtual GetbMaxLUN()BulkOnlyinline GetbTheLUN()BulkOnlyinline - GetLastUsbError()BulkOnlyinline - GetMaxLUN(uint8_t *max_lun)BulkOnly - HandleSCSIError(uint8_t status)BulkOnlyprotected - HandleUsbError(uint8_t error, uint8_t index)BulkOnlyprotected - Init(uint8_t parent, uint8_t port, bool lowspeed)BulkOnlyvirtual - Inquiry(uint8_t lun, uint16_t size, uint8_t *buf)BulkOnly - IsMeaningfulCBW(uint8_t size, uint8_t *pcbw)BulkOnlyprotected - IsValidCBW(uint8_t size, uint8_t *pcbw)BulkOnlyprotected - IsValidCSW(CommandStatusWrapper *pcsw, CommandBlockWrapperBase *pcbw)BulkOnlyprotected + GetCapacity(uint8_t lun)BulkOnly + GetLastUsbError()BulkOnlyinline + GetSectorSize(uint8_t lun)BulkOnly + Init(uint8_t parent, uint8_t port, bool lowspeed)BulkOnlyvirtual + LockMedia(uint8_t lun, uint8_t lock)BulkOnly + LUNIsGood(uint8_t lun)BulkOnly + LUNOkBulkOnlyprotected MediaCTL(uint8_t lun, uint8_t ctl)BulkOnly - ModeSense(uint8_t lun, uint8_t pc, uint8_t page, uint8_t subpage, uint8_t len, uint8_t *buf)BulkOnly - OnInit()BulkOnlyinlineprotectedvirtual - Poll()BulkOnlyvirtual - PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)BulkOnlyprotected - pUsbBulkOnlyprotected - qNextPollTimeBulkOnlyprotected - Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf)BulkOnly - Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, USBReadParser *prs)BulkOnly - ReadCapacity(uint8_t lun, uint16_t size, uint8_t *buf)BulkOnly + OnInit()BulkOnlyinlineprotectedvirtual + Poll()BulkOnlyvirtual + PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)BulkOnlyprotected + pUsbBulkOnlyprotected + qNextPollTimeBulkOnlyprotected + Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf)BulkOnly + Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, USBReadParser *prs)BulkOnly Release()BulkOnlyvirtual - RequestSense(uint8_t lun, uint16_t size, uint8_t *buf)BulkOnly - Reset()BulkOnly - ResetRecovery()BulkOnly - SetCurLUN(uint8_t lun)BulkOnly - TestUnitReady(uint8_t lun)BulkOnly - Transaction(CommandBlockWrapper *cbw, uint16_t bsize, void *buf, uint8_t flags)BulkOnlyprotected Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t *buf)BulkOnly + WriteOkBulkOnlyprotected + WriteProtected(uint8_t lun)BulkOnly diff --git a/class_bulk_only.html b/class_bulk_only.html index 623b6f5f..58b06578 100644 --- a/class_bulk_only.html +++ b/class_bulk_only.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: BulkOnly Class Reference @@ -31,7 +31,7 @@ - + @@ -120,24 +120,8 @@ Public Member Functions   uint8_t GetbTheLUN ()   -uint8_t Reset () -  -uint8_t GetMaxLUN (uint8_t *max_lun) -  -uint8_t SetCurLUN (uint8_t lun) -  -uint8_t ResetRecovery () -  -uint8_t Inquiry (uint8_t lun, uint16_t size, uint8_t *buf) -  -uint8_t TestUnitReady (uint8_t lun) -  -uint8_t ReadCapacity (uint8_t lun, uint16_t size, uint8_t *buf) -  -uint8_t RequestSense (uint8_t lun, uint16_t size, uint8_t *buf) -  -uint8_t ModeSense (uint8_t lun, uint8_t pc, uint8_t page, uint8_t subpage, uint8_t len, uint8_t *buf) -  +boolean WriteProtected (uint8_t lun) +  uint8_t MediaCTL (uint8_t lun, uint8_t ctl)   uint8_t Read (uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf) @@ -146,8 +130,18 @@ Public Member Functions   uint8_t Write (uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t *buf)   +uint8_t LockMedia (uint8_t lun, uint8_t lock) +  +bool LUNIsGood (uint8_t lun) +  +uint32_t GetCapacity (uint8_t lun) +  +uint16_t GetSectorSize (uint8_t lun) +  virtual uint8_t Init (uint8_t parent, uint8_t port, bool lowspeed)   +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  virtual uint8_t Release ()   virtual uint8_t Poll () @@ -161,20 +155,6 @@ Public Member Functions Protected Member Functions void PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTOR *ep_ptr)   -bool IsValidCBW (uint8_t size, uint8_t *pcbw) -  -bool IsMeaningfulCBW (uint8_t size, uint8_t *pcbw) -  -bool IsValidCSW (CommandStatusWrapper *pcsw, CommandBlockWrapperBase *pcbw) -  -uint8_t ClearEpHalt (uint8_t index) -  -uint8_t Transaction (CommandBlockWrapper *cbw, uint16_t bsize, void *buf, uint8_t flags) -  -uint8_t HandleUsbError (uint8_t error, uint8_t index) -  -uint8_t HandleSCSIError (uint8_t status) -  virtual uint8_t OnInit ()   @@ -206,6 +186,14 @@ Protected Attributes + + + + + + + +
 
uint8_t bTheLUN
 
uint32_t CurrentCapacity [MASS_MAX_SUPPORTED_LUN]
 
uint16_t CurrentSectorSize [MASS_MAX_SUPPORTED_LUN]
 
bool LUNOk [MASS_MAX_SUPPORTED_LUN]
 
bool WriteOk [MASS_MAX_SUPPORTED_LUN]
 
@@ -218,7 +206,7 @@ Static Protected Attributes

Static Protected Attributes

Detailed Description

-

Definition at line 189 of file masstorage.h.

+

Definition at line 206 of file masstorage.h.

Constructor & Destructor Documentation

@@ -228,13 +216,13 @@ Static Protected Attributes BulkOnly::BulkOnly ( USB *  - p) + p)
-

Definition at line 19 of file masstorage.cpp.

+

Definition at line 241 of file masstorage.cpp.

@@ -250,7 +238,7 @@ Static Protected Attributes void BulkOnly::PrintEndpointDescriptor ( const USB_ENDPOINT_DESCRIPTOR *  - ep_ptr) + ep_ptr) @@ -260,12 +248,18 @@ Static Protected Attributes
+
Parameters
+ + +
ep_ptr
+
+
-

Definition at line 844 of file masstorage.cpp.

+

Definition at line 1299 of file masstorage.cpp.

- +
@@ -273,235 +267,20 @@ Static Protected Attributes - - -
- + - - - - - - - - - - - - - - -
bool BulkOnly::IsValidCBW virtual uint8_t BulkOnly::OnInit (uint8_t size,
uint8_t * pcbw 
)
-
-protected
-
- -
-
- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - -
bool BulkOnly::IsMeaningfulCBW (uint8_t size,
uint8_t * pcbw 
)
-
-protected
-
- -
-
- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - -
bool BulkOnly::IsValidCSW (CommandStatusWrapperpcsw,
CommandBlockWrapperBasepcbw 
)
-
-protected
-
- -

Definition at line 7 of file masstorage.cpp.

- -
-
- -
-
- - - +inlineprotectedvirtual
- - - - - - +
uint8_t BulkOnly::ClearEpHalt (uint8_t index))
-protected
-

Definition at line 444 of file masstorage.cpp.

- -
-
- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uint8_t BulkOnly::Transaction (CommandBlockWrappercbw,
uint16_t bsize,
void * buf,
uint8_t flags 
)
-
-protected
-
- -

Definition at line 709 of file masstorage.cpp.

- -
-
- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - -
uint8_t BulkOnly::HandleUsbError (uint8_t error,
uint8_t index 
)
-
-protected
-
- -

Definition at line 401 of file masstorage.cpp.

- -
-
- -
-
- - - - - -
- - - - - - - - -
uint8_t BulkOnly::HandleSCSIError (uint8_t status)
-
-protected
-
- -

Definition at line 794 of file masstorage.cpp.

+

Definition at line 236 of file masstorage.h.

@@ -515,7 +294,7 @@ Static Protected Attributes uint8_t BulkOnly::GetLastUsbError ( - ) + ) @@ -526,7 +305,7 @@ Static Protected Attributes
-

Definition at line 227 of file masstorage.h.

+

Definition at line 242 of file masstorage.h.

@@ -540,7 +319,7 @@ Static Protected Attributes uint8_t BulkOnly::GetbMaxLUN ( - ) + ) @@ -551,7 +330,7 @@ Static Protected Attributes
-

Definition at line 231 of file masstorage.h.

+

Definition at line 246 of file masstorage.h.

@@ -565,7 +344,7 @@ Static Protected Attributes uint8_t BulkOnly::GetbTheLUN ( - ) + ) @@ -576,249 +355,33 @@ Static Protected Attributes
-

Definition at line 235 of file masstorage.h.

+

Definition at line 250 of file masstorage.h.

- +
- + - + +
uint8_t BulkOnly::Reset boolean BulkOnly::WriteProtected ()uint8_t lun)
+

Test if LUN is write protected

+
Parameters
+ + +
lunLogical Unit Number
+
+
+
Returns
cached status of write protect switch
-

Definition at line 388 of file masstorage.cpp.

- -
-
- -
-
- - - - - - - - -
uint8_t BulkOnly::GetMaxLUN (uint8_t * max_lun)
-
- -

Definition at line 392 of file masstorage.cpp.

- -
-
- -
-
- - - - - - - - -
uint8_t BulkOnly::SetCurLUN (uint8_t lun)
-
- -

Definition at line 786 of file masstorage.cpp.

- -
-
- -
-
- - - - - - - -
uint8_t BulkOnly::ResetRecovery ()
-
- -

Definition at line 465 of file masstorage.cpp.

- -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
uint8_t BulkOnly::Inquiry (uint8_t lun,
uint16_t size,
uint8_t * buf 
)
-
- -

Definition at line 490 of file masstorage.cpp.

- -
-
- -
-
- - - - - - - - -
uint8_t BulkOnly::TestUnitReady (uint8_t lun)
-
- -

Definition at line 556 of file masstorage.cpp.

- -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
uint8_t BulkOnly::ReadCapacity (uint8_t lun,
uint16_t size,
uint8_t * buf 
)
-
- -

Definition at line 534 of file masstorage.cpp.

- -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
uint8_t BulkOnly::RequestSense (uint8_t lun,
uint16_t size,
uint8_t * buf 
)
-
- -

Definition at line 512 of file masstorage.cpp.

- -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uint8_t BulkOnly::ModeSense (uint8_t lun,
uint8_t pc,
uint8_t page,
uint8_t subpage,
uint8_t len,
uint8_t * buf 
)
-
- -

Definition at line 685 of file masstorage.cpp.

+

Definition at line 53 of file masstorage.cpp.

@@ -845,8 +408,17 @@ Static Protected Attributes
+

Media control, for spindle motor and media tray or door. This includes CDROM, TAPE and anything with a media loader.

+
Parameters
+ + + +
lunLogical Unit Number
ctl0x00 Stop Motor, 0x01 Start Motor, 0x02 Eject Media, 0x03 Load Media
+
+
+
Returns
0 on success
-

Definition at line 581 of file masstorage.cpp.

+

Definition at line 97 of file masstorage.cpp.

@@ -891,8 +463,20 @@ Static Protected Attributes
+

Read data from media

+
Parameters
+ + + + + + +
lunLogical Unit Number
addrLBA address on media to read
bsizesize of a block (we should probably use the cached size)
blockshow many blocks to read
bufmemory that is able to hold the requested data
+
+
+
Returns
0 on success
-

Definition at line 604 of file masstorage.cpp.

+

Definition at line 134 of file masstorage.cpp.

@@ -938,7 +522,7 @@ Static Protected Attributes
-

Definition at line 630 of file masstorage.cpp.

+

Definition at line 1327 of file masstorage.cpp.

@@ -983,8 +567,135 @@ Static Protected Attributes
+

Write data to media

+
Parameters
+ + + + + + +
lunLogical Unit Number
addrLBA address on media to write
bsizesize of a block (we should probably use the cached size)
blockshow many blocks to write
bufmemory that contains the data to write
+
+
+
Returns
0 on success
-

Definition at line 658 of file masstorage.cpp.

+

Definition at line 186 of file masstorage.cpp.

+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + +
uint8_t BulkOnly::LockMedia (uint8_t lun,
uint8_t lock 
)
+
+

Lock or Unlock the tray or door on device. Caution: Some devices with buggy firmware will lock up.

+
Parameters
+ + + +
lunLogical Unit Number
lock1 to lock, 0 to unlock
+
+
+
Returns
+ +

Definition at line 66 of file masstorage.cpp.

+ +
+
+ +
+
+ + + + + + + + +
bool BulkOnly::LUNIsGood (uint8_t lun)
+
+

Test if LUN is ready for use

+
Parameters
+ + +
lunLogical Unit Number
+
+
+
Returns
true if LUN is ready for use
+ +

Definition at line 43 of file masstorage.cpp.

+ +
+
+ +
+
+ + + + + + + + +
uint32_t BulkOnly::GetCapacity (uint8_t lun)
+
+

Get the capacity of the media

+
Parameters
+ + +
lunLogical Unit Number
+
+
+
Returns
media capacity
+ +

Definition at line 19 of file masstorage.cpp.

+ +
+
+ +
+
+ + + + + + + + +
uint16_t BulkOnly::GetSectorSize (uint8_t lun)
+
+

Get the sector (block) size used on the media

+
Parameters
+ + +
lunLogical Unit Number
+
+
+
Returns
media sector size
+ +

Definition at line 31 of file masstorage.cpp.

@@ -1025,10 +736,74 @@ Static Protected Attributes
+
Parameters
+ + + + +
parent(not used)
port(not used)
lowspeedtrue if device is low speed
+
+
+
Returns
0 for success

Implements USBDeviceConfig.

-

Definition at line 40 of file masstorage.cpp.

+

Definition at line 346 of file masstorage.cpp.

+ +
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
uint8_t BulkOnly::ConfigureDevice (uint8_t parent,
uint8_t port,
bool lowspeed 
)
+
+virtual
+
+

USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET == success We need to standardize either the rcode, or change the API to return values so a signal that additional actions are required can be produced. Some of these codes do exist already.

+

TECHNICAL: We could do most of this code elsewhere, with the exception of checking the class instance. Doing so would save some program memory when using multiple drivers.

+
Parameters
+ + + + +
parentUSB address of parent
portaddress of port on parent
lowspeedtrue if device is low speed
+
+
+
Returns
+ +

Reimplemented from USBDeviceConfig.

+ +

Definition at line 270 of file masstorage.cpp.

@@ -1042,7 +817,7 @@ Static Protected Attributes uint8_t BulkOnly::Release ( - ) + ) @@ -1052,10 +827,12 @@ Static Protected Attributes
+

For driver use only.

+
Returns

Implements USBDeviceConfig.

-

Definition at line 363 of file masstorage.cpp.

+

Definition at line 536 of file masstorage.cpp.

@@ -1069,7 +846,7 @@ Static Protected Attributes uint8_t BulkOnly::Poll ( - ) + ) @@ -1079,10 +856,12 @@ Static Protected Attributes
+

For driver use only.

+
Returns

Implements USBDeviceConfig.

-

Definition at line 379 of file masstorage.cpp.

+

Definition at line 614 of file masstorage.cpp.

@@ -1096,7 +875,7 @@ Static Protected Attributes virtual uint8_t BulkOnly::GetAddress ( - ) + ) @@ -1109,7 +888,7 @@ Static Protected Attributes

Implements USBDeviceConfig.

-

Definition at line 259 of file masstorage.h.

+

Definition at line 272 of file masstorage.h.

@@ -1148,7 +927,7 @@ Static Protected Attributes const USB_ENDPOINT_DESCRIPTOR *  - ep  + pep  @@ -1162,35 +941,21 @@ Static Protected Attributes
+

For driver use only.

+
Parameters
+ + + + + + +
conf
iface
alt
proto
pep
+
+

Implements UsbConfigXtracter.

-

Definition at line 336 of file masstorage.cpp.

- -
- - -
-
- - - - - -
- - - - - - - -
virtual uint8_t BulkOnly::OnInit ()
-
-inlineprotectedvirtual
-
- -

Definition at line 269 of file masstorage.h.

+

Definition at line 1268 of file masstorage.cpp.

@@ -1213,7 +978,7 @@ Static Protected Attributes
-

Definition at line 191 of file masstorage.h.

+

Definition at line 208 of file masstorage.h.

@@ -1235,7 +1000,7 @@ Static Protected Attributes
-

Definition at line 192 of file masstorage.h.

+

Definition at line 209 of file masstorage.h.

@@ -1257,7 +1022,7 @@ Static Protected Attributes
-

Definition at line 193 of file masstorage.h.

+

Definition at line 210 of file masstorage.h.

@@ -1279,7 +1044,7 @@ Static Protected Attributes
-

Definition at line 195 of file masstorage.h.

+

Definition at line 212 of file masstorage.h.

@@ -1301,7 +1066,7 @@ Static Protected Attributes
-

Definition at line 196 of file masstorage.h.

+

Definition at line 213 of file masstorage.h.

@@ -1323,7 +1088,7 @@ Static Protected Attributes
-

Definition at line 197 of file masstorage.h.

+

Definition at line 214 of file masstorage.h.

@@ -1345,7 +1110,7 @@ Static Protected Attributes
-

Definition at line 198 of file masstorage.h.

+

Definition at line 215 of file masstorage.h.

@@ -1367,7 +1132,7 @@ Static Protected Attributes
-

Definition at line 199 of file masstorage.h.

+

Definition at line 216 of file masstorage.h.

@@ -1389,7 +1154,7 @@ Static Protected Attributes
-

Definition at line 200 of file masstorage.h.

+

Definition at line 217 of file masstorage.h.

@@ -1411,7 +1176,7 @@ Static Protected Attributes
-

Definition at line 201 of file masstorage.h.

+

Definition at line 218 of file masstorage.h.

@@ -1433,7 +1198,7 @@ Static Protected Attributes
-

Definition at line 203 of file masstorage.h.

+

Definition at line 220 of file masstorage.h.

@@ -1455,7 +1220,7 @@ Static Protected Attributes
-

Definition at line 205 of file masstorage.h.

+

Definition at line 222 of file masstorage.h.

@@ -1477,7 +1242,7 @@ Static Protected Attributes
-

Definition at line 206 of file masstorage.h.

+

Definition at line 223 of file masstorage.h.

@@ -1499,7 +1264,7 @@ Static Protected Attributes
-

Definition at line 207 of file masstorage.h.

+

Definition at line 224 of file masstorage.h.

@@ -1521,7 +1286,7 @@ Static Protected Attributes
-

Definition at line 208 of file masstorage.h.

+

Definition at line 225 of file masstorage.h.

@@ -1543,7 +1308,95 @@ Static Protected Attributes
-

Definition at line 209 of file masstorage.h.

+

Definition at line 226 of file masstorage.h.

+ +
+ + +
+
+ + + + + +
+ + + + +
uint32_t BulkOnly::CurrentCapacity[MASS_MAX_SUPPORTED_LUN]
+
+protected
+
+ +

Definition at line 227 of file masstorage.h.

+ +
+
+ +
+
+ + + + + +
+ + + + +
uint16_t BulkOnly::CurrentSectorSize[MASS_MAX_SUPPORTED_LUN]
+
+protected
+
+ +

Definition at line 228 of file masstorage.h.

+ +
+
+ +
+
+ + + + + +
+ + + + +
bool BulkOnly::LUNOk[MASS_MAX_SUPPORTED_LUN]
+
+protected
+
+ +

Definition at line 229 of file masstorage.h.

+ +
+
+ +
+
+ + + + + +
+ + + + +
bool BulkOnly::WriteOk[MASS_MAX_SUPPORTED_LUN]
+
+protected
+
+ +

Definition at line 230 of file masstorage.h.

@@ -1556,7 +1409,7 @@ Static Protected Attributes diff --git a/class_byte_skipper-members.html b/class_byte_skipper-members.html index 46dffc0c..8f59b949 100644 --- a/class_byte_skipper-members.html +++ b/class_byte_skipper-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_byte_skipper.html b/class_byte_skipper.html index da0cd3f4..02fb4f52 100644 --- a/class_byte_skipper.html +++ b/class_byte_skipper.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: ByteSkipper Class Reference @@ -31,7 +31,7 @@ - + @@ -116,7 +116,7 @@ Public Member Functions ByteSkipper::ByteSkipper ( - ) + ) @@ -143,7 +143,7 @@ Public Member Functions void ByteSkipper::Initialize ( MultiValueBuffer *  - pbuf) + pbuf) @@ -208,7 +208,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 1ded61a6..53281563 100644 --- a/class_c_d_c_async_oper-members.html +++ b/class_c_d_c_async_oper-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -96,7 +96,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 7a885572..ff9b4baf 100644 --- a/class_c_d_c_async_oper.html +++ b/class_c_d_c_async_oper.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: CDCAsyncOper Class Reference @@ -31,7 +31,7 @@ - + @@ -113,7 +113,7 @@ Public Member Functions virtual uint8_t CDCAsyncOper::OnInit ( ACM *  - pacm) + pacm) @@ -134,7 +134,7 @@ Public Member Functions diff --git a/class_config_desc_parser-members.html b/class_config_desc_parser-members.html index 294d36be..a8545a9e 100644 --- a/class_config_desc_parser-members.html +++ b/class_config_desc_parser-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_config_desc_parser.html b/class_config_desc_parser.html index c5a32646..c88cb38d 100644 --- a/class_config_desc_parser.html +++ b/class_config_desc_parser.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: ConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK > Class Template Reference @@ -31,7 +31,7 @@ - + @@ -131,7 +131,7 @@ template<const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PRO ConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK >::ConfigDescParser ( UsbConfigXtracter *  - xtractor) + xtractor) @@ -196,7 +196,7 @@ template<const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PRO diff --git a/class_f_t_d_i-members.html b/class_f_t_d_i-members.html index 881ac0f2..cb87fca6 100644 --- a/class_f_t_d_i-members.html +++ b/class_f_t_d_i-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -90,24 +90,25 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

This is the complete list of members for FTDI, including all inherited members.

- - - - - - - - - - - - + + + + + + + + + + + + +
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)FTDIvirtual
FTDI(USB *pusb, FTDIAsyncOper *pasync)FTDI
GetAddress()FTDIinlinevirtual
Init(uint8_t parent, uint8_t port, bool lowspeed)FTDIvirtual
Poll()FTDIvirtual
RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)FTDI
Release()FTDIvirtual
SetBaudRate(uint32_t baud)FTDI
SetData(uint16_t databm)FTDI
SetFlowControl(uint8_t protocol, uint8_t xon=0x11, uint8_t xoff=0x13)FTDI
SetModemControl(uint16_t control)FTDI
SndData(uint16_t nbytes, uint8_t *dataptr)FTDI
ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)FTDIvirtual
FTDI(USB *pusb, FTDIAsyncOper *pasync)FTDI
GetAddress()FTDIinlinevirtual
Init(uint8_t parent, uint8_t port, bool lowspeed)FTDIvirtual
Poll()FTDIvirtual
RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr)FTDI
Release()FTDIvirtual
SetBaudRate(uint32_t baud)FTDI
SetData(uint16_t databm)FTDI
SetFlowControl(uint8_t protocol, uint8_t xon=0x11, uint8_t xoff=0x13)FTDI
SetModemControl(uint16_t control)FTDI
SndData(uint16_t nbytes, uint8_t *dataptr)FTDI
diff --git a/class_f_t_d_i.html b/class_f_t_d_i.html index 7b78ab88..fbc6a081 100644 --- a/class_f_t_d_i.html +++ b/class_f_t_d_i.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: FTDI Class Reference @@ -31,7 +31,7 @@ - + @@ -133,6 +133,9 @@ Public Member Functions   virtual void EndpointXtract (uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)   +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) + 

Detailed Description

@@ -175,13 +178,13 @@ Public Member Functions uint8_t FTDI::SetBaudRate ( uint32_t  - baud) + baud)
-

Definition at line 257 of file cdcftdi.cpp.

+

Definition at line 269 of file cdcftdi.cpp.

@@ -193,13 +196,13 @@ Public Member Functions uint8_t FTDI::SetModemControl ( uint16_t  - control) + control)
-

Definition at line 294 of file cdcftdi.cpp.

+

Definition at line 306 of file cdcftdi.cpp.

@@ -233,7 +236,7 @@ Public Member Functions
-

Definition at line 298 of file cdcftdi.cpp.

+

Definition at line 310 of file cdcftdi.cpp.

@@ -245,13 +248,13 @@ Public Member Functions uint8_t FTDI::SetData ( uint16_t  - databm) + databm)
-

Definition at line 302 of file cdcftdi.cpp.

+

Definition at line 314 of file cdcftdi.cpp.

@@ -279,7 +282,7 @@ Public Member Functions
-

Definition at line 306 of file cdcftdi.cpp.

+

Definition at line 318 of file cdcftdi.cpp.

@@ -307,7 +310,7 @@ Public Member Functions
-

Definition at line 310 of file cdcftdi.cpp.

+

Definition at line 322 of file cdcftdi.cpp.

@@ -365,7 +368,7 @@ Public Member Functions uint8_t FTDI::Release ( - ) + ) @@ -378,7 +381,7 @@ Public Member Functions

Implements USBDeviceConfig.

-

Definition at line 232 of file cdcftdi.cpp.

+

Definition at line 244 of file cdcftdi.cpp.

@@ -392,7 +395,7 @@ Public Member Functions uint8_t FTDI::Poll ( - ) + ) @@ -405,7 +408,7 @@ Public Member Functions

Implements USBDeviceConfig.

-

Definition at line 242 of file cdcftdi.cpp.

+

Definition at line 254 of file cdcftdi.cpp.

@@ -419,7 +422,7 @@ Public Member Functions virtual uint8_t FTDI::GetAddress ( - ) + ) @@ -488,7 +491,7 @@ Public Member Functions

Implements UsbConfigXtracter.

-

Definition at line 205 of file cdcftdi.cpp.

+

Definition at line 217 of file cdcftdi.cpp.

@@ -501,7 +504,7 @@ Public Member Functions diff --git a/class_f_t_d_i_async_oper-members.html b/class_f_t_d_i_async_oper-members.html index 632c7d59..ba71c9e8 100644 --- a/class_f_t_d_i_async_oper-members.html +++ b/class_f_t_d_i_async_oper-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -96,7 +96,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 fe825b5c..90755a7a 100644 --- a/class_f_t_d_i_async_oper.html +++ b/class_f_t_d_i_async_oper.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: FTDIAsyncOper Class Reference @@ -31,7 +31,7 @@ - + @@ -113,7 +113,7 @@ Public Member Functions virtual uint8_t FTDIAsyncOper::OnInit ( FTDI *  - pftdi) + pftdi) @@ -134,7 +134,7 @@ Public Member Functions diff --git a/class_h_i_d-members.html b/class_h_i_d-members.html index 04fd45da..c130c2ee 100644 --- a/class_h_i_d-members.html +++ b/class_h_i_d-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -91,37 +91,38 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

This is the complete list of members for HID, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
bAddressHIDprotected
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)=0UsbConfigXtracterpure virtual
epInterruptInIndexHIDprotectedstatic
epInterruptOutIndexHIDprotectedstatic
GetAddress()=0USBDeviceConfigpure virtual
GetHidDescr(uint8_t ep, uint16_t nbytes, uint8_t *dataptr)HID
GetIdle(uint8_t iface, uint8_t reportID, uint8_t *dataptr)HID
GetProtocol(uint8_t iface, uint8_t *dataptr)HID
GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
GetReportDescr(uint8_t ep, USBReadParser *parser=NULL)HID
GetReportParser(uint8_t id)HIDprotectedvirtual
GetUsb()HIDinline
HID(USB *pusb)HIDinline
Init(uint8_t parent, uint8_t port, bool lowspeed)=0USBDeviceConfigpure virtual
maxEpPerInterfaceHIDprotectedstatic
maxHidInterfacesHIDprotectedstatic
Poll()=0USBDeviceConfigpure virtual
PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)HIDprotected
PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc)HIDprotected
pUsbHIDprotected
Release()=0USBDeviceConfigpure virtual
SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)HID
SetProtocol(uint8_t iface, uint8_t protocol)HID
SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
SetReportParser(uint8_t id, HIDReportParser *prs)HIDvirtual
totalEndpointsHIDprotectedstatic
ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)=0UsbConfigXtracterpure virtual
epInterruptInIndexHIDprotectedstatic
epInterruptOutIndexHIDprotectedstatic
GetAddress()=0USBDeviceConfigpure virtual
GetHidDescr(uint8_t ep, uint16_t nbytes, uint8_t *dataptr)HID
GetIdle(uint8_t iface, uint8_t reportID, uint8_t *dataptr)HID
GetProtocol(uint8_t iface, uint8_t *dataptr)HID
GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
GetReportDescr(uint8_t ep, USBReadParser *parser=NULL)HID
GetReportParser(uint8_t id)HIDprotectedvirtual
GetUsb()HIDinline
HID(USB *pusb)HIDinline
Init(uint8_t parent, uint8_t port, bool lowspeed)=0USBDeviceConfigpure virtual
maxEpPerInterfaceHIDprotectedstatic
maxHidInterfacesHIDprotectedstatic
Poll()=0USBDeviceConfigpure virtual
PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)HIDprotected
PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc)HIDprotected
pUsbHIDprotected
Release()=0USBDeviceConfigpure virtual
SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)HID
SetProtocol(uint8_t iface, uint8_t protocol)HID
SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
SetReportParser(uint8_t id, HIDReportParser *prs)HIDvirtual
totalEndpointsHIDprotectedstatic
diff --git a/class_h_i_d.html b/class_h_i_d.html index d5a7d5cf..a7855b2d 100644 --- a/class_h_i_d.html +++ b/class_h_i_d.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: HID Class Reference @@ -31,7 +31,7 @@ - + @@ -137,6 +137,8 @@ Public Member Functions - Public Member Functions inherited from USBDeviceConfig virtual uint8_t Init (uint8_t parent, uint8_t port, bool lowspeed)=0   +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  virtual uint8_t Release ()=0   virtual uint8_t Poll ()=0 @@ -191,7 +193,7 @@ Static Protected Attributes HID::HID ( USB *  - pusb) + pusb) @@ -218,7 +220,7 @@ Static Protected Attributes void HID::PrintEndpointDescriptor ( const USB_ENDPOINT_DESCRIPTOR *  - ep_ptr) + ep_ptr) @@ -244,7 +246,7 @@ Static Protected Attributes void HID::PrintHidDescriptor ( const USB_HID_DESCRIPTOR *  - pDesc) + pDesc) @@ -270,7 +272,7 @@ Static Protected Attributes virtual HIDReportParser* HID::GetReportParser ( uint8_t  - id) + id) @@ -295,7 +297,7 @@ Static Protected Attributes const USB* HID::GetUsb ( - ) + ) @@ -798,7 +800,7 @@ Static Protected Attributes diff --git a/class_h_i_d_boot-members.html b/class_h_i_d_boot-members.html index c493db66..09e90190 100644 --- a/class_h_i_d_boot-members.html +++ b/class_h_i_d_boot-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -91,37 +91,38 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

This is the complete list of members for HIDBoot< BOOT_PROTOCOL >, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
bAddressHIDprotected
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)HIDBoot< BOOT_PROTOCOL >virtual
epInterruptInIndexHIDprotectedstatic
epInterruptOutIndexHIDprotectedstatic
GetAddress()HIDBoot< BOOT_PROTOCOL >inlinevirtual
GetHidDescr(uint8_t ep, uint16_t nbytes, uint8_t *dataptr)HID
GetIdle(uint8_t iface, uint8_t reportID, uint8_t *dataptr)HID
GetProtocol(uint8_t iface, uint8_t *dataptr)HID
GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
GetReportDescr(uint8_t ep, USBReadParser *parser=NULL)HID
GetUsb()HIDinline
HID(USB *pusb)HIDinline
HIDBoot(USB *p)HIDBoot< BOOT_PROTOCOL >
Init(uint8_t parent, uint8_t port, bool lowspeed)HIDBoot< BOOT_PROTOCOL >virtual
maxEpPerInterfaceHIDprotectedstatic
maxHidInterfacesHIDprotectedstatic
Poll()HIDBoot< BOOT_PROTOCOL >virtual
PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)HIDprotected
PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc)HIDprotected
pUsbHIDprotected
Release()HIDBoot< BOOT_PROTOCOL >virtual
SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)HID
SetProtocol(uint8_t iface, uint8_t protocol)HID
SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
SetReportParser(uint8_t id, HIDReportParser *prs)HIDBoot< BOOT_PROTOCOL >inlinevirtual
totalEndpointsHIDprotectedstatic
ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)HIDBoot< BOOT_PROTOCOL >virtual
epInterruptInIndexHIDprotectedstatic
epInterruptOutIndexHIDprotectedstatic
GetAddress()HIDBoot< BOOT_PROTOCOL >inlinevirtual
GetHidDescr(uint8_t ep, uint16_t nbytes, uint8_t *dataptr)HID
GetIdle(uint8_t iface, uint8_t reportID, uint8_t *dataptr)HID
GetProtocol(uint8_t iface, uint8_t *dataptr)HID
GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
GetReportDescr(uint8_t ep, USBReadParser *parser=NULL)HID
GetUsb()HIDinline
HID(USB *pusb)HIDinline
HIDBoot(USB *p)HIDBoot< BOOT_PROTOCOL >
Init(uint8_t parent, uint8_t port, bool lowspeed)HIDBoot< BOOT_PROTOCOL >virtual
maxEpPerInterfaceHIDprotectedstatic
maxHidInterfacesHIDprotectedstatic
Poll()HIDBoot< BOOT_PROTOCOL >virtual
PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)HIDprotected
PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc)HIDprotected
pUsbHIDprotected
Release()HIDBoot< BOOT_PROTOCOL >virtual
SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)HID
SetProtocol(uint8_t iface, uint8_t protocol)HID
SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
SetReportParser(uint8_t id, HIDReportParser *prs)HIDBoot< BOOT_PROTOCOL >inlinevirtual
totalEndpointsHIDprotectedstatic
diff --git a/class_h_i_d_boot.html b/class_h_i_d_boot.html index 5a5125bc..e9f773f1 100644 --- a/class_h_i_d_boot.html +++ b/class_h_i_d_boot.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: HIDBoot< BOOT_PROTOCOL > Class Template Reference @@ -31,7 +31,7 @@ - + @@ -144,6 +144,9 @@ Public Member Functions   uint8_t SetReport (uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)   +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  @@ -174,7 +177,7 @@ Additional Inherited Members class HIDBoot< BOOT_PROTOCOL > -

Definition at line 176 of file hidboot.h.

+

Definition at line 179 of file hidboot.h.

Constructor & Destructor Documentation

@@ -186,13 +189,13 @@ template<const uint8_t BOOT_PROTOCOL>
- +

Additional Inherited Members

HIDBoot< BOOT_PROTOCOL >::HIDBoot ( USBp)p)
-

Definition at line 217 of file hidboot.h.

+

Definition at line 220 of file hidboot.h.

@@ -233,7 +236,7 @@ template<const uint8_t BOOT_PROTOCOL>

Reimplemented from HID.

-

Definition at line 198 of file hidboot.h.

+

Definition at line 201 of file hidboot.h.

@@ -279,7 +282,7 @@ template<const uint8_t BOOT_PROTOCOL>

Implements USBDeviceConfig.

-

Definition at line 242 of file hidboot.h.

+

Definition at line 245 of file hidboot.h.

@@ -295,7 +298,7 @@ template<const uint8_t BOOT_PROTOCOL> uint8_t HIDBoot< BOOT_PROTOCOL >::Release ( - ) + ) @@ -308,7 +311,7 @@ template<const uint8_t BOOT_PROTOCOL>

Implements USBDeviceConfig.

-

Definition at line 447 of file hidboot.h.

+

Definition at line 463 of file hidboot.h.

@@ -324,7 +327,7 @@ template<const uint8_t BOOT_PROTOCOL> uint8_t HIDBoot< BOOT_PROTOCOL >::Poll ( - ) + ) @@ -337,7 +340,7 @@ template<const uint8_t BOOT_PROTOCOL>

Implements USBDeviceConfig.

-

Definition at line 460 of file hidboot.h.

+

Definition at line 476 of file hidboot.h.

@@ -353,7 +356,7 @@ template<const uint8_t BOOT_PROTOCOL> virtual uint8_t HIDBoot< BOOT_PROTOCOL >::GetAddress ( - ) + ) @@ -366,7 +369,7 @@ template<const uint8_t BOOT_PROTOCOL>

Implements USBDeviceConfig.

-

Definition at line 208 of file hidboot.h.

+

Definition at line 211 of file hidboot.h.

@@ -424,7 +427,7 @@ template<const uint8_t BOOT_PROTOCOL>

Implements UsbConfigXtracter.

-

Definition at line 424 of file hidboot.h.

+

Definition at line 439 of file hidboot.h.

@@ -436,7 +439,7 @@ template<const uint8_t BOOT_PROTOCOL> diff --git a/class_h_i_d_report_parser-members.html b/class_h_i_d_report_parser-members.html index baf64fc3..ce0012fd 100644 --- a/class_h_i_d_report_parser-members.html +++ b/class_h_i_d_report_parser-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -96,7 +96,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 f1c6657e..8fd0438c 100644 --- a/class_h_i_d_report_parser.html +++ b/class_h_i_d_report_parser.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: HIDReportParser Class Reference @@ -31,7 +31,7 @@ - + @@ -165,7 +165,7 @@ Public Member Functions diff --git a/class_h_i_d_universal-members.html b/class_h_i_d_universal-members.html index eb379c26..569c6cc3 100644 --- a/class_h_i_d_universal-members.html +++ b/class_h_i_d_universal-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -92,39 +92,40 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bAddressHIDprotected
bHasReportIdHIDUniversalprotected
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)HIDUniversalvirtual
epInterruptInIndexHIDprotectedstatic
epInterruptOutIndexHIDprotectedstatic
GetAddress()HIDUniversalinlinevirtual
GetHidDescr(uint8_t ep, uint16_t nbytes, uint8_t *dataptr)HID
GetIdle(uint8_t iface, uint8_t reportID, uint8_t *dataptr)HID
GetProtocol(uint8_t iface, uint8_t *dataptr)HID
GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
GetReportDescr(uint8_t ep, USBReadParser *parser=NULL)HID
GetReportParser(uint8_t id)HIDUniversalprotectedvirtual
GetUsb()HIDinline
HID(USB *pusb)HIDinline
HIDUniversal(USB *p)HIDUniversal
Init(uint8_t parent, uint8_t port, bool lowspeed)HIDUniversalvirtual
maxEpPerInterfaceHIDprotectedstatic
maxHidInterfacesHIDprotectedstatic
OnInitSuccessful()HIDUniversalinlineprotectedvirtual
Poll()HIDUniversalvirtual
PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)HIDprotected
PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc)HIDprotected
pUsbHIDprotected
Release()HIDUniversalvirtual
SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)HID
SetProtocol(uint8_t iface, uint8_t protocol)HID
SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
SetReportParser(uint8_t id, HIDReportParser *prs)HIDUniversalvirtual
totalEndpointsHIDprotectedstatic
ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual
EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)HIDUniversalvirtual
epInterruptInIndexHIDprotectedstatic
epInterruptOutIndexHIDprotectedstatic
GetAddress()HIDUniversalinlinevirtual
GetHidDescr(uint8_t ep, uint16_t nbytes, uint8_t *dataptr)HID
GetIdle(uint8_t iface, uint8_t reportID, uint8_t *dataptr)HID
GetProtocol(uint8_t iface, uint8_t *dataptr)HID
GetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
GetReportDescr(uint8_t ep, USBReadParser *parser=NULL)HID
GetReportParser(uint8_t id)HIDUniversalprotectedvirtual
GetUsb()HIDinline
HID(USB *pusb)HIDinline
HIDUniversal(USB *p)HIDUniversal
Init(uint8_t parent, uint8_t port, bool lowspeed)HIDUniversalvirtual
maxEpPerInterfaceHIDprotectedstatic
maxHidInterfacesHIDprotectedstatic
OnInitSuccessful()HIDUniversalinlineprotectedvirtual
Poll()HIDUniversalvirtual
PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)HIDprotected
PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc)HIDprotected
pUsbHIDprotected
Release()HIDUniversalvirtual
SetIdle(uint8_t iface, uint8_t reportID, uint8_t duration)HID
SetProtocol(uint8_t iface, uint8_t protocol)HID
SetReport(uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)HID
SetReportParser(uint8_t id, HIDReportParser *prs)HIDUniversalvirtual
totalEndpointsHIDprotectedstatic
diff --git a/class_h_i_d_universal.html b/class_h_i_d_universal.html index 1d00648c..c3b67c95 100644 --- a/class_h_i_d_universal.html +++ b/class_h_i_d_universal.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: HIDUniversal Class Reference @@ -31,7 +31,7 @@ - + @@ -147,6 +147,9 @@ Public Member Functions   uint8_t SetReport (uint8_t ep, uint8_t iface, uint8_t report_type, uint8_t report_id, uint16_t nbytes, uint8_t *dataptr)   +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  @@ -196,7 +199,7 @@ Additional Inherited Members - +

Protected Member Functions

HIDUniversal::HIDUniversal ( USBp)p)
@@ -218,7 +221,7 @@ Additional Inherited Members HIDReportParser * HIDUniversal::GetReportParser ( uint8_t  - id) + id) @@ -245,7 +248,7 @@ Additional Inherited Members virtual uint8_t HIDUniversal::OnInitSuccessful ( - ) + ) @@ -352,7 +355,7 @@ Additional Inherited Members uint8_t HIDUniversal::Release ( - ) + ) @@ -365,7 +368,7 @@ Additional Inherited Members

Implements USBDeviceConfig.

-

Definition at line 300 of file hiduniversal.cpp.

+

Definition at line 312 of file hiduniversal.cpp.

@@ -379,7 +382,7 @@ Additional Inherited Members uint8_t HIDUniversal::Poll ( - ) + ) @@ -392,7 +395,7 @@ Additional Inherited Members

Implements USBDeviceConfig.

-

Definition at line 327 of file hiduniversal.cpp.

+

Definition at line 339 of file hiduniversal.cpp.

@@ -406,7 +409,7 @@ Additional Inherited Members virtual uint8_t HIDUniversal::GetAddress ( - ) + ) @@ -475,7 +478,7 @@ Additional Inherited Members

Implements UsbConfigXtracter.

-

Definition at line 257 of file hiduniversal.cpp.

+

Definition at line 269 of file hiduniversal.cpp.

@@ -511,7 +514,7 @@ Additional Inherited Members diff --git a/class_hex_dumper-members.html b/class_hex_dumper-members.html index ad2770d0..bed1dbbd 100644 --- a/class_hex_dumper-members.html +++ b/class_hex_dumper-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_hex_dumper.html b/class_hex_dumper.html index 87334195..c27935ec 100644 --- a/class_hex_dumper.html +++ b/class_hex_dumper.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE > Class Template Reference @@ -31,7 +31,7 @@ - + @@ -96,11 +96,15 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); Inheritance diagram for HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >:
Inheritance graph
+ +
[legend]
Collaboration diagram for HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >:
Collaboration graph
+ +
[legend]
class HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE > -

Definition at line 24 of file hexdump.h.

+

Definition at line 28 of file hexdump.h.

Constructor & Destructor Documentation

@@ -131,7 +135,7 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
- +

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

HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >::HexDumper ())
@@ -142,7 +146,7 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
-

Definition at line 30 of file hexdump.h.

+

Definition at line 34 of file hexdump.h.

@@ -159,7 +163,7 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE> void HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >::Initialize ( - ) + ) @@ -170,7 +174,7 @@ template<class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
-

Definition at line 33 of file hexdump.h.

+

Definition at line 37 of file hexdump.h.

@@ -214,7 +218,7 @@ template<class BASE_CLASS , class LEN_TYPE , class OFFSET_TYPE >
-

Definition at line 42 of file hexdump.h.

+

Definition at line 46 of file hexdump.h.

@@ -226,7 +230,7 @@ template<class BASE_CLASS , class LEN_TYPE , class OFFSET_TYPE > diff --git a/class_keyboard_report_parser-members.html b/class_keyboard_report_parser-members.html index ead4fdd6..52725962 100644 --- a/class_keyboard_report_parser-members.html +++ b/class_keyboard_report_parser-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -98,16 +98,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); kbdLockingKeysKeyboardReportParserprotected KeyboardReportParser()KeyboardReportParserinline OemToAscii(uint8_t mod, uint8_t key)KeyboardReportParserprotected - OnKeyDown(uint8_t mod, uint8_t key)KeyboardReportParserinlineprotectedvirtual - OnKeyUp(uint8_t mod, uint8_t key)KeyboardReportParserinlineprotectedvirtual - Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)KeyboardReportParservirtual - prevStateKeyboardReportParserprotected + OnControlKeysChanged(uint8_t before, uint8_t after)KeyboardReportParserinlineprotectedvirtual + OnKeyDown(uint8_t mod, uint8_t key)KeyboardReportParserinlineprotectedvirtual + OnKeyUp(uint8_t mod, uint8_t key)KeyboardReportParserinlineprotectedvirtual + Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)KeyboardReportParservirtual + prevStateKeyboardReportParserprotected diff --git a/class_keyboard_report_parser.html b/class_keyboard_report_parser.html index 6e672c3a..cd38decf 100644 --- a/class_keyboard_report_parser.html +++ b/class_keyboard_report_parser.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: KeyboardReportParser Class Reference @@ -31,7 +31,7 @@ - + @@ -122,6 +122,8 @@ Protected Member Functions   virtual uint8_t HandleLockingKeys (HID *hid, uint8_t key)   +virtual void OnControlKeysChanged (uint8_t before, uint8_t after) +  virtual void OnKeyDown (uint8_t mod, uint8_t key)   virtual void OnKeyUp (uint8_t mod, uint8_t key) @@ -158,7 +160,7 @@ Protected Attributes KeyboardReportParser::KeyboardReportParser ( - ) + ) @@ -206,7 +208,7 @@ Protected Attributes
-

Definition at line 102 of file hidboot.cpp.

+

Definition at line 107 of file hidboot.cpp.

@@ -292,7 +294,43 @@ Protected Attributes
-

Definition at line 76 of file hidboot.cpp.

+

Definition at line 81 of file hidboot.cpp.

+ +
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
virtual void KeyboardReportParser::OnControlKeysChanged (uint8_t before,
uint8_t after 
)
+
+inlineprotectedvirtual
+
+ +

Definition at line 164 of file hidboot.h.

@@ -328,7 +366,7 @@ Protected Attributes
-

Definition at line 164 of file hidboot.h.

+

Definition at line 167 of file hidboot.h.

@@ -364,7 +402,7 @@ Protected Attributes
-

Definition at line 167 of file hidboot.h.

+

Definition at line 170 of file hidboot.h.

@@ -458,7 +496,7 @@ Protected Attributes diff --git a/class_m_a_x3421e-members.html b/class_m_a_x3421e-members.html index cc269f6f..6e4872ce 100644 --- a/class_m_a_x3421e-members.html +++ b/class_m_a_x3421e-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_m_a_x3421e.html b/class_m_a_x3421e.html index b9badba6..15d5e4fa 100644 --- a/class_m_a_x3421e.html +++ b/class_m_a_x3421e.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: MAX3421e< SS, INTR > Class Template Reference @@ -31,7 +31,7 @@ - + @@ -147,7 +147,7 @@ template<typename SS , typename INTR > MAX3421e< SS, INTR >::MAX3421e ( - ) + ) @@ -234,7 +234,7 @@ template<typename SS , typename INTR > void MAX3421e< SS, INTR >::gpioWr ( uint8_t  - data) + data) @@ -254,7 +254,7 @@ template<typename SS , typename INTR > uint8_t MAX3421e< SS, INTR >::regRd ( uint8_t  - reg) + reg) @@ -309,13 +309,13 @@ template<typename SS , typename INTR > uint8_t MAX3421e< SS, INTR >::gpioRd ( - ) + )
-

Definition at line 172 of file usbhost.h.

+

Definition at line 181 of file usbhost.h.

@@ -328,13 +328,13 @@ template<typename SS , typename INTR > uint16_t MAX3421e< SS, INTR >::reset ( - ) + )
-

Definition at line 183 of file usbhost.h.

+

Definition at line 192 of file usbhost.h.

@@ -347,7 +347,7 @@ template<typename SS , typename INTR > int8_t MAX3421e< SS, INTR >::Init ( - ) + ) @@ -356,7 +356,7 @@ template<typename SS , typename INTR >
  • initialize MAX3421E. Set Host mode, pullups, and stuff. Returns 0 if success, -1 if not */
  • -

    Definition at line 208 of file usbhost.h.

    +

    Definition at line 217 of file usbhost.h.

    @@ -373,7 +373,7 @@ template<typename SS , typename INTR > uint8_t MAX3421e< SS, INTR >::getVbusState ( void  - ) + ) @@ -397,13 +397,13 @@ template<typename SS , typename INTR > void MAX3421e< SS, INTR >::busprobe ( - ) + )
    -

    Definition at line 229 of file usbhost.h.

    +

    Definition at line 238 of file usbhost.h.

    @@ -416,7 +416,7 @@ template<typename SS , typename INTR > uint8_t MAX3421e< SS, INTR >::GpxHandler ( - ) + ) @@ -433,13 +433,13 @@ template<typename SS , typename INTR > uint8_t MAX3421e< SS, INTR >::IntHandler ( - ) + )
    -

    Definition at line 283 of file usbhost.h.

    +

    Definition at line 292 of file usbhost.h.

    @@ -453,13 +453,13 @@ template<typename SS , typename INTR > uint8_t MAX3421e< SS, INTR >::Task ( void  - ) + )
    -

    Definition at line 264 of file usbhost.h.

    +

    Definition at line 273 of file usbhost.h.

    @@ -471,7 +471,7 @@ template<typename SS , typename INTR > diff --git a/class_max___l_c_d-members.html b/class_max___l_c_d-members.html index 53fa69b9..f3789ff1 100644 --- a/class_max___l_c_d-members.html +++ b/class_max___l_c_d-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -116,7 +116,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 cbe491fa..1573bb47 100644 --- a/class_max___l_c_d.html +++ b/class_max___l_c_d.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Max_LCD Class Reference @@ -31,7 +31,7 @@ - + @@ -150,7 +150,7 @@ Public Member Functions Max_LCD::Max_LCD ( USB *  - pusb) + pusb) @@ -168,7 +168,7 @@ Public Member Functions void Max_LCD::init ( - ) + ) @@ -219,7 +219,7 @@ Public Member Functions void Max_LCD::clear ( - ) + ) @@ -236,7 +236,7 @@ Public Member Functions void Max_LCD::home ( - ) + ) @@ -253,7 +253,7 @@ Public Member Functions void Max_LCD::noDisplay ( - ) + ) @@ -270,7 +270,7 @@ Public Member Functions void Max_LCD::display ( - ) + ) @@ -287,7 +287,7 @@ Public Member Functions void Max_LCD::noBlink ( - ) + ) @@ -304,7 +304,7 @@ Public Member Functions void Max_LCD::blink ( - ) + ) @@ -321,7 +321,7 @@ Public Member Functions void Max_LCD::noCursor ( - ) + ) @@ -338,7 +338,7 @@ Public Member Functions void Max_LCD::cursor ( - ) + ) @@ -356,7 +356,7 @@ Public Member Functions void Max_LCD::scrollDisplayLeft ( void  - ) + ) @@ -374,7 +374,7 @@ Public Member Functions void Max_LCD::scrollDisplayRight ( void  - ) + ) @@ -392,7 +392,7 @@ Public Member Functions void Max_LCD::leftToRight ( void  - ) + ) @@ -410,7 +410,7 @@ Public Member Functions void Max_LCD::rightToLeft ( void  - ) + ) @@ -428,7 +428,7 @@ Public Member Functions void Max_LCD::autoscroll ( void  - ) + ) @@ -446,7 +446,7 @@ Public Member Functions void Max_LCD::noAutoscroll ( void  - ) + ) @@ -523,7 +523,7 @@ Public Member Functions void Max_LCD::write ( uint8_t  - value) + value) @@ -549,7 +549,7 @@ Public Member Functions void Max_LCD::command ( uint8_t  - value) + value) @@ -573,7 +573,7 @@ Public Member Functions diff --git a/class_mouse_report_parser-members.html b/class_mouse_report_parser-members.html index d13aaa5e..879dcdf2 100644 --- a/class_mouse_report_parser-members.html +++ b/class_mouse_report_parser-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_mouse_report_parser.html b/class_mouse_report_parser.html index a0a0ed8b..248dee39 100644 --- a/class_mouse_report_parser.html +++ b/class_mouse_report_parser.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: MouseReportParser Class Reference @@ -31,7 +31,7 @@ - + @@ -195,7 +195,7 @@ Protected Member Functions virtual void MouseReportParser::OnMouseMove ( MOUSEINFO *  - mi) + mi) @@ -221,7 +221,7 @@ Protected Member Functions virtual void MouseReportParser::OnLeftButtonUp ( MOUSEINFO *  - mi) + mi) @@ -247,7 +247,7 @@ Protected Member Functions virtual void MouseReportParser::OnLeftButtonDown ( MOUSEINFO *  - mi) + mi) @@ -273,7 +273,7 @@ Protected Member Functions virtual void MouseReportParser::OnRightButtonUp ( MOUSEINFO *  - mi) + mi) @@ -299,7 +299,7 @@ Protected Member Functions virtual void MouseReportParser::OnRightButtonDown ( MOUSEINFO *  - mi) + mi) @@ -325,7 +325,7 @@ Protected Member Functions virtual void MouseReportParser::OnMiddleButtonUp ( MOUSEINFO *  - mi) + mi) @@ -351,7 +351,7 @@ Protected Member Functions virtual void MouseReportParser::OnMiddleButtonDown ( MOUSEINFO *  - mi) + mi) @@ -404,7 +404,7 @@ Protected Member Functions diff --git a/class_multi_byte_value_parser-members.html b/class_multi_byte_value_parser-members.html index 80d2ba64..ce13234a 100644 --- a/class_multi_byte_value_parser-members.html +++ b/class_multi_byte_value_parser-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -99,7 +99,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 f990365f..6972fb02 100644 --- a/class_multi_byte_value_parser.html +++ b/class_multi_byte_value_parser.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: MultiByteValueParser Class Reference @@ -31,7 +31,7 @@ - + @@ -118,7 +118,7 @@ Public Member Functions MultiByteValueParser::MultiByteValueParser ( - ) + ) @@ -144,7 +144,7 @@ Public Member Functions const uint8_t* MultiByteValueParser::GetBuffer ( - ) + ) @@ -170,7 +170,7 @@ Public Member Functions void MultiByteValueParser::Initialize ( MultiValueBuffer *const  - pbuf) + pbuf) @@ -222,7 +222,7 @@ Public Member Functions diff --git a/class_p_l2303-members.html b/class_p_l2303-members.html index 7b666aa9..172632f4 100644 --- a/class_p_l2303-members.html +++ b/class_p_l2303-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -98,37 +98,38 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); bNumEPACMprotected bPollEnableACMprotected ClearCommFeature(uint16_t fid)ACM - EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)ACMvirtual - epDataInIndexACMprotectedstatic - epDataOutIndexACMprotectedstatic - epInfoACMprotected - epInterruptInIndexACMprotectedstatic - GetAddress()ACMinlinevirtual - GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM - GetLineCoding(LINE_CODING *dataptr)ACM - GetNotif(uint16_t *bytes_rcvd, uint8_t *dataptr)ACM - Init(uint8_t parent, uint8_t port, bool lowspeed)PL2303virtual - isReady()ACMinlinevirtual - pAsyncACMprotected - PL2303(USB *pusb, CDCAsyncOper *pasync)PL2303 - Poll()ACMvirtual - PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)ACMprotected - pUsbACMprotected - qNextPollTimeACMprotected - RcvData(uint16_t *nbytesptr, uint8_t *dataptr)ACM - readyACMprotected - Release()ACMvirtual - SendBreak(uint16_t duration)ACM - SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM - SetControlLineState(uint8_t state)ACM - SetLineCoding(const LINE_CODING *dataptr)ACM - SndData(uint16_t nbytes, uint8_t *dataptr)ACM + ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual + EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)ACMvirtual + epDataInIndexACMprotectedstatic + epDataOutIndexACMprotectedstatic + epInfoACMprotected + epInterruptInIndexACMprotectedstatic + GetAddress()ACMinlinevirtual + GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM + GetLineCoding(LINE_CODING *dataptr)ACM + GetNotif(uint16_t *bytes_rcvd, uint8_t *dataptr)ACM + Init(uint8_t parent, uint8_t port, bool lowspeed)PL2303virtual + isReady()ACMinlinevirtual + pAsyncACMprotected + PL2303(USB *pusb, CDCAsyncOper *pasync)PL2303 + Poll()ACMvirtual + PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)ACMprotected + pUsbACMprotected + qNextPollTimeACMprotected + RcvData(uint16_t *nbytesptr, uint8_t *dataptr)ACM + readyACMprotected + Release()ACMvirtual + SendBreak(uint16_t duration)ACM + SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr)ACM + SetControlLineState(uint8_t state)ACM + SetLineCoding(const LINE_CODING *dataptr)ACM + SndData(uint16_t nbytes, uint8_t *dataptr)ACM diff --git a/class_p_l2303.html b/class_p_l2303.html index e9dc025a..67eccfd2 100644 --- a/class_p_l2303.html +++ b/class_p_l2303.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PL2303 Class Reference @@ -31,7 +31,7 @@ - + @@ -146,6 +146,9 @@ Public Member Functions   virtual void EndpointXtract (uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)   +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  @@ -269,7 +272,7 @@ Additional Inherited Members diff --git a/class_p_s3_b_t-members.html b/class_p_s3_b_t-members.html index a99618e7..bb0cd342 100644 --- a/class_p_s3_b_t-members.html +++ b/class_p_s3_b_t-members.html @@ -3,7 +3,7 @@ - +USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@

    Additional Inherited Members

    - + @@ -124,7 +124,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 68dce4da..f6359cee 100644 --- a/class_p_s3_b_t.html +++ b/class_p_s3_b_t.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3BT Class Reference @@ -31,7 +31,7 @@ - + @@ -258,7 +258,7 @@ Public Attributes void PS3BT::ACLData ( uint8_t *  - ACLData) + ACLData) @@ -292,7 +292,7 @@ Public Attributes void PS3BT::Run ( - ) + ) @@ -320,7 +320,7 @@ Public Attributes void PS3BT::Reset ( - ) + ) @@ -348,7 +348,7 @@ Public Attributes void PS3BT::disconnect ( - ) + ) @@ -374,7 +374,7 @@ Public Attributes bool PS3BT::getButtonPress ( Button  - b) + b) @@ -395,7 +395,7 @@ Public Attributes bool PS3BT::getButtonClick ( Button  - b) + b) @@ -416,7 +416,7 @@ Public Attributes uint8_t PS3BT::getAnalogButton ( Button  - a) + a) @@ -442,7 +442,7 @@ Public Attributes uint8_t PS3BT::getAnalogHat ( AnalogHat  - a) + a) @@ -468,7 +468,7 @@ Public Attributes int16_t PS3BT::getSensor ( Sensor  - a) + a) @@ -494,7 +494,7 @@ Public Attributes double PS3BT::getAngle ( Angle  - a) + a) @@ -520,7 +520,7 @@ Public Attributes double PS3BT::get9DOFValues ( Sensor  - a) + a) @@ -546,7 +546,7 @@ Public Attributes bool PS3BT::getStatus ( Status  - c) + c) @@ -571,7 +571,7 @@ Public Attributes String PS3BT::getStatusString ( - ) + ) @@ -590,7 +590,7 @@ Public Attributes String PS3BT::getTemperature ( - ) + ) @@ -609,7 +609,7 @@ Public Attributes void PS3BT::setAllOff ( - ) + ) @@ -627,7 +627,7 @@ Public Attributes void PS3BT::setRumbleOff ( - ) + ) @@ -646,7 +646,7 @@ Public Attributes void PS3BT::setRumbleOn ( Rumble  - mode) + mode) @@ -721,7 +721,7 @@ Public Attributes void PS3BT::setLedRaw ( uint8_t  - value) + value) @@ -746,7 +746,7 @@ Public Attributes void PS3BT::setLedOff ( LED  - a) + a) @@ -771,7 +771,7 @@ Public Attributes void PS3BT::setLedOn ( LED  - a) + a) @@ -796,7 +796,7 @@ Public Attributes void PS3BT::setLedToggle ( LED  - a) + a) @@ -862,7 +862,7 @@ Public Attributes void PS3BT::moveSetBulb ( Colors  - color) + color) @@ -887,7 +887,7 @@ Public Attributes void PS3BT::moveSetRumble ( uint8_t  - rumble) + rumble) @@ -959,7 +959,7 @@ Public Attributes diff --git a/class_p_s3_u_s_b-members.html b/class_p_s3_u_s_b-members.html index b582725c..fa4dc5d9 100644 --- a/class_p_s3_u_s_b-members.html +++ b/class_p_s3_u_s_b-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -91,44 +91,45 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    This is the complete list of members for PS3USB, including all inherited members.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    bAddressPS3USBprotected
    epInfoPS3USBprotected
    GetAddress()PS3USBinlinevirtual
    getAnalogButton(Button a)PS3USB
    getAnalogHat(AnalogHat a)PS3USB
    getAngle(Angle a)PS3USB
    getButtonClick(Button b)PS3USB
    getButtonPress(Button b)PS3USB
    getSensor(Sensor a)PS3USB
    getStatus(Status c)PS3USB
    getStatusString()PS3USB
    Init(uint8_t parent, uint8_t port, bool lowspeed)PS3USBvirtual
    isReady()PS3USBinlinevirtual
    moveSetBulb(uint8_t r, uint8_t g, uint8_t b)PS3USB
    moveSetBulb(Colors color)PS3USB
    moveSetRumble(uint8_t rumble)PS3USB
    Poll()PS3USBvirtual
    PS3ConnectedPS3USB
    PS3MoveConnectedPS3USB
    PS3NavigationConnectedPS3USB
    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)PS3USB
    pUsbPS3USBprotected
    Release()PS3USBvirtual
    setAllOff()PS3USB
    setBdaddr(uint8_t *BDADDR)PS3USB
    setLedOff(LED a)PS3USB
    setLedOn(LED a)PS3USB
    setLedRaw(uint8_t value)PS3USB
    setLedToggle(LED a)PS3USB
    setMoveBdaddr(uint8_t *BDADDR)PS3USB
    setRumbleOff()PS3USB
    setRumbleOn(Rumble mode)PS3USB
    setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)PS3USB
    ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual
    epInfoPS3USBprotected
    GetAddress()PS3USBinlinevirtual
    getAnalogButton(Button a)PS3USB
    getAnalogHat(AnalogHat a)PS3USB
    getAngle(Angle a)PS3USB
    getButtonClick(Button b)PS3USB
    getButtonPress(Button b)PS3USB
    getSensor(Sensor a)PS3USB
    getStatus(Status c)PS3USB
    getStatusString()PS3USB
    Init(uint8_t parent, uint8_t port, bool lowspeed)PS3USBvirtual
    isReady()PS3USBinlinevirtual
    moveSetBulb(uint8_t r, uint8_t g, uint8_t b)PS3USB
    moveSetBulb(Colors color)PS3USB
    moveSetRumble(uint8_t rumble)PS3USB
    Poll()PS3USBvirtual
    PS3ConnectedPS3USB
    PS3MoveConnectedPS3USB
    PS3NavigationConnectedPS3USB
    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)PS3USB
    pUsbPS3USBprotected
    Release()PS3USBvirtual
    setAllOff()PS3USB
    setBdaddr(uint8_t *BDADDR)PS3USB
    setLedOff(LED a)PS3USB
    setLedOn(LED a)PS3USB
    setLedRaw(uint8_t value)PS3USB
    setLedToggle(LED a)PS3USB
    setMoveBdaddr(uint8_t *BDADDR)PS3USB
    setRumbleOff()PS3USB
    setRumbleOn(Rumble mode)PS3USB
    setRumbleOn(uint8_t rightDuration, uint8_t rightPower, uint8_t leftDuration, uint8_t leftPower)PS3USB
    diff --git a/class_p_s3_u_s_b.html b/class_p_s3_u_s_b.html index f5e24de3..f2f8126f 100644 --- a/class_p_s3_u_s_b.html +++ b/class_p_s3_u_s_b.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PS3USB Class Reference @@ -31,7 +31,7 @@ - + @@ -167,6 +167,9 @@ Public Member Functions   void moveSetRumble (uint8_t rumble)   +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  @@ -324,7 +327,7 @@ Protected Attributes - +

    Public Attributes

    uint8_t PS3USB::Release ())
    @@ -339,7 +342,7 @@ Protected Attributes

    Implements USBDeviceConfig.

    -

    Definition at line 248 of file PS3USB.cpp.

    +

    Definition at line 255 of file PS3USB.cpp.

    @@ -353,7 +356,7 @@ Protected Attributes uint8_t PS3USB::Poll ( - ) + ) @@ -368,7 +371,7 @@ Protected Attributes

    Implements USBDeviceConfig.

    -

    Definition at line 258 of file PS3USB.cpp.

    +

    Definition at line 265 of file PS3USB.cpp.

    @@ -382,7 +385,7 @@ Protected Attributes virtual uint8_t PS3USB::GetAddress ( - ) + ) @@ -411,7 +414,7 @@ Protected Attributes virtual bool PS3USB::isReady ( - ) + ) @@ -436,7 +439,7 @@ Protected Attributes void PS3USB::setBdaddr ( uint8_t *  - BDADDR) + BDADDR) @@ -449,7 +452,7 @@ Protected Attributes -

    Definition at line 464 of file PS3USB.cpp.

    +

    Definition at line 474 of file PS3USB.cpp.

    @@ -461,7 +464,7 @@ Protected Attributes void PS3USB::setMoveBdaddr ( uint8_t *  - BDADDR) + BDADDR) @@ -474,7 +477,7 @@ Protected Attributes -

    Definition at line 516 of file PS3USB.cpp.

    +

    Definition at line 526 of file PS3USB.cpp.

    @@ -486,7 +489,7 @@ Protected Attributes bool PS3USB::getButtonPress ( Button  - b) + b) @@ -495,7 +498,7 @@ Protected Attributes

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

    -

    Definition at line 308 of file PS3USB.cpp.

    +

    Definition at line 315 of file PS3USB.cpp.

    @@ -507,7 +510,7 @@ Protected Attributes bool PS3USB::getButtonClick ( Button  - b) + b) @@ -516,7 +519,7 @@ Protected Attributes

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

    -

    Definition at line 312 of file PS3USB.cpp.

    +

    Definition at line 319 of file PS3USB.cpp.

    @@ -528,7 +531,7 @@ Protected Attributes uint8_t PS3USB::getAnalogButton ( Button  - a) + a) @@ -542,7 +545,7 @@ Protected Attributes
    Returns
    Analog value in the range of 0-255.
    -

    Definition at line 319 of file PS3USB.cpp.

    +

    Definition at line 326 of file PS3USB.cpp.

    @@ -554,7 +557,7 @@ Protected Attributes uint8_t PS3USB::getAnalogHat ( AnalogHat  - a) + a) @@ -568,7 +571,7 @@ Protected Attributes
    Returns
    Return the analog value in the range of 0-255.
    -

    Definition at line 325 of file PS3USB.cpp.

    +

    Definition at line 332 of file PS3USB.cpp.

    @@ -580,7 +583,7 @@ Protected Attributes uint16_t PS3USB::getSensor ( Sensor  - a) + a) @@ -594,7 +597,7 @@ Protected Attributes
    Returns
    Return the raw sensor value.
    -

    Definition at line 331 of file PS3USB.cpp.

    +

    Definition at line 338 of file PS3USB.cpp.

    @@ -606,7 +609,7 @@ Protected Attributes double PS3USB::getAngle ( Angle  - a) + a) @@ -620,7 +623,7 @@ Protected Attributes
    Returns
    Return the angle in the range of 0-360.
    -

    Definition at line 337 of file PS3USB.cpp.

    +

    Definition at line 344 of file PS3USB.cpp.

    @@ -632,7 +635,7 @@ Protected Attributes bool PS3USB::getStatus ( Status  - c) + c) @@ -646,7 +649,7 @@ Protected Attributes
    Returns
    True if correct and false if not.
    -

    Definition at line 363 of file PS3USB.cpp.

    +

    Definition at line 370 of file PS3USB.cpp.

    @@ -657,7 +660,7 @@ Protected Attributes String PS3USB::getStatusString ( - ) + ) @@ -665,7 +668,7 @@ Protected Attributes

    Read all the available Status from the controller.

    Returns
    One large string with all the information.
    -

    Definition at line 371 of file PS3USB.cpp.

    +

    Definition at line 378 of file PS3USB.cpp.

    @@ -676,14 +679,14 @@ Protected Attributes void PS3USB::setAllOff ( - ) + )

    Used to set all LEDs and Rumble off.

    -

    Definition at line 412 of file PS3USB.cpp.

    +

    Definition at line 419 of file PS3USB.cpp.

    @@ -694,14 +697,14 @@ Protected Attributes void PS3USB::setRumbleOff ( - ) + )

    Turn off Rumble.

    -

    Definition at line 419 of file PS3USB.cpp.

    +

    Definition at line 426 of file PS3USB.cpp.

    @@ -713,7 +716,7 @@ Protected Attributes void PS3USB::setRumbleOn ( Rumble  - mode) + mode) @@ -726,7 +729,7 @@ Protected Attributes -

    Definition at line 428 of file PS3USB.cpp.

    +

    Definition at line 435 of file PS3USB.cpp.

    @@ -776,7 +779,7 @@ Protected Attributes -

    Definition at line 439 of file PS3USB.cpp.

    +

    Definition at line 446 of file PS3USB.cpp.

    @@ -788,7 +791,7 @@ Protected Attributes void PS3USB::setLedRaw ( uint8_t  - value) + value) @@ -801,7 +804,7 @@ Protected Attributes -

    Definition at line 447 of file PS3USB.cpp.

    +

    Definition at line 454 of file PS3USB.cpp.

    @@ -813,7 +816,7 @@ Protected Attributes void PS3USB::setLedOff ( LED  - a) + a) @@ -826,7 +829,7 @@ Protected Attributes -

    Definition at line 451 of file PS3USB.cpp.

    +

    Definition at line 459 of file PS3USB.cpp.

    @@ -838,7 +841,7 @@ Protected Attributes void PS3USB::setLedOn ( LED  - a) + a) @@ -851,7 +854,7 @@ Protected Attributes -

    Definition at line 455 of file PS3USB.cpp.

    +

    Definition at line 464 of file PS3USB.cpp.

    @@ -863,7 +866,7 @@ Protected Attributes void PS3USB::setLedToggle ( LED  - a) + a) @@ -876,7 +879,7 @@ Protected Attributes -

    Definition at line 459 of file PS3USB.cpp.

    +

    Definition at line 469 of file PS3USB.cpp.

    @@ -917,7 +920,7 @@ Protected Attributes -

    Definition at line 492 of file PS3USB.cpp.

    +

    Definition at line 502 of file PS3USB.cpp.

    @@ -929,7 +932,7 @@ Protected Attributes void PS3USB::moveSetBulb ( Colors  - color) + color) @@ -942,7 +945,7 @@ Protected Attributes -

    Definition at line 501 of file PS3USB.cpp.

    +

    Definition at line 511 of file PS3USB.cpp.

    @@ -954,7 +957,7 @@ Protected Attributes void PS3USB::moveSetRumble ( uint8_t  - rumble) + rumble) @@ -967,7 +970,7 @@ Protected Attributes -

    Definition at line 505 of file PS3USB.cpp.

    +

    Definition at line 515 of file PS3USB.cpp.

    @@ -1095,7 +1098,7 @@ Protected Attributes diff --git a/class_p_t_p_list_parser-members.html b/class_p_t_p_list_parser-members.html index c159ed64..c60a5df6 100644 --- a/class_p_t_p_list_parser-members.html +++ b/class_p_t_p_list_parser-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -101,7 +101,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 b8b01ea6..14b34dc0 100644 --- a/class_p_t_p_list_parser.html +++ b/class_p_t_p_list_parser.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: PTPListParser Class Reference @@ -31,7 +31,7 @@ - + @@ -145,7 +145,7 @@ Public Member Functions PTPListParser::PTPListParser ( - ) + ) @@ -258,7 +258,7 @@ Public Member Functions diff --git a/class_report_desc_parser-members.html b/class_report_desc_parser-members.html index 9c479ed4..fff33fde 100644 --- a/class_report_desc_parser-members.html +++ b/class_report_desc_parser-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -184,7 +184,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_report_desc_parser.html b/class_report_desc_parser.html index 158ee5a5..735e7eae 100644 --- a/class_report_desc_parser.html +++ b/class_report_desc_parser.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: ReportDescParser Class Reference @@ -31,7 +31,7 @@ - + @@ -305,7 +305,7 @@ Additional Inherited Members diff --git a/class_report_desc_parser2-members.html b/class_report_desc_parser2-members.html index e616c44e..dea00f90 100644 --- a/class_report_desc_parser2-members.html +++ b/class_report_desc_parser2-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -185,7 +185,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_report_desc_parser2.html b/class_report_desc_parser2.html index 5bbbf322..d466bc25 100644 --- a/class_report_desc_parser2.html +++ b/class_report_desc_parser2.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: ReportDescParser2 Class Reference @@ -31,7 +31,7 @@ - + @@ -392,7 +392,7 @@ Additional Inherited Members diff --git a/class_report_desc_parser_base-members.html b/class_report_desc_parser_base-members.html index 9a3e2582..d6b9485f 100644 --- a/class_report_desc_parser_base-members.html +++ b/class_report_desc_parser_base-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -184,7 +184,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 00b31c13..32c9cd7d 100644 --- a/class_report_desc_parser_base.html +++ b/class_report_desc_parser_base.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: ReportDescParserBase Class Reference @@ -31,7 +31,7 @@ - + @@ -367,7 +367,7 @@ Static Protected Attributes ReportDescParserBase::ReportDescParserBase ( - ) + ) @@ -394,7 +394,7 @@ Static Protected Attributes void ReportDescParserBase::PrintGenericDesktopPageUsage ( uint16_t  - usage) + usage) @@ -420,7 +420,7 @@ Static Protected Attributes void ReportDescParserBase::PrintSimulationControlsPageUsage ( uint16_t  - usage) + usage) @@ -446,7 +446,7 @@ Static Protected Attributes void ReportDescParserBase::PrintVRControlsPageUsage ( uint16_t  - usage) + usage) @@ -472,7 +472,7 @@ Static Protected Attributes void ReportDescParserBase::PrintSportsControlsPageUsage ( uint16_t  - usage) + usage) @@ -498,7 +498,7 @@ Static Protected Attributes void ReportDescParserBase::PrintGameControlsPageUsage ( uint16_t  - usage) + usage) @@ -524,7 +524,7 @@ Static Protected Attributes void ReportDescParserBase::PrintGenericDeviceControlsPageUsage ( uint16_t  - usage) + usage) @@ -550,7 +550,7 @@ Static Protected Attributes void ReportDescParserBase::PrintLEDPageUsage ( uint16_t  - usage) + usage) @@ -576,7 +576,7 @@ Static Protected Attributes void ReportDescParserBase::PrintButtonPageUsage ( uint16_t  - usage) + usage) @@ -602,7 +602,7 @@ Static Protected Attributes void ReportDescParserBase::PrintOrdinalPageUsage ( uint16_t  - usage) + usage) @@ -628,7 +628,7 @@ Static Protected Attributes void ReportDescParserBase::PrintTelephonyPageUsage ( uint16_t  - usage) + usage) @@ -654,7 +654,7 @@ Static Protected Attributes void ReportDescParserBase::PrintConsumerPageUsage ( uint16_t  - usage) + usage) @@ -680,7 +680,7 @@ Static Protected Attributes void ReportDescParserBase::PrintDigitizerPageUsage ( uint16_t  - usage) + usage) @@ -706,7 +706,7 @@ Static Protected Attributes void ReportDescParserBase::PrintAlphanumDisplayPageUsage ( uint16_t  - usage) + usage) @@ -732,7 +732,7 @@ Static Protected Attributes void ReportDescParserBase::PrintMedicalInstrumentPageUsage ( uint16_t  - usage) + usage) @@ -794,7 +794,7 @@ Static Protected Attributes void ReportDescParserBase::PrintByteValue ( uint8_t  - data) + data) @@ -820,7 +820,7 @@ Static Protected Attributes void ReportDescParserBase::PrintItemTitle ( uint8_t  - prefix) + prefix) @@ -884,7 +884,7 @@ Static Protected Attributes void ReportDescParserBase::PrintUsagePage ( uint16_t  - page) + page) @@ -910,7 +910,7 @@ Static Protected Attributes void ReportDescParserBase::SetUsagePage ( uint16_t  - page) + page) @@ -2903,7 +2903,7 @@ Static Protected Attributes diff --git a/class_s_p_p-members.html b/class_s_p_p-members.html index 786242c0..39e3be19 100644 --- a/class_s_p_p-members.html +++ b/class_s_p_p-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_s_p_p.html b/class_s_p_p.html index f4194ec5..b301cbab 100644 --- a/class_s_p_p.html +++ b/class_s_p_p.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: SPP Class Reference @@ -31,7 +31,7 @@ - + @@ -203,7 +203,7 @@ Public Attributes SPP::operator bool ( - ) + ) @@ -231,7 +231,7 @@ Public Attributes void SPP::ACLData ( uint8_t *  - ACLData) + ACLData) @@ -265,7 +265,7 @@ Public Attributes void SPP::Run ( - ) + ) @@ -279,7 +279,7 @@ Public Attributes

    Reimplemented from BluetoothService.

    -

    Definition at line 410 of file SPP.cpp.

    +

    Definition at line 416 of file SPP.cpp.

    @@ -293,7 +293,7 @@ Public Attributes void SPP::Reset ( - ) + ) @@ -321,7 +321,7 @@ Public Attributes void SPP::disconnect ( - ) + ) @@ -350,7 +350,7 @@ Public Attributes int SPP::available ( void  - ) + ) @@ -363,7 +363,7 @@ Public Attributes

    Get number of bytes waiting to be read.

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

    Definition at line 773 of file SPP.cpp.

    +

    Definition at line 779 of file SPP.cpp.

    @@ -378,7 +378,7 @@ Public Attributes void SPP::flush ( void  - ) + ) @@ -390,7 +390,7 @@ Public Attributes

    Discard all the bytes in the buffer.

    -

    Definition at line 777 of file SPP.cpp.

    +

    Definition at line 783 of file SPP.cpp.

    @@ -405,7 +405,7 @@ Public Attributes int SPP::peek ( void  - ) + ) @@ -418,7 +418,7 @@ Public Attributes

    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 781 of file SPP.cpp.

    +

    Definition at line 787 of file SPP.cpp.

    @@ -433,7 +433,7 @@ Public Attributes int SPP::read ( void  - ) + ) @@ -446,7 +446,7 @@ Public Attributes

    Used to read the buffer.

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

    Definition at line 787 of file SPP.cpp.

    +

    Definition at line 793 of file SPP.cpp.

    @@ -461,7 +461,7 @@ Public Attributes size_t SPP::write ( uint8_t  - data) + data) @@ -480,7 +480,7 @@ Public Attributes
    Returns
    Return the number of bytes written.
    -

    Definition at line 732 of file SPP.cpp.

    +

    Definition at line 738 of file SPP.cpp.

    @@ -525,7 +525,7 @@ Public Attributes
    Returns
    Return the number of bytes written.
    -

    Definition at line 736 of file SPP.cpp.

    +

    Definition at line 742 of file SPP.cpp.

    @@ -537,14 +537,14 @@ Public Attributes void SPP::send ( void  - ) + )

    This will send all the bytes in the buffer. This is called whenever Usb.Task() is called, but can also be called via this function.

    -

    Definition at line 745 of file SPP.cpp.

    +

    Definition at line 751 of file SPP.cpp.

    @@ -573,7 +573,7 @@ Public Attributes diff --git a/class_s_pi-members.html b/class_s_pi-members.html index e7e1c065..d03de11f 100644 --- a/class_s_pi-members.html +++ b/class_s_pi-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_s_pi.html b/class_s_pi.html index ce5bba50..150a3dd1 100644 --- a/class_s_pi.html +++ b/class_s_pi.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: SPi< CLK, MOSI, MISO, SPI_SS > Class Template Reference @@ -31,7 +31,7 @@ - + @@ -117,7 +117,7 @@ template<typename CLK , typename MOSI , typename MISO , typename SPI_SS > static void SPi< CLK, MOSI, MISO, SPI_SS >::init ( - ) + ) @@ -140,7 +140,7 @@ template<typename CLK , typename MOSI , typename MISO , typename SPI_SS > diff --git a/class_t_com-members.html b/class_t_com-members.html index cc9d2667..fb065243 100644 --- a/class_t_com-members.html +++ b/class_t_com-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_t_com.html b/class_t_com.html index 0e58a5a4..68e02072 100644 --- a/class_t_com.html +++ b/class_t_com.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: TCom< TCCR, COM > Class Template Reference @@ -31,7 +31,7 @@ - + @@ -168,7 +168,7 @@ template<typename TCCR , uint8_t COM> static void TCom< TCCR, COM >::Set ( - ) + ) @@ -195,7 +195,7 @@ template<typename TCCR , uint8_t COM> static void TCom< TCCR, COM >::Clear ( - ) + ) @@ -222,7 +222,7 @@ template<typename TCCR , uint8_t COM> static void TCom< TCCR, COM >::Toggle ( - ) + ) @@ -245,7 +245,7 @@ template<typename TCCR , uint8_t COM> diff --git a/class_t_pin-members.html b/class_t_pin-members.html index f613b451..9bb4ac83 100644 --- a/class_t_pin-members.html +++ b/class_t_pin-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_t_pin.html b/class_t_pin.html index 459b5848..62a99d3b 100644 --- a/class_t_pin.html +++ b/class_t_pin.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: TPin< PORT, PIN > Class Template Reference @@ -31,7 +31,7 @@ - + @@ -182,7 +182,7 @@ template<typename PORT , uint8_t PIN> static void TPin< PORT, PIN >::Set ( - ) + ) @@ -210,7 +210,7 @@ template<typename PORT , uint8_t PIN> static void TPin< PORT, PIN >::Set ( uint8_t  - val) + val) @@ -238,7 +238,7 @@ template<typename PORT , uint8_t PIN> static void TPin< PORT, PIN >::SetDir ( uint8_t  - val) + val) @@ -265,7 +265,7 @@ template<typename PORT , uint8_t PIN> static void TPin< PORT, PIN >::Clear ( - ) + ) @@ -292,7 +292,7 @@ template<typename PORT , uint8_t PIN> static void TPin< PORT, PIN >::Toggle ( - ) + ) @@ -319,7 +319,7 @@ template<typename PORT , uint8_t PIN> static void TPin< PORT, PIN >::SetDirRead ( - ) + ) @@ -346,7 +346,7 @@ template<typename PORT , uint8_t PIN> static void TPin< PORT, PIN >::SetDirWrite ( - ) + ) @@ -373,7 +373,7 @@ template<typename PORT , uint8_t PIN> static uint8_t TPin< PORT, PIN >::IsSet ( - ) + ) @@ -400,7 +400,7 @@ template<typename PORT , uint8_t PIN> static void TPin< PORT, PIN >::WaiteForSet ( - ) + ) @@ -427,7 +427,7 @@ template<typename PORT , uint8_t PIN> static void TPin< PORT, PIN >::WaiteForClear ( - ) + ) @@ -450,7 +450,7 @@ template<typename PORT , uint8_t PIN> diff --git a/class_tp___tc-members.html b/class_tp___tc-members.html index 669e087a..8539c2b4 100644 --- a/class_tp___tc-members.html +++ b/class_tp___tc-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_tp___tc.html b/class_tp___tc.html index 63135adc..f93a14f9 100644 --- a/class_tp___tc.html +++ b/class_tp___tc.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Tp_Tc< Tp_pin, Tc_bit > Class Template Reference @@ -31,7 +31,7 @@ - + @@ -122,7 +122,7 @@ template<typename Tp_pin , typename Tc_bit > static void Tp_Tc< Tp_pin, Tc_bit >::SetDir ( uint8_t  - val) + val) @@ -149,7 +149,7 @@ template<typename Tp_pin , typename Tc_bit > static void Tp_Tc< Tp_pin, Tc_bit >::SetDirRead ( - ) + ) @@ -176,7 +176,7 @@ template<typename Tp_pin , typename Tc_bit > static void Tp_Tc< Tp_pin, Tc_bit >::SetDirWrite ( - ) + ) @@ -199,7 +199,7 @@ template<typename Tp_pin , typename Tc_bit > diff --git a/class_u_s_b-members.html b/class_u_s_b-members.html index de06c21b..0178d7ac 100644 --- a/class_u_s_b-members.html +++ b/class_u_s_b-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_u_s_b.html b/class_u_s_b.html index 1facf819..6edf9f6c 100644 --- a/class_u_s_b.html +++ b/class_u_s_b.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: USB Class Reference @@ -31,7 +31,7 @@ - + @@ -194,7 +194,7 @@ Public Member Functions

    Detailed Description

    -

    Definition at line 179 of file Usb.h.

    +

    Definition at line 186 of file Usb.h.

    Constructor & Destructor Documentation

    @@ -204,7 +204,7 @@ Public Member Functions USB::USB ( void  - ) + ) @@ -225,7 +225,7 @@ Public Member Functions void USB::SetHubPreMask ( - ) + ) @@ -236,7 +236,7 @@ Public Member Functions
    -

    Definition at line 188 of file Usb.h.

    +

    Definition at line 195 of file Usb.h.

    @@ -250,7 +250,7 @@ Public Member Functions void USB::ResetHubPreMask ( - ) + ) @@ -261,7 +261,7 @@ Public Member Functions
    -

    Definition at line 192 of file Usb.h.

    +

    Definition at line 199 of file Usb.h.

    @@ -275,7 +275,7 @@ Public Member Functions AddressPool& USB::GetAddressPool ( - ) + ) @@ -286,7 +286,7 @@ Public Member Functions
    -

    Definition at line 196 of file Usb.h.

    +

    Definition at line 203 of file Usb.h.

    @@ -301,7 +301,7 @@ Public Member Functions uint8_t USB::RegisterDeviceClass ( USBDeviceConfig *  - pdev) + pdev) @@ -312,7 +312,7 @@ Public Member Functions
    -

    Definition at line 200 of file Usb.h.

    +

    Definition at line 207 of file Usb.h.

    @@ -327,7 +327,7 @@ Public Member Functions void USB::ForEachUsbDevice ( UsbDeviceHandleFunc  - pfunc) + pfunc) @@ -338,7 +338,7 @@ Public Member Functions
    -

    Definition at line 210 of file Usb.h.

    +

    Definition at line 217 of file Usb.h.

    @@ -350,7 +350,7 @@ Public Member Functions uint8_t USB::getUsbTaskState ( void  - ) + ) @@ -368,7 +368,7 @@ Public Member Functions void USB::setUsbTaskState ( uint8_t  - state) + state) @@ -478,7 +478,7 @@ Public Member Functions

    defined(USB_METHODS_INLINE)

    -

    Definition at line 576 of file Usb.cpp.

    +

    Definition at line 663 of file Usb.cpp.

    @@ -524,7 +524,7 @@ Public Member Functions
    -

    Definition at line 581 of file Usb.cpp.

    +

    Definition at line 668 of file Usb.cpp.

    @@ -564,7 +564,7 @@ Public Member Functions
    -

    Definition at line 585 of file Usb.cpp.

    +

    Definition at line 672 of file Usb.cpp.

    @@ -616,7 +616,7 @@ Public Member Functions
    -

    Definition at line 603 of file Usb.cpp.

    +

    Definition at line 690 of file Usb.cpp.

    @@ -650,7 +650,7 @@ Public Member Functions
    -

    Definition at line 608 of file Usb.cpp.

    +

    Definition at line 695 of file Usb.cpp.

    @@ -684,7 +684,7 @@ Public Member Functions
    -

    Definition at line 613 of file Usb.cpp.

    +

    Definition at line 700 of file Usb.cpp.

    @@ -800,7 +800,7 @@ Public Member Functions
    -

    Definition at line 203 of file Usb.cpp.

    +

    Definition at line 208 of file Usb.cpp.

    @@ -840,7 +840,7 @@ Public Member Functions
    -

    Definition at line 275 of file Usb.cpp.

    +

    Definition at line 292 of file Usb.cpp.

    @@ -874,7 +874,7 @@ Public Member Functions
    -

    Definition at line 350 of file Usb.cpp.

    +

    Definition at line 376 of file Usb.cpp.

    @@ -886,13 +886,13 @@ Public Member Functions void USB::Task ( void  - ) + )
    -

    Definition at line 398 of file Usb.cpp.

    +

    Definition at line 424 of file Usb.cpp.

    @@ -926,7 +926,7 @@ Public Member Functions
    -

    Definition at line 490 of file Usb.cpp.

    +

    Definition at line 526 of file Usb.cpp.

    @@ -960,7 +960,7 @@ Public Member Functions
    -

    Definition at line 530 of file Usb.cpp.

    +

    Definition at line 606 of file Usb.cpp.

    @@ -972,13 +972,13 @@ Public Member Functions uint8_t USB::ReleaseDevice ( uint8_t  - addr) + addr)
    -

    Definition at line 562 of file Usb.cpp.

    +

    Definition at line 649 of file Usb.cpp.

    @@ -1073,7 +1073,7 @@ Public Member Functions diff --git a/class_u_s_b_device_config-members.html b/class_u_s_b_device_config-members.html index 2e9e53d3..cc33f529 100644 --- a/class_u_s_b_device_config-members.html +++ b/class_u_s_b_device_config-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -90,16 +90,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    This is the complete list of members for USBDeviceConfig, including all inherited members.

    - - - - + + + + +
    GetAddress()=0USBDeviceConfigpure virtual
    Init(uint8_t parent, uint8_t port, bool lowspeed)=0USBDeviceConfigpure virtual
    Poll()=0USBDeviceConfigpure virtual
    Release()=0USBDeviceConfigpure virtual
    ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual
    GetAddress()=0USBDeviceConfigpure virtual
    Init(uint8_t parent, uint8_t port, bool lowspeed)=0USBDeviceConfigpure virtual
    Poll()=0USBDeviceConfigpure virtual
    Release()=0USBDeviceConfigpure virtual
    diff --git a/class_u_s_b_device_config.html b/class_u_s_b_device_config.html index bcd1eb8a..54cb10d7 100644 --- a/class_u_s_b_device_config.html +++ b/class_u_s_b_device_config.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: USBDeviceConfig Class Reference @@ -31,7 +31,7 @@ - + @@ -104,6 +104,8 @@ Inheritance diagram for USBDeviceConfig: Public Member Functions virtual uint8_t Init (uint8_t parent, uint8_t port, bool lowspeed)=0   +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  virtual uint8_t Release ()=0   virtual uint8_t Poll ()=0 @@ -113,7 +115,7 @@ Public Member Functions

    Detailed Description

    -

    Definition at line 110 of file Usb.h.

    +

    Definition at line 142 of file Usb.h.

    Member Function Documentation

    @@ -153,7 +155,51 @@ Public Member Functions
    -

    Implemented in BulkOnly, USBHub, HIDBoot< BOOT_PROTOCOL >, ACM, BTD, PL2303, FTDI, ADK, PS3USB, XBOXRECV, XBOXUSB, and HIDUniversal.

    +

    Implemented in BulkOnly, HIDBoot< BOOT_PROTOCOL >, USBHub, ACM, BTD, PL2303, FTDI, ADK, PS3USB, XBOXRECV, XBOXUSB, and HIDUniversal.

    + +
    + + +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    virtual uint8_t USBDeviceConfig::ConfigureDevice (uint8_t parent,
    uint8_t port,
    bool lowspeed 
    )
    +
    +inlinevirtual
    +
    + +

    Reimplemented in BulkOnly.

    + +

    Definition at line 145 of file Usb.h.

    @@ -167,7 +213,7 @@ Public Member Functions virtual uint8_t USBDeviceConfig::Release ( - ) + ) @@ -178,7 +224,7 @@ Public Member Functions
    -

    Implemented in BulkOnly, USBHub, HIDBoot< BOOT_PROTOCOL >, ACM, BTD, FTDI, ADK, PS3USB, XBOXRECV, XBOXUSB, and HIDUniversal.

    +

    Implemented in BulkOnly, HIDBoot< BOOT_PROTOCOL >, USBHub, ACM, BTD, FTDI, ADK, PS3USB, XBOXRECV, XBOXUSB, and HIDUniversal.

    @@ -192,7 +238,7 @@ Public Member Functions virtual uint8_t USBDeviceConfig::Poll ( - ) + ) @@ -203,7 +249,7 @@ Public Member Functions
    -

    Implemented in BulkOnly, USBHub, HIDBoot< BOOT_PROTOCOL >, ACM, BTD, FTDI, ADK, PS3USB, XBOXRECV, XBOXUSB, and HIDUniversal.

    +

    Implemented in BulkOnly, HIDBoot< BOOT_PROTOCOL >, USBHub, ACM, BTD, FTDI, ADK, PS3USB, XBOXRECV, XBOXUSB, and HIDUniversal.

    @@ -217,7 +263,7 @@ Public Member Functions virtual uint8_t USBDeviceConfig::GetAddress ( - ) + ) @@ -228,7 +274,7 @@ Public Member Functions
    -

    Implemented in BulkOnly, USBHub, HIDBoot< BOOT_PROTOCOL >, ACM, BTD, FTDI, ADK, PS3USB, XBOXRECV, XBOXUSB, and HIDUniversal.

    +

    Implemented in BulkOnly, HIDBoot< BOOT_PROTOCOL >, USBHub, ACM, BTD, FTDI, ADK, PS3USB, XBOXRECV, XBOXUSB, and HIDUniversal.

    @@ -240,7 +286,7 @@ Public Member Functions diff --git a/class_u_s_b_hub-members.html b/class_u_s_b_hub-members.html index 330e708f..22a670d8 100644 --- a/class_u_s_b_hub-members.html +++ b/class_u_s_b_hub-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -92,24 +92,25 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); - - - - - - - - - - - - + + + + + + + + + + + + +
    ClearHubFeature(uint8_t fid)USBHubinline
    ClearPortFeature(uint8_t fid, uint8_t port, uint8_t sel=0)USBHubinline
    GetAddress()USBHubinlinevirtual
    GetHubDescriptor(uint8_t index, uint16_t nbytes, uint8_t *dataptr)USBHubinline
    GetHubStatus(uint16_t nbytes, uint8_t *dataptr)USBHubinline
    GetPortStatus(uint8_t port, uint16_t nbytes, uint8_t *dataptr)USBHubinline
    Init(uint8_t parent, uint8_t port, bool lowspeed)USBHubvirtual
    Poll()USBHubvirtual
    PrintHubStatus()USBHub
    Release()USBHubvirtual
    SetHubDescriptor(uint8_t port, uint16_t nbytes, uint8_t *dataptr)USBHubinline
    SetHubFeature(uint8_t fid)USBHubinline
    SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel=0)USBHubinline
    USBHub(USB *p)USBHub
    ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlineprivatevirtual
    GetAddress()USBHubinlinevirtual
    GetHubDescriptor(uint8_t index, uint16_t nbytes, uint8_t *dataptr)USBHubinline
    GetHubStatus(uint16_t nbytes, uint8_t *dataptr)USBHubinline
    GetPortStatus(uint8_t port, uint16_t nbytes, uint8_t *dataptr)USBHubinline
    Init(uint8_t parent, uint8_t port, bool lowspeed)USBHubvirtual
    Poll()USBHubvirtual
    PrintHubStatus()USBHub
    Release()USBHubvirtual
    SetHubDescriptor(uint8_t port, uint16_t nbytes, uint8_t *dataptr)USBHubinline
    SetHubFeature(uint8_t fid)USBHubinline
    SetPortFeature(uint8_t fid, uint8_t port, uint8_t sel=0)USBHubinline
    USBHub(USB *p)USBHub
    diff --git a/class_u_s_b_hub.html b/class_u_s_b_hub.html index 76034490..61b3939d 100644 --- a/class_u_s_b_hub.html +++ b/class_u_s_b_hub.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: USBHub Class Reference @@ -31,7 +31,7 @@ - + @@ -137,6 +137,12 @@ Public Member Functions   virtual uint8_t GetAddress ()   + + + + +

    +Additional Inherited Members

    - Private Member Functions inherited from USBDeviceConfig
    virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed)
     

    Detailed Description

    @@ -150,7 +156,7 @@ Public Member Functions USBHub::USBHub ( USB *  - p) + p) @@ -172,7 +178,7 @@ Public Member Functions uint8_t USBHub::ClearHubFeature ( uint8_t  - fid) + fid) @@ -402,7 +408,7 @@ Public Member Functions uint8_t USBHub::SetHubFeature ( uint8_t  - fid) + fid) @@ -466,7 +472,7 @@ Public Member Functions void USBHub::PrintHubStatus ( - ) + ) @@ -528,7 +534,7 @@ Public Member Functions uint8_t USBHub::Release ( - ) + ) @@ -555,7 +561,7 @@ Public Member Functions uint8_t USBHub::Poll ( - ) + ) @@ -582,7 +588,7 @@ Public Member Functions virtual uint8_t USBHub::GetAddress ( - ) + ) @@ -608,7 +614,7 @@ Public Member Functions diff --git a/class_u_s_b_read_parser-members.html b/class_u_s_b_read_parser-members.html index 9295446e..b73fa1fd 100644 --- a/class_u_s_b_read_parser-members.html +++ b/class_u_s_b_read_parser-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@
    - + @@ -96,7 +96,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 e263f802..772a4ceb 100644 --- a/class_u_s_b_read_parser.html +++ b/class_u_s_b_read_parser.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: USBReadParser Class Reference @@ -31,7 +31,7 @@ - + @@ -107,7 +107,7 @@ Public Member Functions

    Detailed Description

    -

    Definition at line 174 of file Usb.h.

    +

    Definition at line 181 of file Usb.h.

    Member Function Documentation

    @@ -159,7 +159,7 @@ Public Member Functions diff --git a/class_universal_report_parser-members.html b/class_universal_report_parser-members.html index b881a05f..fff88568 100644 --- a/class_universal_report_parser-members.html +++ b/class_universal_report_parser-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@
    - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_universal_report_parser.html b/class_universal_report_parser.html index 8565c720..f596363e 100644 --- a/class_universal_report_parser.html +++ b/class_universal_report_parser.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: UniversalReportParser Class Reference @@ -31,7 +31,7 @@ - + @@ -175,7 +175,7 @@ Public Member Functions diff --git a/class_usb_config_xtracter-members.html b/class_usb_config_xtracter-members.html index 7f341837..9da88fb5 100644 --- a/class_usb_config_xtracter-members.html +++ b/class_usb_config_xtracter-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_usb_config_xtracter.html b/class_usb_config_xtracter.html index 2175e37d..d31b110a 100644 --- a/class_usb_config_xtracter.html +++ b/class_usb_config_xtracter.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: UsbConfigXtracter Class Reference @@ -31,7 +31,7 @@ - + @@ -171,7 +171,7 @@ Public Member Functions diff --git a/class_w_i_i-members.html b/class_w_i_i-members.html index 0a3442d0..552dfa87 100644 --- a/class_w_i_i-members.html +++ b/class_w_i_i-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/class_w_i_i.html b/class_w_i_i.html index 05979464..cded3417 100644 --- a/class_w_i_i.html +++ b/class_w_i_i.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: WII Class Reference @@ -31,7 +31,7 @@ - + @@ -311,7 +311,7 @@ Public Attributes void WII::ACLData ( uint8_t *  - ACLData) + ACLData) @@ -345,7 +345,7 @@ Public Attributes void WII::Run ( - ) + ) @@ -373,7 +373,7 @@ Public Attributes void WII::Reset ( - ) + ) @@ -401,7 +401,7 @@ Public Attributes void WII::disconnect ( - ) + ) @@ -427,7 +427,7 @@ Public Attributes bool WII::getButtonPress ( Button  - b) + b) @@ -448,7 +448,7 @@ Public Attributes bool WII::getButtonClick ( Button  - b) + b) @@ -472,7 +472,7 @@ Public Attributes void WII::pair ( void  - ) + ) @@ -496,7 +496,7 @@ Public Attributes uint8_t WII::getAnalogHat ( Hat  - a) + a) @@ -522,7 +522,7 @@ Public Attributes uint16_t WII::getAnalogHat ( AnalogHat  - a) + a) @@ -550,7 +550,7 @@ Public Attributes double WII::getPitch ( - ) + ) @@ -577,7 +577,7 @@ Public Attributes double WII::getRoll ( - ) + ) @@ -604,7 +604,7 @@ Public Attributes double WII::getYaw ( - ) + ) @@ -629,7 +629,7 @@ Public Attributes void WII::setAllOff ( - ) + ) @@ -647,7 +647,7 @@ Public Attributes void WII::setRumbleOff ( - ) + ) @@ -665,7 +665,7 @@ Public Attributes void WII::setRumbleOn ( - ) + ) @@ -683,7 +683,7 @@ Public Attributes void WII::setRumbleToggle ( - ) + ) @@ -702,7 +702,7 @@ Public Attributes void WII::setLedRaw ( uint8_t  - value) + value) @@ -727,7 +727,7 @@ Public Attributes void WII::setLedOff ( LED  - a) + a) @@ -752,7 +752,7 @@ Public Attributes void WII::setLedOn ( LED  - a) + a) @@ -777,7 +777,7 @@ Public Attributes void WII::setLedToggle ( LED  - a) + a) @@ -801,7 +801,7 @@ Public Attributes void WII::setLedStatus ( - ) + ) @@ -822,7 +822,7 @@ Public Attributes void WII::statusRequest ( - ) + ) @@ -843,7 +843,7 @@ Public Attributes uint8_t WII::getBatteryLevel ( - ) + ) @@ -870,7 +870,7 @@ Public Attributes uint8_t WII::getWiiState ( - ) + ) @@ -894,7 +894,7 @@ Public Attributes void WII::IRinitialize ( - ) + ) @@ -915,7 +915,7 @@ Public Attributes uint16_t WII::getIRx1 ( - ) + ) @@ -942,7 +942,7 @@ Public Attributes uint16_t WII::getIRy1 ( - ) + ) @@ -969,7 +969,7 @@ Public Attributes uint8_t WII::getIRs1 ( - ) + ) @@ -996,7 +996,7 @@ Public Attributes uint16_t WII::getIRx2 ( - ) + ) @@ -1023,7 +1023,7 @@ Public Attributes uint16_t WII::getIRy2 ( - ) + ) @@ -1050,7 +1050,7 @@ Public Attributes uint8_t WII::getIRs2 ( - ) + ) @@ -1077,7 +1077,7 @@ Public Attributes uint16_t WII::getIRx3 ( - ) + ) @@ -1104,7 +1104,7 @@ Public Attributes uint16_t WII::getIRy3 ( - ) + ) @@ -1131,7 +1131,7 @@ Public Attributes uint8_t WII::getIRs3 ( - ) + ) @@ -1158,7 +1158,7 @@ Public Attributes uint16_t WII::getIRx4 ( - ) + ) @@ -1185,7 +1185,7 @@ Public Attributes uint16_t WII::getIRy4 ( - ) + ) @@ -1212,7 +1212,7 @@ Public Attributes uint8_t WII::getIRs4 ( - ) + ) @@ -1239,7 +1239,7 @@ Public Attributes bool WII::isIRCameraEnabled ( - ) + ) @@ -1656,7 +1656,7 @@ Public Attributes 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 1b333115..b1ce0468 100644 --- a/class_x_b_o_x_r_e_c_v-members.html +++ b/class_x_b_o_x_r_e_c_v-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -91,35 +91,36 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    This is the complete list of members for XBOXRECV, including all inherited members.

    - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
    bAddressXBOXRECVprotected
    buttonChanged(uint8_t controller)XBOXRECV
    epInfoXBOXRECVprotected
    GetAddress()XBOXRECVinlinevirtual
    getAnalogHat(uint8_t controller, AnalogHat a)XBOXRECV
    getBatteryLevel(uint8_t controller)XBOXRECV
    getButtonClick(uint8_t controller, Button b)XBOXRECV
    getButtonPress(uint8_t controller, Button b)XBOXRECV
    Init(uint8_t parent, uint8_t port, bool lowspeed)XBOXRECVvirtual
    isReady()XBOXRECVinlinevirtual
    Poll()XBOXRECVvirtual
    pUsbXBOXRECVprotected
    Release()XBOXRECVvirtual
    setAllOff(uint8_t controller)XBOXRECVinline
    setLedBlink(uint8_t controller, LED l)XBOXRECV
    setLedMode(uint8_t controller, LEDMode lm)XBOXRECV
    setLedOff(uint8_t controller)XBOXRECVinline
    setLedOn(uint8_t controller, LED l)XBOXRECV
    setLedRaw(uint8_t controller, uint8_t value)XBOXRECV
    setRumbleOff(uint8_t controller)XBOXRECVinline
    setRumbleOn(uint8_t controller, uint8_t lValue, uint8_t rValue)XBOXRECV
    Xbox360ConnectedXBOXRECV
    XboxReceiverConnectedXBOXRECV
    XBOXRECV(USB *pUsb)XBOXRECV
    buttonChanged(uint8_t controller=0)XBOXRECV
    ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual
    epInfoXBOXRECVprotected
    GetAddress()XBOXRECVinlinevirtual
    getAnalogHat(AnalogHat a, uint8_t controller=0)XBOXRECV
    getBatteryLevel(uint8_t controller=0)XBOXRECV
    getButtonClick(Button b, uint8_t controller=0)XBOXRECV
    getButtonPress(Button b, uint8_t controller=0)XBOXRECV
    Init(uint8_t parent, uint8_t port, bool lowspeed)XBOXRECVvirtual
    isReady()XBOXRECVinlinevirtual
    Poll()XBOXRECVvirtual
    pUsbXBOXRECVprotected
    Release()XBOXRECVvirtual
    setAllOff(uint8_t controller=0)XBOXRECVinline
    setLedBlink(LED l, uint8_t controller=0)XBOXRECV
    setLedMode(LEDMode lm, uint8_t controller=0)XBOXRECV
    setLedOff(uint8_t controller=0)XBOXRECVinline
    setLedOn(LED l, uint8_t controller=0)XBOXRECV
    setLedRaw(uint8_t value, uint8_t controller=0)XBOXRECV
    setRumbleOff(uint8_t controller=0)XBOXRECVinline
    setRumbleOn(uint8_t lValue, uint8_t rValue, uint8_t controller=0)XBOXRECV
    Xbox360ConnectedXBOXRECV
    XboxReceiverConnectedXBOXRECV
    XBOXRECV(USB *pUsb)XBOXRECV
    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 49a7f3cd..71c698c5 100644 --- a/class_x_b_o_x_r_e_c_v.html +++ b/class_x_b_o_x_r_e_c_v.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXRECV Class Reference @@ -31,7 +31,7 @@ - + @@ -125,32 +125,35 @@ Public Member Functions virtual bool isReady ()  
    Xbox Controller functions
    -uint8_t getButtonPress (uint8_t controller, Button b) -  -bool getButtonClick (uint8_t controller, Button b) -  -int16_t getAnalogHat (uint8_t controller, AnalogHat a) -  -void setAllOff (uint8_t controller) -  -void setRumbleOff (uint8_t controller) -  -void setRumbleOn (uint8_t controller, uint8_t lValue, uint8_t rValue) -  -void setLedRaw (uint8_t controller, uint8_t value) -  -void setLedOff (uint8_t controller) -  -void setLedOn (uint8_t controller, LED l) -  -void setLedBlink (uint8_t controller, LED l) -  -void setLedMode (uint8_t controller, LEDMode lm) -  -uint8_t getBatteryLevel (uint8_t controller) -  -bool buttonChanged (uint8_t controller) -  +uint8_t getButtonPress (Button b, uint8_t controller=0) +  +bool getButtonClick (Button b, uint8_t controller=0) +  +int16_t getAnalogHat (AnalogHat a, uint8_t controller=0) +  +void setAllOff (uint8_t controller=0) +  +void setRumbleOff (uint8_t controller=0) +  +void setRumbleOn (uint8_t lValue, uint8_t rValue, uint8_t controller=0) +  +void setLedRaw (uint8_t value, uint8_t controller=0) +  +void setLedOff (uint8_t controller=0) +  +void setLedOn (LED l, uint8_t controller=0) +  +void setLedBlink (LED l, uint8_t controller=0) +  +void setLedMode (LEDMode lm, uint8_t controller=0) +  +uint8_t getBatteryLevel (uint8_t controller=0) +  +bool buttonChanged (uint8_t controller=0) +  +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  @@ -182,7 +185,7 @@ Protected Attributes - +

    Public Attributes

    XBOXRECV::XBOXRECV ( USBpUsb)pUsb)
    @@ -264,7 +267,7 @@ Protected Attributes uint8_t XBOXRECV::Release ( - ) + ) @@ -279,7 +282,7 @@ Protected Attributes

    Implements USBDeviceConfig.

    -

    Definition at line 246 of file XBOXRECV.cpp.

    +

    Definition at line 254 of file XBOXRECV.cpp.

    @@ -293,7 +296,7 @@ Protected Attributes uint8_t XBOXRECV::Poll ( - ) + ) @@ -308,7 +311,7 @@ Protected Attributes

    Implements USBDeviceConfig.

    -

    Definition at line 256 of file XBOXRECV.cpp.

    +

    Definition at line 264 of file XBOXRECV.cpp.

    @@ -322,7 +325,7 @@ Protected Attributes virtual uint8_t XBOXRECV::GetAddress ( - ) + ) @@ -351,7 +354,7 @@ Protected Attributes virtual bool XBOXRECV::isReady ( - ) + ) @@ -368,21 +371,21 @@ Protected Attributes - +
    - - + + - - + + @@ -391,37 +394,37 @@ Protected Attributes
    uint8_t XBOXRECV::getButtonPress (uint8_t controller, Button b,
    Button b uint8_t controller = 0 
    -

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

    -

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

    -

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

    +

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

    +

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

    +

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

    Parameters
    - +
    controllerThe controller to read from.
    bButton to read.
    controllerThe controller to read from. Default to 0.
    -
    Returns
    getButtonClick(uint8_t controller, Button b) will return a bool, but getButtonPress(uint8_t controller, Button b) will return a byte if reading L2 or R2.
    +
    Returns
    getButtonClick(uint8_t controller, Button b) will return a bool, but getButtonPress(uint8_t controller, Button b) will return a byte if reading L2 or R2.
    -

    Definition at line 384 of file XBOXRECV.cpp.

    +

    Definition at line 392 of file XBOXRECV.cpp.

    - +
    - - + + - - + + @@ -430,37 +433,37 @@ Protected Attributes
    bool XBOXRECV::getButtonClick (uint8_t controller, Button b,
    Button b uint8_t controller = 0 
    -

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

    -

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

    -

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

    +

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

    +

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

    +

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

    Parameters
    - +
    controllerThe controller to read from.
    bButton to read.
    controllerThe controller to read from. Default to 0.
    -
    Returns
    getButtonClick(uint8_t controller, Button b) will return a bool, but getButtonPress(uint8_t controller, Button b) will return a byte if reading L2 or R2.
    +
    Returns
    getButtonClick(uint8_t controller, Button b) will return a bool, but getButtonPress(uint8_t controller, Button b) will return a byte if reading L2 or R2.
    -

    Definition at line 392 of file XBOXRECV.cpp.

    +

    Definition at line 400 of file XBOXRECV.cpp.

    - +
    - - + + - - + + @@ -472,18 +475,18 @@ Protected Attributes

    Return the analog value from the joysticks on the controller.

    Parameters
    int16_t XBOXRECV::getAnalogHat (uint8_t controller, AnalogHat a,
    AnalogHat a uint8_t controller = 0 
    - +
    controllerThe controller to read from.
    aEither LeftHatX, LeftHatY, RightHatX or RightHatY.
    controllerThe controller to read from. Default to 0.
    Returns
    Returns a signed 16-bit integer.
    -

    Definition at line 412 of file XBOXRECV.cpp.

    +

    Definition at line 420 of file XBOXRECV.cpp.

    - +
    @@ -494,7 +497,7 @@ Protected Attributes - +
    void XBOXRECV::setAllOff ( uint8_t controller)controller = 0)
    @@ -507,7 +510,7 @@ Protected Attributes

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

    Parameters
    - +
    controllerThe controller to write to.
    controllerThe controller to write to. Default to 0.
    @@ -516,7 +519,7 @@ Protected Attributes
    - +
    @@ -527,7 +530,7 @@ Protected Attributes - +
    void XBOXRECV::setRumbleOff ( uint8_t controller)controller = 0)
    @@ -540,7 +543,7 @@ Protected Attributes

    Turn rumble off the specific controller.

    Parameters
    - +
    controllerThe controller to write to.
    controllerThe controller to write to. Default to 0.
    @@ -549,7 +552,7 @@ Protected Attributes
    - +
    @@ -557,19 +560,19 @@ Protected Attributes - - - - - - - + + + + + + + @@ -581,18 +584,18 @@ Protected Attributes

    Turn rumble on.

    Parameters
    void XBOXRECV::setRumbleOn ( uint8_t controller,
    uint8_t  lValue,
    uint8_t rValue rValue,
    uint8_t controller = 0 
    - +
    controllerThe controller to write to.
    lValueLeft motor (big weight) inside the controller.
    rValueRight motor (small weight) inside the controller.
    controllerThe controller to write to. Default to 0.
    -

    Definition at line 513 of file XBOXRECV.cpp.

    +

    Definition at line 521 of file XBOXRECV.cpp.

    - +
    @@ -600,13 +603,13 @@ Protected Attributes - + - + @@ -618,17 +621,17 @@ Protected Attributes

    Set LED value. Without using the LED or LEDMode enum.

    Parameters
    void XBOXRECV::setLedRaw ( uint8_t controller, value,
    uint8_t value controller = 0 
    - - + +
    controllerThe controller to write to.
    valueSee: setLedOff(uint8_t controller), setLedOn(uint8_t controller, LED l), setLedBlink(uint8_t controller, LED l), and setLedMode(uint8_t controller, LEDMode lm).
    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.
    -

    Definition at line 465 of file XBOXRECV.cpp.

    +

    Definition at line 473 of file XBOXRECV.cpp.

    - +
    @@ -639,7 +642,7 @@ Protected Attributes - +
    void XBOXRECV::setLedOff ( uint8_t controller)controller = 0)
    @@ -652,7 +655,7 @@ Protected Attributes

    Turn all LEDs off the specific controller.

    Parameters
    - +
    controllerThe controller to write to.
    controllerThe controller to write to. Default to 0.
    @@ -661,21 +664,21 @@ Protected Attributes
    - +
    - - + + - - + + @@ -687,31 +690,31 @@ Protected Attributes

    Turn on a LED by using the LED enum.

    Parameters
    void XBOXRECV::setLedOn (uint8_t controller, LED l,
    LED l uint8_t controller = 0 
    - +
    controllerThe controller to write to.
    lLED1, LED2, LED3 and LED4 is supported by the Xbox controller.
    controllerThe controller to write to. Default to 0.
    -

    Definition at line 474 of file XBOXRECV.cpp.

    +

    Definition at line 482 of file XBOXRECV.cpp.

    - +
    - - + + - - + + @@ -723,31 +726,31 @@ Protected Attributes

    Turn on a LED by using the LED enum.

    Parameters
    void XBOXRECV::setLedBlink (uint8_t controller, LED l,
    LED l uint8_t controller = 0 
    - +
    controllerThe controller to write to.
    lALL, LED1, LED2, LED3 and LED4 is supported by the Xbox controller.
    controllerThe controller to write to. Default to 0.
    -

    Definition at line 479 of file XBOXRECV.cpp.

    +

    Definition at line 487 of file XBOXRECV.cpp.

    - +
    - - + + - - + + @@ -759,17 +762,17 @@ Protected Attributes

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

    Parameters
    void XBOXRECV::setLedMode (uint8_t controller, LEDMode lm,
    LEDMode lm uint8_t controller = 0 
    - +
    controllerThe controller to write to.
    lmSee LEDMode.
    controllerThe controller to write to. Default to 0.
    -

    Definition at line 483 of file XBOXRECV.cpp.

    +

    Definition at line 491 of file XBOXRECV.cpp.

    - +
    @@ -777,7 +780,7 @@ Protected Attributes - +
    uint8_t XBOXRECV::getBatteryLevel ( uint8_t controller)controller = 0)
    @@ -785,17 +788,17 @@ Protected Attributes

    Used to get the battery level from the controller.

    Parameters
    - +
    controllerThe controller to read from.
    controllerThe controller to read from. Default to 0.
    Returns
    Returns the battery level as an integer in the range of 0-3.
    -

    Definition at line 441 of file XBOXRECV.cpp.

    +

    Definition at line 449 of file XBOXRECV.cpp.

    - +
    @@ -803,7 +806,7 @@ Protected Attributes - +
    bool XBOXRECV::buttonChanged ( uint8_t controller)controller = 0)
    @@ -811,13 +814,13 @@ Protected Attributes

    Used to check if a button has changed.

    Parameters
    - +
    controllerThe controller to read from.
    controllerThe controller to read from. Default to 0.
    Returns
    True if a button has changed.
    -

    Definition at line 416 of file XBOXRECV.cpp.

    +

    Definition at line 424 of file XBOXRECV.cpp.

    @@ -930,7 +933,7 @@ Protected Attributes 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 7557896c..59d5d0ec 100644 --- a/class_x_b_o_x_u_s_b-members.html +++ b/class_x_b_o_x_u_s_b-members.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Member List @@ -31,7 +31,7 @@ - + @@ -91,32 +91,33 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    This is the complete list of members for XBOXUSB, including all inherited members.

    - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
    bAddressXBOXUSBprotected
    epInfoXBOXUSBprotected
    GetAddress()XBOXUSBinlinevirtual
    getAnalogHat(AnalogHat a)XBOXUSB
    getButtonClick(Button b)XBOXUSB
    getButtonPress(Button b)XBOXUSB
    Init(uint8_t parent, uint8_t port, bool lowspeed)XBOXUSBvirtual
    isReady()XBOXUSBinlinevirtual
    Poll()XBOXUSBvirtual
    pUsbXBOXUSBprotected
    Release()XBOXUSBvirtual
    setAllOff()XBOXUSBinline
    setLedBlink(LED l)XBOXUSB
    setLedMode(LEDMode lm)XBOXUSB
    setLedOff()XBOXUSBinline
    setLedOn(LED l)XBOXUSB
    setLedRaw(uint8_t value)XBOXUSB
    setRumbleOff()XBOXUSBinline
    setRumbleOn(uint8_t lValue, uint8_t rValue)XBOXUSB
    Xbox360ConnectedXBOXUSB
    XBOXUSB(USB *pUsb)XBOXUSB
    ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)USBDeviceConfiginlinevirtual
    epInfoXBOXUSBprotected
    GetAddress()XBOXUSBinlinevirtual
    getAnalogHat(AnalogHat a)XBOXUSB
    getButtonClick(Button b)XBOXUSB
    getButtonPress(Button b)XBOXUSB
    Init(uint8_t parent, uint8_t port, bool lowspeed)XBOXUSBvirtual
    isReady()XBOXUSBinlinevirtual
    Poll()XBOXUSBvirtual
    pUsbXBOXUSBprotected
    Release()XBOXUSBvirtual
    setAllOff()XBOXUSBinline
    setLedBlink(LED l)XBOXUSB
    setLedMode(LEDMode lm)XBOXUSB
    setLedOff()XBOXUSBinline
    setLedOn(LED l)XBOXUSB
    setLedRaw(uint8_t value)XBOXUSB
    setRumbleOff()XBOXUSBinline
    setRumbleOn(uint8_t lValue, uint8_t rValue)XBOXUSB
    Xbox360ConnectedXBOXUSB
    XBOXUSB(USB *pUsb)XBOXUSB
    diff --git a/class_x_b_o_x_u_s_b.html b/class_x_b_o_x_u_s_b.html index 1a23cf87..1ed1caa9 100644 --- a/class_x_b_o_x_u_s_b.html +++ b/class_x_b_o_x_u_s_b.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: XBOXUSB Class Reference @@ -31,7 +31,7 @@ - + @@ -147,6 +147,9 @@ Public Member Functions   void setLedMode (LEDMode lm)   +- Public Member Functions inherited from USBDeviceConfig +virtual uint8_t ConfigureDevice (uint8_t parent, uint8_t port, bool lowspeed) +  @@ -175,7 +178,7 @@ Protected Attributes - +

    Public Attributes

    XBOXUSB::XBOXUSB ( USBpUsb)pUsb)
    @@ -257,7 +260,7 @@ Protected Attributes uint8_t XBOXUSB::Release ( - ) + ) @@ -272,7 +275,7 @@ Protected Attributes

    Implements USBDeviceConfig.

    -

    Definition at line 210 of file XBOXUSB.cpp.

    +

    Definition at line 218 of file XBOXUSB.cpp.

    @@ -286,7 +289,7 @@ Protected Attributes uint8_t XBOXUSB::Poll ( - ) + ) @@ -301,7 +304,7 @@ Protected Attributes

    Implements USBDeviceConfig.

    -

    Definition at line 218 of file XBOXUSB.cpp.

    +

    Definition at line 226 of file XBOXUSB.cpp.

    @@ -315,7 +318,7 @@ Protected Attributes virtual uint8_t XBOXUSB::GetAddress ( - ) + ) @@ -344,7 +347,7 @@ Protected Attributes virtual bool XBOXUSB::isReady ( - ) + ) @@ -369,35 +372,7 @@ Protected Attributes uint8_t XBOXUSB::getButtonPress ( Button  - b) - - - -
    -

    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
    - - -
    bButton to read.
    -
    -
    -
    Returns
    getButtonClick(Button b) will return a bool, but getButtonPress(Button b) will return a byte if reading L2 or R2.
    - -

    Definition at line 269 of file XBOXUSB.cpp.

    - -
    - - -
    -
    - - - - - - +
    bool XBOXUSB::getButtonClick (Button b)b)
    @@ -415,6 +390,34 @@ Protected Attributes

    Definition at line 277 of file XBOXUSB.cpp.

    +
    +
    + +
    +
    + + + + + + + + +
    bool XBOXUSB::getButtonClick (Button b)
    +
    +

    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
    + + +
    bButton to read.
    +
    +
    +
    Returns
    getButtonClick(Button b) will return a bool, but getButtonPress(Button b) will return a byte if reading L2 or R2.
    + +

    Definition at line 285 of file XBOXUSB.cpp.

    +
    @@ -425,7 +428,7 @@ Protected Attributes int16_t XBOXUSB::getAnalogHat ( AnalogHat  - a) + a) @@ -439,7 +442,7 @@ Protected Attributes
    Returns
    Returns a signed 16-bit integer.
    -

    Definition at line 297 of file XBOXUSB.cpp.

    +

    Definition at line 305 of file XBOXUSB.cpp.

    @@ -453,7 +456,7 @@ Protected Attributes void XBOXUSB::setAllOff ( - ) + ) @@ -479,7 +482,7 @@ Protected Attributes void XBOXUSB::setRumbleOff ( - ) + ) @@ -527,7 +530,7 @@ Protected Attributes -

    Definition at line 328 of file XBOXUSB.cpp.

    +

    Definition at line 336 of file XBOXUSB.cpp.

    @@ -539,7 +542,7 @@ Protected Attributes void XBOXUSB::setLedRaw ( uint8_t  - value) + value) @@ -552,7 +555,7 @@ Protected Attributes -

    Definition at line 307 of file XBOXUSB.cpp.

    +

    Definition at line 315 of file XBOXUSB.cpp.

    @@ -566,7 +569,7 @@ Protected Attributes void XBOXUSB::setLedOff ( - ) + ) @@ -590,7 +593,7 @@ Protected Attributes void XBOXUSB::setLedOn ( LED  - l) + l) @@ -603,7 +606,7 @@ Protected Attributes -

    Definition at line 315 of file XBOXUSB.cpp.

    +

    Definition at line 323 of file XBOXUSB.cpp.

    @@ -615,7 +618,7 @@ Protected Attributes void XBOXUSB::setLedBlink ( LED  - l) + l) @@ -628,7 +631,7 @@ Protected Attributes -

    Definition at line 320 of file XBOXUSB.cpp.

    +

    Definition at line 328 of file XBOXUSB.cpp.

    @@ -640,7 +643,7 @@ Protected Attributes void XBOXUSB::setLedMode ( LEDMode  - lm) + lm) @@ -653,7 +656,7 @@ Protected Attributes -

    Definition at line 324 of file XBOXUSB.cpp.

    +

    Definition at line 332 of file XBOXUSB.cpp.

    @@ -751,7 +754,7 @@ Protected Attributes diff --git a/classes.html b/classes.html index a7d15b7b..1a9194b2 100644 --- a/classes.html +++ b/classes.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Index @@ -31,7 +31,7 @@ - + @@ -136,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/confdescparser_8h.html b/confdescparser_8h.html index b9d82ced..759fb94c 100644 --- a/confdescparser_8h.html +++ b/confdescparser_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: confdescparser.h File Reference @@ -31,7 +31,7 @@ - + @@ -101,7 +101,7 @@ Include dependency graph for confdescparser.h:
    - +
    This graph shows which files directly or indirectly include this file:
    @@ -193,7 +193,7 @@ Macros diff --git a/confdescparser_8h__incl.map b/confdescparser_8h__incl.map index e473ab2d..6f914f18 100644 --- a/confdescparser_8h__incl.map +++ b/confdescparser_8h__incl.map @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/confdescparser_8h__incl.md5 b/confdescparser_8h__incl.md5 index 72cdd53f..02752d9a 100644 --- a/confdescparser_8h__incl.md5 +++ b/confdescparser_8h__incl.md5 @@ -1 +1 @@ -ad1b511f6cbd2b0cbca09f00e2dfa447 \ No newline at end of file +cfdaef7f4c6bd3368387914ab043b16d \ No newline at end of file diff --git a/confdescparser_8h__incl.png b/confdescparser_8h__incl.png index 92678ebf..9ad95581 100644 Binary files a/confdescparser_8h__incl.png and b/confdescparser_8h__incl.png differ diff --git a/confdescparser_8h_source.html b/confdescparser_8h_source.html index 459d8fb8..4ae4fa50 100644 --- a/confdescparser_8h_source.html +++ b/confdescparser_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: confdescparser.h Source File @@ -31,7 +31,7 @@
    - + @@ -264,20 +264,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    173 
    174 template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
    175 void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc) {
    -
    176  Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80);
    -
    177  Notify(PSTR("bDescLength:\t\t"), 0x80);
    +
    176  Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80);
    +
    177  Notify(PSTR("bDescLength:\t\t"), 0x80);
    178  PrintHex<uint8_t > (pDesc->bLength, 0x80);
    179 
    -
    180  Notify(PSTR("\r\nbDescriptorType:\t"), 0x80);
    +
    180  Notify(PSTR("\r\nbDescriptorType:\t"), 0x80);
    181  PrintHex<uint8_t > (pDesc->bDescriptorType, 0x80);
    182 
    -
    183  Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80);
    +
    183  Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80);
    184  PrintHex<uint16_t > (pDesc->bcdHID, 0x80);
    185 
    -
    186  Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80);
    +
    186  Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80);
    187  PrintHex<uint8_t > (pDesc->bCountryCode, 0x80);
    188 
    -
    189  Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80);
    +
    189  Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80);
    190  PrintHex<uint8_t > (pDesc->bNumDescriptors, 0x80);
    191 
    192  //Notify(PSTR("\r\nbDescrType:\t\t"));
    @@ -289,13 +289,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    198  for(uint8_t i = 0; i < pDesc->bNumDescriptors; i++) {
    199  HID_CLASS_DESCRIPTOR_LEN_AND_TYPE *pLT = (HID_CLASS_DESCRIPTOR_LEN_AND_TYPE*)&(pDesc->bDescrType);
    200 
    -
    201  Notify(PSTR("\r\nbDescrType:\t\t"), 0x80);
    +
    201  Notify(PSTR("\r\nbDescrType:\t\t"), 0x80);
    202  PrintHex<uint8_t > (pLT[i].bDescrType, 0x80);
    203 
    -
    204  Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80);
    +
    204  Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80);
    205  PrintHex<uint16_t > (pLT[i].wDescriptorLength, 0x80);
    206  }
    -
    207  Notify(PSTR("\r\n"), 0x80);
    +
    207  Notify(PSTR("\r\n"), 0x80);
    208 }
    209 
    210 
    @@ -305,7 +305,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/controller_enums_8h.html b/controller_enums_8h.html index 901adc44..98381253 100644 --- a/controller_enums_8h.html +++ b/controller_enums_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: controllerEnums.h File Reference @@ -31,7 +31,7 @@ - + @@ -380,7 +380,7 @@ Enumerations diff --git a/controller_enums_8h_source.html b/controller_enums_8h_source.html index d1337286..67eef0c1 100644 --- a/controller_enums_8h_source.html +++ b/controller_enums_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: controllerEnums.h Source File @@ -31,7 +31,7 @@ - + @@ -185,7 +185,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dir_397a095372f04465e811d0ee219bbf8f.html b/dir_397a095372f04465e811d0ee219bbf8f.html index 9c50cc75..d32314b7 100644 --- a/dir_397a095372f04465e811d0ee219bbf8f.html +++ b/dir_397a095372f04465e811d0ee219bbf8f.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: USB_Host_Shield_2.0 Directory Reference @@ -31,7 +31,7 @@ - + @@ -209,7 +209,7 @@ Files diff --git a/dir_e5fbe6d2783ccd4c93c7856d92d7be6e.html b/dir_e5fbe6d2783ccd4c93c7856d92d7be6e.html index 73f99ad2..5c11256a 100644 --- a/dir_e5fbe6d2783ccd4c93c7856d92d7be6e.html +++ b/dir_e5fbe6d2783ccd4c93c7856d92d7be6e.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: GitHub Directory Reference @@ -31,7 +31,7 @@ - + @@ -101,7 +101,7 @@ Directories diff --git a/doxygen.css b/doxygen.css index dabaff2f..3ac28511 100644 --- a/doxygen.css +++ b/doxygen.css @@ -1,7 +1,7 @@ -/* The standard CSS for doxygen 1.8.3.1 */ +/* The standard CSS for doxygen 1.8.4 */ body, table, div, p, dl { - font: 400 14px/19px Roboto,sans-serif; + font: 400 14px/22px Roboto,sans-serif; } /* @group Heading Levels */ @@ -11,6 +11,7 @@ h1.groupheader { } .title { + font: 400 14px/28px Roboto,sans-serif; font-size: 150%; font-weight: bold; margin: 10px 2px; @@ -168,8 +169,8 @@ pre.fragment { } div.fragment { - padding: 4px; - margin: 4px; + padding: 0px; + margin: 0px; background-color: #FBFCFD; border: 1px solid #C4CFE5; } @@ -687,6 +688,7 @@ div.directory { .directory td.entry { white-space: nowrap; padding-right: 6px; + padding-top: 3px; } .directory td.entry a { @@ -787,7 +789,7 @@ table.fieldtable { } .fieldtable td.fieldname { - padding-top: 5px; + padding-top: 3px; } .fieldtable td.fielddoc { @@ -796,7 +798,7 @@ table.fieldtable { } .fieldtable td.fielddoc p:first-child { - margin-top: 2px; + margin-top: 0px; } .fieldtable td.fielddoc p:last-child { diff --git a/files.html b/files.html index 680d47a4..a8349bbb 100644 --- a/files.html +++ b/files.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File List @@ -31,7 +31,7 @@ - + @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions.html b/functions.html index 355c5809..1ae4a409 100644 --- a/functions.html +++ b/functions.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x62.html b/functions_0x62.html index c4325d51..09414df6 100644 --- a/functions_0x62.html +++ b/functions_0x62.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -533,7 +533,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : MAX3421e< SS, INTR >
  • buttonChanged() -: XBOXRECV +: XBOXRECV
  • ByteSkipper() : ByteSkipper @@ -550,7 +550,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x63.html b/functions_0x63.html index 2fbd8412..35c2924d 100644 --- a/functions_0x63.html +++ b/functions_0x63.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -139,9 +139,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • ClearCommFeature() : ACM
  • -
  • ClearEpHalt() -: BulkOnly -
  • ClearHubFeature() : USBHub
  • @@ -166,6 +163,10 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • ConfigDescParser() : ConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK >
  • +
  • ConfigureDevice() +: BulkOnly +, USBDeviceConfig +
  • Configuring() : USB
  • @@ -232,6 +233,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • ctrlStatus() : USB
  • +
  • CurrentCapacity +: BulkOnly +
  • +
  • CurrentSectorSize +: BulkOnly +
  • cursor() : Max_LCD
  • @@ -241,7 +248,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x64.html b/functions_0x64.html index e6530a55..eff1c2c3 100644 --- a/functions_0x64.html +++ b/functions_0x64.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -199,7 +199,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x65.html b/functions_0x65.html index 83efaed2..fd4fa0f8 100644 --- a/functions_0x65.html +++ b/functions_0x65.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -191,7 +191,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x66.html b/functions_0x66.html index 9ea9cc69..e1051029 100644 --- a/functions_0x66.html +++ b/functions_0x66.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x67.html b/functions_0x67.html index 3d788471..e988f245 100644 --- a/functions_0x67.html +++ b/functions_0x67.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -176,7 +176,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • getAngle() @@ -185,7 +185,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • getBatteryLevel() : WII -, XBOXRECV +, XBOXRECV
  • GetbMaxLUN() : BulkOnly @@ -200,16 +200,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • getButtonPress() : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • +
  • GetCapacity() +: BulkOnly +
  • GetCommFeature() : ACM
  • @@ -276,9 +279,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • GetLineCoding() : ACM
  • -
  • GetMaxLUN() -: BulkOnly -
  • GetNotif() : ACM
  • @@ -298,19 +298,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : HID
  • GetReportParser() -: HID -, HIDUniversal +: HIDUniversal +, HID
  • getRoll() : WII
  • +
  • GetSectorSize() +: BulkOnly +
  • getSensor() -: PS3USB -, PS3BT +: PS3BT +, PS3USB
  • getStatus() -: PS3USB -, PS3BT +: PS3BT +, PS3USB
  • getStatusString() : PS3USB @@ -326,8 +329,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : HID
  • GetUsbDevicePtr() -: AddressPool -, AddressPoolImpl< MAX_DEVICES_ALLOWED > +: AddressPoolImpl< MAX_DEVICES_ALLOWED > +, AddressPool
  • getUsbTaskState() : USB @@ -383,7 +386,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x68.html b/functions_0x68.html index ebc47600..983b906b 100644 --- a/functions_0x68.html +++ b/functions_0x68.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -127,12 +127,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • HandleLockingKeys() : KeyboardReportParser
  • -
  • HandleSCSIError() -: BulkOnly -
  • -
  • HandleUsbError() -: BulkOnly -
  • hci_accept_connection() : BTD
  • @@ -214,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x69.html b/functions_0x69.html index 30f6931d..e1a87ad5 100644 --- a/functions_0x69.html +++ b/functions_0x69.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -145,38 +145,33 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Information : RequestSenseResponce
  • -
  • init() -: Max_LCD -
  • Init() -: HIDUniversal -, BulkOnly -
  • -
  • init() -: SPi< CLK, MOSI, MISO, SPI_SS > -
  • -
  • Init() -: PS3USB +: ADK +, PS3USB , USBDeviceConfig -, ADK +, BTD , MAX3421e< SS, INTR > , USBHub -, BTD +, ACM , XBOXRECV , XBOXUSB -, ACM , FTDI -, PL2303 +
  • +
  • init() +: Max_LCD +, SPi< CLK, MOSI, MISO, SPI_SS > +
  • +
  • Init() +: PL2303 , HIDBoot< BOOT_PROTOCOL > +, HIDUniversal +, BulkOnly
  • Initialize() -: HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE > +: PTPListParser , MultiByteValueParser +, HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE > , ByteSkipper -, PTPListParser -
  • -
  • Inquiry() -: BulkOnly
  • IntHandler() : MAX3421e< SS, INTR > @@ -196,26 +191,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • isIRCameraEnabled() : WII
  • -
  • IsMeaningfulCBW() -: BulkOnly -
  • isReady() -: BTD -, ADK -, XBOXUSB +: XBOXRECV , ACM , PS3USB -, XBOXRECV +, ADK +, XBOXUSB +, BTD
  • IsSet() : TPin< PORT, PIN >
  • -
  • IsValidCBW() -: BulkOnly -
  • -
  • IsValidCSW() -: BulkOnly -
  • itemParseState : ReportDescParserBase
  • @@ -231,7 +217,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x6b.html b/functions_0x6b.html index ebdbcc1a..43ad8271 100644 --- a/functions_0x6b.html +++ b/functions_0x6b.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -145,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x6c.html b/functions_0x6c.html index 7ed470d7..81ba9240 100644 --- a/functions_0x6c.html +++ b/functions_0x6c.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -160,19 +160,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Linked : InquiryResponse
  • +
  • LockMedia() +: BulkOnly +
  • LogPwrSwitchMode : HubDescriptor
  • lowspeed : UsbDevice
  • +
  • LUNIsGood() +: BulkOnly +
  • +
  • LUNOk +: BulkOnly +
  • diff --git a/functions_0x6d.html b/functions_0x6d.html index 58b70ada..483cde97 100644 --- a/functions_0x6d.html +++ b/functions_0x6d.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -163,9 +163,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • modeRange : PTPListParser
  • -
  • ModeSense() -: BulkOnly -
  • motionPlusConnected : WII
  • @@ -176,13 +173,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : MouseReportParser
  • moveSetBulb() -: PS3USB -, PS3BT +: PS3BT , PS3USB
  • moveSetRumble() -: PS3BT -, PS3USB +: PS3USB +, PS3BT
  • MultiByteValueParser() : MultiByteValueParser @@ -196,7 +192,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x6e.html b/functions_0x6e.html index afec559b..0bc86532 100644 --- a/functions_0x6e.html +++ b/functions_0x6e.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x6f.html b/functions_0x6f.html index 0e9da83e..d02ddc5f 100644 --- a/functions_0x6f.html +++ b/functions_0x6f.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -127,10 +127,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • OemToAscii() : KeyboardReportParser
  • +
  • OnControlKeysChanged() +: KeyboardReportParser +
  • OnInit() -: CDCAsyncOper +: FTDIAsyncOper , BulkOnly -, FTDIAsyncOper +, CDCAsyncOper
  • OnInitSuccessful() : HIDUniversal @@ -177,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x70.html b/functions_0x70.html index f0294791..1bf8d258 100644 --- a/functions_0x70.html +++ b/functions_0x70.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -306,7 +306,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x71.html b/functions_0x71.html index 912d627e..ce95251c 100644 --- a/functions_0x71.html +++ b/functions_0x71.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x72.html b/functions_0x72.html index af462569..2942b1a9 100644 --- a/functions_0x72.html +++ b/functions_0x72.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -129,14 +129,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , ACM , FTDI
  • -
  • read() -: SPP -
  • Read() : BulkOnly
  • -
  • ReadCapacity() -: BulkOnly +
  • read() +: SPP
  • readPollInterval() : BTD @@ -195,12 +192,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • ReqType_u : SETUP_PKT
  • -
  • RequestSense() -: BulkOnly -
  • Reserved -: InquiryResponse -, HubDescriptor +: HubDescriptor +, InquiryResponse
  • Reserved2 : InquiryResponse @@ -213,20 +207,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Reset() : SPP -, PS3BT -, BulkOnly -, BluetoothService -, WII
  • reset() : MAX3421e< SS, INTR >
  • +
  • Reset() +: BluetoothService +, PS3BT +, WII +
  • ResetHubPreMask() : USB
  • -
  • ResetRecovery() -: BulkOnly -
  • ResponseDataFormat : InquiryResponse
  • @@ -252,10 +244,10 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : ReportDescParserBase
  • Run() -: WII -, BluetoothService -, PS3BT +: PS3BT , SPP +, WII +, BluetoothService
  • @@ -263,7 +255,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x73.html b/functions_0x73.html index e866fdbb..2f8804bd 100644 --- a/functions_0x73.html +++ b/functions_0x73.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • SetBaudRate() @@ -172,9 +172,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • SetControlLineState() : ACM
  • -
  • SetCurLUN() -: BulkOnly -
  • setCursor() : Max_LCD
  • @@ -212,32 +209,32 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : HID
  • setLedBlink() -: XBOXRECV +: XBOXRECV , XBOXUSB
  • setLedMode() -: XBOXRECV +: XBOXRECV , XBOXUSB
  • setLedOff() : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • setLedOn() : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • setLedRaw() : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • setLedStatus() @@ -272,20 +269,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , HIDUniversal
  • setRumbleOff() -: WII -, PS3BT +: PS3USB +, WII +, XBOXRECV , XBOXUSB -, PS3USB -, XBOXRECV +, PS3BT
  • setRumbleOn() -: PS3USB -, PS3BT -, XBOXUSB +: PS3BT , WII -, PS3BT -, XBOXRECV +, PS3BT , PS3USB +, XBOXUSB +, XBOXRECV +, PS3USB
  • setRumbleToggle() : WII @@ -309,9 +306,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : ByteSkipper
  • SndData() -: ADK +: FTDI +, ADK , ACM -, FTDI
  • SoftReset : InquiryResponse @@ -340,7 +337,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x74.html b/functions_0x74.html index e0f76c69..8ffd3eb3 100644 --- a/functions_0x74.html +++ b/functions_0x74.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -149,9 +149,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • telTitles5 : ReportDescParserBase
  • -
  • TestUnitReady() -: BulkOnly -
  • theBuffer : ReportDescParserBase
  • @@ -159,8 +156,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : ReportDescParserBase
  • Toggle() -: TPin< PORT, PIN > -, TCom< TCCR, COM > +: TCom< TCCR, COM > +, TPin< PORT, PIN >
  • totalEndpoints : HID @@ -168,9 +165,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • totalSize : ReportDescParserBase
  • -
  • Transaction() -: BulkOnly -
  • TrmTsk : InquiryResponse
  • @@ -186,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x75.html b/functions_0x75.html index 62eaaa95..e5cd4ad3 100644 --- a/functions_0x75.html +++ b/functions_0x75.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x76.html b/functions_0x76.html index fd888528..d744502c 100644 --- a/functions_0x76.html +++ b/functions_0x76.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x77.html b/functions_0x77.html index 74b629e0..6da53d84 100644 --- a/functions_0x77.html +++ b/functions_0x77.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -173,13 +173,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : USB_ENDPOINT_DESCRIPTOR
  • write() -: SPP -, Max_LCD +: Max_LCD , SPP
  • Write() : BulkOnly
  • +
  • WriteOk +: BulkOnly +
  • +
  • WriteProtected() +: BulkOnly +
  • wTotalLength : USB_CONFIGURATION_DESCRIPTOR
  • @@ -187,8 +192,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : SETUP_PKT
  • wValue -: SETUP_PKT -, CLASS_NOTIFICATION +: CLASS_NOTIFICATION +, SETUP_PKT
  • wValueHi : SETUP_PKT @@ -202,7 +207,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x78.html b/functions_0x78.html index 953d7ec0..2fd93cd1 100644 --- a/functions_0x78.html +++ b/functions_0x78.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_0x79.html b/functions_0x79.html index cfe7795e..fac8728a 100644 --- a/functions_0x79.html +++ b/functions_0x79.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members @@ -31,7 +31,7 @@ - + @@ -136,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_enum.html b/functions_enum.html index e3284835..f953d97e 100644 --- a/functions_enum.html +++ b/functions_enum.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Enumerations @@ -31,7 +31,7 @@ - + @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_eval.html b/functions_eval.html index 20e05dc5..eaef59b1 100644 --- a/functions_eval.html +++ b/functions_eval.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Enumerator @@ -31,7 +31,7 @@ - + @@ -121,7 +121,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func.html b/functions_func.html index 1d787835..1380f8cf 100644 --- a/functions_func.html +++ b/functions_func.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x62.html b/functions_func_0x62.html index 02fefd04..28c0a14e 100644 --- a/functions_func_0x62.html +++ b/functions_func_0x62.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -137,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : MAX3421e< SS, INTR >
  • buttonChanged() -: XBOXRECV +: XBOXRECV
  • ByteSkipper() : ByteSkipper @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x63.html b/functions_func_0x63.html index e33c6cc0..e2dc7a49 100644 --- a/functions_func_0x63.html +++ b/functions_func_0x63.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -131,9 +131,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • ClearCommFeature() : ACM
  • -
  • ClearEpHalt() -: BulkOnly -
  • ClearHubFeature() : USBHub
  • @@ -146,6 +143,10 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • ConfigDescParser() : ConfigDescParser< CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK >
  • +
  • ConfigureDevice() +: BulkOnly +, USBDeviceConfig +
  • Configuring() : USB
  • @@ -170,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x64.html b/functions_func_0x64.html index 925f6ab2..759269d8 100644 --- a/functions_func_0x64.html +++ b/functions_func_0x64.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x65.html b/functions_func_0x65.html index 45ad96d4..ae4eb3bc 100644 --- a/functions_func_0x65.html +++ b/functions_func_0x65.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -137,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x66.html b/functions_func_0x66.html index c345064a..d4ac161d 100644 --- a/functions_func_0x66.html +++ b/functions_func_0x66.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x67.html b/functions_func_0x67.html index a732c7b7..eba8ed7f 100644 --- a/functions_func_0x67.html +++ b/functions_func_0x67.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • getAngle() @@ -158,7 +158,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • getBatteryLevel() : WII -, XBOXRECV +, XBOXRECV
  • GetbMaxLUN() : BulkOnly @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • getButtonClick() : WII -, XBOXRECV +, XBOXRECV , XBOXUSB , PS3BT , PS3USB @@ -180,9 +180,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • +
  • GetCapacity() +: BulkOnly +
  • GetCommFeature() : ACM
  • @@ -249,9 +252,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • GetLineCoding() : ACM
  • -
  • GetMaxLUN() -: BulkOnly -
  • GetNotif() : ACM
  • @@ -271,23 +271,26 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : HID
  • GetReportParser() -: HID -, HIDUniversal +: HIDUniversal +, HID
  • getRoll() : WII
  • +
  • GetSectorSize() +: BulkOnly +
  • getSensor() -: PS3USB -, PS3BT +: PS3BT +, PS3USB
  • getStatus() -: PS3USB -, PS3BT +: PS3BT +, PS3USB
  • getStatusString() -: PS3USB -, PS3BT +: PS3BT +, PS3USB
  • getStrDescr() : USB @@ -299,8 +302,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : HID
  • GetUsbDevicePtr() -: AddressPool -, AddressPoolImpl< MAX_DEVICES_ALLOWED > +: AddressPoolImpl< MAX_DEVICES_ALLOWED > +, AddressPool
  • getUsbTaskState() : USB @@ -329,7 +332,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x68.html b/functions_func_0x68.html index 3ac4806c..f0c17b7f 100644 --- a/functions_func_0x68.html +++ b/functions_func_0x68.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -124,12 +124,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • HandleLockingKeys() : KeyboardReportParser
  • -
  • HandleSCSIError() -: BulkOnly -
  • -
  • HandleUsbError() -: BulkOnly -
  • hci_accept_connection() : BTD
  • @@ -205,7 +199,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x69.html b/functions_func_0x69.html index 5a25c051..5f60badb 100644 --- a/functions_func_0x69.html +++ b/functions_func_0x69.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -121,25 +121,29 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');  

    - i -

    diff --git a/functions_func_0x6b.html b/functions_func_0x6b.html index 9c13d257..9218e789 100644 --- a/functions_func_0x6b.html +++ b/functions_func_0x6b.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x6c.html b/functions_func_0x6c.html index 67cfdb7f..061e7963 100644 --- a/functions_func_0x6c.html +++ b/functions_func_0x6c.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -148,13 +148,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • leftToRight() : Max_LCD
  • +
  • LockMedia() +: BulkOnly +
  • +
  • LUNIsGood() +: BulkOnly +
  • diff --git a/functions_func_0x6d.html b/functions_func_0x6d.html index 5bfd6205..e57ea47d 100644 --- a/functions_func_0x6d.html +++ b/functions_func_0x6d.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -130,12 +130,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MediaCTL() : BulkOnly
  • -
  • ModeSense() -: BulkOnly -
  • moveSetBulb() -: PS3USB -, PS3BT +: PS3BT +, PS3USB +, PS3BT +, PS3USB
  • moveSetRumble() : PS3BT @@ -150,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x6e.html b/functions_func_0x6e.html index 52e3b118..3449d087 100644 --- a/functions_func_0x6e.html +++ b/functions_func_0x6e.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -139,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x6f.html b/functions_func_0x6f.html index 283dec45..7bbee2a6 100644 --- a/functions_func_0x6f.html +++ b/functions_func_0x6f.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -124,10 +124,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • OemToAscii() : KeyboardReportParser
  • +
  • OnControlKeysChanged() +: KeyboardReportParser +
  • OnInit() -: CDCAsyncOper +: FTDIAsyncOper , BulkOnly -, FTDIAsyncOper +, CDCAsyncOper
  • OnInitSuccessful() : HIDUniversal @@ -171,7 +174,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x70.html b/functions_func_0x70.html index 3f81b5f4..66caceec 100644 --- a/functions_func_0x70.html +++ b/functions_func_0x70.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -245,7 +245,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x72.html b/functions_func_0x72.html index 701dc7e2..cc9ead02 100644 --- a/functions_func_0x72.html +++ b/functions_func_0x72.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -126,14 +126,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , ACM , FTDI
  • -
  • read() -: SPP -
  • Read() : BulkOnly
  • -
  • ReadCapacity() -: BulkOnly +
  • read() +: SPP
  • readPollInterval() : BTD @@ -151,18 +148,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : MAX3421e< SS, INTR >
  • Release() -: FTDI -, HIDBoot< BOOT_PROTOCOL > +: HIDBoot< BOOT_PROTOCOL > , HIDUniversal , BulkOnly , PS3USB +, XBOXUSB , USBDeviceConfig , USBHub , XBOXRECV -, XBOXUSB , ADK , BTD , ACM +, FTDI
  • ReleaseDevice() : USB @@ -173,35 +170,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • ReportDescParserBase() : ReportDescParserBase
  • -
  • RequestSense() -: BulkOnly -
  • Reset() -: SPP +: WII +, SPP
  • reset() : MAX3421e< SS, INTR >
  • Reset() -: BluetoothService -, WII -, PS3BT -, BulkOnly +: PS3BT +, BluetoothService
  • ResetHubPreMask() : USB
  • -
  • ResetRecovery() -: BulkOnly -
  • rightToLeft() : Max_LCD
  • Run() : SPP -, BluetoothService , PS3BT , WII +, BluetoothService
  • @@ -209,7 +199,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x73.html b/functions_func_0x73.html index 57479f7e..49bab7b0 100644 --- a/functions_func_0x73.html +++ b/functions_func_0x73.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • SetBaudRate() @@ -162,9 +162,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • SetControlLineState() : ACM
  • -
  • SetCurLUN() -: BulkOnly -
  • setCursor() : Max_LCD
  • @@ -202,41 +199,41 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : HID
  • setLedBlink() -: XBOXRECV +: XBOXRECV , XBOXUSB
  • setLedMode() -: XBOXRECV +: XBOXRECV , XBOXUSB
  • setLedOff() : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • setLedOn() -: XBOXUSB -, PS3BT +: PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV +, XBOXUSB
  • setLedRaw() : PS3BT , PS3USB , WII -, XBOXRECV +, XBOXRECV , XBOXUSB
  • setLedStatus() : WII
  • setLedToggle() -: PS3USB +: WII , PS3BT -, WII +, PS3USB
  • SetLineCoding() : ACM @@ -257,23 +254,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : HID
  • SetReportParser() -: HIDBoot< BOOT_PROTOCOL > -, HIDUniversal +: HIDUniversal +, HIDBoot< BOOT_PROTOCOL > , HID
  • setRumbleOff() -: PS3BT -, WII -, XBOXRECV +: XBOXUSB , PS3USB -, XBOXUSB +, XBOXRECV +, PS3BT +, WII
  • setRumbleOn() -: PS3USB -, XBOXRECV +: XBOXRECV , PS3BT , XBOXUSB -, PS3USB +, PS3USB , PS3BT , WII
  • @@ -290,9 +286,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : ByteSkipper
  • SndData() -: FTDI +: ADK +, FTDI , ACM -, ADK
  • SPP() : SPP @@ -306,7 +302,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x74.html b/functions_func_0x74.html index 39a0d180..c8338a42 100644 --- a/functions_func_0x74.html +++ b/functions_func_0x74.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -125,23 +125,17 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : USB , MAX3421e< SS, INTR >
  • -
  • TestUnitReady() -: BulkOnly -
  • Toggle() : TPin< PORT, PIN > , TCom< TCCR, COM >
  • -
  • Transaction() -: BulkOnly -
  • diff --git a/functions_func_0x75.html b/functions_func_0x75.html index 7713ac4e..62018d72 100644 --- a/functions_func_0x75.html +++ b/functions_func_0x75.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -133,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_0x77.html b/functions_func_0x77.html index 107630d2..961e3ab0 100644 --- a/functions_func_0x77.html +++ b/functions_func_0x77.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -133,18 +133,23 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • write() : SPP , Max_LCD -, SPP
  • Write() : BulkOnly
  • +
  • write() +: SPP +
  • +
  • WriteProtected() +: BulkOnly +
  • diff --git a/functions_func_0x78.html b/functions_func_0x78.html index e7df01b6..f762c29d 100644 --- a/functions_func_0x78.html +++ b/functions_func_0x78.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Functions @@ -31,7 +31,7 @@ - + @@ -133,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_type.html b/functions_type.html index 2a625bc7..d26b7b1b 100644 --- a/functions_type.html +++ b/functions_type.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Typedefs @@ -31,7 +31,7 @@ - + @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars.html b/functions_vars.html index 9c71a874..3e27f2ee 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x62.html b/functions_vars_0x62.html index 89388921..cd5ab369 100644 --- a/functions_vars_0x62.html +++ b/functions_vars_0x62.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -522,7 +522,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x63.html b/functions_vars_0x63.html index 783d2aeb..2b339f75 100644 --- a/functions_vars_0x63.html +++ b/functions_vars_0x63.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -186,13 +186,19 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • consTitlesE : ReportDescParserBase
  • +
  • CurrentCapacity +: BulkOnly +
  • +
  • CurrentSectorSize +: BulkOnly +
  • diff --git a/functions_vars_0x64.html b/functions_vars_0x64.html index a4c163d5..c33bf76d 100644 --- a/functions_vars_0x64.html +++ b/functions_vars_0x64.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x65.html b/functions_vars_0x65.html index 3f24ca4e..7f728da9 100644 --- a/functions_vars_0x65.html +++ b/functions_vars_0x65.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x67.html b/functions_vars_0x67.html index 73812ac7..bcd4d50f 100644 --- a/functions_vars_0x67.html +++ b/functions_vars_0x67.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -180,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x68.html b/functions_vars_0x68.html index a6da12af..f69658f7 100644 --- a/functions_vars_0x68.html +++ b/functions_vars_0x68.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x69.html b/functions_vars_0x69.html index 9f12a541..83493cf9 100644 --- a/functions_vars_0x69.html +++ b/functions_vars_0x69.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -165,7 +165,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x6b.html b/functions_vars_0x6b.html index 63e4b57d..156d84ce 100644 --- a/functions_vars_0x6b.html +++ b/functions_vars_0x6b.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x6c.html b/functions_vars_0x6c.html index 91b4195e..fbf0a913 100644 --- a/functions_vars_0x6c.html +++ b/functions_vars_0x6c.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -138,13 +138,16 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • lowspeed : UsbDevice
  • +
  • LUNOk +: BulkOnly +
  • diff --git a/functions_vars_0x6d.html b/functions_vars_0x6d.html index 44b652b8..2517a1a4 100644 --- a/functions_vars_0x6d.html +++ b/functions_vars_0x6d.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -165,7 +165,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x6e.html b/functions_vars_0x6e.html index 6abe50d2..183efe31 100644 --- a/functions_vars_0x6e.html +++ b/functions_vars_0x6e.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x6f.html b/functions_vars_0x6f.html index 70324dd2..ee7f586c 100644 --- a/functions_vars_0x6f.html +++ b/functions_vars_0x6f.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -132,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x70.html b/functions_vars_0x70.html index 501612ca..45561734 100644 --- a/functions_vars_0x70.html +++ b/functions_vars_0x70.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -181,7 +181,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x71.html b/functions_vars_0x71.html index 17bdabed..90503e77 100644 --- a/functions_vars_0x71.html +++ b/functions_vars_0x71.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x72.html b/functions_vars_0x72.html index 7e2e6e99..adf75784 100644 --- a/functions_vars_0x72.html +++ b/functions_vars_0x72.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x73.html b/functions_vars_0x73.html index f43fd9ad..9d327518 100644 --- a/functions_vars_0x73.html +++ b/functions_vars_0x73.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -159,7 +159,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x74.html b/functions_vars_0x74.html index 9092b6e6..82b6577d 100644 --- a/functions_vars_0x74.html +++ b/functions_vars_0x74.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x75.html b/functions_vars_0x75.html index 77cb4e73..3d882a1f 100644 --- a/functions_vars_0x75.html +++ b/functions_vars_0x75.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x76.html b/functions_vars_0x76.html index a0a11945..065b4619 100644 --- a/functions_vars_0x76.html +++ b/functions_vars_0x76.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x77.html b/functions_vars_0x77.html index 6ee5ed51..d2c523cc 100644 --- a/functions_vars_0x77.html +++ b/functions_vars_0x77.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -162,6 +162,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • wMaxPacketSize : USB_ENDPOINT_DESCRIPTOR
  • +
  • WriteOk +: BulkOnly +
  • wTotalLength : USB_CONFIGURATION_DESCRIPTOR
  • @@ -169,8 +172,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : SETUP_PKT
  • wValue -: SETUP_PKT -, CLASS_NOTIFICATION +: CLASS_NOTIFICATION +, SETUP_PKT
  • wValueHi : SETUP_PKT @@ -184,7 +187,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x78.html b/functions_vars_0x78.html index 24840795..2e8512ea 100644 --- a/functions_vars_0x78.html +++ b/functions_vars_0x78.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -136,7 +136,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars_0x79.html b/functions_vars_0x79.html index 6251099d..f230fffc 100644 --- a/functions_vars_0x79.html +++ b/functions_vars_0x79.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Members - Variables @@ -31,7 +31,7 @@ - + @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals.html b/globals.html index 8a724d6a..3bfae3bf 100644 --- a/globals.html +++ b/globals.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x61.html b/globals_0x61.html index 8f0a615f..59ba2b48 100644 --- a/globals_0x61.html +++ b/globals_0x61.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -218,7 +218,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x62.html b/globals_0x62.html index fd4fffd6..27a1a054 100644 --- a/globals_0x62.html +++ b/globals_0x62.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -662,7 +662,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x63.html b/globals_0x63.html index 30f231d1..de179638 100644 --- a/globals_0x63.html +++ b/globals_0x63.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -311,7 +311,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x64.html b/globals_0x64.html index 4049e15f..ab834708 100644 --- a/globals_0x64.html +++ b/globals_0x64.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -161,17 +161,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • DCR2_INIT_X : cdcprolific.h
  • -
  • DEBUG -: Wii.cpp -, PS3BT.cpp -, message.cpp -, PS3USB.cpp -, SPP.cpp -, XBOXRECV.cpp -, XBOXUSB.cpp -, BTD.cpp -, masstorage.h -
  • DEFAULT_AUTO : cdcprolific.h
  • @@ -199,7 +188,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x65.html b/globals_0x65.html index bc62b3f5..4d96224e 100644 --- a/globals_0x65.html +++ b/globals_0x65.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -128,21 +128,36 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • E : max_LCD.cpp
  • +
  • E_Notify() +: message.cpp +, message.h +, message.cpp +, message.h +
  • +
  • E_Notifyc() +: message.h +, printhex.h +, message.cpp +
  • +
  • E_NotifyStr() +: message.cpp +, message.h +
  • EP_DESCR_LEN : usb_ch9.h
  • EP_INTERRUPT -: XBOXRECV.h +: PS3USB.h +, XBOXRECV.h , XBOXUSB.h -, PS3USB.h
  • EP_MAXPKTSIZE -: XBOXUSB.h -, PS3USB.h +: PS3USB.h , XBOXRECV.h +, XBOXUSB.h
  • ErrorMessage() -: message.h +: message.h
  • EV_AUTHENTICATION_COMPLETE : BTD.h @@ -222,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x66.html b/globals_0x66.html index 061d34ed..73266856 100644 --- a/globals_0x66.html +++ b/globals_0x66.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -269,7 +269,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x67.html b/globals_0x67.html index 6c23fc9f..2aef325c 100644 --- a/globals_0x67.html +++ b/globals_0x67.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x68.html b/globals_0x68.html index 9b19e6a8..8c06b3f2 100644 --- a/globals_0x68.html +++ b/globals_0x68.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -493,7 +493,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x69.html b/globals_0x69.html index 04e4a74e..a59e6452 100644 --- a/globals_0x69.html +++ b/globals_0x69.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -137,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x6a.html b/globals_0x6a.html index 732ad536..163452d6 100644 --- a/globals_0x6a.html +++ b/globals_0x6a.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -134,7 +134,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x6b.html b/globals_0x6b.html index ddc9ba6a..e054fba8 100644 --- a/globals_0x6b.html +++ b/globals_0x6b.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -227,7 +227,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x6c.html b/globals_0x6c.html index ef314c9f..c11527e7 100644 --- a/globals_0x6c.html +++ b/globals_0x6c.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -540,7 +540,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x6d.html b/globals_0x6d.html index 7cd024c2..bd271653 100644 --- a/globals_0x6d.html +++ b/globals_0x6d.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -168,12 +168,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MASS_ERR_INVALID_LUN : masstorage.h
  • +
  • MASS_ERR_MEDIA_CHANGED +: masstorage.h +
  • MASS_ERR_NO_MEDIA : masstorage.h
  • MASS_ERR_PHASE_ERROR : masstorage.h
  • +
  • MASS_ERR_READ_NAKS +: masstorage.h +
  • MASS_ERR_STALL : masstorage.h
  • @@ -192,9 +198,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MASS_ERR_USER : masstorage.h
  • +
  • MASS_ERR_WRITE_NAKS +: masstorage.h +
  • +
  • MASS_ERR_WRITE_PROTECTED +: masstorage.h +
  • +
  • MASS_ERR_WRITE_STALL +: masstorage.h +
  • MASS_MAX_ENDPOINTS : masstorage.h
  • +
  • MASS_MAX_SUPPORTED_LUN +: masstorage.h +
  • MASS_PROTO_BBB : masstorage.h
  • @@ -321,7 +339,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x6e.html b/globals_0x6e.html index 9cb9bfac..0e915533 100644 --- a/globals_0x6e.html +++ b/globals_0x6e.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -131,43 +131,32 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • NotCharging : PS3Enums.h
  • -
  • Notify() -: message.cpp -, message.h -, message.cpp -, message.h +
  • Notify +: message.h
  • -
  • Notifyc() -: message.cpp -, printhex.h +
  • Notifyc +: message.h
  • NotifyFail -: message.h -, message.cpp +: message.h
  • NotifyFailGetConfDescr -: message.h -, message.cpp +: message.h
  • -
  • NotifyFailGetDevDescr() -: message.cpp -, message.h +
  • NotifyFailGetDevDescr +: message.h
  • NotifyFailSetConfDescr -: message.h -, message.cpp +: message.h
  • -
  • NotifyFailSetDevTblEntry() -: message.cpp -, message.h +
  • NotifyFailSetDevTblEntry +: message.h
  • -
  • NotifyFailUnknownDevice() -: message.cpp -, message.h +
  • NotifyFailUnknownDevice +: message.h
  • -
  • NotifyStr() -: message.h -, message.cpp +
  • NotifyStr +: message.h
  • nunchuck_connected_flag : Wii.h @@ -178,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x6f.html b/globals_0x6f.html index 8bfd9471..7112edc9 100644 --- a/globals_0x6f.html +++ b/globals_0x6f.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x70.html b/globals_0x70.html index 7b1c1f98..dd600bac 100644 --- a/globals_0x70.html +++ b/globals_0x70.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -2812,7 +2812,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x72.html b/globals_0x72.html index 27d3d651..275cfa67 100644 --- a/globals_0x72.html +++ b/globals_0x72.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -281,7 +281,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x73.html b/globals_0x73.html index e6749389..2803aac8 100644 --- a/globals_0x73.html +++ b/globals_0x73.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -128,6 +128,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • SCSI_ASC_LBA_OUT_OF_RANGE : masstorage.h
  • +
  • SCSI_ASC_MEDIA_CHANGED +: masstorage.h +
  • SCSI_ASC_MEDIUM_NOT_PRESENT : masstorage.h
  • @@ -143,6 +146,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • SCSI_CMD_MODE_SENSE_6 : masstorage.h
  • +
  • SCSI_CMD_PREVENT_REMOVAL +: masstorage.h +
  • SCSI_CMD_READ_10 : masstorage.h
  • @@ -269,7 +275,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x74.html b/globals_0x74.html index a5502945..ddfe6cb3 100644 --- a/globals_0x74.html +++ b/globals_0x74.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -254,7 +254,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x75.html b/globals_0x75.html index 531aff64..19645c7b 100644 --- a/globals_0x75.html +++ b/globals_0x75.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -143,6 +143,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • USB_ATTACHED_SUBSTATE_SETTLE : Usb.h
  • +
  • USB_ATTACHED_SUBSTATE_WAIT_RESET +: Usb.h +
  • USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE : Usb.h
  • @@ -257,12 +260,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE : Usb.h
  • +
  • USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET +: Usb.h +
  • USB_ERROR_EP_NOT_FOUND_IN_TBL : Usb.h
  • USB_ERROR_EPINFO_IS_NULL : Usb.h
  • +
  • USB_ERROR_FailGetConfDescr +: Usb.h +
  • +
  • USB_ERROR_FailGetDevDescr +: Usb.h +
  • +
  • USB_ERROR_FailSetDevTblEntry +: Usb.h +
  • USB_ERROR_HUB_ADDRESS_OVERFLOW : Usb.h
  • @@ -293,8 +308,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • USB_FEATURE_TEST_MODE : usb_ch9.h
  • -
  • USB_METHODS_INLINE -: Usb.h +
  • USB_HOST_SERIAL +: message.h +, printhex.h
  • USB_NAK_DEFAULT : address.h @@ -432,8 +448,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : Usb.h
  • UsbDEBUGlvl -: message.h -, message.cpp +: message.cpp +, hexdump.h +, message.h
  • UsbDeviceHandleFunc : address.h @@ -450,7 +467,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x76.html b/globals_0x76.html index 43234757..5b531ad3 100644 --- a/globals_0x76.html +++ b/globals_0x76.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x77.html b/globals_0x77.html index a170ab95..97550a6f 100644 --- a/globals_0x77.html +++ b/globals_0x77.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x78.html b/globals_0x78.html index b7293c96..5387405c 100644 --- a/globals_0x78.html +++ b/globals_0x78.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -199,7 +199,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x79.html b/globals_0x79.html index 27f8122b..1e47a76d 100644 --- a/globals_0x79.html +++ b/globals_0x79.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -137,7 +137,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_0x7a.html b/globals_0x7a.html index be692f43..20bcc94f 100644 --- a/globals_0x7a.html +++ b/globals_0x7a.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs.html b/globals_defs.html index a9cf5383..eed6e59e 100644 --- a/globals_defs.html +++ b/globals_defs.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -132,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x61.html b/globals_defs_0x61.html index 929dbbe0..82b7cb03 100644 --- a/globals_defs_0x61.html +++ b/globals_defs_0x61.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -180,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x62.html b/globals_defs_0x62.html index 53ed8da9..a8985040 100644 --- a/globals_defs_0x62.html +++ b/globals_defs_0x62.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -638,7 +638,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x63.html b/globals_defs_0x63.html index dd828181..94953519 100644 --- a/globals_defs_0x63.html +++ b/globals_defs_0x63.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -288,7 +288,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x64.html b/globals_defs_0x64.html index e79e812c..12bb53b2 100644 --- a/globals_defs_0x64.html +++ b/globals_defs_0x64.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -159,17 +159,6 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • DCR2_INIT_X : cdcprolific.h
  • -
  • DEBUG -: masstorage.h -, Wii.cpp -, PS3BT.cpp -, SPP.cpp -, PS3USB.cpp -, XBOXRECV.cpp -, message.cpp -, XBOXUSB.cpp -, BTD.cpp -
  • DEFAULT_AUTO : cdcprolific.h
  • @@ -188,7 +177,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x65.html b/globals_defs_0x65.html index 85dc8f3f..0bd64137 100644 --- a/globals_defs_0x65.html +++ b/globals_defs_0x65.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -217,7 +217,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x66.html b/globals_defs_0x66.html index e98124cf..701d8c09 100644 --- a/globals_defs_0x66.html +++ b/globals_defs_0x66.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -261,7 +261,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x67.html b/globals_defs_0x67.html index 1a985279..45d16f08 100644 --- a/globals_defs_0x67.html +++ b/globals_defs_0x67.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x68.html b/globals_defs_0x68.html index 98f161ee..e6546018 100644 --- a/globals_defs_0x68.html +++ b/globals_defs_0x68.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -476,7 +476,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x69.html b/globals_defs_0x69.html index 762d0bf3..f1e6e5a2 100644 --- a/globals_defs_0x69.html +++ b/globals_defs_0x69.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x6a.html b/globals_defs_0x6a.html index 58f2a0db..f687c705 100644 --- a/globals_defs_0x6a.html +++ b/globals_defs_0x6a.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -132,7 +132,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x6b.html b/globals_defs_0x6b.html index ee7daa23..1c35ed38 100644 --- a/globals_defs_0x6b.html +++ b/globals_defs_0x6b.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -210,7 +210,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x6c.html b/globals_defs_0x6c.html index d1518004..8e93c259 100644 --- a/globals_defs_0x6c.html +++ b/globals_defs_0x6c.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -471,7 +471,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x6d.html b/globals_defs_0x6d.html index 25f4cd02..5c9d04dd 100644 --- a/globals_defs_0x6d.html +++ b/globals_defs_0x6d.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -166,12 +166,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MASS_ERR_INVALID_LUN : masstorage.h
  • +
  • MASS_ERR_MEDIA_CHANGED +: masstorage.h +
  • MASS_ERR_NO_MEDIA : masstorage.h
  • MASS_ERR_PHASE_ERROR : masstorage.h
  • +
  • MASS_ERR_READ_NAKS +: masstorage.h +
  • MASS_ERR_STALL : masstorage.h
  • @@ -190,9 +196,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • MASS_ERR_USER : masstorage.h
  • +
  • MASS_ERR_WRITE_NAKS +: masstorage.h +
  • +
  • MASS_ERR_WRITE_PROTECTED +: masstorage.h +
  • +
  • MASS_ERR_WRITE_STALL +: masstorage.h +
  • MASS_MAX_ENDPOINTS : masstorage.h
  • +
  • MASS_MAX_SUPPORTED_LUN +: masstorage.h +
  • MASS_PROTO_BBB : masstorage.h
  • @@ -280,7 +298,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x6e.html b/globals_defs_0x6e.html index 8c47ed7d..e9294e6f 100644 --- a/globals_defs_0x6e.html +++ b/globals_defs_0x6e.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -126,23 +126,32 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • NETWORK_CONNECTION : cdcacm.h
  • +
  • Notify +: message.h +
  • +
  • Notifyc +: message.h +
  • NotifyFail -: message.h +: message.h
  • NotifyFailGetConfDescr -: message.h +: message.h
  • NotifyFailGetDevDescr -: message.h +: message.h
  • NotifyFailSetConfDescr -: message.h +: message.h
  • NotifyFailSetDevTblEntry -: message.h +: message.h
  • NotifyFailUnknownDevice -: message.h +: message.h +
  • +
  • NotifyStr +: message.h
  • nunchuck_connected_flag : Wii.h @@ -153,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x6f.html b/globals_defs_0x6f.html index 187e34db..8a8cf24b 100644 --- a/globals_defs_0x6f.html +++ b/globals_defs_0x6f.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x70.html b/globals_defs_0x70.html index 9f510135..01e0c5de 100644 --- a/globals_defs_0x70.html +++ b/globals_defs_0x70.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -190,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x72.html b/globals_defs_0x72.html index 36a16c79..bca84415 100644 --- a/globals_defs_0x72.html +++ b/globals_defs_0x72.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -228,7 +228,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x73.html b/globals_defs_0x73.html index c718881b..e23f7e5a 100644 --- a/globals_defs_0x73.html +++ b/globals_defs_0x73.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -126,6 +126,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • SCSI_ASC_LBA_OUT_OF_RANGE : masstorage.h
  • +
  • SCSI_ASC_MEDIA_CHANGED +: masstorage.h +
  • SCSI_ASC_MEDIUM_NOT_PRESENT : masstorage.h
  • @@ -141,6 +144,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • SCSI_CMD_MODE_SENSE_6 : masstorage.h
  • +
  • SCSI_CMD_PREVENT_REMOVAL +: masstorage.h +
  • SCSI_CMD_READ_10 : masstorage.h
  • @@ -240,7 +246,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x74.html b/globals_defs_0x74.html index b1f5dc86..e3fc6d77 100644 --- a/globals_defs_0x74.html +++ b/globals_defs_0x74.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -228,7 +228,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x75.html b/globals_defs_0x75.html index b53a9274..aa6da71a 100644 --- a/globals_defs_0x75.html +++ b/globals_defs_0x75.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -132,6 +132,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • USB_ATTACHED_SUBSTATE_SETTLE : Usb.h
  • +
  • USB_ATTACHED_SUBSTATE_WAIT_RESET +: Usb.h +
  • USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE : Usb.h
  • @@ -246,12 +249,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE : Usb.h
  • +
  • USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET +: Usb.h +
  • USB_ERROR_EP_NOT_FOUND_IN_TBL : Usb.h
  • USB_ERROR_EPINFO_IS_NULL : Usb.h
  • +
  • USB_ERROR_FailGetConfDescr +: Usb.h +
  • +
  • USB_ERROR_FailGetDevDescr +: Usb.h +
  • +
  • USB_ERROR_FailSetDevTblEntry +: Usb.h +
  • USB_ERROR_HUB_ADDRESS_OVERFLOW : Usb.h
  • @@ -282,8 +297,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • USB_FEATURE_TEST_MODE : usb_ch9.h
  • -
  • USB_METHODS_INLINE -: Usb.h +
  • USB_HOST_SERIAL +: message.h +, printhex.h
  • USB_NAK_DEFAULT : address.h @@ -432,7 +448,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x76.html b/globals_defs_0x76.html index 24b46ec9..316f0910 100644 --- a/globals_defs_0x76.html +++ b/globals_defs_0x76.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x77.html b/globals_defs_0x77.html index e10dc749..195f7f0b 100644 --- a/globals_defs_0x77.html +++ b/globals_defs_0x77.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_defs_0x78.html b/globals_defs_0x78.html index 9aaaed14..f54a952d 100644 --- a/globals_defs_0x78.html +++ b/globals_defs_0x78.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -185,7 +185,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_enum.html b/globals_enum.html index c437ddc3..1fa4501e 100644 --- a/globals_enum.html +++ b/globals_enum.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_eval.html b/globals_eval.html index 02c644e8..edd1c3a2 100644 --- a/globals_eval.html +++ b/globals_eval.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -548,7 +548,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_func.html b/globals_func.html index 2ded44e3..250617d1 100644 --- a/globals_func.html +++ b/globals_func.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -93,40 +93,22 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
     
    - + @@ -120,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars.html b/globals_vars.html index 9c5ff8ca..cf70d9af 100644 --- a/globals_vars.html +++ b/globals_vars.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_0x62.html b/globals_vars_0x62.html index 39d5a821..136ff76b 100644 --- a/globals_vars_0x62.html +++ b/globals_vars_0x62.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_0x6c.html b/globals_vars_0x6c.html index 06859277..c79a4639 100644 --- a/globals_vars_0x6c.html +++ b/globals_vars_0x6c.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -116,7 +116,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_0x70.html b/globals_vars_0x70.html index a86d4f28..9e7dc638 100644 --- a/globals_vars_0x70.html +++ b/globals_vars_0x70.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -2695,7 +2695,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_0x72.html b/globals_vars_0x72.html index 102a6a9e..e348d079 100644 --- a/globals_vars_0x72.html +++ b/globals_vars_0x72.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_0x75.html b/globals_vars_0x75.html index a315697c..9ba509c3 100644 --- a/globals_vars_0x75.html +++ b/globals_vars_0x75.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -107,8 +107,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    - u -

    @@ -116,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/globals_vars_0x78.html b/globals_vars_0x78.html index c9c5dde4..a95fd613 100644 --- a/globals_vars_0x78.html +++ b/globals_vars_0x78.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: File Members @@ -31,7 +31,7 @@ - + @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/graph_legend.html b/graph_legend.html index b8025d38..04421627 100644 --- a/graph_legend.html +++ b/graph_legend.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Graph Legend @@ -31,7 +31,7 @@ - + @@ -148,7 +148,7 @@ A yellow dashed arrow denotes a relation between a template instance and the tem diff --git a/hexdump_8h.html b/hexdump_8h.html index 3ac788d2..8ec6e83c 100644 --- a/hexdump_8h.html +++ b/hexdump_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hexdump.h File Reference @@ -31,7 +31,7 @@ - + @@ -86,24 +86,29 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    +Classes | +Variables
    hexdump.h File Reference
    #include <inttypes.h>
    #include <avr/pgmspace.h>
    +#include "printhex.h"
    +#include "message.h"
    Include dependency graph for hexdump.h:
    + +
    This graph shows which files directly or indirectly include this file:
    - +

    Go to the source code of this file.

    @@ -112,13 +117,33 @@ This graph shows which files directly or indirectly include this file:
    Classes class  HexDumper< BASE_CLASS, LEN_TYPE, OFFSET_TYPE >   + + + +

    +Variables

    int UsbDEBUGlvl
     
    +

    Variable Documentation

    + +
    +
    + + + + +
    int UsbDEBUGlvl
    +
    + +

    Definition at line 22 of file message.cpp.

    + +
    +
    diff --git a/hexdump_8h__dep__incl.map b/hexdump_8h__dep__incl.map index a4bd8020..40de918c 100644 --- a/hexdump_8h__dep__incl.map +++ b/hexdump_8h__dep__incl.map @@ -1,45 +1,45 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hexdump_8h__dep__incl.md5 b/hexdump_8h__dep__incl.md5 index 552acab4..787aee91 100644 --- a/hexdump_8h__dep__incl.md5 +++ b/hexdump_8h__dep__incl.md5 @@ -1 +1 @@ -0150e93ce0328ea52e4c2b755c90488e \ No newline at end of file +5533c30820093c392b53b3d3dbba2ef2 \ No newline at end of file diff --git a/hexdump_8h__dep__incl.png b/hexdump_8h__dep__incl.png index edd9e969..b6b04606 100644 Binary files a/hexdump_8h__dep__incl.png and b/hexdump_8h__dep__incl.png differ diff --git a/hexdump_8h__incl.map b/hexdump_8h__incl.map index 83211391..48a70125 100644 --- a/hexdump_8h__incl.map +++ b/hexdump_8h__incl.map @@ -1,2 +1,4 @@ + + diff --git a/hexdump_8h__incl.md5 b/hexdump_8h__incl.md5 index 0cd2dade..336056ea 100644 --- a/hexdump_8h__incl.md5 +++ b/hexdump_8h__incl.md5 @@ -1 +1 @@ -8a10af342825d83f5232b053a35b9fae \ No newline at end of file +91c986cdde08fa18a3e455fc2c41473c \ No newline at end of file diff --git a/hexdump_8h__incl.png b/hexdump_8h__incl.png index 09190c1a..a1abb530 100644 Binary files a/hexdump_8h__incl.png and b/hexdump_8h__incl.png differ diff --git a/hexdump_8h_source.html b/hexdump_8h_source.html index af2dd830..e579990d 100644 --- a/hexdump_8h_source.html +++ b/hexdump_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hexdump.h Source File @@ -31,7 +31,7 @@ - + @@ -110,53 +110,55 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    19 
    20 #include <inttypes.h>
    21 #include <avr/pgmspace.h>
    -
    22 
    -
    23 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
    -
    24 class HexDumper : public BASE_CLASS {
    -
    25  uint8_t byteCount;
    -
    26  OFFSET_TYPE byteTotal;
    -
    27 
    -
    28 public:
    -
    29 
    -
    30  HexDumper() : byteCount(0), byteTotal(0) {
    -
    31  };
    -
    32 
    -
    33  void Initialize() {
    -
    34  byteCount = 0;
    -
    35  byteTotal = 0;
    -
    36  };
    -
    37 
    -
    38  virtual void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset);
    -
    39 };
    -
    40 
    -
    41 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
    -
    42 void HexDumper<BASE_CLASS, LEN_TYPE, OFFSET_TYPE>::Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) {
    -
    43 #ifdef DEBUG
    -
    44  if(UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug.
    -
    45  for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) {
    -
    46  if(!byteCount) {
    -
    47  PrintHex<OFFSET_TYPE > (byteTotal, 0x80);
    -
    48  Notify(PSTR(": "), 0x80);
    -
    49  }
    -
    50  PrintHex<uint8_t > (pbuf[j], 0x80);
    -
    51  Notify(PSTR(" "), 0x80);
    -
    52 
    -
    53  if(byteCount == 15) {
    -
    54  Notify(PSTR("\r\n"), 0x80);
    -
    55  byteCount = 0xFF;
    -
    56  }
    -
    57  }
    -
    58  }
    -
    59 #endif
    -
    60 }
    -
    61 
    -
    62 #endif // __HEXDUMP_H__
    +
    22 #include "printhex.h"
    +
    23 #include "message.h"
    +
    24 
    +
    25 extern int UsbDEBUGlvl;
    +
    26 
    +
    27 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
    +
    28 class HexDumper : public BASE_CLASS {
    +
    29  uint8_t byteCount;
    +
    30  OFFSET_TYPE byteTotal;
    +
    31 
    +
    32 public:
    +
    33 
    +
    34  HexDumper() : byteCount(0), byteTotal(0) {
    +
    35  };
    +
    36 
    +
    37  void Initialize() {
    +
    38  byteCount = 0;
    +
    39  byteTotal = 0;
    +
    40  };
    +
    41 
    +
    42  virtual void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset);
    +
    43 };
    +
    44 
    +
    45 template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
    +
    46 void HexDumper<BASE_CLASS, LEN_TYPE, OFFSET_TYPE>::Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) {
    +
    47  if(UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug.
    +
    48  for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) {
    +
    49  if(!byteCount) {
    +
    50  PrintHex<OFFSET_TYPE > (byteTotal, 0x80);
    +
    51  E_Notify(PSTR(": "), 0x80);
    +
    52  }
    +
    53  PrintHex<uint8_t > (pbuf[j], 0x80);
    +
    54  E_Notify(PSTR(" "), 0x80);
    +
    55 
    +
    56  if(byteCount == 15) {
    +
    57  E_Notify(PSTR("\r\n"), 0x80);
    +
    58  byteCount = 0xFF;
    +
    59  }
    +
    60  }
    +
    61  }
    +
    62 }
    +
    63 
    +
    64 #endif // __HEXDUMP_H__
    diff --git a/hid_8cpp.html b/hid_8cpp.html index 8da0b93e..115d91db 100644 --- a/hid_8cpp.html +++ b/hid_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hid.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -95,7 +95,7 @@ Include dependency graph for hid.cpp:
    - +

    Go to the source code of this file.

    @@ -104,7 +104,7 @@ Include dependency graph for hid.cpp: diff --git a/hid_8cpp__incl.map b/hid_8cpp__incl.map index e2085371..966dc981 100644 --- a/hid_8cpp__incl.map +++ b/hid_8cpp__incl.map @@ -1,15 +1,15 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/hid_8cpp__incl.md5 b/hid_8cpp__incl.md5 index 41b17362..fbeff64e 100644 --- a/hid_8cpp__incl.md5 +++ b/hid_8cpp__incl.md5 @@ -1 +1 @@ -7e0c3b79e878a02106eae007f06c9a6e \ No newline at end of file +0381726f464bd7a128028696816b8a21 \ No newline at end of file diff --git a/hid_8cpp__incl.png b/hid_8cpp__incl.png index c8082fcc..6c58140b 100644 Binary files a/hid_8cpp__incl.png and b/hid_8cpp__incl.png differ diff --git a/hid_8cpp_source.html b/hid_8cpp_source.html index ac1486c0..114dfa08 100644 --- a/hid_8cpp_source.html +++ b/hid_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hid.cpp Source File @@ -31,7 +31,7 @@ - + @@ -133,42 +133,42 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    42 }
    43 
    44 void HID::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
    -
    45  Notify(PSTR("Endpoint descriptor:"), 0x80);
    -
    46  Notify(PSTR("\r\nLength:\t\t"), 0x80);
    +
    45  Notify(PSTR("Endpoint descriptor:"), 0x80);
    +
    46  Notify(PSTR("\r\nLength:\t\t"), 0x80);
    47  PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
    -
    48  Notify(PSTR("\r\nType:\t\t"), 0x80);
    +
    48  Notify(PSTR("\r\nType:\t\t"), 0x80);
    49  PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
    -
    50  Notify(PSTR("\r\nAddress:\t"), 0x80);
    +
    50  Notify(PSTR("\r\nAddress:\t"), 0x80);
    51  PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
    -
    52  Notify(PSTR("\r\nAttributes:\t"), 0x80);
    +
    52  Notify(PSTR("\r\nAttributes:\t"), 0x80);
    53  PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
    -
    54  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
    +
    54  Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
    55  PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
    -
    56  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
    +
    56  Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
    57  PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
    58 }
    59 
    60 void HID::PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc) {
    -
    61  Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80);
    -
    62  Notify(PSTR("bDescLength:\t\t"), 0x80);
    +
    61  Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80);
    +
    62  Notify(PSTR("bDescLength:\t\t"), 0x80);
    63  PrintHex<uint8_t > (pDesc->bLength, 0x80);
    64 
    -
    65  Notify(PSTR("\r\nbDescriptorType:\t"), 0x80);
    +
    65  Notify(PSTR("\r\nbDescriptorType:\t"), 0x80);
    66  PrintHex<uint8_t > (pDesc->bDescriptorType, 0x80);
    67 
    -
    68  Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80);
    +
    68  Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80);
    69  PrintHex<uint16_t > (pDesc->bcdHID, 0x80);
    70 
    -
    71  Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80);
    +
    71  Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80);
    72  PrintHex<uint8_t > (pDesc->bCountryCode, 0x80);
    73 
    -
    74  Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80);
    +
    74  Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80);
    75  PrintHex<uint8_t > (pDesc->bNumDescriptors, 0x80);
    76 
    -
    77  Notify(PSTR("\r\nbDescrType:\t\t"), 0x80);
    +
    77  Notify(PSTR("\r\nbDescrType:\t\t"), 0x80);
    78  PrintHex<uint8_t > (pDesc->bDescrType, 0x80);
    79 
    -
    80  Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80);
    +
    80  Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80);
    81  PrintHex<uint16_t > (pDesc->wDescriptorLength, 0x80);
    82 }
    @@ -176,7 +176,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hid_8h.html b/hid_8h.html index 37e19737..193f9158 100644 --- a/hid_8h.html +++ b/hid_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hid.h File Reference @@ -31,7 +31,7 @@ - + @@ -110,7 +110,7 @@ Include dependency graph for hid.h:
    - +
    This graph shows which files directly or indirectly include this file:
    @@ -1246,7 +1246,7 @@ Macros diff --git a/hid_8h__incl.map b/hid_8h__incl.map index dff9135f..8feeb2d1 100644 --- a/hid_8h__incl.map +++ b/hid_8h__incl.map @@ -1,14 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/hid_8h__incl.md5 b/hid_8h__incl.md5 index 2d3f7801..a3e80033 100644 --- a/hid_8h__incl.md5 +++ b/hid_8h__incl.md5 @@ -1 +1 @@ -dac1b8c46a8c8923e023ba934fcd1040 \ No newline at end of file +249010f8b11f72028a7c97de0e4dffc5 \ No newline at end of file diff --git a/hid_8h__incl.png b/hid_8h__incl.png index d0a93c03..646016fe 100644 Binary files a/hid_8h__incl.png and b/hid_8h__incl.png differ diff --git a/hid_8h_source.html b/hid_8h_source.html index 0b8721a8..47bb57e0 100644 --- a/hid_8h_source.html +++ b/hid_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hid.h Source File @@ -31,7 +31,7 @@
    - + @@ -295,7 +295,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidboot_8cpp.html b/hidboot_8cpp.html index ebd44beb..63eca6de 100644 --- a/hidboot_8cpp.html +++ b/hidboot_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidboot.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -95,7 +95,7 @@ Include dependency graph for hidboot.cpp:
    - +

    Go to the source code of this file.

    @@ -104,7 +104,7 @@ Include dependency graph for hidboot.cpp: diff --git a/hidboot_8cpp__incl.map b/hidboot_8cpp__incl.map index 5468de79..3e8a8748 100644 --- a/hidboot_8cpp__incl.map +++ b/hidboot_8cpp__incl.map @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/hidboot_8cpp__incl.md5 b/hidboot_8cpp__incl.md5 index efcfb422..0e8c2e71 100644 --- a/hidboot_8cpp__incl.md5 +++ b/hidboot_8cpp__incl.md5 @@ -1 +1 @@ -e468d905873e558568f13a9e4328fd8b \ No newline at end of file +ca7a03454b8e4e142c621f9285efecf6 \ No newline at end of file diff --git a/hidboot_8cpp__incl.png b/hidboot_8cpp__incl.png index f2c1b897..b841571b 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 fdeffd25..680053f4 100644 --- a/hidboot_8cpp_source.html +++ b/hidboot_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidboot.cpp Source File @@ -31,7 +31,7 @@ - + @@ -143,97 +143,102 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    52 
    53  //KBDINFO *pki = (KBDINFO*)buf;
    54 
    -
    55  for (uint8_t i = 2; i < 8; i++) {
    -
    56  bool down = false;
    -
    57  bool up = false;
    -
    58 
    -
    59  for (uint8_t j = 2; j < 8; j++) {
    -
    60  if (buf[i] == prevState.bInfo[j] && buf[i] != 1)
    -
    61  down = true;
    -
    62  if (buf[j] == prevState.bInfo[i] && prevState.bInfo[i] != 1)
    -
    63  up = true;
    -
    64  }
    -
    65  if (!down) {
    -
    66  HandleLockingKeys(hid, buf[i]);
    -
    67  OnKeyDown(*buf, buf[i]);
    -
    68  }
    -
    69  if (!up)
    -
    70  OnKeyUp(prevState.bInfo[0], prevState.bInfo[i]);
    -
    71  }
    -
    72  for (uint8_t i = 0; i < 8; i++)
    -
    73  prevState.bInfo[i] = buf[i];
    -
    74 };
    -
    75 
    -
    76 uint8_t KeyboardReportParser::HandleLockingKeys(HID *hid, uint8_t key) {
    -
    77  uint8_t old_keys = kbdLockingKeys.bLeds;
    -
    78 
    -
    79  switch (key) {
    -
    80  case KEY_NUM_LOCK:
    -
    81  kbdLockingKeys.kbdLeds.bmNumLock = ~kbdLockingKeys.kbdLeds.bmNumLock;
    -
    82  break;
    -
    83  case KEY_CAPS_LOCK:
    -
    84  kbdLockingKeys.kbdLeds.bmCapsLock = ~kbdLockingKeys.kbdLeds.bmCapsLock;
    -
    85  break;
    -
    86  case KEY_SCROLL_LOCK:
    -
    87  kbdLockingKeys.kbdLeds.bmScrollLock = ~kbdLockingKeys.kbdLeds.bmScrollLock;
    -
    88  break;
    -
    89  }
    -
    90 
    -
    91  if (old_keys != kbdLockingKeys.bLeds && hid)
    -
    92  return (hid->SetReport(0, 0/*hid->GetIface()*/, 2, 0, 1, &kbdLockingKeys.bLeds));
    -
    93 
    -
    94  return 0;
    -
    95 }
    -
    96 
    -
    97 const uint8_t KeyboardReportParser::numKeys[] PROGMEM = {'!', '@', '#', '$', '%', '^', '&', '*', '(', ')'};
    -
    98 const uint8_t KeyboardReportParser::symKeysUp[] PROGMEM = {'_', '+', '{', '}', '|', '~', ':', '"', '~', '<', '>', '?'};
    -
    99 const uint8_t KeyboardReportParser::symKeysLo[] PROGMEM = {'-', '=', '[', ']', '\\', ' ', ';', '\'', '`', ',', '.', '/'};
    -
    100 const uint8_t KeyboardReportParser::padKeys[] PROGMEM = {'/', '*', '-', '+', 0x13};
    +
    55  // provide event for changed control key state
    +
    56  if (prevState.bInfo[0x00] != buf[0x00]) {
    +
    57  OnControlKeysChanged(prevState.bInfo[0x00], buf[0x00]);
    +
    58  }
    +
    59 
    +
    60  for (uint8_t i = 2; i < 8; i++) {
    +
    61  bool down = false;
    +
    62  bool up = false;
    +
    63 
    +
    64  for (uint8_t j = 2; j < 8; j++) {
    +
    65  if (buf[i] == prevState.bInfo[j] && buf[i] != 1)
    +
    66  down = true;
    +
    67  if (buf[j] == prevState.bInfo[i] && prevState.bInfo[i] != 1)
    +
    68  up = true;
    +
    69  }
    +
    70  if (!down) {
    +
    71  HandleLockingKeys(hid, buf[i]);
    +
    72  OnKeyDown(*buf, buf[i]);
    +
    73  }
    +
    74  if (!up)
    +
    75  OnKeyUp(prevState.bInfo[0], prevState.bInfo[i]);
    +
    76  }
    +
    77  for (uint8_t i = 0; i < 8; i++)
    +
    78  prevState.bInfo[i] = buf[i];
    +
    79 };
    +
    80 
    +
    81 uint8_t KeyboardReportParser::HandleLockingKeys(HID *hid, uint8_t key) {
    +
    82  uint8_t old_keys = kbdLockingKeys.bLeds;
    +
    83 
    +
    84  switch (key) {
    +
    85  case KEY_NUM_LOCK:
    +
    86  kbdLockingKeys.kbdLeds.bmNumLock = ~kbdLockingKeys.kbdLeds.bmNumLock;
    +
    87  break;
    +
    88  case KEY_CAPS_LOCK:
    +
    89  kbdLockingKeys.kbdLeds.bmCapsLock = ~kbdLockingKeys.kbdLeds.bmCapsLock;
    +
    90  break;
    +
    91  case KEY_SCROLL_LOCK:
    +
    92  kbdLockingKeys.kbdLeds.bmScrollLock = ~kbdLockingKeys.kbdLeds.bmScrollLock;
    +
    93  break;
    +
    94  }
    +
    95 
    +
    96  if (old_keys != kbdLockingKeys.bLeds && hid)
    +
    97  return (hid->SetReport(0, 0/*hid->GetIface()*/, 2, 0, 1, &kbdLockingKeys.bLeds));
    +
    98 
    +
    99  return 0;
    +
    100 }
    101 
    -
    102 uint8_t KeyboardReportParser::OemToAscii(uint8_t mod, uint8_t key) {
    -
    103  uint8_t shift = (mod & 0x22);
    -
    104 
    -
    105  // [a-z]
    -
    106  if (key > 0x03 && key < 0x1e) {
    -
    107  // Upper case letters
    -
    108  if ((kbdLockingKeys.kbdLeds.bmCapsLock == 0 && (mod & 2)) ||
    -
    109  (kbdLockingKeys.kbdLeds.bmCapsLock == 1 && (mod & 2) == 0))
    -
    110  return (key - 4 + 'A');
    -
    111 
    -
    112  // Lower case letters
    -
    113  else
    -
    114  return (key - 4 + 'a');
    -
    115  }// Numbers
    -
    116  else if (key > 0x1d && key < 0x27) {
    -
    117  if (shift)
    -
    118  return ((uint8_t)pgm_read_byte(&numKeys[key - 0x1e]));
    -
    119  else
    -
    120  return (key - 0x1e + '1');
    -
    121  }// Keypad Numbers
    -
    122  else if (key > 0x58 && key < 0x62) {
    -
    123  if (kbdLockingKeys.kbdLeds.bmNumLock == 1)
    -
    124  return (key - 0x59 + '1');
    -
    125  } else if (key > 0x2c && key < 0x39)
    -
    126  return ((shift) ? (uint8_t)pgm_read_byte(&symKeysUp[key - 0x2d]) : (uint8_t)pgm_read_byte(&symKeysLo[key - 0x2d]));
    -
    127  else if (key > 0x53 && key < 0x59)
    -
    128  return (uint8_t)pgm_read_byte(&padKeys[key - 0x54]);
    -
    129  else {
    -
    130  switch (key) {
    -
    131  case KEY_SPACE: return (0x20);
    -
    132  case KEY_ENTER: return (0x13);
    -
    133  case KEY_ZERO: return ((shift) ? ')': '0');
    -
    134  case KEY_ZERO2: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '0': 0);
    -
    135  case KEY_PERIOD: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '.': 0);
    -
    136  }
    -
    137  }
    -
    138  return ( 0);
    -
    139 }
    +
    102 const uint8_t KeyboardReportParser::numKeys[] PROGMEM = {'!', '@', '#', '$', '%', '^', '&', '*', '(', ')'};
    +
    103 const uint8_t KeyboardReportParser::symKeysUp[] PROGMEM = {'_', '+', '{', '}', '|', '~', ':', '"', '~', '<', '>', '?'};
    +
    104 const uint8_t KeyboardReportParser::symKeysLo[] PROGMEM = {'-', '=', '[', ']', '\\', ' ', ';', '\'', '`', ',', '.', '/'};
    +
    105 const uint8_t KeyboardReportParser::padKeys[] PROGMEM = {'/', '*', '-', '+', 0x13};
    +
    106 
    +
    107 uint8_t KeyboardReportParser::OemToAscii(uint8_t mod, uint8_t key) {
    +
    108  uint8_t shift = (mod & 0x22);
    +
    109 
    +
    110  // [a-z]
    +
    111  if (key > 0x03 && key < 0x1e) {
    +
    112  // Upper case letters
    +
    113  if ((kbdLockingKeys.kbdLeds.bmCapsLock == 0 && (mod & 2)) ||
    +
    114  (kbdLockingKeys.kbdLeds.bmCapsLock == 1 && (mod & 2) == 0))
    +
    115  return (key - 4 + 'A');
    +
    116 
    +
    117  // Lower case letters
    +
    118  else
    +
    119  return (key - 4 + 'a');
    +
    120  }// Numbers
    +
    121  else if (key > 0x1d && key < 0x27) {
    +
    122  if (shift)
    +
    123  return ((uint8_t)pgm_read_byte(&numKeys[key - 0x1e]));
    +
    124  else
    +
    125  return (key - 0x1e + '1');
    +
    126  }// Keypad Numbers
    +
    127  else if (key > 0x58 && key < 0x62) {
    +
    128  if (kbdLockingKeys.kbdLeds.bmNumLock == 1)
    +
    129  return (key - 0x59 + '1');
    +
    130  } else if (key > 0x2c && key < 0x39)
    +
    131  return ((shift) ? (uint8_t)pgm_read_byte(&symKeysUp[key - 0x2d]) : (uint8_t)pgm_read_byte(&symKeysLo[key - 0x2d]));
    +
    132  else if (key > 0x53 && key < 0x59)
    +
    133  return (uint8_t)pgm_read_byte(&padKeys[key - 0x54]);
    +
    134  else {
    +
    135  switch (key) {
    +
    136  case KEY_SPACE: return (0x20);
    +
    137  case KEY_ENTER: return (0x13);
    +
    138  case KEY_ZERO: return ((shift) ? ')': '0');
    +
    139  case KEY_ZERO2: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '0': 0);
    +
    140  case KEY_PERIOD: return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '.': 0);
    +
    141  }
    +
    142  }
    +
    143  return ( 0);
    +
    144 }
    diff --git a/hidboot_8h.html b/hidboot_8h.html index d548e391..96dc2fdc 100644 --- a/hidboot_8h.html +++ b/hidboot_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidboot.h File Reference @@ -31,7 +31,7 @@ - + @@ -110,7 +110,7 @@ Include dependency graph for hidboot.h:
    - +
    This graph shows which files directly or indirectly include this file:
    @@ -285,7 +285,7 @@ Macros
    -

    Definition at line 171 of file hidboot.h.

    +

    Definition at line 174 of file hidboot.h.

    @@ -299,7 +299,7 @@ Macros
    -

    Definition at line 173 of file hidboot.h.

    +

    Definition at line 176 of file hidboot.h.

    @@ -308,7 +308,7 @@ Macros diff --git a/hidboot_8h__incl.map b/hidboot_8h__incl.map index 0f52ae8b..53a6275c 100644 --- a/hidboot_8h__incl.map +++ b/hidboot_8h__incl.map @@ -1,15 +1,15 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/hidboot_8h__incl.md5 b/hidboot_8h__incl.md5 index e0ec4b0f..9511b86a 100644 --- a/hidboot_8h__incl.md5 +++ b/hidboot_8h__incl.md5 @@ -1 +1 @@ -8e83de93e9b917329dea12cd092f1fd4 \ No newline at end of file +932cd75b2cb0e2cf45088bc226eab47e \ No newline at end of file diff --git a/hidboot_8h__incl.png b/hidboot_8h__incl.png index 06625eaa..9930b011 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 0198131b..b76e88d9 100644 --- a/hidboot_8h_source.html +++ b/hidboot_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidboot.h Source File @@ -31,7 +31,7 @@ - + @@ -252,342 +252,358 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    161 protected:
    162  virtual uint8_t HandleLockingKeys(HID* hid, uint8_t key);
    163 
    -
    164  virtual void OnKeyDown(uint8_t mod, uint8_t key) {
    +
    164  virtual void OnControlKeysChanged(uint8_t before, uint8_t after) {
    165  };
    -
    166 
    -
    167  virtual void OnKeyUp(uint8_t mod, uint8_t key) {
    +
    166 
    +
    167  virtual void OnKeyDown(uint8_t mod, uint8_t key) {
    168  };
    -
    169 };
    -
    170 
    -
    171 #define totalEndpoints 2
    -
    172 
    -
    173 #define HID_MAX_HID_CLASS_DESCRIPTORS 5
    -
    174 
    -
    175 template <const uint8_t BOOT_PROTOCOL>
    -
    176 class HIDBoot : public HID //public USBDeviceConfig, public UsbConfigXtracter
    -
    177 {
    -
    178  EpInfo epInfo[totalEndpoints];
    -
    179 
    -
    180  HIDReportParser *pRptParser;
    -
    181 
    -
    182  uint8_t bConfNum; // configuration number
    -
    183  uint8_t bIfaceNum; // Interface Number
    -
    184  uint8_t bNumIface; // number of interfaces in the configuration
    -
    185  uint8_t bNumEP; // total number of EP in the configuration
    -
    186  uint32_t qNextPollTime; // next poll time
    -
    187  bool bPollEnable; // poll enable flag
    -
    188 
    -
    189  void Initialize();
    -
    190 
    -
    191  virtual HIDReportParser* GetReportParser(uint8_t id) {
    -
    192  return pRptParser;
    -
    193  };
    -
    194 
    -
    195 public:
    -
    196  HIDBoot(USB *p);
    +
    169 
    +
    170  virtual void OnKeyUp(uint8_t mod, uint8_t key) {
    +
    171  };
    +
    172 };
    +
    173 
    +
    174 #define totalEndpoints 2
    +
    175 
    +
    176 #define HID_MAX_HID_CLASS_DESCRIPTORS 5
    +
    177 
    +
    178 template <const uint8_t BOOT_PROTOCOL>
    +
    179 class HIDBoot : public HID //public USBDeviceConfig, public UsbConfigXtracter
    +
    180 {
    +
    181  EpInfo epInfo[totalEndpoints];
    +
    182 
    +
    183  HIDReportParser *pRptParser;
    +
    184 
    +
    185  uint8_t bConfNum; // configuration number
    +
    186  uint8_t bIfaceNum; // Interface Number
    +
    187  uint8_t bNumIface; // number of interfaces in the configuration
    +
    188  uint8_t bNumEP; // total number of EP in the configuration
    +
    189  uint32_t qNextPollTime; // next poll time
    +
    190  bool bPollEnable; // poll enable flag
    +
    191 
    +
    192  void Initialize();
    +
    193 
    +
    194  virtual HIDReportParser* GetReportParser(uint8_t id) {
    +
    195  return pRptParser;
    +
    196  };
    197 
    -
    198  virtual bool SetReportParser(uint8_t id, HIDReportParser *prs) {
    -
    199  pRptParser = prs;
    -
    200  return true;
    -
    201  };
    -
    202 
    -
    203  // USBDeviceConfig implementation
    -
    204  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
    -
    205  virtual uint8_t Release();
    -
    206  virtual uint8_t Poll();
    -
    207 
    -
    208  virtual uint8_t GetAddress() {
    -
    209  return bAddress;
    -
    210  };
    -
    211 
    -
    212  // UsbConfigXtracter implementation
    -
    213  virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
    -
    214 };
    -
    215 
    -
    216 template <const uint8_t BOOT_PROTOCOL>
    -
    217 HIDBoot<BOOT_PROTOCOL>::HIDBoot(USB *p) :
    -
    218 HID(p),
    -
    219 qNextPollTime(0),
    -
    220 bPollEnable(false),
    -
    221 pRptParser(NULL) {
    -
    222  Initialize();
    -
    223 
    -
    224  if(pUsb)
    -
    225  pUsb->RegisterDeviceClass(this);
    -
    226 }
    -
    227 
    -
    228 template <const uint8_t BOOT_PROTOCOL>
    -
    229 void HIDBoot<BOOT_PROTOCOL>::Initialize() {
    -
    230  for(uint8_t i = 0; i < totalEndpoints; i++) {
    -
    231  epInfo[i].epAddr = 0;
    -
    232  epInfo[i].maxPktSize = (i) ? 0 : 8;
    -
    233  epInfo[i].epAttribs = 0;
    -
    234  epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
    -
    235  }
    -
    236  bNumEP = 1;
    -
    237  bNumIface = 0;
    -
    238  bConfNum = 0;
    -
    239 }
    -
    240 
    -
    241 template <const uint8_t BOOT_PROTOCOL>
    -
    242 uint8_t HIDBoot<BOOT_PROTOCOL>::Init(uint8_t parent, uint8_t port, bool lowspeed) {
    -
    243  const uint8_t constBufSize = sizeof(USB_DEVICE_DESCRIPTOR);
    -
    244 
    -
    245  uint8_t buf[constBufSize];
    -
    246  uint8_t rcode;
    -
    247  UsbDevice *p = NULL;
    -
    248  EpInfo *oldep_ptr = NULL;
    -
    249  uint8_t len = 0;
    -
    250  uint16_t cd_len = 0;
    -
    251 
    -
    252  uint8_t num_of_conf; // number of configurations
    -
    253  uint8_t num_of_intf; // number of interfaces
    +
    198 public:
    +
    199  HIDBoot(USB *p);
    +
    200 
    +
    201  virtual bool SetReportParser(uint8_t id, HIDReportParser *prs) {
    +
    202  pRptParser = prs;
    +
    203  return true;
    +
    204  };
    +
    205 
    +
    206  // USBDeviceConfig implementation
    +
    207  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
    +
    208  virtual uint8_t Release();
    +
    209  virtual uint8_t Poll();
    +
    210 
    +
    211  virtual uint8_t GetAddress() {
    +
    212  return bAddress;
    +
    213  };
    +
    214 
    +
    215  // UsbConfigXtracter implementation
    +
    216  virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
    +
    217 };
    +
    218 
    +
    219 template <const uint8_t BOOT_PROTOCOL>
    +
    220 HIDBoot<BOOT_PROTOCOL>::HIDBoot(USB *p) :
    +
    221 HID(p),
    +
    222 qNextPollTime(0),
    +
    223 bPollEnable(false),
    +
    224 pRptParser(NULL) {
    +
    225  Initialize();
    +
    226 
    +
    227  if(pUsb)
    +
    228  pUsb->RegisterDeviceClass(this);
    +
    229 }
    +
    230 
    +
    231 template <const uint8_t BOOT_PROTOCOL>
    +
    232 void HIDBoot<BOOT_PROTOCOL>::Initialize() {
    +
    233  for(uint8_t i = 0; i < totalEndpoints; i++) {
    +
    234  epInfo[i].epAddr = 0;
    +
    235  epInfo[i].maxPktSize = (i) ? 0 : 8;
    +
    236  epInfo[i].epAttribs = 0;
    +
    237  epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
    +
    238  }
    +
    239  bNumEP = 1;
    +
    240  bNumIface = 0;
    +
    241  bConfNum = 0;
    +
    242 }
    +
    243 
    +
    244 template <const uint8_t BOOT_PROTOCOL>
    +
    245 uint8_t HIDBoot<BOOT_PROTOCOL>::Init(uint8_t parent, uint8_t port, bool lowspeed) {
    +
    246  const uint8_t constBufSize = sizeof(USB_DEVICE_DESCRIPTOR);
    +
    247 
    +
    248  uint8_t buf[constBufSize];
    +
    249  uint8_t rcode;
    +
    250  UsbDevice *p = NULL;
    +
    251  EpInfo *oldep_ptr = NULL;
    +
    252  uint8_t len = 0;
    +
    253  uint16_t cd_len = 0;
    254 
    -
    255  AddressPool &addrPool = pUsb->GetAddressPool();
    -
    256 
    -
    257  USBTRACE("BM Init\r\n");
    -
    258 
    -
    259  if(bAddress)
    -
    260  return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
    +
    255  uint8_t num_of_conf; // number of configurations
    +
    256  uint8_t num_of_intf; // number of interfaces
    +
    257 
    +
    258  AddressPool &addrPool = pUsb->GetAddressPool();
    +
    259 
    +
    260  USBTRACE("BM Init\r\n");
    261 
    -
    262  // Get pointer to pseudo device with address 0 assigned
    -
    263  p = addrPool.GetUsbDevicePtr(0);
    +
    262  if(bAddress)
    +
    263  return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
    264 
    -
    265  if(!p)
    -
    266  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
    +
    265  // Get pointer to pseudo device with address 0 assigned
    +
    266  p = addrPool.GetUsbDevicePtr(0);
    267 
    -
    268  if(!p->epinfo) {
    -
    269  USBTRACE("epinfo\r\n");
    -
    270  return USB_ERROR_EPINFO_IS_NULL;
    -
    271  }
    -
    272 
    -
    273  // Save old pointer to EP_RECORD of address 0
    -
    274  oldep_ptr = p->epinfo;
    +
    268  if(!p)
    +
    269  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
    +
    270 
    +
    271  if(!p->epinfo) {
    +
    272  USBTRACE("epinfo\r\n");
    +
    273  return USB_ERROR_EPINFO_IS_NULL;
    +
    274  }
    275 
    -
    276  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
    -
    277  p->epinfo = epInfo;
    +
    276  // Save old pointer to EP_RECORD of address 0
    +
    277  oldep_ptr = p->epinfo;
    278 
    -
    279  p->lowspeed = lowspeed;
    -
    280 
    -
    281  // Get device descriptor
    -
    282  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*) buf);
    +
    279  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
    +
    280  p->epinfo = epInfo;
    +
    281 
    +
    282  p->lowspeed = lowspeed;
    283 
    -
    284  if(!rcode)
    -
    285  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
    +
    284  // Get device descriptor
    +
    285  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*) buf);
    286 
    -
    287  if(rcode) {
    -
    288  // Restore p->epinfo
    -
    289  p->epinfo = oldep_ptr;
    -
    290 
    -
    291  goto FailGetDevDescr;
    -
    292  }
    +
    287  if(!rcode)
    +
    288  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
    +
    289 
    +
    290  if(rcode) {
    +
    291  // Restore p->epinfo
    +
    292  p->epinfo = oldep_ptr;
    293 
    -
    294  // Restore p->epinfo
    -
    295  p->epinfo = oldep_ptr;
    +
    294  goto FailGetDevDescr;
    +
    295  }
    296 
    -
    297  // Allocate new address according to device class
    -
    298  bAddress = addrPool.AllocAddress(parent, false, port);
    +
    297  // Restore p->epinfo
    +
    298  p->epinfo = oldep_ptr;
    299 
    -
    300  if(!bAddress)
    -
    301  return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
    +
    300  // Allocate new address according to device class
    +
    301  bAddress = addrPool.AllocAddress(parent, false, port);
    302 
    -
    303  // Extract Max Packet Size from the device descriptor
    -
    304  epInfo[0].maxPktSize = (uint8_t) ((USB_DEVICE_DESCRIPTOR*) buf)->bMaxPacketSize0;
    +
    303  if(!bAddress)
    +
    304  return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
    305 
    -
    306  // Assign new address to the device
    -
    307  rcode = pUsb->setAddr(0, 0, bAddress);
    +
    306  // Extract Max Packet Size from the device descriptor
    +
    307  epInfo[0].maxPktSize = (uint8_t) ((USB_DEVICE_DESCRIPTOR*) buf)->bMaxPacketSize0;
    308 
    -
    309  if(rcode) {
    -
    310  p->lowspeed = false;
    -
    311  addrPool.FreeAddress(bAddress);
    -
    312  bAddress = 0;
    -
    313  USBTRACE2("setAddr:", rcode);
    -
    314  return rcode;
    -
    315  }
    -
    316 
    -
    317  USBTRACE2("Addr:", bAddress);
    -
    318 
    -
    319  p->lowspeed = false;
    -
    320 
    -
    321  p = addrPool.GetUsbDevicePtr(bAddress);
    -
    322 
    -
    323  if(!p)
    -
    324  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
    +
    309  // Assign new address to the device
    +
    310  rcode = pUsb->setAddr(0, 0, bAddress);
    +
    311 
    +
    312  if(rcode) {
    +
    313  p->lowspeed = false;
    +
    314  addrPool.FreeAddress(bAddress);
    +
    315  bAddress = 0;
    +
    316  USBTRACE2("setAddr:", rcode);
    +
    317  return rcode;
    +
    318  }
    +
    319 
    +
    320  USBTRACE2("Addr:", bAddress);
    +
    321 
    +
    322  p->lowspeed = false;
    +
    323 
    +
    324  p = addrPool.GetUsbDevicePtr(bAddress);
    325 
    -
    326  p->lowspeed = lowspeed;
    -
    327 
    -
    328  if(len)
    -
    329  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*) buf);
    +
    326  if(!p)
    +
    327  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
    +
    328 
    +
    329  p->lowspeed = lowspeed;
    330 
    -
    331  if(rcode)
    -
    332  goto FailGetDevDescr;
    +
    331  if(len)
    +
    332  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*) buf);
    333 
    -
    334  num_of_conf = ((USB_DEVICE_DESCRIPTOR*) buf)->bNumConfigurations;
    -
    335 
    -
    336  // Assign epInfo to epinfo pointer
    -
    337  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
    +
    334  if(rcode)
    +
    335  goto FailGetDevDescr;
    +
    336 
    +
    337  num_of_conf = ((USB_DEVICE_DESCRIPTOR*) buf)->bNumConfigurations;
    338 
    -
    339  if(rcode)
    -
    340  goto FailSetDevTblEntry;
    +
    339  // Assign epInfo to epinfo pointer
    +
    340  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
    341 
    -
    342  //USBTRACE2("NC:", num_of_conf);
    -
    343 
    -
    344  for(uint8_t i = 0; i < num_of_conf; i++) {
    -
    345  ConfigDescParser<
    -
    346  USB_CLASS_HID,
    -
    347  HID_BOOT_INTF_SUBCLASS,
    -
    348  BOOT_PROTOCOL,
    -
    349  CP_MASK_COMPARE_ALL> confDescrParser(this);
    -
    350 
    -
    351  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
    -
    352 
    -
    353  if(bNumEP > 1)
    -
    354  break;
    -
    355  } // for
    -
    356 
    -
    357  if(bNumEP < 2)
    -
    358  return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
    +
    342  if(rcode)
    +
    343  goto FailSetDevTblEntry;
    +
    344 
    +
    345  //USBTRACE2("NC:", num_of_conf);
    +
    346 
    +
    347  for(uint8_t i = 0; i < num_of_conf; i++) {
    +
    348  ConfigDescParser<
    +
    349  USB_CLASS_HID,
    +
    350  HID_BOOT_INTF_SUBCLASS,
    +
    351  BOOT_PROTOCOL,
    +
    352  CP_MASK_COMPARE_ALL> confDescrParser(this);
    +
    353 
    +
    354  rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
    +
    355 
    +
    356  if(bNumEP > 1)
    +
    357  break;
    +
    358  } // for
    359 
    -
    360  //USBTRACE2("\r\nbAddr:", bAddress);
    -
    361  //USBTRACE2("\r\nbNumEP:", bNumEP);
    +
    360  if(bNumEP < 2)
    +
    361  return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
    362 
    -
    363  // Assign epInfo to epinfo pointer
    -
    364  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
    +
    363  //USBTRACE2("\r\nbAddr:", bAddress);
    +
    364  //USBTRACE2("\r\nbNumEP:", bNumEP);
    365 
    -
    366  //USBTRACE2("\r\nCnf:", bConfNum);
    -
    367 
    -
    368  // Set Configuration Value
    -
    369  rcode = pUsb->setConf(bAddress, 0, bConfNum);
    +
    366  // Assign epInfo to epinfo pointer
    +
    367  rcode = pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo);
    +
    368 
    +
    369  //USBTRACE2("\r\nCnf:", bConfNum);
    370 
    -
    371  if(rcode)
    -
    372  goto FailSetConfDescr;
    +
    371  // Set Configuration Value
    +
    372  rcode = pUsb->setConf(bAddress, 0, bConfNum);
    373 
    -
    374  //USBTRACE2("\r\nIf:", bIfaceNum);
    -
    375 
    -
    376  rcode = SetProtocol(bIfaceNum, HID_BOOT_PROTOCOL);
    -
    377 
    -
    378  if(rcode)
    -
    379  goto FailSetProtocol;
    +
    374  if(rcode)
    +
    375  goto FailSetConfDescr;
    +
    376 
    +
    377  //USBTRACE2("\r\nIf:", bIfaceNum);
    +
    378 
    +
    379  rcode = SetProtocol(bIfaceNum, HID_BOOT_PROTOCOL);
    380 
    -
    381  if(BOOT_PROTOCOL == 1) {
    -
    382  rcode = SetIdle(bIfaceNum, 0, 0);
    +
    381  if(rcode)
    +
    382  goto FailSetProtocol;
    383 
    -
    384  if(rcode)
    -
    385  goto FailSetIdle;
    -
    386  }
    -
    387  USBTRACE("BM configured\r\n");
    -
    388 
    -
    389  bPollEnable = true;
    -
    390  return 0;
    +
    384  if(BOOT_PROTOCOL == 1) {
    +
    385  rcode = SetIdle(bIfaceNum, 0, 0);
    +
    386 
    +
    387  if(rcode)
    +
    388  goto FailSetIdle;
    +
    389  }
    +
    390  USBTRACE("BM configured\r\n");
    391 
    -
    392 FailGetDevDescr:
    -
    393  NotifyFailGetDevDescr();
    -
    394  goto Fail;
    -
    395 
    -
    396 FailSetDevTblEntry:
    -
    397  NotifyFailSetDevTblEntry();
    +
    392  bPollEnable = true;
    +
    393  return 0;
    +
    394 
    +
    395 FailGetDevDescr:
    +
    396 #ifdef DEBUG_USB_HOST
    +
    397  NotifyFailGetDevDescr();
    398  goto Fail;
    -
    399 
    -
    400 FailGetConfDescr:
    -
    401  NotifyFailGetConfDescr();
    -
    402  goto Fail;
    -
    403 
    -
    404 FailSetConfDescr:
    -
    405  NotifyFailSetConfDescr();
    -
    406  goto Fail;
    -
    407 
    -
    408 
    -
    409 FailSetProtocol:
    -
    410  USBTRACE("SetProto:");
    -
    411  goto Fail;
    -
    412 
    -
    413 FailSetIdle:
    -
    414  USBTRACE("SetIdle:");
    -
    415  goto Fail;
    -
    416 
    -
    417 Fail:
    -
    418  NotifyFail(rcode);
    -
    419  Release();
    -
    420  return rcode;
    -
    421 }
    -
    422 
    -
    423 template <const uint8_t BOOT_PROTOCOL>
    -
    424 void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
    -
    425  // If the first configuration satisfies, the others are not concidered.
    -
    426  if(bNumEP > 1 && conf != bConfNum)
    -
    427  return;
    -
    428 
    -
    429  bConfNum = conf;
    -
    430  bIfaceNum = iface;
    -
    431 
    -
    432  uint8_t index;
    -
    433 
    -
    434  if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) {
    -
    435  index = epInterruptInIndex;
    -
    436 
    -
    437  // Fill in the endpoint info structure
    -
    438  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
    -
    439  epInfo[index].maxPktSize = (uint8_t) pep->wMaxPacketSize;
    -
    440  epInfo[index].epAttribs = 0;
    -
    441 
    -
    442  bNumEP++;
    -
    443  }
    -
    444 }
    -
    445 
    -
    446 template <const uint8_t BOOT_PROTOCOL>
    -
    447 uint8_t HIDBoot<BOOT_PROTOCOL>::Release() {
    -
    448  pUsb->GetAddressPool().FreeAddress(bAddress);
    -
    449 
    -
    450  bConfNum = 0;
    -
    451  bIfaceNum = 0;
    -
    452  bNumEP = 1;
    -
    453  bAddress = 0;
    -
    454  qNextPollTime = 0;
    -
    455  bPollEnable = false;
    -
    456  return 0;
    -
    457 }
    -
    458 
    -
    459 template <const uint8_t BOOT_PROTOCOL>
    -
    460 uint8_t HIDBoot<BOOT_PROTOCOL>::Poll() {
    -
    461  uint8_t rcode = 0;
    -
    462 
    -
    463  if(!bPollEnable)
    -
    464  return 0;
    +
    399 #endif
    +
    400 
    +
    401 FailSetDevTblEntry:
    +
    402 #ifdef DEBUG_USB_HOST
    +
    403  NotifyFailSetDevTblEntry();
    +
    404  goto Fail;
    +
    405 #endif
    +
    406 
    +
    407 FailGetConfDescr:
    +
    408 #ifdef DEBUG_USB_HOST
    +
    409  NotifyFailGetConfDescr();
    +
    410  goto Fail;
    +
    411 #endif
    +
    412 
    +
    413 FailSetConfDescr:
    +
    414 #ifdef DEBUG_USB_HOST
    +
    415  NotifyFailSetConfDescr();
    +
    416  goto Fail;
    +
    417 #endif
    +
    418 
    +
    419 FailSetProtocol:
    +
    420 #ifdef DEBUG_USB_HOST
    +
    421  USBTRACE("SetProto:");
    +
    422  goto Fail;
    +
    423 #endif
    +
    424 
    +
    425 FailSetIdle:
    +
    426 #ifdef DEBUG_USB_HOST
    +
    427  USBTRACE("SetIdle:");
    +
    428 #endif
    +
    429 
    +
    430 Fail:
    +
    431 #ifdef DEBUG_USB_HOST
    +
    432  NotifyFail(rcode);
    +
    433 #endif
    +
    434  Release();
    +
    435  return rcode;
    +
    436 }
    +
    437 
    +
    438 template <const uint8_t BOOT_PROTOCOL>
    +
    439 void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
    +
    440  // If the first configuration satisfies, the others are not concidered.
    +
    441  if(bNumEP > 1 && conf != bConfNum)
    +
    442  return;
    +
    443 
    +
    444  bConfNum = conf;
    +
    445  bIfaceNum = iface;
    +
    446 
    +
    447  uint8_t index;
    +
    448 
    +
    449  if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) {
    +
    450  index = epInterruptInIndex;
    +
    451 
    +
    452  // Fill in the endpoint info structure
    +
    453  epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
    +
    454  epInfo[index].maxPktSize = (uint8_t) pep->wMaxPacketSize;
    +
    455  epInfo[index].epAttribs = 0;
    +
    456  epInfo[index].bmNakPower = USB_NAK_NOWAIT;
    +
    457 
    +
    458  bNumEP++;
    +
    459  }
    +
    460 }
    +
    461 
    +
    462 template <const uint8_t BOOT_PROTOCOL>
    +
    463 uint8_t HIDBoot<BOOT_PROTOCOL>::Release() {
    +
    464  pUsb->GetAddressPool().FreeAddress(bAddress);
    465 
    -
    466  if(qNextPollTime <= millis()) {
    -
    467  qNextPollTime = millis() + 10;
    -
    468 
    -
    469  const uint8_t const_buff_len = 16;
    -
    470  uint8_t buf[const_buff_len];
    -
    471 
    -
    472  uint16_t read = (uint16_t) epInfo[epInterruptInIndex].maxPktSize;
    -
    473 
    -
    474  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[epInterruptInIndex].epAddr, &read, buf);
    -
    475 
    -
    476  if(rcode) {
    -
    477  if(rcode != hrNAK)
    -
    478  USBTRACE2("Poll:", rcode);
    -
    479  return rcode;
    -
    480  }
    -
    481  //for (uint8_t i=0; i<read; i++)
    -
    482  // PrintHex<uint8_t>(buf[i]);
    -
    483  //if (read)
    -
    484  // Serial.println("");
    -
    485 
    -
    486  if(pRptParser)
    -
    487  pRptParser->Parse((HID*)this, 0, (uint8_t) read, buf);
    -
    488  }
    -
    489  return rcode;
    -
    490 }
    +
    466  bConfNum = 0;
    +
    467  bIfaceNum = 0;
    +
    468  bNumEP = 1;
    +
    469  bAddress = 0;
    +
    470  qNextPollTime = 0;
    +
    471  bPollEnable = false;
    +
    472  return 0;
    +
    473 }
    +
    474 
    +
    475 template <const uint8_t BOOT_PROTOCOL>
    +
    476 uint8_t HIDBoot<BOOT_PROTOCOL>::Poll() {
    +
    477  uint8_t rcode = 0;
    +
    478 
    +
    479  if(!bPollEnable)
    +
    480  return 0;
    +
    481 
    +
    482  if(qNextPollTime <= millis()) {
    +
    483  qNextPollTime = millis() + 10;
    +
    484 
    +
    485  const uint8_t const_buff_len = 16;
    +
    486  uint8_t buf[const_buff_len];
    +
    487 
    +
    488  uint16_t read = (uint16_t) epInfo[epInterruptInIndex].maxPktSize;
    +
    489 
    +
    490  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[epInterruptInIndex].epAddr, &read, buf);
    491 
    -
    492 
    -
    493 #endif // __HIDBOOTMOUSE_H__
    +
    492  if(rcode) {
    +
    493  if(rcode != hrNAK)
    +
    494  USBTRACE2("Poll:", rcode);
    +
    495  return rcode;
    +
    496  }
    +
    497  //for (uint8_t i=0; i<read; i++)
    +
    498  // PrintHex<uint8_t>(buf[i]);
    +
    499  //if (read)
    +
    500  // USB_HOST_SERIAL.println("");
    +
    501 
    +
    502  if(pRptParser)
    +
    503  pRptParser->Parse((HID*)this, 0, (uint8_t) read, buf);
    +
    504  }
    +
    505  return rcode;
    +
    506 }
    +
    507 
    +
    508 
    +
    509 #endif // __HIDBOOTMOUSE_H__
    diff --git a/hidescriptorparser_8cpp.html b/hidescriptorparser_8cpp.html index a4b6bd54..82b6fe14 100644 --- a/hidescriptorparser_8cpp.html +++ b/hidescriptorparser_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidescriptorparser.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -95,7 +95,7 @@ Include dependency graph for hidescriptorparser.cpp:
    - +

    Go to the source code of this file.

    @@ -104,7 +104,7 @@ Include dependency graph for hidescriptorparser.cpp: diff --git a/hidescriptorparser_8cpp__incl.map b/hidescriptorparser_8cpp__incl.map index 5e6c3210..21dc8486 100644 --- a/hidescriptorparser_8cpp__incl.map +++ b/hidescriptorparser_8cpp__incl.map @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/hidescriptorparser_8cpp__incl.md5 b/hidescriptorparser_8cpp__incl.md5 index e3a56489..56d3f0d2 100644 --- a/hidescriptorparser_8cpp__incl.md5 +++ b/hidescriptorparser_8cpp__incl.md5 @@ -1 +1 @@ -c5950fe71012376c6c00689c8c1017cf \ No newline at end of file +04aa84b546d05d298092c24c0d8548c8 \ No newline at end of file diff --git a/hidescriptorparser_8cpp__incl.png b/hidescriptorparser_8cpp__incl.png index 181eaa7e..b95d155b 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 636f50b6..49d8c8e8 100644 --- a/hidescriptorparser_8cpp_source.html +++ b/hidescriptorparser_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidescriptorparser.cpp Source File @@ -31,7 +31,7 @@ - + @@ -1072,9 +1072,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    981  totalSize = 0;
    982 
    983  while (cntdn) {
    -
    984  //Serial.println("");
    +
    984  //USB_HOST_SERIAL.println("");
    985  //PrintHex<uint16_t>(offset + len - cntdn);
    -
    986  //Serial.print(":");
    +
    986  //USB_HOST_SERIAL.print(":");
    987 
    988  ParseItem(&p, &cntdn);
    989 
    @@ -1085,79 +1085,79 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    994 }
    995 
    996 void ReportDescParserBase::PrintValue(uint8_t *p, uint8_t len) {
    -
    997  Notify(PSTR("("), 0x80);
    +
    997  Notify(PSTR("("), 0x80);
    998  for (; len; p++, len--)
    999  PrintHex<uint8_t > (*p, 0x80);
    -
    1000  Notify(PSTR(")"), 0x80);
    +
    1000  Notify(PSTR(")"), 0x80);
    1001 }
    1002 
    1003 void ReportDescParserBase::PrintByteValue(uint8_t data) {
    -
    1004  Notify(PSTR("("), 0x80);
    +
    1004  Notify(PSTR("("), 0x80);
    1005  PrintHex<uint8_t > (data, 0x80);
    -
    1006  Notify(PSTR(")"), 0x80);
    +
    1006  Notify(PSTR(")"), 0x80);
    1007 }
    1008 
    1009 void ReportDescParserBase::PrintItemTitle(uint8_t prefix) {
    1010  switch (prefix & (TYPE_MASK | TAG_MASK)) {
    1011  case (TYPE_GLOBAL | TAG_GLOBAL_PUSH):
    -
    1012  Notify(PSTR("\r\nPush"), 0x80);
    +
    1012  Notify(PSTR("\r\nPush"), 0x80);
    1013  break;
    1014  case (TYPE_GLOBAL | TAG_GLOBAL_POP):
    -
    1015  Notify(PSTR("\r\nPop"), 0x80);
    +
    1015  Notify(PSTR("\r\nPop"), 0x80);
    1016  break;
    1017  case (TYPE_GLOBAL | TAG_GLOBAL_USAGEPAGE):
    -
    1018  Notify(PSTR("\r\nUsage Page"), 0x80);
    +
    1018  Notify(PSTR("\r\nUsage Page"), 0x80);
    1019  break;
    1020  case (TYPE_GLOBAL | TAG_GLOBAL_LOGICALMIN):
    -
    1021  Notify(PSTR("\r\nLogical Min"), 0x80);
    +
    1021  Notify(PSTR("\r\nLogical Min"), 0x80);
    1022  break;
    1023  case (TYPE_GLOBAL | TAG_GLOBAL_LOGICALMAX):
    -
    1024  Notify(PSTR("\r\nLogical Max"), 0x80);
    +
    1024  Notify(PSTR("\r\nLogical Max"), 0x80);
    1025  break;
    1026  case (TYPE_GLOBAL | TAG_GLOBAL_PHYSMIN):
    -
    1027  Notify(PSTR("\r\nPhysical Min"), 0x80);
    +
    1027  Notify(PSTR("\r\nPhysical Min"), 0x80);
    1028  break;
    1029  case (TYPE_GLOBAL | TAG_GLOBAL_PHYSMAX):
    -
    1030  Notify(PSTR("\r\nPhysical Max"), 0x80);
    +
    1030  Notify(PSTR("\r\nPhysical Max"), 0x80);
    1031  break;
    1032  case (TYPE_GLOBAL | TAG_GLOBAL_UNITEXP):
    -
    1033  Notify(PSTR("\r\nUnit Exp"), 0x80);
    +
    1033  Notify(PSTR("\r\nUnit Exp"), 0x80);
    1034  break;
    1035  case (TYPE_GLOBAL | TAG_GLOBAL_UNIT):
    -
    1036  Notify(PSTR("\r\nUnit"), 0x80);
    +
    1036  Notify(PSTR("\r\nUnit"), 0x80);
    1037  break;
    1038  case (TYPE_GLOBAL | TAG_GLOBAL_REPORTSIZE):
    -
    1039  Notify(PSTR("\r\nReport Size"), 0x80);
    +
    1039  Notify(PSTR("\r\nReport Size"), 0x80);
    1040  break;
    1041  case (TYPE_GLOBAL | TAG_GLOBAL_REPORTCOUNT):
    -
    1042  Notify(PSTR("\r\nReport Count"), 0x80);
    +
    1042  Notify(PSTR("\r\nReport Count"), 0x80);
    1043  break;
    1044  case (TYPE_GLOBAL | TAG_GLOBAL_REPORTID):
    -
    1045  Notify(PSTR("\r\nReport Id"), 0x80);
    +
    1045  Notify(PSTR("\r\nReport Id"), 0x80);
    1046  break;
    1047  case (TYPE_LOCAL | TAG_LOCAL_USAGE):
    -
    1048  Notify(PSTR("\r\nUsage"), 0x80);
    +
    1048  Notify(PSTR("\r\nUsage"), 0x80);
    1049  break;
    1050  case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
    -
    1051  Notify(PSTR("\r\nUsage Min"), 0x80);
    +
    1051  Notify(PSTR("\r\nUsage Min"), 0x80);
    1052  break;
    1053  case (TYPE_LOCAL | TAG_LOCAL_USAGEMAX):
    -
    1054  Notify(PSTR("\r\nUsage Max"), 0x80);
    +
    1054  Notify(PSTR("\r\nUsage Max"), 0x80);
    1055  break;
    1056  case (TYPE_MAIN | TAG_MAIN_COLLECTION):
    -
    1057  Notify(PSTR("\r\nCollection"), 0x80);
    +
    1057  Notify(PSTR("\r\nCollection"), 0x80);
    1058  break;
    1059  case (TYPE_MAIN | TAG_MAIN_ENDCOLLECTION):
    -
    1060  Notify(PSTR("\r\nEnd Collection"), 0x80);
    +
    1060  Notify(PSTR("\r\nEnd Collection"), 0x80);
    1061  break;
    1062  case (TYPE_MAIN | TAG_MAIN_INPUT):
    -
    1063  Notify(PSTR("\r\nInput"), 0x80);
    +
    1063  Notify(PSTR("\r\nInput"), 0x80);
    1064  break;
    1065  case (TYPE_MAIN | TAG_MAIN_OUTPUT):
    -
    1066  Notify(PSTR("\r\nOutput"), 0x80);
    +
    1066  Notify(PSTR("\r\nOutput"), 0x80);
    1067  break;
    1068  case (TYPE_MAIN | TAG_MAIN_FEATURE):
    -
    1069  Notify(PSTR("\r\nFeature"), 0x80);
    +
    1069  Notify(PSTR("\r\nFeature"), 0x80);
    1070  break;
    1071  } // switch (**pp & (TYPE_MASK | TAG_MASK))
    1072 }
    @@ -1241,30 +1241,30 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    1150  case (TYPE_MAIN | TAG_MAIN_ENDCOLLECTION):
    1151  switch (data) {
    1152  case 0x00:
    -
    1153  Notify(PSTR(" Physical"), 0x80);
    +
    1153  Notify(PSTR(" Physical"), 0x80);
    1154  break;
    1155  case 0x01:
    -
    1156  Notify(PSTR(" Application"), 0x80);
    +
    1156  Notify(PSTR(" Application"), 0x80);
    1157  break;
    1158  case 0x02:
    -
    1159  Notify(PSTR(" Logical"), 0x80);
    +
    1159  Notify(PSTR(" Logical"), 0x80);
    1160  break;
    1161  case 0x03:
    -
    1162  Notify(PSTR(" Report"), 0x80);
    +
    1162  Notify(PSTR(" Report"), 0x80);
    1163  break;
    1164  case 0x04:
    -
    1165  Notify(PSTR(" Named Array"), 0x80);
    +
    1165  Notify(PSTR(" Named Array"), 0x80);
    1166  break;
    1167  case 0x05:
    -
    1168  Notify(PSTR(" Usage Switch"), 0x80);
    +
    1168  Notify(PSTR(" Usage Switch"), 0x80);
    1169  break;
    1170  case 0x06:
    -
    1171  Notify(PSTR(" Usage Modifier"), 0x80);
    +
    1171  Notify(PSTR(" Usage Modifier"), 0x80);
    1172  break;
    1173  default:
    -
    1174  Notify(PSTR(" Vendor Defined("), 0x80);
    +
    1174  Notify(PSTR(" Vendor Defined("), 0x80);
    1175  PrintHex<uint8_t > (data, 0x80);
    -
    1176  Notify(PSTR(")"), 0x80);
    +
    1176  Notify(PSTR(")"), 0x80);
    1177  }
    1178  break;
    1179  case (TYPE_MAIN | TAG_MAIN_INPUT):
    @@ -1273,9 +1273,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    1182  totalSize += (uint16_t)rptSize * (uint16_t)rptCount;
    1183  rptSize = 0;
    1184  rptCount = 0;
    -
    1185  Notify(PSTR("("), 0x80);
    +
    1185  Notify(PSTR("("), 0x80);
    1186  PrintBin<uint8_t > (data, 0x80);
    -
    1187  Notify(PSTR(")"), 0x80);
    +
    1187  Notify(PSTR(")"), 0x80);
    1188  break;
    1189  } // switch (**pp & (TYPE_MASK | TAG_MASK))
    1190  }
    @@ -1328,232 +1328,232 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    1237 }
    1238 
    1239 void ReportDescParserBase::PrintUsagePage(uint16_t page) {
    -
    1240  Notify(pstrSpace, 0x80);
    +
    1240  Notify(pstrSpace, 0x80);
    1241 
    1242  if (page > 0x00 && page < 0x11)
    -
    1243  Notify((char*)pgm_read_word(&usagePageTitles0[page - 1]), 0x80);
    +
    1243  Notify((char*)pgm_read_word(&usagePageTitles0[page - 1]), 0x80);
    1244  else if (page > 0x7f && page < 0x84)
    -
    1245  Notify(pstrUsagePageMonitor, 0x80);
    +
    1245  Notify(pstrUsagePageMonitor, 0x80);
    1246  else if (page > 0x83 && page < 0x8c)
    -
    1247  Notify(pstrUsagePagePower, 0x80);
    +
    1247  Notify(pstrUsagePagePower, 0x80);
    1248  else if (page > 0x8b && page < 0x92)
    -
    1249  Notify((char*)pgm_read_word(&usagePageTitles1[page - 0x8c]), 0x80);
    +
    1249  Notify((char*)pgm_read_word(&usagePageTitles1[page - 0x8c]), 0x80);
    1250  else if (page > 0xfeff && page <= 0xffff)
    -
    1251  Notify(pstrUsagePageVendorDefined, 0x80);
    +
    1251  Notify(pstrUsagePageVendorDefined, 0x80);
    1252  else
    1253  switch (page) {
    1254  case 0x14:
    -
    1255  Notify(pstrUsagePageAlphaNumericDisplay, 0x80);
    +
    1255  Notify(pstrUsagePageAlphaNumericDisplay, 0x80);
    1256  break;
    1257  case 0x40:
    -
    1258  Notify(pstrUsagePageMedicalInstruments, 0x80);
    +
    1258  Notify(pstrUsagePageMedicalInstruments, 0x80);
    1259  break;
    1260  default:
    -
    1261  Notify(pstrUsagePageUndefined, 0x80);
    +
    1261  Notify(pstrUsagePageUndefined, 0x80);
    1262  }
    1263 }
    1264 
    1265 void ReportDescParserBase::PrintButtonPageUsage(uint16_t usage) {
    -
    1266  Notify(pstrSpace, 0x80);
    -
    1267  Notify(PSTR("Btn"), 0x80);
    +
    1266  Notify(pstrSpace, 0x80);
    +
    1267  Notify(PSTR("Btn"), 0x80);
    1268  PrintHex<uint16_t > (usage, 0x80);
    -
    1269  Notify(PSTR("\r\n"), 0x80);
    -
    1270  //Serial.print(usage, HEX);
    +
    1269  Notify(PSTR("\r\n"), 0x80);
    +
    1270  //USB_HOST_SERIAL.print(usage, HEX);
    1271 }
    1272 
    1273 void ReportDescParserBase::PrintOrdinalPageUsage(uint16_t usage) {
    -
    1274  Notify(pstrSpace, 0x80);
    -
    1275  Notify(PSTR("Inst"), 0x80);
    +
    1274  Notify(pstrSpace, 0x80);
    +
    1275  Notify(PSTR("Inst"), 0x80);
    1276  // Sorry, HEX for now...
    1277  PrintHex<uint16_t > (usage, 0x80);
    -
    1278  Notify(PSTR("\r\n"), 0x80);
    -
    1279  //Serial.print(usage, DEC);
    +
    1278  Notify(PSTR("\r\n"), 0x80);
    +
    1279  //USB_HOST_SERIAL.print(usage, DEC);
    1280 }
    1281 
    1282 void ReportDescParserBase::PrintGenericDesktopPageUsage(uint16_t usage) {
    -
    1283  Notify(pstrSpace, 0x80);
    +
    1283  Notify(pstrSpace, 0x80);
    1284 
    1285  if (usage > 0x00 && usage < 0x0a)
    -
    1286  Notify((char*)pgm_read_word(&genDesktopTitles0[usage - 1]), 0x80);
    +
    1286  Notify((char*)pgm_read_word(&genDesktopTitles0[usage - 1]), 0x80);
    1287  else if (usage > 0x2f && usage < 0x49)
    -
    1288  Notify((char*)pgm_read_word(&genDesktopTitles1[usage - 0x30]), 0x80);
    +
    1288  Notify((char*)pgm_read_word(&genDesktopTitles1[usage - 0x30]), 0x80);
    1289  else if (usage > 0x7f && usage < 0x94)
    -
    1290  Notify((char*)pgm_read_word(&genDesktopTitles2[usage - 0x80]), 0x80);
    +
    1290  Notify((char*)pgm_read_word(&genDesktopTitles2[usage - 0x80]), 0x80);
    1291  else if (usage > 0x9f && usage < 0xa9)
    -
    1292  Notify((char*)pgm_read_word(&genDesktopTitles3[usage - 0xa0]), 0x80);
    +
    1292  Notify((char*)pgm_read_word(&genDesktopTitles3[usage - 0xa0]), 0x80);
    1293  else if (usage > 0xaf && usage < 0xb8)
    -
    1294  Notify((char*)pgm_read_word(&genDesktopTitles4[usage - 0xb0]), 0x80);
    +
    1294  Notify((char*)pgm_read_word(&genDesktopTitles4[usage - 0xb0]), 0x80);
    1295  else
    -
    1296  Notify(pstrUsagePageUndefined, 0x80);
    +
    1296  Notify(pstrUsagePageUndefined, 0x80);
    1297 }
    1298 
    1299 void ReportDescParserBase::PrintSimulationControlsPageUsage(uint16_t usage) {
    -
    1300  Notify(pstrSpace, 0x80);
    +
    1300  Notify(pstrSpace, 0x80);
    1301 
    1302  if (usage > 0x00 && usage < 0x0d)
    -
    1303  Notify((char*)pgm_read_word(&simuTitles0[usage - 1]), 0x80);
    +
    1303  Notify((char*)pgm_read_word(&simuTitles0[usage - 1]), 0x80);
    1304  else if (usage > 0x1f && usage < 0x26)
    -
    1305  Notify((char*)pgm_read_word(&simuTitles1[usage - 0x20]), 0x80);
    +
    1305  Notify((char*)pgm_read_word(&simuTitles1[usage - 0x20]), 0x80);
    1306  else if (usage > 0xaf && usage < 0xd1)
    -
    1307  Notify((char*)pgm_read_word(&simuTitles2[usage - 0xb0]), 0x80);
    +
    1307  Notify((char*)pgm_read_word(&simuTitles2[usage - 0xb0]), 0x80);
    1308  else
    -
    1309  Notify(pstrUsagePageUndefined, 0x80);
    +
    1309  Notify(pstrUsagePageUndefined, 0x80);
    1310 }
    1311 
    1312 void ReportDescParserBase::PrintVRControlsPageUsage(uint16_t usage) {
    -
    1313  Notify(pstrSpace, 0x80);
    +
    1313  Notify(pstrSpace, 0x80);
    1314 
    1315  if (usage > 0x00 && usage < 0x0b)
    -
    1316  Notify((char*)pgm_read_word(&vrTitles0[usage - 1]), 0x80);
    +
    1316  Notify((char*)pgm_read_word(&vrTitles0[usage - 1]), 0x80);
    1317  else if (usage > 0x1f && usage < 0x22)
    -
    1318  Notify((char*)pgm_read_word(&vrTitles1[usage - 0x20]), 0x80);
    +
    1318  Notify((char*)pgm_read_word(&vrTitles1[usage - 0x20]), 0x80);
    1319  else
    -
    1320  Notify(pstrUsagePageUndefined, 0x80);
    +
    1320  Notify(pstrUsagePageUndefined, 0x80);
    1321 }
    1322 
    1323 void ReportDescParserBase::PrintSportsControlsPageUsage(uint16_t usage) {
    -
    1324  Notify(pstrSpace, 0x80);
    +
    1324  Notify(pstrSpace, 0x80);
    1325 
    1326  if (usage > 0x00 && usage < 0x05)
    -
    1327  Notify((char*)pgm_read_word(&sportsCtrlTitles0[usage - 1]), 0x80);
    +
    1327  Notify((char*)pgm_read_word(&sportsCtrlTitles0[usage - 1]), 0x80);
    1328  else if (usage > 0x2f && usage < 0x3a)
    -
    1329  Notify((char*)pgm_read_word(&sportsCtrlTitles1[usage - 0x30]), 0x80);
    +
    1329  Notify((char*)pgm_read_word(&sportsCtrlTitles1[usage - 0x30]), 0x80);
    1330  else if (usage > 0x4f && usage < 0x64)
    -
    1331  Notify((char*)pgm_read_word(&sportsCtrlTitles2[usage - 0x50]), 0x80);
    +
    1331  Notify((char*)pgm_read_word(&sportsCtrlTitles2[usage - 0x50]), 0x80);
    1332  else
    -
    1333  Notify(pstrUsagePageUndefined, 0x80);
    +
    1333  Notify(pstrUsagePageUndefined, 0x80);
    1334 }
    1335 
    1336 void ReportDescParserBase::PrintGameControlsPageUsage(uint16_t usage) {
    -
    1337  Notify(pstrSpace, 0x80);
    +
    1337  Notify(pstrSpace, 0x80);
    1338 
    1339  if (usage > 0x00 && usage < 0x04)
    -
    1340  Notify((char*)pgm_read_word(&gameTitles0[usage - 1]), 0x80);
    +
    1340  Notify((char*)pgm_read_word(&gameTitles0[usage - 1]), 0x80);
    1341  else if (usage > 0x1f && usage < 0x3a)
    -
    1342  Notify((char*)pgm_read_word(&gameTitles1[usage - 0x20]), 0x80);
    +
    1342  Notify((char*)pgm_read_word(&gameTitles1[usage - 0x20]), 0x80);
    1343  else
    -
    1344  Notify(pstrUsagePageUndefined, 0x80);
    +
    1344  Notify(pstrUsagePageUndefined, 0x80);
    1345 }
    1346 
    1347 void ReportDescParserBase::PrintGenericDeviceControlsPageUsage(uint16_t usage) {
    -
    1348  Notify(pstrSpace, 0x80);
    +
    1348  Notify(pstrSpace, 0x80);
    1349 
    1350  if (usage > 0x1f && usage < 0x27)
    -
    1351  Notify((char*)pgm_read_word(&genDevCtrlTitles[usage - 0x20]), 0x80);
    +
    1351  Notify((char*)pgm_read_word(&genDevCtrlTitles[usage - 0x20]), 0x80);
    1352  else
    -
    1353  Notify(pstrUsagePageUndefined, 0x80);
    +
    1353  Notify(pstrUsagePageUndefined, 0x80);
    1354 }
    1355 
    1356 void ReportDescParserBase::PrintLEDPageUsage(uint16_t usage) {
    -
    1357  Notify(pstrSpace, 0x80);
    +
    1357  Notify(pstrSpace, 0x80);
    1358 
    1359  if (usage > 0x00 && usage < 0x4e)
    -
    1360  Notify((char*)pgm_read_word(&ledTitles[usage - 1]), 0x80);
    +
    1360  Notify((char*)pgm_read_word(&ledTitles[usage - 1]), 0x80);
    1361  else
    -
    1362  Notify(pstrUsagePageUndefined, 0x80);
    +
    1362  Notify(pstrUsagePageUndefined, 0x80);
    1363 }
    1364 
    1365 void ReportDescParserBase::PrintTelephonyPageUsage(uint16_t usage) {
    -
    1366  Notify(pstrSpace, 0x80);
    +
    1366  Notify(pstrSpace, 0x80);
    1367 
    1368  if (usage > 0x00 && usage < 0x08)
    -
    1369  Notify((char*)pgm_read_word(&telTitles0[usage - 1]), 0x80);
    +
    1369  Notify((char*)pgm_read_word(&telTitles0[usage - 1]), 0x80);
    1370  else if (usage > 0x1f && usage < 0x32)
    -
    1371  Notify((char*)pgm_read_word(&telTitles1[usage - 0x1f]), 0x80);
    +
    1371  Notify((char*)pgm_read_word(&telTitles1[usage - 0x1f]), 0x80);
    1372  else if (usage > 0x4f && usage < 0x54)
    -
    1373  Notify((char*)pgm_read_word(&telTitles2[usage - 0x4f]), 0x80);
    +
    1373  Notify((char*)pgm_read_word(&telTitles2[usage - 0x4f]), 0x80);
    1374  else if (usage > 0x6f && usage < 0x75)
    -
    1375  Notify((char*)pgm_read_word(&telTitles3[usage - 0x6f]), 0x80);
    +
    1375  Notify((char*)pgm_read_word(&telTitles3[usage - 0x6f]), 0x80);
    1376  else if (usage > 0x8f && usage < 0x9f)
    -
    1377  Notify((char*)pgm_read_word(&telTitles4[usage - 0x8f]), 0x80);
    +
    1377  Notify((char*)pgm_read_word(&telTitles4[usage - 0x8f]), 0x80);
    1378  else if (usage > 0xaf && usage < 0xc0)
    -
    1379  Notify((char*)pgm_read_word(&telTitles5[usage - 0xaf]), 0x80);
    +
    1379  Notify((char*)pgm_read_word(&telTitles5[usage - 0xaf]), 0x80);
    1380  else
    -
    1381  Notify(pstrUsagePageUndefined, 0x80);
    +
    1381  Notify(pstrUsagePageUndefined, 0x80);
    1382 }
    1383 
    1384 void ReportDescParserBase::PrintConsumerPageUsage(uint16_t usage) {
    -
    1385  Notify(pstrSpace, 0x80);
    +
    1385  Notify(pstrSpace, 0x80);
    1386 
    1387  if (usage > 0x00 && usage < 0x07)
    -
    1388  Notify((char*)pgm_read_word(&consTitles0[usage - 1]), 0x80);
    +
    1388  Notify((char*)pgm_read_word(&consTitles0[usage - 1]), 0x80);
    1389  else if (usage > 0x1f && usage < 0x23)
    -
    1390  Notify((char*)pgm_read_word(&consTitles1[usage - 0x1f]), 0x80);
    +
    1390  Notify((char*)pgm_read_word(&consTitles1[usage - 0x1f]), 0x80);
    1391  else if (usage > 0x2f && usage < 0x37)
    -
    1392  Notify((char*)pgm_read_word(&consTitles2[usage - 0x2f]), 0x80);
    +
    1392  Notify((char*)pgm_read_word(&consTitles2[usage - 0x2f]), 0x80);
    1393  else if (usage > 0x3f && usage < 0x49)
    -
    1394  Notify((char*)pgm_read_word(&consTitles3[usage - 0x3f]), 0x80);
    +
    1394  Notify((char*)pgm_read_word(&consTitles3[usage - 0x3f]), 0x80);
    1395  else if (usage > 0x5f && usage < 0x67)
    -
    1396  Notify((char*)pgm_read_word(&consTitles4[usage - 0x5f]), 0x80);
    +
    1396  Notify((char*)pgm_read_word(&consTitles4[usage - 0x5f]), 0x80);
    1397  else if (usage > 0x7f && usage < 0xa5)
    -
    1398  Notify((char*)pgm_read_word(&consTitles5[usage - 0x7f]), 0x80);
    +
    1398  Notify((char*)pgm_read_word(&consTitles5[usage - 0x7f]), 0x80);
    1399  else if (usage > 0xaf && usage < 0xcf)
    -
    1400  Notify((char*)pgm_read_word(&consTitles6[usage - 0xaf]), 0x80);
    +
    1400  Notify((char*)pgm_read_word(&consTitles6[usage - 0xaf]), 0x80);
    1401  else if (usage > 0xdf && usage < 0xeb)
    -
    1402  Notify((char*)pgm_read_word(&consTitles7[usage - 0xdf]), 0x80);
    +
    1402  Notify((char*)pgm_read_word(&consTitles7[usage - 0xdf]), 0x80);
    1403  else if (usage > 0xef && usage < 0xf6)
    -
    1404  Notify((char*)pgm_read_word(&consTitles8[usage - 0xef]), 0x80);
    +
    1404  Notify((char*)pgm_read_word(&consTitles8[usage - 0xef]), 0x80);
    1405  else if (usage > 0xff && usage < 0x10e)
    -
    1406  Notify((char*)pgm_read_word(&consTitles9[usage - 0xff]), 0x80);
    +
    1406  Notify((char*)pgm_read_word(&consTitles9[usage - 0xff]), 0x80);
    1407  else if (usage > 0x14f && usage < 0x156)
    -
    1408  Notify((char*)pgm_read_word(&consTitlesA[usage - 0x14f]), 0x80);
    +
    1408  Notify((char*)pgm_read_word(&consTitlesA[usage - 0x14f]), 0x80);
    1409  else if (usage > 0x15f && usage < 0x16b)
    -
    1410  Notify((char*)pgm_read_word(&consTitlesB[usage - 0x15f]), 0x80);
    +
    1410  Notify((char*)pgm_read_word(&consTitlesB[usage - 0x15f]), 0x80);
    1411  else if (usage > 0x16f && usage < 0x175)
    -
    1412  Notify((char*)pgm_read_word(&consTitlesC[usage - 0x16f]), 0x80);
    +
    1412  Notify((char*)pgm_read_word(&consTitlesC[usage - 0x16f]), 0x80);
    1413  else if (usage > 0x17f && usage < 0x1c8)
    -
    1414  Notify((char*)pgm_read_word(&consTitlesD[usage - 0x17f]), 0x80);
    +
    1414  Notify((char*)pgm_read_word(&consTitlesD[usage - 0x17f]), 0x80);
    1415  else if (usage > 0x1ff && usage < 0x29d)
    -
    1416  Notify((char*)pgm_read_word(&consTitlesE[usage - 0x1ff]), 0x80);
    +
    1416  Notify((char*)pgm_read_word(&consTitlesE[usage - 0x1ff]), 0x80);
    1417  else
    -
    1418  Notify(pstrUsagePageUndefined, 0x80);
    +
    1418  Notify(pstrUsagePageUndefined, 0x80);
    1419 }
    1420 
    1421 void ReportDescParserBase::PrintDigitizerPageUsage(uint16_t usage) {
    -
    1422  Notify(pstrSpace, 0x80);
    +
    1422  Notify(pstrSpace, 0x80);
    1423 
    1424  if (usage > 0x00 && usage < 0x0e)
    -
    1425  Notify((char*)pgm_read_word(&digitTitles0[usage - 1]), 0x80);
    +
    1425  Notify((char*)pgm_read_word(&digitTitles0[usage - 1]), 0x80);
    1426  else if (usage > 0x1f && usage < 0x23)
    -
    1427  Notify((char*)pgm_read_word(&digitTitles1[usage - 0x1f]), 0x80);
    +
    1427  Notify((char*)pgm_read_word(&digitTitles1[usage - 0x1f]), 0x80);
    1428  else if (usage > 0x2f && usage < 0x47)
    -
    1429  Notify((char*)pgm_read_word(&digitTitles2[usage - 0x2f]), 0x80);
    +
    1429  Notify((char*)pgm_read_word(&digitTitles2[usage - 0x2f]), 0x80);
    1430  else
    -
    1431  Notify(pstrUsagePageUndefined, 0x80);
    +
    1431  Notify(pstrUsagePageUndefined, 0x80);
    1432 }
    1433 
    1434 void ReportDescParserBase::PrintAlphanumDisplayPageUsage(uint16_t usage) {
    -
    1435  Notify(pstrSpace, 0x80);
    +
    1435  Notify(pstrSpace, 0x80);
    1436 
    1437  if (usage > 0x00 && usage < 0x03)
    -
    1438  Notify((char*)pgm_read_word(&aplphanumTitles0[usage - 1]), 0x80);
    +
    1438  Notify((char*)pgm_read_word(&aplphanumTitles0[usage - 1]), 0x80);
    1439  else if (usage > 0x1f && usage < 0x4e)
    -
    1440  Notify((char*)pgm_read_word(&aplphanumTitles1[usage - 0x1f]), 0x80);
    +
    1440  Notify((char*)pgm_read_word(&aplphanumTitles1[usage - 0x1f]), 0x80);
    1441  else if (usage > 0x7f && usage < 0x96)
    -
    1442  Notify((char*)pgm_read_word(&digitTitles2[usage - 0x80]), 0x80);
    +
    1442  Notify((char*)pgm_read_word(&digitTitles2[usage - 0x80]), 0x80);
    1443  else
    -
    1444  Notify(pstrUsagePageUndefined, 0x80);
    +
    1444  Notify(pstrUsagePageUndefined, 0x80);
    1445 }
    1446 
    1447 void ReportDescParserBase::PrintMedicalInstrumentPageUsage(uint16_t usage) {
    -
    1448  Notify(pstrSpace, 0x80);
    +
    1448  Notify(pstrSpace, 0x80);
    1449 
    1450  if (usage == 1)
    -
    1451  Notify(pstrUsageMedicalUltrasound, 0x80);
    +
    1451  Notify(pstrUsageMedicalUltrasound, 0x80);
    1452  else if (usage > 0x1f && usage < 0x28)
    -
    1453  Notify((char*)pgm_read_word(&medInstrTitles0[usage - 0x1f]), 0x80);
    +
    1453  Notify((char*)pgm_read_word(&medInstrTitles0[usage - 0x1f]), 0x80);
    1454  else if (usage > 0x3f && usage < 0x45)
    -
    1455  Notify((char*)pgm_read_word(&medInstrTitles1[usage - 0x40]), 0x80);
    +
    1455  Notify((char*)pgm_read_word(&medInstrTitles1[usage - 0x40]), 0x80);
    1456  else if (usage > 0x5f && usage < 0x62)
    -
    1457  Notify((char*)pgm_read_word(&medInstrTitles2[usage - 0x60]), 0x80);
    +
    1457  Notify((char*)pgm_read_word(&medInstrTitles2[usage - 0x60]), 0x80);
    1458  else if (usage == 0x70)
    -
    1459  Notify(pstrUsageDepthGainCompensation, 0x80);
    +
    1459  Notify(pstrUsageDepthGainCompensation, 0x80);
    1460  else if (usage > 0x7f && usage < 0x8a)
    -
    1461  Notify((char*)pgm_read_word(&medInstrTitles3[usage - 0x80]), 0x80);
    +
    1461  Notify((char*)pgm_read_word(&medInstrTitles3[usage - 0x80]), 0x80);
    1462  else if (usage > 0x9f && usage < 0xa2)
    -
    1463  Notify((char*)pgm_read_word(&medInstrTitles4[usage - 0xa0]), 0x80);
    +
    1463  Notify((char*)pgm_read_word(&medInstrTitles4[usage - 0xa0]), 0x80);
    1464  else
    -
    1465  Notify(pstrUsagePageUndefined, 0x80);
    +
    1465  Notify(pstrUsagePageUndefined, 0x80);
    1466 }
    1467 
    1468 uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint16_t *pcntdn) {
    @@ -1704,7 +1704,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    1613  }
    1614  PrintByteValue(result.dwResult);
    1615  }
    -
    1616  Notify(PSTR("\r\n"), 0x80);
    +
    1616  Notify(PSTR("\r\n"), 0x80);
    1617 }
    1618 
    1619 void UniversalReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {
    @@ -1720,7 +1720,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidescriptorparser_8h.html b/hidescriptorparser_8h.html index a2e4557d..1e0b4f75 100644 --- a/hidescriptorparser_8h.html +++ b/hidescriptorparser_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidescriptorparser.h File Reference @@ -31,7 +31,7 @@ - + @@ -109,7 +109,7 @@ Include dependency graph for hidescriptorparser.h:
    - +
    This graph shows which files directly or indirectly include this file:
    @@ -137,7 +137,7 @@ Classes diff --git a/hidescriptorparser_8h__incl.map b/hidescriptorparser_8h__incl.map index 3cc412cf..f00a042a 100644 --- a/hidescriptorparser_8h__incl.map +++ b/hidescriptorparser_8h__incl.map @@ -1,15 +1,15 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/hidescriptorparser_8h__incl.md5 b/hidescriptorparser_8h__incl.md5 index f82cf05e..0700cd5e 100644 --- a/hidescriptorparser_8h__incl.md5 +++ b/hidescriptorparser_8h__incl.md5 @@ -1 +1 @@ -25b9ef93dd09b17036b9eaa17754b922 \ No newline at end of file +dca07c5821de121121f1b07f506c37d7 \ No newline at end of file diff --git a/hidescriptorparser_8h__incl.png b/hidescriptorparser_8h__incl.png index a46a8610..0d5c09b5 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 304f70e1..24ec6212 100644 --- a/hidescriptorparser_8h_source.html +++ b/hidescriptorparser_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidescriptorparser.h Source File @@ -31,7 +31,7 @@
    - + @@ -285,7 +285,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hiduniversal_8cpp.html b/hiduniversal_8cpp.html index 45cadf2b..1e48c048 100644 --- a/hiduniversal_8cpp.html +++ b/hiduniversal_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hiduniversal.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -95,7 +95,7 @@ Include dependency graph for hiduniversal.cpp:
    - +

    Go to the source code of this file.

    @@ -104,7 +104,7 @@ Include dependency graph for hiduniversal.cpp: diff --git a/hiduniversal_8cpp__incl.map b/hiduniversal_8cpp__incl.map index b8a4171f..377da8ac 100644 --- a/hiduniversal_8cpp__incl.map +++ b/hiduniversal_8cpp__incl.map @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/hiduniversal_8cpp__incl.md5 b/hiduniversal_8cpp__incl.md5 index 56cf1432..57382b61 100644 --- a/hiduniversal_8cpp__incl.md5 +++ b/hiduniversal_8cpp__incl.md5 @@ -1 +1 @@ -7a4e08af050d651d79e000504b5d3a13 \ No newline at end of file +590c899f227116dec54dfb8dea2e65ee \ No newline at end of file diff --git a/hiduniversal_8cpp__incl.png b/hiduniversal_8cpp__incl.png index 4d9c02b2..6df1541c 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 60f986f7..c4b2681d 100644 --- a/hiduniversal_8cpp_source.html +++ b/hiduniversal_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hiduniversal.cpp Source File @@ -31,7 +31,7 @@ - + @@ -203,7 +203,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    112  p->lowspeed = lowspeed;
    113 
    114  // Get device descriptor
    -
    115  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
    +
    115  rcode = pUsb->getDevDescr(0, 0, 8, (uint8_t*)buf);
    116 
    117  if (!rcode)
    118  len = (buf[0] > constBufSize) ? constBufSize : buf[0];
    @@ -250,7 +250,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    159  p->lowspeed = lowspeed;
    160 
    161  if (len)
    -
    162  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
    +
    162  rcode = pUsb->getDevDescr(bAddress, 0, len, (uint8_t*)buf);
    163 
    164  if (rcode)
    165  goto FailGetDevDescr;
    @@ -312,165 +312,177 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    221  return 0;
    222 
    223 FailGetDevDescr:
    -
    224  NotifyFailGetDevDescr();
    -
    225  goto Fail;
    -
    226 
    -
    227 FailSetDevTblEntry:
    -
    228  NotifyFailSetDevTblEntry();
    -
    229  goto Fail;
    -
    230 
    -
    231 FailGetConfDescr:
    -
    232  NotifyFailGetConfDescr();
    -
    233  goto Fail;
    -
    234 
    -
    235 FailSetConfDescr:
    -
    236  NotifyFailSetConfDescr();
    -
    237  goto Fail;
    -
    238 
    -
    239 
    -
    240 FailSetIdle:
    -
    241  USBTRACE("SetIdle:");
    -
    242 
    -
    243 Fail:
    -
    244  NotifyFail(rcode);
    -
    245  Release();
    -
    246  return rcode;
    -
    247 }
    -
    248 
    -
    249 HIDUniversal::HIDInterface* HIDUniversal::FindInterface(uint8_t iface, uint8_t alt, uint8_t proto) {
    -
    250  for (uint8_t i = 0; i < bNumIface && i < maxHidInterfaces; i++)
    -
    251  if (hidInterfaces[i].bmInterface == iface && hidInterfaces[i].bmAltSet == alt
    -
    252  && hidInterfaces[i].bmProtocol == proto)
    -
    253  return hidInterfaces + i;
    -
    254  return NULL;
    -
    255 }
    -
    256 
    -
    257 void HIDUniversal::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
    -
    258  // If the first configuration satisfies, the others are not concidered.
    -
    259  if (bNumEP > 1 && conf != bConfNum)
    -
    260  return;
    -
    261 
    -
    262  //ErrorMessage<uint8_t>(PSTR("\r\nConf.Val"), conf);
    -
    263  //ErrorMessage<uint8_t>(PSTR("Iface Num"), iface);
    -
    264  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
    -
    265 
    -
    266  bConfNum = conf;
    -
    267 
    -
    268  uint8_t index = 0;
    -
    269  HIDInterface *piface = FindInterface(iface, alt, proto);
    -
    270 
    -
    271  // Fill in interface structure in case of new interface
    -
    272  if (!piface) {
    -
    273  piface = hidInterfaces + bNumIface;
    -
    274  piface->bmInterface = iface;
    -
    275  piface->bmAltSet = alt;
    -
    276  piface->bmProtocol = proto;
    -
    277  bNumIface++;
    -
    278  }
    +
    224 #ifdef DEBUG_USB_HOST
    +
    225  NotifyFailGetDevDescr();
    +
    226  goto Fail;
    +
    227 #endif
    +
    228 
    +
    229 FailSetDevTblEntry:
    +
    230 #ifdef DEBUG_USB_HOST
    +
    231  NotifyFailSetDevTblEntry();
    +
    232  goto Fail;
    +
    233 #endif
    +
    234 
    +
    235 FailGetConfDescr:
    +
    236 #ifdef DEBUG_USB_HOST
    +
    237  NotifyFailGetConfDescr();
    +
    238  goto Fail;
    +
    239 #endif
    +
    240 
    +
    241 FailSetConfDescr:
    +
    242 #ifdef DEBUG_USB_HOST
    +
    243  NotifyFailSetConfDescr();
    +
    244  goto Fail;
    +
    245 #endif
    +
    246 
    +
    247 
    +
    248 FailSetIdle:
    +
    249 #ifdef DEBUG_USB_HOST
    +
    250  USBTRACE("SetIdle:");
    +
    251 #endif
    +
    252 
    +
    253 Fail:
    +
    254 #ifdef DEBUG_USB_HOST
    +
    255  NotifyFail(rcode);
    +
    256 #endif
    +
    257  Release();
    +
    258  return rcode;
    +
    259 }
    +
    260 
    +
    261 HIDUniversal::HIDInterface* HIDUniversal::FindInterface(uint8_t iface, uint8_t alt, uint8_t proto) {
    +
    262  for (uint8_t i = 0; i < bNumIface && i < maxHidInterfaces; i++)
    +
    263  if (hidInterfaces[i].bmInterface == iface && hidInterfaces[i].bmAltSet == alt
    +
    264  && hidInterfaces[i].bmProtocol == proto)
    +
    265  return hidInterfaces + i;
    +
    266  return NULL;
    +
    267 }
    +
    268 
    +
    269 void HIDUniversal::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
    +
    270  // If the first configuration satisfies, the others are not concidered.
    +
    271  if (bNumEP > 1 && conf != bConfNum)
    +
    272  return;
    +
    273 
    +
    274  //ErrorMessage<uint8_t>(PSTR("\r\nConf.Val"), conf);
    +
    275  //ErrorMessage<uint8_t>(PSTR("Iface Num"), iface);
    +
    276  //ErrorMessage<uint8_t>(PSTR("Alt.Set"), alt);
    +
    277 
    +
    278  bConfNum = conf;
    279 
    -
    280  if ((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
    -
    281  index = epInterruptInIndex;
    -
    282  else
    -
    283  index = epInterruptOutIndex;
    -
    284 
    -
    285  if (index) {
    -
    286  // Fill in the endpoint info structure
    -
    287  epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
    -
    288  epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
    -
    289  epInfo[bNumEP].epAttribs = 0;
    -
    290  epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
    +
    280  uint8_t index = 0;
    +
    281  HIDInterface *piface = FindInterface(iface, alt, proto);
    +
    282 
    +
    283  // Fill in interface structure in case of new interface
    +
    284  if (!piface) {
    +
    285  piface = hidInterfaces + bNumIface;
    +
    286  piface->bmInterface = iface;
    +
    287  piface->bmAltSet = alt;
    +
    288  piface->bmProtocol = proto;
    +
    289  bNumIface++;
    +
    290  }
    291 
    -
    292  // Fill in the endpoint index list
    -
    293  piface->epIndex[index] = bNumEP; //(pep->bEndpointAddress & 0x0F);
    -
    294 
    -
    295  bNumEP++;
    -
    296  }
    -
    297  //PrintEndpointDescriptor(pep);
    -
    298 }
    -
    299 
    -
    300 uint8_t HIDUniversal::Release() {
    -
    301  pUsb->GetAddressPool().FreeAddress(bAddress);
    -
    302 
    -
    303  bNumEP = 1;
    -
    304  bAddress = 0;
    -
    305  qNextPollTime = 0;
    -
    306  bPollEnable = false;
    -
    307  return 0;
    -
    308 }
    -
    309 
    -
    310 bool HIDUniversal::BuffersIdentical(uint8_t len, uint8_t *buf1, uint8_t *buf2) {
    -
    311  for (uint8_t i = 0; i < len; i++)
    -
    312  if (buf1[i] != buf2[i])
    -
    313  return false;
    -
    314  return true;
    -
    315 }
    -
    316 
    -
    317 void HIDUniversal::ZeroMemory(uint8_t len, uint8_t *buf) {
    -
    318  for (uint8_t i = 0; i < len; i++)
    -
    319  buf[i] = 0;
    +
    292  if ((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
    +
    293  index = epInterruptInIndex;
    +
    294  else
    +
    295  index = epInterruptOutIndex;
    +
    296 
    +
    297  if (index) {
    +
    298  // Fill in the endpoint info structure
    +
    299  epInfo[bNumEP].epAddr = (pep->bEndpointAddress & 0x0F);
    +
    300  epInfo[bNumEP].maxPktSize = (uint8_t)pep->wMaxPacketSize;
    +
    301  epInfo[bNumEP].epAttribs = 0;
    +
    302  epInfo[bNumEP].bmNakPower = USB_NAK_NOWAIT;
    +
    303 
    +
    304  // Fill in the endpoint index list
    +
    305  piface->epIndex[index] = bNumEP; //(pep->bEndpointAddress & 0x0F);
    +
    306 
    +
    307  bNumEP++;
    +
    308  }
    +
    309  //PrintEndpointDescriptor(pep);
    +
    310 }
    +
    311 
    +
    312 uint8_t HIDUniversal::Release() {
    +
    313  pUsb->GetAddressPool().FreeAddress(bAddress);
    +
    314 
    +
    315  bNumEP = 1;
    +
    316  bAddress = 0;
    +
    317  qNextPollTime = 0;
    +
    318  bPollEnable = false;
    +
    319  return 0;
    320 }
    321 
    -
    322 void HIDUniversal::SaveBuffer(uint8_t len, uint8_t *src, uint8_t *dest) {
    +
    322 bool HIDUniversal::BuffersIdentical(uint8_t len, uint8_t *buf1, uint8_t *buf2) {
    323  for (uint8_t i = 0; i < len; i++)
    -
    324  dest[i] = src[i];
    -
    325 }
    -
    326 
    -
    327 uint8_t HIDUniversal::Poll() {
    -
    328  uint8_t rcode = 0;
    -
    329 
    -
    330  if (!bPollEnable)
    -
    331  return 0;
    -
    332 
    -
    333  if (qNextPollTime <= millis()) {
    -
    334  qNextPollTime = millis() + 50;
    -
    335 
    -
    336  uint8_t buf[constBuffLen];
    -
    337 
    -
    338  for (uint8_t i = 0; i < bNumIface; i++) {
    -
    339  uint8_t index = hidInterfaces[i].epIndex[epInterruptInIndex];
    -
    340  uint16_t read = (uint16_t)epInfo[index].maxPktSize;
    +
    324  if (buf1[i] != buf2[i])
    +
    325  return false;
    +
    326  return true;
    +
    327 }
    +
    328 
    +
    329 void HIDUniversal::ZeroMemory(uint8_t len, uint8_t *buf) {
    +
    330  for (uint8_t i = 0; i < len; i++)
    +
    331  buf[i] = 0;
    +
    332 }
    +
    333 
    +
    334 void HIDUniversal::SaveBuffer(uint8_t len, uint8_t *src, uint8_t *dest) {
    +
    335  for (uint8_t i = 0; i < len; i++)
    +
    336  dest[i] = src[i];
    +
    337 }
    +
    338 
    +
    339 uint8_t HIDUniversal::Poll() {
    +
    340  uint8_t rcode = 0;
    341 
    -
    342  ZeroMemory(constBuffLen, buf);
    -
    343 
    -
    344  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[index].epAddr, &read, buf);
    -
    345 
    -
    346  if (rcode) {
    -
    347  if (rcode != hrNAK)
    -
    348  USBTRACE2("Poll:", rcode);
    -
    349  return rcode;
    -
    350  }
    -
    351 
    -
    352  if (read > constBuffLen)
    -
    353  read = constBuffLen;
    -
    354 
    -
    355  bool identical = BuffersIdentical(read, buf, prevBuf);
    -
    356 
    -
    357  SaveBuffer(read, buf, prevBuf);
    -
    358 
    -
    359  if (identical)
    -
    360  return 0;
    -
    361 
    -
    362  Notify(PSTR("\r\nBuf: "), 0x80);
    +
    342  if (!bPollEnable)
    +
    343  return 0;
    +
    344 
    +
    345  if (qNextPollTime <= millis()) {
    +
    346  qNextPollTime = millis() + 50;
    +
    347 
    +
    348  uint8_t buf[constBuffLen];
    +
    349 
    +
    350  for (uint8_t i = 0; i < bNumIface; i++) {
    +
    351  uint8_t index = hidInterfaces[i].epIndex[epInterruptInIndex];
    +
    352  uint16_t read = (uint16_t)epInfo[index].maxPktSize;
    +
    353 
    +
    354  ZeroMemory(constBuffLen, buf);
    +
    355 
    +
    356  uint8_t rcode = pUsb->inTransfer(bAddress, epInfo[index].epAddr, &read, buf);
    +
    357 
    +
    358  if (rcode) {
    +
    359  if (rcode != hrNAK)
    +
    360  USBTRACE2("Poll:", rcode);
    +
    361  return rcode;
    +
    362  }
    363 
    -
    364  for (uint8_t i = 0; i < read; i++)
    -
    365  PrintHex<uint8_t > (buf[i], 0x80);
    +
    364  if (read > constBuffLen)
    +
    365  read = constBuffLen;
    366 
    -
    367  Notify(PSTR("\r\n"), 0x80);
    +
    367  bool identical = BuffersIdentical(read, buf, prevBuf);
    368 
    -
    369  HIDReportParser *prs = GetReportParser(((bHasReportId) ? *buf : 0));
    +
    369  SaveBuffer(read, buf, prevBuf);
    370 
    -
    371  if (prs)
    -
    372  prs->Parse(this, bHasReportId, (uint8_t)read, buf);
    -
    373  }
    -
    374  }
    -
    375  return rcode;
    -
    376 }
    +
    371  if (identical)
    +
    372  return 0;
    +
    373 
    +
    374  Notify(PSTR("\r\nBuf: "), 0x80);
    +
    375 
    +
    376  for (uint8_t i = 0; i < read; i++)
    +
    377  PrintHex<uint8_t > (buf[i], 0x80);
    +
    378 
    +
    379  Notify(PSTR("\r\n"), 0x80);
    +
    380 
    +
    381  HIDReportParser *prs = GetReportParser(((bHasReportId) ? *buf : 0));
    +
    382 
    +
    383  if (prs)
    +
    384  prs->Parse(this, bHasReportId, (uint8_t)read, buf);
    +
    385  }
    +
    386  }
    +
    387  return rcode;
    +
    388 }
    diff --git a/hiduniversal_8h.html b/hiduniversal_8h.html index 90fbcded..e4b2b85b 100644 --- a/hiduniversal_8h.html +++ b/hiduniversal_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hiduniversal.h File Reference @@ -31,7 +31,7 @@ - + @@ -97,7 +97,7 @@ Include dependency graph for hiduniversal.h:
    - +
    This graph shows which files directly or indirectly include this file:
    @@ -119,7 +119,7 @@ Classes diff --git a/hiduniversal_8h__incl.map b/hiduniversal_8h__incl.map index 048721e1..62e30b93 100644 --- a/hiduniversal_8h__incl.map +++ b/hiduniversal_8h__incl.map @@ -1,15 +1,15 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/hiduniversal_8h__incl.md5 b/hiduniversal_8h__incl.md5 index b487fa4d..0b62dd27 100644 --- a/hiduniversal_8h__incl.md5 +++ b/hiduniversal_8h__incl.md5 @@ -1 +1 @@ -8d889e926e7cf5c5c4713492db83706f \ No newline at end of file +06c1135526829bb5b63305c7ce6678b6 \ No newline at end of file diff --git a/hiduniversal_8h__incl.png b/hiduniversal_8h__incl.png index 60079fe0..c3c3f48b 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 afee0f24..20dc1a49 100644 --- a/hiduniversal_8h_source.html +++ b/hiduniversal_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hiduniversal.h Source File @@ -31,7 +31,7 @@
    - + @@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidusagestr_8h.html b/hidusagestr_8h.html index 66cce892..064e8cad 100644 --- a/hidusagestr_8h.html +++ b/hidusagestr_8h.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidusagestr.h File Reference @@ -31,7 +31,7 @@ - + @@ -96,6 +96,8 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); Include dependency graph for hidusagestr.h:
    + +
    This graph shows which files directly or indirectly include this file:
    @@ -13860,7 +13862,7 @@ Variables diff --git a/hidusagestr_8h_source.html b/hidusagestr_8h_source.html index af3faad6..13ea1441 100644 --- a/hidusagestr_8h_source.html +++ b/hidusagestr_8h_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidusagestr.h Source File @@ -31,7 +31,7 @@
    - + @@ -1071,7 +1071,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hidusagetitlearrays_8cpp.html b/hidusagetitlearrays_8cpp.html index 0e8e1197..7c9984aa 100644 --- a/hidusagetitlearrays_8cpp.html +++ b/hidusagetitlearrays_8cpp.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidusagetitlearrays.cpp File Reference @@ -31,7 +31,7 @@ - + @@ -128,7 +128,7 @@ Macros diff --git a/hidusagetitlearrays_8cpp_source.html b/hidusagetitlearrays_8cpp_source.html index 493f940d..bb802e3c 100644 --- a/hidusagetitlearrays_8cpp_source.html +++ b/hidusagetitlearrays_8cpp_source.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: hidusagetitlearrays.cpp Source File @@ -31,7 +31,7 @@ - + @@ -1141,7 +1141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/hierarchy.html b/hierarchy.html index 22f8fbbe..4b58d4e4 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Class Hierarchy @@ -31,7 +31,7 @@ - + @@ -181,7 +181,7 @@ This inheritance list is sorted roughly, but not completely, alphabetically: diff --git a/index.html b/index.html index b1a30bb4..4966876c 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + USB Host Shield 2.0: Main Page @@ -31,7 +31,7 @@ - + @@ -92,19 +92,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');

    For more information about the hardware see the Hardware Manual.

    Developed By