![](/media/cache/profiles/f095cedd23b99f1696fc8caecbcf257e.jpg.50x50_q85.jpg)
streo mp3 player see: http://mbed.org/users/okini3939/notebook/I2S_AUDIO
Dependencies: FatFileSystemCpp I2SSlave TLV320 mbed
Fork of madplayer by
mbed/Stream.h@0:7627c79db971, 2010-11-26 (annotated)
- Committer:
- Gruenfrosch
- Date:
- Fri Nov 26 12:18:30 2010 +0000
- Revision:
- 0:7627c79db971
First Version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gruenfrosch | 0:7627c79db971 | 1 | /* mbed Microcontroller Library - Stream |
Gruenfrosch | 0:7627c79db971 | 2 | * Copyright (c) 2007-2009 ARM Limited. All rights reserved. |
Gruenfrosch | 0:7627c79db971 | 3 | * sford |
Gruenfrosch | 0:7627c79db971 | 4 | */ |
Gruenfrosch | 0:7627c79db971 | 5 | |
Gruenfrosch | 0:7627c79db971 | 6 | #ifndef MBED_STREAM_H |
Gruenfrosch | 0:7627c79db971 | 7 | #define MBED_STREAM_H |
Gruenfrosch | 0:7627c79db971 | 8 | |
Gruenfrosch | 0:7627c79db971 | 9 | #include "FileLike.h" |
Gruenfrosch | 0:7627c79db971 | 10 | #include "platform.h" |
Gruenfrosch | 0:7627c79db971 | 11 | #include <cstdio> |
Gruenfrosch | 0:7627c79db971 | 12 | |
Gruenfrosch | 0:7627c79db971 | 13 | namespace mbed { |
Gruenfrosch | 0:7627c79db971 | 14 | |
Gruenfrosch | 0:7627c79db971 | 15 | class Stream : public FileLike { |
Gruenfrosch | 0:7627c79db971 | 16 | |
Gruenfrosch | 0:7627c79db971 | 17 | public: |
Gruenfrosch | 0:7627c79db971 | 18 | |
Gruenfrosch | 0:7627c79db971 | 19 | Stream(const char *name = NULL); |
Gruenfrosch | 0:7627c79db971 | 20 | virtual ~Stream(); |
Gruenfrosch | 0:7627c79db971 | 21 | |
Gruenfrosch | 0:7627c79db971 | 22 | int putc(int c) { |
Gruenfrosch | 0:7627c79db971 | 23 | fflush(_file); |
Gruenfrosch | 0:7627c79db971 | 24 | return std::fputc(c, _file); |
Gruenfrosch | 0:7627c79db971 | 25 | } |
Gruenfrosch | 0:7627c79db971 | 26 | int puts(const char *s) { |
Gruenfrosch | 0:7627c79db971 | 27 | fflush(_file); |
Gruenfrosch | 0:7627c79db971 | 28 | return std::fputs(s, _file); |
Gruenfrosch | 0:7627c79db971 | 29 | } |
Gruenfrosch | 0:7627c79db971 | 30 | int getc() { |
Gruenfrosch | 0:7627c79db971 | 31 | fflush(_file); |
Gruenfrosch | 0:7627c79db971 | 32 | return std::fgetc(_file); |
Gruenfrosch | 0:7627c79db971 | 33 | } |
Gruenfrosch | 0:7627c79db971 | 34 | char *gets(char *s, int size) { |
Gruenfrosch | 0:7627c79db971 | 35 | fflush(_file); |
Gruenfrosch | 0:7627c79db971 | 36 | return std::fgets(s,size,_file);; |
Gruenfrosch | 0:7627c79db971 | 37 | } |
Gruenfrosch | 0:7627c79db971 | 38 | int printf(const char* format, ...); |
Gruenfrosch | 0:7627c79db971 | 39 | int scanf(const char* format, ...); |
Gruenfrosch | 0:7627c79db971 | 40 | |
Gruenfrosch | 0:7627c79db971 | 41 | operator std::FILE*() { return _file; } |
Gruenfrosch | 0:7627c79db971 | 42 | |
Gruenfrosch | 0:7627c79db971 | 43 | #ifdef MBED_RPC |
Gruenfrosch | 0:7627c79db971 | 44 | virtual const struct rpc_method *get_rpc_methods(); |
Gruenfrosch | 0:7627c79db971 | 45 | #endif |
Gruenfrosch | 0:7627c79db971 | 46 | |
Gruenfrosch | 0:7627c79db971 | 47 | protected: |
Gruenfrosch | 0:7627c79db971 | 48 | |
Gruenfrosch | 0:7627c79db971 | 49 | virtual int close(); |
Gruenfrosch | 0:7627c79db971 | 50 | virtual ssize_t write(const void* buffer, size_t length); |
Gruenfrosch | 0:7627c79db971 | 51 | virtual ssize_t read(void* buffer, size_t length); |
Gruenfrosch | 0:7627c79db971 | 52 | virtual off_t lseek(off_t offset, int whence); |
Gruenfrosch | 0:7627c79db971 | 53 | virtual int isatty(); |
Gruenfrosch | 0:7627c79db971 | 54 | virtual int fsync(); |
Gruenfrosch | 0:7627c79db971 | 55 | virtual off_t flen(); |
Gruenfrosch | 0:7627c79db971 | 56 | |
Gruenfrosch | 0:7627c79db971 | 57 | virtual int _putc(int c) = 0; |
Gruenfrosch | 0:7627c79db971 | 58 | virtual int _getc() = 0; |
Gruenfrosch | 0:7627c79db971 | 59 | |
Gruenfrosch | 0:7627c79db971 | 60 | std::FILE *_file; |
Gruenfrosch | 0:7627c79db971 | 61 | |
Gruenfrosch | 0:7627c79db971 | 62 | }; |
Gruenfrosch | 0:7627c79db971 | 63 | |
Gruenfrosch | 0:7627c79db971 | 64 | } // namespace mbed |
Gruenfrosch | 0:7627c79db971 | 65 | |
Gruenfrosch | 0:7627c79db971 | 66 | #endif |
Gruenfrosch | 0:7627c79db971 | 67 |