Skip to content

Commit f982fa2

Browse files
authored
Add tca9548a driver
1 parent c4345a9 commit f982fa2

3 files changed

Lines changed: 326 additions & 0 deletions

File tree

peripherals/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ source "$PKGS_DIR/packages/peripherals/ins5t8025/Kconfig"
9292
source "$PKGS_DIR/packages/peripherals/irOnUart/Kconfig"
9393
source "$PKGS_DIR/packages/peripherals/st7305/Kconfig"
9494
source "$PKGS_DIR/packages/peripherals/tm1668/Kconfig"
95+
source "$PKGS_DIR/packages/peripherals/tca9548a/Kconfig"
9596

9697
if RT_VER_NUM > 0x40101
9798
source "$PKGS_DIR/packages/peripherals/spi-tools/Kconfig"

peripherals/tca9548a/Kconfig

Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
# Kconfig file for package TCA9548A (PW548A)
2+
menuconfig PKG_USING_TCA9548A
3+
bool "TCA9548A: Low Voltage 8-Channel I2C Switch with Reset (PW548A)"
4+
default n
5+
select RT_USING_I2C
6+
help
7+
The TCA9548A (chip marking: PW548A) is a low-voltage 8-channel I2C
8+
switch with reset from Texas Instruments. It features 1-to-8
9+
bidirectional translating switches controlled via I2C bus,
10+
allowing voltage-level translation between 1.8V, 2.5V, 3.3V,
11+
and 5V buses.
12+
13+
if PKG_USING_TCA9548A
14+
15+
config PKG_TCA9548A_PATH
16+
string
17+
default "/packages/peripherals/tca9548a"
18+
19+
config TCA9548A_USING_EXAMPLE
20+
bool "Enable TCA9548A example"
21+
default n
22+
help
23+
Enable the TCA9548A example code to demonstrate basic usage
24+
including device scanning, channel switching, and reset.
25+
26+
menu "TCA9548A Device Configuration"
27+
28+
config TCA9548A_DEV0_ENABLE
29+
bool "Device 0 - Enable"
30+
default y
31+
help
32+
Enable the first TCA9548A device.
33+
Each device can be on any I2C bus with any valid address.
34+
35+
if TCA9548A_DEV0_ENABLE
36+
37+
config TCA9548A_DEV0_BUS_NAME
38+
string "Device 0 - I2C bus name"
39+
default "i2c1"
40+
help
41+
The I2C bus device name this TCA9548A is connected to
42+
(e.g., "i2c1", "i2c0", "i2c2").
43+
44+
config TCA9548A_DEV0_ADDR
45+
hex "Device 0 - I2C address (7-bit)"
46+
range 0x70 0x77
47+
default 0x70
48+
help
49+
The 7-bit I2C address of this TCA9548A device.
50+
Valid range: 0x70 - 0x77 (determined by A0, A1, A2 hardware pins).
51+
52+
config TCA9548A_DEV0_NAME
53+
string "Device 0 - Device name"
54+
default "tca9548a_0"
55+
help
56+
A unique name for this TCA9548A device instance.
57+
Used to identify the device in the application code
58+
via tca9548a_find("tca9548a_0").
59+
60+
endif
61+
62+
config TCA9548A_DEV1_ENABLE
63+
bool "Device 1 - Enable"
64+
depends on TCA9548A_DEV0_ENABLE
65+
default n
66+
help
67+
Enable the second TCA9548A device.
68+
Only available when Device 0 is enabled.
69+
70+
if TCA9548A_DEV1_ENABLE
71+
72+
config TCA9548A_DEV1_BUS_NAME
73+
string "Device 1 - I2C bus name"
74+
default "i2c1"
75+
help
76+
The I2C bus device name this TCA9548A is connected to.
77+
78+
config TCA9548A_DEV1_ADDR
79+
hex "Device 1 - I2C address (7-bit)"
80+
range 0x70 0x77
81+
default 0x70
82+
help
83+
The 7-bit I2C address of this TCA9548A device.
84+
85+
config TCA9548A_DEV1_NAME
86+
string "Device 1 - Device name"
87+
default "tca9548a_1"
88+
help
89+
A unique name for this TCA9548A device instance.
90+
91+
endif
92+
93+
config TCA9548A_DEV2_ENABLE
94+
bool "Device 2 - Enable"
95+
depends on TCA9548A_DEV1_ENABLE
96+
default n
97+
help
98+
Enable the third TCA9548A device.
99+
Only available when Device 1 is enabled.
100+
101+
if TCA9548A_DEV2_ENABLE
102+
103+
config TCA9548A_DEV2_BUS_NAME
104+
string "Device 2 - I2C bus name"
105+
default "i2c1"
106+
help
107+
The I2C bus device name this TCA9548A is connected to.
108+
109+
config TCA9548A_DEV2_ADDR
110+
hex "Device 2 - I2C address (7-bit)"
111+
range 0x70 0x77
112+
default 0x70
113+
help
114+
The 7-bit I2C address of this TCA9548A device.
115+
116+
config TCA9548A_DEV2_NAME
117+
string "Device 2 - Device name"
118+
default "tca9548a_2"
119+
help
120+
A unique name for this TCA9548A device instance.
121+
122+
endif
123+
124+
config TCA9548A_DEV3_ENABLE
125+
bool "Device 3 - Enable"
126+
depends on TCA9548A_DEV2_ENABLE
127+
default n
128+
help
129+
Enable the fourth TCA9548A device.
130+
Only available when Device 2 is enabled.
131+
132+
if TCA9548A_DEV3_ENABLE
133+
134+
config TCA9548A_DEV3_BUS_NAME
135+
string "Device 3 - I2C bus name"
136+
default "i2c1"
137+
help
138+
The I2C bus device name this TCA9548A is connected to.
139+
140+
config TCA9548A_DEV3_ADDR
141+
hex "Device 3 - I2C address (7-bit)"
142+
range 0x70 0x77
143+
default 0x70
144+
help
145+
The 7-bit I2C address of this TCA9548A device.
146+
147+
config TCA9548A_DEV3_NAME
148+
string "Device 3 - Device name"
149+
default "tca9548a_3"
150+
help
151+
A unique name for this TCA9548A device instance.
152+
153+
endif
154+
155+
config TCA9548A_DEV4_ENABLE
156+
bool "Device 4 - Enable"
157+
depends on TCA9548A_DEV3_ENABLE
158+
default n
159+
help
160+
Enable the fifth TCA9548A device.
161+
Only available when Device 3 is enabled.
162+
163+
if TCA9548A_DEV4_ENABLE
164+
165+
config TCA9548A_DEV4_BUS_NAME
166+
string "Device 4 - I2C bus name"
167+
default "i2c1"
168+
help
169+
The I2C bus device name this TCA9548A is connected to.
170+
171+
config TCA9548A_DEV4_ADDR
172+
hex "Device 4 - I2C address (7-bit)"
173+
range 0x70 0x77
174+
default 0x70
175+
help
176+
The 7-bit I2C address of this TCA9548A device.
177+
178+
config TCA9548A_DEV4_NAME
179+
string "Device 4 - Device name"
180+
default "tca9548a_4"
181+
help
182+
A unique name for this TCA9548A device instance.
183+
184+
endif
185+
186+
config TCA9548A_DEV5_ENABLE
187+
bool "Device 5 - Enable"
188+
depends on TCA9548A_DEV4_ENABLE
189+
default n
190+
help
191+
Enable the sixth TCA9548A device.
192+
Only available when Device 4 is enabled.
193+
194+
if TCA9548A_DEV5_ENABLE
195+
196+
config TCA9548A_DEV5_BUS_NAME
197+
string "Device 5 - I2C bus name"
198+
default "i2c1"
199+
help
200+
The I2C bus device name this TCA9548A is connected to.
201+
202+
config TCA9548A_DEV5_ADDR
203+
hex "Device 5 - I2C address (7-bit)"
204+
range 0x70 0x77
205+
default 0x70
206+
help
207+
The 7-bit I2C address of this TCA9548A device.
208+
209+
config TCA9548A_DEV5_NAME
210+
string "Device 5 - Device name"
211+
default "tca9548a_5"
212+
help
213+
A unique name for this TCA9548A device instance.
214+
215+
endif
216+
217+
config TCA9548A_DEV6_ENABLE
218+
bool "Device 6 - Enable"
219+
depends on TCA9548A_DEV5_ENABLE
220+
default n
221+
help
222+
Enable the seventh TCA9548A device.
223+
Only available when Device 5 is enabled.
224+
225+
if TCA9548A_DEV6_ENABLE
226+
227+
config TCA9548A_DEV6_BUS_NAME
228+
string "Device 6 - I2C bus name"
229+
default "i2c1"
230+
help
231+
The I2C bus device name this TCA9548A is connected to.
232+
233+
config TCA9548A_DEV6_ADDR
234+
hex "Device 6 - I2C address (7-bit)"
235+
range 0x70 0x77
236+
default 0x70
237+
help
238+
The 7-bit I2C address of this TCA9548A device.
239+
240+
config TCA9548A_DEV6_NAME
241+
string "Device 6 - Device name"
242+
default "tca9548a_6"
243+
help
244+
A unique name for this TCA9548A device instance.
245+
246+
endif
247+
248+
config TCA9548A_DEV7_ENABLE
249+
bool "Device 7 - Enable"
250+
depends on TCA9548A_DEV6_ENABLE
251+
default n
252+
help
253+
Enable the eighth TCA9548A device.
254+
Only available when Device 6 is enabled.
255+
256+
if TCA9548A_DEV7_ENABLE
257+
258+
config TCA9548A_DEV7_BUS_NAME
259+
string "Device 7 - I2C bus name"
260+
default "i2c1"
261+
help
262+
The I2C bus device name this TCA9548A is connected to.
263+
264+
config TCA9548A_DEV7_ADDR
265+
hex "Device 7 - I2C address (7-bit)"
266+
range 0x70 0x77
267+
default 0x70
268+
help
269+
The 7-bit I2C address of this TCA9548A device.
270+
271+
config TCA9548A_DEV7_NAME
272+
string "Device 7 - Device name"
273+
default "tca9548a_7"
274+
help
275+
A unique name for this TCA9548A device instance.
276+
277+
endif
278+
279+
endmenu
280+
281+
choice
282+
prompt "Version"
283+
default PKG_USING_TCA9548A_LATEST_VERSION
284+
help
285+
Select the package version
286+
287+
config PKG_USING_TCA9548A_V100
288+
bool "v1.0.0"
289+
290+
config PKG_USING_TCA9548A_LATEST_VERSION
291+
bool "latest"
292+
endchoice
293+
294+
config PKG_TCA9548A_VER
295+
string
296+
default "v1.0.0" if PKG_USING_TCA9548A_V100
297+
default "latest" if PKG_USING_TCA9548A_LATEST_VERSION
298+
299+
endif

peripherals/tca9548a/package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "tca9548a",
3+
"description": "TCA9548A (PW548A) Low Voltage 8-Channel I2C Switch with Reset driver",
4+
"description_zh": "TCA9548A (PW548A) 低电压8通道I2C开关驱动,支持复位和电压电平转换",
5+
"enable": "PKG_USING_TCA9548A",
6+
"keywords": ["tca9548a","pw548a","i2c","switch","multiplexer","rt-thread"],
7+
"category": "peripherals",
8+
"author": {
9+
"name": "WennianYan",
10+
"email": "yanwennian@yeah.net",
11+
"github": "WennianYan"
12+
},
13+
"license": "Apache-2.0",
14+
"repository": "https://github.com/WennianYan/TCA9548A",
15+
"icon": "unknown",
16+
"homepage": "https://github.com/WennianYan/TCA9548A#readme",
17+
"doc": "unknown",
18+
"site": [
19+
{
20+
"version": "latest",
21+
"URL": "https://github.com/WennianYan/TCA9548A.git",
22+
"filename": "",
23+
"VER_SHA": "main"
24+
}
25+
]
26+
}

0 commit comments

Comments
 (0)