PCA9547: an I2C bus multiplexer control library. PCA9547 is an I2C multiplexer which enables to select 1:8 multiplexed I2C bus. The multiplexer is useful for deviding I2C bus to avoiding slave address conflict and separating capacitive loads. For more information about PCA9547: http://www.nxp.com/documents/data_sheet/PCA9547.pdf

Dependents:   pca9547_Hello m3Dpi

/media/uploads/okano/pca9547_connections.png

Information

For more information, please visit component page.

The PCA9547 is an octal bidirectional translating multiplexer controlled by the I2C-bus. The SCL/SDA upstream pair fans out to eight downstream pairs, or channels.

pca9547

Committer:
okano
Date:
Tue Jul 01 00:34:27 2014 +0000
Revision:
3:7e884a7805b1
Parent:
2:c3459a955c8c
Child:
4:3c0af4c37587
comment in .cpp file is corrected. previous version was having a header comment of LM75B library. Because this lib is made by modifying LM75B. I was forgetting to replace it :-)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okano 3:7e884a7805b1 1 /**
okano 3:7e884a7805b1 2 * PCA9547 library
okano 1:47f2cf4c6619 3 *
okano 3:7e884a7805b1 4 * @author Tedd OKANO
okano 3:7e884a7805b1 5 * @version 0.1
okano 3:7e884a7805b1 6 * @date July-2014
okano 3:7e884a7805b1 7 *
okano 3:7e884a7805b1 8 * PCA9547: an I2C bus multiplexer control library
okano 1:47f2cf4c6619 9 *
okano 3:7e884a7805b1 10 * PCA9547 is an I2C multiplexer which enables to select 1:8 multiplexed I2C bus.
okano 3:7e884a7805b1 11 * The multiplexer is useful for deviding I2C bus to avoiding slave address conflict and separating capacitive loads.
okano 1:47f2cf4c6619 12 *
okano 3:7e884a7805b1 13 * For more informatioj about PCA9547:
okano 3:7e884a7805b1 14 * http://www.nxp.com/documents/data_sheet/PCA9547.pdf
okano 3:7e884a7805b1 15 *
okano 1:47f2cf4c6619 16 */
okano 3:7e884a7805b1 17
okano 0:662ab6a5aa97 18 #include "PCA9547.h"
okano 0:662ab6a5aa97 19
okano 0:662ab6a5aa97 20 PCA9547::PCA9547( PinName sda, PinName scl, char i2c_address ) : i2c( sda, scl ), _i2c_addr( i2c_address )
okano 0:662ab6a5aa97 21 {
okano 0:662ab6a5aa97 22 // do nothing.
okano 0:662ab6a5aa97 23 // leave it in default state.
okano 0:662ab6a5aa97 24 }
okano 0:662ab6a5aa97 25
okano 0:662ab6a5aa97 26 PCA9547::~PCA9547()
okano 0:662ab6a5aa97 27 {
okano 0:662ab6a5aa97 28
okano 0:662ab6a5aa97 29 }
okano 0:662ab6a5aa97 30
okano 0:662ab6a5aa97 31 void PCA9547::select( char channel )
okano 0:662ab6a5aa97 32 {
okano 0:662ab6a5aa97 33 char data = 0x08 | channel;
okano 0:662ab6a5aa97 34
okano 2:c3459a955c8c 35 i2c.write( _i2c_addr, &data, 1 );
okano 0:662ab6a5aa97 36 }
okano 2:c3459a955c8c 37
okano 2:c3459a955c8c 38 void PCA9547::disable( void )
okano 2:c3459a955c8c 39 {
okano 2:c3459a955c8c 40 char data = 0x00;
okano 2:c3459a955c8c 41
okano 2:c3459a955c8c 42 i2c.write( _i2c_addr, &data, 1 );
okano 2:c3459a955c8c 43 }