Initial MIDI Rx test using pyxsim

This commit is contained in:
Ed
2024-04-16 15:21:58 +01:00
parent a6969a8610
commit 398d966145
6 changed files with 113 additions and 37 deletions

View File

@@ -1,7 +1,7 @@
# Copyright 2024 XMOS LIMITED.
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
class Midi_expect:
class midi_expect_tx:
def __init(self):
pass
@@ -14,11 +14,33 @@ class Midi_expect:
return expected
class midi_expect_rx:
def __init(self):
pass
def create_midi_tx_file(commands):
with open("midi_tx_cmds.txt", "wt") as mt:
def expect(self, commands):
expected = ""
for command in commands:
while len(command) < 3:
command.append(0)
expected += "dut_midi_rx: " + " ".join([f"{byte}" for byte in command]) + "\n"
return expected
midi_tx_file = "midi_tx_cmds.txt"
midi_rx_file = "midi_rx_cmds.txt"
def create_midi_tx_file(commands=None):
with open(midi_tx_file, "wt") as mt:
if commands is None:
return
for command in commands:
while len(command) < 3:
command.append(0)
text = " ".join([str(byte) for byte in command]) + "\n"
mt.write(text)
def create_midi_rx_file(num_commands=0):
with open(midi_rx_file, "wt") as mr:
text = f"{num_commands}\n"
mr.write(text)