Struct nrf9160_hal::Uarte [−][src]
pub struct Uarte<T>(_);
Expand description
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
Implementations
impl<T> Uarte<T> where
T: Instance,
[src]
impl<T> Uarte<T> where
T: Instance,
[src]pub fn new(
uarte: T,
pins: Pins,
parity: PARITY_A,
baudrate: BAUDRATE_A
) -> Uarte<T>
[src]
uarte: T,
pins: Pins,
parity: PARITY_A,
baudrate: BAUDRATE_A
) -> Uarte<T>
pub fn write(&mut self, tx_buffer: &[u8]) -> Result<(), Error>
[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]
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, OneShot>,
cycles: u32
) -> Result<(), Error> where
I: Instance,
[src]
pub fn read_timeout<I>(
&mut self,
rx_buffer: &mut [u8],
timer: &mut Timer<I, OneShot>,
cycles: u32
) -> Result<(), Error> where
I: Instance,
[src]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.
Trait Implementations
Auto Trait Implementations
impl<T> Send for Uarte<T> where
T: Send,
T: Send,
impl<T> Sync for Uarte<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Uarte<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self