Struct mcp4x::Mcp4x

source ·
pub struct Mcp4x<DI, IC> { /* private fields */ }
Expand description

MCP4x digital potentiometer driver

Implementations§

source§

impl<DI, IC, CommE> Mcp4x<DI, IC>
where DI: WriteCommand<Error = Error<CommE>>, IC: CheckChannel<CommE>,

source

pub fn set_position( &mut self, channel: Channel, position: u8, ) -> Result<(), Error<CommE>>

Set a channel to a position.

Will return Error::WrongChannel if the channel provided is not available on the device.

source

pub fn shutdown(&mut self, channel: Channel) -> Result<(), Error<CommE>>

Shutdown a channel.

Will return Error::WrongChannel if the channel provided is not available on the device.

source§

impl<SPI> Mcp4x<SpiInterface<SPI>, Mcp41x>

source

pub fn new_mcp41x(spi: SPI) -> Self

Create new MCP41x device instance

source

pub fn destroy_mcp41x(self) -> SPI

Destroy driver instance, return SPI bus instance and CS output pin.

source§

impl<SPI> Mcp4x<SpiInterface<SPI>, Mcp42x>

source

pub fn new_mcp42x(spi: SPI) -> Self

Create new MCP42x device instance

source

pub fn destroy_mcp42x(self) -> SPI

Destroy driver instance, return SPI bus instance and CS output pin.

Trait Implementations§

source§

impl<DI: Debug, IC: Debug> Debug for Mcp4x<DI, IC>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<DI: Default, IC: Default> Default for Mcp4x<DI, IC>

source§

fn default() -> Mcp4x<DI, IC>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<DI, IC> Freeze for Mcp4x<DI, IC>
where DI: Freeze,

§

impl<DI, IC> RefUnwindSafe for Mcp4x<DI, IC>

§

impl<DI, IC> Send for Mcp4x<DI, IC>
where DI: Send, IC: Send,

§

impl<DI, IC> Sync for Mcp4x<DI, IC>
where DI: Sync, IC: Sync,

§

impl<DI, IC> Unpin for Mcp4x<DI, IC>
where DI: Unpin, IC: Unpin,

§

impl<DI, IC> UnwindSafe for Mcp4x<DI, IC>
where DI: UnwindSafe, IC: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.