libjoybus
Joybus implementation for 32-bit MCUs
Loading...
Searching...
No Matches
n64_controller.h File Reference

Common definitions for N64 controllers. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  joybus_n64_controller_state
 N64 controller input state. More...

Macros

#define JOYBUS_N64_BUTTON_RIGHT   (1 << 0)
 N64 controller button bitmask flags.
#define JOYBUS_N64_BUTTON_LEFT   (1 << 1)
#define JOYBUS_N64_BUTTON_DOWN   (1 << 2)
#define JOYBUS_N64_BUTTON_UP   (1 << 3)
#define JOYBUS_N64_BUTTON_START   (1 << 4)
#define JOYBUS_N64_BUTTON_Z   (1 << 5)
#define JOYBUS_N64_BUTTON_B   (1 << 6)
#define JOYBUS_N64_BUTTON_A   (1 << 7)
#define JOYBUS_N64_BUTTON_C_RIGHT   (1 << 8)
#define JOYBUS_N64_BUTTON_C_LEFT   (1 << 9)
#define JOYBUS_N64_BUTTON_C_DOWN   (1 << 10)
#define JOYBUS_N64_BUTTON_C_UP   (1 << 11)
#define JOYBUS_N64_BUTTON_R   (1 << 12)
#define JOYBUS_N64_BUTTON_L   (1 << 13)
#define JOYBUS_N64_RST   (1 << 15)
#define JOYBUS_N64_BUTTON_MASK   0x3FFF

Functions

struct joybus_n64_controller_state __attribute__ ((packed))

Variables

uint16_t buttons
 Button state.
int8_t stick_x
 Stick x-axis position, nominally -80..80.
int8_t stick_y
 Stick y-axis position, nominally -80..80.

Detailed Description

Common definitions for N64 controllers.

Macro Definition Documentation

◆ JOYBUS_N64_BUTTON_RIGHT

#define JOYBUS_N64_BUTTON_RIGHT   (1 << 0)

N64 controller button bitmask flags.

These test the buttons field of joybus_n64_controller_state. Bits 0-7 correspond to the first button byte of the wire input state, bits 8-15 to the second.