Type Alias atmega_hal::usart::Usart

source ·
pub type Usart<USART, RX, TX, CLOCK> = Usart<Atmega, USART, RX, TX, CLOCK>;

Aliased Type§

struct Usart<USART, RX, TX, CLOCK> { /* private fields */ }

Implementations

source§

impl<H, USART, RXPIN, TXPIN, CLOCK> Usart<H, USART, Pin<Input, RXPIN>, Pin<Output, TXPIN>, CLOCK>
where USART: UsartOps<H, Pin<Input, RXPIN>, Pin<Output, TXPIN>>, RXPIN: PinOps, TXPIN: PinOps,

source

pub fn new<IMODE>( p: USART, rx: Pin<Input<IMODE>, RXPIN>, tx: Pin<Output, TXPIN>, baudrate: Baudrate<CLOCK> ) -> Usart<H, USART, Pin<Input, RXPIN>, Pin<Output, TXPIN>, CLOCK>
where IMODE: InputMode,

Initialize a USART peripheral on the given pins.

Note that the RX and TX pins are hardwired for each USART peripheral and you must pass the correct ones. This is enforced at compile time.

source§

impl<H, USART, RX, TX, CLOCK> Usart<H, USART, RX, TX, CLOCK>
where USART: UsartOps<H, RX, TX>,

source

pub fn release(self) -> (USART, RX, TX)

Deinitialize/disable this peripheral and release the pins.

source

pub fn flush(&mut self)

Block until all remaining data has been transmitted.

source

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

Transmit a byte.

This method will block until the byte has been enqueued for transmission but not until it was entirely sent.

source

pub fn read_byte(&mut self) -> u8

Receive a byte.

This method will block until a byte could be received.

source

pub fn listen(&mut self, event: Event)

Enable the interrupt for Event.

source

pub fn unlisten(&mut self, event: Event)

Disable the interrupt for Event.

source

pub fn split( self ) -> (UsartReader<H, USART, RX, TX, CLOCK>, UsartWriter<H, USART, RX, TX, CLOCK>)

Split this USART into a UsartReader and a UsartWriter.

This allows concurrently receiving and transmitting data from different contexts.

Trait Implementations

source§

impl<H, USART, RX, TX, CLOCK> Read<u8> for Usart<H, USART, RX, TX, CLOCK>
where USART: UsartOps<H, RX, TX>,

§

type Error = Infallible

Read error
source§

fn read( &mut self ) -> Result<u8, Error<<Usart<H, USART, RX, TX, CLOCK> as Read<u8>>::Error>>

Reads a single word from the serial interface
source§

impl<H, USART, RX, TX, CLOCK> Write<u8> for Usart<H, USART, RX, TX, CLOCK>
where USART: UsartOps<H, RX, TX>,

§

type Error = Infallible

Write error
source§

fn write( &mut self, byte: u8 ) -> Result<(), Error<<Usart<H, USART, RX, TX, CLOCK> as Write<u8>>::Error>>

Writes a single word to the serial interface
source§

fn flush( &mut self ) -> Result<(), Error<<Usart<H, USART, RX, TX, CLOCK> as Write<u8>>::Error>>

Ensures that none of the previously written words are still buffered
source§

impl<H, USART, RX, TX, CLOCK> uWrite for Usart<H, USART, RX, TX, CLOCK>
where USART: UsartOps<H, RX, TX>,

§

type Error = Infallible

The error associated to this writer
source§

fn write_str( &mut self, s: &str ) -> Result<(), <Usart<H, USART, RX, TX, CLOCK> as uWrite>::Error>

Writes a string slice into this writer, returning whether the write succeeded. Read more
source§

fn write_char(&mut self, c: char) -> Result<(), Self::Error>

Writes a char into this writer, returning whether the write succeeded. Read more