Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1 /* mbed Microcontroller Library
lypinator 0:bb348c97df44 2 * Copyright (c) 2006-2013 ARM Limited
lypinator 0:bb348c97df44 3 *
lypinator 0:bb348c97df44 4 * Licensed under the Apache License, Version 2.0 (the "License");
lypinator 0:bb348c97df44 5 * you may not use this file except in compliance with the License.
lypinator 0:bb348c97df44 6 * You may obtain a copy of the License at
lypinator 0:bb348c97df44 7 *
lypinator 0:bb348c97df44 8 * http://www.apache.org/licenses/LICENSE-2.0
lypinator 0:bb348c97df44 9 *
lypinator 0:bb348c97df44 10 * Unless required by applicable law or agreed to in writing, software
lypinator 0:bb348c97df44 11 * distributed under the License is distributed on an "AS IS" BASIS,
lypinator 0:bb348c97df44 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
lypinator 0:bb348c97df44 13 * See the License for the specific language governing permissions and
lypinator 0:bb348c97df44 14 * limitations under the License.
lypinator 0:bb348c97df44 15 */
lypinator 0:bb348c97df44 16 #ifndef MBED_FILESYSTEMLIKE_H
lypinator 0:bb348c97df44 17 #define MBED_FILESYSTEMLIKE_H
lypinator 0:bb348c97df44 18
lypinator 0:bb348c97df44 19 #include "platform/platform.h"
lypinator 0:bb348c97df44 20
lypinator 0:bb348c97df44 21 #include "platform/FileSystemHandle.h"
lypinator 0:bb348c97df44 22 #include "platform/FileHandle.h"
lypinator 0:bb348c97df44 23 #include "platform/DirHandle.h"
lypinator 0:bb348c97df44 24 #include "platform/NonCopyable.h"
lypinator 0:bb348c97df44 25
lypinator 0:bb348c97df44 26 namespace mbed {
lypinator 0:bb348c97df44 27 /** \addtogroup platform */
lypinator 0:bb348c97df44 28 /** @{*/
lypinator 0:bb348c97df44 29 /**
lypinator 0:bb348c97df44 30 * \defgroup platform_FileSystemLike FileSystemLike functions
lypinator 0:bb348c97df44 31 * @{
lypinator 0:bb348c97df44 32 */
lypinator 0:bb348c97df44 33
lypinator 0:bb348c97df44 34
lypinator 0:bb348c97df44 35 /** A filesystem-like object is one that can be used to open file-like
lypinator 0:bb348c97df44 36 * objects though it by fopen("/name/filename", mode)
lypinator 0:bb348c97df44 37 *
lypinator 0:bb348c97df44 38 * Implementations must define at least open (the default definitions
lypinator 0:bb348c97df44 39 * of the rest of the functions just return error values).
lypinator 0:bb348c97df44 40 *
lypinator 0:bb348c97df44 41 * @note Synchronization level: Set by subclass
lypinator 0:bb348c97df44 42 */
lypinator 0:bb348c97df44 43 class FileSystemLike : public FileSystemHandle, public FileBase, private NonCopyable<FileSystemLike> {
lypinator 0:bb348c97df44 44 public:
lypinator 0:bb348c97df44 45 /** FileSystemLike lifetime
lypinator 0:bb348c97df44 46 */
lypinator 0:bb348c97df44 47 FileSystemLike(const char *name = NULL) : FileBase(name, FileSystemPathType) {}
lypinator 0:bb348c97df44 48 virtual ~FileSystemLike() {}
lypinator 0:bb348c97df44 49
lypinator 0:bb348c97df44 50 // Inherited functions with name conflicts
lypinator 0:bb348c97df44 51 using FileSystemHandle::open;
lypinator 0:bb348c97df44 52
lypinator 0:bb348c97df44 53 /** Open a file on the filesystem
lypinator 0:bb348c97df44 54 *
lypinator 0:bb348c97df44 55 * @param path The name of the file to open
lypinator 0:bb348c97df44 56 * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR,
lypinator 0:bb348c97df44 57 * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND
lypinator 0:bb348c97df44 58 * @return A file handle on success, NULL on failure
lypinator 0:bb348c97df44 59 * @deprecated Replaced by `int open(FileHandle **, ...)` for propagating error codes
lypinator 0:bb348c97df44 60 */
lypinator 0:bb348c97df44 61 MBED_DEPRECATED_SINCE("mbed-os-5.5",
lypinator 0:bb348c97df44 62 "Replaced by `int open(FileHandle **, ...)` for propagating error codes")
lypinator 0:bb348c97df44 63 FileHandle *open(const char *path, int flags)
lypinator 0:bb348c97df44 64 {
lypinator 0:bb348c97df44 65 FileHandle *file;
lypinator 0:bb348c97df44 66 int err = open(&file, path, flags);
lypinator 0:bb348c97df44 67 return err ? NULL : file;
lypinator 0:bb348c97df44 68 }
lypinator 0:bb348c97df44 69
lypinator 0:bb348c97df44 70 /** Open a directory on the filesystem
lypinator 0:bb348c97df44 71 *
lypinator 0:bb348c97df44 72 * @param path Name of the directory to open
lypinator 0:bb348c97df44 73 * @return A directory handle on success, NULL on failure
lypinator 0:bb348c97df44 74 * @deprecated Replaced by `int open(DirHandle **, ...)` for propagating error codes
lypinator 0:bb348c97df44 75 */
lypinator 0:bb348c97df44 76 MBED_DEPRECATED_SINCE("mbed-os-5.5",
lypinator 0:bb348c97df44 77 "Replaced by `int open(DirHandle **, ...)` for propagating error codes")
lypinator 0:bb348c97df44 78 DirHandle *opendir(const char *path)
lypinator 0:bb348c97df44 79 {
lypinator 0:bb348c97df44 80 DirHandle *dir;
lypinator 0:bb348c97df44 81 int err = open(&dir, path);
lypinator 0:bb348c97df44 82 return err ? NULL : dir;
lypinator 0:bb348c97df44 83 }
lypinator 0:bb348c97df44 84 };
lypinator 0:bb348c97df44 85
lypinator 0:bb348c97df44 86 /**@}*/
lypinator 0:bb348c97df44 87
lypinator 0:bb348c97df44 88 /**@}*/
lypinator 0:bb348c97df44 89
lypinator 0:bb348c97df44 90 } // namespace mbed
lypinator 0:bb348c97df44 91
lypinator 0:bb348c97df44 92 #endif