Programme d'une sonde de température DHT 11 associée à de la sauvegarde de données sur clé USB et à l'affichage de ces données sur afficheur LCD
Dependencies: FatFileSystemCpp mbed
MSCFileSystem.h@0:ed0b4e66d2ad, 2015-06-02 (annotated)
- Committer:
- Fanta025
- Date:
- Tue Jun 02 14:19:54 2015 +0000
- Revision:
- 0:ed0b4e66d2ad
Programme d'une sonde de temp?rature DHT 11 associ?e ? de la sauvegarde de donn?es sur USB et un affichage sur ?cran LCD
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Fanta025 | 0:ed0b4e66d2ad | 1 | /* USB Mass Storage device file system |
Fanta025 | 0:ed0b4e66d2ad | 2 | * Copyrigh (c) 2010, Igor Skochinsky |
Fanta025 | 0:ed0b4e66d2ad | 3 | * based on SDFileStorage |
Fanta025 | 0:ed0b4e66d2ad | 4 | * Copyright (c) 2008-2009, sford |
Fanta025 | 0:ed0b4e66d2ad | 5 | */ |
Fanta025 | 0:ed0b4e66d2ad | 6 | |
Fanta025 | 0:ed0b4e66d2ad | 7 | #ifndef MSCFILESYSTEM_H |
Fanta025 | 0:ed0b4e66d2ad | 8 | #define MSCFILESYSTEM_H |
Fanta025 | 0:ed0b4e66d2ad | 9 | |
Fanta025 | 0:ed0b4e66d2ad | 10 | #include "mbed.h" |
Fanta025 | 0:ed0b4e66d2ad | 11 | #include "FATFileSystem.h" |
Fanta025 | 0:ed0b4e66d2ad | 12 | |
Fanta025 | 0:ed0b4e66d2ad | 13 | /* Class: MSCFileSystem |
Fanta025 | 0:ed0b4e66d2ad | 14 | * Access the filesystem on an attached USB mass storage device (e.g. a memory stick) |
Fanta025 | 0:ed0b4e66d2ad | 15 | * |
Fanta025 | 0:ed0b4e66d2ad | 16 | * Example: |
Fanta025 | 0:ed0b4e66d2ad | 17 | * > MSCFileSystem msc("msc"); |
Fanta025 | 0:ed0b4e66d2ad | 18 | * > |
Fanta025 | 0:ed0b4e66d2ad | 19 | * > int main() { |
Fanta025 | 0:ed0b4e66d2ad | 20 | * > FILE *fp = fopen("/msc/myfile.txt", "w"); |
Fanta025 | 0:ed0b4e66d2ad | 21 | * > fprintf(fp, "Hello World!\n"); |
Fanta025 | 0:ed0b4e66d2ad | 22 | * > fclose(fp); |
Fanta025 | 0:ed0b4e66d2ad | 23 | * > } |
Fanta025 | 0:ed0b4e66d2ad | 24 | */ |
Fanta025 | 0:ed0b4e66d2ad | 25 | class MSCFileSystem : public FATFileSystem { |
Fanta025 | 0:ed0b4e66d2ad | 26 | public: |
Fanta025 | 0:ed0b4e66d2ad | 27 | |
Fanta025 | 0:ed0b4e66d2ad | 28 | /* Constructor: MSCFileSystem |
Fanta025 | 0:ed0b4e66d2ad | 29 | * Create the File System for accessing a USB mass storage device |
Fanta025 | 0:ed0b4e66d2ad | 30 | * |
Fanta025 | 0:ed0b4e66d2ad | 31 | * Parameters: |
Fanta025 | 0:ed0b4e66d2ad | 32 | * name - The name used to access the filesystem |
Fanta025 | 0:ed0b4e66d2ad | 33 | */ |
Fanta025 | 0:ed0b4e66d2ad | 34 | MSCFileSystem(const char* name); |
Fanta025 | 0:ed0b4e66d2ad | 35 | virtual int disk_initialize(); |
Fanta025 | 0:ed0b4e66d2ad | 36 | virtual int disk_write(const char *buffer, int block_number); |
Fanta025 | 0:ed0b4e66d2ad | 37 | virtual int disk_read(char *buffer, int block_number); |
Fanta025 | 0:ed0b4e66d2ad | 38 | virtual int disk_status(); |
Fanta025 | 0:ed0b4e66d2ad | 39 | virtual int disk_sync(); |
Fanta025 | 0:ed0b4e66d2ad | 40 | virtual int disk_sectors(); |
Fanta025 | 0:ed0b4e66d2ad | 41 | |
Fanta025 | 0:ed0b4e66d2ad | 42 | protected: |
Fanta025 | 0:ed0b4e66d2ad | 43 | |
Fanta025 | 0:ed0b4e66d2ad | 44 | int initialise_msc(); |
Fanta025 | 0:ed0b4e66d2ad | 45 | uint32_t _numBlks; |
Fanta025 | 0:ed0b4e66d2ad | 46 | uint32_t _blkSize; |
Fanta025 | 0:ed0b4e66d2ad | 47 | }; |
Fanta025 | 0:ed0b4e66d2ad | 48 | |
Fanta025 | 0:ed0b4e66d2ad | 49 | #endif |