1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/esp32-ethernet-kit: add button definition

Conflicts with Ethernet phy clock input.

Tested with tests/saul:

Dev: BOOT	Type: SENSE_BTN
Data:	              0

Dev: BOOT	Type: SENSE_BTN
Data:	              1

and tests/buttons:

On-board button test

 -- Available buttons: 1

 -- Try pressing buttons to test.

[SUCCESS]
Pressed BTN0
Pressed BTN0
Pressed BTN0
This commit is contained in:
Erik Ekman 2020-07-10 18:12:46 +02:00
parent e3142c39f0
commit b3197dea28
2 changed files with 42 additions and 0 deletions

View File

@ -33,6 +33,40 @@ static inline void board_init(void) {
board_init_common();
}
#if !MODULE_ESP_ETH || DOXYGEN
/**
* @name Button pin definitions
* @{
*/
/**
* @brief Default button GPIO pin definition
*
* The button is only available when Ethernet is not used, as is shares its pin
* with the Phy clock.
*/
#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 Default interrupt flank definition for the button GPIO
*/
#ifndef BTN0_INT_FLANK
#define BTN0_INT_FLANK GPIO_FALLING
#endif
/**
* @brief Definition for compatibility with previous versions
*/
#define BUTTON0_PIN BTN0_PIN
/** @} */
#endif /* !MODULE_ESP_ETH || DOXYGEN */
/**
* @name ESP32 Ethernet (EMAC) configuration
* @{

View File

@ -31,6 +31,14 @@ extern "C" {
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
#ifndef MODULE_ESP_ETH
{
.name = "BOOT",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED
},
#endif
};
#ifdef __cplusplus