pub struct UsbSerialDriver<'d>(/* private fields */);
Expand description
USB-SERIAL driver
Implementations§
Source§impl<'d> UsbSerialDriver<'d>
impl<'d> UsbSerialDriver<'d>
Sourcepub fn new(
usb_serial: impl Peripheral<P = USB_SERIAL> + 'd,
_usb_d_min: impl Peripheral<P = UsbDMinGpio>,
_usb_d_plus: impl Peripheral<P = UsbDPlusGpio>,
config: &Config,
) -> Result<Self, EspError>
pub fn new( usb_serial: impl Peripheral<P = USB_SERIAL> + 'd, _usb_d_min: impl Peripheral<P = UsbDMinGpio>, _usb_d_plus: impl Peripheral<P = UsbDPlusGpio>, config: &Config, ) -> Result<Self, EspError>
Create a new USB Serial driver
§Arguments
usb_serial
: The USB Serial peripheralconfig
: The driver configurationusb_d_min
: The USB D- GPIO pinusb_d_plus
: The USB D+ GPIO pin
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if the USB Serial is connected
Sourcepub fn read(
&mut self,
buf: &mut [u8],
timeout: TickType_t,
) -> Result<usize, EspError>
pub fn read( &mut self, buf: &mut [u8], timeout: TickType_t, ) -> Result<usize, EspError>
Trait Implementations§
Source§impl Drop for UsbSerialDriver<'_>
impl Drop for UsbSerialDriver<'_>
Source§impl ErrorType for UsbSerialDriver<'_>
impl ErrorType for UsbSerialDriver<'_>
Source§type Error = EspIOError
type Error = EspIOError
Error type of all the IO operations on this type.
Source§impl Read for UsbSerialDriver<'_>
impl Read for UsbSerialDriver<'_>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf
. Read moreSource§impl Write for UsbSerialDriver<'_>
impl Write for UsbSerialDriver<'_>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Flush this output stream, blocking until all intermediately buffered contents reach their destination.