Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,11 @@ ifneq (,$(filter periph_gpio_irq,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio
endif

# Enable optionally periph_gpio_ext when the MCU supports it as feature
ifneq (,$(filter periph_gpio,$(USEMODULE)))
FEATURES_OPTIONAL += periph_gpio_exp
endif

ifneq (,$(filter periph_timer_periodic,$(USEMODULE)))
FEATURES_REQUIRED += periph_timer
endif
Expand Down
4 changes: 4 additions & 0 deletions drivers/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ ifneq (,$(filter ccs811_%,$(USEMODULE)))
USEMODULE += ccs811
endif

ifneq (,$(filter gpio_exp,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio_exp
endif

ifneq (,$(filter hmc5883l_%,$(USEMODULE)))
USEMODULE += hmc5883l
endif
Expand Down
30 changes: 24 additions & 6 deletions drivers/include/periph/gpio.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
/*
* Copyright (C) 2015 Freie Universität Berlin
* 2020 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

#ifndef PERIPH_GPIO_H
#define PERIPH_GPIO_H

#ifdef MODULE_PERIPH_GPIO_EXP

#include "periph/gpio_exp.h"

#else /* MODULE_PERIPH_GPIO_EXP */

/**
* @anchor drivers_periph_gpio
* @defgroup drivers_periph_gpio GPIO
* @ingroup drivers_periph
* @brief Low-level GPIO peripheral driver
* @brief GPIO peripheral driver
*
* @note This is the legacy GPIO API. It will be removed once all platforms
* implement the new GPIO API which allows to implement the API for any kind
* of GPIO hardware. The new GPIO API is compatible with this legacy API.
* @warning The scalar GPIO pin type `gpio_t` is deprecated and will be
* replaced by a structured GPIO pin type in the new GPIO API. Therefore,
* don't use the direct comparison of GPIO pins anymore. Instead, use the
* inline comparison functions @ref gpio_is_equal and @ref gpio_is_valid.
*
* This is a basic GPIO (General-purpose input/output) interface to allow
* platform independent access to a MCU's input/output pins. This interface is
Expand Down Expand Up @@ -72,9 +91,6 @@
* @author Hauke Petersen <[email protected]>
*/

#ifndef PERIPH_GPIO_H
#define PERIPH_GPIO_H

#include <limits.h>

#include "periph_cpu.h"
Expand Down Expand Up @@ -197,7 +213,7 @@ int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank,
/**
* @brief Enable pin interrupt if configured as interrupt source
*
* Interrupts that would have occured after @see gpio_irq_disable
* Interrupts that would have occurred after @see gpio_irq_disable
* was called will be discarded.
*
* @note You have to add the module `periph_gpio_irq` to your project to
Expand Down Expand Up @@ -283,5 +299,7 @@ static inline int gpio_is_valid(gpio_t gpio)
}
#endif

#endif /* PERIPH_GPIO_H */
/** @} */

#endif /* MODULE_PERIPH_GPIO_EXP */
#endif /* PERIPH_GPIO_H */
Loading