from driver import protocol, tef
import os, time

DEVICE = os.getenv("DEV") or "COM6"
CLOCK_ENV = os.getenv("CLK", "").strip().lower() or "dp"
if CLOCK_ENV == "dp": CLOCK = 12000000 # DP-666
elif CLOCK_ENV == "x": CLOCK = 9216000
else: CLOCK = int(CLOCK_ENV)

p = protocol.I2CPCClient(DEVICE)

with tef.TEF6686(p) as tf:
    tf.init(clock=CLOCK)
    tf.AUDIO_Set_WaveGen(5, 0, 0, 400)
    tf.AUDIO_Set_Input(240)
    tf.AUDIO_Set_Mute(False)
    while True: time.sleep(0.1)