void adc_hw_select_ch(uint8_t ch)
{
/* Set to 0 all mux registers */
- ADMUX &= ~(BV(MUX4) | BV(MUX3) | BV(MUX2) | BV(MUX1) | BV(MUX0));
+ #if CPU_AVR_ATMEGA8 || CPU_AVR_ATMEGA328P || CPU_AVR_ATMEGA168
+ ADMUX &= ~(BV(MUX3) | BV(MUX2) | BV(MUX1) | BV(MUX0));
+ #elif CPU_AVR_ATMEGA32 || CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA1281
+ ADMUX &= ~(BV(MUX4) | BV(MUX3) | BV(MUX2) | BV(MUX1) | BV(MUX0));
+ #else
+ #error Unknown CPU
+ #endif
/* Select channel, only first 8 channel modes are supported for now */
ADMUX |= (ch & 0x07);
*
* $WIZ$ module_name = "adc"
* $WIZ$ module_configuration = "bertos/cfg/cfg_adc.h"
- * $WIZ$ module_supports = "not atmega103 and not atmega168 and not atmega8"
+ * $WIZ$ module_supports = "not atmega103"
*/