Added TARGET_DISCO_F469NI in USBHOST\USBHost\TARGET_STM\USBHALHost_STM_TARGET.h
Dependents: DISCO-F469NI_USB_Disk STM32F4xx_USB_Memory
Fork of USBHOST by
Diff: USBHostMSD/USBHostMSD.cpp
- Revision:
- 6:d3ac9e1c0035
- Parent:
- 5:fc157e6bd5a5
- Child:
- 8:3e7a33f81048
diff -r fc157e6bd5a5 -r d3ac9e1c0035 USBHostMSD/USBHostMSD.cpp --- a/USBHostMSD/USBHostMSD.cpp Wed Apr 26 18:11:37 2017 +0200 +++ b/USBHostMSD/USBHostMSD.cpp Wed Apr 26 20:08:31 2017 +0000 @@ -341,6 +341,7 @@ int USBHostMSD::program(const void *buffer, bd_addr_t addr, bd_size_t size) { uint32_t block_number, count; + uint8_t *buf = (uint8_t *)buffer; if (!disk_init) { init(); } @@ -350,9 +351,9 @@ count = size /blockSize; for (uint32_t b = block_number; b < block_number + count; b++) { - if (dataTransfer((uint8_t*)buffer, b, 1, HOST_TO_DEVICE)) + if (dataTransfer(buf, b, 1, HOST_TO_DEVICE)) return -1; - buffer += 512; + buf += blockSize; } return 0; } @@ -360,6 +361,7 @@ int USBHostMSD::read(void *buffer, bd_addr_t addr, bd_size_t size) { uint32_t block_number, count; + uint8_t *buf = (uint8_t *)buffer; if (!disk_init) { init(); } @@ -369,9 +371,9 @@ count = size /blockSize; for (uint32_t b = block_number; b < block_number + count; b++) { - if (dataTransfer((uint8_t*)buffer, b, 1, DEVICE_TO_HOST)) + if (dataTransfer((uint8_t*)buf, b, 1, DEVICE_TO_HOST)) return -1; - buffer += 512; + buf += blockSize; } return 0; }