[−][src]Struct nrf52_hal_common::uarte::Uarte
Interface to a UARTE instance
This is a very basic interface that comes with the following limitations:
- The UARTE instances share the same address space with instances of UART.
You need to make sure that conflicting instances
are disabled before using
Uarte
. See product specification:- nrf52832: Section 15.2
- nrf52840: Section 6.1.2
Methods
impl<T> Uarte<T> where
T: UarteExt,
[src]
T: UarteExt,
pub fn new(uarte: T, pins: Pins, parity: Parity, baudrate: Baudrate) -> Self
[src]
pub fn write(&mut self, tx_buffer: &[u8]) -> Result<(), Error>
[src]
Write via UARTE
This method uses transmits all bytes in tx_buffer
The buffer must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
pub fn read(&mut self, rx_buffer: &mut [u8]) -> Result<(), Error>
[src]
Read via UARTE
This method fills all bytes in rx_buffer
, and blocks
until the buffer is full.
The buffer must have a length of at most 255 bytes
pub fn read_timeout<I>(
&mut self,
rx_buffer: &mut [u8],
timer: &mut Timer<I>,
cycles: u32
) -> Result<(), Error> where
I: TimerExt,
[src]
&mut self,
rx_buffer: &mut [u8],
timer: &mut Timer<I>,
cycles: u32
) -> Result<(), Error> where
I: TimerExt,
Read via UARTE
This method fills all bytes in rx_buffer
, and blocks
until the buffer is full or the timeout expires, whichever
comes first.
If the timeout occurs, an Error::Timeout(n)
will be returned,
where n
is the number of bytes read successfully.
This method assumes the interrupt for the given timer is NOT enabled, and in cases where a timeout does NOT occur, the timer will be left running until completion.
The buffer must have a length of at most 255 bytes
pub fn free(self) -> T
[src]
Return the raw interface to the underlying UARTE peripheral
Trait Implementations
impl<T> Write for Uarte<T> where
T: UarteExt,
[src]
T: UarteExt,
fn write_str(&mut self, s: &str) -> Result
[src]
fn write_char(&mut self, c: char) -> Result<(), Error>
1.1.0[src]
Writes a [char
] into this writer, returning whether the write succeeded. Read more
fn write_fmt(&mut self, args: Arguments) -> Result<(), Error>
1.0.0[src]
Glue for usage of the [write!
] macro with implementors of this trait. Read more
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> From for T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same for T
type Output = T
Should always be Self