libjoybus
Joybus implementation for 32-bit MCUs
Loading...
Searching...
No Matches
rp2xxx Directory Reference

Detailed Description

Gecko Backend for rp2xxx

Usage

// Store the bus instance somewhere
struct joybus_rp2xxx rp2xxx_bus;
// Initialize the rp2xxx joybus interface
// Parameters: (joybus_rp2xxx instance, GPIO, PIO instance)
joybus_rp2xxx_init(&rp2xxx_bus, 6, pio0);
// Cast to a generic joybus pointer, for ease of use with libjoybus functions
struct joybus *bus = JOYBUS(&rp2xxx_bus);
// Enable the bus
// Use the bus
joybus_transfer(bus, ...);
int joybus_rp2xxx_init(struct joybus_rp2xxx *rp2xxx_bus, uint8_t gpio, PIO pio)
Initialize a RP2xxx Joybus instance.
Definition joybus.c:427
static int joybus_enable(struct joybus *bus)
Enable the Joybus instance.
Definition bus.h:71
static int joybus_transfer(struct joybus *bus, const uint8_t *write_buf, uint8_t write_len, uint8_t *read_buf, uint8_t read_len, joybus_transfer_cb_t callback, void *user_data)
Perform a Joybus "write then read" transfer.
Definition bus.h:102
#define JOYBUS(bus)
Macro to cast a backend-specific Joybus instance to a generic Joybus instance.
Definition bus.h:35
A RP2xxx Joybus instance.
Definition rp2xxx.h:60
A Joybus instance.
Definition bus.h:59

Checklist

  • Backend must implement all functions in joybus_api
  • Transfers must fail with JOYBUS_ERR_DISABLED if backend is not enabled
  • Transfers must fail with JOYBUS_ERR_BUSY if another transfer is in progress
  • Transfers must fail with JOYBUS_ERR_TIMEOUT if target does not begin replying within 100 µs
  • Transfers must fail with JOYBUS_ERR_TIMEOUT if each subsequent byte is not received within 100 µs
  • Backend must enforce a minimum delay of 20 µs between each transfer
  • Target must begin responding to any command within 100 µs
  • When target read mode is enabled, the bus must be idle before reading data to ensure we are not in the middle of a transfer
  • If an error occurs during a target read, wait for the bus to be idle before starting to read the next command

Ideally, your backend should also meet the following criteria:

  • Target must begin responding to any command within 10 µs
  • Backend supports 4 simultaneous buses
  • Zephyr implementation available