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_STREAM_H
lypinator 0:bb348c97df44 17 #define MBED_STREAM_H
lypinator 0:bb348c97df44 18
lypinator 0:bb348c97df44 19 #include "platform/platform.h"
lypinator 0:bb348c97df44 20 #include "platform/FileLike.h"
lypinator 0:bb348c97df44 21 #include "platform/FileHandle.h"
lypinator 0:bb348c97df44 22 #include "platform/NonCopyable.h"
lypinator 0:bb348c97df44 23 #include <cstdio>
lypinator 0:bb348c97df44 24 #include <cstdarg>
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_Stream Stream class
lypinator 0:bb348c97df44 31 * @{
lypinator 0:bb348c97df44 32 */
lypinator 0:bb348c97df44 33
lypinator 0:bb348c97df44 34 extern void mbed_set_unbuffered_stream(std::FILE *_file);
lypinator 0:bb348c97df44 35 extern int mbed_getc(std::FILE *_file);
lypinator 0:bb348c97df44 36 extern char *mbed_gets(char *s, int size, std::FILE *_file);
lypinator 0:bb348c97df44 37
lypinator 0:bb348c97df44 38 /** File stream
lypinator 0:bb348c97df44 39 *
lypinator 0:bb348c97df44 40 * @note Synchronization level: Set by subclass
lypinator 0:bb348c97df44 41 */
lypinator 0:bb348c97df44 42 class Stream : public FileLike, private NonCopyable<Stream> {
lypinator 0:bb348c97df44 43
lypinator 0:bb348c97df44 44 public:
lypinator 0:bb348c97df44 45 Stream(const char *name = NULL);
lypinator 0:bb348c97df44 46 virtual ~Stream();
lypinator 0:bb348c97df44 47
lypinator 0:bb348c97df44 48 int putc(int c);
lypinator 0:bb348c97df44 49 int puts(const char *s);
lypinator 0:bb348c97df44 50 int getc();
lypinator 0:bb348c97df44 51 char *gets(char *s, int size);
lypinator 0:bb348c97df44 52 int printf(const char *format, ...);
lypinator 0:bb348c97df44 53 int scanf(const char *format, ...);
lypinator 0:bb348c97df44 54 int vprintf(const char *format, std::va_list args);
lypinator 0:bb348c97df44 55 int vscanf(const char *format, std::va_list args);
lypinator 0:bb348c97df44 56
lypinator 0:bb348c97df44 57 operator std::FILE *()
lypinator 0:bb348c97df44 58 {
lypinator 0:bb348c97df44 59 return _file;
lypinator 0:bb348c97df44 60 }
lypinator 0:bb348c97df44 61
lypinator 0:bb348c97df44 62 protected:
lypinator 0:bb348c97df44 63 virtual int close();
lypinator 0:bb348c97df44 64 virtual ssize_t write(const void *buffer, size_t length);
lypinator 0:bb348c97df44 65 virtual ssize_t read(void *buffer, size_t length);
lypinator 0:bb348c97df44 66 virtual off_t seek(off_t offset, int whence);
lypinator 0:bb348c97df44 67 virtual off_t tell();
lypinator 0:bb348c97df44 68 virtual void rewind();
lypinator 0:bb348c97df44 69 virtual int isatty();
lypinator 0:bb348c97df44 70 virtual int sync();
lypinator 0:bb348c97df44 71 virtual off_t size();
lypinator 0:bb348c97df44 72
lypinator 0:bb348c97df44 73 virtual int _putc(int c) = 0;
lypinator 0:bb348c97df44 74 virtual int _getc() = 0;
lypinator 0:bb348c97df44 75
lypinator 0:bb348c97df44 76 std::FILE *_file;
lypinator 0:bb348c97df44 77
lypinator 0:bb348c97df44 78 /** Acquire exclusive access to this object.
lypinator 0:bb348c97df44 79 */
lypinator 0:bb348c97df44 80 virtual void lock()
lypinator 0:bb348c97df44 81 {
lypinator 0:bb348c97df44 82 // Stub
lypinator 0:bb348c97df44 83 }
lypinator 0:bb348c97df44 84
lypinator 0:bb348c97df44 85 /** Release exclusive access to this object.
lypinator 0:bb348c97df44 86 */
lypinator 0:bb348c97df44 87 virtual void unlock()
lypinator 0:bb348c97df44 88 {
lypinator 0:bb348c97df44 89 // Stub
lypinator 0:bb348c97df44 90 }
lypinator 0:bb348c97df44 91 };
lypinator 0:bb348c97df44 92 /**@}*/
lypinator 0:bb348c97df44 93
lypinator 0:bb348c97df44 94 /**@}*/
lypinator 0:bb348c97df44 95 } // namespace mbed
lypinator 0:bb348c97df44 96
lypinator 0:bb348c97df44 97 #endif
lypinator 0:bb348c97df44 98