SD card data log
FATFileSystem/FATFileHandle.h@0:18d80d7403d3, 2019-11-03 (annotated)
- Committer:
- kotachi
- Date:
- Sun Nov 03 07:28:09 2019 +0000
- Revision:
- 0:18d80d7403d3
SD card logging system
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kotachi | 0:18d80d7403d3 | 1 | /* mbed Microcontroller Library |
kotachi | 0:18d80d7403d3 | 2 | * Copyright (c) 2006-2012 ARM Limited |
kotachi | 0:18d80d7403d3 | 3 | * |
kotachi | 0:18d80d7403d3 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
kotachi | 0:18d80d7403d3 | 5 | * of this software and associated documentation files (the "Software"), to deal |
kotachi | 0:18d80d7403d3 | 6 | * in the Software without restriction, including without limitation the rights |
kotachi | 0:18d80d7403d3 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
kotachi | 0:18d80d7403d3 | 8 | * copies of the Software, and to permit persons to whom the Software is |
kotachi | 0:18d80d7403d3 | 9 | * furnished to do so, subject to the following conditions: |
kotachi | 0:18d80d7403d3 | 10 | * |
kotachi | 0:18d80d7403d3 | 11 | * The above copyright notice and this permission notice shall be included in |
kotachi | 0:18d80d7403d3 | 12 | * all copies or substantial portions of the Software. |
kotachi | 0:18d80d7403d3 | 13 | * |
kotachi | 0:18d80d7403d3 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
kotachi | 0:18d80d7403d3 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
kotachi | 0:18d80d7403d3 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
kotachi | 0:18d80d7403d3 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
kotachi | 0:18d80d7403d3 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
kotachi | 0:18d80d7403d3 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
kotachi | 0:18d80d7403d3 | 20 | * SOFTWARE. |
kotachi | 0:18d80d7403d3 | 21 | */ |
kotachi | 0:18d80d7403d3 | 22 | #ifndef MBED_FATFILEHANDLE_H |
kotachi | 0:18d80d7403d3 | 23 | #define MBED_FATFILEHANDLE_H |
kotachi | 0:18d80d7403d3 | 24 | |
kotachi | 0:18d80d7403d3 | 25 | #include "FileHandle.h" |
kotachi | 0:18d80d7403d3 | 26 | |
kotachi | 0:18d80d7403d3 | 27 | using namespace mbed; |
kotachi | 0:18d80d7403d3 | 28 | |
kotachi | 0:18d80d7403d3 | 29 | class FATFileHandle : public FileHandle { |
kotachi | 0:18d80d7403d3 | 30 | public: |
kotachi | 0:18d80d7403d3 | 31 | |
kotachi | 0:18d80d7403d3 | 32 | FATFileHandle(FIL fh); |
kotachi | 0:18d80d7403d3 | 33 | virtual int close(); |
kotachi | 0:18d80d7403d3 | 34 | virtual ssize_t write(const void* buffer, size_t length); |
kotachi | 0:18d80d7403d3 | 35 | virtual ssize_t read(void* buffer, size_t length); |
kotachi | 0:18d80d7403d3 | 36 | virtual int isatty(); |
kotachi | 0:18d80d7403d3 | 37 | virtual off_t lseek(off_t position, int whence); |
kotachi | 0:18d80d7403d3 | 38 | virtual int fsync(); |
kotachi | 0:18d80d7403d3 | 39 | virtual off_t flen(); |
kotachi | 0:18d80d7403d3 | 40 | |
kotachi | 0:18d80d7403d3 | 41 | virtual off_t seek(off_t position, int whence) { return lseek(position, whence); } |
kotachi | 0:18d80d7403d3 | 42 | virtual off_t size() { return flen(); } |
kotachi | 0:18d80d7403d3 | 43 | |
kotachi | 0:18d80d7403d3 | 44 | protected: |
kotachi | 0:18d80d7403d3 | 45 | |
kotachi | 0:18d80d7403d3 | 46 | FIL _fh; |
kotachi | 0:18d80d7403d3 | 47 | |
kotachi | 0:18d80d7403d3 | 48 | }; |
kotachi | 0:18d80d7403d3 | 49 | |
kotachi | 0:18d80d7403d3 | 50 | #endif |