34#include <joybus/attributes.h>
35#include <joybus/errors.h>
40#define JOYBUS_TARGET(target) ((struct joybus_target *)(target))
97 return target->
api->
byte_received(target, command, byte_idx, send_response, user_data);
static int joybus_target_byte_received(struct joybus_target *target, const uint8_t *command, uint8_t byte_idx, joybus_target_response_cb send_response, void *user_data)
Handle a received command byte for a Joybus target.
Definition target.h:90
void(* joybus_target_response_cb)(const uint8_t *response, uint8_t len, void *user_data)
Callback type for sending responses from target command handlers.
Definition target.h:49
static bool joybus_target_is_attached(struct joybus_target *target)
Check if a target is currently attached to a bus.
Definition target.h:106
@ JOYBUS_ERR_NOT_SUPPORTED
Command not supported by Joybus target.
Definition errors.h:27
API for implementing a Joybus target.
Definition target.h:54
int(* byte_received)(struct joybus_target *target, const uint8_t *command, uint8_t byte_idx, joybus_target_response_cb send_response, void *user_data)
Handle a received command byte.
Definition target.h:65
Interface for a Joybus target, a device on the Joybus which responds to commands from a host.
Definition target.h:72
bool attached
Whether the target is currently attached to a bus.
Definition target.h:77
const struct joybus_target_api * api
API for handling received commands.
Definition target.h:74