2016-02-17 21:25:25 -04:00
|
|
|
#pragma once
|
2012-08-20 18:37:21 -03:00
|
|
|
|
2015-08-15 19:50:33 -03:00
|
|
|
#include <AP_HAL/AP_HAL_Namespace.h>
|
2012-08-20 18:37:21 -03:00
|
|
|
#include "Print.h"
|
|
|
|
|
|
|
|
/* A simple Stream library modeled after the bits we actually use
|
|
|
|
* from Arduino Stream */
|
|
|
|
|
|
|
|
class AP_HAL::Stream : public AP_HAL::Print {
|
|
|
|
public:
|
2016-08-02 10:42:50 -03:00
|
|
|
virtual uint32_t available() = 0;
|
2012-09-13 20:45:26 -03:00
|
|
|
/* NB txspace was traditionally a member of BetterStream in the
|
|
|
|
* FastSerial library. As far as concerns go, it belongs with available() */
|
2016-08-02 10:42:50 -03:00
|
|
|
virtual uint32_t txspace() = 0;
|
2012-09-13 20:45:26 -03:00
|
|
|
|
2013-01-15 23:43:18 -04:00
|
|
|
/* return value for read():
|
2012-08-20 18:37:21 -03:00
|
|
|
* -1 if nothing available, uint8_t value otherwise. */
|
2012-12-06 14:55:13 -04:00
|
|
|
virtual int16_t read() = 0;
|
2012-09-13 20:45:26 -03:00
|
|
|
|
2012-08-20 18:37:21 -03:00
|
|
|
};
|