Skip to content

Commit c019794

Browse files

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

ovos_PHAL/i2c_detect

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import subprocess
2+
3+
4+
def is_mycroft_sj201():
5+
cmd = 'i2cdetect -y -a 1 0x04 0x04 | egrep "(04|UU)" | awk \'{print $2}\''
6+
out = subprocess.check_output(cmd, shell=True).strip()
7+
if out == b"04" or out == b"UU":
8+
return True
9+
return False
10+
11+
12+
def is_respeaker_2mic():
13+
cmd = 'i2cdetect -y -a 1 0x1a 0x1a | egrep "(1a|UU)" | awk \'{print $2}\''
14+
out = subprocess.check_output(cmd, shell=True).strip()
15+
if out == b"1a" or out == b"UU":
16+
return True
17+
return False
18+
19+
20+
def is_respeaker_4mic():
21+
cmd = 'i2cdetect -y -a 0x35 0x35 | egrep "(35|UU)" | awk \'{print $2}\''
22+
out = subprocess.check_output(cmd, shell=True).strip()
23+
if out == b"35" or out == b"UU":
24+
return True
25+
return False
26+
27+
28+
def is_respeaker_6mic():
29+
cmd = 'i2cdetect -y -a 0x3b 0x3b | egrep "(3b|UU)" | awk \'{print $2}\''
30+
out = subprocess.check_output(cmd, shell=True).strip()
31+
if out == b"3b" or out == b"UU":
32+
return True
33+
return False
34+
35+
36+
def is_adafruit():
37+
cmd = 'i2cdetect -y -a 0x4b 0x4b | egrep "(4b|UU)" | awk \'{print $2}\''
38+
out = subprocess.check_output(cmd, shell=True).strip()
39+
if out == b"4b" or out == b"UU":
40+
return True
41+
return False
42+
43+
44+
def is_texas_tas5806():
45+
cmd = 'i2cdetect -y -a 0x2f 0x2f | egrep "(2f|UU)" | awk \'{print $2}\''
46+
out = subprocess.check_output(cmd, shell=True).strip()
47+
if out == b"2f" or out == b"UU":
48+
return True
49+
return False

0 commit comments

Comments
 (0)