SC16IS752 Serial Bridge Arduino Library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SC16IS752::ChannelStream Class Reference

Per-channel Stream adapter for one SC16IS752 UART. More...

#include <SC16IS752.h>

Inheritance diagram for SC16IS752::ChannelStream:
Inheritance graph
[legend]
Collaboration diagram for SC16IS752::ChannelStream:
Collaboration graph
[legend]

Public Member Functions

 ChannelStream (SC16IS752 &parent, SC16IS752_Channel channel)
 Creates a stream adapter bound to the selected UART channel.
 
int available () override
 Returns the number of bytes available for reading on this channel.
 
int read () override
 Reads one byte from this channel.
 
int peek () override
 Peeks one byte from this channel without removing it.
 
void flush () override
 Waits until pending transmission on this channel is complete.
 
size_t write (uint8_t val) override
 Writes one byte to this channel.
 
void begin (uint32_t baudrate=SC16IS752_DEFAULT_SPEED, uint32_t config=SC16IS752_DEFAULT_CONFIG)
 Initializes this channel with the specified baud rate and serial configuration.
 
void end ()
 Gracefully closes this channel.
 
uint8_t linestate ()
 Returns the line status register for this channel.
 
uint8_t interruptPendingTest ()
 Tests whether an interrupt is pending for this channel.
 
int interruptEventTest ()
 Returns the decoded interrupt event for this channel.
 
void enableRs485 (bool invert_rts)
 Enables RS485 mode for this channel.
 
void enableTransmit (uint8_t tx_enable)
 Enables or disables transmission for this channel.
 
void interruptControl (uint8_t int_ena)
 Controls interrupt enable bits for this channel.
 

Detailed Description

Per-channel Stream adapter for one SC16IS752 UART.

This nested class exposes a standard Arduino Stream interface for a single UART channel and forwards all operations to its parent SC16IS752 instance. It allows sketches to use channelA() and channelB() like regular stream objects while still exposing selected channel-specific helpers such as begin(), linestate(), interruptPendingTest(), enableRs485(), and interruptControl().

Member Function Documentation

◆ begin()

void SC16IS752::ChannelStream::begin ( uint32_t  baudrate = SC16IS752_DEFAULT_SPEED,
uint32_t  config = SC16IS752_DEFAULT_CONFIG 
)
inline

Initializes this channel with the specified baud rate and serial configuration.

Parameters
baudrateUART baud rate.
configArduino-style serial format. Supported values are:
  • SERIAL_5N1
  • SERIAL_6N1
  • SERIAL_7N1
  • SERIAL_8N1 (default)
  • SERIAL_5N2
  • SERIAL_6N2
  • SERIAL_7N2
  • SERIAL_8N2
  • SERIAL_5E1
  • SERIAL_6E1
  • SERIAL_7E1
  • SERIAL_8E1
  • SERIAL_5E2
  • SERIAL_6E2
  • SERIAL_7E2
  • SERIAL_8E2
  • SERIAL_5O1
  • SERIAL_6O1
  • SERIAL_7O1
  • SERIAL_8O1
  • SERIAL_5O2
  • SERIAL_6O2
  • SERIAL_7O2
  • SERIAL_8O2

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