gpio: Reorder code in drivers/gpio.h
Move z_impl_gpio_pin_interrupt_configure before gpio_pin_configure so we can utilize z_impl_gpio_pin_interrupt_configure in gpio_pin_configure in the future. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
7989f5cd6b
commit
84b27a1525
1 changed files with 35 additions and 35 deletions
|
@ -542,6 +542,41 @@ static inline int z_impl_gpio_disable_callback(struct device *port,
|
|||
* @endcond
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Configure pin interrupt.
|
||||
*
|
||||
* @note This function can also be used to configure interrupts on pins
|
||||
* not controlled directly by the GPIO module. That is, pins which are
|
||||
* routed to other modules such as I2C, SPI, UART.
|
||||
*
|
||||
* @param port Pointer to device structure for the driver instance.
|
||||
* @param pin Pin number.
|
||||
* @param flags Interrupt configuration flags as defined by GPIO_INT_*.
|
||||
*
|
||||
* @retval 0 If successful.
|
||||
* @retval -ENOTSUP If any of the configuration options is not supported.
|
||||
* @retval -EINVAL Invalid argument.
|
||||
* @retval -EBUSY Interrupt line required to configure pin interrupt is
|
||||
* already in use.
|
||||
*/
|
||||
__syscall int gpio_pin_interrupt_configure(struct device *port,
|
||||
unsigned int pin, unsigned int flags);
|
||||
|
||||
static inline int z_impl_gpio_pin_interrupt_configure(struct device *port,
|
||||
unsigned int pin, unsigned int flags)
|
||||
{
|
||||
const struct gpio_driver_api *api =
|
||||
(const struct gpio_driver_api *)port->driver_api;
|
||||
|
||||
__ASSERT(pin < GPIO_MAX_PINS_PER_PORT, "Invalid pin number");
|
||||
|
||||
__ASSERT(((flags & GPIO_INT_ENABLE) == 0) ||
|
||||
((flags & (GPIO_INT_LOW_0 | GPIO_INT_HIGH_1)) != 0),
|
||||
"At least one of GPIO_INT_LOW_0, GPIO_INT_HIGH_1 has to be "
|
||||
"enabled.");
|
||||
return api->pin_interrupt_configure(port, pin, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure a single pin.
|
||||
*
|
||||
|
@ -983,41 +1018,6 @@ static inline int gpio_pin_read(struct device *port, u32_t pin,
|
|||
return gpio_read(port, GPIO_ACCESS_BY_PIN, pin, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure pin interrupt.
|
||||
*
|
||||
* @note This function can also be used to configure interrupts on pins
|
||||
* not controlled directly by the GPIO module. That is, pins which are
|
||||
* routed to other modules such as I2C, SPI, UART.
|
||||
*
|
||||
* @param port Pointer to device structure for the driver instance.
|
||||
* @param pin Pin number.
|
||||
* @param flags Interrupt configuration flags as defined by GPIO_INT_*.
|
||||
*
|
||||
* @retval 0 If successful.
|
||||
* @retval -ENOTSUP If any of the configuration options is not supported.
|
||||
* @retval -EINVAL Invalid argument.
|
||||
* @retval -EBUSY Interrupt line required to configure pin interrupt is
|
||||
* already in use.
|
||||
*/
|
||||
__syscall int gpio_pin_interrupt_configure(struct device *port,
|
||||
unsigned int pin, unsigned int flags);
|
||||
|
||||
static inline int z_impl_gpio_pin_interrupt_configure(struct device *port,
|
||||
unsigned int pin, unsigned int flags)
|
||||
{
|
||||
const struct gpio_driver_api *api =
|
||||
(const struct gpio_driver_api *)port->driver_api;
|
||||
|
||||
__ASSERT(pin < GPIO_MAX_PINS_PER_PORT, "Invalid pin number");
|
||||
|
||||
__ASSERT(((flags & GPIO_INT_ENABLE) == 0) ||
|
||||
((flags & (GPIO_INT_LOW_0 | GPIO_INT_HIGH_1)) != 0),
|
||||
"At least one of GPIO_INT_LOW_0, GPIO_INT_HIGH_1 has to be "
|
||||
"enabled.");
|
||||
return api->pin_interrupt_configure(port, pin, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper to initialize a struct gpio_callback properly
|
||||
* @param callback A valid Application's callback structure pointer.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue