More enablement of ATmega32U chip.
- ATmega32U timer 4 register handling differs from other AVRs: Change heater.c and mendel.c. - LUFA USB recognition expanded in Makefile. - Add section for __AVR_ATmega32U4__ in arduino.h.
This commit is contained in:
parent
3d02790032
commit
52ce6b5f52
8
Makefile
8
Makefile
|
|
@ -35,6 +35,7 @@ MCU_TARGET = atmega644p
|
|||
# MCU_TARGET = atmega1280
|
||||
# MCU_TARGET = atmega2560
|
||||
# MCU_TARGET = at90usb1287
|
||||
# MCU_TARGET = atmega32u4
|
||||
|
||||
# CPU clock rate
|
||||
F_CPU = 16000000L
|
||||
|
|
@ -109,7 +110,14 @@ LIBDEPS =
|
|||
SUBDIRS =
|
||||
|
||||
ifneq (,$(findstring usb,$(MCU_TARGET)))
|
||||
USE_LUFA = true
|
||||
endif
|
||||
ifneq (,$(findstring u4,$(MCU_TARGET)))
|
||||
USE_LUFA = true
|
||||
endif
|
||||
ifdef USE_LUFA
|
||||
LDFLAGS += -Llufa_serial
|
||||
|
||||
LIBS += -llufa_serial
|
||||
SUBDIRS += lufa_serial
|
||||
LIBDEPS += lufa_serial/liblufa_serial.a
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@
|
|||
#include "arduino_usb1287.h"
|
||||
#endif
|
||||
|
||||
#if defined (__AVR_ATmega32U4__)
|
||||
#include "arduino_32U4.h"
|
||||
#endif
|
||||
|
||||
#ifndef DIO0_PIN
|
||||
#error pins for this chip not defined in arduino.h! If you write an appropriate pin definition and have this firmware work on your chip, please tell us via the forum thread
|
||||
#endif
|
||||
|
|
|
|||
28
heater.c
28
heater.c
|
|
@ -125,15 +125,25 @@ void heater_init() {
|
|||
#endif
|
||||
#endif
|
||||
#ifdef TCCR4A
|
||||
case (uint16_t) &OCR4AL:
|
||||
TCCR4A |= MASK(COM4A1);
|
||||
break;
|
||||
case (uint16_t) &OCR4BL:
|
||||
TCCR4A |= MASK(COM4B1);
|
||||
break;
|
||||
case (uint16_t) &OCR4CL:
|
||||
TCCR4A |= MASK(COM4C1);
|
||||
break;
|
||||
#if defined (OCR4AL)
|
||||
case (uint16_t) &OCR4AL:
|
||||
TCCR4A |= MASK(COM4A1);
|
||||
break;
|
||||
case (uint16_t) &OCR4BL:
|
||||
TCCR4A |= MASK(COM4B1);
|
||||
break;
|
||||
case (uint16_t) &OCR4CL:
|
||||
TCCR4A |= MASK(COM4C1);
|
||||
break;
|
||||
#else
|
||||
// 10 bit timer
|
||||
case (uint16_t) &OCR4A:
|
||||
TCCR4A |= MASK(COM4A1);
|
||||
break;
|
||||
case (uint16_t) &OCR4B:
|
||||
TCCR4A |= MASK(COM4B1);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef TCCR5A
|
||||
case (uint16_t) &OCR5AL:
|
||||
|
|
|
|||
13
mendel.c
13
mendel.c
|
|
@ -184,7 +184,8 @@ void io_init(void) {
|
|||
SET_OUTPUT(E_ENABLE_PIN);
|
||||
#endif
|
||||
|
||||
// setup PWM timers: fast PWM, no prescaler
|
||||
// setup PWM timers: fast PWM
|
||||
// Warning 2012-01-11: these are not consistent across all AVRs
|
||||
TCCR0A = MASK(WGM01) | MASK(WGM00);
|
||||
// PWM frequencies in TCCR0B, see page 108 of the ATmega644 reference.
|
||||
TCCR0B = MASK(CS00); // F_CPU / 256 (about 78(62.5) kHz on a 20(16) MHz chip)
|
||||
|
|
@ -222,8 +223,14 @@ void io_init(void) {
|
|||
#endif
|
||||
|
||||
#ifdef TCCR4A
|
||||
TCCR4A = MASK(WGM40);
|
||||
TCCR4B = MASK(WGM42) | MASK(CS40);
|
||||
#ifdef TIMER4_IS_10_BIT
|
||||
// ATmega16/32U4 fourth timer is a 10 special bit timer
|
||||
TCCR4D = MASK(WGM40);
|
||||
TCCR4B = MASK(CS40);
|
||||
#else
|
||||
TCCR4A = MASK(WGM40);
|
||||
TCCR4B = MASK(WGM42) | MASK(CS40);
|
||||
#endif
|
||||
TIMSK4 = 0;
|
||||
OCR4A = 0;
|
||||
OCR4B = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue