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
impl SerialOptions
Configuration of various translation/usability options for the serial port device.
Option | Effect |
---|---|
flush_on_eol | Automatically flush when an end-of-line is transmitted |
cr_to_crlf | Translate sent CRs to CRLF |
lf_to_crlf | Translate sent LFs to CRLF |
interactive | This is an interactive terminal, reading from the device will automatically flush the transmit buffer first |
echo | Echo all characters received back on the transmit line. If interactive is set, will also flush after each. |
blocking_read | Calls to read() should block until data is available |
read_to_eol | Blocking read()s will immediately return when a CR or LF (‘\r’ or ‘\n’) is received |
read_to_eot | Blocking read()s will immediately return when an EOT character is received |
sourcepub fn set_flush_on_eol(&mut self, flag: bool)
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.
sourcepub fn flush_on_eol(self) -> bool
pub fn flush_on_eol(self) -> bool
True iff the device should automatically flush when an LF character is sent.
sourcepub fn set_cr_to_crlf(&mut self, flag: bool)
pub fn set_cr_to_crlf(&mut self, flag: bool)
Indicate that CR should be translated to CRLF automatically
sourcepub fn cr_to_crlf(&self) -> bool
pub fn cr_to_crlf(&self) -> bool
True iff the device should automatically translate CR to CRLF.
sourcepub fn set_lf_to_crlf(&mut self, flag: bool)
pub fn set_lf_to_crlf(&mut self, flag: bool)
Indicate that LF should be translated to CRLF automatically
sourcepub fn lf_to_crlf(&self) -> bool
pub fn lf_to_crlf(&self) -> bool
True iff the device should automatically translate LF to CRLF.
sourcepub fn set_interactive(&mut self, flag: bool)
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
sourcepub fn interactive(&self) -> bool
pub fn interactive(&self) -> bool
True iff this is an interative terminal
sourcepub fn set_echo(&mut self, flag: bool)
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.
sourcepub fn set_blocking_read(&mut self, flag: bool)
pub fn set_blocking_read(&mut self, flag: bool)
Indicate that calls to read() should block until data is available
sourcepub fn blocking_read(&self) -> bool
pub fn blocking_read(&self) -> bool
True iff read()s should block until data is available
sourcepub fn set_read_to_eol(&mut self, flag: bool)
pub fn set_read_to_eol(&mut self, flag: bool)
Stop blocking read()s as soon as a linefeed (\n) is received
sourcepub fn read_to_eol(&self) -> bool
pub fn read_to_eol(&self) -> bool
True iff blocking reads will complete when a linefeed (\n) is received
sourcepub fn set_read_to_eot(&mut self, flag: bool)
pub fn set_read_to_eot(&mut self, flag: bool)
Stop blocking read()s as soon as an EOT is received
sourcepub fn read_to_eot(&self) -> bool
pub fn read_to_eot(&self) -> bool
True iff blocking reads will complete when an EOT is received
sourcepub fn disable_translations(&mut self)
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.