Counter
Dependencies: EthernetInterface NTPClient SDFileSystem TextLCD WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip FATFileSystem
SDFileSystem/FATFileSystem/FATFileSystem.h@0:ecaf3e593122, 2016-02-29 (annotated)
- Committer:
- Tuxitheone
- Date:
- Mon Feb 29 18:59:15 2016 +0000
- Revision:
- 0:ecaf3e593122
TankCounter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Tuxitheone | 0:ecaf3e593122 | 1 | /* mbed Microcontroller Library |
Tuxitheone | 0:ecaf3e593122 | 2 | * Copyright (c) 2006-2012 ARM Limited |
Tuxitheone | 0:ecaf3e593122 | 3 | * |
Tuxitheone | 0:ecaf3e593122 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
Tuxitheone | 0:ecaf3e593122 | 5 | * of this software and associated documentation files (the "Software"), to deal |
Tuxitheone | 0:ecaf3e593122 | 6 | * in the Software without restriction, including without limitation the rights |
Tuxitheone | 0:ecaf3e593122 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
Tuxitheone | 0:ecaf3e593122 | 8 | * copies of the Software, and to permit persons to whom the Software is |
Tuxitheone | 0:ecaf3e593122 | 9 | * furnished to do so, subject to the following conditions: |
Tuxitheone | 0:ecaf3e593122 | 10 | * |
Tuxitheone | 0:ecaf3e593122 | 11 | * The above copyright notice and this permission notice shall be included in |
Tuxitheone | 0:ecaf3e593122 | 12 | * all copies or substantial portions of the Software. |
Tuxitheone | 0:ecaf3e593122 | 13 | * |
Tuxitheone | 0:ecaf3e593122 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Tuxitheone | 0:ecaf3e593122 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Tuxitheone | 0:ecaf3e593122 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
Tuxitheone | 0:ecaf3e593122 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
Tuxitheone | 0:ecaf3e593122 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Tuxitheone | 0:ecaf3e593122 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
Tuxitheone | 0:ecaf3e593122 | 20 | * SOFTWARE. |
Tuxitheone | 0:ecaf3e593122 | 21 | */ |
Tuxitheone | 0:ecaf3e593122 | 22 | #ifndef MBED_FATFILESYSTEM_H |
Tuxitheone | 0:ecaf3e593122 | 23 | #define MBED_FATFILESYSTEM_H |
Tuxitheone | 0:ecaf3e593122 | 24 | |
Tuxitheone | 0:ecaf3e593122 | 25 | #include "FileSystemLike.h" |
Tuxitheone | 0:ecaf3e593122 | 26 | #include "FileHandle.h" |
Tuxitheone | 0:ecaf3e593122 | 27 | #include "ff.h" |
Tuxitheone | 0:ecaf3e593122 | 28 | #include <stdint.h> |
Tuxitheone | 0:ecaf3e593122 | 29 | |
Tuxitheone | 0:ecaf3e593122 | 30 | using namespace mbed; |
Tuxitheone | 0:ecaf3e593122 | 31 | |
Tuxitheone | 0:ecaf3e593122 | 32 | class FATFileSystem : public FileSystemLike { |
Tuxitheone | 0:ecaf3e593122 | 33 | public: |
Tuxitheone | 0:ecaf3e593122 | 34 | |
Tuxitheone | 0:ecaf3e593122 | 35 | FATFileSystem(const char* n); |
Tuxitheone | 0:ecaf3e593122 | 36 | virtual ~FATFileSystem(); |
Tuxitheone | 0:ecaf3e593122 | 37 | |
Tuxitheone | 0:ecaf3e593122 | 38 | static FATFileSystem * _ffs[_VOLUMES]; // FATFileSystem objects, as parallel to FatFs drives array |
Tuxitheone | 0:ecaf3e593122 | 39 | FATFS _fs; // Work area (file system object) for logical drive |
Tuxitheone | 0:ecaf3e593122 | 40 | int _fsid; |
Tuxitheone | 0:ecaf3e593122 | 41 | |
Tuxitheone | 0:ecaf3e593122 | 42 | virtual FileHandle *open(const char* name, int flags); |
Tuxitheone | 0:ecaf3e593122 | 43 | virtual int remove(const char *filename); |
Tuxitheone | 0:ecaf3e593122 | 44 | virtual int format(); |
Tuxitheone | 0:ecaf3e593122 | 45 | virtual DirHandle *opendir(const char *name); |
Tuxitheone | 0:ecaf3e593122 | 46 | virtual int mkdir(const char *name, mode_t mode); |
Tuxitheone | 0:ecaf3e593122 | 47 | |
Tuxitheone | 0:ecaf3e593122 | 48 | virtual int disk_initialize() { return 0; } |
Tuxitheone | 0:ecaf3e593122 | 49 | virtual int disk_status() { return 0; } |
Tuxitheone | 0:ecaf3e593122 | 50 | virtual int disk_read(uint8_t * buffer, uint64_t sector) = 0; |
Tuxitheone | 0:ecaf3e593122 | 51 | virtual int disk_write(const uint8_t * buffer, uint64_t sector) = 0; |
Tuxitheone | 0:ecaf3e593122 | 52 | virtual int disk_sync() { return 0; } |
Tuxitheone | 0:ecaf3e593122 | 53 | virtual uint64_t disk_sectors() = 0; |
Tuxitheone | 0:ecaf3e593122 | 54 | |
Tuxitheone | 0:ecaf3e593122 | 55 | }; |
Tuxitheone | 0:ecaf3e593122 | 56 | |
Tuxitheone | 0:ecaf3e593122 | 57 | #endif |