Skip to content

Commit

Permalink
Merge pull request esp8266#2640 from Lauszus/variants
Browse files Browse the repository at this point in the history
Add PIN defines, so the pins can easily be used by external libraries
  • Loading branch information
igrr authored Nov 14, 2016
2 parents f4c3910 + 6d6f22e commit 3e7b4b8
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 49 deletions.
7 changes: 5 additions & 2 deletions variants/ESPDuino/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@

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

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 16;
static const uint8_t BUILTIN_LED = 16;
Expand Down
7 changes: 5 additions & 2 deletions variants/adafruit/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

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

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 0;
static const uint8_t BUILTIN_LED = 0;
Expand Down
7 changes: 5 additions & 2 deletions variants/d1/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

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

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 2;//new ESP-12E GPIO2
static const uint8_t BUILTIN_LED = 2;//new ESP-12E GPIO2
Expand Down
7 changes: 5 additions & 2 deletions variants/d1_mini/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

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

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 2;
static const uint8_t BUILTIN_LED = 2;
Expand Down
7 changes: 5 additions & 2 deletions variants/espino/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

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

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 2;
static const uint8_t LED_BUILTIN_R = 2;
Expand Down
7 changes: 5 additions & 2 deletions variants/espinotee/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

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

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t BUILTIN_LED = 16;
static const uint8_t LED_BUILTIN = 16;
Expand Down
7 changes: 5 additions & 2 deletions variants/espresso_lite_v1/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@

#define ESPRESSO_LITE_VERSION 1

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 16;
static const uint8_t BUILTIN_LED = 16;
Expand Down
7 changes: 5 additions & 2 deletions variants/espresso_lite_v2/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@

#define ESPRESSO_LITE_VERSION 2

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 2;
static const uint8_t BUILTIN_LED = 2;
Expand Down
17 changes: 12 additions & 5 deletions variants/generic/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)? (p) : NOT_AN_INTERRUPT)
#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS && !isFlashInterfacePin(p))? 1 : 0)

static const uint8_t SS = 15;
static const uint8_t MOSI = 13;
static const uint8_t MISO = 12;
static const uint8_t SCK = 14;
#define PIN_SPI_SS (15)
#define PIN_SPI_MOSI (13)
#define PIN_SPI_MISO (12)
#define PIN_SPI_SCK (14)

static const uint8_t A0 = 17;
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;

#define PIN_A0 (17)

static const uint8_t A0 = PIN_A0;

// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
Expand Down
7 changes: 5 additions & 2 deletions variants/generic/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

#include "common.h"

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t BUILTIN_LED = 1;
static const uint8_t LED_BUILTIN = 1;
Expand Down
7 changes: 5 additions & 2 deletions variants/nodemcu/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

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

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 16;
static const uint8_t BUILTIN_LED = 16;
Expand Down
7 changes: 5 additions & 2 deletions variants/phoenix_v1/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@

#define PHOENIX_VERSION 1

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 16;
static const uint8_t BUILTIN_LED = 16;
Expand Down
7 changes: 5 additions & 2 deletions variants/phoenix_v2/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@

#define PHOENIX_VERSION 2

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 2;
static const uint8_t BUILTIN_LED = 2;
Expand Down
7 changes: 5 additions & 2 deletions variants/thing/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@

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

static const uint8_t SDA = 2;
static const uint8_t SCL = 14;
#define PIN_WIRE_SDA (2)
#define PIN_WIRE_SCL (14)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 5;
static const uint8_t BUILTIN_LED = 5;
Expand Down
7 changes: 5 additions & 2 deletions variants/wifinfo/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@

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

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

static const uint8_t LED_BUILTIN = 12;
static const uint8_t BUILTIN_LED = 12;
Expand Down
49 changes: 33 additions & 16 deletions variants/wifio/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,39 @@
#define NUM_ANALOG_INPUTS 1
#define ESP_PINS_OFFSET 20

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;

static const uint8_t SS = 12;
static const uint8_t MOSI = 13;
static const uint8_t MISO = 14;
static const uint8_t SCK = 15;

static const uint8_t A0 = 14;
static const uint8_t A1 = 15;
static const uint8_t A2 = 16;
static const uint8_t A3 = 17;
static const uint8_t A4 = 18;
static const uint8_t A5 = 19;
static const uint8_t A6 = 20;
static const uint8_t A7 = 21;
#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

#define PIN_SPI_SS (12)
#define PIN_SPI_MOSI (13)
#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;

#define PIN_A0 (14)
#define PIN_A1 (15)
#define PIN_A2 (16)
#define PIN_A3 (17)
#define PIN_A4 (18)
#define PIN_A5 (19)
#define PIN_A6 (20)
#define PIN_A7 (21)

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;
static const uint8_t A7 = PIN_A7;

static const uint8_t E0 = ESP_PINS_OFFSET + 0;
static const uint8_t E1 = ESP_PINS_OFFSET + 1;
Expand Down

0 comments on commit 3e7b4b8

Please sign in to comment.