mbed library

Dependents:   Printf

Fork of mbed by mbed official

Committer:
emilmont
Date:
Mon Feb 18 11:12:58 2013 +0000
Revision:
59:0883845fe643
Parent:
55:d722ed6a4237
Child:
65:5798e58a58b1
Add pinmap NC terminators for LPC1768 CAN.
Update the license from MIT to Apache v2.
Make the semihost code target independent using opportune defines for the UID and MAC.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 44:24d45a770a51 1 /* mbed Microcontroller Library
emilmont 54:71b101360fb9 2 * Copyright (c) 2006-2013 ARM Limited
emilmont 44:24d45a770a51 3 *
emilmont 59:0883845fe643 4 * Licensed under the Apache License, Version 2.0 (the "License");
emilmont 59:0883845fe643 5 * you may not use this file except in compliance with the License.
emilmont 59:0883845fe643 6 * You may obtain a copy of the License at
emilmont 59:0883845fe643 7 *
emilmont 59:0883845fe643 8 * http://www.apache.org/licenses/LICENSE-2.0
emilmont 44:24d45a770a51 9 *
emilmont 59:0883845fe643 10 * Unless required by applicable law or agreed to in writing, software
emilmont 59:0883845fe643 11 * distributed under the License is distributed on an "AS IS" BASIS,
emilmont 59:0883845fe643 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
emilmont 59:0883845fe643 13 * See the License for the specific language governing permissions and
emilmont 59:0883845fe643 14 * limitations under the License.
emilmont 44:24d45a770a51 15 */
simon.ford@mbed.co.uk 0:82220227f4fa 16 #ifndef MBED_STREAM_H
simon.ford@mbed.co.uk 0:82220227f4fa 17 #define MBED_STREAM_H
simon.ford@mbed.co.uk 0:82220227f4fa 18
rolf.meyer@arm.com 11:1c1ebd0324fa 19 #include "platform.h"
emilmont 54:71b101360fb9 20 #include "FileLike.h"
simon.ford@mbed.co.uk 0:82220227f4fa 21
simon.ford@mbed.co.uk 0:82220227f4fa 22 namespace mbed {
simon.ford@mbed.co.uk 0:82220227f4fa 23
emilmont 54:71b101360fb9 24 class Stream : public FileLike {
simon.ford@mbed.co.uk 0:82220227f4fa 25
simon.ford@mbed.co.uk 0:82220227f4fa 26 public:
emilmont 54:71b101360fb9 27 Stream(const char *name=NULL);
simon.ford@mbed.co.uk 4:5d1359a283bc 28 virtual ~Stream();
simon.ford@mbed.co.uk 0:82220227f4fa 29
emilmont 44:24d45a770a51 30 int putc(int c);
emilmont 44:24d45a770a51 31 int puts(const char *s);
emilmont 44:24d45a770a51 32 int getc();
emilmont 44:24d45a770a51 33 char *gets(char *s, int size);
simon.ford@mbed.co.uk 0:82220227f4fa 34 int printf(const char* format, ...);
simon.ford@mbed.co.uk 0:82220227f4fa 35 int scanf(const char* format, ...);
emilmont 55:d722ed6a4237 36
emilmont 44:24d45a770a51 37 operator std::FILE*() {return _file;}
simon.ford@mbed.co.uk 8:00a04e5cd407 38
simon.ford@mbed.co.uk 0:82220227f4fa 39 protected:
simon.ford@mbed.co.uk 4:5d1359a283bc 40 virtual int close();
simon.ford@mbed.co.uk 4:5d1359a283bc 41 virtual ssize_t write(const void* buffer, size_t length);
simon.ford@mbed.co.uk 4:5d1359a283bc 42 virtual ssize_t read(void* buffer, size_t length);
simon.ford@mbed.co.uk 4:5d1359a283bc 43 virtual off_t lseek(off_t offset, int whence);
simon.ford@mbed.co.uk 4:5d1359a283bc 44 virtual int isatty();
simon.ford@mbed.co.uk 4:5d1359a283bc 45 virtual int fsync();
simon.ford@mbed.co.uk 8:00a04e5cd407 46 virtual off_t flen();
simon.ford@mbed.co.uk 0:82220227f4fa 47
simon.ford@mbed.co.uk 4:5d1359a283bc 48 virtual int _putc(int c) = 0;
simon.ford@mbed.co.uk 4:5d1359a283bc 49 virtual int _getc() = 0;
emilmont 55:d722ed6a4237 50
simon.ford@mbed.co.uk 4:5d1359a283bc 51 std::FILE *_file;
simon.ford@mbed.co.uk 0:82220227f4fa 52 };
simon.ford@mbed.co.uk 0:82220227f4fa 53
simon.ford@mbed.co.uk 0:82220227f4fa 54 } // namespace mbed
simon.ford@mbed.co.uk 0:82220227f4fa 55
simon.ford@mbed.co.uk 1:6b7f447ca868 56 #endif