Struct capsules_extra::mcp230xx::MCP230xx

source ·
pub struct MCP230xx<'a, I: I2CDevice> { /* private fields */ }

Implementations§

source§

impl<'a, I: I2CDevice> MCP230xx<'a, I>

source

pub fn new( i2c: &'a I, interrupt_pin_a: Option<&'a dyn InterruptValuePin<'a>>, interrupt_pin_b: Option<&'a dyn InterruptValuePin<'a>>, buffer: &'static mut [u8], bank_size: u8, number_of_banks: u8, ) -> MCP230xx<'a, I>

source

pub fn set_client<C: Client>(&self, client: &'static C)

Set the client of this MCP230xx when commands finish or interrupts occur. The identifier is simply passed back with the callback so that the upper layer can keep track of which device triggered.

Trait Implementations§

source§

impl<I: I2CDevice> ClientWithValue for MCP230xx<'_, I>

source§

fn fired(&self, value: u32)

source§

impl<I: I2CDevice> I2CClient for MCP230xx<'_, I>

source§

fn command_complete( &self, buffer: &'static mut [u8], _status: Result<(), Error>, )

Called when an I2C command completed. The error denotes whether the command completed successfully or if an error occured.
source§

impl<I: I2CDevice> Port for MCP230xx<'_, I>

source§

fn disable(&self, pin: usize) -> Result<(), ErrorCode>

Try to disable a GPIO pin. This cannot be supported for all devices.
source§

fn make_output(&self, pin: usize) -> Result<(), ErrorCode>

Configure a pin as an ouput GPIO.
source§

fn make_input(&self, pin: usize, mode: FloatingState) -> Result<(), ErrorCode>

Configure a pin as an input GPIO. Not all FloatingMode settings may be supported by a given device.
source§

fn read(&self, pin: usize) -> Result<(), ErrorCode>

Get the state (0 or 1) of an input pin. The value will be returned via a callback.
source§

fn toggle(&self, pin: usize) -> Result<(), ErrorCode>

Toggle an output GPIO pin.
source§

fn set(&self, pin: usize) -> Result<(), ErrorCode>

Assert a GPIO pin high.
source§

fn clear(&self, pin: usize) -> Result<(), ErrorCode>

Clear a GPIO pin low.
source§

fn enable_interrupt( &self, pin: usize, mode: InterruptEdge, ) -> Result<(), ErrorCode>

Setup an interrupt on a GPIO input pin. The identifier should be the port number and will be returned when the interrupt callback fires.
source§

fn disable_interrupt(&self, pin: usize) -> Result<(), ErrorCode>

Disable an interrupt on a GPIO input pin.
source§

fn is_pending(&self, _pin: usize) -> bool

Auto Trait Implementations§

§

impl<'a, I> !Freeze for MCP230xx<'a, I>

§

impl<'a, I> !RefUnwindSafe for MCP230xx<'a, I>

§

impl<'a, I> !Send for MCP230xx<'a, I>

§

impl<'a, I> !Sync for MCP230xx<'a, I>

§

impl<'a, I> Unpin for MCP230xx<'a, I>

§

impl<'a, I> !UnwindSafe for MCP230xx<'a, I>

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.