diff options
-rw-r--r-- | docs/adc_driver.md | 4 | ||||
-rw-r--r-- | docs/compatible_microcontrollers.md | 1 | ||||
-rw-r--r-- | docs/feature_backlight.md | 2 | ||||
-rw-r--r-- | docs/spi_driver.md | 2 | ||||
-rw-r--r-- | drivers/avr/analog.c | 4 | ||||
-rw-r--r-- | drivers/avr/spi_master.c | 2 | ||||
-rw-r--r-- | drivers/avr/spi_master.h | 2 | ||||
-rw-r--r-- | quantum/backlight/backlight_avr.c | 2 | ||||
-rw-r--r-- | quantum/config_common.h | 2 | ||||
-rw-r--r-- | quantum/mcu_selection.mk | 18 | ||||
-rw-r--r-- | tmk_core/common/avr/bootloader.c | 2 | ||||
-rw-r--r-- | tmk_core/common/uart.c | 2 |
12 files changed, 31 insertions, 12 deletions
diff --git a/docs/adc_driver.md b/docs/adc_driver.md index 7c4e05efc..f8fb94094 100644 --- a/docs/adc_driver.md +++ b/docs/adc_driver.md | |||
@@ -22,7 +22,7 @@ Then place this include at the top of your code: | |||
22 | 22 | ||
23 | ### AVR | 23 | ### AVR |
24 | 24 | ||
25 | |Channel|AT90USB64/128|ATmega16/32U4|ATmega32A|ATmega328P| | 25 | |Channel|AT90USB64/128|ATmega16/32U4|ATmega32A|ATmega328/P| |
26 | |-------|-------------|-------------|---------|----------| | 26 | |-------|-------------|-------------|---------|----------| |
27 | |0 |`F0` |`F0` |`A0` |`C0` | | 27 | |0 |`F0` |`F0` |`A0` |`C0` | |
28 | |1 |`F1` |`F1` |`A1` |`C1` | | 28 | |1 |`F1` |`F1` |`A1` |`C1` | |
@@ -39,7 +39,7 @@ Then place this include at the top of your code: | |||
39 | |12 | |`B5` | | | | 39 | |12 | |`B5` | | | |
40 | |13 | |`B6` | | | | 40 | |13 | |`B6` | | | |
41 | 41 | ||
42 | <sup>\* The ATmega328P possesses two extra ADC channels; however, they are not present on the DIP pinout, and are not shared with GPIO pins. You can use `adc_read()` directly to gain access to these.</sup> | 42 | <sup>\* The ATmega328/P possesses two extra ADC channels; however, they are not present on the DIP pinout, and are not shared with GPIO pins. You can use `adc_read()` directly to gain access to these.</sup> |
43 | 43 | ||
44 | ### ARM | 44 | ### ARM |
45 | 45 | ||
diff --git a/docs/compatible_microcontrollers.md b/docs/compatible_microcontrollers.md index 85dd440d3..ac90ed746 100644 --- a/docs/compatible_microcontrollers.md +++ b/docs/compatible_microcontrollers.md | |||
@@ -14,6 +14,7 @@ Certain MCUs which do not have native USB will use [V-USB](https://www.obdev.at/ | |||
14 | 14 | ||
15 | * [ATmega32A](https://www.microchip.com/wwwproducts/en/ATmega32A) | 15 | * [ATmega32A](https://www.microchip.com/wwwproducts/en/ATmega32A) |
16 | * [ATmega328P](https://www.microchip.com/wwwproducts/en/ATmega328P) | 16 | * [ATmega328P](https://www.microchip.com/wwwproducts/en/ATmega328P) |
17 | * [ATmega328](https://www.microchip.com/wwwproducts/en/ATmega328) | ||
17 | 18 | ||
18 | ## ARM | 19 | ## ARM |
19 | 20 | ||
diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md index 5f69468c3..7e4401b40 100644 --- a/docs/feature_backlight.md +++ b/docs/feature_backlight.md | |||
@@ -89,7 +89,7 @@ BACKLIGHT_DRIVER = pwm | |||
89 | 89 | ||
90 | Hardware PWM is supported according to the following table: | 90 | Hardware PWM is supported according to the following table: |
91 | 91 | ||
92 | |Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A|ATmega328P| | 92 | |Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A|ATmega328/P| |
93 | |-------------|-------------|-------------|-------------|---------|----------| | 93 | |-------------|-------------|-------------|-------------|---------|----------| |
94 | |`B1` | | | | |Timer 1 | | 94 | |`B1` | | | | |Timer 1 | |
95 | |`B2` | | | | |Timer 1 | | 95 | |`B2` | | | | |Timer 1 | |
diff --git a/docs/spi_driver.md b/docs/spi_driver.md index c170bf1df..1d432432a 100644 --- a/docs/spi_driver.md +++ b/docs/spi_driver.md | |||
@@ -11,7 +11,7 @@ No special setup is required - just connect the `SS`, `SCK`, `MOSI` and `MISO` p | |||
11 | |ATMega16/32U2/4|`B0`|`B1` |`B2` |`B3` | | 11 | |ATMega16/32U2/4|`B0`|`B1` |`B2` |`B3` | |
12 | |AT90USB64/128 |`B0`|`B1` |`B2` |`B3` | | 12 | |AT90USB64/128 |`B0`|`B1` |`B2` |`B3` | |
13 | |ATmega32A |`B4`|`B7` |`B5` |`B6` | | 13 | |ATmega32A |`B4`|`B7` |`B5` |`B6` | |
14 | |ATmega328P |`B2`|`B5` |`B3` |`B4` | | 14 | |ATmega328/P |`B2`|`B5` |`B3` |`B4` | |
15 | 15 | ||
16 | You may use more than one slave select pin, not just the `SS` pin. This is useful when you have multiple devices connected and need to communicate with them individually. | 16 | You may use more than one slave select pin, not just the `SS` pin. This is useful when you have multiple devices connected and need to communicate with them individually. |
17 | `SPI_SS_PIN` can be passed to `spi_start()` to refer to `SS`. | 17 | `SPI_SS_PIN` can be passed to `spi_start()` to refer to `SS`. |
diff --git a/drivers/avr/analog.c b/drivers/avr/analog.c index abe478b71..9b8397b93 100644 --- a/drivers/avr/analog.c +++ b/drivers/avr/analog.c | |||
@@ -38,7 +38,7 @@ int16_t analogRead(uint8_t pin) { | |||
38 | // clang-format on | 38 | // clang-format on |
39 | if (pin >= 12) return 0; | 39 | if (pin >= 12) return 0; |
40 | return adc_read(pgm_read_byte(pin_to_mux + pin)); | 40 | return adc_read(pgm_read_byte(pin_to_mux + pin)); |
41 | #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega328P__) | 41 | #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) |
42 | if (pin >= 8) return 0; | 42 | if (pin >= 8) return 0; |
43 | return adc_read(pin); | 43 | return adc_read(pin); |
44 | #else | 44 | #else |
@@ -85,7 +85,7 @@ uint8_t pinToMux(pin_t pin) { | |||
85 | case A6: return _BV(MUX2) | _BV(MUX1); // ADC6 | 85 | case A6: return _BV(MUX2) | _BV(MUX1); // ADC6 |
86 | case A7: return _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // ADC7 | 86 | case A7: return _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // ADC7 |
87 | default: return _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // 0V | 87 | default: return _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // 0V |
88 | #elif defined(__AVR_ATmega328P__) | 88 | #elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) |
89 | case C0: return 0; // ADC0 | 89 | case C0: return 0; // ADC0 |
90 | case C1: return _BV(MUX0); // ADC1 | 90 | case C1: return _BV(MUX0); // ADC1 |
91 | case C2: return _BV(MUX1); // ADC2 | 91 | case C2: return _BV(MUX1); // ADC2 |
diff --git a/drivers/avr/spi_master.c b/drivers/avr/spi_master.c index 32cc55c83..f91baf70b 100644 --- a/drivers/avr/spi_master.c +++ b/drivers/avr/spi_master.c | |||
@@ -28,7 +28,7 @@ | |||
28 | # define SPI_SCK_PIN B7 | 28 | # define SPI_SCK_PIN B7 |
29 | # define SPI_MOSI_PIN B5 | 29 | # define SPI_MOSI_PIN B5 |
30 | # define SPI_MISO_PIN B6 | 30 | # define SPI_MISO_PIN B6 |
31 | #elif defined(__AVR_ATmega328P__) | 31 | #elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) |
32 | # define SPI_SCK_PIN B5 | 32 | # define SPI_SCK_PIN B5 |
33 | # define SPI_MOSI_PIN B3 | 33 | # define SPI_MOSI_PIN B3 |
34 | # define SPI_MISO_PIN B4 | 34 | # define SPI_MISO_PIN B4 |
diff --git a/drivers/avr/spi_master.h b/drivers/avr/spi_master.h index b69c1cbd6..e36a7c21c 100644 --- a/drivers/avr/spi_master.h +++ b/drivers/avr/spi_master.h | |||
@@ -25,7 +25,7 @@ typedef int16_t spi_status_t; | |||
25 | # define SPI_SS_PIN B0 | 25 | # define SPI_SS_PIN B0 |
26 | #elif defined(__AVR_ATmega32A__) | 26 | #elif defined(__AVR_ATmega32A__) |
27 | # define SPI_SS_PIN B4 | 27 | # define SPI_SS_PIN B4 |
28 | #elif defined(__AVR_ATmega328P__) | 28 | #elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) |
29 | # define SPI_SS_PIN B2 | 29 | # define SPI_SS_PIN B2 |
30 | #endif | 30 | #endif |
31 | 31 | ||
diff --git a/quantum/backlight/backlight_avr.c b/quantum/backlight/backlight_avr.c index ce13f1118..b3e882ffe 100644 --- a/quantum/backlight/backlight_avr.c +++ b/quantum/backlight/backlight_avr.c | |||
@@ -103,7 +103,7 @@ | |||
103 | # define COMxx1 COM1A1 | 103 | # define COMxx1 COM1A1 |
104 | # define OCRxx OCR1A | 104 | # define OCRxx OCR1A |
105 | # endif | 105 | # endif |
106 | #elif defined(__AVR_ATmega328P__) && (BACKLIGHT_PIN == B1 || BACKLIGHT_PIN == B2) | 106 | #elif (defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)) && (BACKLIGHT_PIN == B1 || BACKLIGHT_PIN == B2) |
107 | # define HARDWARE_PWM | 107 | # define HARDWARE_PWM |
108 | # define ICRx ICR1 | 108 | # define ICRx ICR1 |
109 | # define TCCRxA TCCR1A | 109 | # define TCCRxA TCCR1A |
diff --git a/quantum/config_common.h b/quantum/config_common.h index 9861c8678..9b28e8d63 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h | |||
@@ -58,7 +58,7 @@ | |||
58 | # define PINC_ADDRESS 0x3 | 58 | # define PINC_ADDRESS 0x3 |
59 | # define PINB_ADDRESS 0x6 | 59 | # define PINB_ADDRESS 0x6 |
60 | # define PINA_ADDRESS 0x9 | 60 | # define PINA_ADDRESS 0x9 |
61 | # elif defined(__AVR_ATmega328P__) | 61 | # elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) |
62 | # define ADDRESS_BASE 0x00 | 62 | # define ADDRESS_BASE 0x00 |
63 | # define PINB_ADDRESS 0x3 | 63 | # define PINB_ADDRESS 0x3 |
64 | # define PINC_ADDRESS 0x6 | 64 | # define PINC_ADDRESS 0x6 |
diff --git a/quantum/mcu_selection.mk b/quantum/mcu_selection.mk index 33de162bb..a1d2c5fbf 100644 --- a/quantum/mcu_selection.mk +++ b/quantum/mcu_selection.mk | |||
@@ -288,6 +288,24 @@ ifneq (,$(filter $(MCU),atmega328p)) | |||
288 | NO_SUSPEND_POWER_DOWN ?= yes | 288 | NO_SUSPEND_POWER_DOWN ?= yes |
289 | endif | 289 | endif |
290 | 290 | ||
291 | ifneq (,$(filter $(MCU),atmega328)) | ||
292 | # MCU name for avrdude | ||
293 | AVRDUDE_MCU = m328 | ||
294 | |||
295 | PROTOCOL = VUSB | ||
296 | |||
297 | # Processor frequency. | ||
298 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
299 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
300 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
301 | # automatically to create a 32-bit value in your source code. | ||
302 | F_CPU ?= 16000000 | ||
303 | |||
304 | # unsupported features for now | ||
305 | NO_UART ?= yes | ||
306 | NO_SUSPEND_POWER_DOWN ?= yes | ||
307 | endif | ||
308 | |||
291 | ifneq (,$(filter $(MCU),attiny85)) | 309 | ifneq (,$(filter $(MCU),attiny85)) |
292 | PROTOCOL = VUSB | 310 | PROTOCOL = VUSB |
293 | 311 | ||
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c index 7e5d2b057..a1db55da9 100644 --- a/tmk_core/common/avr/bootloader.c +++ b/tmk_core/common/avr/bootloader.c | |||
@@ -247,7 +247,7 @@ void bootloader_jump(void) { | |||
247 | 247 | ||
248 | #else // Assume remaining boards are DFU, even if the flag isn't set | 248 | #else // Assume remaining boards are DFU, even if the flag isn't set |
249 | 249 | ||
250 | # if !(defined(__AVR_ATmega32A__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATtiny85__)) // no USB - maybe BOOTLOADER_BOOTLOADHID instead though? | 250 | # if !(defined(__AVR_ATmega32A__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) || defined(__AVR_ATtiny85__)) // no USB - maybe BOOTLOADER_BOOTLOADHID instead though? |
251 | UDCON = 1; | 251 | UDCON = 1; |
252 | USBCON = (1 << FRZCLK); // disable USB | 252 | USBCON = (1 << FRZCLK); // disable USB |
253 | UCSR1B = 0; | 253 | UCSR1B = 0; |
diff --git a/tmk_core/common/uart.c b/tmk_core/common/uart.c index b29d3bbb9..150e256c8 100644 --- a/tmk_core/common/uart.c +++ b/tmk_core/common/uart.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | #include "uart.h" | 32 | #include "uart.h" |
33 | 33 | ||
34 | #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) | 34 | #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) |
35 | # define UDRn UDR0 | 35 | # define UDRn UDR0 |
36 | # define UBRRnL UBRR0L | 36 | # define UBRRnL UBRR0L |
37 | # define UCSRnA UCSR0A | 37 | # define UCSRnA UCSR0A |