fix nrf51822 i2c & spi conflict
Dependencies: BLE_API eMPL_MPU6050 nRF51822
Fork of Seeed_Tiny_BLE_Flash by
mbed-src/api/Stream.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_STREAM_H |
yihui | 5:b8c02645e6af | 17 | #define MBED_STREAM_H |
yihui | 5:b8c02645e6af | 18 | |
yihui | 5:b8c02645e6af | 19 | #include "platform.h" |
yihui | 5:b8c02645e6af | 20 | #include "FileLike.h" |
yihui | 5:b8c02645e6af | 21 | |
yihui | 5:b8c02645e6af | 22 | namespace mbed { |
yihui | 5:b8c02645e6af | 23 | |
yihui | 5:b8c02645e6af | 24 | extern void mbed_set_unbuffered_stream(FILE *_file); |
yihui | 5:b8c02645e6af | 25 | extern int mbed_getc(FILE *_file); |
yihui | 5:b8c02645e6af | 26 | extern char* mbed_gets(char *s, int size, FILE *_file); |
yihui | 5:b8c02645e6af | 27 | |
yihui | 5:b8c02645e6af | 28 | class Stream : public FileLike { |
yihui | 5:b8c02645e6af | 29 | |
yihui | 5:b8c02645e6af | 30 | public: |
yihui | 5:b8c02645e6af | 31 | Stream(const char *name=NULL); |
yihui | 5:b8c02645e6af | 32 | virtual ~Stream(); |
yihui | 5:b8c02645e6af | 33 | |
yihui | 5:b8c02645e6af | 34 | int putc(int c); |
yihui | 5:b8c02645e6af | 35 | int puts(const char *s); |
yihui | 5:b8c02645e6af | 36 | int getc(); |
yihui | 5:b8c02645e6af | 37 | char *gets(char *s, int size); |
yihui | 5:b8c02645e6af | 38 | int printf(const char* format, ...); |
yihui | 5:b8c02645e6af | 39 | int scanf(const char* format, ...); |
yihui | 5:b8c02645e6af | 40 | |
yihui | 5:b8c02645e6af | 41 | operator std::FILE*() {return _file;} |
yihui | 5:b8c02645e6af | 42 | |
yihui | 5:b8c02645e6af | 43 | protected: |
yihui | 5:b8c02645e6af | 44 | virtual int close(); |
yihui | 5:b8c02645e6af | 45 | virtual ssize_t write(const void* buffer, size_t length); |
yihui | 5:b8c02645e6af | 46 | virtual ssize_t read(void* buffer, size_t length); |
yihui | 5:b8c02645e6af | 47 | virtual off_t lseek(off_t offset, int whence); |
yihui | 5:b8c02645e6af | 48 | virtual int isatty(); |
yihui | 5:b8c02645e6af | 49 | virtual int fsync(); |
yihui | 5:b8c02645e6af | 50 | virtual off_t flen(); |
yihui | 5:b8c02645e6af | 51 | |
yihui | 5:b8c02645e6af | 52 | virtual int _putc(int c) = 0; |
yihui | 5:b8c02645e6af | 53 | virtual int _getc() = 0; |
yihui | 5:b8c02645e6af | 54 | |
yihui | 5:b8c02645e6af | 55 | std::FILE *_file; |
yihui | 5:b8c02645e6af | 56 | |
yihui | 5:b8c02645e6af | 57 | /* disallow copy constructor and assignment operators */ |
yihui | 5:b8c02645e6af | 58 | private: |
yihui | 5:b8c02645e6af | 59 | Stream(const Stream&); |
yihui | 5:b8c02645e6af | 60 | Stream & operator = (const Stream&); |
yihui | 5:b8c02645e6af | 61 | }; |
yihui | 5:b8c02645e6af | 62 | |
yihui | 5:b8c02645e6af | 63 | } // namespace mbed |
yihui | 5:b8c02645e6af | 64 | |
yihui | 5:b8c02645e6af | 65 | #endif |