libjoybus
Joybus implementation for 32-bit MCUs
Loading...
Searching...
No Matches
n64_controller.h
1
9
10#pragma once
11
12#include <joybus/bus.h>
13#include <joybus/identify.h>
14#include <joybus/target.h>
16#include <joybus/target/n64_pak.h>
17
19
21#define JOYBUS_TARGET_N64_CONTROLLER(target) ((struct joybus_target_n64_controller *)(target))
22
29
58
68
77
85 struct joybus_target_n64_pak *pak);
86
93
Common definitions for N64 controllers.
void joybus_target_n64_controller_set_reset_cb(struct joybus_target_n64_controller *controller, joybus_target_n64_controller_reset_cb callback)
Set the reset callback for the controller.
Definition n64_controller.c:263
void joybus_target_n64_controller_calibrate(struct joybus_target_n64_controller *controller)
Sample the current stick position as the controller's neutral origin.
Definition n64_controller.c:293
void joybus_target_n64_controller_detach_pak(struct joybus_target_n64_controller *controller)
Detach the currently attached pak from the controller.
Definition n64_controller.c:283
void joybus_target_n64_controller_init(struct joybus_target_n64_controller *controller)
Initialize an N64 controller.
Definition n64_controller.c:249
void(* joybus_target_n64_controller_reset_cb)(struct joybus_target_n64_controller *controller)
Callback type for N64 controller reset events.
Definition n64_controller.h:28
void joybus_target_n64_controller_attach_pak(struct joybus_target_n64_controller *controller, struct joybus_target_n64_pak *pak)
Attach an pak to the controller.
Definition n64_controller.c:269
#define JOYBUS_BLOCK_SIZE
Maximum size of a Joybus transfer, in bytes.
Definition bus.h:53
Joybus device identification values and utilities.
Represents the 3-byte ID field from an "identify" buffer.
Definition identify.h:98
N64 controller input state.
Definition n64_controller.h:42
N64 controller Joybus target.
Definition n64_controller.h:33
struct joybus_n64_controller_state input
Current input state.
Definition n64_controller.h:44
joybus_target_n64_controller_reset_cb on_reset
Callback for controller reset events.
Definition n64_controller.h:47
struct joybus_n64_controller_state origin
Origin input state.
Definition n64_controller.h:41
uint8_t response[JOYBUS_BLOCK_SIZE]
Response buffer.
Definition n64_controller.h:56
struct joybus_target base
Base target interface.
Definition n64_controller.h:35
uint8_t crc
CRC for data transfer commands.
Definition n64_controller.h:53
struct joybus_id id
Controller ID.
Definition n64_controller.h:38
struct joybus_target_n64_pak * pak
Currently attached pak (if any)
Definition n64_controller.h:50
An N64 pak, such as a Rumble Pak or Controller Pak.
Definition n64_pak.h:76
Interface for a Joybus target, a device on the Joybus which responds to commands from a host.
Definition target.h:69