libjoybus
Joybus implementation for 32-bit MCUs
Loading...
Searching...
No Matches
N64 Commands

Topics

 N64 Rumble Pak Commands

Functions

int joybus_n64_read (struct joybus *bus, struct joybus_n64_controller_state *response)
 Read the current input state of an N64 controller or mouse.
int joybus_n64_read_async (struct joybus *bus, struct joybus_n64_controller_state *response, joybus_transfer_cb callback, void *user_data)
 Read the current input state of an N64 controller or mouse, asynchronously.
int joybus_n64_pak_write (struct joybus *bus, uint16_t addr, const void *data, uint8_t response[JOYBUS_CMD_N64_PAK_WRITE_RX])
 Write a block of data to the pak attached to an N64 controller.
int joybus_n64_pak_write_async (struct joybus *bus, uint16_t addr, const uint8_t data[JOYBUS_PAK_BLOCK_SIZE], uint8_t response[JOYBUS_CMD_N64_PAK_WRITE_RX], joybus_transfer_cb callback, void *user_data)
 Write a block of data to the pak attached to an N64 controller, asynchronously.
int joybus_n64_pak_read (struct joybus *bus, uint16_t addr, uint8_t response[JOYBUS_CMD_N64_PAK_READ_RX])
 Read a block of data from the pak attached to an N64 controller.
int joybus_n64_pak_read_async (struct joybus *bus, uint16_t addr, uint8_t response[JOYBUS_CMD_N64_PAK_READ_RX], joybus_transfer_cb callback, void *user_data)
 Read a block of data from the pak attached to an N64 controller, asynchronously.

Detailed Description

Function Documentation

◆ joybus_n64_pak_read()

int joybus_n64_pak_read ( struct joybus * bus,
uint16_t addr,
uint8_t response[JOYBUS_CMD_N64_PAK_READ_RX] )

Read a block of data from the pak attached to an N64 controller.

The response buffer will be populated with 32 bytes of data read from the pak, followed by a checksum.

Parameters
busthe Joybus instance to use
addrthe address to read from, must be 32-byte aligned
responsebuffer to store the response in
Returns
0 on success, a negative joybus_error on failure

◆ joybus_n64_pak_read_async()

int joybus_n64_pak_read_async ( struct joybus * bus,
uint16_t addr,
uint8_t response[JOYBUS_CMD_N64_PAK_READ_RX],
joybus_transfer_cb callback,
void * user_data )

Read a block of data from the pak attached to an N64 controller, asynchronously.

The response buffer will be populated with 32 bytes of data read from the pak, followed by a checksum.

Parameters
busthe Joybus to use
addrthe address to read from, must be 32-byte aligned
responsebuffer to store the response in, must be at least JOYBUS_CMD_N64_PAK_READ_RX bytes
callbacka callback function to call when the transfer is complete
user_datauser data to pass to the callback function
Returns
0 if the transfer was started, a negative joybus_error otherwise

◆ joybus_n64_pak_write()

int joybus_n64_pak_write ( struct joybus * bus,
uint16_t addr,
const void * data,
uint8_t response[JOYBUS_CMD_N64_PAK_WRITE_RX] )

Write a block of data to the pak attached to an N64 controller.

The response buffer will be populated with a checksum of the written data (see joybus_data_checksum)

Parameters
busthe Joybus instance to use
addrthe address to read from, must be 32-byte aligned
databuffer to store the data in
responsebuffer to store the response in
Returns
0 on success, a negative joybus_error on failure

◆ joybus_n64_pak_write_async()

int joybus_n64_pak_write_async ( struct joybus * bus,
uint16_t addr,
const uint8_t data[JOYBUS_PAK_BLOCK_SIZE],
uint8_t response[JOYBUS_CMD_N64_PAK_WRITE_RX],
joybus_transfer_cb callback,
void * user_data )

Write a block of data to the pak attached to an N64 controller, asynchronously.

The response buffer will be populated with a checksum of the written data (see joybus_data_checksum).

Parameters
busthe Joybus instance to use
addrthe address to write to, must be 32-byte aligned
datathe data to write
responsebuffer to store the response in
callbacka callback function to call when the transfer is complete
user_datauser data to pass to the callback function
Returns
0 if the transfer was started, a negative joybus_error otherwise

◆ joybus_n64_read()

int joybus_n64_read ( struct joybus * bus,
struct joybus_n64_controller_state * response )

Read the current input state of an N64 controller or mouse.

Parameters
busthe Joybus instance to use
responsebuffer to store the response in
Returns
0 on success, a negative joybus_error on failure

Read the current input state of an N64 controller or mouse.

◆ joybus_n64_read_async()

int joybus_n64_read_async ( struct joybus * bus,
struct joybus_n64_controller_state * response,
joybus_transfer_cb callback,
void * user_data )

Read the current input state of an N64 controller or mouse, asynchronously.

Parameters
busthe Joybus instance to use
responsebuffer to store the response in
callbacka callback function to call when the transfer is complete
user_datauser data to pass to the callback function
Returns
0 if the transfer was started, a negative joybus_error otherwise