AP_HAL: change txspace from a BetterStream method to a Stream method.

This commit is contained in:
Pat Hickey 2012-09-13 16:45:26 -07:00 committed by Andrew Tridgell
parent 9a653a1a75
commit 36154559fc
4 changed files with 7 additions and 5 deletions

View File

@ -60,10 +60,10 @@ public:
void println_P(const prog_char_t *pstr) {}
void printf(const char *pstr, ...) {}
void _printf_P(const prog_char *pstr, ...) {}
int txspace() { return 1; }
/* Empty implementations of Stream virtual methods */
int available() { return 0; }
int txspace() { return 1; }
int read() { return -1; }
int peek() { return -1; }

View File

@ -32,9 +32,6 @@ class AP_HAL::BetterStream : public AP_HAL::Stream {
public:
BetterStream(void) {}
// Stream extensions
virtual int txspace(void) = 0;
virtual void print_P(const prog_char_t *) = 0;
virtual void println_P(const prog_char_t *) = 0;
virtual void printf(const char *, ...)

View File

@ -11,10 +11,15 @@
class AP_HAL::Stream : public AP_HAL::Print {
public:
virtual int available() = 0;
/* NB txspace was traditionally a member of BetterStream in the
* FastSerial library. As far as concerns go, it belongs with available() */
virtual int txspace() = 0;
/* return value for read() and peek() :
* -1 if nothing available, uint8_t value otherwise. */
virtual int read() = 0;
virtual int peek() = 0;
};
#endif // __AP_HAL_UTILITY_STREAM_H__

View File

@ -40,7 +40,6 @@ public:
}
/* Implementations of BetterStream virtual methods */
int txspace();
void print_P(const prog_char_t *s);
void println_P(const prog_char_t *s);
void printf(const char *s, ...)
@ -50,6 +49,7 @@ public:
/* Implementations of Stream virtual methods */
int available();
int txspace();
int read();
int peek();