Struct Uart

Source
pub struct Uart<A: UartAddress, M: Mode> { /* private fields */ }

Implementations§

Source§

impl<A: UartAddress, M: Mode> Uart<A, M>

Source

pub fn read_interrupt_status(&self) -> InterruptStatus

Read from the interrupt status register.

Source

pub fn write_fifo_control(&mut self, fifo_control: FifoControl)

Write to the FIFO control register.

Source

pub fn read_line_control(&self) -> LineControl

Read from the line control register.

Source

pub fn write_line_control(&mut self, value: LineControl)

Write to the line control register.

Source

pub fn write_modem_control(&mut self, value: ModemControl)

Write to the modem control register.

Source

pub fn read_line_status(&mut self) -> LineStatus

Read from the line status register.

Source

pub fn read_modem_status(&self) -> ModemStatus

Read from the modem status register.

Source§

impl<A: UartAddress> Uart<A, DLAB>

Source

pub unsafe fn new(base_address: A) -> Self

Creates a new Uart pointing to base_address.

§Safety
  • Provided address must be valid as the base address of a UART device.
  • Provided address must not be otherwise mutably aliased.
  • Device must have bit 7 of the line control register (DLAB enable) set to 1.
Source

pub fn get_baud(&self) -> Baud

Read from the baud rate from the divisor latch registers.

Source

pub fn set_baud(&mut self, baud: Baud)

Set the baud rate using the divisor latch registers.

Source

pub fn into_data_mode(self) -> Uart<A, Data>

Disables access to the divisor latch registers.

Source§

impl<A: UartAddress> Uart<A, Data>

Source

pub unsafe fn new(base_address: A) -> Self

Creates a new Uart pointing to base_address.

§Safety
  • UART must have bit 7 of the line control register (DLAB enable) set to 0.
Source

pub fn new_reset(base_address: A) -> Self

Creates a new Uart pointing to base_address, and resets all the control and holding registers.

Source

pub fn read_byte(&mut self) -> u8

Reads a byte from the receiver holding register.

Source

pub fn write_byte(&mut self, byte: u8)

Writes a byte to the transmitter holding register

Source

pub fn read_interrupt_enable(&self) -> InterruptEnable

Reads from the interrupt enable register.

Source

pub fn write_interrupt_enable(&mut self, value: InterruptEnable)

Writes to the interrupt enable register.

Source

pub fn into_dlab_mode(self) -> Uart<A, DLAB>

Enables access to the divisor latch registers.

Auto Trait Implementations§

§

impl<A, M> Freeze for Uart<A, M>
where A: Freeze,

§

impl<A, M> RefUnwindSafe for Uart<A, M>

§

impl<A, M> Send for Uart<A, M>
where A: Send, M: Send,

§

impl<A, M> Sync for Uart<A, M>
where A: Sync, M: Sync,

§

impl<A, M> Unpin for Uart<A, M>
where A: Unpin, M: Unpin,

§

impl<A, M> UnwindSafe for Uart<A, M>
where A: UnwindSafe, M: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.