Class that contain only FATFileSystem
Fork of USBFileSystem by
Diff: USBFileSystem.cpp
- Revision:
- 6:eeeea7fbb0a2
- Parent:
- 2:9af05743d551
--- a/USBFileSystem.cpp Wed Oct 23 20:32:07 2013 +0000 +++ b/USBFileSystem.cpp Fri Dec 19 14:41:08 2014 +0000 @@ -4,10 +4,7 @@ USBFileSystem::USBFileSystem(const char* n) : FATFileSystem_ds(n) { localFunction = NULL; - usbFunction = NULL; - usbfree = true; local_count = 0; - usbMode(1); } @@ -53,14 +50,10 @@ return (local_count == 0); } -bool USBFileSystem::usbSafe( void ){ - return usbfree; -} - int USBFileSystem::disk_status_fat() { int retval = _disk_status(); - if ((retval == 0) && (!usbSafe())) + if (retval == 0) return 4; else return retval; @@ -69,24 +62,14 @@ int USBFileSystem::disk_status_msd() { int retval = _disk_status(); - if ((retval == 0) && (!localSafe())) + if (retval == 0) return 4; else return retval; } int USBFileSystem::disk_write(const uint8_t * data, uint64_t block) { - if (localSafe()) { - if (usbfree && (usbFunction!=NULL) ) - usbFunction(false); - - usbfree = false; - } - - int retval= _disk_write(data, block); - - if (localSafe()) - usb_write.attach_us(this, &USBFileSystem::usbFree, USBWRITE_TIMEOUT * 1000); + int retval= _disk_write(data, block); return retval; } @@ -100,14 +83,10 @@ //Pseudo-IRQ if (open && (local_count == 1)) { - if (usbmode == 1) - disconnect(); if (localFunction != NULL) (*localFunction)(false); } if (!open && (local_count == 0)) { - if (usbmode == 1) - connect(); if (localFunction != NULL) (*localFunction)(true); } @@ -116,17 +95,3 @@ void USBFileSystem::attachLocal(void (*function)(bool)) { localFunction = function; } - -void USBFileSystem::attachUSB(void (*function)(bool)) { - usbFunction = function; -} - -void USBFileSystem::usbFree( void ) { - usbfree = true; - if (usbFunction != NULL) - usbFunction(true); -} - -void USBFileSystem::usbMode(int mode) { - usbmode = mode; -} \ No newline at end of file