fork from va009039/USBLocalFileSystem
Dependents: 11u35_usbLocalFilesystem
Fork of USBLocalFileSystem by
Diff: src/StorageInterface.h
- Revision:
- 0:39eb4d5b97df
- Child:
- 2:97c314eae8b8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/StorageInterface.h Sat May 03 11:21:37 2014 +0000 @@ -0,0 +1,26 @@ +#pragma once + +class StorageInterface { +public: + StorageInterface() { + onUpdate = NULL; + } + virtual int storage_read(uint8_t* data, uint32_t block) = 0; + virtual int storage_write(const uint8_t* data, uint32_t block) = 0; + virtual uint32_t storage_sectors() = 0; + virtual uint32_t storage_size() = 0; + + void attachEvent(void (*ptr)()) { + if (ptr != NULL) { + onUpdate = ptr; + } + } + +protected: + void (*onUpdate)(); + void update() { + if (onUpdate) { + (*onUpdate)(); + } + } +};