Naze32 clone with Frysky receiver
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Stream.h 1.9KB

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