63 unsigned char *data = (
unsigned char *)buf;
73 size_t bytes_read =
rxBuf->
get(data, count < 64 ? count : 64);
79 if ((file->
flags & O_NONBLOCK) || result > 0)
88 rxBuf->block_until_condition(file,
true);
97 if (!result && (file->
flags & O_NONBLOCK))
114 const unsigned char *data = (
const unsigned char *)buf;
119 portENTER_CRITICAL();
124 size_t bytes_written =
txBuf->
put(data, count < 64 ? count : 64);
126 if (bytes_written == 0)
130 if ((file->
flags & O_NONBLOCK) || result > 0)
139 txBuf->block_until_condition(file,
false);
146 count -= bytes_written;
147 result += bytes_written;
148 data += bytes_written;
152 if (!result && (file->
flags & O_NONBLOCK))
183 portENTER_CRITICAL();
195 portENTER_CRITICAL();
void flush()
flush all the data out of the buffer and reset the buffer.
size_t space()
Return the number of items for which space is available.
size_t pending()
Return the number of items in the queue.
void select_insert()
Add client to list of clients needing woken.
size_t get(T *buf, size_t items)
remove a number of items from the buffer.
size_t put(const T *buf, size_t items)
Insert a number of items to the buffer.
DeviceBuffer< uint8_t > * rxBuf
receive buffer
DeviceBuffer< uint8_t > * txBuf
transmit buffer
bool select(File *file, int mode) OVERRIDE
Device select method.
void flush_buffers() OVERRIDE
Discards all pending buffers.
virtual void tx_char()=0
Function to try and transmit a character.
ssize_t write(File *file, const void *buf, size_t count) OVERRIDE
Write to a file or device.
ssize_t read(File *file, void *buf, size_t count) OVERRIDE
Read from a file or device.
int ioctl(File *file, unsigned long int key, unsigned long data) OVERRIDE
Request an ioctl transaction.
#define FWRITE
Workaround for missing header defines on some newlib versions.
#define FREAD
Workaround for missing header defines on some newlib versions.