ロケット用プログラム
Dependencies: mbed
SDFileSystem/FATFileSystem/FATFileSystem.h@0:d58274531d38, 2019-09-11 (annotated)
- Committer:
- ishiyamayuto
- Date:
- Wed Sep 11 06:37:20 2019 +0000
- Revision:
- 0:d58274531d38
BMP180,MPU6050
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ishiyamayuto | 0:d58274531d38 | 1 | /* mbed Microcontroller Library |
ishiyamayuto | 0:d58274531d38 | 2 | * Copyright (c) 2006-2012 ARM Limited |
ishiyamayuto | 0:d58274531d38 | 3 | * |
ishiyamayuto | 0:d58274531d38 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
ishiyamayuto | 0:d58274531d38 | 5 | * of this software and associated documentation files (the "Software"), to deal |
ishiyamayuto | 0:d58274531d38 | 6 | * in the Software without restriction, including without limitation the rights |
ishiyamayuto | 0:d58274531d38 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
ishiyamayuto | 0:d58274531d38 | 8 | * copies of the Software, and to permit persons to whom the Software is |
ishiyamayuto | 0:d58274531d38 | 9 | * furnished to do so, subject to the following conditions: |
ishiyamayuto | 0:d58274531d38 | 10 | * |
ishiyamayuto | 0:d58274531d38 | 11 | * The above copyright notice and this permission notice shall be included in |
ishiyamayuto | 0:d58274531d38 | 12 | * all copies or substantial portions of the Software. |
ishiyamayuto | 0:d58274531d38 | 13 | * |
ishiyamayuto | 0:d58274531d38 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
ishiyamayuto | 0:d58274531d38 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
ishiyamayuto | 0:d58274531d38 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
ishiyamayuto | 0:d58274531d38 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
ishiyamayuto | 0:d58274531d38 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ishiyamayuto | 0:d58274531d38 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
ishiyamayuto | 0:d58274531d38 | 20 | * SOFTWARE. |
ishiyamayuto | 0:d58274531d38 | 21 | */ |
ishiyamayuto | 0:d58274531d38 | 22 | #ifndef MBED_FATFILESYSTEM_H |
ishiyamayuto | 0:d58274531d38 | 23 | #define MBED_FATFILESYSTEM_H |
ishiyamayuto | 0:d58274531d38 | 24 | |
ishiyamayuto | 0:d58274531d38 | 25 | #include "FileSystemLike.h" |
ishiyamayuto | 0:d58274531d38 | 26 | #include "FileHandle.h" |
ishiyamayuto | 0:d58274531d38 | 27 | #include "ff.h" |
ishiyamayuto | 0:d58274531d38 | 28 | #include <stdint.h> |
ishiyamayuto | 0:d58274531d38 | 29 | |
ishiyamayuto | 0:d58274531d38 | 30 | using namespace mbed; |
ishiyamayuto | 0:d58274531d38 | 31 | |
ishiyamayuto | 0:d58274531d38 | 32 | /** |
ishiyamayuto | 0:d58274531d38 | 33 | * FATFileSystem based on ChaN's Fat Filesystem library v0.8 |
ishiyamayuto | 0:d58274531d38 | 34 | */ |
ishiyamayuto | 0:d58274531d38 | 35 | class FATFileSystem : public FileSystemLike { |
ishiyamayuto | 0:d58274531d38 | 36 | public: |
ishiyamayuto | 0:d58274531d38 | 37 | |
ishiyamayuto | 0:d58274531d38 | 38 | FATFileSystem(const char* n); |
ishiyamayuto | 0:d58274531d38 | 39 | virtual ~FATFileSystem(); |
ishiyamayuto | 0:d58274531d38 | 40 | |
ishiyamayuto | 0:d58274531d38 | 41 | static FATFileSystem * _ffs[_VOLUMES]; // FATFileSystem objects, as parallel to FatFs drives array |
ishiyamayuto | 0:d58274531d38 | 42 | FATFS _fs; // Work area (file system object) for logical drive |
ishiyamayuto | 0:d58274531d38 | 43 | char _fsid[2]; |
ishiyamayuto | 0:d58274531d38 | 44 | |
ishiyamayuto | 0:d58274531d38 | 45 | /** |
ishiyamayuto | 0:d58274531d38 | 46 | * Opens a file on the filesystem |
ishiyamayuto | 0:d58274531d38 | 47 | */ |
ishiyamayuto | 0:d58274531d38 | 48 | virtual FileHandle *open(const char* name, int flags); |
ishiyamayuto | 0:d58274531d38 | 49 | |
ishiyamayuto | 0:d58274531d38 | 50 | /** |
ishiyamayuto | 0:d58274531d38 | 51 | * Removes a file path |
ishiyamayuto | 0:d58274531d38 | 52 | */ |
ishiyamayuto | 0:d58274531d38 | 53 | virtual int remove(const char *filename); |
ishiyamayuto | 0:d58274531d38 | 54 | |
ishiyamayuto | 0:d58274531d38 | 55 | /** |
ishiyamayuto | 0:d58274531d38 | 56 | * Renames a file |
ishiyamayuto | 0:d58274531d38 | 57 | */ |
ishiyamayuto | 0:d58274531d38 | 58 | virtual int rename(const char *oldname, const char *newname); |
ishiyamayuto | 0:d58274531d38 | 59 | |
ishiyamayuto | 0:d58274531d38 | 60 | /** |
ishiyamayuto | 0:d58274531d38 | 61 | * Formats a logical drive, FDISK artitioning rule, 512 bytes per cluster |
ishiyamayuto | 0:d58274531d38 | 62 | */ |
ishiyamayuto | 0:d58274531d38 | 63 | virtual int format(); |
ishiyamayuto | 0:d58274531d38 | 64 | |
ishiyamayuto | 0:d58274531d38 | 65 | /** |
ishiyamayuto | 0:d58274531d38 | 66 | * Opens a directory on the filesystem |
ishiyamayuto | 0:d58274531d38 | 67 | */ |
ishiyamayuto | 0:d58274531d38 | 68 | virtual DirHandle *opendir(const char *name); |
ishiyamayuto | 0:d58274531d38 | 69 | |
ishiyamayuto | 0:d58274531d38 | 70 | /** |
ishiyamayuto | 0:d58274531d38 | 71 | * Creates a directory path |
ishiyamayuto | 0:d58274531d38 | 72 | */ |
ishiyamayuto | 0:d58274531d38 | 73 | virtual int mkdir(const char *name, mode_t mode); |
ishiyamayuto | 0:d58274531d38 | 74 | |
ishiyamayuto | 0:d58274531d38 | 75 | /** |
ishiyamayuto | 0:d58274531d38 | 76 | * Mounts the filesystem |
ishiyamayuto | 0:d58274531d38 | 77 | */ |
ishiyamayuto | 0:d58274531d38 | 78 | virtual int mount(); |
ishiyamayuto | 0:d58274531d38 | 79 | |
ishiyamayuto | 0:d58274531d38 | 80 | /** |
ishiyamayuto | 0:d58274531d38 | 81 | * Unmounts the filesystem |
ishiyamayuto | 0:d58274531d38 | 82 | */ |
ishiyamayuto | 0:d58274531d38 | 83 | virtual int unmount(); |
ishiyamayuto | 0:d58274531d38 | 84 | |
ishiyamayuto | 0:d58274531d38 | 85 | virtual int disk_initialize() { return 0; } |
ishiyamayuto | 0:d58274531d38 | 86 | virtual int disk_status() { return 0; } |
ishiyamayuto | 0:d58274531d38 | 87 | virtual int disk_read(uint8_t *buffer, uint32_t sector, uint32_t count) = 0; |
ishiyamayuto | 0:d58274531d38 | 88 | virtual int disk_write(const uint8_t *buffer, uint32_t sector, uint32_t count) = 0; |
ishiyamayuto | 0:d58274531d38 | 89 | virtual int disk_sync() { return 0; } |
ishiyamayuto | 0:d58274531d38 | 90 | virtual uint32_t disk_sectors() = 0; |
ishiyamayuto | 0:d58274531d38 | 91 | |
ishiyamayuto | 0:d58274531d38 | 92 | }; |
ishiyamayuto | 0:d58274531d38 | 93 | |
ishiyamayuto | 0:d58274531d38 | 94 | #endif |