mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-28 16:01:18 +01:00
Merge pull request #10662 from gschorcht/esp32_gpio_fix
cpu/esp32: GPIO macro cleanup in periph_cpu.h
This commit is contained in:
commit
3e5658d407
@ -109,11 +109,14 @@ static esp_err_t IRAM_ATTR _eth_input_callback(void *buffer, uint16_t len, void
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if EMAC_PHY_POWER_PIN != GPIO_UNDEF
|
||||
static void _esp_eth_phy_power_enable_gpio(bool enable)
|
||||
{
|
||||
assert(EMAC_ETHERNET_PHY_CONFIG.phy_power_enable);
|
||||
|
||||
if (EMAC_PHY_POWER_PIN == GPIO_UNDEF) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enable) {
|
||||
EMAC_ETHERNET_PHY_CONFIG.phy_power_enable(false);
|
||||
}
|
||||
@ -127,7 +130,6 @@ static void _esp_eth_phy_power_enable_gpio(bool enable)
|
||||
EMAC_ETHERNET_PHY_CONFIG.phy_power_enable(true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int _esp_eth_init(netdev_t *netdev)
|
||||
{
|
||||
@ -146,13 +148,13 @@ static int _esp_eth_init(netdev_t *netdev)
|
||||
config.gpio_config = _eth_gpio_config_rmii;
|
||||
config.tcpip_input = _eth_input_callback;
|
||||
|
||||
#if EMAC_PHY_POWER_PIN != GPIO_UNDEF
|
||||
/*
|
||||
* Replace the default 'power enable' function with an example-specific
|
||||
* one that toggles a power GPIO.
|
||||
*/
|
||||
config.phy_power_enable = phy_device_power_enable_via_gpio;
|
||||
#endif
|
||||
if (EMAC_PHY_POWER_PIN != GPIO_UNDEF) {
|
||||
config.phy_power_enable = _esp_eth_phy_power_enable_gpio;
|
||||
}
|
||||
|
||||
/* initialize EMAC with config */
|
||||
if (ret == ESP_OK && (ret = esp_eth_init(&config)) != ESP_OK) {
|
||||
|
||||
@ -46,16 +46,6 @@ extern "C" {
|
||||
#define PORT_GPIO 0 /**< port GPIO */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Definition of a fitting UNDEF value
|
||||
*/
|
||||
#define GPIO_UNDEF (0xff)
|
||||
|
||||
/**
|
||||
* @brief Define CPU specific GPIO pin generator macro
|
||||
*/
|
||||
#define GPIO_PIN(x, y) ((x << 4) | y)
|
||||
|
||||
/**
|
||||
* @brief Define CPU specific number of GPIO pins
|
||||
* @{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user