|
wiiuse
|
Functions | |
| void | wiiuse_handshake (struct wiimote_t *wm, byte *data, uint16_t len) |
| int | wiiuse_wait_report (struct wiimote_t *wm, int report, byte *buffer, int bufferLength, unsigned long timeout_ms) |
| Wait until specified report arrives and return it. More... | |
| void | wiiuse_read_data_sync (struct wiimote_t *wm, byte memory, unsigned addr, unsigned short size, byte *data) |
| Read memory/register data synchronously. More... | |
| void | wiiuse_decode_accel_calibration_lsb (struct accel_t *accel, byte *buf) |
| Decode the extra low-order accelerometer calibration bits packed into the EEPROM calibration block. More... | |
| void | wiiuse_init_platform_fields (struct wiimote_t *wm) |
| void | wiiuse_cleanup_platform_fields (struct wiimote_t *wm) |
| int | wiiuse_os_find (struct wiimote_t **wm, int max_wiimotes, int timeout) |
| int | wiiuse_os_connect (struct wiimote_t **wm, int wiimotes) |
| void | wiiuse_os_disconnect (struct wiimote_t *wm) |
| int | wiiuse_os_poll (struct wiimote_t **wm, int wiimotes) |
| int | wiiuse_os_read (struct wiimote_t *wm, byte *buf, int len) |
| int | wiiuse_os_write (struct wiimote_t *wm, byte report_type, byte *buf, int len) |
| unsigned long | wiiuse_os_ticks () |
| void wiiuse_decode_accel_calibration_lsb | ( | struct accel_t * | accel, |
| byte * | buf | ||
| ) |
Decode the extra low-order accelerometer calibration bits packed into the EEPROM calibration block.
| accel | Calibration struct to fill in (cal_zero, cal_g and their _lsb). |
| buf | The 8 calibration bytes read from WM_MEM_OFFSET_CALIBRATION. |
buf[3]/buf[7] pack the zero-point/one-g point's extra bits (layout per Dolphin's WiimoteCommon::AccelCalibrationData), matching what handle_wm_accel() decodes for live readings.
cal_g/cal_g_lsb together hold the full-precision delta between the one-g and zero points, so the zero point's extra bits borrow correctly.
Always compiled so it can be unit tested; wiiuse_handshake() only calls it under WIIUSE_ACCEL_10BIT.
| void wiiuse_read_data_sync | ( | struct wiimote_t * | wm, |
| byte | memory, | ||
| unsigned | addr, | ||
| unsigned short | size, | ||
| byte * | data | ||
| ) |
Read memory/register data synchronously.
| wm | Pointer to a wiimote_t structure. |
| memory | If set to non-zero, reads EEPROM, otherwise registers |
| addr | Address offset to read from |
| size | How many bytes to read |
| data | Pre-allocated memory to store the received data |
Synchronous/blocking read, this function will not return until it receives the specified amount of data from the Wiimote.
| int wiiuse_wait_report | ( | struct wiimote_t * | wm, |
| int | report, | ||
| byte * | buffer, | ||
| int | bufferLength, | ||
| unsigned long | timeout_ms | ||
| ) |
Wait until specified report arrives and return it.
| wm | Pointer to a wiimote_t structure. |
| buffer | Pre-allocated memory to store the received data |
| bufferLength | size of buffer in bytes |
| timeout_ms | timeout in ms, 0 = wait forever |
Synchronous/blocking, this function will not return until it receives the specified report from the Wiimote or timeout occurs.
Returns 1 on success, -1 on failure.
1.8.13