Skip to content

Commit 3e7b4b8

Browse files
authored
Merge pull request esp8266#2640 from Lauszus/variants
Add PIN defines, so the pins can easily be used by external libraries
2 parents f4c3910 + 6d6f22e commit 3e7b4b8

File tree

16 files changed

+115
-49
lines changed

16 files changed

+115
-49
lines changed

variants/ESPDuino/pins_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@
2727

2828
#include "../generic/common.h"
2929

30-
static const uint8_t SDA = 4;
31-
static const uint8_t SCL = 5;
30+
#define PIN_WIRE_SDA (4)
31+
#define PIN_WIRE_SCL (5)
32+
33+
static const uint8_t SDA = PIN_WIRE_SDA;
34+
static const uint8_t SCL = PIN_WIRE_SCL;
3235

3336
static const uint8_t LED_BUILTIN = 16;
3437
static const uint8_t BUILTIN_LED = 16;

variants/adafruit/pins_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828

2929
#include "../generic/common.h"
3030

31-
static const uint8_t SDA = 4;
32-
static const uint8_t SCL = 5;
31+
#define PIN_WIRE_SDA (4)
32+
#define PIN_WIRE_SCL (5)
33+
34+
static const uint8_t SDA = PIN_WIRE_SDA;
35+
static const uint8_t SCL = PIN_WIRE_SCL;
3336

3437
static const uint8_t LED_BUILTIN = 0;
3538
static const uint8_t BUILTIN_LED = 0;

variants/d1/pins_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828

2929
#include "../generic/common.h"
3030

31-
static const uint8_t SDA = 4;
32-
static const uint8_t SCL = 5;
31+
#define PIN_WIRE_SDA (4)
32+
#define PIN_WIRE_SCL (5)
33+
34+
static const uint8_t SDA = PIN_WIRE_SDA;
35+
static const uint8_t SCL = PIN_WIRE_SCL;
3336

3437
static const uint8_t LED_BUILTIN = 2;//new ESP-12E GPIO2
3538
static const uint8_t BUILTIN_LED = 2;//new ESP-12E GPIO2

variants/d1_mini/pins_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828

2929
#include "../generic/common.h"
3030

31-
static const uint8_t SDA = 4;
32-
static const uint8_t SCL = 5;
31+
#define PIN_WIRE_SDA (4)
32+
#define PIN_WIRE_SCL (5)
33+
34+
static const uint8_t SDA = PIN_WIRE_SDA;
35+
static const uint8_t SCL = PIN_WIRE_SCL;
3336

3437
static const uint8_t LED_BUILTIN = 2;
3538
static const uint8_t BUILTIN_LED = 2;

variants/espino/pins_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828

2929
#include "../generic/common.h"
3030

31-
static const uint8_t SDA = 4;
32-
static const uint8_t SCL = 5;
31+
#define PIN_WIRE_SDA (4)
32+
#define PIN_WIRE_SCL (5)
33+
34+
static const uint8_t SDA = PIN_WIRE_SDA;
35+
static const uint8_t SCL = PIN_WIRE_SCL;
3336

3437
static const uint8_t LED_BUILTIN = 2;
3538
static const uint8_t LED_BUILTIN_R = 2;

variants/espinotee/pins_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828

2929
#include "../generic/common.h"
3030

31-
static const uint8_t SDA = 4;
32-
static const uint8_t SCL = 5;
31+
#define PIN_WIRE_SDA (4)
32+
#define PIN_WIRE_SCL (5)
33+
34+
static const uint8_t SDA = PIN_WIRE_SDA;
35+
static const uint8_t SCL = PIN_WIRE_SCL;
3336

3437
static const uint8_t BUILTIN_LED = 16;
3538
static const uint8_t LED_BUILTIN = 16;

variants/espresso_lite_v1/pins_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030

3131
#define ESPRESSO_LITE_VERSION 1
3232

33-
static const uint8_t SDA = 4;
34-
static const uint8_t SCL = 5;
33+
#define PIN_WIRE_SDA (4)
34+
#define PIN_WIRE_SCL (5)
35+
36+
static const uint8_t SDA = PIN_WIRE_SDA;
37+
static const uint8_t SCL = PIN_WIRE_SCL;
3538

3639
static const uint8_t LED_BUILTIN = 16;
3740
static const uint8_t BUILTIN_LED = 16;

variants/espresso_lite_v2/pins_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030

3131
#define ESPRESSO_LITE_VERSION 2
3232

33-
static const uint8_t SDA = 4;
34-
static const uint8_t SCL = 5;
33+
#define PIN_WIRE_SDA (4)
34+
#define PIN_WIRE_SCL (5)
35+
36+
static const uint8_t SDA = PIN_WIRE_SDA;
37+
static const uint8_t SCL = PIN_WIRE_SCL;
3538

3639
static const uint8_t LED_BUILTIN = 2;
3740
static const uint8_t BUILTIN_LED = 2;

variants/generic/common.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,19 @@
3737
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)? (p) : NOT_AN_INTERRUPT)
3838
#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS && !isFlashInterfacePin(p))? 1 : 0)
3939

40-
static const uint8_t SS = 15;
41-
static const uint8_t MOSI = 13;
42-
static const uint8_t MISO = 12;
43-
static const uint8_t SCK = 14;
40+
#define PIN_SPI_SS (15)
41+
#define PIN_SPI_MOSI (13)
42+
#define PIN_SPI_MISO (12)
43+
#define PIN_SPI_SCK (14)
4444

45-
static const uint8_t A0 = 17;
45+
static const uint8_t SS = PIN_SPI_SS;
46+
static const uint8_t MOSI = PIN_SPI_MOSI;
47+
static const uint8_t MISO = PIN_SPI_MISO;
48+
static const uint8_t SCK = PIN_SPI_SCK;
49+
50+
#define PIN_A0 (17)
51+
52+
static const uint8_t A0 = PIN_A0;
4653

4754
// These serial port names are intended to allow libraries and architecture-neutral
4855
// sketches to automatically default to the correct port name for a particular type

variants/generic/pins_arduino.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828

2929
#include "common.h"
3030

31-
static const uint8_t SDA = 4;
32-
static const uint8_t SCL = 5;
31+
#define PIN_WIRE_SDA (4)
32+
#define PIN_WIRE_SCL (5)
33+
34+
static const uint8_t SDA = PIN_WIRE_SDA;
35+
static const uint8_t SCL = PIN_WIRE_SCL;
3336

3437
static const uint8_t BUILTIN_LED = 1;
3538
static const uint8_t LED_BUILTIN = 1;

0 commit comments

Comments
 (0)