diff --git a/examples/mass/mass.ino b/examples/mass/mass.ino index 50d0d0e..47c1419 100755 --- a/examples/mass/mass.ino +++ b/examples/mass/mass.ino @@ -7,14 +7,14 @@ USBCompositeSerial CompositeSerial; #include "image.h" -bool write(uint32_t memoryOffset, const uint8_t *writebuff, uint16_t transferLength) { - memcpy(image+memoryOffset, writebuff, transferLength); +bool write(const uint8_t *writebuff, uint32_t memoryOffset, uint16_t transferLength) { + memcpy(image+SCSI_BLOCK_SIZE*memoryOffset, writebuff, SCSI_BLOCK_SIZE*transferLength); return true; } -bool read(uint32_t memoryOffset, uint8_t *readbuff, uint16_t transferLength) { - memcpy(readbuff, image+memoryOffset, transferLength); +bool read(uint8_t *readbuff, uint32_t memoryOffset, uint16_t transferLength) { + memcpy(readbuff, image+SCSI_BLOCK_SIZE*memoryOffset, SCSI_BLOCK_SIZE*transferLength); return true; } @@ -55,7 +55,7 @@ void dumpDrive() { void setup() { USBComposite.setProductId(PRODUCT_ID); - MassStorage.setDrive(0, sizeof(image), read, write); + MassStorage.setDriveData(0, sizeof(image)/SCSI_BLOCK_SIZE, read, write); MassStorage.registerComponent(); CompositeSerial.registerComponent(); USBComposite.begin(); @@ -68,4 +68,4 @@ void loop() { dumpDrive(); } } - + diff --git a/examples/sdreader/sdreader.ino b/examples/sdreader/sdreader.ino index 9336f82..106d831 100755 --- a/examples/sdreader/sdreader.ino +++ b/examples/sdreader/sdreader.ino @@ -17,12 +17,12 @@ const uint8_t SD_CHIP_SELECT = SS; bool enabled = false; uint32 cardSize; -bool write(uint32_t memoryOffset, const uint8_t *writebuff, uint16_t transferLength) { - return sd.card()->writeBlocks(memoryOffset/512, writebuff, transferLength/512); +bool write(const uint8_t *writebuff, uint32_t startSector, uint16_t numSectors) { + return sd.card()->writeBlocks(startSector, writebuff, numSectors); } -bool read(uint32_t memoryOffset, uint8_t *readbuff, uint16_t transferLength) { - return sd.card()->readBlocks(memoryOffset/512, readbuff, transferLength/512); +bool read(uint8_t *readbuff, uint32_t startSector, uint16_t numSectors) { + return sd.card()->readBlocks(startSector, readbuff, numSectors); } void setup() { @@ -34,7 +34,7 @@ void setup() { void initReader() { digitalWrite(LED_PIN,0); cardSize = sd.card()->cardSize(); - MassStorage.setDrive(0, cardSize*512, read, write); + MassStorage.setDriveData(0, cardSize, read, write); MassStorage.registerComponent(); CompositeSerial.registerComponent(); USBComposite.begin(); @@ -54,4 +54,4 @@ void loop() { MassStorage.loop(); } } - +