Skip to content

Commit ef76fd1

Browse files
committed
I2C Manager Kconfig now generic
1 parent 0484387 commit ef76fd1

File tree

2 files changed

+96
-97
lines changed

2 files changed

+96
-97
lines changed

Kconfig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ menu "LVGL ESP Drivers"
44

55
rsource "lvgl_touch/Kconfig"
66

7-
rsource "i2c_manager/Kconfig"
7+
menu "I2C Port Settings"
8+
depends on LV_I2C && !HAVE_I2C_MANAGER
9+
10+
rsource "i2c_manager/Kconfig"
11+
12+
endmenu
813

914
endmenu

i2c_manager/Kconfig

Lines changed: 90 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,96 @@
1-
menu "I2C Port Settings"
2-
depends on LV_I2C && !HAVE_I2C_MANAGER
1+
menu "I2C Port 0"
32

4-
menu "I2C Port 0"
3+
config I2C_MANAGER_0_ENABLED
4+
bool "Enable I2C port 0"
5+
6+
if I2C_MANAGER_0_ENABLED
7+
config I2C_MANAGER_0_SDA
8+
int "SDA (GPIO pin)"
9+
config I2C_MANAGER_0_SCL
10+
int "SCL (GPIO pin)"
11+
config I2C_MANAGER_0_FREQ_HZ
12+
int "Frequency (Hz)"
13+
default 400000
14+
range 100000 5000000
15+
help
16+
The clock speed in Hz. Ranges from 100000 (100 kHz) to
17+
5000000 (5 Mhz). I2C busses that involve external wires may
18+
have to be slower, and the real maximum speed the bus will
19+
support depends on the value of the pullup resistors and the
20+
design of the overall circuit.
21+
config I2C_MANAGER_0_TIMEOUT
22+
int "R/W timeout (ms)"
23+
default 20
24+
range 10 1000
25+
help
26+
Timeout for I2C read and write operations. This does not
27+
include the time waiting for a lock.
28+
config I2C_MANAGER_0_LOCK_TIMEOUT
29+
int "Stale lock override (ms)"
30+
default 50
31+
range 10 1000
32+
help
33+
Timeout at which point an operation waiting for its turn on
34+
the port will assume that whatever set the lock has died and
35+
overrides it. Set this somewhat larger than the previous
36+
timeout.
37+
config I2C_MANAGER_0_PULLUPS
38+
bool "Use ESP32 built-in bus pull-up resistors"
39+
help
40+
The I2C bus needs resistors to make sure it's in a defined
41+
state when nobody is talking. Many circuits have external
42+
pullup resistors already and turning these on will increase
43+
power consumption slightly and may limit the speed your bus
44+
can attain. Try with these off first if you don't know.
45+
endif
546

6-
config I2C_MANAGER_0_ENABLED
7-
bool "Enable I2C port 0"
8-
9-
if I2C_MANAGER_0_ENABLED
10-
config I2C_MANAGER_0_SDA
11-
int "SDA (GPIO pin)"
12-
config I2C_MANAGER_0_SCL
13-
int "SCL (GPIO pin)"
14-
config I2C_MANAGER_0_FREQ_HZ
15-
int "Frequency (Hz)"
16-
default 400000
17-
range 100000 5000000
18-
help
19-
The clock speed in Hz. Ranges from 100000 (100 kHz) to
20-
5000000 (5 Mhz). I2C busses that involve external wires may
21-
have to be slower, and the real maximum speed the bus will
22-
support depends on the value of the pullup resistors and the
23-
design of the overall circuit.
24-
config I2C_MANAGER_0_TIMEOUT
25-
int "R/W timeout (ms)"
26-
default 20
27-
range 10 1000
28-
help
29-
Timeout for I2C read and write operations. This does not
30-
include the time waiting for a lock.
31-
config I2C_MANAGER_0_LOCK_TIMEOUT
32-
int "Stale lock override (ms)"
33-
default 50
34-
range 10 1000
35-
help
36-
Timeout at which point an operation waiting for its turn on
37-
the port will assume that whatever set the lock has died and
38-
overrides it. Set this somewhat larger than the previous
39-
timeout.
40-
config I2C_MANAGER_0_PULLUPS
41-
bool "Use ESP32 built-in bus pull-up resistors"
42-
help
43-
The I2C bus needs resistors to make sure it's in a defined
44-
state when nobody is talking. Many circuits have external
45-
pullup resistors already and turning these on will increase
46-
power consumption slightly and may limit the speed your bus
47-
can attain. Try with these off first if you don't know.
48-
endif
49-
50-
endmenu
51-
52-
53-
menu "I2C Port 1"
54-
55-
config I2C_MANAGER_1_ENABLED
56-
bool "Enable I2C port 1"
47+
endmenu
5748

58-
if I2C_MANAGER_1_ENABLED
59-
config I2C_MANAGER_1_SDA
60-
int "SDA (GPIO pin)"
61-
config I2C_MANAGER_1_SCL
62-
int "SCL (GPIO pin)"
63-
config I2C_MANAGER_1_FREQ_HZ
64-
int "Frequency (Hz)"
65-
default 1000000
66-
range 100000 5000000
67-
help
68-
The clock speed in Hz. Ranges from 100000 (100 kHz) to
69-
5000000 (5 Mhz). I2C busses that involve external wires may
70-
have to be slower, and the real maximum speed the bus will
71-
support depends on the value of the pullup resistors and the
72-
design of the overall circuit.
73-
config I2C_MANAGER_1_TIMEOUT
74-
int "R/W timeout (ms)"
75-
default 20
76-
range 10 1000
77-
help
78-
Timeout for I2C read and write operations. This does not
79-
include the time waiting for a lock. Default should be fine.
80-
config I2C_MANAGER_1_LOCK_TIMEOUT
81-
int "Stale lock override (ms)"
82-
default 50
83-
help
84-
Timeout at which point an operation waiting for its turn on
85-
the port will assume that whatever set the lock has died and
86-
overrides it. Set this somewhat larger than the previous
87-
timeout. Default should be fine.
88-
range 30 1000
89-
config I2C_MANAGER_1_PULLUPS
90-
bool "Use ESP32 built-in bus pull-up resistors"
91-
help
92-
The I2C bus needs resistors to make sure it's in a defined
93-
state when nobody is talking. Many circuits have external
94-
pullup resistors already and turning these on will increase
95-
power consumption slightly and may limit the speed your bus
96-
can attain. Try with these off first if you don't know.
97-
endif
9849

99-
endmenu
50+
menu "I2C Port 1"
51+
52+
config I2C_MANAGER_1_ENABLED
53+
bool "Enable I2C port 1"
54+
55+
if I2C_MANAGER_1_ENABLED
56+
config I2C_MANAGER_1_SDA
57+
int "SDA (GPIO pin)"
58+
config I2C_MANAGER_1_SCL
59+
int "SCL (GPIO pin)"
60+
config I2C_MANAGER_1_FREQ_HZ
61+
int "Frequency (Hz)"
62+
default 1000000
63+
range 100000 5000000
64+
help
65+
The clock speed in Hz. Ranges from 100000 (100 kHz) to
66+
5000000 (5 Mhz). I2C busses that involve external wires may
67+
have to be slower, and the real maximum speed the bus will
68+
support depends on the value of the pullup resistors and the
69+
design of the overall circuit.
70+
config I2C_MANAGER_1_TIMEOUT
71+
int "R/W timeout (ms)"
72+
default 20
73+
range 10 1000
74+
help
75+
Timeout for I2C read and write operations. This does not
76+
include the time waiting for a lock. Default should be fine.
77+
config I2C_MANAGER_1_LOCK_TIMEOUT
78+
int "Stale lock override (ms)"
79+
default 50
80+
help
81+
Timeout at which point an operation waiting for its turn on
82+
the port will assume that whatever set the lock has died and
83+
overrides it. Set this somewhat larger than the previous
84+
timeout. Default should be fine.
85+
range 30 1000
86+
config I2C_MANAGER_1_PULLUPS
87+
bool "Use ESP32 built-in bus pull-up resistors"
88+
help
89+
The I2C bus needs resistors to make sure it's in a defined
90+
state when nobody is talking. Many circuits have external
91+
pullup resistors already and turning these on will increase
92+
power consumption slightly and may limit the speed your bus
93+
can attain. Try with these off first if you don't know.
94+
endif
10095

10196
endmenu
102-

0 commit comments

Comments
 (0)