reference-en icon indicating copy to clipboard operation
reference-en copied to clipboard

Proposal: `BTN_BUILTIN`

Open zfields opened this issue 4 years ago • 0 comments

There is a precedent for LEDs which have been built into the board and are configurable by the user to be named LED_BUILTIN. This is a de facto standard and has been accepted broadly across the community.

New boards are coming out with button built into the board, which can be configured by the user. There are conflicting names currently, such as ESP's BUTTON_BUILTIN or STM's USER_BTN. I believe BUTTON_BUILTIN follows the naming precedent better than USER_BTN. I would like to see Arduino take the lead here and dictate a standard name for such a feature, and bring alignment to the Arduino ecosystem.

BTN_BUILTIN seems like a good compromise. BTN is a reasonable abbreviation for button, and it would make BTN_BUILTIN the same number of characters as LED_BUILTIN. The name also expresses that the button is a feature of the board and not simply and external addition.

It would be much easier to port Arduino sketches across hardware platforms if Arduino would take a stance and add BTN_BUILTIN to the Arduino standard or specification.

BUTTON_BUILTIN References:

  • https://github.com/espressif/arduino-esp32/blob/master/variants/micro_s2/pins_arduino.h#L75
  • https://github.com/esp8266/Arduino/blob/master/variants/espectro/pins_arduino.h#L40
  • https://github.com/f32c/arduino/blob/master/hardware/fpga/f32c/variants/FleaFPGA-Uno/variant.h#L17

USER_BTN References:

  • https://github.com/stm32duino/Arduino_Core_STM32/pull/1490#issuecomment-915874601
  • https://github.com/search?q=org%3Astm32duino+USER_BTN&type=code

If this is not the appropriate place for such a suggestion, please point me in the right direction.

zfields avatar Sep 14 '21 02:09 zfields