minor clean up

This commit is contained in:
hathach 2024-11-27 11:35:21 +07:00
parent 453d69517b
commit 9e4b855e53
No known key found for this signature in database
GPG Key ID: 26FAB84F615C3C52
6 changed files with 15 additions and 19 deletions

View File

@ -78,8 +78,8 @@ typedef struct {
} cdch_interface_t;
typedef struct {
TUH_EPBUF_DEF(tx_ep_buf, CFG_TUH_CDC_TX_EPSIZE);
TUH_EPBUF_DEF(rx_ep_buf, CFG_TUH_CDC_TX_EPSIZE);
TUH_EPBUF_DEF(tx, CFG_TUH_CDC_TX_EPSIZE);
TUH_EPBUF_DEF(rx, CFG_TUH_CDC_TX_EPSIZE);
} cdch_epbuf_t;
static cdch_interface_t cdch_data[CFG_TUH_CDC];
@ -631,11 +631,11 @@ bool cdch_init(void) {
cdch_epbuf_t* epbuf = &cdch_epbuf[i];
tu_edpt_stream_init(&p_cdc->stream.tx, true, true, false,
p_cdc->stream.tx_ff_buf, CFG_TUH_CDC_TX_BUFSIZE,
epbuf->tx_ep_buf, CFG_TUH_CDC_TX_EPSIZE);
epbuf->tx, CFG_TUH_CDC_TX_EPSIZE);
tu_edpt_stream_init(&p_cdc->stream.rx, true, false, false,
p_cdc->stream.rx_ff_buf, CFG_TUH_CDC_RX_BUFSIZE,
epbuf->rx_ep_buf, CFG_TUH_CDC_RX_EPSIZE);
epbuf->rx, CFG_TUH_CDC_RX_EPSIZE);
}
return true;

View File

@ -61,8 +61,8 @@ typedef struct {
} hidh_interface_t;
typedef struct {
TUH_EPBUF_DEF(epin_buf, CFG_TUH_HID_EPIN_BUFSIZE);
TUH_EPBUF_DEF(epout_buf, CFG_TUH_HID_EPOUT_BUFSIZE);
TUH_EPBUF_DEF(epin, CFG_TUH_HID_EPIN_BUFSIZE);
TUH_EPBUF_DEF(epout, CFG_TUH_HID_EPOUT_BUFSIZE);
} hidh_epbuf_t;
static hidh_interface_t _hidh_itf[CFG_TUH_HID];
@ -363,7 +363,7 @@ bool tuh_hid_receive_report(uint8_t daddr, uint8_t idx) {
// claim endpoint
TU_VERIFY(usbh_edpt_claim(daddr, p_hid->ep_in));
if (!usbh_edpt_xfer(daddr, p_hid->ep_in, epbuf->epin_buf, p_hid->epin_size)) {
if (!usbh_edpt_xfer(daddr, p_hid->ep_in, epbuf->epin, p_hid->epin_size)) {
usbh_edpt_release(daddr, p_hid->ep_in);
return false;
}
@ -403,16 +403,16 @@ bool tuh_hid_send_report(uint8_t daddr, uint8_t idx, uint8_t report_id, const vo
if (report_id == 0) {
// No report ID in transmission
memcpy(&epbuf->epout_buf[0], report, len);
memcpy(&epbuf->epout[0], report, len);
} else {
epbuf->epout_buf[0] = report_id;
memcpy(&epbuf->epout_buf[1], report, len);
epbuf->epout[0] = report_id;
memcpy(&epbuf->epout[1], report, len);
++len; // 1 more byte for report_id
}
TU_LOG3_MEM(p_hid->epout_buf, len, 2);
if (!usbh_edpt_xfer(daddr, p_hid->ep_out, epbuf->epout_buf, len)) {
if (!usbh_edpt_xfer(daddr, p_hid->ep_out, epbuf->epout, len)) {
usbh_edpt_release(daddr, p_hid->ep_out);
return false;
}
@ -446,10 +446,10 @@ bool hidh_xfer_cb(uint8_t daddr, uint8_t ep_addr, xfer_result_t result, uint32_t
if (dir == TUSB_DIR_IN) {
TU_LOG_DRV(" Get Report callback (%u, %u)\r\n", daddr, idx);
TU_LOG3_MEM(p_hid->epin_buf, xferred_bytes, 2);
tuh_hid_report_received_cb(daddr, idx, epbuf->epin_buf, (uint16_t) xferred_bytes);
tuh_hid_report_received_cb(daddr, idx, epbuf->epin, (uint16_t) xferred_bytes);
} else {
if (tuh_hid_report_sent_cb) {
tuh_hid_report_sent_cb(daddr, idx, epbuf->epout_buf, (uint16_t) xferred_bytes);
tuh_hid_report_sent_cb(daddr, idx, epbuf->epout, (uint16_t) xferred_bytes);
}
}

View File

@ -1477,8 +1477,6 @@ static void process_enumeration(tuh_xfer_t* xfer) {
dev->i_product = desc_device->iProduct;
dev->i_serial = desc_device->iSerialNumber;
// if (tuh_attach_cb) tuh_attach_cb((tusb_desc_device_t*) _usbh_epbuf.ctrl);
// Get 9-byte for total length
uint8_t const config_idx = CONFIG_NUM - 1;
TU_LOG_USBH("Get Configuration[0] Descriptor (9 bytes)\r\n");

View File

@ -96,8 +96,6 @@ typedef union {
// APPLICATION CALLBACK
//--------------------------------------------------------------------+
//TU_ATTR_WEAK uint8_t tuh_attach_cb (tusb_desc_device_t const *desc_device);
// Invoked when a device is mounted (configured)
TU_ATTR_WEAK void tuh_mount_cb (uint8_t daddr);

View File

@ -549,7 +549,7 @@ def test_board(board):
for f1 in flags_on_list:
f1_str = ""
if f1 != "":
f1_str = '-' + f1.replace(' ', '-')
f1_str = '-f1_' + f1.replace(' ', '_')
for test in test_list:
fw_dir = f'{TINYUSB_ROOT}/cmake-build/cmake-build-{name}{f1_str}/{test}'
if not os.path.exists(fw_dir):

View File

@ -90,7 +90,7 @@ def cmake_board(board, toolchain, build_flags_on):
if len(build_flags_on) > 0:
build_flags = ' '.join(f'-D{flag}=1' for flag in build_flags_on)
build_flags = f'-DCFLAGS_CLI="{build_flags}"'
build_dir += '-' + '-'.join(build_flags_on)
build_dir += '-f1_' + '_'.join(build_flags_on)
family = find_family(board)
if family == 'espressif':