diff --git a/Doxyfile b/Doxyfile index 48e2a8ac..555427ad 100644 --- a/Doxyfile +++ b/Doxyfile @@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8 # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. -PROJECT_NAME = USB_Host_Shield_2.0 +PROJECT_NAME = "USB Host Shield 2.0" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or @@ -485,7 +485,7 @@ INLINE_INFO = YES # alphabetically by member name. If set to NO the members will appear in # declaration order. -SORT_MEMBER_DOCS = YES +SORT_MEMBER_DOCS = NO # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically @@ -756,7 +756,7 @@ EXCLUDE_SYMLINKS = NO # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = XBOXUSB.* +EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -1007,7 +1007,7 @@ HTML_COLORSTYLE_GAMMA = 80 # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. -HTML_TIMESTAMP = YES +HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the diff --git a/_b_t_d_8cpp.html b/_b_t_d_8cpp.html index 0456951a..d4303aea 100644 --- a/_b_t_d_8cpp.html +++ b/_b_t_d_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: BTD.cpp File Reference +USB Host Shield 2.0: BTD.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -125,7 +125,7 @@ Macros
diff --git a/_b_t_d_8cpp_source.html b/_b_t_d_8cpp_source.html index 4650eba5..b03f5ba4 100644 --- a/_b_t_d_8cpp_source.html +++ b/_b_t_d_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: BTD.cpp Source File +USB Host Shield 2.0: BTD.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -1275,7 +1275,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/_b_t_d_8h.html b/_b_t_d_8h.html index 842a8c8f..bac1f886 100644 --- a/_b_t_d_8h.html +++ b/_b_t_d_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: BTD.h File Reference +USB Host Shield 2.0: BTD.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -288,6 +288,76 @@ Macros  

Macro Definition Documentation

+ +
+
+ + + + +
#define PS3_VID   0x054C
+
+ +

Definition at line 25 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define PS3_PID   0x0268
+
+ +

Definition at line 26 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define PS3NAVIGATION_PID   0x042F
+
+ +

Definition at line 27 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define PS3MOVE_PID   0x03D5
+
+ +

Definition at line 28 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define BULK_MAXPKTSIZE   64
+
+ +

Definition at line 31 of file BTD.h.

+ +
+
@@ -316,353 +386,45 @@ Macros
- +
- +
#define BTD_MAX_ENDPOINTS   4#define HID_REQUEST_SET_REPORT   0x09
-

Definition at line 130 of file BTD.h.

+

Definition at line 37 of file BTD.h.

- +
- +
#define BTD_NUMSERVICES   4#define HCI_INIT_STATE   0
-

Definition at line 131 of file BTD.h.

+

Definition at line 40 of file BTD.h.

- +
- +
#define BULK_MAXPKTSIZE   64#define HCI_RESET_STATE   1
-

Definition at line 31 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_AUTHENTICATION_COMPLETE   0x06
-
- -

Definition at line 87 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_CHANGE_CONNECTION_LINK   0x09
-
- -

Definition at line 90 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_COMMAND_COMPLETE   0x0E
-
- -

Definition at line 100 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_COMMAND_STATUS   0x0F
-
- -

Definition at line 101 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_CONNECT_COMPLETE   0x03
-
- -

Definition at line 84 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_DATA_BUFFER_OVERFLOW   0x1A
-
- -

Definition at line 96 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_DISCONNECT_COMPLETE   0x05
-
- -

Definition at line 86 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_ENCRYPTION_CHANGE   0x08
-
- -

Definition at line 89 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_INCOMING_CONNECT   0x04
-
- -

Definition at line 85 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_INQUIRY_COMPLETE   0x01
-
- -

Definition at line 82 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_INQUIRY_RESULT   0x02
-
- -

Definition at line 83 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_LINK_KEY_NOTIFICATION   0x18
-
- -

Definition at line 95 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_LINK_KEY_REQUEST   0x17
-
- -

Definition at line 94 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_LOOPBACK_COMMAND   0x19
-
- -

Definition at line 102 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_MAX_SLOTS_CHANGE   0x1B
-
- -

Definition at line 97 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_NUM_COMPLETE_PKT   0x13
-
- -

Definition at line 92 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_PAGE_SCAN_REP_MODE   0x20
-
- -

Definition at line 103 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_PIN_CODE_REQUEST   0x16
-
- -

Definition at line 93 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_QOS_SETUP_COMPLETE   0x0D
-
- -

Definition at line 99 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE   0x0C
-
- -

Definition at line 98 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_REMOTE_NAME_COMPLETE   0x07
-
- -

Definition at line 88 of file BTD.h.

- -
-
- -
-
- - - - -
#define EV_ROLE_CHANGED   0x12
-
- -

Definition at line 91 of file BTD.h.

+

Definition at line 41 of file BTD.h.

@@ -678,6 +440,34 @@ Macros

Definition at line 42 of file BTD.h.

+
+ + +
+
+ + + + +
#define HCI_LOCAL_VERSION_STATE   3
+
+ +

Definition at line 43 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define HCI_SET_NAME_STATE   4
+
+ +

Definition at line 44 of file BTD.h.

+
@@ -694,59 +484,17 @@ Macros - +
- +
#define hci_cmd_complete   (hci_event_flag & HCI_FLAG_CMD_COMPLETE)#define HCI_INQUIRY_STATE   6
-

Definition at line 71 of file BTD.h.

- -
-
- -
-
- - - - -
#define hci_connect_complete   (hci_event_flag & HCI_FLAG_CONN_COMPLETE)
-
- -

Definition at line 72 of file BTD.h.

- -
-
- -
-
- - - - -
#define hci_connect_event   (hci_event_flag & HCI_FLAG_CONNECT_EVENT)
-
- -

Definition at line 79 of file BTD.h.

- -
-
- -
-
- - - - -
#define HCI_CONNECT_IN_STATE   10
-
- -

Definition at line 52 of file BTD.h.

+

Definition at line 47 of file BTD.h.

@@ -762,20 +510,6 @@ Macros

Definition at line 48 of file BTD.h.

- - - -
-
- - - - -
#define HCI_CONNECTED_STATE   12
-
- -

Definition at line 54 of file BTD.h.

-
@@ -790,6 +524,62 @@ Macros

Definition at line 49 of file BTD.h.

+ + + +
+
+ + + + +
#define HCI_SCANNING_STATE   9
+
+ +

Definition at line 51 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define HCI_CONNECT_IN_STATE   10
+
+ +

Definition at line 52 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define HCI_REMOTE_NAME_STATE   11
+
+ +

Definition at line 53 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define HCI_CONNECTED_STATE   12
+
+ +

Definition at line 54 of file BTD.h.

+
@@ -806,17 +596,17 @@ Macros - +
- +
#define hci_disconnect_complete   (hci_event_flag & HCI_FLAG_DISCONN_COMPLETE)#define HCI_DONE_STATE   14
-

Definition at line 73 of file BTD.h.

+

Definition at line 56 of file BTD.h.

@@ -832,20 +622,6 @@ Macros

Definition at line 57 of file BTD.h.

- - - -
-
- - - - -
#define HCI_DONE_STATE   14
-
- -

Definition at line 56 of file BTD.h.

-
@@ -874,20 +650,6 @@ Macros

Definition at line 61 of file BTD.h.

- - - -
-
- - - - -
#define HCI_FLAG_CONNECT_EVENT   0x100
-
- -

Definition at line 68 of file BTD.h.

-
@@ -902,6 +664,20 @@ Macros

Definition at line 62 of file BTD.h.

+ + + +
+
+ + + + +
#define HCI_FLAG_REMOTE_NAME_COMPLETE   0x08
+
+ +

Definition at line 63 of file BTD.h.

+
@@ -944,20 +720,6 @@ Macros

Definition at line 66 of file BTD.h.

- - - -
-
- - - - -
#define HCI_FLAG_REMOTE_NAME_COMPLETE   0x08
-
- -

Definition at line 63 of file BTD.h.

-
@@ -972,6 +734,76 @@ Macros

Definition at line 67 of file BTD.h.

+ + + +
+
+ + + + +
#define HCI_FLAG_CONNECT_EVENT   0x100
+
+ +

Definition at line 68 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define hci_cmd_complete   (hci_event_flag & HCI_FLAG_CMD_COMPLETE)
+
+ +

Definition at line 71 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define hci_connect_complete   (hci_event_flag & HCI_FLAG_CONN_COMPLETE)
+
+ +

Definition at line 72 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define hci_disconnect_complete   (hci_event_flag & HCI_FLAG_DISCONN_COMPLETE)
+
+ +

Definition at line 73 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define hci_remote_name_complete   (hci_event_flag & HCI_FLAG_REMOTE_NAME_COMPLETE)
+
+ +

Definition at line 74 of file BTD.h.

+
@@ -986,48 +818,6 @@ Macros

Definition at line 75 of file BTD.h.

- - - -
-
- - - - -
#define HCI_INIT_STATE   0
-
- -

Definition at line 40 of file BTD.h.

- -
-
- -
-
- - - - -
#define HCI_INQUIRY_STATE   6
-
- -

Definition at line 47 of file BTD.h.

- -
-
- -
-
- - - - -
#define HCI_LOCAL_VERSION_STATE   3
-
- -

Definition at line 43 of file BTD.h.

-
@@ -1056,76 +846,6 @@ Macros

Definition at line 77 of file BTD.h.

- - - -
-
- - - - -
#define hci_remote_name_complete   (hci_event_flag & HCI_FLAG_REMOTE_NAME_COMPLETE)
-
- -

Definition at line 74 of file BTD.h.

- -
-
- -
-
- - - - -
#define HCI_REMOTE_NAME_STATE   11
-
- -

Definition at line 53 of file BTD.h.

- -
-
- -
-
- - - - -
#define HCI_RESET_STATE   1
-
- -

Definition at line 41 of file BTD.h.

- -
-
- -
-
- - - - -
#define HCI_SCANNING_STATE   9
-
- -

Definition at line 51 of file BTD.h.

- -
-
- -
-
- - - - -
#define HCI_SET_NAME_STATE   4
-
- -

Definition at line 44 of file BTD.h.

-
@@ -1142,45 +862,325 @@ Macros - +
- +
#define HID_CTRL_PSM   0x11#define hci_connect_event   (hci_event_flag & HCI_FLAG_CONNECT_EVENT)
-

Definition at line 123 of file BTD.h.

+

Definition at line 79 of file BTD.h.

- +
- +
#define HID_INTR_PSM   0x13#define EV_INQUIRY_COMPLETE   0x01
-

Definition at line 124 of file BTD.h.

+

Definition at line 82 of file BTD.h.

- +
- +
#define HID_REQUEST_SET_REPORT   0x09#define EV_INQUIRY_RESULT   0x02
-

Definition at line 37 of file BTD.h.

+

Definition at line 83 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_CONNECT_COMPLETE   0x03
+
+ +

Definition at line 84 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_INCOMING_CONNECT   0x04
+
+ +

Definition at line 85 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_DISCONNECT_COMPLETE   0x05
+
+ +

Definition at line 86 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_AUTHENTICATION_COMPLETE   0x06
+
+ +

Definition at line 87 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_REMOTE_NAME_COMPLETE   0x07
+
+ +

Definition at line 88 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_ENCRYPTION_CHANGE   0x08
+
+ +

Definition at line 89 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_CHANGE_CONNECTION_LINK   0x09
+
+ +

Definition at line 90 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_ROLE_CHANGED   0x12
+
+ +

Definition at line 91 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_NUM_COMPLETE_PKT   0x13
+
+ +

Definition at line 92 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_PIN_CODE_REQUEST   0x16
+
+ +

Definition at line 93 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_LINK_KEY_REQUEST   0x17
+
+ +

Definition at line 94 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_LINK_KEY_NOTIFICATION   0x18
+
+ +

Definition at line 95 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_DATA_BUFFER_OVERFLOW   0x1A
+
+ +

Definition at line 96 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_MAX_SLOTS_CHANGE   0x1B
+
+ +

Definition at line 97 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE   0x0C
+
+ +

Definition at line 98 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_QOS_SETUP_COMPLETE   0x0D
+
+ +

Definition at line 99 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_COMMAND_COMPLETE   0x0E
+
+ +

Definition at line 100 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_COMMAND_STATUS   0x0F
+
+ +

Definition at line 101 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_LOOPBACK_COMMAND   0x19
+
+ +

Definition at line 102 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define EV_PAGE_SCAN_REP_MODE   0x20
+
+ +

Definition at line 103 of file BTD.h.

@@ -1196,34 +1196,6 @@ Macros

Definition at line 106 of file BTD.h.

- - - -
-
- - - - -
#define L2CAP_CMD_CONFIG_REQUEST   0x04
-
- -

Definition at line 109 of file BTD.h.

- -
-
- -
-
- - - - -
#define L2CAP_CMD_CONFIG_RESPONSE   0x05
-
- -

Definition at line 110 of file BTD.h.

-
@@ -1252,6 +1224,34 @@ Macros

Definition at line 108 of file BTD.h.

+ + + +
+
+ + + + +
#define L2CAP_CMD_CONFIG_REQUEST   0x04
+
+ +

Definition at line 109 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_CMD_CONFIG_RESPONSE   0x05
+
+ +

Definition at line 110 of file BTD.h.

+
@@ -1324,73 +1324,17 @@ Macros - +
- +
#define PS3_PID   0x0268#define SUCCESSFUL   0x00
-

Definition at line 26 of file BTD.h.

- -
-
- -
-
- - - - -
#define PS3_VID   0x054C
-
- -

Definition at line 25 of file BTD.h.

- -
-
- -
-
- - - - -
#define PS3MOVE_PID   0x03D5
-
- -

Definition at line 28 of file BTD.h.

- -
-
- -
-
- - - - -
#define PS3NAVIGATION_PID   0x042F
-
- -

Definition at line 27 of file BTD.h.

- -
-
- -
-
- - - - -
#define RFCOMM_PSM   0x03
-
- -

Definition at line 122 of file BTD.h.

+

Definition at line 118 of file BTD.h.

@@ -1408,31 +1352,45 @@ Macros - +
- +
#define SUCCESSFUL   0x00#define RFCOMM_PSM   0x03
-

Definition at line 118 of file BTD.h.

+

Definition at line 122 of file BTD.h.

- +
- +
#define WI_PROTOCOL_BT   0x01#define HID_CTRL_PSM   0x11
-

Definition at line 128 of file BTD.h.

+

Definition at line 123 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define HID_INTR_PSM   0x13
+
+ +

Definition at line 124 of file BTD.h.

@@ -1448,12 +1406,54 @@ Macros

Definition at line 127 of file BTD.h.

+ + + +
+
+ + + + +
#define WI_PROTOCOL_BT   0x01
+
+ +

Definition at line 128 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define BTD_MAX_ENDPOINTS   4
+
+ +

Definition at line 130 of file BTD.h.

+ +
+
+ +
+
+ + + + +
#define BTD_NUMSERVICES   4
+
+ +

Definition at line 131 of file BTD.h.

+
diff --git a/_b_t_d_8h_source.html b/_b_t_d_8h_source.html index fef62e02..85db0418 100644 --- a/_b_t_d_8h_source.html +++ b/_b_t_d_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: BTD.h Source File +USB Host Shield 2.0: BTD.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -297,54 +297,56 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
378  bool pairWithWii;
380  bool motionPlusInside;
382  bool wiiUProController;
-
383 
-
384 protected:
-
386  USB *pUsb;
-
388  uint8_t bAddress;
-
390  EpInfo epInfo[BTD_MAX_ENDPOINTS];
-
391 
-
393  uint8_t bConfNum;
-
395  uint8_t bNumEP;
-
397  uint32_t qNextPollTime;
-
398 
-
400  static const uint8_t BTD_CONTROL_PIPE;
-
402  static const uint8_t BTD_EVENT_PIPE;
-
404  static const uint8_t BTD_DATAIN_PIPE;
-
406  static const uint8_t BTD_DATAOUT_PIPE;
-
407 
-
412  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
+
383 
+
388  uint8_t readPollInterval() { return pollInterval; };
+
389 
+
390 protected:
+
392  USB *pUsb;
+
394  uint8_t bAddress;
+
396  EpInfo epInfo[BTD_MAX_ENDPOINTS];
+
397 
+
399  uint8_t bConfNum;
+
401  uint8_t bNumEP;
+
403  uint32_t qNextPollTime;
+
404 
+
406  static const uint8_t BTD_CONTROL_PIPE;
+
408  static const uint8_t BTD_EVENT_PIPE;
+
410  static const uint8_t BTD_DATAIN_PIPE;
+
412  static const uint8_t BTD_DATAOUT_PIPE;
413 
-
414 private:
-
415  BluetoothService* btService[BTD_NUMSERVICES];
-
416 
-
417  bool bPollEnable;
-
418  uint8_t pollInterval;
+
418  void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
419 
-
420  /* Variables used by high level HCI task */
-
421  uint8_t hci_state; //current state of bluetooth hci connection
-
422  uint16_t hci_counter; // counter used for bluetooth hci reset loops
-
423  uint8_t hci_num_reset_loops; // this value indicate how many times it should read before trying to reset
-
424  uint16_t hci_event_flag; // hci flags of received bluetooth events
-
425  uint8_t inquiry_counter;
-
426 
-
427  uint8_t hcibuf[BULK_MAXPKTSIZE];//General purpose buffer for hci data
-
428  uint8_t l2capinbuf[BULK_MAXPKTSIZE];//General purpose buffer for l2cap in data
-
429  uint8_t l2capoutbuf[BULK_MAXPKTSIZE];//General purpose buffer for l2cap out data
-
430 
-
431  /* State machines */
-
432  void HCI_event_task(); // Poll the HCI event pipe
-
433  void HCI_task(); // HCI state machine
-
434  void ACL_event_task(); // ACL input pipe
-
435 
-
436  /* Used to set the Bluetooth Address internally to the PS3 Controllers */
-
437  void setBdaddr(uint8_t* BDADDR);
-
438  void setMoveBdaddr(uint8_t* BDADDR);
-
439 };
-
440 #endif
+
420 private:
+
421  BluetoothService* btService[BTD_NUMSERVICES];
+
422 
+
423  bool bPollEnable;
+
424  uint8_t pollInterval;
+
425 
+
426  /* Variables used by high level HCI task */
+
427  uint8_t hci_state; //current state of bluetooth hci connection
+
428  uint16_t hci_counter; // counter used for bluetooth hci reset loops
+
429  uint8_t hci_num_reset_loops; // this value indicate how many times it should read before trying to reset
+
430  uint16_t hci_event_flag; // hci flags of received bluetooth events
+
431  uint8_t inquiry_counter;
+
432 
+
433  uint8_t hcibuf[BULK_MAXPKTSIZE];//General purpose buffer for hci data
+
434  uint8_t l2capinbuf[BULK_MAXPKTSIZE];//General purpose buffer for l2cap in data
+
435  uint8_t l2capoutbuf[BULK_MAXPKTSIZE];//General purpose buffer for l2cap out data
+
436 
+
437  /* State machines */
+
438  void HCI_event_task(); // Poll the HCI event pipe
+
439  void HCI_task(); // HCI state machine
+
440  void ACL_event_task(); // ACL input pipe
+
441 
+
442  /* Used to set the Bluetooth Address internally to the PS3 Controllers */
+
443  void setBdaddr(uint8_t* BDADDR);
+
444  void setMoveBdaddr(uint8_t* BDADDR);
+
445 };
+
446 #endif
diff --git a/_p_s3_b_t_8cpp.html b/_p_s3_b_t_8cpp.html index dd74955e..fdf05f16 100644 --- a/_p_s3_b_t_8cpp.html +++ b/_p_s3_b_t_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3BT.cpp File Reference +USB Host Shield 2.0: PS3BT.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -158,7 +158,7 @@ OUTPUT_REPORT_BUFFER[]  diff --git a/_p_s3_b_t_8cpp_source.html b/_p_s3_b_t_8cpp_source.html index 20cd3eeb..7ddb0787 100644 --- a/_p_s3_b_t_8cpp_source.html +++ b/_p_s3_b_t_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3BT.cpp Source File +USB Host Shield 2.0: PS3BT.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -749,7 +749,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 6e078992..969e21e4 100644 --- a/_p_s3_b_t_8h.html +++ b/_p_s3_b_t_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3BT.h File Reference +USB Host Shield 2.0: PS3BT.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -192,101 +192,31 @@ Macros
- +
- +
#define l2cap_config_request_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_CONTROL_REQUEST)#define OUTPUT_REPORT_BUFFER_SIZE   48
-

Definition at line 52 of file PS3BT.h.

+

Definition at line 25 of file PS3BT.h.

- +
- +
#define l2cap_config_request_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_INTERRUPT_REQUEST)#define L2CAP_WAIT   0
-

Definition at line 55 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define l2cap_config_success_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)
-
- -

Definition at line 53 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define l2cap_config_success_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)
-
- -

Definition at line 56 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define l2cap_connection_request_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)
-
- -

Definition at line 51 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define l2cap_connection_request_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)
-
- -

Definition at line 54 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define L2CAP_CONTROL_DISCONNECT   10
-
- -

Definition at line 38 of file PS3BT.h.

+

Definition at line 28 of file PS3BT.h.

@@ -318,157 +248,45 @@ Macros - +
- +
#define l2cap_disconnect_response_control_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)#define L2CAP_INTERRUPT_SETUP   3
-

Definition at line 57 of file PS3BT.h.

+

Definition at line 31 of file PS3BT.h.

- +
- +
#define l2cap_disconnect_response_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE)#define L2CAP_INTERRUPT_REQUEST   4
-

Definition at line 58 of file PS3BT.h.

+

Definition at line 32 of file PS3BT.h.

- +
- +
#define L2CAP_DONE   8#define L2CAP_INTERRUPT_SUCCESS   5
-

Definition at line 36 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONFIG_CONTROL_REQUEST   0x02
-
- -

Definition at line 42 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS   0x04
-
- -

Definition at line 43 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONFIG_INTERRUPT_REQUEST   0x10
-
- -

Definition at line 45 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS   0x20
-
- -

Definition at line 46 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST   0x01
-
- -

Definition at line 41 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST   0x08
-
- -

Definition at line 44 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE   0x40
-
- -

Definition at line 47 of file PS3BT.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE   0x80
-
- -

Definition at line 48 of file PS3BT.h.

+

Definition at line 33 of file PS3BT.h.

@@ -498,6 +316,20 @@ Macros

Definition at line 35 of file PS3BT.h.

+ + + +
+
+ + + + +
#define L2CAP_DONE   8
+
+ +

Definition at line 36 of file PS3BT.h.

+
@@ -514,80 +346,248 @@ Macros - +
- +
#define L2CAP_INTERRUPT_REQUEST   4#define L2CAP_CONTROL_DISCONNECT   10
-

Definition at line 32 of file PS3BT.h.

+

Definition at line 38 of file PS3BT.h.

- +
- +
#define L2CAP_INTERRUPT_SETUP   3#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST   0x01
-

Definition at line 31 of file PS3BT.h.

+

Definition at line 41 of file PS3BT.h.

- +
- +
#define L2CAP_INTERRUPT_SUCCESS   5#define L2CAP_FLAG_CONFIG_CONTROL_REQUEST   0x02
-

Definition at line 33 of file PS3BT.h.

+

Definition at line 42 of file PS3BT.h.

- +
- +
#define L2CAP_WAIT   0#define L2CAP_FLAG_CONFIG_CONTROL_SUCCESS   0x04
-

Definition at line 28 of file PS3BT.h.

+

Definition at line 43 of file PS3BT.h.

- +
- +
#define OUTPUT_REPORT_BUFFER_SIZE   48#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST   0x08
-

Definition at line 25 of file PS3BT.h.

+

Definition at line 44 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_CONFIG_INTERRUPT_REQUEST   0x10
+
+ +

Definition at line 45 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS   0x20
+
+ +

Definition at line 46 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE   0x40
+
+ +

Definition at line 47 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE   0x80
+
+ +

Definition at line 48 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_connection_request_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)
+
+ +

Definition at line 51 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_config_request_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_CONTROL_REQUEST)
+
+ +

Definition at line 52 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_config_success_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)
+
+ +

Definition at line 53 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_connection_request_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)
+
+ +

Definition at line 54 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_config_request_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_INTERRUPT_REQUEST)
+
+ +

Definition at line 55 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_config_success_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)
+
+ +

Definition at line 56 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_disconnect_response_control_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)
+
+ +

Definition at line 57 of file PS3BT.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_disconnect_response_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE)
+
+ +

Definition at line 58 of file PS3BT.h.

diff --git a/_p_s3_b_t_8h_source.html b/_p_s3_b_t_8h_source.html index 70ddc3b5..a22a0cb2 100644 --- a/_p_s3_b_t_8h_source.html +++ b/_p_s3_b_t_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3BT.h Source File +USB Host Shield 2.0: PS3BT.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -156,76 +156,76 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
84  virtual void Run();
86  virtual void Reset();
88  virtual void disconnect();
-
98  bool getButtonPress(Button b);
-
99  bool getButtonClick(Button b);
-
110  uint8_t getAnalogButton(Button a);
-
116  uint8_t getAnalogHat(AnalogHat a);
-
125  int16_t getSensor(Sensor a);
-
131  double getAngle(Angle a);
-
137  double get9DOFValues(Sensor a);
-
143  bool getStatus(Status c);
-
148  String getStatusString();
-
153  String getTemperature();
-
154 
-
156  void setAllOff();
-
158  void setRumbleOff();
-
163  void setRumbleOn(Rumble mode);
-
168  void setLedOff(LED a);
-
173  void setLedOn(LED a);
-
178  void setLedToggle(LED a);
-
179 
-
184  void moveSetBulb(uint8_t r, uint8_t g, uint8_t b);
-
189  void moveSetBulb(Colors color);
-
194  void moveSetRumble(uint8_t rumble);
-
198  bool PS3Connected;
-
200  bool PS3MoveConnected;
-
202  bool PS3NavigationConnected;
-
203 
-
204 private:
-
205  /* mandatory members */
-
206  BTD *pBtd;
-
207 
-
208  void L2CAP_task(); // L2CAP state machine
+
100  bool getButtonPress(Button b);
+
101  bool getButtonClick(Button b);
+
112  uint8_t getAnalogButton(Button a);
+
118  uint8_t getAnalogHat(AnalogHat a);
+
127  int16_t getSensor(Sensor a);
+
133  double getAngle(Angle a);
+
139  double get9DOFValues(Sensor a);
+
145  bool getStatus(Status c);
+
150  String getStatusString();
+
155  String getTemperature();
+
156 
+
158  void setAllOff();
+
160  void setRumbleOff();
+
165  void setRumbleOn(Rumble mode);
+
170  void setLedOff(LED a);
+
175  void setLedOn(LED a);
+
180  void setLedToggle(LED a);
+
181 
+
186  void moveSetBulb(uint8_t r, uint8_t g, uint8_t b);
+
191  void moveSetBulb(Colors color);
+
196  void moveSetRumble(uint8_t rumble);
+
200  bool PS3Connected;
+
202  bool PS3MoveConnected;
+
204  bool PS3NavigationConnected;
+
205 
+
206 private:
+
207  /* mandatory members */
+
208  BTD *pBtd;
209 
-
210  /* Variables filled from HCI event management */
-
211  int16_t hci_handle;
-
212  uint8_t remote_name[30]; // First 30 chars of remote name
-
213  bool activeConnection; // Used to indicate if it's already has established a connection
-
214 
-
215  /* variables used by high level L2CAP task */
-
216  uint8_t l2cap_state;
-
217  uint16_t l2cap_event_flag; // L2CAP flags of received bluetooth events
-
218 
-
219  unsigned long timer;
+
210  void L2CAP_task(); // L2CAP state machine
+
211 
+
212  /* Variables filled from HCI event management */
+
213  int16_t hci_handle;
+
214  uint8_t remote_name[30]; // First 30 chars of remote name
+
215  bool activeConnection; // Used to indicate if it's already has established a connection
+
216 
+
217  /* variables used by high level L2CAP task */
+
218  uint8_t l2cap_state;
+
219  uint16_t l2cap_event_flag; // L2CAP flags of received bluetooth events
220 
-
221  uint32_t ButtonState;
-
222  uint32_t OldButtonState;
-
223  uint32_t ButtonClickState;
-
224 
-
225  uint32_t timerHID; // Timer used see if there has to be a delay before a new HID command
-
226  uint32_t timerBulbRumble;// used to continuously set PS3 Move controller Bulb and rumble values
-
227 
-
228  uint8_t l2capinbuf[BULK_MAXPKTSIZE]; // General purpose buffer for L2CAP in data
-
229  uint8_t HIDBuffer[HID_BUFFERSIZE]; // Used to store HID commands
-
230  uint8_t HIDMoveBuffer[HID_BUFFERSIZE]; // Used to store HID commands for the Move controller
-
231 
-
232  /* L2CAP Channels */
-
233  uint8_t control_scid[2]; // L2CAP source CID for HID_Control
-
234  uint8_t control_dcid[2]; // 0x0040
-
235  uint8_t interrupt_scid[2]; // L2CAP source CID for HID_Interrupt
-
236  uint8_t interrupt_dcid[2]; // 0x0041
-
237  uint8_t identifier; // Identifier for connection
-
238 
-
239  /* HID Commands */
-
240  void HID_Command(uint8_t* data, uint8_t nbytes);
-
241  void HIDMove_Command(uint8_t* data, uint8_t nbytes);
-
242  void enable_sixaxis(); // Command used to enable the Dualshock 3 and Navigation controller to send data via Bluetooth
-
243 };
-
244 #endif
+
221  unsigned long timer;
+
222 
+
223  uint32_t ButtonState;
+
224  uint32_t OldButtonState;
+
225  uint32_t ButtonClickState;
+
226 
+
227  uint32_t timerHID; // Timer used see if there has to be a delay before a new HID command
+
228  uint32_t timerBulbRumble;// used to continuously set PS3 Move controller Bulb and rumble values
+
229 
+
230  uint8_t l2capinbuf[BULK_MAXPKTSIZE]; // General purpose buffer for L2CAP in data
+
231  uint8_t HIDBuffer[HID_BUFFERSIZE]; // Used to store HID commands
+
232  uint8_t HIDMoveBuffer[HID_BUFFERSIZE]; // Used to store HID commands for the Move controller
+
233 
+
234  /* L2CAP Channels */
+
235  uint8_t control_scid[2]; // L2CAP source CID for HID_Control
+
236  uint8_t control_dcid[2]; // 0x0040
+
237  uint8_t interrupt_scid[2]; // L2CAP source CID for HID_Interrupt
+
238  uint8_t interrupt_dcid[2]; // 0x0041
+
239  uint8_t identifier; // Identifier for connection
+
240 
+
241  /* HID Commands */
+
242  void HID_Command(uint8_t* data, uint8_t nbytes);
+
243  void HIDMove_Command(uint8_t* data, uint8_t nbytes);
+
244  void enable_sixaxis(); // Command used to enable the Dualshock 3 and Navigation controller to send data via Bluetooth
+
245 };
+
246 #endif
diff --git a/_p_s3_enums_8h.html b/_p_s3_enums_8h.html index e3ee5477..abef67d3 100644 --- a/_p_s3_enums_8h.html +++ b/_p_s3_enums_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3Enums.h File Reference +USB Host Shield 2.0: PS3Enums.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -189,27 +189,6 @@ Variables  

Enumeration Type Documentation

- -
-
- - - - -
enum Angle
-
-

Used to get the angle calculated using the accelerometer.

- - - -
Enumerator
Pitch  -
Roll  -
- -

Definition at line 157 of file PS3Enums.h.

- -
-
@@ -249,26 +228,6 @@ Variables

Definition at line 96 of file PS3Enums.h.

-
-
- -
-
- - - - -
enum Rumble
-
- - - -
Enumerator
RumbleHigh  -
RumbleLow  -
- -

Definition at line 188 of file PS3Enums.h.

-
@@ -329,6 +288,27 @@ Variables

Definition at line 122 of file PS3Enums.h.

+
+ + +
+
+ + + + +
enum Angle
+
+

Used to get the angle calculated using the accelerometer.

+ + + +
Enumerator
Pitch  +
Roll  +
+ +

Definition at line 157 of file PS3Enums.h.

+
@@ -385,6 +365,26 @@ Variables

Definition at line 161 of file PS3Enums.h.

+ + + +
+
+ + + + +
enum Rumble
+
+ + + +
Enumerator
RumbleHigh  +
RumbleLow  +
+ +

Definition at line 188 of file PS3Enums.h.

+

Variable Documentation

@@ -423,7 +423,7 @@ Variables diff --git a/_p_s3_enums_8h_source.html b/_p_s3_enums_8h_source.html index 01afb439..c6a2b13c 100644 --- a/_p_s3_enums_8h_source.html +++ b/_p_s3_enums_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3Enums.h Source File +USB Host Shield 2.0: PS3Enums.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -245,7 +245,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 867f99f2..8639ff0f 100644 --- a/_p_s3_u_s_b_8cpp.html +++ b/_p_s3_u_s_b_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3USB.cpp File Reference +USB Host Shield 2.0: PS3USB.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -157,7 +157,7 @@ Variables
diff --git a/_p_s3_u_s_b_8cpp_source.html b/_p_s3_u_s_b_8cpp_source.html index 4b4f8e3b..cd45cb51 100644 --- a/_p_s3_u_s_b_8cpp_source.html +++ b/_p_s3_u_s_b_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3USB.cpp Source File +USB Host Shield 2.0: PS3USB.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -643,7 +643,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/_p_s3_u_s_b_8h.html b/_p_s3_u_s_b_8h.html index a2a1622f..80303573 100644 --- a/_p_s3_u_s_b_8h.html +++ b/_p_s3_u_s_b_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3USB.h File Reference +USB Host Shield 2.0: PS3USB.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -149,17 +149,17 @@ Macros  

Macro Definition Documentation

- +
- +
#define bmREQ_HID_OUT   USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE#define EP_MAXPKTSIZE   64
-

Definition at line 51 of file PS3USB.h.

+

Definition at line 31 of file PS3USB.h.

@@ -175,48 +175,6 @@ Macros

Definition at line 34 of file PS3USB.h.

-
- - -
-
- - - - -
#define EP_MAXPKTSIZE   64
-
- -

Definition at line 31 of file PS3USB.h.

- -
-
- -
-
- - - - -
#define HID_REQUEST_SET_REPORT   0x09
-
- -

Definition at line 52 of file PS3USB.h.

- -
-
- -
-
- - - - -
#define MOVE_REPORT_BUFFER_SIZE   7
-
- -

Definition at line 48 of file PS3USB.h.

-
@@ -231,34 +189,6 @@ Macros

Definition at line 37 of file PS3USB.h.

- - - -
-
- - - - -
#define PS3_INPUT_PIPE   2
-
- -

Definition at line 39 of file PS3USB.h.

- -
-
- -
-
- - - - -
#define PS3_MAX_ENDPOINTS   3
-
- -

Definition at line 54 of file PS3USB.h.

-
@@ -275,31 +205,17 @@ Macros - +
- +
#define PS3_PID   0x0268#define PS3_INPUT_PIPE   2
-

Definition at line 43 of file PS3USB.h.

- -
-
- -
-
- - - - -
#define PS3_REPORT_BUFFER_SIZE   48
-
- -

Definition at line 47 of file PS3USB.h.

+

Definition at line 39 of file PS3USB.h.

@@ -317,17 +233,17 @@ Macros - +
- +
#define PS3MOVE_PID   0x03D5#define PS3_PID   0x0268
-

Definition at line 45 of file PS3USB.h.

+

Definition at line 43 of file PS3USB.h.

@@ -343,12 +259,96 @@ Macros

Definition at line 44 of file PS3USB.h.

+ + + +
+
+ + + + +
#define PS3MOVE_PID   0x03D5
+
+ +

Definition at line 45 of file PS3USB.h.

+ +
+
+ +
+
+ + + + +
#define PS3_REPORT_BUFFER_SIZE   48
+
+ +

Definition at line 47 of file PS3USB.h.

+ +
+
+ +
+
+ + + + +
#define MOVE_REPORT_BUFFER_SIZE   7
+
+ +

Definition at line 48 of file PS3USB.h.

+ +
+
+ +
+
+ + + + +
#define bmREQ_HID_OUT   USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
+
+ +

Definition at line 51 of file PS3USB.h.

+ +
+
+ +
+
+ + + + +
#define HID_REQUEST_SET_REPORT   0x09
+
+ +

Definition at line 52 of file PS3USB.h.

+ +
+
+ +
+
+ + + + +
#define PS3_MAX_ENDPOINTS   3
+
+ +

Definition at line 54 of file PS3USB.h.

+
diff --git a/_p_s3_u_s_b_8h_source.html b/_p_s3_u_s_b_8h_source.html index 4ca5f0af..18e0c91f 100644 --- a/_p_s3_u_s_b_8h_source.html +++ b/_p_s3_u_s_b_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: PS3USB.h Source File +USB Host Shield 2.0: PS3USB.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -156,60 +156,60 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
110  void setBdaddr(uint8_t* BDADDR);
115  void setMoveBdaddr(uint8_t* BDADDR);
116 
-
124  bool getButtonPress(Button b);
-
125  bool getButtonClick(Button b);
-
136  uint8_t getAnalogButton(Button a);
-
142  uint8_t getAnalogHat(AnalogHat a);
-
149  uint16_t getSensor(Sensor a);
-
155  double getAngle(Angle a);
-
161  bool getStatus(Status c);
-
166  String getStatusString();
-
167 
-
169  void setAllOff();
-
171  void setRumbleOff();
-
176  void setRumbleOn(Rumble mode);
-
181  void setLedOff(LED a);
-
186  void setLedOn(LED a);
-
191  void setLedToggle(LED a);
-
192 
-
197  void moveSetBulb(uint8_t r, uint8_t g, uint8_t b);
-
202  void moveSetBulb(Colors color);
-
207  void moveSetRumble(uint8_t rumble);
-
211  bool PS3Connected;
-
213  bool PS3MoveConnected;
-
215  bool PS3NavigationConnected;
-
216 
-
217 protected:
-
219  USB *pUsb;
-
221  uint8_t bAddress;
-
223  EpInfo epInfo[PS3_MAX_ENDPOINTS];
-
224 
-
225 private:
-
226  bool bPollEnable;
-
227 
-
228  uint32_t timer; // used to continuously set PS3 Move controller Bulb and rumble values
-
229 
-
230  uint32_t ButtonState;
-
231  uint32_t OldButtonState;
-
232  uint32_t ButtonClickState;
-
233 
-
234  uint8_t my_bdaddr[6]; // Change to your dongles Bluetooth address in the constructor
-
235  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
-
236  uint8_t writeBuf[EP_MAXPKTSIZE]; // General purpose buffer for output data
-
237 
-
238  void readReport(); // read incoming data
-
239  void printReport(); // print incoming date - Uncomment for debugging
-
240 
-
241  /* Private commands */
-
242  void PS3_Command(uint8_t* data, uint16_t nbytes);
-
243  void enable_sixaxis(); // Command used to enable the Dualshock 3 and Navigation controller to send data via USB
-
244  void Move_Command(uint8_t* data, uint16_t nbytes);
-
245 };
-
246 #endif
+
126  bool getButtonPress(Button b);
+
127  bool getButtonClick(Button b);
+
138  uint8_t getAnalogButton(Button a);
+
144  uint8_t getAnalogHat(AnalogHat a);
+
151  uint16_t getSensor(Sensor a);
+
157  double getAngle(Angle a);
+
163  bool getStatus(Status c);
+
168  String getStatusString();
+
169 
+
171  void setAllOff();
+
173  void setRumbleOff();
+
178  void setRumbleOn(Rumble mode);
+
183  void setLedOff(LED a);
+
188  void setLedOn(LED a);
+
193  void setLedToggle(LED a);
+
194 
+
199  void moveSetBulb(uint8_t r, uint8_t g, uint8_t b);
+
204  void moveSetBulb(Colors color);
+
209  void moveSetRumble(uint8_t rumble);
+
213  bool PS3Connected;
+
215  bool PS3MoveConnected;
+
217  bool PS3NavigationConnected;
+
218 
+
219 protected:
+
221  USB *pUsb;
+
223  uint8_t bAddress;
+
225  EpInfo epInfo[PS3_MAX_ENDPOINTS];
+
226 
+
227 private:
+
228  bool bPollEnable;
+
229 
+
230  uint32_t timer; // used to continuously set PS3 Move controller Bulb and rumble values
+
231 
+
232  uint32_t ButtonState;
+
233  uint32_t OldButtonState;
+
234  uint32_t ButtonClickState;
+
235 
+
236  uint8_t my_bdaddr[6]; // Change to your dongles Bluetooth address in the constructor
+
237  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
+
238  uint8_t writeBuf[EP_MAXPKTSIZE]; // General purpose buffer for output data
+
239 
+
240  void readReport(); // read incoming data
+
241  void printReport(); // print incoming date - Uncomment for debugging
+
242 
+
243  /* Private commands */
+
244  void PS3_Command(uint8_t* data, uint16_t nbytes);
+
245  void enable_sixaxis(); // Command used to enable the Dualshock 3 and Navigation controller to send data via USB
+
246  void Move_Command(uint8_t* data, uint16_t nbytes);
+
247 };
+
248 #endif
diff --git a/_r_e_a_d_m_e_8md.html b/_r_e_a_d_m_e_8md.html index 1948f536..bce5751e 100644 --- a/_r_e_a_d_m_e_8md.html +++ b/_r_e_a_d_m_e_8md.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: README.md File Reference +USB Host Shield 2.0: README.md File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -90,7 +90,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 8c4987dc..6dd8869e 100644 --- a/_r_e_a_d_m_e_8md_source.html +++ b/_r_e_a_d_m_e_8md_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: README.md Source File +USB Host Shield 2.0: README.md Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -174,7 +174,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
87 
88 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).
89 
-
90 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.
+
90 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.
91 
92 __Note that a Wireless controller can NOT be used via USB!__
93 
@@ -234,7 +234,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/_s_p_p_8cpp.html b/_s_p_p_8cpp.html index 130ca920..855f4d89 100644 --- a/_s_p_p_8cpp.html +++ b/_s_p_p_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: SPP.cpp File Reference +USB Host Shield 2.0: SPP.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -164,7 +164,7 @@ Variables
diff --git a/_s_p_p_8cpp_source.html b/_s_p_p_8cpp_source.html index fbfe14c2..b6c3747e 100644 --- a/_s_p_p_8cpp_source.html +++ b/_s_p_p_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: SPP.cpp Source File +USB Host Shield 2.0: SPP.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -1016,7 +1016,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/_s_p_p_8h.html b/_s_p_p_8h.html index cd37ed43..58b0a5ec 100644 --- a/_s_p_p_8h.html +++ b/_s_p_p_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: SPP.h File Reference +USB Host Shield 2.0: SPP.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -203,437 +203,17 @@ Macros  

Macro Definition Documentation

- +
- +
#define BT_RFCOMM_MSC_CMD   0xE3#define L2CAP_SDP_WAIT   0
-

Definition at line 76 of file SPP.h.

- -
-
- -
-
- - - - -
#define BT_RFCOMM_MSC_RSP   0xE1
-
- -

Definition at line 77 of file SPP.h.

- -
-
- -
-
- - - - -
#define BT_RFCOMM_PN_CMD   0x83
-
- -

Definition at line 74 of file SPP.h.

- -
-
- -
-
- - - - -
#define BT_RFCOMM_PN_RSP   0x81
-
- -

Definition at line 75 of file SPP.h.

- -
-
- -
-
- - - - -
#define BT_RFCOMM_RPN_CMD   0x93
-
- -

Definition at line 78 of file SPP.h.

- -
-
- -
-
- - - - -
#define BT_RFCOMM_RPN_RSP   0x91
-
- -

Definition at line 79 of file SPP.h.

- -
-
- -
-
- - - - -
#define extendAddress   0x01
-
- -

Definition at line 71 of file SPP.h.

- -
-
- -
-
- - - - -
#define l2cap_config_request_rfcomm_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_RFCOMM_REQUEST)
-
- -

Definition at line 51 of file SPP.h.

- -
-
- -
-
- - - - -
#define l2cap_config_request_sdp_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_SDP_REQUEST)
-
- -

Definition at line 50 of file SPP.h.

- -
-
- -
-
- - - - -
#define l2cap_config_success_rfcomm_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS)
-
- -

Definition at line 53 of file SPP.h.

- -
-
- -
-
- - - - -
#define l2cap_config_success_sdp_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_SDP_SUCCESS)
-
- -

Definition at line 52 of file SPP.h.

- -
-
- -
-
- - - - -
#define l2cap_connection_request_rfcomm_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST)
-
- -

Definition at line 49 of file SPP.h.

- -
-
- -
-
- - - - -
#define l2cap_connection_request_sdp_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_SDP_REQUEST)
-
- -

Definition at line 48 of file SPP.h.

- -
-
- -
-
- - - - -
#define l2cap_disconnect_request_rfcomm_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST)
-
- -

Definition at line 55 of file SPP.h.

- -
-
- -
-
- - - - -
#define l2cap_disconnect_request_sdp_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_SDP_REQUEST)
-
- -

Definition at line 54 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_DISCONNECT_RESPONSE   4
-
- -

Definition at line 28 of file SPP.h.

- -
-
- -
-
- - - - -
#define l2cap_disconnect_response_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_RESPONSE)
-
- -

Definition at line 56 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONFIG_RFCOMM_REQUEST   0x008
-
- -

Definition at line 40 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS   0x020
-
- -

Definition at line 42 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONFIG_SDP_REQUEST   0x004
-
- -

Definition at line 39 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONFIG_SDP_SUCCESS   0x010
-
- -

Definition at line 41 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST   0x002
-
- -

Definition at line 38 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONNECTION_SDP_REQUEST   0x001
-
- -

Definition at line 37 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_DISCONNECT_RESPONSE   0x100
-
- -

Definition at line 45 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST   0x080
-
- -

Definition at line 44 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_DISCONNECT_SDP_REQUEST   0x040
-
- -

Definition at line 43 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_RFCOMM_DONE   3
-
- -

Definition at line 34 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_RFCOMM_REQUEST   1
-
- -

Definition at line 32 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_RFCOMM_SUCCESS   2
-
- -

Definition at line 33 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_RFCOMM_WAIT   0
-
- -

Definition at line 31 of file SPP.h.

- -
-
- -
-
- - - - -
#define L2CAP_SDP_DONE   3
-
- -

Definition at line 27 of file SPP.h.

+

Definition at line 24 of file SPP.h.

@@ -665,87 +245,339 @@ Macros
- +
- +
#define L2CAP_SDP_WAIT   0#define L2CAP_SDP_DONE   3
-

Definition at line 24 of file SPP.h.

+

Definition at line 27 of file SPP.h.

- +
- +
#define L2CAP_UUID   0x0100#define L2CAP_DISCONNECT_RESPONSE   4
-

Definition at line 62 of file SPP.h.

+

Definition at line 28 of file SPP.h.

- +
- +
#define RFCOMM_DISC   0x43#define L2CAP_RFCOMM_WAIT   0
-

Definition at line 69 of file SPP.h.

+

Definition at line 31 of file SPP.h.

- +
- +
#define RFCOMM_SABM   0x2F#define L2CAP_RFCOMM_REQUEST   1
-

Definition at line 65 of file SPP.h.

+

Definition at line 32 of file SPP.h.

- +
- +
#define RFCOMM_UA   0x63#define L2CAP_RFCOMM_SUCCESS   2
-

Definition at line 66 of file SPP.h.

+

Definition at line 33 of file SPP.h.

- +
- +
#define RFCOMM_UIH   0xEF#define L2CAP_RFCOMM_DONE   3
-

Definition at line 67 of file SPP.h.

+

Definition at line 34 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_CONNECTION_SDP_REQUEST   0x001
+
+ +

Definition at line 37 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST   0x002
+
+ +

Definition at line 38 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_CONFIG_SDP_REQUEST   0x004
+
+ +

Definition at line 39 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_CONFIG_RFCOMM_REQUEST   0x008
+
+ +

Definition at line 40 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_CONFIG_SDP_SUCCESS   0x010
+
+ +

Definition at line 41 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS   0x020
+
+ +

Definition at line 42 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_DISCONNECT_SDP_REQUEST   0x040
+
+ +

Definition at line 43 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST   0x080
+
+ +

Definition at line 44 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_DISCONNECT_RESPONSE   0x100
+
+ +

Definition at line 45 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_connection_request_sdp_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_SDP_REQUEST)
+
+ +

Definition at line 48 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_connection_request_rfcomm_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_RFCOMM_REQUEST)
+
+ +

Definition at line 49 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_config_request_sdp_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_SDP_REQUEST)
+
+ +

Definition at line 50 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_config_request_rfcomm_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_RFCOMM_REQUEST)
+
+ +

Definition at line 51 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_config_success_sdp_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_SDP_SUCCESS)
+
+ +

Definition at line 52 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_config_success_rfcomm_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_RFCOMM_SUCCESS)
+
+ +

Definition at line 53 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_disconnect_request_sdp_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_SDP_REQUEST)
+
+ +

Definition at line 54 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_disconnect_request_rfcomm_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_RFCOMM_REQUEST)
+
+ +

Definition at line 55 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_disconnect_response_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_RESPONSE)
+
+ +

Definition at line 56 of file SPP.h.

@@ -789,12 +621,180 @@ Macros

Definition at line 61 of file SPP.h.

+ + + +
+
+ + + + +
#define L2CAP_UUID   0x0100
+
+ +

Definition at line 62 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define RFCOMM_SABM   0x2F
+
+ +

Definition at line 65 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define RFCOMM_UA   0x63
+
+ +

Definition at line 66 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define RFCOMM_UIH   0xEF
+
+ +

Definition at line 67 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define RFCOMM_DISC   0x43
+
+ +

Definition at line 69 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define extendAddress   0x01
+
+ +

Definition at line 71 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define BT_RFCOMM_PN_CMD   0x83
+
+ +

Definition at line 74 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define BT_RFCOMM_PN_RSP   0x81
+
+ +

Definition at line 75 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define BT_RFCOMM_MSC_CMD   0xE3
+
+ +

Definition at line 76 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define BT_RFCOMM_MSC_RSP   0xE1
+
+ +

Definition at line 77 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define BT_RFCOMM_RPN_CMD   0x93
+
+ +

Definition at line 78 of file SPP.h.

+ +
+
+ +
+
+ + + + +
#define BT_RFCOMM_RPN_RSP   0x91
+
+ +

Definition at line 79 of file SPP.h.

+
diff --git a/_s_p_p_8h_source.html b/_s_p_p_8h_source.html index 561f4836..7f5c10ff 100644 --- a/_s_p_p_8h_source.html +++ b/_s_p_p_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: SPP.h Source File +USB Host Shield 2.0: SPP.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -190,97 +190,97 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
114  virtual void disconnect();
118  bool connected;
119 
-
126  void print(const String &str);
-
131  void println(const String &str);
-
136  void print(const char* str);
-
141  void println(const char* str);
-
146  void print(uint8_t data);
-
151  void println(uint8_t data);
-
157  void print(uint8_t* array, uint8_t length);
-
163  void println(uint8_t* array, uint8_t length);
-
168  void print(const __FlashStringHelper *ifsh);
-
173  void println(const __FlashStringHelper *ifsh);
-
175  void println(void);
-
176 
-
181  void printNumber(int32_t n);
-
186  void printNumberln(int32_t n);
-
192  void printNumber(double n, uint8_t digits = 2);
-
198  void printNumberln(double n, uint8_t digits = 2);
-
199 
-
206  void doubleToString(double input, char* output, uint8_t digits = 2);
-
207 
-
212  uint8_t available() { return rfcommAvailable; };
-
217  uint8_t read();
-
219  void flush() { rfcommAvailable = 0; };
-
222 private:
-
223  /* Bluetooth dongle library pointer */
-
224  BTD *pBtd;
-
225 
-
226  /* Set true when a channel is created */
-
227  bool SDPConnected;
-
228  bool RFCOMMConnected;
-
229 
-
230  uint16_t hci_handle; // The HCI Handle for the connection
-
231 
-
232  /* Variables used by L2CAP state maschines */
-
233  uint8_t l2cap_sdp_state;
-
234  uint8_t l2cap_rfcomm_state;
-
235  uint16_t l2cap_event_flag; // l2cap flags of received bluetooth events
-
236 
-
237  uint8_t l2capoutbuf[BULK_MAXPKTSIZE]; // General purpose buffer for l2cap out data
-
238  uint8_t rfcommbuf[10]; // Buffer for RFCOMM Commands
-
239 
-
240  /* L2CAP Channels */
-
241  uint8_t sdp_scid[2]; // L2CAP source CID for SDP
-
242  uint8_t sdp_dcid[2]; // 0x0050
-
243  uint8_t rfcomm_scid[2]; // L2CAP source CID for RFCOMM
-
244  uint8_t rfcomm_dcid[2]; // 0x0051
-
245  uint8_t identifier; // Identifier for command
-
246 
-
247  /* RFCOMM Variables */
-
248  uint8_t rfcommChannel;
-
249  uint8_t rfcommChannelConnection; // This is the channel the SPP chanel will be running at
-
250  uint8_t rfcommDirection;
-
251  uint8_t rfcommCommandResponse;
-
252  uint8_t rfcommChannelType;
-
253  uint8_t rfcommPfBit;
-
254 
-
255  unsigned long timer;
-
256  bool waitForLastCommand;
-
257  bool creditSent;
-
258 
-
259  uint8_t rfcommDataBuffer[100]; // Create a 100 sized buffer for incoming data
-
260  uint8_t rfcommAvailable;
-
261 
-
262  bool firstMessage; // Used to see if it's the first SDP request received
-
263  uint8_t bytesRead; // Counter to see when it's time to send more credit
-
264 
-
265  unsigned long printTimer; // Used to set a delay, so it doesn't try to print too fast
-
266 
-
267  /* State machines */
-
268  void SDP_task(); // SDP state machine
-
269  void RFCOMM_task(); // RFCOMM state machine
-
270 
-
271  /* SDP Commands */
-
272  void SDP_Command(uint8_t* data, uint8_t nbytes);
-
273  void serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow);
-
274  void serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);
-
275  void serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);
-
276  void l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);
-
277  void l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);
-
278 
-
279  /* RFCOMM Commands */
-
280  void RFCOMM_Command(uint8_t* data, uint8_t nbytes);
-
281  void sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t* data, uint8_t length);
-
282  void sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit);
-
283  uint8_t calcFcs(uint8_t *data);
-
284  uint8_t __crc(uint8_t* data);
-
285 };
-
286 #endif
+
125  void print(const String &str);
+
130  void println(const String &str);
+
135  void print(const char* str);
+
140  void println(const char* str);
+
145  void print(uint8_t data);
+
150  void println(uint8_t data);
+
156  void print(uint8_t* array, uint8_t length);
+
162  void println(uint8_t* array, uint8_t length);
+
167  void print(const __FlashStringHelper *ifsh);
+
172  void println(const __FlashStringHelper *ifsh);
+
174  void println(void);
+
175 
+
180  void printNumber(int32_t n);
+
185  void printNumberln(int32_t n);
+
191  void printNumber(double n, uint8_t digits = 2);
+
197  void printNumberln(double n, uint8_t digits = 2);
+
198 
+
205  void doubleToString(double input, char* output, uint8_t digits = 2);
+
206 
+
211  uint8_t available() { return rfcommAvailable; };
+
216  uint8_t read();
+
218  void flush() { rfcommAvailable = 0; };
+
221 private:
+
222  /* Bluetooth dongle library pointer */
+
223  BTD *pBtd;
+
224 
+
225  /* Set true when a channel is created */
+
226  bool SDPConnected;
+
227  bool RFCOMMConnected;
+
228 
+
229  uint16_t hci_handle; // The HCI Handle for the connection
+
230 
+
231  /* Variables used by L2CAP state maschines */
+
232  uint8_t l2cap_sdp_state;
+
233  uint8_t l2cap_rfcomm_state;
+
234  uint16_t l2cap_event_flag; // l2cap flags of received bluetooth events
+
235 
+
236  uint8_t l2capoutbuf[BULK_MAXPKTSIZE]; // General purpose buffer for l2cap out data
+
237  uint8_t rfcommbuf[10]; // Buffer for RFCOMM Commands
+
238 
+
239  /* L2CAP Channels */
+
240  uint8_t sdp_scid[2]; // L2CAP source CID for SDP
+
241  uint8_t sdp_dcid[2]; // 0x0050
+
242  uint8_t rfcomm_scid[2]; // L2CAP source CID for RFCOMM
+
243  uint8_t rfcomm_dcid[2]; // 0x0051
+
244  uint8_t identifier; // Identifier for command
+
245 
+
246  /* RFCOMM Variables */
+
247  uint8_t rfcommChannel;
+
248  uint8_t rfcommChannelConnection; // This is the channel the SPP chanel will be running at
+
249  uint8_t rfcommDirection;
+
250  uint8_t rfcommCommandResponse;
+
251  uint8_t rfcommChannelType;
+
252  uint8_t rfcommPfBit;
+
253 
+
254  unsigned long timer;
+
255  bool waitForLastCommand;
+
256  bool creditSent;
+
257 
+
258  uint8_t rfcommDataBuffer[100]; // Create a 100 sized buffer for incoming data
+
259  uint8_t rfcommAvailable;
+
260 
+
261  bool firstMessage; // Used to see if it's the first SDP request received
+
262  uint8_t bytesRead; // Counter to see when it's time to send more credit
+
263 
+
264  unsigned long printTimer; // Used to set a delay, so it doesn't try to print too fast
+
265 
+
266  /* State machines */
+
267  void SDP_task(); // SDP state machine
+
268  void RFCOMM_task(); // RFCOMM state machine
+
269 
+
270  /* SDP Commands */
+
271  void SDP_Command(uint8_t* data, uint8_t nbytes);
+
272  void serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLow);
+
273  void serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);
+
274  void serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);
+
275  void l2capResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLow);
+
276  void l2capResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLow);
+
277 
+
278  /* RFCOMM Commands */
+
279  void RFCOMM_Command(uint8_t* data, uint8_t nbytes);
+
280  void sendRfcomm(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t* data, uint8_t length);
+
281  void sendRfcommCredit(uint8_t channel, uint8_t direction, uint8_t CR, uint8_t channelType, uint8_t pfBit, uint8_t credit);
+
282  uint8_t calcFcs(uint8_t *data);
+
283  uint8_t __crc(uint8_t* data);
+
284 };
+
285 #endif
diff --git a/_usb_8cpp.html b/_usb_8cpp.html index eac03e54..62632599 100644 --- a/_usb_8cpp.html +++ b/_usb_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Usb.cpp File Reference +USB Host Shield 2.0: Usb.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -106,7 +106,7 @@ Include dependency graph for Usb.cpp:
diff --git a/_usb_8cpp_source.html b/_usb_8cpp_source.html index 2a90feb7..fa2ac9f7 100644 --- a/_usb_8cpp_source.html +++ b/_usb_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Usb.cpp Source File +USB Host Shield 2.0: Usb.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -734,7 +734,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/_usb_8h.html b/_usb_8h.html index 435b7451..81204c73 100644 --- a/_usb_8h.html +++ b/_usb_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Usb.h File Reference +USB Host Shield 2.0: Usb.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -116,7 +116,7 @@ This graph shows which files directly or indirectly include this file:
- +

Go to the source code of this file.

@@ -255,608 +255,6 @@ Typedefs  

Macro Definition Documentation

- -
-
- - - - -
#define bmREQ_CL_GET_INTF   USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
-
- -

Definition at line 75 of file Usb.h.

- -
-
- -
-
- - - - -
#define bmREQ_GET_DESCR   USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE
-
- -

Definition at line 73 of file Usb.h.

- -
-
- -
-
- - - - -
#define bmREQ_SET   USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE
-
- -

Definition at line 74 of file Usb.h.

- -
-
- -
-
- - - - -
#define HUB_PORT_RESET_DELAY   20
-
- -

Definition at line 132 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE   0x60
-
- -

Definition at line 145 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ATTACHED_SUBSTATE_RESET_DEVICE   0x30
-
- -

Definition at line 142 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ATTACHED_SUBSTATE_SETTLE   0x20
-
- -

Definition at line 141 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE   0x40
-
- -

Definition at line 143 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ATTACHED_SUBSTATE_WAIT_SOF   0x50
-
- -

Definition at line 144 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_APP_SPECIFIC   0xfe
-
- -

Definition at line 99 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_AUDIO   0x01
-
- -

Definition at line 83 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_CDC_DATA   0x0a
-
- -

Definition at line 91 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_COM_AND_CDC_CTRL   0x02
-
- -

Definition at line 84 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_CONTENT_SECURITY   0x0d
-
- -

Definition at line 93 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_DIAGNOSTIC_DEVICE   0xdc
-
- -

Definition at line 96 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_HID   0x03
-
- -

Definition at line 85 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_HUB   0x09
-
- -

Definition at line 90 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_IMAGE   0x06
-
- -

Definition at line 87 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_MASS_STORAGE   0x08
-
- -

Definition at line 89 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_MISC   0xef
-
- -

Definition at line 98 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_PERSONAL_HEALTH   0x0f
-
- -

Definition at line 95 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_PHYSICAL   0x05
-
- -

Definition at line 86 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_PRINTER   0x07
-
- -

Definition at line 88 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_SMART_CARD   0x0b
-
- -

Definition at line 92 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_USE_CLASS_INFO   0x00
-
- -

Definition at line 82 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_VENDOR_SPECIFIC   0xff
-
- -

Definition at line 100 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_VIDEO   0x0e
-
- -

Definition at line 94 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_CLASS_WIRELESS_CTRL   0xe0
-
- -

Definition at line 97 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_DETACHED_SUBSTATE_ILLEGAL   0x13
-
- -

Definition at line 140 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_DETACHED_SUBSTATE_INITIALIZE   0x11
-
- -

Definition at line 138 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE   0x12
-
- -

Definition at line 139 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE   0xD2
-
- -

Definition at line 104 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED   0xD1
-
- -

Definition at line 103 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL   0xD6
-
- -

Definition at line 108 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE   0xD9
-
- -

Definition at line 111 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_EP_NOT_FOUND_IN_TBL   0xDB
-
- -

Definition at line 113 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_EPINFO_IS_NULL   0xD7
-
- -

Definition at line 109 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_HUB_ADDRESS_OVERFLOW   0xD5
-
- -

Definition at line 107 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_INVALID_ARGUMENT   0xD8
-
- -

Definition at line 110 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_INVALID_MAX_PKT_SIZE   0xDA
-
- -

Definition at line 112 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL   0xD4
-
- -

Definition at line 106 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_TRANSFER_TIMEOUT   0xFF
-
- -

Definition at line 114 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS   0xD3
-
- -

Definition at line 105 of file Usb.h.

- -
-
@@ -869,146 +267,6 @@ Typedefs

Definition at line 25 of file Usb.h.

-
-
- -
-
- - - - -
#define USB_NUMDEVICES   16
-
- -

Definition at line 130 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_RETRY_LIMIT   3
-
- -

Definition at line 127 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_SETTLE_DELAY   200
-
- -

Definition at line 128 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_STATE_ADDRESSING   0x70
-
- -

Definition at line 146 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_STATE_CONFIGURING   0x80
-
- -

Definition at line 147 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_STATE_DETACHED   0x10
-
- -

Definition at line 137 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_STATE_ERROR   0xa0
-
- -

Definition at line 149 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_STATE_MASK   0xf0
-
- -

Definition at line 135 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_STATE_RUNNING   0x90
-
- -

Definition at line 148 of file Usb.h.

- -
-
- -
-
- - - - -
#define USB_XFER_TIMEOUT   5000
-
- -

Definition at line 125 of file Usb.h.

-
@@ -1055,6 +313,748 @@ Typedefs

Definition at line 68 of file Usb.h.

+ + + +
+
+ + + + +
#define bmREQ_GET_DESCR   USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE
+
+ +

Definition at line 73 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define bmREQ_SET   USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE
+
+ +

Definition at line 74 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define bmREQ_CL_GET_INTF   USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
+
+ +

Definition at line 75 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_USE_CLASS_INFO   0x00
+
+ +

Definition at line 82 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_AUDIO   0x01
+
+ +

Definition at line 83 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_COM_AND_CDC_CTRL   0x02
+
+ +

Definition at line 84 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_HID   0x03
+
+ +

Definition at line 85 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_PHYSICAL   0x05
+
+ +

Definition at line 86 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_IMAGE   0x06
+
+ +

Definition at line 87 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_PRINTER   0x07
+
+ +

Definition at line 88 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_MASS_STORAGE   0x08
+
+ +

Definition at line 89 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_HUB   0x09
+
+ +

Definition at line 90 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_CDC_DATA   0x0a
+
+ +

Definition at line 91 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_SMART_CARD   0x0b
+
+ +

Definition at line 92 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_CONTENT_SECURITY   0x0d
+
+ +

Definition at line 93 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_VIDEO   0x0e
+
+ +

Definition at line 94 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_PERSONAL_HEALTH   0x0f
+
+ +

Definition at line 95 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_DIAGNOSTIC_DEVICE   0xdc
+
+ +

Definition at line 96 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_WIRELESS_CTRL   0xe0
+
+ +

Definition at line 97 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_MISC   0xef
+
+ +

Definition at line 98 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_APP_SPECIFIC   0xfe
+
+ +

Definition at line 99 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_CLASS_VENDOR_SPECIFIC   0xff
+
+ +

Definition at line 100 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED   0xD1
+
+ +

Definition at line 103 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE   0xD2
+
+ +

Definition at line 104 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS   0xD3
+
+ +

Definition at line 105 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL   0xD4
+
+ +

Definition at line 106 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_HUB_ADDRESS_OVERFLOW   0xD5
+
+ +

Definition at line 107 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL   0xD6
+
+ +

Definition at line 108 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_EPINFO_IS_NULL   0xD7
+
+ +

Definition at line 109 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_INVALID_ARGUMENT   0xD8
+
+ +

Definition at line 110 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE   0xD9
+
+ +

Definition at line 111 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_INVALID_MAX_PKT_SIZE   0xDA
+
+ +

Definition at line 112 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_EP_NOT_FOUND_IN_TBL   0xDB
+
+ +

Definition at line 113 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ERROR_TRANSFER_TIMEOUT   0xFF
+
+ +

Definition at line 114 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_XFER_TIMEOUT   5000
+
+ +

Definition at line 125 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_RETRY_LIMIT   3
+
+ +

Definition at line 127 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_SETTLE_DELAY   200
+
+ +

Definition at line 128 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_NUMDEVICES   16
+
+ +

Definition at line 130 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define HUB_PORT_RESET_DELAY   20
+
+ +

Definition at line 132 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_STATE_MASK   0xf0
+
+ +

Definition at line 135 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_STATE_DETACHED   0x10
+
+ +

Definition at line 137 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_DETACHED_SUBSTATE_INITIALIZE   0x11
+
+ +

Definition at line 138 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE   0x12
+
+ +

Definition at line 139 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_DETACHED_SUBSTATE_ILLEGAL   0x13
+
+ +

Definition at line 140 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ATTACHED_SUBSTATE_SETTLE   0x20
+
+ +

Definition at line 141 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ATTACHED_SUBSTATE_RESET_DEVICE   0x30
+
+ +

Definition at line 142 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE   0x40
+
+ +

Definition at line 143 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ATTACHED_SUBSTATE_WAIT_SOF   0x50
+
+ +

Definition at line 144 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE   0x60
+
+ +

Definition at line 145 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_STATE_ADDRESSING   0x70
+
+ +

Definition at line 146 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_STATE_CONFIGURING   0x80
+
+ +

Definition at line 147 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_STATE_RUNNING   0x90
+
+ +

Definition at line 148 of file Usb.h.

+ +
+
+ +
+
+ + + + +
#define USB_STATE_ERROR   0xa0
+
+ +

Definition at line 149 of file Usb.h.

+

Typedef Documentation

@@ -1087,7 +1087,7 @@ Typedefs diff --git a/_usb_8h__dep__incl.map b/_usb_8h__dep__incl.map index 7c06bac1..7bdc7bb9 100644 --- a/_usb_8h__dep__incl.map +++ b/_usb_8h__dep__incl.map @@ -1,37 +1,39 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/_usb_8h__dep__incl.md5 b/_usb_8h__dep__incl.md5 index dc74ca56..0bea158b 100644 --- a/_usb_8h__dep__incl.md5 +++ b/_usb_8h__dep__incl.md5 @@ -1 +1 @@ -442ebf13656c01ada7e7ad4b8b5761f1 \ No newline at end of file +207a88a0652d96de0277d94f381679ac \ No newline at end of file diff --git a/_usb_8h__dep__incl.png b/_usb_8h__dep__incl.png index 699910ea..bd03288b 100644 Binary files a/_usb_8h__dep__incl.png and b/_usb_8h__dep__incl.png differ diff --git a/_usb_8h_source.html b/_usb_8h_source.html index 86e57691..e253e391 100644 --- a/_usb_8h_source.html +++ b/_usb_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Usb.h Source File +USB Host Shield 2.0: Usb.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -377,7 +377,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/_wii_8cpp.html b/_wii_8cpp.html index 9f3dce69..2a505a4b 100644 --- a/_wii_8cpp.html +++ b/_wii_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Wii.cpp File Reference +USB Host Shield 2.0: Wii.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -159,7 +159,7 @@ Variables
diff --git a/_wii_8cpp_source.html b/_wii_8cpp_source.html index 967329c7..2dbf6159 100644 --- a/_wii_8cpp_source.html +++ b/_wii_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Wii.cpp Source File +USB Host Shield 2.0: Wii.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -1250,7 +1250,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/_wii_8h.html b/_wii_8h.html index 276ecb18..e5b47c9c 100644 --- a/_wii_8h.html +++ b/_wii_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Wii.h File Reference +USB Host Shield 2.0: Wii.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -200,157 +200,32 @@ Enumerations  

Macro Definition Documentation

- +
- +
#define L2CAP_CHECK_EXTENSION_STATE   8#define WIICAMERA
+

You will have to uncomment this to use the IR camera

-

Definition at line 46 of file Wii.h.

+

Definition at line 29 of file Wii.h.

- +
- +
#define L2CAP_CHECK_MOTION_PLUS_STATE   7#define L2CAP_WAIT   0
-

Definition at line 45 of file Wii.h.

- -
-
- -
-
- - - - -
#define l2cap_config_success_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)
-
- -

Definition at line 67 of file Wii.h.

- -
-
- -
-
- - - - -
#define l2cap_config_success_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)
-
- -

Definition at line 68 of file Wii.h.

- -
-
- -
-
- - - - -
#define l2cap_connected_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONTROL_CONNECTED)
-
- -

Definition at line 65 of file Wii.h.

- -
-
- -
-
- - - - -
#define l2cap_connected_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_INTERRUPT_CONNECTED)
-
- -

Definition at line 66 of file Wii.h.

- -
-
- -
-
- - - - -
#define l2cap_connection_request_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)
-
- -

Definition at line 71 of file Wii.h.

- -
-
- -
-
- - - - -
#define l2cap_connection_request_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)
-
- -

Definition at line 72 of file Wii.h.

- -
-
- -
-
- - - - -
#define L2CAP_CONTROL_CONFIG_REQUEST   4
-
- -

Definition at line 40 of file Wii.h.

- -
-
- -
-
- - - - -
#define L2CAP_CONTROL_CONNECT_REQUEST   3
-
- -

Definition at line 39 of file Wii.h.

- -
-
- -
-
- - - - -
#define L2CAP_CONTROL_DISCONNECT   13
-
- -

Definition at line 52 of file Wii.h.

+

Definition at line 32 of file Wii.h.

@@ -368,31 +243,129 @@ Enumerations
- +
- +
#define l2cap_disconnect_response_control_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)#define L2CAP_INTERRUPT_SETUP   2
-

Definition at line 69 of file Wii.h.

+

Definition at line 36 of file Wii.h.

- +
- +
#define l2cap_disconnect_response_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE)#define L2CAP_CONTROL_CONNECT_REQUEST   3
-

Definition at line 70 of file Wii.h.

+

Definition at line 39 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_CONTROL_CONFIG_REQUEST   4
+
+ +

Definition at line 40 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_INTERRUPT_CONNECT_REQUEST   5
+
+ +

Definition at line 41 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_INTERRUPT_CONFIG_REQUEST   6
+
+ +

Definition at line 43 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_CHECK_MOTION_PLUS_STATE   7
+
+ +

Definition at line 45 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_CHECK_EXTENSION_STATE   8
+
+ +

Definition at line 46 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_INIT_MOTION_PLUS_STATE   9
+
+ +

Definition at line 47 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_LED_STATE   10
+
+ +

Definition at line 48 of file Wii.h.

@@ -408,6 +381,62 @@ Enumerations

Definition at line 49 of file Wii.h.

+ + + +
+
+ + + + +
#define L2CAP_INTERRUPT_DISCONNECT   12
+
+ +

Definition at line 51 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_CONTROL_DISCONNECT   13
+
+ +

Definition at line 52 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_CONTROL_CONNECTED   0x001
+
+ +

Definition at line 55 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define L2CAP_FLAG_INTERRUPT_CONNECTED   0x002
+
+ +

Definition at line 56 of file Wii.h.

+
@@ -436,48 +465,6 @@ Enumerations

Definition at line 58 of file Wii.h.

- - - -
-
- - - - -
#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST   0x100
-
- -

Definition at line 61 of file Wii.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST   0x200
-
- -

Definition at line 62 of file Wii.h.

- -
-
- -
-
- - - - -
#define L2CAP_FLAG_CONTROL_CONNECTED   0x001
-
- -

Definition at line 55 of file Wii.h.

-
@@ -508,115 +495,171 @@ Enumerations - +
- +
#define L2CAP_FLAG_INTERRUPT_CONNECTED   0x002#define L2CAP_FLAG_CONNECTION_CONTROL_REQUEST   0x100
-

Definition at line 56 of file Wii.h.

+

Definition at line 61 of file Wii.h.

- +
- +
#define L2CAP_INIT_MOTION_PLUS_STATE   9#define L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST   0x200
-

Definition at line 47 of file Wii.h.

+

Definition at line 62 of file Wii.h.

- +
- +
#define L2CAP_INTERRUPT_CONFIG_REQUEST   6#define l2cap_connected_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONTROL_CONNECTED)
-

Definition at line 43 of file Wii.h.

+

Definition at line 65 of file Wii.h.

- +
- +
#define L2CAP_INTERRUPT_CONNECT_REQUEST   5#define l2cap_connected_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_INTERRUPT_CONNECTED)
-

Definition at line 41 of file Wii.h.

+

Definition at line 66 of file Wii.h.

- +
- +
#define L2CAP_INTERRUPT_DISCONNECT   12#define l2cap_config_success_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_CONTROL_SUCCESS)
-

Definition at line 51 of file Wii.h.

+

Definition at line 67 of file Wii.h.

- +
- +
#define L2CAP_INTERRUPT_SETUP   2#define l2cap_config_success_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONFIG_INTERRUPT_SUCCESS)
-

Definition at line 36 of file Wii.h.

+

Definition at line 68 of file Wii.h.

- +
- +
#define L2CAP_LED_STATE   10#define l2cap_disconnect_response_control_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_CONTROL_RESPONSE)
-

Definition at line 48 of file Wii.h.

+

Definition at line 69 of file Wii.h.

- +
- +
#define L2CAP_WAIT   0#define l2cap_disconnect_response_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_DISCONNECT_INTERRUPT_RESPONSE)
-

Definition at line 32 of file Wii.h.

+

Definition at line 70 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_connection_request_control_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_CONTROL_REQUEST)
+
+ +

Definition at line 71 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define l2cap_connection_request_interrupt_flag   (l2cap_event_flag & L2CAP_FLAG_CONNECTION_INTERRUPT_REQUEST)
+
+ +

Definition at line 72 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define WII_FLAG_MOTION_PLUS_CONNECTED   0x400
+
+ +

Definition at line 75 of file Wii.h.

+ +
+
+ +
+
+ + + + +
#define WII_FLAG_NUNCHUCK_CONNECTED   0x800
+
+ +

Definition at line 76 of file Wii.h.

@@ -660,49 +703,6 @@ Enumerations

Definition at line 81 of file Wii.h.

- - - -
-
- - - - -
#define WII_FLAG_MOTION_PLUS_CONNECTED   0x400
-
- -

Definition at line 75 of file Wii.h.

- -
-
- -
-
- - - - -
#define WII_FLAG_NUNCHUCK_CONNECTED   0x800
-
- -

Definition at line 76 of file Wii.h.

- -
-
- -
-
- - - - -
#define WIICAMERA
-
-

You will have to uncomment this to use the IR camera

- -

Definition at line 29 of file Wii.h.

-

Enumeration Type Documentation

@@ -732,7 +732,7 @@ Enumerations diff --git a/_wii_8h_source.html b/_wii_8h_source.html index c8d64336..ca2a6363 100644 --- a/_wii_8h_source.html +++ b/_wii_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Wii.h Source File +USB Host Shield 2.0: Wii.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -183,166 +183,166 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
113  virtual void Run();
115  virtual void Reset();
117  virtual void disconnect();
-
127  bool getButtonPress(Button b);
-
128  bool getButtonClick(Button b);
-
137  uint8_t getAnalogHat(Hat a);
-
143  uint16_t getAnalogHat(AnalogHat a);
-
144 
-
149  double getPitch() { return pitch; };
-
154  double getRoll() { return roll; };
-
161  double getYaw() { return gyroYaw; };
-
162 
-
164  void setAllOff();
-
166  void setRumbleOff();
-
168  void setRumbleOn();
-
170  void setRumbleToggle();
-
175  void setLedOff(LED a);
-
180  void setLedOn(LED a);
-
185  void setLedToggle(LED a);
-
195  void setLedStatus();
-
196 
-
201  uint8_t getBatteryLevel() { return batteryLevel; };
-
206  uint8_t getWiiState() { return wiiState; };
-
211  bool wiimoteConnected;
-
213  bool nunchuckConnected;
-
215  bool motionPlusConnected;
-
217  bool wiiUProControllerConnected;
-
220  /* IMU Data, might be usefull if you need to do something more advanced than just calculating the angle */
-
221 
-
224  double wiimotePitch;
-
225  double wiimoteRoll;
-
230  double nunchuckPitch;
-
231  double nunchuckRoll;
-
236  int16_t accX;
-
237  int16_t accY;
-
238  int16_t accZ;
-
241  /* Variables for the gyro inside the Motion Plus */
-
243  double gyroPitch;
-
245  double gyroRoll;
-
247  double gyroYaw;
-
248 
-
251  double pitchGyroSpeed;
-
252  double rollGyroSpeed;
-
253  double yawGyroSpeed;
-
258  uint16_t pitchGyroScale;
-
259  uint16_t rollGyroScale;
-
260  uint16_t yawGyroScale;
-
265  int16_t gyroYawRaw;
-
266  int16_t gyroRollRaw;
-
267  int16_t gyroPitchRaw;
-
272  int16_t gyroYawZero;
-
273  int16_t gyroRollZero;
-
274  int16_t gyroPitchZero;
-
277 #ifdef WIICAMERA
-
278 
-
282  void IRinitialize();
-
283 
-
285  uint16_t getIRx1() { return IR_object_x1; };
-
287  uint16_t getIRy1() { return IR_object_y1; };
-
289  uint8_t getIRs1() { return IR_object_s1; };
-
290 
-
292  uint16_t getIRx2() { return IR_object_x2; };
-
294  uint16_t getIRy2() { return IR_object_y2; };
-
296  uint8_t getIRs2() { return IR_object_s2; };
-
297 
-
299  uint16_t getIRx3() { return IR_object_x3; };
-
301  uint16_t getIRy3() { return IR_object_y3; };
-
303  uint8_t getIRs3() { return IR_object_s3; };
-
304 
-
306  uint16_t getIRx4() { return IR_object_x4; };
-
308  uint16_t getIRy4() { return IR_object_y4; };
-
310  uint8_t getIRs4() { return IR_object_s4; };
-
311 
-
317  bool isIRCameraEnabled() { return (wiiState & 0x08); };
-
319 #endif
-
320 
-
321 private:
-
322  /* Mandatory members */
-
323  BTD *pBtd;
-
324 
-
325  void L2CAP_task(); // L2CAP state machine
-
326 
-
327  /* Variables filled from HCI event management */
-
328  uint16_t hci_handle;
-
329  bool activeConnection; // Used to indicate if it's already has established a connection
-
330 
-
331  /* variables used by high level L2CAP task */
-
332  uint8_t l2cap_state;
-
333  uint16_t l2cap_event_flag;// l2cap flags of received bluetooth events
-
334 
-
335  uint32_t ButtonState;
-
336  uint32_t OldButtonState;
-
337  uint32_t ButtonClickState;
-
338  uint16_t hatValues[4];
-
339 
-
340  uint8_t HIDBuffer[3];// Used to store HID commands
-
341 
-
342  uint16_t stateCounter;
-
343  bool unknownExtensionConnected;
-
344  bool extensionConnected;
-
345 
-
346  /* L2CAP Channels */
-
347  uint8_t control_scid[2]; // L2CAP source CID for HID_Control
-
348  uint8_t control_dcid[2]; // 0x0060
-
349  uint8_t interrupt_scid[2]; // L2CAP source CID for HID_Interrupt
-
350  uint8_t interrupt_dcid[2]; // 0x0061
-
351  uint8_t identifier; // Identifier for connection
-
352 
-
353  /* HID Commands */
-
354  void HID_Command(uint8_t* data, uint8_t nbytes);
-
355  void setReportMode(bool continuous, uint8_t mode);
-
356  void statusRequest();
-
357 
-
358  void writeData(uint32_t offset, uint8_t size, uint8_t* data);
-
359  void initExtension1();
-
360  void initExtension2();
-
361 
-
362  void readData(uint32_t offset, uint16_t size, bool EEPROM);
-
363  void readExtensionType();
-
364  void readCalData();
-
365 
-
366  void checkMotionPresent(); // Used to see if a Motion Plus is connected to the Wiimote
-
367  void initMotionPlus();
-
368  void activateMotionPlus();
-
369 
-
370  double pitch; // Fusioned angle using a complimentary filter if the Motion Plus is connected
-
371  double roll; // Fusioned angle using a complimentary filter if the Motion Plus is connected
+
129  bool getButtonPress(Button b);
+
130  bool getButtonClick(Button b);
+
139  uint8_t getAnalogHat(Hat a);
+
145  uint16_t getAnalogHat(AnalogHat a);
+
146 
+
151  double getPitch() { return pitch; };
+
156  double getRoll() { return roll; };
+
163  double getYaw() { return gyroYaw; };
+
164 
+
166  void setAllOff();
+
168  void setRumbleOff();
+
170  void setRumbleOn();
+
172  void setRumbleToggle();
+
177  void setLedOff(LED a);
+
182  void setLedOn(LED a);
+
187  void setLedToggle(LED a);
+
197  void setLedStatus();
+
198 
+
203  uint8_t getBatteryLevel() { return batteryLevel; };
+
208  uint8_t getWiiState() { return wiiState; };
+
213  bool wiimoteConnected;
+
215  bool nunchuckConnected;
+
217  bool motionPlusConnected;
+
219  bool wiiUProControllerConnected;
+
222  /* IMU Data, might be usefull if you need to do something more advanced than just calculating the angle */
+
223 
+
226  double wiimotePitch;
+
227  double wiimoteRoll;
+
232  double nunchuckPitch;
+
233  double nunchuckRoll;
+
238  int16_t accX;
+
239  int16_t accY;
+
240  int16_t accZ;
+
243  /* Variables for the gyro inside the Motion Plus */
+
245  double gyroPitch;
+
247  double gyroRoll;
+
249  double gyroYaw;
+
250 
+
253  double pitchGyroSpeed;
+
254  double rollGyroSpeed;
+
255  double yawGyroSpeed;
+
260  uint16_t pitchGyroScale;
+
261  uint16_t rollGyroScale;
+
262  uint16_t yawGyroScale;
+
267  int16_t gyroYawRaw;
+
268  int16_t gyroRollRaw;
+
269  int16_t gyroPitchRaw;
+
274  int16_t gyroYawZero;
+
275  int16_t gyroRollZero;
+
276  int16_t gyroPitchZero;
+
279 #ifdef WIICAMERA
+
280 
+
284  void IRinitialize();
+
285 
+
290  uint16_t getIRx1() { return IR_object_x1; };
+
295  uint16_t getIRy1() { return IR_object_y1; };
+
300  uint8_t getIRs1() { return IR_object_s1; };
+
301 
+
306  uint16_t getIRx2() { return IR_object_x2; };
+
311  uint16_t getIRy2() { return IR_object_y2; };
+
316  uint8_t getIRs2() { return IR_object_s2; };
+
317 
+
322  uint16_t getIRx3() { return IR_object_x3; };
+
327  uint16_t getIRy3() { return IR_object_y3; };
+
332  uint8_t getIRs3() { return IR_object_s3; };
+
333 
+
338  uint16_t getIRx4() { return IR_object_x4; };
+
343  uint16_t getIRy4() { return IR_object_y4; };
+
348  uint8_t getIRs4() { return IR_object_s4; };
+
349 
+
355  bool isIRCameraEnabled() { return (wiiState & 0x08); };
+
357 #endif
+
358 
+
359 private:
+
360  /* Mandatory members */
+
361  BTD *pBtd;
+
362 
+
363  void L2CAP_task(); // L2CAP state machine
+
364 
+
365  /* Variables filled from HCI event management */
+
366  uint16_t hci_handle;
+
367  bool activeConnection; // Used to indicate if it's already has established a connection
+
368 
+
369  /* variables used by high level L2CAP task */
+
370  uint8_t l2cap_state;
+
371  uint16_t l2cap_event_flag;// l2cap flags of received bluetooth events
372 
-
373  bool activateNunchuck;
-
374  bool motionValuesReset; // This bool is true when the gyro values has been reset
-
375  unsigned long timer;
-
376 
-
377  uint8_t wiiState; // Stores the value in l2capinbuf[12] - (0x01: Battery is nearly empty), (0x02: An Extension Controller is connected), (0x04: Speaker enabled), (0x08: IR enabled), (0x10: LED1, 0x20: LED2, 0x40: LED3, 0x80: LED4)
-
378  uint8_t batteryLevel;
+
373  uint32_t ButtonState;
+
374  uint32_t OldButtonState;
+
375  uint32_t ButtonClickState;
+
376  uint16_t hatValues[4];
+
377 
+
378  uint8_t HIDBuffer[3];// Used to store HID commands
379 
-
380 #ifdef WIICAMERA
-
381  /* Private function and variables for the readings from teh IR Camera */
-
382  void enableIRCamera1(); // Sets bit 2 of output report 13
-
383  void enableIRCamera2(); // Sets bit 2 of output report 1A
-
384  void writeSensitivityBlock1();
-
385  void writeSensitivityBlock2();
-
386  void write0x08Value();
-
387  void setWiiModeNumber(uint8_t mode_number);
-
388 
-
389  uint16_t IR_object_x1; // IR x position 10 bits
-
390  uint16_t IR_object_y1; // IR y position 10 bits
-
391  uint8_t IR_object_s1; // IR size value
-
392  uint16_t IR_object_x2;
-
393  uint16_t IR_object_y2;
-
394  uint8_t IR_object_s2;
-
395  uint16_t IR_object_x3; // IR x position 10 bits
-
396  uint16_t IR_object_y3; // IR y position 10 bits
-
397  uint8_t IR_object_s3; // IR size value
-
398  uint16_t IR_object_x4;
-
399  uint16_t IR_object_y4;
-
400  uint8_t IR_object_s4;
-
401 #endif
-
402 };
-
403 #endif
+
380  uint16_t stateCounter;
+
381  bool unknownExtensionConnected;
+
382  bool extensionConnected;
+
383 
+
384  /* L2CAP Channels */
+
385  uint8_t control_scid[2]; // L2CAP source CID for HID_Control
+
386  uint8_t control_dcid[2]; // 0x0060
+
387  uint8_t interrupt_scid[2]; // L2CAP source CID for HID_Interrupt
+
388  uint8_t interrupt_dcid[2]; // 0x0061
+
389  uint8_t identifier; // Identifier for connection
+
390 
+
391  /* HID Commands */
+
392  void HID_Command(uint8_t* data, uint8_t nbytes);
+
393  void setReportMode(bool continuous, uint8_t mode);
+
394  void statusRequest();
+
395 
+
396  void writeData(uint32_t offset, uint8_t size, uint8_t* data);
+
397  void initExtension1();
+
398  void initExtension2();
+
399 
+
400  void readData(uint32_t offset, uint16_t size, bool EEPROM);
+
401  void readExtensionType();
+
402  void readCalData();
+
403 
+
404  void checkMotionPresent(); // Used to see if a Motion Plus is connected to the Wiimote
+
405  void initMotionPlus();
+
406  void activateMotionPlus();
+
407 
+
408  double pitch; // Fusioned angle using a complimentary filter if the Motion Plus is connected
+
409  double roll; // Fusioned angle using a complimentary filter if the Motion Plus is connected
+
410 
+
411  bool activateNunchuck;
+
412  bool motionValuesReset; // This bool is true when the gyro values has been reset
+
413  unsigned long timer;
+
414 
+
415  uint8_t wiiState; // Stores the value in l2capinbuf[12] - (0x01: Battery is nearly empty), (0x02: An Extension Controller is connected), (0x04: Speaker enabled), (0x08: IR enabled), (0x10: LED1, 0x20: LED2, 0x40: LED3, 0x80: LED4)
+
416  uint8_t batteryLevel;
+
417 
+
418 #ifdef WIICAMERA
+
419  /* Private function and variables for the readings from teh IR Camera */
+
420  void enableIRCamera1(); // Sets bit 2 of output report 13
+
421  void enableIRCamera2(); // Sets bit 2 of output report 1A
+
422  void writeSensitivityBlock1();
+
423  void writeSensitivityBlock2();
+
424  void write0x08Value();
+
425  void setWiiModeNumber(uint8_t mode_number);
+
426 
+
427  uint16_t IR_object_x1; // IR x position 10 bits
+
428  uint16_t IR_object_y1; // IR y position 10 bits
+
429  uint8_t IR_object_s1; // IR size value
+
430  uint16_t IR_object_x2;
+
431  uint16_t IR_object_y2;
+
432  uint8_t IR_object_s2;
+
433  uint16_t IR_object_x3; // IR x position 10 bits
+
434  uint16_t IR_object_y3; // IR y position 10 bits
+
435  uint8_t IR_object_s3; // IR size value
+
436  uint16_t IR_object_x4;
+
437  uint16_t IR_object_y4;
+
438  uint8_t IR_object_s4;
+
439 #endif
+
440 };
+
441 #endif
diff --git a/_wii_camera_readme_8md.html b/_wii_camera_readme_8md.html index e6ce2484..2212bfe2 100644 --- a/_wii_camera_readme_8md.html +++ b/_wii_camera_readme_8md.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: WiiCameraReadme.md File Reference +USB Host Shield 2.0: WiiCameraReadme.md File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -90,7 +90,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 7b085903..f37fcb45 100644 --- a/_wii_camera_readme_8md_source.html +++ b/_wii_camera_readme_8md_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: WiiCameraReadme.md Source File +USB Host Shield 2.0: WiiCameraReadme.md Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -103,7 +103,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 ae39afd6..c8ddfa93 100644 --- a/_x_b_o_x_r_e_c_v_8cpp.html +++ b/_x_b_o_x_r_e_c_v_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: XBOXRECV.cpp File Reference +USB Host Shield 2.0: XBOXRECV.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -86,8 +86,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
-Macros | -Variables
+Macros
XBOXRECV.cpp File Reference
@@ -98,7 +97,7 @@ Include dependency graph for XBOXRECV.cpp:
- +

Go to the source code of this file.

@@ -107,11 +106,6 @@ Include dependency graph for XBOXRECV.cpp: Macros #define DEBUG   - - - -

-Variables

const uint8_t LEDS[] PROGMEM
 

Macro Definition Documentation

@@ -126,34 +120,12 @@ Variables

Definition at line 21 of file XBOXRECV.cpp.

- - -

Variable Documentation

- -
-
- - - - -
const uint16_t BUTTONS [] PROGMEM
-
-Initial value:
= {
-
0x02,
-
0x03,
-
0x04,
-
0x05,
-
0x01
-
}
-
-

Definition at line 25 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 7af176eb..aeee8fe7 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,13 +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 bfa781fd..75fdc40a 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 @@ -f58de32a6eab759ace708c6df8ad551d \ No newline at end of file +61989c7a9fc6a14c10c7e5dd46752793 \ 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 d75061c9..c4c09728 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 6731f4f7..9e95ced2 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 @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: XBOXRECV.cpp Source File +USB Host Shield 2.0: XBOXRECV.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -113,526 +113,495 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
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 const uint8_t LEDS[] PROGMEM = {
-
26  0x02, // LED1
-
27  0x03, // LED2
-
28  0x04, // LED3
-
29  0x05, // LED4
-
30  0x01 // ALL - Used to blink all LEDs
-
31  };
-
32 const uint16_t BUTTONS[] PROGMEM = {
-
33  0x0100, // UP
-
34  0x0800, // RIGHT
-
35  0x0200, // DOWN
-
36  0x0400, // LEFT
-
37 
-
38  0x2000, // BACK
-
39  0x1000, // START
-
40  0x4000, // L3
-
41  0x8000, // R3
-
42 
-
43  0,0, // Skip L2 and R2 as these are analog buttons
-
44  0x0001, // L1
-
45  0x0002, // R1
-
46 
-
47  0x0020, // B
-
48  0x0010, // A
-
49  0x0040, // X
-
50  0x0080, // Y
-
51 
-
52  0x0004, // XBOX
-
53  0x0008 // SYNC
-
54 };
-
55 
-
56 XBOXRECV::XBOXRECV(USB *p):
-
57 pUsb(p), // pointer to USB class instance - mandatory
-
58 bAddress(0), // device address - mandatory
-
59 bPollEnable(false) { // don't start polling before dongle is connected
-
60  for(uint8_t i=0; i<XBOX_MAX_ENDPOINTS; i++) {
-
61  epInfo[i].epAddr = 0;
-
62  epInfo[i].maxPktSize = (i) ? 0 : 8;
-
63  epInfo[i].epAttribs = 0;
-
64  epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
-
65  }
-
66 
-
67  if (pUsb) // register in USB subsystem
-
68  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
-
69 }
-
70 
-
71 uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
-
72  uint8_t buf[sizeof(USB_DEVICE_DESCRIPTOR)];
-
73  uint8_t rcode;
-
74  UsbDevice *p = NULL;
-
75  EpInfo *oldep_ptr = NULL;
-
76  uint16_t PID;
-
77  uint16_t VID;
-
78 
-
79  // get memory address of USB device address pool
-
80  AddressPool &addrPool = pUsb->GetAddressPool();
-
81 #ifdef EXTRADEBUG
-
82  Notify(PSTR("\r\nXBOXRECV Init"));
-
83 #endif
-
84  // check if address has already been assigned to an instance
-
85  if (bAddress) {
-
86 #ifdef DEBUG
-
87  Notify(PSTR("\r\nAddress in use"));
-
88 #endif
-
89  return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
-
90  }
-
91 
-
92  // Get pointer to pseudo device with address 0 assigned
-
93  p = addrPool.GetUsbDevicePtr(0);
-
94 
-
95  if (!p) {
-
96 #ifdef DEBUG
-
97  Notify(PSTR("\r\nAddress not found"));
-
98 #endif
-
99  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
-
100  }
-
101 
-
102  if (!p->epinfo) {
-
103 #ifdef DEBUG
-
104  Notify(PSTR("\r\nepinfo is null"));
-
105 #endif
-
106  return USB_ERROR_EPINFO_IS_NULL;
-
107  }
+
25 XBOXRECV::XBOXRECV(USB *p):
+
26 pUsb(p), // pointer to USB class instance - mandatory
+
27 bAddress(0), // device address - mandatory
+
28 bPollEnable(false) { // don't start polling before dongle is connected
+
29  for(uint8_t i=0; i<XBOX_MAX_ENDPOINTS; i++) {
+
30  epInfo[i].epAddr = 0;
+
31  epInfo[i].maxPktSize = (i) ? 0 : 8;
+
32  epInfo[i].epAttribs = 0;
+
33  epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
+
34  }
+
35 
+
36  if (pUsb) // register in USB subsystem
+
37  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
+
38 }
+
39 
+
40 uint8_t XBOXRECV::Init(uint8_t parent, uint8_t port, bool lowspeed) {
+
41  uint8_t buf[sizeof(USB_DEVICE_DESCRIPTOR)];
+
42  uint8_t rcode;
+
43  UsbDevice *p = NULL;
+
44  EpInfo *oldep_ptr = NULL;
+
45  uint16_t PID;
+
46  uint16_t VID;
+
47 
+
48  // get memory address of USB device address pool
+
49  AddressPool &addrPool = pUsb->GetAddressPool();
+
50 #ifdef EXTRADEBUG
+
51  Notify(PSTR("\r\nXBOXRECV Init"));
+
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"));
+
57 #endif
+
58  return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
+
59  }
+
60 
+
61  // Get pointer to pseudo device with address 0 assigned
+
62  p = addrPool.GetUsbDevicePtr(0);
+
63 
+
64  if (!p) {
+
65 #ifdef DEBUG
+
66  Notify(PSTR("\r\nAddress not found"));
+
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"));
+
74 #endif
+
75  return USB_ERROR_EPINFO_IS_NULL;
+
76  }
+
77 
+
78  // Save old pointer to EP_RECORD of address 0
+
79  oldep_ptr = p->epinfo;
+
80 
+
81  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
+
82  p->epinfo = epInfo;
+
83 
+
84  p->lowspeed = lowspeed;
+
85 
+
86  // Get device descriptor
+
87  rcode = pUsb->getDevDescr(0, 0, sizeof(USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);// Get device descriptor - addr, ep, nbytes, data
+
88  // Restore p->epinfo
+
89  p->epinfo = oldep_ptr;
+
90 
+
91  if(rcode)
+
92  goto FailGetDevDescr;
+
93 
+
94  VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
+
95  PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
+
96 
+
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"));
+
102 #endif
+
103  goto FailUnknownDevice;
+
104  }
+
105 
+
106  // Allocate new address according to device class
+
107  bAddress = addrPool.AllocAddress(parent, false, port);
108 
-
109  // Save old pointer to EP_RECORD of address 0
-
110  oldep_ptr = p->epinfo;
+
109  if (!bAddress)
+
110  return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
111 
-
112  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
-
113  p->epinfo = epInfo;
+
112  // Extract Max Packet Size from device descriptor
+
113  epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0;
114 
-
115  p->lowspeed = lowspeed;
-
116 
-
117  // Get device descriptor
-
118  rcode = pUsb->getDevDescr(0, 0, sizeof(USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);// Get device descriptor - addr, ep, nbytes, data
-
119  // Restore p->epinfo
-
120  p->epinfo = oldep_ptr;
-
121 
-
122  if(rcode)
-
123  goto FailGetDevDescr;
-
124 
-
125  VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
-
126  PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
-
127 
-
128  if(VID != XBOX_VID && VID != MADCATZ_VID) // We just check if it's a xbox receiver using the Vendor ID
-
129  goto FailUnknownDevice;
-
130  else if(PID != XBOX_WIRELESS_RECEIVER_PID && PID != XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID) {
-
131 #ifdef DEBUG
-
132  Notify(PSTR("\r\nYou'll need a wireless receiver for this libary to work"));
-
133 #endif
-
134  goto FailUnknownDevice;
-
135  }
-
136 
-
137  // Allocate new address according to device class
-
138  bAddress = addrPool.AllocAddress(parent, false, port);
+
115  // Assign new address to the device
+
116  rcode = pUsb->setAddr( 0, 0, bAddress );
+
117  if (rcode) {
+
118  p->lowspeed = false;
+
119  addrPool.FreeAddress(bAddress);
+
120  bAddress = 0;
+
121 #ifdef DEBUG
+
122  Notify(PSTR("\r\nsetAddr: "));
+
123 #endif
+
124  PrintHex<uint8_t>(rcode);
+
125  return rcode;
+
126  }
+
127 #ifdef EXTRADEBUG
+
128  Notify(PSTR("\r\nAddr: "));
+
129  PrintHex<uint8_t>(bAddress);
+
130 #endif
+
131  p->lowspeed = false;
+
132 
+
133  //get pointer to assigned address record
+
134  p = addrPool.GetUsbDevicePtr(bAddress);
+
135  if (!p)
+
136  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
+
137 
+
138  p->lowspeed = lowspeed;
139 
-
140  if (!bAddress)
-
141  return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
-
142 
-
143  // Extract Max Packet Size from device descriptor
-
144  epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0;
-
145 
-
146  // Assign new address to the device
-
147  rcode = pUsb->setAddr( 0, 0, bAddress );
-
148  if (rcode) {
-
149  p->lowspeed = false;
-
150  addrPool.FreeAddress(bAddress);
-
151  bAddress = 0;
-
152 #ifdef DEBUG
-
153  Notify(PSTR("\r\nsetAddr: "));
-
154 #endif
-
155  PrintHex<uint8_t>(rcode);
-
156  return rcode;
-
157  }
-
158 #ifdef EXTRADEBUG
-
159  Notify(PSTR("\r\nAddr: "));
-
160  PrintHex<uint8_t>(bAddress);
-
161 #endif
-
162  p->lowspeed = false;
-
163 
-
164  //get pointer to assigned address record
-
165  p = addrPool.GetUsbDevicePtr(bAddress);
-
166  if (!p)
-
167  return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
-
168 
-
169  p->lowspeed = lowspeed;
-
170 
-
171  // Assign epInfo to epinfo pointer - only EP0 is known
-
172  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
-
173  if (rcode)
-
174  goto FailSetDevTblEntry;
-
175 
-
176  /* The application will work in reduced host mode, so we can save program and data
-
177  memory space. After verifying the VID we will use known values for the
-
178  configuration values for device, interface, endpoints and HID for the XBOX360 Wireless receiver */
-
179 
-
180  /* Initialize data structures for endpoints of device */
-
181  epInfo[ XBOX_INPUT_PIPE_1 ].epAddr = 0x01; // XBOX 360 report endpoint - poll interval 1ms
-
182  epInfo[ XBOX_INPUT_PIPE_1 ].epAttribs = EP_INTERRUPT;
-
183  epInfo[ XBOX_INPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
-
184  epInfo[ XBOX_INPUT_PIPE_1 ].maxPktSize = EP_MAXPKTSIZE;
-
185  epInfo[ XBOX_INPUT_PIPE_1 ].bmSndToggle = bmSNDTOG0;
-
186  epInfo[ XBOX_INPUT_PIPE_1 ].bmRcvToggle = bmRCVTOG0;
-
187  epInfo[ XBOX_OUTPUT_PIPE_1 ].epAddr = 0x01; // XBOX 360 output endpoint - poll interval 8ms
-
188  epInfo[ XBOX_OUTPUT_PIPE_1 ].epAttribs = EP_INTERRUPT;
-
189  epInfo[ XBOX_OUTPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
-
190  epInfo[ XBOX_OUTPUT_PIPE_1 ].maxPktSize = EP_MAXPKTSIZE;
-
191  epInfo[ XBOX_OUTPUT_PIPE_1 ].bmSndToggle = bmSNDTOG0;
-
192  epInfo[ XBOX_OUTPUT_PIPE_1 ].bmRcvToggle = bmRCVTOG0;
-
193 
-
194  epInfo[ XBOX_INPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 report endpoint - poll interval 1ms
-
195  epInfo[ XBOX_INPUT_PIPE_2 ].epAttribs = EP_INTERRUPT;
-
196  epInfo[ XBOX_INPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
-
197  epInfo[ XBOX_INPUT_PIPE_2 ].maxPktSize = EP_MAXPKTSIZE;
-
198  epInfo[ XBOX_INPUT_PIPE_2 ].bmSndToggle = bmSNDTOG0;
-
199  epInfo[ XBOX_INPUT_PIPE_2 ].bmRcvToggle = bmRCVTOG0;
-
200  epInfo[ XBOX_OUTPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 output endpoint - poll interval 8ms
-
201  epInfo[ XBOX_OUTPUT_PIPE_2 ].epAttribs = EP_INTERRUPT;
-
202  epInfo[ XBOX_OUTPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
-
203  epInfo[ XBOX_OUTPUT_PIPE_2 ].maxPktSize = EP_MAXPKTSIZE;
-
204  epInfo[ XBOX_OUTPUT_PIPE_2 ].bmSndToggle = bmSNDTOG0;
-
205  epInfo[ XBOX_OUTPUT_PIPE_2 ].bmRcvToggle = bmRCVTOG0;
-
206 
-
207  epInfo[ XBOX_INPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 report endpoint - poll interval 1ms
-
208  epInfo[ XBOX_INPUT_PIPE_3 ].epAttribs = EP_INTERRUPT;
-
209  epInfo[ XBOX_INPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
-
210  epInfo[ XBOX_INPUT_PIPE_3 ].maxPktSize = EP_MAXPKTSIZE;
-
211  epInfo[ XBOX_INPUT_PIPE_3 ].bmSndToggle = bmSNDTOG0;
-
212  epInfo[ XBOX_INPUT_PIPE_3 ].bmRcvToggle = bmRCVTOG0;
-
213  epInfo[ XBOX_OUTPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 output endpoint - poll interval 8ms
-
214  epInfo[ XBOX_OUTPUT_PIPE_3 ].epAttribs = EP_INTERRUPT;
-
215  epInfo[ XBOX_OUTPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
-
216  epInfo[ XBOX_OUTPUT_PIPE_3 ].maxPktSize = EP_MAXPKTSIZE;
-
217  epInfo[ XBOX_OUTPUT_PIPE_3 ].bmSndToggle = bmSNDTOG0;
-
218  epInfo[ XBOX_OUTPUT_PIPE_3 ].bmRcvToggle = bmRCVTOG0;
-
219 
-
220  epInfo[ XBOX_INPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 report endpoint - poll interval 1ms
-
221  epInfo[ XBOX_INPUT_PIPE_4 ].epAttribs = EP_INTERRUPT;
-
222  epInfo[ XBOX_INPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
-
223  epInfo[ XBOX_INPUT_PIPE_4 ].maxPktSize = EP_MAXPKTSIZE;
-
224  epInfo[ XBOX_INPUT_PIPE_4 ].bmSndToggle = bmSNDTOG0;
-
225  epInfo[ XBOX_INPUT_PIPE_4 ].bmRcvToggle = bmRCVTOG0;
-
226  epInfo[ XBOX_OUTPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 output endpoint - poll interval 8ms
-
227  epInfo[ XBOX_OUTPUT_PIPE_4 ].epAttribs = EP_INTERRUPT;
-
228  epInfo[ XBOX_OUTPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
-
229  epInfo[ XBOX_OUTPUT_PIPE_4 ].maxPktSize = EP_MAXPKTSIZE;
-
230  epInfo[ XBOX_OUTPUT_PIPE_4 ].bmSndToggle = bmSNDTOG0;
-
231  epInfo[ XBOX_OUTPUT_PIPE_4 ].bmRcvToggle = bmRCVTOG0;
-
232 
-
233  rcode = pUsb->setEpInfoEntry(bAddress, 9, epInfo);
-
234  if( rcode )
-
235  goto FailSetDevTblEntry;
-
236 
-
237  delay(200);//Give time for address change
-
238 
-
239  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
-
240  if( rcode )
-
241  goto FailSetConf;
-
242 
-
243 #ifdef DEBUG
-
244  Notify(PSTR("\r\nXbox Wireless Receiver Connected\r\n"));
-
245 #endif
-
246  XboxReceiverConnected = true;
-
247  bPollEnable = true;
-
248  return 0; // successful configuration
-
249 
-
250  /* diagnostic messages */
-
251 FailGetDevDescr:
-
252 #ifdef DEBUG
-
253  Notify(PSTR("\r\ngetDevDescr:"));
-
254 #endif
-
255  goto Fail;
-
256 FailSetDevTblEntry:
-
257 #ifdef DEBUG
-
258  Notify(PSTR("\r\nsetDevTblEn:"));
-
259 #endif
-
260  goto Fail;
-
261 FailSetConf:
-
262 #ifdef DEBUG
-
263  Notify(PSTR("\r\nsetConf:"));
-
264 #endif
-
265  goto Fail;
-
266 FailUnknownDevice:
-
267 #ifdef DEBUG
-
268  Notify(PSTR("\r\nUnknown Device Connected - VID: "));
-
269  PrintHex<uint16_t>(VID);
-
270  Notify(PSTR(" PID: "));
-
271  PrintHex<uint16_t>(PID);
-
272 #endif
-
273  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
-
274  goto Fail;
-
275 Fail:
-
276 #ifdef DEBUG
-
277  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "));
-
278  Serial.print(rcode,HEX);
-
279 #endif
-
280  Release();
-
281  return rcode;
-
282 }
-
283 
-
284 /* Performs a cleanup after failed Init() attempt */
-
285 uint8_t XBOXRECV::Release() {
-
286  XboxReceiverConnected = false;
-
287  for(uint8_t i=0;i<4;i++)
-
288  Xbox360Connected[i] = 0x00;
-
289  pUsb->GetAddressPool().FreeAddress(bAddress);
-
290  bAddress = 0;
-
291  bPollEnable = false;
-
292  return 0;
-
293 }
-
294 uint8_t XBOXRECV::Poll() {
-
295  if (!bPollEnable)
-
296  return 0;
-
297  if(!timer || ((millis() - timer) > 3000)) { // Run checkStatus every 3 seconds
-
298  timer = millis();
-
299  checkStatus();
-
300  }
-
301  uint8_t inputPipe;
-
302  uint16_t bufferSize;
-
303  for(uint8_t i=0;i<4;i++) {
-
304  switch (i) {
-
305  case 0: inputPipe = XBOX_INPUT_PIPE_1; break;
-
306  case 1: inputPipe = XBOX_INPUT_PIPE_2; break;
-
307  case 2: inputPipe = XBOX_INPUT_PIPE_3; break;
-
308  case 3: inputPipe = XBOX_INPUT_PIPE_4; break;
-
309  }
-
310  bufferSize = EP_MAXPKTSIZE; // This is the maximum number of bytes we want to receive
-
311  pUsb->inTransfer(bAddress, epInfo[ inputPipe ].epAddr, &bufferSize, readBuf);
-
312  if(bufferSize > 0) { // The number of received bytes
-
313 #ifdef EXTRADEBUG
-
314  Notify(PSTR("Bytes Received: "));
-
315  Serial.print(bufferSize);
-
316  Notify(PSTR("\r\n"));
-
317 #endif
-
318  readReport(i);
-
319 #ifdef PRINTREPORT
-
320  printReport(i,bufferSize); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
-
321 #endif
-
322  }
-
323  }
-
324  return 0;
-
325 }
-
326 
-
327 void XBOXRECV::readReport(uint8_t controller) {
-
328  if (readBuf == NULL)
-
329  return;
-
330  // This report is send when a controller is connected and disconnected
-
331  if(readBuf[0] == 0x08 && readBuf[1] != Xbox360Connected[controller]) {
-
332  Xbox360Connected[controller] = readBuf[1];
-
333 #ifdef DEBUG
-
334  Notify(PSTR("Controller "));
-
335  Serial.print(controller);
-
336 #endif
-
337  if(Xbox360Connected[controller]) {
-
338 #ifdef DEBUG
-
339  char* str = 0;
-
340  switch(readBuf[1]) {
-
341  case 0x80: str = PSTR(" as controller\r\n"); break;
-
342  case 0x40: str = PSTR(" as headset\r\n"); break;
-
343  case 0xC0: str = PSTR(" as controller+headset\r\n"); break;
-
344  }
-
345  Notify(PSTR(": connected"));
-
346  Notify(str);
-
347 #endif
-
348  LED led;
-
349  switch (controller) {
-
350  case 0: led = LED1; break;
-
351  case 1: led = LED2; break;
-
352  case 2: led = LED3; break;
-
353  case 3: led = LED4; break;
-
354  }
-
355  setLedOn(controller,led);
-
356  }
-
357 #ifdef DEBUG
-
358  else
-
359  Notify(PSTR(": disconnected\r\n"));
-
360 #endif
-
361  return;
+
140  // Assign epInfo to epinfo pointer - only EP0 is known
+
141  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
+
142  if (rcode)
+
143  goto FailSetDevTblEntry;
+
144 
+
145  /* The application will work in reduced host mode, so we can save program and data
+
146  memory space. After verifying the VID we will use known values for the
+
147  configuration values for device, interface, endpoints and HID for the XBOX360 Wireless receiver */
+
148 
+
149  /* Initialize data structures for endpoints of device */
+
150  epInfo[ XBOX_INPUT_PIPE_1 ].epAddr = 0x01; // XBOX 360 report endpoint - poll interval 1ms
+
151  epInfo[ XBOX_INPUT_PIPE_1 ].epAttribs = EP_INTERRUPT;
+
152  epInfo[ XBOX_INPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+
153  epInfo[ XBOX_INPUT_PIPE_1 ].maxPktSize = EP_MAXPKTSIZE;
+
154  epInfo[ XBOX_INPUT_PIPE_1 ].bmSndToggle = bmSNDTOG0;
+
155  epInfo[ XBOX_INPUT_PIPE_1 ].bmRcvToggle = bmRCVTOG0;
+
156  epInfo[ XBOX_OUTPUT_PIPE_1 ].epAddr = 0x01; // XBOX 360 output endpoint - poll interval 8ms
+
157  epInfo[ XBOX_OUTPUT_PIPE_1 ].epAttribs = EP_INTERRUPT;
+
158  epInfo[ XBOX_OUTPUT_PIPE_1 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+
159  epInfo[ XBOX_OUTPUT_PIPE_1 ].maxPktSize = EP_MAXPKTSIZE;
+
160  epInfo[ XBOX_OUTPUT_PIPE_1 ].bmSndToggle = bmSNDTOG0;
+
161  epInfo[ XBOX_OUTPUT_PIPE_1 ].bmRcvToggle = bmRCVTOG0;
+
162 
+
163  epInfo[ XBOX_INPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 report endpoint - poll interval 1ms
+
164  epInfo[ XBOX_INPUT_PIPE_2 ].epAttribs = EP_INTERRUPT;
+
165  epInfo[ XBOX_INPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+
166  epInfo[ XBOX_INPUT_PIPE_2 ].maxPktSize = EP_MAXPKTSIZE;
+
167  epInfo[ XBOX_INPUT_PIPE_2 ].bmSndToggle = bmSNDTOG0;
+
168  epInfo[ XBOX_INPUT_PIPE_2 ].bmRcvToggle = bmRCVTOG0;
+
169  epInfo[ XBOX_OUTPUT_PIPE_2 ].epAddr = 0x03; // XBOX 360 output endpoint - poll interval 8ms
+
170  epInfo[ XBOX_OUTPUT_PIPE_2 ].epAttribs = EP_INTERRUPT;
+
171  epInfo[ XBOX_OUTPUT_PIPE_2 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+
172  epInfo[ XBOX_OUTPUT_PIPE_2 ].maxPktSize = EP_MAXPKTSIZE;
+
173  epInfo[ XBOX_OUTPUT_PIPE_2 ].bmSndToggle = bmSNDTOG0;
+
174  epInfo[ XBOX_OUTPUT_PIPE_2 ].bmRcvToggle = bmRCVTOG0;
+
175 
+
176  epInfo[ XBOX_INPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 report endpoint - poll interval 1ms
+
177  epInfo[ XBOX_INPUT_PIPE_3 ].epAttribs = EP_INTERRUPT;
+
178  epInfo[ XBOX_INPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+
179  epInfo[ XBOX_INPUT_PIPE_3 ].maxPktSize = EP_MAXPKTSIZE;
+
180  epInfo[ XBOX_INPUT_PIPE_3 ].bmSndToggle = bmSNDTOG0;
+
181  epInfo[ XBOX_INPUT_PIPE_3 ].bmRcvToggle = bmRCVTOG0;
+
182  epInfo[ XBOX_OUTPUT_PIPE_3 ].epAddr = 0x05; // XBOX 360 output endpoint - poll interval 8ms
+
183  epInfo[ XBOX_OUTPUT_PIPE_3 ].epAttribs = EP_INTERRUPT;
+
184  epInfo[ XBOX_OUTPUT_PIPE_3 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+
185  epInfo[ XBOX_OUTPUT_PIPE_3 ].maxPktSize = EP_MAXPKTSIZE;
+
186  epInfo[ XBOX_OUTPUT_PIPE_3 ].bmSndToggle = bmSNDTOG0;
+
187  epInfo[ XBOX_OUTPUT_PIPE_3 ].bmRcvToggle = bmRCVTOG0;
+
188 
+
189  epInfo[ XBOX_INPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 report endpoint - poll interval 1ms
+
190  epInfo[ XBOX_INPUT_PIPE_4 ].epAttribs = EP_INTERRUPT;
+
191  epInfo[ XBOX_INPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+
192  epInfo[ XBOX_INPUT_PIPE_4 ].maxPktSize = EP_MAXPKTSIZE;
+
193  epInfo[ XBOX_INPUT_PIPE_4 ].bmSndToggle = bmSNDTOG0;
+
194  epInfo[ XBOX_INPUT_PIPE_4 ].bmRcvToggle = bmRCVTOG0;
+
195  epInfo[ XBOX_OUTPUT_PIPE_4 ].epAddr = 0x07; // XBOX 360 output endpoint - poll interval 8ms
+
196  epInfo[ XBOX_OUTPUT_PIPE_4 ].epAttribs = EP_INTERRUPT;
+
197  epInfo[ XBOX_OUTPUT_PIPE_4 ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+
198  epInfo[ XBOX_OUTPUT_PIPE_4 ].maxPktSize = EP_MAXPKTSIZE;
+
199  epInfo[ XBOX_OUTPUT_PIPE_4 ].bmSndToggle = bmSNDTOG0;
+
200  epInfo[ XBOX_OUTPUT_PIPE_4 ].bmRcvToggle = bmRCVTOG0;
+
201 
+
202  rcode = pUsb->setEpInfoEntry(bAddress, 9, epInfo);
+
203  if( rcode )
+
204  goto FailSetDevTblEntry;
+
205 
+
206  delay(200);//Give time for address change
+
207 
+
208  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
+
209  if( rcode )
+
210  goto FailSetConf;
+
211 
+
212 #ifdef DEBUG
+
213  Notify(PSTR("\r\nXbox Wireless Receiver Connected\r\n"));
+
214 #endif
+
215  XboxReceiverConnected = true;
+
216  bPollEnable = true;
+
217  return 0; // successful configuration
+
218 
+
219  /* diagnostic messages */
+
220 FailGetDevDescr:
+
221 #ifdef DEBUG
+
222  Notify(PSTR("\r\ngetDevDescr:"));
+
223 #endif
+
224  goto Fail;
+
225 FailSetDevTblEntry:
+
226 #ifdef DEBUG
+
227  Notify(PSTR("\r\nsetDevTblEn:"));
+
228 #endif
+
229  goto Fail;
+
230 FailSetConf:
+
231 #ifdef DEBUG
+
232  Notify(PSTR("\r\nsetConf:"));
+
233 #endif
+
234  goto Fail;
+
235 FailUnknownDevice:
+
236 #ifdef DEBUG
+
237  Notify(PSTR("\r\nUnknown Device Connected - VID: "));
+
238  PrintHex<uint16_t>(VID);
+
239  Notify(PSTR(" PID: "));
+
240  PrintHex<uint16_t>(PID);
+
241 #endif
+
242  rcode = USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED;
+
243  goto Fail;
+
244 Fail:
+
245 #ifdef DEBUG
+
246  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "));
+
247  Serial.print(rcode,HEX);
+
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 uint8_t XBOXRECV::Poll() {
+
264  if (!bPollEnable)
+
265  return 0;
+
266  if(!timer || ((millis() - timer) > 3000)) { // Run checkStatus every 3 seconds
+
267  timer = millis();
+
268  checkStatus();
+
269  }
+
270  uint8_t inputPipe;
+
271  uint16_t bufferSize;
+
272  for(uint8_t i=0;i<4;i++) {
+
273  switch (i) {
+
274  case 0: inputPipe = XBOX_INPUT_PIPE_1; break;
+
275  case 1: inputPipe = XBOX_INPUT_PIPE_2; break;
+
276  case 2: inputPipe = XBOX_INPUT_PIPE_3; break;
+
277  case 3: inputPipe = XBOX_INPUT_PIPE_4; break;
+
278  }
+
279  bufferSize = EP_MAXPKTSIZE; // This is the maximum number of bytes we want to receive
+
280  pUsb->inTransfer(bAddress, epInfo[ inputPipe ].epAddr, &bufferSize, readBuf);
+
281  if(bufferSize > 0) { // The number of received bytes
+
282 #ifdef EXTRADEBUG
+
283  Notify(PSTR("Bytes Received: "));
+
284  Serial.print(bufferSize);
+
285  Notify(PSTR("\r\n"));
+
286 #endif
+
287  readReport(i);
+
288 #ifdef PRINTREPORT
+
289  printReport(i,bufferSize); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
+
290 #endif
+
291  }
+
292  }
+
293  return 0;
+
294 }
+
295 
+
296 void XBOXRECV::readReport(uint8_t controller) {
+
297  if (readBuf == NULL)
+
298  return;
+
299  // This report is send when a controller is connected and disconnected
+
300  if(readBuf[0] == 0x08 && readBuf[1] != Xbox360Connected[controller]) {
+
301  Xbox360Connected[controller] = readBuf[1];
+
302 #ifdef DEBUG
+
303  Notify(PSTR("Controller "));
+
304  Serial.print(controller);
+
305 #endif
+
306  if(Xbox360Connected[controller]) {
+
307 #ifdef DEBUG
+
308  char* str = 0;
+
309  switch(readBuf[1]) {
+
310  case 0x80: str = PSTR(" as controller\r\n"); break;
+
311  case 0x40: str = PSTR(" as headset\r\n"); break;
+
312  case 0xC0: str = PSTR(" as controller+headset\r\n"); break;
+
313  }
+
314  Notify(PSTR(": connected"));
+
315  Notify(str);
+
316 #endif
+
317  LED led;
+
318  switch (controller) {
+
319  case 0: led = LED1; break;
+
320  case 1: led = LED2; break;
+
321  case 2: led = LED3; break;
+
322  case 3: led = LED4; break;
+
323  }
+
324  setLedOn(controller,led);
+
325  }
+
326 #ifdef DEBUG
+
327  else
+
328  Notify(PSTR(": disconnected\r\n"));
+
329 #endif
+
330  return;
+
331  }
+
332  // Controller status report
+
333  if(readBuf[1] == 0x00 && readBuf[3] & 0x13 && readBuf[4] >= 0x22) {
+
334  controllerStatus[controller] = ((uint16_t)readBuf[3] << 8) | readBuf[4];
+
335  return;
+
336  }
+
337  if(readBuf[1] != 0x01) // Check if it's the correct report - the receiver also sends different status reports
+
338  return;
+
339 
+
340  // A controller must be connected if it's sending data
+
341  if(!Xbox360Connected[controller])
+
342  Xbox360Connected[controller] |= 0x80;
+
343 
+
344  ButtonState[controller] = (uint32_t)(readBuf[9] | ((uint16_t)readBuf[8] << 8) | ((uint32_t)readBuf[7] << 16) | ((uint32_t)readBuf[6] << 24));
+
345 
+
346  hatValue[controller][LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
+
347  hatValue[controller][LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
+
348  hatValue[controller][RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
+
349  hatValue[controller][RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
+
350 
+
351  //Notify(PSTR("\r\nButtonState: "));
+
352  //PrintHex<uint32_t>(ButtonState[controller]);
+
353 
+
354  if(ButtonState[controller] != OldButtonState[controller]) {
+
355  buttonStateChanged[controller] = true;
+
356  ButtonClickState[controller] = (ButtonState[controller] >> 16) & ((~OldButtonState[controller]) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
+
357  if(((uint8_t)OldButtonState[controller]) == 0 && ((uint8_t)ButtonState[controller]) != 0) // The L2 and R2 buttons are special as they are analog buttons
+
358  R2Clicked[controller] = true;
+
359  if((uint8_t)(OldButtonState[controller] >> 8) == 0 && (uint8_t)(ButtonState[controller] >> 8) != 0)
+
360  L2Clicked[controller] = true;
+
361  OldButtonState[controller] = ButtonState[controller];
362  }
-
363  // Controller status report
-
364  if(readBuf[1] == 0x00 && readBuf[3] & 0x13 && readBuf[4] >= 0x22) {
-
365  controllerStatus[controller] = ((uint16_t)readBuf[3] << 8) | readBuf[4];
-
366  return;
-
367  }
-
368  if(readBuf[1] != 0x01) // Check if it's the correct report - the receiver also sends different status reports
-
369  return;
-
370 
-
371  // A controller must be connected if it's sending data
-
372  if(!Xbox360Connected[controller])
-
373  Xbox360Connected[controller] |= 0x80;
-
374 
-
375  ButtonState[controller] = (uint32_t)(readBuf[9] | ((uint16_t)readBuf[8] << 8) | ((uint32_t)readBuf[7] << 16) | ((uint32_t)readBuf[6] << 24));
-
376 
-
377  hatValue[controller][LeftHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
-
378  hatValue[controller][LeftHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
-
379  hatValue[controller][RightHatX] = (int16_t)(((uint16_t)readBuf[15] << 8) | readBuf[14]);
-
380  hatValue[controller][RightHatY] = (int16_t)(((uint16_t)readBuf[17] << 8) | readBuf[16]);
-
381 
-
382  //Notify(PSTR("\r\nButtonState: "));
-
383  //PrintHex<uint32_t>(ButtonState[controller]);
-
384 
-
385  if(ButtonState[controller] != OldButtonState[controller]) {
-
386  buttonStateChanged[controller] = true;
-
387  ButtonClickState[controller] = (ButtonState[controller] >> 16) & ((~OldButtonState[controller]) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
-
388  if(((uint8_t)OldButtonState[controller]) == 0 && ((uint8_t)ButtonState[controller]) != 0) // The L2 and R2 buttons are special as they are analog buttons
-
389  R2Clicked[controller] = true;
-
390  if((uint8_t)(OldButtonState[controller] >> 8) == 0 && (uint8_t)(ButtonState[controller] >> 8) != 0)
-
391  L2Clicked[controller] = true;
-
392  OldButtonState[controller] = ButtonState[controller];
+
363 }
+
364 
+
365 void XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
+
366 #ifdef PRINTREPORT
+
367  if (readBuf == NULL)
+
368  return;
+
369  Notify(PSTR("Controller "));
+
370  Serial.print(controller);
+
371  Notify(PSTR(": "));
+
372  for(uint8_t i = 0; i < nBytes;i++) {
+
373  PrintHex<uint8_t>(readBuf[i]);
+
374  Serial.print(" ");
+
375  }
+
376  Serial.println();
+
377 #endif
+
378 }
+
379 uint8_t XBOXRECV::getButtonPress(uint8_t controller, Button b) {
+
380  if(b == L2) // These are analog buttons
+
381  return (uint8_t)(ButtonState[controller] >> 8);
+
382  else if(b == R2)
+
383  return (uint8_t)ButtonState[controller];
+
384  return (ButtonState[controller] & ((uint32_t)pgm_read_word(&BUTTONS[(uint8_t)b]) << 16));
+
385 }
+
386 bool XBOXRECV::getButtonClick(uint8_t controller, Button b) {
+
387  if(b == L2) {
+
388  if(L2Clicked[controller]) {
+
389  L2Clicked[controller] = false;
+
390  return true;
+
391  }
+
392  return false;
393  }
-
394 }
-
395 
-
396 void XBOXRECV::printReport(uint8_t controller, uint8_t nBytes) { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
-
397 #ifdef PRINTREPORT
-
398  if (readBuf == NULL)
-
399  return;
-
400  Notify(PSTR("Controller "));
-
401  Serial.print(controller);
-
402  Notify(PSTR(": "));
-
403  for(uint8_t i = 0; i < nBytes;i++) {
-
404  PrintHex<uint8_t>(readBuf[i]);
-
405  Serial.print(" ");
-
406  }
-
407  Serial.println();
-
408 #endif
-
409 }
-
410 uint8_t XBOXRECV::getButtonPress(uint8_t controller, Button b) {
-
411  if(b == L2) // These are analog buttons
-
412  return (uint8_t)(ButtonState[controller] >> 8);
-
413  else if(b == R2)
-
414  return (uint8_t)ButtonState[controller];
-
415  return (ButtonState[controller] & ((uint32_t)pgm_read_word(&BUTTONS[(uint8_t)b]) << 16));
-
416 }
-
417 bool XBOXRECV::getButtonClick(uint8_t controller, Button b) {
-
418  if(b == L2) {
-
419  if(L2Clicked[controller]) {
-
420  L2Clicked[controller] = false;
-
421  return true;
-
422  }
-
423  return false;
-
424  }
-
425  else if(b == R2) {
-
426  if(R2Clicked[controller]) {
-
427  R2Clicked[controller] = false;
-
428  return true;
-
429  }
-
430  return false;
-
431  }
-
432  uint16_t button = pgm_read_word(&BUTTONS[(uint8_t)b]);
-
433  bool click = (ButtonClickState[controller] & button);
-
434  ButtonClickState[controller] &= ~button; // clear "click" event
-
435  return click;
-
436 }
-
437 int16_t XBOXRECV::getAnalogHat(uint8_t controller, AnalogHat a) {
-
438  return hatValue[controller][a];
-
439 }
-
440 bool XBOXRECV::buttonChanged(uint8_t controller) {
-
441  bool state = buttonStateChanged[controller];
-
442  buttonStateChanged[controller] = false;
-
443  return state;
-
444 }
-
445 /*
-
446 ControllerStatus Breakdown
-
447  ControllerStatus[controller] & 0x0001 // 0
-
448  ControllerStatus[controller] & 0x0002 // normal batteries, no rechargeable battery pack
-
449  ControllerStatus[controller] & 0x0004 // controller starting up / settling
-
450  ControllerStatus[controller] & 0x0008 // headset adapter plugged in, but no headphones connected (mute?)
-
451  ControllerStatus[controller] & 0x0010 // 0
-
452  ControllerStatus[controller] & 0x0020 // 1
-
453  ControllerStatus[controller] & 0x0040 // battery level (high bit)
-
454  ControllerStatus[controller] & 0x0080 // battery level (low bit)
-
455  ControllerStatus[controller] & 0x0100 // 1
-
456  ControllerStatus[controller] & 0x0200 // 1
-
457  ControllerStatus[controller] & 0x0400 // headset adapter plugged in
-
458  ControllerStatus[controller] & 0x0800 // 0
-
459  ControllerStatus[controller] & 0x1000 // 1
-
460  ControllerStatus[controller] & 0x2000 // 0
-
461  ControllerStatus[controller] & 0x4000 // 0
-
462  ControllerStatus[controller] & 0x8000 // 0
-
463 */
-
464 uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
-
465  uint8_t batteryLevel = ((controllerStatus[controller] & 0x00C0) >> 6) * 33;
-
466  if(batteryLevel == 99)
-
467  batteryLevel = 100;
-
468  return batteryLevel;
+
394  else if(b == R2) {
+
395  if(R2Clicked[controller]) {
+
396  R2Clicked[controller] = false;
+
397  return true;
+
398  }
+
399  return false;
+
400  }
+
401  uint16_t button = pgm_read_word(&BUTTONS[(uint8_t)b]);
+
402  bool click = (ButtonClickState[controller] & button);
+
403  ButtonClickState[controller] &= ~button; // clear "click" event
+
404  return click;
+
405 }
+
406 int16_t XBOXRECV::getAnalogHat(uint8_t controller, AnalogHat a) {
+
407  return hatValue[controller][a];
+
408 }
+
409 bool XBOXRECV::buttonChanged(uint8_t controller) {
+
410  bool state = buttonStateChanged[controller];
+
411  buttonStateChanged[controller] = false;
+
412  return state;
+
413 }
+
414 /*
+
415 ControllerStatus Breakdown
+
416  ControllerStatus[controller] & 0x0001 // 0
+
417  ControllerStatus[controller] & 0x0002 // normal batteries, no rechargeable battery pack
+
418  ControllerStatus[controller] & 0x0004 // controller starting up / settling
+
419  ControllerStatus[controller] & 0x0008 // headset adapter plugged in, but no headphones connected (mute?)
+
420  ControllerStatus[controller] & 0x0010 // 0
+
421  ControllerStatus[controller] & 0x0020 // 1
+
422  ControllerStatus[controller] & 0x0040 // battery level (high bit)
+
423  ControllerStatus[controller] & 0x0080 // battery level (low bit)
+
424  ControllerStatus[controller] & 0x0100 // 1
+
425  ControllerStatus[controller] & 0x0200 // 1
+
426  ControllerStatus[controller] & 0x0400 // headset adapter plugged in
+
427  ControllerStatus[controller] & 0x0800 // 0
+
428  ControllerStatus[controller] & 0x1000 // 1
+
429  ControllerStatus[controller] & 0x2000 // 0
+
430  ControllerStatus[controller] & 0x4000 // 0
+
431  ControllerStatus[controller] & 0x8000 // 0
+
432 */
+
433 uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
+
434  uint8_t batteryLevel = ((controllerStatus[controller] & 0x00C0) >> 6) * 33;
+
435  if(batteryLevel == 99)
+
436  batteryLevel = 100;
+
437  return batteryLevel;
+
438 }
+
439 
+
440 void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
+
441  uint8_t rcode;
+
442  uint8_t outputPipe;
+
443  switch (controller) {
+
444  case 0: outputPipe = XBOX_OUTPUT_PIPE_1; break;
+
445  case 1: outputPipe = XBOX_OUTPUT_PIPE_2; break;
+
446  case 2: outputPipe = XBOX_OUTPUT_PIPE_3; break;
+
447  case 3: outputPipe = XBOX_OUTPUT_PIPE_4; break;
+
448  }
+
449  rcode = pUsb->outTransfer(bAddress, epInfo[ outputPipe ].epAddr, nbytes, data);
+
450 #ifdef EXTRADEBUG
+
451  if(rcode)
+
452  Notify(PSTR("Error sending Xbox message\r\n"));
+
453 #endif
+
454 }
+
455 void XBOXRECV::setLedRaw(uint8_t controller, uint8_t value) {
+
456  writeBuf[0] = 0x00;
+
457  writeBuf[1] = 0x00;
+
458  writeBuf[2] = 0x08;
+
459  writeBuf[3] = value | 0x40;
+
460 
+
461  XboxCommand(controller, writeBuf, 4);
+
462 }
+
463 void XBOXRECV::setLedOn(uint8_t controller, LED led) {
+
464  if(led != ALL) // All LEDs can't be on a the same time
+
465  setLedRaw(controller,(pgm_read_byte(&LEDS[(uint8_t)led]))+4);
+
466 }
+
467 void XBOXRECV::setLedBlink(uint8_t controller, LED led) {
+
468  setLedRaw(controller,pgm_read_byte(&LEDS[(uint8_t)led]));
469 }
-
470 
-
471 void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
-
472  uint8_t rcode;
-
473  uint8_t outputPipe;
-
474  switch (controller) {
-
475  case 0: outputPipe = XBOX_OUTPUT_PIPE_1; break;
-
476  case 1: outputPipe = XBOX_OUTPUT_PIPE_2; break;
-
477  case 2: outputPipe = XBOX_OUTPUT_PIPE_3; break;
-
478  case 3: outputPipe = XBOX_OUTPUT_PIPE_4; break;
-
479  }
-
480  rcode = pUsb->outTransfer(bAddress, epInfo[ outputPipe ].epAddr, nbytes, data);
-
481 #ifdef EXTRADEBUG
-
482  if(rcode)
-
483  Notify(PSTR("Error sending Xbox message\r\n"));
-
484 #endif
-
485 }
-
486 void XBOXRECV::setLedRaw(uint8_t controller, uint8_t value) {
-
487  writeBuf[0] = 0x00;
-
488  writeBuf[1] = 0x00;
-
489  writeBuf[2] = 0x08;
-
490  writeBuf[3] = value | 0x40;
-
491 
-
492  XboxCommand(controller, writeBuf, 4);
-
493 }
-
494 void XBOXRECV::setLedOn(uint8_t controller, LED led) {
-
495  if(led != ALL) // All LEDs can't be on a the same time
-
496  setLedRaw(controller,(pgm_read_byte(&LEDS[(uint8_t)led]))+4);
+
470 void XBOXRECV::setLedMode(uint8_t controller, LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports
+
471  setLedRaw(controller,(uint8_t)ledMode);
+
472 }
+
473 /* PC runs this at interval of approx 2 seconds
+
474 Thanks to BusHound from Perisoft.net for the Windows USB Analysis output
+
475 Found by timstamp.co.uk
+
476 */
+
477 void XBOXRECV::checkStatus() {
+
478  if(!bPollEnable)
+
479  return;
+
480  // Get controller info
+
481  writeBuf[0] = 0x08;
+
482  writeBuf[1] = 0x00;
+
483  writeBuf[2] = 0x0f;
+
484  writeBuf[3] = 0xc0;
+
485  for(uint8_t i=0; i<4; i++) {
+
486  XboxCommand(i, writeBuf, 4);
+
487  }
+
488  // Get battery status
+
489  writeBuf[0] = 0x00;
+
490  writeBuf[1] = 0x00;
+
491  writeBuf[2] = 0x00;
+
492  writeBuf[3] = 0x40;
+
493  for(uint8_t i=0; i<4; i++) {
+
494  if(Xbox360Connected[i])
+
495  XboxCommand(i, writeBuf, 4);
+
496  }
497 }
-
498 void XBOXRECV::setLedBlink(uint8_t controller, LED led) {
-
499  setLedRaw(controller,pgm_read_byte(&LEDS[(uint8_t)led]));
-
500 }
-
501 void XBOXRECV::setLedMode(uint8_t controller, LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports
-
502  setLedRaw(controller,(uint8_t)ledMode);
-
503 }
-
504 /* PC runs this at interval of approx 2 seconds
-
505 Thanks to BusHound from Perisoft.net for the Windows USB Analysis output
-
506 Found by timstamp.co.uk
-
507 */
-
508 void XBOXRECV::checkStatus() {
-
509  if(!bPollEnable)
-
510  return;
-
511  // Get controller info
-
512  writeBuf[0] = 0x08;
-
513  writeBuf[1] = 0x00;
-
514  writeBuf[2] = 0x0f;
-
515  writeBuf[3] = 0xc0;
-
516  for(uint8_t i=0; i<4; i++) {
-
517  XboxCommand(i, writeBuf, 4);
-
518  }
-
519  // Get battery status
-
520  writeBuf[0] = 0x00;
-
521  writeBuf[1] = 0x00;
-
522  writeBuf[2] = 0x00;
-
523  writeBuf[3] = 0x40;
-
524  for(uint8_t i=0; i<4; i++) {
-
525  if(Xbox360Connected[i])
-
526  XboxCommand(i, writeBuf, 4);
-
527  }
-
528 }
-
529 
-
530 void XBOXRECV::setRumbleOn(uint8_t controller, uint8_t lValue, uint8_t rValue) {
-
531  writeBuf[0] = 0x00;
-
532  writeBuf[1] = 0x01;
-
533  writeBuf[2] = 0x0f;
-
534  writeBuf[3] = 0xc0;
-
535  writeBuf[4] = 0x00;
-
536  writeBuf[5] = lValue; // big weight
-
537  writeBuf[6] = rValue; // small weight
-
538 
-
539  XboxCommand(controller, writeBuf, 7);
-
540 }
+
498 
+
499 void XBOXRECV::setRumbleOn(uint8_t controller, uint8_t lValue, uint8_t rValue) {
+
500  writeBuf[0] = 0x00;
+
501  writeBuf[1] = 0x01;
+
502  writeBuf[2] = 0x0f;
+
503  writeBuf[3] = 0xc0;
+
504  writeBuf[4] = 0x00;
+
505  writeBuf[5] = lValue; // big weight
+
506  writeBuf[6] = rValue; // small weight
+
507 
+
508  XboxCommand(controller, writeBuf, 7);
+
509 }
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 cb9ad9c4..1f85365e 100644 --- a/_x_b_o_x_r_e_c_v_8h.html +++ b/_x_b_o_x_r_e_c_v_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: XBOXRECV.h File Reference +USB Host Shield 2.0: XBOXRECV.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -87,21 +87,20 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
+Macros
XBOXRECV.h File Reference
#include "Arduino.h"
#include "Usb.h"
-#include "controllerEnums.h"
+#include "xboxEnums.h"
Include dependency graph for XBOXRECV.h:
- +
This graph shows which files directly or indirectly include this file:
@@ -152,31 +151,8 @@ Macros   #define XBOX_MAX_ENDPOINTS   9   - - - -

-Enumerations

enum  LEDMode { ROTATING = 0x0A, -FASTBLINK = 0x0B, -SLOWBLINK = 0x0C, -ALTERNATING = 0x0D - }
 

Macro Definition Documentation

- -
-
- - - - -
#define EP_INTERRUPT   0x03
-
- -

Definition at line 36 of file XBOXRECV.h.

- -
-
@@ -191,17 +167,17 @@ Enumerations
- +
- +
#define MADCATZ_VID   0x1BAD#define EP_INTERRUPT   0x03
-

Definition at line 54 of file XBOXRECV.h.

+

Definition at line 36 of file XBOXRECV.h.

@@ -231,62 +207,6 @@ Enumerations

Definition at line 40 of file XBOXRECV.h.

-
-
- -
-
- - - - -
#define XBOX_INPUT_PIPE_2   3
-
- -

Definition at line 42 of file XBOXRECV.h.

- -
-
- -
-
- - - - -
#define XBOX_INPUT_PIPE_3   5
-
- -

Definition at line 44 of file XBOXRECV.h.

- -
-
- -
-
- - - - -
#define XBOX_INPUT_PIPE_4   7
-
- -

Definition at line 46 of file XBOXRECV.h.

- -
-
- -
-
- - - - -
#define XBOX_MAX_ENDPOINTS   9
-
- -

Definition at line 56 of file XBOXRECV.h.

-
@@ -301,6 +221,20 @@ Enumerations

Definition at line 41 of file XBOXRECV.h.

+ + + +
+
+ + + + +
#define XBOX_INPUT_PIPE_2   3
+
+ +

Definition at line 42 of file XBOXRECV.h.

+
@@ -315,6 +249,20 @@ Enumerations

Definition at line 43 of file XBOXRECV.h.

+ + + +
+
+ + + + +
#define XBOX_INPUT_PIPE_3   5
+
+ +

Definition at line 44 of file XBOXRECV.h.

+
@@ -329,6 +277,20 @@ Enumerations

Definition at line 45 of file XBOXRECV.h.

+ + + +
+
+ + + + +
#define XBOX_INPUT_PIPE_4   7
+
+ +

Definition at line 46 of file XBOXRECV.h.

+
@@ -387,36 +349,38 @@ Enumerations -

Enumeration Type Documentation

- +
- +
enum LEDMode#define MADCATZ_VID   0x1BAD
-

Enum used to set special LED modes supported by the Xbox controller.

- - - - - -
Enumerator
ROTATING  -
FASTBLINK  -
SLOWBLINK  -
ALTERNATING  -
-

Definition at line 59 of file XBOXRECV.h.

+

Definition at line 54 of file XBOXRECV.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_MAX_ENDPOINTS   9
+
+ +

Definition at line 56 of file XBOXRECV.h.

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 f35cc8e6..3703c45b 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,12 +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 aec8cc5c..5a055b6b 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 @@ -c8c03e815fdc272e10d79b2508f0587f \ No newline at end of file +b706bf6b82e6c4c084191859cdb64634 \ 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 73ba042b..27ca341c 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 1f5c77c5..7293b0f1 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 @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: XBOXRECV.h Source File +USB Host Shield 2.0: XBOXRECV.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
27 #endif
28 
29 #include "Usb.h"
-
30 #include "controllerEnums.h"
+
30 #include "xboxEnums.h"
31 
32 /* Data Xbox 360 taken from descriptors */
33 #define EP_MAXPKTSIZE 32 // max size for data via USB
@@ -142,78 +142,71 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
51 #define XBOX_WIRELESS_RECEIVER_PID 0x0719 // Microsoft Wireless Gaming Receiver
52 #define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID 0x0291 // Third party Wireless Gaming Receiver
53 
-
54 #define MADCATZ_VID 0x1BAD // For unofficial Mad Catz controllers
+
54 #define MADCATZ_VID 0x1BAD // For unofficial Mad Catz receivers
55 
56 #define XBOX_MAX_ENDPOINTS 9
57 
-
59 enum LEDMode {
-
60  ROTATING = 0x0A,
-
61  FASTBLINK = 0x0B,
-
62  SLOWBLINK = 0x0C,
-
63  ALTERNATING = 0x0D,
-
64 };
-
65 
-
71 class XBOXRECV : public USBDeviceConfig {
-
72 public:
-
77  XBOXRECV(USB *pUsb);
-
78 
-
87  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
-
92  virtual uint8_t Release();
-
97  virtual uint8_t Poll();
-
102  virtual uint8_t GetAddress() { return bAddress; };
-
107  virtual bool isReady() { return bPollEnable; };
-
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);
-
137  void setAllOff(uint8_t controller) { setRumbleOn(controller,0,0); setLedOff(controller); };
-
142  void setRumbleOff(uint8_t controller) { setRumbleOn(controller,0,0); };
-
149  void setRumbleOn(uint8_t controller, uint8_t lValue, uint8_t rValue);
-
157  void setLedRaw(uint8_t controller, uint8_t value);
-
162  void setLedOff(uint8_t controller) { setLedRaw(controller,0); };
-
168  void setLedOn(uint8_t controller, LED l);
-
174  void setLedBlink(uint8_t controller, LED l);
-
180  void setLedMode(uint8_t controller, LEDMode lm);
-
186  uint8_t getBatteryLevel(uint8_t controller);
-
192  bool buttonChanged(uint8_t controller);
-
196  bool XboxReceiverConnected;
-
198  uint8_t Xbox360Connected[4];
-
199 
-
200 protected:
-
202  USB *pUsb;
-
204  uint8_t bAddress;
-
206  EpInfo epInfo[XBOX_MAX_ENDPOINTS];
-
207 
-
208 private:
-
209  bool bPollEnable;
-
210 
-
211  /* Variables to store the buttons */
-
212  uint32_t ButtonState[4];
-
213  uint32_t OldButtonState[4];
-
214  uint16_t ButtonClickState[4];
-
215  int16_t hatValue[4][4];
-
216  uint16_t controllerStatus[4];
-
217  bool buttonStateChanged[4]; // True if a button has changed
-
218 
-
219  bool L2Clicked[4]; // These buttons are analog, so we use we use these bools to check if they where clicked or not
-
220  bool R2Clicked[4];
-
221 
-
222  unsigned long timer; // Timing for checkStatus() signals
-
223 
-
224  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
-
225  uint8_t writeBuf[EP_MAXPKTSIZE]; // General purpose buffer for output data
-
226 
-
227  void readReport(uint8_t controller); // read incoming data
-
228  void printReport(uint8_t controller, uint8_t nBytes); // print incoming date - Uncomment for debugging
-
229 
-
230  /* Private commands */
-
231  void XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes);
-
232  void checkStatus();
-
233 };
-
234 #endif
+
63 class XBOXRECV : public USBDeviceConfig {
+
64 public:
+
69  XBOXRECV(USB *pUsb);
+
70 
+
79  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
+
84  virtual uint8_t Release();
+
89  virtual uint8_t Poll();
+
94  virtual uint8_t GetAddress() { return bAddress; };
+
99  virtual bool isReady() { return bPollEnable; };
+
115  uint8_t getButtonPress(uint8_t controller, Button b);
+
116  bool getButtonClick(uint8_t controller, Button b);
+
126  int16_t getAnalogHat(uint8_t controller, AnalogHat a);
+
131  void setAllOff(uint8_t controller) { setRumbleOn(controller,0,0); setLedOff(controller); };
+
136  void setRumbleOff(uint8_t controller) { setRumbleOn(controller,0,0); };
+
143  void setRumbleOn(uint8_t controller, uint8_t lValue, uint8_t rValue);
+
151  void setLedRaw(uint8_t controller, uint8_t value);
+
156  void setLedOff(uint8_t controller) { setLedRaw(controller,0); };
+
162  void setLedOn(uint8_t controller, LED l);
+
168  void setLedBlink(uint8_t controller, LED l);
+
174  void setLedMode(uint8_t controller, LEDMode lm);
+
180  uint8_t getBatteryLevel(uint8_t controller);
+
186  bool buttonChanged(uint8_t controller);
+
190  bool XboxReceiverConnected;
+
192  uint8_t Xbox360Connected[4];
+
193 
+
194 protected:
+
196  USB *pUsb;
+
198  uint8_t bAddress;
+
200  EpInfo epInfo[XBOX_MAX_ENDPOINTS];
+
201 
+
202 private:
+
203  bool bPollEnable;
+
204 
+
205  /* Variables to store the buttons */
+
206  uint32_t ButtonState[4];
+
207  uint32_t OldButtonState[4];
+
208  uint16_t ButtonClickState[4];
+
209  int16_t hatValue[4][4];
+
210  uint16_t controllerStatus[4];
+
211  bool buttonStateChanged[4]; // True if a button has changed
+
212 
+
213  bool L2Clicked[4]; // These buttons are analog, so we use we use these bools to check if they where clicked or not
+
214  bool R2Clicked[4];
+
215 
+
216  unsigned long timer; // Timing for checkStatus() signals
+
217 
+
218  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
+
219  uint8_t writeBuf[EP_MAXPKTSIZE]; // General purpose buffer for output data
+
220 
+
221  void readReport(uint8_t controller); // read incoming data
+
222  void printReport(uint8_t controller, uint8_t nBytes); // print incoming date - Uncomment for debugging
+
223 
+
224  /* Private commands */
+
225  void XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes);
+
226  void checkStatus();
+
227 };
+
228 #endif
diff --git a/_x_b_o_x_u_s_b_8cpp.html b/_x_b_o_x_u_s_b_8cpp.html new file mode 100644 index 00000000..82bb6990 --- /dev/null +++ b/_x_b_o_x_u_s_b_8cpp.html @@ -0,0 +1,133 @@ + + + + + + +USB Host Shield 2.0: XBOXUSB.cpp File Reference + + + + + + + + + + +
+
+ + + + + + +
+
USB Host Shield 2.0 +
+
+
+ + + + + + +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+ + +
+ +
+ + +
+
+
+Macros
+
+
XBOXUSB.cpp File Reference
+
+
+
#include "XBOXUSB.h"
+
+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 new file mode 100644 index 00000000..497e3bb8 --- /dev/null +++ b/_x_b_o_x_u_s_b_8cpp__incl.map @@ -0,0 +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 new file mode 100644 index 00000000..586ba3f3 --- /dev/null +++ b/_x_b_o_x_u_s_b_8cpp__incl.md5 @@ -0,0 +1 @@ +3ca153d023e1731c3bdf798e2214196b \ 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 new file mode 100644 index 00000000..45c98691 Binary files /dev/null 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 new file mode 100644 index 00000000..adaea15b --- /dev/null +++ b/_x_b_o_x_u_s_b_8cpp_source.html @@ -0,0 +1,442 @@ + + + + + + +USB Host Shield 2.0: XBOXUSB.cpp Source File + + + + + + + + + + +
+
+ + + + + + +
+
USB Host Shield 2.0 +
+
+
+ + + + + + +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+ + +
+ +
+ + +
+
+
+
XBOXUSB.cpp
+
+
+Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
+
2 
+
3  This software may be distributed and modified under the terms of the GNU
+
4  General Public License version 2 (GPL2) as published by the Free Software
+
5  Foundation and appearing in the file GPL2.TXT included in the packaging of
+
6  this file. Please note that GPL2 Section 2[b] requires that all works based
+
7  on this software must also be made publicly available under the terms of
+
8  the GPL2 ("Copyleft").
+
9 
+
10  Contact information
+
11  -------------------
+
12 
+
13  Kristian Lauszus, TKJ Electronics
+
14  Web : http://www.tkjelectronics.com
+
15  e-mail : kristianl@tkjelectronics.com
+
16  */
+
17 
+
18 #include "XBOXUSB.h"
+
19 #define DEBUG // Uncomment to print data for debugging
+
20 //#define EXTRADEBUG // Uncomment to get even more debugging data
+
21 //#define PRINTREPORT // Uncomment to print the report send by the Xbox 360 Controller
+
22 
+ +
24 pUsb(p), // pointer to USB class instance - mandatory
+
25 bAddress(0), // device address - mandatory
+
26 bPollEnable(false) { // don't start polling before dongle is connected
+
27  for(uint8_t i=0; i<XBOX_MAX_ENDPOINTS; i++) {
+
28  epInfo[i].epAddr = 0;
+
29  epInfo[i].maxPktSize = (i) ? 0 : 8;
+
30  epInfo[i].epAttribs = 0;
+ +
32  }
+
33 
+
34  if (pUsb) // register in USB subsystem
+
35  pUsb->RegisterDeviceClass(this); //set devConfig[] entry
+
36 }
+
37 
+
38 uint8_t XBOXUSB::Init(uint8_t parent, uint8_t port, bool lowspeed) {
+
39  uint8_t buf[sizeof(USB_DEVICE_DESCRIPTOR)];
+
40  uint8_t rcode;
+
41  UsbDevice *p = NULL;
+
42  EpInfo *oldep_ptr = NULL;
+
43  uint16_t PID;
+
44  uint16_t VID;
+
45 
+
46  // get memory address of USB device address pool
+
47  AddressPool &addrPool = pUsb->GetAddressPool();
+
48 #ifdef EXTRADEBUG
+
49  Notify(PSTR("\r\nXBOXUSB Init"));
+
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"));
+
55 #endif
+ +
57  }
+
58 
+
59  // Get pointer to pseudo device with address 0 assigned
+
60  p = addrPool.GetUsbDevicePtr(0);
+
61 
+
62  if (!p) {
+
63 #ifdef DEBUG
+
64  Notify(PSTR("\r\nAddress not found"));
+
65 #endif
+ +
67  }
+
68 
+
69  if (!p->epinfo) {
+
70 #ifdef DEBUG
+
71  Notify(PSTR("\r\nepinfo is null"));
+
72 #endif
+ +
74  }
+
75 
+
76  // Save old pointer to EP_RECORD of address 0
+
77  oldep_ptr = p->epinfo;
+
78 
+
79  // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
+
80  p->epinfo = epInfo;
+
81 
+
82  p->lowspeed = lowspeed;
+
83 
+
84  // Get device descriptor
+
85  rcode = pUsb->getDevDescr(0, 0, sizeof(USB_DEVICE_DESCRIPTOR), (uint8_t*)buf);// Get device descriptor - addr, ep, nbytes, data
+
86  // Restore p->epinfo
+
87  p->epinfo = oldep_ptr;
+
88 
+
89  if(rcode)
+
90  goto FailGetDevDescr;
+
91 
+
92  VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
+
93  PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
+
94 
+
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"));
+
100 #endif
+
101  goto FailUnknownDevice;
+
102  }
+ +
104 #ifdef DEBUG
+
105  Notify(PSTR("\r\nThis library only supports Xbox 360 controllers via USB"));
+
106 #endif
+
107  goto FailUnknownDevice;
+
108  }
+
109 
+
110  // Allocate new address according to device class
+
111  bAddress = addrPool.AllocAddress(parent, false, port);
+
112 
+
113  if (!bAddress)
+ +
115 
+
116  // Extract Max Packet Size from device descriptor
+
117  epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0;
+
118 
+
119  // Assign new address to the device
+
120  rcode = pUsb->setAddr( 0, 0, bAddress );
+
121  if (rcode) {
+
122  p->lowspeed = false;
+
123  addrPool.FreeAddress(bAddress);
+
124  bAddress = 0;
+
125 #ifdef DEBUG
+
126  Notify(PSTR("\r\nsetAddr: "));
+
127 #endif
+
128  PrintHex<uint8_t>(rcode);
+
129  return rcode;
+
130  }
+
131 #ifdef EXTRADEBUG
+
132  Notify(PSTR("\r\nAddr: "));
+
133  PrintHex<uint8_t>(bAddress);
+
134 #endif
+
135  p->lowspeed = false;
+
136 
+
137  //get pointer to assigned address record
+
138  p = addrPool.GetUsbDevicePtr(bAddress);
+
139  if (!p)
+ +
141 
+
142  p->lowspeed = lowspeed;
+
143 
+
144  // Assign epInfo to epinfo pointer - only EP0 is known
+
145  rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
+
146  if (rcode)
+
147  goto FailSetDevTblEntry;
+
148 
+
149  /* The application will work in reduced host mode, so we can save program and data
+
150  memory space. After verifying the VID we will use known values for the
+
151  configuration values for device, interface, endpoints and HID for the XBOX360 Controllers */
+
152 
+
153  /* Initialize data structures for endpoints of device */
+
154  epInfo[ XBOX_INPUT_PIPE ].epAddr = 0x01; // XBOX 360 report endpoint
+ +
156  epInfo[ XBOX_INPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+ + + +
160  epInfo[ XBOX_OUTPUT_PIPE ].epAddr = 0x02; // XBOX 360 output endpoint
+ +
162  epInfo[ XBOX_OUTPUT_PIPE ].bmNakPower = USB_NAK_NOWAIT; // Only poll once for interrupt endpoints
+ + + +
166 
+
167  rcode = pUsb->setEpInfoEntry(bAddress, 3, epInfo);
+
168  if( rcode )
+
169  goto FailSetDevTblEntry;
+
170 
+
171  delay(200);//Give time for address change
+
172 
+
173  rcode = pUsb->setConf(bAddress, epInfo[ XBOX_CONTROL_PIPE ].epAddr, 1);
+
174  if( rcode )
+
175  goto FailSetConf;
+
176 
+
177 #ifdef DEBUG
+
178  Notify(PSTR("\r\nXbox 360 Controller Connected\r\n"));
+
179 #endif
+
180  setLedOn(LED1);
+
181  Xbox360Connected = true;
+
182  bPollEnable = true;
+
183  return 0; // successful configuration
+
184 
+
185  /* diagnostic messages */
+
186 FailGetDevDescr:
+
187 #ifdef DEBUG
+
188  Notify(PSTR("\r\ngetDevDescr:"));
+
189 #endif
+
190  goto Fail;
+
191 FailSetDevTblEntry:
+
192 #ifdef DEBUG
+
193  Notify(PSTR("\r\nsetDevTblEn:"));
+
194 #endif
+
195  goto Fail;
+
196 FailSetConf:
+
197 #ifdef DEBUG
+
198  Notify(PSTR("\r\nsetConf:"));
+
199 #endif
+
200  goto Fail;
+
201 FailUnknownDevice:
+
202 #ifdef DEBUG
+
203  Notify(PSTR("\r\nUnknown Device Connected - VID: "));
+
204  PrintHex<uint16_t>(VID);
+
205  Notify(PSTR(" PID: "));
+
206  PrintHex<uint16_t>(PID);
+
207 #endif
+ +
209  goto Fail;
+
210 Fail:
+
211 #ifdef DEBUG
+
212  Notify(PSTR("\r\nXbox 360 Init Failed, error code: "));
+
213  Serial.print(rcode,HEX);
+
214 #endif
+
215  Release();
+
216  return rcode;
+
217 }
+
218 
+
219 /* Performs a cleanup after failed Init() attempt */
+
220 uint8_t XBOXUSB::Release() {
+
221  Xbox360Connected = false;
+ +
223  bAddress = 0;
+
224  bPollEnable = false;
+
225  return 0;
+
226 }
+
227 uint8_t XBOXUSB::Poll() {
+
228  if (!bPollEnable)
+
229  return 0;
+
230  uint16_t BUFFER_SIZE = EP_MAXPKTSIZE;
+
231  pUsb->inTransfer(bAddress, epInfo[ XBOX_INPUT_PIPE ].epAddr, &BUFFER_SIZE, readBuf); // input on endpoint 1
+
232  readReport();
+
233 #ifdef PRINTREPORT
+
234  printReport(); // Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
+
235 #endif
+
236  return 0;
+
237 }
+
238 
+
239 void XBOXUSB::readReport() {
+
240  if (readBuf == NULL)
+
241  return;
+
242  if(readBuf[0] != 0x00 || readBuf[1] != 0x14) { // Check if it's the correct report - the controller also sends different status reports
+
243  return;
+
244  }
+
245 
+
246  ButtonState = (uint32_t)(readBuf[5] | ((uint16_t)readBuf[4] << 8) | ((uint32_t)readBuf[3] << 16) | ((uint32_t)readBuf[2] << 24));
+
247 
+
248  hatValue[LeftHatX] = (int16_t)(((uint16_t)readBuf[7] << 8) | readBuf[6]);
+
249  hatValue[LeftHatY] = (int16_t)(((uint16_t)readBuf[9] << 8) | readBuf[8]);
+
250  hatValue[RightHatX] = (int16_t)(((uint16_t)readBuf[11] << 8) | readBuf[10]);
+
251  hatValue[RightHatY] = (int16_t)(((uint16_t)readBuf[13] << 8) | readBuf[12]);
+
252 
+
253  //Notify(PSTR("\r\nButtonState"));
+
254  //PrintHex<uint32_t>(ButtonState);
+
255 
+
256  if(ButtonState != OldButtonState) {
+
257  ButtonClickState = (ButtonState >> 16) & ((~OldButtonState) >> 16); // Update click state variable, but don't include the two trigger buttons L2 and R2
+
258  if(((uint8_t)OldButtonState) == 0 && ((uint8_t)ButtonState) != 0) // The L2 and R2 buttons are special as they are analog buttons
+
259  R2Clicked = true;
+
260  if((uint8_t)(OldButtonState >> 8) == 0 && (uint8_t)(ButtonState >> 8) != 0)
+
261  L2Clicked = true;
+
262  OldButtonState = ButtonState;
+
263  }
+
264 }
+
265 
+
266 void XBOXUSB::printReport() { //Uncomment "#define PRINTREPORT" to print the report send by the Xbox 360 Controller
+
267 #ifdef PRINTREPORT
+
268  if (readBuf == NULL)
+
269  return;
+
270  for(uint8_t i = 0; i < XBOX_REPORT_BUFFER_SIZE;i++) {
+
271  PrintHex<uint8_t>(readBuf[i]);
+
272  Serial.print(" ");
+
273  }
+
274  Serial.println();
+
275 #endif
+
276 }
+
277 
+ +
279  if(b == L2) // These are analog buttons
+
280  return (uint8_t)(ButtonState >> 8);
+
281  else if(b == R2)
+
282  return (uint8_t)ButtonState;
+
283  return (ButtonState & ((uint32_t)pgm_read_word(&BUTTONS[(uint8_t)b]) << 16));
+
284 }
+ +
286  if(b == L2) {
+
287  if(L2Clicked) {
+
288  L2Clicked = false;
+
289  return true;
+
290  }
+
291  return false;
+
292  }
+
293  else if(b == R2) {
+
294  if(R2Clicked) {
+
295  R2Clicked = false;
+
296  return true;
+
297  }
+
298  return false;
+
299  }
+
300  uint16_t button = pgm_read_word(&BUTTONS[(uint8_t)b]);
+
301  bool click = (ButtonClickState & button);
+
302  ButtonClickState &= ~button; // clear "click" event
+
303  return click;
+
304 }
+ +
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 void XBOXUSB::setLedRaw(uint8_t value) {
+
315  writeBuf[0] = 0x01;
+
316  writeBuf[1] = 0x03;
+
317  writeBuf[2] = value;
+
318 
+
319  XboxCommand(writeBuf, 3);
+
320 }
+ +
322  if(led != ALL) // All LEDs can't be on a the same time
+
323  setLedRaw((pgm_read_byte(&LEDS[(uint8_t)led]))+4);
+
324 }
+ +
326  setLedRaw(pgm_read_byte(&LEDS[(uint8_t)led]));
+
327 }
+
328 void XBOXUSB::setLedMode(LEDMode ledMode) { // This function is used to do some speciel LED stuff the controller supports
+
329  setLedRaw((uint8_t)ledMode);
+
330 }
+
331 void XBOXUSB::setRumbleOn(uint8_t lValue, uint8_t rValue) {
+
332  writeBuf[0] = 0x00;
+
333  writeBuf[1] = 0x08;
+
334  writeBuf[2] = 0x00;
+
335  writeBuf[3] = lValue; // big weight
+
336  writeBuf[4] = rValue; // small weight
+
337  writeBuf[5] = 0x00;
+
338  writeBuf[6] = 0x00;
+
339  writeBuf[7] = 0x00;
+
340 
+
341  XboxCommand(writeBuf, 8);
+
342 }
+
+ + + + diff --git a/_x_b_o_x_u_s_b_8h.html b/_x_b_o_x_u_s_b_8h.html new file mode 100644 index 00000000..3ac0c2b5 --- /dev/null +++ b/_x_b_o_x_u_s_b_8h.html @@ -0,0 +1,372 @@ + + + + + + +USB Host Shield 2.0: XBOXUSB.h File Reference + + + + + + + + + + +
+
+ + + + + + +
+
USB Host Shield 2.0 +
+
+
+ + + + + + +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+ + +
+ +
+ + +
+
+
+Classes | +Macros
+
+
XBOXUSB.h File Reference
+
+
+
#include "Arduino.h"
+#include "Usb.h"
+#include "xboxEnums.h"
+
+Include dependency graph for XBOXUSB.h:
+
+
+ + +
+
+This graph shows which files directly or indirectly include this file:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  XBOXUSB
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Macros

#define EP_MAXPKTSIZE   32
 
#define EP_INTERRUPT   0x03
 
#define XBOX_CONTROL_PIPE   0
 
#define XBOX_INPUT_PIPE   1
 
#define XBOX_OUTPUT_PIPE   2
 
#define XBOX_VID   0x045E
 
#define XBOX_WIRELESS_PID   0x028F
 
#define XBOX_WIRELESS_RECEIVER_PID   0x0719
 
#define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID   0x0291
 
#define MADCATZ_VID   0x1BAD
 
#define JOYTECH_VID   0x162E
 
#define XBOX_REPORT_BUFFER_SIZE   14
 
#define bmREQ_HID_OUT   USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
 
#define HID_REQUEST_SET_REPORT   0x09
 
#define XBOX_MAX_ENDPOINTS   3
 
+

Macro Definition Documentation

+ +
+
+ + + + +
#define EP_MAXPKTSIZE   32
+
+ +

Definition at line 31 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define EP_INTERRUPT   0x03
+
+ +

Definition at line 34 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_CONTROL_PIPE   0
+
+ +

Definition at line 37 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_INPUT_PIPE   1
+
+ +

Definition at line 38 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_OUTPUT_PIPE   2
+
+ +

Definition at line 39 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_VID   0x045E
+
+ +

Definition at line 42 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_WIRELESS_PID   0x028F
+
+ +

Definition at line 43 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_WIRELESS_RECEIVER_PID   0x0719
+
+ +

Definition at line 44 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID   0x0291
+
+ +

Definition at line 45 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define MADCATZ_VID   0x1BAD
+
+ +

Definition at line 47 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define JOYTECH_VID   0x162E
+
+ +

Definition at line 48 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_REPORT_BUFFER_SIZE   14
+
+ +

Definition at line 50 of file XBOXUSB.h.

+ +
+
+ +
+
+ +

Definition at line 53 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define HID_REQUEST_SET_REPORT   0x09
+
+ +

Definition at line 54 of file XBOXUSB.h.

+ +
+
+ +
+
+ + + + +
#define XBOX_MAX_ENDPOINTS   3
+
+ +

Definition at line 56 of file XBOXUSB.h.

+ +
+
+
+ + + + diff --git a/_x_b_o_x_u_s_b_8h__dep__incl.map b/_x_b_o_x_u_s_b_8h__dep__incl.map new file mode 100644 index 00000000..23ac7a2d --- /dev/null +++ b/_x_b_o_x_u_s_b_8h__dep__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/_x_b_o_x_u_s_b_8h__dep__incl.md5 b/_x_b_o_x_u_s_b_8h__dep__incl.md5 new file mode 100644 index 00000000..e2871605 --- /dev/null +++ b/_x_b_o_x_u_s_b_8h__dep__incl.md5 @@ -0,0 +1 @@ +f71133bf381aea861d91b2082208595d \ No newline at end of file diff --git a/_x_b_o_x_u_s_b_8h__dep__incl.png b/_x_b_o_x_u_s_b_8h__dep__incl.png new file mode 100644 index 00000000..492dd91c Binary files /dev/null and b/_x_b_o_x_u_s_b_8h__dep__incl.png differ diff --git a/_x_b_o_x_u_s_b_8h__incl.map b/_x_b_o_x_u_s_b_8h__incl.map new file mode 100644 index 00000000..7d551121 --- /dev/null +++ b/_x_b_o_x_u_s_b_8h__incl.map @@ -0,0 +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 new file mode 100644 index 00000000..8fe7dfb6 --- /dev/null +++ b/_x_b_o_x_u_s_b_8h__incl.md5 @@ -0,0 +1 @@ +acdb454213bd6a2a1c611203a1473383 \ 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 new file mode 100644 index 00000000..b1bb1c55 Binary files /dev/null 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 new file mode 100644 index 00000000..eb55512a --- /dev/null +++ b/_x_b_o_x_u_s_b_8h_source.html @@ -0,0 +1,208 @@ + + + + + + +USB Host Shield 2.0: XBOXUSB.h Source File + + + + + + + + + + +
+
+ + + + + + +
+
USB Host Shield 2.0 +
+
+
+ + + + + + +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
+ + +
+ +
+ + +
+
+
+
XBOXUSB.h
+
+
+Go to the documentation of this file.
1 /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronics. All rights reserved.
+
2 
+
3  This software may be distributed and modified under the terms of the GNU
+
4  General Public License version 2 (GPL2) as published by the Free Software
+
5  Foundation and appearing in the file GPL2.TXT included in the packaging of
+
6  this file. Please note that GPL2 Section 2[b] requires that all works based
+
7  on this software must also be made publicly available under the terms of
+
8  the GPL2 ("Copyleft").
+
9 
+
10  Contact information
+
11  -------------------
+
12 
+
13  Kristian Lauszus, TKJ Electronics
+
14  Web : http://www.tkjelectronics.com
+
15  e-mail : kristianl@tkjelectronics.com
+
16  */
+
17 
+
18 #ifndef _xboxusb_h_
+
19 #define _xboxusb_h_
+
20 
+
21 #if defined(ARDUINO) && ARDUINO >= 100
+
22 #include "Arduino.h"
+
23 #else
+
24 #include "WProgram.h"
+
25 #endif
+
26 
+
27 #include "Usb.h"
+
28 #include "xboxEnums.h"
+
29 
+
30 /* Data Xbox 360 taken from descriptors */
+
31 #define EP_MAXPKTSIZE 32 // max size for data via USB
+
32 
+
33 /* Endpoint types */
+
34 #define EP_INTERRUPT 0x03
+
35 
+
36 /* Names we give to the 3 Xbox360 pipes */
+
37 #define XBOX_CONTROL_PIPE 0
+
38 #define XBOX_INPUT_PIPE 1
+
39 #define XBOX_OUTPUT_PIPE 2
+
40 
+
41 // PID and VID of the different devices
+
42 #define XBOX_VID 0x045E // Microsoft Corporation
+
43 #define XBOX_WIRELESS_PID 0x028F // Wireless controller only support charging
+
44 #define XBOX_WIRELESS_RECEIVER_PID 0x0719 // Microsoft Wireless Gaming Receiver
+
45 #define XBOX_WIRELESS_RECEIVER_THIRD_PARTY_PID 0x0291 // Third party Wireless Gaming Receiver
+
46 
+
47 #define MADCATZ_VID 0x1BAD // For unofficial Mad Catz controllers
+
48 #define JOYTECH_VID 0x162E // For unofficial Joytech controllers
+
49 
+
50 #define XBOX_REPORT_BUFFER_SIZE 14 // Size of the input report buffer
+
51 
+
52 // Used in control endpoint header for HID Commands
+
53 #define bmREQ_HID_OUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
+
54 #define HID_REQUEST_SET_REPORT 0x09
+
55 
+
56 #define XBOX_MAX_ENDPOINTS 3
+
57 
+
59 class XBOXUSB : public USBDeviceConfig {
+
60 public:
+
65  XBOXUSB(USB *pUsb);
+
66 
+
75  virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed);
+
80  virtual uint8_t Release();
+
85  virtual uint8_t Poll();
+
90  virtual uint8_t GetAddress() { return bAddress; };
+
95  virtual bool isReady() { return bPollEnable; };
+
110  uint8_t getButtonPress(Button b);
+
111  bool getButtonClick(Button b);
+
120  int16_t getAnalogHat(AnalogHat a);
+
121 
+
123  void setAllOff() { setRumbleOn(0,0); setLedRaw(0); };
+
125  void setRumbleOff() { setRumbleOn(0,0); };
+
131  void setRumbleOn(uint8_t lValue, uint8_t rValue);
+
138  void setLedRaw(uint8_t value);
+
140  void setLedOff() { setLedRaw(0); };
+
145  void setLedOn(LED l);
+
150  void setLedBlink(LED l);
+
156  void setLedMode(LEDMode lm);
+ +
161 
+
162 protected:
+ +
166  uint8_t bAddress;
+ +
169 
+
170 private:
+
171  bool bPollEnable;
+
172 
+
173  /* Variables to store the buttons */
+
174  uint32_t ButtonState;
+
175  uint32_t OldButtonState;
+
176  uint16_t ButtonClickState;
+
177  int16_t hatValue[4];
+
178  uint16_t controllerStatus;
+
179 
+
180  bool L2Clicked; // These buttons are analog, so we use we use these bools to check if they where clicked or not
+
181  bool R2Clicked;
+
182 
+
183  uint8_t readBuf[EP_MAXPKTSIZE]; // General purpose buffer for input data
+
184  uint8_t writeBuf[EP_MAXPKTSIZE]; // General purpose buffer for output data
+
185 
+
186  void readReport(); // read incoming data
+
187  void printReport(); // print incoming date - Uncomment for debugging
+
188 
+
189  /* Private commands */
+
190  void XboxCommand(uint8_t* data, uint16_t nbytes);
+
191 };
+
192 #endif
+
+ + + + diff --git a/address_8h.html b/address_8h.html index d59fcec2..78ca3248 100644 --- a/address_8h.html +++ b/address_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: address.h File Reference +USB Host Shield 2.0: address.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -108,7 +108,7 @@ This graph shows which files directly or indirectly include this file:
- +

Go to the source code of this file.

@@ -153,73 +153,17 @@ Typedefs  

Macro Definition Documentation

- +
- +
#define ADDR_ERROR_INVALID_ADDRESS   0xFF#define USB_NAK_MAX_POWER   16
-

Definition at line 98 of file address.h.

- -
-
- -
-
- - - - -
#define ADDR_ERROR_INVALID_INDEX   0xFF
-
- -

Definition at line 97 of file address.h.

- -
-
- -
-
- - - - -
#define bmUSB_DEV_ADDR_ADDRESS   0x07
-
- -

Definition at line 74 of file address.h.

- -
-
- -
-
- - - - -
#define bmUSB_DEV_ADDR_HUB   0x40
-
- -

Definition at line 76 of file address.h.

- -
-
- -
-
- - - - -
#define bmUSB_DEV_ADDR_PARENT   0x38
-
- -

Definition at line 75 of file address.h.

+

Definition at line 27 of file address.h.

@@ -237,17 +181,17 @@ Typedefs - +
- +
#define USB_NAK_MAX_POWER   16#define USB_NAK_NOWAIT   1
-

Definition at line 27 of file address.h.

+

Definition at line 29 of file address.h.

@@ -265,17 +209,73 @@ Typedefs - +
- +
#define USB_NAK_NOWAIT   1#define bmUSB_DEV_ADDR_ADDRESS   0x07
-

Definition at line 29 of file address.h.

+

Definition at line 74 of file address.h.

+ +
+
+ +
+
+ + + + +
#define bmUSB_DEV_ADDR_PARENT   0x38
+
+ +

Definition at line 75 of file address.h.

+ +
+
+ +
+
+ + + + +
#define bmUSB_DEV_ADDR_HUB   0x40
+
+ +

Definition at line 76 of file address.h.

+ +
+
+ +
+
+ + + + +
#define ADDR_ERROR_INVALID_INDEX   0xFF
+
+ +

Definition at line 97 of file address.h.

+ +
+
+ +
+
+ + + + +
#define ADDR_ERROR_INVALID_ADDRESS   0xFF
+
+ +

Definition at line 98 of file address.h.

@@ -297,7 +297,7 @@ Typedefs diff --git a/address_8h__dep__incl.map b/address_8h__dep__incl.map index ac5f0677..454549ff 100644 --- a/address_8h__dep__incl.map +++ b/address_8h__dep__incl.map @@ -1,38 +1,40 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/address_8h__dep__incl.md5 b/address_8h__dep__incl.md5 index 00118df7..268d30cc 100644 --- a/address_8h__dep__incl.md5 +++ b/address_8h__dep__incl.md5 @@ -1 +1 @@ -76dc9dba3ebd93ea05d113f03fd7c5d2 \ No newline at end of file +f5c550b54537896a01440e4a9c721ac3 \ No newline at end of file diff --git a/address_8h__dep__incl.png b/address_8h__dep__incl.png index 50054bf9..d7208145 100644 Binary files a/address_8h__dep__incl.png and b/address_8h__dep__incl.png differ diff --git a/address_8h_source.html b/address_8h_source.html index 594bdfed..70b0b739 100644 --- a/address_8h_source.html +++ b/address_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: address.h Source File +USB Host Shield 2.0: address.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -380,7 +380,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/adk_8cpp.html b/adk_8cpp.html index 2d615921..d8a23c18 100644 --- a/adk_8cpp.html +++ b/adk_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: adk.cpp File Reference +USB Host Shield 2.0: adk.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -102,7 +102,7 @@ Include dependency graph for adk.cpp:
diff --git a/adk_8cpp_source.html b/adk_8cpp_source.html index 9b1dcd40..eba56a88 100644 --- a/adk_8cpp_source.html +++ b/adk_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: adk.cpp Source File +USB Host Shield 2.0: adk.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -447,7 +447,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/adk_8h.html b/adk_8h.html index 48d23c0c..871dfd4f 100644 --- a/adk_8h.html +++ b/adk_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: adk.h File Reference +USB Host Shield 2.0: adk.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -162,143 +162,17 @@ Macros  

Macro Definition Documentation

- +
- +
#define ACCESSORY_STRING_DESCRIPTION   2#define ADK_VID   0x18D1
-

Definition at line 62 of file adk.h.

- -
-
- -
-
- - - - -
#define ACCESSORY_STRING_MANUFACTURER   0
-
- -

Definition at line 60 of file adk.h.

- -
-
- -
-
- - - - -
#define ACCESSORY_STRING_MODEL   1
-
- -

Definition at line 61 of file adk.h.

- -
-
- -
-
- - - - -
#define ACCESSORY_STRING_SERIAL   5
-
- -

Definition at line 65 of file adk.h.

- -
-
- -
-
- - - - -
#define ACCESSORY_STRING_URI   4
-
- -

Definition at line 64 of file adk.h.

- -
-
- -
-
- - - - -
#define ACCESSORY_STRING_VERSION   3
-
- -

Definition at line 63 of file adk.h.

- -
-
- -
-
- - - - -
#define ADB_PID   0x2D01
-
- -

Definition at line 45 of file adk.h.

- -
-
- -
-
- - - - -
#define ADK_ACCSTART   53
-
- -

Definition at line 55 of file adk.h.

- -
-
- -
-
- - - - -
#define ADK_GETPROTO   51
-
- -

Definition at line 53 of file adk.h.

- -
-
- -
-
- - - - -
#define ADK_MAX_ENDPOINTS   3
-
- -

Definition at line 67 of file adk.h.

+

Definition at line 43 of file adk.h.

@@ -314,6 +188,48 @@ Macros

Definition at line 44 of file adk.h.

+
+ + +
+
+ + + + +
#define ADB_PID   0x2D01
+
+ +

Definition at line 45 of file adk.h.

+ +
+
+ +
+
+ + + + +
#define XOOM
+
+ +

Definition at line 47 of file adk.h.

+ +
+
+ +
+
+ + + + +
#define ADK_GETPROTO   51
+
+ +

Definition at line 53 of file adk.h.

+
@@ -330,17 +246,17 @@ Macros - +
- +
#define ADK_VID   0x18D1#define ADK_ACCSTART   53
-

Definition at line 43 of file adk.h.

+

Definition at line 55 of file adk.h.

@@ -372,24 +288,108 @@ Macros - +
- +
#define XOOM#define ACCESSORY_STRING_MANUFACTURER   0
-

Definition at line 47 of file adk.h.

+

Definition at line 60 of file adk.h.

+ +
+
+ +
+
+ + + + +
#define ACCESSORY_STRING_MODEL   1
+
+ +

Definition at line 61 of file adk.h.

+ +
+
+ +
+
+ + + + +
#define ACCESSORY_STRING_DESCRIPTION   2
+
+ +

Definition at line 62 of file adk.h.

+ +
+
+ +
+
+ + + + +
#define ACCESSORY_STRING_VERSION   3
+
+ +

Definition at line 63 of file adk.h.

+ +
+
+ +
+
+ + + + +
#define ACCESSORY_STRING_URI   4
+
+ +

Definition at line 64 of file adk.h.

+ +
+
+ +
+
+ + + + +
#define ACCESSORY_STRING_SERIAL   5
+
+ +

Definition at line 65 of file adk.h.

+ +
+
+ +
+
+ + + + +
#define ADK_MAX_ENDPOINTS   3
+
+ +

Definition at line 67 of file adk.h.

diff --git a/adk_8h_source.html b/adk_8h_source.html index 45b29424..6ae0dd8b 100644 --- a/adk_8h_source.html +++ b/adk_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: adk.h Source File +USB Host Shield 2.0: adk.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -237,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/annotated.html b/annotated.html index 48c0a6c9..8a3f17d2 100644 --- a/annotated.html +++ b/annotated.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Class List +USB Host Shield 2.0: Class List @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -159,13 +159,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); oCUSBHub oCUSBReadParser oCWII -\CXBOXRECV +oCXBOXRECV +\CXBOXUSB
diff --git a/avrpins_8h.html b/avrpins_8h.html index 955e8cdc..11d0f5a6 100644 --- a/avrpins_8h.html +++ b/avrpins_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: avrpins.h File Reference +USB Host Shield 2.0: avrpins.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -105,7 +105,7 @@ This graph shows which files directly or indirectly include this file:
- +

Go to the source code of this file.

@@ -235,7 +235,7 @@ Macros diff --git a/avrpins_8h__dep__incl.map b/avrpins_8h__dep__incl.map index 1badeb0f..efa0d046 100644 --- a/avrpins_8h__dep__incl.map +++ b/avrpins_8h__dep__incl.map @@ -1,39 +1,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/avrpins_8h__dep__incl.md5 b/avrpins_8h__dep__incl.md5 index 83a261f9..ec8d20c3 100644 --- a/avrpins_8h__dep__incl.md5 +++ b/avrpins_8h__dep__incl.md5 @@ -1 +1 @@ -50924a4e374ee6c33035ac5121ff7de7 \ No newline at end of file +daae9e094c4a346d02a8ba84b3656342 \ No newline at end of file diff --git a/avrpins_8h__dep__incl.png b/avrpins_8h__dep__incl.png index 9040f92a..aecbf3f7 100644 Binary files a/avrpins_8h__dep__incl.png and b/avrpins_8h__dep__incl.png differ diff --git a/avrpins_8h_source.html b/avrpins_8h_source.html index 2884a057..3c67a787 100644 --- a/avrpins_8h_source.html +++ b/avrpins_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: avrpins.h Source File +USB Host Shield 2.0: avrpins.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -799,7 +799,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/cdcacm_8cpp.html b/cdcacm_8cpp.html index 18ca58e7..4d4cb89c 100644 --- a/cdcacm_8cpp.html +++ b/cdcacm_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcacm.cpp File Reference +USB Host Shield 2.0: cdcacm.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -102,7 +102,7 @@ Include dependency graph for cdcacm.cpp:
diff --git a/cdcacm_8cpp_source.html b/cdcacm_8cpp_source.html index 3de9122a..70f18cb8 100644 --- a/cdcacm_8cpp_source.html +++ b/cdcacm_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcacm.cpp Source File +USB Host Shield 2.0: cdcacm.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -451,7 +451,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/cdcacm_8h.html b/cdcacm_8h.html index af945f2d..31ee1b9f 100644 --- a/cdcacm_8h.html +++ b/cdcacm_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcacm.h File Reference +USB Host Shield 2.0: cdcacm.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -256,31 +256,17 @@ Typedefs  

Macro Definition Documentation

- +
- +
#define ACM_MAX_ENDPOINTS   4#define bmREQ_CDCOUT   USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
-

Definition at line 160 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define AUX_JACK_HOOK_STATE   0x08
-
- -

Definition at line 95 of file cdcacm.h.

+

Definition at line 40 of file cdcacm.h.

@@ -298,185 +284,171 @@ Typedefs
- +
- +
#define bmREQ_CDCOUT   USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE#define CDC_SUBCLASS_DLCM   0x01
-

Definition at line 40 of file cdcacm.h.

+

Definition at line 44 of file cdcacm.h.

- +
- +
#define CALL_STATE_CHANGE   0x28#define CDC_SUBCLASS_ACM   0x02
-

Definition at line 98 of file cdcacm.h.

+

Definition at line 45 of file cdcacm.h.

- +
- +
#define CDC_CLEAR_COMM_FEATURE   0x04#define CDC_SUBCLASS_TCM   0x03
-

Definition at line 73 of file cdcacm.h.

+

Definition at line 46 of file cdcacm.h.

- +
- +
#define CDC_DIAL_DIGITS   0x36#define CDC_SUBCLASS_MCCM   0x04
-

Definition at line 90 of file cdcacm.h.

+

Definition at line 47 of file cdcacm.h.

- +
- +
#define CDC_GET_COMM_FEATURE   0x03#define CDC_SUBCLASS_CAPI   0x05
-

Definition at line 72 of file cdcacm.h.

+

Definition at line 48 of file cdcacm.h.

- +
- +
#define CDC_GET_ENCAPSULATED_RESPONSE   0x01#define CDC_SUBCLASS_ETHERNET   0x06
-

Definition at line 68 of file cdcacm.h.

+

Definition at line 49 of file cdcacm.h.

- +
- +
#define CDC_GET_LINE_CODING   0x21#define CDC_SUBCLASS_ATM   0x07
-

Definition at line 81 of file cdcacm.h.

+

Definition at line 50 of file cdcacm.h.

- +
- +
#define CDC_GET_LINE_PARMS   0x35#define CDC_SUBCLASS_WIRELESS_HANDSET   0x08
-

Definition at line 89 of file cdcacm.h.

+

Definition at line 51 of file cdcacm.h.

- +
- +
#define CDC_GET_OPERATION_PARMS   0x33#define CDC_SUBCLASS_DEVICE_MANAGEMENT   0x09
-

Definition at line 87 of file cdcacm.h.

+

Definition at line 52 of file cdcacm.h.

- +
- +
#define CDC_GET_RINGER_PARMS   0x31#define CDC_SUBCLASS_MOBILE_DIRECT_LINE   0x0A
-

Definition at line 85 of file cdcacm.h.

+

Definition at line 53 of file cdcacm.h.

- +
- +
#define CDC_PROTOCOL_3GPP_27_07   0x05#define CDC_SUBCLASS_OBEX   0x0B
-

Definition at line 62 of file cdcacm.h.

+

Definition at line 54 of file cdcacm.h.

- +
- +
#define CDC_PROTOCOL_C_S0017_0   0x06#define CDC_SUBCLASS_ETHERNET_EMU   0x0C
-

Definition at line 63 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_PROTOCOL_GSM_7_07   0x04
-
- -

Definition at line 61 of file cdcacm.h.

+

Definition at line 55 of file cdcacm.h.

@@ -520,6 +492,48 @@ Typedefs

Definition at line 60 of file cdcacm.h.

+ + + +
+
+ + + + +
#define CDC_PROTOCOL_GSM_7_07   0x04
+
+ +

Definition at line 61 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define CDC_PROTOCOL_3GPP_27_07   0x05
+
+ +

Definition at line 62 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define CDC_PROTOCOL_C_S0017_0   0x06
+
+ +

Definition at line 63 of file cdcacm.h.

+
@@ -534,48 +548,6 @@ Typedefs

Definition at line 64 of file cdcacm.h.

- - - -
-
- - - - -
#define CDC_PULSE_SETUP   0x12
-
- -

Definition at line 76 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_RING_AUX_JACK   0x15
-
- -

Definition at line 79 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_SEND_BREAK   0x23
-
- -

Definition at line 83 of file cdcacm.h.

-
@@ -592,31 +564,17 @@ Typedefs - +
- +
#define CDC_SEND_PULSE   0x13#define CDC_GET_ENCAPSULATED_RESPONSE   0x01
-

Definition at line 77 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_SET_AUX_LINE_STATE   0x10
-
- -

Definition at line 74 of file cdcacm.h.

+

Definition at line 68 of file cdcacm.h.

@@ -634,17 +592,45 @@ Typedefs - +
- +
#define CDC_SET_CONTROL_LINE_STATE   0x22#define CDC_GET_COMM_FEATURE   0x03
-

Definition at line 82 of file cdcacm.h.

+

Definition at line 72 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define CDC_CLEAR_COMM_FEATURE   0x04
+
+ +

Definition at line 73 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define CDC_SET_AUX_LINE_STATE   0x10
+
+ +

Definition at line 74 of file cdcacm.h.

@@ -662,45 +648,31 @@ Typedefs - +
- +
#define CDC_SET_LINE_CODING   0x20#define CDC_PULSE_SETUP   0x12
-

Definition at line 80 of file cdcacm.h.

+

Definition at line 76 of file cdcacm.h.

- +
- +
#define CDC_SET_LINE_PARMS   0x34#define CDC_SEND_PULSE   0x13
-

Definition at line 88 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_SET_OPERATION_PARMS   0x32
-
- -

Definition at line 86 of file cdcacm.h.

+

Definition at line 77 of file cdcacm.h.

@@ -716,6 +688,76 @@ Typedefs

Definition at line 78 of file cdcacm.h.

+ + + +
+
+ + + + +
#define CDC_RING_AUX_JACK   0x15
+
+ +

Definition at line 79 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define CDC_SET_LINE_CODING   0x20
+
+ +

Definition at line 80 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define CDC_GET_LINE_CODING   0x21
+
+ +

Definition at line 81 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define CDC_SET_CONTROL_LINE_STATE   0x22
+
+ +

Definition at line 82 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define CDC_SEND_BREAK   0x23
+
+ +

Definition at line 83 of file cdcacm.h.

+
@@ -732,199 +774,87 @@ Typedefs - +
- +
#define CDC_SUBCLASS_ACM   0x02#define CDC_GET_RINGER_PARMS   0x31
-

Definition at line 45 of file cdcacm.h.

+

Definition at line 85 of file cdcacm.h.

- +
- +
#define CDC_SUBCLASS_ATM   0x07#define CDC_SET_OPERATION_PARMS   0x32
-

Definition at line 50 of file cdcacm.h.

+

Definition at line 86 of file cdcacm.h.

- +
- +
#define CDC_SUBCLASS_CAPI   0x05#define CDC_GET_OPERATION_PARMS   0x33
-

Definition at line 48 of file cdcacm.h.

+

Definition at line 87 of file cdcacm.h.

- +
- +
#define CDC_SUBCLASS_DEVICE_MANAGEMENT   0x09#define CDC_SET_LINE_PARMS   0x34
-

Definition at line 52 of file cdcacm.h.

+

Definition at line 88 of file cdcacm.h.

- +
- +
#define CDC_SUBCLASS_DLCM   0x01#define CDC_GET_LINE_PARMS   0x35
-

Definition at line 44 of file cdcacm.h.

+

Definition at line 89 of file cdcacm.h.

- +
- +
#define CDC_SUBCLASS_ETHERNET   0x06#define CDC_DIAL_DIGITS   0x36
-

Definition at line 49 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_SUBCLASS_ETHERNET_EMU   0x0C
-
- -

Definition at line 55 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_SUBCLASS_MCCM   0x04
-
- -

Definition at line 47 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_SUBCLASS_MOBILE_DIRECT_LINE   0x0A
-
- -

Definition at line 53 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_SUBCLASS_OBEX   0x0B
-
- -

Definition at line 54 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_SUBCLASS_TCM   0x03
-
- -

Definition at line 46 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CDC_SUBCLASS_WIRELESS_HANDSET   0x08
-
- -

Definition at line 51 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define CONNECTION_SPEED_CHANGE   0x2a
-
- -

Definition at line 100 of file cdcacm.h.

- -
-
- -
-
- - - - -
#define LINE_STATE_CHANGE   0x29
-
- -

Definition at line 99 of file cdcacm.h.

+

Definition at line 90 of file cdcacm.h.

@@ -954,6 +884,20 @@ Typedefs

Definition at line 94 of file cdcacm.h.

+ + + +
+
+ + + + +
#define AUX_JACK_HOOK_STATE   0x08
+
+ +

Definition at line 95 of file cdcacm.h.

+
@@ -982,6 +926,62 @@ Typedefs

Definition at line 97 of file cdcacm.h.

+ + + +
+
+ + + + +
#define CALL_STATE_CHANGE   0x28
+
+ +

Definition at line 98 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define LINE_STATE_CHANGE   0x29
+
+ +

Definition at line 99 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define CONNECTION_SPEED_CHANGE   0x2a
+
+ +

Definition at line 100 of file cdcacm.h.

+ +
+
+ +
+
+ + + + +
#define ACM_MAX_ENDPOINTS   4
+
+ +

Definition at line 160 of file cdcacm.h.

+

Typedef Documentation

@@ -995,6 +995,18 @@ Typedefs
+
+ + +
+
+ + + + +
typedef struct ACM_FUNC_DESCR TEL_OPER_MODES_FUNC_DESCR
+
+
@@ -1008,24 +1020,12 @@ Typedefs
-
- - -
-
- - - - -
typedef struct ACM_FUNC_DESCR TEL_OPER_MODES_FUNC_DESCR
-
-
diff --git a/cdcacm_8h_source.html b/cdcacm_8h_source.html index e3093c9d..77d4ab3c 100644 --- a/cdcacm_8h_source.html +++ b/cdcacm_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcacm.h Source File +USB Host Shield 2.0: cdcacm.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -303,7 +303,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/cdcftdi_8cpp.html b/cdcftdi_8cpp.html index 2e76d8cc..8b6a0c4a 100644 --- a/cdcftdi_8cpp.html +++ b/cdcftdi_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcftdi.cpp File Reference +USB Host Shield 2.0: cdcftdi.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -102,7 +102,7 @@ Include dependency graph for cdcftdi.cpp:
diff --git a/cdcftdi_8cpp_source.html b/cdcftdi_8cpp_source.html index 046cbfe8..e3ba40a6 100644 --- a/cdcftdi_8cpp_source.html +++ b/cdcftdi_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcftdi.cpp Source File +USB Host Shield 2.0: cdcftdi.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -440,7 +440,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/cdcftdi_8h.html b/cdcftdi_8h.html index 511de010..cd1455ed 100644 --- a/cdcftdi_8h.html +++ b/cdcftdi_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcftdi.h File Reference +USB Host Shield 2.0: cdcftdi.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -218,20 +218,6 @@ Macros  

Macro Definition Documentation

- -
-
- - - - -
#define bmREQ_FTDI_IN   0xc0
-
- -

Definition at line 41 of file cdcftdi.h.

- -
-
@@ -246,17 +232,45 @@ Macros
- +
- +
#define FT2232   0x0500#define bmREQ_FTDI_IN   0xc0
-

Definition at line 51 of file cdcftdi.h.

+

Definition at line 41 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_VID   0x0403
+
+ +

Definition at line 46 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_PID   0x6001
+
+ +

Definition at line 47 of file cdcftdi.h.

@@ -286,6 +300,20 @@ Macros

Definition at line 50 of file cdcftdi.h.

+
+ + +
+
+ + + + +
#define FT2232   0x0500
+
+ +

Definition at line 51 of file cdcftdi.h.

+
@@ -302,101 +330,17 @@ Macros - +
- +
#define FTDI_MAX_ENDPOINTS   3#define FTDI_SIO_RESET   0 /* Reset the port */
-

Definition at line 106 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_PID   0x6001
-
- -

Definition at line 47 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_CTS_MASK   0x10
-
- -

Definition at line 90 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_DISABLE_FLOW_CTRL   0x0
-
- -

Definition at line 85 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_DSR_MASK   0x20
-
- -

Definition at line 91 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_DTR_DSR_HS   (0x2 << 8)
-
- -

Definition at line 87 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_GET_MODEM_STATUS   5 /* Retrieve current value of modem status register */
-
- -

Definition at line 60 of file cdcftdi.h.

+

Definition at line 55 of file cdcftdi.h.

@@ -414,17 +358,101 @@ Macros - +
- +
#define FTDI_SIO_RESET   0 /* Reset the port */#define FTDI_SIO_SET_FLOW_CTRL   2 /* Set flow control register */
-

Definition at line 55 of file cdcftdi.h.

+

Definition at line 57 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_SET_BAUD_RATE   3 /* Set baud rate */
+
+ +

Definition at line 58 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_SET_DATA   4 /* Set the data characteristics of the port */
+
+ +

Definition at line 59 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_GET_MODEM_STATUS   5 /* Retrieve current value of modem status register */
+
+ +

Definition at line 60 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_SET_EVENT_CHAR   6 /* Set the event character */
+
+ +

Definition at line 61 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_SET_ERROR_CHAR   7 /* Set the error character */
+
+ +

Definition at line 62 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_RESET_SIO   0
+
+ +

Definition at line 64 of file cdcftdi.h.

@@ -456,101 +484,31 @@ Macros - +
- +
#define FTDI_SIO_RESET_SIO   0#define FTDI_SIO_SET_DATA_PARITY_NONE   (0x0 << 8 )
-

Definition at line 64 of file cdcftdi.h.

+

Definition at line 68 of file cdcftdi.h.

- +
- +
#define FTDI_SIO_RI_MASK   0x40#define FTDI_SIO_SET_DATA_PARITY_ODD   (0x1 << 8 )
-

Definition at line 92 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_RLSD_MASK   0x80
-
- -

Definition at line 93 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_RTS_CTS_HS   (0x1 << 8)
-
- -

Definition at line 86 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_SET_BAUD_RATE   3 /* Set baud rate */
-
- -

Definition at line 58 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_SET_BREAK   (0x1 << 14)
-
- -

Definition at line 76 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_SET_DATA   4 /* Set the data characteristics of the port */
-
- -

Definition at line 59 of file cdcftdi.h.

+

Definition at line 69 of file cdcftdi.h.

@@ -580,34 +538,6 @@ Macros

Definition at line 71 of file cdcftdi.h.

- - - -
-
- - - - -
#define FTDI_SIO_SET_DATA_PARITY_NONE   (0x0 << 8 )
-
- -

Definition at line 68 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_SET_DATA_PARITY_ODD   (0x1 << 8 )
-
- -

Definition at line 69 of file cdcftdi.h.

-
@@ -664,6 +594,34 @@ Macros

Definition at line 75 of file cdcftdi.h.

+ + + +
+
+ + + + +
#define FTDI_SIO_SET_BREAK   (0x1 << 14)
+
+ +

Definition at line 76 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_SET_DTR_MASK   0x1
+
+ +

Definition at line 78 of file cdcftdi.h.

+
@@ -694,59 +652,17 @@ Macros - +
- +
#define FTDI_SIO_SET_DTR_MASK   0x1#define FTDI_SIO_SET_RTS_MASK   0x2
-

Definition at line 78 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_SET_ERROR_CHAR   7 /* Set the error character */
-
- -

Definition at line 62 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_SET_EVENT_CHAR   6 /* Set the event character */
-
- -

Definition at line 61 of file cdcftdi.h.

- -
-
- -
-
- - - - -
#define FTDI_SIO_SET_FLOW_CTRL   2 /* Set flow control register */
-
- -

Definition at line 57 of file cdcftdi.h.

+

Definition at line 81 of file cdcftdi.h.

@@ -778,17 +694,45 @@ Macros - +
- +
#define FTDI_SIO_SET_RTS_MASK   0x2#define FTDI_SIO_DISABLE_FLOW_CTRL   0x0
-

Definition at line 81 of file cdcftdi.h.

+

Definition at line 85 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_RTS_CTS_HS   (0x1 << 8)
+
+ +

Definition at line 86 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_DTR_DSR_HS   (0x2 << 8)
+
+ +

Definition at line 87 of file cdcftdi.h.

@@ -806,24 +750,80 @@ Macros - +
- +
#define FTDI_VID   0x0403#define FTDI_SIO_CTS_MASK   0x10
-

Definition at line 46 of file cdcftdi.h.

+

Definition at line 90 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_DSR_MASK   0x20
+
+ +

Definition at line 91 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_RI_MASK   0x40
+
+ +

Definition at line 92 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_SIO_RLSD_MASK   0x80
+
+ +

Definition at line 93 of file cdcftdi.h.

+ +
+
+ +
+
+ + + + +
#define FTDI_MAX_ENDPOINTS   3
+
+ +

Definition at line 106 of file cdcftdi.h.

diff --git a/cdcftdi_8h_source.html b/cdcftdi_8h_source.html index 4515bf09..6a794af0 100644 --- a/cdcftdi_8h_source.html +++ b/cdcftdi_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcftdi.h Source File +USB Host Shield 2.0: cdcftdi.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -242,7 +242,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/cdcprolific_8cpp.html b/cdcprolific_8cpp.html index 408d4097..8090501f 100644 --- a/cdcprolific_8cpp.html +++ b/cdcprolific_8cpp.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcprolific.cpp File Reference +USB Host Shield 2.0: cdcprolific.cpp File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -102,7 +102,7 @@ Include dependency graph for cdcprolific.cpp:
diff --git a/cdcprolific_8cpp_source.html b/cdcprolific_8cpp_source.html index 1009ef2d..7eec5572 100644 --- a/cdcprolific_8cpp_source.html +++ b/cdcprolific_8cpp_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcprolific.cpp Source File +USB Host Shield 2.0: cdcprolific.cpp Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -335,7 +335,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/cdcprolific_8h.html b/cdcprolific_8h.html index 1c621d0c..d2c572c5 100644 --- a/cdcprolific_8h.html +++ b/cdcprolific_8h.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcprolific.h File Reference +USB Host Shield 2.0: cdcprolific.h File Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -274,6 +274,188 @@ Enumerations  

Macro Definition Documentation

+ +
+
+ + + + +
#define PL_VID   0x067B
+
+ +

Definition at line 43 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define PL_PID   ( 0x2303 || 0x0609 )
+
+ +

Definition at line 44 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define PROLIFIC_REV_H   0x0202
+
+ +

Definition at line 46 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define PROLIFIC_REV_X   0x0300
+
+ +

Definition at line 47 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define PROLIFIC_REV_HX_CHIP_D   0x0400
+
+ +

Definition at line 48 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define PROLIFIC_REV_1   0x0001
+
+ +

Definition at line 49 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define kXOnChar   '\x11'
+
+ +

Definition at line 51 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define kXOffChar   '\x13'
+
+ +

Definition at line 52 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define SPECIAL_SHIFT   (5)
+
+ +

Definition at line 54 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define SPECIAL_MASK   ((1<<SPECIAL_SHIFT) - 1)
+
+ +

Definition at line 55 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define STATE_ALL   ( PD_RS232_S_MASK | PD_S_MASK )
+
+ +

Definition at line 56 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define FLOW_RX_AUTO   ( PD_RS232_A_RFR | PD_RS232_A_DTR | PD_RS232_A_RXO )
+
+ +

Definition at line 57 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define FLOW_TX_AUTO   ( PD_RS232_A_CTS | PD_RS232_A_DSR | PD_RS232_A_TXO | PD_RS232_A_DCD )
+
+ +

Definition at line 58 of file cdcprolific.h.

+ +
+
@@ -302,115 +484,31 @@ Enumerations
- +
- +
#define CONTINUE_SEND   1#define EXTERNAL_MASK   ( PD_S_MASK | (PD_RS232_S_MASK & ~PD_RS232_S_LOOP) )
-

Definition at line 67 of file cdcprolific.h.

+

Definition at line 61 of file cdcprolific.h.

- +
- +
#define DCR0_INIT   0x01#define INTERNAL_DELAY   ( PD_RS232_S_LOOP )
-

Definition at line 110 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define DCR0_INIT_H   0x41
-
- -

Definition at line 111 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define DCR0_INIT_X   0x61
-
- -

Definition at line 112 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define DCR1_INIT_H   0x80
-
- -

Definition at line 116 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define DCR1_INIT_X   0x00
-
- -

Definition at line 117 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define DCR2_INIT_H   0x24
-
- -

Definition at line 121 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define DCR2_INIT_X   0x44
-
- -

Definition at line 122 of file cdcprolific.h.

+

Definition at line 62 of file cdcprolific.h.

@@ -456,115 +554,101 @@ Enumerations
- +
- +
#define EXTERNAL_MASK   ( PD_S_MASK | (PD_RS232_S_MASK & ~PD_RS232_S_LOOP) )#define CONTINUE_SEND   1
-

Definition at line 61 of file cdcprolific.h.

+

Definition at line 67 of file cdcprolific.h.

- +
- +
#define FLOW_RX_AUTO   ( PD_RS232_A_RFR | PD_RS232_A_DTR | PD_RS232_A_RXO )#define PAUSE_SEND   2
-

Definition at line 57 of file cdcprolific.h.

+

Definition at line 68 of file cdcprolific.h.

- +
- +
#define FLOW_TX_AUTO   ( PD_RS232_A_CTS | PD_RS232_A_DSR | PD_RS232_A_TXO | PD_RS232_A_DCD )#define kRxAutoFlow   ((UInt32)( PD_RS232_A_RFR | PD_RS232_A_DTR | PD_RS232_A_RXO ))
-

Definition at line 58 of file cdcprolific.h.

+

Definition at line 70 of file cdcprolific.h.

- +
- +
#define GET_DCR0   0x80#define kTxAutoFlow   ((UInt32)( PD_RS232_A_CTS | PD_RS232_A_DSR | PD_RS232_A_TXO | PD_RS232_A_DCD ))
-

Definition at line 109 of file cdcprolific.h.

+

Definition at line 71 of file cdcprolific.h.

- +
- +
#define GET_DCR1   0x81#define kControl_StateMask   ((UInt32)( PD_RS232_S_CTS | PD_RS232_S_DSR | PD_RS232_S_CAR | PD_RS232_S_RI ))
-

Definition at line 115 of file cdcprolific.h.

+

Definition at line 72 of file cdcprolific.h.

- +
- +
#define GET_DCR2   0x82#define kRxQueueState   ((UInt32)( PD_S_RXQ_EMPTY | PD_S_RXQ_LOW_WATER | PD_S_RXQ_HIGH_WATER | PD_S_RXQ_FULL ))
-

Definition at line 120 of file cdcprolific.h.

+

Definition at line 73 of file cdcprolific.h.

- +
- +
#define INTERNAL_DELAY   ( PD_RS232_S_LOOP )#define kTxQueueState   ((UInt32)( PD_S_TXQ_EMPTY | PD_S_TXQ_LOW_WATER | PD_S_TXQ_HIGH_WATER | PD_S_TXQ_FULL ))
-

Definition at line 62 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define kBreakError   0x04
-
- -

Definition at line 90 of file cdcprolific.h.

+

Definition at line 74 of file cdcprolific.h.

@@ -596,59 +680,31 @@ Enumerations - +
- +
#define kControl_StateMask   ((UInt32)( PD_RS232_S_CTS | PD_RS232_S_DSR | PD_RS232_S_CAR | PD_RS232_S_RI ))#define kStateTransientMask   0x74
-

Definition at line 72 of file cdcprolific.h.

+

Definition at line 89 of file cdcprolific.h.

- +
- +
#define kCTS   0x80#define kBreakError   0x04
-

Definition at line 95 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define kDCD   0x01
-
- -

Definition at line 98 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define kDSR   0x02
-
- -

Definition at line 96 of file cdcprolific.h.

+

Definition at line 90 of file cdcprolific.h.

@@ -666,17 +722,17 @@ Enumerations - +
- +
#define kHandshakeInMask   ((UInt32)( PD_RS232_S_CTS | PD_RS232_S_DSR | PD_RS232_S_CAR | PD_RS232_S_RI ))#define kParityError   0x20
-

Definition at line 99 of file cdcprolific.h.

+

Definition at line 92 of file cdcprolific.h.

@@ -694,17 +750,31 @@ Enumerations - +
- +
#define kParityError   0x20#define kCTS   0x80
-

Definition at line 92 of file cdcprolific.h.

+

Definition at line 95 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define kDSR   0x02
+
+ +

Definition at line 96 of file cdcprolific.h.

@@ -722,213 +792,269 @@ Enumerations - +
- +
#define kRxAutoFlow   ((UInt32)( PD_RS232_A_RFR | PD_RS232_A_DTR | PD_RS232_A_RXO ))#define kDCD   0x01
-

Definition at line 70 of file cdcprolific.h.

+

Definition at line 98 of file cdcprolific.h.

- +
- +
#define kRxQueueState   ((UInt32)( PD_S_RXQ_EMPTY | PD_S_RXQ_LOW_WATER | PD_S_RXQ_HIGH_WATER | PD_S_RXQ_FULL ))#define kHandshakeInMask   ((UInt32)( PD_RS232_S_CTS | PD_RS232_S_DSR | PD_RS232_S_CAR | PD_RS232_S_RI ))
-

Definition at line 73 of file cdcprolific.h.

+

Definition at line 99 of file cdcprolific.h.

- +
- +
#define kStateTransientMask   0x74#define VENDOR_WRITE_REQUEST_TYPE   0x40
-

Definition at line 89 of file cdcprolific.h.

+

Definition at line 101 of file cdcprolific.h.

- +
- +
#define kTxAutoFlow   ((UInt32)( PD_RS232_A_CTS | PD_RS232_A_DSR | PD_RS232_A_TXO | PD_RS232_A_DCD ))#define VENDOR_WRITE_REQUEST   0x01
-

Definition at line 71 of file cdcprolific.h.

+

Definition at line 102 of file cdcprolific.h.

- +
- +
#define kTxQueueState   ((UInt32)( PD_S_TXQ_EMPTY | PD_S_TXQ_LOW_WATER | PD_S_TXQ_HIGH_WATER | PD_S_TXQ_FULL ))#define VENDOR_READ_REQUEST_TYPE   0xc0
-

Definition at line 74 of file cdcprolific.h.

+

Definition at line 104 of file cdcprolific.h.

- +
- +
#define kXOffChar   '\x13'#define VENDOR_READ_REQUEST   0x01
-

Definition at line 52 of file cdcprolific.h.

+

Definition at line 105 of file cdcprolific.h.

- +
- +
#define kXOnChar   '\x11'#define SET_DCR0   0x00
-

Definition at line 51 of file cdcprolific.h.

+

Definition at line 108 of file cdcprolific.h.

- +
- +
#define PAUSE_SEND   2#define GET_DCR0   0x80
-

Definition at line 68 of file cdcprolific.h.

+

Definition at line 109 of file cdcprolific.h.

- +
- +
#define PL_MAX_ENDPOINTS   4#define DCR0_INIT   0x01
-

Definition at line 139 of file cdcprolific.h.

+

Definition at line 110 of file cdcprolific.h.

- +
- +
#define PL_PID   ( 0x2303 || 0x0609 )#define DCR0_INIT_H   0x41
-

Definition at line 44 of file cdcprolific.h.

+

Definition at line 111 of file cdcprolific.h.

- +
- +
#define PL_VID   0x067B#define DCR0_INIT_X   0x61
-

Definition at line 43 of file cdcprolific.h.

+

Definition at line 112 of file cdcprolific.h.

- +
- +
#define PROLIFIC_REV_1   0x0001#define SET_DCR1   0x01
-

Definition at line 49 of file cdcprolific.h.

+

Definition at line 114 of file cdcprolific.h.

- +
- +
#define PROLIFIC_REV_H   0x0202#define GET_DCR1   0x81
-

Definition at line 46 of file cdcprolific.h.

+

Definition at line 115 of file cdcprolific.h.

- +
- +
#define PROLIFIC_REV_HX_CHIP_D   0x0400#define DCR1_INIT_H   0x80
-

Definition at line 48 of file cdcprolific.h.

+

Definition at line 116 of file cdcprolific.h.

- +
- +
#define PROLIFIC_REV_X   0x0300#define DCR1_INIT_X   0x00
-

Definition at line 47 of file cdcprolific.h.

+

Definition at line 117 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define SET_DCR2   0x02
+
+ +

Definition at line 119 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define GET_DCR2   0x82
+
+ +

Definition at line 120 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define DCR2_INIT_H   0x24
+
+ +

Definition at line 121 of file cdcprolific.h.

+ +
+
+ +
+
+ + + + +
#define DCR2_INIT_X   0x44
+
+ +

Definition at line 122 of file cdcprolific.h.

@@ -960,147 +1086,47 @@ Enumerations - +
- +
#define SET_DCR0   0x00#define PL_MAX_ENDPOINTS   4
-

Definition at line 108 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define SET_DCR1   0x01
-
- -

Definition at line 114 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define SET_DCR2   0x02
-
- -

Definition at line 119 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define SPECIAL_MASK   ((1<<SPECIAL_SHIFT) - 1)
-
- -

Definition at line 55 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define SPECIAL_SHIFT   (5)
-
- -

Definition at line 54 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define STATE_ALL   ( PD_RS232_S_MASK | PD_S_MASK )
-
- -

Definition at line 56 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define VENDOR_READ_REQUEST   0x01
-
- -

Definition at line 105 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define VENDOR_READ_REQUEST_TYPE   0xc0
-
- -

Definition at line 104 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define VENDOR_WRITE_REQUEST   0x01
-
- -

Definition at line 102 of file cdcprolific.h.

- -
-
- -
-
- - - - -
#define VENDOR_WRITE_REQUEST_TYPE   0x40
-
- -

Definition at line 101 of file cdcprolific.h.

+

Definition at line 139 of file cdcprolific.h.

Enumeration Type Documentation

+ +
+
+ + + + +
enum tXO_State
+
+ + + + + + +
Enumerator
kXOnSent  +
kXOffSent  +
kXO_Idle  +
kXOffNeeded  +
kXOnNeeded  +
+ +

Definition at line 80 of file cdcprolific.h.

+ +
+
@@ -1127,38 +1153,12 @@ Enumerations

Definition at line 128 of file cdcprolific.h.

-
-
- -
-
- - - - -
enum tXO_State
-
- - - - - - -
Enumerator
kXOnSent  -
kXOffSent  -
kXO_Idle  -
kXOffNeeded  -
kXOnNeeded  -
- -

Definition at line 80 of file cdcprolific.h.

-
diff --git a/cdcprolific_8h_source.html b/cdcprolific_8h_source.html index 965e668c..1b44f6d1 100644 --- a/cdcprolific_8h_source.html +++ b/cdcprolific_8h_source.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: cdcprolific.h Source File +USB Host Shield 2.0: cdcprolific.h Source File @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -270,7 +270,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 6bf21eb4..978ee1ba 100644 --- a/class_a_c_m-members.html +++ b/class_a_c_m-members.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: Member List +USB Host Shield 2.0: Member List @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
diff --git a/class_a_c_m.html b/class_a_c_m.html index d0dd9853..bb92bb5a 100644 --- a/class_a_c_m.html +++ b/class_a_c_m.html @@ -4,7 +4,7 @@ -USB_Host_Shield_2.0: ACM Class Reference +USB Host Shield 2.0: ACM Class Reference @@ -23,7 +23,7 @@ -
USB_Host_Shield_2.0 +
USB Host Shield 2.0
@@ -219,6 +219,100 @@ Static Protected Attributes

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
void ACM::PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTORep_ptr)
+
+protected
+
+ +

Definition at line 343 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
uint8_t ACM::SetCommFeature (uint16_t fid,
uint8_t nbytes,
uint8_t * dataptr 
)
+
+ +

Definition at line 307 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
uint8_t ACM::GetCommFeature (uint16_t fid,
uint8_t nbytes,
uint8_t * dataptr 
)
+
+ +

Definition at line 312 of file cdcacm.cpp.

+ +
+
@@ -235,6 +329,314 @@ Static Protected Attributes

Definition at line 317 of file cdcacm.cpp.

+
+
+ +
+
+ + + + + + + + +
uint8_t ACM::SetLineCoding (const LINE_CODINGdataptr)
+
+ +

Definition at line 322 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + + + + +
uint8_t ACM::GetLineCoding (LINE_CODINGdataptr)
+
+ +

Definition at line 327 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + + + + +
uint8_t ACM::SetControlLineState (uint8_t state)
+
+ +

Definition at line 332 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + + + + +
uint8_t ACM::SendBreak (uint16_t duration)
+
+ +

Definition at line 337 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
uint8_t ACM::GetNotif (uint16_t * bytes_rcvd,
uint8_t * dataptr 
)
+
+ +

Definition at line 302 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
uint8_t ACM::RcvData (uint16_t * nbytesptr,
uint8_t * dataptr 
)
+
+ +

Definition at line 291 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
uint8_t ACM::SndData (uint16_t nbytes,
uint8_t * dataptr 
)
+
+ +

Definition at line 296 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
uint8_t ACM::Init (uint8_t parent,
uint8_t port,
bool lowspeed 
)
+
+virtual
+
+ +

Implements USBDeviceConfig.

+ +

Reimplemented in PL2303.

+ +

Definition at line 50 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
uint8_t ACM::Release ()
+
+virtual
+
+ +

Implements USBDeviceConfig.

+ +

Definition at line 239 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
uint8_t ACM::Poll ()
+
+virtual
+
+ +

Implements USBDeviceConfig.

+ +

Definition at line 254 of file cdcacm.cpp.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual uint8_t ACM::GetAddress ()
+
+inlinevirtual
+
+ +

Implements USBDeviceConfig.

+ +

Definition at line 204 of file cdcacm.h.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual bool ACM::isReady ()
+
+inlinevirtual
+
+ +

Definition at line 205 of file cdcacm.h.

+
@@ -293,7 +695,8 @@ Static Protected Attributes - +

Member Data Documentation

+
@@ -301,106 +704,21 @@ Static Protected Attributes +staticprotected
- - - - +
virtual uint8_t ACM::GetAddress ()const uint8_t ACM::epDataInIndex = 1
-inlinevirtual
-

Implements USBDeviceConfig.

- -

Definition at line 204 of file cdcacm.h.

+

Definition at line 165 of file cdcacm.h.

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
uint8_t ACM::GetCommFeature (uint16_t fid,
uint8_t nbytes,
uint8_t * dataptr 
)
-
- -

Definition at line 312 of file cdcacm.cpp.

- -
-
- -
-
- - - - - - - - -
uint8_t ACM::GetLineCoding (LINE_CODINGdataptr)
-
- -

Definition at line 327 of file cdcacm.cpp.

- -
-
- -
-
- - - - - - - - - - - - - - - - - - -
uint8_t ACM::GetNotif (uint16_t * bytes_rcvd,
uint8_t * dataptr 
)
-
- -

Definition at line 302 of file cdcacm.cpp.

- -
-
- +
@@ -408,45 +726,21 @@ Static Protected Attributes +staticprotected
- - - - - - - - - - - - - - - - - - - - - +
uint8_t ACM::Init (uint8_t parent,
uint8_t port,
bool lowspeed 
)const uint8_t ACM::epDataOutIndex = 2
-virtual
-

Implements USBDeviceConfig.

- -

Reimplemented in PL2303.

- -

Definition at line 50 of file cdcacm.cpp.

+

Definition at line 166 of file cdcacm.h.

- +
@@ -454,24 +748,21 @@ Static Protected Attributes +staticprotected
- - - - +
virtual bool ACM::isReady ()const uint8_t ACM::epInterruptInIndex = 3
-inlinevirtual
-

Definition at line 205 of file cdcacm.h.

+

Definition at line 167 of file cdcacm.h.

- +
@@ -479,38 +770,7 @@ Static Protected Attributes - - -
- - - - - -
uint8_t ACM::Poll ()
-
-virtual
-
- -

Implements USBDeviceConfig.

- -

Definition at line 254 of file cdcacm.cpp.

- -
-
- -
-
- - - @@ -520,39 +780,11 @@ Static Protected Attributes
- - - - - - - +
void ACM::PrintEndpointDescriptor (const USB_ENDPOINT_DESCRIPTORep_ptr)USB* ACM::pUsb
-

Definition at line 343 of file cdcacm.cpp.

+

Definition at line 169 of file cdcacm.h.

- -
-
- - - - - - - - - - - - - - - - - - -
uint8_t ACM::RcvData (uint16_t * nbytesptr,
uint8_t * dataptr 
)
-
- -

Definition at line 291 of file cdcacm.cpp.

- -
-
- +
@@ -560,142 +792,20 @@ Static Protected Attributes +protected
- - - - +
uint8_t ACM::Release ()CDCAsyncOper* ACM::pAsync
-virtual
-

Implements USBDeviceConfig.

- -

Definition at line 239 of file cdcacm.cpp.

+

Definition at line 170 of file cdcacm.h.

- -
-
- - - - - - - - -
uint8_t ACM::SendBreak (uint16_t duration)
-
- -

Definition at line 337 of file cdcacm.cpp.

- -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
uint8_t ACM::SetCommFeature (uint16_t fid,
uint8_t nbytes,
uint8_t * dataptr 
)
-
- -

Definition at line 307 of file cdcacm.cpp.

- -
-
- -
-
- - - - - - - - -
uint8_t ACM::SetControlLineState (uint8_t state)
-
- -

Definition at line 332 of file cdcacm.cpp.

- -
-
- -
-
- - - - - - - - -
uint8_t ACM::SetLineCoding (const LINE_CODINGdataptr)
-
- -

Definition at line 322 of file cdcacm.cpp.

- -
-
- -
-
- - - - - - - - - - - - - - - - - - -
uint8_t ACM::SndData (uint16_t nbytes,
uint8_t * dataptr 
)
-
- -

Definition at line 296 of file cdcacm.cpp.

- -
-
-

Member Data Documentation

@@ -804,160 +914,6 @@ Static Protected Attributes

Definition at line 175 of file cdcacm.h.

-
-
- -
-
- - - - - -
- - - - -
bool ACM::bPollEnable
-
-protected
-
- -

Definition at line 177 of file cdcacm.h.

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

Definition at line 165 of file cdcacm.h.

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

Definition at line 166 of file cdcacm.h.

- -
-
- -
-
- - - - - -
- - - - -
EpInfo ACM::epInfo[ACM_MAX_ENDPOINTS]
-
-protected
-
- -

Definition at line 180 of file cdcacm.h.

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

Definition at line 167 of file cdcacm.h.

- -
-
- -
-
- - - - - -
- - - - -
CDCAsyncOper* ACM::pAsync
-
-protected
-
- -

Definition at line 170 of file cdcacm.h.

- -
-
- -
-
- - - - - -
- - - - -
USB* ACM::pUsb
-
-protected
-
- -

Definition at line 169 of file cdcacm.h.

-
@@ -980,6 +936,28 @@ Static Protected Attributes

Definition at line 176 of file cdcacm.h.

+ + + +
+
+ + + + + +
+ + + + +
bool ACM::bPollEnable
+
+protected
+
+ +

Definition at line 177 of file cdcacm.h.

+
@@ -1002,6 +980,28 @@ Static Protected Attributes

Definition at line 178 of file cdcacm.h.

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

Definition at line 180 of file cdcacm.h.

+

The documentation for this class was generated from the following files: