mirror of
https://github.com/clockworkpi/uConsole.git
synced 2026-09-04 23:14:37 +02:00
add Code/scripts/README.md
This commit is contained in:
12
Code/scripts/README.md
Normal file
12
Code/scripts/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Scripts code used in uConsole os image
|
||||
|
||||
## uconsole-4g-cm4
|
||||
|
||||
Bash script to PowerOn/PowerOff 4G ext module in uConsole.
|
||||
|
||||
## audio_3.5_patch.py
|
||||
|
||||
Python script to switch between 3.5 audio jack and speaker on uConsole when 3.5 audio jack plugged or not.
|
||||
|
||||
|
||||
|
||||
32
Code/scripts/audio_3.5_patch.py
Normal file
32
Code/scripts/audio_3.5_patch.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
def init_gpio():
|
||||
os.popen("pinctrl set 11 op")
|
||||
os.popen("pinctrl set 10 ip pn")
|
||||
|
||||
def check_3_5():
|
||||
tmp = os.popen("pinctrl 10").readline().strip("\n")
|
||||
return tmp
|
||||
|
||||
|
||||
def enable_speaker_gpio():
|
||||
os.popen("pinctrl set 11 op dh")
|
||||
|
||||
def disable_speaker_gpio():
|
||||
os.popen("pinctrl set 11 op dl")
|
||||
|
||||
init_gpio()
|
||||
|
||||
while True:
|
||||
tmp = check_3_5()
|
||||
if tmp == "10: ip pn | lo // GPIO10 = input":
|
||||
enable_speaker_gpio()
|
||||
elif tmp == "10: ip pn | hi // GPIO10 = input":
|
||||
disable_speaker_gpio()
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user