AW: [En-Nut-Discussion] sleeping in idle thread

Matthias Ringwald mringwal at inf.ethz.ch
Mon Jul 12 10:24:41 CEST 2004


hi Ralph

thanks for your comment.

I wrote:

     for (;;) {
         NutThreadYield();
         NutThreadDestroy();

#ifdef __GNUC__
         if (idle_sleep_mode != SLEEP_MODE_NONE) {
             sleep_mode = MCUCR & SLEEP_MODE_EXT_STANDBY;
             set_sleep_mode(idle_sleep_mode);
             sleep_mode();
             set_sleep_mode(sleep_mode);
#endif
	}

which is basically the same. I was using avr-libc functions,
and use a pre-defined sleep-mode which is restored afterwards.

You're caling ResetWD(). (assuming it means to Rest the Watchdog
timer). Nut/OS doens't provide any watchdog related functions, does it?

Matthias


> Hi have been using
>
> ..       ResetWD(WD_IDLE);
>              //AVR Sleep code - nothing to do but save power!
>        sbi( MCUCR,5) ; asm volatile("sleep" ::);




More information about the En-Nut-Discussion mailing list