fix nrf51822 i2c & spi conflict
Dependencies: BLE_API eMPL_MPU6050 nRF51822
Fork of Seeed_Tiny_BLE_Flash by
mbed-src/api/FileBase.h@5:b8c02645e6af, 2015-11-17 (annotated)
- Committer:
- yihui
- Date:
- Tue Nov 17 07:48:56 2015 +0000
- Revision:
- 5:b8c02645e6af
fix i2c & spi conflict
Who changed what in which revision?
User | Revision | Line number | New 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_FILEBASE_H |
yihui | 5:b8c02645e6af | 17 | #define MBED_FILEBASE_H |
yihui | 5:b8c02645e6af | 18 | |
yihui | 5:b8c02645e6af | 19 | typedef int FILEHANDLE; |
yihui | 5:b8c02645e6af | 20 | |
yihui | 5:b8c02645e6af | 21 | #include <stdio.h> |
yihui | 5:b8c02645e6af | 22 | |
yihui | 5:b8c02645e6af | 23 | #if defined(__ARMCC_VERSION) || defined(__ICCARM__) |
yihui | 5:b8c02645e6af | 24 | # define O_RDONLY 0 |
yihui | 5:b8c02645e6af | 25 | # define O_WRONLY 1 |
yihui | 5:b8c02645e6af | 26 | # define O_RDWR 2 |
yihui | 5:b8c02645e6af | 27 | # define O_CREAT 0x0200 |
yihui | 5:b8c02645e6af | 28 | # define O_TRUNC 0x0400 |
yihui | 5:b8c02645e6af | 29 | # define O_APPEND 0x0008 |
yihui | 5:b8c02645e6af | 30 | |
yihui | 5:b8c02645e6af | 31 | # define NAME_MAX 255 |
yihui | 5:b8c02645e6af | 32 | |
yihui | 5:b8c02645e6af | 33 | typedef int mode_t; |
yihui | 5:b8c02645e6af | 34 | typedef int ssize_t; |
yihui | 5:b8c02645e6af | 35 | typedef long off_t; |
yihui | 5:b8c02645e6af | 36 | |
yihui | 5:b8c02645e6af | 37 | #else |
yihui | 5:b8c02645e6af | 38 | # include <sys/fcntl.h> |
yihui | 5:b8c02645e6af | 39 | # include <sys/types.h> |
yihui | 5:b8c02645e6af | 40 | # include <sys/syslimits.h> |
yihui | 5:b8c02645e6af | 41 | #endif |
yihui | 5:b8c02645e6af | 42 | |
yihui | 5:b8c02645e6af | 43 | #include "platform.h" |
yihui | 5:b8c02645e6af | 44 | |
yihui | 5:b8c02645e6af | 45 | namespace mbed { |
yihui | 5:b8c02645e6af | 46 | |
yihui | 5:b8c02645e6af | 47 | typedef enum { |
yihui | 5:b8c02645e6af | 48 | FilePathType, |
yihui | 5:b8c02645e6af | 49 | FileSystemPathType |
yihui | 5:b8c02645e6af | 50 | } PathType; |
yihui | 5:b8c02645e6af | 51 | |
yihui | 5:b8c02645e6af | 52 | class FileBase { |
yihui | 5:b8c02645e6af | 53 | public: |
yihui | 5:b8c02645e6af | 54 | FileBase(const char *name, PathType t); |
yihui | 5:b8c02645e6af | 55 | |
yihui | 5:b8c02645e6af | 56 | virtual ~FileBase(); |
yihui | 5:b8c02645e6af | 57 | |
yihui | 5:b8c02645e6af | 58 | const char* getName(void); |
yihui | 5:b8c02645e6af | 59 | PathType getPathType(void); |
yihui | 5:b8c02645e6af | 60 | |
yihui | 5:b8c02645e6af | 61 | static FileBase *lookup(const char *name, unsigned int len); |
yihui | 5:b8c02645e6af | 62 | |
yihui | 5:b8c02645e6af | 63 | static FileBase *get(int n); |
yihui | 5:b8c02645e6af | 64 | |
yihui | 5:b8c02645e6af | 65 | protected: |
yihui | 5:b8c02645e6af | 66 | static FileBase *_head; |
yihui | 5:b8c02645e6af | 67 | |
yihui | 5:b8c02645e6af | 68 | FileBase *_next; |
yihui | 5:b8c02645e6af | 69 | const char *_name; |
yihui | 5:b8c02645e6af | 70 | PathType _path_type; |
yihui | 5:b8c02645e6af | 71 | |
yihui | 5:b8c02645e6af | 72 | /* disallow copy constructor and assignment operators */ |
yihui | 5:b8c02645e6af | 73 | private: |
yihui | 5:b8c02645e6af | 74 | FileBase(const FileBase&); |
yihui | 5:b8c02645e6af | 75 | FileBase & operator = (const FileBase&); |
yihui | 5:b8c02645e6af | 76 | }; |
yihui | 5:b8c02645e6af | 77 | |
yihui | 5:b8c02645e6af | 78 | } // namespace mbed |
yihui | 5:b8c02645e6af | 79 | |
yihui | 5:b8c02645e6af | 80 | #endif |