AP_HAL: remove unused peek() interface from UART drivers
this is a bit tricky to implement on some platforms, and is unused anyway
This commit is contained in:
parent
e852d6300f
commit
76092eb590
@ -15,10 +15,9 @@ public:
|
||||
* FastSerial library. As far as concerns go, it belongs with available() */
|
||||
virtual int16_t txspace() = 0;
|
||||
|
||||
/* return value for read() and peek() :
|
||||
/* return value for read():
|
||||
* -1 if nothing available, uint8_t value otherwise. */
|
||||
virtual int16_t read() = 0;
|
||||
virtual int16_t peek() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -77,10 +77,6 @@ int16_t AVRConsoleDriver::read() {
|
||||
return _base_uart->read();
|
||||
}
|
||||
|
||||
int16_t AVRConsoleDriver::peek() {
|
||||
return _base_uart->peek();
|
||||
}
|
||||
|
||||
// Print method implementations /////////////////////////////////////////
|
||||
|
||||
size_t AVRConsoleDriver::write(uint8_t c) {
|
||||
|
@ -30,7 +30,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
/* Implementations of Print virtual methods */
|
||||
size_t write(uint8_t c);
|
||||
|
@ -150,16 +150,6 @@ int16_t AVRUARTDriver::read(void) {
|
||||
return (c);
|
||||
}
|
||||
|
||||
int16_t AVRUARTDriver::peek(void) {
|
||||
|
||||
// if the head and tail are equal, the buffer is empty
|
||||
if (!_open || (_rxBuffer->head == _rxBuffer->tail))
|
||||
return (-1);
|
||||
|
||||
// pull character from tail
|
||||
return (_rxBuffer->bytes[_rxBuffer->tail]);
|
||||
}
|
||||
|
||||
void AVRUARTDriver::flush(void) {
|
||||
// don't reverse this or there may be problems if the RX interrupt
|
||||
// occurs after reading the value of _rxBuffer->head but before writing
|
||||
|
@ -55,7 +55,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
/* Implementations of Print virtual methods */
|
||||
size_t write(uint8_t c);
|
||||
|
@ -95,11 +95,6 @@ int16_t SITLConsoleDriver::read()
|
||||
return _base_uart->read();
|
||||
}
|
||||
|
||||
int16_t SITLConsoleDriver::peek()
|
||||
{
|
||||
return _base_uart->peek();
|
||||
}
|
||||
|
||||
// Print method implementations /////////////////////////////////////////
|
||||
|
||||
size_t SITLConsoleDriver::write(uint8_t c)
|
||||
|
@ -32,7 +32,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
/* Implementations of Print virtual methods */
|
||||
size_t write(uint8_t c);
|
||||
|
@ -139,11 +139,6 @@ int16_t SITLUARTDriver::read(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int16_t SITLUARTDriver::peek(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void SITLUARTDriver::flush(void)
|
||||
{
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
/* Implementations of Print virtual methods */
|
||||
size_t write(uint8_t c);
|
||||
|
@ -66,10 +66,6 @@ int16_t EmptyConsoleDriver::read() {
|
||||
return _d->read();
|
||||
}
|
||||
|
||||
int16_t EmptyConsoleDriver::peek() {
|
||||
return _d->peek();
|
||||
}
|
||||
|
||||
size_t EmptyConsoleDriver::write(uint8_t c) {
|
||||
return _d->write(c);
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
size_t write(uint8_t c);
|
||||
private:
|
||||
|
@ -25,7 +25,6 @@ void EmptyUARTDriver::vprintf_P(const prog_char *pstr, va_list ap) {}
|
||||
int16_t EmptyUARTDriver::available() { return 0; }
|
||||
int16_t EmptyUARTDriver::txspace() { return 1; }
|
||||
int16_t EmptyUARTDriver::read() { return -1; }
|
||||
int16_t EmptyUARTDriver::peek() { return -1; }
|
||||
|
||||
/* Empty implementations of Print virtual methods */
|
||||
size_t EmptyUARTDriver::write(uint8_t c) { return 0; }
|
||||
|
@ -29,7 +29,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
/* Empty implementations of Print virtual methods */
|
||||
size_t write(uint8_t c);
|
||||
|
@ -71,10 +71,6 @@ int16_t PX4ConsoleDriver::read() {
|
||||
return _uart->read();
|
||||
}
|
||||
|
||||
int16_t PX4ConsoleDriver::peek() {
|
||||
return _uart->peek();
|
||||
}
|
||||
|
||||
size_t PX4ConsoleDriver::write(uint8_t c) {
|
||||
return _uart->write(c);
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
size_t write(uint8_t c);
|
||||
|
||||
|
@ -130,10 +130,6 @@ int16_t PX4UARTDriver::read() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int16_t PX4UARTDriver::peek() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* PX4 implementations of Print virtual methods */
|
||||
size_t PX4UARTDriver::write(uint8_t c) {
|
||||
if (!_initialised) {
|
||||
|
@ -29,7 +29,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
/* PX4 implementations of Print virtual methods */
|
||||
size_t write(uint8_t c);
|
||||
|
@ -125,15 +125,6 @@ int16_t SMACCMConsoleDriver::read()
|
||||
}
|
||||
}
|
||||
|
||||
int16_t SMACCMConsoleDriver::peek()
|
||||
{
|
||||
if (_user_backend) {
|
||||
return _rxbuf.peek();
|
||||
} else {
|
||||
return _d->peek();
|
||||
}
|
||||
}
|
||||
|
||||
size_t SMACCMConsoleDriver::write(uint8_t c)
|
||||
{
|
||||
if (_user_backend) {
|
||||
@ -192,15 +183,6 @@ int16_t SMACCMConsoleDriver::Buffer::pop()
|
||||
return (int16_t) b;
|
||||
}
|
||||
|
||||
int16_t SMACCMConsoleDriver::Buffer::peek()
|
||||
{
|
||||
if ( _tail == _head ) {
|
||||
return -1;
|
||||
}
|
||||
uint8_t b = _bytes[_tail];
|
||||
return (int16_t) b;
|
||||
}
|
||||
|
||||
uint16_t SMACCMConsoleDriver::Buffer::bytes_used()
|
||||
{
|
||||
return ((_head - _tail) & _mask);
|
||||
|
@ -32,7 +32,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
size_t write(uint8_t c);
|
||||
private:
|
||||
@ -44,7 +43,6 @@ private:
|
||||
bool allocate(uint16_t size);
|
||||
bool push(uint8_t b);
|
||||
int16_t pop();
|
||||
int16_t peek();
|
||||
|
||||
uint16_t bytes_free();
|
||||
uint16_t bytes_used();
|
||||
|
@ -146,19 +146,6 @@ int16_t SMACCMUARTDriver::read()
|
||||
return (int16_t)c;
|
||||
}
|
||||
|
||||
int16_t SMACCMUARTDriver::peek()
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
if (m_dev == NULL)
|
||||
return -1;
|
||||
|
||||
if (!usart_peek(m_dev, &c))
|
||||
return -1;
|
||||
|
||||
return (int16_t)c;
|
||||
}
|
||||
|
||||
/* SMACCM implementations of Print virtual methods */
|
||||
size_t SMACCMUARTDriver::write(uint8_t c)
|
||||
{
|
||||
|
@ -36,7 +36,6 @@ public:
|
||||
int16_t available();
|
||||
int16_t txspace();
|
||||
int16_t read();
|
||||
int16_t peek();
|
||||
|
||||
/* SMACCM implementations of Print virtual methods */
|
||||
size_t write(uint8_t c);
|
||||
|
Loading…
Reference in New Issue
Block a user