Struct rp6::uart::Serial

source ·
pub struct Serial;
Expand description

Struct managing all access to the robot’s serial port connection

Implementations§

source§

impl Serial

source

pub fn init()

Initialize the serial connection on pins RX and TX.

source

pub fn enable_USART_RXC_interrupt()

Enable the USART_RXC interrupt

source

pub fn enable_USART_TXC_interrupt()

Enable the USART_TXC interrupt

source

pub fn disable_USART_RXC_interrupt()

Disable the USART_RXC interrupt

source

pub fn disable_USART_TXC_interrupt()

Disable the USART_TXC interrupt

source

pub fn set_baudrate_low()

Configure serial connection to low baudrate UBRR_BAUD_LOW.

source

pub fn set_baudrate_high()

Configure serial connection to high baudrate UBRR_BAUD_HIGH.

source

pub fn read_raw() -> u8

Reads a single raw byte from the Serial connection. Blocks until the processor is ready to receive the next byte, i.e., the corresponding bit UDRE is set in UCSRA.

source

pub fn write_raw(b: u8)

Writes a single raw byte to the Serial connection. Blocks until the processor is ready to send the next byte, i.e., the corresponding bit UDRE is set in UCSRA.

source

pub fn write<T: SerialWritable>(value: T)

Write something to the Serial connection. By default, supports &str, char, and basic number types (in decimal notation).

source

pub fn write_dec<T: SerialWritableDecimal>(value: T)

Write a number formatted as decimal to the Serial connection.

source

pub fn write_hex<T: SerialWritableHexadecimal>(value: T)

Write a number formatted as hexadecimal to the Serial connection.

source

pub fn new_line()

Write a '\n' (newline character) to the serial connection.

Auto Trait Implementations§

§

impl RefUnwindSafe for Serial

§

impl Send for Serial

§

impl Sync for Serial

§

impl Unpin for Serial

§

impl UnwindSafe for Serial

Blanket Implementations§

§

impl<T> Any for Twhere
T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for Twhere
T: ?Sized,

const: unstable§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for Twhere
T: ?Sized,

const: unstable§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

const: unstable§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for Twhere
U: From<T>,

const: unstable§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.