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.

Dependencies:   mbed

Committer:
Blaze513
Date:
Sun Jan 16 09:20:30 2011 +0000
Revision:
6:ddf09d859ed7
Parent:
4:9a5878d316d5
gave access to Initialization function to FAT module.
added disk formatting functionality.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Blaze513 4:9a5878d316d5 1 /* mbed Microcontroller Library - FATFileSystem
Blaze513 4:9a5878d316d5 2 Copyright (c) 2008, sford */
Blaze513 4:9a5878d316d5 3
Blaze513 4:9a5878d316d5 4 //Modified by Thomas Hamilton, Copyright 2010
Blaze513 4:9a5878d316d5 5
Blaze513 4:9a5878d316d5 6 #ifndef MBED_FATFILESYSTEM_H
Blaze513 4:9a5878d316d5 7 #define MBED_FATFILESYSTEM_H
Blaze513 4:9a5878d316d5 8
Blaze513 4:9a5878d316d5 9 #include "stdint.h"
Blaze513 4:9a5878d316d5 10 #include "ff.h"
Blaze513 4:9a5878d316d5 11 #include "mbed.h"
Blaze513 4:9a5878d316d5 12 #include "FileSystemLike.h"
Blaze513 4:9a5878d316d5 13 #include "FATFileHandle.h"
Blaze513 4:9a5878d316d5 14 #include "FATDirHandle.h"
Blaze513 4:9a5878d316d5 15 #include <stdio.h>
Blaze513 4:9a5878d316d5 16
Blaze513 4:9a5878d316d5 17 class FATFileSystem : public FileSystemLike
Blaze513 4:9a5878d316d5 18 {
Blaze513 4:9a5878d316d5 19 private:
Blaze513 4:9a5878d316d5 20 FATFS FileSystemObject;
Blaze513 4:9a5878d316d5 21 unsigned char Drive;
Blaze513 4:9a5878d316d5 22
Blaze513 4:9a5878d316d5 23 public:
Blaze513 4:9a5878d316d5 24 static FATFileSystem* DriveArray[_DRIVES];
Blaze513 4:9a5878d316d5 25
Blaze513 4:9a5878d316d5 26 FATFileSystem(const char* SystemName);
Blaze513 4:9a5878d316d5 27 virtual ~FATFileSystem();
Blaze513 6:ddf09d859ed7 28
Blaze513 6:ddf09d859ed7 29 int format(unsigned int allocationunit);
Blaze513 4:9a5878d316d5 30
Blaze513 4:9a5878d316d5 31 virtual FileHandle* open(const char* filename, int flags);
Blaze513 4:9a5878d316d5 32 virtual int remove(const char* filename);
Blaze513 4:9a5878d316d5 33 virtual int rename(const char* oldname, const char* newname);
Blaze513 4:9a5878d316d5 34 virtual DirHandle* opendir(const char* name);
Blaze513 4:9a5878d316d5 35 virtual int mkdir(const char* name, mode_t mode);
Blaze513 4:9a5878d316d5 36
Blaze513 4:9a5878d316d5 37 virtual unsigned char disk_initialize() { return 0x00; }
Blaze513 4:9a5878d316d5 38 virtual unsigned char disk_status() { return 0x00; }
Blaze513 4:9a5878d316d5 39 virtual unsigned char disk_read(unsigned char* buff,
Blaze513 4:9a5878d316d5 40 unsigned long sector, unsigned char count) = 0;
Blaze513 4:9a5878d316d5 41 virtual unsigned char disk_write(const unsigned char* buff,
Blaze513 4:9a5878d316d5 42 unsigned long sector, unsigned char count) = 0;
Blaze513 4:9a5878d316d5 43 virtual unsigned char disk_sync() { return 0x00; }
Blaze513 4:9a5878d316d5 44 virtual unsigned long disk_sector_count() = 0;
Blaze513 4:9a5878d316d5 45 virtual unsigned short disk_sector_size() { return 512; }
Blaze513 4:9a5878d316d5 46 virtual unsigned long disk_block_size() { return 1; }
Blaze513 4:9a5878d316d5 47 };
Blaze513 4:9a5878d316d5 48
Blaze513 1:94c648931f84 49 #endif