if (!usb_configuration) return -1; | if (!usb_configuration) return -1; | ||||
yield(); | yield(); | ||||
} | } | ||||
delayNanoseconds(30); // TODO: why is status ready too soon? | |||||
uint8_t *buffer = txbuffer + head * TX_BUFSIZE; | uint8_t *buffer = txbuffer + head * TX_BUFSIZE; | ||||
memcpy(buffer, usb_joystick_data, JOYSTICK_SIZE); | memcpy(buffer, usb_joystick_data, JOYSTICK_SIZE); | ||||
usb_prepare_transfer(xfer, buffer, JOYSTICK_SIZE, 0); | usb_prepare_transfer(xfer, buffer, JOYSTICK_SIZE, 0); |
if (!usb_configuration) return -1; | if (!usb_configuration) return -1; | ||||
yield(); | yield(); | ||||
} | } | ||||
delayNanoseconds(30); // min req'd 11 ns, TODO: why is status ready too soon? | |||||
uint8_t *buffer = txbuffer + head * TX_BUFSIZE; | uint8_t *buffer = txbuffer + head * TX_BUFSIZE; | ||||
memcpy(buffer, data, len); | memcpy(buffer, data, len); | ||||
usb_prepare_transfer(xfer, buffer, len, 0); | usb_prepare_transfer(xfer, buffer, len, 0); |
if (!usb_configuration) return -1; | if (!usb_configuration) return -1; | ||||
yield(); | yield(); | ||||
} | } | ||||
delayNanoseconds(30); // TODO: why is status ready too soon? | |||||
uint8_t *buffer = txbuffer + head * TX_BUFSIZE; | uint8_t *buffer = txbuffer + head * TX_BUFSIZE; | ||||
memcpy(buffer, data, len); | memcpy(buffer, data, len); | ||||
usb_prepare_transfer(xfer, buffer, len, 0); | usb_prepare_transfer(xfer, buffer, len, 0); |
if (status & 0x68) { | if (status & 0x68) { | ||||
// TODO: what if status has errors??? | // TODO: what if status has errors??? | ||||
} | } | ||||
delayNanoseconds(30); // TODO: is this needed? (probably not) | |||||
uint8_t *buffer = txbuffer + head * TX_BUFSIZE; | uint8_t *buffer = txbuffer + head * TX_BUFSIZE; | ||||
memcpy(buffer, data, MULTITOUCH_SIZE); | memcpy(buffer, data, MULTITOUCH_SIZE); | ||||
usb_prepare_transfer(xfer, buffer, MULTITOUCH_SIZE, 0); | usb_prepare_transfer(xfer, buffer, MULTITOUCH_SIZE, 0); |