### Generic TypeId Implementation Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Provides a method to get the TypeId of any type T, as part of blanket implementations. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Get Type ID Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Gets the `TypeId` of the `Address` struct. This is a generic implementation for any type `T` that is `'static` and `?Sized`. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Tca9554::new Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Creates a new driver instance for the TCA9554 I/O expander. ```APIDOC ## Tca9554::new ### Description Creates a new driver with the given I²C peripheral and address. ### Signature ```rust pub fn new(i2c: I2C, address: Address) -> Self ``` ``` -------------------------------- ### Tca9554 Driver Initialization and Management Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Provides methods for creating a new driver instance, retrieving the I2C address, and releasing the I2C peripheral. ```APIDOC ## `Tca9554` ### Description Driver for a TCA9554(A) I/O expander. ### Methods #### `new(i2c: I2C, address: Address) -> Self` Creates a new driver with the given I²C peripheral and address. #### `address(&self) -> Address` Gets the I²C used by the driver. #### `release(self) -> I2C` Releases the driver, returning ownership of the I²C peripheral. ``` -------------------------------- ### TCA9554 Driver Initialization Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Creates a new driver instance for the TCA9554 I/O expander. Requires an I2C peripheral and the device's address. ```rust pub fn new(i2c: I2C, address: Address) -> Self { Self { i2c, address } } ``` -------------------------------- ### Clone To Uninitialized Memory (Nightly) Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Performs copy-assignment from the `Address` struct to uninitialized memory. This is a nightly-only experimental API. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Identity Conversion Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Returns the argument unchanged. This is a generic implementation of `From for T`. ```rust fn from(t: T) -> T ``` -------------------------------- ### TCA9554 Utility Functions Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Provides utility methods for resetting the device to its power-on defaults and checking if the device is currently in its default state. ```APIDOC ## Utility Functions ### Methods #### `reset(&mut self) -> Result<(), E>` Writes the state of the registers to the chip's power-on defaults. #### `is_in_default_state(&mut self) -> Result` Returns whether or not the current state of the registers matches the chip's power-on defaults. When the chip is functioning properly, the registers will match the power-on defaults after power has been applied or after a call to [`Self::reset()`]. ``` -------------------------------- ### Address Representation and Construction Source: https://docs.rs/tca9554/0.1.1/src/tca9554/address.rs.html Defines the `Address` struct to hold a 7-bit I2C address and provides methods to create addresses for standard and alternate chip variants, as well as to set user-selectable bits. ```APIDOC ## Struct Address ### Description Represents the I2C address for a TCA9554(A) I/O expander. ### Methods #### `standard()` - **Description**: Returns the I2C address for the standard variant of the chip (model TCA9554). - **Returns**: `Address` #### `alternate()` - **Description**: Returns the I2C address for the alternate variant of the chip (model TCA9554A). - **Returns**: `Address` #### `with_selectable_bits(ax: (bool, bool, bool))` - **Description**: Sets the user-selectable, rightmost bits in the address: `(a3, a2, a1)`. The input tuple corresponds to the `a2`, `a1`, and `a0` bits respectively. - **Parameters**: - `ax` (bool, bool, bool): A tuple representing the state of the selectable bits. - **Returns**: `Address` ### Type Conversion #### `From
for SevenBitAddress` - **Description**: Converts an `Address` struct into a `SevenBitAddress`. ``` -------------------------------- ### Try Convert Into Another Type Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Attempts to convert the `Address` into another type `U` using `TryInto`. This relies on the `TryFrom for U` trait implementation and returns a `Result`. ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Convert Address to SevenBitAddress Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Converts an `Address` struct into a `SevenBitAddress` type. This is part of the `From
for SevenBitAddress` trait implementation. ```rust fn from(val: Address) -> Self ``` -------------------------------- ### Tca9554::release Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Releases the driver and returns ownership of the I²C peripheral. ```APIDOC ## Tca9554::release ### Description Releases the driver, returning ownership of the I²C peripheral. ### Signature ```rust pub fn release(self) -> I2C ``` ``` -------------------------------- ### Address::standard Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Creates an Address for the standard variant of the TCA9554 chip. ```APIDOC ## Address::standard ### Description Address for the standard variant of the chip (model TCA9554). ### Method `pub fn standard() -> Self` ``` -------------------------------- ### Clone From Address Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Performs copy-assignment from a source I2C address to the current one. This is part of the `Clone` trait implementation. ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Tca9554 New Function Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Creates a new Tca9554 driver instance. Requires an I2C peripheral and the device's I2C address. ```rust pub fn new(i2c: I2C, address: Address) -> Self ``` -------------------------------- ### Try Convert From Another Type Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Attempts to convert from another type `U` into `Address`. This relies on the `TryFrom for T` trait implementation and returns a `Result`. ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### Address::alternate Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Creates an Address for the alternate variant of the TCA9554A chip. ```APIDOC ## Address::alternate ### Description Address for the alternate variant of the chip (model TCA9554A). ### Method `pub fn alternate() -> Self` ``` -------------------------------- ### Generic TryInto Implementation Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Provides fallible conversion from type T into type U, as part of blanket implementations. The error type is determined by U's TryFrom implementation. ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Create Standard TCA9554 Address Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Creates an I2C address for the standard variant of the TCA9554 chip. This is the default address when the model does not end in 'A'. ```rust pub fn standard() -> Self ``` -------------------------------- ### Set Selectable Address Bits Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Sets the user-selectable, rightmost bits in the I2C address. This allows for fine-tuning the address based on the `(a3, a2, a1)` configuration. ```rust pub fn with_selectable_bits(self, ax: (bool, bool, bool)) -> Self ``` -------------------------------- ### Tca9554::write_direction Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Writes new pin direction settings. ```APIDOC ## Tca9554::write_direction ### Description Writes the value of the direction register. ### Signature ```rust pub async fn write_direction(&mut self, state: u8) -> Result<(), E> ``` ``` -------------------------------- ### Clone Address Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Returns a duplicate of the I2C address value. This is part of the `Clone` trait implementation. ```rust fn clone(&self) -> Address ``` -------------------------------- ### TCA9554 Standard Address Test Source: https://docs.rs/tca9554/0.1.1/src/tca9554/address.rs.html Verifies that the `Address::standard()` method returns the correct I2C address for the standard TCA9554 variant. ```rust #[test] fn test_standard() { let addr: SevenBitAddress = Address::standard().into(); assert_eq!(addr, 0x20); } ``` -------------------------------- ### Generic TryFrom Implementation Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Provides fallible conversion from type U into type T, as part of blanket implementations. The error type is Infallible. ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### Tca9554::write_polarity Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Writes new polarity inversion settings. ```APIDOC ## Tca9554::write_polarity ### Description Writes the value of polarity inversion register. ### Signature ```rust pub async fn write_polarity(&mut self, state: u8) -> Result<(), E> ``` ``` -------------------------------- ### Check if Registers Match Default State Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Asynchronously checks if the current state of the registers matches the chip's power-on defaults. This is useful for verifying proper functioning after power-up or reset. Requires the I2C peripheral to implement the I2c trait. ```rust pub async fn is_in_default_state(&mut self) -> Result ``` -------------------------------- ### Create Alternate TCA9554A Address Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Creates an I2C address for the alternate variant of the TCA9554 chip, typically models ending in 'A'. ```rust pub fn alternate() -> Self ``` -------------------------------- ### Format Address for Debugging Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Formats the I2C address value for debugging output using the given formatter. This is part of the `Debug` trait implementation. ```rust fn fmt(&self, f: &mut Formatter<'_>) -> Result ``` -------------------------------- ### Write Output Register Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Asynchronously writes a new state to the output register. Requires the I2C peripheral to implement the I2c trait. ```rust pub async fn write_output(&mut self, state: u8) -> Result<(), E> ``` -------------------------------- ### Read Input Register Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Asynchronously reads the current state of the input register. Requires the I2C peripheral to implement the I2c trait. ```rust pub async fn read_input(&mut self) -> Result ``` -------------------------------- ### Address::with_selectable_bits Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Sets the user-selectable, rightmost bits (a3, a2, a1) in the I2C address. ```APIDOC ## Address::with_selectable_bits ### Description Sets the user selectable, rightmost bits in the address: `(a3, a2, a1)`. ### Method `pub fn with_selectable_bits(self, ax: (bool, bool, bool)) -> Self` ``` -------------------------------- ### Read Output Register Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Asynchronously reads the current state of the output register. Requires the I2C peripheral to implement the I2c trait. ```rust pub async fn read_output(&mut self) -> Result ``` -------------------------------- ### Write Direction Register Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Asynchronously writes a new state to the direction register. Requires the I2C peripheral to implement the I2c trait. ```rust pub async fn write_direction(&mut self, state: u8) -> Result<(), E> ``` -------------------------------- ### Tca9554::read_polarity Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Reads the current polarity inversion settings. ```APIDOC ## Tca9554::read_polarity ### Description Reads the value of the polarity inversion register. ### Signature ```rust pub async fn read_polarity(&mut self) -> Result ``` ``` -------------------------------- ### Write Polarity Inversion Register Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Asynchronously writes a new state to the polarity inversion register. Requires the I2C peripheral to implement the I2c trait. ```rust pub async fn write_polarity(&mut self, state: u8) -> Result<(), E> ``` -------------------------------- ### Tca9554 Release I2C Peripheral Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Releases ownership of the I2C peripheral, returning it to the caller. ```rust pub fn release(self) -> I2C ``` -------------------------------- ### Convert Into Another Type Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Calls `U::from(self)` to convert the `Address` into another type `U`. This relies on the `From for U` trait implementation. ```rust fn into(self) -> U ``` -------------------------------- ### TCA9554 Alternate Address Test Source: https://docs.rs/tca9554/0.1.1/src/tca9554/address.rs.html Verifies that the `Address::alternate()` method returns the correct I2C address for the alternate TCA9554A variant. ```rust #[test] fn test_alternate() { let addr: SevenBitAddress = Address::alternate().into(); assert_eq!(addr, 0x38); } ``` -------------------------------- ### Tca9554::read_direction Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Reads the current pin direction settings. ```APIDOC ## Tca9554::read_direction ### Description Reads the value of the direction register. ### Signature ```rust pub async fn read_direction(&mut self) -> Result ``` ``` -------------------------------- ### Tca9554::is_in_default_state Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Checks if the chip's registers are currently in their power-on default state. ```APIDOC ## Tca9554::is_in_default_state ### Description Returns whether or not the current state of the registers matches the chip’s power-on defaults. When the chip is functioning properly, the registers will match the power-on defaults after power has been applied or after a call to `Self::reset()`. ### Signature ```rust pub async fn is_in_default_state(&mut self) -> Result ``` ``` -------------------------------- ### Define TCA9554 Address Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Defines the structure for an I2C address for the TCA9554(A) I/O expander. Use `Self::standard` for the standard variant and `Self::alternate` for the alternate variant. ```rust pub struct Address(/* private fields */); ``` -------------------------------- ### Read Polarity Inversion Register Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Asynchronously reads the polarity inversion register. Requires the I2C peripheral to implement the I2c trait. ```rust pub async fn read_polarity(&mut self) -> Result ``` -------------------------------- ### Read Direction Register Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Asynchronously reads the direction register. Requires the I2C peripheral to implement the I2c trait. ```rust pub async fn read_direction(&mut self) -> Result ``` -------------------------------- ### TCA9554 Address Struct Definition Source: https://docs.rs/tca9554/0.1.1/src/tca9554/address.rs.html Defines the `Address` struct for I2C communication with TCA9554 devices. It wraps a `SevenBitAddress` and provides methods for initialization and configuration. ```rust use embedded_hal_async::i2c::SevenBitAddress; /// I2C address for a TCA9554(A) I/O expander. /// /// For the standard variant (model not ending in 'A'), use [`Self::standard`]. /// Otherwise, use [`Self::alternate`]. /// /// Datasheet reference: section 8.6.1, figure 19. /// #[derive(Debug, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Address(SevenBitAddress); impl Address { /// Address for the standard variant of the chip (model TCA9554). pub fn standard() -> Self { Self(0x40 >> 1) } /// Address for the alternate variant of the chip (model TCA9554A). pub fn alternate() -> Self { Self(0x70 >> 1) } /// Sets the user selectable, rightmost bits in the address: `(a3, a2, a1)`. pub fn with_selectable_bits(self, ax: (bool, bool, bool)) -> Self { let (a2, a1, a0) = ax; let bits = ((a2 as u8) << 2) | ((a1 as u8) << 1) | a0 as u8; Self(self.0 | bits) } } impl From
for SevenBitAddress { fn from(val: Address) -> Self { val.0 } } ``` -------------------------------- ### Tca9554::read_input Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Reads the current state of the input register. ```APIDOC ## Tca9554::read_input ### Description Reads the value of the input register. ### Signature ```rust pub async fn read_input(&mut self) -> Result ``` ``` -------------------------------- ### Tca9554::read_output Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Reads the current state of the output register. ```APIDOC ## Tca9554::read_output ### Description Reads the value of the output register. ### Signature ```rust pub async fn read_output(&mut self) -> Result ``` ``` -------------------------------- ### TCA9554 Register Operations Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Provides asynchronous methods for reading from and writing to the TCA9554's input, output, polarity, and direction registers. ```APIDOC ## Register Operations ### Methods #### `read_input(&mut self) -> Result` Reads the value of the input register. #### `read_output(&mut self) -> Result` Reads the value of the output register. #### `write_output(&mut self, state: u8) -> Result<(), E>` Writes the value of the output register. #### `read_polarity(&mut self) -> Result` Reads the value of the polarity inversion register. #### `write_polarity(&mut self, state: u8) -> Result<(), E>` Writes the value of polarity inversion register. #### `read_direction(&mut self) -> Result` Reads the value of the direction register. #### `write_direction(&mut self, state: u8) -> Result<(), E>` Writes the value of the direction register. ``` -------------------------------- ### TCA9554 Driver Release I2C Peripheral Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Releases the driver and returns ownership of the underlying I2C peripheral. This is useful when the driver is no longer needed. ```rust pub fn release(self) -> I2C { self.i2c } ``` -------------------------------- ### Reset Tca9554 Registers Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Asynchronously writes the chip's power-on default states to all registers. Requires the I2C peripheral to implement the I2c trait. ```rust pub async fn reset(&mut self) -> Result<(), E> ``` -------------------------------- ### Tca9554::write_output Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Writes a new state to the output register. ```APIDOC ## Tca9554::write_output ### Description Writes the value of the output register. ### Signature ```rust pub async fn write_output(&mut self, state: u8) -> Result<(), E> ``` ``` -------------------------------- ### Check if TCA9554 is in Default State Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Verifies if the current state of the TCA9554's registers matches the chip's power-on defaults. This is useful after power-up or a reset. This operation is asynchronous. ```rust pub async fn is_in_default_state(&mut self) -> Result { Ok(self.read_direction().await? == DIRECTION_REGISTER_DEFAULT && self.read_polarity().await? == POLARITY_REGISTER_DEFAULT && self.read_output().await? == OUTPUT_REGISTER_DEFAULT) } ``` -------------------------------- ### Borrow Address Immutably Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Immutably borrows the `Address` struct. This is a generic implementation for borrowing any type `T`. ```rust fn borrow(&self) -> &T ``` -------------------------------- ### Tca9554::reset Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Resets the chip's registers to their power-on defaults. ```APIDOC ## Tca9554::reset ### Description Writes the state of the registers to the chip’s power-on defaults. ### Signature ```rust pub async fn reset(&mut self) -> Result<(), E> ``` ``` -------------------------------- ### TCA9554 Driver Address Access Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Retrieves the I2C address configured for the TCA9554 driver instance. ```rust pub fn address(&self) -> Address { self.address } ``` -------------------------------- ### Tca9554 Address Getter Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Retrieves the I2C address currently used by the Tca9554 driver. ```rust pub fn address(&self) -> Address ``` -------------------------------- ### Write TCA9554 Polarity Register Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Writes new polarity inversion settings to the TCA9554's polarity register. This operation is asynchronous. ```rust pub async fn write_polarity(&mut self, state: u8) -> Result<(), E> { self.write_register(Register::Polarity, state).await } ``` -------------------------------- ### Tca9554::address Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Retrieves the I²C address used by the driver. ```APIDOC ## Tca9554::address ### Description Gets the I²C used by the driver. ### Signature ```rust pub fn address(&self) -> Address ``` ``` -------------------------------- ### Write TCA9554 Direction Register Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Writes new pin direction settings to the TCA9554's direction register. This operation is asynchronous. ```rust pub async fn write_direction(&mut self, state: u8) -> Result<(), E> { self.write_register(Register::Direction, state).await } ``` -------------------------------- ### Read TCA9554 Input Register Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Reads the current state of the input pins from the TCA9554's input register. This operation is asynchronous. ```rust pub async fn read_input(&mut self) -> Result { self.read_register(Register::Input).await } ``` -------------------------------- ### Tca9554 Sync Trait Implementation Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Implements the Sync trait for Tca9554, allowing it to be safely shared between threads if the underlying I2C peripheral is Sync. ```rust impl Sync for Tca9554 where I2C: Sync, ``` -------------------------------- ### TCA9554 Selectable Bits Address Test Source: https://docs.rs/tca9554/0.1.1/src/tca9554/address.rs.html Tests the `with_selectable_bits` method to ensure it correctly modifies the I2C address based on the provided user-selectable bits. ```rust #[test] fn test_with_selectable_bits() { let addr: SevenBitAddress = Address::standard() .with_selectable_bits((false, true, false)) .into(); assert_eq!(addr, 0x22); } ``` -------------------------------- ### Read TCA9554 Output Register Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Reads the current state of the output pins from the TCA9554's output register. This operation is asynchronous. ```rust pub async fn read_output(&mut self) -> Result { self.read_register(Register::Output).await } ``` -------------------------------- ### Read TCA9554 Polarity Register Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Reads the polarity inversion settings from the TCA9554's polarity register. This operation is asynchronous. ```rust pub async fn read_polarity(&mut self) -> Result { self.read_register(Register::Polarity).await } ``` -------------------------------- ### Write TCA9554 Output Register Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Writes a new state to the TCA9554's output register, controlling the state of the output pins. This operation is asynchronous. ```rust pub async fn write_output(&mut self, state: u8) -> Result<(), E> { self.write_register(Register::Output, state).await } ``` -------------------------------- ### Read from TCA9554 Register Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Internal helper function to read a value from a specific TCA9554 register. This is an asynchronous operation. ```rust async fn read_register(&mut self, register: Register) -> Result { let mut read_buf = [0u8]; self.i2c .write_read(self.address.into(), &[register as u8], &mut read_buf) .await?; Ok(read_buf[0]) } ``` -------------------------------- ### Reset TCA9554 Registers to Defaults Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Resets all configurable registers (Direction, Polarity, Output) of the TCA9554 to their power-on default values. This operation is asynchronous. ```rust pub async fn reset(&mut self) -> Result<(), E> { self.write_direction(DIRECTION_REGISTER_DEFAULT).await?; self.write_polarity(POLARITY_REGISTER_DEFAULT).await?; self.write_output(OUTPUT_REGISTER_DEFAULT).await?; Ok(()) } ``` -------------------------------- ### Write to TCA9554 Register Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Internal helper function to write a value to a specific TCA9554 register. This is an asynchronous operation. ```rust async fn write_register(&mut self, register: Register, value: u8) -> Result<(), E> { self.i2c .write(self.address.into(), &[register as u8, value]) .await?; Ok(()) } ``` -------------------------------- ### Read TCA9554 Direction Register Source: https://docs.rs/tca9554/0.1.1/src/tca9554/driver.rs.html Reads the pin direction settings from the TCA9554's direction register. This operation is asynchronous. ```rust pub async fn read_direction(&mut self) -> Result { self.read_register(Register::Direction).await } ``` -------------------------------- ### Borrow Address Mutably Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Address.html Mutably borrows the `Address` struct. This is a generic implementation for mutable borrowing of any type `T`. ```rust fn borrow_mut(&mut self) -> &mut T ``` -------------------------------- ### Tca9554 Struct Definition Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Defines the Tca9554 driver struct, which is generic over the I2C peripheral type. ```rust pub struct Tca9554 { /* private fields */ } ``` -------------------------------- ### Tca9554 Freeze Trait Implementation Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Implements the Freeze trait for Tca9554, allowing it to be frozen if the underlying I2C peripheral also implements Freeze. ```rust impl Freeze for Tca9554 where I2C: Freeze, ``` -------------------------------- ### Tca9554 Send Trait Implementation Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Implements the Send trait for Tca9554, allowing it to be sent across threads if the underlying I2C peripheral is Send. ```rust impl Send for Tca9554 where I2C: Send, ``` -------------------------------- ### Tca9554 Unpin Trait Implementation Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Implements the Unpin trait for Tca9554, indicating that it does not need to be pinned in memory. ```rust impl Unpin for Tca9554 where I2C: Unpin, ``` -------------------------------- ### Tca9554 RefUnwindSafe Trait Implementation Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Implements the RefUnwindSafe trait for Tca9554, indicating that references to it are safe to unwind across. ```rust impl RefUnwindSafe for Tca9554 where I2C: RefUnwindSafe, ``` -------------------------------- ### Tca9554 UnwindSafe Trait Implementation Source: https://docs.rs/tca9554/0.1.1/tca9554/struct.Tca9554.html Implements the UnwindSafe trait for Tca9554, indicating that it is safe to unwind across. ```rust impl UnwindSafe for Tca9554 where I2C: UnwindSafe, ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.