Skip to main content
Goof Ball
Associate III
Jun 12, 2020 3:11 AM UTC
Solved

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

__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.
    berendi
    berendiBest answer
    Principal
    Jun 12, 2020 3:51 AM UTC
    void vApplicationIdleHook() {
     __disable_irq();
     __WFI();
     my_own_code();
     __enable_irq();
    }

    3 replies

    berendi
    berendiBest answer
    Principal
    Jun 12, 2020 3:51 AM UTC
    void vApplicationIdleHook() {
     __disable_irq();
     __WFI();
     my_own_code();
     __enable_irq();
    }

    Goof Ball
    Goof BallAuthor
    Associate III
    Jun 12, 2020 4:31 AM UTC

    @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
    Jun 12, 2020 4:43 AM UTC