pub struct MCP230xx<'a, I: I2CDevice> { /* private fields */ }
Implementations§
Source§impl<'a, I: I2CDevice> MCP230xx<'a, I>
impl<'a, I: I2CDevice> MCP230xx<'a, I>
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>
Sourcepub fn set_client<C: Client>(&self, client: &'static C)
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> Port for MCP230xx<'_, I>
impl<I: I2CDevice> Port for MCP230xx<'_, I>
Source§fn disable(&self, pin: usize) -> Result<(), ErrorCode>
fn disable(&self, pin: usize) -> Result<(), ErrorCode>
Try to disable a GPIO pin. This cannot be supported for all devices.
Source§fn make_input(&self, pin: usize, mode: FloatingState) -> Result<(), ErrorCode>
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>
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 enable_interrupt(
&self,
pin: usize,
mode: InterruptEdge,
) -> Result<(), ErrorCode>
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>
fn disable_interrupt(&self, pin: usize) -> Result<(), ErrorCode>
Disable an interrupt on a GPIO input pin.
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> 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