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