Joy-Con: Difference between revisions

Clean up and merge in preparation for documentation
Add HID reports
Line 33: Line 33:


= Protocol =
= Protocol =
The Joy-Con can communicate wirelessly over Bluetooth or through the rails over UART. This uses a Nintendo proprietary protocol called "Nwcp".  
The Joy-Con can communicate wirelessly over Bluetooth or through the rails over UART. The latter uses a Nintendo proprietary protocol called "Nwcp".  


== NwcpPacket ==
== NwcpPacket ==
Line 139: Line 139:
|-
|-
| 0xA5 || Handshake
| 0xA5 || Handshake
|}
== HidCommandInputReport ==
This is a 0x31-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| LatencyTimer
|-
| 0x2
| 0x1
| PowerInfo
|-
| 0x3
| 0x1
| RightPadButtonStatus
|-
| 0x4
| 0x1
| SharedButtonStatus
|-
| 0x5
| 0x1
| LeftPadButtonStatus
|-
| 0x6
| 0x3
| LeftAnalogStickData
|-
| 0x9
| 0x3
| RightAnalogStickData
|-
| 0xC
| 0x1
| MotorStatus
|-
| 0xD
| 0x1
| CommandAck
|-
| 0xE
| 0x1
| [[#HidCommand|CommandId]]
|-
| 0xF
| 0x22
| CommandReply
|}
== HidMcuUpdateInputReport ==
This is a 0x30-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| LatencyTimer
|-
| 0x2
| 0x1
| PowerInfo
|-
| 0x3
| 0x1
| RightPadButtonStatus
|-
| 0x4
| 0x1
| SharedButtonStatus
|-
| 0x5
| 0x1
| LeftPadButtonStatus
|-
| 0x6
| 0x3
| LeftAnalogStickData
|-
| 0x9
| 0x3
| RightAnalogStickData
|-
| 0xC
| 0x1
| MotorStatus
|-
| 0xD
| 0x23
| McuUpdateData
|}
== HidBasicInputReport ==
This is a 0x31-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| LatencyTimer
|-
| 0x2
| 0x1
| PowerInfo
|-
| 0x3
| 0x1
| RightPadButtonStatus
|-
| 0x4
| 0x1
| SharedButtonStatus
|-
| 0x5
| 0x1
| LeftPadButtonStatus
|-
| 0x6
| 0x3
| LeftAnalogStickData
|-
| 0x9
| 0x3
| RightAnalogStickData
|-
| 0xC
| 0x1
| MotorStatus
|-
| 0xD
| 0x24
| BasicData
|}
== HidMcuInputReport ==
This is a 0x16A-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| LatencyTimer
|-
| 0x2
| 0x1
| PowerInfo
|-
| 0x3
| 0x1
| RightPadButtonStatus
|-
| 0x4
| 0x1
| SharedButtonStatus
|-
| 0x5
| 0x1
| LeftPadButtonStatus
|-
| 0x6
| 0x3
| LeftAnalogStickData
|-
| 0x9
| 0x3
| RightAnalogStickData
|-
| 0xC
| 0x1
| MotorStatus
|-
| 0xD
| 0x6
| SensorAccelSample0
|-
| 0x13
| 0x6
| SensorGyroSample0
|-
| 0x19
| 0x6
| SensorAccelSample1
|-
| 0x1F
| 0x6
| SensorGyroSample1
|-
| 0x25
| 0x6
| SensorAccelSample2
|-
| 0x2B
| 0x6
| SensorGyroSample2
|-
| 0x31
| 0x139
| McuData
|}
== HidAttachmentInputReport ==
This is a 0x16A-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| LatencyTimer
|-
| 0x2
| 0x1
| PowerInfo
|-
| 0x3
| 0x1
| RightPadButtonStatus
|-
| 0x4
| 0x1
| SharedButtonStatus
|-
| 0x5
| 0x1
| LeftPadButtonStatus
|-
| 0x6
| 0x3
| LeftAnalogStickData
|-
| 0x9
| 0x3
| RightAnalogStickData
|-
| 0xC
| 0x1
| MotorStatus
|-
| 0xD
| 0x6
| SensorAccelSample0
|-
| 0x13
| 0x6
| SensorGyroSample0
|-
| 0x19
| 0x6
| SensorAccelSample1
|-
| 0x1F
| 0x6
| SensorGyroSample1
|-
| 0x25
| 0x6
| SensorAccelSample2
|-
| 0x2B
| 0x6
| SensorGyroSample2
|-
| 0x31
| 0x139
| AttachmentData
|}
== HidGenericInputReport ==
This is a 0xC-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x2
| ButtonStatus
|-
| 0x3
| 0x1
| StickHatData
|-
| 0x4
| 0x4
| LeftAnalogStickData
|-
| 0x8
| 0x4
| RightAnalogStickData
|}
== HidCommandOutputReport ==
This is a 0x31-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| PacketNumber
|-
| 0x2
| 0x8
| MotorData
|-
| 0xA
| 0x1
| [[#HidCommand|CommandId]]
|-
| 0xB
| 0x26
| CommandData
|}
== HidMcuUpdateOutputReport ==
This is a 0x13E-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| PacketNumber
|-
| 0x2
| 0x8
| MotorData
|-
| 0xA
| 0x134
| McuUpdateData
|}
== HidBasicOutputReport ==
This is a 0xA-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| PacketNumber
|-
| 0x2
| 0x8
| MotorData
|}
== HidMcuOutputReport ==
This is a 0x30-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| PacketNumber
|-
| 0x2
| 0x8
| MotorData
|-
| 0xA
| 0x26
| McuData
|}
== HidAttachmentOutputReport ==
This is a 0x30-byte struct.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x1
| [[#HidReportId|ReportId]]
|-
| 0x1
| 0x1
| PacketNumber
|-
| 0x2
| 0x8
| MotorData
|-
| 0xA
| 0x26
| AttachmentData
|}
== HidReportId ==
{| class="wikitable" border="1"
! Value
! Description
|-
| 0x01 || CommandOutputReport
|-
| 0x03 || McuUpdateOutputReport
|-
| 0x10 || BasicOutputReport
|-
| 0x11 || McuOutputReport
|-
| 0x12 || AttachmentOutputReport
|-
| 0x21 || CommandInputReport
|-
| 0x23 || McuUpdateInputReport
|-
| 0x30 || BasicInputReport
|-
| 0x31 || McuInputReport
|-
| 0x32 || AttachmentInputReport
|-
| 0x33 ||
|-
| 0x3F || GenericInputReport
|-
| 0x80 || ExtGripOutputReport
|-
| 0x81 || ExtGripInputReport
|}
|}