From d139389267918dac65216e794fad05cffc4a2b0b Mon Sep 17 00:00:00 2001 From: Douglas Hammond Date: Fri, 23 Feb 2018 15:57:14 -0500 Subject: [PATCH] avr: Add at90usb646 support Signed-off-by: Douglas Hammond wizhippo@gmail.com --- klippy/pins.py | 2 +- src/avr/Kconfig | 8 ++++++-- src/avr/gpio.c | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/klippy/pins.py b/klippy/pins.py index d803d390..683041b5 100644 --- a/klippy/pins.py +++ b/klippy/pins.py @@ -33,7 +33,7 @@ def beaglebone_pins(): MCU_PINS = { "atmega168": port_pins(5), "atmega328": port_pins(5), "atmega644p": port_pins(4), "atmega1284p": port_pins(4), - "at90usb1286": port_pins(6), + "at90usb1286": port_pins(6), "at90usb646": port_pins(6), "atmega1280": port_pins(12), "atmega2560": port_pins(12), "sam3x8e": port_pins(4, 32), "pru": beaglebone_pins(), diff --git a/src/avr/Kconfig b/src/avr/Kconfig index dda36653..9a4500c1 100644 --- a/src/avr/Kconfig +++ b/src/avr/Kconfig @@ -23,6 +23,8 @@ choice bool "atmega1280" config MACH_at90usb1286 bool "at90usb1286" + config MACH_at90usb646 + bool "at90usb646" config MACH_atmega1284p bool "atmega1284p" config MACH_atmega644p @@ -40,6 +42,7 @@ config MCU default "atmega1284p" if MACH_atmega1284p default "atmega644p" if MACH_atmega644p default "at90usb1286" if MACH_at90usb1286 + default "at90usb646" if MACH_at90usb646 default "atmega1280" if MACH_atmega1280 default "atmega2560" if MACH_atmega2560 @@ -47,6 +50,7 @@ config AVRDUDE_PROTOCOL string default "wiring" if MACH_atmega2560 default "avr109" if MACH_at90usb1286 + default "avr109" if MACH_at90usb646 default "arduino" choice @@ -68,7 +72,7 @@ config CLOCK_FREQ config CLEAR_PRESCALER bool "Manually clear the CPU prescaler field at startup" - depends on MACH_at90usb1286 + depends on MACH_at90usb1286 || MACH_at90usb646 default y help Some AVR chips ship with a "clock prescaler" that causes the @@ -91,7 +95,7 @@ config AVR_WATCHDOG default y config AVR_USBSERIAL bool "Use USB for communication (instead of serial)" - depends on MACH_at90usb1286 + depends on MACH_at90usb1286 || MACH_at90usb646 default y config AVR_SERIAL depends on !AVR_USBSERIAL diff --git a/src/avr/gpio.c b/src/avr/gpio.c index 774885e4..70d849f0 100644 --- a/src/avr/gpio.c +++ b/src/avr/gpio.c @@ -152,7 +152,7 @@ static const uint8_t pwm_pins[ARRAY_SIZE(pwm_regs)] PROGMEM = { # ifdef OCR3A GPIO('B', 6), GPIO('B', 7), # endif -#elif CONFIG_MACH_at90usb1286 +#elif CONFIG_MACH_at90usb1286 || CONFIG_MACH_at90usb646 GPIO('B', 7), GPIO('D', 0), GPIO('B', 5), GPIO('B', 6), GPIO('B', 7), GPIO('B', 4), GPIO('D', 1), @@ -252,7 +252,7 @@ static const uint8_t adc_pins[] PROGMEM = { #elif CONFIG_MACH_atmega644p || CONFIG_MACH_atmega1284p GPIO('A', 0), GPIO('A', 1), GPIO('A', 2), GPIO('A', 3), GPIO('A', 4), GPIO('A', 5), GPIO('A', 6), GPIO('A', 7), -#elif CONFIG_MACH_at90usb1286 +#elif CONFIG_MACH_at90usb1286 || CONFIG_MACH_at90usb646 GPIO('F', 0), GPIO('F', 1), GPIO('F', 2), GPIO('F', 3), GPIO('F', 4), GPIO('F', 5), GPIO('F', 6), GPIO('F', 7), #elif CONFIG_MACH_atmega1280 || CONFIG_MACH_atmega2560 @@ -352,7 +352,7 @@ gpio_adc_cancel_sample(struct gpio_adc g) static const uint8_t SS = GPIO('B', 2), SCK = GPIO('B', 5), MOSI = GPIO('B', 3); #elif CONFIG_MACH_atmega644p || CONFIG_MACH_atmega1284p static const uint8_t SS = GPIO('B', 4), SCK = GPIO('B', 7), MOSI = GPIO('B', 5); -#elif CONFIG_MACH_at90usb1286 || CONFIG_MACH_atmega1280 || CONFIG_MACH_atmega2560 +#elif CONFIG_MACH_at90usb1286 || CONFIG_MACH_at90usb646 || CONFIG_MACH_atmega1280 || CONFIG_MACH_atmega2560 static const uint8_t SS = GPIO('B', 0), SCK = GPIO('B', 1), MOSI = GPIO('B', 2); #endif