Browse Source

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

master
Pat Hickey 13 years ago committed by Andrew Tridgell
parent
commit
36154559fc
  1. 2
      libraries/AP_HAL/UARTDriver.h
  2. 3
      libraries/AP_HAL/utility/BetterStream.h
  3. 5
      libraries/AP_HAL/utility/Stream.h
  4. 2
      libraries/AP_HAL_AVR/UARTDriver.h

2
libraries/AP_HAL/UARTDriver.h

@ -60,10 +60,10 @@ public: @@ -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; }

3
libraries/AP_HAL/utility/BetterStream.h

@ -32,9 +32,6 @@ class AP_HAL::BetterStream : public AP_HAL::Stream { @@ -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 *, ...)

5
libraries/AP_HAL/utility/Stream.h

@ -11,10 +11,15 @@ @@ -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__

2
libraries/AP_HAL_AVR/UARTDriver.h

@ -40,7 +40,6 @@ public: @@ -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: @@ -50,6 +49,7 @@ public:
/* Implementations of Stream virtual methods */
int available();
int txspace();
int read();
int peek();

Loading…
Cancel
Save