Example of using the SDFileSystem library on a K64F to write data to files and also read data into dynamically created arrays.

Dependencies:   mbed

Committer:
eencae
Date:
Mon Feb 03 12:06:21 2020 +0000
Revision:
1:caceb9d9d17a
Updated Mbed library. Removed serial. Confirmed working Jan 2020.

Who changed what in which revision?

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