[][src]Struct ruspiro_uart::Uart0

pub struct Uart0 { /* fields omitted */ }

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]

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

impl Send for Uart0

impl Sync for Uart0

impl Unpin for Uart0

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.