[][src]Trait driver_cp2130::Device

pub trait Device {
    fn spi_read(&self, buff: &mut [u8]) -> Result<usize, Error>;
fn spi_write(&self, buff: &[u8]) -> Result<(), Error>;
fn spi_write_read(
        &self,
        buff_out: &[u8],
        buff_in: &mut [u8]
    ) -> Result<usize, Error>;
fn version(&self) -> Result<u16, Error>;
fn set_gpio_mode_level(
        &self,
        pin: u8,
        mode: GpioMode,
        level: GpioLevel
    ) -> Result<(), Error>;
fn get_gpio_values(&self) -> Result<GpioLevels, Error>;
fn get_gpio_level(&self, pin: u8) -> Result<bool, Error>; }

Device trait provides methods directly on the CP2130

Required methods

fn spi_read(&self, buff: &mut [u8]) -> Result<usize, Error>

Read from the SPI device

fn spi_write(&self, buff: &[u8]) -> Result<(), Error>

Write to the SPI device

fn spi_write_read(
    &self,
    buff_out: &[u8],
    buff_in: &mut [u8]
) -> Result<usize, Error>

fn version(&self) -> Result<u16, Error>

Fetch the CP2130 chip version

fn set_gpio_mode_level(
    &self,
    pin: u8,
    mode: GpioMode,
    level: GpioLevel
) -> Result<(), Error>

Set the mode and level for a given GPIO pin

fn get_gpio_values(&self) -> Result<GpioLevels, Error>

Fetch the values for all GPIO pins

fn get_gpio_level(&self, pin: u8) -> Result<bool, Error>

Fetch the value for a given GPIO pin

Loading content...

Implementors

impl<'a> Device for Cp2130<'a>[src]

Underlying device functions

Loading content...