[−][src]Struct ruspiro_uart::Uart0
Uart0 peripheral representation
Implementations
impl Uart0
[src]
pub const fn new() -> Self
[src]
get a new Uart0 instance
pub fn initialize(
&mut self,
clock_rate: u32,
baud_rate: u32
) -> Result<(), &'static str>
[src]
&mut self,
clock_rate: u32,
baud_rate: u32
) -> Result<(), &'static str>
Initialize the Uart0 peripheral for usage. It takes the UART clock rate and the baud rate to configure correct communication speed. Please not that in the current version the initialization of the Uart0 will use the GPIO pins 32 and 33 to configure the bridge to the on-board bluetooth low energy chip.
Example
let mut uart = Uart0::new(); assert_eq!(uart.initialize(3_000_000, 115_200), Ok(()));
pub fn write_data(&self, data: &[u8])
[src]
Write the byte buffer to the Uart0 transmit buffer/fifo which inturn will send the data to any connected device. In the current setup this is the BLE chip.
Example
let data: [u8; 4] = [1, 15, 20, 10]; uart.write_data(&data);
pub fn read_data(&self) -> Option<u8>
[src]
Read one byte from the Uart0 receive buffer/Fifo if available.
Example
if let Some(data) = uart.read_data() { println!("received {}", data); }
Trait Implementations
impl ConsoleImpl for Uart0
[src]
to use the Uart0 as a console to output strings implement the respective trait
impl Drop for Uart0
[src]
When the Uart0 is dropped it should release the GPIO pins that have been aquired.
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,