[En-Nut-Discussion] sleep_mode() patch

Andrzej Lawrynowicz a.lawrynowicz at gmail.com
Wed Jul 16 21:41:51 CEST 2008


Hello
I have attached patches to files:
nut/arch/avr/dev/adc.c
nut/arch/avr/os/nutinit.c
This patch removes workaround made for AT90CAN128 compiled with avr-libc
version earlier than 1.2
Now code uses sleep_mode() defined in WinAVR\avr\include\avr\sleep.h
This macro automatically sets the sleep enable bit, goes to sleep, and
clears the sleep enable bit.

We can also remove code
        /* Note:  avr-libc has a sleep_mode() function, but it's broken for
        AT90CAN128 with avr-libc version earlier than 1.2 */
        AVR_SLEEP_CTRL_REG |= _BV(SE);
        __asm__ __volatile__ ("sleep" "\n\t" :: );
        AVR_SLEEP_CTRL_REG &= ~_BV(SE);
from these files if all uses WinAVR-20050214 and newer.

Regards

-- 
Regards
Andrzej Ławrynowicz



More information about the En-Nut-Discussion mailing list