瀏覽代碼

Workaround corrupted USB packets when status shows ready too soon

main
PaulStoffregen 5 年之前
父節點
當前提交
9026659eaa
共有 4 個檔案被更改,包括 4 行新增0 行删除
  1. +1
    -0
      teensy4/usb_joystick.c
  2. +1
    -0
      teensy4/usb_keyboard.c
  3. +1
    -0
      teensy4/usb_mouse.c
  4. +1
    -0
      teensy4/usb_touch.c

+ 1
- 0
teensy4/usb_joystick.c 查看文件

@@ -95,6 +95,7 @@ int usb_joystick_send()
if (!usb_configuration) return -1;
yield();
}
delayNanoseconds(30); // TODO: why is status ready too soon?
uint8_t *buffer = txbuffer + head * TX_BUFSIZE;
memcpy(buffer, usb_joystick_data, JOYSTICK_SIZE);
usb_prepare_transfer(xfer, buffer, JOYSTICK_SIZE, 0);

+ 1
- 0
teensy4/usb_keyboard.c 查看文件

@@ -544,6 +544,7 @@ static int usb_keyboard_transmit(int endpoint, const uint8_t *data, uint32_t len
if (!usb_configuration) return -1;
yield();
}
delayNanoseconds(30); // min req'd 11 ns, TODO: why is status ready too soon?
uint8_t *buffer = txbuffer + head * TX_BUFSIZE;
memcpy(buffer, data, len);
usb_prepare_transfer(xfer, buffer, len, 0);

+ 1
- 0
teensy4/usb_mouse.c 查看文件

@@ -159,6 +159,7 @@ static int usb_mouse_transmit(const uint8_t *data, uint32_t len)
if (!usb_configuration) return -1;
yield();
}
delayNanoseconds(30); // TODO: why is status ready too soon?
uint8_t *buffer = txbuffer + head * TX_BUFSIZE;
memcpy(buffer, data, len);
usb_prepare_transfer(xfer, buffer, len, 0);

+ 1
- 0
teensy4/usb_touch.c 查看文件

@@ -109,6 +109,7 @@ static int transmit(const uint8_t *data)
if (status & 0x68) {
// TODO: what if status has errors???
}
delayNanoseconds(30); // TODO: is this needed? (probably not)
uint8_t *buffer = txbuffer + head * TX_BUFSIZE;
memcpy(buffer, data, MULTITOUCH_SIZE);
usb_prepare_transfer(xfer, buffer, MULTITOUCH_SIZE, 0);

Loading…
取消
儲存