Struct capsules_extra::mcp230xx::MCP230xx
source · 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