41 struct io_avr_buttons
btn;
48 {joy_pos.
x, joy_pos.
y,
btn.right,
btn.left,
btn.nav, 0, 0, 0},
Handles CAN communication for game control, joystick, and buttons.
int8_t can_write(struct can_device *dev, struct CAN_frame msg)
Write a CAN frame to the MCP2515 transmit buffer.
int can_rxq_pull(struct CAN_frame *out)
Pull a CAN frame from the internal receive queue.
int8_t tx_error(struct can_device *can_dev)
Sends an error message via CAN.
uint8_t process_can_frame(struct control_state *ctrl)
Processes an incoming CAN frame.
int8_t tx_reset(struct can_device *can_dev)
Sends a reset message via CAN.
int8_t tx_joy_btn(struct io_joystick_device *joy_dev, struct io_avr_device *avr_dev, struct can_device *can_dev)
Transmits joystick positions and button states via CAN.
int8_t tx_gamestart(struct can_device *can_dev)
Sends a game start message via CAN.
int io_joystick_read_position(struct io_joystick_device *dev, struct io_joystick_position *buffer)
Read the position of a joystick as a percentage from 0 in each axis.
int io_avr_buttons_read(struct io_avr_device *dev, struct io_avr_buttons *btn)
#define LOG_CRITICAL(msg)
#define LOG_MODULE_DEFINE(name)
Driver for joystick, buttons, and OLED.
Logging interface for debug messages.
struct control_state ctrl
struct io_avr_buttons btn
Represents a full CAN frame for sending/receiving.
Represents a CAN device, storing the SPI slave controlling the MCP2515.
Stores current control state.
Represents an SPI-connected AVR-I/O board.
Represents a joystick input device.
Represents the position of a joystick relative to center.