pub struct SerialPort(/* private fields */);
Expand description
A x86 I/O port-mapped UART.
Implementations§
Source§impl SerialPort
impl SerialPort
Sourcepub const unsafe fn new(base: u16) -> Self
pub const unsafe fn new(base: u16) -> Self
Creates a new serial port interface on the given I/O base port.
This function is unsafe because the caller must ensure that the given base address really points to a serial port device and that the caller has the necessary rights to perform the I/O operation.
Sourcepub fn init(&mut self)
pub fn init(&mut self)
Initializes the serial port.
The default configuration of 38400/8-N-1 is used.
Sourcepub fn send(&mut self, data: u8)
pub fn send(&mut self, data: u8)
Sends a byte on the serial port. 0x08 (backspace) and 0x7F (delete) get replaced with 0x08, 0x20, 0x08 and 0x0A (\n) gets replaced with \r\n. If this replacement is unwanted use SerialPort::send_raw instead.
Sourcepub fn send_raw(&mut self, data: u8)
pub fn send_raw(&mut self, data: u8)
Sends a raw byte on the serial port, intended for binary data.
Sourcepub fn try_send_raw(&mut self, data: u8) -> Result<(), WouldBlockError>
pub fn try_send_raw(&mut self, data: u8) -> Result<(), WouldBlockError>
Tries to send a raw byte on the serial port, intended for binary data.
Sourcepub fn try_receive(&mut self) -> Result<u8, WouldBlockError>
pub fn try_receive(&mut self) -> Result<u8, WouldBlockError>
Tries to receive a byte on the serial port.
Trait Implementations§
Source§impl Debug for SerialPort
impl Debug for SerialPort
Auto Trait Implementations§
impl Freeze for SerialPort
impl RefUnwindSafe for SerialPort
impl Send for SerialPort
impl Sync for SerialPort
impl Unpin for SerialPort
impl UnwindSafe for SerialPort
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more