avr: Add support for atmega328 chip
The atmega328 is basically the same as the atmega168 - it just adds some additional memory. Allow the chip to be selected during the build. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
7e3d7e071f
commit
d2547ce6b0
|
@ -27,8 +27,8 @@ def beaglebone_pins():
|
||||||
return gpios
|
return gpios
|
||||||
|
|
||||||
MCU_PINS = {
|
MCU_PINS = {
|
||||||
"atmega168": port_pins(4), "atmega644p": port_pins(4),
|
"atmega168": port_pins(4), "atmega328": port_pins(4),
|
||||||
"at90usb1286": port_pins(5),
|
"atmega644p": port_pins(4), "at90usb1286": port_pins(5),
|
||||||
"atmega1280": port_pins(12), "atmega2560": port_pins(12),
|
"atmega1280": port_pins(12), "atmega2560": port_pins(12),
|
||||||
"sam3x8e": port_pins(4, 32),
|
"sam3x8e": port_pins(4, 32),
|
||||||
"pru": beaglebone_pins(),
|
"pru": beaglebone_pins(),
|
||||||
|
|
|
@ -24,6 +24,8 @@ choice
|
||||||
bool "at90usb1286"
|
bool "at90usb1286"
|
||||||
config MACH_atmega644p
|
config MACH_atmega644p
|
||||||
bool "atmega644p"
|
bool "atmega644p"
|
||||||
|
config MACH_atmega328
|
||||||
|
bool "atmega328"
|
||||||
config MACH_atmega168
|
config MACH_atmega168
|
||||||
bool "atmega168"
|
bool "atmega168"
|
||||||
endchoice
|
endchoice
|
||||||
|
@ -31,6 +33,7 @@ endchoice
|
||||||
config MCU
|
config MCU
|
||||||
string
|
string
|
||||||
default "atmega168" if MACH_atmega168
|
default "atmega168" if MACH_atmega168
|
||||||
|
default "atmega328" if MACH_atmega328
|
||||||
default "atmega644p" if MACH_atmega644p
|
default "atmega644p" if MACH_atmega644p
|
||||||
default "at90usb1286" if MACH_at90usb1286
|
default "at90usb1286" if MACH_at90usb1286
|
||||||
default "atmega1280" if MACH_atmega1280
|
default "atmega1280" if MACH_atmega1280
|
||||||
|
|
|
@ -139,7 +139,7 @@ static const struct gpio_pwm_info pwm_regs[] PROGMEM = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t pwm_pins[ARRAY_SIZE(pwm_regs)] PROGMEM = {
|
static const uint8_t pwm_pins[ARRAY_SIZE(pwm_regs)] PROGMEM = {
|
||||||
#if CONFIG_MACH_atmega168
|
#if CONFIG_MACH_atmega168 || CONFIG_MACH_atmega328
|
||||||
GPIO('D', 6), GPIO('D', 5),
|
GPIO('D', 6), GPIO('D', 5),
|
||||||
GPIO('B', 1), GPIO('B', 2),
|
GPIO('B', 1), GPIO('B', 2),
|
||||||
GPIO('B', 3), GPIO('D', 3),
|
GPIO('B', 3), GPIO('D', 3),
|
||||||
|
@ -241,7 +241,7 @@ gpio_pwm_write(struct gpio_pwm g, uint8_t val)
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
static const uint8_t adc_pins[] PROGMEM = {
|
static const uint8_t adc_pins[] PROGMEM = {
|
||||||
#if CONFIG_MACH_atmega168
|
#if CONFIG_MACH_atmega168 || CONFIG_MACH_atmega328
|
||||||
GPIO('C', 0), GPIO('C', 1), GPIO('C', 2), GPIO('C', 3),
|
GPIO('C', 0), GPIO('C', 1), GPIO('C', 2), GPIO('C', 3),
|
||||||
GPIO('C', 4), GPIO('C', 5), GPIO('E', 0), GPIO('E', 1),
|
GPIO('C', 4), GPIO('C', 5), GPIO('E', 0), GPIO('E', 1),
|
||||||
#elif CONFIG_MACH_atmega644p
|
#elif CONFIG_MACH_atmega644p
|
||||||
|
@ -343,7 +343,7 @@ gpio_adc_cancel_sample(struct gpio_adc g)
|
||||||
* Serial Peripheral Interface (SPI) hardware
|
* Serial Peripheral Interface (SPI) hardware
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#if CONFIG_MACH_atmega168
|
#if CONFIG_MACH_atmega168 || CONFIG_MACH_atmega328
|
||||||
static const uint8_t SS = GPIO('B', 2), SCK = GPIO('B', 5), MOSI = GPIO('B', 3);
|
static const uint8_t SS = GPIO('B', 2), SCK = GPIO('B', 5), MOSI = GPIO('B', 3);
|
||||||
#elif CONFIG_MACH_atmega644p
|
#elif CONFIG_MACH_atmega644p
|
||||||
static const uint8_t SS = GPIO('B', 4), SCK = GPIO('B', 7), MOSI = GPIO('B', 5);
|
static const uint8_t SS = GPIO('B', 4), SCK = GPIO('B', 7), MOSI = GPIO('B', 5);
|
||||||
|
|
Loading…
Reference in New Issue