Merge pull request #13418 from gschorcht/boards/esp32/fix_btn0_pin

boards/esp32: rename BUTTON0_PIN to BTN0_PIN
This commit is contained in:
Alexandre Abadie 2020-02-20 14:40:39 +01:00 committed by GitHub
commit e324b22c96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 66 additions and 14 deletions

View File

@ -40,7 +40,24 @@
* @name Button pin definitions * @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
/** @} */ /** @} */
/** /**

View File

@ -39,8 +39,8 @@ static const saul_gpio_params_t saul_gpio_params[] =
#endif #endif
{ {
.name = "BUT1", .name = "BUT1",
.pin = BUTTON0_PIN, .pin = BTN0_PIN,
.mode = GPIO_IN, .mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED .flags = SAUL_GPIO_INVERTED
}, },
}; };

View File

@ -36,11 +36,28 @@
* @name Button pin definitions * @name Button pin definitions
* @{ * @{
*/ */
/**
* @brief Default button GPIO pin definition
*/
#if MODULE_ESP32_TTGO_T_BEAM_V1_0 #if MODULE_ESP32_TTGO_T_BEAM_V1_0
#define BUTTON0_PIN GPIO38 #define BTN0_PIN GPIO38
#else #else
#define BUTTON0_PIN GPIO39 #define BTN0_PIN GPIO39
#endif #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
/** @} */ /** @} */
/** /**

View File

@ -39,8 +39,8 @@ static const saul_gpio_params_t saul_gpio_params[] =
#endif #endif
{ {
.name = "PRG", .name = "PRG",
.pin = BUTTON0_PIN, .pin = BTN0_PIN,
.mode = GPIO_IN, .mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED .flags = SAUL_GPIO_INVERTED
}, },
}; };

View File

@ -37,12 +37,30 @@
* @name Button pin definitions * @name Button pin definitions
* @{ * @{
*/ */
/** /**
* Generic ESP32 boards have a BOOT button, which can be used as normal button * @brief Default button GPIO pin definition
* 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. * 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 BUTTON0_PIN GPIO0 #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
/** @} */ /** @} */
/** /**

View File

@ -31,8 +31,8 @@ static const saul_gpio_params_t saul_gpio_params[] =
{ {
{ {
.name = "BOOT", .name = "BOOT",
.pin = BUTTON0_PIN, .pin = BTN0_PIN,
.mode = GPIO_IN, .mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED .flags = SAUL_GPIO_INVERTED
}, },
}; };