temp

Dependencies:   mbed SDFileSystem MS5607 ADXL345_I2C FATFileSystem

Committer:
IKobayashi
Date:
Mon Mar 16 23:37:42 2020 +0900
Revision:
0:c88c3b616c00
copy

Who changed what in which revision?

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