1
0

minor changes in functionality

This commit is contained in:
2026-02-21 11:32:24 +01:00
parent eece17b9db
commit 7daa4d6e94
8 changed files with 107 additions and 83 deletions

28
test.py
View File

@@ -1,24 +1,20 @@
from tef import TEF6686
from protocol import I2CPCClient
import time
p = I2CPCClient("COM17")
print(p._send_packet(bytes([4])))
tef = TEF6686(p)
tef.init(clock=12000000)
tef.AM_Tune_To(1, 225)
tef.AUDIO_Set_Mute(False)
tef.AUDIO_Set_Volume(70)
tef.FM_Set_MphSuppression(True)
tef.FM_Set_ChannelEqualizer(True)
# tef.FM_Set_Specials(1)
tef.FM_Set_Bandwidth(True)
import time
time.sleep(0.032)
try:
with TEF6686(p) as tef:
tef.init(clock=12000000)
tef.AM_Tune_To(1, 225)
tef.AUDIO_Set_Mute(False)
tef.AUDIO_Set_Volume(70)
tef.FM_Set_MphSuppression(True)
tef.FM_Set_ChannelEqualizer(True)
# tef.FM_Set_Specials(1)
tef.FM_Set_Bandwidth(True)
time.sleep(0.032)
while True:
status, level, usn, wam, offset, bandwidth, modulation = tef.FM_Get_Quality_Data()
if not status or not level or not usn or not wam or not offset or not bandwidth or not modulation: continue
print(f"{level / 10} dbμV | {usn / 10}% USN | {wam / 10}% WAM | {offset / 10} kHz offset | {bandwidth / 10} kHz bandwidth | {modulation / 10}% modulation")
time.sleep(0.3)
finally:
tef.close()
time.sleep(0.3)