SD Card Interface class. Log raw data bytes to memory addresses of your choice, or format the card and use the FAT file system to write files.
FATFileSystem/Interface/FATFileSystem.h@3:210eb67b260c, 2010-08-23 (annotated)
- Committer:
- Blaze513
- Date:
- Mon Aug 23 07:12:13 2010 +0000
- Revision:
- 3:210eb67b260c
- Parent:
- 1:94c648931f84
- Child:
- 4:9a5878d316d5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Blaze513 | 1:94c648931f84 | 1 | /* mbed Microcontroller Library - FATFileSystem |
Blaze513 | 1:94c648931f84 | 2 | Copyright (c) 2008, sford */ |
Blaze513 | 1:94c648931f84 | 3 | |
Blaze513 | 3:210eb67b260c | 4 | //Modified by Thomas Hamilton, Copyright 2010 |
Blaze513 | 3:210eb67b260c | 5 | |
Blaze513 | 1:94c648931f84 | 6 | #ifndef MBED_FATFILESYSTEM_H |
Blaze513 | 1:94c648931f84 | 7 | #define MBED_FATFILESYSTEM_H |
Blaze513 | 1:94c648931f84 | 8 | |
Blaze513 | 1:94c648931f84 | 9 | #include "ff.h" |
Blaze513 | 1:94c648931f84 | 10 | #include "mbed.h" |
Blaze513 | 1:94c648931f84 | 11 | #include "FileSystemLike.h" |
Blaze513 | 1:94c648931f84 | 12 | #include "FATFileHandle.h" |
Blaze513 | 1:94c648931f84 | 13 | #include "FATDirHandle.h" |
Blaze513 | 1:94c648931f84 | 14 | #include <stdio.h> |
Blaze513 | 1:94c648931f84 | 15 | |
Blaze513 | 1:94c648931f84 | 16 | class FATFileSystem : public FileSystemLike |
Blaze513 | 1:94c648931f84 | 17 | { |
Blaze513 | 1:94c648931f84 | 18 | private: |
Blaze513 | 1:94c648931f84 | 19 | FATFS FileSystemObject; |
Blaze513 | 1:94c648931f84 | 20 | unsigned char Drive; |
Blaze513 | 1:94c648931f84 | 21 | |
Blaze513 | 1:94c648931f84 | 22 | public: |
Blaze513 | 1:94c648931f84 | 23 | static FATFileSystem* DriveArray[_DRIVES]; |
Blaze513 | 1:94c648931f84 | 24 | |
Blaze513 | 1:94c648931f84 | 25 | FATFileSystem(const char* SystemName); |
Blaze513 | 3:210eb67b260c | 26 | virtual ~FATFileSystem(); |
Blaze513 | 1:94c648931f84 | 27 | |
Blaze513 | 1:94c648931f84 | 28 | virtual FileHandle* open(const char* filename, int flags); |
Blaze513 | 1:94c648931f84 | 29 | virtual int remove(const char* filename); |
Blaze513 | 1:94c648931f84 | 30 | virtual int rename(const char* oldname, const char* newname); |
Blaze513 | 1:94c648931f84 | 31 | virtual DirHandle* opendir(const char* name); |
Blaze513 | 1:94c648931f84 | 32 | virtual int mkdir(const char* name, mode_t mode); |
Blaze513 | 1:94c648931f84 | 33 | |
Blaze513 | 1:94c648931f84 | 34 | virtual unsigned char disk_initialize() { return 0x00; } |
Blaze513 | 1:94c648931f84 | 35 | virtual unsigned char disk_status() { return 0x00; } |
Blaze513 | 1:94c648931f84 | 36 | virtual unsigned char disk_read(unsigned char* buff, |
Blaze513 | 1:94c648931f84 | 37 | unsigned long sector, unsigned char count) = 0; |
Blaze513 | 1:94c648931f84 | 38 | virtual unsigned char disk_write(const unsigned char* buff, |
Blaze513 | 1:94c648931f84 | 39 | unsigned long sector, unsigned char count) = 0; |
Blaze513 | 1:94c648931f84 | 40 | virtual unsigned char disk_sync() { return 0x00; } |
Blaze513 | 1:94c648931f84 | 41 | virtual unsigned long disk_sector_count() = 0; |
Blaze513 | 1:94c648931f84 | 42 | virtual unsigned short disk_sector_size() { return 512; } |
Blaze513 | 1:94c648931f84 | 43 | virtual unsigned long disk_block_size() { return 1; } |
Blaze513 | 1:94c648931f84 | 44 | }; |
Blaze513 | 1:94c648931f84 | 45 | |
Blaze513 | 1:94c648931f84 | 46 | #endif |