1 #ifndef BufferedOutput_h
2 #define BufferedOutput_h
37 #include <Printable.h>
43 #define createBufferedOutput(name, size, ...) uint8_t name ## _OUTPUT_BUFFER[(size)+4]; BufferedOutput name(sizeof(name ## _OUTPUT_BUFFER),name ## _OUTPUT_BUFFER, __VA_ARGS__ );
112 void connect(Stream& _stream,
const uint32_t baudRate=0);
116 virtual size_t write(
const uint8_t *buf,
size_t size);
129 int internalAvailableForWrite();
130 int internalStreamAvailableForWrite();
131 void writeDropMark();
132 size_t bytesToBeSent();
135 bool allOrNothingSetting;
136 uint8_t defaultBuffer[8];
137 unsigned long us_perByte;
139 HardwareSerial* serialPtr;
141 unsigned long sendTimerStart;
145 bool dropMarkWritten;
146 uint8_t lastCharWritten;
153 void rb_init(uint8_t* _buf,
size_t _size);
155 bool rb_clearSpace(
size_t len);
157 inline int rb_available() {
158 return rb_buffer_count;
162 size_t rb_write(uint8_t b);
163 size_t rb_write(
const uint8_t *buffer,
size_t size);
164 int rb_availableForWrite();
166 bool rb_lastBufferedByteProtect();
167 void rb_dump(Stream* streamPtr);
171 uint16_t rb_buffer_head;
172 uint16_t rb_buffer_tail;
173 uint16_t rb_buffer_count;
174 uint16_t rb_wrapBufferIdx(uint16_t idx);
175 void rb_internalWrite(uint8_t b);
To create a BufferedOutput use the macro createBufferedOutput see the detailed description.
size_t terminateLastLine()
BufferedOutput(size_t _bufferSize, uint8_t *_buf, BufferedOutputMode=BLOCK_IF_FULL, bool allOrNothing=true)
use createBufferedOutput(name, size, mode); instead BufferedOutput(size_t _bufferSize,...
virtual int availableForWrite()
void connect(Stream &_stream, const uint32_t baudRate=0)
void connect(Stream& _stream, const uint32_t baudRate); // the stream to write to and how fast to wri...
int clearSpace(size_t len)
virtual size_t write(const uint8_t *buf, size_t size)
void connect(HardwareSerial &_serial)
void connect(HardwareSerial& _serial); // the output to write to, can also read from serial – the Har...
virtual size_t write(uint8_t)