Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
features/unsupported/fs/fat/FATFileSystem.h@1:f30bdcd2b33b, 2017-02-27 (annotated)
- Committer:
- jacobjohnson
- Date:
- Mon Feb 27 17:45:05 2017 +0000
- Revision:
- 1:f30bdcd2b33b
- Parent:
- 0:098463de4c5d
changed the inputscale from 1 to 7 in analogin_api.c. This will need to be changed later, and accessed from the main level, but for now this allows the adc to read a value from 0 to 3.7V, instead of just up to 1V.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-onsemi | 0:098463de4c5d | 1 | /* mbed Microcontroller Library |
group-onsemi | 0:098463de4c5d | 2 | * Copyright (c) 2006-2012 ARM Limited |
group-onsemi | 0:098463de4c5d | 3 | * |
group-onsemi | 0:098463de4c5d | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
group-onsemi | 0:098463de4c5d | 5 | * of this software and associated documentation files (the "Software"), to deal |
group-onsemi | 0:098463de4c5d | 6 | * in the Software without restriction, including without limitation the rights |
group-onsemi | 0:098463de4c5d | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
group-onsemi | 0:098463de4c5d | 8 | * copies of the Software, and to permit persons to whom the Software is |
group-onsemi | 0:098463de4c5d | 9 | * furnished to do so, subject to the following conditions: |
group-onsemi | 0:098463de4c5d | 10 | * |
group-onsemi | 0:098463de4c5d | 11 | * The above copyright notice and this permission notice shall be included in |
group-onsemi | 0:098463de4c5d | 12 | * all copies or substantial portions of the Software. |
group-onsemi | 0:098463de4c5d | 13 | * |
group-onsemi | 0:098463de4c5d | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
group-onsemi | 0:098463de4c5d | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
group-onsemi | 0:098463de4c5d | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
group-onsemi | 0:098463de4c5d | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
group-onsemi | 0:098463de4c5d | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
group-onsemi | 0:098463de4c5d | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
group-onsemi | 0:098463de4c5d | 20 | * SOFTWARE. |
group-onsemi | 0:098463de4c5d | 21 | */ |
group-onsemi | 0:098463de4c5d | 22 | #ifndef MBED_FATFILESYSTEM_H |
group-onsemi | 0:098463de4c5d | 23 | #define MBED_FATFILESYSTEM_H |
group-onsemi | 0:098463de4c5d | 24 | |
group-onsemi | 0:098463de4c5d | 25 | #include "FileSystemLike.h" |
group-onsemi | 0:098463de4c5d | 26 | #include "FileHandle.h" |
group-onsemi | 0:098463de4c5d | 27 | #include "ff.h" |
group-onsemi | 0:098463de4c5d | 28 | #include <stdint.h> |
group-onsemi | 0:098463de4c5d | 29 | #include "PlatformMutex.h" |
group-onsemi | 0:098463de4c5d | 30 | |
group-onsemi | 0:098463de4c5d | 31 | using namespace mbed; |
group-onsemi | 0:098463de4c5d | 32 | |
group-onsemi | 0:098463de4c5d | 33 | /** |
group-onsemi | 0:098463de4c5d | 34 | * FATFileSystem based on ChaN's Fat Filesystem library v0.8 |
group-onsemi | 0:098463de4c5d | 35 | */ |
group-onsemi | 0:098463de4c5d | 36 | class FATFileSystem : public FileSystemLike { |
group-onsemi | 0:098463de4c5d | 37 | public: |
group-onsemi | 0:098463de4c5d | 38 | |
group-onsemi | 0:098463de4c5d | 39 | FATFileSystem(const char* n); |
group-onsemi | 0:098463de4c5d | 40 | virtual ~FATFileSystem(); |
group-onsemi | 0:098463de4c5d | 41 | |
group-onsemi | 0:098463de4c5d | 42 | static FATFileSystem * _ffs[_VOLUMES]; // FATFileSystem objects, as parallel to FatFs drives array |
group-onsemi | 0:098463de4c5d | 43 | FATFS _fs; // Work area (file system object) for logical drive |
group-onsemi | 0:098463de4c5d | 44 | char _fsid[2]; |
group-onsemi | 0:098463de4c5d | 45 | |
group-onsemi | 0:098463de4c5d | 46 | /** |
group-onsemi | 0:098463de4c5d | 47 | * Opens a file on the filesystem |
group-onsemi | 0:098463de4c5d | 48 | */ |
group-onsemi | 0:098463de4c5d | 49 | virtual FileHandle *open(const char* name, int flags); |
group-onsemi | 0:098463de4c5d | 50 | |
group-onsemi | 0:098463de4c5d | 51 | /** |
group-onsemi | 0:098463de4c5d | 52 | * Removes a file path |
group-onsemi | 0:098463de4c5d | 53 | */ |
group-onsemi | 0:098463de4c5d | 54 | virtual int remove(const char *filename); |
group-onsemi | 0:098463de4c5d | 55 | |
group-onsemi | 0:098463de4c5d | 56 | /** |
group-onsemi | 0:098463de4c5d | 57 | * Renames a file |
group-onsemi | 0:098463de4c5d | 58 | */ |
group-onsemi | 0:098463de4c5d | 59 | virtual int rename(const char *oldname, const char *newname); |
group-onsemi | 0:098463de4c5d | 60 | |
group-onsemi | 0:098463de4c5d | 61 | /** |
group-onsemi | 0:098463de4c5d | 62 | * Formats a logical drive, FDISK artitioning rule, 512 bytes per cluster |
group-onsemi | 0:098463de4c5d | 63 | */ |
group-onsemi | 0:098463de4c5d | 64 | virtual int format(); |
group-onsemi | 0:098463de4c5d | 65 | |
group-onsemi | 0:098463de4c5d | 66 | /** |
group-onsemi | 0:098463de4c5d | 67 | * Opens a directory on the filesystem |
group-onsemi | 0:098463de4c5d | 68 | */ |
group-onsemi | 0:098463de4c5d | 69 | virtual DirHandle *opendir(const char *name); |
group-onsemi | 0:098463de4c5d | 70 | |
group-onsemi | 0:098463de4c5d | 71 | /** |
group-onsemi | 0:098463de4c5d | 72 | * Creates a directory path |
group-onsemi | 0:098463de4c5d | 73 | */ |
group-onsemi | 0:098463de4c5d | 74 | virtual int mkdir(const char *name, mode_t mode); |
group-onsemi | 0:098463de4c5d | 75 | |
group-onsemi | 0:098463de4c5d | 76 | /** |
group-onsemi | 0:098463de4c5d | 77 | * Mounts the filesystem |
group-onsemi | 0:098463de4c5d | 78 | */ |
group-onsemi | 0:098463de4c5d | 79 | virtual int mount(); |
group-onsemi | 0:098463de4c5d | 80 | |
group-onsemi | 0:098463de4c5d | 81 | /** |
group-onsemi | 0:098463de4c5d | 82 | * Unmounts the filesystem |
group-onsemi | 0:098463de4c5d | 83 | */ |
group-onsemi | 0:098463de4c5d | 84 | virtual int unmount(); |
group-onsemi | 0:098463de4c5d | 85 | |
group-onsemi | 0:098463de4c5d | 86 | virtual int disk_initialize() { return 0; } |
group-onsemi | 0:098463de4c5d | 87 | virtual int disk_status() { return 0; } |
group-onsemi | 0:098463de4c5d | 88 | virtual int disk_read(uint8_t *buffer, uint32_t sector, uint32_t count) = 0; |
group-onsemi | 0:098463de4c5d | 89 | virtual int disk_write(const uint8_t *buffer, uint32_t sector, uint32_t count) = 0; |
group-onsemi | 0:098463de4c5d | 90 | virtual int disk_sync() { return 0; } |
group-onsemi | 0:098463de4c5d | 91 | virtual uint32_t disk_sectors() = 0; |
group-onsemi | 0:098463de4c5d | 92 | |
group-onsemi | 0:098463de4c5d | 93 | protected: |
group-onsemi | 0:098463de4c5d | 94 | |
group-onsemi | 0:098463de4c5d | 95 | virtual void lock(); |
group-onsemi | 0:098463de4c5d | 96 | virtual void unlock(); |
group-onsemi | 0:098463de4c5d | 97 | |
group-onsemi | 0:098463de4c5d | 98 | private: |
group-onsemi | 0:098463de4c5d | 99 | |
group-onsemi | 0:098463de4c5d | 100 | PlatformMutex *_mutex; |
group-onsemi | 0:098463de4c5d | 101 | |
group-onsemi | 0:098463de4c5d | 102 | }; |
group-onsemi | 0:098463de4c5d | 103 | |
group-onsemi | 0:098463de4c5d | 104 | #endif |