Skip to content

Commit ba95fd1

Browse files
committed
Add PIN defines, so the pins can easily be used by external libraries
See: arduino/Arduino#4814
1 parent 2c28709 commit ba95fd1

File tree

2 files changed

+64
-28
lines changed

2 files changed

+64
-28
lines changed

avr/variants/sanguino/pins_arduino.h

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,42 @@
3434

3535
#include <avr/pgmspace.h>
3636

37-
static const uint8_t SS = 4;
38-
static const uint8_t MOSI = 5;
39-
static const uint8_t MISO = 6;
40-
static const uint8_t SCK = 7;
4137

42-
static const uint8_t SDA = 17;
43-
static const uint8_t SCL = 16;
38+
#define PIN_SPI_SS (4)
39+
#define PIN_SPI_MOSI (5)
40+
#define PIN_SPI_MISO (6)
41+
#define PIN_SPI_SCK (7)
42+
43+
static const uint8_t SS = PIN_SPI_SS;
44+
static const uint8_t MOSI = PIN_SPI_MOSI;
45+
static const uint8_t MISO = PIN_SPI_MISO;
46+
static const uint8_t SCK = PIN_SPI_SCK;
47+
48+
#define PIN_WIRE_SDA (17)
49+
#define PIN_WIRE_SCL (16)
50+
51+
static const uint8_t SDA = PIN_WIRE_SDA;
52+
static const uint8_t SCL = PIN_WIRE_SCL;
4453

4554
#define LED_BUILTIN 0
4655

47-
static const uint8_t A0 = 31;
48-
static const uint8_t A1 = 30;
49-
static const uint8_t A2 = 29;
50-
static const uint8_t A3 = 28;
51-
static const uint8_t A4 = 27;
52-
static const uint8_t A5 = 26;
53-
static const uint8_t A6 = 25;
54-
static const uint8_t A7 = 24;
56+
#define PIN_A0 (31)
57+
#define PIN_A1 (30)
58+
#define PIN_A2 (29)
59+
#define PIN_A3 (28)
60+
#define PIN_A4 (27)
61+
#define PIN_A5 (26)
62+
#define PIN_A6 (25)
63+
#define PIN_A7 (24)
64+
65+
static const uint8_t A0 = PIN_A0;
66+
static const uint8_t A1 = PIN_A1;
67+
static const uint8_t A2 = PIN_A2;
68+
static const uint8_t A3 = PIN_A3;
69+
static const uint8_t A4 = PIN_A4;
70+
static const uint8_t A5 = PIN_A5;
71+
static const uint8_t A6 = PIN_A6;
72+
static const uint8_t A7 = PIN_A7;
5573

5674
// ATMEL ATMEGA644/ATMEGA1284 / SANGUINO
5775
//

variants/sanguino/pins_arduino.h

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,42 @@
3434

3535
#include <avr/pgmspace.h>
3636

37-
static const uint8_t SS = 4;
38-
static const uint8_t MOSI = 5;
39-
static const uint8_t MISO = 6;
40-
static const uint8_t SCK = 7;
4137

42-
static const uint8_t SDA = 17;
43-
static const uint8_t SCL = 16;
38+
#define PIN_SPI_SS (4)
39+
#define PIN_SPI_MOSI (5)
40+
#define PIN_SPI_MISO (6)
41+
#define PIN_SPI_SCK (7)
42+
43+
static const uint8_t SS = PIN_SPI_SS;
44+
static const uint8_t MOSI = PIN_SPI_MOSI;
45+
static const uint8_t MISO = PIN_SPI_MISO;
46+
static const uint8_t SCK = PIN_SPI_SCK;
47+
48+
#define PIN_WIRE_SDA (17)
49+
#define PIN_WIRE_SCL (16)
50+
51+
static const uint8_t SDA = PIN_WIRE_SDA;
52+
static const uint8_t SCL = PIN_WIRE_SCL;
4453

4554
#define LED_BUILTIN 0
4655

47-
static const uint8_t A0 = 31;
48-
static const uint8_t A1 = 30;
49-
static const uint8_t A2 = 29;
50-
static const uint8_t A3 = 28;
51-
static const uint8_t A4 = 27;
52-
static const uint8_t A5 = 26;
53-
static const uint8_t A6 = 25;
54-
static const uint8_t A7 = 24;
56+
#define PIN_A0 (31)
57+
#define PIN_A1 (30)
58+
#define PIN_A2 (29)
59+
#define PIN_A3 (28)
60+
#define PIN_A4 (27)
61+
#define PIN_A5 (26)
62+
#define PIN_A6 (25)
63+
#define PIN_A7 (24)
64+
65+
static const uint8_t A0 = PIN_A0;
66+
static const uint8_t A1 = PIN_A1;
67+
static const uint8_t A2 = PIN_A2;
68+
static const uint8_t A3 = PIN_A3;
69+
static const uint8_t A4 = PIN_A4;
70+
static const uint8_t A5 = PIN_A5;
71+
static const uint8_t A6 = PIN_A6;
72+
static const uint8_t A7 = PIN_A7;
5573

5674
// ATMEL ATMEGA644/ATMEGA1284 / SANGUINO
5775
//

0 commit comments

Comments
 (0)