Struct mcp23x17::Mcp23x17

source ·
pub struct Mcp23x17<I2C> { /* private fields */ }
Expand description

16bit GPIO Expander

Implementations

Create a new instance of the GPIO expander

This chip optionally splits its registers between two eight bit ports or virtuall one large 16 bit port. This function sets the port internally.

Set the I/O direction for the currently active port. A value of 1 is for input, 0 for output

Get the I/O direction for the active port

Set configuration register. Given the structure of this library and how the chip can rearrange its registers, any attempt to set the BANK bit will be masked to zero.

Read the data state from the active port

Set the pullups. A value of 1 enables the 100KOhm pullup.

Get the pullups.

Read interrupt state. Each pin that caused an interrupt will have a bit is set. Not settable.

The value will be reset after a read from data_at_interrupt or data().

GPIO value at time of interrupt. It will remain latched to this value until another interrupt is fired. While it won’t reset on read, it does reset the interrupt state on the corresponding interrupt output pin

Set a comparison value for the interrupts. The interrupt will fire if the input value is different from what is set here

Read interrupt comparison value. Check set_int_compare() for more details

Decide how interrupts will fire. If a bit is set, the input data is compared against what’s set by int_compare(). If unset, the interrupt will fire when the pin has changed.

Read how interrupts will fire. More details on set_int_control().

Enable interrupts. If a bit is set, a change on this pin will trigger an interrupt. You’ll also need to call set_int_compare() and set_int_control()

Read the data state from the active port. See set_interrupt() for more details

Read output latches. This essentially reads the values set from calling set_data()

Set polarity allows inverting the values from input pins. A value of 1 will flip the polarity.

Read the data state from the active port

Set the data for the active port

Read the data state from the active port

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.