Skip to main content

pamoja_serial_port_read

Function pamoja_serial_port_read 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_serial_port_read( port: *const PamojaSerialPort, out: *mut u8, capacity: usize, timeout_micros: u64, out_len: *mut usize, ) -> PamojaStatus
Expand description

Reads what has arrived, waiting up to a timeout for the first byte when nothing has. On any port but the kernel’s device the read does not wait, and the timeout is counted instead.

§Arguments

  • port - the port.
  • out - receives the bytes.
  • capacity - the most bytes to read.
  • timeout_micros - how long to wait for the first byte.
  • out_len - receives how many bytes were read, zero when the timeout passed with nothing.

§Returns

As pamoja_serial_port_write, and PamojaStatus::InvalidArgument for a null out_len.

§Safety

port must be a live handle or null, out must point to capacity writable bytes, and out_len must be a writable pointer or null.