virtmem
virtual memory library for Arduino
virtmem::serram_utils::SerialInput< IOStream > Class Template Reference

Utility class that handles serial input over a port that is used by by SerialVAlloc. More...

#include <serial_utils.h>

Public Member Functions

 SerialInput (IOStream *s)
 
uint32_t available (void)
 Available bytes that can be read via serial. More...
 
uint32_t availableAtLeast (void)
 Returns the minimum number of bytes that can be read. More...
 
int16_t read (void)
 Read a byte from serial input. More...
 
uint32_t readBytes (char *buffer, uint32_t count)
 Read multiple bytes from serial input. More...
 
int16_t peek (void)
 Reads a byte from serial input without removing it from the serial buffer. More...
 

Detailed Description

template<typename IOStream>
class virtmem::serram_utils::SerialInput< IOStream >

Utility class that handles serial input over a port that is used by by SerialVAlloc.

Member Function Documentation

template<typename IOStream>
uint32_t virtmem::serram_utils::SerialInput< IOStream >::available ( void  )

Available bytes that can be read via serial.

Returns
Number of bytes that can be read
template<typename IOStream>
uint32_t virtmem::serram_utils::SerialInput< IOStream >::availableAtLeast ( void  )

Returns the minimum number of bytes that can be read.

Returns
The number of bytes that are minimally available to read.
Note
This function tries to use cached data and is therefore often more efficient compared to available().
template<typename IOStream>
int16_t virtmem::serram_utils::SerialInput< IOStream >::peek ( void  )

Reads a byte from serial input without removing it from the serial buffer.

Returns
Available byte to read, or -1 if none.
template<typename IOStream>
int16_t virtmem::serram_utils::SerialInput< IOStream >::read ( void  )

Read a byte from serial input.

Returns
Returns the byte that was read, or -1 if none were available.
template<typename IOStream>
uint32_t virtmem::serram_utils::SerialInput< IOStream >::readBytes ( char *  buffer,
uint32_t  count 
)

Read multiple bytes from serial input.

Parameters
bufferDestination character array to read data into.
countAmount of bytes to read
Returns
Amount of bytes to read

The documentation for this class was generated from the following file: