Skip to content

Commit 3884249

Browse files
authored
Merge pull request #3369 from hathach/misc_fix
Few misc fixes
2 parents 8205b60 + 3f0d266 commit 3884249

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

examples/device/uac2_speaker_fb/src/audio_debug.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
# Install python3 HID package https://pypi.org/project/hid/
33
# Install python3 matplotlib package https://pypi.org/project/matplotlib/
44

5-
from ctypes import *
5+
from ctypes import Structure, c_uint32, c_uint8, c_int8, c_int16, c_uint16
6+
import signal
67
try:
78
import hid
89
import matplotlib.pyplot as plt
910
import matplotlib.animation as animation
1011
except:
1112
print("Missing import, please try 'pip install hid matplotlib' or consult your OS's python package manager.")
13+
exit(1)
1214

1315
# Example must be compiled with CFG_AUDIO_DEBUG=1
1416
VID = 0xcafe
@@ -29,6 +31,7 @@ class audio_debug_info_t (Structure):
2931
dev = hid.Device(VID, PID)
3032

3133
if dev:
34+
signal.signal(signal.SIGINT, signal.SIG_DFL)
3235
# Create figure for plotting
3336
fig = plt.figure()
3437
ax = fig.add_subplot(1, 1, 1)
@@ -61,10 +64,10 @@ def animate(i):
6164
ax.set_ylim(bottom=0, top=info.fifo_size)
6265

6366
# Format plot
64-
plt.title('FIFO information')
65-
plt.grid()
67+
ax.set_title('FIFO information')
68+
ax.grid(True)
6669

6770
print(f'Sample rate:{info.sample_rate} | Alt settings:{info.alt_settings} | Volume:{info.volume[:]}')
6871

69-
ani = animation.FuncAnimation(fig, animate, interval=10)
70-
plt.show()
72+
ani = animation.FuncAnimation(fig, animate, interval=10, cache_frame_data=False) # type: ignore
73+
plt.show(block=True)

src/common/tusb_fifo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ bool tu_fifo_full(const tu_fifo_t *f);
175175
bool tu_fifo_overflowed(const tu_fifo_t *f);
176176

177177
TU_ATTR_ALWAYS_INLINE static inline bool tu_fifo_empty(const tu_fifo_t *f) {
178-
return f->wr_idx == f->rd_idx;
178+
uint16_t wr_idx = f->wr_idx;
179+
uint16_t rd_idx = f->rd_idx;
180+
return wr_idx == rd_idx;
179181
}
180182

181183
TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_fifo_depth(const tu_fifo_t *f) {

src/portable/st/stm32_fsdev/fsdev_stm32.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@
202202
#include "stm32u0xx.h"
203203
#define FSDEV_PMA_SIZE (1024u)
204204
#define FSDEV_BUS_32BIT
205-
// Disable SBUF_ISO on U0 for now due to bad performance (audio glitching)
206-
#define FSDEV_HAS_SBUF_ISO 0
205+
#define FSDEV_HAS_SBUF_ISO 1
207206
#define USB USB_DRD_FS
208207

209208
#define USB_EP_CTR_RX USB_EP_VTRX

0 commit comments

Comments
 (0)