Final tidy of code following installation of new sensor, more comments added prior to submission

Dependencies:   mbed

Committer:
legstar85
Date:
Fri Jan 21 22:33:32 2022 +0000
Revision:
14:3e9991fe64e5
Addition of new menu option, start of coding for writing Temp data to SD card

Who changed what in which revision?

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