forked from PAWPAW-Mirror/lib_xua
Enhanced app_midi_simple to support file based commands and readiness for Rx testing
This commit is contained in:
24
tests/midi_test_helpers.py
Normal file
24
tests/midi_test_helpers.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright 2024 XMOS LIMITED.
|
||||
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
class Midi_expect:
|
||||
def __init(self):
|
||||
pass
|
||||
|
||||
def expect(self, commands):
|
||||
expected = ""
|
||||
for command in commands:
|
||||
while len(command) < 3:
|
||||
command.append(0)
|
||||
expected += "uart_tx_checker: " + " ".join([f"0x{byte:02x}" for byte in command]) + "\n"
|
||||
|
||||
return expected
|
||||
|
||||
|
||||
def create_midi_tx_file(commands):
|
||||
with open("midi_tx_cmds.txt", "wt") as mt:
|
||||
for command in commands:
|
||||
while len(command) < 3:
|
||||
command.append(0)
|
||||
text = " ".join([str(byte) for byte in command]) + "\n"
|
||||
mt.write(text)
|
||||
Reference in New Issue
Block a user