Skip to content

Commit

Permalink
tests/ports/psoc6/../pdm_pcm: Refactored to use interrupt synch.
Browse files Browse the repository at this point in the history
Signed-off-by: enriquezgarc <[email protected]>
  • Loading branch information
jaenrig-ifx authored and actions-user committed Nov 29, 2024
1 parent b58d83d commit d8aa71b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions tests/ports/psoc6/board_ext_hw/multi/pdm_pcm_rx.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
print("*** PDM_PCM tests - RX ***")

send_signal = Pin(send_signal_to_tx_pin, mode=Pin.OUT, pull=Pin.PULL_DOWN, value=False)
send_signal.value(0)


def generate_exp_seq(data):
Expand All @@ -37,6 +36,7 @@ def generate_exp_seq(data):
rounds = 2

for m in range(rounds):
send_signal.value(0)
exp_seq = generate_exp_seq(exp_data[m])
if m == 0:
print("*** Test for data high ***")
Expand Down Expand Up @@ -94,7 +94,7 @@ def rx_complete_irq(obj):
rx_done = True


machine.freq(machine.AUDIO_PDM_24_576_000_HZ)
machine.freq(machine.AUDIO_PDM_22_579_000_HZ)
pdm_pcm = PDM_PCM(
0,
sck=clk_pin,
Expand Down
24 changes: 8 additions & 16 deletions tests/ports/psoc6/board_ext_hw/multi/pdm_pcm_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,13 @@
print("SKIP")
raise SystemExit

start_time = time.time()

sig_val = 1
sig_val = 0
test_done = False


def signal_irq(event):
global sig_val
sig_val = 0


def blocking_delay_ms(delay_ms):
start = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), start) < delay_ms:
pass
sig_val += 1


data_out = Pin(data_out_pin, mode=Pin.OUT, pull=Pin.PULL_DOWN, value=False)
Expand All @@ -38,12 +30,12 @@ def blocking_delay_ms(delay_ms):
sync_data.irq(handler=signal_irq, trigger=Pin.IRQ_RISING)

data_out.value(1)
while test_done == False:
while sig_val:
pass
data_out.value(0)
blocking_delay_ms(200000)
test_done = True
while sig_val == 0:
pass

data_out.value(0)
while sig_val == 1:
pass

data_out.deinit()
clk_in.deinit()
Expand Down

0 comments on commit d8aa71b

Please sign in to comment.