Circle Pad Pro: Difference between revisions

Mailwl (talk | contribs)
Request 2: Read Calibration Data?: Add calibration data format
 
(3 intermediate revisions by one other user not shown)
Line 10: Line 10:
Communications with this device is done via the [[IR_Services|ir:USER]] service, which uses obfuscation implemented in software. The [[IRU:SetBitRate|bitrate-value]] passed to IRUSER is 0x04, hence the actual bps is 96000.
Communications with this device is done via the [[IR_Services|ir:USER]] service, which uses obfuscation implemented in software. The [[IRU:SetBitRate|bitrate-value]] passed to IRUSER is 0x04, hence the actual bps is 96000.


The application sends requests via [[IRUSER:SendIrnop]] and receives response from Circle Pad Pro via [[IRUSER:ReceiveIrnop]] (or read data from the [[IRUSER_Shared_Memory|shared memory]]). The request and response data structures below are payloads in packets.
The application sends requests via [[IRUSER:SendIrnop]] and receives response from Circle Pad Pro via [[IRUSER:ReceiveIrnop]] (or read data from the [[IRUSER_Shared_Memory|shared memory]]). The request and response data structures below are payloads in packets. Each request begins with a one-byte ID that determines the request type.


=== Read Input ===
=== Request 1: Read Input ===


Request (3 bytes):
Request (3 bytes):
Line 44: Line 44:
| 0x0
| 0x0
| 0x1
| 0x1
| Response ID? Fixed value 0x11 (Really 0x11? Should be 0x10)
| Response ID? Fixed value 0x10
|-
|-
| 0x1
| 0x1
Line 52: Line 52:
|-
|-
| 0x4
| 0x4
| 0x2
| 0x1
| bit[0:4] battery level?
| bit[0:4] battery level?
bit[5] ZL button
bit[5] ZL button
Line 61: Line 61:


Note that for the three button fields, the bit is set when the button is NOT pressed.
Note that for the three button fields, the bit is set when the button is NOT pressed.
|-
| 0x5
| 0x1
| Unknown
|}
|}


=== Read Calibration Data? ===
=== Request 2: Read Calibration Data? ===


Request (6 bytes):
Request (6 bytes):
Line 82: Line 86:
| 0x2
| 0x2
| 0x2
| 0x2
| Data offset? (aligned to 0x10?)
| Data offset (aligned to 0x10)
|-
|-
| 0x4
| 0x4
| 0x2
| 0x2
| Data size (aligned to 0x10?)
| Data size (aligned to 0x10)
|}
|}


Line 102: Line 106:
| 0x1
| 0x1
| 0x2
| 0x2
| Unknown. Same as request+0x2
| Data offset. Same as Request+0x2
|-
|-
| 0x3
| 0x2
| 0x2
| Data size. Same as Request+0x4
|-
| 0x5
| data size
| calibration data
|}
Calibration data:
{| class="wikitable" border="1"
|-
!  offset
!  Size
!  Description
|-
| 0x0
| 0x1
| Unknown
|-
| 0x1
| 0x3
| Right circle pad offset.
These three bytes are two little-endian 12-bit fields. The lower one is for x-axis and the upper one is for y-axis.
|-
| 0x4
| 0x4
| Right circle pad x-axis scale factor (floating-point).
|-
| 0x8
| 0x4
| Right circle pad y-axis scale factor (floating-point).
|-
| 0xC
| 0x3
| Unknown
|-
| 0xF
| 0x1
| [[CRC-8-CCITT]] over data above
|}
The Circle Pad Pro contains many sets of calibration data. Sets with an invalid CRC checksum should be ignored.
To calculate the right circle pad's position, first subtract the calibration offset from the value reported in the "Read Input" request, then multiply by the scaling factor. Dividing the result by 8 gives a value with a similar range to that of the left circle pad: -0x9C(bottom/left) - 0x9C(top/right).
=== Request 3 ===
Request (22 bytes?):
{| class="wikitable" border="1"
|-
!  offset
!  Size
!  Description
|-
| 0x0
| 0x1
| Request ID (fixed value 3)
|-
| 0x1
| 0x1
| Expected response time in ms?
|-
| 0x2
| ...
| ?
|}
Response (2 bytes?):
{| class="wikitable" border="1"
|-
!  offset
!  Size
!  Description
|-
| 0x0
| 0x1
| Response ID? Fixed value 0x12
|-
| 0x1
| 0x1
| 0?
|}
=== Request 4: Reset Calibration Data? ===
Request (3 bytes?):
{| class="wikitable" border="1"
|-
!  offset
!  Size
!  Description
|-
| 0x0
| 0x1
| Request ID (fixed value 4)
|-
| 0x1
| 0x1
| Expected response time in ms?
|-
| 0x2
| 0x2
| Data size
| 0x1
| ?
|}
 
 
Response (2 bytes?):
{| class="wikitable" border="1"
|-
|-
| 0x4
!  offset
| data size
!  Size
| calibration data?
!  Description
|-
| 0x0
| 0x1
| Response ID? Fixed value 0x13
|-
| 0x1
| 0x1
| 0?
|}
 
=== Request 5 ===
Request (2 bytes):
{| class="wikitable" border="1"
|-
!  offset
!  Size
!  Description
|-
| 0x0
| 0x1
| Request ID (fixed value 5)
|-
| 0x1
| 0x1
| Expected response time in ms?
|}
 
 
Response (2 bytes?):
{| class="wikitable" border="1"
|-
!  offset
!  Size
!  Description
|-
| 0x0
| 0x1
| Response ID? Fixed value 0x14
|-
| 0x1
| 0x1
| ?
|}
|}