Code to take GPS, Accelerometer and Compass readings and print to USB for data analysis.
Dependencies: CMPS03 FatFileSystemCpp GPS MMA7660 mbed C12832_lcd
MSCFileSystem.h@7:2f5cc7f14269, 2014-05-07 (annotated)
- Committer:
- Alex4475
- Date:
- Wed May 07 10:44:45 2014 +0000
- Revision:
- 7:2f5cc7f14269
- Parent:
- 0:2557081b4322
Final code cleaning and syntax.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Alex4475 | 0:2557081b4322 | 1 | /* USB Mass Storage device file system |
Alex4475 | 0:2557081b4322 | 2 | * Copyrigh (c) 2010, Igor Skochinsky |
Alex4475 | 0:2557081b4322 | 3 | * based on SDFileStorage |
Alex4475 | 0:2557081b4322 | 4 | * Copyright (c) 2008-2009, sford |
Alex4475 | 0:2557081b4322 | 5 | */ |
Alex4475 | 0:2557081b4322 | 6 | |
Alex4475 | 0:2557081b4322 | 7 | #ifndef MSCFILESYSTEM_H |
Alex4475 | 0:2557081b4322 | 8 | #define MSCFILESYSTEM_H |
Alex4475 | 0:2557081b4322 | 9 | |
Alex4475 | 0:2557081b4322 | 10 | #include "mbed.h" |
Alex4475 | 0:2557081b4322 | 11 | #include "FATFileSystem.h" |
Alex4475 | 0:2557081b4322 | 12 | |
Alex4475 | 0:2557081b4322 | 13 | /* Class: MSCFileSystem |
Alex4475 | 0:2557081b4322 | 14 | * Access the filesystem on an attached USB mass storage device (e.g. a memory stick) |
Alex4475 | 0:2557081b4322 | 15 | * |
Alex4475 | 0:2557081b4322 | 16 | * Example: |
Alex4475 | 0:2557081b4322 | 17 | * > MSCFileSystem msc("msc"); |
Alex4475 | 0:2557081b4322 | 18 | * > |
Alex4475 | 0:2557081b4322 | 19 | * > int main() { |
Alex4475 | 0:2557081b4322 | 20 | * > FILE *fp = fopen("/msc/myfile.txt", "w"); |
Alex4475 | 0:2557081b4322 | 21 | * > fprintf(fp, "Hello World!\n"); |
Alex4475 | 0:2557081b4322 | 22 | * > fclose(fp); |
Alex4475 | 0:2557081b4322 | 23 | * > } |
Alex4475 | 0:2557081b4322 | 24 | */ |
Alex4475 | 0:2557081b4322 | 25 | class MSCFileSystem : public FATFileSystem { |
Alex4475 | 0:2557081b4322 | 26 | public: |
Alex4475 | 0:2557081b4322 | 27 | |
Alex4475 | 0:2557081b4322 | 28 | /* Constructor: MSCFileSystem |
Alex4475 | 0:2557081b4322 | 29 | * Create the File System for accessing a USB mass storage device |
Alex4475 | 0:2557081b4322 | 30 | * |
Alex4475 | 0:2557081b4322 | 31 | * Parameters: |
Alex4475 | 0:2557081b4322 | 32 | * name - The name used to access the filesystem |
Alex4475 | 0:2557081b4322 | 33 | */ |
Alex4475 | 0:2557081b4322 | 34 | MSCFileSystem(const char* name); |
Alex4475 | 0:2557081b4322 | 35 | virtual int disk_initialize(); |
Alex4475 | 0:2557081b4322 | 36 | virtual int disk_write(const char *buffer, int block_number); |
Alex4475 | 0:2557081b4322 | 37 | virtual int disk_read(char *buffer, int block_number); |
Alex4475 | 0:2557081b4322 | 38 | virtual int disk_status(); |
Alex4475 | 0:2557081b4322 | 39 | virtual int disk_sync(); |
Alex4475 | 0:2557081b4322 | 40 | virtual int disk_sectors(); |
Alex4475 | 0:2557081b4322 | 41 | |
Alex4475 | 0:2557081b4322 | 42 | protected: |
Alex4475 | 0:2557081b4322 | 43 | |
Alex4475 | 0:2557081b4322 | 44 | int initialise_msc(); |
Alex4475 | 0:2557081b4322 | 45 | uint32_t _numBlks; |
Alex4475 | 0:2557081b4322 | 46 | uint32_t _blkSize; |
Alex4475 | 0:2557081b4322 | 47 | }; |
Alex4475 | 0:2557081b4322 | 48 | |
Alex4475 | 0:2557081b4322 | 49 | #endif |