J&W / Mbed 2 deprecated Rejestrator

Dependencies:   mbed Rejestrator

Dependents:   Rejestrator

Committer:
Waldek
Date:
Sat May 09 15:06:38 2015 +0000
Revision:
1:5ad44a4edff9
Parent:
0:fa31f8461c63
Correction in the magnetic measurement

Who changed what in which revision?

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