Hardware serial class. More...

#include <HardwareSerial.h>

Inheritance diagram for HardwareSerial:
[legend]
Collaboration diagram for HardwareSerial:
[legend]

Public Member Functions

 HardwareSerial (int uartPort)
 Create instance of a hardware serial port object. More...
 
 ~HardwareSerial ()
 
void setPort (int uartPort)
 
int getPort ()
 
void begin (uint32_t baud=9600)
 Initialise the serial port. More...
 
void begin (uint32_t baud, SerialConfig config)
 Initialise and set its configuration. More...
 
void begin (uint32_t baud, SerialConfig config, SerialMode mode)
 Initialise, set its configuration and mode. More...
 
void begin (uint32_t baud, SerialConfig config, SerialMode mode, uint8_t txPin)
 Initialise, set its configuration and mode. More...
 
void end ()
 De-inits the current UART if it is already used. More...
 
size_t setRxBufferSize (size_t size)
 Sets receiving buffer size. More...
 
size_t setTxBufferSize (size_t size)
 Sets transmit buffer size. More...
 
void setTxWait (bool wait)
 Governs write behaviour when UART transmit buffers are full. More...
 
void swap ()
 Toggle between use of GPIO13/GPIO15 or GPIO3/GPIO(1/2) as RX and TX. More...
 
void swap (uint8_t tx_pin)
 Toggle between use of GPIO13/GPIO15 or GPIO3/GPIO(1/2) as RX and TX. More...
 
void setTx (uint8_t tx_pin)
 Toggle between use of GPIO1 and GPIO2 as TX on UART 0. More...
 
void pins (uint8_t tx, uint8_t rx)
 Sets the transmission and receiving PINS. More...
 
int available () override
 Get quantity characters available from serial input. More...
 
int read () override
 Read a character from serial port. More...
 
uint16_t readMemoryBlock (char *buf, int max_len) override
 Read a block of characters from serial port. More...
 
bool seek (int len) override
 Move read cursor. More...
 
bool isFinished () override
 Check if all data has been read. More...
 
int peek () override
 Read a character from serial port without removing from input buffer. More...
 
void clear (SerialMode mode=SERIAL_FULL)
 Clear the serial port transmit/receive buffers. More...
 
void flush () override
 Flush all pending data to the serial port. More...
 
size_t write (const uint8_t *buffer, size_t size) override
 write multiple characters to serial port More...
 
void systemDebugOutput (bool enabled)
 Configure serial port for system debug output and redirect output from debugf. More...
 
void commandProcessing (bool reqEnable)
 Configure serial port for command processing. More...
 
bool setCallback (StreamDataReceivedDelegate dataReceivedDelegate)
 Set handler for received data. More...
 
bool onDataReceived (StreamDataReceivedDelegate dataReceivedDelegate)
 Set handler for received data. More...
 
bool onTransmitComplete (TransmitCompleteDelegate transmitCompleteDelegate)
 Set handler for received data. More...
 
void setUartCallback (smg_uart_callback_t callback, void *param=nullptr)
 Set callback ISR for received data. More...
 
bool isTxEnabled ()
 Checks if the current UART can transmit(print) information. More...
 
bool isRxEnabled ()
 Checks if the current UART can receive information. More...
 
uint32_t baudRate ()
 Get the current baud rate. More...
 
uint32_t setBaudRate (uint32_t baudrate)
 Attempt to set the requested baud rate. More...
 
 operator bool () const
 Operator that returns true if the uart structure is set. More...
 
int indexOf (char c) override
 Returns the location of the searched character. More...
 
smg_uart_tgetUart ()
 Returns a pointer to the internal uart object. Use with care. More...
 
unsigned getStatus ()
 Get status error flags and clear them. More...
 
size_t write (uint8_t charToWrite) override
 Write a single character to the stream. More...
 
size_t write (const char *str)
 Writes a c-string to output stream. More...
 
size_t write (const char *buffer, size_t size)
 Writes characters from a buffer to output stream. More...
 
virtual size_t copyFrom (IDataSourceStream *source, size_t size)
 Copy data from a source stream. More...
 
virtual StreamType getStreamType () const
 Get the stream type. More...
 
virtual bool isValid () const
 Determine if the stream object contains valid data. More...
 
virtual int seekFrom (int offset, unsigned origin)
 Change position in stream. More...
 
int length ()
 Return the total length of the stream. More...
 
virtual String id () const
 Returns unique id of the resource. More...
 
virtual String getName () const
 Returns name of the resource. More...
 
String readString (size_t maxLen=UINT16_MAX)
 Overrides Stream method for more efficient reading. More...
 
String readString ()
 
void setTimeout (unsigned long timeout)
 
bool find (char *target)
 
bool find (char *target, size_t length)
 
bool findUntil (char *target, char *terminator)
 
bool findUntil (char *target, size_t targetLen, char *terminate, size_t termLen)
 
long parseInt ()
 
float parseFloat ()
 
size_t readBytes (char *buffer, size_t length)
 
size_t readBytesUntil (char terminator, char *buffer, size_t length)
 
String readStringUntil (char terminator)
 
int getWriteError ()
 Gets last error. More...
 
void clearWriteError ()
 Clears the last write error. More...
 
size_t print (char c)
 Prints a single character to output stream. More...
 
size_t print (const char str[])
 Prints a c-string to output stream. More...
 
size_t print (double num, int digits=2)
 Print a floating-point number to output stream. More...
 
size_t print (const Printable &p)
 Prints a Printable object to output stream. More...
 
size_t print (const String &s)
 Prints a String to output stream. More...
 
size_t println ()
 Prints a newline to output stream. More...
 
size_t println (const char str[])
 Prints a c-string to output stream, appending newline. More...
 
size_t println (char c)
 Prints a single character to output stream, appending newline. More...
 
size_t println (double num, int digits=2)
 Print a floating-point number to output stream, appending newline. More...
 
size_t println (const Printable &p)
 Prints a Printable object to output stream, appending newline. More...
 
size_t println (const String &s)
 Prints a String to output stream, appending newline. More...
 
size_t printf (const char *fmt,...) __attribute__((format(printf
 Prints a formatted c-string to output stream. More...
 
Print an integral number to output stream
Parameters
numNumber to print
baseThe base for output (Default: Decimal (base 10))
Return values
size_tQuantity of characters written to stream
size_t print (unsigned long num, int base=DEC)
 
size_t print (const unsigned long long &num, int base=DEC)
 
size_t print (long, int base=DEC)
 
size_t print (const long long &, int base=DEC)
 
size_t print (unsigned int num, int base=DEC)
 
size_t print (unsigned char num, int base=DEC)
 
size_t print (int num, int base=DEC)
 
Print an integral number to output stream, appending newline
Parameters
numNumber to print
baseThe base for output (Default: Decimal (base 10))
Return values
size_tQuantity of characters written to stream
size_t println (unsigned char num, int base=DEC)
 
size_t println (unsigned int num, int base=DEC)
 
size_t println (unsigned long num, int base=DEC)
 
size_t println (const unsigned long long &num, int base=DEC)
 
size_t println (int num, int base=DEC)
 
size_t println (long num, int base=DEC)
 
size_t println (const long long &num, int base=DEC)
 

Protected Member Functions

int timedRead ()
 
int timedPeek ()
 
int peekNextDigit ()
 
long parseInt (char skipChar)
 
float parseFloat (char skipChar)
 
void setWriteError (int err=1)
 

Protected Attributes

unsigned long receiveTimeout = 1000
 
unsigned long startMillis = 0
 

Detailed Description

Hardware serial class.

Constructor & Destructor Documentation

◆ HardwareSerial()

HardwareSerial::HardwareSerial ( int  uartPort)
inline

Create instance of a hardware serial port object.

Parameters
uartPortUART number [0 | 1]
Note
A global instance of UART 0 is already defined as Serial

◆ ~HardwareSerial()

HardwareSerial::~HardwareSerial ( )

Member Function Documentation

◆ available()

int HardwareSerial::available ( )
inlineoverridevirtual

Get quantity characters available from serial input.

Return values
intQuantity of characters in receive buffer

Reimplemented from IDataSourceStream.

◆ baudRate()

uint32_t HardwareSerial::baudRate ( )
inline

Get the current baud rate.

Return values
uint32_tbaud rate

◆ begin() [1/4]

void HardwareSerial::begin ( uint32_t  baud = 9600)
inline

Initialise the serial port.

Parameters
baudBAUD rate of the serial port (Default: 9600)

◆ begin() [2/4]

void HardwareSerial::begin ( uint32_t  baud,
SerialConfig  config 
)
inline

Initialise and set its configuration.

Parameters
baudBaud rate to use
configcan be 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call Serial.begin(baudrate, SERIAL_8N1), Serial.begin(baudrate, SERIAL_6E2), etc.

◆ begin() [3/4]

void HardwareSerial::begin ( uint32_t  baud,
SerialConfig  config,
SerialMode  mode 
)
inline

Initialise, set its configuration and mode.

Parameters
baudBaud rate to use
configcan be 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call Serial.begin(baudrate, SERIAL_8N1), Serial.begin(baudrate, SERIAL_6E2), etc.
modespecifies if the UART supports receiving (RX), transmitting (TX) or both (FULL) operations

◆ begin() [4/4]

void HardwareSerial::begin ( uint32_t  baud,
SerialConfig  config,
SerialMode  mode,
uint8_t  txPin 
)

Initialise, set its configuration and mode.

Parameters
baudBaud rate to use
config
mode
txPinCan specify alternate pin for TX

◆ clear()

void HardwareSerial::clear ( SerialMode  mode = SERIAL_FULL)
inline

Clear the serial port transmit/receive buffers.

Parameters
modeWhether to flush TX, RX or both (the default)
Note
All un-read buffered data is removed and any error condition cleared

◆ clearWriteError()

void Print::clearWriteError ( )
inlineinherited

Clears the last write error.

◆ commandProcessing()

void HardwareSerial::commandProcessing ( bool  reqEnable)

Configure serial port for command processing.

Parameters
reqEnableTrue to enable command processing
Note
Command processing provides a CLI to the system
See also
commandHandler

◆ copyFrom()

virtual size_t ReadWriteStream::copyFrom ( IDataSourceStream source,
size_t  size 
)
virtualinherited

Copy data from a source stream.

Parameters
sourceStream to read data from
sizeQuantity of chars to write, determines size of intermediate buffer to use
Return values
size_tQuantity of chars actually written, may be less than requested

◆ end()

void HardwareSerial::end ( )

De-inits the current UART if it is already used.

◆ find() [1/2]

bool Stream::find ( char *  target)
inherited

◆ find() [2/2]

bool Stream::find ( char *  target,
size_t  length 
)
inherited

◆ findUntil() [1/2]

bool Stream::findUntil ( char *  target,
char *  terminator 
)
inherited

◆ findUntil() [2/2]

bool Stream::findUntil ( char *  target,
size_t  targetLen,
char *  terminate,
size_t  termLen 
)
inherited

◆ flush()

void HardwareSerial::flush ( )
inlineoverridevirtual

Flush all pending data to the serial port.

Note
Not to be confused with uart_flush() which is different. See clear() method.

Reimplemented from IDataSourceStream.

◆ getName()

virtual String IDataSourceStream::getName ( ) const
inlinevirtualinherited

Returns name of the resource.

Return values
String
Note
Commonly used to obtain name of file

Reimplemented in TemplateStream, FileStream, StreamTransformer, GdbFileStream, and HostFileStream.

◆ getPort()

int HardwareSerial::getPort ( )
inline

◆ getStatus()

unsigned HardwareSerial::getStatus ( )

Get status error flags and clear them.

Return values
unsignedStatus flags, combination of SerialStatus bits
See also
SerialStatus

◆ getStreamType()

virtual StreamType IDataSourceStream::getStreamType ( ) const
inlinevirtualinherited

◆ getUart()

smg_uart_t* HardwareSerial::getUart ( )
inline

Returns a pointer to the internal uart object. Use with care.

Return values
pointerto uart_t

◆ getWriteError()

int Print::getWriteError ( )
inlineinherited

Gets last error.

Return values
intError number of last write error

◆ id()

virtual String IDataSourceStream::id ( ) const
inlinevirtualinherited

Returns unique id of the resource.

Return values
Stringthe unique id of the stream.

Reimplemented in FileStream, GdbFileStream, and CircularBuffer.

◆ indexOf()

int HardwareSerial::indexOf ( char  c)
inlineoverridevirtual

Returns the location of the searched character.

Parameters
c- character to search for
Return values
int-1 if not found 0 or positive number otherwise

Reimplemented from Stream.

◆ isFinished()

bool HardwareSerial::isFinished ( )
inlineoverridevirtual

Check if all data has been read.

Return values
boolTrue on success.

Implements IDataSourceStream.

◆ isRxEnabled()

bool HardwareSerial::isRxEnabled ( )
inline

Checks if the current UART can receive information.

Return values
booltrue if receiving is allowed

◆ isTxEnabled()

bool HardwareSerial::isTxEnabled ( )
inline

Checks if the current UART can transmit(print) information.

Return values
booltrue if transmitting is allowed

◆ isValid()

virtual bool IDataSourceStream::isValid ( ) const
inlinevirtualinherited

Determine if the stream object contains valid data.

Return values
booltrue if valid, false if invalid
Note
Where inherited classes are initialised by constructor this method indicates whether that was successful or not (e.g. FileStream)

Reimplemented in FileStream, GdbFileStream, and HostFileStream.

◆ length()

int IDataSourceStream::length ( )
inlineinherited

Return the total length of the stream.

Return values
int-1 is returned when the size cannot be determined
Deprecated:
Use available() instead

◆ onDataReceived()

bool HardwareSerial::onDataReceived ( StreamDataReceivedDelegate  dataReceivedDelegate)
inline

Set handler for received data.

Parameters
dataReceivedDelegateFunction to handle received data
Return values
boolReturns true if the callback was set correctly

◆ onTransmitComplete()

bool HardwareSerial::onTransmitComplete ( TransmitCompleteDelegate  transmitCompleteDelegate)
inline

Set handler for received data.

Parameters
transmitCompleteDelegateFunction to handle received data
Return values
boolReturns true if the callback was set correctly

◆ operator bool()

HardwareSerial::operator bool ( ) const
inline

Operator that returns true if the uart structure is set.

◆ parseFloat() [1/2]

float Stream::parseFloat ( )
inherited

◆ parseFloat() [2/2]

float Stream::parseFloat ( char  skipChar)
protectedinherited

◆ parseInt() [1/2]

long Stream::parseInt ( )
inherited

◆ parseInt() [2/2]

long Stream::parseInt ( char  skipChar)
protectedinherited

◆ peek()

int HardwareSerial::peek ( )
inlineoverridevirtual

Read a character from serial port without removing from input buffer.

Return values
intCharacter read from serial port or -1 if buffer empty
Note
The character remains in serial port input buffer

Reimplemented from IDataSourceStream.

◆ peekNextDigit()

int Stream::peekNextDigit ( )
protectedinherited

◆ pins()

void HardwareSerial::pins ( uint8_t  tx,
uint8_t  rx 
)
inline

Sets the transmission and receiving PINS.

Parameters
txTransmission pin number
rxReceiving pin number
Note
UART 0 possible options are (1, 3), (2, 3) or (15, 13)
UART 1 allows only TX on 2 if UART 0 is not (2, 3)

◆ print() [1/12]

size_t Print::print ( char  c)
inlineinherited

Prints a single character to output stream.

Parameters
cCharacter to print
Return values
size_tQuantity of characters written to stream

◆ print() [2/12]

size_t Print::print ( const char  str[])
inlineinherited

Prints a c-string to output stream.

Parameters
strc-string to print
Return values
size_tQuantity of characters written to output stream

◆ print() [3/12]

size_t Print::print ( unsigned long  num,
int  base = DEC 
)
inlineinherited

◆ print() [4/12]

size_t Print::print ( const unsigned long long &  num,
int  base = DEC 
)
inlineinherited

◆ print() [5/12]

size_t Print::print ( long  ,
int  base = DEC 
)
inherited

◆ print() [6/12]

size_t Print::print ( const long long &  ,
int  base = DEC 
)
inherited

◆ print() [7/12]

size_t Print::print ( unsigned int  num,
int  base = DEC 
)
inlineinherited

◆ print() [8/12]

size_t Print::print ( unsigned char  num,
int  base = DEC 
)
inlineinherited

◆ print() [9/12]

size_t Print::print ( int  num,
int  base = DEC 
)
inlineinherited

◆ print() [10/12]

size_t Print::print ( double  num,
int  digits = 2 
)
inlineinherited

Print a floating-point number to output stream.

Parameters
numNumber to print
digitsThe decimal places to print (Default: 2, e.g. 21.35)
Return values
size_tQuantity of characters written to stream

◆ print() [11/12]

size_t Print::print ( const Printable p)
inlineinherited

Prints a Printable object to output stream.

Parameters
pObject to print
Return values
size_tQuantity of characters written to stream

◆ print() [12/12]

size_t Print::print ( const String s)
inlineinherited

Prints a String to output stream.

Parameters
sString to print
Return values
size_tQuantity of characters written to stream

◆ printf()

size_t Print::printf ( const char *  fmt,
  ... 
)
inherited

Prints a formatted c-string to output stream.

Parameters
fmtPointer to formated c-string to print
...Parameters for placeholders within formated string
Return values
size_tQuantity of characters written to stream
Note
Use standard printf placeholders, e.g. d for integer, s for c-string, etc.

◆ println() [1/13]

size_t Print::println ( )
inlineinherited

Prints a newline to output stream.

Return values
size_tQuantity of characters written to stream

◆ println() [2/13]

size_t Print::println ( const char  str[])
inlineinherited

Prints a c-string to output stream, appending newline.

Parameters
strc-string to print
Return values
size_tQuantity of characters written to stream

◆ println() [3/13]

size_t Print::println ( char  c)
inlineinherited

Prints a single character to output stream, appending newline.

Parameters
cCharacter to print
Return values
size_tQuantity of characters written to stream

◆ println() [4/13]

size_t Print::println ( unsigned char  num,
int  base = DEC 
)
inlineinherited

◆ println() [5/13]

size_t Print::println ( unsigned int  num,
int  base = DEC 
)
inlineinherited

◆ println() [6/13]

size_t Print::println ( unsigned long  num,
int  base = DEC 
)
inlineinherited

◆ println() [7/13]

size_t Print::println ( const unsigned long long &  num,
int  base = DEC 
)
inlineinherited

◆ println() [8/13]

size_t Print::println ( int  num,
int  base = DEC 
)
inlineinherited

◆ println() [9/13]

size_t Print::println ( long  num,
int  base = DEC 
)
inlineinherited

◆ println() [10/13]

size_t Print::println ( const long long &  num,
int  base = DEC 
)
inlineinherited

◆ println() [11/13]

size_t Print::println ( double  num,
int  digits = 2 
)
inlineinherited

Print a floating-point number to output stream, appending newline.

Parameters
numNumber to print
digitsThe decimal places to print (Default: 2, e.g. 21.35)
Return values
size_tQuantity of characters written to stream

◆ println() [12/13]

size_t Print::println ( const Printable p)
inlineinherited

Prints a Printable object to output stream, appending newline.

Parameters
pObject to print
Return values
size_tQuantity of characters written to stream

◆ println() [13/13]

size_t Print::println ( const String s)
inlineinherited

Prints a String to output stream, appending newline.

Parameters
sString to print
Return values
size_tQuantity of characters written to stream

◆ read()

int HardwareSerial::read ( )
inlineoverridevirtual

Read a character from serial port.

Return values
intCharacter read from serial port or -1 if buffer empty
Note
The character is removed from the serial port input buffer

Reimplemented from IDataSourceStream.

◆ readBytes()

size_t Stream::readBytes ( char *  buffer,
size_t  length 
)
inherited

◆ readBytesUntil()

size_t Stream::readBytesUntil ( char  terminator,
char *  buffer,
size_t  length 
)
inherited

◆ readMemoryBlock()

uint16_t HardwareSerial::readMemoryBlock ( char *  buf,
int  max_len 
)
inlineoverridevirtual

Read a block of characters from serial port.

Parameters
bufPointer to buffer to hold received data
max_lenMaximum quantity of characters to read
Return values
uint16_tQuantity of characters read
Note
Although this shares the same name as the method in IDataSourceStream, behaviour is different because in effect the 'seek' position is changed by this call.

Implements IDataSourceStream.

◆ readString() [1/2]

String Stream::readString ( )
inherited

◆ readString() [2/2]

String IDataSourceStream::readString ( size_t  maxLen = UINT16_MAX)
inherited

Overrides Stream method for more efficient reading.

Note
Content is read using readMemoryBlock() so read position (for seekable streams) is not changed

◆ readStringUntil()

String Stream::readStringUntil ( char  terminator)
inherited

◆ seek()

bool HardwareSerial::seek ( int  len)
inlineoverridevirtual

Move read cursor.

Parameters
lenRelative cursor adjustment
Return values
boolTrue on success.

Reimplemented from IDataSourceStream.

◆ seekFrom()

virtual int IDataSourceStream::seekFrom ( int  offset,
unsigned  origin 
)
inlinevirtualinherited

Change position in stream.

Parameters
offset
originSEEK_SET, SEEK_CUR, SEEK_END
Return values
Newposition, < 0 on error
Note
This method is implemented by streams which support random seeking, such as files and memory streams.

Reimplemented in FileStream, MemoryDataStream, HostFileStream, FSTR::Stream, and GdbFileStream.

◆ setBaudRate()

uint32_t HardwareSerial::setBaudRate ( uint32_t  baudrate)
inline

Attempt to set the requested baud rate.

Return values
uint32_tthe actual baud rate in force
Note
Return value may differ from requested baud rate due to clock division errors

◆ setCallback()

bool HardwareSerial::setCallback ( StreamDataReceivedDelegate  dataReceivedDelegate)
inline

Set handler for received data.

Parameters
dataReceivedDelegateFunction to handle received data
Return values
boolReturns true if the callback was set correctly
Deprecated:
Use onDataReceived instead

◆ setPort()

void HardwareSerial::setPort ( int  uartPort)
inline

◆ setRxBufferSize()

size_t HardwareSerial::setRxBufferSize ( size_t  size)

Sets receiving buffer size.

Parameters
sizerequested size
Return values
size_tactual size

◆ setTimeout()

void Stream::setTimeout ( unsigned long  timeout)
inherited

◆ setTx()

void HardwareSerial::setTx ( uint8_t  tx_pin)
inline

Toggle between use of GPIO1 and GPIO2 as TX on UART 0.

Parameters
tx_pin
Note
: UART 1 can't be used if GPIO2 is used with UART 0!
: If UART1 is not used and UART0 is not swapped - TX for UART0 can be mapped to GPIO2 by calling .setTx(2) after .begin or directly with .begin(baud, config, mode, 2).

◆ setTxBufferSize()

size_t HardwareSerial::setTxBufferSize ( size_t  size)

Sets transmit buffer size.

Parameters
sizerequested size
Return values
size_tactual size

◆ setTxWait()

void HardwareSerial::setTxWait ( bool  wait)
inline

Governs write behaviour when UART transmit buffers are full.

Parameters
waitIf false, writes will return short count; applications can use the txComplete callback to send more data. If true, writes will wait for more buffer space so that all requested data is written

◆ setUartCallback()

void HardwareSerial::setUartCallback ( smg_uart_callback_t  callback,
void *  param = nullptr 
)
inline

Set callback ISR for received data.

Parameters
callbackFunction to handle received data
paramSet as return value for uart_get_callback_param()
Note
callback is invoked directly from serial ISR and bypasses any registered delgates

◆ setWriteError()

void Print::setWriteError ( int  err = 1)
inlineprotectedinherited

◆ swap() [1/2]

void HardwareSerial::swap ( )
inline

Toggle between use of GPIO13/GPIO15 or GPIO3/GPIO(1/2) as RX and TX.

Note
UART0 uses pins GPIO1 (TX) and GPIO3 (RX). It may be swapped to GPIO15 (TX) and GPIO13 (RX) by calling .swap() after .begin. C
Calling swap again maps UART0 back to GPIO1 and GPIO3.

◆ swap() [2/2]

void HardwareSerial::swap ( uint8_t  tx_pin)
inline

Toggle between use of GPIO13/GPIO15 or GPIO3/GPIO(1/2) as RX and TX.

Parameters
tx_pinPin number.

◆ systemDebugOutput()

void HardwareSerial::systemDebugOutput ( bool  enabled)

Configure serial port for system debug output and redirect output from debugf.

Parameters
enabledTrue to enable this port for system debug output
Note
If enabled, port will issue system debug messages

◆ timedPeek()

int Stream::timedPeek ( )
protectedinherited

◆ timedRead()

int Stream::timedRead ( )
protectedinherited

◆ write() [1/4]

size_t ReadWriteStream::write ( uint8_t  charToWrite)
inlineoverridevirtualinherited

Write a single character to the stream.

Parameters
charToWrite
Return values
size_tNumber of chars written (1 on success, 0 on failure)

Reimplemented from IDataSourceStream.

◆ write() [2/4]

size_t Print::write ( const char *  str)
inlineinherited

Writes a c-string to output stream.

Parameters
strPointer to c-string
Return values
size_tQuantity of characters written to stream

◆ write() [3/4]

size_t Print::write ( const char *  buffer,
size_t  size 
)
inlineinherited

Writes characters from a buffer to output stream.

Parameters
bufferPointer to character buffer
sizeQuantity of characters to write
Return values
size_tQuantity of characters written to stream

◆ write() [4/4]

size_t HardwareSerial::write ( const uint8_t *  buffer,
size_t  size 
)
inlineoverridevirtual

write multiple characters to serial port

Parameters
bufferdata to write
sizenumber of characters to write
Return values
size_tQuantity of characters written, may be less than size

Implements ReadWriteStream.

Member Data Documentation

◆ receiveTimeout

unsigned long Stream::receiveTimeout = 1000
protectedinherited

◆ startMillis

unsigned long Stream::startMillis = 0
protectedinherited

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