Type Alias avr_oxide::devices::serialport::SerialOptions

source ·
pub type SerialOptions = BitField;
Expand description

Options for controlling how data is transmitted by the serial port device.

Aliased Type§

struct SerialOptions(/* private fields */);

Implementations§

source§

impl SerialOptions

Configuration of various translation/usability options for the serial port device.

OptionEffect
flush_on_eolAutomatically flush when an end-of-line is transmitted
cr_to_crlfTranslate sent CRs to CRLF
lf_to_crlfTranslate sent LFs to CRLF
interactiveThis is an interactive terminal, reading from the device will automatically flush the transmit buffer first
echoEcho all characters received back on the transmit line. If interactive is set, will also flush after each.
blocking_readCalls to read() should block until data is available
read_to_eolBlocking read()s will immediately return when a CR or LF (‘\r’ or ‘\n’) is received
read_to_eotBlocking read()s will immediately return when an EOT character is received
source

pub fn set_flush_on_eol(&mut self, flag: bool)

Indicate that the device should automatically flush when an end-of-line (CR or LF) character is sent is sent.

source

pub fn flush_on_eol(self) -> bool

True iff the device should automatically flush when an LF character is sent.

source

pub fn set_cr_to_crlf(&mut self, flag: bool)

Indicate that CR should be translated to CRLF automatically

source

pub fn cr_to_crlf(&self) -> bool

True iff the device should automatically translate CR to CRLF.

source

pub fn set_lf_to_crlf(&mut self, flag: bool)

Indicate that LF should be translated to CRLF automatically

source

pub fn lf_to_crlf(&self) -> bool

True iff the device should automatically translate LF to CRLF.

source

pub fn set_interactive(&mut self, flag: bool)

Indicate that this is an interactive terminal. Effects:

  • A call to read() will automatically flush the transmit buffer
source

pub fn interactive(&self) -> bool

True iff this is an interative terminal

source

pub fn set_echo(&mut self, flag: bool)

Indicate that we should echo received characters back. If the device is also set to interactive, then we will flush() after each echoed character as well.

source

pub fn echo(&self) -> bool

True iff we should echo everything we receive back on transmit

source

pub fn set_blocking_read(&mut self, flag: bool)

Indicate that calls to read() should block until data is available

source

pub fn blocking_read(&self) -> bool

True iff read()s should block until data is available

source

pub fn set_read_to_eol(&mut self, flag: bool)

Stop blocking read()s as soon as a linefeed (\n) is received

source

pub fn read_to_eol(&self) -> bool

True iff blocking reads will complete when a linefeed (\n) is received

source

pub fn set_read_to_eot(&mut self, flag: bool)

Stop blocking read()s as soon as an EOT is received

source

pub fn read_to_eot(&self) -> bool

True iff blocking reads will complete when an EOT is received

source

pub fn disable_translations(&mut self)

Clear all settings that result in the data being translated in any way (e.g. CR to CRLF type translations.) Use this to ensure a serial port is ‘clean’ for sending/receiving binary data.

Trait Implementations§

source§

impl Default for SerialOptions

source§

fn default() -> Self

Default transmit options:

  • DO flush automatically on End-of-Line
  • DO NOT translate CR to CRLF
  • DO NOT translate LF to CRLF
  • Interactive mode NOT enabled