This is a repository for code relating to mbed Fitness Tracker
Dependencies: mbed PulseSensor2 SCP1000 mbed-rtos 4DGL-uLCD-SE LSM9DS1_Library_cal PinDetect FatFileSystemCpp GP-20U7
MSCFileSystem.h@43:81f314c92d9f, 2020-04-28 (annotated)
- Committer:
- dyu2021
- Date:
- Tue Apr 28 20:00:56 2020 +0000
- Revision:
- 43:81f314c92d9f
- Parent:
- 18:9617bd66bdae
Changed serial_USB to output all lines of prev_text, not hard set to 7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
memig3 | 18:9617bd66bdae | 1 | /* USB Mass Storage device file system |
memig3 | 18:9617bd66bdae | 2 | * Copyrigh (c) 2010, Igor Skochinsky |
memig3 | 18:9617bd66bdae | 3 | * based on SDFileStorage |
memig3 | 18:9617bd66bdae | 4 | * Copyright (c) 2008-2009, sford |
memig3 | 18:9617bd66bdae | 5 | */ |
memig3 | 18:9617bd66bdae | 6 | |
memig3 | 18:9617bd66bdae | 7 | #ifndef MSCFILESYSTEM_H |
memig3 | 18:9617bd66bdae | 8 | #define MSCFILESYSTEM_H |
memig3 | 18:9617bd66bdae | 9 | |
memig3 | 18:9617bd66bdae | 10 | #include "mbed.h" |
memig3 | 18:9617bd66bdae | 11 | #include "FATFileSystem.h" |
memig3 | 18:9617bd66bdae | 12 | |
memig3 | 18:9617bd66bdae | 13 | /* Class: MSCFileSystem |
memig3 | 18:9617bd66bdae | 14 | * Access the filesystem on an attached USB mass storage device (e.g. a memory stick) |
memig3 | 18:9617bd66bdae | 15 | * |
memig3 | 18:9617bd66bdae | 16 | * Example: |
memig3 | 18:9617bd66bdae | 17 | * > MSCFileSystem msc("msc"); |
memig3 | 18:9617bd66bdae | 18 | * > |
memig3 | 18:9617bd66bdae | 19 | * > int main() { |
memig3 | 18:9617bd66bdae | 20 | * > FILE *fp = fopen("/msc/myfile.txt", "w"); |
memig3 | 18:9617bd66bdae | 21 | * > fprintf(fp, "Hello World!\n"); |
memig3 | 18:9617bd66bdae | 22 | * > fclose(fp); |
memig3 | 18:9617bd66bdae | 23 | * > } |
memig3 | 18:9617bd66bdae | 24 | */ |
memig3 | 18:9617bd66bdae | 25 | class MSCFileSystem : public FATFileSystem { |
memig3 | 18:9617bd66bdae | 26 | public: |
memig3 | 18:9617bd66bdae | 27 | |
memig3 | 18:9617bd66bdae | 28 | /* Constructor: MSCFileSystem |
memig3 | 18:9617bd66bdae | 29 | * Create the File System for accessing a USB mass storage device |
memig3 | 18:9617bd66bdae | 30 | * |
memig3 | 18:9617bd66bdae | 31 | * Parameters: |
memig3 | 18:9617bd66bdae | 32 | * name - The name used to access the filesystem |
memig3 | 18:9617bd66bdae | 33 | */ |
memig3 | 18:9617bd66bdae | 34 | MSCFileSystem(const char* name); |
memig3 | 18:9617bd66bdae | 35 | virtual int disk_initialize(); |
memig3 | 18:9617bd66bdae | 36 | virtual int disk_write(const char *buffer, int block_number); |
memig3 | 18:9617bd66bdae | 37 | virtual int disk_read(char *buffer, int block_number); |
memig3 | 18:9617bd66bdae | 38 | virtual int disk_status(); |
memig3 | 18:9617bd66bdae | 39 | virtual int disk_sync(); |
memig3 | 18:9617bd66bdae | 40 | virtual int disk_sectors(); |
memig3 | 18:9617bd66bdae | 41 | |
memig3 | 18:9617bd66bdae | 42 | protected: |
memig3 | 18:9617bd66bdae | 43 | |
memig3 | 18:9617bd66bdae | 44 | int initialise_msc(); |
memig3 | 18:9617bd66bdae | 45 | uint32_t _numBlks; |
memig3 | 18:9617bd66bdae | 46 | uint32_t _blkSize; |
memig3 | 18:9617bd66bdae | 47 | }; |
memig3 | 18:9617bd66bdae | 48 | |
memig3 | 18:9617bd66bdae | 49 | #endif |