Commit 016f0d4f authored by Bartosz Bilas's avatar Bartosz Bilas Committed by Christopher Friedt
Browse files

gpio: add `gpio_is_ready_dt` function

Add `gpio_is_ready_dt` function that validates GPIO DT spec port
is ready and it allows the user to pass `gpio_dt_spec` directly.

Signed-off-by: default avatarBartosz Bilas <b.bilas@grinn-global.com>
parent 041e8530
Loading
Loading
Loading
Loading
+14 −0
Changes for include/zephyr/drivers/gpio.h: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -555,6 +555,20 @@ __subsystem struct gpio_driver_api {
 * @endcond
 */

/**
 * @brief Validate that GPIO port is ready.
 *
 * @param spec GPIO specification from devicetree
 *
 * @retval true if the GPIO spec is ready for use.
 * @retval false if the GPIO spec is not ready for use.
 */
static inline bool gpio_is_ready_dt(const struct gpio_dt_spec *spec)
{
	/* Validate port is ready */
	return device_is_ready(spec->port);
}

/**
 * @brief Configure pin interrupt.
 *