aboutsummaryrefslogtreecommitdiff
path: root/variants/leonardo/pins_arduino.h
diff options
context:
space:
mode:
authorArturo Guadalupi <a.guadalupi@arduino.cc>2016-07-07 17:51:31 +0200
committerGitHub <noreply@github.com>2016-07-07 17:51:31 +0200
commit5665f869770fa5be65eb8e48651199d14dccdf52 (patch)
treef30bed019a86ec810a44119df1b307ae308d4fc8 /variants/leonardo/pins_arduino.h
parent0c8151db1a3da4382ebb913c12cbfea833970191 (diff)
parent257ee3fd67f70a67b9568dfdbbe7677d06c13ff4 (diff)
Merge pull request #4814 from sandeepmistry/avr-pin_
Add PIN_* defines to AVR variants
Diffstat (limited to 'variants/leonardo/pins_arduino.h')
-rw-r--r--variants/leonardo/pins_arduino.h58
1 files changed, 40 insertions, 18 deletions
diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h
index 6027223..8586dac 100644
--- a/variants/leonardo/pins_arduino.h
+++ b/variants/leonardo/pins_arduino.h
@@ -97,32 +97,54 @@
#define RXLED0 PORTB |= (1<<0)
#define RXLED1 PORTB &= ~(1<<0)
-static const uint8_t SDA = 2;
-static const uint8_t SCL = 3;
+#define PIN_WIRE_SDA (2)
+#define PIN_WIRE_SCL (3)
+
+static const uint8_t SDA = PIN_WIRE_SDA;
+static const uint8_t SCL = PIN_WIRE_SCL;
+
#define LED_BUILTIN 13
#define LED_BUILTIN_RX 17
#define LED_BUILTIN_TX 30
// Map SPI port to 'new' pins D14..D17
-static const uint8_t SS = 17;
-static const uint8_t MOSI = 16;
-static const uint8_t MISO = 14;
-static const uint8_t SCK = 15;
+#define PIN_SPI_SS (17)
+#define PIN_SPI_MOSI (16)
+#define PIN_SPI_MISO (14)
+#define PIN_SPI_SCK (15)
+
+static const uint8_t SS = PIN_SPI_SS;
+static const uint8_t MOSI = PIN_SPI_MOSI;
+static const uint8_t MISO = PIN_SPI_MISO;
+static const uint8_t SCK = PIN_SPI_SCK;
// Mapping of analog pins as digital I/O
// A6-A11 share with digital pins
-static const uint8_t A0 = 18;
-static const uint8_t A1 = 19;
-static const uint8_t A2 = 20;
-static const uint8_t A3 = 21;
-static const uint8_t A4 = 22;
-static const uint8_t A5 = 23;
-static const uint8_t A6 = 24; // D4
-static const uint8_t A7 = 25; // D6
-static const uint8_t A8 = 26; // D8
-static const uint8_t A9 = 27; // D9
-static const uint8_t A10 = 28; // D10
-static const uint8_t A11 = 29; // D12
+#define PIN_A0 (18)
+#define PIN_A1 (19)
+#define PIN_A2 (20)
+#define PIN_A3 (21)
+#define PIN_A4 (22)
+#define PIN_A5 (23)
+#define PIN_A6 (24)
+#define PIN_A7 (25)
+#define PIN_A8 (26)
+#define PIN_A9 (27)
+#define PIN_A10 (28)
+#define PIN_A11 (29)
+
+static const uint8_t A0 = PIN_A0;
+static const uint8_t A1 = PIN_A1;
+static const uint8_t A2 = PIN_A2;
+static const uint8_t A3 = PIN_A3;
+static const uint8_t A4 = PIN_A4;
+static const uint8_t A5 = PIN_A5;
+static const uint8_t A6 = PIN_A6; // D4
+static const uint8_t A7 = PIN_A7; // D6
+static const uint8_t A8 = PIN_A8; // D8
+static const uint8_t A9 = PIN_A9; // D9
+static const uint8_t A10 = PIN_A10; // D10
+static const uint8_t A11 = PIN_A11; // D12
#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) 0