[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] Re: [avr-gcc-list] Different usage of pre defined mod

From: Volkmar Dierkes
Subject: Re: [avr-libc-dev] Re: [avr-gcc-list] Different usage of pre defined modes
Date: Sun, 12 Jan 2003 00:09:04 +0100
User-agent: 40tude_Dialog/ Hamster/

Hi Ted,

I found right now another issue with the sleep.h file. If you set at 
one time to SLEEP_MODE_ADC and at a later time to SLEEP_MODE_IDLE, 
the second one didn't use the idle mode, it uses the ADC mode again! 
To fix this I changed the definition of set_sleep_mode(mode) to this 

#define set_sleep_mode(mode)   MCUCR = ((MCUCR & ~( _BV(SM0) | 
_BV(SM1) | _BV(SM2) )) | (mode))

maybe there is a better way, but it is neccessary to clear the sleep 
mode bits before setting them. I am sorry that I didn't provide you 
a diff file, but I think you will find it in the sleep.h file.


On Sun, 5 Jan 2003 20:52:41 -0800 (PST), Theodore A. Roth wrote:

> Hi Volkmar,
> Looking over the sleep.h file, I see that I wrote it incorrectly. Or'ing the 
> SMn values without the _BV() wrapper is wrong. The attached patch (which 
> I've committed to cvs) fixes it.
> Now you should be able to use the more consistent call to set_sleep_mode() 
> without the need for _BV().
> Ted Roth
> On Sun, 5 Jan 2003, Volkmar Dierkes wrote:
> :)Hi,
> :)
> :)I found the following issue. If I want to go to ADC noise 
> :)cancelation mode I have to define the sleep mode via
> :)
> :)  set_sleep_mode(_BV(SLEEP_MODE_ADC));
> :)
> :)But when I want to go to idle mode I must not use _BV:
> :)
> :)  set_sleep_mode(SLEEP_MODE_IDLE);
> :)
> :)I think there is no other solution to get it to the same behaviour? 
> :)It isn't a relevant problem for me, but I think it would be fine to 
> :)have it in a same way.
> :)
> :)Volkmar
> :)avr-gcc-list at http://avr1.org
> :)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]