pub fn new(channel: TestChannel) -> Result<Self, RpiTestChannelError> {
        let mut uart = Uart::with_path(
            Path::new(&format!("/dev/ttyAMA{}", UART_PATHS[channel as usize])),
            115_200,
            Parity::None,
            8,
            1,
        )
        .map_err(|err| RpiTestChannelError::UartInitError { source: err })?;

        uart.set_read_mode(
            UART_BYTES_READ,
            Duration::from_millis(UART_READ_TIMEOUT as u64),
        )
        .map_err(|err| RpiTestChannelError::UartInitError { source: err })?;

        uart.set_write_mode(true)
            .map_err(|err| RpiTestChannelError::UartInitError { source: err })?;

        uart.set_dtr(false)
            .map_err(|err| RpiTestChannelError::UartInitError { source: err })?;

        Ok(Self { uart })
    }
/// Creates a new instance of the struct and configures the UART peripheral. Both write and read are blocking, as the tests on a single Testchannel are never parallel.
Creates a new instance of the struct and configures the UART peripheral. Both write and read are blocking, as the tests on a single Testchannel are never parallel.
Creates a new instance of the struct and configures the UART peripheral . Both write and read are blocking as the tests on a single Testchannel are never parallel .
pub fn new(channel: TestChannel) -> Result<Self, RpiTestChannelError> {
        let mut uart = Uart::with_path(
            Path::new(&format!("/dev/ttyAMA{}", UART_PATHS[channel as usize])),
            115_200,
            Parity::None,
            8,
            1,
        )
        .map_err(|err| RpiTestChannelError::UartInitError { source: err })?;
        uart.set_read_mode(
            UART_BYTES_READ,
            Duration::from_millis(UART_READ_TIMEOUT as u64),
        )
        .map_err(|err| RpiTestChannelError::UartInitError { source: err })?;
        uart.set_write_mode(true)
            .map_err(|err| RpiTestChannelError::UartInitError { source: err })?;
        uart.set_dtr(false)
            .map_err(|err| RpiTestChannelError::UartInitError { source: err })?;
        Ok(Self { uart })
    }
pub fn new ( channel : TestChannel ) -> Result < Self , RpiTestChannelError > { let mut uart = Uart :: with_path ( Path :: new ( & format ! ( " " UART_PATHS [ channel as usize ] ) ) , 115_200 , Parity :: None , 8 , 1 , ) . map_err ( | err | RpiTestChannelError :: UartInitError { source : err } ) ? ; uart . set_read_mode ( UART_BYTES_READ , Duration :: from_millis ( UART_READ_TIMEOUT as u64 ) , ) . map_err ( | err | RpiTestChannelError :: UartInitError { source : err } ) ? ; uart . set_write_mode ( true ) . map_err ( | err | RpiTestChannelError :: UartInitError { source : err } ) ? ; uart . set_dtr ( false ) . map_err ( | err | RpiTestChannelError :: UartInitError { source : err } ) ? ; Ok ( Self { uart } ) }
Creates a new instance of the struct and configures the UART peripheral.
Creates a new instance of the struct and configures the UART peripheral .
channel
TestChannel