Programme d'utilisation des AX12 avec rajout de l'MX12
Fork of test_carteAToutFaire_PR by
mbed/Stream.h@1:f3f702086a30, 2017-05-11 (annotated)
- Committer:
- ClementBreteau
- Date:
- Thu May 11 11:49:50 2017 +0000
- Revision:
- 1:f3f702086a30
test de la carte ? tout faire du petit robot
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ClementBreteau | 1:f3f702086a30 | 1 | /* mbed Microcontroller Library - Stream |
ClementBreteau | 1:f3f702086a30 | 2 | * Copyright (c) 2007-2009 ARM Limited. All rights reserved. |
ClementBreteau | 1:f3f702086a30 | 3 | */ |
ClementBreteau | 1:f3f702086a30 | 4 | |
ClementBreteau | 1:f3f702086a30 | 5 | #ifndef MBED_STREAM_H |
ClementBreteau | 1:f3f702086a30 | 6 | #define MBED_STREAM_H |
ClementBreteau | 1:f3f702086a30 | 7 | |
ClementBreteau | 1:f3f702086a30 | 8 | #include "FileLike.h" |
ClementBreteau | 1:f3f702086a30 | 9 | #include "platform.h" |
ClementBreteau | 1:f3f702086a30 | 10 | #include <cstdio> |
ClementBreteau | 1:f3f702086a30 | 11 | |
ClementBreteau | 1:f3f702086a30 | 12 | namespace mbed { |
ClementBreteau | 1:f3f702086a30 | 13 | |
ClementBreteau | 1:f3f702086a30 | 14 | class Stream : public FileLike { |
ClementBreteau | 1:f3f702086a30 | 15 | |
ClementBreteau | 1:f3f702086a30 | 16 | public: |
ClementBreteau | 1:f3f702086a30 | 17 | |
ClementBreteau | 1:f3f702086a30 | 18 | Stream(const char *name = NULL); |
ClementBreteau | 1:f3f702086a30 | 19 | virtual ~Stream(); |
ClementBreteau | 1:f3f702086a30 | 20 | |
ClementBreteau | 1:f3f702086a30 | 21 | int putc(int c) { |
ClementBreteau | 1:f3f702086a30 | 22 | fflush(_file); |
ClementBreteau | 1:f3f702086a30 | 23 | return std::fputc(c, _file); |
ClementBreteau | 1:f3f702086a30 | 24 | } |
ClementBreteau | 1:f3f702086a30 | 25 | int puts(const char *s) { |
ClementBreteau | 1:f3f702086a30 | 26 | fflush(_file); |
ClementBreteau | 1:f3f702086a30 | 27 | return std::fputs(s, _file); |
ClementBreteau | 1:f3f702086a30 | 28 | } |
ClementBreteau | 1:f3f702086a30 | 29 | int getc() { |
ClementBreteau | 1:f3f702086a30 | 30 | fflush(_file); |
ClementBreteau | 1:f3f702086a30 | 31 | return std::fgetc(_file); |
ClementBreteau | 1:f3f702086a30 | 32 | } |
ClementBreteau | 1:f3f702086a30 | 33 | char *gets(char *s, int size) { |
ClementBreteau | 1:f3f702086a30 | 34 | fflush(_file); |
ClementBreteau | 1:f3f702086a30 | 35 | return std::fgets(s,size,_file);; |
ClementBreteau | 1:f3f702086a30 | 36 | } |
ClementBreteau | 1:f3f702086a30 | 37 | int printf(const char* format, ...); |
ClementBreteau | 1:f3f702086a30 | 38 | int scanf(const char* format, ...); |
ClementBreteau | 1:f3f702086a30 | 39 | |
ClementBreteau | 1:f3f702086a30 | 40 | operator std::FILE*() { return _file; } |
ClementBreteau | 1:f3f702086a30 | 41 | |
ClementBreteau | 1:f3f702086a30 | 42 | #ifdef MBED_RPC |
ClementBreteau | 1:f3f702086a30 | 43 | virtual const struct rpc_method *get_rpc_methods(); |
ClementBreteau | 1:f3f702086a30 | 44 | #endif |
ClementBreteau | 1:f3f702086a30 | 45 | |
ClementBreteau | 1:f3f702086a30 | 46 | protected: |
ClementBreteau | 1:f3f702086a30 | 47 | |
ClementBreteau | 1:f3f702086a30 | 48 | virtual int close(); |
ClementBreteau | 1:f3f702086a30 | 49 | virtual ssize_t write(const void* buffer, size_t length); |
ClementBreteau | 1:f3f702086a30 | 50 | virtual ssize_t read(void* buffer, size_t length); |
ClementBreteau | 1:f3f702086a30 | 51 | virtual off_t lseek(off_t offset, int whence); |
ClementBreteau | 1:f3f702086a30 | 52 | virtual int isatty(); |
ClementBreteau | 1:f3f702086a30 | 53 | virtual int fsync(); |
ClementBreteau | 1:f3f702086a30 | 54 | virtual off_t flen(); |
ClementBreteau | 1:f3f702086a30 | 55 | |
ClementBreteau | 1:f3f702086a30 | 56 | virtual int _putc(int c) = 0; |
ClementBreteau | 1:f3f702086a30 | 57 | virtual int _getc() = 0; |
ClementBreteau | 1:f3f702086a30 | 58 | |
ClementBreteau | 1:f3f702086a30 | 59 | std::FILE *_file; |
ClementBreteau | 1:f3f702086a30 | 60 | |
ClementBreteau | 1:f3f702086a30 | 61 | }; |
ClementBreteau | 1:f3f702086a30 | 62 | |
ClementBreteau | 1:f3f702086a30 | 63 | } // namespace mbed |
ClementBreteau | 1:f3f702086a30 | 64 | |
ClementBreteau | 1:f3f702086a30 | 65 | #endif |
ClementBreteau | 1:f3f702086a30 | 66 |