Skip to content

Commit bd6e701

Browse files
authored
Adapt to changed function signatures in TinyUSB
The present version of the UsbHostMsd library no longer compiles because tuh_msc_write10(), tuh_msc_read10(), and the completion callback of TinyUSB have different function signatures now. The new parameter "uintptr_t arg" is simply set to 0 in a similar manner as in the examples from TinyUSB. Former-commit-id: 12fd56a
1 parent 304008c commit bd6e701

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Diff for: libraries/UsbHostMsd/UsbHostMsd.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,10 @@ bool USBHostMSD::connect() {
9494
/* */
9595
/* -------------------------------------------------------------------------- */
9696
static bool in_progress = false;
97-
bool complete_cb(uint8_t dev_addr, msc_cbw_t const* cbw, msc_csw_t const* csw) {
97+
bool complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data) {
9898
in_progress = false;
9999
}
100100

101-
102101
/* -------------------------------------------------------------------------- */
103102
/* WRITE */
104103
/* -------------------------------------------------------------------------- */
@@ -115,7 +114,7 @@ int USBHostMSD::write(const void *buffer, bd_addr_t addr, bd_size_t size) {
115114

116115
for (uint32_t b = block_number; b < block_number + count; b++) {
117116
in_progress = true;
118-
if(tuh_msc_write10(usb_host_msd_get_device_address(), get_lun(), buf, b, 1, complete_cb)) {
117+
if(tuh_msc_write10(usb_host_msd_get_device_address(), get_lun(), buf, b, 1, complete_cb, 0)) {
119118
while(in_progress) {
120119
delay(10);
121120
}
@@ -147,7 +146,7 @@ int USBHostMSD::read(void *buffer, bd_addr_t addr, bd_size_t size)
147146

148147
for (uint32_t b = block_number; b < block_number + count; b++) {
149148
in_progress = true;
150-
if(tuh_msc_read10(usb_host_msd_get_device_address(), get_lun(), buf, b, 1, complete_cb)) {
149+
if(tuh_msc_read10(usb_host_msd_get_device_address(), get_lun(), buf, b, 1, complete_cb, 0)) {
151150
while(in_progress) {
152151
delay(10);
153152
}
@@ -236,4 +235,4 @@ const char *USBHostMSD::get_type() const {
236235

237236
bool USBHostMSD::attach_detected_callback(void (*cbk)()) {
238237
usb_host_msd_attach_mnt_cbk(cbk);
239-
}
238+
}

0 commit comments

Comments
 (0)