cancel
Showing results for 
Search instead for 
Did you mean: 

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

Goof Ball
Associate III

__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?

1 ACCEPTED SOLUTION

Accepted Solutions
berendi
Principal
void vApplicationIdleHook() {
    __disable_irq();
    __WFI();
    my_own_code();
    __enable_irq();
}

View solution in original post

3 REPLIES 3
berendi
Principal
void vApplicationIdleHook() {
    __disable_irq();
    __WFI();
    my_own_code();
    __enable_irq();
}

@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
Chief II