diff --git a/boards/esp32-olimex-evb/include/board.h b/boards/esp32-olimex-evb/include/board.h index d0b325257f..301ef3dcc7 100644 --- a/boards/esp32-olimex-evb/include/board.h +++ b/boards/esp32-olimex-evb/include/board.h @@ -40,7 +40,24 @@ * @name Button pin definitions * @{ */ -#define BUTTON0_PIN GPIO34 + +/** + * @brief Default button GPIO pin definition + */ +#define BTN0_PIN GPIO34 + +/** + * @brief Default button GPIO mode definition + * + * Since the GPIO of the button is pulled up with an external resistor, the + * mode for the GPIO pin has to be GPIO_IN. + */ +#define BTN0_MODE GPIO_IN + +/** + * @brief Definition for compatibility with previous versions + */ +#define BUTTON0_PIN BTN0_PIN /** @} */ /** diff --git a/boards/esp32-olimex-evb/include/gpio_params.h b/boards/esp32-olimex-evb/include/gpio_params.h index 5228cda5ba..05770ea7b5 100644 --- a/boards/esp32-olimex-evb/include/gpio_params.h +++ b/boards/esp32-olimex-evb/include/gpio_params.h @@ -39,8 +39,8 @@ static const saul_gpio_params_t saul_gpio_params[] = #endif { .name = "BUT1", - .pin = BUTTON0_PIN, - .mode = GPIO_IN, + .pin = BTN0_PIN, + .mode = BTN0_MODE, .flags = SAUL_GPIO_INVERTED }, }; diff --git a/boards/esp32-ttgo-t-beam/include/board.h b/boards/esp32-ttgo-t-beam/include/board.h index 82dc892543..7e75749a61 100644 --- a/boards/esp32-ttgo-t-beam/include/board.h +++ b/boards/esp32-ttgo-t-beam/include/board.h @@ -36,11 +36,28 @@ * @name Button pin definitions * @{ */ + +/** + * @brief Default button GPIO pin definition + */ #if MODULE_ESP32_TTGO_T_BEAM_V1_0 -#define BUTTON0_PIN GPIO38 +#define BTN0_PIN GPIO38 #else -#define BUTTON0_PIN GPIO39 +#define BTN0_PIN GPIO39 #endif + +/** + * @brief Default button GPIO mode definition + * + * Since the GPIO of the button is pulled up with an external resistor, the + * mode for the GPIO pin has to be GPIO_IN. + */ +#define BTN0_MODE GPIO_IN + +/** + * @brief Definition for compatibility with previous versions + */ +#define BUTTON0_PIN BTN0_PIN /** @} */ /** diff --git a/boards/esp32-ttgo-t-beam/include/gpio_params.h b/boards/esp32-ttgo-t-beam/include/gpio_params.h index 389c2e0c5d..c1480b763b 100644 --- a/boards/esp32-ttgo-t-beam/include/gpio_params.h +++ b/boards/esp32-ttgo-t-beam/include/gpio_params.h @@ -39,8 +39,8 @@ static const saul_gpio_params_t saul_gpio_params[] = #endif { .name = "PRG", - .pin = BUTTON0_PIN, - .mode = GPIO_IN, + .pin = BTN0_PIN, + .mode = BTN0_MODE, .flags = SAUL_GPIO_INVERTED }, }; diff --git a/boards/esp32-wroom-32/include/board.h b/boards/esp32-wroom-32/include/board.h index 11a608a8a7..41e125e56e 100644 --- a/boards/esp32-wroom-32/include/board.h +++ b/boards/esp32-wroom-32/include/board.h @@ -37,12 +37,30 @@ * @name Button pin definitions * @{ */ + /** - * Generic ESP32 boards have a BOOT button, which can be used as normal button - * during normal operation. Since the GPIO0 pin is pulled up, the button - * signal is inverted, i.e., pressing the button will give a low signal. - */ -#define BUTTON0_PIN GPIO0 + * @brief Default button GPIO pin definition + * + * Generic ESP32 boards have a BOOT button connected to GPIO0, which can be + * used as button during normal operation. Since the GPIO0 pin is pulled up, + * the button signal is inverted, i.e., pressing the button will give a + * low signal. + */ +#define BTN0_PIN GPIO0 + +/** + * @brief Default button GPIO mode definition + * + * Since the GPIO of the button is pulled up with an external resistor, the + * mode for the GPIO pin has to be GPIO_IN. + */ +#define BTN0_MODE GPIO_IN + +/** + * @brief Definition for compatibility with previous versions + */ +#define BUTTON0_PIN BTN0_PIN + /** @} */ /** diff --git a/boards/esp32-wroom-32/include/gpio_params.h b/boards/esp32-wroom-32/include/gpio_params.h index d44c00abcb..1cf32a000b 100644 --- a/boards/esp32-wroom-32/include/gpio_params.h +++ b/boards/esp32-wroom-32/include/gpio_params.h @@ -31,8 +31,8 @@ static const saul_gpio_params_t saul_gpio_params[] = { { .name = "BOOT", - .pin = BUTTON0_PIN, - .mode = GPIO_IN, + .pin = BTN0_PIN, + .mode = BTN0_MODE, .flags = SAUL_GPIO_INVERTED }, };