V

Dependencies:   mbed FatFileSystemCpp TextLCD

Committer:
bertonieto
Date:
Mon Aug 12 21:54:14 2019 +0000
Revision:
2:73cbcff90232
Export new

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bertonieto 2:73cbcff90232 1 /* USB Mass Storage device file system
bertonieto 2:73cbcff90232 2 * Copyrigh (c) 2010, Igor Skochinsky
bertonieto 2:73cbcff90232 3 * based on SDFileStorage
bertonieto 2:73cbcff90232 4 * Copyright (c) 2008-2009, sford
bertonieto 2:73cbcff90232 5 */
bertonieto 2:73cbcff90232 6
bertonieto 2:73cbcff90232 7 #ifndef MSCFILESYSTEM_H
bertonieto 2:73cbcff90232 8 #define MSCFILESYSTEM_H
bertonieto 2:73cbcff90232 9
bertonieto 2:73cbcff90232 10 #include "mbed.h"
bertonieto 2:73cbcff90232 11 #include "FATFileSystem.h"
bertonieto 2:73cbcff90232 12
bertonieto 2:73cbcff90232 13 /* Class: MSCFileSystem
bertonieto 2:73cbcff90232 14 * Access the filesystem on an attached USB mass storage device (e.g. a memory stick)
bertonieto 2:73cbcff90232 15 *
bertonieto 2:73cbcff90232 16 * Example:
bertonieto 2:73cbcff90232 17 * > MSCFileSystem msc("msc");
bertonieto 2:73cbcff90232 18 * >
bertonieto 2:73cbcff90232 19 * > int main() {
bertonieto 2:73cbcff90232 20 * > FILE *fp = fopen("/msc/myfile.txt", "w");
bertonieto 2:73cbcff90232 21 * > fprintf(fp, "Hello World!\n");
bertonieto 2:73cbcff90232 22 * > fclose(fp);
bertonieto 2:73cbcff90232 23 * > }
bertonieto 2:73cbcff90232 24 */
bertonieto 2:73cbcff90232 25 class MSCFileSystem : public FATFileSystem {
bertonieto 2:73cbcff90232 26 public:
bertonieto 2:73cbcff90232 27
bertonieto 2:73cbcff90232 28 /* Constructor: MSCFileSystem
bertonieto 2:73cbcff90232 29 * Create the File System for accessing a USB mass storage device
bertonieto 2:73cbcff90232 30 *
bertonieto 2:73cbcff90232 31 * Parameters:
bertonieto 2:73cbcff90232 32 * name - The name used to access the filesystem
bertonieto 2:73cbcff90232 33 */
bertonieto 2:73cbcff90232 34 MSCFileSystem(const char* name);
bertonieto 2:73cbcff90232 35 virtual int disk_initialize();
bertonieto 2:73cbcff90232 36 virtual int disk_write(const char *buffer, int block_number);
bertonieto 2:73cbcff90232 37 virtual int disk_read(char *buffer, int block_number);
bertonieto 2:73cbcff90232 38 virtual int disk_status();
bertonieto 2:73cbcff90232 39 virtual int disk_sync();
bertonieto 2:73cbcff90232 40 virtual int disk_sectors();
bertonieto 2:73cbcff90232 41
bertonieto 2:73cbcff90232 42 protected:
bertonieto 2:73cbcff90232 43
bertonieto 2:73cbcff90232 44 int initialise_msc();
bertonieto 2:73cbcff90232 45 uint32_t _numBlks;
bertonieto 2:73cbcff90232 46 uint32_t _blkSize;
bertonieto 2:73cbcff90232 47 };
bertonieto 2:73cbcff90232 48
bertonieto 2:73cbcff90232 49 #endif