![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This is code is part of a Technion course project in advanced IoT, implementing a device to receive and present sensors data from a Formula racing car built by students at Technion - Israel Institute of Technology.
Fork of DISCO-L072CZ-LRWAN1_LoRa_PingPong by
This is code is part of a Technion course project in advanced IoT, implementing a device to receive sensors data from another L072CZ-LRWAN1 installed on a Formula racing car (built by students at Technion - Israel Institute of Technology), and sends it to a GUI presenting the data (GUI project: github.com/ward-mattar/TechnionFormulaGUI).
How to install
- Create an account on Mbed: https://os.mbed.com/account/signup/
- Import project into Compiler
- In the Program Workspace select "Formula_Nucleo_Receiver"
- Select a Platform like so:
- Click button at top-left
- Add Board
- Search "NUCLEO F103RB" and then "Add to your Mbed Compiler"
- Finally click "Compile", if the build was successful, the binary would download automatically
- To install it on device simply plug it in to a PC, open device drive and drag then drop binary file in it
FATFileSystem/FATFileSystem.h@12:046346a16ff4, 2018-05-19 (annotated)
- Committer:
- wardm
- Date:
- Sat May 19 15:42:38 2018 +0000
- Revision:
- 12:046346a16ff4
V1.0.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wardm | 12:046346a16ff4 | 1 | /* mbed Microcontroller Library |
wardm | 12:046346a16ff4 | 2 | * Copyright (c) 2006-2012 ARM Limited |
wardm | 12:046346a16ff4 | 3 | * |
wardm | 12:046346a16ff4 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
wardm | 12:046346a16ff4 | 5 | * of this software and associated documentation files (the "Software"), to deal |
wardm | 12:046346a16ff4 | 6 | * in the Software without restriction, including without limitation the rights |
wardm | 12:046346a16ff4 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
wardm | 12:046346a16ff4 | 8 | * copies of the Software, and to permit persons to whom the Software is |
wardm | 12:046346a16ff4 | 9 | * furnished to do so, subject to the following conditions: |
wardm | 12:046346a16ff4 | 10 | * |
wardm | 12:046346a16ff4 | 11 | * The above copyright notice and this permission notice shall be included in |
wardm | 12:046346a16ff4 | 12 | * all copies or substantial portions of the Software. |
wardm | 12:046346a16ff4 | 13 | * |
wardm | 12:046346a16ff4 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
wardm | 12:046346a16ff4 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
wardm | 12:046346a16ff4 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
wardm | 12:046346a16ff4 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
wardm | 12:046346a16ff4 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
wardm | 12:046346a16ff4 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
wardm | 12:046346a16ff4 | 20 | * SOFTWARE. |
wardm | 12:046346a16ff4 | 21 | */ |
wardm | 12:046346a16ff4 | 22 | #ifndef MBED_FATFILESYSTEM_H |
wardm | 12:046346a16ff4 | 23 | #define MBED_FATFILESYSTEM_H |
wardm | 12:046346a16ff4 | 24 | |
wardm | 12:046346a16ff4 | 25 | #include "FileSystemLike.h" |
wardm | 12:046346a16ff4 | 26 | #include "FileHandle.h" |
wardm | 12:046346a16ff4 | 27 | #include "ff.h" |
wardm | 12:046346a16ff4 | 28 | #include <stdint.h> |
wardm | 12:046346a16ff4 | 29 | |
wardm | 12:046346a16ff4 | 30 | using namespace mbed; |
wardm | 12:046346a16ff4 | 31 | |
wardm | 12:046346a16ff4 | 32 | /** |
wardm | 12:046346a16ff4 | 33 | * FATFileSystem based on ChaN's Fat Filesystem library v0.8 |
wardm | 12:046346a16ff4 | 34 | */ |
wardm | 12:046346a16ff4 | 35 | class FATFileSystem : public FileSystemLike { |
wardm | 12:046346a16ff4 | 36 | public: |
wardm | 12:046346a16ff4 | 37 | |
wardm | 12:046346a16ff4 | 38 | FATFileSystem(const char* n); |
wardm | 12:046346a16ff4 | 39 | virtual ~FATFileSystem(); |
wardm | 12:046346a16ff4 | 40 | |
wardm | 12:046346a16ff4 | 41 | static FATFileSystem * _ffs[_VOLUMES]; // FATFileSystem objects, as parallel to FatFs drives array |
wardm | 12:046346a16ff4 | 42 | FATFS _fs; // Work area (file system object) for logical drive |
wardm | 12:046346a16ff4 | 43 | char _fsid[2]; |
wardm | 12:046346a16ff4 | 44 | |
wardm | 12:046346a16ff4 | 45 | /** |
wardm | 12:046346a16ff4 | 46 | * Opens a file on the filesystem |
wardm | 12:046346a16ff4 | 47 | */ |
wardm | 12:046346a16ff4 | 48 | virtual FileHandle *open(const char* name, int flags); |
wardm | 12:046346a16ff4 | 49 | virtual int open(FileHandle **file, const char *name, int flags); |
wardm | 12:046346a16ff4 | 50 | |
wardm | 12:046346a16ff4 | 51 | /** |
wardm | 12:046346a16ff4 | 52 | * Removes a file path |
wardm | 12:046346a16ff4 | 53 | */ |
wardm | 12:046346a16ff4 | 54 | virtual int remove(const char *filename); |
wardm | 12:046346a16ff4 | 55 | |
wardm | 12:046346a16ff4 | 56 | /** |
wardm | 12:046346a16ff4 | 57 | * Renames a file |
wardm | 12:046346a16ff4 | 58 | */ |
wardm | 12:046346a16ff4 | 59 | virtual int rename(const char *oldname, const char *newname); |
wardm | 12:046346a16ff4 | 60 | |
wardm | 12:046346a16ff4 | 61 | /** |
wardm | 12:046346a16ff4 | 62 | * Formats a logical drive, FDISK artitioning rule, 512 bytes per cluster |
wardm | 12:046346a16ff4 | 63 | */ |
wardm | 12:046346a16ff4 | 64 | virtual int format(); |
wardm | 12:046346a16ff4 | 65 | |
wardm | 12:046346a16ff4 | 66 | /** |
wardm | 12:046346a16ff4 | 67 | * Opens a directory on the filesystem |
wardm | 12:046346a16ff4 | 68 | */ |
wardm | 12:046346a16ff4 | 69 | virtual DirHandle *opendir(const char *name); |
wardm | 12:046346a16ff4 | 70 | virtual int open(DirHandle **dir, const char *name); |
wardm | 12:046346a16ff4 | 71 | |
wardm | 12:046346a16ff4 | 72 | /** |
wardm | 12:046346a16ff4 | 73 | * Creates a directory path |
wardm | 12:046346a16ff4 | 74 | */ |
wardm | 12:046346a16ff4 | 75 | virtual int mkdir(const char *name, mode_t mode); |
wardm | 12:046346a16ff4 | 76 | |
wardm | 12:046346a16ff4 | 77 | /** |
wardm | 12:046346a16ff4 | 78 | * Mounts the filesystem |
wardm | 12:046346a16ff4 | 79 | */ |
wardm | 12:046346a16ff4 | 80 | virtual int mount(); |
wardm | 12:046346a16ff4 | 81 | |
wardm | 12:046346a16ff4 | 82 | /** |
wardm | 12:046346a16ff4 | 83 | * Unmounts the filesystem |
wardm | 12:046346a16ff4 | 84 | */ |
wardm | 12:046346a16ff4 | 85 | virtual int unmount(); |
wardm | 12:046346a16ff4 | 86 | |
wardm | 12:046346a16ff4 | 87 | virtual int disk_initialize() { return 0; } |
wardm | 12:046346a16ff4 | 88 | virtual int disk_status() { return 0; } |
wardm | 12:046346a16ff4 | 89 | virtual int disk_read(uint8_t *buffer, uint32_t sector, uint32_t count) = 0; |
wardm | 12:046346a16ff4 | 90 | virtual int disk_write(const uint8_t *buffer, uint32_t sector, uint32_t count) = 0; |
wardm | 12:046346a16ff4 | 91 | virtual int disk_sync() { return 0; } |
wardm | 12:046346a16ff4 | 92 | virtual uint32_t disk_sectors() = 0; |
wardm | 12:046346a16ff4 | 93 | |
wardm | 12:046346a16ff4 | 94 | }; |
wardm | 12:046346a16ff4 | 95 | |
wardm | 12:046346a16ff4 | 96 | #endif |