Skip to content

Commit 5dd6acc

Browse files
committed
Merge pull request #1833 from esp8266/digitalPinHasPWM_fix
Clean up variants, fix digitalPinHasPWM definition
2 parents 2e849e3 + 0f719e8 commit 5dd6acc

File tree

13 files changed

+87
-420
lines changed

13 files changed

+87
-420
lines changed

variants/ESPDuino/pins_arduino.h

+1-35
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,12 @@
2525
#ifndef Pins_Arduino_h
2626
#define Pins_Arduino_h
2727

28-
#define EXTERNAL_NUM_INTERRUPTS 16
29-
#define NUM_DIGITAL_PINS 17
30-
#define NUM_ANALOG_INPUTS 1
31-
32-
#define analogInputToDigitalPin(p) ((p > 0)?NOT_A_PIN:0)
33-
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)?p:NOT_A_PIN)
34-
#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS)?p:NOT_A_PIN)
28+
#include "../generic/common.h"
3529

3630
static const uint8_t SDA = 4;
3731
static const uint8_t SCL = 5;
3832

39-
static const uint8_t SS = 15;
40-
static const uint8_t MOSI = 13;
41-
static const uint8_t MISO = 12;
42-
static const uint8_t SCK = 14;
43-
4433
static const uint8_t LED_BUILTIN = 16;
45-
4634
static const uint8_t BUILTIN_LED = 16;
4735

48-
static const uint8_t A0 = 17;
49-
50-
// These serial port names are intended to allow libraries and architecture-neutral
51-
// sketches to automatically default to the correct port name for a particular type
52-
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
53-
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
54-
//
55-
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
56-
//
57-
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
58-
//
59-
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
60-
//
61-
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
62-
//
63-
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
64-
// pins are NOT connected to anything by default.
65-
#define SERIAL_PORT_MONITOR Serial
66-
#define SERIAL_PORT_USBVIRTUAL Serial
67-
#define SERIAL_PORT_HARDWARE Serial
68-
#define SERIAL_PORT_HARDWARE_OPEN Serial
69-
7036
#endif /* Pins_Arduino_h */

variants/adafruit/pins_arduino.h

+2-36
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
pins_arduino.h - Pin definition functions for Arduino
3-
Part of Arduino - http://www.arduino.cc/
3+
Part of ESP8266 core for Arduino - https://github.com/esp8266/Arduino
44
55
Copyright (c) 2007 David A. Mellis
66
Modified for ESP8266 platform by Ivan Grokhotkov, 2014-2015.
@@ -26,46 +26,12 @@
2626
#ifndef Pins_Arduino_h
2727
#define Pins_Arduino_h
2828

29-
#define EXTERNAL_NUM_INTERRUPTS 16
30-
#define NUM_DIGITAL_PINS 17
31-
#define NUM_ANALOG_INPUTS 1
32-
33-
#define analogInputToDigitalPin(p) ((p > 0)?NOT_A_PIN:0)
34-
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)?p:NOT_A_PIN)
35-
#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS)?p:NOT_A_PIN)
29+
#include "../generic/common.h"
3630

3731
static const uint8_t SDA = 4;
3832
static const uint8_t SCL = 5;
3933

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;
44-
4534
static const uint8_t LED_BUILTIN = 0;
4635
static const uint8_t BUILTIN_LED = 0;
4736

48-
static const uint8_t A0 = 17;
49-
50-
// These serial port names are intended to allow libraries and architecture-neutral
51-
// sketches to automatically default to the correct port name for a particular type
52-
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
53-
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
54-
//
55-
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
56-
//
57-
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
58-
//
59-
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
60-
//
61-
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
62-
//
63-
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
64-
// pins are NOT connected to anything by default.
65-
#define SERIAL_PORT_MONITOR Serial
66-
#define SERIAL_PORT_USBVIRTUAL Serial
67-
#define SERIAL_PORT_HARDWARE Serial
68-
#define SERIAL_PORT_HARDWARE_OPEN Serial
69-
7037
#endif /* Pins_Arduino_h */
71-

variants/d1/pins_arduino.h

+1-34
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,14 @@
2626
#ifndef Pins_Arduino_h
2727
#define Pins_Arduino_h
2828

29-
#define EXTERNAL_NUM_INTERRUPTS 16
30-
#define NUM_DIGITAL_PINS 17
31-
#define NUM_ANALOG_INPUTS 1
32-
33-
#define analogInputToDigitalPin(p) ((p > 0)?NOT_A_PIN:0)
34-
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)?p:NOT_A_PIN)
35-
#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS)?p:NOT_A_PIN)
29+
#include "../generic/common.h"
3630

3731
static const uint8_t SDA = 4;
3832
static const uint8_t SCL = 5;
3933

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;
44-
4534
static const uint8_t LED_BUILTIN = 2;//new ESP-12E GPIO2
4635
static const uint8_t BUILTIN_LED = 2;//new ESP-12E GPIO2
4736

48-
static const uint8_t A0 = 17;
49-
5037
static const uint8_t D0 = 3;
5138
static const uint8_t D1 = 1;
5239
static const uint8_t D2 = 16;
@@ -64,24 +51,4 @@ static const uint8_t D13 = 14;
6451
static const uint8_t D14 = 4;
6552
static const uint8_t D15 = 5;
6653

67-
// These serial port names are intended to allow libraries and architecture-neutral
68-
// sketches to automatically default to the correct port name for a particular type
69-
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
70-
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
71-
//
72-
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
73-
//
74-
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
75-
//
76-
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
77-
//
78-
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
79-
//
80-
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
81-
// pins are NOT connected to anything by default.
82-
#define SERIAL_PORT_MONITOR Serial
83-
#define SERIAL_PORT_USBVIRTUAL Serial
84-
#define SERIAL_PORT_HARDWARE Serial
85-
#define SERIAL_PORT_HARDWARE_OPEN Serial
86-
8754
#endif /* Pins_Arduino_h */

variants/d1_mini/pins_arduino.h

+1-36
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,14 @@
2626
#ifndef Pins_Arduino_h
2727
#define Pins_Arduino_h
2828

29-
#define EXTERNAL_NUM_INTERRUPTS 16
30-
#define NUM_DIGITAL_PINS 17
31-
#define NUM_ANALOG_INPUTS 1
32-
33-
#define analogInputToDigitalPin(p) ((p > 0)?NOT_A_PIN:0)
34-
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)?p:NOT_A_PIN)
35-
#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS)?p:NOT_A_PIN)
29+
#include "../generic/common.h"
3630

3731
static const uint8_t SDA = 4;
3832
static const uint8_t SCL = 5;
3933

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;
44-
4534
static const uint8_t LED_BUILTIN = 2;
4635
static const uint8_t BUILTIN_LED = 2;
4736

48-
static const uint8_t A0 = 17;
49-
5037
static const uint8_t D0 = 16;
5138
static const uint8_t D1 = 5;
5239
static const uint8_t D2 = 4;
@@ -59,26 +46,4 @@ static const uint8_t D8 = 15;
5946
static const uint8_t RX = 3;
6047
static const uint8_t TX = 1;
6148

62-
63-
64-
// These serial port names are intended to allow libraries and architecture-neutral
65-
// sketches to automatically default to the correct port name for a particular type
66-
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
67-
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
68-
//
69-
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
70-
//
71-
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
72-
//
73-
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
74-
//
75-
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
76-
//
77-
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
78-
// pins are NOT connected to anything by default.
79-
#define SERIAL_PORT_MONITOR Serial
80-
#define SERIAL_PORT_USBVIRTUAL Serial
81-
#define SERIAL_PORT_HARDWARE Serial
82-
#define SERIAL_PORT_HARDWARE_OPEN Serial
83-
8449
#endif /* Pins_Arduino_h */

variants/espino/pins_arduino.h

+1-34
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,11 @@
2626
#ifndef Pins_Arduino_h
2727
#define Pins_Arduino_h
2828

29-
#define EXTERNAL_NUM_INTERRUPTS 16
30-
#define NUM_DIGITAL_PINS 17
31-
#define NUM_ANALOG_INPUTS 1
32-
33-
#define analogInputToDigitalPin(p) ((p > 0)?NOT_A_PIN:0)
34-
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)?p:NOT_A_PIN)
35-
#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS)?p:NOT_A_PIN)
29+
#include "../generic/common.h"
3630

3731
static const uint8_t SDA = 4;
3832
static const uint8_t SCL = 5;
3933

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;
44-
4534
static const uint8_t LED_BUILTIN = 2;
4635
static const uint8_t LED_BUILTIN_R = 2;
4736
static const uint8_t LED_BUILTIN_G = 4;
@@ -53,26 +42,4 @@ static const uint8_t BUILTIN_LEDG = 4;
5342
static const uint8_t BUILTIN_LEDB = 5;
5443
static const uint8_t BUILTIN_BUTTON = 0;
5544

56-
static const uint8_t A0 = 17;
57-
58-
// These serial port names are intended to allow libraries and architecture-neutral
59-
// sketches to automatically default to the correct port name for a particular type
60-
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
61-
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
62-
//
63-
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
64-
//
65-
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
66-
//
67-
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
68-
//
69-
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
70-
//
71-
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
72-
// pins are NOT connected to anything by default.
73-
#define SERIAL_PORT_MONITOR Serial
74-
#define SERIAL_PORT_USBVIRTUAL Serial
75-
#define SERIAL_PORT_HARDWARE Serial
76-
#define SERIAL_PORT_HARDWARE_OPEN Serial
77-
7845
#endif /* Pins_Arduino_h */

variants/espinotee/pins_arduino.h

+6-39
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,37 @@
11
/*
22
pins_arduino.h - Pin definition functions for Arduino
33
Part of Arduino - http://www.arduino.cc/
4-
4+
55
Copyright (c) 2007 David A. Mellis
66
Modified for ESP8266 platform by Ivan Grokhotkov, 2014-2015.
7-
7+
88
This library is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Lesser General Public
1010
License as published by the Free Software Foundation; either
1111
version 2.1 of the License, or (at your option) any later version.
12-
12+
1313
This library is distributed in the hope that it will be useful,
1414
but WITHOUT ANY WARRANTY; without even the implied warranty of
1515
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1616
Lesser General Public License for more details.
17-
17+
1818
You should have received a copy of the GNU Lesser General
1919
Public License along with this library; if not, write to the
2020
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
2121
Boston, MA 02111-1307 USA
22-
22+
2323
$Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
2424
*/
2525

2626
#ifndef Pins_Arduino_h
2727
#define Pins_Arduino_h
2828

29-
#define EXTERNAL_NUM_INTERRUPTS 16
30-
#define NUM_DIGITAL_PINS 11
31-
#define NUM_ANALOG_INPUTS 1
32-
33-
#define analogInputToDigitalPin(p) ((p > 0)?NOT_A_PIN:0)
34-
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)?p:NOT_A_PIN)
35-
#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS)?p:NOT_A_PIN)
29+
#include "../generic/common.h"
3630

3731
static const uint8_t SDA = 4;
3832
static const uint8_t SCL = 5;
3933

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;
44-
4534
static const uint8_t BUILTIN_LED = 16;
4635
static const uint8_t LED_BUILTIN = 16;
4736

48-
static const uint8_t A0 = 17;
49-
50-
// These serial port names are intended to allow libraries and architecture-neutral
51-
// sketches to automatically default to the correct port name for a particular type
52-
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
53-
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
54-
//
55-
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
56-
//
57-
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
58-
//
59-
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
60-
//
61-
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
62-
//
63-
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
64-
// pins are NOT connected to anything by default.
65-
#define SERIAL_PORT_MONITOR Serial
66-
#define SERIAL_PORT_USBVIRTUAL Serial
67-
#define SERIAL_PORT_HARDWARE Serial
68-
#define SERIAL_PORT_HARDWARE_OPEN Serial
69-
7037
#endif /* Pins_Arduino_h */

variants/espresso_lite_v1/pins_arduino.h

+2-34
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,14 @@
2626
#ifndef Pins_Arduino_h
2727
#define Pins_Arduino_h
2828

29-
#define EXTERNAL_NUM_INTERRUPTS 16
30-
#define NUM_DIGITAL_PINS 17
31-
#define NUM_ANALOG_INPUTS 1
29+
#include "../generic/common.h"
3230

3331
#define ESPRESSO_LITE_VERSION 1
3432

35-
#define analogInputToDigitalPin(p) ((p > 0)?NOT_A_PIN:0)
36-
#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)?p:NOT_A_PIN)
37-
#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS)?p:NOT_A_PIN)
38-
3933
static const uint8_t SDA = 4;
4034
static const uint8_t SCL = 5;
4135

42-
static const uint8_t SS = 15;
43-
static const uint8_t MOSI = 13;
44-
static const uint8_t MISO = 12;
45-
static const uint8_t SCK = 14;
46-
4736
static const uint8_t LED_BUILTIN = 16;
48-
49-
static const uint8_t A0 = 17;
50-
51-
// These serial port names are intended to allow libraries and architecture-neutral
52-
// sketches to automatically default to the correct port name for a particular type
53-
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
54-
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
55-
//
56-
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
57-
//
58-
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
59-
//
60-
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
61-
//
62-
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
63-
//
64-
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
65-
// pins are NOT connected to anything by default.
66-
#define SERIAL_PORT_MONITOR Serial
67-
#define SERIAL_PORT_USBVIRTUAL Serial
68-
#define SERIAL_PORT_HARDWARE Serial
69-
#define SERIAL_PORT_HARDWARE_OPEN Serial
37+
static const uint8_t BUILTIN_LED = 16;
7038

7139
#endif /* Pins_Arduino_h */

0 commit comments

Comments
 (0)