Tx

Struct Tx 

Source
pub struct Tx<I, State, Throttle> { /* private fields */ }
Expand description

USART transmitter

Can be accessed through USART.

§embedded-hal traits

Implementations§

Source§

impl<I, W, Mode, Throttle> Tx<I, Enabled<W, Mode>, Throttle>
where I: Instance, W: Word,

Source

pub fn enable_rts<P, S>( &mut self, function: Function<I::Rts, Unassigned>, pin: Pin<P, S>, swm: &mut Handle, ) -> (Function<I::Rts, Assigned<P>>, <Pin<P, S> as AssignFunction<I::Rts, <I::Rts as FunctionTrait<P>>::Kind>>::Assigned)
where P: Trait, S: State, Pin<P, S>: AssignFunction<I::Rts, <I::Rts as FunctionTrait<P>>::Kind>, I::Rts: FunctionTrait<P>,

Enable RTS signal

Configure the transmitter to assert the Request to Send (RTS) signal, when it is ready to send.

This is a convenience method that ensures the correct RTS function for this peripheral instance is assigned to a pin. The same effect can be achieved by just assigning the function using the SWM API.

Source

pub fn disable_rts<P, S>( &mut self, function: Function<I::Rts, Assigned<P>>, pin: Pin<P, S>, swm: &mut Handle, ) -> (Function<I::Rts, Unassigned>, <Pin<P, S> as UnassignFunction<I::Rts, <I::Rts as FunctionTrait<P>>::Kind>>::Unassigned)
where P: Trait, S: State, Pin<P, S>: UnassignFunction<I::Rts, <I::Rts as FunctionTrait<P>>::Kind>, I::Rts: FunctionTrait<P>,

Disable RTS signal

Configure the transmitter to no longer assert the Request to Send (RTS) signal.

This is a convenience method that ensures the correct RTS function for this peripheral instance is unassigned. The same effect can be achieved by just unassigning the function using the SWM API.

Source

pub fn is_flag_set(&self, flag: Flag) -> bool

Query whether the provided flag is set

Flags that need to be reset by software will be reset by this operation.

Source

pub fn enable_interrupts(&mut self, interrupts: Interrupts)

Enable interrupts

Enables all interrupts set to true in interrupts. Interrupts set to false are not affected.

§Example
use lpc8xx_hal::usart;

// Enable only RXRDY and TXRDY, leave other interrupts untouched.
usart.enable_interrupts(usart::Interrupts {
    RXRDY: true,
    TXRDY: true,
    .. usart::Interrupts::default()
});
Source

pub fn disable_interrupts(&mut self, interrupts: Interrupts)

Disable interrupts

Disables all interrupts set to true in interrupts. Interrupts set to false are not affected.

§Example
use lpc8xx_hal::usart;

// Disable only RXRDY and TXRDY, leave other interrupts untouched.
usart.disable_interrupts(usart::Interrupts {
    RXRDY: true,
    TXRDY: true,
    .. usart::Interrupts::default()
});
Source§

impl<I, W, Mode> Tx<I, Enabled<W, Mode>, NoThrottle>
where I: Instance, W: Word,

Source

pub fn enable_cts_throttling<P>( self, function: Function<I::Cts, Assigned<P>>, ) -> Tx<I, Enabled<W, Mode>, CtsThrottle<Function<I::Cts, Assigned<P>>>>

Enable throttling via CTS signal

Configure the transmitter to only transmit, while the CTS signal is asserted.

Source§

impl<I, W, Mode, Function> Tx<I, Enabled<W, Mode>, CtsThrottle<Function>>
where I: Instance, W: Word,

Source

pub fn disable_cts_throttling( self, ) -> (Tx<I, Enabled<W, Mode>, NoThrottle>, Function)

Disable throttling via CTS signal

Configure the transmitter to ignore the CTS signal. Returns the SWM function for the CTS signal, so it can be reused to enable CTS throttling again, or for something else.

Source§

impl<I, Mode, Throttle> Tx<I, Enabled<u8, Mode>, Throttle>
where I: Instance,

Source

pub fn write_all( self, buffer: &'static [u8], channel: Channel<I::TxChannel, Enabled>, ) -> Transfer<Ready, I::TxChannel, &'static [u8], Self>

Writes the provided buffer using DMA

§Panics

Panics, if the length of buffer is 0 or larger than 1024.

Trait Implementations§

Source§

impl<I, Mode, Throttle> Dest for Tx<I, Enabled<u8, Mode>, Throttle>
where I: Instance,

Source§

type Error = Void

The error that can occur while finishing the transfer
Source§

fn is_valid(&self) -> bool

Indicates whether the destination is valid Read more
Source§

fn is_full(&self) -> bool

Indicates whether the destination is full Read more
Source§

fn increment(&self) -> DSTINC_A

The address increment during the transfer Read more
Source§

fn transfer_count(&self) -> Option<u16>

The transfer count, as defined by XFERCFG.XFERCOUNT Read more
Source§

fn end_addr(&mut self) -> *mut u8

The end address Read more
Source§

fn finish(&mut self) -> Result<(), Self::Error>

Tell the destination to finish the transfer
Source§

impl<I, Mode, Throttle> Write for Tx<I, Enabled<u8, Mode>, Throttle>
where Self: BlockingWriteDefault<u8>, I: Instance,

Source§

fn write_str(&mut self, s: &str) -> Result

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

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

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more
Source§

impl<I, W, Mode, Throttle> Write<W> for Tx<I, Enabled<W, Mode>, Throttle>
where I: Instance, W: Word,

Source§

type Error = Void

Write error
Source§

fn write(&mut self, word: W) -> Result<(), Self::Error>

Writes a single word to the serial interface
Source§

fn flush(&mut self) -> Result<(), Self::Error>

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

impl<I, W, Mode, Throttle> Default<W> for Tx<I, Enabled<W, Mode>, Throttle>
where I: Instance, W: Word,

Auto Trait Implementations§

§

impl<I, State, Throttle> Freeze for Tx<I, State, Throttle>
where Throttle: Freeze,

§

impl<I, State, Throttle> RefUnwindSafe for Tx<I, State, Throttle>
where Throttle: RefUnwindSafe, I: RefUnwindSafe, State: RefUnwindSafe,

§

impl<I, State, Throttle> Send for Tx<I, State, Throttle>
where Throttle: Send, I: Send, State: Send,

§

impl<I, State, Throttle> Sync for Tx<I, State, Throttle>
where Throttle: Sync, I: Sync, State: Sync,

§

impl<I, State, Throttle> Unpin for Tx<I, State, Throttle>
where Throttle: Unpin, I: Unpin, State: Unpin,

§

impl<I, State, Throttle> UnwindSafe for Tx<I, State, Throttle>
where Throttle: UnwindSafe, I: UnwindSafe, State: 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.
Source§

impl<S, Word> Write<Word> for S
where S: Default<Word>, Word: Clone,

Source§

type Error = <S as Write<Word>>::Error

The type of error that can occur when writing
Source§

fn bwrite_all( &mut self, buffer: &[Word], ) -> Result<(), <S as Write<Word>>::Error>

Writes a slice, blocking until everything has been written Read more
Source§

fn bflush(&mut self) -> Result<(), <S as Write<Word>>::Error>

Block until the serial interface has sent all buffered words