diff options
| author | HiFiPhile <[email protected]> | 2026-06-22 21:30:58 +0200 |
|---|---|---|
| committer | HiFiPhile <[email protected]> | 2026-06-22 21:30:58 +0200 |
| commit | 693cdce08e14833f26f4e8a1f26e4fd546be4c35 (patch) | |
| tree | 7667d2223dc32d9f21b5b60ab200e64ed46e3e20 /examples/device/uac2_speaker_fb/src/audio_debug.py | |
| parent | 41e9eaa65a935136085d78ec4b99c81ff991b560 (diff) | |
| parent | cd3561bf158afd5a5718904b8139a338d1e3b67c (diff) | |
Merge remote-tracking branch 'tinyusb/master' into pr-osal-spin-deinit
Signed-off-by: HiFiPhile <[email protected]>
Diffstat (limited to 'examples/device/uac2_speaker_fb/src/audio_debug.py')
| -rwxr-xr-x | examples/device/uac2_speaker_fb/src/audio_debug.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/device/uac2_speaker_fb/src/audio_debug.py b/examples/device/uac2_speaker_fb/src/audio_debug.py index 05b49baf6..1c6035a44 100755 --- a/examples/device/uac2_speaker_fb/src/audio_debug.py +++ b/examples/device/uac2_speaker_fb/src/audio_debug.py @@ -2,13 +2,15 @@ # Install python3 HID package https://pypi.org/project/hid/ # Install python3 matplotlib package https://pypi.org/project/matplotlib/ -from ctypes import * +from ctypes import Structure, c_uint32, c_uint8, c_int8, c_int16, c_uint16 +import signal try: import hid import matplotlib.pyplot as plt import matplotlib.animation as animation except: print("Missing import, please try 'pip install hid matplotlib' or consult your OS's python package manager.") + exit(1) # Example must be compiled with CFG_AUDIO_DEBUG=1 VID = 0xcafe @@ -29,6 +31,7 @@ class audio_debug_info_t (Structure): dev = hid.Device(VID, PID) if dev: + signal.signal(signal.SIGINT, signal.SIG_DFL) # Create figure for plotting fig = plt.figure() ax = fig.add_subplot(1, 1, 1) @@ -61,10 +64,10 @@ if dev: ax.set_ylim(bottom=0, top=info.fifo_size) # Format plot - plt.title('FIFO information') - plt.grid() + ax.set_title('FIFO information') + ax.grid(True) print(f'Sample rate:{info.sample_rate} | Alt settings:{info.alt_settings} | Volume:{info.volume[:]}') - ani = animation.FuncAnimation(fig, animate, interval=10) - plt.show() + ani = animation.FuncAnimation(fig, animate, interval=10, cache_frame_data=False) # type: ignore + plt.show(block=True) |
