mirror of
https://gitea.tendokyu.moe/Dniel97/segatools.git
synced 2024-12-18 06:45:53 +01:00
9ea6e09fdc
This makes things more consistent with the button/analog APIs.
36 lines
815 B
C
36 lines
815 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "jvs/jvs-bus.h"
|
|
|
|
struct io3_switch_state {
|
|
/* Note: this struct is host-endian. The IO3 emulator handles the conversion
|
|
to protocol-endian. */
|
|
|
|
uint8_t system;
|
|
uint16_t p1;
|
|
uint16_t p2;
|
|
};
|
|
|
|
struct io3_ops {
|
|
void (*reset)(void *ctx);
|
|
void (*write_gpio)(void *ctx, uint32_t state);
|
|
void (*read_switches)(void *ctx, struct io3_switch_state *out);
|
|
void (*read_analogs)(void *ctx, uint16_t *analogs, uint8_t nanalogs);
|
|
void (*read_coin_counter)(void *ctx, uint8_t slot_no, uint16_t *out);
|
|
};
|
|
|
|
struct io3 {
|
|
struct jvs_node jvs;
|
|
uint8_t addr;
|
|
const struct io3_ops *ops;
|
|
void *ops_ctx;
|
|
};
|
|
|
|
void io3_init(
|
|
struct io3 *io3,
|
|
struct jvs_node *next,
|
|
const struct io3_ops *ops,
|
|
void *ops_ctx);
|