LPC11U35 ADC Tick & USBSerial

Dependencies:   mbed

Dependents:   SmallDoseMeter_SingleCH_AE_lpc11u35_V1_00

Committer:
H_Tsunemoto
Date:
Mon Feb 19 09:09:52 2018 +0000
Revision:
1:b1a3be5f48ab
Parent:
0:871ab6846b18
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
H_Tsunemoto 0:871ab6846b18 1 /* mbed Microcontroller Library
H_Tsunemoto 0:871ab6846b18 2 * Copyright (c) 2006-2013 ARM Limited
H_Tsunemoto 0:871ab6846b18 3 *
H_Tsunemoto 0:871ab6846b18 4 * Licensed under the Apache License, Version 2.0 (the "License");
H_Tsunemoto 0:871ab6846b18 5 * you may not use this file except in compliance with the License.
H_Tsunemoto 0:871ab6846b18 6 * You may obtain a copy of the License at
H_Tsunemoto 0:871ab6846b18 7 *
H_Tsunemoto 0:871ab6846b18 8 * http://www.apache.org/licenses/LICENSE-2.0
H_Tsunemoto 0:871ab6846b18 9 *
H_Tsunemoto 0:871ab6846b18 10 * Unless required by applicable law or agreed to in writing, software
H_Tsunemoto 0:871ab6846b18 11 * distributed under the License is distributed on an "AS IS" BASIS,
H_Tsunemoto 0:871ab6846b18 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
H_Tsunemoto 0:871ab6846b18 13 * See the License for the specific language governing permissions and
H_Tsunemoto 0:871ab6846b18 14 * limitations under the License.
H_Tsunemoto 0:871ab6846b18 15 */
H_Tsunemoto 0:871ab6846b18 16 #ifndef MBED_FILESYSTEMLIKE_H
H_Tsunemoto 0:871ab6846b18 17 #define MBED_FILESYSTEMLIKE_H
H_Tsunemoto 0:871ab6846b18 18
H_Tsunemoto 0:871ab6846b18 19 #include "platform.h"
H_Tsunemoto 0:871ab6846b18 20
H_Tsunemoto 0:871ab6846b18 21 #include "FileBase.h"
H_Tsunemoto 0:871ab6846b18 22 #include "FileHandle.h"
H_Tsunemoto 0:871ab6846b18 23 #include "DirHandle.h"
H_Tsunemoto 0:871ab6846b18 24
H_Tsunemoto 0:871ab6846b18 25 namespace mbed {
H_Tsunemoto 0:871ab6846b18 26
H_Tsunemoto 0:871ab6846b18 27 /** A filesystem-like object is one that can be used to open files
H_Tsunemoto 0:871ab6846b18 28 * though it by fopen("/name/filename", mode)
H_Tsunemoto 0:871ab6846b18 29 *
H_Tsunemoto 0:871ab6846b18 30 * Implementations must define at least open (the default definitions
H_Tsunemoto 0:871ab6846b18 31 * of the rest of the functions just return error values).
H_Tsunemoto 0:871ab6846b18 32 */
H_Tsunemoto 0:871ab6846b18 33 class FileSystemLike : public FileBase {
H_Tsunemoto 0:871ab6846b18 34
H_Tsunemoto 0:871ab6846b18 35 public:
H_Tsunemoto 0:871ab6846b18 36 /** FileSystemLike constructor
H_Tsunemoto 0:871ab6846b18 37 *
H_Tsunemoto 0:871ab6846b18 38 * @param name The name to use for the filesystem.
H_Tsunemoto 0:871ab6846b18 39 */
H_Tsunemoto 0:871ab6846b18 40 FileSystemLike(const char *name);
H_Tsunemoto 0:871ab6846b18 41
H_Tsunemoto 0:871ab6846b18 42 virtual ~FileSystemLike();
H_Tsunemoto 0:871ab6846b18 43
H_Tsunemoto 0:871ab6846b18 44 static DirHandle *opendir();
H_Tsunemoto 0:871ab6846b18 45 friend class BaseDirHandle;
H_Tsunemoto 0:871ab6846b18 46
H_Tsunemoto 0:871ab6846b18 47 /** Opens a file from the filesystem
H_Tsunemoto 0:871ab6846b18 48 *
H_Tsunemoto 0:871ab6846b18 49 * @param filename The name of the file to open.
H_Tsunemoto 0:871ab6846b18 50 * @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with
H_Tsunemoto 0:871ab6846b18 51 * zero or more of O_CREAT, O_TRUNC, or O_APPEND.
H_Tsunemoto 0:871ab6846b18 52 *
H_Tsunemoto 0:871ab6846b18 53 * @returns
H_Tsunemoto 0:871ab6846b18 54 * A pointer to a FileHandle object representing the
H_Tsunemoto 0:871ab6846b18 55 * file on success, or NULL on failure.
H_Tsunemoto 0:871ab6846b18 56 */
H_Tsunemoto 0:871ab6846b18 57 virtual FileHandle *open(const char *filename, int flags) = 0;
H_Tsunemoto 0:871ab6846b18 58
H_Tsunemoto 0:871ab6846b18 59 /** Remove a file from the filesystem.
H_Tsunemoto 0:871ab6846b18 60 *
H_Tsunemoto 0:871ab6846b18 61 * @param filename the name of the file to remove.
H_Tsunemoto 0:871ab6846b18 62 * @param returns 0 on success, -1 on failure.
H_Tsunemoto 0:871ab6846b18 63 */
H_Tsunemoto 0:871ab6846b18 64 virtual int remove(const char *filename) { return -1; };
H_Tsunemoto 0:871ab6846b18 65
H_Tsunemoto 0:871ab6846b18 66 /** Rename a file in the filesystem.
H_Tsunemoto 0:871ab6846b18 67 *
H_Tsunemoto 0:871ab6846b18 68 * @param oldname the name of the file to rename.
H_Tsunemoto 0:871ab6846b18 69 * @param newname the name to rename it to.
H_Tsunemoto 0:871ab6846b18 70 *
H_Tsunemoto 0:871ab6846b18 71 * @returns
H_Tsunemoto 0:871ab6846b18 72 * 0 on success,
H_Tsunemoto 0:871ab6846b18 73 * -1 on failure.
H_Tsunemoto 0:871ab6846b18 74 */
H_Tsunemoto 0:871ab6846b18 75 virtual int rename(const char *oldname, const char *newname) { return -1; };
H_Tsunemoto 0:871ab6846b18 76
H_Tsunemoto 0:871ab6846b18 77 /** Opens a directory in the filesystem and returns a DirHandle
H_Tsunemoto 0:871ab6846b18 78 * representing the directory stream.
H_Tsunemoto 0:871ab6846b18 79 *
H_Tsunemoto 0:871ab6846b18 80 * @param name The name of the directory to open.
H_Tsunemoto 0:871ab6846b18 81 *
H_Tsunemoto 0:871ab6846b18 82 * @returns
H_Tsunemoto 0:871ab6846b18 83 * A DirHandle representing the directory stream, or
H_Tsunemoto 0:871ab6846b18 84 * NULL on failure.
H_Tsunemoto 0:871ab6846b18 85 */
H_Tsunemoto 0:871ab6846b18 86 virtual DirHandle *opendir(const char *name) { return NULL; };
H_Tsunemoto 0:871ab6846b18 87
H_Tsunemoto 0:871ab6846b18 88 /** Creates a directory in the filesystem.
H_Tsunemoto 0:871ab6846b18 89 *
H_Tsunemoto 0:871ab6846b18 90 * @param name The name of the directory to create.
H_Tsunemoto 0:871ab6846b18 91 * @param mode The permissions to create the directory with.
H_Tsunemoto 0:871ab6846b18 92 *
H_Tsunemoto 0:871ab6846b18 93 * @returns
H_Tsunemoto 0:871ab6846b18 94 * 0 on success,
H_Tsunemoto 0:871ab6846b18 95 * -1 on failure.
H_Tsunemoto 0:871ab6846b18 96 */
H_Tsunemoto 0:871ab6846b18 97 virtual int mkdir(const char *name, mode_t mode) { return -1; }
H_Tsunemoto 0:871ab6846b18 98
H_Tsunemoto 0:871ab6846b18 99 // TODO other filesystem functions (mkdir, rm, rn, ls etc)
H_Tsunemoto 0:871ab6846b18 100 };
H_Tsunemoto 0:871ab6846b18 101
H_Tsunemoto 0:871ab6846b18 102 } // namespace mbed
H_Tsunemoto 0:871ab6846b18 103
H_Tsunemoto 0:871ab6846b18 104 #endif