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 = Gpio18>,
_usb_d_plus: impl Peripheral<P = Gpio19>,
config: &Config,
) -> Result<UsbSerialDriver<'d>, EspError>
pub fn new( usb_serial: impl Peripheral<P = USB_SERIAL> + 'd, _usb_d_min: impl Peripheral<P = Gpio18>, _usb_d_plus: impl Peripheral<P = Gpio19>, config: &Config, ) -> Result<UsbSerialDriver<'d>, 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
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, <UsbSerialDriver<'_> as ErrorType>::Error>
fn read( &mut self, buf: &mut [u8], ) -> Result<usize, <UsbSerialDriver<'_> as ErrorType>::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<u8> for UsbSerialDriver<'_>
impl Write<u8> for UsbSerialDriver<'_>
Source§impl Write for UsbSerialDriver<'_>
impl Write for UsbSerialDriver<'_>
Source§fn write(
&mut self,
buf: &[u8],
) -> Result<usize, <UsbSerialDriver<'_> as ErrorType>::Error>
fn write( &mut self, buf: &[u8], ) -> Result<usize, <UsbSerialDriver<'_> as ErrorType>::Error>
Write a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<(), <UsbSerialDriver<'_> as ErrorType>::Error>
fn flush(&mut self) -> Result<(), <UsbSerialDriver<'_> as ErrorType>::Error>
Flush this output stream, blocking until all intermediately buffered contents reach their destination.