Skip to main content
Goof Ball
Associate III
June 12, 2020
Solved

wake from WFI and *immediately* execute my code ??

  • June 12, 2020
  • 2 replies
  • 1781 views

__WFI works beauty. But I want more. Behold:

void vApplicationIdleHook() {
	__WFI();
 my_own_code(); // on wake, this will be executed *after* the intr handler :(
}

Upon every wake from WFI, I want to execute my own code immediately: ie. before any intr handler, and before any other threads.

I could slap "my_own_code();" into the top of *every* interrupt handler... but that is too much work.

Anyone have any ideas?

    This topic has been closed for replies.
    Best answer by berendi
    void vApplicationIdleHook() {
     __disable_irq();
     __WFI();
     my_own_code();
     __enable_irq();
    }

    2 replies

    berendi
    berendiBest answer
    Principal
    June 12, 2020
    void vApplicationIdleHook() {
     __disable_irq();
     __WFI();
     my_own_code();
     __enable_irq();
    }

    Goof Ball
    Goof BallAuthor
    Associate III
    June 12, 2020

    @berendi​ Thanks man! You are totally the dude of the day. Works great!

    The disturbing question, of course, is how come I couldn't figger that out myself...

    Piranha
    Principal III
    June 12, 2020