From 573a0fb47fc0dc6dc25010d50642494dbb069476 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 2 Feb 2016 15:53:41 +0100 Subject: [PATCH] Add LED_BUILTIN definition (#1556) keep arduino incompatible BUILTIN_LED (+22 squashed commits) [e124f9c] keep arduino incompatible BUILTIN_LED [18dab66] keep arduino incompatible BUILTIN_LED [0095de6] keep arduino incompatible BUILTIN_LED [cca2714] keep arduino incompatible BUILTIN_LED [ff62bfb] keep arduino incompatible BUILTIN_LED [fd6f7c0] keep arduino incompatible BUILTIN_LED [220b02a] keep arduino incompatible BUILTIN_LED [b871b1b] keep arduino incompatible BUILTIN_LED [1d97cac] keep arduino incompatible BUILTIN_LED [ebc2667] changed BUILTIN_LED to LED_BUILTIN [7008a27] changed BUILTIN_LED to LED_BUILTIN [cf3f6da] changed BUILTIN_LED to LED_BUILTIN [5e11c43] changed BUILTIN_LED to LED_BUILTIN [8645bd5] changed BUILTIN_LED to LED_BUILTIN [faae742] changed BUILTIN_LED to LED_BUILTIN [df2659b] changed BUILTIN_LED to LED_BUILTIN [1eb74d5] changed BUILTIN_LED to LED_BUILTIN [fb9e977] changed BUILTIN_LED to LED_BUILTIN [b735737] changed BUILTIN_LED to LED_BUILTIN [d0557dd] changed BUILTIN_LED to LED_BUILTIN [a25e4aa] changed BUILTIN_LED to LED_BUILTIN [7865ace] changed BUILTIN_LED to LED_BUILTIN --- libraries/esp8266/examples/Blink/Blink.ino | 8 ++++---- .../examples/BlinkWithoutDelay/BlinkWithoutDelay.ino | 6 +++--- variants/ESPDuino/pins_arduino.h | 4 +++- variants/adafruit/pins_arduino.h | 1 + variants/d1/pins_arduino.h | 1 + variants/d1_mini/pins_arduino.h | 1 + variants/espino/pins_arduino.h | 5 +++++ variants/generic/pins_arduino.h | 1 + variants/nodemcu/pins_arduino.h | 1 + variants/thing/pins_arduino.h | 2 ++ variants/wifinfo/pins_arduino.h | 1 + variants/wifio/pins_arduino.h | 1 + 12 files changed, 24 insertions(+), 8 deletions(-) diff --git a/libraries/esp8266/examples/Blink/Blink.ino b/libraries/esp8266/examples/Blink/Blink.ino index 578f36886..6391632a5 100644 --- a/libraries/esp8266/examples/Blink/Blink.ino +++ b/libraries/esp8266/examples/Blink/Blink.ino @@ -6,19 +6,19 @@ The blue LED on the ESP-01 module is connected to GPIO1 (which is also the TXD pin; so we cannot use Serial.print() at the same time) - Note that this sketch uses BUILTIN_LED to find the pin with the internal LED + Note that this sketch uses LED_BUILTIN to find the pin with the internal LED */ void setup() { - pinMode(BUILTIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output + pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output } // the loop function runs over and over again forever void loop() { - digitalWrite(BUILTIN_LED, LOW); // Turn the LED on (Note that LOW is the voltage level + digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level // but actually the LED is on; this is because // it is acive low on the ESP-01) delay(1000); // Wait for a second - digitalWrite(BUILTIN_LED, HIGH); // Turn the LED off by making the voltage HIGH + digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH delay(2000); // Wait for two seconds (to demonstrate the active low LED) } diff --git a/libraries/esp8266/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino b/libraries/esp8266/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino index 740211d6d..ccff3fd74 100644 --- a/libraries/esp8266/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino +++ b/libraries/esp8266/examples/BlinkWithoutDelay/BlinkWithoutDelay.ino @@ -7,7 +7,7 @@ The blue LED on the ESP-01 module is connected to GPIO1 (which is also the TXD pin; so we cannot use Serial.print() at the same time) - Note that this sketch uses BUILTIN_LED to find the pin with the internal LED + Note that this sketch uses LED_BUILTIN to find the pin with the internal LED */ int ledState = LOW; @@ -16,7 +16,7 @@ unsigned long previousMillis = 0; const long interval = 1000; void setup() { - pinMode(BUILTIN_LED, OUTPUT); + pinMode(LED_BUILTIN, OUTPUT); } void loop() @@ -28,6 +28,6 @@ void loop() ledState = HIGH; // Note that this switches the LED *off* else ledState = LOW; // Note that this switches the LED *on* - digitalWrite(BUILTIN_LED, ledState); + digitalWrite(LED_BUILTIN, ledState); } } diff --git a/variants/ESPDuino/pins_arduino.h b/variants/ESPDuino/pins_arduino.h index ca32bcef7..89de15782 100644 --- a/variants/ESPDuino/pins_arduino.h +++ b/variants/ESPDuino/pins_arduino.h @@ -41,6 +41,8 @@ static const uint8_t MOSI = 13; static const uint8_t MISO = 12; static const uint8_t SCK = 14; +static const uint8_t LED_BUILTIN = 16; + static const uint8_t BUILTIN_LED = 16; static const uint8_t A0 = 17; @@ -65,4 +67,4 @@ static const uint8_t A0 = 17; #define SERIAL_PORT_HARDWARE Serial #define SERIAL_PORT_HARDWARE_OPEN Serial -#endif /* Pins_Arduino_h */ \ No newline at end of file +#endif /* Pins_Arduino_h */ diff --git a/variants/adafruit/pins_arduino.h b/variants/adafruit/pins_arduino.h index aeb20d43b..217317d03 100644 --- a/variants/adafruit/pins_arduino.h +++ b/variants/adafruit/pins_arduino.h @@ -42,6 +42,7 @@ static const uint8_t MOSI = 13; static const uint8_t MISO = 12; static const uint8_t SCK = 14; +static const uint8_t LED_BUILTIN = 0; static const uint8_t BUILTIN_LED = 0; static const uint8_t A0 = 17; diff --git a/variants/d1/pins_arduino.h b/variants/d1/pins_arduino.h index ddab599ba..7139b381d 100644 --- a/variants/d1/pins_arduino.h +++ b/variants/d1/pins_arduino.h @@ -42,6 +42,7 @@ static const uint8_t MOSI = 13; static const uint8_t MISO = 12; static const uint8_t SCK = 14; +static const uint8_t LED_BUILTIN = 2;//new ESP-12E GPIO2 static const uint8_t BUILTIN_LED = 2;//new ESP-12E GPIO2 static const uint8_t A0 = 17; diff --git a/variants/d1_mini/pins_arduino.h b/variants/d1_mini/pins_arduino.h index 40a16f2b5..61ddbe820 100644 --- a/variants/d1_mini/pins_arduino.h +++ b/variants/d1_mini/pins_arduino.h @@ -42,6 +42,7 @@ static const uint8_t MOSI = 13; static const uint8_t MISO = 12; static const uint8_t SCK = 14; +static const uint8_t LED_BUILTIN = 2; static const uint8_t BUILTIN_LED = 2; static const uint8_t A0 = 17; diff --git a/variants/espino/pins_arduino.h b/variants/espino/pins_arduino.h index 2efad2db3..3ced0bf5b 100644 --- a/variants/espino/pins_arduino.h +++ b/variants/espino/pins_arduino.h @@ -42,6 +42,11 @@ static const uint8_t MOSI = 13; static const uint8_t MISO = 12; static const uint8_t SCK = 14; +static const uint8_t LED_BUILTIN = 2; +static const uint8_t LED_BUILTIN_R = 2; +static const uint8_t LED_BUILTIN_G = 4; +static const uint8_t LED_BUILTIN_B = 5; + static const uint8_t BUILTIN_LED = 2; static const uint8_t BUILTIN_LEDR = 2; static const uint8_t BUILTIN_LEDG = 4; diff --git a/variants/generic/pins_arduino.h b/variants/generic/pins_arduino.h index b2ff8f1cd..f5483bda0 100644 --- a/variants/generic/pins_arduino.h +++ b/variants/generic/pins_arduino.h @@ -43,6 +43,7 @@ static const uint8_t MISO = 12; static const uint8_t SCK = 14; static const uint8_t BUILTIN_LED = 1; +static const uint8_t LED_BUILTIN = 1; static const uint8_t A0 = 17; diff --git a/variants/nodemcu/pins_arduino.h b/variants/nodemcu/pins_arduino.h index 25d287771..ecfa07c75 100644 --- a/variants/nodemcu/pins_arduino.h +++ b/variants/nodemcu/pins_arduino.h @@ -42,6 +42,7 @@ static const uint8_t MOSI = 13; static const uint8_t MISO = 12; static const uint8_t SCK = 14; +static const uint8_t LED_BUILTIN = 16; static const uint8_t BUILTIN_LED = 16; static const uint8_t A0 = 17; diff --git a/variants/thing/pins_arduino.h b/variants/thing/pins_arduino.h index 72d0aaea1..8c73b2fe0 100644 --- a/variants/thing/pins_arduino.h +++ b/variants/thing/pins_arduino.h @@ -42,6 +42,8 @@ static const uint8_t MOSI = 13; static const uint8_t MISO = 12; static const uint8_t SCK = 14; +static const uint8_t LED_BUILTIN = 5; + static const uint8_t BUILTIN_LED = 5; static const uint8_t A0 = 17; diff --git a/variants/wifinfo/pins_arduino.h b/variants/wifinfo/pins_arduino.h index f4000865c..69549b5ef 100644 --- a/variants/wifinfo/pins_arduino.h +++ b/variants/wifinfo/pins_arduino.h @@ -47,6 +47,7 @@ static const uint8_t MOSI = 13; static const uint8_t MISO = 12; static const uint8_t SCK = 14; +static const uint8_t LED_BUILTIN = 12; static const uint8_t BUILTIN_LED = 12; static const uint8_t A0 = 17; diff --git a/variants/wifio/pins_arduino.h b/variants/wifio/pins_arduino.h index c2a2f986d..24635b37c 100644 --- a/variants/wifio/pins_arduino.h +++ b/variants/wifio/pins_arduino.h @@ -60,6 +60,7 @@ static const uint8_t E14 = ESP_PINS_OFFSET + 14; static const uint8_t E15 = ESP_PINS_OFFSET + 15; static const uint8_t E16 = ESP_PINS_OFFSET + 16; +static const uint8_t LED_BUILTIN_LED = 2; static const uint8_t BUILTIN_LED = 2; #define SERIAL_PORT_MONITOR Serial