[En-Nut-Discussion] WinAVR-20080512 -- same error as 20080411

Thiago A. Corrêa thiago.correa at gmail.com
Wed May 21 03:10:27 CEST 2008


avrlibc 1.2 was released on 01/28/2005, so I guess is quite old enough
so we could remove this workaround.



On Tue, May 20, 2008 at 7:02 PM, Ole Reinhardt
<ole.reinhardt at embedded-it.de> wrote:
> Little addendum:
>
>> > Couldn't we just use avrlibc's sleep functions instead?
>>
>> Shure :) Sometimes the solution is even more simple :)
>
> We just use the set sleep_mode function. But what we would need is a
> function re retreve the current sleep mode and restore it later after
> the completed conversion. So we need to know the sleep mode. Indeed
> that's not a problem, as we know our registers. And at least we could
> simply substitude the _SLEEP_MODE_MASK constant by
>
> (~(_BV(SM0) | _BV(SM1) | _BV(SM2)))
>
> The next three lines work around a bug in avrlibc < 1.2 triggered with
> atcan128. If we define avrlibc < 1.2 as deprecated then we could modify
> the function like this:
>
>
> void ADCStartLowNoiseConversion()
> {
>    ADCSetMode(SINGLE_CONVERSION);
>
> #if defined(__GNUC__) && defined(__AVR_ENHANCED__)
>    {
>        u_char old_sleep_mode = AVR_SLEEP_CTRL_REG & (~(_BV(SM0) |
> _BV(SM1) | _BV(SM2)));
>        set_sleep_mode(adc_sleep_mode);
>        sleep_mode();
>        set_sleep_mode(old_sleep_mode);
>    }
> #else
>    sbi(ADCSR, ADSC);
> #endif
> }
>
> Regards,
>
> Ole Reinhardt
>
> --
>  _____________________________________________________________
> |                                                             |
> | Embedded-IT          Hard- und Softwarelösungen             |
> |                                                             |
> | Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
> | Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
> | 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
> | Germany              Web:         http://www.embedded-it.de |
> |                      UstID / VAT:       DE198944716         |
> |_____________________________________________________________|
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>


More information about the En-Nut-Discussion mailing list