You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An I2C Multiplexer library that supports the PCA9546 and TCA9546A chips
Usage
The sensor is initialized
use i2c_multiplexer::prelude::*;fnmain() -> Result<()>{// Disable all ports and only enable port 0Multiplexer::new(i2c).with_ports_disabled()?.set_port(0,true)?;}
Changing Address
use i2c_multiplexer::prelude::*;fnmain() -> Result<()>{// Manually set the addressMultiplexer::new(i2c).with_address(0x72);// Or set it according to the selected hardware pins// This uses A0 which means the address is 0x71Multiplexer::new(i2c).with_address_pins(true,false,false);}
Setting multiple ports
use i2c_multiplexer::prelude::*;fnmain() -> Result<()>{// Manually set the ports 0,2 to enabled and 1,3 to disabledMultiplexer::new(i2c).with_ports([true,false,true,false])?;}
Initializing as bus using the bus flag
use i2c_multiplexer::prelude::*;fnmain() -> Result<()>{let i2c = SomeI2CInit;// Initialize multiplexerlet multiplexer = MultiplexerBus::new();// Setup the i2c portlet port = 0;letmut multiplexed_i2c = multiplexer.new_port(i2c, port);}
About
An I2C Multiplexer library that supports the PCA9546 and TCA9546A chips