From d7c99e625d8111df00662724329fca3f8e7f9a94 Mon Sep 17 00:00:00 2001 From: lottaviano Date: Tue, 3 Aug 2010 10:54:58 +0000 Subject: [PATCH] Add I2C and ADC support for ATMega1280 (contributed by Fabio Bizzi) I modified a bit the patch for i2c since it didn't apply cleanly. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4131 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/avr/drv/adc_avr.c | 3 ++- bertos/cpu/avr/drv/i2c_avr.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bertos/cpu/avr/drv/adc_avr.c b/bertos/cpu/avr/drv/adc_avr.c index 7e932f62..3eb08b79 100644 --- a/bertos/cpu/avr/drv/adc_avr.c +++ b/bertos/cpu/avr/drv/adc_avr.c @@ -101,7 +101,8 @@ void adc_hw_select_ch(uint8_t ch) /* Set to 0 all mux registers */ #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 + #elif CPU_AVR_ATMEGA32 || CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA1281 \ + || CPU_AVR_ATMEGA1280 ADMUX &= ~(BV(MUX4) | BV(MUX3) | BV(MUX2) | BV(MUX1) | BV(MUX0)); #else #error Unknown CPU diff --git a/bertos/cpu/avr/drv/i2c_avr.c b/bertos/cpu/avr/drv/i2c_avr.c index 64d77786..918d2758 100644 --- a/bertos/cpu/avr/drv/i2c_avr.c +++ b/bertos/cpu/avr/drv/i2c_avr.c @@ -384,7 +384,7 @@ void i2c_hw_init(I2c *i2c, int dev, uint32_t clock) * probably due to some unwanted interaction between the * port pin and the TWI lines. */ - #if CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA1281 + #if CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128 || CPU_AVR_ATMEGA1281 || CPU_AVR_ATMEGA1280 PORTD |= BV(PD0) | BV(PD1); DDRD |= BV(PD0) | BV(PD1); #elif CPU_AVR_ATMEGA8 -- 2.25.1