Oh my gosh I clearly need to get more sleep. I just realized you've included the code with STM. And that second answer - of course it's as simple as that!
Jeez, you're a saint. Thank you so much! I'll come back when I have actually tricky questions.