fix nrf51822 i2c & spi conflict

Dependencies:   BLE_API eMPL_MPU6050 nRF51822

Fork of Seeed_Tiny_BLE_Flash by Darren Huang

Committer:
yihui
Date:
Tue Nov 17 07:48:56 2015 +0000
Revision:
5:b8c02645e6af
fix i2c & spi conflict

Who changed what in which revision?

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