capsules_extra::mcp230xx

Struct 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>,

Source§

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>,

Source§

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.