Struct driver_cp2130::Cp2130
source · pub struct Cp2130 { /* private fields */ }
Expand description
CP2130 provides methods to interact with the device, as well as create new spi and gpio connectors.
Implementations§
source§impl Cp2130
impl Cp2130
sourcepub fn new(
device: UsbDevice<UsbContext>,
descriptor: DeviceDescriptor,
options: UsbOptions
) -> Result<Self, Error>
pub fn new( device: UsbDevice<UsbContext>, descriptor: DeviceDescriptor, options: UsbOptions ) -> Result<Self, Error>
Create a new CP2130 instance from a libusb device and descriptor
pub fn reset(&self) -> Result<(), Error>
sourcepub fn spi(
&self,
channel: u8,
config: SpiConfig,
cs_pin: Option<u8>
) -> Result<Spi, Error>
pub fn spi( &self, channel: u8, config: SpiConfig, cs_pin: Option<u8> ) -> Result<Spi, Error>
Create an SPI connector with an optional CS pin
Trait Implementations§
source§impl Device for Cp2130
impl Device for Cp2130
Underlying device functions
fn spi_write_read( &self, buff_out: &[u8], buff_in: &mut [u8] ) -> Result<usize, Error>
source§fn set_gpio_mode_level(
&self,
pin: u8,
mode: GpioMode,
level: GpioLevel
) -> Result<(), Error>
fn set_gpio_mode_level( &self, pin: u8, mode: GpioMode, level: GpioLevel ) -> Result<(), Error>
Set the mode and level for a given GPIO pin
source§fn get_gpio_values(&self) -> Result<GpioLevels, Error>
fn get_gpio_values(&self) -> Result<GpioLevels, Error>
Fetch the values for all GPIO pins
Auto Trait Implementations§
impl Freeze for Cp2130
impl RefUnwindSafe for Cp2130
impl Send for Cp2130
impl Sync for Cp2130
impl Unpin for Cp2130
impl UnwindSafe for Cp2130
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more