Chris Styles
/
USB-A
Example program using USB A
Embed:
(wiki syntax)
Show/hide line numbers
MSCFileSystem.h
00001 /* USB Mass Storage device file system 00002 * Copyrigh (c) 2010, Igor Skochinsky 00003 * based on SDFileStorage 00004 * Copyright (c) 2008-2009, sford 00005 */ 00006 00007 #ifndef MSCFILESYSTEM_H 00008 #define MSCFILESYSTEM_H 00009 00010 #include "mbed.h" 00011 #include "FATFileSystem.h" 00012 00013 /* Class: MSCFileSystem 00014 * Access the filesystem on an attached USB mass storage device (e.g. a memory stick) 00015 * 00016 * Example: 00017 * > MSCFileSystem msc("msc"); 00018 * > 00019 * > int main() { 00020 * > FILE *fp = fopen("/msc/myfile.txt", "w"); 00021 * > fprintf(fp, "Hello World!\n"); 00022 * > fclose(fp); 00023 * > } 00024 */ 00025 class MSCFileSystem : public FATFileSystem { 00026 public: 00027 00028 /* Constructor: MSCFileSystem 00029 * Create the File System for accessing a USB mass storage device 00030 * 00031 * Parameters: 00032 * name - The name used to access the filesystem 00033 */ 00034 MSCFileSystem(const char* name); 00035 virtual int disk_initialize(); 00036 virtual int disk_write(const char *buffer, int block_number); 00037 virtual int disk_read(char *buffer, int block_number); 00038 virtual int disk_status(); 00039 virtual int disk_sync(); 00040 virtual int disk_sectors(); 00041 00042 protected: 00043 00044 int initialise_msc(); 00045 uint32_t _numBlks; 00046 uint32_t _blkSize; 00047 }; 00048 00049 #endif
Generated on Thu Jul 14 2022 15:51:46 by 1.7.2