Skip to content

UART read timeout? #461

@marie-bnl

Description

@marie-bnl

I am trying to read a success code that is sent to my ESP by a UART sensor. To do so, I use read_exact this way

fn read_success(uart: &mut UartDriver) -> anyhow::Result<()> {
    let mut buffer = [0; 10];
    uart.read_exact(&mut buffer)?;
    assert_eq!(&buffer, b"$00023335&");
    Ok(())
}

Can I set a read timeout in case the sensor never responds?

There seems to be uart_set_rx_timeout but I couldn’t find any function that does this in the wrappers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions