summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authoritsnoteasy <pyrosoma1@yahoo.ie>2020-06-10 22:23:11 +0100
committerDrashna Jael're <drashna@live.com>2020-08-08 21:04:00 -0700
commit7d8930c80579798cbdd992c6561a6e3a3c447a33 (patch)
tree6e0cccc38bed0e8f060f03b75d0843c73c32f4c9 /drivers
parentd26bb7e403f7e0451bfab8900e86f6cc3add1efa (diff)
adds support for the atmega328 (#9043)
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/avr/analog.c4
-rw-r--r--drivers/avr/spi_master.c2
-rw-r--r--drivers/avr/spi_master.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/drivers/avr/analog.c b/drivers/avr/analog.c
index abe478b712..9b8397b933 100644
--- a/drivers/avr/analog.c
+++ b/drivers/avr/analog.c
@@ -38,7 +38,7 @@ int16_t analogRead(uint8_t pin) {
// clang-format on
if (pin >= 12) return 0;
return adc_read(pgm_read_byte(pin_to_mux + pin));
-#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega328P__)
+#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
if (pin >= 8) return 0;
return adc_read(pin);
#else
@@ -85,7 +85,7 @@ uint8_t pinToMux(pin_t pin) {
case A6: return _BV(MUX2) | _BV(MUX1); // ADC6
case A7: return _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // ADC7
default: return _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // 0V
-#elif defined(__AVR_ATmega328P__)
+#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
case C0: return 0; // ADC0
case C1: return _BV(MUX0); // ADC1
case C2: return _BV(MUX1); // ADC2
diff --git a/drivers/avr/spi_master.c b/drivers/avr/spi_master.c
index 32cc55c836..f91baf70ba 100644
--- a/drivers/avr/spi_master.c
+++ b/drivers/avr/spi_master.c
@@ -28,7 +28,7 @@
# define SPI_SCK_PIN B7
# define SPI_MOSI_PIN B5
# define SPI_MISO_PIN B6
-#elif defined(__AVR_ATmega328P__)
+#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
# define SPI_SCK_PIN B5
# define SPI_MOSI_PIN B3
# define SPI_MISO_PIN B4
diff --git a/drivers/avr/spi_master.h b/drivers/avr/spi_master.h
index b69c1cbd66..e36a7c21c0 100644
--- a/drivers/avr/spi_master.h
+++ b/drivers/avr/spi_master.h
@@ -25,7 +25,7 @@ typedef int16_t spi_status_t;
# define SPI_SS_PIN B0
#elif defined(__AVR_ATmega32A__)
# define SPI_SS_PIN B4
-#elif defined(__AVR_ATmega328P__)
+#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
# define SPI_SS_PIN B2
#endif