Skip to content

Commit

Permalink
add recommended ScopedIrqBlocker to deal with interupt race conditions (
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer authored Feb 7, 2025
1 parent 2f39589 commit 0606383
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hvcc/generators/c2daisy/templates/HeavyDaisy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ DaisyHvParamOut DaisyOutputParameters[DaisyNumOutputParameters] = {
// Typical Switch case for Message Type.
void HandleMidiMessage(MidiEvent m)
{
ScopedIrqBlocker block; //< Disables interrupts while in scope

for (int i = 0; i <= 2; ++i) {
hv->sendMessageToReceiverV(HV_HASH_MIDIIN, 0, "ff",
(float) m.data[i],
Expand Down Expand Up @@ -476,6 +478,8 @@ static void printHook(HeavyContextInterface *c, const char *printLabel, const ch
*/
void LoopWriteIn(Heavy_{{patch_name}}* hv)
{
ScopedIrqBlocker block; //< Disables interrupts while in scope

{% for param in loop_write_in %}
{% if param.bool %}
if ({{param.process}})
Expand Down Expand Up @@ -505,6 +509,8 @@ void CallbackWriteIn(Heavy_{{patch_name}}* hv)
*
*/
void LoopWriteOut() {
ScopedIrqBlocker block; //< Disables interrupts while in scope

{% for param in loop_write_out %}
{% if param.bool %}
if ({{param.value}})
Expand Down

0 comments on commit 0606383

Please sign in to comment.