Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An I2C Multiplexer library that supports the PCA9546 and TCA9546A chips

License

NotificationsYou must be signed in to change notification settings

FloppyDisck/i2c-multiplexer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 thebus 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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp