ST/USBHOST forked to add another HID handler for raw keyboard data to get more detail not available with current handlers (all pressed keys, all releases, and periodic updates)

Dependents:   C64-stm429_discovery

Files at this revision

API Documentation at this revision

Comitter:
jamike
Date:
Wed Apr 26 20:08:31 2017 +0000
Parent:
5:fc157e6bd5a5
Child:
7:9dc1cb9d5e12
Commit message:
fix error in read and write

Changed in this revision

USBHostMSD/USBHostMSD.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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;
 }