Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LED_BUILTIN should be a #define #4276

Merged
merged 5 commits into from
Feb 7, 2018
Merged

LED_BUILTIN should be a #define #4276

merged 5 commits into from
Feb 7, 2018

Conversation

d-a-v
Copy link
Collaborator

@d-a-v d-a-v commented Feb 2, 2018

Arduino only defines LED_BUILTIN, should BUILTIN_LED be removed ?

@@ -33,7 +33,7 @@
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;
#define LED_BUILTIN 16
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could a compiler #define such as "-DBUILTIN_LED=LED_BUILTIN" and remove the need for all these repeated 2nd #define BUILTIN_LED X?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUILTIN_LED is not used in core, but seems to be historically used in esp8266 code outside.
What about moving this define into variants/generic/common.h (hidden, wrong name less exposed, less loaded gcc cmdline) ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not standard, how about putting it somewhere safe and deprecating its use?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

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;
/*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented code

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;
static const uint8_t BUILTIN_LEDB = 5;
static const uint8_t BUILTIN_BUTTON = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe there should be a BUTTON_BUILTIN?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. BUTTON_BUILTIN added, commented BUILTIN_* removed.

@devyte devyte merged commit 4caf487 into esp8266:master Feb 7, 2018
@d-a-v d-a-v deleted the led branch February 7, 2018 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants