TCA9548A 8 channel I2C switch with reset
Dependents: 4012Code PWM SBra_Programme_Mbed
TCA9548A Class Reference
#include <tca9548a.h>
Public Member Functions | |
TCA9548A (PinName sda, PinName scl, uint8_t i2c_address=0x70, PinName resetPin=NC, uint32_t hz=400000) | |
Create a TCA9546A instance connected to specified I2C pins with specified address. | |
void | select (uint8_t channel) |
Selecting a channel. | |
void | reset () |
Reset TCA9546A. |
Detailed Description
TCA9548A class.
DESCRIPTION
TCA9548A: Low-Voltage 8-Channel I2C Switch With Reset The TCA9548A device has eight bidirectional translating switches that can be controlled through the I2C bus. The SCL/SDA upstream pair fans out to eight downstream pairs, or channels. Any individual SCn/SDn channel or combination of channels can be selected, determined by the contents of the programmable control register.
The TCA9548A has a user 8 selectable address in the range 0x70 thru 0x77 (7-bit), based on the configuration of Addr pins (A0, A1, A2). Default address is 0x70 for A0:A2 pull down.
Datasheet for TCA9548A can be found at: http://www.ti.com/lit/ds/symlink/tca9548a.pdf
Example:
#include "mbed.h" #include "LM75B.h" #include "TCA9548A.h" TCA9548A i2c_sw(I2C_SDA, I2C_SCL); //default address 0x70 applied int main() { // By default TCA9548A performs a power on reset and all downstream ports are deselected i2c_sw.select(0); // select the channel 0 LM75B tmp0(I2C_SDA, I2C_SCL); // making instance after a branch of I2C bus (which is connecting the LM75B) enabled i2c_sw.select(1); // select the channel 1 LM75B tmp1(I2C_SDA, I2C_SCL); // making instance after a branch of I2C bus (which is connecting the LM75B) enabled while(1) { i2c_sw.select(0); // select the channel 0 printf( "%.3f\r\n", tmp0.read() ); i2c_sw.select(1); // select the channel 1 printf( "%.3f\r\n", tmp1.read() ); wait( 1.0 ); } }
Definition at line 83 of file tca9548a.h.
Constructor & Destructor Documentation
TCA9548A | ( | PinName | sda, |
PinName | scl, | ||
uint8_t | i2c_address = 0x70 , |
||
PinName | resetPin = NC , |
||
uint32_t | hz = 400000 |
||
) |
Create a TCA9546A instance connected to specified I2C pins with specified address.
TCA9548A library.
- Parameters:
-
sda I2C-bus SDA pin scl I2C-bus SCL pin i2c_address I2C-bus address (default: 0x70) reset TCA9546A reset pin (default: NC for simple pullup connected) hz I2C bus frequency (default: 400kHz)
- Version:
- 0.1
- Date:
- May/24/2016
Definition at line 12 of file tca9548a.cpp.
Member Function Documentation
void reset | ( | ) |
void select | ( | uint8_t | channel ) |
Selecting a channel.
Switch to commended downstream I2C channel
- Parameters:
-
channel channel number
Definition at line 19 of file tca9548a.cpp.
Generated on Fri Jul 15 2022 12:20:07 by
